Formal Definition

A Nondeterministic Finite Automaton 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

Let be an NFA and a string over the alphabet . Then we say that accepts if we can write as , where each is a member of and a sequence of states exists in with three conditions:

  1. , for

Note

Unlike Deterministic Computation where the next state is determined to be a specific state, Nondeterministic Machine has several choices that exists for the next state at any point.

Nondeterminism is a generalization of determinism → every deterministic finite automaton is automatically a nondeterministic finite automaton

DFA vs NFA

Deterministic Finite Automaton (DFA)Nondeterministic Finite Automation (NFA)
Every state always has exactly one exiting transition arrow for each symbol in the alphabet States may have 0, 1, or many exiting arrows for each alphabet symbol
Labels on the transition arrows are symbols from the alphabet May have arrows labeled with members of the alphabet or

Computation of NFA

  1. Start: The process begins in the start state ​.
  2. Read: The machine reads the input string symbols one by one from left to right.
  3. Move: After reading a symbol, it follows the transition to a new state.
    • The current state has multiple ways to proceed → the machine “splits” into multiple copies of itself and follows all the possibilities in parallel
    • Each takes one of the possible ways to proceed and continues as before
  4. Output: After the last symbol is read, the machine accepts the string if any of the copies have an accept state in the final stage; otherwise, the machine rejects the input.

Equivalence of NFAs and DFAs

  • DFAs and NFAs recognize the same class of languages
  • Say that two machines are equivalent if they recognize the same language

Every NFA Has an Equivalent DFA

Proof by Construction

Let be the NFA recognizing some language .

Construct a DFA recognizing .


  1. Every state of is a set of states of
    Recall that is the set of subsets of

  2. For and , let
    If is a state of , it is also a set of states of
    When reads a symbol in state , it shows where takes each state in , it shows where takes each state in
    Because each state may go to a set of states, we take the union of all these sets.

    The notation standards for the union of the sets for each possible in


  3. starts in the state corresponding to the collection containing just the start state of


  4. The machine accepts if one of the possible states that could be in at this point is an accept state.