Professional Documents
Culture Documents
DFA
For every string x, there is a unique path
from initial state and associated with x.
x
NFA
For any string x, there may exist none or
more than one path from initial state and
associated with x.
NFA DFA
Consider an NFA M=(Q, , , s, F).
For x in *, define
[x] = {q in Q | there exists a path s x
Define DFA M=(Q, , , s, F}:
Q = { [x] | x in * },
([x], a) = [xa] for x in * and a in ,
s = [],
F = { [x] | x in L(M) }
q}
Construction of M
Special Case: M has no -move.
[] = {s}
Suppose [x] is known. How to get [xa] for
a in ?
U (q,a)
q in [x]
p for
path
Construction of M
F = {[x] | x in L(M)}
= {[x] | [x] F }
Example 1
Construct DFA to accept 00(0+1)*
0
0, 1
1
1
0,1
Example 2
Design DFA to accept (0+1)*11
0
0 1
1
s
p
s
p
q
0
1
1
p
Example 3
Design DFA to accept 00(0+1)*11
0
0
0,1
0
p
q
0
r
0
q
t
Example 4
Construct DFA M for L(M)=.
Is this a DFA?
0,1
s
Example 5
Construct DFA M for L(M)=.
Is it a DFA?
0,1
0,1
Construction of M
For q in Q, define
q edger pathp }
= { p | for some q in [x] and r in (q,a),
p in -closure(r) }
= Uq in [x]U r in (q,a) -closure(r)
Construction of M
F = {[x] | x in L(M)}
= {[x] | [x] F }
Example 6
Construct DFA M for L(M)=(0+1)*.
0,1
q
0,1
s
p
q
0
1
p
q
0,1
Example 7
Convert the following NFA to DFA.
0
0
p
1
q
1
0
s
r
p
q, r, p
1
q
r s
p
0
1
0
0,1
s
0
0
0
b
0
d
1
s
s,a
1
s,b
1
s,c
1
s,d
1
s,e
s,a,b 0
s,a,b,c 0
s,a,b,c,d
s,a,b,c,d,e
2 =32
4