No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Definition
A language of finite binary strings belongs to if a deterministic Turing machine decides membership in that language in polynomial time. Precisely, there are a single machine and a polynomial such that, on every input , the machine halts within steps and returns the bit if belongs to the language and otherwise.
The definition uses mathlib's deterministic stack machines, the identity encoding of binary strings, and a singleton Boolean output. Time counts transitions of fixed finite instruction blocks. We also prove equivalence with elementary single-tape machines.
Lean source view on GitHub
| 1 | import Mathlib.Computability.TuringMachine.Computable |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: The complexity class P |
| 6 | type: definition |
| 7 | --- |
| 8 | A language of finite binary strings belongs to if a deterministic |
| 9 | Turing machine decides membership in that language in polynomial time. |
| 10 | Precisely, there are a single machine and a polynomial |
| 11 | such that, on every input , the machine halts within steps and |
| 12 | returns the bit if belongs to the language and otherwise. |
| 13 | |
| 14 | The definition uses mathlib's deterministic stack machines, the identity |
| 15 | encoding of binary strings, and a singleton Boolean output. Time counts |
| 16 | transitions of fixed finite instruction blocks. We also prove equivalence |
| 17 | with elementary single-tape machines. |
| 18 | -/ |
| 19 | |
| 20 | namespace Lax554803.PolynomialTime |
| 21 | |
| 22 | /-- A finite binary string. -/ |
| 23 | abbrev Word := List Bool |
| 24 | |
| 25 | /-- A language of finite binary strings. -/ |
| 26 | abbrev Language := Set Word |
| 27 | |
| 28 | /-- Languages whose Boolean characteristic functions are computable in polynomial time. -/ |
| 29 | def P : Set Language := |
| 30 | {L | ∃ f : Word → Bool, |
| 31 | (∀ w, f w = true ↔ w ∈ L) ∧ |
| 32 | Nonempty (Turing.TM2ComputableInPolyTime id Computability.encodeBool f)} |
| 33 | |
| 34 | end Lax554803.PolynomialTime |
| 35 |
Builds on
none
From Mathlib
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