GATE / CS ARCHIVE

GATE CSE 2021 SET 2 / QUESTION 12

GATE CSE 2021 Set 2 Q12

Theory of Computation · Closure Properties & Language Hierarchy · Full GATE CSE 2021 Set 2 paper

GATE 2021 Set 2, Q12 1 mark · MSQ
Report issue

Closure Properties & Language Hierarchy

Question 12, GATE 2021: L1 is regular and L2 context-free. Which are necessarily context-free? A L1∩¬L2; B ¬(¬L1∪¬L2); C L1∪(L2∪¬L2); D (L1∩L2)∪(¬L1∩L2). Complements are relative to the common alphabet-star.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B; C; D

Visually reading the overbars, B is the complement of (complement L1 union complement L2), hence L1 intersection L2, which is context-free. C contains L2 union complement L2 and equals the whole alphabet-star. D is (L1 intersection L2) union (complement L1 intersection L2), hence L2. A is L1 intersection complement L2; taking L1=Σ* shows that it need not be context-free, since CFLs are not closed under complement. Thus B, C, D.

The relevant closure theorem is intersection of a CFL with a regular language, not intersection of two arbitrary CFLs. A product construction combines the CFL's PDA control with the regular DFA state without adding another stack. C and D simplify by excluded middle, so no unsupported general CFL-complement closure is used.

Original paper, page 61 · Answer key