Specification-Guided Repair of Arithmetic Errors in Dafny Programs using LLMs
Not on the map. Why?
Abstract (arXiv)
Debugging and repairing faults when programs fail to formally verify can be complex and time-consuming. Automated Program Repair (APR) can ease this burden by automatically identifying and fixing faults. However, traditional APR techniques often rely on test suites for validation, but these may not capture all possible scenarios. In contrast, formal specifications provide strong correctness criteria, enabling more effective automated repair. In this paper, we present an APR tool for Dafny, a verification-aware programming language that uses formal specifications - including pre-conditions, post-conditions, and invariants - as oracles for fault localization and repair. Assuming the correctness of the specifications and focusing on arithmetic bugs, we localize faults through a series of steps, which include using Hoare logic to determine the state of each statement within the program, and applying Large Language Models (LLMs) to synthesize candidate fixes. The models considered are GPT-4o mini, Llama 3, Mistral 7B, and Llemma 7B. We evaluate our approach using DafnyBench, a benchmark of real-world Dafny programs. Our tool achieves 89.6% fault localization coverage and GPT-4o mini yields the highest repair success rate of 74.18%. These results highlight the potential of combining formal reasoning with LLM-based program synthesis for automated program repair.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). First posted on arXiv 4 Jul 2025.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 1; 2026: 1.
2 papers.
- 2025Inferring multiple helper Dafny assertions with LLMscited by 4
- 2026Self-Spec Verifiable Code Generationcited by 0
- 2026Self-Spec Verifiable Code Generation30 Sep 2026
- 2025Inferring multiple helper Dafny assertions with LLMs31 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2026Rethinking Automated Program Repair: The Impact of Bug Complexity, Fault Localization, and LLM Cost-efficiency
- 2026AxDafny: Agentic Verified Code Generation in Dafny
- 2025The Art of Repair: Optimizing Iterative Program Repair with Instruction-Tuned Models
- 2026Automated Testing and Repair for Verified Compilers Generated by a Coding Agent ↗
- 2025Automated Repair of C Programs Using Large Language Models
- 2024Aligning the Objective of LLM-based Program Repair
- 2026SkillForge: Compositional Skill Synthesis with Verification-in-the-Loop for Generating Formally Verified Dafny Programs
- 2024An Empirical Evaluation of Pre-trained Large Language Models for Repairing Declarative Formal Specifications