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.
Supported by University of Copenhagen, The Danish Research Academy, and ESPRIT BRA 3124 SEMANTIQUE
Preview
Unable to display preview. Download preview PDF.
References
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.
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.
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.
Nachum Dershowitz. Termination of rewriting. Journal of Symbolic Computation, 3:69–116, 1987.
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.
Neil D. Jones and Tine Andersen. Notes on a safe binding time analysis. Internal note., 1989.
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.
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.
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.
S. C. Kleene. Introduction to Metamathematics. D. van Nostrand, Princeton, New Jersey, 1952.
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.
Lutz Plümer. Termination Proofs for Logic Programs, volume 446 of Lecture Notes in Artificial Intelligence. Springer-Verlag, 1990.
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.
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.
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.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1991 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Holst, C.K. (1991). Finiteness analysis. In: Hughes, J. (eds) Functional Programming Languages and Computer Architecture. FPCA 1991. Lecture Notes in Computer Science, vol 523. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3540543961_23
Download citation
DOI: https://doi.org/10.1007/3540543961_23
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-54396-1
Online ISBN: 978-3-540-47599-6
eBook Packages: Springer Book Archive