LLM-Assisted Verification in Dafny
Wieger Wesselink, Kees Huizing, Huub van de Wetering
Abstract
Formal verification of complex algorithms requires expertise in program specification, invariant construction, mathematical proof, and the management of automated theorem provers. Although large language models (LLMs) can generate program code and proof fragments, reliably developing complete machine-checked verifications remains challenging: it requires an iterative process of constructing and validating specifications and invariants, building proofs, diagnosing solver failures, and optimizing verification performance. This paper presents a systematic ten-step workflow for LLM-assisted verification of scientific algorithms using the Dafny verification system. The workflow integrates algorithm formalization, contract development, empirical invariant validation, proof construction, bottleneck profiling, and resource-driven proof optimization. We applied the workflow using Antrhopic's Claude Opus 5 and Opus 5.5 models, combining LLM-driven development with automated testing and verification feedback, while retaining human oversight for correctness-critical decisions and strategic interventions. We evaluate the approach on 37 complex algorithms from graph theory and labelled transition systems. Notably, we verified the Hopfcroft-Tarjan triconnectivity test, demonstrating that even highly challenging algorithmic verification tasks can be carried out through a structured LLM-assisted workflow. Many of our machine-checked verifications were obtained within hours to a few days of interactive development. Our results suggest that LLM-assisted workflows can shift the role of the human verifier from detailed proof construction toward supervision, specification review, and strategic guidance.
Create a lesson
Related papers
LLM-Assisted Bi-Approximate CHC Solving
Shared title terminology · Baiting Jiang
Isabelle Pool Server: a pooled verification service for prover training and multi-agent proving
Shared title terminology · Xuanwei Ren, Wenda Li
RyBench: Runtime Verification Benchmarking Framework over Publish/Subscribe Networks
Shared title terminology · Mehmet Hilmi Dündar, Doğan Ulus
Plenty to FRET About: From Hazard Analysis to Formal Requirements for Robot-Assisted Dressing
Shared title terminology · Gunjari Chakraborty, Yasmin Rafiq, Hazel M. Taylor et al.
Verification-Guided Safety-Repair of Learned Controllers
Shared title terminology · Fabian Kresse, Sobhan Gharanfoli, Nikolaus Vertovec et al.
Sundance: A Simple SMT Solver for Program Verification
Shared title terminology · Amar Shah, Benjamin F. Jones, Can Cebeci et al.