cs.SEOct 31, 2025

DAISY: Fault-Guided Assertion Inference for Dafny

Authors: Álvaro Silva, Alexandra Mendes, Ruben Martins

Organizations: INESC TEC, Faculty of Engineering, University of Porto, Portugal · Computer Science Department of Carnegie Mellon University, USA

Abstract

Formal verification with Dafny provides strong correctness guarantees, but verification failures often require users to determine where helper assertions are needed and to manually write the assertions necessary for verification to succeed. This proof-engineering burden is difficult, time-consuming, and a barrier to the adoption of verification-aware languages. We present DAISY (Dafny Assertion Inference SYstem), a tool for fault-guided assertion inference in Dafny. Given a Dafny program and a target method, DAISY localizes likely assertion sites using verifier diagnostics, LLM-based localization, or their combination. It then annotates the program with assertion placeholders, retrieves relevant in-context examples, generates candidate assertions with an LLM, and validates candidates by running the Dafny verifier. To evaluate DAISY, we extend DafnyBench with verification-failing variants created by removing helper assertions from verified programs. The resulting benchmark distinguishes between programs with one missing assertion, two missing assertions, and all assertions removed, allowing us to evaluate DAISY on increasingly difficult proof failures. On this benchmark, DAISY verifies 86% of programs with a single missing assertion and 36% of programs with two missing assertions. These results show that fault-guided LLM assertion inference can repair many Dafny verification failures. They also show that successful repairs often differ from the original assertions, reducing proof-engineering effort without reconstructing the original proof.

Figures & tables

Explore similar work

CardsList
  1. AxDafny: Agentic Verified Code Generation in Dafny

    Jun 30, 2026Benjamin Breen, Austin Letson, Borja Requena Pozo +1Code GenerationFormal Verification

  2. LLM-Assisted Verification in Dafny

    Nov 12, 2026Wieger Wesselink, Kees Huizing, Huub van de WeteringFormal VerificationLarge Language Model-Guided Theorem Proving