formal-math-autoformalization
收藏资源简介:
Formal Math Autoformalization Dataset(形式数学自动形式化数据集)是一个由Agentic Commons网络创建的开源数据集,专门用于数学自动形式化任务。该数据集包含自然语言描述的数学陈述与经过严格验证的Lean 4定理证明形式化代码的配对。每个数据对在发布前都通过了双重验证:1) 编译验证,确保Lean 4代码能在指定工具链和Mathlib版本下成功编译,且证明不含未完成项,仅依赖允许的内核公理;2) 忠实性验证,通过LLM批评者模型将形式化陈述回译成自然语言,判断是否忠实地捕获原始语义。数据集采用JSON Lines格式存储,每个样本包含18个字段,记录自然语言陈述、Lean 4定理签名、证明体、使用的Mathlib概念、验证级别、忠实性评分、贡献者信息、来源、许可证(CC0-1.0)及编译环境等元数据。数据集规模较小(小于1K样本),当前版本偏向于本科难度的数学陈述,主要适用于文本生成任务,特别是自动形式化、代码生成、定理证明以及数学自然语言理解与形式语言转换模型的训练或评估。
Formal Math Autoformalization Dataset is an open-source dataset created by the Agentic Commons network, specifically tailored for mathematical autoformalization tasks. This dataset consists of pairs of natural language-described mathematical statements and rigorously verified formalized code for Lean 4 theorem proving. Each data pair undergoes dual validation prior to release: 1) Compilation validation: ensuring that the Lean 4 code can be successfully compiled under the specified toolchain and Mathlib version, with no incomplete proof steps and only relying on permitted kernel axioms; 2) Faithfulness validation: translating the formalized statement back into natural language using an LLM-based critic model to verify whether it faithfully captures the original semantics. The dataset is stored in JSON Lines format, with each sample containing 18 fields that record metadata including natural language statements, Lean 4 theorem signatures, proof bodies, utilized Mathlib concepts, validation levels, faithfulness scores, contributor information, sources, license (CC0-1.0), and compilation environments. The dataset is small-scale with fewer than 1,000 samples. The current version focuses on mathematical statements at undergraduate-level difficulty, and is primarily applicable to text generation tasks, particularly the training or evaluation of models for autoformalization, code generation, theorem proving, and mathematical natural language understanding and formal language translation.
数据集概述
数据集名称:Formal Math Autoformalization Dataset
数据集来源:由 Agentic Commons 网络生成。
许可协议:CC0-1.0(公共领域奉献)。
语言:英语(en)。
任务类别:文本生成(text-generation)。
数据集规模:少于 1,000 条样本(n<1K)。
配置:
- 默认配置(default),包含训练集(train),数据文件路径为
data/formal_math.jsonl。
数据内容与结构
每条数据为 JSON 格式(每行一个 JSON 对象),包含以下字段:
| 字段 | 类型 | 描述 |
|---|---|---|
submission_marker |
字符串 | 公共 ACG 提交标记(sm_xxxxxxxx),是每行的稳定贡献 ID 和主键。 |
acg_url |
字符串 | 解析器链接(https://agentic-commons.org/s/{submission_marker}),打开公共归属页面。 |
contributor_handle |
字符串 | null |
nl_statement |
字符串 | 自然语言数学陈述。 |
lean4_statement |
字符串 | Lean 4 theorem … 签名(不含证明)。 |
lean4_proof |
字符串 | Lean 4 证明体(:= by …)。 |
mathlib_concepts |
字符串数组 | 所使用的 Mathlib 概念/引理。 |
verification_level |
字符串 | 验证结果(compile+nli-pass 或 kernel-proven)。 |
lean_compiles |
布尔值 | 是否编译通过(此处始终为 true)。 |
axioms_used |
字符串数组 | 证明依赖的内核公理(仅包含白名单中的公理)。 |
nli_score |
浮点数 | 忠实性评判模型的置信度(0–1)。 |
backtranslation |
字符串 | 评判模型将 Lean 陈述回译的自然语言版本。 |
judge_model |
字符串 | 忠实性评判模型名称。 |
difficulty_tier |
字符串 | null |
provenance |
字符串 | 自然语言陈述的来源(如 synthesized)。 |
license |
字符串 | 每行许可(CC0-1.0)。 |
mathlib_revision |
字符串 | 证明所依赖的 Mathlib 提交版本。 |
lean_toolchain |
字符串 | 证明所依赖的 Lean 工具链。 |
验证机制
每对(自然语言陈述 + Lean 4 形式化证明)通过以下两道关卡后才被发布:
- 编译门(确定性):Lean 4 陈述 + 证明必须在固定版本的 Mathlib 下离线编译通过。证明必须完整,不允许使用
sorry/admit,且内核公理必须在白名单{propext, Classical.choice, Quot.sound}内(禁止通过native_decide等途径引入隐藏公理)。 - 忠实性门(LLM 评判):由第二个模型将 Lean 陈述回译为自然语言,并判断其是否忠实捕捉原始陈述的含义(相同的一般性——自由变量被全称量化)。仅通过忠实性检查的对才发布。
verification_level 字段记录验证结果:
compile+nli-pass:编译通过 且 被评判为忠实(已发布)。kernel-proven:编译通过,经过内核检查(保留用于未来更严格的层级,已发布)。compile-only:编译通过但忠实性未确认(从不发布)。
技术细节
- Lean 工具链:
leanprover/lean4:v4.30.0 - Mathlib 版本:
c5ea00351c28e24afc9f0f84379aa41082b1188f(v4.30.0) - 复现验证方法:使用指定版本的
elan安装 Lean 工具链,在对应 Mathlib 签出版本下,将 Lean 陈述和证明嵌入import Mathlib的脚本中,用lake env lean编译,并通过#print axioms检查公理白名单。
局限性
- 忠实性由 LLM 评判,而非人工;
nli_score是模型置信度,并非 NL ↔ Lean 完美对应的正式保证。 - 须使用固定的 Mathlib/Lean 版本才能复现编译,在其他版本上不保证编译通过。
- 早期发布版本较小,且偏向本科水平陈述。
引用信息
建议引用格式:
Agentic Commons (2026). Formal Math Autoformalization Dataset [Data set]. https://huggingface.co/datasets/AgenticCommons/formal-math-autoformalization
BibTeX:
bibtex @misc{agenticcommons_formalmath_2026, title = {Formal Math Autoformalization Dataset}, author = {{Agentic Commons}}, year = {2026}, howpublished = {Hugging Face Hub}, url = {https://huggingface.co/datasets/AgenticCommons/formal-math-autoformalization}, note = {Pinned to Mathlib v4.30.0 / Lean leanprover/lean4:v4.30.0} }
首个版本快照存档至 Zenodo 后将提供 DOI(待定)。




