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

Lax58.RamPolynomialComparison

Two polynomial-time conventions, and their separation

concepts/Lax58/RamPolynomialComparison.lean · lax-58

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.

    Concept map

    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.

    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 Lax51'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 checked proof uses the following witness transformations, where TT is a time polynomial, QQ is a sufficient-word-length polynomial, and XX denotes the binary input size. From arena input to native input it uses 66T+6X+8166*T + 6*X + 81; from native input to arena input it uses 18T+2618*T + 26. Both directions use Q+7Q + 7 for word length. Consequently, nonconstant time degrees are preserved, but the first translation can turn a constant bound into a linear one because its current adapter has linear startup. The theorem asserts equivalence of the existential polynomial-time classes only: it does not require the two witnesses, or their degrees, to match.

    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.

    Lean source view on GitHub

    1import Lax58.BitPolynomialTime
    2import Lax58.RamComplexityExample
    3import Lax51.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 Lax51'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 checked proof uses the following witness transformations, where `T` is a
    23time polynomial, `Q` is a sufficient-word-length polynomial, and `X` denotes
    24the binary input size. From arena input to native input it uses
    25`66*T + 6*X + 81`; from native input to arena input it uses `18*T + 26`.
    26Both directions use `Q + 7` for word length. Consequently, nonconstant time
    27degrees are preserved, but the first translation can turn a constant bound
    28into a linear one because its current adapter has linear startup. The theorem
    29asserts equivalence of the existential polynomial-time classes only: it does
    30not require the two witnesses, or their degrees, to match.
    31
    32`RamComplexityExample.PolynomialTime` instead bounds time polynomially in
    33`n` and requires correctness whenever capacity exceeds a constant times
    34input magnitude (and the arena fits). The difference in capacity matters
    35even on all-zero inputs, where `B=n`: the exact result `2^n` fits in `n+1`
    36bits but cannot fit at all admissible logarithmic word widths. Thus the
    37example below satisfies the bit-polynomial convention but not the
    38length-polynomial, linear-capacity convention.
    39-/
    40
    41namespace Lax58.RamPolynomialComparison
    42
    43open Lax58.StructuralCombinators Lax58.RamComplexity
    44
    45/-- Polynomial time and sufficient word length in the binary size of a
    46natural-number sequence; input uses its distinguished structural arena. -/
    47def BitPolynomialTime (f : List Nat → Nat) : Prop :=
    48 Lax58.BitPolynomialTime.BitPolynomialTimeUsing (list nat) natOutput
    49 Lax51.BinaryWordEncoding.bitSize f
    50
    51/-- A small exact-output example, independent of all input payloads. -/
    52def exponentialLength (xs : List Nat) : Nat := 2 ^ xs.length
    53
    54/-- Arena input and native length-prefixed input yield the same
    55bit-polynomial computability class for natural-number outputs. This is a class
    56equivalence, not a same-degree equivalence. -/
    57axiom bitPolynomialTime_iff_ramPolytime (f : List Nat → Nat) :
    58 BitPolynomialTime f ↔ Lax51.RamPolytime.RamPolytime (fun xs => [f xs])
    59
    60axiom exponentialLength_bitPolynomialTime : BitPolynomialTime exponentialLength
    61
    62axiom exponentialLength_not_polynomialTime :
    63 ¬ Lax58.RamComplexityExample.PolynomialTime exponentialLength
    64
    65end Lax58.RamPolynomialComparison
    66
    Show ProofShow ProofShow Proof

    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…