Abstract
This article considers an algorithmic problem related to the termination analysis of programs. More specifically, we are given bounds on differences in sizes of data values before and after every transition in the program's control-flow graph. Our goal is to infer program termination via the following reasoning (“the size-change principle”): if in any infinite (hypothetic) execution of the program, some size must descend unboundedly, the program must always terminate, since infinite descent of a natural number is impossible.
The problem of inferring termination from such abstract information is not the halting problem for programs and may well be decidable. If this is the case, the decision algorithm forms a “back end” of a termination verifier, and it is interesting to find out the computational complexity of the problem.
A restriction of the problem described above, which only uses monotonicity information (but not difference bounds), is already known to be decidable. We prove that the unrestricted problem is undecidable, which gives a theoretical argument for studying restricted cases. We consider a case where the termination proof is allowed to make use of at most one bound per target variable in each transition. For this special case, which we claim is practically significant, we give (for the first time) an algorithm and show that the problem is in PSPACE, in fact that it is PSPACE-complete. The algorithm is based on combinatorial arguments and results from the theory of integer programming not previously used for similar problems.
The algorithm has interesting connections to other work in termination, in particular to methods for generating linear ranking functions or invariants.
- Anderson, H. and Khoo, S.-C. 2003. Affine-based size-change termination. In Proceedings of the First Asian Symposium on Programming Languages and Systems (APLAS 2003) (Beijing, China), A. Ohori, Ed. Lecture Notes in Computer Science, vol. 2895. Springer-Verlag, New York, 122--140.Google Scholar
- 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, Oxford, UK, 183--229. Google Scholar
Digital Library
- Avery, J. 2006. Size-change termination and bound analysis. In Proceedings of the 8th International Symposium on Functional and Logic Programming (FLOPS 2006) M. Hagiya and P. Wadler, Eds. Lecture Notes in Computer Science, vol. 3945. Springer-Verlag, New York. Google Scholar
Digital Library
- Ben-Amram, A. M. and Lee, C. S. 2007. Size-change analysis in polynomial time. ACM Trans. Prog. Lang. Syst. 29, 1. Google Scholar
Digital Library
- Brodsky, A. and Sagiv, Y. 1991. Inference of inequality constraints in logic programs. In Proceedings of the 10th ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS). ACM, New York, 227--240. Google Scholar
Digital Library
- 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 Symposium on Logic Programming. MIT Press, Cambridge, MA, 320--336. Google Scholar
Digital Library
- Codish, M., Lagoon, V., and Stuckey, P. J. 2005. Testing for termination with monotonicity constraints. In Logic Programming, 21st International Conference, ICLP 2005, M. Gabbrielli and G. Gupta, Eds. Lecture Notes in Computer Science, vol. 3668. Springer-Verlag, New York, 326--340. Google Scholar
Digital Library
- Codish, M. and Taboch, C. 1999. A semantic basis for termination analysis of logic programs. The Journal of Logic Programming 41, 1, 103--123. (Preliminary (conference) version in LNCS 1298 (1997)). Google Scholar
Digital Library
- Colón, M. and Sipma, H. 2002. Practical methods for proving program termination. In Proceedings of the 14th International Conference on Computer Aided Verification (CAV). Lecture Notes in Computer Science, vol. 2404. Springer-Verlag, New York, 442--454. Google Scholar
Digital Library
- Cook, B., Podelski, A., and Rybalchenko, A. 2005. Abstraction refinement for termination. In Proceedings of the 12th International Symposium on Static Analysis (SAS'05) (London, UK, Sept. 7--9) Lecture Notes in Computer Science, vol. 3672. Springer-Verlag, New York, 87--101. Google Scholar
Digital Library
- Cook, B., Podelski, A., and Rybalchenko, A. 2006. Terminator: Beyond safety. In Proceedings of the 18th International Conference on Computer Aided Verification (CAV 2006), (Seattle, WA, Aug.), T. Ball and R. B. Jones, Eds. Lecture Notes in Computer Science, vol. 4144. Springer-Verlag, New York, 415--418. Google Scholar
Digital Library
- Dershowitz, N., Lindenstrauss, N., Sagiv, Y., and Serebrenik, A. 2001. A general framework for automatic termination analysis of logic programs. Applic. Algebra Eng. Commun. Comput. 12, 1--2, 117--156.Google Scholar
Cross Ref
- Downey, R. G. and Fellows, M. R. 1995. Fixed-parameter tractability and completeness. I. basic results. SIAM J. Comput. 24, 4 (Aug.), 873--921. Google Scholar
Digital Library
- Graham, R. L. 1981. Rudiments of Ramsey Theory. American Mathematical Society.Google Scholar
- Jones, N. D. 1988. Automatic program specialization: A re-examination from basic principles. In Partial Evaluation and Mixed Computation, D. Bjørner, A. P. Ershov, and N. D. Jones, Eds. North-Holland, Amsterdam, The Netherlands, 225--282.Google Scholar
- Jones, N. D. 1997. Computability and Complexity from a Programming Perspective. Foundations of Computing Series. MIT Press, Cambridge, MA. Google Scholar
Digital Library
- 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'04). Lecture Notes in Computer Science, vol. 3091. Springer-Verlag, New York, 1--23.Google Scholar
- Jones, N. D., Gomard, C. K., and Sestoft, P. 1993. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs, NJ. Google Scholar
Digital Library
- Jones, N. D., Landweber, L. H., and Lien, Y. E. 1977. Complexity of some problems in Petri nets. Theoret. Comput. Sci. 4, 3 (June), 277--299.Google Scholar
Cross Ref
- Lee, C. S. 2002. Program termination analysis and termination of offline partial evaluation. Ph.D. dissertation, University of Western Australia.Google Scholar
- Lee, C. S. 2008. Ranking functions for size-change termination. Submitted for publication in ACM Trans. Prog. Lang. Syst. (Levven, Belgium). Google Scholar
Digital Library
- Lee, C. S., Jones, N. D., and Ben-Amram, A. M. 2001. The size-change principle for program termination. In Proceedings of the 28th ACM Symposium on Principles of Programming Languages. ACM, New York, 81--92. Google Scholar
Digital Library
- Lindenstrauss, N. and Sagiv, Y. 1997a. Automatic termination analysis of logic programs (with detailed experimental results). http://www.cs.huji.ac.il/~naomil/.Google Scholar
- Lindenstrauss, N. and Sagiv, Y. 1997b. Automatic termination analysis of Prolog programs. In Proceedings of the 14th International Conference on Logic Programming (Leuven, Belgium). L. Naish, Ed. MIT Press, Cambridge, MA, 64--77.Google Scholar
- Manolios, P. and Vroon, D. 2006. Termination analysis with calling context graphs. In Proceedings of the 18th International Conference on Computer Aided Verification (CAV 2006) (Seattle, WA Aug.). Lecture Notes in Computer Science, vol. 4144. Springer-Verlag, New York, 401--414. Google Scholar
Digital Library
- Naish, L. 1985. Automating control for logic programs. J. Logic Prog. 2, 3 (Oct.), 167--183. Google Scholar
Digital Library
- Papadimitriou, C. H. 1981. On the complexity of integer programming. J. ACM 28, 4, 765--768. Google Scholar
Digital Library
- Plümer, L. 1990. Termination Proofs for Logic Programs. Lecture Notes in Artificial Intelligence, vol. 446. Springer-Verlag, New York. Google Scholar
Digital Library
- Podelski, A. and Rybalchenko, A. 2004. Transition invariants. In Proceedings of the Symposium on Logic in Computer Science (LICS'04). H. Ganzinger, Ed. IEEE Computer Society Press, Los Alamitos, CA, 32--41. Google Scholar
Digital Library
- Ramsey, F. P. 1930. On a problem of formal logic. In Proceedings of the London Mathematical Society. The London Mathematical Society, London, UK, 264--286.Google Scholar
Cross Ref
- Sagiv, Y. 1991. A termination test for logic programs. In Proceedings of the International Symposium on Logic Programming (San Diego, CA). V. Saraswat and K. Ueda, Eds. MIT Press, Cambridge, MA, 518--532.Google Scholar
- Schreye, D. D. and Decorte, S. 1994. Termination of logic programs: The never-ending story. J. Logic Prog. 19-20, 199--260.Google Scholar
Cross Ref
- Sohn, K. and Van Gelder, A. 1991. Termination detection in logic programs using argument sizes (extended abstract). In Proceedings of the 10th ACM SIGACT-SIGMOD-SOGART Symposium on Principles of Database Systems (PODS) (Denver, CO, May). ACM, New York, 216--226. Google Scholar
Digital Library
- Thiemann, R. and Giesl, J. 2005. The size-change principle and dependency pairs for termination of term rewriting. Applic. Algebra Eng. Commun. Comput. 16, 4 (Sept.), 229--270. Google Scholar
Cross Ref
- Ullman G. D. and Gelder, V. 1988. Efficient tests for top-down termination of logical rules. J. ACM 35, 2, 345--373. Google Scholar
Digital Library
Index Terms
Size-change termination with difference constraints
Recommendations
Program termination analysis in polynomial time
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 ...
The size-change principle for program termination
The "size-change termination" principle for a first-order functional language with well-founded data is: a program terminates on all inputs if every infinite call sequence (following program control flow) would cause an infinite descent in some data ...
The size-change principle for program termination
POPL '01: Proceedings of the 28th ACM SIGPLAN-SIGACT symposium on Principles of programming languagesThe "size-change termination" principle for a first-order functional language with well-founded data is: a program terminates on all inputs if every infinite call sequence (following program control flow) would cause an infinite descent in some data ...






Comments