M2F (Math-to-Formal) is a framework for translating textbook- and paper-level mathematics into Lean projects that pass machine verification at scale.
Figure 1. High-level overview of M2F and its staged formalization process.
M2F addresses a central bottleneck in machine-assisted mathematics: the transition from isolated theorem proving to document-level formalization. The framework decomposes this process into two stages. In Stage 1, informal mathematical statements are translated into Lean declaration skeletons, while structural inconsistencies are detected and repaired. In Stage 2, the statement signatures are fixed, allowing the system to focus on proof completion through iterative, verifier-guided repair. This staged design enhances robustness and interpretability while substantially improving end-to-end compilation and verification rates.
Try Quokka (https://quokka.reaslab.io/), our publicly available automated formalization system. Quokka can automatically transform long-form mathematical literature into compilable Lean 4 projects containing formally verified statements and proofs.
| Item | Value |
|---|---|
| Long-document corpus scale: real analysis, convex analysis | 479 pages |
| Generated Lean project size | 153,853 lines of Lean code |
| Benchmark | FATE-H (100 problems) |
| Fully automatic setting | 96% PSR |
| Light supervision (+31 declaration lemma map) | 97% PSR |
| Stage 2 on matched statements (long-document setting) | 100% PSR |
Figure 2. End-to-end architecture for document-level formalization with M2F.
An end-to-end sample is provided in example/ based on Section 1 (Affine Sets) of Rockafellar's convex analysis. The workflow in this example is:
PDF source -> structured JSON -> Lean formalization.
example/section01.jsonexample/Rockafellar_convex_analysis_section01/section01_part1.lean, example/Rockafellar_convex_analysis_section01/section01_part2.lean, example/Rockafellar_convex_analysis_section01/section01_part3.lean, example/Rockafellar_convex_analysis_section01/section01_part4.leanexample/Rockafellar_convex_analysis_section01/section01.leanoptsuite/ReasBookThis example explicitly starts from PDF parsing output (section01.json) and then performs formalization from JSON to machine-checkable Lean code.
Table 1. Book-level extraction and formalization summary (long-document setting).
| Item | Value |
|---|---|
| Source domain | Textbook- and paper-level mathematical documents |
| Extraction/formalization pipeline | PDF source -> structured JSON -> Lean formalization |
| Long-document corpus scale | 479 pages |
| Generated Lean project size | 153,853 lines of Lean code |
| Stage 2 on matched statements | 100% PSR |
Figure 4. Pass Success Rate (PSR) comparison across provers on FATE-H.
PDF version
Table 2. M2F summary results on FATE-H and matched-statement settings.
| Condition | PSR |
|---|---|
| Fully automatic | 96% |
| +31 declaration lemma map | 97% |
| Stage 2 (matched statements) | 100% |
Figure 5. Per-problem proof length and verification outcomes on FATE-H.
PDF version
Figure 6. Alignment behavior analysis under the convex setting.
We hope that the package is useful for your application. If you have any bug reports or comments, please feel free to email one of the authors:
@article{wang2026m2f,
title = {M2F: Automated Formalization of Mathematical Literature at Scale},
author = {Zichen Wang and Wanli Ma and Zhenyu Ming and Gong Zhang and Kun Yuan and Zaiwen Wen},
journal = {arXiv preprint arXiv:2602.17016},
year = {2026}
}
This repository is released under the CC BY-NC 4.0 license
(Creative Commons Attribution-NonCommercial 4.0 International).
See the full terms in LICENSE.
Lean
100.0%
M2F (Math-to-Formal) is a framework for translating textbook- and paper-level mathematics into Lean projects that pass machine verification at scale.
Figure 1. High-level overview of M2F and its staged formalization process.
M2F addresses a central bottleneck in machine-assisted mathematics: the transition from isolated theorem proving to document-level formalization. The framework decomposes this process into two stages. In Stage 1, informal mathematical statements are translated into Lean declaration skeletons, while structural inconsistencies are detected and repaired. In Stage 2, the statement signatures are fixed, allowing the system to focus on proof completion through iterative, verifier-guided repair. This staged design enhances robustness and interpretability while substantially improving end-to-end compilation and verification rates.
Try Quokka (https://quokka.reaslab.io/), our publicly available automated formalization system. Quokka can automatically transform long-form mathematical literature into compilable Lean 4 projects containing formally verified statements and proofs.
| Item | Value |
|---|---|
| Long-document corpus scale: real analysis, convex analysis | 479 pages |
| Generated Lean project size | 153,853 lines of Lean code |
| Benchmark | FATE-H (100 problems) |
| Fully automatic setting | 96% PSR |
| Light supervision (+31 declaration lemma map) | 97% PSR |
| Stage 2 on matched statements (long-document setting) | 100% PSR |
Figure 2. End-to-end architecture for document-level formalization with M2F.
An end-to-end sample is provided in example/ based on Section 1 (Affine Sets) of Rockafellar's convex analysis. The workflow in this example is:
PDF source -> structured JSON -> Lean formalization.
example/section01.jsonexample/Rockafellar_convex_analysis_section01/section01_part1.lean, example/Rockafellar_convex_analysis_section01/section01_part2.lean, example/Rockafellar_convex_analysis_section01/section01_part3.lean, example/Rockafellar_convex_analysis_section01/section01_part4.leanexample/Rockafellar_convex_analysis_section01/section01.leanoptsuite/ReasBookThis example explicitly starts from PDF parsing output (section01.json) and then performs formalization from JSON to machine-checkable Lean code.
Table 1. Book-level extraction and formalization summary (long-document setting).
| Item | Value |
|---|---|
| Source domain | Textbook- and paper-level mathematical documents |
| Extraction/formalization pipeline | PDF source -> structured JSON -> Lean formalization |
| Long-document corpus scale | 479 pages |
| Generated Lean project size | 153,853 lines of Lean code |
| Stage 2 on matched statements | 100% PSR |
Figure 4. Pass Success Rate (PSR) comparison across provers on FATE-H.
PDF version
Table 2. M2F summary results on FATE-H and matched-statement settings.
| Condition | PSR |
|---|---|
| Fully automatic | 96% |
| +31 declaration lemma map | 97% |
| Stage 2 (matched statements) | 100% |
Figure 5. Per-problem proof length and verification outcomes on FATE-H.
PDF version
Figure 6. Alignment behavior analysis under the convex setting.
We hope that the package is useful for your application. If you have any bug reports or comments, please feel free to email one of the authors:
@article{wang2026m2f,
title = {M2F: Automated Formalization of Mathematical Literature at Scale},
author = {Zichen Wang and Wanli Ma and Zhenyu Ming and Gong Zhang and Kun Yuan and Zaiwen Wen},
journal = {arXiv preprint arXiv:2602.17016},
year = {2026}
}
This repository is released under the CC BY-NC 4.0 license
(Creative Commons Attribution-NonCommercial 4.0 International).
See the full terms in LICENSE.
Lean
100.0%