Proof of the Recursion Theorem
The recursion theorem (Kleene's fixed-point theorem) is a fundamental result guaranteeing that self-referential programs exist. It states that for any computable transformation of programs, there is a fixed point — a program that computes the same function as its own transformation.
Statement
For every total computable function , there exists such that , where denotes the partial function computed by the -th Turing machine.
Proof
By the -- theorem, there is a total computable function such that for all .
Define a total computable function by . Then .
Now, given the total computable function , define a computable function by . Let be an index for , so .
Set . Then:
Thus .
Applications
A quine is a program that outputs its own source code. The recursion theorem guarantees their existence: let be any total computable function (e.g., = index of the machine that prints ). The fixed point with is a program that prints its own index.
The recursion theorem gives an elegant alternative proof that the halting problem is undecidable. Suppose decides . Define index of the machine that on all inputs does the opposite of what predicts about . By the recursion theorem, there exists with , leading to .
Two sets are recursively isomorphic (there is a computable bijection with ) if and only if they are many-one equivalent ( and ). The proof of the forward direction of this uses the recursion theorem to construct the isomorphism by a back-and-forth argument.