skip to main content
research-article
Open access

Size-change termination with difference constraints

Published: 21 May 2008 Publication History

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.

References

[1]
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.
[2]
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.
[3]
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.
[4]
Ben-Amram, A. M. and Lee, C. S. 2007. Size-change analysis in polynomial time. ACM Trans. Prog. Lang. Syst. 29, 1.
[5]
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.
[6]
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.
[7]
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.
[8]
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)).
[9]
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.
[10]
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.
[11]
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.
[12]
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.
[13]
Downey, R. G. and Fellows, M. R. 1995. Fixed-parameter tractability and completeness. I. basic results. SIAM J. Comput. 24, 4 (Aug.), 873--921.
[14]
Graham, R. L. 1981. Rudiments of Ramsey Theory. American Mathematical Society.
[15]
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.
[16]
Jones, N. D. 1997. Computability and Complexity from a Programming Perspective. Foundations of Computing Series. MIT Press, Cambridge, MA.
[17]
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.
[18]
Jones, N. D., Gomard, C. K., and Sestoft, P. 1993. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs, NJ.
[19]
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.
[20]
Lee, C. S. 2002. Program termination analysis and termination of offline partial evaluation. Ph.D. dissertation, University of Western Australia.
[21]
Lee, C. S. 2008. Ranking functions for size-change termination. Submitted for publication in ACM Trans. Prog. Lang. Syst. (Levven, Belgium).
[22]
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.
[23]
Lindenstrauss, N. and Sagiv, Y. 1997a. Automatic termination analysis of logic programs (with detailed experimental results). http://www.cs.huji.ac.il/~naomil/.
[24]
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.
[25]
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.
[26]
Naish, L. 1985. Automating control for logic programs. J. Logic Prog. 2, 3 (Oct.), 167--183.
[27]
Papadimitriou, C. H. 1981. On the complexity of integer programming. J. ACM 28, 4, 765--768.
[28]
Plümer, L. 1990. Termination Proofs for Logic Programs. Lecture Notes in Artificial Intelligence, vol. 446. Springer-Verlag, New York.
[29]
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.
[30]
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.
[31]
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.
[32]
Schreye, D. D. and Decorte, S. 1994. Termination of logic programs: The never-ending story. J. Logic Prog. 19-20, 199--260.
[33]
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.
[34]
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.
[35]
Ullman G. D. and Gelder, V. 1988. Efficient tests for top-down termination of logical rules. J. ACM 35, 2, 345--373.

Cited By

View all
  • (2022)Nested Session TypesACM Transactions on Programming Languages and Systems10.1145/353965644:3(1-45)Online publication date: 15-Jul-2022
  • (2022)Session Coalgebras: A Coalgebraic View on Regular and Context-free Session TypesACM Transactions on Programming Languages and Systems10.1145/352763344:3(1-45)Online publication date: 15-Jul-2022
  • (2022)Runtime Complexity Bounds Using SqueezersACM Transactions on Programming Languages and Systems10.1145/352763244:3(1-36)Online publication date: 15-Jul-2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 30, Issue 3
May 2008
245 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/1353445
Issue’s Table of Contents
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: 21 May 2008
Accepted: 01 March 2007
Revised: 01 November 2006
Received: 01 April 2006
Published in TOPLAS Volume 30, Issue 3

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Abstraction
  2. program analysis
  3. size-change graph
  4. size-change termination
  5. termination analysis

Qualifiers

  • Research-article
  • Research
  • Refereed

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)57
  • Downloads (Last 6 weeks)15
Reflects downloads up to 20 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2022)Nested Session TypesACM Transactions on Programming Languages and Systems10.1145/353965644:3(1-45)Online publication date: 15-Jul-2022
  • (2022)Session Coalgebras: A Coalgebraic View on Regular and Context-free Session TypesACM Transactions on Programming Languages and Systems10.1145/352763344:3(1-45)Online publication date: 15-Jul-2022
  • (2022)Runtime Complexity Bounds Using SqueezersACM Transactions on Programming Languages and Systems10.1145/352763244:3(1-36)Online publication date: 15-Jul-2022
  • (2022)Strong-separation LogicACM Transactions on Programming Languages and Systems10.1145/349884744:3(1-40)Online publication date: 15-Jul-2022
  • (2022)Types for Complexity of Parallel Computation in Pi-calculusACM Transactions on Programming Languages and Systems10.1145/349552944:3(1-50)Online publication date: 15-Jul-2022
  • (2022)For a Few Dollars More: Verified Fine-Grained Algorithm Analysis Down to LLVMACM Transactions on Programming Languages and Systems10.1145/348616944:3(1-36)Online publication date: 15-Jul-2022
  • (2021)Run-time Complexity Bounds Using SqueezersProgramming Languages and Systems10.1007/978-3-030-72019-3_12(320-347)Online publication date: 23-Mar-2021
  • (2017)Complexity and Resource Bound Analysis of Imperative Programs Using Difference ConstraintsJournal of Automated Reasoning10.1007/s10817-016-9402-459:1(3-45)Online publication date: 1-Jun-2017
  • (2017)Automata and Program AnalysisFundamentals of Computation Theory10.1007/978-3-662-55751-8_1(3-10)Online publication date: 16-Aug-2017
  • (2016)Compositional Coinduction with Sized TypesCoalgebraic Methods in Computer Science10.1007/978-3-319-40370-0_2(5-10)Online publication date: 4-Jun-2016
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media