Breaking the Mold: Nonlinear Ranking Function Synthesis Without Templates
Shaowei Zhu, Zachary Kincaid
TL;DR
This work tackles termination of nonlinear loops by synthesizing polynomial ranking functions modulo a weak arithmetic theory, $\mathbf{LIRR}$, which makes the otherwise undecidable problem tractable in a complete sense. The approach builds a finite template from consequences of the loop while reducing the ranking-function synthesis to linear arithmetic, enabling complete synthesis of $\mathbf{PRF}$ and $\mathbf{WLPRF}$ even for unbounded degree and dimension. A key innovation is the zero-stable restriction, which preserves termination while enabling a complete, monotone end-to-end termination analysis for whole programs. Empirical results on SV-COMP benchmarks show competitive performance for nonlinear programs, with the method subsuming linear lexicographic ranking for many linear loops and improving termination analysis for nonlinear cases over several existing tools.
Abstract
This paper studies the problem of synthesizing (lexicographic) polynomial ranking functions for loops that can be described in polynomial arithmetic over integers and reals. While the analogous ranking function synthesis problem for linear arithmetic is decidable, even checking whether a given function ranks an integer loop is undecidable in the nonlinear setting. We side-step the decidability barrier by working within the theory of linear integer/real rings (LIRR) rather than the standard model of arithmetic. We develop a termination analysis that is guaranteed to succeed if a loop (expressed as a formula) admits a (lexicographic) polynomial ranking function. In contrast to template-based ranking function synthesis in real arithmetic, our completeness result holds for lexicographic ranking functions of unbounded dimension and degree, and effectively subsumes linear lexicographic ranking function synthesis for linear integer loops.
