Lax489179.WordTime
Polynomial running time on logarithmic words
concepts/Lax489179/WordTime.lean · lax-489179
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Definition
An encoded problem specifies its instances, size parameter , input array, admissibility promise and correct outputs. It is solvable with exponent if one finite word-RAM program solves every admissible instance within instructions, for a constant .
The word length is for one fixed positive integer . Thus words have bits and the program is uniform in . Both and the program are chosen before the input. Every encoded input entry and the full input length must fit in a word. These fitting conditions are requirements on the algorithm, so a choice of small words cannot discard difficult inputs.
The size parameter counts vertices for APSP and integers for 3-SUM. There is no arbitrary polynomial factor in these time bounds. The additive two makes the same constant bound meaningful at small sizes.
Lean source view on GitHub
| 1 | import Lax489179.WordPrograms |
| 2 | import Mathlib.Data.Nat.Log |
| 3 | import Mathlib.Analysis.SpecialFunctions.Pow.Real |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: Polynomial running time on logarithmic words |
| 8 | type: definition |
| 9 | --- |
| 10 | An encoded problem specifies its instances, size parameter , input |
| 11 | array, admissibility promise and correct outputs. It is solvable with |
| 12 | exponent if one finite word-RAM program solves every admissible |
| 13 | instance within instructions, for a constant . |
| 14 | |
| 15 | The word length is for one fixed |
| 16 | positive integer . Thus words have bits and |
| 17 | the program is uniform in . Both and the program are chosen |
| 18 | before the input. Every encoded input entry and the full input length |
| 19 | must fit in a word. These fitting conditions are requirements on the |
| 20 | algorithm, so a choice of small words cannot discard difficult inputs. |
| 21 | |
| 22 | The size parameter counts vertices for APSP and integers for 3-SUM. |
| 23 | There is no arbitrary polynomial factor in these time bounds. The |
| 24 | additive two makes the same constant bound meaningful at small sizes. |
| 25 | -/ |
| 26 | |
| 27 | namespace Lax489179.WordTime |
| 28 | |
| 29 | structure Problem where |
| 30 | Input : Type |
| 31 | size : Input → ℕ |
| 32 | encode : Input → List ℕ |
| 33 | valid : Input → Prop |
| 34 | correct : Input → List ℕ → Prop |
| 35 | |
| 36 | def wordLength (b n : ℕ) : ℕ := b * (Nat.log2 (n + 2) + 1) |
| 37 | |
| 38 | def Fits (w : ℕ) (input : List ℕ) : Prop := |
| 39 | input.length < 2 ^ w ∧ ∀ x ∈ input, x < 2 ^ w |
| 40 | |
| 41 | def Solvable (mode : Algorithms.Mode) (P : Problem) (a : ℝ) : Prop := |
| 42 | ∃ (p : WordPrograms.Program) (b : ℕ) (C : ℝ), |
| 43 | 0 < b ∧ 0 < C ∧ Algorithms.Allowed mode (WordPrograms.Deterministic p) ∧ |
| 44 | ∀ x : P.Input, P.valid x → |
| 45 | Fits (wordLength b (P.size x)) (P.encode x) ∧ |
| 46 | ∃ t : ℕ, (t : ℝ) ≤ C * Real.rpow (P.size x + 2 : ℝ) a ∧ |
| 47 | WordPrograms.ComputesWithin (wordLength b (P.size x)) p |
| 48 | (P.encode x) (P.correct x) t |
| 49 | |
| 50 | end Lax489179.WordTime |
| 51 |
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