Two polynomial-time conventions, and their separation
Lax560851.RamPolynomialComparison · concepts/Lax560851/RamPolynomialComparison.lean · lax-560851
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition and theorem
For a sequence , let , let be its largest entry (zero for the empty sequence), and let be its binary size: one separator per entry plus the number of bits of each entry. The distinguished arena has structural nodes, and input magnitude is .
permits polynomial instruction count and polynomial sufficient word length in . 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.
instead bounds time polynomially in 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 : the exact result fits in 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
Evidence
Lean source view on GitHub
| 1 | import Lax560851.BitPolynomialTime |
| 2 | import Lax560851.RamComplexityExample |
| 3 | import Lax759944.RamPolytime |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: Two polynomial-time conventions, and their separation |
| 8 | type: definition and theorem |
| 9 | --- |
| 10 | |
| 11 | For 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 |
| 13 | per entry plus the number of bits of each entry. The distinguished arena |
| 14 | has `2*n+1` structural nodes, and input magnitude is `2*n+m+2`. |
| 15 | |
| 16 | `BitPolynomialTime` permits polynomial instruction count and polynomial |
| 17 | sufficient word length in `B`. It keeps arena input and one-word natural |
| 18 | output. It agrees with Lax759944's convention, whose input is instead the native |
| 19 | length-prefixed sequence. The agreement requires explicit efficient encoding |
| 20 | conversions; it is not a definitional identification of the two input tapes. |
| 21 | |
| 22 | The input conversions must preserve both indexed access to the original |
| 23 | input and sequential reads, including EOF. Buffering an input can contribute |
| 24 | linear startup time in either direction. The theorem asserts equivalence of |
| 25 | the existential polynomial-time classes only: it does not require the two |
| 26 | time witnesses, or their degrees, to match. Terminal instructions are charged |
| 27 | according 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 |
| 31 | input magnitude (and the arena fits). The difference in capacity matters |
| 32 | even on all-zero inputs, where `B=n`: the exact result `2^n` fits in `n+1` |
| 33 | bits but cannot fit at all admissible logarithmic word widths. Thus the |
| 34 | example below satisfies the bit-polynomial convention but not the |
| 35 | length-polynomial, linear-capacity convention. |
| 36 | -/ |
| 37 | |
| 38 | namespace Lax560851.RamPolynomialComparison |
| 39 | |
| 40 | open Lax560851.StructuralCombinators Lax560851.RamComplexity |
| 41 | |
| 42 | /-- Polynomial time and sufficient word length in the binary size of a |
| 43 | natural-number sequence; input uses its distinguished structural arena. -/ |
| 44 | def 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. -/ |
| 49 | def exponentialLength (xs : List Nat) : Nat := 2 ^ xs.length |
| 50 | |
| 51 | /-- Arena input and native length-prefixed input yield the same |
| 52 | bit-polynomial computability class for natural-number outputs. This is a class |
| 53 | equivalence, not a same-degree equivalence. -/ |
| 54 | axiom bitPolynomialTime_iff_ramPolytime (f : List Nat → Nat) : |
| 55 | BitPolynomialTime f ↔ Lax759944.RamPolytime.RamPolytime (fun xs => [f xs]) |
| 56 | |
| 57 | axiom exponentialLength_bitPolynomialTime : BitPolynomialTime exponentialLength |
| 58 | |
| 59 | axiom exponentialLength_not_polynomialTime : |
| 60 | ¬ Lax560851.RamComplexityExample.PolynomialTime exponentialLength |
| 61 | |
| 62 | end Lax560851.RamPolynomialComparison |
| 63 |
Used by
none
From Mathlib
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments