P3: Joint Program-and-Proof Planning for Verified Code Generation
Zenan Li, Ziran Yang, Peiyang Song, Zhaoyu Li, Kaiyu Yang
NeurIPS page · Open on the map
Category: LLM Agents, Evals & Benchmarks › Verified Code Synthesis and Testing · Type: new method · Keywords: verified code generation, program-and-proof planning, LLM agentic workflow, formal verification, benchmark Lean4Commit0
Areas: Code & Coding Agents › Code Verification › Verified code generation; AI Agents › Agent Benchmarking › Agentic code and proof generation; Evaluation & Benchmarks › Language Model and Agent Benchmarks › Formal Verification Benchmarks
Summary
P³ introduces a joint program-and-proof planning framework that derives a unified plan before generating code and proofs, improving verified code generation solve rates and efficiency.
Explained to a 5-year-old
Computers write code that should do exactly what it is supposed to do. They also write a proof, which is like a step-by-step explanation that the code works. Usually they write the code first, then try to write a proof later, and the proof often fails, so they have to fix both many times. This paper says we should plan both the code and its proof together from the start, like drawing a complete picture before building. Then a special computer program helps the AI think out this plan together. After the plan is ready, the AI writes the code and the proof following the same ideas, so they match each other. This makes the code more likely to be correct the first time and saves time.
Explained to a 5-year-old, longer
Computers can write small pieces of code, but they also need to make sure the code does exactly what it should do. To be sure, they also write a proof, which is like a step-by-step explanation that the code works. Usually people tell the computer to write the code first, and then later try to write a proof for it. This can be slow and often the proof fails, so the computer has to go back and fix both the code and the proof many times. The paper says this is like trying to build a house without a blueprint; it often ends up wobbly. Instead, they suggest making a plan that includes both the code and its proof from the start, like drawing a complete picture before starting to build. Then a special computer program helps the AI think out this plan together. After the plan is ready, the AI writes the code and the proof following the same ideas, so they match each other. This way the code is more likely to be correct the first time, and the proof can be written more easily. Because the code and proof are planned together, the computer needs fewer tries, which saves time and money. The researchers tested this idea on several tasks and found it works better than the old way, fixing both the code and the proof faster and with fewer mistakes.
For a technical reader
The paper addresses the inefficiency of sequential program synthesis and proof generation by introducing a unified planning step. An LLM-based agent first creates a joint program-and-proof plan from the specification, then follows that plan to generate both code and proof scaffolds. This coordinated approach reduces repair loops, improves solve rates, and cuts computational cost. Evaluations on Verina, AlgoVeri, and the new Lean4Commit0 benchmark show consistent gains over strong baselines.
Problem
Verified code generation requires producing both correct programs and machine-checkable proofs, but existing sequential approaches that first generate code then attempt proof can be ineffective and inefficient.
Method
The approach derives a unified program-and-proof plan from the specification and then elaborates both the implementation and proof scaffold under this shared plan.
Results
The approach achieves the highest solve rates across benchmarks, improving over the stronger baseline by 4.6-11.2 percentage points and reducing per-task API cost by up to 40% and wall-clock time by up to 37% on the difficult subset.
Contributions
It introduces a joint program-and-proof planning workflow that co-develops code and proofs from a unified plan, and it provides Lean4Commit0, a project-level benchmark reflecting real-world API specifications.
Practical relevance
It enables more efficient and reliable generation of formally verified software, reducing development cost and time.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction