Langlib

Langlib.Classes.RecursivelyEnumerable.Decidability.Equivalence

Undecidability of Equivalence for RE Languages #

This file proves that equivalence cannot be decided for recursively enumerable (RE) languages. More precisely, there is no computable predicate that decides whether two codes compute the same partial function.

The proof proceeds in two steps:

  1. Fixed-reference undecidability (RE_equivalence_undecidable_fixed): By Rice's theorem, the predicate "does code c compute the same function as Code.zero?" is not computable. The property {f | f = Code.zero.eval} is non-trivial because pure 0 satisfies it while fun _ ↦ Part.none does not.

  2. General equivalence undecidability (RE_equivalence_undecidable): If the binary equivalence predicate on Code × Code were computable, we could fix one argument to Code.zero and obtain a computable unary predicate, contradicting step 1.

Main results #

Comparing any code against a fixed code (Code.zero) is undecidable.

This is an instance of Rice's theorem: the semantic property {f | f = Code.zero.eval} is non-trivial.

Equivalence is undecidable for RE languages.

There is no algorithm that, given two codes c₁ and c₂ for partial-recursive functions, decides whether c₁ and c₂ compute the same function.

Proof. If such an algorithm existed, fixing the second argument to Code.zero would yield a computable predicate deciding c.eval = Code.zero.eval, contradicting RE_equivalence_undecidable_fixed.