arXiv:2602.17016cs.AI2026-02被引 9

M2F可自动将数学教材转化为完整可验证的Lean代码,效率提升数十倍。

M2F: Automated Formalization of Mathematical Literature at Scale

  • 分两阶段自动化处理数学文献:先编译语句块,再修复证明漏洞。
  • 3周内完成479页教材形式化,生成15.4万行代码,证明成功率96%。
  • 适合数学形式化研究者和自动化验证开发者使用。

自动化数学形式化可实现机械验证,但目前仅限于孤立定理和短片段。将其扩展至教材和论文仍面临跨文件依赖、导入解析及项目整体编译等挑战。本文提出M2F(Math-to-Formal),首个面向Lean的端到端、项目级自动化形式化框架。该框架分为两个阶段:声明编译阶段将文档拆分为原子块,通过推断依赖关系排序,并修复声明骨架直至项目编译成功,允许证明中存在占位符;证明修复阶段在固定签名下,利用目标导向的局部编辑填补这些空白。两个阶段均保持验证器在闭环中,仅当工具链反馈确认改进时才提交修改。约三周内,M2F将实分析与凸分析教材(共479页)转化为包含153,853行代码的完整Lean库,所有声明与证明均已形式化。相比强基线模型(FATE-H上80%成功率),本方法达到96%证明成功率。结果表明,大规模自动化数学文献形式化已具备可行性。完整生成代码见https://github.com/optsuite/ReasBook.git。

原文摘要 · Abstract (English)

Automated formalization of mathematics enables mechanical verification but remains limited to isolated theorems and short snippets. Scaling to textbooks and research papers is largely unaddressed, as it requires managing cross-file dependencies, resolving imports, and ensuring that entire projects compile end-to-end. We present M2F (Math-to-Formal), the first agentic framework for end-to-end, project-scale autoformalization in Lean. The framework operates in two stages. The statement compilation stage splits the document into atomic blocks, orders them via inferred dependencies, and repairs declaration skeletons until the project compiles, allowing placeholders in proofs. The proof repair stage closes these holes under fixed signatures using goal-conditioned local edits. Throughout both stages, M2F keeps the verifier in the loop, committing edits only when toolchain feedback confirms improvement. In approximately three weeks, M2F converts long-form mathematical sources into a project-scale Lean library of 153,853 lines from 479 pages textbooks on real analysis and convex analysis, fully formalized as Lean declarations with accompanying proofs. This represents textbook-scale formalization at a pace that would typically require months or years of expert effort. On FATE-H, we achieve $96\%$ proof success (vs.\ $80\%$ for a strong baseline). Together, these results demonstrate that practical, large-scale automated formalization of mathematical literature is within reach. The full generated Lean code from our runs is available at https://github.com/optsuite/ReasBook.git.

形式化自动化Lean数学

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。