A Neurosymbolic Approach to Loop Invariant Generation via Weakest Precondition Reasoning
Daragh King, Vasileios Koutavas, Laura Kovacs

TL;DR
NeuroInv is a neurosymbolic method combining LLMs and symbolic reasoning to generate loop invariants, significantly improving success rates and scalability in automated program verification.
Contribution
This paper introduces NeuroInv, a novel neurosymbolic framework that integrates neural reasoning with symbolic verification to enhance loop invariant generation.
Findings
Achieves 99.5% success rate on Java program benchmarks.
Outperforms existing approaches in invariant generation accuracy.
Scales effectively to complex multi-loop programs.
Abstract
Loop invariant generation remains a critical bottleneck in automated program verification. Recent work has begun to explore the use of Large Language Models (LLMs) in this area, yet these approaches tend to lack a reliable and structured methodology, with little reference to existing program verification theory. This paper presents NeuroInv, a neurosymbolic approach to loop invariant generation. NeuroInv comprises two key modules: (1) a neural reasoning module that leverages LLMs and Hoare logic to derive and refine candidate invariants via backward-chaining weakest precondition reasoning, and (2) a verification-guided symbolic module that iteratively repairs invariants using counterexamples from OpenJML. We evaluate NeuroInv on a comprehensive benchmark of 150 Java programs, encompassing single and multiple (sequential) loops, multiple arrays, random branching, and noisy code segments.…
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
TopicsFormal Methods in Verification · Logic, programming, and type systems · Software Testing and Debugging Techniques
