fermats-last-theorem README

The project's README from github.com/anthropics/fermats-last-theorem. As one markdown file: README.md.

Fermat's Last Theorem in Lean 4

A complete, machine-checked proof of Fermat's Last Theorem in Lean 4, built on Mathlib (Lean 4.33.1; Mathlib v4.33.0, pinned by commit in lakefile.lean). The argument is that of Frey, Serre, Ribet, Wiles and Taylor-Wiles. PROOF-PATH.md names each step and the Lean theorem that carries it, and the html/ folder presents the whole proof as web pages you can browse offline (see "Reading the proof in a browser" below).

Research artifact. Not maintained and not accepting contributions.

The statement

Theorems/Thm_fermat_last_theorem.lean declares

theorem fermat_last_theorem (n : ℕ) (hn : 3 ≤ n) (a b c : ℕ) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : a ^ n + b ^ n ≠ c ^ n

and the default build target FinalCheck.lean contains

/-- info: 'fermat_last_theorem' depends on axioms: [propext, Classical.choice, Quot.sound] -/
#guard_msgs in
#print axioms fermat_last_theorem

so the build fails unless the proof rests on exactly Lean's three standard axioms (no sorry, no added axiom, no native_decide). FinalCheck.lean also derives Mathlib's own statement, FermatLastTheorem, from this theorem.

How it was verified

No module contains axiom, sorry, native_decide, unsafe, extern, implemented_by, partial def or #eval (Challenge.lean uses sorry by design and is not part of the package).

Together, these checks establish that the statement above follows from the three axioms, given trust in the Lean kernel (or nanoda) and the checking tools. The statement is written with Lean's built-in natural numbers, +, ≤, < and ≠; its one Mathlib ingredient is ^ on ℕ, which Mathlib defines as Lean's built-in exponentiation, and comparator checks that every definition the statement mentions is identical to stock Mathlib's. Nothing else in Mathlib has to be trusted, because the kernel checks everything beneath the statement. What no tool can check is that each intermediate theorem means what its name suggests; that is for the reader to judge, and PROOF-PATH.md names the Lean theorem behind each step and states exactly how strong each named classical result is as proved here.

Reading the proof in a browser

The html/ folder (about 390 MB) presents this repository as static web pages: the route of the proof step by step; a page for each of the 29,511 theorems (the exact Lean statement, what it cites and what cites it, and an expandable dependency graph) and for each of the 1,450 definition modules (the full source and which statements use it); a search box over all theorem and definition names; the landmark theorems as a graph; and README.md, PROOF-PATH.md and ATTRIBUTION.md rendered with cross-links. The folder is part of this repository, so a clone or a ZIP download already contains it (if you obtained html/ as a separate archive, unpack it at the repository root). Open html/index.html in a web browser; everything works offline, with no web server. The pages were machine-tested in a Chromium-based browser only, and html/README-DOCS.md explains what is quoted from the Lean files and what is generated (the English summaries and suggested references are generated automatically; the Lean statement is authoritative).

Check it yourself

git clone <this repository> flt && cd flt
LEAN_NUM_THREADS=96 lake build              # one job per hardware thread by default; lower it to bound memory (about 5 GB per job)
verification/comparator/run.sh              # verdict: last line of .verify-work/wrapper/comparator.log
verification/nanoda/run.sh                  # after the comparator script; verdict: .verify-work/nanoda/run-*/nanoda.stdout

Lean prints a large number of deprecation and style-linter warnings while building. They do not affect the result. The build has succeeded when its output ends with 'flt_mathlib' depends on axioms: [propext, Classical.choice, Quot.sound] and Build completed successfully. Each script fetches and builds its checker at a pinned version and exits 0 on success.

About the sources

FinalCheck.lean is the default target; Theorems/ holds the statements, P2M/Sol/ the proofs (each importing the statements it cites), Definitions/ the definitions, verification/ the two checks, html/ the web pages described above and tools/docs-site/ the program that generated them. The Lean sources were produced by AI agents building on human-written open-source Lean, with Lean as the arbiter, and are written to be checked rather than read: names are machine-generated, labels such as P2M or hexadecimal suffixes are pipeline labels rather than mathematics, and where a name and a statement disagree the statement is what was proved. Comments were removed, apart from upstream notices, doc strings and citations (listed in ATTRIBUTION.md) and the expected-output comment that #guard_msgs checks.

Licence and attribution

Copyright 2026 Anthropic, PBC; released under the Apache License 2.0 (LICENSE). Portions derive from three Apache-2.0 projects credited in NOTICE: the Imperial College London FLT project led by Kevin Buzzard (Frey package, Galois representations, deformation theory, patching and more), flt-regular (Kummer's theorem) and Mathlib. ATTRIBUTION.md lists the 106 files containing material from the first two, with upstream file, copyright holder and authors, and the 23 files that reproduce Mathlib text (the excerpts in Definitions/Def_Compat_Mathlib430.lean and twenty-two modules that re-prove a Mathlib lemma in place). The web pages bundle KaTeX and Graphviz (compiled to WebAssembly) under their own licences, listed in html/assets/vendor/LICENSES.txt. Lean and the packages in lake-manifest.json are fetched at build time, not distributed here. If you recognise unattributed material, the omission is unintentional.

fermats-last-theorem (anthropics/fermats-last-theorem)

Searching Database…

这是什么?一个完整的、经机器校验的费马大定理 Lean 4 证明,基于 Mathlib 构建,遵循 Frey-Serre-Ribet-Wiles-Taylor-Wiles 论证路线,并由两个独立的内核交叉校验。
这是我可以导入的库,还是别的东西?它是一个研究成果:一个冻结的 Lean 证明仓库,不再维护、不接受贡献,用途是被校验和浏览,而不是当作依赖使用。
我实际要怎么阅读或校验这个证明?克隆仓库,在基于 Chromium 的浏览器中打开 html/index.html,无需服务器即可离线浏览全部 29,511 个定理和 1,450 个定义;想自己验证的话,用 Lake 重新构建,然后运行 comparator 和 nanoda 脚本。
自己重新构建并验证需要什么?Linux 或 macOS、elan 工具链管理器(它会依据 lean-toolchain 安装 Lean 4.33.1),以及网络连接,因为 Lake 要从源码编译 Mathlib 以匹配这个确切的工具链。
完整验证过程的开销有多大?非常大:从零构建在 96 个并行任务下耗时 5 小时 32 分,内存峰值 153 GB;comparator 校验耗时约 15 小时,峰值 230 GB;.lake 目录下大约需要 67 GB 磁盘空间,外加最多 220 GB 的临时 C 文件。
我怎么确信这不是平凡或伪造的证明?默认构建目标会失败,除非最终定理恰好只依赖 Lean 的三个标准公理(propext、Classical.choice、Quot.sound),不含 sorry、没有额外公理、也没有 native_decide;另外还有一个名为 comparator 的独立工具,检查被证明的命题与一个仅用 Mathlib 的挑战文件相符。
这个证明是否经过不止一个工具的检查?是的:除了常规的 Lean 内核,一个名为 nanoda 的独立 Rust 内核还重新检查了导出的完整环境——共 1,052,234 个声明——没有发现任何错误。
Lean 代码实际上是谁写的?Lean 源码由 AI 智能体编写,其基础是帝国理工学院 FLT 项目、flt-regular 和 Mathlib 中人类编写的开源 Lean 代码,并以 Lean 本身作为仲裁者;这些代码是为机器校验而写,而不是为人类阅读而写。
html/ 文件夹里有什么?一套约 390 MB 的静态离线网页:逐步覆盖证明的路线,每个定理和定义模块各有一页并附带依赖图,还有搜索框,以及 README.md、PROOF-PATH.md 和 ATTRIBUTION.md 的渲染版本。
Creator
anthropics
Size
227.1 MB
Stars
1.3K
Updated
CommitSep 24
Age
1mo
Commits · 90 Days