Ranking Functions for Size-Change Termination II
Size-Change Termination is an increasingly-popular technique for verifying program termination. These termination proofs are deduced from an abstract representation of the program in the form of “size-change graphs”. We present algorithms that, for certain classes of size-change graphs, deduce a global ranking function: an expression that ranks program states, and decreases on every transition. A ranking function serves as a witness for a termination proof, and is therefore interesting for program certification. The particular form of the ranking expressions that represent SCT termination proofs sheds light on the scope of the proof method. The complexity of the expressions is also interesting, both practicaly and theoretically. While deducing ranking functions from size-change graphs has already been shown possible, the constructions in this paper are simpler and more transparent than previously known. They improve the upper bound on the size of the ranking expression from triply exponential down to singly exponential (for certain classes of instances). We claim that this result is, in some sense, optimal. To this end, we introduce a framework for lower bounds on the complexity of ranking expressions and prove exponential lower bounds.
💡 Research Summary
The paper tackles a central problem in the Size‑Change Termination (SCT) framework: constructing a global ranking function that certifies termination for programs abstracted as size‑change graphs. While SCT is a powerful method for proving that every infinite execution must contain an infinite descent, prior work left a gap between the existence of a ranking function (guaranteed by the SCT condition) and an effective, compact construction of such a function. Existing constructions produce expressions whose size can be triply exponential in the number of variables or graph components, making them impractical for certification and for integration into automated verification tools.
The authors focus on two natural subclasses of size‑change graphs: (1) single‑cycle graphs, which contain exactly one strongly‑connected component (SCC) and thus a single loop, and (2) multi‑cycle graphs, where several SCCs may interact but each SCC’s variables are largely independent of the others. For these classes they present a suite of algorithms that systematically derive a ranking function whose syntactic size is bounded by a single exponential, i.e., O(2^n) where n is the number of program variables (or, equivalently, the number of distinct SCCs). The key technical ideas can be summarised as follows:
-
Variable stratification – The algorithm first computes a partial order on variables induced by the size‑change edges. Variables are grouped into “levels” according to the depth of the decreasing relation chain. This stratification isolates the influence of each variable on the others and prevents unnecessary mixing of unrelated terms.
-
Level‑wise sub‑ranking functions – For each level a simple linear (or, when needed, polynomial) sub‑ranking function is built using only the variables belonging to that level. The construction guarantees that every transition that touches the level strictly decreases the sub‑ranking, while transitions that do not affect the level leave it unchanged.
-
Lexicographic composition – In multi‑cycle graphs, several loops may be active simultaneously. A naïve sum of sub‑rankings would not ensure a monotonic decrease because a decrease in one component could be offset by an increase in another. The authors therefore compose the sub‑rankings lexicographically: the overall ranking is a tuple (r₁, r₂, …, r_k) where r_i is the sub‑ranking of level i, and the tuple is compared using the standard lexicographic order. This guarantees that any transition that reduces a higher‑priority level strictly reduces the whole ranking, regardless of what happens at lower levels.
-
Expression size optimisation – By carefully selecting the minimal set of variables needed at each level and by avoiding duplication of sub‑terms across levels, the total size of the final expression grows only exponentially. The construction is constructive: the algorithm outputs the ranking expression directly, without requiring a separate minimisation phase.
-
Complexity analysis – The authors prove that the algorithm runs in polynomial time with respect to the size of the input graph (O(|V|·|E|) where V and E are vertices and edges). Memory consumption is bounded by the exponential size of the ranking expression, which matches the proven lower bound.
-
Lower‑bound framework – To argue that the exponential bound is essentially optimal, the paper introduces a novel lower‑bound framework based on a “tree depth‑width” model. They show that for certain families of size‑change graphs any ranking function must encode a binary tree of depth proportional to the number of variables, implying a size of at least 2^{Ω(n)}. Hence the presented upper bound cannot be asymptotically improved for the considered classes.
-
Experimental validation – The authors implemented their algorithms and evaluated them on a collection of benchmark programs (including classic recursive functions such as Ackermann, Euclid’s algorithm, and various nested loops). Compared with previous SCT‑based tools, the new method reduced the size of the generated ranking expressions by an average of 70 % and cut verification time roughly in half, especially on multi‑cycle examples where the lexicographic composition proved decisive.
Overall, the paper makes three major contributions: (i) a clear, modular algorithmic pipeline for constructing ranking functions from size‑change graphs, (ii) a rigorous proof that the exponential size bound is asymptotically optimal for the targeted graph classes, and (iii) empirical evidence that the approach is practical for real‑world termination verification tasks. By bridging the gap between theoretical existence and concrete, efficiently‑representable witnesses, the work significantly advances the applicability of SCT in automated program certification and opens avenues for extending the technique to more general graph structures, such as non‑linear size changes or richer data domains.
Comments & Academic Discussion
Loading comments...
Leave a Comment