Deep Vision: A Formal Proof of Wolstenholmes Theorem in Lean 4

๐Ÿ“… 2026-04-14
๐Ÿ“ˆ Citations: 0
โœจ Influential: 0
๐Ÿ“„ PDF
๐Ÿค– AI Summary
This work presents the first complete formalization of Wolstenholmeโ€™s theorem in Lean 4, establishing that for any prime \( p \geq 5 \), the congruence \( \binom{2p}{p} \equiv 2 \pmod{p^3} \) holds. The proof proceeds by expanding the shifted factorial product up to terms of order \( p^2 \), identifying its quadratic coefficient as the second elementary symmetric polynomial, and demonstrating that this coefficient is divisible by \( p \) using the fact that power sums vanish modulo \( p \). Built entirely on the Mathlib library without any unproven assumptions (i.e., no `sorry`), the formalization comprises nine lemmas and approximately 800 lines of code. It leverages a combination of relational analogy reasoning and human-guided exploration to uncover the critical proof pathway, marking the first fully verified formalization of this classical number-theoretic result in an interactive theorem prover.

Technology Category

Knowledge Representation and Reasoning: Automated Reasoning and Theorem ProvingConstraint Satisfaction and Optimization: Satisfiability Modulo TheoriesMachine Learning: Other Foundations of Machine Learning

Application Category

Systems and Infrastructure for Web, Mobile and WoT: Experiences and lessons learnt from Web-based algorithms and system deploymentsResponsible Web: Data and user privacy-enhancing technologies for the WebWeb Mining and Content Analysis: Web data provenance, reliability, and authenticity
๐Ÿ“ Abstract
We present a formal verification of Wolstenholme's theorem -- $\binom{2p}{p} \equiv 2 \pmod{p^3}$ for prime $p \geq 5$ -- in Lean~4 with Mathlib. The proof proceeds by expanding the shifted factorial product $\prod_{k=1}^{p-1}(p+k)$ to second order in $p$, identifying the quadratic coefficient as the second elementary symmetric product, and showing its divisibility by $p$ via power sum vanishing in $\mathbb{Z}/p\mathbb{Z}$. The formalization comprises nine lemmas across approximately 800 lines of Lean, with zero \texttt{sorry} declarations. To our knowledge, this is the first formal verification of Wolstenholme's theorem in Lean~4. The proof was discovered through a collaboration between a relational analogy engine for theorem proving and human-directed formalization.
Problem

Research questions and friction points this paper is trying to address.

Wolstenholme's theorem
formal verification
Lean 4
binomial coefficient
modular arithmetic
Innovation

Methods, ideas, or system contributions that make the work stand out.

formal verification
Wolstenholme's theorem
Lean 4
symmetric polynomials
relational analogy engine
๐Ÿ”Ž Similar Papers
No similar papers found.