Two polynomial-time conventions, and their separation

Lax560851.RamPolynomialComparison · concepts/Lax560851/RamPolynomialComparison.lean · lax-560851

proven

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.

    Natural Language Statement

    Definition and theorem

    For a sequence xsxs, let n=xs.lengthn = xs.length, let mm be its largest entry (zero for the empty sequence), and let BB be its binary size: one separator per entry plus the number of bits of each entry. The distinguished arena has 2n+12*n+1 structural nodes, and input magnitude is 2n+m+22*n+m+2.

    BitPolynomialTimeBitPolynomialTime permits polynomial instruction count and polynomial sufficient word length in BB. It keeps arena input and one-word natural output. It agrees with Lax759944's convention, whose input is instead the native length-prefixed sequence. The agreement requires explicit efficient encoding conversions; it is not a definitional identification of the two input tapes.

    The input conversions must preserve both indexed access to the original input and sequential reads, including EOF. Buffering an input can contribute linear startup time in either direction. The theorem asserts equivalence of the existential polynomial-time classes only: it does not require the two time witnesses, or their degrees, to match. Terminal instructions are charged according to the Lax808846 machine semantics.

    RamComplexityExample.PolynomialTimeRamComplexityExample.PolynomialTime instead bounds time polynomially in nn and requires correctness whenever capacity exceeds a constant times input magnitude (and the arena fits). The difference in capacity matters even on all-zero inputs, where B=nB=n: the exact result 2n2^n fits in n+1n+1 bits but cannot fit at all admissible logarithmic word widths. Thus the example below satisfies the bit-polynomial convention but not the length-polynomial, linear-capacity convention.

    Concept map
    14 concepts
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    This concept declares 3 statements. Each proof establishes one of them relative to its assumptions.

    Lean source view on GitHub

    1import Lax560851.BitPolynomialTime
    2import Lax560851.RamComplexityExample
    3import Lax759944.RamPolytime
    4
    5/-!
    6---
    7title: Two polynomial-time conventions, and their separation
    8type: definition and theorem
    9---
    10
    11For a sequence `xs`, let `n = xs.length`, let `m` be its largest entry
    12(zero for the empty sequence), and let `B` be its binary size: one separator
    13per entry plus the number of bits of each entry. The distinguished arena
    14has `2*n+1` structural nodes, and input magnitude is `2*n+m+2`.
    15
    16`BitPolynomialTime` permits polynomial instruction count and polynomial
    17sufficient word length in `B`. It keeps arena input and one-word natural
    18output. It agrees with Lax759944's convention, whose input is instead the native
    19length-prefixed sequence. The agreement requires explicit efficient encoding
    20conversions; it is not a definitional identification of the two input tapes.
    21
    22The input conversions must preserve both indexed access to the original
    23input and sequential reads, including EOF. Buffering an input can contribute
    24linear startup time in either direction. The theorem asserts equivalence of
    25the existential polynomial-time classes only: it does not require the two
    26time witnesses, or their degrees, to match. Terminal instructions are charged
    27according to the Lax808846 machine semantics.
    28
    29`RamComplexityExample.PolynomialTime` instead bounds time polynomially in
    30`n` and requires correctness whenever capacity exceeds a constant times
    31input magnitude (and the arena fits). The difference in capacity matters
    32even on all-zero inputs, where `B=n`: the exact result `2^n` fits in `n+1`
    33bits but cannot fit at all admissible logarithmic word widths. Thus the
    34example below satisfies the bit-polynomial convention but not the
    35length-polynomial, linear-capacity convention.
    36-/
    37
    38namespace Lax560851.RamPolynomialComparison
    39
    40open Lax560851.StructuralCombinators Lax560851.RamComplexity
    41
    42/-- Polynomial time and sufficient word length in the binary size of a
    43natural-number sequence; input uses its distinguished structural arena. -/
    44def BitPolynomialTime (f : List Nat → Nat) : Prop :=
    45 Lax560851.BitPolynomialTime.BitPolynomialTimeUsing (list nat) natOutput
    46 Lax759944.BinaryWordEncoding.bitSize f
    47
    48/-- A small exact-output example, independent of all input payloads. -/
    49def exponentialLength (xs : List Nat) : Nat := 2 ^ xs.length
    50
    51/-- Arena input and native length-prefixed input yield the same
    52bit-polynomial computability class for natural-number outputs. This is a class
    53equivalence, not a same-degree equivalence. -/
    54axiom bitPolynomialTime_iff_ramPolytime (f : List Nat → Nat) :
    55 BitPolynomialTime f ↔ Lax759944.RamPolytime.RamPolytime (fun xs => [f xs])
    56
    57axiom exponentialLength_bitPolynomialTime : BitPolynomialTime exponentialLength
    58
    59axiom exponentialLength_not_polynomialTime :
    60 ¬ Lax560851.RamComplexityExample.PolynomialTime exponentialLength
    61
    62end Lax560851.RamPolynomialComparison
    63
    Show ProofShow ProofShow Proof

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…