TL;DR
CLEVER is a curated benchmark of 161 programming problems adapted from HumanEval to evaluate end-to-end verified code generation in Lean 4. By requiring machine-checked proofs for both specification fidelity and program correctness—and enforcing non-computable specifications to prevent shortcutting—it exposes a massive capability gap: state-of-the-art LLMs and proof agents solve at most 1 out of 161 problems end-to-end.
What Problem Does This Paper Address?
Software verification using interactive theorem provers (ITPs) like Lean, Coq, or Isabelle delivers unmatched guarantees against bugs, but writing formal specifications and proofs by hand is notoriously expensive (e.g., the verified seL4 microkernel took over 20 person-years).
While AI has made rapid strides in unverified code generation and formal pure mathematics, existing benchmarks for verified code generation (such as FVAPPS) have major flaws:
- Loose specifications: They verify only partial properties (e.g., upper/lower bounds), allowing trivial solutions—like a function that always returns
0—to pass. - Leaky specifications: Specifications are often written as computable functions. LLMs can simply copy the specification's logic into their implementation and complete the "proof" using trivial rewriting tactics (
simporrfl).
CLEVER resolves these loopholes by introducing a rigorous, complete, and leak-proof evaluation pipeline.
Methods
CLEVER evaluates models through a two-stage, four-step pipeline:
Natural Language Prompt (ν)
│
├──► Stage 1: Specification Certification
│ 1. Generate formal Lean spec (ψ)
│ 2. Prove ψ ↔ ψ* (isomorphic to hidden ground-truth spec)
│
└──► Stage 2: Implementation Certification
3. Generate Lean implementation (π) matching signature
4. Prove π satisfies ψ* (correctness proof)
Both proofs must pass Lean 4's kernel type checker within a 600-second timeout budget.
Non-Computable Specs as Guardrails
To prevent models from copying logic, ground-truth specifications are authored as non-computable logical propositions (Prop) using inductive predicates, existential quantifiers, and algebraic relations rather than executable code. Because Lean cannot mechanically evaluate or reduce these propositions directly, models cannot rely on reflexivity or trivial simplification tactics; they must engage in explicit symbolic and deductive reasoning.
Datasets
- CLEVER (Core Benchmark): 161 programming tasks adapted from HumanEval's 164 problems into Lean 4. Each problem includes a natural language description, a non-computable formal specification, target signatures, and theorem definitions. (3 problems were excluded due to dynamic typing like Python's
Any, built-in runtime features likeeval, or missing cryptography libraries for MD5). - Auxiliary Few-Shot Set: 5 hand-curated programming problems outside HumanEval with complete human-written implementations and proofs (some spanning over 300 lines) for prompt engineering and in-context learning.
Key Insights and Ideas
- Syntax is solved, semantics is not: LLMs are fluent at Lean 4 syntax—models regularly achieve 80–90% compilation rates for specifications and implementations. However, kernel-checked semantic verification rates fall below 10%.
- Program proofs are fundamentally different from math proofs: Unlike math competition benchmarks (e.g., MiniF2F), where proofs are often flat and amenable to arithmetic solvers (
linarith,ring), software proofs mirror program control flow. They require step-by-step case analysis over pattern matches, structural induction, recursion unrolling, and loop/fuel invariants. - Spec equivalence is harder than implementation correctness: Proving specification isomorphism requires abstract reasoning about semantic equivalence without concrete implementation clues. Across models, spec equivalence proofs were significantly longer and harder to find than implementation correctness proofs.
- The "joint success" bottleneck: Tasks where models successfully certify specifications rarely overlap with the tasks where they can prove implementation correctness.
Key Results
The authors evaluated few-shot frontier models (GPT-4o, o4-mini, Claude-3.7, DeepSeek-R1), the neuro-symbolic agent COPRA, and prover architectures like KiminaProver-7B:
| Method / Model | Spec Compiled | Spec Proved | Impl Compiled | Impl Proved | End-to-End Success |
|---|---|---|---|---|---|
| GPT-4o (Few-Shot) | 84.5% | 0.6% | 68.3% | 0.6% | 0.0% (0/161) |
| o4-mini (Few-Shot) | 82.6% | 1.2% | 83.2% | 1.9% | 0.6% (1/161) |
| Claude-3.7 (Few-Shot) | 87.0% | 0.6% | 65.2% | 1.9% | 0.6% (1/161) |
| DeepSeek-R1 (Few-Shot) | 71.4% | 0.6% | 60.9% | 5.6% | 0.6% (1/161) |
| Claude-3.7 + COPRA | 81.4% | 1.2% | 65.2% | 8.7% | 0.6% (1/161) |
| GPT-5-mini + Kimina | 90.1% | 0.0% | 84.5% | 0.6% | 0.0% (0/161) |
- Across all tested configurations, only a single problem (Problem 53: "Add Two Numbers") was ever solved end-to-end, where algebraic structure could be solved via
simpandring. - Claude-3.7 paired with COPRA achieved the highest implementation certification (14 problems, 8.7%), including a 35-line proof for recursive Brazilian factorials, but struggled to prove spec equivalence within time limits.
Limitations and Future Work
- Language & Typing Constraints: Static typing in Lean 4 prevented 3 HumanEval tasks from being cleanly represented without arbitrary encoding compromises.
- Proof Search Timeouts: A 600-second wall-clock budget restricts deeper, multi-branch neuro-symbolic search for complex recursive tasks.
- Future Directions: Developing specialized agents capable of decomposing program-structured proofs (handling recursion and induction invariants) rather than purely linear mathematical tactics. Additionally, verified model-generated specification pairs present a promising mechanism for bootstrapping high-quality synthetic training data.
Summary updated