Peano Player: Why Theorem Proving Should Be an Interactive Conversation, Not a Monologue
TL;DR
Peano Player reframes neural theorem proving as a Constrained Markov Decision Process (CMDP), treating tactic failure as a hard cost rather than a minor penalty. By allowing the agent to observe intermediate proof states and learn from per-step errors, the researchers achieved a 4x improvement in solve rates over standard "one-shot" generation methods.
What Problem Does This Paper Address?
Most current Large Language Model (LLM) theorem provers operate in a "bandit" style: the model generates a full proof string, sends it to a verifier (like Lean or Coq), and receives a single binary reward (Success/Failure).
This approach ignores the interactive nature of proof assistants. In a real-world setting, a verifier provides two crucial signals at every step:
- The updated proof state: The new goal the agent must solve.
- Tactic failure: An immediate signal if the chosen move was illegal.
When models generate proofs in one go, they often "hallucinate" steps after an initial error, wasting compute and missing out on the learning signal provided by intermediate failures. The authors argue that theorem proving is naturally a multi-step process where staying within the "constraints" of valid logic is just as important as reaching the goal.
Methods
The authors introduce Peano Player, which treats theorem proving as a CMDP.
- Multi-step MDP: Unlike bandit models that generate a whole sequence, Peano Player observes the current goal string, selects one tactic, and receives the resulting state from the verifier before choosing the next move.
- Cost-Based Constraints: They separate the objective into Reward (1 for closing the proof) and Cost (1 for an invalid tactic).
- Optimization: They use Proximal Policy Optimization (PPO) with a Lagrangian relaxation. Essentially, the agent's objective function is penalized by the cost of failure ($R - \lambda C$). In this study, they fixed $\lambda=1$, making a tactic failure as "bad" as a success is "good."
- Architecture: They compared an encoder-style Transformer (for the multi-step agent) against a decoder-style Transformer (for the bandit baseline) to ensure the comparison was fair regarding parameter counts (~4M parameters each).
Datasets
The researchers used a controlled, synthetic environment based on Peano arithmetic (equational theory involving zero, succ, pred, and add).
- Procedural Generation: Instead of a static dataset, they built a generator that starts with a "normal form" expression and applies expansions to create theorems of varying difficulty ($d=1$ to $d=8$).
- Provability by Construction: Because the system is confluent and terminating, every generated theorem is guaranteed to be provable, allowing for an infinite stream of training data without needing expensive human-annotated proofs.
- Lean Validation: To ensure the synthetic environment was realistic, they validated 200 generated theorem-proof pairs using the Lean 4 compiler.
Key Insights and Ideas
- Observation is the "Learning Gap": The bandit models have enough information in theory to "calculate" the next state in their heads, but they fail to do so in practice. Providing the verifier's state explicitly closes a massive "learning-effectiveness gap."
- Failure vs. Progress: The CMDP formulation allows the agent to distinguish between two types of "zero reward" outcomes: an invalid action (tactic failure) and insufficient progress (valid tactics that didn't finish the proof). This distinction provides a much denser training signal.
- Synergy of State and Cost: An ablation study showed that seeing the state and penalizing failure both help independently, but their combination is synergistic, leading to exponential gains in harder problems.
Key Results
- Overall Performance: Peano Player achieved a 92.9% solve rate, compared to just 21.0% for the standard bandit baseline.
- Scaling with Difficulty: At the highest difficulty level ($d=8$), Peano Player was 10 times more successful than the bandit methods.
- Failure Reduction: Peano Player’s tactic failure rate dropped to 1.46%, while bandit models hovered around 23%. This shows the agent effectively learned the "rules of the game" (the constraints) while pursuing the goal.
- Convergence: Multi-step agents converged significantly faster than bandit-style agents during training.
Limitations and Future Work
- Synthetic Simplicity: The environment uses only four rewrite rules. Real-world proof assistants like Lean have a massive, non-finite action space where tactics take complex arguments (e.g., specific theorem names or variable hypotheses).
- Search Strategy: The current environment is "confluent," meaning there are many paths to the solution and fewer "dead ends." In higher-level mathematics, search-level strategy (deciding which branch of a proof to follow) is much more difficult.
- Scaling to Lean: The authors suggest that the next step is applying this CMDP framework to Lean's
Mathlib. This would require handling multi-token tactic strings and using "truncated" library proofs to create intermediate training states. - Adaptive Constraints: Future work could use adaptive Lagrangian multipliers (like RCPO) to dynamically balance the reward for winning vs. the cost of failing.
Summary updated