Assessing LLM Program Reasoning through Equivalence Proofs
Organizations: University of Alberta, Canada · Simon Fraser University, Canada · Also with Alberta Machine Intelligence Institute (Amii).
Abstract
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
| \frac{\begin{array}[]{c}C\equiv C_{1};C_{2}\hskip 18.49988ptD\equiv D_{1};D_{2}\\[2.84526pt] {\Gamma}_{1}\vdash_{\text{{C}}}C_{1}\sim D_{1}:\Phi_{1}\Rightarrow\Phi_{1}^{\prime}\hskip 18.49988pt{\Gamma}_{2}\vdash_{\text{{C}}}C_{2}\sim D_{2}:\Phi_{2}\Rightarrow\Phi_{2}^{\prime}\\[2.84526pt] \vdash\Phi\leq\Phi_{1}\hskip 18.49988pt\vdash\Phi_{1}^{\prime}\leq\Phi_{2}\hskip 18.49988pt\vdash\Phi_{2}^{\prime}\leq\Phi^{\prime}\end{array}}{{\Gamma}_{1}\cup{\Gamma}_{2}\vdash_{\text{{C}}}C\sim D:\Phi\Rightarrow\Phi^{\prime}}\;[\text{{Sequential Composition}}] |
| 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 |
| 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% |
| 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 |
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%) |
| 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 (3.00 output per 1M tokens) | $449 |
| Total | $3,882 |