Polynomially bounded functions #
The time accounting of the instantiation (Halting/Wrapper.lean, Halting/Compressor.lean)
composes a dozen explicit cost bounds, each a polynomial in the values it depends on. What the
argument eventually needs is only that the total is bounded by some polynomial in the level,
so that it falls under 2 ^ n above a threshold. PolyBounded f records exactly that —
f n ≤ P.eval n for some P : Polynomial ℕ — with the closure properties that let the
bounds be composed without ever writing the polynomial down:
- constants, the identity, sums, products, powers,
Nat.size; PolyBounded.comp: a polynomially bounded function of a polynomially bounded function;PolyBounded.eval: a fixed polynomial evaluated at a polynomially bounded argument;PolyBounded.mono: domination by a polynomially bounded function;PolyBounded.exists_le_two_pow: the threshold,f n ≤ 2 ^ nfor allnabove somen₀;PolyBounded.exists_le_pow: a singleλwithf n ≤ n ^ λfor everyn ≥ 2, which is the shapeVerifier.IsBoundedasks for.
PolyCost and HasPolyCost are the same notion for the cost of a program at index n on an
input d: bounded by C n · (|d| + 1) ^ k with C polynomially bounded and k constant —
exactly what Decider.TimeBoundAt asks for, and what the stages of a decider's run compose
into (PolyCost.add, mul, poly, the last being the universal machine's overhead).
The polynomial of a PolyBounded function can be extracted (PolyBounded.choose) where an
explicit Polynomial ℕ is required, as in the timeBound field of PolyTimeFun.
f is bounded by a polynomial.
Equations
- MIPRE.Cost.PolyBounded f = ∃ (P : Polynomial ℕ), ∀ (n : ℕ), f n ≤ Polynomial.eval n P
Instances For
A fixed polynomial at a polynomially bounded argument.
A polynomially bounded function of a polynomially bounded argument. Polynomials over ℕ
are monotone, so no monotonicity of g is needed.
The threshold. A polynomially bounded function is below 2 ^ n from some n₀ on.
A single exponent for every index. A polynomially bounded function is below n ^ λ for
one λ and all n ≥ 2 — the form Verifier.IsBounded asks for.
The size of the binary encoding of n is polynomially bounded.
Costs, polynomially bounded in the index and in the input #
A cost function of an index and an input, bounded by C n · (|d| + 1) ^ k with C
polynomially bounded and k constant.
Equations
- MIPRE.Cost.PolyCost f = ∃ (C : ℕ → ℕ) (k : ℕ), MIPRE.Cost.PolyBounded C ∧ ∀ (n : ℕ) (d : MIPRE.Cost.Data), f n d ≤ C n * (d.size + 1) ^ k
Instances For
A fixed polynomial at a polynomially bounded cost: the universal machine's overhead.
A program whose cost at index n on input d is polynomially bounded: the hypothesis the
deciders of the instantiation carry, and (through hasPolyCost_iff_exists_isBounded) what
λ-boundedness comes from.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A cost bound of the composable shape PolyCost is a HasPolyCost: the two differ only in
whether the polynomial in the input size is displayed. Cost analyses are assembled in the first
form, where add, mul and poly apply, and consumed in the second.