🤖 AI Summary
This work addresses the challenging problem of loop invariant synthesis, which is inherently undecidable and difficult for existing learning-based methods to solve due to their inability to generate complete and ordered sequences of invariants. The paper proposes an incremental ICE framework that, for the first time, integrates the incremental reasoning principle from IC3 into learning-based invariant inference. By introducing lemma-specific learning objectives and a counterexample filtering mechanism, the approach leverages large language models (LLMs) to produce ordered lemma sequences, with ICE-DT serving as a fallback. This enables lemma-level controllable learning that effectively combines LLMs with symbolic reasoning. Evaluated on 367 linear and 50 nonlinear benchmarks, the method solves 349 and 47 instances respectively, with average runtimes of 15.2 and 8.8 seconds—outperforming state-of-the-art LLM baselines by solving 12–24% more instances and achieving 36–63% speedups, while significantly surpassing strong non-LLM baselines.
📝 Abstract
Loop invariant synthesis is a fundamental problem in program verification, yet the inherent undecidability makes it highly challenging. Recent studies have increasingly employed various machine learning techniques to generate loop invariants. However, most of these methods adopt a monolithic approach. Due to the inability to strictly constrain the learning process, learning-based methods struggle to simultaneously consider all necessary conditions and generate complete invariants when tackling complex problems. In fact, a loop invariant is often an ordered sequence of lemmas, rather than a single invariant formula. This motivates us to propose Incremental ICE, a novel learning framework for incremental synthesis. Our framework integrates the incremental philosophy of IC3 into the general invariant learning framework ICE. By defining a lemma-specific learning objective and introducing a counterexample filtering mechanism, we can achieve sound incremental learning. Under this framework, we instantiate a loop invariant synthesis tool, LimICE, which leverages LLMs to generate the ordered sequence of lemmas and incorporates ICE-DT as a fallback mechanism to complement the lemma sequence. Experiments on 367 linear benchmarks and 50 nonlinear benchmarks demonstrate the effectiveness of the proposed approach. LimICE solves 349 (out of 367) linear problems on an average of 15.2 seconds and 47 (out of 50) nonlinear problems on an average of 8.8 seconds. Compared to the state-of-the-art LLM-based baseline, our approach solves 12-24% more instances while running 36-63% faster across linear and nonlinear benchmarks. LimICE also consistently outperforms strong non-LLM baselines and solves at least 86 and 27 additional instances on the linear and nonlinear benchmarks, respectively.