Finite automata
-
Upload
lavishkaanuj -
Category
Technology
-
view
2.059 -
download
9
description
Transcript of Finite automata
![Page 1: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/1.jpg)
1
Theory of Automata &
Formal Languages
![Page 2: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/2.jpg)
2
BOOKS
Theory of computer Science: K.L.P.Mishra &
N.Chandrasekharan
Intro to Automata theory, Formal languages and computation: Ullman,Hopcroft
Motwani
Elements of theory of computation Lewis & papadimitrou
![Page 3: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/3.jpg)
3
Syllabus
Introduction
Deterministic and non deterministic Finite Automata, Regular Expression,Two way finite automata,Finite automata with output,properties of regular sets,pumping lemma, closure properties,Myhill nerode theorem
![Page 4: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/4.jpg)
4
Context free Grammar: Derivation trees, Simplification forms
Pushdown automata: Def, Relationship between PDA and context free language,Properties, decision algorithms
Turing Machines: Turing machine model,Modification of turing machines,Church’s thesis,Undecidability,Recursive and recursively enumerable languages Post correspondence problems recursive functions
![Page 5: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/5.jpg)
5
Chomsky Hierarchy: Regular grammars, unrestricted grammar, context sensitive language, relationship among languages
![Page 6: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/6.jpg)
6
![Page 7: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/7.jpg)
7
![Page 8: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/8.jpg)
8
Finite AutomatonInput
String
•
Output
String
FiniteAutomaton
![Page 9: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/9.jpg)
9
Finite Accepter
•
Input
“Accept” or“Reject”
String
FiniteAutomaton
Output
![Page 10: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/10.jpg)
10
Transition Graph
•
initialstate
final state“accept”state
transition
Abba -Finite Accepter
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
![Page 11: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/11.jpg)
11
Initial Configuration
•
1q 2q 3q 4qa b b a
5q
a a bb
ba,
Input Stringa b b a
ba,
0q
![Page 12: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/12.jpg)
12
Reading the Input
•
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
![Page 13: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/13.jpg)
13
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
![Page 14: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/14.jpg)
14
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
![Page 15: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/15.jpg)
15
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
![Page 16: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/16.jpg)
16
0q 1q 2q 3q 4qa b b a
Output: “accept”
5q
a a bb
ba,
a b b a
ba,
Input finished
![Page 17: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/17.jpg)
17
Rejection
•
1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
0q
![Page 18: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/18.jpg)
18
•
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
![Page 19: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/19.jpg)
19
•
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
![Page 20: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/20.jpg)
20
•
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
![Page 21: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/21.jpg)
21
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
Output:“reject”
a b a
ba,
Input finished
![Page 22: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/22.jpg)
22
Another Example
a
b ba,
ba,
0q 1q 2q
a ba
![Page 23: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/23.jpg)
23
a
b ba,
ba,
0q 1q 2q
a ba
![Page 24: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/24.jpg)
24
a
b ba,
ba,
0q 1q 2q
a ba
![Page 25: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/25.jpg)
25
a
b ba,
ba,
0q 1q 2q
a ba
![Page 26: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/26.jpg)
26
a
b ba,
ba,
0q 1q 2q
a ba
Output: “accept”
Input finished
![Page 27: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/27.jpg)
27
Rejection
a
b ba,
ba,
0q 1q 2q
ab b
![Page 28: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/28.jpg)
28
a
b ba,
ba,
0q 1q 2q
ab b
![Page 29: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/29.jpg)
29
a
b ba,
ba,
0q 1q 2q
ab b
![Page 30: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/30.jpg)
30
a
b ba,
ba,
0q 1q 2q
ab b
![Page 31: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/31.jpg)
31
a
b ba,
ba,
0q 1q 2q
ab b
Output: “reject”
Input finished
![Page 32: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/32.jpg)
32
• Deterministic Finite Accepter (DFA)
FqQM ,,,, 0
Q
0q
F
: Finite set of states
: input alphabet
: transition function
: initial state is a member of Q
: set of final states
: Q X Q
![Page 33: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/33.jpg)
33
Input Alphabet
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
ba,
![Page 34: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/34.jpg)
34
Set of States
Q
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
543210 ,,,,, qqqqqqQ
ba,
![Page 35: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/35.jpg)
35
Initial State
0q
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q
![Page 36: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/36.jpg)
36
Set of Final States
F
0q 1q 2q 3qa b b a
5q
a a bb
ba,
4qF
ba,
4q
![Page 37: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/37.jpg)
37
Transition Function
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
QQ :
ba,
![Page 38: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/38.jpg)
38
10 , qaq
2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q 1q
![Page 39: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/39.jpg)
39
50 , qbq
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q
![Page 40: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/40.jpg)
40
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
32 , qbq
![Page 41: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/41.jpg)
41
Transition Function
•
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b
0q
1q
2q
3q
4q
5q
1q 5q
5q 2q
2q 3q
4q 5q
ba,5q5q5q5q
![Page 42: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/42.jpg)
42
Extended Transition Function
*
QQ *:*
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
![Page 43: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/43.jpg)
43
20 ,* qabq
3q 4qa b b a
5q
a a bb
ba,
ba,
0q 1q 2q
![Page 44: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/44.jpg)
44
40 ,* qabbaq
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
![Page 45: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/45.jpg)
45
50 ,* qabbbaaq
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q
![Page 46: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/46.jpg)
46
50 ,* qabbbaaq
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q
Observation: There is a walk from to with label
0qabbbaa
5q
![Page 47: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/47.jpg)
47
Recursive Definition
•
)),,(*(,*
,*
awqwaq
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
![Page 48: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/48.jpg)
48
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
2
1
0
0
0
0
,
,,
,,,*
),,(*
,*
q
bq
baq
baq
baq
abq
![Page 49: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/49.jpg)
49
Languages Accepted by DFAs• Take DFA
• Definition:
– The language contains – all input strings accepted by
– = { strings that drive to a final state}
M
MLM
M ML
![Page 50: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/50.jpg)
50
Example
•
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
abbaML M
accept
![Page 51: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/51.jpg)
51
Another Example
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
abbaabML ,, M
acceptacceptaccept
•
![Page 52: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/52.jpg)
52
Formally
• For a DFA Language accepted by :
FqQM ,,,, 0
M
FwqwML ,*:* 0
alphabet transitionfunction
initialstate
finalstates
![Page 53: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/53.jpg)
53
Observation
• Language accepted by :
• Language rejected by :
FwqwML ,*:* 0M
FwqwML ,*:* 0M
![Page 54: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/54.jpg)
54
More Examples•
a
b ba,
ba,
0q 1q 2q
}0:{ nbaML n
accept trap state or dead state
![Page 55: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/55.jpg)
55
•
ML = { all strings with prefix }ab
a b
ba,
0q 1q 2q
accept
ba,3q
ab
![Page 56: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/56.jpg)
56
•
ML = { all strings without substring }001
0 00 001
1
0
1
10
0 1,0
![Page 57: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/57.jpg)
57
Regular Languages
• A language is regular if there is
• a DFA such that
• All regular languages form a language family–
LM MLL
![Page 58: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/58.jpg)
58
Example
• The language
• is regular:
•
*,: bawawaL
a
b
ba,
a
b
ba
0q 2q 3q
4q
![Page 59: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/59.jpg)
59
Non Deterministic Automata
![Page 60: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/60.jpg)
60
Non Deterministic Finite Accepter
FqQM ,,,, 0
: 2QQ
![Page 61: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/61.jpg)
61
1q 2q
3q
a
a
a
0q
}{aAlphabet =
Nondeterministic Finite Accepter (NFA)
![Page 62: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/62.jpg)
62
1q 2q
3q
a
a
a
0q
Two choices
}{aAlphabet =
Nondeterministic Finite Accepter (NFA)
![Page 63: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/63.jpg)
63
No transition
1q 2q
3q
a
a
a
0q
Two choices No transition
}{aAlphabet =
Nondeterministic Finite Accepter (NFA)
![Page 64: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/64.jpg)
64
a a
0q
1q 2q
3q
a
a
First Choice
a
![Page 65: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/65.jpg)
65
a a
0q
1q 2q
3q
a
a
a
First Choice
![Page 66: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/66.jpg)
66
a a
0q
1q 2q
3q
a
a
First Choice
a
![Page 67: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/67.jpg)
67
a a
0q
1q 2q
3q
a
a
a “accept”
First Choice
All input is consumed
![Page 68: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/68.jpg)
68
a a
0q
1q 2q
3q
a
a
Second Choice
a
![Page 69: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/69.jpg)
69
a a
0q
1q 2qa
a
Second Choice
a
3q
![Page 70: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/70.jpg)
70
a a
0q
1q 2qa
a
a
3q
Second Choice
No transition:the automaton hangs
![Page 71: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/71.jpg)
71
a a
0q
1q 2qa
a
a
3q
Second Choice
“reject”
Input cannot be consumed
![Page 72: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/72.jpg)
72
An NFA accepts a string:
when there is a computation of the NFAthat accepts the string
•All the input is consumed and the automaton is in a final state
![Page 73: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/73.jpg)
73
An NFA rejects a string:
when there is no computation of the NFAthat accepts the string
• All the input is consumed and the automaton is in a non final state
• The input cannot be consumed
![Page 74: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/74.jpg)
74
Example
aa is accepted by the NFA:
0q
1q 2q
3q
a
a
a
“accept”
0q
1q 2qa
a
a
3q “reject”
because this computationaccepts aa
![Page 75: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/75.jpg)
75
a
0q
1q 2q
3q
a
a
Rejection example
a
![Page 76: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/76.jpg)
76
a
0q
1q 2q
3q
a
a
a
First Choice
![Page 77: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/77.jpg)
77
a
0q
1q 2q
3q
a
a
a
First Choice
“reject”
![Page 78: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/78.jpg)
78
Second Choice
a
0q
1q 2q
3q
a
a
a
![Page 79: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/79.jpg)
79
Second Choice
a
0q
1q 2qa
a
a
3q
![Page 80: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/80.jpg)
80
Second Choice
a
0q
1q 2qa
a
a
3q “reject”
![Page 81: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/81.jpg)
81
Examplea is rejected by the NFA:
0q
1q 2qa
a
a
3q “reject”
0q
1q 2qa
a
a
3q
“reject”
All possible computations lead to rejection
![Page 82: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/82.jpg)
82
Rejection example
a a
0q
1q 2q
3q
a
a
a
a
![Page 83: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/83.jpg)
83
a a
0q
1q 2q
3q
a
a
a
First Choice
a
![Page 84: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/84.jpg)
84
a a
0q
1q 2q
3q
a
a
First Choice
a
a
No transition:the automaton hangs
![Page 85: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/85.jpg)
85
a a
0q
1q 2q
3q
a
a
a “reject”
First Choice
a
Input cannot be consumed
![Page 86: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/86.jpg)
86
a a
0q
1q 2q
3q
a
a
Second Choice
a
a
![Page 87: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/87.jpg)
87
a a
0q
1q 2qa
a
Second Choice
a
3q
a
![Page 88: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/88.jpg)
88
a a
0q
1q 2qa
a
a
3q
Second Choice
No transition:the automaton hangs
a
![Page 89: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/89.jpg)
89
a a
0q
1q 2qa
a
a
3q
Second Choice
“reject”
a
Input cannot be consumed
![Page 90: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/90.jpg)
90
aaais rejected by the NFA:
0q
1q 2q
3q
a
a
a
“reject”
0q
1q 2qa
a
a
3q “reject”
All possible computations lead to rejection
![Page 91: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/91.jpg)
91
1q 2q
3q
a
a
a
0q
Language accepted: }{aaL
![Page 92: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/92.jpg)
92
Lambda →Transitions
1q 3qa0q
2q a
![Page 93: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/93.jpg)
93
a a
1q 3qa0q
2q a
![Page 94: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/94.jpg)
94
a a
1q 3qa0q
2q a
![Page 95: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/95.jpg)
95
a a
1q 3qa0q
2q a
(read head doesn’t move)
![Page 96: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/96.jpg)
96
a a
1q 3qa0q
2q a
![Page 97: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/97.jpg)
97
a a
1q 3qa0q
2q a
“accept”
String is acceptedaa
all input is consumed
![Page 98: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/98.jpg)
98
a a
1q 3qa0q
2q a
Rejection Example
a
![Page 99: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/99.jpg)
99
a a
1q 3qa0q
2q a
a
![Page 100: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/100.jpg)
100
a a
1q 3qa0q
2q a
(read head doesn’t move)
a
![Page 101: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/101.jpg)
101
a a
1q 3qa0q
2q a
a
No transition:the automaton hangs
![Page 102: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/102.jpg)
102
a a
1q 3qa0q
2q a
“reject”
String is rejectedaaa
a
Input cannot be consumed
![Page 103: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/103.jpg)
103
Language accepted: }{aaL
1q 3qa0q
2q a
![Page 104: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/104.jpg)
104
Another NFA Example
0q 1q 2qa b
3q
![Page 105: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/105.jpg)
105
a b
0q 1q 2qa b
3q
![Page 106: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/106.jpg)
106
0q 2qa b
3q
a b
1q
![Page 107: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/107.jpg)
107
a b
0q 1qa b
3q2q
![Page 108: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/108.jpg)
108
a b
0q 1qa b
3q2q
“accept”
![Page 109: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/109.jpg)
109
0qa b
a b
Another String
a b
1q 2q 3q
![Page 110: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/110.jpg)
110
0qa b
a b a b
1q 2q 3q
![Page 111: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/111.jpg)
111
0qa b
a b a b
1q 2q 3q
![Page 112: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/112.jpg)
112
0qa b
a b a b
1q 2q 3q
![Page 113: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/113.jpg)
113
0qa b
a b a b
1q 2q 3q
![Page 114: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/114.jpg)
114
0qa b
a b a b
1q 2q 3q
![Page 115: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/115.jpg)
115
0qa b
a b a b
1q 2q 3q
![Page 116: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/116.jpg)
116
a b a b
0qa b
1q 2q 3q
“accept”
![Page 117: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/117.jpg)
117
ab
ababababababL ...,,,
Language accepted
0q 1q 2qa b
3q
![Page 118: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/118.jpg)
118
Another NFA Example
0q 1q 2q0
11,0
![Page 119: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/119.jpg)
119
{ }{ } *10=
...,101010,1010,10,λ=)(ML
0q 1q 2q0
11,0
Language accepted
![Page 120: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/120.jpg)
120
Remarks:
•The symbol never appears on the input tape
0q2M
0q1M
{}=)M(L 1 }λ{=)M(L 2
•Extreme automata:
![Page 121: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/121.jpg)
121
0q
2q
1qa
0q 1qa
}{=)( 1 aML
2M1M
}{=)( 2 aML
NFA DFA
•NFAs are interesting because we can express languages easier than DFAs
ba,b
a,b
![Page 122: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/122.jpg)
122
Formal Definition of NFAs
FqQM ,,,, 0
:Q
::0q
:F
Set of states, i.e. 210 ,, qqq
: Input alphabet, i.e. ba,
Transition function
Initial state
Final states
![Page 123: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/123.jpg)
123
10 1, qq
0
11,0
Transition Function
0q 1q 2q
![Page 124: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/124.jpg)
124
0q
0
11,0
},{)0,( 201 qqq
1q 2q
![Page 125: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/125.jpg)
125
0q
0
11,0
1q 2q
},{),( 200 qqq
![Page 126: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/126.jpg)
126
0q
0
11,0
1q 2q
)1,( 2q
![Page 127: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/127.jpg)
127
Extended Transition Function
•
*
0q
5q4q
3q2q1qa
aa
b
10 ,* qaq
![Page 128: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/128.jpg)
128
540 ,,* qqaaq
0q
5q4q
3q2q1qa
aa
b
![Page 129: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/129.jpg)
129
0320 ,,,* qqqabq
0q
5q4q
3q2q1qa
aa
b
![Page 130: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/130.jpg)
130
Formally
wqq ij ,*
It holdsif and only if
there is a walk from towith label
iq jqw
![Page 131: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/131.jpg)
131
The Language of an NFA
•
0q
5q4q
3q2q1qa
aa
b
540 ,,* qqaaq
M
)(MLaa
50 ,qqF
![Page 132: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/132.jpg)
132
0q
5q4q
3q2q1qa
aa
b
0320 ,,,* qqqabq MLab
50 ,qqF
![Page 133: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/133.jpg)
133
•
0q
5q4q
3q2q1qa
aa
b
50 ,qqF
540 ,,* qqabaaq )(MLaaba
![Page 134: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/134.jpg)
134
0q
5q4q
3q2q1qa
aa
b
50 ,qqF
10 ,* qabaq MLaba
![Page 135: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/135.jpg)
135
0q
5q4q
3q2q1qa
aa
b
aaababaaML *
![Page 136: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/136.jpg)
136
Formally
• The language accepted by NFA is:
• where
• and there is some
M
,...,, 321 wwwML
,...},{),(* 0 jim qqwq
Fqk (final state)
![Page 137: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/137.jpg)
137
•
0q kq
w
w
w
),(* 0 wq MLw
Fqk
iq
jq
![Page 138: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/138.jpg)
138
Equivalence of NFAs and DFAs
![Page 139: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/139.jpg)
139
Equivalence of Machines
• For DFAs or NFAs:
• Machine is equivalent to machine
• if
•
1M 2M
21 MLML
![Page 140: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/140.jpg)
140
• 0q 1q 2q
0
11,0
0q 1q 2q
0
11
0
1,0
NFA
DFA
*}10{1 ML
*}10{2 ML
1M
2M
![Page 141: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/141.jpg)
141
• Since
• machines and are equivalent
*1021 MLML
1M 2M
0q 1q 2q
0
11,0
0q 1q 2q
0
11
0
1,0
DFA
NFA 1M
2M
![Page 142: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/142.jpg)
142
Equivalence of NFAs and DFAs
Question: NFAs = DFAs ?
Same power?Accept the same languages?
![Page 143: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/143.jpg)
143
Equivalence of NFAs and DFAs
Question: NFAs = DFAs ?
Same power?Accept the same languages?
YES!
![Page 144: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/144.jpg)
144
We will prove:
Languages acceptedby NFAs
Languages acceptedby DFAs
NFAs and DFAs have the same computation power
![Page 145: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/145.jpg)
145
Languages acceptedby NFAs
Languages acceptedby DFAs
Step 1
Proof: Every DFA is trivially an NFA
A language accepted by a DFAis also accepted by an NFA
![Page 146: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/146.jpg)
146
Languages acceptedby NFAs
Languages acceptedby DFAs
Step 2
Proof: Any NFA can be converted to anequivalent DFA
A language accepted by an NFAis also accepted by a DFA
![Page 147: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/147.jpg)
147
NFA to DFA
•
a
b
a
0q 1q 2q
NFA
DFA
0q
M
M
![Page 148: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/148.jpg)
148
•
a
b
a
0q 1q 2q
NFA
DFA
0q 21,qqa
M
M
![Page 149: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/149.jpg)
149
•
a
b
a
0q 1q 2q
NFA
DFA
0q 21,qqa
b
M
M
![Page 150: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/150.jpg)
150
•
a
b
a
0q 1q 2q
NFA
DFA
0q 21,qqa
b
a
M
M
![Page 151: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/151.jpg)
151
•
a
b
a
0q 1q 2q
NFA
DFA
0q 21,qqa
b
ab
M
M
![Page 152: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/152.jpg)
152
•
a
b
a
0q 1q 2q
NFA
DFA
0q 21,qqa
b
ab
ba,
M
M
![Page 153: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/153.jpg)
153
•
a
b
a
0q 1q 2q
NFA
DFA
0q 21,qqa
b
ab
ba,
M
M
)(MLML
![Page 154: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/154.jpg)
154
NFA to DFA: Remarks
• We are given an NFA
• We want to convert it to an equivalent DFA
M
M
)(MLML
![Page 155: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/155.jpg)
155
• If the NFA has states
• the DFA has states in the power set
•
,...,, 210 qqq
,....,,,,,,, 7432110 qqqqqqq
![Page 156: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/156.jpg)
156
Procedure NFA to DFA
•
• 1. Initial state of NFA:
•
• Initial state of DFA:
0q
0q
![Page 157: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/157.jpg)
157
•
a
b
a
0q 1q 2q
NFA
DFA
0q
M
M
![Page 158: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/158.jpg)
158
Procedure NFA to DFA
• 2. For every DFA’s state
• Compute in the NFA
•
• Add transition to DFA
},...,,{ mji qqq
...
,,*
,,*
aq
aq
j
i
},...,,{ mji qqq
},...,,{},,...,,{ mjimji qqqaqqq
![Page 159: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/159.jpg)
159
•
a
b
a
0q 1q 2q
NFA
0q 21,qqa
DFA
},{),(* 210 qqaq
210 ,, qqaq
M
M
},{),(* 210 qqaq
![Page 160: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/160.jpg)
160
Procedure NFA to DFA
• Repeat Step 2 for all letters in alphabet,
• until
• no more transitions can be added.
![Page 161: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/161.jpg)
161
•
a
b
a
0q 1q 2q
NFA
DFA
0q 21,qqa
b
ab
ba,
M
M
![Page 162: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/162.jpg)
162
Procedure NFA to DFA
• 3. For any DFA state
• If some is a final state in the NFA
• Then, • is a final state in the DFA•
},...,,{ mji qqq
jq
},...,,{ mji qqq
![Page 163: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/163.jpg)
163
•
a
b
a
0q 1q 2q
NFA
DFA
0q 21,qqa
b
ab
ba,
Fq 1
Fqq 21,
M
M
![Page 164: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/164.jpg)
164
Theorem
• Take NFA M
Apply procedure to obtain DFA M
Then and are equivalent :M M
MLML
![Page 165: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/165.jpg)
165
FinallyWe have proven
Languages acceptedby NFAs
Languages acceptedby DFAs
![Page 166: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/166.jpg)
166
Languages acceptedby NFAs
Languages acceptedby DFAs
We have proven
Regular Languages
![Page 167: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/167.jpg)
167
Languages acceptedby NFAs
Languages acceptedby DFAs
We have proven
Regular LanguagesRegular Languages
![Page 168: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/168.jpg)
168
Languages acceptedby NFAs
Languages acceptedby DFAs
We have proven
Regular LanguagesRegular Languages
Thus, NFAs accept the regular languages
![Page 169: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/169.jpg)
169
Single Final State for NFAs and DFAs
![Page 170: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/170.jpg)
170
Observation
• Any Finite Automaton (NFA or DFA)
• can be converted to an equivalent NFA
• with a single final state
![Page 171: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/171.jpg)
171
a
b
b
aNFA
Equivalent NFA
a
b
b
a
Example
![Page 172: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/172.jpg)
172
NFAIn General
Equivalent NFA
Singlefinal state
![Page 173: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/173.jpg)
173
Extreme Case
NFA without final state
Add a final stateWithout transitions
![Page 174: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/174.jpg)
174
Some Properties of Regular Languages
![Page 175: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/175.jpg)
175
1L2L
21LLConcatenation:
*1LStar:
21 LL Union:
Are regularLanguages
For regular languages and we will prove that:
properties
![Page 176: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/176.jpg)
176
We Say:Regular languages are closed under
21LLConcatenation:
*1LStar:
21 LL Union:
![Page 177: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/177.jpg)
177
Properties
1L 2L
21LLConcatenation:
*1LStar:
21 LL Union:
Are regularLanguages
For regular languages and we will prove that:
![Page 178: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/178.jpg)
178
1LRegular language
11 LML
1M
Single final state
NFA 2M
2L
Single final state
22 LML
Regular language
NFA
![Page 179: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/179.jpg)
179
Example
}{1 baL na
b 1M
baL 2ab
2M
![Page 180: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/180.jpg)
180
Union
• NFA for 1M
2M
21 LL
![Page 181: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/181.jpg)
181
• a
b
ab
}{1 baL n
}{2 baL
}{}{21 babaLL n NFA for
![Page 182: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/182.jpg)
182
Concatenation
• NFA for
21LL
1M 2M
![Page 183: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/183.jpg)
183
Example
•
• NFA for
a
b ab
}{1 baL n}{2 baL
}{}}{{21 bbaababaLL nn
![Page 184: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/184.jpg)
184
Star Operation• NFA for *1L
1M
*1L
![Page 185: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/185.jpg)
185
Example
• NFA for
*}{*1 baL n
a
b
}{1 baL n
N>= 0
![Page 186: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/186.jpg)
186
Procedure: NFA to DFA
1 Create a graph with vertex {q0}.Identify this vertex as initial vertex of DFA.
2 Repeat the following steps until no more edges are missing.Take any vertex {qi,qj,….qk} of G that has no outgoing edge for some symbol a of the alphabet.Compute (qi, a), (qj, a)…. (qk, a)Then form the union of all these yielding the set {ql, qm, …qn}.Create a vertex for G labeled {ql, qm,…qn} if it does not already exist.Add to G an edge from {qi, qj,…qk} to {ql,qm…qn} and label it with a.
3 Every state of G whose label contains any qf of F is identified as a final vertex of DFA.
4 If NFA accepts then vertex {q0} in G is also made a final vertex.
**
*
*
![Page 187: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/187.jpg)
187
q0 q2q10,1 0,1
10
![Page 188: Finite automata](https://reader033.fdocuments.us/reader033/viewer/2022061209/548cad88b4795931018b49ed/html5/thumbnails/188.jpg)
188
q0
{q0,q1}
q1
q0,q1,q2q1,q2
q2
0
01
1
0
0,1
0,1
1
1
0,1
Equivalent DFA
Start
0