GATE / CS ARCHIVE

GATE CSE 1992 / QUESTION 16(i)

Union of two recursive languages

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

GATE 1992, Q16(i) Descriptive
Report issue

Closure Properties & Language Hierarchy

Question 16(i), GATE 1992: True or false? The union of two recursive languages is recursive. Prove your answer.
Question 16(i), GATE 1992: True or false? The union of two recursive languages is recursive. Prove your answer.
Tap to enlarge
Answer & solution

Answer: True; run the two total deciders and accept iff either accepts. (no official key was published)

True. A recursive language has a decider: a machine that halts on every input and answers membership correctly. Let M1 decide L1 and M2 decide L2, taking a common ambient alphabet (the union of their alphabets if necessary). A machine for L1∪L2 operates as follows:

On input w:
  run M1(w) to completion;
  if M1 accepts, accept;
  run M2(w) to completion;
  if M2 accepts, accept;
  otherwise reject.

If w belongs to the union, at least one decider accepts. Acceptance by M1 immediately suffices; otherwise M2 accepts. If w is outside the union, both deciders reject, and the constructed machine rejects. It always halts because M1 always halts and, when run, M2 always halts. Correctness together with total termination proves recursiveness.

Sequential simulation is adequate here. For merely recursively enumerable languages the first recognizer might loop forever on a nonmember, so a union recognizer generally needs dovetailing instead. The stronger halting promise for recursive languages is the precise reason the simpler proof works. This establishes closure under finite union by induction; it does not establish closure under arbitrary infinite union.

Original paper, page 9