Language models increasingly optimize and migrate code, and trusting these rewrites requires independently checkable arguments that they preserve program behavior. We ask whether models can construct such arguments as equivalence proofs. We propose a lightweight textual proof format based on relational Hoare logic, with automatic checks of intermediate claims and their compositions. Models may leave claims underived as explicit assumptions, keeping partial proofs checkable while recording how much of each argument they derive. We evaluate five models on 200 equivalent program pairs in two imperative languages with unfamiliar syntax and guard semantics. In free-form reasoning, every model reaches the correct verdict on at least 66% of tasks, yet proof acceptance without feedback ranges from 36% to 94%. A verifier-assisted workflow uses the checks to guide proof refinement, raising overall acceptance from 56.4% to 80%, with the two strongest models exceeding 97%. Proof records also reveal what acceptance rates alone obscure: among accepted proofs, some models derive nearly every step, while others leave most of the argument as explicit assumptions. How these models fail to construct a valid proof gives a profile on their relative strengths and weaknesses.
Figures & tables
Figure 2. Excerpts from one free-form answer by each model, verbatim (both EQUIVALENT ). We add, in the right margin, the questions a reader must answer to check these steps. Quoted argument steps from the two models, each with a margin question in red. Opus: step 4, the inner-loop coupling, with no question; step 5, equality of x and y at each outer-loop head, with question 1, whether it can hold together with step 6, which puts the source's reset before H and the target's after it; step 6, the reset timing. Sol: step 3, each pixel starts with zeros in both programs, with question 2, starts where; steps 4 and 6, which rest on step 3, with question 3, under which reading; step 7, induction over pixels, with question 4, which relation at H, never stated.
Figure 3. A reconstructed run ( cx=1 , cy=0 , width=2 , maxit=3 , bound=100 ). The programs are aligned at visits to H ; badges give (x,y) as source | target. Boxes name fragments of Figure 1 ; dashed boxes mark resets skipped by their tests, and inner-loop boxes list z , which remains real because cy=0 . The second visit exposes the between-pixel case behind questions 1 and 2 . A two-row timeline of one run of the source and target, aligned at three visits to the outer-loop head H. Source: A1, then B1, C1 (z goes to 1, 2, 5), D1, R1; then B1, C1 (z goes to 2, 6, 38), D1, and a skipped R1. Target: A2, a skipped R2, B2, C2, D2, F2; then R2, B2, C2, D2, F2. Above the visits, the case of the relation at H: first pixel, reset pending, after the last pixel. Below them, (x, y) in source and target: (0,0) and (0,0); (0,0) and (5,0), marked red, where Opus's step 5 fails and Sol states nothing; (38,0) in both. After the target's R2 in the second pixel, both are (0,0), where Sol's step 3 holds.
Figure 4. Opus’s derivation for the pair (outline of 87 steps). Each row relates two fragments of Figure 1 and is checked automatically ( √ ); indented rows make up one iteration of the outer loops. A table of the judgments in Opus's derivation, with columns for the fragments, the precondition and postcondition, a check mark, and the question of Figure 2 that the row answers. Rows: A1 with A2; the outer loops by the while rule with invariant I, answering question 4, the relation at H, and noting that with Opus's step 5 in its place the check fails; indented, skip with R2, answering question 2, since starting with zeros is its postcondition after R2; B1 with B2, the link Sol's step 4 rests on; C1 with C2 by the while rule; D1 with D2; R1 with F2, the reset timing of step 6; then the loop exit. Below, the invariant I is defined with three cases (first pixel, reset pending, after the last pixel), followed by K, E, Z and G.
Figure 5. Rules of the composition proof framework. Sequential and Conjunctive Composition combine established claims and collect their assumptions. Embed and Oracle connect composition to local proofs and assertion checks. Assumption and Obligation Discharge record and resolve hypotheses within local proofs. Six inference rules in order: Sequential Composition, Conjunctive Composition, Embed and Oracle on one line, Assumption, and Obligation Discharge. Each rule shows its premises above its conclusion.
ProcLang - Obs
ProcLang - alt
Execution
Equivalence
Execution
Equivalence
Model
Outputs
Rule F1
Free-form
Proof
Outputs
Rule F1
Free-form
Proof
GPT-6.1-Sol
100
100.00
100
94
99
97.88
100
94
Opus-5.5
96
99.79
99
59
93
76.86
83
50
GLM-5.3
72
93.79
93
53
55
58.76
80
53
GPT-6-Luna
83
95.41
91
45
73
87.45
66
36
Table 1. Execution, free-form decisions, and proof construction without feedback on 100 program pairs per model and language. Outputs is pair execution accuracy; Rule F1 measures agreement in rule-application counts. Free-form is decision correctness in free-form reasoning. Proof scores the first response after deterministic JSON cleanup, before model feedback or refinement. All numeric entries are percentages.
Model
Agreement
GPT-6.1-Sol
99.98%
Opus-5.5
99.97%
GLM-5.3
97.93%
GPT-6-Luna
98.23%
Qwen3.8-27B
96.21%
Overall
98.82%
Table 2. LLM–cvc5 agreement on the first composed proof (%).
Figure 7. Proof correctness with and without verifier feedback on 100 tasks per model and language. Unassisted results score the first response; assisted results score the selected final proof. Two panels compare first-response and selected-final proof correctness. On ProcLang-Obs, Sol improves from 94 to 99 percent, Opus from 59 to 99, GLM from 53 to 79, Luna from 45 to 73, and Qwen from 39 to 46. On ProcLang-Alt, the respective changes are 94 to 100, 50 to 96, 53 to 80, 36 to 74, and 41 to 51 percent.
Syntax
Derivation validity
Completeness
Task goal
Model
Malformed
Rule
Claim
Connection
Unlinked
Mismatch
GPT-6.1-Sol
1
6
2
3
1
0
Opus-5.5
58
2
7
5
23
5
GLM-5.3
51
11
32
3
2
10
GPT-6-Luna
44
77
31
29
57
21
Qwen3.8-27B
76
25
16
3
4
10
Table 3. Proof diagnostics per model over 200 tasks (100 per language): tasks whose first response has each outcome, grouped by the criteria of Section 4.2 . A proof can have several outcomes.
Figure 8. Proof acceptance versus the share of statement occurrences covered by assumptions in accepted proofs, pooled over both languages. Panels (a,b) score first responses. Panels (c,d) count a task as accepted if any composed iteration passes and measure coverage in its first accepted iteration. Left: overall results over 200 tasks per model; right: results by insertion count. Ranges pool the indicated insertion counts; unlabeled markers in (d) pool all three. Lower right indicates higher acceptance and a smaller assumed share. Four scatter plots compare proof acceptance and assumed statement share. Assistance increases acceptance for every model. GLM's assumed share falls substantially, from 77.4 to 23.2 percent. Luna and Qwen also improve, but their accepted assisted proofs still leave 76.4 and 74.6 percent of statements to assumptions. Sol and Opus have the smallest assumed shares under both protocols. By insertion count, unassisted Opus acceptance falls from 72.9 to 27.6 percent, while Luna acceptance rises from 28.6 to 50.0 percent as its assumed share rises from 83.3 to 97.6 percent.
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
Feedback type
Information returned
Runs
Final passes
Response format
JSON or response-schema error; requests a corrected submission.
393
231 (58.8%)
Judgment syntax
Identifies a proof judgment that cannot be parsed.
179
76 (42.5%)
Rule application
Explains mismatches in rule applications or parsing errors in side conditions.
669
473 (70.7%)
Premise linkage
Identifies a premise with no matching earlier conclusion.
194
120 (61.9%)
Task goal
Identifies a mismatch between the final judgment and the required whole-program goal.
40
17 (42.5%)
Assumed judgment
Identifies a refuted assumed judgment and the postcondition conjuncts that fail.
210
98 (46.7%)
Appendix
Table 4. Feedback supplied during assisted generation and the resulting selected-final proof correctness. Runs are counted once per category among the 1,000 model–task evaluations; categories overlap. Percentages use the receiving runs in that row as the denominator. Response-format feedback includes parsing repair in recursive refinement calls.
Figure 10. Refinement reduces the code covered by assumptions in a GLM proof on ProcLang - alt . Before refinement, the proof joins four pieces of the programs by sequential composition, and one assumption covers the initializations and the loop (26 command occurrences). A 29-step sub-proof replaces it; its tree, shown with each judgment above its premises, derives everything except two smaller assumptions covering eight occurrences. Shading marks assumptions; counts include both programs.
Model
Price basis
Cost
GPT-6.1-Sol
OpenAI list price
$239
GPT-6-Luna
OpenAI list price
$19
Opus-5.5
Anthropic list price
$1,321
GLM-5.3
Tinker’s 256K-context price
$1,854
Qwen3.8-27B
Alibaba Cloud’s API rate (0.50input,3.00 output per 1M tokens)
$449
Total
$3,882
Appendix
Table 5. Cost of the experiments by model, at list prices.
Large Language Models (LLMs) have shown promising results in automating formal verification. However, existing approaches treat proof generation as a static, end-to-end prediction over source code, relying on limited verifier feedback and lacking access to concrete program behaviors. We present EXVERUS, a counterexample-guided framework that enables LLMs to reason about proofs using behavioral feedback via counterexamples. When a proof fails, EXVERUS automatically generates and validates counterexamples, and then guides the LLM to generalize them into inductive invariants to block these failures. Our evaluation shows that EXVERUS significantly improves proof accuracy, robustness, and token efficiency over the state-of-the-art prompting-based Verus proof generator.
Jun Yang, Yuechun Sun, Yi Wu +5
The University of Chicago · Purdue University · The University of Toronto +1
We introduce a self-play framework for semantic equivalence in Haskell, utilizing formal verification to guide adversarial training between a generator and an evaluator. The framework leverages Liquid Haskell proofs for validating equivalence and execution-based counterexamples for inequivalence, organized via a difficulty-aware curriculum. To facilitate this, we release OpInstruct-HSx, a synthetic dataset of ≈28k validated Haskell programs. Empirical experiments show that our evaluator transfers effectively to downstream tasks, achieving up to 13.3pp accuracy gain on EquiBench and consistent gains on PySecDB. Ablation studies on the SEQ-SINQ regimes indicate that while inequivalence supervision provides data volume, equivalence proofs are uniquely responsible for the model's reasoning capabilities. The entire training pipeline and dataset are publicly released on GitHub and Hugging Face respectively.
Large language models (LLMs) are increasingly deployed for natural-language logical reasoning, where the final answer is easy to check but the proof behind it is not. In natural-language logical reasoning, an intermediate conclusion should follow from its premises, and the resulting derivation should support the final answer. Existing methods lack machine-checkable verification of intermediate conclusions and answer-supporting proof dependencies, so they may assign credit to invalid or answer-irrelevant steps. We propose Proof-R1, an RL framework from formal verification that trains LLMs to construct verifiable proofs for natural-language logical reasoning. Proof-R1 admits a generated conclusion into the verified proof state only when the corresponding reasoning action satisfies the proof obligations through UNSAT-based machine-checkable formal verification. Proof-R1 also recovers the answer-supporting dependency closure to trace the proof structure of the final answer and align outcome credit with the proof dependencies. Experiments demonstrate that Proof-R1 improves answer accuracy across three logical reasoning benchmarks and four backbone models and outperforms training-free agents and training-based methods in terms of reasoning-process verifiability.
Qili Zhang, Qianren Mao, Hanze Cai +11
Zhongguancun Laboratory · Beihang University · Nanyang Technological University +1