Polynomial-time computation on the Lax759944 finite-Turing model
Lax614640.Machine · concepts/Lax614640/Machine.lean · lax-614640
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
All algorithms in this submission compute total functions on finite words of natural numbers. Polynomial time is exactly Lax759944's predicate: a fixed finite multi-stack Turing machine transforms the canonical binary encoding of the input word into the canonical binary encoding of its output within a polynomial number of transitions.
In particular, a program's semantic function is tied to an actual finite Turing machine by . Randomized algorithms receive a finite list of independent uniform bits, represented by the words and .
Concept map
Lean source view on GitHub
| 1 | import Lax759944.TuringPolytime |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: Polynomial-time computation on the Lax759944 finite-Turing model |
| 6 | type: definition |
| 7 | --- |
| 8 | All algorithms in this submission compute total functions on finite words of |
| 9 | natural numbers. Polynomial time is exactly Lax759944's predicate: a fixed |
| 10 | finite multi-stack Turing machine transforms the canonical binary encoding of |
| 11 | the input word into the canonical binary encoding of its output within a |
| 12 | polynomial number of transitions. |
| 13 | |
| 14 | In particular, a program's semantic function is tied to an actual finite |
| 15 | Turing machine by . Randomized algorithms receive a finite |
| 16 | list of independent uniform bits, represented by the words and . |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | namespace Lax614640.Machine |
| 22 | |
| 23 | open Lax759944.BinaryWordEncoding Lax759944.TuringPolytime |
| 24 | |
| 25 | /-- A finite machine word. Boolean data use the entries and . -/ |
| 26 | abbrev BitString := List ℕ |
| 27 | |
| 28 | /-- The convenient monomial bound . -/ |
| 29 | def polynomialBound (c k n : ℕ) : ℕ := |
| 30 | c * (n + 1) ^ k |
| 31 | |
| 32 | /-- A total word function computed in polynomial time by a finite Turing machine. -/ |
| 33 | structure PolytimeProgram where |
| 34 | function : BitString → BitString |
| 35 | polytime : TuringPolytime function |
| 36 | |
| 37 | /-- The semantic output certified by the program's finite Turing machine. -/ |
| 38 | def PolytimeProgram.output (program : PolytimeProgram) |
| 39 | (input : BitString) : BitString := |
| 40 | program.function input |
| 41 | |
| 42 | /-- A length-prefixed pairing of two finite words. -/ |
| 43 | def pairBits (left right : BitString) : BitString := |
| 44 | left.length :: left ++ right |
| 45 | |
| 46 | /-- A uniformly random string of exactly bits. -/ |
| 47 | abbrev RandomSeed (r : ℕ) := Fin r → Bool |
| 48 | |
| 49 | /-- Encode one Boolean as a natural-number word. -/ |
| 50 | def bitWord (bit : Bool) : ℕ := |
| 51 | if bit then 1 else 0 |
| 52 | |
| 53 | /-- The word representation of a fixed-length random seed. -/ |
| 54 | def RandomSeed.bits {r : ℕ} (seed : RandomSeed r) : BitString := |
| 55 | (List.ofFn seed).map bitWord |
| 56 | |
| 57 | end Lax614640.Machine |
| 58 |
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments