← All papers
First page of Proving the Coding Interview: A Benchmark for Formally Verified Code Generation

Proving the Coding Interview: A Benchmark for Formally Verified Code Generation

Quinn Dougherty, Ronak Mehta

cs.SE Feb 8, 2025 · v1
FVAPPS is a formal verification benchmark expressing coding-problem correctness as unproved Lean 4 theorems for models to prove.
We introduce the Formally Verified Automated Programming Progress Standards, or FVAPPS, a benchmark of 4715 samples for writing programs and proving their correctness, the largest formal verification benchmark, including 1083 curated and quality controlled samples. Previously, APPS provided a benchmark and dataset for programming puzzles to be completed in Python and checked against unit tests, of the kind seen in technical assessments in the software engineering industry. Building upon recent approaches for benchmarks in interactive theorem proving, we generalize the unit tests to Lean 4 theorems given without proof (i.e., using Lean's "sorry" keyword). On the 406 theorems of 100 randomly selected samples, Sonnet correctly proves 30% and Gemini correctly proves 18%. We challenge the machine learning and program synthesis communities to solve both each general purpose programming problem and its associated correctness specifications. The benchmark is available at https://huggingface.co/datasets/quinn-dougherty/fvapps.

Existing benchmarks for code generation verify programs against unit tests, which cannot guarantee correctness for all inputs. No large-scale benchmark existed for generating programs with machine-checked correctness proofs.

FVAPPS (Formally Verified Automated Programming Progress Standards) generalizes Python unit tests from the APPS benchmark into Lean 4 theorem statements. A pipeline converts APPS coding interview questions and solutions into Lean 4 definitions with associated correctness theorems. The benchmark includes 4715 samples (1083 curated and quality-controlled), making it the largest formal verification benchmark for code generation. Models must produce both code and proofs of correctness.

The benchmark contains 4715 samples with varying numbers of theorems per sample. Baseline evaluation shows Claude Sonnet solves 60 of 101 test samples and Gemini solves 43. Only 14 of 18 guarded (non-trivially verified) solutions from Sonnet are also plausible, indicating that current models often prove only trivial properties. The benchmark reveals that most model successes fall into categories like easy-branch-of-if, effectively-unit-test, or non-negativity-of-Nat.

CategorySonnetGemini
Unguarded4128
Guarded1211
Guarded and Plausible74
Total6043
Baseline model results on FVAPPS