MechGeo: Autoformalizing and Proving Euclidean Geometry in Lean 4
Hao Shen, Junyu Guo, Tian Cui, Yuxuan Xiao, Lihong Zhi
cs.AI
Aug 3, 2026 · v1
cs.LO
TL;DR
MechGeo autoformalizes and proves Euclidean geometry problems in Lean 4, with all proofs and counterexamples verified by Lean's kernel.
Abstract
We present MechGeo, a Mathlib native agentic framework that jointly addresses faithful autoformalization and certified proof construction for Euclidean geometry. In this framework, GeoFormalizer represents informal problems in GeoIR, deterministically translates them into Lean 4, and iteratively repairs candidate statements using structural diagnostics and semantic evaluation. GeoProver constructs geometric proof plans, derives intermediate lemmas, and selectively algebraizes suitable subgoals through a library verified in Lean. Singular or SymPy may generate algebraic certificates, but all resulting proofs and counterexamples are checked by Lean's kernel. Experiments across seven LLM backbones show substantial improvements in autoformalization, particularly for models with weaker direct translation performance. On 43 historical IMO geometry problems, GeoFormalizer generates formal statements that GeoProver proves in 29 cases; for the remaining 14, it constructs counterexamples verified in Lean and proves all repaired statements after expert correction. Together with IMO 2026 Problem 2, this yields, to the best of our knowledge, the largest reported collection of automated, kernel-checked Lean proofs for IMO geometry problems. On the 14 geometry statements in LEAP's Lean-IMO-Bench, MechGeo proves 12 for the first time, formally refutes the remaining two, and proves both repaired statements. These results establish counterexample guided diagnosis, geometric reasoning, and certified symbolic computation as a practical foundation for trustworthy formal geometry.
Problem
Faithful autoformalization and certified proof construction for Euclidean geometry problems remain difficult, especially producing kernel-checked formal proofs for competition-level geometry.
Approach
MechGeo is a Mathlib-native agentic framework combining GeoFormalizer, which translates informal problems into a geometric intermediate representation and then deterministically into Lean 4 with iterative repair, and GeoProver, which builds proof plans, derives lemmas, and algebraizes subgoals. External tools like Singular or SymPy may produce algebraic certificates, but all proofs and counterexamples are checked by Lean's kernel. Structural diagnostics and semantic evaluation guide statement repair, and counterexample-guided diagnosis handles incorrect statements.
Results
On 43 historical IMO geometry problems, GeoProver proves 29 and constructs Lean-verified counterexamples for the other 14, proving all repaired statements after expert correction. On the 14 geometry statements in LEAP's Lean-IMO-Bench, MechGeo proves 12, refutes two, and proves both repaired statements, plus IMO 2026 Problem 2.