910 likes | 1.26k Views
Non-Deterministic Finite Automata. Nondeterministic Finite Automaton (NFA). Alphabet =. Alphabet =. Two choices. Alphabet =. Two choices. No transition. No transition. First Choice. First Choice. First Choice. First Choice. All input is consumed. “accept”. Second Choice.
E N D
Nondeterministic Finite Automaton (NFA) Alphabet =
Alphabet = Two choices
Alphabet = Two choices No transition No transition
First Choice All input is consumed “accept”
Second Choice No transition: the automaton hangs
Second Choice Input cannot be consumed “reject”
An NFA accepts a string: when there is a computation of the NFA that accepts the string There is a computation: all the input is consumed and the automaton is in an accepting state
Example is accepted by the NFA: “accept” “reject” because this computation accepts
First Choice “reject”
Second Choice “reject”
An NFA rejects a string: when there is no computation of the NFA that accepts the string. For each computation: • All the input is consumed and the • automaton is in a non final state OR • The input cannot be consumed
Three major differences between FA & NFA • Each entry in the table of NFA is a set. • Allow as the second argument of . This means that the NFA can make a transition function without consuming an input symbol. • The set may be empty.
Example is rejected by the NFA: “reject” “reject” All possible computations lead to rejection
First Choice No transition: the automaton hangs
First Choice Input cannot be consumed “reject”
Second Choice No transition: the automaton hangs
Second Choice Input cannot be consumed “reject”
is rejected by the NFA: “reject” “reject” All possible computations lead to rejection
all input is consumed “accept” String is accepted
No transition: the automaton hangs
Input cannot be consumed “reject” String is rejected