TCS: Advanced Computability
Advanced Computability
Programs That Know Their Own Descriptions
A program description is finite data. Given a string , an algorithm can generate the description of a program that ignores its input and prints . Constructing this printer requires no execution of the program encoded by
Self-reference becomes possible when a program combines stored data with a procedure that turns that data into code. A self-printing program, or quine, reconstructs its full description from these two parts
Kleene’s recursion theorem generalizes this idea: a program can use its own description as an argument to an arbitrary computation
Let compute a partial function . There exists a program such that
The construction of is effective from . Equality here includes matching divergence
A Compiler-Based Proof
Let denote the partial function computed by program . A total computable specialization function produces a program that fixes the first argument of a two-argument program
Construct a two-argument program whose behavior is
Let be the code of , and define . Then
Thus the program with code has the required behavior. The specialization operation generates code syntactically, so there is no circular request to finish executing a program before constructing it
Choosing gives a self-printing program immediately
Applications of the Recursion Theorem
An Undecidability Proof
Suppose decides whether a program accepts an input. By the recursion theorem, construct that obtains its own code, asks whether accepts the current input, and returns the opposite answer
Either answer contradicts the specification of . The recursion theorem packages the self-reference that otherwise appears as an explicit diagonal input
Minimal Programs
Fix a machine encoding. A program is minimal if no shorter program computes the same partial function
The set
is not Turing-recognizable
Assume an enumerator lists exactly the minimal programs. Construct that knows the length of its own description, waits for an enumerated program longer than itself, and then simulates on the current input
There are infinitely many partial computable functions, hence minimal descriptions of unbounded length. The waiting stage therefore finishes. But computes exactly the same partial function as the longer program , contradicting the minimality of
The same reasoning rules out every infinite recognizable subset of minimal programs
Rogers’ Fixed-Point Theorem
For every total computable transformation of program descriptions, there is a program such that
To obtain , use the recursion theorem with a computation that transforms its own code by and simulates the resulting program. The fixed point is behavioral: the two descriptions need not be identical strings
Syntax, Semantics and Proof
A first-order language specifies variables, logical connectives, quantifiers, and symbols for constants, functions and relations. A structure assigns those nonlogical symbols meanings over a nonempty domain
For example, a sentence about addition can be interpreted in the natural numbers or in another structure. A sentence can be true in one structure without being valid in every structure
The first asserts the existence of a formal derivation from . The second asserts truth in every model of
A proof calculus is sound when derivability implies semantic consequence, and complete when semantic consequence implies derivability
Gödel’s Completeness Theorem
For classical first-order logic,
This completeness concerns all structures satisfying the axioms. A separate question asks whether a fixed effective theory proves every sentence true in the intended structure
Formal proofs are finite strings. For an effectively axiomatized theory, proofs can be effectively enumerated; for a decidable axiom set, a candidate derivation can be checked directly. A computably enumerable axiom set can instead be handled by recording finite witnesses to the enumeration of each axiom used
Gödel’s First Incompleteness Theorem
An effectively axiomatized, consistent theory capable of expressing sufficient arithmetic is incomplete: there is a sentence for which neither nor
Here consistent means that the theory does not prove a sentence and its negation. The computability argument below uses a theory strong enough to represent program execution and reason about finite computation traces
A Machine That Opposes Proofs
Using the recursion theorem, define a machine with access to its own description. It enumerates -proofs and searches for either of two sentences about itself
- If it finds a proof that halts, it enters an explicit infinite loop
- If it finds a proof that never halts, it halts
Assume is consistent. If proved that never halts, no proof of the opposite sentence could appear. The search would eventually find the nonhalting proof and halt. That finite execution supplies a formal proof of halting, contradicting consistency
If proved that halts, the search would instead reach the explicit loop. A finite trace establishes that has entered a state from which it can never halt, giving a proof of nonhalting and the same contradiction
Therefore neither sentence is provable. Externally, runs forever because neither triggering proof exists. Its nonhalting statement is a true arithmetic sentence unprovable in
Adding this sentence as an axiom gives another effective theory to which the construction can be applied again
Gödel’s Second Incompleteness Theorem
Write for the usual arithmetic sentence asserting that no -proof of a contradiction exists
For the standard sufficiently strong, effectively axiomatized theories of arithmetic, consistency implies
The first argument used consistency to conclude that its self-referential machine never halts. When the reasoning and the usual provability conditions are formalized inside the theory, they connect its consistency statement to an unprovable sentence
If could prove its own consistency, it could complete that internal argument and prove the sentence already shown to be unprovable. The full theorem requires the standard arithmetization of proofs; finite proof checking alone is not its entire proof
The completeness and incompleteness theorems fit together: a sentence true in but unprovable from must fail in some other model of