Abstract
In this paper we study the complexity of the Linear Ranking problem: given a loop, described by linear constraints over a finite set of integer variables, is there a linear ranking function for this loop? While existence of such a function implies termination, this problem is not equivalent to termination. When the variables range over the rationals or reals, the Linear Ranking problem is known to be PTIME decidable. However, when they range over the integers, whether for single-path or multipath loops, the complexity of the Linear Ranking problem has not yet been determined. We show that it is coNP-complete. However, we point out some special cases of importance of PTIME complexity. We also present complete algorithms for synthesizing linear ranking functions, both for the general case and the special PTIME cases.
Supplemental Material
- E. Albert, P. Arenas, S. Genaim, G. Puebla, and D. Zanardini. Costa: Design and implementation of a cost and termination analyzer for java bytecode. In F. S. de Boer, M. M. Bonsangue, S. Graf, and W. P. de Roever, editors, Formal Methods for Components and Objects, FMCO'07, volume 5382 of LNCS, pages 113--132. Springer, 2007.Google Scholar
- E. Albert, P. Arenas, S. Genaim, and G. Puebla. Closed-form upper bounds in static cost analysis. J. Autom. Reasoning, 46 (2): 161--203, 2011. Google Scholar
Digital Library
- C. Alias, A. Darte, P. Feautrier, and L. Gonnord. Multi-dimensional rankings, program termination, and complexity bounds of flowchart programs. In R. Cousot and M. Martel, editors, Static Analysis Symposium, SAS'10, volume 6337 of LNCS, pages 117--133. Springer, 2010. Google Scholar
Digital Library
- R. Bagnara, P. M. Hill, and E. Zaffanella. An improved tight closure algorithm for integer octagonal constraints. In F. Logozzo, D. Peled, and L. D. Zuck, editors, phVerification, Model Checking, and Abstract Interpretation, VMCAI'08, volume 4905 of LNCS, pages 8--21. Springer, 2008. Google Scholar
Digital Library
- R. Bagnara, P. M. Hill, and E. Zaffanella. The parma polyhedra library: Toward a complete set of numerical abstractions for the analysis and verification of hardware and software systems. Sci. Comput. Program., 72 (1--2): 3--21, 2008. Google Scholar
Digital Library
- R. Bagnara, F. Mesnard, A. Pescetti, and E. Zaffanella. A new look at the automatic synthesis of linear ranking functions. Inf. Comput., 215: 47--67, 2012. Google Scholar
Digital Library
- A. M. Ben-Amram. Size-change termination with difference constraints. ACM Trans. Program. Lang. Syst., 30 (3), 2008. Google Scholar
Digital Library
- A. M. Ben-Amram and S. Genaim. On the linear ranking problem for integer linear-constraint loops. CoRR, abs/1208.4041, 2012. Google Scholar
Digital Library
- A. M. Ben-Amram, S. Genaim, and A. N. Masud. On the termination of integer loops. In V. Kuncak and A. Rybalchenko, editors, Verification, Model Checking, and Abstract Interpretation, VMCAI'12, volume 7148 of LNCS, pages 72--87. Springer, 2012. Google Scholar
Digital Library
- M. Bozga, R. Iosif, and F. Konecný. Deciding conditional termination. In C. Flanagan and B. König, editors, Tools and Algorithms for the Construction and Analysis of Systems, TACAS'12, volume 7214 of LNCS, pages 252--266. Springer, 2012. Google Scholar
Digital Library
- L. Bozzelli and S. Pinchinat. Verification of gap-order constraint abstractions of counter systems. In V. Kuncak and A. Rybalchenko, editors, Verification, Model Checking, and Abstract Interpretation, VMCAI'12, volume 7148 of LNCS, pages 88--103. Springer, 2012. Google Scholar
Digital Library
- A. R. Bradley, Z. Manna, and H. B. Sipma. Linear ranking with reachability. In K. Etessami and S. K. Rajamani, editors, Computer Aided Verification, CAV'05, volume 3576 of LNCS, pages 491--504. Springer, 2005. Google Scholar
Digital Library
- A. R. Bradley, Z. Manna, and H. B. Sipma. Termination analysis of integer linear loops. In M. Abadi and L. de Alfaro, editors, Concurrency Theory, CONCUR 2005, volume 3653 of LNCS, pages 488--502. Springer, 2005. Google Scholar
Digital Library
- A. R. Bradley, Z. Manna, and H. B. Sipma. The polyranking principle. In L. Caires, G. F. Italiano, L. Monteiro, C. Palamidessi, and M. Yung, editors, International Colloquium on Automata, Languages and Programming, ICALP'05, volume 3580 of LNCS, pages 1349--1361. Springer, 2005. Google Scholar
Digital Library
- A. R. Bradley, Z. Manna, and H. B. Sipma. Termination of polynomial programs. In R. Cousot, editor, Verification, Model Checking, and Abstract Interpretation, VMCAI'05, volume 3385 of LNCS, pages 113--129. Springer, 2005. Google Scholar
Digital Library
- M. Braverman. Termination of integer linear programs. In T. Ball and R. B. Jones, editors, Computer Aided Verification, CAV'06, volume 4144 of LNCS, pages 372--385. Springer, 2006. Google Scholar
Digital Library
- M. Bruynooghe, M. Codish, J. P. Gallagher, S. Genaim, and W. Vanhoof. Termination analysis of logic programs through combination of type-based norms. ACM Trans. Program. Lang. Syst., 29 (2), 2007. Google Scholar
Digital Library
- P. J. Charles, J. M. Howe, and A. King. Integer polyhedra for program analysis. In A. V. Goldberg and Y. Zhou, editors, Algorithmic Aspects in Information and Management, AAIM'09, volume 5564 of LNCS, pages 85--99. Springer, 2009. Google Scholar
Digital Library
- M. Codish, V. Lagoon, and P. J. Stuckey. Testing for termination with monotonicity constraints. In M. Gabbrielli and G. Gupta, editors, International Conference on Logic Programming, ICLP'05, volume 3668 of LNCS, pages 326--340. Springer, 2005. Google Scholar
Digital Library
- M. Colón and H. Sipma. Synthesis of linear ranking functions. In T. Margaria and W. Yi, editors, Tools and Algorithms for the Construction and Analysis of Systems, TACAS'01, volume 2031 of LNCS, pages 67--81. Springer, 2001. Google Scholar
Digital Library
- B. Cook, A. Podelski, and A. Rybalchenko. Termination proofs for systems code. In M. I. Schwartzbach and T. Ball, editors, Programming Language Design and Implementation, PLDI'06, pages 415--426. ACM, 2006. Google Scholar
Digital Library
- B. Cook, D. Kroening, P. Rümmer, and C. M. Wintersteiger. Ranking function synthesis for bit-vector relations. In J. Esparza and R. Majumdar, editors, Tools and Algorithms for the Construction and Analysis of Systems, 16th International Conference, TACAS'10, volume 6015 of LNCS, pages 236--250. Springer, 2010. Google Scholar
Digital Library
- P. Cousot. Proving program invariance and termination by parametric abstraction, lagrangian relaxation and semidefinite programming. In R. Cousot, editor, Verification, Model Checking, and Abstract Interpretation, VMCAI'05, volume 3385 of LNCS, pages 1--24, 2005. Google Scholar
Digital Library
- A. Darte. Understanding loops: The influence of the decomposition of Karp, Miller, and Winograd. In Formal Methods and Models for Codesign, MEMOCODE'10, pages 139--148. IEEE Computer Society, 2010.Google Scholar
- P. Feautrier. Some efficient solutions to the affine scheduling problem. I. one-dimensional time. International Journal of Parallel Programming, 21 (5): 313--347, 1992. Google Scholar
Digital Library
- M. R. Garey and D. S. Johnson. Computers and Intractability. W.H. Freeman and Co., New York, 1979. Google Scholar
Digital Library
- J. Giesl, R. Thiemann, P. Schneider-Kamp, and S. Falke. Automated termination proofs with aprove. In V. van Oostrom, editor, Rewriting Techniques and Applications, RTA'04, volume 3091 of LNCS, pages 210--220. Springer, 2004.Google Scholar
- M. E. Hartmann. Cutting Planes and the Complexity of the Integer Hull. PhD thesis, School of Operations Research and Industrial Engineering, Cornell University, 1988. Google Scholar
Digital Library
- W. Harvey. Computing two-dimensional integer hulls. SIAM J. Comput., 28 (6): 2285--2299, 1999. Google Scholar
Digital Library
- W. Harvey and P. J. Stuckey. A unit two variable per inequality integer constraint solver for constraint logic programming. In Australasian Computer Science Conference, ACSC'97, pages 102--111, 1997.Google Scholar
- R. M. Karp. Reducibility among combinatorial problems. In R. E. Miller and J. W. Thatcher, editors, Complexity of Computer Computations, pages 85--103. Plenum Press, New York, 1972.Google Scholar
Cross Ref
- R. M. Karp and C. H. Papadimitriou. On linear characterizations of combinatorial optimization problems. In Symp. on Foundations of Computer Science, FOCS'80, pages 1--9. IEEE Computer Society, 1980. Google Scholar
Digital Library
- J.-L. Lassez. Querying constraints. In Symposium on Principles of Database Systems, pages 288--298. ACM Press, 1990. Google Scholar
Digital Library
- C. S. Lee, N. D. Jones, and A. M. Ben-Amram. The size-change principle for program termination. In C. Hankin and D. Schmidt, editors, Symposium on Principles of Programming Languages, POPL'01, pages 81--92, 2001. Google Scholar
Digital Library
- N. Lindenstrauss and Y. Sagiv. Automatic termination analysis of Prolog programs. In L. Naish, editor, International Conference on Logic Programming, ICLP'97, pages 64--77. MIT Press, 1997.Google Scholar
- F. Mesnard and A. Serebrenik. Recurrence with affine level mappings is p-time decidable for clp(r). TPLP, 8 (1): 111--119, 2008. Google Scholar
Digital Library
- A. Miné. The octagon abstract domain. Higher-Order and Symbolic Computation, 19 (1): 31--100, Mar. 2006. Google Scholar
Digital Library
- A. Podelski and A. Rybalchenko. A complete method for the synthesis of linear ranking functions. In B. Steffen and G. Levi, editors, Verification, Model Checking, and Abstract Interpretation, VMCAI'04, volume 2937 of phLNCS, pages 239--251. Springer, 2004.Google Scholar
- P. Z. Revesz. Tightened transitive closure of integer addition constraints. In V. Bulitko and J. C. Beck, editors, phSymposium on Abstraction, Reformulation, and Approximation, SARA'09, 2009.Google Scholar
- A. Rybalchenko. phTemporal Verification with Transition Invariants. PhD thesis, Universitat des Saarlandes, 2004.Google Scholar
- A. Schrijver. Theory of Linear and Integer Programming. John Wiley and Sons, New York, 1986. Google Scholar
Digital Library
- K. Sohn and A. V. Gelder. Termination detection in logic programs using argument sizes. In D. J. Rosenkrantz, editor, Symposium on Principles of Database Systems, pages 216--226. ACM Press, 1991. Google Scholar
Digital Library
- F. Spoto, F. Mesnard, and É. Payet. A termination analyzer for java bytecode based on path-length. ACM Trans. Program. Lang. Syst., 32 (3), 2010. Google Scholar
Digital Library
- Éva. Tardos. A strongly polynomial algorithm to solve combinatorial linear programs. Operations Research, 34: 250--256, 1986. Google Scholar
Digital Library
- A. Tiwari. Termination of linear programs. In R. Alur and D. Peled, editors, Computer Aided Verification, CAV'04, volume 3114 of LNCS, pages 387--390. Springer, 2004.Google Scholar
Index Terms
On the linear ranking problem for integer linear-constraint loops
Recommendations
On the Termination of Integer Loops
In this article we study the decidability of termination of several variants of simple integer loops, without branching in the loop body and with affine constraints as the loop guard (and possibly a precondition). We show that termination of such loops ...
Ranking Functions for Linear-Constraint Loops
In this article, we study the complexity of the problems: given a loop, described by linear constraints over a finite set of variables, is there a linear or lexicographical-linear ranking function for this loop? While existence of such functions implies ...
On the linear ranking problem for integer linear-constraint loops
POPL '13: Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesIn this paper we study the complexity of the Linear Ranking problem: given a loop, described by linear constraints over a finite set of integer variables, is there a linear ranking function for this loop? While existence of such a function implies ...







Comments