Goedel-Code-Prover: Hierarchical Proof Search for Open State-of-the-Art Code Verification
Organizations: ETH Zürich · Princeton Language and Intelligence · Department of Computer Science, Princeton University · Apodex
Abstract
Large language models (LLMs) can generate plausible code but offer limited guarantees of correctness. Formally verifying that implementations satisfy specifications requires constructing machine-checkable proofs, a task that remains beyond current automation. We propose a hierarchical proof search framework for automated code verification in Lean~4 that decomposes complex verification goals into structurally simpler subgoals before attempting tactic-level proving. Central to our approach is a principled decomposition score that combines constructive justification with structural effectiveness. The same score serves as both the training reward and the inference-time ranking criterion, aligning optimization and deployment. We train Goedel Code Prover, a single unified policy for both decomposition and completion, through supervised initialization followed by hybrid reinforcement learning, where a continuous decomposition reward supports planning exploration while supervised replay stabilizes proof generation. On three Lean-based code verification benchmarks comprising 427 tasks, our 8B-parameter model achieves a 62.0% prove success rate, a 2.6 improvement over the strongest baseline under the reported inference settings. We further observe consistent inference-time scaling: success rates improve monotonically with search iterations and sampling budget, while whole-proof baselines plateau within the evaluated budgets.
Figures & tables
| Model | Pass@1 | Pass@10 | Pass@20 | Pass@32 |
| SFT only | 26.9 | 44.9 | 53.9 | 66.1 |
| SFT + RL | 29.1 | 46.0 | 57.1 | 68.8 |
| Difference | +2.2 | +1.1 | +3.2 | +2.7 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Decomposition | Completion | Verina |
| — | GPT-OSS-120B | 20.1 |
| — | Gemini-3-Flash | 19.6 |
| GPT-OSS-120B | GPT-OSS-120B | 44.9 |
| GPT-5.2-Pro | Gemini-3-Flash | 54.4 |
| Threshold | Verina | Clever | AlgoVeri | Total |
| chars | 7 | 5 | 1 | 13/427 |
| chars | 3 | 0 | 0 | 3/427 |
| chars | 0 | 0 | 0 | 0/427 |
| Theorem class | Cases | Representative examples (reduction ratio) | |
| Hoare-style program correctness (CSLib) | 14 | 9 | otp_ciphertextDist_eq_uniform (0.872), mergeSort_sorted (0.502), toNAFinAcc_language_eq (0.492), Shamir privacy (0.154), and pred_correct for SKI (0.112) |
| Type-safety theorems (CSLib) | 3 | 0 | STLC/Fsub preservation and progress statements |
| Structural and categorical theorems (CSLib) | 5 | 0 | LTS composition, Turing-machine composition, -regular complement, CLL -expansion, and infinite Ramsey |
| Pure mathematics (Mathlib) | 10 | 0 | Lagrange, Beatty, Hensel, Siegel, Kronecker, Shortlex, Lucas–Lehmer, and related theorems |
| Statistics | Verina | Clever | AlgoVeri | Total |
| Lemma count (mean) | 17.02 | 12.13 | 8.48 | 14.38 |
| Lemma count (std) | 11.79 | 10.57 | 10.97 | 11.97 |
| Proof length (mean) | 167.11 | 137.78 | 129.87 | 154.28 |
| Proof length (std) | 108.50 | 97.79 | 83.03 | 103.11 |