Kleene's recursion theorem states that for any computable function φ, there exists an index e such that φ_e = φ(e), where φ_e is the partial computable function with index e. This powerful result allows Turing machines to obtain their own descriptions, enabling paradox-free self-reference and fixed-point constructions. It underlies quines and demonstrates intrinsic limitations of formal systems.
From your study of general recursive functions, you know that every computable function can be assigned a Gödel number — an index e such that φ_e is the partial recursive function computed by the eth program. The s-m-n theorem tells you that there is a computable function s(m, x) such that φ_{s(m,x)} = the function you get by feeding x into the mth program as a fixed input. Together, these give programs the ability to talk about and manipulate other programs. Kleene's recursion theorem takes this one step further: it allows a program to talk about itself.
The theorem states that for any total computable function f, there exists an index e such that φ_e = φ_{f(e)}. Read this carefully: f maps indices to indices, and the theorem says there is a fixed point — an index e where f doesn't change what the function does. Equivalently, for any computable operator T that transforms programs, there is a program e that "behaves the same way" as T(e). The proof is a diagonal construction: build a program that first computes its own index (using s-m-n), then applies f to that index to find another program, and then simulates that other program. The resulting program is its own fixed point under f.
The most vivid application is a quine — a program that prints its own source code. Intuitively, it seems like a quine would require circular reasoning: "to know what to print, I need to know what I am." The recursion theorem resolves this cleanly. A quine exists because the function f that maps any program index e to the index of the program "print the source of φ_e" has a fixed point. That fixed point is a program whose output, when run, is itself. No circular magic is required — the fixed point is constructed directly via the s-m-n machinery.
The deeper significance is about what programs can do with self-knowledge. Because of the recursion theorem, you cannot design a computable function that behaves differently on programs that "know their own index" than on those that don't — because every program can, in principle, obtain its own index. This underlies the undecidability of many properties of programs: Rice's theorem (no non-trivial property of the function φ_e is decidable) can be proved as a corollary, because if a property P were decidable, you could construct a function f that maps any e satisfying P to an index not satisfying P and vice versa, contradicting the existence of a fixed point. Self-reference, far from being paradoxical, is an inescapable feature of any sufficiently powerful computational system.
No topics depend on this one yet.