mlsanityData to 14 Oct 2026

Specification-Guided Repair of Arithmetic Errors in Dafny Programs using LLMs

arXiv 2507.03659 ↗First posted 4 Jul 2025cs.SE cs.PLcited by 2

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

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 1; 2026: 1.

2 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026Rethinking Automated Program Repair: The Impact of Bug Complexity, Fault Localization, and LLM Cost-efficiency
  2. 2026AxDafny: Agentic Verified Code Generation in Dafny
  3. 2025The Art of Repair: Optimizing Iterative Program Repair with Instruction-Tuned Models
  4. 2026Automated Testing and Repair for Verified Compilers Generated by a Coding Agent ↗
  5. 2025Automated Repair of C Programs Using Large Language Models
  6. 2024Aligning the Objective of LLM-based Program Repair
  7. 2026SkillForge: Compositional Skill Synthesis with Verification-in-the-Loop for Generating Formally Verified Dafny Programs
  8. 2024An Empirical Evaluation of Pre-trained Large Language Models for Repairing Declarative Formal Specifications