005: Properties of Regular Sets

Properties of
Regular Sets
Pumping Lemma
Ultimate periodicity
Closure under some operations
State Minimization
#005
1
Closure Properties

THEOREM R is closed under ,
•, *, , -, c, R, substitution,
homomorhism, inverse
homomorphism, gsm, etc.

L is said to be closed under n-ary
operation  iff (L1,…,Ln) is in L for
any L1,…,Ln in L.
If L*, Lc or L is defined to be *-L.
A mapping h:** is a
homomorphism if h()= and
h(x1…xn)=h(x1)…h(xn) for each x1,…,xn
in *. For L* and L’*, define
h(L):={h(x) | x in L}*, and
h-1(L’):={x* | h(x) in L’}.
A substitution w.r.t. L is a map : 2*
s.t. (a) is in L for any a in .
(a1…an):=(a1)…(an), (L):=xL(x).
A gsm is a finite automaton with output.




#005
2
The Pumping Lemma
for Regular Sets

THEOREM
L*
[ LR  n x
[ xL & |x|n 
u,v,w*
[ x=uvw & |uv|n & v &
i0 [uviwL]
]
]
]
For any regular set L, there exists
an integer n s.t. if x is in L and its
length is n then x=uvw for some
u,v, and w, and uviw is in L for
each i0.
#005
3
Proof of the Pumping Lemma
There exists a DFA M=(Q,,,q0,F)
accepting L.
Let n=|Q|, the # of states of M.
Suppose x=a1a2…amL (ai) &
|x|=mn, and for each i let
*(q0,a1…ai)=qi. Then there exist
identical states, say qs and qt,
among q0,q1,…,qm.
*(qs,as+1…ai)qt for each i (s+1it-1).
Thus *(q0,uviw)=*(q0,uvw)F
for each i (including 0).
v= as+1…at
q0
u
a1…as
qs=qt
#005
No qt on this path
w
at+1…am
qm
4
Applications of the Pumping
Lemma:
Examples of Non-regular Set
AnBn:={anbn | n0}
If AnBnR, let n be an integer
satisfying P.L. and consider
x=anbn. Assuming x=uvw, a
contradition is derived in
each of the following cases:
(i) va+, (ii) va+b+, (iii) vb+.
 L2={ann | n0}
 L3={ap | p is prime}
 L4={x{a,b}* | #a(x)=#b(x)}

The pumping lemma does not work for
L4. Why?
#005
5
Usage of regularity
preserving operations
AnBn’={anbn | n1}
AnBn=AnBn’{}
 L4={x{a,b}* | #a(x)=#b(x)}
AnBn=L4a*b*
L5={anbmcn | n,m0}

AnBn=h(L5), where h is the
homo. defined by h(a)=a,
h(b)=, and h(c)=b.
 Define a gsm M which
converts L5 to AnBn, i.e.,
M(L5)=AnBn.
#005
6
State Minimization

Why important?

MinDFA: A minimization algorithm

M=(Q,,,q0,F): a DFA with total s.t.f.

1. Remove all the states which are
unreachable from q0. To do that, use
depth-first search on the STG of M.
In what follows, identify (p,q) and (q,p).
2. For each (p,q)QQ,
if (pF & qF) then mark (p,q).
3. Repeat
if (p,q) is not yet marked, and
((p,a),(q,a)) is marked for some
a in , then mark (p,q)
until no new pair is marked.
4. If (p,q) is not marked, identify p and q.
#005
7
The State Minimization Theorem
THEOREM
 (p,q) is marked iff *(p,x)F and
*(q,x)F for some x. Thus
(p,q) is not marked iff either
*(p,x)F & *(q,x)F for all x, or
*(p,x)F & *(q,x)F for all x.
 Identify those states whose contributions to
acceptance and nonacceptance of inputs are
totally equal.

The DFA obtained by applying
algorithm MinDFA is the
minimum state DFA (which is
unique up to isomorphism).
#005
8
State Minimization:
An Example

0
1
2
3
4
5
6
a b
1 2
3 4
1 a 3 a,b
a
4 3
b
0
b
5
5 5
b 2
5 5
4 a,b
a
5 5
b
0 1 unreachable a
6
from 0
0
1
2
3
4
5





1



a,b
2
3
4
: 1st time
: 2nd time



a,b


a,b
a,b a,b
Identify 1 and 2; and 3 and 4.
#005
9
Exercises
1. Which are regular sets, and which are
not ? Prove your answer.
(a) {a2nb3m | n,m0}, (b) {a2nb3n | n0},
(c) {x{a,b}* | #a(x)#b(x)}, (d) The set of
all strings over {0,1} that do not have
3 consequtive 0’s, (d) {xxR | x in a*},
(e) {xxR | x in (a+b)*}  Reg. exps. may
be confused with the languages they
denote.
2. Give an equivalent minimum state DFA
and an equivalent reg. exp.:
(a)
0 1
(b)
a
b
q1 q6 q3
 p {p,q}
{r}
q2 q5 q6
q {r,s}

q3 q4 q5
r
 {p,r,s}
q4 q3 q2
s


q5 q2 q1
t
{q}
{r,s}
q6 q1 q4
#005
10