31+Slides--NFAs%2C+Regular+Expressions

# 31+Slides--NFAs%2C+Regular+Expressions - CS103 HO#31...

This preview shows pages 1–2. Sign up to view the full content.

CS103 HO#31 Slides--NFAs, 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 0 , F) recognizing A into a DFA M = (Q', , ' , q 0 ', 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 0 ' = { q 0 } 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 0 , F) recognizing A into a DFA M = (Q', , ' , q 0 ', 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 0 ' = E({ q 0 }) 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 0 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. Reference: Hopcroft, Motwani, and Ullman, Automata Theory, Languages, and Computation, 3 rd Edition . Another Bad Case for the Subset Construction Let = {a, b, c, ..., z} Let L Missing = {w | there is a symbol from not in w} The NFA would look much like the one we had for the

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.
• Spring '11
• PLUMMER
• SEPTA Regional Rail, Formal language, Regular expression, Nondeterministic finite state machine, Automata theory, regular expressions

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern