Lax58.RamPolynomialComparison
Two polynomial-time conventions, and their separation
concepts/Lax58/RamPolynomialComparison.lean · lax-58
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Evidence
This concept declares 3 statements. Each proof establishes one of them relative to its assumptions.
1st statement bitPolynomialTime_iff_ramPolytime proven
2nd statement exponentialLength_bitPolynomialTime proven
3rd statement exponentialLength_not_polynomialTime proven
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 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 is a time polynomial, is a sufficient-word-length polynomial, and denotes the binary input size. From arena input to native input it uses ; from native input to arena input it uses . Both directions use 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.
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.
Lean source view on GitHub
| 1 | import Lax58.BitPolynomialTime |
| 2 | import Lax58.RamComplexityExample |
| 3 | import Lax51.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 Lax51'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 checked proof uses the following witness transformations, where `T` is a |
| 23 | time polynomial, `Q` is a sufficient-word-length polynomial, and `X` denotes |
| 24 | the 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`. |
| 26 | Both directions use `Q + 7` for word length. Consequently, nonconstant time |
| 27 | degrees are preserved, but the first translation can turn a constant bound |
| 28 | into a linear one because its current adapter has linear startup. The theorem |
| 29 | asserts equivalence of the existential polynomial-time classes only: it does |
| 30 | not 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 |
| 34 | input magnitude (and the arena fits). The difference in capacity matters |
| 35 | even on all-zero inputs, where `B=n`: the exact result `2^n` fits in `n+1` |
| 36 | bits but cannot fit at all admissible logarithmic word widths. Thus the |
| 37 | example below satisfies the bit-polynomial convention but not the |
| 38 | length-polynomial, linear-capacity convention. |
| 39 | -/ |
| 40 | |
| 41 | namespace Lax58.RamPolynomialComparison |
| 42 | |
| 43 | open Lax58.StructuralCombinators Lax58.RamComplexity |
| 44 | |
| 45 | /-- Polynomial time and sufficient word length in the binary size of a |
| 46 | natural-number sequence; input uses its distinguished structural arena. -/ |
| 47 | def 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. -/ |
| 52 | def exponentialLength (xs : List Nat) : Nat := 2 ^ xs.length |
| 53 | |
| 54 | /-- Arena input and native length-prefixed input yield the same |
| 55 | bit-polynomial computability class for natural-number outputs. This is a class |
| 56 | equivalence, not a same-degree equivalence. -/ |
| 57 | axiom bitPolynomialTime_iff_ramPolytime (f : List Nat → Nat) : |
| 58 | BitPolynomialTime f ↔ Lax51.RamPolytime.RamPolytime (fun xs => [f xs]) |
| 59 | |
| 60 | axiom exponentialLength_bitPolynomialTime : BitPolynomialTime exponentialLength |
| 61 | |
| 62 | axiom exponentialLength_not_polynomialTime : |
| 63 | ¬ Lax58.RamComplexityExample.PolynomialTime exponentialLength |
| 64 | |
| 65 | end Lax58.RamPolynomialComparison |
| 66 |
Used by
none
From Mathlib
none
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