Minimal Automata
Learn how to minimize the number of states of a DFA.
We'll cover the following...
DFAs are useful in recognizing text patterns and are easily implemented in code. We haven’t considered, however, whether an automaton is “efficient.” Our measure of efficiency is the number of states, since that determines the number of possible transitions that exist.
Making DFA efficient
Let’s examine the following DFA, , for any redundant states.
Once we reach state , the machine remains in an accepting state regardless of subsequent input. States and can therefore collapse into a single accepting state, as shown in the figure below.
Now let’s think about what language the machine above accepts. If a string starts with a , it is accepted. If it starts with an , it is not accepted until a is read. In other words, this machine accepts the language of strings that have at least one . We can therefore combine states and to obtain the minimal DFA in the figure below.
We’ve discovered that states and play the same role in the original DFA (). States and are likewise indistinguishable in their function, and we have reduced the number of states from 4 to 2.
Identifying distinguishable states
Which states are indistinguishable in the DFA ...