Polynomial evaluation from modular coefficient access #
Summing weighted coefficient residues up to a binary degree bound uses one counting level.
The correctness statement applies to every positive modulus. Adapted from
LeanCanny.CountingHierarchy.binaryPolynomialValue at lean-canny
970f28a5ecefc1327402ade16c068aa4b1b2c183.
theorem Cslib.Complexity.polynomialResidue_lt {p : ℕ} (hp : 0 < p) (D t : ℕ) (coeff : ℕ → ℕ) :
polynomialResidue p D t coeff < p
A positive modulus gives a canonical natural residue.
theorem Cslib.Complexity.polynomialResidue_mem {α : Type} {enc : α ↪ List Bool} {a : ℕ} (E : Turing.MultiTapeTM.Decoder enc) {p D t : α → ℕ} {coeff : α × ℕ → ℕ} (hp : Turing.MultiTapeTM.ComputableInPolyTime p enc Turing.MultiTapeTM.encNat) (hD : Turing.MultiTapeTM.ComputableInPolyTime D enc Turing.MultiTapeTM.encNat) (ht : Turing.MultiTapeTM.ComputableInPolyTime t enc Turing.MultiTapeTM.encNat) (hc : coeff ∈ CountingFunction a (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encNat) :
(fun (w : α) => polynomialResidue (p w) (D w) (t w) fun (k : ℕ) => coeff (w, k)) ∈ CountingFunction (a + 1) enc Turing.MultiTapeTM.encNat
Evaluation uses one counting level above its coefficient access. The modulus, evaluation point, degree bound, and coefficient index are binary.
theorem Cslib.Complexity.polynomialResidue_cast {R : Type u_1} [Semiring R] {p : ℕ} (hp : p ≠ 0) (φ : R →+* ZMod p) (P : Polynomial R) (D t : ℕ) (hD : P.natDegree ≤ D) (coeff : ℕ → ℕ) (hc : ∀ k ≤ D, ↑(coeff k) = φ (P.coeff k)) :
A complete sequence of mapped coefficients gives evaluation over ZMod p.