Documentation

CslibFrontier.Computability.Complexity.RealAlgebraic.SparseDerivativeTestEvaluation

Modular evaluation of sparse derivative tests #

The qualifying test occupies slot zero. Later slots look up positive derivative orders from the list and return zero for missing entries. The lookup and dispatch preserve the counting level of derivative evaluation when the qualifying value is available at that level.

Adapted from LeanCanny.CountingHierarchy.BinaryDerivativeTestEvaluation at lean-canny commit 970f28a5ecefc1327402ade16c068aa4b1b2c183.

noncomputable def Cslib.Complexity.RealAlgebraic.sparseDerivativeTestResidue (p D z base : ℕ) (c : ℕ → ℕ) (orders : List ℕ) (i : ℕ) :

Select the qualifying residue at slot zero or evaluate the addressed derivative. The orders are binary naturals, with zero reserved for a missing test.

theorem Cslib.Complexity.RealAlgebraic.sparseDerivativeTestResidue_cast {p D N : ℕ} [Fact (Nat.Prime p)] (q b₀ : Polynomial ℤ) (z base : ℕ) (c : ℕ → ℕ) (L : List (Fin D × SignType)) (hD : q.natDegree ≤ D) (hprime : D < p) (hc : ∀ j ≤ D, ↑(c j) = (Polynomial.map (Int.castRingHom (ZMod p)) q).coeff j) (hbase : ↑base = Polynomial.eval₂ (Int.castRingHom (ZMod p)) (↑z) b₀) (i : Fin (N + 1)) :
↑(sparseDerivativeTestResidue p D z base c (List.map (fun (t : Fin D × SignType) => ↑t.1 + 1) L) ↑i) = Polynomial.eval₂ (Int.castRingHom (ZMod p)) (↑z) (q.sparseRootLabelTests b₀ N L i).1

Encoding each test by its positive derivative order gives the same evaluation as Polynomial.sparseRootLabelTests, including the qualifying slot and zero padding.