Mind · In / Out · In · 文章

费马大定理的形式化

Formalizing Fermat's Last Theorem

Anthropic 研究博客 · 2026-09-05

Claude 用 11 天把费马大定理的证明搬进 Lean:不是新数学,是把核验从几年压到两周。

Indigo 的结论

迄今最大的 AI 数学核验里程碑。它没有推翻「验证省不掉」,而是给它划了边界:领域里有 Lean 这样便宜的机器终审,核验就能从几年压到两周;没有,照旧慢。

怎么读这篇 Anthropic 自家发布,有秀 Claude、推销「形式化就是信任层」、招科研合作的用意。但「存在一份有效的 Lean 版证明」经过 Lean 机器核查和 Buzzard 背书双重确认,是硬事实;「有多快多省、意味着什么」是自家说法,读时分开。

需要记住的几件事

  1. 是形式化,不是新数学:Claude 把 Wiles 已有的证明翻译进 Lean,没有重新证明费马大定理。
  2. 核验能不能提速,要看有没有便宜的机器终审。数学有 Lean,能提速;湿实验、临床、物理没有,照旧慢。
  3. 脚手架是关键:光靠模型会丢进度、停止协作,Prove2Me 的定理依赖图才把它带过终点。
  4. 「形式化是信任层」只在 Lean 覆盖到的数学里成立;前沿数学大半没形式化,经验科学根本没有 Lean。

拆解 · 5 步

  1. 01

    第一份机器核验过的费马大定理证明

    11 天、基本自主、1300 万行 Lean;这个领域的头号专家 Buzzard 背书。Anthropic 自己也说清了:新的是核验,不是数学。 读这一段原文 →

  2. 02

    核验证明,一直是数学的瓶颈

    Wiles 的 129 页证明审了几个月,首次宣讲后被审出致命漏洞,又补了一年;开普勒猜想审了 4 年,12 人评审组只肯说「99% 确定」。 读这一段原文 →

  3. 03

    agent 会丢进度,靠脚手架救回来

    形式化原本要好几年。早期的 agent 很快丢失项目进度、不再协作;换上 Prove2Me 的定理依赖图之后,两周做完。 读这一段原文 →

  4. 04

    形式化是 AI 数学的信任层

    AI 产出的数学会越来越多,人审不过来;他们押的解法是:给人读的证明旁边,附一份机器可核验的版本。 读这一段原文 →

  5. 05

    致谢,和一句坦白:代码远比需要的长

    感谢 Mathlib 社区和前人的理论;附注承认 1300 万行是蛮力的产物,又补了几段数学界一份证明要审好几年的旧账。 读这一段原文 →

对 Rewired Index 意味着什么

「卖验证工具」这条主题的一手证据:Lean 和 Mathlib 生态、Prove2Me 这类协作平台。和 Pachocki 那篇同向,利好评估和形式化验证工具;不过 Lean FRO、Prove2Me 都不是商业公司,没有对应标的。

什么会让我改口

没有机器终审的领域(湿实验、临床、物理判断)也出现同等幅度的核验提速。

怎么读这篇

Anthropic 自家发布,有秀 Claude、推销「形式化就是信任层」、招科研合作的用意。但「存在一份有效的 Lean 版证明」经过 Lean 机器核查和 Buzzard 背书双重确认,是硬事实;「有多快多省、意味着什么」是自家说法,读时分开。

拆解 · 5 步
  1. 第一份机器核验过的费马大定理证明
  2. 核验证明,一直是数学的瓶颈
  3. agent 会丢进度,靠脚手架救回来
  4. 形式化是 AI 数学的信任层
  5. 致谢,和一句坦白:代码远比需要的长
01

第一份机器核验过的费马大定理证明

11 天、基本自主、1300 万行 Lean;这个领域的头号专家 Buzzard 背书。Anthropic 自己也说清了:新的是核验,不是数学。

我们在此公开首个完整的、经由计算机核验的费马大定理证明。Claude 在 11 天里基本自主地用 Lean 编程语言写出了这份证明。下文我们将说明这次形式化是如何完成的,并分享一些关于这项工作对数学研究可能意味着什么的思考。大约在 1637 年,Pierre de Fermat 在自己那本 Diophantus《算术》的页边空白处随手写下了一个断言,它后来成为有史以来最著名的数学猜想之一:不存在正整数 a、b、c,使得 aⁿ + bⁿ = cⁿ 对任何 n > 2 成立。这个后来被称作费马大定理(FLT)的猜想,事实证明极难被证明。第一个证明来自 Sir Andrew Wiles,发表于 1995 年,长达 129 页,光是核验就需要数月的艰苦工作。

十年之后,荷兰计算机科学家 Jan Bergstra 提出把 Wiles 的证明"形式化":把其中的数学推理转换成计算机可以自动核验的形式。此后,数学家们一直在发展编码这样一个复杂证明所需的方法,其中包括 2024 年由伦敦帝国理工学院的 Kevin Buzzard 发起的一项持续多年的社区协作,目标是用 Lean 证明助手完成这一形式化。

最近,Anthropic 研究员 Tianyi Peng——他在哥伦比亚大学的团队专门开发用于 AI 形式化的工具——着手测试 Claude 能否在 FLT 的形式化上取得进展。1 结果远超他的预期。在 11 天里,Claude 基本自主地产出了首个端到端、经计算机核验的 FLT 证明。在这个过程中,它写下了 1300 万行 Lean 代码,证明了 29,500 条中间定理。

我们把最终的证明拿给 Kevin Buzzard 看,他说:

这项非凡的自动形式化成就——Anthropic 的研究人员说只花了 11 天——在不依赖任何假设、只用数学公理的前提下证明了费马大定理。沿途我们看到了代数、调和分析、几何与数论的自动形式化,也认识到 AI 自动形式化的产物如今已足够稳健,可以在其上继续构建;这份证明是多层次的。

自动形式化一个像 FLT 这样复杂的证明,是迈向"全部数学都能被轻易核验"这一未来的重要一步。随着 AI 产出越来越多的证明,轻松形式化的能力可以减轻评估新结果的负担(这个过程可能耗时数年)。我们乐观地认为,信任数学赖以建立的整个知识体系,将会变得更容易,而不是更难。

02

核验证明,一直是数学的瓶颈

Wiles 的 129 页证明审了几个月,首次宣讲后被审出致命漏洞,又补了一年;开普勒猜想审了 4 年,12 人评审组只肯说「99% 确定」。

核验数学证明的挑战

与近期由 AI 推动的黎曼猜想相关工作不同——那项工作产出的是新数学——这里的新意在于核验:像用计算器核对一次数学计算那样去核对一个数学证明。证明数学定理需要搭建复杂的逻辑链条,只要其中一环断裂,其后的一切都可能是错的。要把一个新结果理解到足以确信其正确的深度,可能需要数月甚至数年的工作。

费马大定理正是一个说明性的例子。2 Fermat 把定理的陈述写在一本书的页边,旁边还有一句撩人的注脚:

我发现了一个真正精妙的证明,可惜这里的空白太窄,写不下。

在此后的 350 多年里,一代又一代数学家寻找 FLT 的证明,精妙与否皆可。1908 年,有人宣布悬赏 10 万德国金马克(相当于今天的 100 万至 200 万美元)征求正确的证明,仅第一年就冒出了 621 份错误的尝试。

1993 年 6 月,Wiles 在为期三天的系列讲座中给出了他自认为是 FLT 的第一个正确证明。在数位数学家展开高强度核验两个月后,一位审阅者向 Wiles 提出的一个问题暴露出一处关键缺口。Wiles 花了一年时间试图弥补,先是独自钻研,后来与他从前的学生 Richard Taylor 合作。就在几乎要放弃这个项目时,他终于意识到自己早先弃置的一条思路可以补上这个证明。Wiles 于 1995 年 5 月发表了 FLT 的第一个正确证明;它依赖的现代数学工具,远远超出 1637 年的 Fermat 所可能掌握的范围。既然几个世纪的尝试都没能找到一个初等证明,数学界如今相信,Fermat 自己那个原初的"精妙证明"是错的。

03

agent 会丢进度,靠脚手架救回来

形式化原本要好几年。早期的 agent 很快丢失项目进度、不再协作;换上 Prove2Me 的定理依赖图之后,两周做完。

形式化费马大定理

检查一个证明是否正确,办法之一是让计算机来做。像 Lean 这样的证明助手会用算法核验证明的逻辑,从而无可置疑地确立其正确性。对人来说困难的部分,是把证明改写成 Lean 能理解的样子。写给人读的证明会跳过许多显而易见的步骤,而 Lean 需要看到每一步,无论多么琐碎。人写的证明还建立在几个世纪的既有文献之上,而形式化只能从已经被形式化的那一小部分数学出发。

就 FLT 而言,形式化过程原本预计要花上数年。单是数学界一直用来描述该项目第一阶段的那份蓝图,就有 86 页。

Claude 在 11 天里完成了这个证明,沿途产出了 30,300 条定理的计算机可核验证明(其中 29,500 条用在最终证明里)。数十个 Claude 智能体协同定义概念、证明中间定理,并用这些定理去证明越来越难的命题。以 1300 万行 Lean 代码计,Claude 的这份证明是 Mathlib 体量的 5 倍以上——Mathlib 是这条定理所依托的主要社区数学证明库。3

FLT 形式化的时间进程。

Claude 的证明遵循 Darmon、Diamond 和 Taylor 给出的 Wiles 证明的简化版本。来自人类的数学输入仅限于 Tianyi 偶尔给出的高层指令:"把 Jacobian 作为概形来处理,听起来优先级很高"、"把 Mazur 那条定理往前赶,早点做完"。你可以在这里看到 Claude 思考过程的节选。

Claude 意识到自己刚刚完成了什么时的思考节选。

Claude 最初的一些尝试是失败的:智能体们虽然早期取得了一些进展,但很快就跟丢了项目状态,也不再有效协作。这些失败的努力贡献了最终证明中约 7% 的非样板代码行。

当我们改用 Prove2Me 之后,整件事才成功。Prove2Me 是 Tianyi Peng 与他在哥伦比亚大学的合作者设计的一个开放式数学形式化协作平台。它的帮助体现在:

- 维护一张定理陈述的有向无环图(DAG),智能体据此决定下一步该去证哪些命题。这对缓解记忆衰退、让多个智能体并行工作尤其有用。

- 把定理陈述与证明分置于不同文件、并单独维护两者之间的关联,从而加快 Lean 编译速度、降低资源消耗。

- 为每条定理陈述维护一段自然语言描述,从而支持检索与复用,最终得到更简洁的证明路径。

Claude 用于形式化费马大定理的 Prove2Me 计划中的关键里程碑。三个彩色区块对应 Claude 在通往最终目标途中必须证明的三条核心子定理。这张图与 Wiles 的原始证明高度一致。

借助 Prove2Me 和一套基于 Claude Code 的多智能体框架,一支智能体团队在不到两周内完成了证明,消耗了约 60 亿输出 token,使用的是一个大致相当于 Claude Fable 5.1 的通用内部研究模型。完成的证明由 Lean 核验;它只用到 Lean 的三条标准公理,并且一个比对程序确认,该定理的陈述与 Mathlib 自己对 FLT 的陈述一致。

04

形式化是 AI 数学的信任层

AI 产出的数学会越来越多,人审不过来;他们押的解法是:给人读的证明旁边,附一份机器可核验的版本。

减轻形式化核验的负担

我们产出这份证明的速度表明,如今大面积地形式化数学已经成为可能,这既可能揪出公共数学证明体系中的错误,也能减轻审阅新工作的负担。在审阅了 Claude 的 Lean 证明后,Kevin Buzzard 告诉我们:

如果 FLT 的自动形式化在今天已经可行,那么我们就朝着现代数学文献的自动形式化迈出了一大步。这类自动形式化技术将催生新工具,清除当前数学语料中的错误,减轻审稿人的负担。这些技术还将使我们能够严格核验 LLM 生成的数学,而这在今天通常是一个极其昂贵、由人主导的过程。

形式化也是人类如何建立对 AI 生成数学结果之信心的一个主要因素。随着 AI 以及有 AI 辅助的数学家产出比以往任何时候都多的(所谓的)证明,AI 辅助的形式化能替人类审阅者卸下一部分负担。我们预计,在任何面向人类读者的成稿之外一并产出一份形式化证明,将会变得普遍。尽管我们并不认为形式化证明应当取代人类可读的论述,但它可能是数学界跟上 AI 生成成果的唯一可行方式。

写 Lean 似乎也有助于 Claude 证明新结果。我们近期由 Claude 完成的许多结果,都是在证明的同时并行做形式化的;Claude 似乎会用这些局部证明来独立检验自己的假设,就像它写数值模拟来确认自己方向没走偏一样。

形式化 FLT 是一个 token 消耗巨大的项目,但它同时也是有史以来构建出的最大规模的 Lean 证明。Anthropic 的研究人员做了一个小实验:用三个个人 Claude Max 订阅来形式化 Hardy-Littlewood 圆法的若干应用。智能体们完全通过 Prove2Me 协作,仅用三天就共同完成了 Vinogradov 三素数定理的形式化。我们认为,只要有合适的支撑框架,用消费级 AI 订阅协作形式化重大结果是可以做到的。

为此,Anthropic 以及其他实验室最近扩大了对外部研究者的支持——包括从事纯数学与形式化工作的数学家——提供免费和折扣订阅以及研究额度。我们还为更大型的科学项目设有专项资助,其中可以包括形式化其他重大定理,或改进 Lean 与 Mathlib。

在 AI 迅速改变数学研究面貌的当下,数学家们——无论在 Anthropic 还是在别处——都在琢磨这对他们的工作意味着什么。而形式化是一个我们对 AI 所扮演角色感觉毫无保留地乐观的领域。随着形式化成为一种更寻常的工具,我们乐观地认为,它将有助于维系人们对公共数学知识体系的信任。

05

致谢,和一句坦白:代码远比需要的长

感谢 Mathlib 社区和前人的理论;附注承认 1300 万行是蛮力的产物,又补了几段数学界一份证明要审好几年的旧账。

致谢

我们的形式化工作,只是费马定理漫长历史与形式数学发展进程中的一小块。Andrew Wiles 与 Richard Taylor 共同完成的第一个完整证明,是三百多年数学积累的结晶,融汇了 Gerhard Frey、Jean-Pierre Serre、Ken Ribet、Barry Mazur、Robert Langlands、Jerrold Tunnell、Yutaka Taniyama、Goro Shimura、André Weil 等人的思想。Claude 的证明遵循 Henri Darmon、Fred Diamond 与 Richard Taylor 的论述。

我们的证明借用了 Kevin Buzzard 领导的伦敦帝国理工学院 FLT 项目和 flt-regular 项目的部分内容。Lean 与 Mathlib 都是各自倾注心血的作品,接受过数百位数学家的贡献,其中许多人与 Lean FRO 合作。我们感谢 Kevin Buzzard 审阅这份证明并提出意见。

了解更多

完整证明已发布在 GitHub 上,并附有一份文字版的证明导读。

推荐延伸阅读

- The Proof in the Code 是一本近期出版的书,讲述 Lean 定理证明器的历史与数学形式化。

- 1996 年 BBC 纪录片《Fermat's Last Theorem》采访了 Wiles 和其他参与该证明的数学家,本文的一些作者对它记忆犹新。

- 对有数学背景的读者,命题即类型(propositions-as-types,是 Lean、Rocq、Agda 等证明助手背后的原理)的技术史可参见 Philip Wadler 的 Propositions as Types。

- Chen, S., Marwaha, K., Lu, X., Yuen, H., & Peng, T. (2026). Prove2Me: An open collaborative platform for scaling math formalization. arXiv. https://doi.org/10.48550/arXiv.2608.28433

- Automating Math,Adam Marblestone 著,刊于 Asterisk Magazine。

- 在本科阶段,Peng 的研究导师想把 Peng 论文中的结果写进一篇 Nature 文章。他问 Peng 是否确信那个证明是正确的。Peng 老实回答:"我有 99% 的把握,但对这么长的证明很难有 100% 的确定。"Peng 因此错过了让自己的工作发表在 Nature 上。

- 数学界为核验所困的故事还有很多。其中最著名的之一是 Thomas Hales 在 1998 年给出的开普勒猜想证明,它经历了四年评审,最后一个 12 人审稿小组只肯给出"99% 确定"的结论(Hales 后来领导了一个 20 人的项目 Flyspeck,把该证明形式化)。Grigori Perelman 在 2002 年给出的庞加莱猜想证明,数学界花了大约四年、三份各 300 页的论述才予以接受。Harald Helfgott 在 2013 年给出的弱哥德巴赫猜想证明至今仍在评审中。有时候,最终被证明是错的结果会被接受多年,而其他数学家就在这些有缺陷的地基上继续构筑自己的理论。

- 这部分是因为 Mathlib 简洁且经过充分审阅,而我们的证明很可能比它本来所需的长得多。

判断收口延伸

Indigo 的结论

迄今最大的 AI 数学核验里程碑。它没有推翻「验证省不掉」,而是给它划了边界:领域里有 Lean 这样便宜的机器终审,核验就能从几年压到两周;没有,照旧慢。

需要记住的几件事

  1. 是形式化,不是新数学:Claude 把 Wiles 已有的证明翻译进 Lean,没有重新证明费马大定理。
  2. 核验能不能提速,要看有没有便宜的机器终审。数学有 Lean,能提速;湿实验、临床、物理没有,照旧慢。
  3. 脚手架是关键:光靠模型会丢进度、停止协作,Prove2Me 的定理依赖图才把它带过终点。
  4. 「形式化是信任层」只在 Lean 覆盖到的数学里成立;前沿数学大半没形式化,经验科学根本没有 Lean。

放回主线

证实

可验证域能否泛化 AI 的突破又一次精确落在有便宜机器终审的环节。

补充

验证不可压缩 看着像反例,其实是加固:验证能不能压缩,取决于领域有没有便宜的机器终审。

补充

OpenAI Astra 解决十个开放数学难题 与 Anthropic-Claude 把黎曼 zeta 下界推到 67.2 那两篇是 AI 生成新数学,这篇是 AI 核验已有证明,合起来才是 AI 攻数学的两条腿。

证实

Furong Huang:自我改进的 agent 学会怎么工作 Prove2Me 用定理依赖图解决丢进度:能力在做事方法和脚手架里,不全在模型。

补充

Jakub Pachocki《An Alien Mind》 他说监控和验证是瓶颈;这篇给了数学里的解法:形式化做信任层,但只限有 Lean 的地方。

对 Rewired Index 意味着什么

「卖验证工具」这条主题的一手证据:Lean 和 Mathlib 生态、Prove2Me 这类协作平台。和 Pachocki 那篇同向,利好评估和形式化验证工具;不过 Lean FRO、Prove2Me 都不是商业公司,没有对应标的。

什么会让我改口

没有机器终审的领域(湿实验、临床、物理判断)也出现同等幅度的核验提速。

读完了。Indigo 对这篇的判断在这两处:

Mind · In / Out · In · Essay

Formalizing Fermat's Last Theorem

anthropic.com · 2026-09-05

Claude moved the proof of Fermat's Last Theorem into Lean in 11 days. Not new math: checking a proof went from years to two weeks.

Indigo's conclusion

The biggest AI milestone yet in checking math. It doesn't overturn “verification can't be skipped”; it draws the line: where a field has a cheap machine judge like Lean, checking drops from years to two weeks; where it doesn't, it stays slow.

How to read this Anthropic's own release, meant partly to show off Claude, sell “formalization as the trust layer” and recruit research partners. But “a valid Lean proof exists” is confirmed twice, by Lean's machine check and by Kevin Buzzard, so it is hard fact. How fast, how cheap and what it means are the company's own claims; keep the two apart.

What to remember

  1. Formalization, not new math: Claude translated Wiles's existing proof into Lean; it did not prove Fermat again.
  2. Whether checking speeds up depends on a cheap machine judge. Math has Lean and speeds up; wet labs, clinics and physics don't.
  3. The scaffolding made the difference: the model alone lost track and stopped cooperating; Prove2Me's graph of theorems carried it over the line.
  4. “Formalization as trust layer” holds only for math Lean covers. Most frontier math isn't formalized, and empirical science has no Lean at all.

Breakdown · 5 steps

  1. 01

    The first machine-checked proof of Fermat's Last Theorem

    11 days, largely autonomous, 13 million lines of Lean, endorsed by Buzzard, the field's leading expert. Anthropic says it plainly: what's new is the checking, not the math. Read this part →

  2. 02

    Checking proofs has always been math's bottleneck

    Wiles's 129-page proof took months to review; a fatal gap turned up after his first lecture and took a year to fix. The Kepler conjecture took 4 years, and a 12-person panel would only say “99% certain”. Read this part →

  3. 03

    Agents lost track; the scaffolding saved them

    Formalization was expected to take years. Early agents quickly lost the project's state and stopped cooperating; after switching to Prove2Me's graph of theorems, it was done in two weeks. Read this part →

  4. 04

    Formalization as the trust layer for AI math

    AI will produce more math than people can review. Their bet: next to every proof written for people, attach a version a machine can check. Read this part →

  5. 05

    Thanks, and an admission: the code is far longer than needed

    Thanks to the Mathlib community and earlier theory. A footnote admits the 13 million lines are brute force, and a few paragraphs recall proofs that took mathematicians years to check. Read this part →

What it means for Rewired Index

First-hand evidence for the “sell the verification tools” theme: the Lean and Mathlib ecosystem and collaboration platforms like Prove2Me. It points the same way as Pachocki, favoring evaluation and formal-verification tools; but Lean FRO and Prove2Me are not companies, so there are no names to own.

What would change my mind

fields without a machine judge (wet labs, clinics, physical judgment) see checking speed up by a similar amount.

How to read this

Anthropic's own release, meant partly to show off Claude, sell “formalization as the trust layer” and recruit research partners. But “a valid Lean proof exists” is confirmed twice, by Lean's machine check and by Kevin Buzzard, so it is hard fact. How fast, how cheap and what it means are the company's own claims; keep the two apart.

Breakdown · 5 steps
  1. The first machine-checked proof of Fermat's Last Theorem
  2. Checking proofs has always been math's bottleneck
  3. Agents lost track; the scaffolding saved them
  4. Formalization as the trust layer for AI math
  5. Thanks, and an admission: the code is far longer than needed
01

The first machine-checked proof of Fermat's Last Theorem

11 days, largely autonomous, 13 million lines of Lean, endorsed by Buzzard, the field's leading expert. Anthropic says it plainly: what's new is the checking, not the math.

We are sharing the first complete computer-checked proof of Fermat’s Last Theorem. Claude worked largely autonomously over 11 days to write the proof in the Lean programming language. Below, we describe how the formalization was done and share some thoughts about what this work could mean for research mathematics. Around 1637, Pierre de Fermat jotted down a claim in the margin of his copy of Diophantus’s Arithmetica that would become one of the most famous mathematical conjectures of all time: no positive integers a, b, c satisfy aⁿ + bⁿ = cⁿ for any n > 2. Fermat’s Last Theorem (FLT), as the conjecture became known, turned out to be incredibly difficult to prove. The first proof, from Sir Andrew Wiles in 1995, ran to 129 pages and required months of painstaking work to verify.

A decade later, Dutch computer scientist Jan Bergstra proposed “formalizing” Wiles’s proof: converting the mathematical reasoning into a form computers can check automatically. Since then, mathematicians have been developing the methods needed to encode such a complex proof, including a multi-year community effort kicked off in 2024 by Kevin Buzzard at Imperial College London to complete the formalization using the Lean proof assistant.

Recently, Tianyi Peng, an Anthropic researcher whose group at Columbia University builds tools for AI formalization, set out to test whether Claude could make progress on formalizing FLT.1 The result went further than he expected. In 11 days, working largely autonomously, Claude produced the first end-to-end, computer-checked proof of FLT. Along the way, it wrote 13 million lines of Lean and proved 29,500 intermediate theorems.

We shared the resulting proof with Kevin Buzzard, who said:

This extraordinary autoformalization achievement, which Anthropic researchers say only took 11 days, proves Fermat’s Last Theorem with no assumptions other than the axioms of mathematics. Along the way we see autoformalization of algebra, harmonic analysis, geometry and number theory, and we learn that AI autoformalization artefacts are now robust enough to be built upon; the proof is multi-layered.

Automatically formalizing a proof as complex as FLT is a significant step towards a future in which all of mathematics can be readily checked. As AI produces ever more proofs, the ability to easily formalize work can lighten the burden of evaluating new results (a process that can take years). We are hopeful that it will become easier, not harder, to trust the body of knowledge upon which mathematics is built.

02

Checking proofs has always been math's bottleneck

Wiles's 129-page proof took months to review; a fatal gap turned up after his first lecture and took a year to fix. The Kepler conjecture took 4 years, and a 12-person panel would only say “99% certain”.

The challenge of verifying mathematical proofs

Unlike recent AI-driven work on the Riemann hypothesis, which produced novel mathematics, what’s novel here is the verification—checking a mathematical proof as one would check a mathematical computation with a calculator. Proving math theorems requires assembling complex logical chains, and if a single link is broken, everything that follows it might turn out to be false. Understanding a novel result deeply enough to be confident in its correctness can take months, or even years, of work.

Fermat’s Last Theorem is an illustrative example.2 Fermat wrote down the theorem’s statement in the margin of a book, alongside a tantalizing note:

I have discovered a truly marvelous proof of this, which this margin is too narrow to contain.

For over 350 years, generations of mathematicians searched for a proof of FLT, marvelous or otherwise. In 1908, a prize of 100,000 German gold marks (the equivalent of 1–2 million dollars today) was announced for anyone who could produce a correct proof, and 621 incorrect attempts were produced in the first year alone.

In June 1993, Wiles presented what he believed to be the first correct proof of FLT in a three-day series of lectures. Two months into an intensive verification effort by several mathematicians, a reviewer asked Wiles a question that exposed a critical gap. Wiles spent a year trying to fix it, first alone and then with his former student Richard Taylor. He was on the brink of abandoning the project when he finally realized an approach he’d discarded earlier could fix the proof. Wiles published the first correct proof of FLT in May 1995; it relied on modern mathematical techniques that were far beyond what would have been known to Fermat in 1637. Since an elementary proof has not been found after centuries of trying, the mathematical community now believes Fermat’s own original “marvelous proof” was incorrect.

03

Agents lost track; the scaffolding saved them

Formalization was expected to take years. Early agents quickly lost the project's state and stopped cooperating; after switching to Prove2Me's graph of theorems, it was done in two weeks.

Formalizing Fermat’s Last Theorem

One way to check a proof’s correctness is to ask a computer to do it. Proof assistants like Lean verify the logic of a proof algorithmically, demonstrating its correctness beyond a doubt. The difficult part for humans is rewriting the proof so Lean can understand it. While a proof written for human readers will skip many obvious steps, Lean needs to see every step, no matter how trivial. Human proofs also build on centuries of published work, while a formalization starts from the tiny fraction of math that’s been formalized already.

For FLT, the formalization process was expected to take years. Just the blueprint the mathematical community has been using to describe the initial phase of the project runs to 86 pages.

Claude completed the proof in 11 days, producing computer-verifiable proofs of 30,300 theorems along the way (using 29,500 in the final proof). Dozens of Claude agents collaborated to define concepts, prove intermediate theorems, and use those theorems to prove ever harder statements. At 13 million lines of Lean code, Claude’s proof is over 5x the size of Mathlib, the principal community library of mathematical proofs this theorem builds on.3

Time progression of FLT formalization.

Claude’s proof follows a simplified version of Wiles’s proof from Darmon, Diamond, and Taylor. Mathematical input from humans was limited to occasional high-level instructions from Tianyi: “Jacobian as a scheme sounds high priority,” “push [the] Mazur [theorem] to be done soon.” You can find excerpts of Claude’s thinking here.

Excerpts of Claude’s thinking as it realizes what it has just accomplished.

A number of Claude’s initial attempts failed: while agents had some early success, they quickly lost track of the project’s state and stopped collaborating effectively. Their failed efforts contributed ~7% of the non-boilerplate lines in the final proof.

The effort succeeded when we switched to using Prove2Me, an open collaborative platform for formalizing mathematics designed by Tianyi Peng and his collaborators at Columbia University. Prove2Me helped by:

- Maintaining a directed acyclic graph (DAG) of theorem statements that agents used to decide what proofs they should attempt next. This was particularly helpful for mitigating memory degradation and allowing multiple agents to work in parallel.

- Speeding up Lean compilation and minimizing resource consumption by separating theorem statements and proofs into different files, with the links between them maintained independently.

- Enabling search and reuse by maintaining a natural-language description of each theorem statement, resulting in a simpler proof path.

Key milestones from the Prove2Me plan that Claude used to formalize Fermat’s Last Theorem. The three colored sections correspond to three core sub-theorems that Claude had to prove on the way to its final goal. This graph closely follows Wiles’s original proof.

With Prove2Me and a Claude Code-based multi-agent harness, a team of agents completed the proof in a little under two weeks, consuming about six billion output tokens from a general-purpose internal research model roughly comparable to Claude Fable 5.1. The finished proof was checked by Lean; it uses just Lean’s three standard axioms, and a comparator confirmed that the theorem’s statement matches Mathlib’s own statement of FLT.

04

Formalization as the trust layer for AI math

AI will produce more math than people can review. Their bet: next to every proof written for people, attach a version a machine can check.

Reducing the burden of formal verification

The speed with which we were able to produce this proof demonstrates that it is now possible to formalize large swaths of mathematics, which may both catch errors in the common body of mathematical proofs and reduce the burden of refereeing new work. After reviewing Claude’s Lean proof, Kevin Buzzard told us:

If the automatic formalization of FLT is possible now, then we have taken a big step towards automatic formalization of the modern mathematical literature. Such autoformalization techniques will lead to new tools, rooting out errors in the current mathematical corpus and lightening the load of referees. The techniques will also enable us to rigorously check LLM-generated mathematics, which is currently typically an extremely costly human-led process.

Formalization is also a major factor in how humans can gain confidence in AI-generated mathematical results. As AI and AI-assisted mathematicians produce more (purported) proofs than ever before, AI-assisted formalization takes part of the load off human reviewers. We expect it will become common to produce a formalized proof alongside any write-up intended for a human reader. Although we do not think a formalized proof should replace a human-understandable exposition, it may be the only feasible way for the mathematical community to keep up with AI-generated contributions.

Writing Lean also seems to help Claude prove novel results. Many of our recent Claude-authored results have been formalized in parallel with their proofs, and Claude appears to use these partial proofs to independently check its hypotheses much like it writes numerical simulations to check that it’s on the right track.

Formalizing FLT was a token-intensive project, but it is also the largest Lean proof ever constructed. Anthropic researchers did a small experiment using three personal Claude Max plans to formalize applications of the Hardy-Littlewood Circle Method. Collaborating entirely through Prove2Me, the agents jointly completed a formalization of Vinogradov’s Three Primes Theorem in just three days. We think with the right scaffold, collaborative formalization of major results with consumer AI subscriptions is achievable.

To this end, Anthropic as well as other labs have recently expanded their support for external researchers—including mathematicians working on pure math and formalization—with free and discounted subscriptions and research credits. We also offer dedicated grants for larger scientific projects, which could include formalizing other major theorems or improving Lean or Mathlib.

With AI rapidly changing what it looks like to do math research, mathematicians—at Anthropic and elsewhere—are grappling with what that means for their work. Formalization, however, is a place where we feel unambiguously good about the role of AI. As formalization becomes a more commonplace tool, we are hopeful that it will help maintain trust in the common body of mathematical knowledge.

05

Thanks, and an admission: the code is far longer than needed

Thanks to the Mathlib community and earlier theory. A footnote admits the 13 million lines are brute force, and a few paragraphs recall proofs that took mathematicians years to check.

Acknowledgments

Our formalization effort is a small piece of the long history of Fermat’s theorem and the development of formal mathematics. The first full proof from Andrew Wiles together with Richard Taylor was a culmination of more than 300 years of mathematics, integrating ideas from Gerhard Frey, Jean-Pierre Serre, Ken Ribet, Barry Mazur, Robert Langlands, Jerrold Tunnell, Yutaka Taniyama, Goro Shimura, and André Weil, among others. Claude’s proof follows the exposition by Henri Darmon, Fred Diamond, and Richard Taylor.

Our proof adapts pieces from the Imperial College London FLT project led by Kevin Buzzard and the flt-regular project. Lean and Mathlib are both their own labors of love and have received contributions from hundreds of mathematicians, many working with the Lean FRO. We thank Kevin Buzzard for reviewing the proof and for his comments.

Learn more

The full proof is available on GitHub along with a written walk-through of the proof.

Recommended expository reading

- The Proof in the Code is a recent book about the history of the Lean theorem prover and the formalization of mathematics.

- The 1996 “Fermat’s Last Theorem” BBC documentary has interviews with Wiles and other mathematicians involved in the proof, and is fondly remembered by some authors of this post.

- For those with a mathematical background, a technical history of propositions-as-types (the underlying discipline of proof assistants such as Lean, Rocq, and Agda) can be found in Propositions as Types by Philip Wadler.

- Chen, S., Marwaha, K., Lu, X., Yuen, H., & Peng, T. (2026). Prove2Me: An open collaborative platform for scaling math formalization. arXiv. https://doi.org/10.48550/arXiv.2608.28433

- Automating Math, Adam Marblestone, in Asterisk Magazine.

- During his undergrad, Peng’s research advisor wanted to include results from Peng’s thesis in a Nature article. He asked Peng whether he was sure the proof was correct. Peng’s honest answer was: “I'm 99% sure, but it's hard to be 100% certain about a proof this long.” Peng missed out on getting his work published in Nature.

- There are numerous other stories of the mathematical community struggling with verification. Among the most famous is Thomas Hales’s 1998 proof of the Kepler conjecture, which spent four years in review before a 12-referee panel settled for “99% certain” (Hales eventually led a 20-person project, Flyspeck, that formalized the proof). Grigori Perelman’s 2002 proof of the Poincaré conjecture took the community roughly four years and three 300-page expositions to accept. Harald Helfgott’s 2013 proof of the weak Goldbach conjecture is still under review. Sometimes results that turn out to be wrong are accepted for years, and other mathematicians build their theories on these faulty foundations.

- This is partly because Mathlib is concise and well-reviewed, while our proof is likely much longer than it needs to be.

Where Indigo landsFurther

Indigo's conclusion

The biggest AI milestone yet in checking math. It doesn't overturn “verification can't be skipped”; it draws the line: where a field has a cheap machine judge like Lean, checking drops from years to two weeks; where it doesn't, it stays slow.

What to remember

  1. Formalization, not new math: Claude translated Wiles's existing proof into Lean; it did not prove Fermat again.
  2. Whether checking speeds up depends on a cheap machine judge. Math has Lean and speeds up; wet labs, clinics and physics don't.
  3. The scaffolding made the difference: the model alone lost track and stopped cooperating; Prove2Me's graph of theorems carried it over the line.
  4. “Formalization as trust layer” holds only for math Lean covers. Most frontier math isn't formalized, and empirical science has no Lean at all.

Back on the long-running theses

confirms

Whether verifiable domains generalize Once again AI's leap lands exactly where a cheap machine judge exists.

adds to

Verification can't be compressed It looks like a counterexample but strengthens the view: whether verification compresses depends on a cheap machine judge.

adds to

OpenAI Astra solves ten open math problems; Claude pushes the Riemann zeta bound to 67.2 Those two are AI producing new math; this is AI checking existing proofs. Together they are the two legs of AI's push into math.

confirms

Furong Huang: self-improving agents learn how to work Prove2Me's graph of theorems fixed the lost-state problem: capability lives in methods and scaffolding, not only the model.

adds to

Jakub Pachocki, An Alien Mind He says monitoring and verification are the bottleneck; this gives the answer for math: formalization as trust layer, only where Lean reaches.

What it means for Rewired Index

First-hand evidence for the “sell the verification tools” theme: the Lean and Mathlib ecosystem and collaboration platforms like Prove2Me. It points the same way as Pachocki, favoring evaluation and formal-verification tools; but Lean FRO and Prove2Me are not companies, so there are no names to own.

What would change my mind

fields without a machine judge (wet labs, clinics, physical judgment) see checking speed up by a similar amount.

Finished. Indigo's take on this piece is in two places: