= Kleene's recursion theorem
{c}
{title2=$\varphi_e\simeq\varphi_{f(e)}$}
{wiki}
= Recursion theorem
{synonym}
Fix an effective numbering $\varphi_e$ of the <partial computable functions> with a <universal partial computable function> and the parameter compilation supplied by the <S-m-n theorem>. For every <total computable function> $f:\mathbb N\to\mathbb N$, there is a program index $e$ such that
$$
\varphi_e\simeq\varphi_{f(e)}.
$$
Here $\simeq$ means equality as <partial functions>, including the inputs on which computation diverges. The conclusion concerns a program's behavior, not equality of program indices: $f(n)=n+1$ has no numerical <fixed point>, but still has this semantic <fixed point>.<Introduction to the Theory of Computation by Jean Gallier (2017)>[Section10.5, Theorem10.22, printed pp.276–277]{ref}
For a proof, the <S-m-n theorem> gives a <total computable function> $d$ compiling $a$ into a program that, on input $x$, first computes $\varphi_a(a)$ and then runs the program with that resulting index on $x$. Thus
$$
\varphi_{d(a)}(x)\simeq\varphi_{\varphi_a(a)}(x),
$$
where both sides diverge if the inner computation does. Choose an index $b$ for the <total computable function> $a\mapsto f(d(a))$. Setting $e=d(b)$ gives
$$
\varphi_e\simeq\varphi_{\varphi_b(b)}=\varphi_{f(d(b))}=\varphi_{f(e)}.
$$
The theorem makes rigorous a program's ability to use a description of itself. For example, let $f(a)$ compile a program that ignores its input and prints $a$. Its semantic <fixed point> is a program that prints its own index. This does not require a program to read its source file.
Back to article page