This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 373: Theory of Computation Madhusudan Parthasarathy Lecture 7: NFA s are equivalent to DFA s 9 February 2010 1 From NFA s to DFA s 1.1 NFA handling an input word For the NFA N = ( Q, ,,q ,F ) that has notransitions, let us de ne N ( X,c ) to be the set of states that N might be in, if it was in a state of X Q , and it handled the input c . Formally, we have that N ( X,c ) = [ x X ( x,c ) . We also de ne N ( X, ) = X . Given a word w = w 1 ,w 2 ,...,w n , we de ne N ( X,w ) = N N ( X,w 1 ...w n 1 ) ,w n = N ( N ( ... N ( N ( X,w 1 ) ,w 2 ) ... ) ,w n ) . That is, N ( X,w ) is the set of all the states N might be in, if it starts from a state of X , and it handles the input w . The proof of the following lemma is by an easy induction on the length of w . Lemma 1.1 Let N = ( Q, ,,q ,F ) be a given NFA with notransitions. For any word w * , we have that q N ( { q } ,w ) , if and only if, there is a way for N to be in q after reading w (when starting from the start state q ). 1 More details. We include the proof for the sake of completeness, but the reader should by now be able to ll in such a proof on their own. Proof: The proof is by induction on the length of w = w 1 w 2 ...w k . If k = 0 then w is the empty word, and then N stays in q . Also, by de nition, we have N ( { q } ,w ) = { q } , and the claim holds in this case. Assume that the claim holds for all word of length at most n , and let k = n + 1 be the length of w . Consider a state q n +1 that N reaches after reading w 1 w 2 ...w n w n +1 , and let q n be the state N was before handling the character w n +1 and reaching q n +1 . By induction, we know that q n N ( { q } ,w 1 w 2 ...w n ) . Furthermore, we know that q n +1 ( q n ,w n +1 ) . As such, we have that q n +1 ( q n ,w n +1 ) [ q N ( { q } ,w 1 w 2 ...w n ) ( q,w n +1 ) = N ( N ( { q } ,w 1 w 2 ...w n ) ,w n +1 ) = N ( { q } ,w 1 w @ ...w n +1 ) = N ( { q } ,w ) . Thus, q n +1 N ( { q } ,w ) . As for the other direction, if p n +1 N ( { q } ,w ) , then there must exist a state p n N ( { q } ,w 1 ...w n ) , such that p n +1 ( p n ,w n +1 ) . By induction, this implies that there is execu tion trace for N starting at q and ending at p n , such that N reads w 1 ...w n to reach p n . As such, appending the transition from p n to p n +1 (that read the character w n +1 to this trace, results in a trace for N that starts at q , reads w , and end up in the state p n +1 ....
View
Full Document
 Spring '10
 kuma
 Veteran, Veterinarian, DFA Records, stte

Click to edit the document details