DFA Minimization
Merge equivalent DFA states by partition refinement and find strings that tell two states apart.
- Lecture reference: Lexical Analysis IV
Input
Thompson’s construction, then the subset construction. The DFA is not minimized first.
Add regular definitions
The DFA the subset construction builds from the NFA for (1 | 0)*1: ABCDHI, FGABCDHI, EJGABCDHI.
Lecture reference: Lexical Analysis IVFrom the slides “Is the previous DFA minimal?”
Lecture reference: Lexical Analysis IVShow answer
No. ABCDHI and FGABCDHI are equivalent: neither accepts, and both go to FGABCDHI on 0 and to EJGABCDHI on 1. Merging them leaves 2 states.
Partition refinement 3 states
P0 = block1 { ABCDHI, FGABCDHI }block2 { EJGABCDHI }
Round 0 initial partition
Accepting and non-accepting states start in different blocks.
| State | Accepting | Block |
|---|---|---|
| ABCDHI | no | block1 |
| FGABCDHI | no | block1 |
| EJGABCDHI | yes | block2 |
The empty string "" tells an accepting state from a non-accepting one, so they start in different blocks.
Tell two states apart
Equivalent
No string tells ABCDHI and FGABCDHI apart. Both end up in block 1 and merge into ABCDHI.
The shortest string, first in shortlex order, that one state accepts and the other rejects. Missing transitions go to the trap state.
Minimal DFA
| Block | State | Merges |
|---|---|---|
| block1 | ABCDHI , start | { ABCDHI, FGABCDHI } |
| block2 | EJGABCDHI , accepting | { EJGABCDHI } |
Transition table
| State | 0 | 1 |
|---|---|---|
| ABCDHI , start | ABCDHI | EJGABCDHI |
| EJGABCDHI , accepting | ABCDHI | EJGABCDHI |