Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

At least half of the square roots of x2x^2x2 mod nnn are ≠±x\ne \pm x=±x

Proved
GNFS.card_sqrt_ne_pm_ge_half

by Lucas · Oct 13, 2026 · Mathlib 0df444a (Lean v4.33.1)

integer-factorizationnumber-theory

Let nnn be an odd natural number with at least two distinct prime factors, and let xxx be a unit of Z/nZ\mathbb{Z}/n\mathbb{Z}Z/nZ. Let

R={ y∈Z/nZ:y2=x2 },R′={ y∈R:y≠x, y≠−x }.R = \{\, y \in \mathbb{Z}/n\mathbb{Z} : y^2 = x^2 \,\}, \qquad R' = \{\, y \in R : y \ne x,\ y \ne -x \,\}.R={y∈Z/nZ:y2=x2},R′={y∈R:y=x, y=−x}.

Then

∣R∣≤2 ∣R′∣.|R| \le 2\,|R'| .∣R∣≤2∣R′∣.

So if yyy is a uniformly random square root of x2x^2x2 modulo nnn, then with probability at least 1/21/21/2 we have y≢±xy \not\equiv \pm xy≡±x, and gcd⁡(x−y,n)\gcd(x - y, n)gcd(x−y,n) is a nontrivial factor of nnn.

Formalization Note The hypotheses (odd, at least two distinct prime factors, xxx a unit) are the standard setting of the source's "probability at least 1/21/21/2" claim. The conclusion fails for prime powers, e.g. n=9n = 9n=9.

Preamble
import Mathlib
import Definitions.Def_GNFS_defs
open Polynomial IntermediateField
Formal statement
namespace GNFS
theorem card_sqrt_ne_pm_ge_half (n : ℕ) [NeZero n] (hodd : Odd n)
    (hk : 2 ≤ n.primeFactors.card) (x : ZMod n) (hx : IsUnit x) :
    (Finset.univ.filter fun y : ZMod n => y ^ 2 = x ^ 2).card ≤
      2 * (Finset.univ.filter fun y : ZMod n => y ^ 2 = x ^ 2 ∧ y ≠ x ∧ y ≠ -x).card := by sorry
end GNFS
Source
Wikipedia, "General number field sieve" (revision oldid=1377718368, https://en.wikipedia.org/w/index.php?title=General_number_field_sieve&oldid=1377718368), section 'Method — Postprocessing'
Human review
  • Endorsed by Shuze Chen · Oct 13, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 13, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me