Lably
Skip to content

DFA minimization

Task of transforming a deterministic finite automaton

  • 11 min read
  • 4 chapters

Related on Lably

Through Pattern matching, Equivalence class and Pseudocode

Minimal DFA

For each regular language, there exists a minimal deterministic automaton that accepts it, that is, a DFA with a minimum number of states. By the Myhill-Nerode theorem, this DFA is unique (except that states can be given different names). The minimal DFA ensures minimal computational cost for tasks such as pattern matching.

There are three classes of states that can be removed or merged from the original DFA without affecting the language it accepts.

  • Unreachable states are the states that are not reachable from the initial state of the DFA, for any input string. These states can be removed.
  • Dead states are the states from which no final state is reachable. These states can be removed unless the automaton is required to be complete.
  • Nondistinguishable states are those that cannot be distinguished from one another for any input string. These states can be merged.

DFA minimization is usually done in three steps:

  1. remove dead and unreachable states (this will accelerate the following step),
  2. merge nondistinguishable states,
  3. optionally, re-create a single dead state ("sink" state) if the resulting DFA is required to be complete.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication