Anthropic's Shorter GRH Proof Separates Checking From Insight

Anthropic shrank its 17M-line Lean proof of GRH to 76K and 300K lines. Why the larger readable edition matters more for mathematicians and AI engineering.

Anthropic's Shorter GRH Proof Separates Checking From Insight
In this essay

Five days after Anthropic researcher Levent Alpöge and Claude stunned mathematicians with a 17-million-line Lean 4 proof of the Generalized Riemann Hypothesis (GRH), Anthropic researcher Luke Sernau, colleagues, and Claude published a rewritten repository that shrinks the proof to roughly 76,000 lines in a compact edition and 300,000 lines in a documented edition. While the 99.5% compression grabbed headlines, the existence of two separate editions exposes a critical lesson for AI-assisted science and software: machine discovery and human comprehension are now distinct engineering phases, and semantic refactoring matters far more than raw brevity.

Why Dead-Code Pruning Could Not Tame 17 Million Lines

When Alpöge released his formalization on November 20, it proved both the classic Riemann Hypothesis—a 167-year-old problem governing the distribution of prime numbers—and GRH for Dirichlet L-functions across 175,187 Lean 4 modules. Lean is an interactive theorem prover whose small, trusted kernel rejects any step that does not follow strictly from foundational logic. Unlike a natural-language paper where a subtle gap can hide in prose, a valid Lean build leaves zero room for hand-waving.

On November 21, the Lean Focused Research Organization and the Mathlib Initiative confirmed that the proof compiled cleanly, matched Mathlib's official RiemannHypothesis definition, and relied solely on Lean's three standard axioms (propext, Classical.choice, and Quot.sound). Independent type-checkers written in other languages—including the Rust kernel nanoda across 1,484,729 declarations, alongside formally verified checkers con-leche and con-ron—accepted the proof without error.

Yet logical certainty arrived without human understanding. Alpöge withheld a prose paper because AI-generated English explanations ballooned past 250,000 pages. Compiling the repository demanded heavy multi-core servers or distributed university clusters, and early community scripts that stripped unused declarations trimmed only about 8% of the codebase. The remaining millions of lines were not dead code; they were sprawling, ad-hoc scaffolding generated during open-ended search.

Semantic Refactoring Changes the Math, Not Just the Syntax

Interlocking anodized aluminum blocks and steel calipers on a concrete workbench representing modular formal verification

Cutting two orders of magnitude in lsernau/grh-lean, released on November 25 under the Apache license, required changing how the proof argues rather than merely formatting Lean tactics. Keeping the five theorem statements in Statements.lean and Main.lean identical to Alpöge's original, Sernau's team used Claude to replace detour-heavy subproofs with cleaner mathematical machinery.

Specifically, the rewrite eliminated a dependency on a weak form of Vandiver's conjecture, simplified an integrality argument, and swapped a convoluted sieve construction for standard Poisson summation. Instead of reinventing background lemmas across tens of thousands of generated files, the refactored codebase leans properly on Mathlib (56a00585) under Lean v4.35.0.

That architectural cleanup changes who can audit the result. What previously required distributed cluster scheduling now builds from scratch in one to two hours on a 12-core workstation with three commands:

lake exe cache get
lake build
lake env lean scripts/PrintAxioms.lean

Pulling precompiled Mathlib artifacts, replaying the proof locally, and running PrintAxioms.lean lets any independent researcher confirm that all five theorems rest exclusively on Lean's three standard axioms, with no hidden sorry placeholders or custom assumptions.

Why the 300,000-Line Edition Beats the 76,000-Line Trophy

The most revealing design choice inside lsernau/grh-lean is that the authors did not stop at their smallest number. Alongside grh-compact/ at roughly 76,000 lines, they shipped grh/, a "readable edition" spanning about 300,000 lines with module documentation and an onboarding roadmap in grh/GUIDE.md. When the Lean community repository (leanprover-community/riemann-hypothesis) selected a new main branch for ongoing collaborative cleanup, it adopted the 300,000-line edition rather than the 76,000-line one.

Once a formal kernel guarantees soundness, optimizing strictly for minimum line count starts to resemble code golf. Compressing proof scripts by inlining intermediate lemmas, stripping explanatory structure, or chaining dense tactics lowers line metrics for benchmarks while raising cognitive load for human readers. Four times more code, when spent on named abstractions and navigable boundaries, buys far more legibility.

Even so, restraint is warranted. Three hundred thousand lines of machine-authored Lean is still the length of several dozen textbooks, not a peer-reviewed journal article. No mathematician has read the proof end to end in natural language yet. In mathematics, knowing a theorem is true is only half the prize; researchers want portable ideas that explain why zeros stay on the critical line and unlock neighboring conjectures across number theory.

Two Loops for AI Engineering: Search First, Refactor Second

For software engineers watching from outside pure mathematics, the five-day arc from 17 million lines to a structured 300,000-line repository previews how verifier-backed AI development actually works. Pairing frontier models with strict automated oracles—whether Lean's kernel, Rust's borrow checker, or deterministic simulation suites—unlocks massive first-pass search. Left to optimize solely for a green check, however, agents accumulate structural debt that simple linters and dead-code eliminators cannot dent.

Turning raw machine solutions into maintainable assets requires a dedicated second loop: semantic refactoring under an invariant test or proof harness. Because the verifier instantly catches regressions, another pass of human-guided AI can aggressively rip out entire subsystems and substitute standard library primitives without risking correctness. Passing the compiler is becoming the cheap half of engineering; the scarce work is reshaping machine-found truth until humans can reason about what comes next.

Sources

  1. github.com
  2. leanprover-community.github.io
  3. github.com
  4. mrubinst.github.io
  5. alpo.ge

AI-assisted · Reviewed by PKN

0

Responses

Loading comments…