Abstract
Recall the size-change principle for program termination: An infinite computation is impossible, if it would give rise to an infinite sequence of size-decreases for some data values. For an actual analysis, size-change graphs are used to capture the data size changes in possible program state transitions. A graph sequence that respects program control flow is called a multipath. The set of multipaths describe possible state transition sequences. To show that such sequences are finite, it is sufficient that the graphs satisfy size-change termination (SCT): Every infinite multipath has infinite descent, according to the arcs of the graphs. This is an application of the size-change principle.
SCT is decidable, but complete for pspace. In this paper, we explore efficient approximations that are sufficiently precise in practice. For size-change graphs that can loop (i.e., they give rise to an infinite multipath), and that satisfy SCT, it is usual to find amongst them an anchor— some graph whose infinite occurrence in a multipath causes infinite descent. The SCT approximations are based on finding and eliminating anchors, as far as possible. If the remaining graphs cannot loop, then SCT is established.
An efficient method is proposed to find anchors among fan-in free graphs, as such graphs occur commonly in practice. This leads to a worst-case quadratic-time approximation of SCT. An extension of the method handles general graphs and can detect some rather subtle descent. It leads to a worst-case cubic-time approximation of SCT. Experiments confirm the effectiveness and efficiency of the approximations in practice.
This research is supported by DAEDALUS, the RTD project IST-1999-20527 of the IST Programme within the European Union’s Fifth Framework Programme.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
K. R. Apt and D. Pedreschi. Modular termination proofs for logic and pure prolog programs. In Advances in Logic Programming Theory, pages 183–229. Oxford University Press, 1994.
F. Bueno, M. GarcÃa de la Banda, and M. Hermenegildo. Effectiveness of global analysis in strict independence-based automatic program parallelization. In International Symposium on Logic Programming, pages 320–336. MIT Press, 1994.
Michael Codish and Cohavit Taboch. A semantic basis for termination analysis of logic programs and its realization using symbolic norm constraints. In Michael Hanus, Jan Heering, and Karl Meinke, editors, Algebraic and Logic Programming, 6th International Joint Conference, ALP’ 97-HOA’ 97, Southampton, U.K., Sep 3-5, 1997, volume 1298 of LNCS, pages 31–45. Springer, 1997.
D. De Schreye and S. Decorte. Termination of logic programs: The never-ending story. The Journal of Logic Programming, 19-20:199–260, 1994.
Carl C. Frederiksen. SCT analyzer. At http://www.diku.dk/~xeno/sct.html.
Carl C. Frederiksen. A simple implementation of the size-change principle. Technical Report D-442, Datalogisk Institut Köbenhavns Universitet, 2001.
Neil Jones and Arne Glenstrup. Program generation, termination, and binding-time analysis. In Principles, Logics, and Implementations of High-Level Programming Languages, PLI 2002 (invited paper). Springer, 2002.
Chin Soon Lee. Partial evaluation of the euclidean algorithm, revisited. Higher-Order and Symbolic Computation, 12(2):203–212, Sep 1999.
Chin Soon Lee. Program Termination Analysis, and Termination of Offline Partial Evaluation. PhD thesis, UWA, University of Western Australia, Australia, 2001.
Chin Soon Lee. Finiteness analysis in polynomial time. In M. Hermenegildo and G. Puebla, editors, Proceedings of Static Analysis Symposium, volume 2477 of LNCS. Springer, 2002.
Chin Soon Lee. Program termination analysis in polynomial time (with proofs). To be available as a technical report at DIKU, Denmark, 2002.
Chin Soon Lee, Neil D. Jones, and Amir Ben-Amram. The size-change principle for program termination. In Proceedings of the ACM Symposium on Principles of Programming Languages, Jan 2001. ACM, 2001.
Naomi Lindenstrauss and Yehohua Sagiv. Automatic termination analysis of logic program (with detailed experimental results). Article available at http://www.cs.huji.ac.il/~naomil/, 1997.
Lutz Plümer. Termination Proofs for Logic Programs, volume 446 of LNAI. Springer-Verlag, 1990.
Wim Vanhoof and Maurice Bruynooghe. Binding-time annotations without binding-time analysis. In Logic for Programming, Artificial Intelligence, and Reasoning (LPAR), 8th International Conference, Havana, Cuba, Dec 3-7, 2001, volume 2250 of LNCS, pages 707–722, 2001.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lee, C.S. (2002). Program Termination Analysis in Polynomial Time. In: Batory, D., Consel, C., Taha, W. (eds) Generative Programming and Component Engineering. GPCE 2002. Lecture Notes in Computer Science, vol 2487. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45821-2_14
Download citation
DOI: https://doi.org/10.1007/3-540-45821-2_14
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-44284-4
Online ISBN: 978-3-540-45821-0
eBook Packages: Springer Book Archive