CS 254: Automata and Computability

A sample pumping lemma argument

The following statement and proof illustrate a formal structure that can be used to make an argument based on the pumping lemma for context-free languages.

The statement and proof

Let A = {an bn cn | n ≥ 0}. Then A is not a context-free language.

Proof:

Let k by an arbitrary non-negative integer. Set z = ak bk ck. Then |z| ≥ k.

Let u, v, w, x, and y be any strings for which z = uvwxy, vx ≠ ε, and |vwx| ≤ k. The structure of v, w, and x breaks down into the following cases:

  1. vx = ai bj for some i, j ≥ 0 such that i + j > 0. In this case, uv2wx2y will consist of (2k + i + j) a's and b's, followed by k c's. Since the number of a's and b's is strictly greater than twice the number of c's, uv2wx2y ∉ A.
  2. vx = bi cj for some i, j ≥ 0 such that i + j > 0. In this case, uv2wx2y will consist of k a's followed by (2k + i + j) b's and c's. Since the number of b's and c's is strictly greater than twice the number of a's, uv2wx2y ∉ A.

There are no more cases than cases 1 and 2 since |vwx| ≤ k. Thus, for any decomposition of z into uvwxy with the properties listed above, there exists an i ≥ 0 (specifically, i = 2) such that uviwxiy ∉ A. Therefore, by the Pumping Lemma, A is not context-free.

Notes on the proof