Finite State Machines State Minimization
Finite State Machines State Minimization
State Minimization
Chapter 5
State Minimization
Consider:
State 3 is unreachable.
Example:
(1) a b a b a b
(2) b a a b a b
Suppose L = {w {a, b}* : |w| is even}. Are (1) and (2) equivalent?
= {a, b}
L = aab*a
[0] []
[1] [a, aba, ababa, …]
[2] [b, ab, bab, abab, …]
[3] [aa, abaa, ababb…]
Does L Always Have a Finite Number
of Equivalence Classes?
= {a, b}
L = {anbn, n 0}
aa aaaa
a aba aaaaa
b aaa
0 b a 3 a,b
b 2 b
The Myhill-Nerode Theorem
Theorem 5.6 (Myhill-Nerode): A language is regular iff the
number of equivalence classes of L is finite.
Consider:
Minimizing an Existing DFSM
(Without Knowing L)
Two approaches:
q2 q3
Constructing as the Limit of a Sequence of
Approximating Equivalence Relations n
q n p
iff
1. q n-1 p, and
2. a ((p, a) n-1 (q, a))
MinDFSM
MinDFSM(M: DFSM) =
1. classes := {A, K-A};
2. While E classes, p,q E, c with [(p,c)] ≠ [(q,c)] do
3. split E such that [p] ≠ [q]
4. remove E from classes
5. add the subclasses of E to classes
6. return M* = (classes, , , [sM], {[q]: q AM]}), where M* is
constructed as follows:
if M(q, c) = p, then M*([q], c) = [p]
An Example
= {a, b}
0 = {[1,3,5,6], [2,4]}
1 = {[1,3,5], [6], [2,4]}
2 = {[1,3,5], [2], [4], [6]}
The Result
Summary