Pumping Lemma for CFLs & Non-Context-Free Proofs
“s = uvxyz decomposition, proving a^n b^n c^n is not CFL, and undecidable CFG problems.”
1.The Pumping Lemma for Context-Free Languages
§ 4.1.The Pumping Lemma for CFLs is used to prove that a given language is NOT context-free.
Formal Statement:
If L is a context-free language, there exists a pumping length p ≥ 1 such that every string s \in L with |s| ≥ p can be divided into five pieces, s = uvxyz, satisfying:
1. |vxy| ≤ p (the pumped region vxy has length at most p).
2. |vy| ≥ 1 (v and y are not both empty; at least one symbol is pumped).
3. For all i ≥ 0: u v^i x y^i z \in L (both v and y are pumped simultaneously with identical powers).
Canonical Non-CFL Proofs:
- L_1 = { a^n b^n c^n \mid n ≥ 1 }: Pick s = a^p b^p c^p. Since |vxy| ≤ p, vxy can span at most two different symbol types (e.g., a's and b's, or b's and c's). Pumping changes the count of those symbols while leaving the third unchanged \implies Contradiction!
- L_2 = { a^n b^n c^n d^n \mid n ≥ 1 }: Not CFL (requires tracking 4 counts).
- L_3 = { w w \mid w \in \Sigma^* }: Not CFL (copying language requires cross-serial dependencies).
- L_4 = { a^{p} \mid p is prime }: Not CFL.
2.Decision Properties of Context-Free Languages
§ 4.2.Unlike regular languages, many fundamental questions for CFGs are completely UNDECIDABLE:
Decidable Properties for CFGs:
1. Emptiness (L(G) = \emptyset): DECIDABLE (check if start symbol S derives any terminal string).
2. Finiteness (Is L(G) finite?): DECIDABLE (check for cycles in variable dependency graph of CNF).
3. Membership (w \in L(G)): DECIDABLE (via CYK dynamic programming algorithm in O(n^3)).
Undecidable Properties for CFGs (GATE Critical Traps):
1. Equivalence (L(G_1) = L(G_2)): UNDECIDABLE!
2. Totality / Universality (L(G) = \Sigma^*): UNDECIDABLE!
3. Inclusion (L(G_1) \subseteq L(G_2)): UNDECIDABLE!
4. Disjointness (L(G_1) \cap L(G_2) = \emptyset): UNDECIDABLE!
5. Is L(G) regular?: UNDECIDABLE!
6. Is grammar G ambiguous?: UNDECIDABLE!
Worked example: aⁿbⁿcⁿ is not context-free
Then it has a CFL pumping length p.
s = aᵖbᵖcᵖ.
s = uvxyz with |vxy| ≤ p and |vy| ≥ 1. Since |vxy| ≤ p, vxy touches at most two of the three letters.
uv²xy²z increases at most two of the counts, so they can't all stay equal.
Every split fails: L is not context-free.
Practice: test yourself
Original practice questions in the GATE style, with worked explanations. Not past-paper questions.
Context-free languages are closed under:
The intersection of a context-free language and a regular language is:
Is { aⁿbᵐcⁿ : n, m ≥ 0 } context-free?
Primary Academic References & Exam Sources
Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.
Curated for clarity, rigorous numerical solving, and semester excellence:
GATE-focused with clear minimal DFA construction and language classification.
Exam-pattern oriented with closure table drilling and decidability proofs.
Mathematically rigorous treatment for high-rank GATE aspirants.