RE properties and
Minimization
RIKIP GINANJAR
Closure Properties of RL
A ”closure property” is a theorem that shows that certain
operations preserve some property. People often say that a set
is closed under certain operations.
For example, the integers are closed under addition,
subtraction, and multiplication, but not division. So a closure
property is that addition of integers gives an integer.
That’s why we’re interested in closure properties of regular
languages.
Int. to Automata 2017, Rikip
Regular Operators
We can use all the different representations we have (reg exprs, DFAs, NFEs -NFAs) to
prove closure properties.
Theorem Regular sets are closed under the operations: union, concatenation, Kleene
closure.
Proof: Suppose L1 and L2 are regular languages.
Then there exist regular expressions R1 and R2 such that L ( R1 ) = L1 and L ( R2 ) = L2 .
But then L ( R1 + R2 ) = L1 U L2 , L ( R1R2 ) = L1L2 , and L ( R1* ) = L1* . So each of these
languages is regular as well.
Int. to Automata 2017, Rikip
Int. to Automata 2017, Rikip
Product construction
There is a different, more direct approach to intersection that is so important
that we should talk about it. It is the product construction.
Intuitively, the product combines two automata by working on all the pairs of
states, one from each automaton.
(Remember the cartesian product of two sets
S x T = { ( x, y ) | x S and y T } .
Given DFAs D1 = (Q1, S, δ, q0 , F1) D2 = (Q2, S , δ, s0 , F2 )
The product is (Q1 x Q2, S, δ, (q0,s0) , F1xF2) where δ((q, r), a) = (δ (q, a) , δ(r,
a)) for all q Q1 and r Q2 .
This DFA accepts L(D1) L(D2) .
Interesting point: Essentially the same construction works for NFAs.
Int. to Automata 2017, Rikip
Equivalence and Minimization Of
Automata
1. EQUIVALENCE OF STATES
2. MINIMIZATION OF AUTOMATA
Int. to Automata 2017, Rikip
Equivalence of states
When two distinct states p and q in a FA can be replaced by a single state
that behaves like both p and q
Two states p and q are equivalent: for all input strings w, (p,w) is an
accepting state if and only if (q,w) is an accepting state.
◦ we don’t require that (p,w)= (q,w)
◦ we only need that (p,w) is an accepting state and D(q,w) is an accepting state
If two states are not equivalent, then they are distinguishable.
◦ p is distinguishable from q if there is at least one string w such that one of (p,w) and
(q,w) is accepting and the other is not.
Int. to Automata 2017, Rikip
Testing Equivalence of states
0 1
0 0
A B C D
1
0
1
1
0 1
E 1 1 0
F G H
1
0
0
C and G are not equivalent, because one is accepting and the other is not (e
string can distinguish C and G)
A and G are not equivalent, because string 01 distinguish A and G: D(A,01)=C,
D(G,01)=E
A and E, no input string whatsoever will distinguish A from E; they are equivalent
states.
How about the other states? Int. to Automata 2017, Rikip
table-filling algorithm
Algorithm:
◦ if p is an accepting state and q is non accepting, then pair (p,q) is distinguishable
◦ Let p and q be states such that for some input symbol a, r=(p,a) and s=(q,a) are a
pair of states known to be distinguishable. Then {p,q} is a pair of distinguisbale states.
B • C is the only accepting state
C • Since {C,H} is distinguishable, and
D
E and F go to H and C respectively on
input 0, then {E,F} is also a distinguishable
E
• {A,G} is distinguishable
F
• the others?
G
A B C D E F G
Int. to Automata 2017, Rikip
Table-filling Algorithm
Theorem: If two states are not distinguished by the table-filling
algorithm, then the states are equivalent
◦ Proof: see the text book.
After filling the table, there are three remaining pairs, which are
therefore equivalent pairs, are {A,E}, {B,H}, and{D,F}
B x
C x x
D x x x
E x x x
F x x x x
G x x x x x x
H x x x x x x
A B C D E F G
Int. to Automata 2017, Rikip
Minimization of DFAs
The consequence of the equivalence of states is that we can minimize DFAs.
The original DFA and minimized DFA are equivalent: they accept the same
language.
Theorem: the equivalence of states is transitive.
Proof: suppose that the pairs {p,q} and {q,r} are equivalent, but {p,r} is
distinguishable. There is some input string w such that exactly one of D(p,w)
and D(r,w) is an accepting state. Suppose, D(p,w) is an accepting state. Two
cases:
◦ if (q,w) is an accepting state, {q,r} is distinguishable, since (r,w) is not an accepting
state.
◦ if (q,w) is nonaccepting state, {p,q} is distinguishable. We conclude by contradiction that
{p,r} is not distinguishable, therefore {p,r} is equivalent.
Int. to Automata 2017, Rikip
Minimization of DFAs (cont)
Algorithm:
◦ first, eliminate any state that cannot be reached from start state.
◦ the partition the remaining states into blocks, so that all states in the
same block are equivalent,
◦ and no pair of states from different blocks are equivalent
Then, we can form the partition of the states into equivalent blocks is
({A,E},{B,H},{C},{D,F},{G})
Int. to Automata 2017, Rikip