Finiteness analysis

  • Carsten Kehler Holst
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 523)

Abstract

This paper address quasi-termination (or finiteness) in general and termination of poly-variant partial evaluation in particular. A program is quasi-terminating if it only goes through finitely many different states. A terminating program is a special case of a quasi-terminating program, only going through finitely many states. Furthermore a quasi-terminating program can easily be converted into a terminating program that gives the same result except where the original program was non-terminating.

The following observation makes quasi-termination interesting when it comes to partial evaluation. Partial evaluation of a program will terminate iff the program is quasi-terminating in the static part of the state, i.e., only finitely many statically different states can be reached.

This paper develops a finiteness analysis, and shows how its results can be used to ensure termination of partial evaluation. The finiteness analysis is an abstraction of a transition semantics consisting of a dependency and a size analysis. It determines various kinds of inductive properties such as increasing, decreasing, and in situ increasing/decreasing arguments. Sufficient conditions for quasi-termination is then stated in terms of these properties.

Using the result of the finiteness analysis the binding time annotation of a program can be changes (parts of the static data are made dynamic) such that the resulting program is quasi-terminating in the remaining static part of the state. This guarantees that partial evaluation of the program will terminate. Our experiments have shown this algorithm to be powerful enough to handle complicated interpreters and self-applicable partial evaluators with good results.

Keywords

Finiteness termination quasi-termination abstract interpretation transition analysis induction memoisation partial evaluation 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    Anders Bondorf. Automatic autoprojection of higher order recursive equations. In Neil D. Jones, editor, 3rd European Symposium on Programming (ESOP '90), volume 432 of Lecture Notes in Computer Science, pages 70–87, Copenhagen, Denmark, May 1990. Springer-Verlag.Google Scholar
  2. [2]
    G. L. Burn, C. L. Hankin, and S Abramsky. The theory of strictness analysis for higher order functions. In H. Ganzinger and N. D. Jones, editors, Programs as Data Structures, pages 42–62. Lecture Notes in Computer Science, October 1985.Google Scholar
  3. [3]
    Charles Consel. New insights into partial evaluation: The schism experiment. In Harald Ganzinger, editor, 2nd European Symposium on Programming, (ESOP '88), volume 300 of Lecture Notes in Computer Science, pages 236–247, Nancy, France, 1988. Springer-Verlag.Google Scholar
  4. [4]
    Nachum Dershowitz. Termination of rewriting. Journal of Symbolic Computation, 3:69–116, 1987.Google Scholar
  5. [5]
    Neil D. Jones. Automatic program specialization: A re-examination from basic principles. In A.P. Ershov D. Bjørner and N.D. Jones, editors, Partial Evaluation and Mixed Computation, pages 225–282. North-Holland, 1988.Google Scholar
  6. [6]
    Neil D. Jones and Tine Andersen. Notes on a safe binding time analysis. Internal note., 1989.Google Scholar
  7. [7]
    Neil D. Jones, Carsten K. Gomard, Anders Bondorf, Olivier Danvier, and Torben Æ. Mogensen. A self-applicable partial evaluator for the lambda-calculus. In 1990 Interational Conference on Computer Languages. IEEE computer Society, 1990.Google Scholar
  8. [8]
    Neil D. Jones and Allan Mycroft. Data flow analysis of applicative programs using minimal function graphs. In Thirteenth ACM Symposium on Principles of Programming Languages, St. Petersburg, Florida, pages 296–306. ACM, 1986.Google Scholar
  9. [9]
    Neil D. Jones, Peter Sestoft, and Harald Søndergaard. Mix: A self-applicable partial evaluator for experiments in compiler generation. Lisp and Symbolic Computation, 2(1):9–50, 1989.Google Scholar
  10. [10]
    S. C. Kleene. Introduction to Metamathematics. D. van Nostrand, Princeton, New Jersey, 1952.Google Scholar
  11. [11]
    Torben Æ. Mogensen. Partially static structures in a self-applicable partial evaluator. In A.P. Ershov D. Bjørner and N.D. Jones, editors, Partial Evaluation and Mixed Computation, pages 325–347. North-Holland, 1988.Google Scholar
  12. [12]
    Lutz Plümer. Termination Proofs for Logic Programs, volume 446 of Lecture Notes in Artificial Intelligence. Springer-Verlag, 1990.Google Scholar
  13. [13]
    Peter Sestoft. The structure of a self-applicable partial evaluator. In Harald Ganzinger and Neil D. Jones, editors, Programs as Data Objects, volume 217 of Lecture Notes in Computer Science, pages 236–256, Copenhagen, Denmark, 1986. Springer-Verlag.Google Scholar
  14. [14]
    Peter Sestoft. Automatic call unfolding in a partial evaluator. In A.P. Ershov D. Bjørner and N.D. Jones, editors, Partial Evaluation and Mixed Computation, pages 485–506. North-Holland, 1988.Google Scholar
  15. [15]
    V. F. Turchin. The algorithm of generalization in the supercompiler. In A.P. Ershov D. Bjørner and N.D. Jones, editors, Partial Evaluation and Mixed Computation, pages 531–549. North-Holland, 1988.Google Scholar

Copyright information

© Springer-Verlag 1991

Authors and Affiliations

  • Carsten Kehler Holst
    • 1
  1. 1.Department of Computing ScienceUniversity of GlasgowUK

Personalised recommendations