skip to main content
research-article
Open Access

On the Termination of Integer Loops

Published:01 December 2012Publication History
Skip Abstract Section

Abstract

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 is undecidable in some cases, in particular, when the body of the loop is expressed by a set of linear inequalities where the coefficients are from Z ∪ {r} with r an arbitrary irrational; when the loop is a sequence of instructions, that compute either linear expressions or the step function; and when the loop body is a piecewise linear deterministic update with two pieces. The undecidability result is proven by a reduction from counter programs, whose termination is known to be undecidable. For the common case of integer linear-constraint loops with rational coefficients we have not succeeded in proving either decidability or undecidability of termination, but we show that a Petri net can be simulated with such a loop; this implies some interesting lower bounds. For example, termination for a partially specified input is at least EXPSPACE-hard.

References

  1. Albert, E., Arenas, P., Genaim, S., Puebla, G., and Zanardini, D. 2007. Costa: Design and implementation of a cost and termination analyzer for java bytecode. In Proceedings of the International Symposium on Formal Methods for Components and Objects (FMCO’07). F. S. de Boer, M. M. Bonsangue, S. Graf, and W. P. de Roever Eds., Lecture Notes in Computer Science, vol. 5382, Springer, 113--132.Google ScholarGoogle Scholar
  2. Bagnara, R., Mesnard, F., Pescetti, A., and Zaffanella, E. 2012. A new look at the automatic synthesis of linear ranking functions. Inf. Comput. 215, 47--67. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Ben-Amram, A. M. 2008. Size-Change termination with difference constraints. ACM Trans. Program. Lang. Syst. 30, 3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Ben-Amram, A. M. 2010. Size-Change termination, monotonicity constraints and ranking functions. Logic. Meth. Comput. Sci. 6, 3.Google ScholarGoogle Scholar
  5. Ben-Amram, A. M. 2011. Monotonicity constraints for termination in the integer domain. Logic. Meth. Comput. Sci. 7, 3.Google ScholarGoogle ScholarCross RefCross Ref
  6. Ben-Amram, A. M. and Codish, M. 2008. A SAT-based approach to size change termination with global ranking functions. In Proceedings of the International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS’08). C. Ramakrishnan and J. Rehof Eds., Lecture Notes in Computer Science, vol. 5028, Springer, 46--55. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Ben-Amram, A. M. and Lee, C. S. 2007. Program termination analysis in polynomial time. ACM Trans. Program. Lang. Syst. 29, 1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ben-Amram, A. M., Genaim, S., and Masud, A. N. 2012. On the termination of integer loops. In Proceedings of the International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI’12). V. Kuncak and A. Rybalchenko Eds., Lecture Notes in Computer Science, vol. 7148, Springer, 72--87. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Blondel, V. D., Bournez, O., Koiran, P., Papadimitriou, C. H., and Tsitsiklis, J. N. 2001. Deciding stability and mortality of piecewise affine dynamical systems. Theor. Comput. Sci. 255, 1--2, 687--696. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Bozga, M., Iosif, R., and Konecný, F. 2012. Deciding conditional termination. In Proceedings of the International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS’12). C. Flanagan and B. Konig Eds., Lecture Notes in Computer Science, vol. 7214, Springer, 252--266. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Bozzelli, L. and Pinchinat, S. 2012. Verification of gap-order constraint abstractions of counter systems. In Proceedings of the International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI’12). V. Kuncak and A. Rybalchenko Eds., Lecture Notes in Computer Science, vol. 7148, Springer, 88--103. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Bradley, A. R., Manna, Z., and Sipma, H. B. 2005. Termination analysis of integer linear loops. In Proceedings of the International Conference on Concurrency Theory (CONCUR’05). M. Abadi and L. de Alfaro Eds., Lecture Notes in Computer Science, vol. 3653, Springer, 488--502. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Braverman, M. 2006. Termination of integer linear programs. In Proceedings of the International Conference on Computer-Aided Verification (CAV’06). T. Ball and R. B. Jones Eds., Lecture Notes in Computer Science, vol. 4144, Springer, 372--385. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Bruynooghe, M., Codish, M., Gallagher, J. P., Genaim, S., and Vanhoof, W. 2007. Termination analysis of logic programs through combination of type-based norms. ACM Trans. Program. Lang. Syst. 29, 2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Codish, M., Lagoon, V., and Stuckey, P. J. 2005. Testing for termination with monotonicity constraints. In Proceedings of the International Conference on Logic Programming (ICLP’05). M. Gabbrielli and G. Gupta Eds., Lecture Notes in Computer Science, vol. 3668, Springer, 326--340. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Colón, M. and Sipma, H. 2001. Synthesis of linear ranking functions. In Proceedings of the International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS’01). T. Margaria and W. Yi Eds., Lecture Notes in Computer Science, vol. 2031, Springer, 67--81. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Cook, B., Podelski, A., and Rybalchenko, A. 2006. Termination proofs for systems code. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’06). M. I. Schwarzbach and T. Ball Eds., ACM Press, New York, 415--426. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Dufourd, C., Jancar, P., and Schnoebelen, P. 1999. Boundedness of reset p/t nets. In Proceedings of the International Colloquium on Automata, Languages and Programming (ICALP’99). J. Wiedermann, P. van Emde Boas, and M. Nielsen Eds., Lecture Notes in Computer Science, vol. 1644, Springer, 301--310. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Esparza, J. 1998. Decidability and complexity of Petri net problems -- An introduction. In Lectures on Petri Nets, Vol. I: Basic Models. W. Reisig and G. Rozenberg Eds., Lecture Notes in Computer Science, vol. 1491, Springer, 374--428. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Esparza, J. and Nielsen, M. 1994. Decidability issues for Petri nets. Tech. rep. RS-94-8, BRICS, Department of Computer Science, University of Aarhus.Google ScholarGoogle Scholar
  21. Giesl, J., Thiemann, R., Schneider-Kamp, P., and Falke, S. 2004. Automated termination proofs with aprove. In Proceedings of the International Conference on Rewriting Techniques and Applications (RTA’04). V. van Oostrom Ed., Lecture Notes in Computer Science, vol. 3091, Springer, 210--220.Google ScholarGoogle Scholar
  22. Giesl, J., Raffelsieper, M., Schneider-Kamp, P., Swiderski, S., and Thiemann, R. 2011. Automated termination proofs for Haskell by term rewriting. ACM Trans. Program. Lang. Syst. 33, 2, 7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Hack, M. 1976. Decidability questions for Petri nets. Tech. rep. MIT/LCS/TR-161, Massachusetts Institute of Technology. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Jancar, P. 1995. Undecidability of bisimilarity for Petri nets and some related problems. Theor. Comput. Sci. 148, 2, 281--301. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Kurtz, S. A. and Simon, J. 2007. The undecidability of the generalized Collatz problem. In Proceedings of the Annual Conference on Theory and Applications of Models of Computation (TAMC’07). J.-Y. Cai, S. B. Cooper, and H. Zhu Eds., Lecture Notes in Computer Science, vol. 4484, Springer, 542--553. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Lee, C. S., Jones, N. D., and Ben-Amram, A. M. 2001. The size-change principle for program termination. In Proceedings of the Symposium on Principles of Programming Languages (POPL’01). C. Hankin and D. Schmidt Eds., ACM Press, New York, 81--92. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Lindenstrauss, N. and Sagiv, Y. 1997. Automatic termination analysis of Prolog programs. In Proceedings of the International Conference on Logic Programming (ICLP’97). L. Naish Ed., MIT Press, 64--77.Google ScholarGoogle Scholar
  28. Lindenstrauss, N., Sagiv, Y., and Serebrenik, A. 1997. Termilog: A system for checking termination of queries to logic programs. In Proceedings of the International Conference on Computer-Aided Verification (CAV’97). O. Grumberg Ed., Lecture Notes in Computer Science, vol. 1254, Springer, 444--447. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Lipton, R. J. 1976. The reachability problem requires exponential space. Tech. rep. 63, Yale University.Google ScholarGoogle Scholar
  30. Matiyasevich. 2000. Hilbert’s tenth problem: What was done and what is to be done. In Hilbert’s Tenth Problem: Relations with Arithmetic and Algebraic Geometry (AMS’00). J. Denef, L. Lipshitz, T. Pheidas, and V. Geel Eds., American Mathematical Society.Google ScholarGoogle Scholar
  31. Mehlhorn, K. and Schirra, S. 2001. Exact computation with leda_real -- Theory and geometric applications. Symbol. Algebr. Meth. Verif. Meth. 379, 163--172.Google ScholarGoogle ScholarCross RefCross Ref
  32. Memmi, G. and Roucairol, G. 1980. Linear algebra in net theory. In Net Theory and Applications, W. Brauer Ed., Lecture Notes in Computer Science, vol. 84, Springer, 213--223. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Mesnard, F. and Serebrenik, A. 2008. Recurrence with affine level mappings is p-time decidable for clp(r). Theory Pract. Logic Program. 8, 1, 111--119. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Meyer, R. R. 1975. Integer and mixed-integer programming models: General properties. J. Optim. Theory Appl. 16, 191--206.Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Minsky, M. L. 1967. Computation: Finite and Infinite Machines. Prentice Hall, Upper Saddle River, NJ. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Podelski, A. and Rybalchenko, A. 2004. A complete method for the synthesis of linear ranking functions. In Proceedings of the International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI’04). B. Steffen and G. Levi Eds., Lecture Notes in Computer Science, vol. 2937, Springer, 239--251.Google ScholarGoogle Scholar
  37. Rackoff, C. 1978. The covering and boundedness problems for vector addition systems. Theor. Comput. Sci. 6, 2, 223--231.Google ScholarGoogle ScholarCross RefCross Ref
  38. Reisig, W. 1985. Petri Nets: An Introduction. EATCS Monographs on Theoretical Computer Science. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Shoenfield, J. R. 1993. Recursion Theory. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Sohn, K. and Gelder, A. V. 1991. Termination detection in logic programs using argument sizes. In Proceedings of the Symposium on Principles of Database Systems (PODS’91). D. J. Rosenkrantz Ed., ACM Press, New York, 216--226. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Spoto, F., Mesnard, F., and Payet, É. 2010. A termination analyzer for java bytecode based on path-length. ACM Trans. Program. Lang. Syst. 32, 3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Tiwari, A. 2004. Termination of linear programs. In Proceedings of the International Conference on Computer-Aided Verification (CAV’04). R. Alur and D. Peled Eds., Lecture Notes in Computer Science, vol. 3114, Springer, 387--390.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. On the Termination of Integer Loops

          Recommendations

          Reviews

          Prahladavaradan Sampath

          "Does a given program halt__?__" is perhaps the simplest question that one could ask of programs. It has fascinated computer scientists and has been at the root of a number of deep results ever since the earliest undecidability results by Turing. This paper carries on in this tradition and illuminates yet another part of this inexhaustible space of problems. Since we know that the problem of termination in general is undecidable, it is only natural to analyze the space of programs and identify subclasses where the problem is decidable. This line of thought has led to some elegant results showing the decidability of certain linear loops [1,2]. This leads to the question of how tight these results are. The authors present some extensions of linear loops and prove undecidability results for them. They also investigate variants of the termination problem, considering termination on given inputs in contrast with termination on all inputs, and prove undecidability results for these variants. One extension introduces an instruction for testing the sign of a number. This instruction does not have the expressive power of a general conditional statement, but termination for even this is shown to be undecidable by a reduction to the problem of termination of a two-counter machine, which is known to be undecidable. The other extension is motivated by practical applications in program analysis and introduces the notion of an integer constraint loop that could be used to represent an abstraction of a program. Though the paper is not able to construct a simulation of a two-counter machine, it demonstrates a simulation of Petri nets, thereby establishing a lower bound on the termination problem for integer constraint loops. The paper contains a number of interesting and even curious results. For example, the introduction of at least a single irrational constant in linear constraint loops is necessary to encode a simulation of two-counter programs. The authors use an expressibility result from mixed integer programming to prove this result! The paper opens up a number of interesting follow-up questions of both theoretical and practical interest, which can provide fodder for future research in this area. Online Computing Reviews Service

          Access critical reviews of Computing literature here

          Become a reviewer for Computing Reviews.

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          • Published in

            cover image ACM Transactions on Programming Languages and Systems
            ACM Transactions on Programming Languages and Systems  Volume 34, Issue 4
            December 2012
            117 pages
            ISSN:0164-0925
            EISSN:1558-4593
            DOI:10.1145/2400676
            Issue’s Table of Contents

            Copyright © 2012 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 1 December 2012
            • Accepted: 1 October 2012
            • Received: 1 February 2012
            Published in toplas Volume 34, Issue 4

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article
            • Research
            • Refereed

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader