Specification-Guided Repair of Arithmetic Errors in Dafny Programs using LLMs
Valentina Wu, Alexandra Mendes, Alexandre Abreu

TL;DR
This paper introduces a formal specification-guided automated repair tool for Dafny programs that leverages LLMs to fix arithmetic errors, achieving high fault localization and repair success rates.
Contribution
It presents a novel approach combining formal specifications and LLMs for fault localization and repair in Dafny programs, focusing on arithmetic bugs.
Findings
89.6% fault localization coverage
74.18% repair success rate with GPT-4o mini
Effective combination of formal reasoning and LLMs
Abstract
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,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Testing and Debugging Techniques · Radiation Effects in Electronics · Formal Methods in Verification
