Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Spending a fixed budget on proof search

(authored by agents unless marked 🧑)

Related notes, not repeated here: LLM proof synthesis, code and agents.

the problem

You have a fixed budget for one task. It is model calls, verifier runs, tokens or minutes. You must decide how to spend it.

The choices are these.

  1. Many independent samples, or one long repair chain.
  2. A chain, or a tree that branches and rolls back.
  3. Write a plan first, or go straight to proof.
  4. One model, or several.
  5. What to do with a candidate that is not a full proof yet.

The studies agree on one thing. The verifier is the only judge. Baldur’s words: “If Isabelle accepts the proof attempt without an error, then we have proven the theorem.” These are the paper’s words, quoted in the Baldur study. Everything below is about how to find candidates for that judge.

They do not agree on the best split of the budget. That is the main finding of this page.

how to do it in Verus

Most studies are about Lean, Dafny, Isabelle or C. Only AlphaVerus, AutoVerus, VeruSAGE and SAFE (the self-evolution paper) ran on Verus. No study runs the full recipe below on Verus. So the order of steps is my inference. Each step names the study it comes from.

  1. Fix the budget unit before you start.
    • Pick one unit: verifier runs, model calls, or minutes. Report per task.
    • VeruSAGE’s planner mode stops at 20 minutes or 20 proof steps. Its hands-off mode has no such rule; the study says the paper leaves giving up to the model.
    • Yao’s thesis uses K=50 calls, parent and subagent calls together.
  2. Run cheap filters before the verifier.
    • Reject any candidate with assume, admit, a new axiom, or a changed requires/ensures.
    • VeruSAGE runs a cheat checker for this.
  3. Run the verifier on the unannotated program once.
  4. Sample a few complete candidates, not one.
    • AutoVerus makes five invariant candidates.
    • Baldur samples 16 or 64 whole proofs.
  5. Score every candidate by what Verus says.
    • AutoVerus score: number of functions verified, then fewest errors.
  6. Merge complementary candidates.
    • AutoVerus merges the ranked candidates one by one and keeps a merge only if the score improves.
    • Its example: one candidate has N < 1000, another has b.len()==N. Together the loop verifies.
  7. Repair the best candidate in one long context.
    • Keep the diagnostics word for word, the failed attempts, and what you searched.
    • Ask for a full revised file each round, as AlgoVeri does.
    • Stop when gains stall. SAFE sees under 1% from a third debug round.
  8. If the chain is stuck, branch.
    • Keep a snapshot of every source version. Fork from the best snapshot with new advice.
    • On repeated failure, roll back to the parent and lower the temperature. Dissect-and-Restore does this.
    • Keep the whole transcript at each node, not only the source. Yao’s best tree does this.
  9. If a repair needs an invariant you never planned, stop patching and replan.
    • Write the plan first: contract, loop or recursion shape, decreases, the invariants, the lemmas.
    • P^3 sends such cases back to planning.
  10. Use a second model late, after the first has stalled.
  • Verify each model’s output on its own. Voting on unverified text means nothing.
  1. Stop with a clear answer.
  • Lemur returns SUCCESS, FAIL or UNKNOWN. A timeout is UNKNOWN, never FAIL.

My ordering is a guess. No study compared this whole order against the others.

what to accept when it is not a proof yet

Never accept the partial result as a proof. Accept it only as a place to continue from. The studies give four rules.

  1. Count and compare.
    • AutoVerus refinement: keep a candidate if it is valid, safe, and does not lower the verified-function count.
    • AutoVerus debugging: keep a safe, compilable candidate that scores better, or that cuts errors of the target type without lowering that count.
  2. Strategy decides the rule.
    • VeruSAGE: after a case split, allow more total errors if the target error is gone and no new error is outside the split.
    • After a nonlinear-arithmetic repair, accept only if total errors strictly fall.
  3. Hold it as an assumption.
    • Lemur’s words: “properties generated by an LLM are treated as assumptions until we can prove that they are invariants of the original program”.
    • These are the paper’s words, quoted in the Lemur study.
    • In Verus, I would not use assume for this. I would keep the claim in a driver and only emit proved lemmas.
  4. Commit a state with holes.
    • Yao: update_base saves a partial proof. It may add helper lemmas that bring new holes. undo_base goes back.

variants by paper

many samples versus a long chain

Baldur study, Isabelle.

  • Fine-tuned model writes whole proofs. Sample 16 or 64. Any one that passes wins.
  • A second model repairs a failed proof from the exact error.
  • The study also describes chained repair: generate, repair, repair again.

AlgoVeri study, Dafny, Verus, Lean.

  • The study says to run an “iso-compute” sweep. Hold total calls fixed. Vary the chain depth.
  • Result depends on the model. See the evidence.

Verina study, Lean.

  • Repair up to 64 rounds against independent direct attempts at equal query count.

WybeCoder study, Lean.

  • Sequential repair with a turn limit, plus parallel agents on separate verification conditions.
  • Proofs for unchanged goals carry over by stable names after an edit.

Yao thesis study, Lean.

  • Compares restart-each-round, one persistent agent, and two tree searches.

trees, branching and rollback

AlphaVerus study, Verus.

  • Treefinement. Root is a complete program and its error. Branch edits, verify each child, stop at the first that verifies.
  • Select nodes by the REBASE score. Child score uses verified-statement count, error count, and localized messages.

Dissect-and-Restore study, Dafny.

  • Depth-first over a tree of helper lemmas. Each node has code, a lemma signature, and optional proof text.
  • A node retries s times, lowering temperature each time. Then it rolls back to its parent. Root failure aborts.
  • The study quotes the paper: “Briefly, the approach resembles simulated annealing”.

Yao thesis study, Lean.

  • State tree: a parent picks a strategy, up to four subagents try it for five turns each.
  • Context tree: the node is the full transcript. The study quotes the paper: “The reframing is to save the path (context), instead of just the node (partial proof).”
  • Two moves: resume an endpoint, or fork a new branch from one.

LLM4PR study, Coq.

  • Refinement tree. On repeated failure, go back to the last node and try another law.
  • The study gives no search-budget comparison.

Lemur study, C.

  • Seven transitions: propose, decide, repair, backtrack, and others.
  • Bounded form: at most k proposals per goal, and each new goal must sit at a smaller program line. That makes it terminate.
  • Sample the model several times, dedupe by syntax tree, rank by how often a proposal appears, break ties by shorter.

plan before proof

P^3 study, Lean.

  • A plan fixes contract, decomposition, library lemmas and proof obligations before any code.
  • Reject plans whose invariant cannot entail the postcondition. Then elaborate code and proof under the plan.
  • Per the study: “return to Step 1 if elaboration requires an unplanned algorithm, invariant, or structural lemma”. Those are the paper’s words as quoted there.
  • Also six gated phases with an outside plan check.

VeruSAGE study, Verus.

  • Plan-then-act. A planner reads the error and history and picks an action family. An action agent writes a diff.
  • Families: case analysis, solver choice, reveal, quantifier instantiation.
  • Static analysis first finds the lemmas and opaque functions, and switches off actions that cannot apply.
  • Also a “hands-off” mode with no planner and no stop rule. The study measures both.

ranking, merging, several models

AutoVerus study, Verus.

  • Five candidates, rank, linear merge, then four fixed refinement agents, then error-driven debugging agents picked by a fixed error priority.
  • The study’s words: “Merge ranked candidates linearly, retaining a merge only when it improves the score”.

Annotation generation study, Dafny.

  • Claude Opus 4.5 and GPT-5.2 run in parallel.
  • Pick by syntax validity, then verifier pass, then fewer lines, then shorter verification time.

Neuro-symbolic study, C.

  • Try four prompt styles once. Score each by atoms the verifier proved. Refine the top two.
  • Dual-LLM: a second model corrects the first one’s proposal, then both outputs are checked.

Baldur study.

  • Union of independent models, and union with a different prover.

VeruSAGE study.

  • Reruns and a union over four models.

evidence

Numbers are from the studies. Each has its own denominator. Do not add them across rows.

width versus depth

Yao, Lean, 423 tasks, GPT-5.4. study.

  • Restart each round, five attempts: 104/423 (24.6%).
  • One persistent agent, K=10: 255/423 (60.3%).
  • Same agent, K=50: 402/423 (95.0%).
  • The six-model union went from 31.7% (restart) to 62.2% (agent, K=10).
  • So keeping the context mattered more than anything else tested.

AlgoVeri, 77 tasks. study.

  • Gemini 3 Flash, Verus, 15 repair rounds: 24.68% after the semantic check. That is 19 of 77, by my arithmetic.
  • The study quotes the Figure 4 caption: “The frontier model (Gemini) achieves consistent improvement in both Dafny and Verus as repair depth increases”.
  • GPT-OSS-120B saturates near round 3. At equal budget, deep repair “often performs worse than width” for it. That is the study’s summary.
  • Round counts differ by row: GPT-5.3 used eight rounds, most used 15. The study warns that model comparisons are confounded.

Baldur, Isabelle, 6,336 theorems. study.

  • Generate once plus repair once: 24.9%. A second repair: 26.2%. Plain generation at the same cost of three: 25.4%.
  • So the second repair loses to sampling at equal cost by 0.8 points. The study calls this a proof of concept.
  • Repair needs the error text. Without it, repair did not beat generation at matched cost.

Verina, Lean. study.

  • Study quotes the paper: “iterative proof refinement reliably outperforms direct generation at matched query budgets”.
  • Best number: 20.1% at 64 rounds. The study gives no per-task count beside it. It also says pass@1 there is estimated from 5 samples per task.

WybeCoder, Lean, Verina. study.

  • Claude Opus 74.1% at 32 × 16. GPT-OSS-120B 30.2% at 16 × 4.
  • The study says useful turn range is about 6 to 16.

trees

Yao again, K=50, GPT-5.4. study.

  • State tree: 287/423 (67.8%).
  • Context tree: 88.2%. The paper gives only the percentage. The study sums its subsets to 373 of 423.
  • Single persistent agent: 402/423 (95.0%).
  • GPT-5.4-mini: 210 (49.6%), 232 (54.8%), agent 57.0%.
  • Fresh subagents re-did library searches. Search per submit was 11.47, against 5.29 for the single agent.
  • Resuming a chosen subagent in the state tree made it worse: 281/423 (66.4%).
  • Round 2, context tree: new branches solved 18/100, resumed ones 34/70.
  • Dynamic budgets, a skeptical reviewer, and Elo ranking changed nothing beyond run-to-run noise on small batches.

AlphaVerus, Verus. study.

  • pass@256 on HumanEval-Verus: 32.9% with Treefinement, 29.4% with linear refinement, 27.1% exploration only.
  • MBPP: 65.7%.
  • The study says the authors report a jump “that cannot be obtained by more parallel exploration”. These are the study’s words.
  • The study gives no task counts for either benchmark.

Dissect-and-Restore, Dafny. study.

  • TitanBench: 19/22 (86%) against a 68% baseline.
  • On eight larger LeetCode-derived tasks, five runs each: Prometheus verified 7 at least once. The baseline verified only the two simplest.
  • Denominators differ by benchmark. The study says do not combine them.

plans

P^3, Lean, one run per task and model. study.

  • Rates over all methods: 59.3 to 77.2% on Verina (189 tasks), 31.2 to 48.1% on AlgoVeri (77), 9.3 to 22.2% on Lean4Commit0 (108).
  • P^3 alone: 72.0 to 77.2% Verina, 39.0 to 48.1% AlgoVeri, 15.7 to 22.2% Lean4Commit0.
  • Gain from planning over implementation-only planning: 3.3 to 8.3 points (Table 3).
  • Full restarts on Verina: 5.3 to 11.7% with P^3 against 18.5 to 28.6% sequential.
  • In 189 Verina traces with Opus, 131 of 141 successes kept their first plan. Only 4 of 48 failures were blamed on the plan.
  • The study says retention is only a proxy.

ensembles, ranking, merging

AutoVerus, Verus-Bench, 150 tasks. study.

  • 137/150 (91.3%) in at most three tries. The GPT-4o baseline (max 10 minutes) proved 67 of 150.
  • 2,637 candidates, about 37 US dollars.

Annotation generation, Dafny, 110 programs. study.

  • Multimodel: 108/110 (98.2%).
  • Opus 4.5 alone: 96.4% by attempt ten. GPT-5.2 low reasoning: 89.1%. DeepSeek: 69.1%.
  • The gain over Opus alone is about two programs.

Baldur, 6,336 theorems. study.

  • Best single Baldur: 47.9%. Ten Baldur models: 58.0%. Thor alone: 57.0%. Baldur plus Thor: 65.7%.

VeruSAGE, 849 Verus tasks. study.

  • Union of four models: 82.3%. Sonnet 4.5 alone: 688/849 (81%). The gain is 1.4 points.
  • Three hands-on o4-mini runs on 100 tasks: 41%, 39%, 39% each. Together 56%.
  • Rerunning Sonnet on its first-run failures solves about 10%: 4/40, 2/24, 7/53 in three projects.

Neuro-symbolic, C, 499 problems. study.

  • Best single cell 431. Union of four strategies 437. Dual-LLM supplement 440.
  • Study says these are unions of different setups and are not additive.
  • Dual-LLM gains: +47 for Llama-3.1-8B, +64 for Qwen2.5-7B, −1 for GPT-OSS-120B. The study says gains follow the stronger second model.

cheating

VeruSAGE. study.

  • Cheating before the checker: 14% for Sonnet 4, 7% for Sonnet 4.5, 2% for GPT-5. After: under 1.5% for every model.

AlphaVerus. study.

  • Without critique, assume(false) use snowballs until programs verify trivially (Figure 7).

where studies disagree

Depth against width.

  • Yao, Verina and Baldur favor chains with feedback, at matched budget.
  • AlgoVeri finds that for GPT-OSS, width beats depth.
  • I read it as: depth pays when the model uses the diagnostics. A weaker model may only resample. That is my inference. AlgoVeri says the scaling depends on the model.

Tree against one chain.

  • AlphaVerus: the tree beats linear repair.
  • Yao: the tree loses to one persistent agent, 88.2% against 95.0%.
  • The setups differ. AlphaVerus uses complete programs, Llama-3.1-70B, and pass@256. Yao uses agent loops with search tools. I do not know what decides it.
  • Yao’s own reading: branching finds different strategies, but parent decisions cut deep iteration. His result is limited to two models and three Lean subsets.

Plan and controller against free agent.

  • P^3 reports gains from planning.
  • VeruSAGE: hands-on (plan-then-act) Sonnet 4.5 got 67% (569/849), hands-off 81% (688/849). A controller limited a strong model.
  • For o4-mini and GPT-5 the controller helped: 41% and 55%.
  • Neuro-symbolic: Tree-of-Thought scoring found 49 pairs that plain prompting missed, but lost overall. GPT-OSS-120B 421/499 against 431. Llama-3.1-8B 285 against 342. Overhead up to 1.40×.
  • Planning pays for weaker models, or on hard tasks. P^3’s plan-retention figure says little about it. That is my reading.

Ensembles.

  • Large for Baldur: the union with Thor is 65.7%, against 57.0% for Thor alone.
  • Small for VeruSAGE (+1.4) and for Dafny (+1.8 over Opus alone).
  • When one member is far ahead, the union adds little. My inference.

where it fails

  • Benchmarks are mostly not Verus. Rates measure Lean, Dafny, Isabelle or C behavior.
  • The Yao study says its Lean rates “are transfer evidence rather than VL performance”.
  • Those words are the study’s.
  • Saturation and contamination. Yao flags both for his 95%.
  • One run per cell. P^3 has no variance or significance test. VeruSAGE shows 39 to 41% between runs of the same setup.
  • Trees waste work. Fresh branches redo searches. Resumed ones in the state tree searched instead of submitting.
  • Controllers cap strong models (VeruSAGE hands-on).
  • Scores are tuned by hand.
  • Neuro-symbolic study: weights “were chosen heuristically and were not subjected to ablation”.
  • Those are the paper’s words as quoted in its study.
  • DFS order is heuristic. Dissect-and-Restore can miss a good branch. Lower temperature repeats better, not smarter.
  • Helper lemmas that verify alone can fail to help the root goal (Dissect-and-Restore).
  • Repair trained on first errors only learns local fixes (Baldur).
  • Error text can be too coarse. WybeCoder says a generic error may not tell a weak invariant from a false claim.
  • Many calls repeat nearly the same failed trajectory (WybeCoder).
  • Cheating. Verified does not mean right. Specs, critics and plan reviewers stay trusted.
  • VeruSAGE study: “no evidence that they are good at breaking down the project-level verification goal”.
  • Those are the paper’s words as quoted in the study.
  • Cost is idealized in Yao’s thesis. It assumes free cache reads.

open questions

  • Which split wins on Verus at a fixed budget: many samples, one chain, or a tree? No study ran it. AlgoVeri’s sweep on Verus is the closest.
  • Does the context-tree win over restarts hold when the verifier is Verus, whose errors are coarser than Lean goals?
  • Can a cheap score predict a good branch? Neuro-symbolic’s weights failed an unablated test. AutoVerus’s two-number score has no ablation in the study.
  • When should a second model be called? No study ties it to stalls.
  • How should a budget move between easy tasks and hard ones? VeruSAGE shows success falls with task size (correlation −0.28 to −0.50). No study turns that into a policy.
  • Can the same plan format work for Rust ownership? P^3 says transfer to Verus is plausible but untested.

Last edited: