Counting-level sums over binary bounds #
A binary polynomial-time endpoint may have exponential value. Enumerating its binary width through one uniform evaluator still costs one counting level. These rules include the empty interval and avoid an explicit list of its elements.
Main results #
Cslib.Complexity.CountingFunction.sum_range: natural sums up to a short binary bound.Cslib.Complexity.CountingFunction.sum_range_int: signed sums with the same bound.
theorem Cslib.Complexity.CountingFunction.sum_range {α : Type} {enc : α ↪ List Bool} {a : ℕ} (D : Turing.MultiTapeTM.Decoder enc) {f : α × ℕ → ℕ} {r : α → ℕ} (hf : f ∈ CountingFunction a (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encNat) (hr : Turing.MultiTapeTM.ComputableInPolyTime r enc Turing.MultiTapeTM.encNat) :
(fun (x : α) => ∑ i ∈ Finset.range (r x), f (x, i)) ∈ CountingFunction (a + 1) enc Turing.MultiTapeTM.encNat
Summation below a polynomial-bit binary endpoint costs one function level.
theorem Cslib.Complexity.CountingFunction.sum_range_int {α : Type} {enc : α ↪ List Bool} {a : ℕ} (D : Turing.MultiTapeTM.Decoder enc) {f : α × ℕ → ℤ} {r : α → ℕ} (hf : f ∈ CountingFunction a (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encIntBin) (hr : Turing.MultiTapeTM.ComputableInPolyTime r enc Turing.MultiTapeTM.encNat) :
(fun (x : α) => ∑ i ∈ Finset.range (r x), f (x, i)) ∈ CountingFunction (a + 1) enc Turing.MultiTapeTM.encIntBin
Signed summation below a short binary endpoint has the same one-level cost.