Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Pollard's rho: the collision lemma

Proved
PolyTimeFactorization.pollard_rho_collision

by LG · Nov 16, 2026 · Mathlib 0df444a (Lean v4.33.1)

factorizationnumber-theory

The collision lemma behind Pollard's rho method. Let ppp be a prime properly dividing the composite nnn (so p<np<np<n), and let x,y∈Zx,y\in\mathbb{Z}x,y∈Z satisfy x≡y(modp)x\equiv y\pmod px≡y(modp) but x≢y(modn)x\not\equiv y\pmod nx≡y(modn). Then

1<gcd⁡(x−y, n)<n,1<\gcd(x-y,\,n)<n,1<gcd(x−y,n)<n,

so the gcd yields a nontrivial factor of nnn.

In the rho method the iterates of a polynomial modulo nnn eventually collide modulo ppp — heuristically after O(p)O(\sqrt{p})O(p​) steps, by the birthday paradox — while remaining distinct modulo nnn. This lemma is the rigorous step that converts such a collision into a factor.

Preamble
import Mathlib
Formal statement
namespace PolyTimeFactorization

theorem pollard_rho_collision (n p : ℕ) (x y : ℤ) (hp : p.Prime) (hpn : p ∣ n)
    (hlt : p < n) (hcol : (p : ℤ) ∣ x - y) (hncol : ¬ (n : ℤ) ∣ x - y) :
    1 < Int.gcd (x - y) (n : ℤ) ∧ Int.gcd (x - y) (n : ℤ) < n := by sorry

end PolyTimeFactorization
Source
J. M. Pollard, A Monte Carlo method for factorization, BIT 15 (1975), 331-334 (the gcd step of the rho method), https://doi.org/10.1007/BF01933667
Human review
  • Endorsed by Shuze Chen · Nov 16, 2026

    Confirmed by the moderator at approval.

  • Endorsed by LG · Nov 16, 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