MerLean: An Agentic Framework for Autoformalization in Quantum Computation
Autoformalization of research-level mathematics into verified Lean 4 code has not been demonstrated at scale for domain-specific fields like quantum computation, and existing methods require significant manual intervention.
MerLean is a fully automated agentic framework that extracts mathematical statements from LaTeX source files, formalizes them into verified Lean 4 code built on Mathlib, and translates the result back into human-readable LaTeX for semantic review. The framework operates bidirectionally: autoformalization (LaTeX to Lean) and autoinformalization (Lean to LaTeX). It uses iterative compilation attempts with compiler feedback to repair formalization errors.
MerLean produces 2,050 Lean declarations from 114 statements across three theoretical quantum computing papers, achieving end-to-end formalization on all three. Average compilation attempts vary by statement type: 11.7 for definitions, 22.4 for theorems, and 11.4 for lemmas. Total formalization time ranges from 5h 42m to 20h 4m per paper.
| Paper | Statements | Lines of Lean | Declarations | Time |
|---|---|---|---|---|
| Balanced Product | 44 | 14,997 | 730 | 20h 4m |
| Fault-Tolerant | - | - | - | - |
