This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS103 HO#31 SlidesNFAs, Regular Expressions 4/25/11 1 Theorem 1.39 : Every nondeterministic finite automaton has an equivalent deterministic finite automaton. To convert an NFA N = (Q, , , q , F) recognizing A into a DFA M = (Q', , ' , q ', F ' ): 1. Q' = P (Q) 2. For R Q' and a , let ' (R, a) = { q Q  q (r, a) for some r R }. Alternately, we may write ' (R, a) = (r, a) 3. q ' = { q } 4. F' = { R Q'  R contains an accepting state of N } This does not handle transitions. r R without transitions. Theorem 1.39 : Every nondeterministic finite automaton has an equivalent deterministic finite automaton. To convert an NFA N = (Q, , , q , F) recognizing A into a DFA M = (Q', , ' , q ', F): 1. Q' = P (Q) 2. For R Q' and a , let ' (R, a) = { q Q  q E( (r, a)) for some r R }. 3. q ' = E({ q }) 4. F' = { R Q'  R contains an accepting state of N } For an NFA with transitions, make the changes shown in red, where { E(R) = { q Q  q can be reached by following 0 or more arrows }. Sipser has a good example of the Subset Construction on pp. 57 – 58. For the DFA, Q' = P ({1, 2, 3}), so there are 8 states. A Bad Case for the Subset Construction q q 1 q 2 q n ... 0, 1 0, 1 0, 1 0, 1 1 0, 1 If we build an NFA like this for some value of n, the language accepted is the set of all strings of 0's and 1's such that the n th symbol from the end is a 1. If we build a DFA to accept the same language, it will have to "remember" the last n symbols it has read, and be prepared for any combination of 0's and 1's after the critical 1. Although converting an NFA to a DFA often results in a machine with roughly the same number of states as the NFA, this one needs at least 2 n states....
View
Full
Document
This note was uploaded on 06/01/2011 for the course EE 103 taught by Professor Plummer during the Spring '11 term at Stanford.
 Spring '11
 PLUMMER

Click to edit the document details