- Asked 2/7
- 2071 Chaitra
- 2073 Chaitra
Recursive iff language and complement are RE
Short answer
If L is recursive, a decider M for L also decides complement by swapping accept/reject, so both are RE. Conversely, if L and complement are RE, run acceptors for both in parallel; one will accept, so we can decide L. Thus L is recursive.
Prove that a language is recursive if and only if both it and its complement are recursively enumerable. (That is, if a language L and its complement are both recursively enumerable, then L is recursive.)
Theorem. A language L is recursive if and only if both L and its complement Lᶜ = Σ* − L are recursively enumerable (RE).
(⇒) Recursive implies L and Lᶜ are RE
Let M be a TM that decides L (it always halts).
- M itself accepts L, so L is RE.
- Build M′ from M by swapping the accepting and rejecting outcomes: M′ accepts exactly when M rejects. M′ halts on every input and accepts Lᶜ. Hence Lᶜ is recursive, so also RE.
(⇐) If L and Lᶜ are RE, then L is recursive
Let M1 be a TM that accepts L (halts and accepts every w ∈ L) and M2 a TM that accepts Lᶜ.
Construct a two-tape TM M that, on input w:
- Copies w to both tapes.
- Simulates M1 on tape 1 and M2 on tape 2 alternately, one step at a time (a step of M1, then a step of M2, and so on).
- If M1 accepts, M accepts. If M2 accepts, M rejects.
input w
/ \
M1 (for L) M2 (for Lc)
\ /
run in lock-step (1 step each)
M1 accepts -> ACCEPT
M2 accepts -> REJECT
Why this works. Every string w lies in exactly one of L or Lᶜ.
- If w ∈ L, then M1 eventually halts and accepts (M2 may loop forever, but it does not matter).
- If w ∉ L, then w ∈ Lᶜ, so M2 eventually halts and accepts.
So exactly one of M1, M2 accepts in finite time, and the combined machine M always halts with the correct answer. Therefore M is a decider for L, and L is recursive.
Consequence
If L is RE but not recursive (for example the halting language), then Lᶜ cannot be RE. Otherwise L would be recursive by this theorem.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Recursive and recursively enumerable languages · Theory of Computation, chapter 4
- Recursive language and its properties · Theory of Computation, chapter 4 · asked 2×
- Prove n even iff 7n+4 even · Discrete Structure, chapter 1