Exercise

Minimization Practice: Table Filling

Six minimization problems on paper, from a small automaton to a product automaton and a DFA given as a 5-tuple, and a tool that draws a new DFA every time and checks the unreachable states, every cell of the pair table, the classes and the quotient automaton.

Last updated:


On this page we practise the minimization of Minimization: Removing Unreachable States and Minimization: Merging Equivalent States from start to finish:
on paper, in six problems that grow step by step, and then in a tool that draws a new DFA every time and checks each step.

Problems on paper

In each problem, minimize the automaton in the four steps of Minimization: the full order:

  1. Find the states that cannot be reached, and remove them.
  2. Fill in the table of pairs round by round. In every cell you mark, write a distinguishing word; the word written in round kk has length kk⁠. In the cell of a pair that is still unmarked when the process stops, write ≡\equiv⁠.
  3. List the classes of equivalent states.
  4. Build the quotient automaton: a transition table and a drawing. Each class is named after its first state, for example [q2][q_2]⁠.

In all the problems Σ={a,b}\Sigma=\{a,b\}⁠; in a table, the arrow marks the start state and the star the accepting states.
The state names are numbered, because what each state remembers becomes clear only after minimization.

Problem 1. Minimize the following DFA, and describe its language in words.

Stateon aaon bb
→q0\to q_0q0q_0q1q_1
q1q_1q2q_2q1q_1
∗ q2{*}\,q_2q3q_3q2q_2
∗ q3{*}\,q_3q3q_3q2q_2
q0q1q2q3abbababa
The DFA of Problem 1: four states, two of them accepting.

Transitions of the diagram:

  • δ(q_0, a) = q_0
  • δ(q_0, b) = q_1
  • δ(q_1, a) = q_2
  • δ(q_1, b) = q_1
  • δ(q_2, a) = q_3
  • δ(q_2, b) = q_2
  • δ(q_3, a) = q_3
  • δ(q_3, b) = q_2
Answer

States that cannot be reached: none. q1q_1 is reached by the word bb⁠, q2q_2 by baba and q3q_3 by baabaa⁠.

The table. Round 0 marks the four pairs of an accepting and a non-accepting state.
In round 1 the letter aa leads q0,q1q_0,q_1 to q0,q2q_0,q_2⁠, a pair from round 0, so q0,q1q_0,q_1 is marked with the word aa⁠.
The pair q2,q3q_2,q_3 goes on aa to q3,q3q_3,q_3 and on bb to q2,q2q_2,q_2⁠, that is, to a single state, and is never marked.
In round 2 no pair is left to mark, and the process stops.

q0q_0q1q_1q2q_2
q1q_1aa
q2q_2ε\varepsilonε\varepsilon
q3q_3ε\varepsilonε\varepsilon≡\equiv

The classes: {q0}\{q_0\}⁠, {q1}\{q_1\}⁠, {q2,q3}\{q_2,q_3\}⁠.

The quotient automaton:

Stateon aaon bb
→[q0]\to[q_0][q0][q_0][q1][q_1]
[q1][q_1][q2][q_2][q1][q_1]
∗ [q2]{*}\,[q_2][q2][q_2][q2][q_2]
[q0][q1][q2]abbaa,b
The quotient automaton of Problem 1: three states.

Transitions of the diagram:

  • δ([q_0], a) = [q_0]
  • δ([q_0], b) = [q_1]
  • δ([q_1], a) = [q_2]
  • δ([q_1], b) = [q_1]
  • δ([q_2], a) = [q_2]
  • δ([q_2], b) = [q_2]

The language: the words that contain baba⁠. The class [q1][q_1] remembers “the last letter is bb and baba has not been found yet”, and [q2][q_2] is an accepting trap state.

Problem 2. Minimize the following DFA. How many states does the quotient automaton have?

Stateon aaon bb
→q0\to q_0q2q_2q0q_0
∗ q1{*}\,q_1q1q_1q1q_1
q2q_2q2q_2q3q_3
q3q_3q2q_2q1q_1
q0q2q3q1baababa,b
The DFA of Problem 2: four states, and q1q_1 is accepting.

Transitions of the diagram:

  • δ(q_0, a) = q_2
  • δ(q_0, b) = q_0
  • δ(q_2, a) = q_2
  • δ(q_2, b) = q_3
  • δ(q_3, a) = q_2
  • δ(q_3, b) = q_1
  • δ(q_1, a) = q_1
  • δ(q_1, b) = q_1
Answer

Every state can be reached: q2q_2 by the word aa⁠, q3q_3 by abab and q1q_1 by abbabb⁠.

Round 0: the three pairs of q1q_1⁠. Round 1: the letter bb leads q3q_3 to q1q_1⁠, and q0q_0 and q2q_2 to q0q_0 and q3q_3⁠, which are not accepting; so q0,q3q_0,q_3 and q2,q3q_2,q_3 are marked with the word bb⁠.
Round 2: the letter bb leads q0,q2q_0,q_2 to q0,q3q_0,q_3⁠, marked in round 1, so q0,q2q_0,q_2 is marked with the word bbbb⁠.
Every pair is marked.

q0q_0q1q_1q2q_2
q1q_1ε\varepsilon
q2q_2bbbbε\varepsilon
q3q_3bbε\varepsilonbb

Every pair has a distinguishing word, so each class is a single state:
{q0}\{q_0\}⁠, {q1}\{q_1\}⁠, {q2}\{q_2\}⁠, {q3}\{q_3\}⁠. The quotient automaton has four states, and it is the automaton itself after renaming q↦[q]q\mapsto[q]⁠:
minimization merges nothing. The language is the words that contain abbabb⁠, and q2q_2 and q3q_3 remember the progress aa and abab in the pattern.

Problem 3. Minimize the following DFA, and describe its language in words.

Stateon aaon bb
→q0\to q_0q1q_1q3q_3
q1q_1q3q_3q2q_2
∗ q2{*}\,q_2q4q_4q2q_2
q3q_3q3q_3q3q_3
∗ q4{*}\,q_4q2q_2q4q_4
q5q_5q2q_2q3q_3
q0q1q2q4q3q5ababaabba,bab
The DFA of Problem 3: six states, and q2,q4q_2,q_4 are accepting.

Transitions of the diagram:

  • δ(q_0, a) = q_1
  • δ(q_0, b) = q_3
  • δ(q_1, a) = q_3
  • δ(q_1, b) = q_2
  • δ(q_2, a) = q_4
  • δ(q_2, b) = q_2
  • δ(q_4, a) = q_2
  • δ(q_4, b) = q_4
  • δ(q_3, a) = q_3
  • δ(q_3, b) = q_3
  • δ(q_5, a) = q_2
  • δ(q_5, b) = q_3
Hint

The reachable states are found by a search: R0={q0}R_0=\{q_0\}⁠, and Ri+1R_{i+1} adds to RiR_i every state that a letter leads to from a state in RiR_i⁠, until no state is added.

Answer

States that cannot be reached: R0={q0}R_0=\{q_0\}⁠, R1={q0,q1,q3}R_1=\{q_0,q_1,q_3\}⁠, R2={q0,q1,q2,q3}R_2=\{q_0,q_1,q_2,q_3\}⁠, R3={q0,q1,q2,q3,q4}R_3=\{q_0,q_1,q_2,q_3,q_4\} and R4=R3R_4=R_3⁠.
No letter leads to q5q_5⁠, so it is removed. Five states and ten pairs remain.

Round 0: the six pairs of a state from {q2,q4}\{q_2,q_4\} and a state from {q0,q1,q3}\{q_0,q_1,q_3\}⁠.
Round 1: the letter bb leads q1q_1 to q2q_2⁠, which is accepting, and q0q_0 and q3q_3 to q3q_3⁠, which is not; so q0,q1q_0,q_1 and q1,q3q_1,q_3 are marked with the word bb⁠.
Round 2: the letter aa leads q0,q3q_0,q_3 to q1,q3q_1,q_3⁠, marked in round 1, so q0,q3q_0,q_3 is marked with the word abab⁠.
Round 3: only q2,q4q_2,q_4 is left, and aa leads it to q4,q2q_4,q_2 and bb to q2,q4q_2,q_4⁠:
the same pair, which is unmarked. No new pair, and the process stops.

q0q_0q1q_1q2q_2q3q_3
q1q_1bb
q2q_2ε\varepsilonε\varepsilon
q3q_3ababbbε\varepsilon
q4q_4ε\varepsilonε\varepsilon≡\equivε\varepsilon

The classes: {q0}\{q_0\}⁠, {q1}\{q_1\}⁠, {q2,q4}\{q_2,q_4\}⁠, {q3}\{q_3\}⁠.

The quotient automaton:

Stateon aaon bb
→[q0]\to[q_0][q1][q_1][q3][q_3]
[q1][q_1][q3][q_3][q2][q_2]
∗ [q2]{*}\,[q_2][q2][q_2][q2][q_2]
[q3][q_3][q3][q_3][q3][q_3]
[q0][q1][q2][q3]ababa,ba,b
The quotient automaton of Problem 3: four states.

Transitions of the diagram:

  • δ([q_0], a) = [q_1]
  • δ([q_0], b) = [q_3]
  • δ([q_1], a) = [q_3]
  • δ([q_1], b) = [q_2]
  • δ([q_2], a) = [q_2]
  • δ([q_2], b) = [q_2]
  • δ([q_3], a) = [q_3]
  • δ([q_3], b) = [q_3]

The language: the words that start with abab⁠. [q3][q_3] is a rejecting trap state, and [q2][q_2] an accepting trap state.

Problem 4. Minimize the following DFA. In which round is the pair q0,q5q_0,q_5 marked, and why not in an earlier round?

Stateon aaon bb
→q0\to q_0q1q_1q1q_1
q1q_1q2q_2q2q_2
q2q_2q5q_5q3q_3
∗ q3{*}\,q_3q4q_4q3q_3
∗ q4{*}\,q_4q3q_3q4q_4
q5q_5q5q_5q5q_5
q0q1q2q3q4q5a,ba,babaabba,b
The DFA of Problem 4: six states, and q3,q4q_3,q_4 are accepting.

Transitions of the diagram:

  • δ(q_0, a) = q_1
  • δ(q_0, b) = q_1
  • δ(q_1, a) = q_2
  • δ(q_1, b) = q_2
  • δ(q_2, a) = q_5
  • δ(q_2, b) = q_3
  • δ(q_3, a) = q_4
  • δ(q_3, b) = q_3
  • δ(q_4, a) = q_3
  • δ(q_4, b) = q_4
  • δ(q_5, a) = q_5
  • δ(q_5, b) = q_5
Hint

In round kk⁠, check every pair that is not marked yet: does one of the letters lead it to a pair marked in round k−1k-1⁠?
Write the word of every marked pair beside it, so that the word of the next round is the letter followed by that word.

Answer

Every state can be reached: q1q_1 by the word aa⁠, q2q_2 by aaaa⁠, q5q_5 by aaaaaa⁠, q3q_3 by aabaab and q4q_4 by aabaaaba⁠.

  • Round 0: the eight pairs of a state from {q3,q4}\{q_3,q_4\} and a state from {q0,q1,q2,q5}\{q_0,q_1,q_2,q_5\}⁠.
  • Round 1: the letter bb leads q2q_2 to q3q_3⁠, which is accepting, and q0,q1,q5q_0,q_1,q_5 to q1,q2,q5q_1,q_2,q_5⁠, which are not. So q0,q2q_0,q_2⁠, q1,q2q_1,q_2 and q2,q5q_2,q_5 are marked with the word bb⁠.
  • Round 2: the letter bb leads q0,q1q_0,q_1 to q1,q2q_1,q_2 and q1,q5q_1,q_5 to q2,q5q_2,q_5⁠, two pairs from round 1. So q0,q1q_0,q_1 and q1,q5q_1,q_5 are marked with the word bbbb⁠.
  • Round 3: the letter bb leads q0,q5q_0,q_5 to q1,q5q_1,q_5⁠, marked in round 2. So q0,q5q_0,q_5 is marked with the word bbbbbb⁠.
  • Round 4: only q3,q4q_3,q_4 is left, which aa leads to q4,q3q_4,q_3 and bb to q3,q4q_3,q_4⁠. No new pair, and the process stops.
q0q_0q1q_1q2q_2q3q_3q4q_4
q1q_1bbbb
q2q_2bbbb
q3q_3ε\varepsilonε\varepsilonε\varepsilon
q4q_4ε\varepsilonε\varepsilonε\varepsilon≡\equiv
q5q_5bbbbbbbbbbbbε\varepsilonε\varepsilon

The pair q0,q5q_0,q_5 is marked in round 3, because its shortest distinguishing word has length 3.
A word of length at most 2 takes q0q_0 to q0q_0⁠, q1q_1 or q2q_2⁠, and q5q_5 to q5q_5⁠, and none of these is accepting; a pair marked in round kk is a pair whose shortest distinguishing word has length kk⁠.
The word aabaab also distinguishes q0q_0 and q5q_5⁠.

The classes: {q0}\{q_0\}⁠, {q1}\{q_1\}⁠, {q2}\{q_2\}⁠, {q3,q4}\{q_3,q_4\}⁠, {q5}\{q_5\}⁠.

The quotient automaton:

Stateon aaon bb
→[q0]\to[q_0][q1][q_1][q1][q_1]
[q1][q_1][q2][q_2][q2][q_2]
[q2][q_2][q5][q_5][q3][q_3]
∗ [q3]{*}\,[q_3][q3][q_3][q3][q_3]
[q5][q_5][q5][q_5][q5][q_5]
[q0][q1][q2][q3][q5]a,ba,baba,ba,b
The quotient automaton of Problem 4: five states.

Transitions of the diagram:

  • δ([q_0], a) = [q_1]
  • δ([q_0], b) = [q_1]
  • δ([q_1], a) = [q_2]
  • δ([q_1], b) = [q_2]
  • δ([q_2], a) = [q_5]
  • δ([q_2], b) = [q_3]
  • δ([q_3], a) = [q_3]
  • δ([q_3], b) = [q_3]
  • δ([q_5], a) = [q_5]
  • δ([q_5], b) = [q_5]

[q0][q_0]⁠, [q1][q_1] and [q2][q_2] count how many letters have been read, up to three, so the language is the words whose third letter is bb⁠.

Problem 5. The DFA AA recognizes the words whose second letter is aa⁠:
q0q_0 (start), q1q_1 (one letter read), qokq_{\mathrm{ok}} (the second letter is aa⁠; an accepting trap state) and qtrapq_{\mathrm{trap}} (the second letter is bb⁠; a rejecting trap state).
The DFA BB recognizes the words that end with aa⁠: pap_a after aa⁠, and p0p_0 at the start and after bb⁠.

Stateon aaon bb
→q0\to q_0q1q_1q1q_1
q1q_1qokq_{\mathrm{ok}}qtrapq_{\mathrm{trap}}
∗ qok{*}\,q_{\mathrm{ok}}qokq_{\mathrm{ok}}qokq_{\mathrm{ok}}
qtrapq_{\mathrm{trap}}qtrapq_{\mathrm{trap}}qtrapq_{\mathrm{trap}}
Stateon aaon bb
→p0\to p_0pap_ap0p_0
∗ pa{*}\,p_apap_ap0p_0

Build the product automaton of AA and BB for the language “the second letter is aa or ends with aa” (all eight pairs), and minimize it.

Hint

In the product δ((q,p),σ)=(δA(q,σ),δB(p,σ))\delta\bigl((q,p),\sigma\bigr)=\bigl(\delta_A(q,\sigma),\delta_B(p,\sigma)\bigr)⁠, and for “or” a pair is accepting when q∈FAq\in F_A or p∈FBp\in F_B⁠.

Answer

The product. Five pairs are accepting: the four with pap_a⁠, and (qok,p0)(q_{\mathrm{ok}},p_0)⁠.

Stateon aaon bb
→(q0,p0)\to(q_0,p_0)(q1,pa)(q_1,p_a)(q1,p0)(q_1,p_0)
∗ (q0,pa){*}\,(q_0,p_a)(q1,pa)(q_1,p_a)(q1,p0)(q_1,p_0)
(q1,p0)(q_1,p_0)(qok,pa)(q_{\mathrm{ok}},p_a)(qtrap,p0)(q_{\mathrm{trap}},p_0)
∗ (q1,pa){*}\,(q_1,p_a)(qok,pa)(q_{\mathrm{ok}},p_a)(qtrap,p0)(q_{\mathrm{trap}},p_0)
∗ (qok,p0){*}\,(q_{\mathrm{ok}},p_0)(qok,pa)(q_{\mathrm{ok}},p_a)(qok,p0)(q_{\mathrm{ok}},p_0)
∗ (qok,pa){*}\,(q_{\mathrm{ok}},p_a)(qok,pa)(q_{\mathrm{ok}},p_a)(qok,p0)(q_{\mathrm{ok}},p_0)
(qtrap,p0)(q_{\mathrm{trap}},p_0)(qtrap,pa)(q_{\mathrm{trap}},p_a)(qtrap,p0)(q_{\mathrm{trap}},p_0)
∗ (qtrap,pa){*}\,(q_{\mathrm{trap}},p_a)(qtrap,pa)(q_{\mathrm{trap}},p_a)(qtrap,p0)(q_{\mathrm{trap}},p_0)
(q0,p0)(q1,p0)(q0,pa)(q1,pa)(qtrap,p0)(qok,pa)(qtrap,pa)(qok,p0)abababababbaabba
The product automaton of Problem 5. The left column holds the states with p0p_0 (and (qtrap,pa)(q_{\mathrm{trap}},p_a) below them), the right column the states with pap_a (and (qok,p0)(q_{\mathrm{ok}},p_0) below them), and (q0,pa)(q_0,p_a)⁠, which cannot be reached, is in the middle.

Transitions of the diagram:

  • δ((q_0,p_0), a) = (q_1,p_a)
  • δ((q_0,p_0), b) = (q_1,p_0)
  • δ((q_1,p_0), a) = (q_ok,p_a)
  • δ((q_1,p_0), b) = (q_trap,p_0)
  • δ((q_0,p_a), a) = (q_1,p_a)
  • δ((q_0,p_a), b) = (q_1,p_0)
  • δ((q_1,p_a), a) = (q_ok,p_a)
  • δ((q_1,p_a), b) = (q_trap,p_0)
  • δ((q_trap,p_0), a) = (q_trap,p_a)
  • δ((q_trap,p_0), b) = (q_trap,p_0)
  • δ((q_ok,p_a), a) = (q_ok,p_a)
  • δ((q_ok,p_a), b) = (q_ok,p_0)
  • δ((q_trap,p_a), a) = (q_trap,p_a)
  • δ((q_trap,p_a), b) = (q_trap,p_0)
  • δ((q_ok,p_0), a) = (q_ok,p_a)
  • δ((q_ok,p_0), b) = (q_ok,p_0)

States that cannot be reached: (q0,pa)(q_0,p_a)⁠. The component q0q_0 says that no letter has been read, and the component pap_a that the last letter is aa⁠; and in the table, no pair goes to it.
Seven states and 21 pairs remain.

The table: the pairs by the round in which each pair is marked.

  • Round 0 (ε\varepsilon⁠): the 12 pairs of a state from {(q0,p0),(q1,p0),(qtrap,p0)}\{(q_0,p_0),(q_1,p_0),(q_{\mathrm{trap}},p_0)\} and an accepting state.
  • Round 1 (bb⁠): (q1,pa)(q_1,p_a) with (qok,p0)(q_{\mathrm{ok}},p_0) and with (qok,pa)(q_{\mathrm{ok}},p_a)⁠, and (qtrap,pa)(q_{\mathrm{trap}},p_a) with (qok,p0)(q_{\mathrm{ok}},p_0) and with (qok,pa)(q_{\mathrm{ok}},p_a)⁠. The letter bb leads both states of qokq_{\mathrm{ok}} to (qok,p0)(q_{\mathrm{ok}},p_0)⁠, which is accepting, and (q1,pa)(q_1,p_a) and (qtrap,pa)(q_{\mathrm{trap}},p_a) to (qtrap,p0)(q_{\mathrm{trap}},p_0)⁠, which is not.
  • Round 2 (abab⁠): (q0,p0),(q1,p0)(q_0,p_0),(q_1,p_0)⁠, (q1,p0),(qtrap,p0)(q_1,p_0),(q_{\mathrm{trap}},p_0) and (q1,pa),(qtrap,pa)(q_1,p_a),(q_{\mathrm{trap}},p_a)⁠. The letter aa leads them to (q1,pa),(qok,pa)(q_1,p_a),(q_{\mathrm{ok}},p_a) and to (qok,pa),(qtrap,pa)(q_{\mathrm{ok}},p_a),(q_{\mathrm{trap}},p_a) (twice), pairs from round 1.
  • Round 3 (aabaab⁠): (q0,p0),(qtrap,p0)(q_0,p_0),(q_{\mathrm{trap}},p_0)⁠. The letter aa leads it to (q1,pa),(qtrap,pa)(q_1,p_a),(q_{\mathrm{trap}},p_a)⁠, marked in round 2.
  • Not marked (≡\equiv⁠): (qok,p0),(qok,pa)(q_{\mathrm{ok}},p_0),(q_{\mathrm{ok}},p_a)⁠. Each letter leads both states to the same state, and round 4 marks no new pair.

The classes: {(qok,p0),(qok,pa)}\{(q_{\mathrm{ok}},p_0),(q_{\mathrm{ok}},p_a)\}⁠, and each of the other five states on its own.

The quotient automaton:

Stateon aaon bb
→[(q0,p0)]\to[(q_0,p_0)][(q1,pa)][(q_1,p_a)][(q1,p0)][(q_1,p_0)]
[(q1,p0)][(q_1,p_0)][(qok,p0)][(q_{\mathrm{ok}},p_0)][(qtrap,p0)][(q_{\mathrm{trap}},p_0)]
∗ [(q1,pa)]{*}\,[(q_1,p_a)][(qok,p0)][(q_{\mathrm{ok}},p_0)][(qtrap,p0)][(q_{\mathrm{trap}},p_0)]
∗ [(qok,p0)]{*}\,[(q_{\mathrm{ok}},p_0)][(qok,p0)][(q_{\mathrm{ok}},p_0)][(qok,p0)][(q_{\mathrm{ok}},p_0)]
[(qtrap,p0)][(q_{\mathrm{trap}},p_0)][(qtrap,pa)][(q_{\mathrm{trap}},p_a)][(qtrap,p0)][(q_{\mathrm{trap}},p_0)]
∗ [(qtrap,pa)]{*}\,[(q_{\mathrm{trap}},p_a)][(qtrap,pa)][(q_{\mathrm{trap}},p_a)][(qtrap,p0)][(q_{\mathrm{trap}},p_0)]
[(q0,p0)][(q1,p0)][(q1,pa)][(qok,p0)][(qtrap,p0)][(qtrap,pa)]abababa,babba
The quotient automaton of Problem 5: six states instead of eight.

Transitions of the diagram:

  • δ([(q_0,p_0)], a) = [(q_1,p_a)]
  • δ([(q_0,p_0)], b) = [(q_1,p_0)]
  • δ([(q_1,p_0)], a) = [(q_ok,p_0)]
  • δ([(q_1,p_0)], b) = [(q_trap,p_0)]
  • δ([(q_1,p_a)], a) = [(q_ok,p_0)]
  • δ([(q_1,p_a)], b) = [(q_trap,p_0)]
  • δ([(q_ok,p_0)], a) = [(q_ok,p_0)]
  • δ([(q_ok,p_0)], b) = [(q_ok,p_0)]
  • δ([(q_trap,p_0)], a) = [(q_trap,p_a)]
  • δ([(q_trap,p_0)], b) = [(q_trap,p_0)]
  • δ([(q_trap,p_a)], a) = [(q_trap,p_a)]
  • δ([(q_trap,p_a)], b) = [(q_trap,p_0)]

Once the second letter is aa the word is known to be in the language, so there is no need to remember the last letter:
this is why (qok,p0)(q_{\mathrm{ok}},p_0) and (qok,pa)(q_{\mathrm{ok}},p_a) merge. In the other states both the number of letters read and the last letter have to be remembered, and no pair merges.

Problem 6. Let M=(Q,Σ,δ,q0,F)M=(Q,\Sigma,\delta,q_0,F) be the DFA with Q={q0,q1,q2,q3,q4,q5}Q=\{q_0,q_1,q_2,q_3,q_4,q_5\}⁠, Σ={a,b}\Sigma=\{a,b\}⁠, F={q0,q3}F=\{q_0,q_3\} and the transition function:

δ\deltaaabb
q0q_0q1q_1q3q_3
q1q_1q2q_2q3q_3
q2q_2q2q_2q2q_2
q3q_3q4q_4q0q_0
q4q_4q2q_2q0q_0
q5q_5q4q_4q2q_2

Minimize MM⁠, write the quotient automaton also as a 5-tuple M′=(Q′,Σ,δ′,s′,F′)M'=(Q',\Sigma,\delta',s',F')⁠, and describe the language of MM in words.

Hint

Draw MM from the table: each row gives two arrows, and one more arrow marks the start state q0q_0⁠.
In a drawing it is easier to see which states can be reached.

Answer

States that cannot be reached: q5q_5⁠. From q0q_0 we reach q1q_1 and q3q_3⁠, from there q2q_2 and q4q_4⁠, and none of these states has a transition to q5q_5⁠.

The table on the five states q0,…,q4q_0,\dots,q_4⁠. Round 0: the six pairs of a state from {q0,q3}\{q_0,q_3\} and a state from {q1,q2,q4}\{q_1,q_2,q_4\}⁠.
Round 1: the letter bb leads q1q_1 and q4q_4 to q3q_3 and q0q_0⁠, which are accepting, and q2q_2 to q2q_2⁠; so q1,q2q_1,q_2 and q2,q4q_2,q_4 are marked with the word bb⁠.
Round 2: q0,q3q_0,q_3 and q1,q4q_1,q_4 are left. The pair q0,q3q_0,q_3 goes on aa to q1,q4q_1,q_4 and on bb to q3,q0q_3,q_0⁠, and the pair q1,q4q_1,q_4 goes on aa to q2,q2q_2,q_2 and on bb to q3,q0q_3,q_0⁠; neither reaches a marked pair, and the process stops.

q0q_0q1q_1q2q_2q3q_3
q1q_1ε\varepsilon
q2q_2ε\varepsilonbb
q3q_3≡\equivε\varepsilonε\varepsilon
q4q_4ε\varepsilon≡\equivbbε\varepsilon

The classes: {q0,q3}\{q_0,q_3\}⁠, {q1,q4}\{q_1,q_4\}⁠, {q2}\{q_2\}⁠.

The quotient automaton: Q′={[q0],[q1],[q2]}Q'=\{[q_0],[q_1],[q_2]\}⁠, s′=[q0]s'=[q_0]⁠, F′={[q0]}F'=\{[q_0]\}⁠, and δ′\delta' in the table:

Stateon aaon bb
→∗ [q0]\to{*}\,[q_0][q1][q_1][q0][q_0]
[q1][q_1][q2][q_2][q0][q_0]
[q2][q_2][q2][q_2][q2][q_2]
[q0][q1][q2]babaa,b
The quotient automaton of Problem 6: three states instead of six.

Transitions of the diagram:

  • δ([q_0], a) = [q_1]
  • δ([q_0], b) = [q_0]
  • δ([q_1], a) = [q_2]
  • δ([q_1], b) = [q_0]
  • δ([q_2], a) = [q_2]
  • δ([q_2], b) = [q_2]

The language: the words in which every aa is immediately followed by bb⁠.
[q0][q_0] is “every aa so far was followed by bb”, [q1][q_1] is “the last letter is aa and no bb has followed it yet”, and [q2][q_2] is a rejecting trap state:
aaaa was found.

A new automaton every time

The tool draws a complete DFA over {a,b}\{a,b\} with 3 to 7 states:
sometimes it has a state that cannot be reached, and sometimes no pair is equivalent.
You go through the four steps of the problems above, and the tool checks each step before it opens the next.
In the pair table it checks every cell: a word is right if it really distinguishes the two states, even when it is not a shortest one, and a right cell shows the round in which the pair is marked.
The button “New automaton” draws another automaton; there is no limit on the number of automata, and nothing is stored.

The tool needs JavaScript. Practise with the problems on paper above.

Back to Minimization: Merging Equivalent States, or see the glossary.