TL;DR
This paper introduces a neuro-symbolic framework designed to "autoformalize" Euclidean geometry—translating informal mathematical text and diagrams into machine-verifiable code for the Lean proof assistant. By combining Large Language Models (LLMs) with SMT solvers to handle implicit diagrammatic reasoning, the authors provide a new benchmark (LeanEuclid) and a novel semantic evaluation engine (E3) that moves beyond rigid string-matching to check true logical equivalence.
The Challenge of Autoformalizing Geometry
Autoformalization is often considered the "holy grail" of formal verification: taking a human-written proof and turning it into code that a computer can verify with absolute certainty. However, Euclidean geometry presents two unique hurdles:
- The Diagrammatic Gap: Human geometry proofs are notoriously "leaky." We often skip steps that are obvious from a visual diagram (e.g., "these two circles clearly intersect"), but a formal system like Lean requires every single intersection and spatial relationship to be rigorously proved.
- The Evaluation Bottleneck: Traditional NLP metrics like BLEU or edit distance are useless for mathematics. A formal statement can be syntactically different from the ground truth but logically identical. Conversely, a single character change can render a proof completely invalid.
A Neuro-Symbolic Methodology
To overcome these challenges, the authors propose a neuro-symbolic approach that splits the labor between the "intuition" of language models and the "logic" of formal solvers.
- LeanEuclid & System E: The researchers implemented "System E" (a formalization of Euclid’s Elements) in Lean 4. This system includes custom tactics like
euclid_applyandeuclid_finishto streamline the formalization process. - Symbolic Reasoning Engine: To bridge the diagrammatic gap, they integrated SMT solvers (Z3 and CVC5). When an LLM translates a proof, it only needs to formalize the explicit textual steps. The symbolic engine automatically fills in the "obvious" diagrammatic inferences by checking for satisfiability, effectively offloading the visual reasoning.
- E3 (Euclidean Equivalence Engine): This tool uses SMT solvers to verify if an LLM-generated theorem is logically equivalent to the ground truth. It can also perform "Approximate Equivalence" checking to see how close a failed attempt was to the correct answer, bypassing the limitations of syntactic metrics.
The LeanEuclid Benchmark
The researchers introduce LeanEuclid, a comprehensive benchmark consisting of 173 examples:
- Euclid’s Elements: 48 theorems and proofs from Book I, following the original text as closely as possible.
- UniGeo: 125 problems adapted from an existing geometry dataset, covering triangles, quadrilaterals, and parallel lines.
Each entry in the dataset includes the informal LaTeX text, a diagram, and the corresponding formal Lean code.
Key Insights and Results
The most powerful idea demonstrated is that LLMs shouldn't have to "reason" about every tiny diagrammatic detail. By using a symbolic engine to handle the implicit geometry, the LLM can focus on the high-level translation of the human narrative. Furthermore, the E3 engine proves that semantic evaluation is feasible in restricted domains; many "incorrect" LLM outputs were actually valid alternative formalizations.
Multimodality also plays a crucial role. Geometry is a natural testbed for vision-language models, and providing the model with the diagram yields better results than text alone, as diagrams often contain constraints missing from the text.
- Theorem Autoformalization: In a 5-shot setting, GPT-4 correctly formalized 18.9% of theorems. GPT-4V (with vision) improved this to 21.0%.
- Proof Autoformalization: GPT-4V successfully generated entire proofs out-of-the-box for 23.1% of the benchmark.
- Human-in-the-Loop Potential: While the absolute success rate leaves room for improvement, failed proofs were often very close to correct. The median Levenshtein similarity between autoformalized and manually repaired proofs was over 60%, suggesting these tools could significantly speed up human formalization efforts.
- Evaluation Accuracy: The E3 engine demonstrated a low false-negative rate (~15.8%), making it a highly reliable proxy for human judgment.
Limitations and Future Work
Despite the promising results, the framework has limitations. With only 173 examples, the dataset is currently too small for fine-tuning state-of-the-art models. The authors suggest using synthetic data generation to scale up. Additionally, the symbolic engine relies on SMT solvers, which are not currently "certified" within Lean. This means that while the proof is likely correct, it doesn't yet meet the gold standard of a fully kernel-verified Lean proof. Finally, System E is a proof system rather than a specification language, making theorem statements relatively verbose and increasing the surface area for minor LLM errors.
The code and data for this research are available at GitHub.
Summary updated