Abstract
Machine-assisted theorem proving refers to the process of conducting structured reasoning to automatically generate proofs for mathematical theorems. Recently, there has been a surge of interest in using machine learning models in conjunction with proof assistants to perform this task. In this paper, we introduce Pantograph, a tool that provides a versatile interface to the Lean 4 proof assistant and enables efficient proof search via powerful search algorithms such as Monte Carlo Tree Search. In addition, Pantograph enables high-level reasoning by enabling a more robust handling of Lean 4’s inference steps. We provide an overview of Pantograph’s architecture and features. We also report on an illustrative use case: using machine learning models and proof sketches to prove Lean 4 theorems. Pantograph’s innovative features pave the way for more advanced machine learning models to perform complex proof searches and high-level reasoning, equipping future researchers to design more versatile and powerful theorem provers.
Introduction
While Large Language Models (LLMs) have demonstrated remarkable capabilities in "informal" mathematical reasoning, they frequently struggle with the rigorous requirements of formal proof assistants like Lean 4. A primary bottleneck is the interface: existing tools, such as the Lean 4 Language Server Protocol (LSP), are designed for human interaction. They rely on tracking cursor positions in text files, a paradigm that is cumbersome for automated agents.
Furthermore, automated theorem proving requires exploring numerous possible paths, a process known as proof search. Previous interfaces struggled with metavariable coupling—where solving one sub-goal alters the requirements of another—making it difficult to build high-performing "neural theorem provers." Pantograph addresses these challenges by providing a specialized machine-to-machine interface written entirely in Lean 4.
System Architecture and Features
Pantograph moves away from the text-cursor model toward a state-based kernel interface, removing the bookkeeping overhead that typically slows down AI agents. Key technical features include:
- Independent Goal Management: Pantograph allows an agent to jump between different "goals" (sub-problems) in any order. This is essential for non-linear search algorithms like Monte Carlo Tree Search (MCTS).
- Metavariable Coupling: The system explicitly tracks dependencies between goals. If an agent assigns a value in one branch of a proof, the consequences are correctly propagated to all related branches.
- Advanced Tactic Support: It supports complex Lean tactics such as
have,let,conv, andcalc, enabling high-level reasoning and the definition of intermediate lemmas. - Granular Feedback: Pantograph provides feedback on partially executed tactics, which is vital for Reinforcement Learning agents that require reward signals at every incremental step.
Draft-Sketch-Prove (DSP) Workflow
A significant contribution of Pantograph is its support for the "Draft-Sketch-Prove" (DSP) workflow. LLMs are often better at providing the high-level intuition of a proof than writing every line of formal code perfectly. Pantograph can extract "holes" (marked by the sorry keyword) from a proof sketch. This allows an LLM to outline a proof structure, which can then be filled in by automated "hammer" tactics like Aesop.
Evaluation and Results
The researchers evaluated Pantograph using Mathlib, Lean’s extensive library of formalized mathematics, to demonstrate its ability to extract training data triplets (state, tactic, next-state). For performance benchmarking, they used MiniF2F, a standard set of high-school competition-level math problems.
Using GPT-4o as a "drafter" and the Aesop search tactic as the "hammer," the system achieved a 28.4% success rate on the MiniF2F test set without specialized fine-tuning. The study found that generating multiple proof sketches significantly boosted success rates, suggesting that the primary bottleneck is currently LLM inference time rather than the Lean interface itself. Comparisons with GPT-o1-preview showed that while powerful, its slower inference and lack of support for multiple sketches made it slightly less effective for this specific DSP workflow than GPT-4o.
Conclusion and Future Work
Pantograph bridges the gap between the intuitive reasoning of LLMs and the formal verification of Lean 4. While currently sensitive to Lean 4 internal updates, it provides a foundation for training more specialized machine learning models. Future work will focus on enabling distributed computing for proof branches and developing "gym-like" environments for mathematical reinforcement learning, further advancing the state of automated formal reasoning.
Summary updated