A formal proof of the Ramanujan--Nagell theorem in Lean 4

Fuente: arXiv
Saved in:
Bibliographic Details
Main Author: Banwait, Barinder S.
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866913178606108672
author Banwait, Barinder S.
author_facet Banwait, Barinder S.
contents We present a complete formalization, in the Lean interactive theorem prover with the Mathlib library, of the Ramanujan--Nagell theorem: the only integer solutions to the Diophantine equation $x^2 + 7 = 2^n$ are $(n,x) \in \{(3,\pm1),(4,\pm3),(5,\pm5),(7,\pm11),(15,\pm181)\}$. The formalization includes all dependencies, notably the computation of the ring of integers of the quadratic field $\mathbb{Q}(\sqrt{-7})$, its class number, and unit group. We describe the proof strategy, the architecture of the formalization, and the challenges encountered in bridging the gap between textbook proofs and their machine-checked counterparts, with particular attention to the algebraic number theory infrastructure required.
format Preprint
id arxiv_https___arxiv_org_abs_2604_09808
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle A formal proof of the Ramanujan--Nagell theorem in Lean 4
Banwait, Barinder S.
Number Theory
Logic in Computer Science
11D61, 68V20 (primary), 11R04 (secondary)
We present a complete formalization, in the Lean interactive theorem prover with the Mathlib library, of the Ramanujan--Nagell theorem: the only integer solutions to the Diophantine equation $x^2 + 7 = 2^n$ are $(n,x) \in \{(3,\pm1),(4,\pm3),(5,\pm5),(7,\pm11),(15,\pm181)\}$. The formalization includes all dependencies, notably the computation of the ring of integers of the quadratic field $\mathbb{Q}(\sqrt{-7})$, its class number, and unit group. We describe the proof strategy, the architecture of the formalization, and the challenges encountered in bridging the gap between textbook proofs and their machine-checked counterparts, with particular attention to the algebraic number theory infrastructure required.
title A formal proof of the Ramanujan--Nagell theorem in Lean 4
topic Number Theory
Logic in Computer Science
11D61, 68V20 (primary), 11R04 (secondary)
url https://arxiv.org/abs/2604.09808