next up previous contents
Next: DFA minimisation Up: Deterministic Finite-State Automata Previous: Deterministic Finite-State Automata   Contents

Constructing a DFA from an NFA (``Subset Construction'')

We merge together NFA states by looking at them from the point of view of the input characters:

To perform this operation, let us define two functions:

We can generalise both these functions to apply to sets of states by taking the union of the application to individual states.

Eg. If A, B and C are states, move({A,B,C},`a') = move(A,`a') $\cup$ move(B,`a') $\cup$ move(C,`a').

The Subset Construction Algorithm

  1. Create the start state of the DFA by taking the $\varepsilon$-closure of the start state of the NFA.
  2. Perform the following for the new DFA state:
    For each possible input symbol:
    1. Apply move to the newly-created state and the input symbol; this will return a set of states.
    2. Apply the $\varepsilon$-closure to this set of states, possibly resulting in a new set.
    This set of NFA states will be a single state in the DFA.
  3. Each time we generate a new DFA state, we must apply step 2 to it. The process is complete when applying step 2 does not yield any new states.
  4. The finish states of the DFA are those which contain any of the finish states of the NFA.


next up previous contents
Next: DFA minimisation Up: Deterministic Finite-State Automata Previous: Deterministic Finite-State Automata   Contents
James Power 2002-11-29