Documentation

CslibFrontier.Foundations.Data.MvPolynomial.SchwartzZippel

Schwartz–Zippel over any finite set of variables #

Mathlib's MvPolynomial.schwartz_zippel_totalDegree bounds the proportion of the points of S ^ n at which a nonzero polynomial in the variables Fin n vanishes by totalDegree / |S|. MvPolynomial.schwartz_zippel_totalDegree_fintype transports it to the variables of any finite type σ, by renaming along Fintype.equivFin σ. For n variables over a finite domain with q elements it reads #zeros * q ≤ d * q ^ n (MvPolynomial.card_filter_eval_eq_zero_mul_card_le). A nonzero polynomial of total degree below |S| does not vanish on all of S ^ σ (MvPolynomial.exists_eval_ne_zero_of_totalDegree_lt_card), a consequence of Mathlib's MvPolynomial.eq_zero_of_eval_zero_at_prod_finset.

Main results #

theorem MvPolynomial.schwartz_zippel_totalDegree_fintype {R : Type u_1} {σ : Type u_2} [CommRing R] [IsDomain R] [DecidableEq R] [Fintype σ] [DecidableEq σ] {p : MvPolynomial σ R} (hp : p ≠ 0) (S : Finset R) :
↑{f ∈ Fintype.piFinset fun (x : σ) => S | (eval f) p = 0}.card / ↑S.card ^ Fintype.card σ ≤ ↑p.totalDegree / ↑S.card

The Schwartz–Zippel lemma for variables indexed by a finite type σ: a nonzero polynomial over an integral domain vanishes on at most a totalDegree / |S| proportion of the points of S ^ σ.

theorem MvPolynomial.card_filter_eval_eq_zero_mul_card_le {R : Type u_1} [CommRing R] [IsDomain R] [Fintype R] [DecidableEq R] {n d : ℕ} {p : MvPolynomial (Fin n) R} (hp : p ≠ 0) (hd : p.totalDegree ≤ d) :
{x : Fin n → R | (eval x) p = 0}.card * Fintype.card R ≤ d * Fintype.card R ^ n

The Schwartz–Zippel lemma over a finite integral domain with q elements, in counting form: a nonzero polynomial in n variables of total degree at most d has at most d * q ^ n / q zeros, stated without division as #zeros * q ≤ d * q ^ n.

theorem MvPolynomial.card_filter_eval_eq_mul_card_le {R : Type u_1} [CommRing R] [IsDomain R] [Fintype R] [DecidableEq R] {n d : ℕ} {p q : MvPolynomial (Fin n) R} (hne : p ≠ q) (hp : ∀ (i : Fin n), degreeOf i p ≤ d) (hq : ∀ (i : Fin n), degreeOf i q ≤ d) :
{x : Fin n → R | (eval x) p = (eval x) q}.card * Fintype.card R ≤ n * d * Fintype.card R ^ n

Two distinct polynomials of individual degree at most d in n variables can agree on at most a fraction n * d / |R| of the evaluation points.

theorem MvPolynomial.exists_eval_ne_zero_of_totalDegree_lt_card {R : Type u_1} {σ : Type u_2} [CommRing R] [IsDomain R] [Finite σ] {p : MvPolynomial σ R} (hp : p ≠ 0) {S : Finset R} (hS : p.totalDegree < S.card) :
∃ (x : σ → R), (∀ (i : σ), x i ∈ S) ∧ (eval x) p ≠ 0

A nonzero polynomial over an integral domain whose total degree is below |S| has a nonzero value at some point of S ^ σ.