On Deciding Constant Runtime of Linear Loops

📅 2026-01-13
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This study addresses the decidability of whether linear single-path loops of the form while φ do x ← Ax + b terminate in constant time for all inputs, where variables range over the reals or rationals. Focusing on the case where the loop matrix A has only real eigenvalues, the paper establishes—for the first time—the decidability of this problem and demonstrates its equivalence to the existence of multi-stage linear ranking functions. The approach integrates spectral analysis of matrices, reasoning over real semi-algebraic sets, and automated verification techniques to construct an effective decision procedure. A prototype implementation validates the practicality of the method, providing a theoretical foundation for analyzing both constant-time behavior and safety properties of linear while programs.

Technology Category

Application Category

📝 Abstract
We consider linear single-path loops of the form \[ \textbf{while} \quad \varphi \quad \textbf{do} \quad \vec{x} \gets A \vec{x} + \vec{b} \quad \textbf{end} \] where $\vec{x}$ is a vector of variables, the loop guard $\varphi$ is a conjunction of linear inequations over the variables $\vec{x}$, and the update of the loop is represented by the matrix $A$ and the vector $\vec{b}$. It is already known that termination of such loops is decidable. In this work, we consider loops where $A$ has real eigenvalues, and prove that it is decidable whether the loop's runtime (for all inputs) is bounded by a constant if the variables range over $\mathbb R$ or $\mathbb Q$. This is an important problem in automatic program verification, since safety of linear while-programs is decidable if all loops have constant runtime, and it is closely connected to the existence of multiphase-linear ranking functions, which are often used for termination and complexity analysis. To evaluate its practical applicability, we also present an implementation of our decision procedure.
Problem

Research questions and friction points this paper is trying to address.

constant runtime
linear loops
termination
program verification
eigenvalues
Innovation

Methods, ideas, or system contributions that make the work stand out.

constant runtime
linear loops
decidability
multiphase-linear ranking functions
program verification
🔎 Similar Papers
No similar papers found.