notes04 Nondeterministic Finite Automata (NFA)

# notes04 Nondeterministic Finite Automata (NFA) - CS 373...

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

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

View Full Document

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

View Full Document

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.

Unformatted text preview: CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1 1 Introducing Nondeterminism 1.1 Informal Overview Nondeterminism Michael Rabin and Dana Scott (1959) Figure 1: Michael Rabin Figure 2: Dana Scott Nondeterminism Given a current state of the machine and input symbol to be read, the next state is not uniquely determined. Comparison to DFAs Nondeterministic Finite Automata (NFA) NFAs have 3 features when compared with DFAs. 1. Ability to take a step without reading any input symbol 2. A state may have no transition on a particular symbol 3. Ability to transition to more than one state on a given symbol-Transitions Transitions without reading input symbols Example 1 . The British spelling of “color” is “colour”. In a web search application, you may want to recognize both variants. 2 q q 1 q 2 q 3 q 4 q 5 q 6 c o l o u r Figure 3: NFA with -transitions No transitions Example 2 . q q 1 ... 1 Figure 4: No 0-transition out of initial state In the above automaton, if the string starts with a 0 then the string has no computation (i.e., rejected). Multiple Transitions q q q 00 q p , 1 1 , 1 Figure 5: q has two 0-transitions 1.2 Nondeterministic Computation Parallel Computation View At each step, the machine “forks” a thread corresponding to one of the possible next states. • If a state has an -transition, then you fork a new process for each of the possible -transitions, without reading any input symbol • If the state has multiple transitions on the current input symbol read, then fork a process for each possibility • If from current state of a thread, there is no transition on the current input symbol then the thread dies 3 Parallel Computation View: An Example q q q 00 q p , 1 1 , 1 Figure 6: Example NFA q q q q 00 q p X q q p q q q 00 q p q q 00 q q 00 X 1 1 1 Figure 7: Computation on 0100 Nondeterministic Acceptance Parallel Computation View Input is accepted if after reading all the symbols, one of the live threads of the automaton is in a final/accepting state. If none of the live threads are in a final/accepting state, the input is rejected . q q q 00 q p , 1 1 , 1 0100 is accepted because one thread of computation is q → q → q 00 1 → q p → q p → q p Computation: Guessing View 4 The machine magically guesses the choices that lead to acceptance Example 3 . ¡2-¿ q q 1 q 2 q 3 q 4 q 5 q 6 c o l o u r Figure 8: NFA M color After seeing “colo” the automaton guesses if it will see the british or the american spelling. IfAfter seeing “colo” the automaton guesses if it will see the british or the american spelling....
View Full Document

{[ snackBarMessage ]}

### Page1 / 12

notes04 Nondeterministic Finite Automata (NFA) - CS 373...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online