陶哲轩转引Hales谈Lean定理证明与AI自动形式化
What mathematicians should know about the Lean Theorem Prover: reliability & AI
这是关于AI辅助数学证明领域最重磅的行业进展汇总,涵盖了Anthropic、OpenAI、Meta等大厂的最新硬核成果,对关注AI for Science和Agent能力的从业者极具参考价值。
What's new
最新动态
Updates on my research and expository papers, discussion of open problems, and other maths-related topics. By Terence Tao
关于我的研究进展和科普文章、开放问题的讨论,以及其他与数学相关的主题。作者:陶哲轩
- Home
- About
- Career advice
- On writing
- Books
- Mastodon+
- Applets
- Subscribe to feed
- 首页
- 关于
- 职业建议
- 写作心得
- 书籍
- Mastodon+
- 小程序
- 订阅源
What mathematicians should know about the Lean Theorem Prover: questions of reliability and AI
数学家应了解的 Lean 定理证明器:可靠性与人工智能问题
9 October, 2026 in math.GM, opinion | Tags: AI, Lean, Thomas Hales | by Terence Tao
2026年10月9日,发布于 math.GM、观点 | 标签:AI, Lean, Thomas Hales | 作者:Terence Tao
[This is a guest post by Thomas Hales. This blog post was initially written in a different file format and converted using AI. — T.]
[本文为 Thomas Hales 的客座文章。此博客帖子最初以其他文件格式编写,并使用 AI 转换而成。——T.]
Mathematicians have been weighing in on what they value about mathematics. For me, what matters is the consistency of math and its unparalleled reliability in support of science and civilization.
数学家们一直在阐述他们认为数学中最重要的价值。对我来说,最重要的是数学的一致性及其在支撑科学与文明方面无与伦比的可靠性。
Formalization of Math
数学的形式化
A formal proof is a mathematical proof that has been exhaustively checked at the level of the foundations of math and the fundamental rules of logic. In theory, this might be done by hand, but because of the number of steps involved, this is generally done by computer, using software that is designed for the task.
形式化证明是一种数学证明,它已在数学基础和基本逻辑规则的层面上被彻底检查过。理论上,这可以手工完成,但由于涉及的步骤众多,通常由计算机使用专为该任务设计的软件来完成。
Examples of theorems that have been formalized include the four-color theorem, the Feit-Thompson (odd-order) theorem, the Kepler conjecture, sphere eversion, the sphere packing problem in 8 and 24 dimensions, Navier-Stokes forced blowup, and Fermat’s Last Theorem. The last three formalization projects have been completed this year and have brought widespread awareness of the potential of formalization.
已被形式化的定理示例包括四色定理、Feit-Thompson(奇阶)定理、开普勒猜想、球面反演、8维和24维的球体堆积问题、Navier-Stokes方程的强制爆破以及费马大定理。最后三个形式化项目已于今年完成,并广泛提升了人们对形式化潜力的认识。
Software systems for formalization are variously called proof assistants, theorem provers, or interactive theorem provers. For the purpose of this post, these terms are used interchangeably. Many proof assistants have been developed over the years: Automath, HOL Light, Isabelle, Coq (renamed Rocq last year), Metamath, Mizar, and Lean. Freek Wiedijk edited a book “The Seventeen Provers of the World” that compares some of these proof assistants, giving a proof of the irrationality of the square root of 2 in each of them. Among mathematicians, the Lean theorem prover is the most popular, and this post will focus on Lean.
用于形式化的软件系统有时被称为证明助手、定理证明器或交互式定理证明器。就本文而言,这些术语可互换使用。多年来已开发出许多证明助手:Automath、HOL Light、Isabelle、Coq(去年更名为 Rocq)、Metamath、Mizar 和 Lean。Freek Wiedijk 编辑了一本书《The Seventeen Provers of the World》,比较了其中一些证明助手,并在每个系统中给出了2的平方根无理性证明。在数学家群体中,Lean 定理证明器最受欢迎,本文将聚焦于 Lean。
Lean was developed and introduced by Leo de Moura in 2013, while at Microsoft. To our great benefit, de Moura persuaded Microsoft to make the software open-source. Kevin Hartnett’s book on the history of Lean, “The Proof in the Code”, states that Jeremy Avigad (the director of Carnegie Mellon’s new NSF institute ICARM) was the first user of Lean. He ran a Lean seminar in 2015 that I attended. In 2017, one of Jeremy’s graduate students, Mario Carneiro, working with Johannes Hölzl, took existing parts of Lean’s core library and started a separate Lean mathematical library, called mathlib. This library of formalized mathematics is now massive, containing nearly 300,000 theorems, over 100,000 definitions, 2.5 million lines of code, with over 700 contributors. Any definition or theorem in mathlib can be used to prove further theorems. For example, if a proof uses the Cauchy-Schwarz inequality, the result can be cited from the library rather than reproving it.
Lean 由 Leo de Moura 于 2013 年在微软期间开发并引入。出于我们的巨大利益,de Moura 说服微软将该软件开源。Kevin Hartnett 所著的关于 Lean 历史的书籍《代码中的证明》(The Proof in the Code)指出,Jeremy Avigad(卡内基梅隆大学新 NSF 研究所 ICARM 的主任)是 Lean 的首位用户。他于 2015 年举办了一期我参加的 Lean 研讨会。2017 年,Jeremy 的一名研究生 Mario Carneiro 与 Johannes Hölzl 合作,利用 Lean 核心库的现有部分,启动了一个独立的 Lean 数学库,名为 mathlib。这个形式化数学库如今规模庞大,包含近 30 万个定理、超过 10 万个定义、250 万行代码,并有超过 700 名贡献者。mathlib 中的任何定义或定理都可用于证明进一步的定理。例如,如果某个证明使用了柯西-施瓦茨不等式(Cauchy-Schwarz inequality),则可以直接引用库中的结果,而无需重新证明。
Autoformalization is a practical reality
自动形式化已成为现实
In the past, researchers had to transcribe paper proofs into formal proofs by human labor. For example, the formal proof of the Kepler conjecture on sphere packings in three dimensions took about 20 human work-years to complete and consists of about 500,000 lines of proof scripts. For years, it has been a dream for many of us working in formalization to find ways to bring increased automation to the process. Autoformalization is the realization of that dream. Autoformalization is the formalization of mathematics by AI. AI reads the paper (say a pdf or tex file) and outputs the formal proof in Lean or some other proof assistant.
过去,研究人员必须通过人工劳动将纸面证明转录为形式化证明。例如,三维球体堆积的开普勒猜想(Kepler conjecture)的形式化证明耗时约 20 个人工年才完成,包含约 50 万行证明脚本。多年来,我们许多从事形式化工作的人一直梦想找到方法为该流程增加自动化程度。自动形式化正是这一梦想的实现。自动形式化是指由人工智能进行数学形式化。AI 读取论文(例如 pdf 或 tex 文件),并输出在 Lean 或其他证明助手中的形式化证明。
Autoformalization has become a practical reality in 2026. Starting in late spring and summer of 2025, researchers were becoming increasingly bullish about autoformalization. Here are some milestones.
自动形式化在 2026 年已成为现实。从 2025 年晚春和夏季开始,研究人员对自动形式化的态度日益乐观。以下是一些里程碑事件。
- Sep 2025, Math Inc. produced a quasi-autoformalization of the prime number theorem. The process was merely “quasi”, because humans had to intervene to give further guidance whenever the AI got stuck.
- Jan 2026, J. Urban posted an arXiv preprint “130k lines of formal topology in two weeks” that gave the autoformalization of large parts of Munkres’s topology textbook in a proof assistant based on set theory.
- Mar 2026. Approximately a week after announcing the completed formalization in 8 dimensions, Math Inc. announced an autoformalization of the sphere-packing problem in 24 dimensions, following the proof by Viazovska and her collaborators. This project generated about 500K SLOC (source lines of code) that golfing (or code pruning) later reduced to about 200K lines.
- May 2026, a group at Meta/Facebook Research autoformalized a large part of 26 mathematical textbooks in a project called ATLAS.
- 2025 年 9 月,Math Inc. 完成了素数定理的准自动形式化。该过程仅是“准”自动的,因为每当 AI 陷入停滞时,都需要人类介入以提供进一步指导。
- 2026 年 1 月,J. Urban 发布了一篇 arXiv 预印本《两周内的 13 万行形式化拓扑学》,其中展示了基于集合论的证明助手中 Munkres 拓扑学教材大部分内容的自动形式化。
- 2026年3月。在宣布完成8维度的形式化工作约一周后,Math Inc. 宣布了基于 Viazovska 及其合作者的证明,对24维球体堆积问题进行的自动形式化。该项目生成了约50万行源代码(SLOC),随后通过代码精简(或称代码修剪)减少至约20万行。
- 2026年5月,Meta/Facebook Research 的一个小组在一个名为 ATLAS 的项目中自动形式化了26本数学教科书的大部分內容。
From there, numerous theorems have been autoformalized. Particularly noteworthy is the autoformalization of Fermat’s Last Theorem, announced by Anthropic on September 4. This project generated 13 million lines of Lean in 11 days. The announcement of Navier-Stokes blowup with forcing on September 8 by OpenAI was accompanied by an autoformalization of the theorem in Lean.
此后,众多定理被自动形式化。特别值得注意的是 Anthropic 于9月4日宣布的费马大定理的自动形式化。该项目在11天内生成了1300万行 Lean 代码。OpenAI 于9月8日宣布带有强制力的 Navier-Stokes 方程爆破解时,也附带了该定理在 Lean 中的自动形式化。
Looking forward, Urban stated in January, “We believe that (auto)formalization may become quite easy and ubiquitous in 2026, regardless of which proof assistant is used.” Autoformalization projects have been completed in various proof assistants using various LLMs, but we focus on Lean. “For [Jesse] Han, it represents even more: the beginning of a revolutionary transformation in mathematics, where extremely large-scale formalizations are commonplace” (IEEE Spectrum). Jared Lichtman announced the launch of MAP (the Mathematics Autoformalization Project) on Sept 8, 2026, which aims to translate “all known math into formal code”. He asks us to imagine the next one trillion lines of code.
展望未来,Urban 在一月表示:“我们相信,无论使用哪种证明助手,(自动)形式化在2026年可能会变得相当简单且无处不在。”自动形式化项目已在各种证明助手中使用各种大语言模型完成,但我们重点关注 Lean。“对于 [Jesse] Han 而言,这代表着更多:它是数学革命性变革的开始,其中超大规模的形式化将成为常态”(IEEE Spectrum)。Jared Lichtman 于2026年9月8日宣布启动 MAP(数学自动形式化项目),旨在将“所有已知数学转化为形式化代码”。他让我们想象接下来的万亿行代码。
Is Lean reliable?
Lean 可靠吗?
Type theory.
类型论。
Lean is based on type theory; in fact, a particular dialect of type theory called CIC, the calculus of inductive constructions. This post is not intended to be a tutorial on type theory, and I will be brief. Russell’s famous paradox in 1901 (the set of all sets that are not an element of themselves….) led to a crisis in the foundations of math. Two solutions were proposed later that decade. (1) Zermelo’s axioms of set theory that disallow the creation of unsafe sets; (2) type theory that makes it a syntax error to create Russell-paradox-like entities. Type theory was introduced by Russell himself in 1903 in his book Principles of Mathematics, and it became part of the foundational system of Russell and Whitehead’s Principia.
Lean 基于类型论;事实上,是基于一种称为 CIC(归纳构造演算)的特定类型论方言。本文并非旨在成为类型论的教程,因此我将简要说明。罗素著名的悖论(即所有不包含自身的集合的集合……)在1901年引发了数学基础的危机。同年稍晚时候提出了两种解决方案。(1)策梅洛的集合论公理,禁止创建不安全的集合;(2)类型论,将创建类似罗素悖论实体的行为设为语法错误。类型论由罗素本人于1903年在《数学原理》一书中引入,并成为罗素和怀特海《数学原理》基础系统的一部分。
For mathematicians who are accustomed to set theory, B. Werner’s paper (1997) “Sets in Types, Types in Sets” gives some reassurance that whatever they have done in set theory can be translated into type theory, and whatever gets done in type theory can be translated back into set theory. More precisely, the paper shows that ZFC set theory can be encoded into CIC, and that a particular dialect of CIC can be encoded back into ZFC (augmented with a hierarchy of inaccessible cardinals).
对于习惯于集合论的数学家而言,B. Werner 的论文(1997)《集合中的类型,类型中的集合》提供了一些安慰:他们在集合论中所做的一切都可以翻译成类型论,而在类型论中完成的一切也可以翻译回集合论。更准确地说,该论文表明 ZFC 集合论可以编码到 CIC 中,并且 CIC 的一种特定方言可以编码回 ZFC(辅以不可达基数层级)。
At the risk of simplifying matters to a ridiculous degree, we might say that “types are like disjoint sets”; each element in type theory “is an element of” exactly one type. The type of the natural number 2 is the natural number type; the type of e, the base of the natural logarithm, is the real number type, and so forth. The type of natural numbers is disjoint from the type of real numbers, and an explicit coercion (sending 2 to 2.0) is constructed from the type of natural numbers to the type of real numbers. When I give talks, I sometimes draw a picture of sets as a Venn diagram with nonempty intersections and a picture of types as bricks stacked against one another without intersection.
冒着将问题简化到荒谬程度的风险,我们或许可以说“类型类似于不相交的集合”;类型论中的每个元素“属于”恰好一个类型。自然数 2 的类型是自然数类型;自然对数底数 e 的类型是实数类型,依此类推。自然数的类型与实数的类型是不相交的,并且从自然数类型到实数类型构建了一个显式的强制转换(将 2 映射为 2.0)。当我进行演讲时,我有时会将集合画成具有非空交集的维恩图,而将类型画成彼此堆叠且无交集的砖块。
Lean’s design
Lean 的设计
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力