Properties of Regular Sets Pumping Lemma Ultimate periodicity










- Slides: 10
Properties of Regular Sets Pumping Lemma Ultimate periodicity Closure under some operations State Minimization #005 1
Closure Properties n THEOREM R is closed under , • , *, , -, c, R, substitution, homomorhism, inverse homomorphism, gsm, etc. n L is said to be closed under n-ary operation iff (L 1, …, Ln) is in L for any L 1, …, Ln in L. If L *, Lc or L is defined to be *-L. A mapping h: * * is a homomorphism if h( )= and h(x 1…xn)=h(x 1)…h(xn) for each x 1, …, 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 . (a 1…an): = (a 1)… (an), (L): = x L (x). A gsm is a finite automaton with output. n n #005 2
The Pumping Lemma for Regular Sets n 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, , , q 0, F) accepting L. Let n=|Q|, the # of states of M. Suppose x=a 1 a 2…am L (ai ) & |x|=m n, and for each i let *(q 0, a 1…ai)=qi. Then there exist identical states, say qs and qt, among q 0, q 1, …, qm. *(qs, as+1…ai) qt for each i (s+1 i t-1). Thus *(q 0, uviw)= *(q 0, uvw) F for each i (including 0). v= as+1…at q 0 u a 1…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 n An. Bn: ={anbn | n 0} If An. Bn 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+. n L 2={an n | n 0} n L 3={ap | p is prime} n L 4={x {a, b}* | #a(x)=#b(x)} The pumping lemma does not work for L 4. Why? #005 5
Usage of regularity preserving operations n An. Bn’={anbn | n 1} An. Bn=An. Bn’ { } n L 4={x {a, b}* | #a(x)=#b(x)} An. Bn=L 4 a*b* n. L 5={anbmcn | n, m 0} An. Bn=h(L 5), where h is the homo. defined by h(a)=a, h(b)= , and h(c)=b. n Define a gsm M which converts L 5 to An. Bn, i. e. , M(L 5)=An. Bn. #005 6
State Minimization n Why important? Min. DFA: A minimization algorithm n M=(Q, , , q 0, F): a DFA with total s. t. f. 1. Remove all the states which are unreachable from q 0. 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. n #005 7
The State Minimization Theorem THEOREM n (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. n The DFA obtained by applying algorithm Min. DFA is the minimum state DFA (which is unique up to isomorphism). #005 8
State Minimization: An Example n 0 1 2 3 4 5 6 a b 1 2 3 4 a 4 3 0 5 5 b 5 5 0 1 unreachable b 1 2 3 4 5 1 2 3 a, b b 5 a, b 2 a 4 a, b a b 6 from 0 0 a 1 3 4 : 1 st time : 2 nd time 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) {a 2 nb 3 m | n, m 0}, (b) {a 2 nb 3 n | 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) {xx. R | x in a*}, (e) {xx. R | 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 q 1 q 6 q 3 p {p, q} {r} q 2 q 5 q 6 q {r, s} q 3 q 4 q 5 r {p, r, s} q 4 q 3 q 2 s q 5 q 2 q 1 t {q} {r, s} q 6 q 1 q 4 #005 10