The document Pumping lemma Computer Science Engineering (CSE) Notes | EduRev is a part of the Computer Science Engineering (CSE) Course Mock Test Series - Computer Science Engg. (CSE) GATE 2020.

All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)

There are two Pumping Lemmas, which are defined for

1. Regular Languages, and

2. Context â€“ Free Languages

**Pumping Lemma for Regular Languages**

For any regular language L, there exists an integer n, such that for all x âˆˆ L with |x| â‰¥ n, there exists u, v, w âˆˆ Î£âˆ—, such that x = uvw, and

(1) |uv| â‰¤ n

(2) |v| â‰¥ 1

(3) for all i â‰¥ 0: uv^{i}w âˆˆ L

In simple terms, this means that if a string v is â€˜pumpedâ€™, i.e., if v is inserted any number of times, the resultant string still remains in L.

Pumping Lemma is used as a proof for irregularity of a language. Thus, if a language is regular, it always satisfies pumping lemma. If there exists at least one string made from pumping which is not in L, then L is surely not regular.

The opposite of this may not always be true. That is, if Pumping Lemma holds, it does not mean that the language is regular.

For example, let us prove L_{01} = {0^{n}1^{n} | n â‰¥ 0} is irregular.

Let us assume that L is regular, then by Pumping Lemma the above given rules follow.

Now, let x âˆˆ L and |x| â‰¥ n. So, by Pumping Lemma, there exists u, v, w such that (1) â€“ (3) hold.

We show that for all u, v, w, (1) â€“ (3) does not hold.

If (1) and (2) hold then x = 0^{n}1^{n} = uvw with |uv| â‰¤ n and |v| â‰¥ 1.

So, u = 0^{a}, v = 0^{b}, w = 0^{c}1^{n} where : a + b â‰¤ n, b â‰¥ 1, c â‰¥ 0, a + b + c = n

But, then (3) fails for i = 0

uv^{0}w = uw = 0^{a}0^{c}1^{n} = 0^{a + c}1^{n} âˆ‰ L, since a + c â‰ n.

For above example, 0^{n}1^{n} is CFL, as any string can be the result of pumping at two places, one for 0 and other for 1.

Let us prove, L_{012} = {0^{n}1^{n}2^{n} | n â‰¥ 0} is not Context-free.

Let us assume that L is Context-free, then by Pumping Lemma, the above given rules follow.

Now, let x âˆˆ L and |x| â‰¥ n. So, by Pumping Lemma, there exists u, v, w, x, y such that (1) â€“ (3) hold.

We show that for all u, v, w, x, y (1) â€“ (3) do not hold.

If (1) and (2) hold then x = 0^{n}1^{n}2^{n} = uvwxy with |vwx| â‰¤ n and |vx| â‰¥ 1.

(1) tells us that vwx does not contain both 0 and 2. Thus, either vwx has no 0â€™s, or vwx has no 2â€™s. Thus, we have two cases to consider.

Suppose vwx has no 0â€™s. By (2), vx contains a 1 or a 2. Thus uwy has â€˜nâ€™ 0â€™s and uwy either has less than â€˜nâ€™ 1â€™s or has less than â€˜nâ€™ 2â€™s.

But (3) tells us that uwy = uv^{0}wx^{0}y âˆˆ L.

So, uwy has an equal number of 0â€™s, 1â€™s and 2â€™s gives us a contradiction. The case where vwx has no 2â€™s is similar and also gives us a contradiction. Thus L is not context-free.

Offer running on EduRev: __Apply code STAYHOME200__ to get INR 200 off on our premium plan EduRev Infinity!

131 docs|169 tests

### Turing Machines And Undecidability

- Doc | 13 pages

- Context-free Grammars And Push-Down Automata
- Doc | 11 pages
- Regular Expressions And Finite Automata
- Doc | 20 pages
- Test: Identify Class Language
- Test | 10 ques | 20 min