Lax251941.TuringCompleteness
Every partial recursive function is computed by a Turing machine
concepts/Lax251941/TuringCompleteness.lean · lax-251941
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Theorem
For every partial recursive function there is a single-tape Turing machine which, on the unary encoding of , reaches its accept state exactly when is defined. This is the Turing-completeness of the string-rewriting machines of , in the form in which it links Sipser's two sections: the diagonalisation of Section 4.2 is carried out for partial recursive programs, the reduction of Section 5.2 for tape machines, and this theorem is what makes the acceptance problem of the latter as hard as that of the former.
Lean source view on GitHub
| 1 | import Mathlib.Computability.Partrec |
| 2 | import Lax251941.TuringMachines |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Every partial recursive function is computed by a Turing machine |
| 7 | type: theorem |
| 8 | --- |
| 9 | For every partial recursive function |
| 10 | there is a single-tape Turing machine which, on the unary encoding of , |
| 11 | reaches its accept state exactly when is defined. This is the |
| 12 | Turing-completeness of the string-rewriting machines of `TuringMachines`, in |
| 13 | the form in which it links Sipser's two sections: the diagonalisation of |
| 14 | Section 4.2 is carried out for partial recursive programs, the reduction of |
| 15 | Section 5.2 for tape machines, and this theorem is what makes the acceptance |
| 16 | problem of the latter as hard as that of the former. |
| 17 | |
| 18 | # Formalization notes |
| 19 | |
| 20 | The unary encoding of `n` is the word `mk :: replicate n c` for two tape symbols |
| 21 | `mk` (a marker) and `c` (a counter cell) chosen by the theorem together with |
| 22 | the machine. `Partrec` is mathlib's class of partial recursive functions |
| 23 | `ℕ →. ℕ`. The proof compiles the function to a counter-machine program and the |
| 24 | program to a tape machine; the compiled machine is deterministic, although the |
| 25 | model allows nondeterminism. |
| 26 | -/ |
| 27 | |
| 28 | namespace Lax251941.TuringCompleteness |
| 29 | |
| 30 | open Lax251941.TuringMachines |
| 31 | |
| 32 | /-- For every partial recursive `f` there is a tape machine, with a marker symbol |
| 33 | and a counter symbol, that accepts the unary encoding of `n` exactly when `f n` is |
| 34 | defined. -/ |
| 35 | axiom exists_tm_accepts_iff_dom (f : ℕ →. ℕ) (hf : Partrec f) : |
| 36 | ∃ (M : TM) (mk c : ℕ), ∀ n : ℕ, M.Accepts (mk :: List.replicate n c) ↔ (f n).Dom |
| 37 | |
| 38 | end Lax251941.TuringCompleteness |
| 39 |
Formalization notes
The unary encoding of is the word for two tape symbols (a marker) and (a counter cell) chosen by the theorem together with the machine. is mathlib's class of partial recursive functions . The proof compiles the function to a counter-machine program and the program to a tape machine; the compiled machine is deterministic, although the model allows nondeterminism.
Community review
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.
0 comments