Pumping Lemma More Examples

 Example

Regular — L=(ab)L = (ab)^*

Let pp be the pumping length (a DFA for (ab)(ab)^* has 2 states, so p can be taken as 2).

Pick s=abab=(ab)2s = abab = (ab)^2. Choose the decomposition

  • x=ϵ, y=ab, z=abx=\epsilon,\ y=ab,\ z=ab.
    Check: xy=2p, y=21|xy|=2 \le p,\ |y|=2\ge1.
    Pump: for i=2, xy2z=(ab)(ab)(ab)=(ab)3Lxy^2z = (ab)(ab)(ab) = (ab)^3 \in L.
    (So the decomposition exists and pumping keeps the string in LL.)

 Example

Regular — L=(a)

Proof.

  1. Choose p=1p=1. (Any fixed positive integer works; choosing 1 makes the argument simplest.)

  2. Let sas\in a^* with sp=1|s|\ge p=1. Then ss is of the form ana^n for some n1.

  3. Decompose ss as

    x=ϵ,y=a,z=an1.x=\epsilon,\qquad y=a,\qquad z=a^{n-1}.

    Then y=11|y|=1\ge1 and xy=1p.

  4. For any i0i\ge0,

    xyiz=ϵaian1=an1+ia.xy^iz=\epsilon\cdot a^i\cdot a^{n-1}=a^{n-1+i}\in a^*.

    Thus every pumped string remains in aa^*.

  5. If s<p|s|<p (i.e. s=ϵs=\epsilon

    ), the lemma’s requirement is vacuous because it only asserts something for strings of length 
    p\ge p.

Hence a∗ satisfies the pumping-lemma conditions with pumping length p=1. 











 Example

Non-regular — Palindromes over {a,b}\{a,b\}

Let pp be pumping length. Choose

s=apbap,s = a^{p} b a^{p},

a palindrome. Decompose s=xyzs=xyz with xyp, y1|xy|\le p,\ |y|\ge1. Then yy lies entirely in the left block of aa's, so y=ak, k1y=a^k,\ k\ge1. Pump with i=0i=0:

xz=apkbap,xz = a^{p-k} b a^{p},

which has fewer aa's on the left than on the right, so it is not a palindrome. Thus xzLxz\notin L

— contradiction. Palindromes are not regular.

 Example

L={a^nb^nn0}

Answer: Not regular.

Proof :
Assume L1L_1 is regular. Let pp be the pumping length. Take s=apbpL1s=a^{p}b^{p}\in L_1 with sp|s|\ge p. By pumping lemma write s=xyzs=xyz with xyp|xy|\le p, y1|y|\ge1. Because xyp|xy|\le p, yy consists only of aa's, say y=aky=a^k with k1. Pump with i=0: xy0z=xz=apkbp. This string has
aa's and pp bb's, so xzL1xz\notin L_1, contradicting the pumping lemma. Hence L1L_1 is not regular. ∎

 Example

Answer: Not regular.

Proof:
Assume regular and let pp be the pumping length. Choose s=0p1p0ps=0^{p}1^{p}0^{p}. Decompose s=xyzs=xyz with xyp|xy|\le p, y1|y|\ge1. Then xyxy lies entirely in the first block 0p0^p, so y=0ky=0^k with k1k\ge1. Pump with i=0i=0: xz=0pk1p0pxz=0^{p-k}1^{p}0^{p}. Now the first and last zero-blocks have different lengths (pkp-kvs pp), so xzL2xz\notin L_2. Contradiction ⇒ not regular. ∎

 Example

L
={w{0,1}#0(w)=#1(w)}

Answer: Not regular.

Proof :
Assume regular; let pp be pumping length. Choose s=0p1ps=0^{p}1^{p}. Decompose s=xyzs=xyz with xyp|xy|\le p, y1. Then yy consists only of 00's (say 0k0^k). Pump with i=0: xz=0pk1pxz=0^{p-k}1^{p} has fewer 0's than 1's, so xzL3xz\notin L_3. Contradiction ⇒ not regular.

 Example

Answer: Not regular.

Proof :
Assume regular; let pp be pumping length. Choose s=a2pbps=a^{2p} b^{p}(so m=2nm=2n). Decompose s=xyzs=xyz with xyp|xy|\le p, y1|y|\ge1. Since xyp|xy|\le p, yy lies within the first pp aa’s, so y=aky=a^k with k1k\ge1. Pump with i=0i=0: xz=a2pkbpxz=a^{2p-k}b^{p}. But now the number of aa’s is 2pk2p-k, and condition m=2nm=2n would demand 2pk=2p2p-k = 2pk=0, contradiction. Thus xzL6xz\notin L_6. Hence L6L_6 is not regular. ∎

is not regular. (I write m1m\ge1 because “multiple of mm” is not meaningful for m=0m=0.)


 Example

L={a^nb^mn is a multiple of m, m1}


Proof (by Pumping Lemma)

Assume L is regular. Let p1p\ge1 be the pumping length given by the pumping lemma.

Choose the string

s=ap!bp!L
,
s = a^{p!}\,b^{p!}\in L_{12},

since p! is clearly a multiple of p!p!. Note s=2p!p|s|=2p! \ge p

By the pumping lemma write s=xyzs=xyz with

  1. y1,

  2. xyp|xy|\le p,

  3. xyizLfor all i0i\ge0.

From xyp|xy|\le p we see xyxy lies entirely inside the first pp symbols of ss, i.e. inside the first block of aa’s. Therefore yy consists only of aa’s:

y=akfor some k with 1kp.y = a^{k}\quad\text{for some }k\text{ with }1\le k\le p.

Now pump with i=2. The pumped string is

xy2z=ap!+kbp!.xy^{2}z = a^{p!+k}\,b^{p!}.

To belong to L, the number of aa’s (which is p!+kp!+k) would have to be a multiple of the number of bb’s (which is p!p!). But p!p!divides p!+kp!+k iff p!p! divides kk. Since 1kp, p!kp!\nmid k. Hence p!(p!+k)p!\nmid (p!+k), so ap!+kbp!L
a^{p!+k}b^{p!}\notin L_{12}

This contradicts condition (3) of the pumping lemma. Therefore our assumption that
L​ is regular is false.

Example

Language. L={ai2i1}L=\{a^{i^2}\mid i\ge 1\} (all unary strings whose length is a perfect square).

Claim. LL is not regular.

Proof (by pumping lemma).

  1. Assume, for contradiction, that LL is regular. Then the pumping lemma gives a pumping length p1p\ge1.

  2. Choose the particular string

    s=ap2L,s = a^{p^{2}}\in L,

    since p2p^{2} is a perfect square and s=p2p|s|=p^{2}\ge p.

  3. By the pumping lemma we can write s=xyzs=xyz with

    • y1|y|\ge1,

    • xyp|xy|\le p,

    • and xyizLxy^{i}z\in L for every integer i0.

  4. From xyp|xy|\le p we know xyxy lies entirely in the first pp symbols of ss. Thus yy consists only of aa’s, so

    y=akfor some k with 1kp.y = a^{k}\quad\text{for some }k\text{ with }1\le k\le p.
  5. Pump with i=2i=2. The pumped string has length

    xy2z=p2+k.|xy^{2}z| = p^{2} + k.

    We will show p2+kp^{2}+k is not a perfect square, so xy2zLxy^{2}z\notin L, contradicting the pumping lemma.

  6. Note that

    p2<p2+kp2+p<p2+2p+1=(p+1)2.

    Thus p2+kp^{2}+k lies strictly between consecutive perfect squares p2p^{2} and (p+1)2(p+1)^{2}, so it cannot itself be a perfect square.

  7. Therefore xy2zLxy^{2}z\notin L, contradicting the pumping lemma requirement that xyizLxy^{i}z\in L for all i0i\ge0.

Hence our assumption was false and LL is not regular.

Example

is not regular.

Proof :

Assume, for contradiction, that LL is regular. Let p1p\ge1 be the pumping length given by the pumping lemma.

Choose the string

s=02pL,s = 0^{2^{p}}\in L,

since 2p2^{p} is a power of 22 and s=2pp|s|=2^{p}\ge p.

By the pumping lemma we can write s=xyzs=xyz with

  1. y1,

  2. xyp|xy|\le p,

  3. xyizL for every integer i0.

Because xyp|xy|\le p, the substring yy lies entirely in the first pp symbols of ss. Hence yy consists only of zeros:

y=0kfor some k with 1kp.y = 0^{k}\quad\text{for some }k\text{ with }1\le k\le p.

Now pump with i=2i=2. The pumped string xy2zxy^{2}z has length

xy2z=2p+k.|xy^{2}z| = 2^{p} + k.

We show 2p+k2^{p} + k is not a power of 22. Indeed,

2p<2p+k2p+p<2p+2p=2p+1,2^{p} < 2^{p}+k \le 2^{p}+p < 2^{p}+2^{p} = 2^{p+1},

because kp<2pk\le p < 2^{p}. Thus 2p+k2^{p}+k lies strictly between consecutive powers of 22, namely between 2p2^{p} and 2p+12^{p+1}, so it cannot be a power of 22. Therefore xy2zLxy^{2}z\notin L, contradicting condition (3) of the pumping lemma.

Hence our assumption that LL is regular is false.

Comments

Popular posts from this blog

Theory Of Computation PCCST302 KTU Semester 3 BTech 2024 Scheme

Non deterministic Finite Automata NFA

Example DFAs University Questions