arXiv:2610.36328cs.AIOct 2026

Manuscript Offprint

arXiv:2610.36328

How Stable Are LLM-Generated Proofs Under Program Refactoring? A Stress Test for Verifiable Code Generation

Aravind Mandiga, Guoming Li

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.

1 Introduction

A machine-checked proof establishes that an implementation satisfies its specification. That guarantee is strong, but it is usually evaluated on one fixed version of the program. Real programs are refactored, and proofs can break even when those changes preserve behavior. Proof maintenance is a longstanding problem in formal methods. A Lean user may expect some scripts that unfold definitions to break after helper extraction; the empirical question is whether this brittleness differs systematically across proof sources and transformation mechanisms. The new setting considered here is that language models now generate such proofs at scale, while current verifiable-code benchmarks still score whether a proof verifies once.

We introduce RefactorProof to measure this gap. A VERINA task contains an implementation C, a specification S, and a proof P. We mechanically construct a refactored implementation C′C', ask Lean to certify ∀xˉ.C(xˉ)=C′(xˉ)\forall \bar{x}. C(\bar{x}) = C'(\bar{x}) in a separate file, and then re-check the unchanged proof P against (C′,S)(C', S). The proof survival rate (PSR) is the fraction of certified refactorings of a task on which the same proof still verifies. RefactorProof uses five deterministic transformation families grouped into three operational classes: definitional (D), structural (S), and theorem-certified semantic (E). These

NeurIPS 2026 Workshop on AI for Verifiable Coding.

labels describe the source-level change being tested. They do not classify Lean’s definitional equality: T2 and T5 alter source structure even though Lean can reduce the transformed implementation to the original behavior definitionally.

Contributions. (i) A semantics-preserving evaluation in which only the implementation changes, while the specification and proof are byte-fixed and every retained transformation has a separate Lean certificate. (ii) RefactorProof, a benchmark of 458 certified variants, together with matched proof-survival comparisons and sensitivity analyses for proof selection, aggregation, common support, and certification artifacts. (iii) Artifact-level analysis of how proof strategies fail under different refactorings, plus a controlled mechanical-repair experiment that separates unchanged-proof stability from simple repair effort. We do not claim that proof brittleness itself is new. The supplied VERINA reference proofs are available for only 46 basic-split tasks, and the primary model-versus-reference comparisons match on 21–25 short, non-recursive tasks. We therefore interpret the source-level differences as comparisons of proof artifacts on this subset, not as checkpoint-wide robustness rankings over VERINA. Code, benchmark artifacts, and analysis scripts are available at https://github.com/aravind-mandiga/refactorproof.

References (38)