Documentation

CslibFrontier.Computability.Complexity.RealAlgebraic.ResidueEvaluation

Uniform modular evaluation of finite pure-power residues #

The evaluator sums coefficients of the geometric-series numerators over short base-addresses. A degree mask removes the noncontributing indices before coefficient extraction. Unary arity and binary modulus, degree and exponents keep each address polynomial in the encoded input; the number of summands may be exponential. Uniform numerator and relation evaluators in CountingFunction a give a residue evaluator in CountingFunction (a + 5).

Correctness identifies this constructed evaluator with the actual finite residue over ZMod p when the source degree and prime bounds hold. No residue oracle is assumed. Ported and simplified from LeanCanny.CountingHierarchy.ResidueEvaluation and ResidueEnumeration at lean-canny commit 970f28a5ecefc1327402ade16c068aa4b1b2c183. Critical-system evaluation and the full real-counting endpoints remain #6560.

The top-box exponent shifted by ell times the geometric-series index.

noncomputable def Cslib.Complexity.RealAlgebraic.residueValue (p n ell B : ℕ) (v : List ℕ → ℕ) (r : ℕ → List ℕ → ℕ) :

A total residue evaluator. The degree mask discards indices outside the finite simplex before invoking coefficient extraction.

theorem Cslib.Complexity.RealAlgebraic.residueValue_cast {p n ell B : ℕ} [Fact (Nat.Prime p)] (hell : 1 ≤ ell) (r : Fin n → MvPolynomial (Fin n) (ZMod p)) (hr : ∀ (i : Fin n), (r i).totalDegree < ell) (v : MvPolynomial (Fin n) (ZMod p)) (hv : v.totalDegree ≤ B) (hcut : ell * (B + 1) + 1 < p) (value : List ℕ → ℕ) (rvalue : ℕ → List ℕ → ℕ) (hvalue : ∀ s < p ^ n, ↑(value (gridPoint p n s)) = (MvPolynomial.eval fun (i : Fin n) => ↑((gridPoint p n s)[↑i]?.getD 0)) v) (hrvalue : ∀ (i : Fin n), ∀ s < p ^ n, ↑(rvalue (↑i) (gridPoint p n s)) = (MvPolynomial.eval fun (k : Fin n) => ↑((gridPoint p n s)[↑k]?.getD 0)) (r i)) :
↑(residueValue p n ell B value rvalue) = MvPolynomial.PurePower.residue ell r v

The constructed evaluator computes the actual residue, using only canonical finite-field evaluation points and bounded base-address indices.