How Stable Are LLM-Generated Proofs Under Program Refactoring? A Stress Test for Verifiable Code Generation
Organizations: University of Georgia, Athens, USA
Abstract
Benchmarks for verifiable code generation usually test a proof against one fixed implementation. We ask whether the same proof remains valid after a program refactoring that preserves behavior. We introduce RefactorProof, which derives 458 Lean-certified variants from the 185 VERINA tasks that compile in our pinned environment while holding the specification and evaluated proof fixed byte-for-byte. VERINA supplies reference proofs for 46 tasks, all from its basic split; the primary model-versus-reference comparisons further match on 21-25 short, non-recursive tasks. Structural refactorings expose substantial brittleness across proof sources: task-normalized structural PSR is 4.3% for the supplied references and 13.3-26.8% for the specialized provers. On the matched tasks, specialized prover proofs nevertheless have higher overall unchanged-proof survival than the supplied reference artifacts: +15.6 points for DeepSeek-Prover-V2-7B, +18.8 for Goedel-Prover-V2-32B, and +20.3 for Goedel-Prover-V2-8B; all three 95% CIs exclude zero. The ordering persists after excluding universally survived T1 variants, under family-balanced aggregation, and under alternative deployable valid-proof selection rules. However, unchanged-proof failure is not the same as high repair cost: predefined one-identifier edits repair 51/54 eligible reference structural failures and 58/85 eligible prover failures. RefactorProof therefore measures unchanged-proof stability under program refactoring, not the cost of maintaining a proof after it breaks.
Figures & tables
| Population / proof source | Tasks | Coverage@1 (%) | Coverage@5 (%) | Valid artifacts |
|---|---|---|---|---|
| VERINA source benchmark | 189 | – | – | – |
| RefactorProof construction | 185 | – | – | – |
| VERINA reference proofs | 46 | – | – | 46 supplied |
| DeepSeek-Prover-V2-7B | 31/189 | 12.7 | 16.4 | 111 |
| Goedel-Prover-V2-32B | 26/189 | 11.6 | 13.8 | 108 |
| Goedel-Prover-V2-8B | 29/189 | 9.5 | 15.3 | 100 |
| Transformation | Class | Applicable tasks | Candidates | Certified | Cert. rate (%) | rfl (%) | Tasks w/ variant |
|---|---|---|---|---|---|---|---|
| T1_let_intro | D | 181/185 | 181 | 180 | 99.4 | 100.0 | 180 |
| T2_helper_extract | S | 179/185 | 179 | 178 | 99.4 | 100.0 | 178 |
| T3_comm_swap | E | 77/185 | 122 | 50 | 41.0 | 4.0 | 34 |
| T4_cond_invert | E | 32/185 | 32 | 32 | 100.0 | 0.0 | 32 |
| T5_branch_extract | S | 18/185 | 18 | 18 | 100.0 | 100.0 | 18 |
| Panel A: Overall and transformation class | |||||||
| Proof source | C@1 | C@5 | Tasks | Overall PSR (%) [95% CI] | D | S | E |
| DeepSeek-Prover-V2-7B | 12.7 | 16.4 | 31 | 59.3 [52.4, 66.4] | 100.0 | 13.3 | 72.2 |
| Goedel-Prover-V2-32B | 11.6 | 13.8 | 26 | 64.5 [56.5, 72.8] | 100.0 | 26.0 | 67.6 |
| Goedel-Prover-V2-8B | 9.5 | 15.3 | 29 | 64.6 [57.8, 72.1] | 100.0 | 26.8 | 72.4 |
| reference | – | – | 46 | 47.9 [44.0, 52.0] | 100.0 | 4.3 | 44.2 |
| Model | Class | Matched tasks | Ref. PSR | Model PSR | PSR | 95% CI |
|---|---|---|---|---|---|---|
| deepseek-prover-v2-7b | all | 25 | 43.6 | 59.2 | +15.6 | [8.0, 24.3] |
| deepseek-prover-v2-7b | structural | 25 | 2.0 | 16.0 | +14.0 | [2.0, 30.0] |
| deepseek-prover-v2-7b | semantic | 15 | 35.6 | 73.3 | +37.8 | [13.3, 62.2] |
| goedel-prover-v2-32b | all | 21 | 43.5 | 62.4 | +18.8 | [10.1, 28.1] |
| goedel-prover-v2-32b | structural | 21 | 2.4 | 26.2 | +23.8 | [4.8, 45.2] |
| goedel-prover-v2-32b | semantic | 14 | 38.1 | 67.9 | +29.8 | [0.0, 58.3] |
| Proof source | unfold target (%) | simp[target] (%) | med. LoC | med. tactics | |
|---|---|---|---|---|---|
| deepseek-prover-v2-7b | 31 | 9.7 | 77.4 | 25 | 23 |
| goedel-prover-v2-32b | 26 | 0.0 | 84.6 | 36 | 33 |
| goedel-prover-v2-8b | 29 | 0.0 | 79.3 | 32 | 30 |
| reference | 46 | 97.8 | 2.2 | 11 | 12 |
| Setting | Comparison level | Group A | Group B | Evidence |
|---|---|---|---|---|
| Structural | task | rfl bridge: 6/6 | other: 6/31 | Fisher |
| Structural | same variant | rfl bridge: 9/9 | other: 2/9 | 6 variants, 5 tasks |
| Semantic | task | rfl bridge: 0/3 | simp[f]: 17/19 | Fisher |
| Semantic | same variant | rfl bridge: 0/4 | simp[f]: 3/5 | 3 variants |
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | First valid | Shortest valid | Random valid | All valid |
|---|---|---|---|---|
| DeepSeek-Prover-V2-7B | +15.6 | +11.3 | +15.6 | +15.5 |
| Goedel-Prover-V2-8B | +20.3 | +22.4 | +20.7 | +20.7 |
| Goedel-Prover-V2-32B | +18.8 | +24.5 | +20.9 | +20.9 |
| Model | Tasks ( valid) | Identical (%) | PSR range | range | range | Within-var. share (%) | first–mean |
|---|---|---|---|---|---|---|---|
| DeepSeek-7B | 26 | 46 | 17.4 | 48.0 | 35.3 | 41 | 6.7 |
| Goedel-8B | 25 | 44 | 15.1 | 36.0 | 45.4 | 29 | 4.7 |
| Goedel-32B | 24 | 29 | 22.4 | 54.2 | 55.9 | 54 | 8.6 |
| Proof source | Rate (%) | 95% CI |
|---|---|---|
| VERINA supplied reference | 12.2 | [9.0, 15.5] |
| DeepSeek-Prover-V2-7B | 10.2 | [6.8, 13.8] |
| Goedel-Prover-V2-8B | 10.4 | [6.9, 14.2] |
| Goedel-Prover-V2-32B | 9.3 | [5.9, 13.0] |
| Analysis | DeepSeek-7B | Goedel-8B | Goedel-32B |
|---|---|---|---|
| Exclude T1 | +24.3 [11.5, 38.9] | +32.9 [18.4, 48.6] | +31.3 [15.7, 48.7] |
| Family-balanced within task | +13.7 [6.8, 21.5] | +18.6 [10.9, 26.6] | +17.3 [9.2, 26.2] |
| Exclude T1 and T2 | +28.7 [13.3, 46.0] | +30.7 [4.0, 54.7] | +20.7 [-4.3, 45.7] |
| Common task-family support | +17.4 [8.3, 26.8] | +21.1 [12.3, 30.2] | +18.8 [9.9, 27.8] |
| Model | Class | Tasks | Model higher | Reference higher | Tie | PSR |
|---|---|---|---|---|---|---|
| DeepSeek-7B | all | 25 | 10 | 0 | 15 | +15.6 |
| DeepSeek-7B | structural | 25 | 5 | 1 | 19 | +14.0 |
| DeepSeek-7B | semantic | 15 | 6 | 0 | 9 | +37.8 |
| Goedel-8B | all | 23 | 12 | 0 | 11 | +20.3 |
| Goedel-8B | structural | 23 | 6 | 1 | 16 | +21.7 |
| Goedel-8B | semantic | 15 | 8 | 1 | 6 | +42.8 |
| Population | Tasks | Basic (%) | Recursive (%) | Med. impl. LoC | Med. postcond. LoC | T3 (%) | T4 (%) | T5 (%) |
|---|---|---|---|---|---|---|---|---|
| Construction population | 185 | 58 | 42.2 | 6 | 3 | 18 | 17 | 10 |
| Supplied-reference subset | 46 | 100 | 6.5 | 1 | 2 | 24 | 26 | 24 |
| Matched, DeepSeek-7B | 25 | 100 | 0.0 | 1 | 1 | 36 | 32 | 32 |
| Matched, Goedel-8B | 23 | 100 | 0.0 | 1 | 1 | 39 | 35 | 35 |
| Matched, Goedel-32B | 21 | 100 | 0.0 | 1 | 1 | 43 | 33 | 33 |
| Model | Family | Matched tasks | PSR | 95% CI |
|---|---|---|---|---|
| DeepSeek-Prover-V2-7B | T2 | 25 | +12.0 | [0.0, 24.0] |
| Goedel-Prover-V2-8B | T2 | 23 | +21.7 | [4.3, 39.1] |
| Goedel-Prover-V2-32B | T2 | 21 | +23.8 | [9.5, 42.9] |
| DeepSeek-Prover-V2-7B | T3 | 9 | +33.3 | [0.0, 66.7] |
| Goedel-Prover-V2-8B | T3 | 9 | +40.7 | [-3.7, 81.5] |
| Goedel-Prover-V2-32B | T3 | 9 | +25.9 | [-14.8, 66.7] |
| Source / template | Repaired | Attempted |
| Reference | 51 | 54 |
| DeepSeek-Prover-V2-7B | 21 | 32 |
| Goedel-Prover-V2-8B | 19 | 28 |
| Goedel-Prover-V2-32B | 18 | 25 |
| dsimp add helper | 40 | 45 |
| simp add helper | 16 | 37 |
Code Generation Evaluation
Code generation evaluation measures whether AI-produced programs are correct, reliable, secure, efficient, and faithful to their specifications.
See all 215 papers