- Statement of pumping lemma
- Using pumping lemma
- Proof of pumping lemma

If *L* is a regular language, then

- there exists a number
*n*> 0 such that - for all
*x*∈*L*with ∣*x*∣ ≥*n* - there exists strings
*u*,*v*, and*w*, such that*x*=*u**v**w*- ∣
*u**v*∣ ≤*n* - ∣
*v*∣ > 0 - for all
*k*≥ 0,*u**v*^{k}*w*∈*L*.

The pumping lemma is a tool for proving that a language is *not* regular. For example:

Claim:

L= {0^{n}1^{n}∣n≥ 0} is not regular.Proof: assume for the sake of contradiction that

Lis regular. Then there exists a numbernas in the pumping lemma. Letx= 0^{n}1^{n}. Clearlyx∈Land ∣x∣ ≥n, so we can splitxintou,vandwas in the pumping lemma. Now, since ∣uv∣ ≤n,vcan consist only of 0's. Thereforexʹ =uv^{2}w= 0^{n + ∣v∣}1^{n}. Now the pumping lemma says thatxʹ ∈L, but clearlyxʹ has more 0's than 1's, so it is not inL. This is a contradiction, so the assumption thatLwas regular must be false.

Be careful to pay attention to the quantifiers (for all and there exists) while using the pumping lemma. You don't get to pick *n* or *u*, *v*, or *w*, but you do get to pick *x* and *k*.

Proof sketch: if *L* is regular, there is a DFA *M* that recognizes *L*. *n* is the number of states. While processing the first *n* characters of *x*, we transition through *n* + 1 states, so by the pigeonhole principle, two of them must be the same. In other words, there is a loop. Let *u* be the part of *x* that leads to the start of the loop, *v* be the part of *x* that goes around the loop, and let *w* be the part of the string that takes that machine from the end of the loop to the final state.

While processing *u**v*^{k}*w* the machine transitions to the loop (using *u*), follows the loop *k* times (using *v*^{k}) and then transitions to the final state (using *w*). Thus *u**v*^{k}*w* is accepted by the machine.