Growing an Agent/Prover Interface: Evolutionary Tool Design for Cost-Efficient Theorem Proving in Rocq and Lean

Jules Viennot, Guillaume Baudart, Marc Lelarge

TL;DR

Researchers have developed an evolutionary method to design specialized interfaces that help AI agents interact more efficiently with formal proof assistants like Rocq and Lean. By using a "frontier" model to iteratively propose and test new interface tools, they created ROCQ-MCP-EVOLVE, a server that significantly boosts proof success rates while slashing computational costs and wall-clock time by over 50% across various LLM families.

What Problem Does This Paper Address?

Large Language Models (LLMs) are increasingly used to solve complex mathematics, but their proofs often contain logical errors. To ensure correctness, we use "proof assistants" (like Rocq or Lean) to verify every step. However, the interfaces these agents use to talk to the provers were originally designed for humans.

For a human, a slow, verbose interface is fine; for an AI agent, every extra token and every second of latency translates directly into higher costs and higher failure rates. Current interfaces often force agents to re-compile entire files for every small change, leading to massive inefficiencies. The authors identify a critical gap: we are training sophisticated "drivers" (AI agents) but giving them a "dashboard" (interface) designed for a different species.

Methods

The authors propose an evolutionary design process to "grow" an interface optimized for agents, utilizing the Model Context Protocol (MCP). The process involves two main roles:

  1. The Orchestrator: A high-end frontier model (Claude Fable 5) that manages the evolution. It analyzes logs from previous attempts, proposes "mutations" (new tools, refined error messages, or configuration changes), and implements them.
  2. The Testers: Smaller, faster models (Claude Haiku 4.5 and Sonnet 5) that evaluate the mutated interface on a set of math problems.

A mutation is only kept if it measurably improves accuracy (problems solved), cost, or wall-clock time. This ensures the interface doesn't just get "fancier," but actually more effective.

Figure 2: A step of the evolutionary process. The mutation designed by the orchestrator is denoted by the dark red color. The purple dotted box represents ROCQ-MCP-EVOLVE, the blue dotted box represents the evaluation of the mutation. The light gray circle shows the process is iterative: a new step starts at the end of the previous one.

Key technical improvements included moving from a simple compiler wrapper to a live interactive session (reducing Rocq call times from 266ms to 1ms) and adding "Lean-ism hints" to help agents translate their Lean-heavy training data into valid Rocq syntax.

Datasets

The study utilized several benchmarks to ensure the evolved tools weren't overfitted to one type of problem:

  • dev60: A curated set of 60 problems from the Rocq Workbook used for the primary evolution.
  • miniF2F-Rocq: A benchmark of high-school competition problems (AIME, IMO) used for final testing.
  • hard70 & mathcomp35: Specialized sets for testing agent collaboration and library-specific lemma retrieval.
  • Autoform: A new set of five "project-scale" tasks introduced by the authors, requiring agents to build multi-file software projects (e.g., tropical algebra, finite automata) from natural language specs.
  • PutnamBench: Used to test how well the Rocq-evolved tools transferred to the Lean proof assistant.

Key Insights and Ideas

  • Human Intuition Fails for Agents: One of the most common human tools, search (for finding lemmas), was proposed by the orchestrator but provided zero gain in accuracy. Agents used it heavily but didn't get smarter, so it was discarded.
  • Density of Information is King: The most successful mutations were those that increased the "information density" of the feedback. For example, the try tool allowed agents to test eight candidates at once, and "near-miss hints" helped agents correct typos in theorem names without extra round-trips.
  • Cross-Model Synergy: Tools evolved using Claude models also improved the performance of GPT-5.6 Terra, suggesting that the requirements for a good agent/prover interface are somewhat universal across different LLM architectures.
  • Phase-Shifted Success: The evolution happened in two phases: Phase 1 focused on standalone math exercises, while Phase 2 targeted complex project-scale tasks. Interestingly, the tools from Phase 1 were already so robust that the orchestrator couldn't find further improvements in Phase 2, suggesting a "local optimum" for general-purpose proving tools.
Figure 3: Evolution of accuracy, cost, and wall time across both phases. In the left column, the mutations are numbered chronologically and correspond to x-axis labels. Numbers 0 and 15 are not mutations but the starting servers of the phases. Colors indicate the dataset each point was measured on. Each mutation is linked to the version it is compared to. The link of a reverted mutation is dotted, its background is gray and its data point is a cross. The background of a bug fix is hatched gray.

Key Results

The final server, ROCQ-MCP-EVOLVE, outperformed both a minimal baseline and an established human-centric MCP server across all metrics:

  • Accuracy: On the miniF2F-Rocq test split, it improved success rates by at least +30 points compared to the baseline across all tested models.
  • Efficiency: It reduced the number of input tokens by 24% and divided the number of output tokens by four compared to the control.
  • Cost & Speed: For the Claude Sonnet model, cost per solve dropped by 54% and wall-clock time dropped by 64%.
  • Transferability: When ported to Lean, the server (LEAN-MCP-EVOLVE) achieved the best cost and time per solve on the PutnamBench, even though it wasn't specifically evolved for Lean.
Main results on miniF2F-Rocq showing ROCQ-MCP-EVOLVE (solid bars) leading in accuracy, cost, and time.

Limitations and Future Work

While the transfer to Lean was successful in terms of efficiency, the solve rate on Lean remained lower than the current state-of-the-art specialized Lean server (LEAN-LSP-MCP). The authors attribute this to the fact that the tools were evolved specifically for Rocq's quirks.

Future work aims to run the entire evolutionary process natively within the Lean ecosystem to discover Lean-specific features. Additionally, the authors noted that the process is non-deterministic; since it's driven by a frontier LLM, different runs might "grow" different, potentially even better, toolsets.

Summary updated

BibTeX
@misc{viennot2026growing,
  author = {Jules Viennot and Guillaume Baudart and Marc Lelarge},
  title = {{Growing an Agent/Prover Interface: Evolutionary Tool Design for Cost-Efficient Theorem Proving in Rocq and Lean}},
  year = {2026},
  eprint = {2609.39544},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.39544},
}
Figure