In this discussion we practiced all of the constructions from Kleene's Theorem, starting with the regular expression (b+a(a+ba*b))*a.
The suggested optimization is to merge states 6 and 7 into a single
final state 6, with now an a-move from state 5 to state 6.
We begin by finding the transitive closure of the λ-moves. We have
λ-moves from 1 to 2, 2 to 5, and 5 to 2. (We have eliminated the
former λ-move from 5 to 6.) The transitive
closure includes an additional λ-move from 1 to 5 -- all other two-step
paths are either covered by λ-moves or are from a vertex to itself.
Now we add the letter moves for each of the letter moves of the
λ-NFA:
Since there is no λ-path from start to final state, we do not need to
make the start state final. We have a total of eighteen letter moves.
For convenience I will rename the states 1, 36, 25, and 4.
Our initial partition has F = {36} and N = {1, 25, 4}. Looking at N, we
find that 1 and 25 each go to
F on a and to N on b, while 4 always goes to N. So we split N.
Now we have F = {36}, X = {1, 25}, and Y = {4}. We look at X and see that
both states go to F on a and to X on b. So this is our final partition.
The minimal DFA has three states:
We take the three-state NFA and add a new start state S and a new final state
Z, with new λ-moves from S to X and from F to Z.
The easiest state to eliminate first is Y, leaving a move
(F,ba*b,X) which merges with a parallel move to become
(F,a + ba*b, X).
Now we may kill F, leading to two moves (X,a,Z) and (X,a(a+ba*b),
X). The latter move merges with the parallel loop at X to make
(X,b + a(a+ba*b), X).
Now killing the last move leaves us the regular expression
(b + a(a + ba*b))*a, which is exactly the regular
expression we started with. There are other valid regular expressions that
are obtained by eliminating the states in a different order.
Last modified 15 May 2006