- 2074 Asoj
Recursive and recursively enumerable languages
Short answer
Recursively enumerable languages are accepted by a Turing machine that may loop on non-members. Example: the halting language {⟨M,w⟩ | M halts on w}. Recursive languages are decided by a TM that always halts; examples include {aⁿbⁿcⁿ} and the primes. Every recursive language is RE, but not every RE language is recursive.
Explain recursive and recursively enumerable languages with suitable examples of each language.
Recursively enumerable (RE) languages
A language L is recursively enumerable (Turing-recognisable) if some Turing machine M accepts it: for w ∈ L, M halts in an accepting state; for w ∉ L, M either halts in a non-accepting state or runs forever. M recognises L but need not decide it.
Example: the halting language H = { ⟨M, w⟩ : M halts on input w }. Simulate M on w; if the simulation halts, accept. If M loops, the simulator loops. So H is RE but not recursive.
Recursive languages
A language L is recursive (decidable) if some TM M halts on every input, accepting w ∈ L and rejecting w ∉ L. Such a machine is an algorithm.
Examples:
- { aⁿbⁿcⁿ : n ≥ 1 }: mark one a, one b, one c repeatedly and check nothing remains. It always halts.
- The set of prime numbers (in binary or unary): try all possible divisors; this halts.
- Every regular language and every context free language is recursive.
Relationship
all languages
┌──────────────────────────────┐
│ RE languages │
│ ┌────────────────────────┐ │
│ │ recursive languages │ │
│ │ ┌──────────────────┐ │ │
│ │ │ CFL ⊃ regular │ │ │
│ │ └──────────────────┘ │ │
│ └────────────────────────┘ │
│ (H lies here: RE, not rec.)│
└──────────────────────────────┘
- Every recursive language is RE, but not every RE language is recursive.
- L is recursive if and only if both L and its complement are RE.
- The complement of H is not RE, so it lies outside RE.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Recursive iff language and complement are RE · Theory of Computation, chapter 4 · asked 2×
- Recursive language and its properties · Theory of Computation, chapter 4 · asked 2×
- High level languages and natural language · Computer Programming, chapter 1
- High level languages; C versus FORTRAN · Computer Programming, chapter 1
- Categories of programming languages · Computer Programming, chapter 1