Draft — mutable and not usable as a dependency; its citation marks the draft state.

Lax489179.WordTime

Polynomial running time on logarithmic words

concepts/Lax489179/WordTime.lean · lax-489179

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Concept map

    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Definition

    An encoded problem specifies its instances, size parameter nn, input array, admissibility promise and correct outputs. It is solvable with exponent aa if one finite word-RAM program solves every admissible instance within C(n+2)aC(n+2)^a instructions, for a constant C>0C>0.

    The word length is b(1+log2(n+2))b(1+\lfloor\log_2(n+2)\rfloor) for one fixed positive integer bb. Thus words have Θ(log(n+2))\Theta(\log(n+2)) bits and the program is uniform in nn. Both bb 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

    1import Lax489179.WordPrograms
    2import Mathlib.Data.Nat.Log
    3import Mathlib.Analysis.SpecialFunctions.Pow.Real
    4
    5/-!
    6---
    7title: Polynomial running time on logarithmic words
    8type: definition
    9---
    10An encoded problem specifies its instances, size parameter nn, input
    11array, admissibility promise and correct outputs. It is solvable with
    12exponent aa if one finite word-RAM program solves every admissible
    13instance within C(n+2)aC(n+2)^a instructions, for a constant C>0C>0.
    14
    15The word length is b(1+log2(n+2))b(1+\lfloor\log_2(n+2)\rfloor) for one fixed
    16positive integer bb. Thus words have Θ(log(n+2))\Theta(\log(n+2)) bits and
    17the program is uniform in nn. Both bb and the program are chosen
    18before the input. Every encoded input entry and the full input length
    19must fit in a word. These fitting conditions are requirements on the
    20algorithm, so a choice of small words cannot discard difficult inputs.
    21
    22The size parameter counts vertices for APSP and integers for 3-SUM.
    23There is no arbitrary polynomial factor in these time bounds. The
    24additive two makes the same constant bound meaningful at small sizes.
    25-/
    26
    27namespace Lax489179.WordTime
    28
    29structure Problem where
    30 Input : Type
    31 size : Input → ℕ
    32 encode : Input → List ℕ
    33 valid : Input → Prop
    34 correct : Input → List ℕ → Prop
    35
    36def wordLength (b n : ℕ) : ℕ := b * (Nat.log2 (n + 2) + 1)
    37
    38def Fits (w : ℕ) (input : List ℕ) : Prop :=
    39 input.length < 2 ^ w ∧ ∀ x ∈ input, x < 2 ^ w
    40
    41def 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
    50end 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

    Loading discussion…