# Lecture 36: pumping lemma

• Statement of pumping lemma
• Using pumping lemma
• Proof of pumping lemma

## The 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 = uvw
• uv∣ ≤ n
• v∣ > 0
• for all k ≥ 0, uvkw ∈ L.

## Using the pumping lemma

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

Claim: L = {0n1n  ∣  n ≥ 0} is not regular.

Proof: assume for the sake of contradiction that L is regular. Then there exists a number n as in the pumping lemma. Let x = 0n1n. Clearly x ∈ L and x∣ ≥ n, so we can split x into u, v and w as in the pumping lemma. Now, since uv∣ ≤ n, v can consist only of 0's. Therefore xʹ = uv2w = 0n + ∣v1n. Now the pumping lemma says that xʹ ∈ L, but clearly xʹ has more 0's than 1's, so it is not in L. This is a contradiction, so the assumption that L was 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 of the pumping lemma

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 uvkw the machine transitions to the loop (using u), follows the loop k times (using vk) and then transitions to the final state (using w). Thus uvkw is accepted by the machine.