Skip to main content

Program Termination Analysis in Polynomial Time

  • Conference paper
  • First Online:
Generative Programming and Component Engineering (GPCE 2002)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2487))

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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.

    Google Scholar 

  2. 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.

    Google Scholar 

  3. 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.

    Google Scholar 

  4. D. De Schreye and S. Decorte. Termination of logic programs: The never-ending story. The Journal of Logic Programming, 19-20:199–260, 1994.

    Article  Google Scholar 

  5. Carl C. Frederiksen. SCT analyzer. At http://www.diku.dk/~xeno/sct.html.

  6. Carl C. Frederiksen. A simple implementation of the size-change principle. Technical Report D-442, Datalogisk Institut Köbenhavns Universitet, 2001.

    Google Scholar 

  7. 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.

    Google Scholar 

  8. Chin Soon Lee. Partial evaluation of the euclidean algorithm, revisited. Higher-Order and Symbolic Computation, 12(2):203–212, Sep 1999.

    Google Scholar 

  9. Chin Soon Lee. Program Termination Analysis, and Termination of Offline Partial Evaluation. PhD thesis, UWA, University of Western Australia, Australia, 2001.

    Google Scholar 

  10. 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.

    Google Scholar 

  11. Chin Soon Lee. Program termination analysis in polynomial time (with proofs). To be available as a technical report at DIKU, Denmark, 2002.

    Google Scholar 

  12. 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.

    Google Scholar 

  13. 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.

  14. Lutz Plümer. Termination Proofs for Logic Programs, volume 446 of LNAI. Springer-Verlag, 1990.

    Google Scholar 

  15. 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.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics