# 自动形式化

**自动形式化**（Autoformalization）是将以自然语言书写的非形式化数学命题转换为计算机可验证的形式化表示的过程，例如转换为 Lean 或 Isabelle/HOL 等证明助手中的陈述与证明。<sup>[1](https://arxiv.org/abs/2505.23486)</sup> 它是自动定理证明中的一项基础任务，自 2022 年以来，主要借助大语言模型（LLM）来推进，这些模型能够将相当一部分数学文本翻译为机器可检查的形式。<sup>[1](https://arxiv.org/abs/2505.23486)</sup><sup> • </sup><sup>[2](https://arxiv.org/abs/2205.12615)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 将自然语言数学自动翻译为形式化规范与证明，其任务类似于软件合成<sup>[2](https://arxiv.org/abs/2205.12615)</sup> |
| 早期 LLM 成果 | LLM 将 25.3% 的数学竞赛题正确翻译为 Isabelle/HOL 形式；在这些形式化定理上训练证明器后，miniF2F 的证明率从 29.6% 提升至 35.2%<sup>[2](https://arxiv.org/abs/2205.12615)</sup> |
| 基准测试 | ProofNet（371 个 Lean 3 本科水平样例）；FormalMATH（5,560 个 Lean 4 问题）；ProofNetVerif（3,752 个标注样例）<sup>[3](https://arxiv.org/abs/2302.12433)</sup><sup> • </sup><sup>[4](https://paperswithlean.com/paper/2505.02735.html)</sup><sup> • </sup><sup>[5](https://aclanthology.org/2025.emnlp-main.907/)</sup> |
| 忠实性差距 | 生成的 Lean 陈述可能通过类型检查，却遗漏假设或表达空洞的命题；在各系统中测得的“编译通过至忠实”差距为 1.3 至 29.5 个百分点<sup>[6](https://arxiv.org/abs/2606.31002)</sup> |
| 在证明器中的作用 | AlphaProof 在数百万个自动形式化问题上训练，与 AlphaGeometry 2 联手在 2024 年国际数学奥林匹克上取得银牌级表现<sup>[7](https://www.nature.com/articles/s41586-025-09833-y)</sup><sup> • </sup><sup>[17](https://deepmind.google/blog/ai-solves-imo-problems-at-silver-medal-level/)</sup> |
| 规模里程碑 | 一个基于 Claude 的系统在 11 天内以 1300 万行 Lean 代码形式化了费马大定理的证明，规模超过 Mathlib 库的五倍<sup>[8](https://www.techradar.com/pro/anthropic-formalizes-fermats-last-theorem-like-never-before-using-claude-but-it-still-took-11-days-to-write-out)</sup> |
| 当前准确率 | 陈述自动形式化在本科数学上准确率最高达 45.1%，但在缺乏适当上下文时难以处理研究级内容<sup>[5](https://aclanthology.org/2025.emnlp-main.907/)</sup> |

## 任务及其困难之处

形式数学以计算机能够通过应用逻辑规则来验证的格式表达定理与证明。Isabelle/HOL、Coq 和 Lean 等交互式定理证明器为编码和检查此类证明提供了环境，但将数学翻译为这些语言需要对数学本身和目标语法都有深入理解，因此即便对专家团队而言，手工形式化长期以来也是劳动密集型工作。<sup>[9](https://proceedings.neurips.cc/paper_files/paper/2024/file/6034a661584af6c28fd97a6f23e56c0a-Paper-Conference.pdf)</sup> 自动形式化旨在使这一翻译过程自动化。<sup>[1](https://arxiv.org/abs/2505.23486)</sup>

该任务分为两部分。陈述自动形式化将自然语言定理翻译为形式化声明；证明自动形式化则翻译非形式证明，或为该陈述生成形式证明。<sup>[5](https://aclanthology.org/2025.emnlp-main.907/)</sup> 陈述翻译是证明搜索之前的第一步，在人类非形式意图与机器可检查语法之间架起桥梁。<sup>[6](https://arxiv.org/abs/2606.31002)</sup>

## 早期大语言模型成果

Google Research 2022 年的论文《使用大语言模型进行自动形式化》观察到，在以下一词元预测为目标、在同时包含自然语言和形式语言的网络语料上训练过的 LLM，能够通过少样本提示将相当一部分（25.3%）数学竞赛题正确翻译为 Isabelle/HOL 中的形式化规范。<sup>[2](https://arxiv.org/abs/2205.12615)</sup> 作者通过在自动形式化的定理上训练神经定理证明器，证明了这一过程的实用性，将 miniF2F 基准上的证明率从 29.6% 提升至 35.2%，为当时的最优水平。<sup>[2](https://arxiv.org/abs/2205.12615)</sup>

基准测试随之而来。2023 年推出的 ProofNet 包含 371 个样例，每个样例均配有 Lean 3 中的形式定理陈述、自然语言定理陈述和自然语言证明，取自实分析与复分析、线性代数、抽象代数和拓扑学的本科教材。<sup>[3](https://arxiv.org/abs/2302.12433)</sup> 2025 年发布的 FormalMATH 将其扩展至 5,560 个经形式验证的 Lean 4 问题，涵盖从高中数学奥林匹克竞赛题到代数、微积分、数论和离散数学的本科定理，采用人在回路的流水线构建，结合了专用自动形式化 LLM、多 LLM 语义验证和基于否定的反证过滤；该流水线在人工验证前保留了 72.09% 的陈述。<sup>[4](https://paperswithlean.com/paper/2505.02735.html)</sup>

## 忠实性问题

一个核心困难在于：证明助手证明的是形式陈述类型正确、且证明确实证明了它，但并不证明该陈述表达了源文本的本意。一个 Lean 声明可能通过类型检查，却遗漏假设、改变定义域或表达空洞的命题。<sup>[6](https://arxiv.org/abs/2606.31002)</sup> 在一项涵盖八个系统、227 个研究生水平陈述的评估中，陈述编译通过与其忠实于原意之间的差距从单次调用的 Gemini-2.5-Pro 的 1.3 个百分点，到工具增强的 GPT-5.2 智能体的 29.5 个百分点不等——后者成功编译了 87.2% 的陈述，但仅在 57.7% 的陈述上被证明是忠实的。<sup>[6](https://arxiv.org/abs/2606.31002)</sup> 一项跨证明器研究发现，确定性的 Lean 4 等价性检查（BEq）仅对 54.0% 通过验证的源到 Lean 的 miniF2F 陈述翻译确认了语义等价，表明仅靠原生类型检查可能大幅高估语义保真度。<sup>[10](https://arxiv.org/abs/2607.19407)</sup>

评估方法也随之发展。洛桑联邦理工学院（EPFL）的奥古斯特·普瓦鲁（Auguste Poiroux）、盖尔·魏斯（Gail Weiss）、维克托·昆查克（Viktor Kunčak）和安托万·博斯吕（Antoine Bosselut） 在 EMNLP 2025 的论文中提出了 BEq+，一种与人类判断高度相关的自动化指标，同时提出了用于评估评估指标的数据集 ProofNetVerif（包含 3,752 个标注样例），以及两个新基准：ProofNet#（ProofNet 的修正版）和 RLM25（包含来自六个形式化项目的 619 对研究级数学陈述）。<sup>[5](https://aclanthology.org/2025.emnlp-main.907/)</sup> ShadowBench 提出了 SA-Pass（语义对齐通过），仅当生成的陈述编译通过、蕴含一组辅助“影子”陈述中的每一个、且被它们的合取所蕴含时，才给予满分；在六种智能体配置的输出上，SA-Pass 与专家判断的二元一致率达到 98.8%。<sup>[11](https://arxiv.org/abs/2608.29270)</sup> 在生产侧，在现有方法之上以自洽性技术扩展类型检查过滤，在 ProofNet 上将准确率最多提升了 18.4 个百分点。<sup>[12](https://arxiv.org/abs/2406.07222)</sup>

## 定理证明系统中的自动形式化

自动形式化的数据已成为形式定理证明器的训练材料。[AlphaProof](https://www.edgepedia.org/zh/alphaproof) 是 DeepMind 受 AlphaZero 启发的智能体，通过在数百万个自动形式化问题上训练，以强化学习学会寻找形式证明；其自动形式化系统基于一个专门的 [Gemini 1.5 Pro](https://www.edgepedia.org/zh/gemini-1-5-pro) 模型，该模型在自然语言问题陈述、形式化思维链和 Lean 形式陈述的三元组上进行了微调。<sup>[7](https://www.nature.com/articles/s41586-025-09833-y)</sup> 在 2024 年[国际数学奥林匹克](https://www.edgepedia.org/zh/international-mathematical-olympiad)上，以 AlphaProof 为核心推理引擎的系统解决了五道非几何题中的三道，与 AlphaGeometry 2 联手共解决六题中的四题，得分 28 分，相当于银牌得主。<sup>[7](https://www.nature.com/articles/s41586-025-09833-y)</sup><sup> • </sup><sup>[17](https://deepmind.google/blog/ai-solves-imo-problems-at-silver-medal-level/)</sup>

证明器模型也会自行生成形式陈述。DeepSeek-Prover-V2 使用 [DeepSeek-V3](https://www.edgepedia.org/zh/deepseek-v3) 作为子目标分解与形式化的统一工具，将定理分解为在 Lean 4 中形式化的证明草图；由此得到的 6710 亿参数模型在 MiniF2F-test 上达到 88.9% 的通过率，并解决了 PutnamBench 中 658 道题中的 49 道。<sup>[13](https://github.com/deepseek-ai/DeepSeek-Prover-V2)</sup> 然而 FormalMATH 评估发现，即使是最强的 LLM 证明器，在其更广泛的基准上、在实际采样预算下也仅达到 16.46% 的成功率，且存在明显的领域偏差和对简单自动化策略的过度依赖。<sup>[4](https://paperswithlean.com/paper/2505.02735.html)</sup>

## 大规模形式化项目

自 2025 年以来，自动形式化智能体已在以往需要专家多年努力的规模上产出了重大数学成果的形式化。

**Gauss。** Math, Inc. 的 Gauss 智能体在 Lean 中完成了强素数定理的形式化——这是 [陶哲轩](https://www.edgepedia.org/zh/terence-tao)（Terence Tao）和[亚历克斯·康托罗维奇](https://www.edgepedia.org/zh/alex-kontorovich)（Alex Kontorovich） 于 2024 年 1 月提出的挑战——历时三周，产出约 25,000 行 Lean 代码，包含 1,000 多个定理和定义；人类专家在 18 个月后仅宣布了中间进展，受困于复分析中的困难，而 Gauss 在此过程中顺带将其形式化了。<sup>[14](https://www.math.inc/gauss)</sup> 作为对比，Lean 的社区数学库 Mathlib 包含约 2,000,000 行代码、350,000 个定理和定义，由 600 多名人类贡献者在八年多的时间里开发而成。<sup>[14](https://www.math.inc/gauss)</sup>

**费马大定理。** 2026 年 9 月，[Anthropic](https://www.edgepedia.org/zh/anthropic) 报告称，一个基于 Claude 的系统在 11 天持续、基本无监督的工作中，产出了 [安德鲁·怀尔斯](https://www.edgepedia.org/zh/andrew-wiles)（Andrew Wiles）1995 年[费马大定理](https://www.edgepedia.org/zh/fermats-last-theorem)证明的完全计算机检查版本。该证明长达 1300 万行 Lean 代码，超过 Mathlib 规模的五倍，智能体证明了大约 30,300 个独立定理，其中 29,500 个用于最终版本；人类输入仅限于偶尔的高层指导。<sup>[8](https://www.techradar.com/pro/anthropic-formalizes-fermats-last-theorem-like-never-before-using-claude-but-it-still-took-11-days-to-write-out)</sup> 伦敦帝国理工学院的数学家 凯文·巴扎德（Kevin Buzzard）将其描述为“除数学公理外不依赖任何假设”地证明了该定理，并指出这些成果如今已足够稳健，可供在此基础上继续构建。<sup>[8](https://www.techradar.com/pro/anthropic-formalizes-fermats-last-theorem-like-never-before-using-claude-but-it-still-took-11-days-to-write-out)</sup>

**Trellis 与教材级流水线。** Trellis 是一个自动形式化系统，其中 LLM 智能体在确定性约束的工作流中工作，它完全自主地交付了强完美图定理及其分解定理的形式化：最终形式化包含近 1,500 个节点（约 1,100 个类定理陈述加上 390 个定义），总计约 530,000 行 Lean 代码，在约六周半的时间内组装完成，除源手稿外无人工干预，且不含任何 `sorry` 占位符。<sup>[15](https://www.math.cmu.edu/~wes/trellis.php)</sup> AutoformBot 是一个多智能体系统，将 26 本开放获取教材翻译为 Atlas——一个经验证的库，包含超过 45,000 个 Lean 4 声明和 50 万行代码，表明大规模自动形式化研究生水平数学的核心内容在经济和技术上都是可行的。<sup>[16](https://arxiv.org/abs/2605.29955)</sup>

## 意义与局限

同一特性也解释了它在更广泛地提升 LLM 生成输出的可验证性方面的作用。<sup>[1](https://arxiv.org/abs/2505.23486)</sup>

局限同样具体。在缺乏适当上下文时，研究级内容的陈述准确率仍然很低，<sup>[5](https://aclanthology.org/2025.emnlp-main.907/)</sup> 对某些系统而言编译通过会大幅高估忠实性，<sup>[6](https://arxiv.org/abs/2606.31002)</sup> 而一个与预期自然语言命题不同的形式化陈述意味着机器检查的证明可能并不证明原始数学。关于语义对齐、等价性检查和基准缺陷的评估研究直接针对这一差距。<sup>[5](https://aclanthology.org/2025.emnlp-main.907/)</sup><sup> • </sup><sup>[10](https://arxiv.org/abs/2607.19407)</sup><sup> • </sup><sup>[11](https://arxiv.org/abs/2608.29270)</sup>

## References

1. [Ke Weng, Lun Du, Sirui Li, Wangyue Lu, Haozhe Sun, Hengyu Liu, Tiancheng Zhang (2025). Autoformalization in the Era of Large Language Models: A Survey. arXiv.](https://arxiv.org/abs/2505.23486)
2. [Autoformalization with Large Language Models (2022). arXiv.](https://arxiv.org/abs/2205.12615)
3. [ProofNet: Autoformalizing and Formally Proving Undergraduate-Level Mathematics (2023). arXiv.](https://arxiv.org/abs/2302.12433)
4. [FormalMATH: Benchmarking Formal Mathematical Reasoning of Large Language Models (2025). Papers With Lean.](https://paperswithlean.com/paper/2505.02735.html)
5. [Auguste Poiroux, Gail Weiss, Viktor Kunčak, Antoine Bosselut (2025). Reliable Evaluation and Benchmarks for Statement Autoformalization. EMNLP 2025.](https://aclanthology.org/2025.emnlp-main.907/)
6. [Ke Zhang and colleagues (2026). Beyond Compilation: Evaluating Faithful Natural-Language-to-Lean Statement Formalization. arXiv.](https://arxiv.org/abs/2606.31002)
7. [Olympiad-level formal mathematical reasoning with reinforcement learning (AlphaProof). Nature.](https://www.nature.com/articles/s41586-025-09833-y)
8. [Anthropic 'formalizes' Fermat's Last Theorem like never before using Claude. TechRadar.](https://www.techradar.com/pro/anthropic-formalizes-fermats-last-theorem-like-never-before-using-claude-but-it-still-took-11-days-to-write-out)
9. [Autoformalizing Mathematical Statements (2024). NeurIPS proceedings.](https://proceedings.neurips.cc/paper_files/paper/2024/file/6034a661584af6c28fd97a6f23e56c0a-Paper-Conference.pdf)
10. [ITPEval: Benchmarking Formal Translation Across Interactive Theorem Provers. arXiv.](https://arxiv.org/abs/2607.19407)
11. [SHADOWBENCH: Toward Reliable Automatic Evaluation of Semantic Alignment in Autoformalization. arXiv.](https://arxiv.org/abs/2608.29270)
12. [Improving Autoformalization using Type Checking. arXiv.](https://arxiv.org/abs/2406.07222)
13. [DeepSeek-Prover-V2. GitHub, deepseek-ai.](https://github.com/deepseek-ai/DeepSeek-Prover-V2)
14. [Introducing Gauss, an agent for autoformalization. Math, Inc.](https://www.math.inc/gauss)
15. [Trellis. Carnegie Mellon University.](https://www.math.cmu.edu/~wes/trellis.php)
16. [Formalizing Mathematics at Scale (AutoformBot). arXiv.](https://arxiv.org/abs/2605.29955)
17. [AI achieves silver-medal standard solving International Mathematical Olympiad problems](https://deepmind.google/blog/ai-solves-imo-problems-at-silver-medal-level/)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 现代人工智能：基础模型、生成式人工智能与人工智能产业 › Foundation-model methods and training › Prompting, reasoning, and agents

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/autoformalization

English original: https://www.edgepedia.org/autoformalization
