Which one of the following statements is false?
2011
Which one of the following statements is false?
Answer: C. Context-free languages are closed under intersection. — Concept. A class of languages is closed under an operation when applying that operation to members of the class always yields a language that is still in the…
- A.
Context-free languages are closed under union.
- B.
Context-free languages are closed under concatenation.
- C.
Context-free languages are closed under intersection.
- D.
Context-free languages are closed under Kleene closure.
Attempted by 4 students.
Show answer & explanation
Correct answer: C
Concept. A class of languages is closed under an operation when applying that operation to members of the class always yields a language that is still in the class. The context-free class is exactly what a pushdown automaton — a finite control with a single stack — can recognise, so the test for each operation is whether the result can always be written as one context-free grammar, or equivalently run on one stack.
Application. Take context-free grammars G1 and G2 with disjoint variable sets and start symbols S1 and S2. Three of the four operations have a direct grammar construction, so the result is context-free by construction:
Union: introduce a new start symbol with S → S1 | S2; a derivation commits to one of the two grammars and continues inside it.
Concatenation: introduce S → S1S2; a derivation lays a string of the first grammar in front of a string of the second.
Kleene closure: introduce S → S1 S | ε; a derivation repeats the grammar zero or more times.
Intersection. No analogous construction exists, and one counterexample settles the question:
Let L1 = { anbncm | n, m ≥ 0 }. It is context-free: a single stack pushes the a’s and pops them against the b’s, while the c’s are unconstrained.
Let L2 = { ambncn | n, m ≥ 0 }. It is context-free for the mirror-image reason: the stack matches the b’s against the c’s, while the a’s are unconstrained.
A string lies in both languages only if it satisfies both matching constraints, so L1 ∩ L2 = { anbncn | n ≥ 0 }.
That language is not context-free. By the pumping lemma for context-free languages, any sufficiently long string would have to be pumpable through two substrings lying within a window of bounded width; such a window meets at most two of the three blocks, so pumping changes at most two of the three counts and breaks the three-way equality.
Two context-free languages therefore have an intersection that is not context-free, so the class is not closed under that operation and the statement asserting it is the false one.
Cross-check. The one-stack picture explains the split: a pushdown automaton carries exactly one unbounded count, which is enough for a single matching constraint but not for two independent ones, whereas union, concatenation and Kleene closure only ever ask the machine to choose, sequence, or repeat — never to count twice. Contrast the regular class, which is closed under intersection via the product construction on two finite automata, and the mixed case, where the intersection of a context-free language with a regular language is context-free, because the finite automaton’s states fold into the pushdown automaton’s finite control without a second stack.
Result: the false statement is that context-free languages are closed under intersection; closure under union, concatenation and Kleene closure all hold.