Myhill–Nerode Classes and Minimization: Practice with Tools
Collect words that are pairwise distinguishable and get a lower bound, check whether an automaton is minimal with a certificate of words, minimize an automaton through the words that reach its states, and map each state of a large automaton to a class of the smallest automaton.
Last updated:
On this practice page we practise the Myhill–Nerode classes from the lesson “Myhill–Nerode: What a State Remembers”:
we collect words that are pairwise distinguishable, use them to check whether an automaton is minimal, and minimize an automaton through the words that reach its states.
In every tool on this page a word is written with the letters and , and the empty word is written as an empty field or as ε.
Collecting distinguishable words
Choose a language, and predict how many states the smallest DFA for the language has.
Then add words one at a time. The tool adds a word only if it is distinguishable from every word already in the list; if not, it says which of them it is equivalent to.
The number of words in the list is a lower bound on the number of states, by the lower bound.
When no further word can be added, show the smallest automaton and compare it with your prediction.
The tool needs JavaScript. Use the questions on paper at the end of the page.
Minimality certificate
By the lower bound, a DFA with states is the smallest for its language if there are words, every two of them distinguishable.
This is a minimality certificate. Choose an automaton, and write for each state a word that reaches it.
If every two words are distinguishable, there is a certificate.
If not, there are two possible reasons: a state that no word reaches, or, by the claim on equivalent states and indistinguishable words, two equivalent states.
Find the equivalent states and check them in the row under the table.
The tool needs JavaScript. Use Question 3 on paper.
Minimization through words
Choose a large automaton. For each state write a word that reaches it, or tick that there is none.
Then split the states into groups by the class of their words:
two states are in the same group if their words are indistinguishable.
By the same claim, the groups are exactly the states that minimization merges.
After a successful check the tool shows the minimized automaton and, for each pair of groups, a shortest distinguishing word; table filling writes a word of the same length for a pair of states from these groups.
The tool needs JavaScript. Use Question 4 on paper.
Mapping to the smallest automaton
The tool shows a large automaton and the automaton of its language, whose states are the classes.
Choose a class for each state of the large automaton. The tool checks that the choice takes the start state to the start state, an accepting state to an accepting class, and a transition to a transition, as in the proof of the uniqueness theorem.
States that received the same class are the states that minimization merges.
The tool needs JavaScript. Use Question 4 on paper.
Questions on paper
Question 1. Let , the words that contain . How many classes does have?
Find a representative word for each class, prove that every two of them are distinguishable, and build .
Hint
What must be remembered while reading? Which part of does the end of the word already match?
Answer
Four classes: , , and . The distinguishing words:
and : (, ); and :
; and : (, ); in every pair with :
. The automaton :
| State | on | on |
|---|---|---|
Question 2. Let , the words that start and end with the same letter.
How many states does the smallest DFA for have? Prove the lower bound.
Hint
After the first letter we must remember which letter it was, and whether the last letter equals it.
Is in the class of another word?
Answer
Five. The words are pairwise distinguishable: for and , and , and every pair of a word from and a word from , the word distinguishes, because and the other words are not.
and : (, ). and :
. and : (, ). and :
(, ). So every DFA for the language has at least five states, and the automaton of the classes shows that five suffice:
from the letter returns to and leads to , and from the letter returns to and stays; symmetrically for and .
Question 3. For the counter of modulo 4 from the practice of Minimizing Automata by Table Filling (, accepting and ), write for each state a word that reaches it.
Are the words a minimality certificate? What follows from the answer?
Answer
For example , , , . This is not a certificate:
, because for every the numbers of in and in differ by 2, so both are even or both are odd.
By the claim on equivalent states and indistinguishable words, , and in the same way .
The automaton is not minimal, and the language (an even number of ) has two classes.
Question 4. In the nine-state product automaton for the language “contains or contains ” from the lesson on table filling, to which class of does the word that reaches each state belong?
Which states merge?
Hint
The classes are . Is there a state that no word reaches?
Answer
is reached by the word , so it is in the class ; by the word , in the class ; by the word , in the class ; the five accepting states are reached by words of , in the class , and merge into one state.
is not reachable, so it gets no class, and minimization removes it.
Continue with Myhill–Nerode Practice, go back to Myhill–Nerode: What a State Remembers, or see the glossary.