NFAs Labeled Multi Digraphs THEOREM If MQ q
NFAs Labeled Multi. Digraphs THEOREM If M=(Q, , , q 0, F) is an NFA, then G=(Q, E, f) is a labeled multiedge digraph with the edgelabeling function f: E , where e=(p, q) E & f(e)=a, i. e. , a in G q (p, a) in M. p q Conversely, if G=(Q, E, f) is a labeled multi-edge digraph with f: E , then M=(Q, , , q 0, F) is an NFA, where is defined s. t. a q (p, a) in M p q in G. n 003 -02 1
From NFAs To DFAs: Example 1 0 1 p {r} {q} q {q, r} {q} r n s 0 s 1 {p} s 2 {q} s 3 {r} s 4 {p, q} s 5 {q, r} s 6 {r, p} s 7 {p, q, r} 0 {r} {q, r} {q, r} 0 p r 1 0 q 1 {q} {q} {q} 0, 1 0 s 1 s 5 0 1 0 s 3 0, 1 s 2 1 0 s 0 0, 1 0 s 7 1 1 s 6 1 s 4 0 1
From NFAs To DFAs: Example 2 a, b a b c p {p, q} {p} q {q, r} {q} r {q, r} {q} {p, q, r} n p a c b {p} {p, q} {p, q, r} {q, r} r b, c q a, b, c c, a a b c {p, q} {p} {p, q} {p, q, r} {q} {p, q, r} {q, r} {q, r} {p, q, r} 3
NFAs with -Moves n a*b*c* n -NFA a b c n DFA with part. s. t. f. a b b c c c n NFA a b a, b c b, c a, b, c 4
Converting -NFAs To NFAs: An Example n a a, p q b a, t b r s b q a a b a n a p b b b t b b r b s b b b 5
Exercises n What is L(M)? – Show as a language. – Describe in English. n Construct an FA for each given language. n Convert a given ( -)NFA to an equivalent DFA. n ARE YOU READY TO TAKE A QUIZ? A 10 minute quiz will be given without notice. 003 -02 6
Converting -NFAs To DFAs: An Example n a a, p q b a, t b r b s b Algorithm -NFAto. DFA n {p} b a {p, q, t} {r, s} b b a a, b {} a a {r, s, t} b 7
Converting -NFAs To NFAs: A Construction If M=(Q, , , q 0, F), then let M’=(Q, , ’, q 0, F’), where 1) ’(q, a)= *(q, a) for q Q, a , 2) F’=F {q 0} if *(q 0, ) contains a state in F, and F’=F otherwise. n The example on Slide 5 is based on this construction. 003 -02 8
Nondeterminism = “Guess and Verify” a M b a p a+b* q Given input aab, consider the relation which is denoted by in the following tree (the computation tree for aab). (p, aab) Guess the next symbol: a? b? (p, ab) Guess the next symbol: a? (p, b) b? Wrong guess! right guesses wrong guesses (q, ab) Wrong guess! (q, b) No choice (q, ) You made right guesses! 9
- Slides: 9