HN
Today

Fermat's Last Theorem in Lean 4

Anthropic's latest project showcases a complete, machine-checked proof of Fermat's Last Theorem using Lean 4 and AI agents, rigorously verified against its minimal axiomatic foundation. This monumental effort not only formally validates a landmark mathematical achievement but also ignites robust discussions on the capabilities and limitations of AI in formal mathematics, as well as the inherent trustworthiness of proof assistants. It's a deep dive into the intersection of advanced mathematics, AI, and formal verification that captivates the HN crowd.

54
Score
13
Comments
#12
Highest Rank
9h
on Front Page
First Seen
Sep 4, 8:00 PM
Last Seen
Sep 5, 4:00 AM
Rank Over Time
201412151519161616

The Lowdown

Anthropic has released a complete, machine-checked proof of Fermat's Last Theorem implemented in Lean 4. This formidable undertaking builds upon the foundational work of mathematicians like Frey, Serre, Ribet, Wiles, and Taylor-Wiles, showcasing a significant advance in formal verification.

  • The proof is verified to rely exclusively on Lean's three standard axioms: propext, Classical.choice, and Quot.sound, with no informal sorry or additional axiom statements.
  • Its integrity was validated through a comprehensive build process of all 60,475 modules, cross-checked by leanprover/comparator against Mathlib's official statement, and independently verified by nanoda, a Rust-based Lean kernel.
  • The entire proof, consisting of 29,511 theorems and 1,450 definition modules, is navigable offline via static web pages provided in an html/ folder, complete with cross-references and dependency graphs.
  • Reproducing the verification requires substantial computational resources: Linux or macOS, elan, significant memory (up to 300 GB peak), and disk space (over 200 GB), with total verification times extending over 20 hours.
  • Intriguingly, the Lean source code was primarily "produced by AI agents building on human-written open-source Lean, with Lean as the arbiter," designed more for machine checking than human readability.

This project stands as a testament to the power of formal verification and AI in tackling complex mathematical problems, pushing the boundaries of what is possible in machine-assisted proof.

The Gossip

Automated Agents & Abstract Abstraction

Commenters engaged in a spirited debate regarding the role of AI (specifically LLMs) in generating formal proofs. While acknowledging AI's prowess in closing theorems within an existing proof-tree, concerns were raised about its ability to produce modular, reusable code suitable for building mathematical libraries, suggesting that significant human curation is still required to create 'nice' code. The discussion highlighted the tension between proving a result at any cost versus building robust, extensible foundations for future proofs.

Kernel's Credibility & Cryptic Checks

A core philosophical discussion emerged around the trustworthiness of the Lean interpreter's kernel itself. The 'turtles all the way down' problem was invoked, questioning how one can definitively prove the proof assistant's own code is error-free. The consensus clarified that kernels are designed to be 'lean' (small and inspectable) to minimize potential bug surface, and while kernel bugs can exist, the goal is reliability for good-faith users rather than perfect imperviousness, a standard that may evolve with AI integration.

Fermat's Fanciful Funnies

Amidst the deep technical analysis, a thread of humor surfaced, particularly referencing Pierre de Fermat's famous marginal note regarding his 'truly marvelous proof' that his margin was too narrow to contain. Commenters light-heartedly quipped about the modern, lengthy, and machine-checked version being the digital equivalent of that missing proof, contrasting it with Fermat's concise (and elusive) original thought.