Introduction
Two states of a DFA are equivalent when no string leads from one to an accept state and from the other to a reject state. Merging equivalent states yields the unique (up to renaming) minimal DFA for the language: fewest states among all DFAs for that language. The skills are running the table-filling (distinguishability) algorithm, reading the minimized diagram, and using Myhill-Nerode to prove a lower bound on the number of states.
Prerequisites
- Deterministic Finite Automata: DFA definition and acceptance.
Core concepts
Distinguishable states
States and are distinguishable if there exists a string such that exactly one of and is accepting. Otherwise they are equivalent (indistinguishable).
Base case: if exactly one of is accepting, they are distinguished by .
Inductive step: if for some symbol , the states and are already distinguishable, then and are distinguishable (prepend to the distinguishing continuation).
Table-filling algorithm
For states ordered , maintain a triangular table of pairs with .
- Mark every pair where one state is accepting and the other is not.
- Repeat until no change: if an unmarked pair has, for some , the pair marked, mark .
- Unmarked pairs are equivalent. Merge each equivalence class into one state; transitions and acceptance lift to classes. Remove states unreachable from the start if any remain.
The result is the minimal DFA. Hopcroft's algorithm computes the same partition faster ( time) but table-filling is the easier one to run by hand.
Myhill-Nerode link
For a language , define iff for every , . This is an equivalence relation, and it is right-invariant: implies .
Myhill-Nerode theorem. The following are equivalent: (1) is regular; (2) has finitely many classes (finite index); (3) is a union of classes of some right-invariant equivalence of finite index. Moreover, the number of classes of equals the number of states of the minimal complete DFA for , and the minimal DFA is unique up to renaming of states.
Consequences used in exams:
- Lower bound. To prove every DFA for needs at least states, exhibit pairwise distinguishable strings: for every pair give a with .
- Non-regularity. An infinite set of pairwise distinguishable strings proves is not regular. For , the strings and () are separated by . This proof works even for languages where the pumping lemma is awkward, and it is the only one of the two that can also prove regularity (finite index).
- Describing the classes. For "ends with
01" over the three classes are: strings ending in01; strings ending in 0; all other strings (including and strings ending in11). Each class is one state of the minimal DFA.
How it works
Worked table for a redundant even- machine
Alphabet . States (start, accept), (reject), (accept) with transitions , , . States and are both accepting and move to on ; is rejecting. Table marks and immediately; never marks. Merge into one accept state. Minimal DFA has 2 states.

Already-minimal example
DFA for strings ending with 0: states (start), (accept); , , , . Pair marked by . Minimal already: 2 states.
Algorithms and pseudocode
TABLE-FILL(M)
1 mark all pairs {p,q} with (p in F) xor (q in F)
2 repeat
3 for each unmarked pair {p,q}
4 for each a in Sigma
5 if {delta(p,a), delta(q,a)} is marked
6 mark {p,q}; break
7 until no new marks
8 return unmarked pairs as equivalencesTime worst-case for this repeated-scan loop, where : there are propagation rounds and work per round. A dependency/worklist implementation can achieve .
MINIMIZE(M)
1 remove states unreachable from q0
2 equiv <- TABLE-FILL(M)
3 classes <- partition Q by equiv
4 return the quotient DFA on classesMathematical explanation
Uniqueness
Any two minimal DFAs for the same language are isomorphic: the Myhill-Nerode classes determine both. Minimization finds that canonical machine.
Why the algorithm terminates with the Myhill-Nerode partition
Marked pairs are exactly the distinguishable ones: soundness by induction on the length of a shortest distinguishing string; completeness because if , a shortest distinguisher of length forces a mark after rounds.
Worked examples
Example 1: mergeable accept states
As above: three-state even- machine minimizes to two states. Distinguishing string for vs is ; for vs none exists.
Example 2: lower bound via Myhill-Nerode
Language . Strings are pairwise distinguishable:
- and distinguished by (first in , second not).
- and distinguished by (, ).
- and distinguished by : rejects, whereas accepts.
Hence every DFA needs at least 3 states; the standard mod-3 length DFA meets the bound.
Example 3: strings ending with 01
The 4-state progress DFA of the DFA note is not minimal. Its states and 1 are equivalent: both are rejecting, and both go to 0 on 0 and to 1 on 1, so the pair is never marked. The other pairs are marked: 01 against any other state by , then 0 against and against 1 because on input 1 they go to the marked pairs (01, 1). Minimal size is 3, matching the three Myhill-Nerode classes listed above.
Example 4: full table on a 4-state machine
States A (start), B, C (accept), D (accept). Alphabet {0,1}. Transitions:
| 0 | 1 | |
|---|---|---|
| A | B | A |
| B | A | C |
| C | D | A |
| D | C | A |
First mark pairs mixing accept and reject: (A,C), (A,D), (B,C), (B,D). Unmarked: (A,B), (C,D).
Check (A,B): on 0 go to (B,A) unmarked; on 1 go to (A,C) which is marked. So mark (A,B).
Check (C,D): on 0 go to (D,C) unmarked; on 1 go to (A,A) same state. No mark from this round. Next round still no new marks from (C,D). So C and D merge.
Quotient: states {A}, {B}, {C,D}. The only merge is between the two accept states.
Example 5: partition refinement (-equivalence) on a 6-state DFA
States (start) to , accepting :
| State | on 0 | on 1 |
|---|---|---|
| A | B | E |
| B | D | F |
| C | B | E |
| D | E | D |
| E | F | C |
| F | B | E |
Two states are -equivalent if no string of length at most distinguishes them. Refine until a round changes nothing.
- (accepting or not): , .
- : in the first block, go to but goes to , so splits off. and both go to the non-accepting block on both symbols and stay together. .
- : goes to and to , so they split. .
- : stop.
The minimal DFA has 4 states, becoming the start state. Note that and are 1-equivalent but not 2-equivalent. A distinguishing string of length 2 is 01: rejects, while accepts. (The string 00 does not work: it leads from to and from to , both accepting.)
Table filling and partition refinement agree. Both compute the Myhill-Nerode partition of the reachable states; table filling marks pairs, refinement splits blocks. Refinement is faster to write for 6 or more states.
Example 6: unreachable state
Add a state E with self-loops that is never reached from A. Table-filling might still compare E to others, but MINIMIZE first deletes E by reachability DFS/BFS from the start. The minimal DFA never includes unreachable states. Always remove them before reporting the state count.
Important properties and observations
- Minimization requires a complete DFA; apply subset construction first if you start from an NFA.
- Equivalent states must agree on acceptance and on the classes of all successors.
- All non-accepting sinks are equivalent and merge into one dead state; a dead state is never equivalent to a state from which an accepting state is reachable.
- If no accepting state is reachable, the minimal complete DFA has exactly 1 state (a rejecting sink); if every reachable state accepts, it has 1 accepting state.
- NFAs have no unique minimal form. Two different minimal NFAs can accept the same language, and minimizing an NFA is computationally hard in general. Minimization questions are about DFAs.
- Equivalence of two DFAs is decided by minimizing both and comparing up to renaming, or by running table filling on their disjoint union and checking whether the two start states are equivalent.
- Minimal DFA is unique up to renaming; minimal RE is not unique.
Common misconceptions.
- "Any two accept states may merge." Only if they are indistinguishable.
- "Minimization can change the language." It must not; always verify on a few strings.
- "Unreachable states affect minimality counts in Myhill-Nerode." Remove them first; Nerode classes count only what the language needs.
GATE examination perspective
- FILL THE TABLE IN ORDER. Mark accept/reject pairs first; iterate until stable.
- DRAW THE MERGED MACHINE. One state per class; copy transitions using representatives.
- LOWER BOUNDS. Give pairwise distinguishing continuations; do not assume a particular DFA.
- COUNT AFTER REMOVING UNREACHABLE STATES. Unreachable states inflate raw state counts.
- IDENTICAL ROWS MERGE AT ONCE. States with the same acceptance and identical rows (here , , ) are equivalent; spotting them shortens the work.
- -EQUIVALENCE QUESTIONS. "How many classes after round 1" asks for , not the final partition; read which round is asked.
- COMPLETE FIRST. Add the dead state before minimizing a partial DFA; an omitted sink can change the count and must be included before minimization; the change is not always exactly one.
- MYHILL-NERODE PROVES BOTH WAYS. Finite index proves regularity, infinite index proves non-regularity; the pumping lemma only does the second.
Summary
Sources
- J. E. Hopcroft, R. Motwani, J. D. Ullman, Introduction to Automata Theory, Languages, and Computation, 3rd ed., Pearson Addison-Wesley, Section 4.4 (equivalence and minimization of automata: testing equivalence of states, testing equivalence of regular languages, minimization of DFAs, why the minimized DFA cannot be beaten).
- M. Sipser, Introduction to the Theory of Computation, 3rd ed., Cengage Learning: Section 1.1 (finite automata) and Section 1.4 (nonregular languages).
- P. Linz, An Introduction to Formal Languages and Automata, 6th ed., Jones & Bartlett Learning: Section 2.4 (reduction of the number of states in finite automata).