Documentation

Atlas.TheoryOfComputation.code.RecursionTheorem

Possible outcomes of running a Turing machine on an input: accept (enter the accept state), reject (halt in the reject state) or diverge (run forever). Matches the three TM outcomes described in Sipser's formal definition.

Instances For
    structure RecursionTheorem.TMCoding (Γ : Type) :

    An abstract acceptable indexing of Turing machines, stronger than the language-level version used in SelfReference.lean because it records the full behavior (accept/reject/diverge) of each machine on each input rather than just the language. Provides the standard ingredients needed to prove the Recursion Theorem: encoding/decoding, a pairing function, an smn function with the usual specification, a notion of computable index transformations, representability of computable transformations, and closure of IsComputable under composition and the diagonal x ↦ smn x x.

    Instances For

      The language of a TM index M: the set of inputs w on which M accepts.

      Instances For
        theorem RecursionTheorem.recursion_theorem {Γ : Type} (C : TMCoding Γ) (t : C.TMIndexC.TMIndex) (ht : C.IsComputable t) :
        (R : C.TMIndex), ∀ (w : List Γ), C.behavior R w = C.behavior (t R) w

        Recursion Theorem (Sipser, Lecture 11). For any computable transformation t : TMIndexTMIndex of TM indices there exists R such that for every input w, R and t R produce the same behavior — R operates the same as t R. In particular, R has access to its own description via t.

        Proof sketch: let h x = t (smn x x); by representability of computable transformations there is e₀ with behavior (smn e₀ x) w = behavior (h x) w; take R = smn e₀ e₀.

        Language-level corollary of the Recursion Theorem: for any computable t : TMIndexTMIndex there exists R with L(R) = L(t R). Follows from recursion_theorem by taking accepting inputs on both sides.