Root counts of polynomials over ZMod n #
Over a field, a nonzero polynomial has at most natDegree roots (Polynomial.card_roots'). Over
ZMod n with composite n it can have many more: (n / p) * X vanishes on every multiple of a
prime p ∣ n. This file proves the general bound: a nonzero f : (ZMod n)[X] has at most
f.natDegree * (n / n.minFac) roots. The proof writes an integer lift of f as p ^ j * G for a
prime p ∣ n such that G is nonzero modulo p, and counts the residues of ZMod n above the at
most f.natDegree roots of G in ZMod p.
Main results #
ZMod.card_filter_castHom_eq: every fibre of the reductionZMod n → ZMod d, ford ∣ n, hasn / delements.ZMod.card_filter_eval_eq_zero_le: the root boundf.natDegree * (n / n.minFac).Nat.minFac_mul_pow: for primesp < qandζ ≠ 0, the smallest prime factor of(p * q) ^ ζisp, which evaluates the bound for the moduli of Damgård–Jurik encryption. Its Mathlib destination isMathlib/Data/Nat/Prime/Pow.lean, besideNat.pow_minFac.
theorem ZMod.card_filter_eval_eq_zero_le {n : ℕ} [NeZero n] {f : Polynomial (ZMod n)} (hf : f ≠ 0) :
Root bound over ZMod n. A nonzero polynomial f over ZMod n has at most
f.natDegree * (n / n.minFac) roots. For prime n this is the usual bound f.natDegree.