Summary
Showing regular
construct DFA, NFA
construct regular expression
show L is the union, concatenation,
intersection (regular operations) of regular
languages.
Showing non-regular
pumping lemma
assume regular, apply closure properties of
regular languages and obtain a known non-
regular language.
1
Equivalence & Minimization
of
Automata
2
Outline
• Equivalence of
• a state in a DFA
• regular languages
• Minimization of DFA
• smallest possible DFA for a given
regular language
3
Equivalent States.
Example
Consider the accept states c and g. They are
both sinks meaning that any string which ever
reaches them is guaranteed to be accepted later.
0,1
Q: Do we need both states?
0
b c
1
0 0,
1
0 1
a d e
1 1 0,1
0
f g
4
Example (cont)
A: No, they can be unified as illustrated below.
Q: Can any other states be unified because any
subsequent string suffixes produce identical
results?
b
0 1 0 0,1
0 1
a d e 0, cg
1
1 1
0
f
5
Example (cont)
A: Yes, b and f. Notice that if you’re in b or f
then:
if string ends, reject in both cases
if next character is 0, forever accept in both cases
if next character is 1, forever reject in both cases
b
So unify b with f.
0 1 0 0,1
0 1
a d e 0, cg
1
1 1
0
f
6
Example (cont)
Intuitively two states are equivalent if all
subsequent behavior from those states is the
same.
Come up with a formal characterization of state
equivalence.
Q: Any other ways to simplify the automaton?
0,1
0 1
a d e 0, cg
1
0, 1
1 0
bf
7
Example (cont)
A: Get rid of d.
i.e. Getting rid of unreachable useless states
doesn’t affect the accepted language.
0,1
a e 0, cg
1
0, 1
1 0
bf
8
Equivalent States.
Definition
DEF:
Two states q and q’ in a DFA M = (Q, Σ, δ, q0,
F ) are said to be equivalent (or
indistinguishable) if for all strings u Σ*, the
states on which u ends on when read from q
and q’ are both accept, or both non-accept.
Equivalent states may be glued together
without affecting M’ s behavior.
9
Minimization Algorithm.
Goals
DEF: An automaton is irreducible if
• it contains no useless states, and
• no two distinct states are equivalent.
The goal of minimization algorithm is to create
irreducible automata from arbitrary ones. Later:
remarkably, the algorithm actually produces
smallest possible DFA for the given language,
hence the name “minimization”.
10
Minimization of DFA’s
Example:
The DFA has equivalence classes
{{A,E}, {B,H}, {C}, {D,F}, {G}}
11
Equivalence Class
Transitivity: If p ≡ q and q ≡ r, then p ≡ r
Proof: Suppose to the contrary that p ≢ r
Then w : * ( p, w) F & * (r , w) F
or vice versa. Now * ( q, w) is either accepting
or not
If * ( q, w) F q r
Otherwise * ( q, w) F p q
The vice versa case is proved symmetrically
p r
12
Minimization of DFA’s (cont)
13
Example
Can be minimized to
({ A, E},0} B / H / {B, H }
( A,0) B ( E ,0) H
&
({ A, E},1} D / F / {D, F }
( A,1) F ( E ,1) F
14
Cannot apply the TF-algo to NFA’s
For Example, to minimize
Simply remove state C
However, A ≢ C
15
Minimized DFA Cannot be Beaten
Let B be the minimized DFA obtained by applying
the TF-Algo to DFA A. We know that L(A) = L(B)
What if there existed a DFA C with L(C) = L(B) and
fewer states than B?
If we run the TF-Algo on B “union” C
B C
q q L( B ) L(C )
0 0
Also ( q0B , a ) ( q0C , a ), a
B C
If we could distinguish successors q
q
then 0 0
16
Minimized DFA Cannot be Beaten
(cont)
Claim: For each state p in B there is at least
p q
one state q in C, s.t.
Proof: There are no inaccessible states, so
p * (q0 , a1a2 ak )
B
Now q * ( q C
0 , a1a2 ak ) p q
and
q0 q0 (q0 , a1 ) (q0 , a1 )
B C B C
* (q0B , a1a2 ) * (q0C , a1a2 )
Since C has fewer states than B, there must
be two states r & s of B s.t.r t s For
some state t of C.
rBut
s
CONTRADICTION!! 17