Computer science Automata and formal languages Lemma
Pumping lemma for context-free languages
Builds on Context-free languageContext-free grammarChomsky normal formPumping lemma for regular languages
Statement
Let be a context-free language. Then there is an integer such that every with can be written as with such that:
- ;
- ;
- for every integer .
Here is the length of and is repeated times.
Remarks
Take a context-free grammar for in Chomsky normal form with nonterminals and set . A parse tree of a word of length at least is binary, so it has a root-to-leaf path with more than nonterminals. So some nonterminal repeats on the lowest part of this path. The subtree under the upper yields , the one under the lower yields , and replacing one subtree by the other, or the reverse, repeatedly gives . Example: is not context-free. For , the part has length at most , so it meets at most two of the three blocks. Then either has letters out of order or has unequal block lengths, so it is not in . The lemma gives only a necessary condition: some languages that are not context-free satisfy its conclusion.
Going deeper
For a student
The lemma is the context-free analogue of the pumping lemma for regular languages, where one piece is pumped instead of two. A typical proof that is not context-free picks a word depending on , considers every split allowed by clauses 1 and 2, and finds an with . Since the context-free languages are closed under intersection with regular languages and under homomorphisms, one often first simplifies in this way. When the lemma is too weak, Ogden's lemma, which lets one mark the important positions, often works.
Reading path
To understand this page from the ground up, read these 8 pages in order. The foundations come first.
Show the path as a graph
- no evidence level
- Chomsky normal form concept
- Context-free grammar concept
- Context-free language concept
- Deterministic finite automaton concept
- Regular language concept
- String concept
- Pumping lemma for regular languages statement
- Pumping lemma for context-free languages statement
Where this leads
1 page builds on this one.
Further reading
About this page
| Tag | KQ0TQABTPJ |
|---|---|
| URI | m2://KQ0TQABTPJ |
| Kind | statement, lemma |
| Writing | W0 stub |
| MSC | 68Q45, 68Q42 |
| Status | This copy of the site has no build data. Run m2 status KQ0TQABTPJ. |
| About | Context-free language |
| Uses | Context-free language, Context-free grammar, Chomsky normal form, Pumping lemma for regular languages |
| Same as | |
| Changed | 3 November 2026 |
Markdown · JSON · Edit on GitHub
What this page needs for W1
- an inventory row: the row of the inventory that the node accounts for (0 of 1)
- a source with a locator (0 of 1)
The writing levels say how complete the text of a page is. They do not measure its truth.