On the Termination of Integer Loops

  • Amir M. Ben-Amram
  • Samir Genaim
  • Abu Naser Masud
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7148)


In this paper 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 ℤ ∪ {r} with r an arbitrary irrational; or when the loop is a sequence of instructions, that compute either linear expressions or the step function. The undecidability result is proven by a reduction from counter programs, whose termination is known to be undecidable. For the common case of integer constraints loops with rational coefficients only we have not succeeded in proving decidability nor undecidability of termination, however, this attempt led to the result that a Petri net can be simulated with such a loop, which implies some interesting lower bounds. For example, termination for a given input is at least EXPSPACE-hard.


Linear Constraint Ranking Function Counter Program Termination Problem Loop Body 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Albert, E., Arenas, P., Genaim, S., Puebla, G., Zanardini, D.: COSTA: Design and Implementation of a Cost and Termination Analyzer for Java Bytecode. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2007. LNCS, vol. 5382, pp. 113–132. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  2. 2.
    Bagnara, R., Mesnard, F., Pescetti, A., Zaffanella, E.: The automatic synthesis of linear ranking functions: The complete unabridged version. Quaderno 498, Dipartimento di Matematica, Università di Parma, Italy, Published as arXiv:cs.PL/1004.0944 (2010)Google Scholar
  3. 3.
    Ben-Amram, A.M.: Size-change termination with difference constraints. ACM Trans. Program. Lang. Syst. 30(3) (2008)Google Scholar
  4. 4.
    Ben-Amram, A.M.: Size-change termination, monotonicity constraints and ranking functions. Logical Methods in Computer Science 6(3) (2010)Google Scholar
  5. 5.
    Ben-Amram, A.M.: Monotonicity constraints for termination in the integer domain. CoRR, abs/1105.6317 (2011)Google Scholar
  6. 6.
    Ben-Amram, A.M., Lee, C.S.: Program termination analysis in polynomial time. ACM Trans. Program. Lang. Syst. 29(1) (2007)Google Scholar
  7. 7.
    Blondel, V.D., Bournez, O., Koiran, P., Papadimitriou, C.H., Tsitsiklis, J.N.: Deciding stability and mortality of piecewise affine dynamical systems. Theor. Comput. Sci. 255(1-2), 687–696 (2001)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Bozzelli, L., Pinchinat, S.: Verification of Gap-Order Constraint Abstractions of Counter Systems. In: Kuncak, V., Rybalchenko, A. (eds.) VMCAI 2012. LNCS, vol. 7148, pp. 88–103. Springer, Heidelberg (2012)Google Scholar
  9. 9.
    Bradley, A.R., Manna, Z., Sipma, H.B.: Termination Analysis of Integer Linear Loops. In: Abadi, M., de Alfaro, L. (eds.) CONCUR 2005. LNCS, vol. 3653, pp. 488–502. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  10. 10.
    Braverman, M.: Termination of Integer Linear Programs. In: Ball, T., Jones, R.B. (eds.) CAV 2006. LNCS, vol. 4144, pp. 372–385. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  11. 11.
    Bruynooghe, M., Codish, M., Gallagher, J.P., Genaim, S., Vanhoof, W.: Termination analysis of logic programs through combination of type-based norms. ACM Trans. Program. Lang. Syst. 29(2) (2007)Google Scholar
  12. 12.
    Cook, B., Podelski, A., Rybalchenko, A.: Termination proofs for systems code. In: Schwartzbach, M.I., Ball, T. (eds.) Proceedings of the ACM SIGPLAN 2006 Conference on Programming Language Design and Implementation (PLDI), Ottawa, Canada, pp. 415–426. ACM (2006); TerminatorGoogle Scholar
  13. 13.
    Dufourd, C., Jančar, P., Schnoebelen, P.: Boundedness of Reset P/T Nets. In: Wiedermann, J., Van Emde Boas, P., Nielsen, M. (eds.) ICALP 1999. LNCS, vol. 1644, pp. 301–310. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  14. 14.
    Esparza, J.: Decidability and Complexity of Petri Net Problems—an Introduction. In: Reisig, W., Rozenberg, G. (eds.) APN 1998. LNCS, vol. 1491, pp. 374–428. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  15. 15.
    Giesl, J., Thiemann, R., Schneider-Kamp, P., Falke, S.: Automated Termination Proofs with AProVE. In: van Oostrom, V. (ed.) RTA 2004. LNCS, vol. 3091, pp. 210–220. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  16. 16.
    Lee, C.S., Jones, N.D., Ben-Amram, A.M.: The size-change principle for program termination. In: POPL, pp. 81–92 (2001)Google Scholar
  17. 17.
    Lipton, R.J.: The reachability problem requires exponential space. Technical Report 63, Yale University (1976),
  18. 18.
    Matiyasevich, Y.: Hilbert’s tenth problem: What was done and what is to be done. In: Denef, J., Lipshitz, L., Pheidas, T., Van Geel, J. (eds.) Hilbert’s Tenth Problem: Relations with Arithmetic and Algebraic Geometry. AMS (2000)Google Scholar
  19. 19.
    Mesnard, F., Serebrenik, A.: Recurrence with affine level mappings is p-time decidable for clp(r). TPLP 8(1), 111–119 (2008)MathSciNetzbMATHGoogle Scholar
  20. 20.
    Meyer, R.R.: Integer and mixed-integer programming models: General properties. Journal of Optimization Theory and Applications 16, 191–206 (1975), doi:10.1007/BF01262932MathSciNetCrossRefzbMATHGoogle Scholar
  21. 21.
    Minsky, M.L.: Computation: finite and infinite machines. Prentice-Hall, Inc., Upper Saddle River (1967)zbMATHGoogle Scholar
  22. 22.
    Podelski, A., Rybalchenko, A.: A Complete Method for the Synthesis of Linear Ranking Functions. In: Steffen, B., Levi, G. (eds.) VMCAI 2004. LNCS, vol. 2937, pp. 239–251. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  23. 23.
    Reisig, W.: Petri Nets: An Introduction. EATCS Monographs on Theoretical Computer Science. Springer, Berlin (1985)CrossRefzbMATHGoogle Scholar
  24. 24.
    Sohn, K., Van Gelder, A.: Termination detection in logic programs using argument sizes. In: PODS, pp. 216–226. ACM Press (1991)Google Scholar
  25. 25.
    Spoto, F., Mesnard, F., Payet, É.: A termination analyzer for java bytecode based on path-length. ACM Trans. Program. Lang. Syst. 32(3) (2010)Google Scholar
  26. 26.
    Tiwari, A.: Termination of Linear Programs. In: Alur, R., Peled, D.A. (eds.) CAV 2004. LNCS, vol. 3114, pp. 70–82. Springer, Heidelberg (2004)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Amir M. Ben-Amram
    • 1
  • Samir Genaim
    • 2
  • Abu Naser Masud
    • 3
  1. 1.School of Computer ScienceThe Tel-Aviv Academic CollegeIsrael
  2. 2.DSICComplutense University of Madrid (UCM)Spain
  3. 3.DLSIISTechnical University of Madrid (UPM)Spain

Personalised recommendations