CLN2INV: Learning Loop Invariants with Continuous Logic Networks
Gabriel Ryan, Justin Wong, Jianan Yao, Ronghui Gu, Suman Jana
Abstract
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 verification of real-world programs which often contain many loops. In this paper, we present Continuous Logic Network (CLN), a novel neural architecture for automatically learning loop invariants directly from program execution traces. Unlike existing neural networks, CLNs can learn precise and explicit representations of formulas in Satisfiability Modulo Theories (SMT) for loop invariants from program execution traces. We develop a new sound and complete semantic mapping for assigning SMT formulas to continuous truth values that allows CLNs to be trained efficiently. We use CLNs to implement a new inference system for loop invariants, CLN2INV, that significantly outperforms existing approaches on the popular Code2Inv dataset. CLN2INV is the first tool to solve all 124 theoretically solvable problems in the Code2Inv dataset. Moreover, CLN2INV takes only 1.1 seconds on average for each problem, which is 40 times faster than existing approaches. We further demonstrate that CLN2INV can even learn 12 significantly more complex loop invariants than the ones required for the Code2Inv dataset.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 1a834906-9a94-477b-9956-e8e6250cfbe8Cited by top-tier papers24
- InCoder: A Generative Model for Code Infilling and SynthesisDaniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang et al.ICLR 2023 · 140 citations
- Can Large Language Models Reason about Program Invariants?Kexin Pei, David Bieber, Kensen Shi, Charles Sutton et al.ICML 2023 · 128 citations
- DistAI: Data-Driven Automated Invariant Learning for Distributed ProtocolsJianan Yao, Runzhou Tao, Ronghui Gu, Jason Nieh et al.OSDI 2021 · 76 citations
- DuoAI: Fast, Automated Inference of Inductive Invariants for Verifying Distributed ProtocolsJianan Yao, Runzhou Tao, Ronghui Gu, Jason NiehOSDI 2022 · 50 citations
- Giallar: push-button verification for the qiskit Quantum compilerRunzhou Tao, Yunong Shi, Jianan Yao, Xupeng Li et al.PLDI 2022 · 44 citations
Related papers
- Learning nonlinear loop invariants with gated continuous logic networksJianan Yao, Gabriel Ryan, Justin Wong, Suman Jana et al.PLDI 2020 · 1 citation
- Clause2Inv: A Generate-Combine-Check Framework for Loop Invariant InferenceWeining Cao, Guangyuan Wu, Tangzhi Xu, Yuan Yao et al.ISSTA 2025 · 2 citations
- Loop Invariant Inference through SMT Solving Enhanced Reinforcement LearningShiwen Yu, Ting Wang, Ji WangISSTA 2023 · 11 citations
- LLM Meets Bounded Model Checking: Neuro-symbolic Loop Invariant InferenceGuangyuan Wu, Weining Cao, Yuan Yao, Hengfeng Wei et al.ASE 2024 · 9 citations
- MALICE: Memory-aware Loop Invariants Generation on Symbolic Execution TracesTong Chen, Siyu Liu, Hongyi Zhong, liao zhang et al.ICML 2026
