This preview shows pages 1–12. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 1 Nondeterministic Finite Automata Nondeterminism Subset Construction 2 Nondeterminism A nondeterministic finite automaton has the ability to be in several states at once. Transitions from a state on an input symbol can be to any set of states. 3 Nondeterminism (2) Start in one start state. Accept if any sequence of choices leads to a final state. Intuitively : the NFA always guesses right. 4 Example : Moves on a Chessboard States = squares. Inputs = r (move to an adjacent red square) and b (move to an adjacent black square). Start state, final state are in opposite corners. 5 Example : Chessboard (2) 1 2 5 7 9 3 4 8 6 1 r b b 4 2 1 5 3 7 5 1 3 9 7 r b 1 2,4 5 2 4,6 1,3,5 3 2,6 5 4 2,8 1,5,7 5 2,4,6,8 1,3,7,9 6 2,8 3,5,9 7 4,8 5 8 4,6 5,7,9 9 6,8 5 * Accept, since final state reached 6 Formal NFA A finite set of states, typically Q. An input alphabet, typically . A transition function, typically . A start state in Q, typically q . A set of final states F Q. 7 Transition Function of an NFA (q, a) is a set of states. Extend to strings as follows: Basis : (q, ) = {q} Induction : (q, wa) = the union over all states p in (q, w) of (p, a) 8 Language of an NFA A string w is accepted by an NFA if (q , w) contains at least one final state. The language of the NFA is the set of strings it accepts. 9 Example : Language of an NFA For our chessboard NFA we saw that rbb is accepted. If the input consists of only bs, the set of accessible states alternates between {5} and {1,3,7,9}, so only evenlength, nonempty strings of bs are accepted. What about strings with at least one r? 1 2 5 7 9 3 4 8 6 10 Equivalence of DFAs, NFAs A DFA can be turned into an NFA that accepts the same language. If D (q, a) = p, let the NFA have N (q, a) = {p}. Then the NFA is always in a set containing exactly one state the state the DFA is in after reading the same input. 11 Equivalence (2) Surprisingly, for any NFA there is a DFA that accepts the same language....
View
Full
Document
This note was uploaded on 03/30/2012 for the course CS 154 taught by Professor Motwani,r during the Spring '08 term at Stanford.
 Spring '08
 Motwani,R

Click to edit the document details