Context free grammar is not closed under :
2017
Context free grammar is not closed under :
- A.
Concatenation
- B.
Complementation
- C.
Kleene Star
- D.
Union
Attempted by 100 students.
Show answer & explanation
Correct answer: B
Answer: Complementation is not a closure property of context-free grammars.
Which operations are CFLs closed under?
Concatenation — closed. You can combine grammars to produce strings from L1 followed by L2.
Union — closed. Use a new start symbol with productions to each grammar's start symbol.
Kleene star — closed. Add rules that allow repetition of the language's start symbol (including the empty string).
Why complementation is not closed:
Assume, for contradiction, that context-free languages were closed under complementation.
Since CFLs are closed under union, De Morgan's law would imply they are closed under intersection: A ∩ B = complement( complement(A) ∪ complement(B) ).
But intersection of two context-free languages need not be context-free. For example, let L1 = { a^n b^n c^m | n,m ≥ 0 } and L2 = { a^m b^n c^n | m,n ≥ 0 }. Both L1 and L2 are context-free, and L1 ∩ L2 = { a^n b^n c^n | n ≥ 0 }, which is not context-free.
This contradiction shows context-free languages cannot be closed under complementation.
Therefore, among the listed operations, complementation is the one under which context-free grammars (languages) are not closed.
A video solution is available for this question — log in and enroll to watch it.