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.
theorem Cslib.Complexity.RealAlgebraic.sparseDerivativeTestResidue_mem {α : Type} {enc : α ↪ List Bool} {a : ℕ} (E : Turing.MultiTapeTM.Decoder enc) {p D z base : α → ℕ} {orders : α → List ℕ} {c : α × ℕ → ℕ} (hp : Turing.MultiTapeTM.ComputableInPolyTime p enc Turing.MultiTapeTM.encNat) (hD : Turing.MultiTapeTM.ComputableInPolyTime D enc Turing.MultiTapeTM.encNat) (hz : Turing.MultiTapeTM.ComputableInPolyTime z enc Turing.MultiTapeTM.encNat) (hbase : base ∈ CountingFunction (max a 3 + 1) enc Turing.MultiTapeTM.encNat) (horders : Turing.MultiTapeTM.ComputableInPolyTime orders enc (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)) (hc : c ∈ CountingFunction a (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encNat) :
(fun (w : α × ℕ) =>
sparseDerivativeTestResidue (p w.1) (D w.1) (z w.1) (base w.1) (fun (j : ℕ) => c (w.1, j)) (orders w.1) w.2) ∈ CountingFunction (max a 3 + 1) (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encNat) Turing.MultiTapeTM.encNat
Binary list lookup and dispatch require no additional counting-hierarchy level.
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.