In this discussion we are going to practice our constructions underlying Kleene's Theorem by taking a language given by a regular expression and successively producing a λ-NFA, an ordinary NFA, a DFA, a minimized DFA, and a new regular expression. The original regular expression is ab* + (ab)*.
Question text is in black, solutions in blue.
We begin with b*, which gets a four state λ-NFA by the
construction for Kleene star: state set {1,2,3,4}, λ-arrows from 1 to 2,
2 to 3, 3 to 2, and 3 to 4, and b-arrow from 2 to 3. Connecting this in
series with the two-state λ-NFA for the language a, we get a five-state
λ-NFA for ab*, with a new state 0 and an a-arrow from 0 to 1.
The language ab has a three-state λ-NFA -- its state set is {5,6,7}
(start state 5, final state 7) and it has an a-arrow from 5 to 6 and a b-arrow
from 6 to 7. To make the λ-NFA for (ab)* we add two new
states and four λ-arrows. Combining the machines for ab*
and (ab)* in parallel, the two new states of the second machine
become 0 and 4 respectively. So we get a machine with state set
{0,1,2,3,4,5,6,7}, start state 0, final state 4, and arrows (0,a,1),
(1,λ,2), (2,b,3), (2,λ,3), (3,λ,2), (3,λ,4),
(0,λ5), (5,a,6), (5,λ,7), (6,b,7), (7,λ,5), and
(7,λ,4).
The optimization is to combine states 1, 2, and 3 into a single state 1, with
a b-loop on it. This gives six states {0,1,4,5,6,7}, with start state 0, final
state 4, and arrows (0,a,1),
(1,b,1), (1,λ,4),
(0,λ,5), (5,a,6), (5,λ,7), (6,b,7), (7,λ,5), and
(7,λ,4).
We first find the transitive closure of the λ-moves. The existing moves
go from 0 to 5, 1 to 4, 5 to 7, 7 to 4, and 7 to 5. To get a transitively
closed set we must add λ-moves from 0 to 7, 0 to 4, and 5 to 4.
The a-arrow from 0 to 1 gives us a-arrows
from 0 to 1 and 1 to 4. The b-arrow
from 1 to 1 gives us b-arrows from 1 to 1 and 1 to 4. The a-arrow from 5 to 6
gives us a-arrows from 0 to 6, 5 to 6, and 7 to 6. The b-arrow from 6 to 7
gives us b-arrows from 6 to 4, 6 to 5, and 6 to 7. This gives us ten
letter-moves on our six states.
Since there is a λ-path in the λ-NFA from the start state
to the final state, we must make the start state 0 final in the ordinary NFA.
It thus has final state set {0,4}.
We make the following states in succession:
We begin with a set F of final states {0, 146, 1457, 14, 457} and a set N of
nonfinal states {E, 6}. Looking at N first, we see that E goes to N on both
a and b while 6 goes to N on a and to F on b. So we split N into two classes
E and 6. Looking at the five states of F we then find:
There are four different behaviors, so we now know that each state is in
a separate class except possibly for 146 and 14. But 146 goes to 1457 on
b while 14 goes to itself. So once we know that 1457 and 14 are in different
classes, it follows that 146 and 14 must be in separate classes as well.
We conclude that the seven-state DFA was already minimal.
We can keep 0 as our start state because it has no moves into it. We need to
add a new start state F and make λ-moves to F from each of the five
final states. We then proceed to eliminate states in succession:
It is fairly easy to see that this regular expression is equivalent to the
original one because we may rewrite ab* as a + ab + abbb*
and rewrite (ab)* as λ + ab + abab(ab)*.
Last modified 3 May 2007