Module-1 - Introduction To Automata Theory
Module-1 - Introduction To Automata Theory
Introduction to Automata
Theory
09/01/2022
1
Models of Computation
09/01/2022 2
Computation
CPU memory
09/01/2022 3
temporary memory
input memory
CPU
output memory
Program memory
09/01/2022 4
3
Example: f ( x) x
temporary memory
input memory
CPU
output memory
Program memory
compute xx
2
09/01/2022
compute x x 5
3
f ( x) x
temporary memory
input memory
x2
CPU
output memory
Program memory
compute xx
2
09/01/2022
compute x x 6
3
temporary memory f ( x) x
z 2*2 4
f ( x) z * 2 8
input memory
x2
CPU
output memory
Program memory
compute xx
2
09/01/2022
compute x x 7
3
temporary memory f ( x) x
z 2*2 4
f ( x) z * 2 8
input memory
x2
CPU
f ( x) 8
Program memory output memory
compute xx
2
09/01/2022
compute x x 8
Automata theory is the study of
abstract machines and automata.
The computational problems can be
solved using them.
It is a theory in theoretical computer
science and discrete mathematics
09/01/2022 9
Automaton
temporary memory
Automaton
input memory
CPU
output memory
Program memory
09/01/2022 10
Different Kinds of Automata
Automata are distinguished by the temporary memory
09/01/2022 11
Finite Automaton
temporary memory
09/01/2022 12
Pushdown Automaton
Stack Push, Pop
09/01/2022 13
Turing Machine
input memory
Turing
Machine output memory
09/01/2022 14
Power of Automata
09/01/2022 15
Applications of finite automata
For the designing of lexical analysis of a compiler which breaks the
input text into logical units like identifiers, keywords etc.
For recognizing the pattern using regular expressions.
For the designing of the combination and sequential circuits.
Software for designing and checking the behavior of digital circuits.
Used in text editors.
For the implementation of spell checkers.
Software for scanning large bodies of text like web pages to find
occurrence of words, phrases and other patterns.
Software to verify all types that have finite number of distinct
states such as communications protocols for secure exchange of
information.
09/01/2022 16
Applications of Push Down Automata
09/01/2022 17
Applications of Turing machine
For solving any recursively enumerable problem.
For understanding complexity theory.
For implementation of neural networks.
For implementation of Robotics Applications.
For implementation of artificial intelligence.
09/01/2022 18
General Concepts of Automata Theory
• Alphabet
• Strings
• Empty Strings
• Length of the string
• Power of an Alphabet
• Concatenation of two strings
• Languages
09/01/2022
19
Alphabets and Strings
• We will use small alphabets: a, b
• Strings
a
ab u ab
abba
v bbbaaa
baba
aaabbbaabab w abba
09/01/2022
20
String Operations
w a1a2 an abba
v b1b2 bm bbbaaa
1. Concatenation
09/01/2022
21
2.Reverse
w a1a2 an ababaaabbb
w R an a2 a1 bbbaaababa
3. String Length
w a1a2 an Examples:
abba 4
Length: w n aa 2
a 1
09/01/2022 22
4. Length of Concatenation
uv u v
• Example: u aab, u 3
v abaab, v 5
uv aababaab 8
uv u v 3 5 8
09/01/2022
23
5. Empty String
• A string with no letters: or ϵ
• Observations:
0
w w w
09/01/2022
24
6. Substring
• Substring of string:
• a subsequence of consecutive characters
String Substring
abbab ab
abbab abba
abbab b
abbab bbab
09/01/2022
25
7. Prefix and Suffix
abbab
abbab w uv
Prefixes Suffixes
a bbab
ab bab prefix
abb ab suffix
abba b
abbab
09/01/2022
26
8. Another Operation
n
w ww
w
n
2
• Example: abba abbaabba
• Definition: w0
abba 0
09/01/2022
27
9. The * Operation
09/01/2022
28
10. The + Operation
: the set of all possible strings from
alphabet except
a, b
* , a, b, aa, ab, ba, bb, aaa, aab,
*
a, b, aa, ab, ba, bb, aaa, aab,
09/01/2022 29
Languages
• A language is a set of strings
09/01/2022
30
• A language is any subset of *
• Example:
a, b
* , a, b, aa, ab, ba, bb, aaa,
• Languages:
a, aa, aab
{ , abba, baba, aa, ab, aaaaaa}
09/01/2022
31
Note that
Sets { } {}
Set size {} 0
Set size {} 1
String length 0
09/01/2022 32
Another Example
An infinite language n n
L {a b : n 0}
ab
L abb L
aabb
aaaaabbbbb
09/01/2022
33
Operations on Languages
1. The usual set operations
a, ab, aaaabb, ab {a, ab, bb, aaaa}
a, ab, aaaabb, ab {ab}
a, ab, aaaa bb, ab a, aaaa
Complement: L * L
a, ba , b, aa, ab, bb, aaa,
09/01/2022
34
• L1= { ab,abb}
• L2= { abb,ba}
• Find L1U L2 = { ab,abb,ba}
• L1 –L2 = { ab}
• L1 = { abb}
09/01/2022
35
2. Reverse
Definition:
R R
L {w : w L}
R
Examples:
ab, aab, baba ba, baa, abab
n n
L {a b : n 0}
LR {b n a n : n 0}
09/01/2022
36
• L = { baa, ab,bb,aba }
• Find
09/01/2022
37
3.Concatenation
09/01/2022
38
4. Another Operation
• Definition: Ln LLL
n
3
a, b a, ba, ba, b
aaa, aab, aba, abb, baa, bab, bba, bbb
L0
• Special case:
a , bba , aaa 0
09/01/2022
39
More Examples
n n
L {a b : n 0}
2 n n m m
L {a b a b : n, m 0}
2
aabbaaabbb L
09/01/2022
40
5. Star-Closure (Kleene *)
Definition: 0 1 2
L* L L L
,
• Example:
a, bb,
a, bb*
aa , abb, bba , bbbb,
aaa, aabb, abba, abbbb,
09/01/2022
41
6. Positive Closure
1 2
L L L
Definition:
L *
a, bb,
a, bb aa, abb, bba, bbbb,
aaa, aabb, abba, abbbb,
09/01/2022
42
Language Recognizers : An example of Finite
Automata
09/01/2022 43
Finite Automaton
Input
String
Output
“Accept”
Finite or
Automaton “Reject”
09/01/2022
44
Representation of Finite Automata
1. Transition Graph
2. Transition Table
3. Regular Expression
09/01/2022 45
Transition Graph
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
initial accepting
state state state
transition
09/01/2022
46
Initial Configuration
Input String
a b b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
47
Reading the Input
a b b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
48
a b b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
49
a b b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
50
a b b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
51
Input finished
a b b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
accept
09/01/2022 52
Rejection
a b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
53
a b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
54
a b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
55
a b a
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
56
Input finished
a b a
a, b
reject
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022 57
Another Rejection
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
09/01/2022
58
a, b
q5
a, b
b a a b
q0 a q1 b q2 b q3 a q4
reject
09/01/2022
59
Another Example
a a b
a a, b
b a, b
q0 q1 q2
09/01/2022 60
a a b
a a, b
b a, b
q0 q1 q2
09/01/2022 61
a a b
a a, b
b a, b
q0 q1 q2
09/01/2022 62
a a b
a a, b
b a, b
q0 q1 q2
09/01/2022 63
Input finished
a a b
a a, b
accept
b a, b
q0 q1 q2
09/01/2022 64
Rejection Example
b a b
a a, b
b a, b
q0 q1 q2
09/01/2022 65
b a b
a a, b
b a, b
q0 q1 q2
09/01/2022 66
b a b
a a, b
b a, b
q0 q1 q2
09/01/2022 67
b a b
a a, b
b a, b
q0 q1 q2
09/01/2022 68
Input finished
b a b
a a, b
b a, b
q0 q1 q2
reject
09/01/2022 69
Languages Accepted by FAs
Definition:
09/01/2022
70
Example
LM abba M
a, b
q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4
accept
09/01/2022
71
Example
LM , ab, abba M
a, b
q5
b a a a, b
b
q0 a q1 b q2 b q3 a q4
accept accept accept
09/01/2022
72
Example
n
LM {a b : n 0}
a a, b
b a, b
q0 q1 q2