GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 19(b)

A regular union does not determine its operand

Theory of Computation · Regular Expressions & Languages · Full GATE CSE 1994 paper

GATE 1994, Q19(b) Descriptive
Report issue

Regular Expressions & Languages

Question 19(b), GATE 1994: If L1 and L1∪L2 are regular, must L2 be regular? Prove the answer.
Tap to enlarge
Answer & solution

Answer: No. Take L1={a,b}* and L2={a^n b^n:n≥0}. (no official key was published)

Choose the common alphabet Σ={a,b}, let L1=Σ*, and let L2={an bn:n≥0}. L1 is recognized by a single accepting state with a loop on each alphabet symbol. Since L2⊆L1, their union is Σ*, also regular. Nevertheless L2 is not regular.

To verify the last assertion, suppose a pumping length p exists. The word ap bp must have a decomposition xyz with |xy|≤p and |y|>0. Consequently y consists of k≥1 copies of a. Pumping y zero times gives ap−kbp, which is not in L2 because the numbers of a and b differ. This contradicts the pumping lemma.

The tempting subtraction argument is invalid: (L1∪L2) minus L1 equals L2 minus L1, not necessarily L2. Regularity of the union controls the portion of L2 outside L1, but places no constraint on its arbitrary portion inside L1. Our counterexample puts all of L2 inside L1, making that gap explicit.

Original paper, page 6