GATE / CS ARCHIVE

GATE CSE 2011 / QUESTION 24

Regular-language complement guarantee

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

GATE 2011, Q24 1 mark · MCQ
Report issue

Closure Properties & Language Hierarchy

Question 24, GATE 2011: P is regular and Q is context-free with Q a subset of P. For example, P=p*q* and Q={p^n q^n : n is natural}. Which language is ALWAYS regular, over alphabet Σ?

(A) P intersect Q
(B) P minus Q
(C) Σ* minus P
(D) Σ* minus Q
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Regular languages are closed under complement, so Σ*−P is always regular. P∩Q=Q may be nonregular. If P−Q were always regular, Q=P−(P−Q) would always be regular, a contradiction; likewise regularity of Σ*−Q would imply regularity of Q. Therefore only C is guaranteed.

A counterexample is permitted because the question asks what is guaranteed for all P,Q. Choose P=0*1* and Q={0n1n}. Then P∩Q=Q is nonregular. If P−Q were regular, subtracting it from regular P would recover nonregular Q, contradicting closure of regular languages under difference. If the complement of Q were regular, complementing again would make Q regular. In contrast, a complete DFA for P can always have its accepting and rejecting states swapped to recognize its complement.

Original paper, page 6 · Answer key