9. CONVERT NFA TO FA
9
a
b
a
0
q 1
q 2
q
NFA
FA
0
q
M
M
10. CONVERT NFA TO FA
10
a
b
a
0
q 1
q 2
q
NFA
FA
0
q
2
1,q
q
a
M
M
11. CONVERT NFA TO FA
11
a
b
a
0
q 1
q 2
q
NFA
FA
0
q
2
1,q
q
a
b
M
M
12. CONVERT NFA TO FA
12
a
b
a
0
q 1
q 2
q
NFA
FA
0
q
2
1,q
q
a
b
a
M
M
13. CONVERT NFA TO FA
13
a
b
a
0
q 1
q 2
q
NFA
FA
0
q
2
1,q
q
a
b
a
b
M
M
14. CONVERT NFA TO FA
14
a
b
a
0
q 1
q 2
q
NFA
FA
0
q
2
1,q
q
a
b
a
b
b
a,
M
M
15. CONVERT NFA TO FA
15
a
b
a
0
q 1
q 2
q
NFA
FA
0
q
2
1,q
q
a
b
a
b
b
a,
M
M
)
(M
L
M
L
16. NFA TO FA CONVERSION
We are given an NFA
We want to convert it
to an equivalent FA
With
16
M
M
)
(M
L
M
L
17. WHAT WE NEED TO CONSTRUCT
Finite Automaton (FA)
17
F
q
Q
M ,
,
,
, 0
Q
0
q
F
: set of states
: input alphabet
: transition function
: initial state
: set of accepting states
18. If the NFA has states
the FA has states in the power set
18
,...
,
, 2
1
0 q
q
q
,....
,
,
,
,
,
,
, 7
4
3
2
1
1
0 q
q
q
q
q
q
q
19. PROCEDURE NFA TO FA
1. Initial state of NFA:
Initial state of FA:
19
0
q
0
q
21. PROCEDURE NFA TO FA
2. For every FA’s state
Compute in the NFA
Add transition to FA
21
}
,...,
,
{ m
j
i q
q
q
...
,
,
*
,
,
*
a
q
a
q
j
i
}
,...,
,
{ m
j
i q
q
q
}
,...,
,
{
},
,...,
,
{ m
j
i
m
j
i q
q
q
a
q
q
q
25. PROCEDURE NFA TO FA
3. For any FA state
If is accepting state in NFA
Then,
is accepting state in FA
25
}
,...,
,
{ m
j
i q
q
q
j
q
}
,...,
,
{ m
j
i q
q
q
32. 32
0
q f
q
k
w
2
1
1
2
k
:
M
}
{ 0
q
1
2
k
:
M
}
,
{
f
q
)
(M
L
w
)
(M
L
w
We will show that if
then
33. 33
0
q m
q
n
a
a
a
v
2
1
1
a 2
a n
a
:
M
}
{ 0
q
1
a 2
a n
a
:
M
}
,
{
i
q
i
q j
q l
q
}
,
{
j
q }
,
{
l
q }
,
{
m
q
More generally, we will show that if in :
M
(arbitrary string)
then
35. 35
Induction hypothesis: k
v
|
|
1
0
q d
q
1
a 2
a k
a
:
M i
q j
q c
q
}
{ 0
q
1
a 2
a k
a
:
M
}
,
{
i
q }
,
{
j
q }
,
{
c
q }
,
{
d
q
k
a
a
a
v
2
1
36. 36
Induction Step: 1
|
|
k
v
0
q d
q
1
a 2
a k
a
:
M i
q j
q c
q
}
{ 0
q
1
a 2
a k
a
:
M
}
,
{
i
q }
,
{
j
q }
,
{
c
q }
,
{
d
q
1
1
2
1
k
k
v
k a
v
a
a
a
a
v
v
v
37. 37
Induction Step: 1
|
|
k
v
0
q d
q
1
a 2
a k
a
:
M i
q j
q c
q
}
{ 0
q
1
a 2
a k
a
:
M
}
,
{
i
q }
,
{
j
q }
,
{
c
q }
,
{
d
q
1
1
2
1
k
k
v
k a
v
a
a
a
a
v
v
v
e
q
1
k
a
1
k
a
}
,
{
e
q
38. 38
0
q f
q
k
w
2
1
1
2
k
:
M
}
{ 0
q
1
2
k
:
M
}
,
{
f
q
)
(M
L
w
)
(M
L
w
Therefore if
then
39. 39
We have shown:
M
L
M
L
We also need to show:
M
L
M
L
(proof is similar)
40. 40
Induction Step: 1
|
|
k
v
0
q d
q
1
a 2
a k
a
:
M i
q j
q c
q
}
{ 0
q
1
a 2
a k
a
:
M
}
,
{
i
q }
,
{
j
q }
,
{
c
q }
,
{
d
q
1
1
2
1
k
k
v
k a
v
a
a
a
a
v
v
v
e
q
1
k
a
1
k
a
}
,
{
e
q
All cases covered?
49. 49
We say: Regular languages are closed under
2
1L
L
Concatenation:
*
1
L
Star:
2
1 L
L
Union:
1
L
2
1 L
L
Complement:
Intersection:
R
L1
Reversal:
50. 50
1
L
Regular language
1
1 L
M
L
1
M
Single accepting state
NFA 2
M
2
L
Single accepting state
2
2 L
M
L
Regular language
NFA
56. 56
How do we construct automata for the
remaining operations?
2
1L
L
Concatenation:
*
1
L
Star:
2
1 L
L
Union:
1
L
2
1 L
L
Complement:
Intersection:
R
L1
Reversal:
71. 71
M simulates in parallel and
1
M 2
M
M accepts string w if and only if
accepts string and
w
1
M
accepts string w
2
M
)
(
)
(
)
( 2
1 M
L
M
L
M
L
72. 72
Example: what are the DFAs for the
Following:
}
{
1 b
a
L n
a
b
1
M
0
n
}
{
2
n
ab
L
b
b
2
M
0
q 1
q 0
p 1
p
0
n
2
q 2
p
a
a
b
a, b
a,
b
a,
74. 74
0
0, p
q
Automaton for intersection
}
{
}
{
}
{ ab
ab
b
a
L n
n
1
0, p
q
a
2
1, p
q
b
a
b 1
1, p
q
2
0, p
q
a
1
2, p
q
2
2, p
q
b
b
a,
a
b
b
a,
b
a