Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

GNFS congruence of squares: φ1(γ1)2=φ2(γ2)2\varphi_1(\gamma_1)^2 = \varphi_2(\gamma_2)^2φ1​(γ1​)2=φ2​(γ2​)2 in Z/nZ\mathbb{Z}/n\mathbb{Z}Z/nZ

Proved
GNFS.congruence_of_squares

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

algebraic-number-theoryinteger-factorizationnumber-theory

Let n∈Nn \in \mathbb{N}n∈N, m∈Zm \in \mathbb{Z}m∈Z, and let f1,f2∈Z[x]f_1, f_2 \in \mathbb{Z}[x]f1​,f2​∈Z[x] be irreducible in Z[x]\mathbb{Z}[x]Z[x] with complex roots θ1,θ2\theta_1, \theta_2θ1​,θ2​ and a common root mmm modulo nnn:

n∣f1(m),n∣f2(m).n \mid f_1(m), \qquad n \mid f_2(m).n∣f1​(m),n∣f2​(m).

Let SSS be a finite set of pairs of integers (a,b)(a,b)(a,b), and suppose γ1∈Z[θ1]\gamma_1 \in \mathbb{Z}[\theta_1]γ1​∈Z[θ1​] and γ2∈Z[θ2]\gamma_2 \in \mathbb{Z}[\theta_2]γ2​∈Z[θ2​] satisfy

γ12=∏(a,b)∈S(a−bθ1),γ22=∏(a,b)∈S(a−bθ2).\gamma_1^2 = \prod_{(a,b)\in S} (a - b\theta_1), \qquad \gamma_2^2 = \prod_{(a,b)\in S} (a - b\theta_2).γ12​=(a,b)∈S∏​(a−bθ1​),γ22​=(a,b)∈S∏​(a−bθ2​).

Then

  1. there is a ring homomorphism φ1:Z[θ1]→Z/nZ\varphi_1 : \mathbb{Z}[\theta_1] \to \mathbb{Z}/n\mathbb{Z}φ1​:Z[θ1​]→Z/nZ with φ1(θ1)=m\varphi_1(\theta_1) = mφ1​(θ1​)=m;
  2. there is a ring homomorphism φ2:Z[θ2]→Z/nZ\varphi_2 : \mathbb{Z}[\theta_2] \to \mathbb{Z}/n\mathbb{Z}φ2​:Z[θ2​]→Z/nZ with φ2(θ2)=m\varphi_2(\theta_2) = mφ2​(θ2​)=m;
  3. for all such homomorphisms, φ1(γ1)2=φ2(γ2)2\varphi_1(\gamma_1)^2 = \varphi_2(\gamma_2)^2φ1​(γ1​)2=φ2​(γ2​)2 in Z/nZ\mathbb{Z}/n\mathbb{Z}Z/nZ.

So x=φ1(γ1)x = \varphi_1(\gamma_1)x=φ1​(γ1​) and y=φ2(γ2)y = \varphi_2(\gamma_2)y=φ2​(γ2​) satisfy x2≡y2(modn)x^2 \equiv y^2 \pmod nx2≡y2(modn). This is the congruence of squares produced by the postprocessing step of the general number field sieve.

Formalization Note Z[θj]\mathbb{Z}[\theta_j]Z[θj​] is the subring of C\mathbb{C}C generated by θj\theta_jθj​. The rational side g(x)=x−mg(x) = x - mg(x)=x−m is the case θ2=m\theta_2 = mθ2​=m, where Z[θ2]=Z\mathbb{Z}[\theta_2] = \mathbb{Z}Z[θ2​]=Z.

Preamble
import Mathlib
import Definitions.Def_GNFS_defs
open Polynomial IntermediateField
Formal statement
namespace GNFS
theorem congruence_of_squares (n : ℕ) (m : ℤ) (f₁ f₂ : ℤ[X])
    (hf₁ : Irreducible f₁) (hf₂ : Irreducible f₂) (θ₁ θ₂ : ℂ)
    (hθ₁ : aeval θ₁ f₁ = 0) (hθ₂ : aeval θ₂ f₂ = 0)
    (hm₁ : (n : ℤ) ∣ f₁.eval m) (hm₂ : (n : ℤ) ∣ f₂.eval m)
    (S : Finset (ℤ × ℤ))
    (γ₁ : Algebra.adjoin ℤ ({θ₁} : Set ℂ)) (γ₂ : Algebra.adjoin ℤ ({θ₂} : Set ℂ))
    (hγ₁ : (γ₁ : ℂ) ^ 2 = ∏ p ∈ S, ((p.1 : ℂ) - (p.2 : ℂ) * θ₁))
    (hγ₂ : (γ₂ : ℂ) ^ 2 = ∏ p ∈ S, ((p.1 : ℂ) - (p.2 : ℂ) * θ₂)) :
    (∃ φ₁ : Algebra.adjoin ℤ ({θ₁} : Set ℂ) →+* ZMod n,
        φ₁ ⟨θ₁, Algebra.self_mem_adjoin_singleton ℤ θ₁⟩ = (m : ZMod n)) ∧
      (∃ φ₂ : Algebra.adjoin ℤ ({θ₂} : Set ℂ) →+* ZMod n,
        φ₂ ⟨θ₂, Algebra.self_mem_adjoin_singleton ℤ θ₂⟩ = (m : ZMod n)) ∧
      ∀ (φ₁ : Algebra.adjoin ℤ ({θ₁} : Set ℂ) →+* ZMod n)
        (φ₂ : Algebra.adjoin ℤ ({θ₂} : Set ℂ) →+* ZMod n),
        φ₁ ⟨θ₁, Algebra.self_mem_adjoin_singleton ℤ θ₁⟩ = (m : ZMod n) →
        φ₂ ⟨θ₂, Algebra.self_mem_adjoin_singleton ℤ θ₂⟩ = (m : ZMod n) →
        φ₁ γ₁ ^ 2 = φ₂ γ₂ ^ 2 := 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