nondeterministic finite automaton

a nondeterministic finite automaton (NFA) is a 5-tuple , where
  1. is a finite set of states,
  2. is a finite alphabet,
  3. is the transition function,
  4. is the start state,
  5. is the set of accept states.
usually such an automaton is abbreviated NFA.
we say an NFA accepts the string if we can write as , where each is a member of and a sequene of states exists in with three conditions:
  1. ,
  2. , for , and
  3. .
condition 1 says that the machine starts out in the start state. condition 2 says that state is one of the allowable next states when is in state and reading . observe that is the set of allowable next states and so we say that is a member of that set. finally, condition 3 says that the machine accepts its input if the last state is an accept state.
[cite:@sipser_comp_2012 definition 1.37]
although they recognize the same class of languages (regular languages), there are a few differences between a deterministic finite automaton and a nondeterministic finite automaton. first, every state of a DFA always has exactly one exiting transition arrow for each symbol in the alphabet. NFAs violate that rule. in an NFA, a state may have zero, one, or many exiting arrows for each alphabet symbol. second, in a DFA, labels on the transition arrows are symbols from the alphabet. this NFA has an arrow with the label . in general, an NFA may have arrows labelled with members of the alphabet or . zero, one, or many arrows may exit from each state with the label .
how does an NFA compute? suppose that we are running an NFA on an input string and come to a state with multiple ways to proceed. the machine splits into multiple copies of itself and follows all the possibilities in parallel. each copy of the machine takes one of the possible ways to proceed and continues as before. if there are subsequent choices, the machine splits again. if the next input symbol doesn’t appear on any of the arrows exiting the state occupied by a copy of the machine, that copy of the machine dies, along with the branch of the computation associated with it. finally, if any one of these copies of the machine is in an accept state at the end of the input, the NFA accepts the input string.
if a state with an symbol on an exiting arrow is encountered, something similar happens. without reading any input, the machine splits into multiple copies, one following each of the exiting -labeled arrows and one staying at the current state. then the machine proceeds nondeterministically as before. nondeterminism may be viewed as a kind of parallel computation wherein multiple independent "processes" or "threads" can be running concurrently.
when the NFA splits to follow several choices, that corresponds to a process "forking" into several children, each proceeding separately. if at least one of these processes accepts, then the entire computation accepts.
[cite:@sipser_comp_2012 chapter 1.2 nondeterminism]