~/satyajit

Leanstral: proving theorems by being a code agent, not a prover

mdjsonmcp

2026-07-03 · 8 min · llm · agents · reinforcement-learning · formal-methods · explainer

Formal theorem proving is the rare corner of ML where correctness is not a vibe: a proof either type-checks against Lean's kernel or it doesn't. The catch is that the strongest Lean systems tend to win with machinery around the model — Seed-Prover runs conjecture proposing and lemma pools at a budget of ~10 H20-days per problem; Goedel-Architect generates a blueprint and proves lemmas in parallel. Powerful, but none of it is the interface a person actually uses to write Lean.

Mistral's Leanstral 1.5 makes the opposite bet. It's a 119B-parameter Mixture-of-Experts that activates just 6B per token, and it proves theorems by doing exactly what a developer does in Mistral Vibe: edit files, run shell commands, and query the Lean language server for goals, types, and errors — then revise, and keep going. No prover scaffold. Its test-time scaling is nothing more exotic than running that loop longer. And it works: it saturates miniF2F (100% on validation and test), solves 587/672 PutnamBench, and sets a new open state-of-the-art of 87 on FATE-H and 34 on FATE-X — while being Apache-2.0.

The loop is the whole method

There's no separate "prover mode." A theorem — or a repository with a missing proof — enters the same agent harness used for ordinary software engineering, and the model works it turn by turn:

the code-agent loop · think → act → read feedback → revise
doesn't compile yet → revise & keep goingprompt1/6think2/6tool3/6feedback4/6revise5/6verify6/6one turn of Mistral Vibe →
1/6 · system + user
the task enters the loop

A theorem statement (or a repo with a missing proof) arrives in the same harness used for ordinary software work: “You are Mistral Vibe. Tools: bash, lean-lsp-mcp.” No prover-specific interface.

-- prove: ∀ n, 0 ≤ n → n < n + 1

The point: this is the same loop a human uses in Mistral Vibe, and the same loop the model was trained in. Test-time scaling is just running it longer — no conjecture pool, no parallel prover orchestration, no blueprint stage.

Mistral's own diagram of the loop shows the same thing at the token level: the system prompt hands the model lean-lsp-mcp tools, and from there it's assistant turns interleaving <think>, tool calls, and tool results — the agent editing a Lean file and checking it exactly as it would edit and test any other codebase, through Vibe's raw filesystem / bash / MCP surface.

Diagram of the Leanstral code-agent loop: a system+user prompt grants lean-lsp-mcp tools; assistant turns alternate think blocks, tool calls (lean-toolchain, lakefile.toml, Main.lean) and tool results; later turns query Mathlib via MCP and write/verify through the Lean LSP; a panel shows Vibe connecting to raw filesystem, raw bash, and arbitrary MCP servers.
Leanstral works Lean through the ordinary Mistral Vibe code-agent interface — edit files, run bash, query the Lean language server over MCP — the same loop used for general software engineering (Mistral, Leanstral 1.5).

Why insist on the ordinary loop? Two reasons. It makes the model usable — you point it at a Lean repo the way you'd point a coding assistant at any repo — and, more importantly, it means the model is trained in the same long-horizon interaction pattern it uses at inference. There's no train/test interface gap to paper over.

Test-time scaling, without a trick

Because the model just spends tokens inside that loop, its accuracy is a smooth function of the per-attempt token budget. This is the headline result, and it's worth playing with — drag the budget and watch PutnamBench solved climb:

PutnamBench test-time scaling · more tokens → more proofs
per-attempt token budget
4M
PutnamBench solved (Pass@8)
587/672 87%
0%25%50%75%100%25k50k100k200k500k1M2M4M587token limit per attempt →

No plateau tricks, no bespoke scaffold — the curve climbs monotonically because Leanstral just keeps working the proof. That is the whole claim: compute spent inside the ordinary loop converts directly into solved theorems. At the far right, ~$4 of tokens per problem edges Seed-Prover 1.5's high setting (which budgets ~10 H20-days, ~$300+ per problem).

That monotonic climb — 44 solved at 50k tokens, 244 at 200k, 493 at 1M, 587 at 4M — is Leanstral's whole argument in one curve. Rather than giving up when a proof runs long, it keeps reasoning, editing, and compacting context, turning budget directly into solved theorems. Here's Mistral's version of the same figure:

Line chart titled PutnamBench Test-Time Scaling: Pass@8 solved percentage rises smoothly and monotonically as the per-attempt token limit increases from 25k to 4M, annotated with problem counts 44, 126, 244, 396, 493, 573, 587.
Pass@8 on PutnamBench (672 problems) versus per-attempt token budget — performance climbs smoothly from 44 solved at 50k tokens to 587 at 4M, with no plateau trick (Mistral, Leanstral 1.5).

The economics are the striking part. On PutnamBench, Leanstral edges Seed-Prover 1.5's high setting by 7 problems (587 vs 580) at roughly 4perproblemagainstanestimated4 per problem** against an estimated **300+ for Seed-Prover, whose high setting budgets ~10 H20-days per problem. The only systems above it run under different rules — natural-language proof guidance, or a much larger cost like Aleph Prover at $54–68 per problem.

Why you can't fake a proof

Turning compiler feedback into an RL reward is dangerous: if the objective is just "make Lean stop complaining," the cheapest policies are to cheat — leave a sorry, call the unsound native_decide, assume an extra axiom, or loosen the checker with set_option. Leanstral is graded by a fork of SafeVerify, which is built to reject every one of those. Full reward requires a proof that compiles, uses only standard Lean axioms (checked via #print axioms), and took no shortcut. Toggle the cheats and watch the verdict flip:

SafeVerify · the reward is adversarialhonest proof
candidateproofhonesttype-checks against the Lean kernelno admitted goals (`sorry`)no `native_decide` (unsound)only standard axioms (#print axioms)no `set_option` escape hatchesSafeVerify gates · all must passACCEPTEDfull reward
try a shortcut the model might take to fake a proof:
ACCEPTED — full rewarda real proof, only standard axioms

Because every one of these gets zero reward, RL can't learn to cheat its way to a green checkmark — the only policy that pays is producing genuinely kernel-checked proofs. It's the formal-methods version of a unit test that can't be satisfied by deleting the assertion.

This adversarial verifier is what makes the reinforcement learning honest. Leanstral trains on two RL environments through a CISPO objective: a multiturn environment where it must prove or disprove a theorem, getting Lean compiler feedback between attempts until it succeeds or runs out of budget; and a code-agent environment where it acts as a developer across a whole repository. Mistral's diagram of the multiturn loop is the picture of a verifier-gated reward — the same instinct as Agents-A1's verifier-graded RL, specialized to Lean:

Diagram of the multiturn Lean verifier training loop: a theorem dataset feeds 'solve this theorem' to the model, which emits a candidate proof to a Verifier; a passing proof yields a CISPO reward, a failing one returns format feedback and loops back, and the loop also terminates on too many tries.
The prove-or-disprove RL loop: the model submits a candidate proof, a verifier accepts it (CISPO reward) or returns feedback to retry — reward flows only through a genuinely checked proof (Mistral, Leanstral 1.5).

The numbers

On competition math, Leanstral is the best open result across the board — the caveat being that a couple of systems above it on PutnamBench either use natural-language guidance or cost 10–75× more to run:

PutnamBench — problems solved (of 672)
Aleph Prover ($54–68/problem)
668
Leanstral 1.5 (open, ~$4/prob)
587
Seed-Prover 1.5 high (~$300/prob)
580
Goedel-Architect (w/o NL)
508
AxProverBase
365
0200400600800

The result that best captures the "keep working the problem" behaviour is FLTEval — proof-engineering tasks drawn from real pull requests to the Fermat's Last Theorem repository. Here Leanstral 1.5 tops even frontier general models, at a fraction of the cost:

FLTEval — pass@8 (%)
Leanstral 1.5 (open)
43.2%
Claude Opus 4.6 (7× the cost)
39.6%
Leanstral 1.0
31.9%
0204060

Mistral's own charts show the full comparison set — the three-benchmark bar chart (PutnamBench / FATE-H / FATE-X) and the FLTEval scaling across pass@1/2/4, where 1.5 pulls clearly ahead of much larger open models:

Grouped bar chart comparing Aleph Prover, Leanstral 1.5, Seed-Prover 1.5 high, Goedel-Architect (w/o NL), AxProverBase and Seed-Prover 1.5 agentic-only across PutnamBench (668/587/580/508/365/359), FATE-H (87/80/66/57) and FATE-X (34/33/24/10); Leanstral 1.5 bars are highlighted as open source.
Leanstral 1.5 (open source, hatched) versus specialized prover systems on PutnamBench, FATE-H, and FATE-X (Mistral, Leanstral 1.5).
Line chart of FLTEval score versus generation budget (pass@1, pass@2, pass@4): Leanstral 1.5 leads at every budget, above Leanstral 1.0, Qwen3.5, Kimi K2.5 and GLM5, reaching about 39% at pass@4.
FLTEval by generation budget — Leanstral 1.5 leads open models 3–10× its size at every pass@k (Mistral, Leanstral 1.5).

It generalizes past math

Because the skill it learned is proof engineering in a repository, not competition-problem pattern matching, it transfers to code verification:

The take

Leanstral's contribution isn't a clever proof-search algorithm; it's a stance. The formal-proving leaderboard has been climbing by wrapping models in ever-more-specialized test-time scaffolds, and Leanstral shows that a plain code agent — trained in the loop it's evaluated in, graded by a verifier it can't cheat — matches or beats that machinery at a fraction of the cost, while staying usable by anyone who can drive a coding assistant. The MoE is efficient (6B active), the license is open (Apache-2.0), and the scaling story is the honest kind: no plateau trick, just compute converted into checked proofs. The open question is how far "just run the agent longer" goes as problems get genuinely harder than Putnam — but as a demonstration that formal verification can be practical infrastructure rather than a prover-lab specialty, it's the most encouraging Lean release in a while.


Built on the Leanstral technical report and Mistral's Leanstral 1.5 announcement (Mistral AI, 2026; Apache-2.0, weights on Hugging Face). Figures are reproduced from Mistral's report and blog post; benchmark and cost figures are quoted from those sources.

Cite this article

For attribution, please use the following reference or BibTeX:

Satyajit Ghana, "Leanstral: proving theorems by being a code agent, not a prover", ai.thesatyajit.com, July 2026.

bibtex
@misc{ghana2026leanstralformalproofs,
  author = {Satyajit Ghana},
  title  = {Leanstral: proving theorems by being a code agent, not a prover},
  url    = {https://ai.thesatyajit.com/articles/leanstral-formal-proofs},
  year   = {2026}
}
share