Pumping Lemma for Context-Free Languages

Context: FIT2014_MOC · the property every CFL must have ➔ the tool that proves some languages are not context-free, closing the outer ring after Pumping Lemma for Regular Languages closed the inner one · applied in Proving a Language Non-Context-Free Parent Framework: Context-Free Grammars (CFG)

Quick Revision

  • 🎯 Objective: in a CNF grammar with nonterminals, any generated word longer than forces a repeated nonterminal on a root-to-leaf path ➔ the subtree between the two copies can be re-inserted or deleted, pumping two substrings at once.
  • 📦 Core Components: pump | = inner subtree’s yield | = untouched flanks.
  • ⚡ Key Constraint: necessary, not sufficient — it proves non-context-freeness only. And unlike the regular case you must pump two blocks simultaneously, which is what the case analysis has to defeat.

🌳 Why a long word forces a repeated nonterminal

  • Path length = non-leaf nodes ➔ in a parse tree, each non-leaf node carries a nonterminal symbol.
  • Naive bound ➔ if some root-to-leaf path is longer than the number of nonterminals in the grammar, some nonterminal appears twice on it (pigeonhole).
  • The gap ➔ nothing yet guarantees a long word produces a long path — a wide flat tree would defeat it. CNF closes the gap:
  • Consequence ➔ if then , so a nonterminal repeats on that path. (This is exactly what CNF’s binary shape is for.)

📜 The lemma

Theorem (Pumping Lemma for CFLs). Let be a context-free language with a CNF grammar having nonterminal symbols. Then for every with there exist strings with (i.e. not both empty) such that:

  1. for all : — i.e.

Symbolically:

🧮 Proof Blueprint

Theorem. As stated above.

Strategy. Pigeonhole a repeated nonterminal onto a root-to-leaf path of a CNF parse tree, then splice the subtree between the two copies.

Derivation.

Q.E.D. (The final step is formalised by induction on .)


⚖️ A Tale of Two Pumping Lemmas

RegularContext-free
Object with the boundFA with statesCNF grammar with nonterminals
”Sufficiently long”
What repeatsa state on the accepting patha nonterminal on a root-to-leaf path
Decomposition
Blocks pumpedone ()two, in lockstep ( and )
Non-emptiness (either may be empty, not both)
Locality bound
Conclusion

When It Flips: a language that survives the regular lemma's failure is often context-free by pumping two blocks — pumps together. Three coupled blocks () is where two pumping sites run out, and that is the CFL frontier.


⚠️ Common Mistakes

  • 💡 , not one of them may be empty; only the pair must be non-empty. A proof that assumes both are non-empty is incomplete.
  • 💡 The bound is on , not ➔ the regular lemma bounds a prefix; here the bound confines the pumped material plus the gap between the two blocks, and it can sit anywhere in .
  • 💡 Necessary, not sufficient ➔ satisfying the lemma never proves a language is context-free; build a CFG or PDA for that.
  • 💡 counts nonterminals in the CNF grammar ➔ not states, not terminals, not rules — and the grammar must be in Chomsky Normal Form for the bound to hold at all.
  • 💡 is legal (delete both blocks) is as valid a pumped word as .

🧠 Active Recall