Skip to content
Official PYQ · 1987

GATE CS 1987 Q2k — Context-free Grammars and Push-down Automata

Explain with AI
State whether the following statements are TRUE or FALSE:

The intersection of two CFL's is also a CFL.
View worked solution

Answer: 0

The given statement is FALSE (represented by 0).

Explanation:

Context-Free Languages (CFLs) are not closed under intersection. We can prove this using a classic counterexample:

  1. Let L1={anbncm∣n,m≥0}L_1 = \{a^n b^n c^m \mid n, m \ge 0\}. This language is context-free because we can use a pushdown automaton (PDA) to match the number of aa's with bb's, while ignoring the number of cc's.
  2. Let L2={ambncn∣n,m≥0}L_2 = \{a^m b^n c^n \mid n, m \ge 0\}. This language is also context-free because we can match the number of bb's with cc's, while ignoring the number of aa's.

Now, let us find the intersection of L1L_1 and L2L_2:

L1∩L2={anbncn∣n≥0}L_1 \cap L_2 = \{a^n b^n c^n \mid n \ge 0\}

The language {anbncn∣n≥0}\{a^n b^n c^n \mid n \ge 0\} requires matching the counts of three different symbols (aa, bb, and cc) simultaneously. A single stack in a PDA cannot perform this tracking, and it can be formally proven to be non-context-free using the Pumping Lemma for CFLs.

Since the intersection of two CFLs (L1L_1 and L2L_2) results in a non-CFL, the family of context-free languages is not closed under intersection.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Context-free Grammars and Push-down Automata questions