Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

THEORY OF AUTOMATA(CS-2208)

LECTURE# 01
INTRODUCTION

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 1


Overview

 Introduction to Course
 Formal and informal languages
 Alphabets, Strings, and Words
 Valid and invalid alphabets
 String length
 Reverse of string

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 2


What is Automata?

• The term Automata came from Greek the


word αὐτόματα which means “self
controlled”.
• Automata is plural of automaton, that
means “automation or something that works
automatically”.
• Examples: computer, ATM, and any
machine that has automatic mechanism is
an automata.
• Computers and all its programing
languages are based on this mechanism.

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 3


Objectives of Theory of
Automata
• Theory of automata is an area of computer science
that deals with abstract machines
(mathematical/theoretical models) and computational
problems.

• This course allows us to think systematic about what


machine does without going into H/W details.

• Learning of computational languages

• Building theoretical models of machines

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 4


Course Contents
• Finite State Models:
• Language definitions preliminaries,
• Regular expressions/Regular languages,
• Finite automata (FAs),
• Transition graphs (TGs),
• NFAs, Kleene’s theorem,
• Transducers (automata with output),
• Pumping lemma and non-regular language Grammars and PDA:
CFGs,
• Derivations, derivation trees and ambiguity,
• Simplifying CFLs,
• Normal form grammars and parsing,
• Chomsky’s hierarchy of grammars
• Turing Machines Theory

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 5


Book

• Introduction to computer theory, Daniel I. A.


Cohen, 2nd Edition

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 6


Grading Policy

• Assignments 10 %
• Quizzes 10 %
• Mid-Term 30 %
• Terminal 50%

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 7


Introduction to Languages

• There are two types of languages


− Formal Languages (Syntactic
languages)
− Informal Languages (Semantic
languages)

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 8


Alphabets
• Definition:
• A finite non-empty set of symbols (letters), is called an
alphabet. It is denoted by Σ ( Greek letter sigma).
• Σ contains symbol/character out of which we are going
to build a language for any machine. Set of letters are
called alphabets
• Example:
Σ={a,b}
Σ={0,1} important as this is the language which the
computer understands.
Σ={i,j,k}

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 9


Strings

• Definition:
Concatenation of finite symbols from the
alphabet is called a string.
• Example:
If Σ= {a,b} then
a, abab, aaabb, ababababababababab are
various strings of the language defined over
alphet {a,b}

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 10


Empty String or NULL String
 Sometimes a string with no symbol at all is
used, denoted by (Small Greek letter Lambda)
λ or (Capital Greek letter Lambda) Λ, is called
an empty string or null string.

 The capital lambda will mostly be used to


denote the empty string, in further discussion.

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 11


Words

• Definition:
Words are strings belonging to some language.
Example:
If Σ= {x} then a language L can be defined as
L={xn : n=1,2,3,…..} or L={x,xx,xxx,xxxx,….}
Here x,xx,xxx,… are the words of L
Note: All words are strings, but not all strings are
words.

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 12


Valid/In-valid alphabets

• While defining an alphabet, an alphabet may


contain letters consisting of group of symbols
for example

− Σ1= {B, aB, bab, d}.

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 13


Valid/In-valid alphabets Cont.
• Now consider an alphabet

Σ2= {B, Ba, bab, d} and a string BababB.

• As when this string is scanned by the compiler


(Lexical Analyzer),
• First symbol B is identified as a letter belonging to Σ,
• while for the second letter the lexical analyzer would
not be able to identify,
• So while defining an alphabet it should be kept in
mind that ambiguity should not be created.
Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 14
Valid/In-valid alphabets Cont.

This string can be tokenized in two different


ways
 (Ba), (bab), (B)
 (B), (abab), (B)
Which shows that the second group cannot
be identified as a string, defined over
Σ = {B, Ba, bab, d}

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 15


Remarks:

• While defining an alphabet of letters


consisting of more than one symbols, no
letter should be started with the letter of
the same alphabet i.e. one letter should
not be the prefix of another.
• However, a letter may be ended in the
letter of same alphabet i.e. one letter may
be the suffix of another.

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 16


Conclusion
• Σ1= {B, aB, bab, d}
• Σ2= {B, Ba, bab, d}

Σ1 is a valid alphabet while Σ2 is an in-valid


alphabet.

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 17


Length of Strings

• Definition:
The length of string s, denoted by |s|, is
the number of letters in the string.
• Example:
Σ={a,b}
s=ababa
|s|=5

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 18


Length of Strings Cont.

• Example:
Σ= {B, aB, bab, d}
s=BaBbabBd
Tokenizing = (B), (aB), (bab), (B),(d)
|s|=5

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 19


Reverse of a String
• Definition:
The reverse of a string s denoted by
Rev(s) or sr, is obtained by writing the
letters of s in reverse order.
• Example:
If s=abc is a string defined over Σ={a,b,c}
then Rev(s) or sr = cba

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 20


Reverse of a String

• Example:
Σ= {B, aB, bab, d}
s= BaBbabBd
Rev(s) = dBbabaBB

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 21

You might also like