skip to main content
article
Free Access

Program termination analysis in polynomial time

Published:01 January 2007Publication History
Skip Abstract Section

Abstract

A size-change termination algorithm takes as input abstract information about a program in the form of size-change graphs and uses it to determine whether any infinite computation would imply that some data decrease in size infinitely. Since such an infinite descent is presumed impossible, this proves program termination. The property of the graphs that implies program termination is called SCT. There are many examples of practical programs whose termination can be verified by creating size-change graphs and testing them for SCT.The size-change graph abstraction is useful because the graphs often carry sufficient information to deduce termination, and at the same time are simple enough to be analyzed automatically. However, there is a tradeoff between the completeness and efficiency of this analysis, and complete algorithms in the literature can easily be pushed to an exponential combinatorial search by certain patterns in the graph structures.We therefore propose a novel algorithm to detect common forms of parameter-descent behavior efficiently. Specifically, we target lexicographic descent, multiset descent, and min- and max-descent. Our algorithm makes it possible to verify practical instances of SCT while guarding against unwarranted combinatorial search. It has worst-case time complexity cubic in the input size, and its effectiveness is demonstrated empirically using a test suite of over 90 programs.

References

  1. Anderson, H. and Khoo, S. C. 2003. Affine-Based size-change termination. In Proceedings of the 1st Asian Symposium on Programming Languages and Systems (APLAS), A. Ohori, Ed. Lecture Notes in Computer Science, vol. 2895. Springer Verlag, 122--140.Google ScholarGoogle Scholar
  2. Anderson, H. and Khoo, S. C. 2005. Bounded size-change termination. Tech. Rep. TRB6/05, National University of Singapore, Singapore.Google ScholarGoogle Scholar
  3. Apt, K. R. and Pedreschi, D. 1994. Modular termination proofs for logic and pure Prolog programs. In Advances in Logic Programming Theory. Oxford University Press, 183--229. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Arts, T. 2001. Automatically proving termination and innermost normalisation of term rewriting systems. Ph.D. thesis, Universiteit Utrecht, The Netherlands. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Avery, J. 2005. The size-change termination principle on non well founded data types. Tech. Rep., Datalogisk Institut Københavns Universitet, Denmark.Google ScholarGoogle Scholar
  6. Ben-Amram, A. 2002. General size-change termination and lexicographic descent. In The Essence of Computation: Complexity, Analysis, Transformation. Essays Dedicated to Neil D. Jones, T. Mogensen et al. Eds. Lecture Notes in Computer Science, vol. 2566. Springer Verlag, 3--17. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Bueno, F., García de la Banda, M., and Hermenegildo, M. 1994. Effectiveness of global analysis in strict independence-based automatic program parallelization. In Proceedings of the International Logic Programming Symposium (ILPS). MIT Press, Cambridge, MA. 320--336. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Codish, M., Lagoon, V., and Stuckey, P. 2005. Testing for termination with monotonicity constraints. In Proceedings of the 21st International Conference on Logic Programming (ICLP). To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Codish, M., Mariott, K., and Taboch, C. 2000. Improving program analyses by structure untupling. J. Logic Program. 43, 3, 251--263.Google ScholarGoogle ScholarCross RefCross Ref
  10. Codish, M. and Taboch, C. 1997. A semantic basis for termination analysis of logic programs and its realization using symbolic norm constraints. In Proceedings of the 6th International Conference on Algebraic and Logic Programming (ALP), M. Hanus et al., Eds. Lecture Notes in Computer Science, vol. 1298. Springer Verlag, 31--45. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Cormen, T. H., Leiserson, C. E., and Rivest, R. L. 2001. Introduction to Algorithms. MIT Press Cambridge, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Dershowitz, N. and Manna, Z. 1979. Proving termination with multiset orderings. Commun. ACM 22, 8 (Aug.), 465--476. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. De Schreye, D. and Decorte, S. 1994. Termination of logic programs: The never-ending story. J. Logic Program. 19--20, 199--260.Google ScholarGoogle Scholar
  14. Floyd, R. W. 1967. Assigning meanings to programs. Proceedings of Symposia in Applied Mathematics XIX, 19--32.Google ScholarGoogle ScholarCross RefCross Ref
  15. Frederiksen, C. C. 2001. A simple implementation of the size-change principle. Tech. Rep. D-442, Datalogisk Institut Københavns Universitet, Denmark.Google ScholarGoogle Scholar
  16. Genaim, S. and Codish, M. 2002. Combining norms to prove termination. In Proceedings of the International Workshop on Verification, Model Checking and Abstract Interpretation (VMCAI). Springer Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Giesl, J., Thiemann, R., Schneider-Kamp, P., and Falke, S. 2004. Automated termination proofs with AProVE. In Proceedings of the 15th International Conference on Rewriting Techniques and Applications (RTA). Lecture Notes in Computer Science, vol. 3091. Springer Verlag, 210--220. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Glenstrup, A. and Jones, N. 2004. Termination analysis and specialization-point insertion in off-line partial evaluation. Tech. Rep. D-498, Datalogisk Institut Københavns Universitet, Denmark.Google ScholarGoogle Scholar
  19. Jones, N. D. and Bohr, N. 2004. Termination analysis of the untyped lambda calculus. In Proceedings of the 15th International Conference on Rewriting Techniques and Applications (RTA). Lecture Notes in Computer Science, vol. 3091. Springer Verlag, 1--23.Google ScholarGoogle Scholar
  20. Lee, C. S. 1999. Partial evaluation of the Euclidean algorithm, revisited. Higher-Order Symb. Comput. 12, 2 (Sept.), 203--212. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Lee, C. S. 2001. Program termination analysis and termination of offline partial evaluation. Ph.D. thesis, UWA, Australia. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Lee, C. S., Jones, N. D., and Ben-Amram, A. 2001. The size-change principle for program termination. In Proceedings of the 28th ACM Symposium on Principles of Programming Languages (POPL). Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Lee, C. S. 2002. Program termination analysis in polynomial time. In Proceedings of the 1st International Conference on Generative Programming and Component Engineering (GPCE). Lecture Notes in Computer Science, vol. 2487. Sringer Verlag, 218--235. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Lindenstrauss, N. and Sagiv, Y. 1997a. Automatic termination analysis of logic programs (with detailed experimental results). http://www.cs.huji.ac.il/~naomil/.Google ScholarGoogle Scholar
  25. Lindenstrauss, N. and Sagiv, Y. 1997b. Automatic termination analysis of Prolog programs. In Proceedings of the 14th International Conference on Logic Programming (ICLP), L. Naish, Ed. MIT Press, Cambridge, MA. 64--77.Google ScholarGoogle Scholar
  26. Paige, R. and Yang, Z. 1997. High level reading and structure compilation. In Proceedings of the 24th ACM Symposium on Principles of Programming Languages (POPL). 456--469. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Péter, R. 1967. Recursive Functions. Academic Press.Google ScholarGoogle Scholar
  28. Plümer, L. 1990. Termination Proofs for Logic Programs. Lecture Notes in Artificial Intelligence, vol. 446. Springer Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Podelski, A. and Rybalchenko, A. 2005. Transition predicate abstraction and fair termination. In Proceedings of the 32nd ACM Symposium on Principles of Programming Languages (POPL). Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Sagiv, Y. 1991. A termination test for logic programs. In Proceedings of the International Logic Programming Symposium (ILPS), V. Saraswat and K. Ueda, Eds. MIT Press, Cambridge, MA. 518--532.Google ScholarGoogle Scholar
  31. Thiemann, R. and Giesl, J. 2003. Size-Change termination for term rewriting. In Proceedings of the 14th International Conference on Rewriting Techniques and Applications (RTA). Lecture Notes in Computer Science, vol. 2706. Springer Verlag, 264--278. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Thiemann, R. and Giesl, J. 2005. The size-change principle and dependency pairs for termination of term rewriting. In Applicable Algebra in Engineering, Communication and Computing. To appear. doi 10.1007/s00200-005-0179-7. Google ScholarGoogle ScholarCross RefCross Ref
  33. Turing, A. M. 1948. Checking a large routine. In Report of a Conference on High Speed Automatic Calculating Machines. 67--69. Reprinted in The Early British Computer Conferences, vol. 14 of Charles Babbage Institute Reprint Series For The History Of Computing, MIT Press, Cambridge, MA. 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Wahlstedt, D. 2000. Detecting termination using size-change in parameter values. Master's thesis, Göteborgs Universitet, Sweden.Google ScholarGoogle Scholar
  35. Xi, H. 1999. Dependent types for program termination verification. Higher-Order Symb. Comput. 15, 1 (Mar.), 91--131. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Program termination analysis in polynomial time

              Recommendations

              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

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader
              About Cookies On This Site

              We use cookies to ensure that we give you the best experience on our website.

              Learn more

              Got it!