4.6.12 · D5Theory of Computation
Question bank — Pumping lemma for CFLs
Prerequisites worth having fresh: Chomsky Normal Form, Parse Trees and Derivations, Pigeonhole Principle, and Pumping lemma for regular languages for contrast.
True or false — justify
Every context-free language satisfies the pumping lemma.
True — the lemma is a necessary property of all CFLs, so passing it is expected and proves nothing on its own.
If a language satisfies the pumping lemma, it must be context-free.
False — the lemma is necessary but not sufficient; some non-CFLs still satisfy a pumping-style property, so you cannot conclude "CFL" from it. To prove CFL you must exhibit a grammar or PDA.
The CFL pumping lemma has exactly one pumped piece, just like the regular version.
False — it has two pieces and pumped together with the same exponent , because a repeated variable grows the parse tree on both sides.
In , the pieces and can be pumped with different exponents.
False — they always share the same : . They come from one repeated variable, so one loop-count controls both.
The condition means both and are non-empty.
False — it means they are not both empty; one of them may be empty as long as the other has at least one symbol.
Choosing the string is up to us when we play the refutation game.
True — the adversary hands us , then we pick a clever with . This is the step where good choices win.
Choosing the split is also up to us.
False — the adversary chooses any valid split (respecting and ); our job is to beat every such split.
The pumping lemma can prove a language IS context-free.
False — it can only ever prove a language is not context-free (by contradiction). It is a one-directional tool.
If you find one string in that pumps fine, is context-free.
False — the lemma says every long string pumps, so one good-behaving string proves nothing. To refute you need one bad witness that no split can pump.
If you find one long string in that cannot be pumped, is not context-free.
True — that single un-pumpable witness contradicts the lemma, so cannot be a CFL.
The pumping length depends on the string .
False — is a constant of the language (roughly where is the number of variables in a CNF grammar). It is fixed before any is chosen.
Converting to CNF is essential to the proof, but a CFL might have grammars not in CNF.
True — CNF makes parse trees binary so we can bound leaves by height, but the lemma's statement holds for the language regardless of which grammar you started from.
Spot the error
"To prove is not a CFL, I picked , and no split kept it in ."
Error: unless also equals the - and -counts, and even so it is a weak witness. The correct witness is , whose three blocks the window cannot all span.
"I picked for and it pumped, so is context-free."
Error: a weak witness pumping proves nothing (necessary-not-sufficient). Use a harder witness like , and note the game only ever proves not-CFL, never CFL.
"The adversary must split so that and land in different blocks."
Error: the adversary picks any valid split; you cannot assume where land. You must argue the contradiction holds for all placements consistent with .
"Since , the piece touches at most one letter type in ."
Error: a window of length straddling a boundary can touch two adjacent letter types; it just cannot span from an to a (they are apart). The argument must allow two types.
"I pumped up with and it stayed in , so the split survives — the language is a CFL."
Error: surviving one is not enough for you, but also does not help the language. You need some (0 or 2) that ejects the string, and you only prove not-CFL, never CFL.
" guarantees and are each of length at most ."
Slight but real error: it bounds the whole window together by , which does bound and individually — but the useful fact is the combined window is localized, not that any single piece is large.
"In I always pump up to break it."
Error: pumping up only works when omits (raising an earlier count above ). If omits , you must pump down () to shrink or below the fixed -count. Both cases are required.
Why questions
Why does the CFL version have two pump pieces while the regular version has one?
A DFA loop repeats a linear cycle giving one piece; a CFG's repeated variable sits inside a branching parse tree, inserting symbols on both the left () and right ().
Why set (strictly more than ) rather than ?
A binary tree of height has at most leaves; needing strictly more than leaves forces height , which by pigeonhole forces a repeated variable on some path. The strict inequality is exactly why we exceed .
Why do we pick the two lowest repeated variables on the path?
Picking the lowest pair keeps the upper 's subtree small (bounded height), which is what guarantees . A higher pair could give an arbitrarily large window.
Why does hold — why can't both pieces be empty?
In CNF a node has two children, so the upper 's subtree is strictly larger than the lower 's subtree; the extra symbols are exactly and , so at least one is non-empty. CNF's ban on unit/-rules prevents .
Why choose a witness with several interacting blocks (e.g. )?
The bounded window can only reach a couple of adjacent blocks, so pumping unavoidably breaks the balance a third block requires — the interaction is what makes the string un-pumpable.
Why is the pumping lemma a "game against an adversary"?
Because the quantifiers alternate: (adversary), becomes we choose one bad , splits (adversary), (we choose). Modelling it as a game keeps the "who chooses what" straight.
Why can't we conclude context-freeness even when every string pumps?
Pumpability is only necessary; certain non-CFLs mimic it, so the property is too weak to certify membership. Positive proof needs an explicit grammar or PDA.
Why is CNF used in the proof?
CNF forces every internal parse-tree node to have exactly two children, making the tree binary so that "many leaves ⇒ tall tree ⇒ repeated variable" is a clean counting argument.
Edge cases
Does the lemma say anything about strings shorter than ?
No — the guarantee applies only to with . Short strings are exempt, which is why witnesses must be long enough.
Can (the middle, un-pumped piece) be empty?
Yes — may be empty; only is required. The repeated variable might derive an empty core while carry the growth.
Is the empty string ever a problem for the lemma?
Not directly — is shorter than , so the length hypothesis excludes it; the lemma makes no claim about it.
What happens at (pumping "down")?
You delete the loop, removing the symbols in and . This is the tool of choice when sits in blocks whose counts you want to shrink below a fixed reference block.
If a language is finite, does the pumping lemma apply usefully?
Every finite language is context-free (and regular), so it trivially satisfies the lemma — you just take larger than the longest string, making the "" clause vacuous. No contradiction is derivable, as expected.
Is pumpable, and what does that tell us?
Yes — it is context-free, so it pumps (split so sits in the 's and in the 's, adding equal counts). This is a reminder that pumping-success is normal and never a red flag.
Can the window legally sit entirely inside a single block of ?
Yes — the adversary may place it inside one block. Your contradiction argument must therefore cover that case too (pumping there changes only one count, still breaking equality).
Does closure help when the pumping lemma is awkward?
Sometimes — via Closure properties of CFLs, intersecting a suspect language with a regular language can produce a simpler non-CFL to pump, since CFLs are closed under intersection with regular languages but not with each other.