Simple Linear Loops: Algebraic Invariants and Applications
Rida Ait El Manssour, George Kenison, Mahsa Shirmohammadi, Anton Varonka
Abstract
The automatic generation of loop invariants is a fundamental challenge in software verification. While this task is undecidable in general, it is decidable for certain restricted classes of programs. This work focuses on invariant generation for (branching-free) loops with a single linear update.
Our primary contribution is a polynomial-space algorithm that computes the strongest algebraic invariant for simple linear loops, generating all polynomial equations that hold among program variables across all reachable states. The key to achieving our complexity bounds lies in mitigating the blow-up associated with variable elimination and Gröbner basis computation, as seen in prior works (see [25,40,64] among others). Our procedure runs in polynomial time when the number of program variables is fixed.
We examine various applications of our results on invariant generation, focusing on invariant verification and loop synthesis. The invariant verification problem investigates whether a polynomial ideal defining an algebraic set serves as an invariant for a given linear loop. We show that this problem is coNP-complete and lies in PSPACE when the input ideal is given in dense or sparse representations, respectively. In the context of loop synthesis, we aim to construct a loop with an infinite set of reachable states that upholds a specified algebraic property as an invariant. The strong synthesis variant of this problem requires the construction of loops for which the given property is the strongest invariant. In terms of hardness, synthesising loops over integers (or rationals) is as hard as Hilbert's Tenth problem (or its analogue over the rationals). When the constants of the output are constrained to bit-bounded rational numbers, we demonstrate that loop synthesis and its strong variant are both decidable in PSPACE, and in NP when the number of program variables is fixed.
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 3f62d0d8-741a-46ed-bbb8-925a355711b6Cited by top-tier papers2
- Algebraic Closure of Matrix Sets Recognized by 1-VASSRida Ait El Manssour, Mahsa Naraghi, Mahsa Shirmohammadi, James WorrellSODA 2026 · 1 citation
- Determination Problems for Orbit Closures and Matrix GroupsRida Ait El Manssour, George Kenison, Mahsa Shirmohammadi, Anton Varonka et al.POPL 2026
Builds on5
- Solvable Polynomial Ideals: The Ideal Reflection for Program AnalysisJohn Cyphert, Zachary KincaidPOPL 2024 · 11 citations
- On the Orbit Closure Containment Problem and Slice Rank of TensorsMarkus Bläser, Christian Ikenmeyer, Vladimir Lysikov, Anurag Pandey et al.SODA 2021 · 7 citations
- Strong Invariants Are Hard: On the Hardness of Strongest Polynomial Invariants for (Probabilistic) ProgramsJulian Müllner, Marcel Moosbrugger, Laura KovácsPOPL 2024 · 7 citations
- Identity Testing for Radical ExpressionsNikhil Balaji, Klara Nosan, Mahsa Shirmohammadi, James WorrellLICS 2022 · 4 citations
- Determination Problems for Orbit Closures and Matrix GroupsRida Ait El Manssour, George Kenison, Mahsa Shirmohammadi, Anton Varonka et al.POPL 2026
Related papers
- Affine Loop Invariant Generation via Matrix AlgebraYucheng Ji, Hongfei Fu, Bin Fang, Haibo ChenCAV 2022 · 10 citations
- Polynomial invariant generation for non-deterministic recursive programsKrishnendu Chatterjee, Hongfei Fu, Amir Kafshdar Goharshady, Ehsan Kafshdar GoharshadyPLDI 2020 · 46 citations
- Scalable linear invariant generation with Farkas' lemmaHongming Liu, Hongfei Fu, Zhiyong Yu, Jiaxin Song et al.OOPSLA 2022 · 15 citations
- Demystifying Template-Based Invariant Generation for Bit-Vector ProgramsPeisen Yao, Jingyu Ke, Jiahui Sun, Hongfei Fu et al.ASE 2023 · 3 citations
- Exact Loop Bound AnalysisDaniel Riley, Grigory FedyukovichPLDI 2025
