🤖 AI Summary
This work addresses the challenge of simultaneously generating executable code and formal verification artifacts—such as invariants, assertions, and termination proofs—in Dafny. It proposes a verifier-guided repair framework that, for the first time, deeply integrates agent-driven code generation with Dafny’s formal verification capabilities. By establishing an iterative feedback loop between a large language model and the Dafny verifier, the approach co-generates program implementations and their accompanying verification constructs. The study also introduces LCB-Pro-Dafny, the first Dafny verification benchmark tailored to competition-level problems. Experimental results demonstrate that the method achieves a 92.7% verification success rate on DafnyBench, surpassing the previous state-of-the-art baseline by 6.5 percentage points, while further revealing an orthogonality between verification success and runtime test performance.
📝 Abstract
We study agentic code generation in Dafny, where a model must generate both executable code and the proof artifacts for verification. We present AxDafny, a verifier-guided repair framework that iteratively generates implementations, invariants, assertions, and termination arguments. We also introduce LiveCodeBench-Pro-Dafny (LCB-Pro-Dafny), a benchmark of 250 competition-style programming problems translated into Dafny with formal specifications and a verifier-based evaluation harness. On LCB-Pro-Dafny, AxDafny substantially improves verification success over baseline GPT-5.5 performance. On DafnyBench, AxDafny achieves 92.7\% verification success, outperforming the strongest previously reported proof-hint baseline by 6.5 percentage points. Lastly, we show that verification success and runtime test performance measure different aspects of generated code.