Presentation is loading. Please wait.

Presentation is loading. Please wait.

Properties of Regular Sets

Similar presentations


Presentation on theme: "Properties of Regular Sets"— Presentation transcript:

1 Properties of Regular Sets
Pumping Lemma Ultimate periodicity Closure under some operations State Minimization #005

2 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.                    •                 L  ¢  #005

3 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

4 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). as+1…at v= No qt on this path u w a1…as at+1…am q0 qs=qt qm #005

5 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?                    •                 L  ¢  #005

6 Usage of regularity preserving operations
AnBn’={anbn | n1} AnBn=AnBn’{} L4={x{a,b}* | #a(x)=#b(x)} AnBn=L4a*b* 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. L5={anbmcn | n,m0}                    •                 L  ¢  #005

7 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.                    •                 L  ¢  #005

8 The State Minimization 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

9 State Minimization: An Example
a b unreachable from 0  : 1st time  : 2nd time       -      Identify 1 and 2; and 3 and 4. a 1 3 a,b a b b 5 b a,b 2 4 a,b a a b 6 a,b a,b a,b a,b #005

10 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) (b) a b q1 q6 q  p {p,q} {r} q2 q5 q q {r,s}  q3 q4 q r  {p,r,s} q4 q3 q s   q5 q2 q t {q} {r,s} q6 q1 q4                    •                 L  ¢  #005


Download ppt "Properties of Regular Sets"

Similar presentations


Ads by Google