Lecture # 4: Theory of Automata by Dr. MM Alam
Lecture # 4: Theory of Automata by Dr. MM Alam
Theory Of Automata
By
Dr. MM Alam
Lecture#3 Recap
• Plus Operation Examples
• Four way of defining languages
• Examples for Descriptive way of defining
languages
Recursive way
A recursive definition is fundamentally a three-step
process:
• We specify some basic objects in the set. The number
of basic objects specified must be finite. This means
that we write some basic facts about the set
• Second, we give a finite number of basic rules for
constructing more objects in the set from the ones
we already know.
• Finally, we provide declaration that no objects except
those constructed in this way are allowed in the set.
Language of Integer
Defining language of INTEGER
Rule 1: 1 is in INTEGER.
2 is in P-EVEN by Rule 1.
2 + 2 = 4 is in P-EVEN by Rule 2.
4 + 4 = 8 is in P-EVEN by Rule 2.
4 + 8 = 12 is in P-EVEN by Rule 2.
• Example: Let PALINDROME be the set of all
strings over the alphabet = {a, b}
PALINDROME = {w : w = reverse(w)} = {Λ, a, b,
aa, bb, aaa, aba, bab, bbb, aaaa, abba, . . .}.
A recursive definition for PALINDROME is as
follows:
• Rule 1: , a, and b are in PALINDROME.
• Rule 2: If w 2 PALINDROME, then so are awa
and bwb.
• Rule 3: No other string is in PALINDROME
unless it can be produced by rules 1 and 2.
Regular Expressions
• Regular expressions is a common means of
defining a language. It actually provide concise
matching of string.
• The concept is associated with the Kleenes
formalism of regular sets introduced in 1950
• Useful operators used in the regular
expression are as follows:
* = 0 or more
+ = 1 or more
a|b = a or b
(a|b)* = (a or b) 0 or more times
(a|b)+ = (a or b) 1 or more times
a|b* = a or b (only b 0 or more times)
(a|b)*(c|Λ) = (a or b) 0 or more times and c or
Null string
• Construct a regular expression for all words in
which a appears tripled, if at all. This means
that every clump of a’s contains 3 or 6 or 9 or
12... a’s
• (aaa + b)* or (b + aaa)* or ((aaa)*b*)* or
(b*(aaa)*)*
• Construct a regular expression for all words
that contain at least one of the strings s1, s2,
s3, or s4
• (s1 + s2 + s3 + s4)(s1 + s2 + s3 + s4)*
Lecture#4 Summary
• Recursive way of defining languages
• Recursive way examples
• Regular expressions
• Regular expression examples