paper-with-me

홈 › Papers

Learning Loop Invariants for Program Verification

2018-12-01 · NeurIPS 2018 12 · Xujie Si, Hanjun Dai, Mukund Raghothaman, Mayur Naik, Le Song

A fundamental problem in program verification concerns inferring loop invariants. The problem is undecidable and even practical instances are challenging. Inspired by how human experts construct loop invariants, we propose a reasoning framework Code2Inv that constructs the solution by multi-step decision making and querying an external program graph memory block. By training with reinforcement learning, Code2Inv captures rich program features and avoids the need for ground truth solutions as supervision. Compared to previous learning tasks in domains with graph-structured data, it addresses unique challenges, such as a binary objective function and an extremely sparse reward that is given by an automated theorem prover only after the complete loop invariant is proposed. We evaluate Code2Inv on a suite of 133 benchmark problems and compare it to three state-of-the-art systems. It solves 106 problems compared to 73 by a stochastic search-based system, 77 by a heuristic search-based system, and 100 by a decision tree learning-based system. Moreover, the strategy learned can be generalized to new programs: compared to solving new instances from scratch, the pre-trained agent is more sample efficient in finding solutions.

📄 PDF Abstract BibTeX

Code (1)

PL-ML/code2inv 공식 구현 pytorch

Tasks

Decision MakingHeuristic SearchReinforcement Learning

Similar Papers 제목 키워드 기반

Finding Inductive Loop Invariants using Large Language Models

2023-11-14 · Adharsh Kamath, Aditya Senthilnathan, Saikat Chakraborty, Pantazis Deligiannis 외

Loop invariants are fundamental to reasoning about programs with loops. They establish properties about a given loop's behavior. When they additionally are inductive, they become useful for the task of formal verificatio…

CLN2INV: Learning Loop Invariants with Continuous Logic Networks

2019-09-25 · ICLR 2020 1 · Gabriel Ryan, Justin Wong, Jianan Yao, Ronghui Gu 외

Program verification offers a framework for ensuring program correctness and therefore systematically eliminating different classes of bugs. Inferring loop invariants is one of the main challenges behind automated verifi…

Ranking LLM-Generated Loop Invariants for Program Verification

2023-10-13 · Saikat Chakraborty, Shuvendu K. Lahiri, Sarah Fakhoury, Madanlal Musuvathi 외

Synthesizing inductive loop invariants is fundamental to automating program verification. In this work, we observe that Large Language Models (such as gpt-3.5 or gpt-4) are capable of synthesizing loop invariants for a c…

Re-Ranking

LLM For Loop Invariant Generation and Fixing: How Far Are We?

2025-11-09 · Mostafijur Rahman Akhond, Saikat Chakraborty, Gias Uddin arxiv

A loop invariant is a property of a loop that remains true before and after each execution of the loop. The identification of loop invariants is a critical step to support automated program safety assessment. Recent adva…

A Neurosymbolic Approach to Loop Invariant Generation via Weakest Precondition Reasoning

2025-12-17 · Daragh King, Vasileios Koutavas, Laura Kovacs arxiv

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 reliab…