Lax51.TuringRamEquivalence
Equivalence of Turing machines and word RAMs
concepts/Lax51/TuringRamEquivalence.lean · lax-51
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Evidence
Each proof establishes this claim relative to its assumptions.
Theorem
Turing machines and word random access machines compute exactly the same total functions from finite lists of natural numbers to finite lists of natural numbers.
A function is word-RAM computable when there are one program and a computable word-length threshold, depending on the input, such that the program returns the exact value from the length-prefixed physical input at every word length at or above that threshold. The program is chosen before both the input and the word length, so it is uniform. Requiring the threshold to be computable is essential: mere eventual stabilization with no effective modulus describes the larger class of limit-computable functions.
On the Turing-machine side, is mathlib's standard predicate for total computability. Mathlib's Turing-machine development proves its equivalence with execution by a concrete finitely described Turing machine, so the right-hand side is the usual Turing-computability notion rather than an additional machine model introduced here.
No running-time comparison is asserted. The theorem identifies the functions computable by the two models; simulations may have arbitrary overhead.
Lean source view on GitHub
| 1 | import Lax13.Ram |
| 2 | import Mathlib.Computability.TuringMachine.ToPartrec |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Equivalence of Turing machines and word RAMs |
| 7 | type: theorem |
| 8 | --- |
| 9 | Turing machines and word random access machines compute exactly the same |
| 10 | total functions from finite lists of natural numbers to finite lists of |
| 11 | natural numbers. |
| 12 | |
| 13 | A function is word-RAM computable when there are one program and a |
| 14 | computable word-length threshold, depending on the input, such that the |
| 15 | program returns the exact value from the length-prefixed physical input |
| 16 | `x.length :: x` at every word length at or above that threshold. The program |
| 17 | is chosen before both the input and the word length, so it is uniform. |
| 18 | Requiring the threshold to be computable is essential: |
| 19 | mere eventual stabilization with no effective modulus describes the larger |
| 20 | class of limit-computable functions. |
| 21 | |
| 22 | On the Turing-machine side, `Computable` is mathlib's standard predicate for |
| 23 | total computability. Mathlib's Turing-machine development proves its |
| 24 | equivalence with execution by a concrete finitely described Turing machine, |
| 25 | so the right-hand side is the usual Turing-computability notion rather than |
| 26 | an additional machine model introduced here. |
| 27 | |
| 28 | No running-time comparison is asserted. The theorem identifies the |
| 29 | functions computable by the two models; simulations may have arbitrary |
| 30 | overhead. |
| 31 | -/ |
| 32 | |
| 33 | namespace Lax51.TuringRamEquivalence |
| 34 | |
| 35 | open Lax13.Ram |
| 36 | |
| 37 | /-- A total function on finite words is computable by a word RAM if one |
| 38 | uniform program computes it from the length-prefixed physical input |
| 39 | `x.length :: x` at every effectively sufficient word length. -/ |
| 40 | def RamComputable (f : List ℕ → List ℕ) : Prop := |
| 41 | ∃ (p : Program) (threshold : List ℕ → ℕ), |
| 42 | Computable threshold ∧ |
| 43 | ∀ (x : List ℕ) (w : ℕ), threshold x ≤ w → |
| 44 | ∃ t : ℕ, RunsTo w p (x.length :: x) (f x) t |
| 45 | |
| 46 | /-- **Equivalence of Turing machines and word RAMs.** A total function on |
| 47 | finite words is computable by the archive's word RAM model exactly when it |
| 48 | is Turing-computable. -/ |
| 49 | axiom ramComputable_iff_computable (f : List ℕ → List ℕ) : |
| 50 | RamComputable f ↔ Computable f |
| 51 | |
| 52 | end Lax51.TuringRamEquivalence |
| 53 |
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