TL;DR
MechMath is a novel agentic framework for automated theorem proving that introduces a "Sorrifier-driven" decomposition strategy. By surgically isolating proof errors using Lean’s sorry placeholder, it breaks complex failures into independent, self-contained subgoals, achieving state-of-the-art performance on elite benchmarks like the IMO and Putnam with up to 22x greater efficiency than previous methods.
What Problem Does This Paper Address?
Automated theorem proving (ATP) using Large Language Models (LLMs) faces a "repair dilemma." When an LLM generates a formal proof (e.g., in the Lean programming language) that contains a small error, current systems usually take one of two paths:
- Iterative Repair: They try to fix the error in the same conversation. This leads to "contextual explosion," where the chat history becomes so long and messy that the model loses focus.
- Full Regeneration: They discard the entire proof and start over. This is incredibly wasteful, as it throws away 90% of a proof that might be logically sound just because of a localized syntax or tactical error.
MechMath aims to find a middle ground: preserving the "correct" parts of a proof while isolating and solving the "broken" parts in fresh, clean contexts.
Methods
The core innovation is the Sorrifier, a tool that manages the transition from a failed proof to a set of manageable sub-tasks. The workflow follows these steps:
- Informal-to-Formal Pipeline: A "Reasoner" LLM first writes a natural language proof sketch. A "Prover" LLM then translates this into Lean code.
- The Sorrifier: If the Lean code fails to compile, the Sorrifier surgically identifies the innermost error. It replaces the failing block with a
sorryplaceholder—a Lean keyword that tells the compiler to "ignore this for now and assume it's true." - Subgoal Extraction: Once the proof compiles (with
sorryblocks), the system extracts the exact mathematical state (hypotheses and goal) at eachsorrylocation. - Recursive Resolution: Each extracted subgoal is treated as a new, independent theorem. This allows the model to work in a "clean room" environment without the baggage of the original failed proof.
- Assembly: Once the subgoals are solved, they are plugged back into the original "scaffold" to complete the theorem.
The authors also distinguish between an "Easy" mode (basic pipeline) and a "Hard" mode, which adds a documentation retriever to fix syntax errors and a strategic analyzer to handle high-level logical dead ends.
Datasets
The authors evaluated MechMath on several high-difficulty benchmarks:
- Putnam 2025: 12 problems from the prestigious undergraduate competition.
- IMO 2025: 4 problems from the International Mathematical Olympiad.
- miniF2F: A standard benchmark of 244 high-school-level competition problems.
- ProverBench: A subset of 40 number theory problems.
Key Insights and Ideas
- Surgical Error Isolation: By using
sorry, MechMath treats a proof like a modular program. You don't need to rewrite the whole app just because one function has a bug. - Context is King: Moving a sub-problem to a new context prevents the LLM from being distracted by previous failed attempts, which is a major cause of "hallucinations" in long-form reasoning.
- Wide and Shallow Proof Trees: Analysis showed that MechMath produces proof structures that are "wide" (many independent lemmas) but "shallow" (not many nested dependencies). This makes the proofs easier to parallelize and less prone to cascading logical failures.
- Formal vs. Informal Decomposition: Unlike previous agents that decompose problems based on informal guesses, MechMath decomposes based on actual compiler feedback, ensuring the subgoals are mathematically valid and necessary.
Key Results
MechMath demonstrated exceptional efficiency and accuracy:
- miniF2F: Achieved a 99.2% pass rate, matching the state-of-the-art. However, it required only 512 LLM calls at maximum, compared to the 11,300 calls required by the previous leading system (Hilbert).
- Putnam 2025: Solved 11 out of 12 problems. For most problems, it was significantly faster and cheaper (averaging under $10 per question) than baselines.
- Efficiency: On the IMO 2025 benchmark, MechMath-Hard was roughly 2x faster than the Numina baseline and 4x faster than the Seed baseline.
- Robustness: In ProverBench, MechMath successfully identified 4 problems that were actually erroneous/unprovable in the original dataset—a testament to its rigorous verification loop.
Limitations and Future Work
- Fixed Pipeline: Currently, the agent follows a rigid sequence (Informal -> Formal -> Sorrify). The authors note that an ideal agent should be more adaptive, perhaps skipping the informal stage for trivial problems.
- Recursive Depth: While the system handles nested subgoals, there is a risk of infinite recursion if a model generates a subgoal identical to the parent. The authors implemented a basic termination check, but more sophisticated "loop detection" could be developed.
- Modularization: The authors plan to release the Sorrifier as a standalone component that other researchers can integrate into different ATP architectures.
Summary updated