See Kozen (1997) lectures 13-16.
DFA minimization
Every regular language has a minimal DFA that is unique up to isomorphism, and there is an algorithm for constructing it from any given DFA for . Proving uniqueness requires the Myhill-Nerode theorem, but constructing a minimal DFA can be achieved using a simple algorithm.
Given a DFA, the minimization process consists of two steps: getting rid of inaccessible states, and collapsing equivalent states.
The quotient construction
By ‘collapsing’ two states and , we mean we can identify the two states as being the same, and one larger state.
- We cannot collapse a final state and a non-final state , since if were such that and , it is impossible to ensure that is rejected and is accepted after collapsing.
- If we merge and , we are forced to also merge and for all , to preserve determinism.
These two observations imply inductively that we cannot collapse and if and for some string . It turns out that this is also a sufficient condition.
Proposition 283.1.
States an of a DFA can be safely collapsed iff there does not exist a string such that and .
Proof.
efine an equivalence relation on by
We now define the quotient automaton :
where
We need to show that is well defined: if , then :
It is also clear that . After showing that for all , , we can show that . Thus, we have shown that is a sufficient condition for collapsing and .
It is also clear that no further collapsing is possible.□
The minimization algorithm
- Write down a table of all pairs , initially unmarked.
- Mark if and or vice versa.
- Repeat the following until no more changes occur: if there exists an unmarked pair such that is marked for some , then mark .
- When done, iff is not marked.
This is easily proved by induction on the length of distinguishing suffixes.
The Myhill-Nerode Relations
Correspondence between MH relations and DFAs
Let be a DFA for a regular language with no inaccessible states. induces an equivalence relation on defined by . Some properties of :
- it is a right congruence: .
- It refines : for all .
- It is of finite index, since has finitely many states.
Call any equivalence relation on a Myhill-Nerode relation for if it satisfies the three properties above, that is, if it is a right congruence of finite index refining .
Given any Myhill-Nerode relation on for , we can produce a DFA accepting :
These two constructions are inverses up to isomorphism, that is, , and . Thus, Myhill-Nerode relations for are in a bijective correspondence with DFAs for with no inaccessible states.
The Myhill-Nerode Theorem
There exists a coarsest Myhill-Nerode relation for any given regular set .
Definition 283.2.
Let , regular or not. We define an equivalence relation on in terms of as follows:
For any set , regular or not, satisfies properties 1 and 2 of Myhill-Nerode relations and is the coarsest such relation on . If is regular, this is also of finite index, and therefore a Myhill-Nerode relation on (the coarsest possible one, and corresponds to the unique minimal finite automaton for ).
j
Theorem 283.3.
Let . The following statements are equivalent:
- is regular;
- there exists a Myhill-Nerode relation for ;
- the relation is of finite index.