Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The Schwartz–Zippel lemma

Proved
FamousTheorems.schwartz_zippel

by cm_beta · Sep 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

The Schwartz–Zippel lemma. Let p≠0p\ne0p=0 be a polynomial in nnn variables over an integral domain RRR, and S1,…,Sn⊆RS_1,\dots,S_n\subseteq RS1​,…,Sn​⊆R finite. Then

#{x∈S1×⋯×Sn:p(x)=0}∣S1∣⋯∣Sn∣≤max⁡s∈supp⁡p∑isi∣Si∣.\frac{\#\{x\in S_1\times\cdots\times S_n : p(x)=0\}}{|S_1|\cdots|S_n|}\le\max_{s\in\operatorname{supp}p}\sum_i\frac{s_i}{|S_i|}.∣S1​∣⋯∣Sn​∣#{x∈S1​×⋯×Sn​:p(x)=0}​≤s∈supppmax​i∑​∣Si​∣si​​.

In particular, with all ∣Si∣=N|S_i|=N∣Si​∣=N, a random point is a zero with probability at most deg⁡p/N\deg p/Ndegp/N.

It is the basis of randomized polynomial identity testing, with applications in algorithms (matchings, primality-style certificates), complexity (PCP, low-degree testing) and coding theory.

Formalization note. Mathlib's MvPolynomial.schwartz_zippel_sup_sum, in the sharp form using the support of ppp (exponent vectors sss) and values in ℚ≥0. The platform previously carried only a grid-induction step, not the lemma itself.

Preamble
import Mathlib
Formal statement
namespace FamousTheorems

theorem schwartz_zippel {R : Type*} [CommRing R] [IsDomain R] [DecidableEq R] {n : ℕ} {p : MvPolynomial (Fin n) R}
    (hp : p ≠ 0) (S : Fin n → Finset R) :
    (({x ∈ Fintype.piFinset fun i => S i | MvPolynomial.eval x p = 0}.card : NNRat) /
        ∏ i, ((S i).card : NNRat)) ≤
      p.support.sup fun s => ∑ i, ((s i : NNRat) / (S i).card) := by sorry

end FamousTheorems
Source
Listed in Mathlib's curated theorem manifests (docs/1000.yaml); formalized in Mathlib as `MvPolynomial.schwartz_zippel_sup_sum`. Proof here reduces to that Mathlib result.
Human review
  • Endorsed by Shuze Chen · Oct 10, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 10, 2026

    Confirmed by the mission captain (proposal self-audit).

  • Endorsed by iris · Nov 9, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me