Source-linked AI summary
Verifier-Grounded Agentic RL for Provably Correct Code
George Ma, Yuhao Zhang, Bing He, Zeren Shui, Ferhat Erata, Murali Krishna Ramanathan, Somayeh Sojoudi, Hao Zhou
TL;DR
Tests can pass programs that remain wrong on uncovered inputs, while verifier-only rewards are sparse and can be gamed by changing specifications or assuming proof obligations. The paper trains an agent against a live verifier using diagnostic-based partial credit, integrity checks, and a frozen proof specialist; held-out code-generation verification rises on DafnyBench and SWE-Proof.
Problem
Tests cover only a fraction of the input domain, while verifier-only rewards are binary and can be gamed by altering specifications or assuming obligations.
Source: §1 · pp. 1–2Method
An agent uses live-verifier diagnostics for obligation-based partial credit, hidden probes, and an integrity audit, with a frozen proof specialist assisting code generation.
Source: §1 · pp. 2–3Results
66.1% to 93.5% on DafnyBench and 56.3% to 100% on SWE-Proof held-out code-generation verification; checkpoints also improve on three unseen suites.
Source: §1 · p. 3, §5 · p. 10Takeaways & Limitations
The verifier-grounded reward outperforms the other compared training signals, and unchanged checkpoints improve on unseen verification suites, including one with an unseen language and verifier.
Source: §5 · p. 10
Abstract
from arXiv · showhide
Reinforcement learning for code usually rewards passing tests, which a model can do while remaining wrong on the inputs the tests do not cover. A program verifier instead decides whether a program satisfies a formal specification for all inputs. Language models are almost always paired with verifiers at inference time only, and turning a verifier into a reward raises two difficulties. It reports only acceptance or rejection, which gives no gradient when every attempt fails, and a policy can cheat it, most simply by telling it to assume what the proof was supposed to establish. We build an agentic environment and reward that address both. The reward reads the verifier's diagnostics rather than its verdict, scoring a candidate by the weighted fraction of proof obligations it discharges, extended with hidden probes from a reference proof's annotations. An integrity audit outranks the verifier, rejecting any candidate that alters the specification or assumes what it was meant to prove. The model works as an agent against a live verifier over many turns, with a separately trained proof specialist as a frozen collaborator. Across Qwen3 models from 1.7B to 14B and a 35B Qwen3.6 mixture-of-experts model, held-out verification on code generation rises from 66.1% to 93.5% on DafnyBench and from 56.3% to 100% on SWE-Proof. This reward leads every other training signal we compare, including a binary pass-or-fail reward trained under otherwise identical settings, with the widest margin on code generation. When the agent must also deliver the repository patch, graded by each project's withheld tests, the fraction of held-out issues it resolves rises from 59.6% to 72.5%. Evaluated unchanged on three verification suites withheld from training, the checkpoints improve on all of them, including one whose language and verifier are absent from training.
1 INTRODUCTION
Tests cover only part of the input domain, while verifier-only rewards are sparse and vulnerable to specification or proof shortcuts. The paper uses verifier diagnostics, an integrity audit, and a frozen proof specialist in an agentic training loop.
1 INTRODUCTION
- The reward scores the weighted fraction of obligations discharged and adds hidden probes, while an integrity audit rejects altered specifications and assumed obligations.The obligation set is fixed from the instance before the episode begins.Source: §1 · pp. 2–3
- A separately trained annotation-repair policy is frozen as a proof specialist; code-generation submissions are scored directly and after its proof-annotation rewrite.The episode keeps the better score, so the specialist's version is returned as feedback without lowering the agent's score.Source: §1 · p. 3
- Held-out code-generation verification rises from 66.1% to 93.5% on DafnyBench and from 56.3% to 100% on SWE-Proof, with gains across model sizes.The reported gains span models from 1.7B to 35B on DafnyBench.Source: §1 · p. 3
- On DafnyBench code generation, verifier-grounded reward reaches 93.5%, versus 71.0% for binary reward and 53.2% for reference-proof supervised fine-tuning.The binary reward uses otherwise identical training settings.Source: §1 · p. 3
- With repository patches graded by withheld project tests, the fraction of held-out issues resolved rises from 59.6% to 72.5%.The agent must both verify the specification and deliver the patch.Source: §1 · p. 3
- The trained checkpoints improve on three held-out verification suites, including Verus, whose language and verifier are absent from training.The evaluation is performed unchanged on those suites.Source: §1 · p. 3
2 TASKS AND ENVIRONMENT
The environment holds each specification fixed and asks models to restore either proof annotations or implementation plus proof through an interactive loop with a live verifier. Its benchmarks span verified programs and repository issue fixes.
2 TASKS AND ENVIRONMENT
- Each instance has a specification, implementation, and proof annotations; the specification remains unchanged while the task removes one of the other parts.Annotation repair removes proof annotations; code generation replaces implementation bodies with placeholders.Source: §2 · p. 4
- The model interacts with a live verifier for up to T turns, using diagnostics, execution, integrity checks, and—during code generation—optional specialist assistance before submission.Multiple submissions are allowed, and the episode retains the best submission.Source: §2 · p. 4
- An integrity audit compares the submitted and given specifications and rejects unchecked assumptions, axioms, admitted proofs, or directives that exclude code from verification.Constructs written by the instance author are allowed; failing either check scores below an honest partial attempt.Source: §2 · p. 4
- DafnyBench supplies 782 annotation-repair and 750 code-generation instances, while SWE-Proof uses 500 repository issue tasks paired with Nagini models.SWE-Proof annotation repair uses the 257 instances whose reference proofs contain annotations; three HumanEval-derived verified suites are reserved for evaluation.Source: §2 · p. 4
- SWE-Proof specifications are longer and less uniform than DafnyBench's, and Table 1 reports median specification size for each benchmark.DafnyBench is split by program and SWE-Proof by repository, with the largest repository divided across the splits.Source: §2 · p. 4, Table 1 · p. 4
3 VERIFIER-GROUNDED REWARD
The reward turns verifier diagnostics into partial credit, with fixed obligations and hidden probes measuring proof progress. Integrity penalties and a verification bonus prioritize sound completion, while a frozen specialist can improve code-generation submissions.
3 VERIFIER-GROUNDED REWARD
- The obligation ratio uses fixed, instance-level counts across five categories, so candidates cannot earn credit by making their own obligations easier.It averages over categories exercised by the instance, using task-specific weights; code generation emphasizes postconditions, while annotation repair emphasizes invariants.Source: §3 · p. 5
- Hidden probes turn reference-proof annotations into checked assertions for annotation repair, but code generation uses specification obligations alone because it has no reference proof.Probes already satisfied by the stripped program are dropped, and isolated assertions avoid letting loop invariants assume the facts being tested.Source: §3 · p. 5
- The score combines the obligation ratio with integrity penalties and a verification bonus, ranking intact full verification above honest partial proofs and dishonest verification.Intact verification scores 2–3, honest partial attempts 0–1, altered-specification verification −1–0, and proof-check failures at most −2.Source: §3 · p. 5
- An episode with no submission receives −1.5, while unchanged resubmissions and turns without valid actions each cost 0.25.The episode reward adds these terms to the best submission's score.Source: §3 · pp. 5–6
- The frozen specialist rewrites proof annotations while retaining the implementation, and code generation uses the better of the direct and assisted scores.The maximum-score rule means a poor specialist suggestion cannot lower the agent's reward.Source: Figure 3 · p. 6, §3 · p. 6
- Policy optimization samples groups of complete episodes and gives every generated token the episode's normalized group-relative advantage under a clipped objective with a KL penalty.The method uses Group Relative Policy Optimization and the k3 estimator for the KL penalty.Source: §3 · p. 6
4 EXPERIMENTS
Across held-out experiments, training improved verification across tasks and scales, and the verifier-grounded reward outperformed the alternatives compared. Specialist assistance raised code-generation verification and repository-issue resolution, while gains also transferred to unseen verification suites.
4.1 SETUP
- DafnyBench experiments covered Qwen3 models from 1.7B to 14B and a 35B mixture-of-experts model; SWE-Proof results report the 35B model.Evaluation used the best held-out checkpoint and one greedy episode per held-out instance.Source: §4.1 · pp. 6–7
4.2 MAIN RESULTS
- At 35B, code-generation verification reached 93.5% on DafnyBench and 100% on SWE-Proof; training improved held-out verification across scales, tasks, and benchmarks.The section also reports 76.7% for 35B DafnyBench annotation repair.Source: §4.2 · p. 7, Figure 4 · p. 7, Table 2 · p. 7
4.3 TRANSFER TO UNSEEN VERIFICATION BENCHMARKS
- On unseen benchmarks, 35B checkpoints improved on all three; HumanEval-Verus code generation more than doubled from 17.2% to 36.6% despite its unseen language and verifier.Transfer rates varied with benchmark similarity to training data.Source: §4.3 · p. 8
4.4 THE FROZEN PROOF SPECIALIST
- With the specialist, code-generation verification rose from 88.7% to 93.5% on DafnyBench and from 87.5% to 100% on SWE-Proof; per-episode assistance usually finished under-annotated proofs.The run-level gap was indistinguishable at 1.7B and opened from 8B onward.Source: §4.4 · p. 8, Figure 5 · p. 8
4.5 COMPARISON WITH OTHER TRAINING METHODS
- On DafnyBench code generation, verifier-grounded RL reached 93.5% versus 71.0% for a controlled binary-reward ablation; supervised fine-tuning was weakest across both tasks.The binary reward was competitive on annotation repair, at 75.2% versus 76.7%.Source: Table 3 · p. 8, §4.5 · p. 9
4.6 FROM A VERIFIED SPECIFICATION TO A REPOSITORY PATCH
- With specialist assistance, held-out SWE-Proof issue resolution rose from 59.6% to 72.5%, while full verification rose from 76.1% to 88.1%.The task requires both a proved Nagini program and a repository patch graded by withheld project tests.Source: §4.6 · p. 9, Figure 6 · p. 9, Table 4 · p. 9
5 CONCLUSION
The paper reports broad verification gains and transfer while detailing the verifier-grounded reward, integrity controls, and agent environment. Its appendices describe obligation scoring and hidden probes that add reward density where proof work is non-trivial.
5 CONCLUSION
- Held-out code-generation verification rises from 66.1% to 93.5% on DafnyBench and from 56.3% to 100% on SWE-Proof; checkpoints also improve on three unseen suites.The paper reports gains at every DafnyBench scale and improvement on a suite whose language and verifier were absent from training.Source: §5 · p. 10
AI USE STATEMENT
- The authors used generative AI tools to assist with software-code implementation and editing the paper for readability, with authors reviewing the code and checking text accuracy.They state the tools did not generate data, formulate hypotheses or claims, design methods or experiments, or interpret results.Source: AI USE STATEMENT · p. 10
A RELATED WORK
- Program verifiers provide all-input correctness checks, but prior verifier use is usually at inference time; this work trains against verifier feedback and audits submitted artifacts.The related-work discussion distinguishes this approach from inference-time acceptance tests, search, and filtering, and from reflection scaffolds that leave model weights untouched.Source: A RELATED WORK · pp. 20–21
B ENVIRONMENT DETAILS
- The environment runs episodes over multiple turns, keeping the specification and scoring record on its side so the model’s claims cannot determine reward.Episodes have a 20-turn budget; invalid turns incur a penalty and episodes can end upon completion, budget exhaustion, or verified submission.Source: B ENVIRONMENT DETAILS · p. 21, §B.1 · p. 21
B.2 ACTIONS AND ISOLATION
- Verification returns unmet-obligation categories, locations, and messages; execution tests behavior, while audit and submission actions expose integrity status and score.Proof assistance independently verifies a frozen specialist’s re-annotated candidate, and the higher score of assisted or direct candidates is retained.Source: §B.2 · pp. 21–22
- The verifier and execution calls run in isolated sandboxes with timeouts; Nagini uses warm verifier processes to cut per-call latency by roughly an order of magnitude.The environment overlaps verifier calls with generation across the rollout batch.Source: §B.2 · p. 22
C.1 OBLIGATION CATEGORIES, ATTRIBUTION AND WEIGHTS
- The reward uses a fixed, instance-specific denominator of proof obligations, with candidates receiving credit for discharging those obligations rather than for adding annotations.Obligations are categorized by the verifier’s reported kind, and code generation weights postconditions more heavily while annotation repair emphasizes invariants.Source: §C.1 · pp. 22–23
C.2 HIDDEN PROBES
- For annotation repair, reference-proof annotations become isolated hidden probes; baseline filtering removes probes already discharged by the stripped program.Isolation prevents a probe from helping prove itself or changing the proof context; roughly two thirds of extracted DafnyBench annotations are filtered out.Source: §C.2 · pp. 23–24
C.3 HOW THE INTEGRITY AUDIT WORKS
The integrity audit checks that a submission preserves the specification and does not bypass proof obligations, with its verdict taking precedence over verification. The section also describes episode-level scoring, specialist assistance, and optimization choices.
C.3 HOW THE INTEGRITY AUDIT WORKS
- The audit rejects changed specifications and verification-escaping constructs, and a failure on either check is scored as verifier rejection rather than retaining partial credit.The specification comparison operates on parsed clauses; the proof check enumerates constructs such as unchecked assumptions and admitted lemmas.Source: §C.3 · p. 24
- The proof check is only as strong as its language-specific construct list, while the specification comparison checks a canonical specification against submitted content.In 35B runs, audit failures fall to near zero on both DafnyBench tasks and 0.4% of SWE-Proof code-generation submissions.Source: §C.3 · p. 24
C.4 EPISODE-LEVEL TERMS AND THE ASSISTANCE CLAMP
- Episode reward includes a −1.5 penalty for never submitting and capped −0.25 costs for identical resubmissions or invalid turns; specialist assistance cannot lower the direct score.The assisted score enters as max(sdirect, sassisted), so even a malformed specialist suggestion is discarded if it scores worse.Source: §C.4 · pp. 24–25
D.1 OPTIMIZATION
- Training uses group-relative policy optimization without a learned value function, assigning each episode’s scalar reward to its tokens; value fitting performed poorly for this reward.Thinking mode was disabled after it consumed response budget and hurt verified rates; the 35B training setup used 32 A100-80GB GPUs.Source: §D.1 · p. 25
D.2 VERIFIER CALLS, DATA ORDERING AND CHECKPOINTING
- At 35B, policy updates take just over half a training step, generation about a third, and reward computation the remainder; verifier latency is largely hidden by overlap.Dafny and Nagini verification calls have 30-second and 90-second timeouts, respectively.Source: §D.2 · pp. 25–26
D.3 REPRODUCIBILITY
The reproducibility section specifies verifier versions, evaluation conditions, and planned artifact release. The benchmark-construction account explains how annotation-repair and code-generation instances are derived from verified reference programs.
D.3 REPRODUCIBILITY
- All Dafny results use Dafny 4.11.0, Nagini results use Nagini 1.2.0 over Viper, and Rust transfer uses Verus; verifier diagnostics are checked against its summary line.Reported numbers use one greedy sample per instance on the complete held-out split; evaluation is reproducible from a checkpoint and verifier version apart from timeouts.Source: §D.3 · p. 26
- The authors state they will release the environment, reward and audit implementation, probe construction, benchmark adapters, training configurations, and evaluation harness upon publication.Source: §D.3 · p. 26
E BENCHMARK CONSTRUCTION AND SPLITS
- Benchmark instances start from reference programs whose proofs verify under the toolchain; annotation repair removes proof annotations, while code generation removes method and lemma bodies but retains contracts and declarations.Instances with no annotations to repair or no bodies to write are excluded, as are code-generation instances retaining a verification-escaping construct.Source: E BENCHMARK CONSTRUCTION AND SPLITS · p. 26, §E.1 · p. 26
E.2 SUITE STATISTICS
The suite statistics describe the sizes and construction of DafnyBench, SWE-Proof, and transfer instances. The training benchmarks use held-out splits designed around programs or repositories, while transfer suites are entirely held out.
E.2 SUITE STATISTICS
- DafnyBench contains 782 annotation-repair instances and 750 code-generation instances; SWE-Proof contains 500 code-generation instances and 257 annotation-repair instances.DafnyBench code-generation instances average 38.8 visible lines, while SWE-Proof reference models average 146.3 lines.Source: §E.2 · p. 27
- The three transfer suites use HumanEval-derived verified programs in Dafny, Nagini, and Verus, with exclusions based on reference verification, removable bodies, or proof annotations.The retained suite counts vary by language and task: for example, HumanEval-Dafny has 110 annotation-repair and 131 code-generation instances.Source: §E.2 · p. 27
E.3 SPLITS
- DafnyBench splits by program so paired task forms and near-duplicates stay together; SWE-Proof splits by repository, with the largest repository divided across both sides.Transfer suites are never split because none contributes to training.Source: §E.3 · pp. 27–28
F.1 TRAINING CURVES
Training reward and held-out verification rise together, though the starting signal differs by benchmark. The reported runs remain in progress when their training budgets end, and the held-out curves are granular because the splits are small.
F.1 TRAINING CURVES
- On SWE-Proof annotation repair, held-out verification climbs from 3.1% to 68.8% despite near-zero initial reward, showing partial obligation credit can support progress when almost nothing verifies.On DafnyBench, reward starts positive at every scale and rises steadily; held-out verification and training reward move together across the reported runs.Source: §F.1 · p. 28
- The strongest runs—both 35B code-generation runs and SWE-Proof annotation repair—are still improving when their training budgets end.Figures 7 and 8 report held-out verification and mean training reward by task and model size; the two measures move together throughout these runs.Source: §F.1 · p. 28
- Held-out splits contain 58–129 instances, so a one-point movement between evaluations represents only one or two instances.The resulting verification curves are correspondingly granular.Source: §F.1 · p. 28
F.2 WHY SWE-PROOF IS REPORTED AT 35B
SWE-Proof annotation repair remains near the floor at smaller scales, while the 35B run improves substantially. This pattern explains why the body reports SWE-Proof results at 35B only.
F.2 WHY SWE-PROOF IS REPORTED AT 35B
- Reconstructing a SWE-Proof reference proof requires permission accounting, quantified invariants, and predicate definitions spread across routines, making fully stripped instances beyond the smaller scales.SWE-Proof annotation repair starts near zero, so essentially all of its final performance is acquired during training.Source: §F.2 · p. 29, Figure 8 · p. 29
- For SWE-Proof annotation repair, the task becomes learnable only at 35B, where the rate rises from 3.1% to 68.8%; the 14B run continued to 120 steps to confirm no movement.Source: §F.2 · p. 30
- Below 35B, code-generation runs with and without the frozen specialist track each other; at 35B, they separate by 12.5 points.The specialist itself has never produced a verifying proof below 35B, so its suggestions are almost always discarded there.Source: §F.2 · p. 30, Figure 9 · p. 30
F.3 BEHAVIORAL CHANGE OVER TRAINING
Training changes episode behavior: agents persist after failed submissions, revise programs, and more often recover to verification. Audit failures also fall, while the actor-critic comparison and logged-episode analysis explain how these findings were assessed.
F.3 BEHAVIORAL CHANGE OVER TRAINING
- Episodes become shorter, and first-submission success rises on three of four runs; the largest behavioral improvement occurs after a failed submission.Table 8 compares held-out episodes from each run’s first and last quarters; Figure 10 tracks five episode-level diagnostics on DafnyBench, while Figure 11 shows longer SWE-Proof episodes.Source: §F.3 · p. 30, Table 8 · p. 30, Figure 10 · p. 31
- Retry rates approach one, revisions rise, and recovery improves on DafnyBench and triples or better on SWE-Proof.SWE-Proof annotation repair starts with a 0.7% first-try rate, and recovery accounts for most of that run’s improvement.Source: Table 8 · p. 30, §F.3 · p. 31
- Integrity-audit failures fall from 10%–45% of DafnyBench submissions initially to near zero at 35B, and end at 0.4% on SWE-Proof code generation.The reward ranks a verified submission with an altered specification below an honest partial proof, and the policy learns to stop altering specifications.Source: §F.3 · pp. 31–32
- DafnyBench code-generation responses shorten from about 3,950 to about 1,300 tokens as verification rises, while policy entropy declines from 0.42 to 0.27 without collapsing to one proof style.The initial policy spends tokens restating the specification and narrating intentions, neither of which the reward pays for.Source: §F.3 · p. 32
F.4 ACTOR-CRITIC VARIANTS AND WALL-CLOCK COST
- On 35B DafnyBench code generation, actor-critic runs improved training reward while held-out verification fell; the learned value head favored predictable penalties over the obligation ratio.Group-relative advantages avoid the value-function misfit and compare episodes on the same instance.Source: §F.4 · p. 33
- A 35B DafnyBench step takes about an hour on four nodes of eight A100-80GB GPUs, and the 110–185-step main runs represent roughly a week on that allocation.SWE-Proof steps take longer, principally because Nagini verification is roughly three times slower than Dafny verification and its programs are longer.Source: §F.4 · p. 33
G ANALYSIS
- The appendix analysis measures episode behavior from logged submissions containing verifier verdicts, audit verdicts, and program text.Its numbers come from the body-reported runs.Source: G ANALYSIS · p. 33
G.1 THE FROZEN PROOF SPECIALIST
The frozen proof specialist usually completes a proof when its assistance changes the score, with the largest run-level gains at larger model sizes and no detected shift in agent behavior. In patch generation, both held-out task trends are significant with the specialist, while neither is significant without it; the task combines verified code with a repository edit.
G.1 THE FROZEN PROOF SPECIALIST
- In 165 held-out episodes, assistance changed a failing candidate into a verifying one and never reversed that outcome; it changed 12.9% of scores, improving them by 1.97 reward units on average.The full-verification bonus is 2 reward units, so assistance usually completes the proof when it changes a score.Source: §G.1 · p. 33, Table 9 · p. 33
- 47.5% of assisted submissions return unchanged, 7.3% change and verify, and 43.7% change but still fail; implementation statements are almost never touched.When the specialist changes a candidate, assertions and loop invariants make up over a third of added lines, with the rest split among other proof annotations and reformatting.Source: §G.1 · pp. 33–34
- At 1.7B, runs are indistinguishable; the specialist’s gap is largest at 8B and 35B, at about five points.Table 10 reports held-out DafnyBench code-generation rates by model size.Source: §G.1 · p. 34, Table 10 · p. 34
- Turns, submissions, response length, entropy, and proof-line counts follow similar trends with and without assistance on both benchmarks.On DafnyBench, the assisted run submits slightly less often; its 7.00 proof lines per program versus 7.11 without assistance are not separable from noise.Source: §G.1 · p. 34, Figure 12 · p. 34, Figure 13 · p. 35
G.2 PATCH GENERATION
- Patch episodes add an issue report and project shell; each submission includes a Nagini program and repository patch, with a 24-turn budget.The agent can search, edit, and run existing repository tests, while the issue tests are absent from its checkout and excluded paths prevent changing test setup instead of source.Source: §G.2 · pp. 34–35
- The repository-edit score combines issue-test progress with regression protection, uses βresolve = 3.0, and is floored at −0.4.Both fractions are measured against the starting repository; the resolve bonus exceeds the full-verification bonus so the repository task contributes more to within-group reward differences.Source: §G.2 · p. 35
- With the specialist, both held-out patch-resolution and verification trends are significant; without it, neither trend is significant (verification p = 0.15; resolve is flat).The training resolve rate rises from 52.7% to 82.4% with the specialist and does not rise without it.Source: §G.2 · pp. 35–36, Table 11 · p. 36, Table 12 · p. 36
G.3 TRANSFER BEHAVIOR
This section examines how the trained checkpoint transfers across verification suites, including diagnostic-guided progress and direct repair under the integrity audit. An example shows the audit rejecting attempts to alter executable code, followed by a recovery that preserves the program and adds proof annotations, ending in full verification with all three probes passing.
G.3 TRANSFER BEHAVIOR
- Transfer gains were significant at 5% on HumanEval-Dafny and HumanEval-Verus code generation and 10% on HumanEval-Nagini; Verus code generation rose from 17.2% to 36.6%.The Verus result was the largest transfer gain despite an increase in unparseable turns, which the passage attributes to writing Rust and Verus syntax after training only on Dafny.Source: §G.3 · pp. 36–37
- Across six suite-task combinations, the trained checkpoint eliminated episodes with no submission; unparseable-turn shares fell in five, including HumanEval-Nagini code generation from 27.6% to 7.8%.The exception was HumanEval-Verus code generation: unparseable turns rose from 51.0% to 70.4%, and 91% of episodes hit the turn cap.Source: §G.3 · p. 37
- On HumanEval-Dafny code generation, multi-submit successes fell from 41.8% to 32.8% and mean submissions from 2.73 to 1.64; annotation repair instead needed 3.52 versus 1.96 submissions.Submission counts are among successful episodes; annotation repair's increase matches the training pattern of continuing to work on an instance rather than settling.Source: §G.3 · p. 37
H REPRESENTATIVE EPISODES
- The appendix presents nine verbatim held-out episodes spanning successful repairs, audit interventions, specialist assistance, and failures, with per-turn scores and provenance and outcome metrics.The logged obligation ratio can rise across turns before full verification is reached.Source: H REPRESENTATIVE EPISODES · pp. 37–38
H.1 ANNOTATION REPAIR: READING A DIAGNOSTIC AND REPAIRING THE INVARIANT
- In a held-out Dafny repair episode, the weighted obligation ratio rose from 0.33 to 0.67 to 1.0, and all four turns discharged both hidden probes.Verifier diagnostics exposed a false counter bound; replacing it with the counter-to-flag relationship and adding a loop-completion assertion led to verification.Source: §H.1 · p. 38
H.2 THE INTEGRITY AUDIT OVERRULING THE VERIFIER, AND RECOVERY
- The integrity audit rejected an empty program that the verifier accepted, penalized the destroyed specification, and then allowed recovery when the original program was restored and verified with all three hidden probes.The audit also rejected an earlier rewrite of the given loop as a clause-level change.Source: §H.2 · p. 42
- Score 3.0, full_verify 1.0, audit_failed 0.0, obligation_ratio 1.0, and probes_passed/total 3.0 / 3.0 were recorded in the final episode.The episode used 3 submits over 4 turns. The agent submitted the original code with an invariant annotation after recognizing it needed to preserve the code.Source: §H.2 · pp. 43, 46
- The audit rejected a candidate that changed the original for-loop into a while-loop and added a variable, despite the verifier also reporting an invariant failure.The audit requires the annotation agent to leave executable code unchanged; the verifier reported an invariant-on-entry failure and an index-out-of-range error.Source: §H.2 · p. 44
- After a postcondition failure, the agent identified that its invariant tracked output validity but not whether every processed even input had been added.It proposed an invariant connecting processed input indices to membership in the output, then aimed to submit the original code with only that annotation.Source: §H.2 · pp. 45–46
H.3 AN UNSOUND SHORTCUT, DETECTED AND PENALIZED
The verifier reports success on an impossible contract after the model uses an unchecked assumption, but the integrity audit rejects the candidate. The audit prevents the verifier’s apparent success from becoming a reward.
H.3 AN UNSOUND SHORTCUT, DETECTED AND PENALIZED
- The contract has no satisfying witness: it requires a value strictly between two bounds that admit none.The model attempts to close the gap with an unchecked assumption, which the audit rejects.Source: §H.3 · pp. 46, 49
- -3.0 is the final-episode score, with `full_verify = 0.0` and `audit_failed = 1.0`.The episode ends after two turns, with one candidate submission.Source: §H.3 · pp. 46–47
- The verifier reports every obligation discharged, but the audit rejects the candidate for using `assume false`, turning apparent success into an unsoundness penalty.A verifier-only reward would have paid the full bonus; the audit makes the sign flip.Source: §H.3 · pp. 46, 50
H.4 CODE GENERATION COMPLETED BY THE PROOF SPECIALIST
In a three-turn search episode, the agent changes from an unsound two-pointer scan to a correct nested-loop implementation with incomplete proof annotations. The specialist supplies the missing invariants and termination measures, allowing verification.
H.4 CODE GENERATION COMPLETED BY THE PROOF SPECIALIST
- The specialist adds missing loop invariants and termination measures to the correct implementation, which then verifies.The agent’s own candidate discharges two thirds of the weighted obligations but does not verify.Source: §H.4 · p. 50
- The agent’s initial two-pointer scan is unsound for an unsorted array, so it switches to a nested-loop search.The episode’s final implementation is correct, but its proof annotations remain incomplete until the specialist’s assistance.Source: §H.4 · p. 50
- 3.0 is the final episode score, with `full_verify = 1.0` and `audit_failed = 0.0`.The assisted score is 3.0, compared with a direct score of 0.667.Source: §H.4 · p. 51
H.5 A MATCHED PAIR, WITH THE PROOF SPECIALIST
On a selection-sort instance, the specialist adds one sortedness invariant and the program verifies. Without the specialist, the agent repeatedly fails to prove that same invariant despite an essentially correct implementation.
H.5 A MATCHED PAIR, WITH THE PROOF SPECIALIST
- One added invariant—that placed elements are no larger than those remaining—lets the selection-sort program verify.The model’s own submission fails on the outer loop’s sortedness invariant.Source: §H.5 · p. 54
- Without a specialist, the essentially correct implementation fails across five submissions on the same sortedness invariant, and the model scores nothing.Compared with the assisted episode, the missing invariant is the difference between failure and verification.Source: §H.5 · p. 54
- 3.0 is the assisted segment score, while the agent’s direct score is 0.0.The specialist’s annotations make the program verify.Source: §H.5 · p. 57
H.6 A MATCHED PAIR, WITHOUT THE PROOF SPECIALIST
This section presents repository-scale verification and code-generation episodes, including attempts that fail in the available verifier trace and candidates that verify or discharge hidden probes. The examples also show that a high proof-assisted score can accompany a diff that removes behavioral postconditions.
H.6 A MATCHED PAIR, WITHOUT THE PROOF SPECIALIST
- Without the proof specialist, the model exhausted its context after five submissions and scored 0.0, unable to prove the same sortedness invariant.The implementation was essentially correct from the first turn, but repeated rewrites never found the invariant.Source: §H.6 · pp. 57–58
H.7 REPOSITORY-SCALE ANNOTATION REPAIR IN A PERMISSION LOGIC
- Score 3.0, full_verify 1.0, and probes_passed/total 4.0 / 4.0 in the SWE-Proof annotation-repair episode.After an initial inspection turn, the model added a fractional read permission and functional invariant, then full write permission, then an index bound as requested by successive diagnostics.Source: §H.7 · p. 62
- In the permission-logic reversal task, the agent added permission and sequence loop invariants, but the shown verifier attempt still failed on the elements[i - 1] precondition.The contract requires the output sequence to equal the reversal of the input sequence while preserving fractional permission to the input.Source: §H.7 · pp. 63–65
H.8 REPOSITORY-SCALE CODE GENERATION, AND A HARMLESS BAD SUGGESTION
- The agent repaired two verifier failures by replacing mutation with functional construction, then replacing an untranslatable comprehension with a replicated literal; a malformed specialist suggestion scored negatively without reducing the episode score.The specialist's edited Python docstring failed to parse, and assistance could only raise the score, leaving the total unchanged.Source: §H.8 · p. 66
- The earlier list-comprehension candidate failed verification with an unsupported NoneType error.Source: §H.8 · p. 68
- A revised list construction received proof-assisted success with score 3.0000, while its annotation diff removed both behavioral postconditions.The removed clauses required an empty schedule when table identifiers match and a nonempty schedule when they differ.Source: §H.8 · p. 69
H.9 THE DOMINANT FAILURE MODE: EXHAUSTING THE TURN BUDGET
This section examines turn-budget exhaustion as a dominant failure mode: an audit-clean policy may earn partial credit and pass hidden probes yet fail to discharge the top-level postcondition. It also describes SWE-Proof’s per-instance test guarantee and notes that satisfying a contract does not ensure that it captures user intent.
H.9 THE DOMINANT FAILURE MODE: EXHAUSTING THE TURN BUDGET
- The agent repeatedly tried logically equivalent assertions for the same proof gap, cycling through verifier failures until it was cut off.Three turns are reproduced verbatim, with the remaining repetitive turns summarized by their annotations and verifier verdicts.Source: §H.9 · pp. 69–70
- Four submissions damaged the frozen program and were rejected by the audit, while two turns stalled without an action.The audit rejected edits to executable code and other non-annotation content, although the task allowed only proof-annotation changes.Source: §H.9 · pp. 69, 72
- 1.0 obligation_ratio and 2.0 / 2.0 probes_passed/total still yielded full_verify = 0.0 after 21 turns and 18 submissions.The agent identified the prefix-versus-whole-array multiset obligation but never found an assertion phrasing that proved the postcondition.Source: §H.9 · pp. 69–70
- At turn 21, the audit-clean submission discharged 2/2 hidden probes but failed the top-level postcondition, earning 1.0 partial credit rather than 3.0 for full verification.The episode ended because the maximum turn budget was reached.Source: §H.9 · p. 75
I ARTIFACTS, LICENSES AND INTENDED USE
- For all 500 SWE-Proof instances, each Nagini reference model verifies, its pre-patch model fails, and the instance resolves in the official SWE-bench harness, establishing that verification implies hidden tests pass.SWE-Proof pairs each SWE-bench Verified instance with a Nagini model of the behavior implemented by its reference patch; the underlying tasks remain unchanged and the verification layer is additive.Source: I ARTIFACTS, LICENSES AND INTENDED USE · p. 76
- The intended use is assistive, but a verified program satisfies only its contract; determining whether that contract fully states the desired behavior remains the human’s responsibility.A proof is accepted only when a verifier accepts it and an audit confirms the specification was not weakened.Source: I ARTIFACTS, LICENSES AND INTENDED USE · p. 76