GATE / CS ARCHIVE

GATE CSE 2005 / QUESTION 55

Intersection of two context-free languages

Theory of Computation · Closure Properties & Language Hierarchy · Full GATE CSE 2005 paper

GATE 2005, Q55 2 marks · MCQ
Report issue

Closure Properties & Language Hierarchy

Question 55, GATE 2005: L1={a^n b^n c^m:n, m>0}, L2={a^n b^m c^m:n, m>0}. Identify the false claim among: A their intersection is context-free; B their union is context-free; C both individual languages are context-free; D their intersection is context-sensitive.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

L1={an bn cm:n, m>0} and L2={an bm cm:n, m>0} each need only one stack comparison, hence are CFLs. CFLs are closed under union. Their intersection is {ak bk ck:k>0}, which is not context-free (standard CFL pumping argument) but is context-sensitive by linear-space counting. The false assertion is A.

Each individual language compares only two adjacent block counts and allows the remaining block freely, which a PDA can handle. Closure under union proves the union claim. In the intersection, the first language forces #a=#b and the second forces #b=#c, hence all three counts coincide. The standard pumping argument prevents a single stack from enforcing these three blocks: a short pumped region cannot cover all three, so pumping changes only one or two counts or disrupts the block order. Linear-space checking still recognizes the intersection, establishing context sensitivity.

Original paper, page 7