Abstract
We demonstrate the usefulness of higher-order rewriting techniques for specializing programs, i.e., for partial evaluation. More precisely, we demonstrate how casting program specializers as combinatory reduction systems (CRSs) makes it possible to formalize the corresponding program transformations as meta-reductions, i.e., reductions in the internal “substitution calculus.” For partial-evaluation problems, this means that instead of having to prove on a case-by-case basis that one's “two-level functions” operate properly, one can concisely formalize them as a combinatory reduction system and obtain as a corollary that static reduction does not go wrong and yields a well-formed residual program.
We have found that the CRS substitution calculus provides an adequate expressive power to formalize partial evaluation: it provides sufficient termination strength while avoiding the need for additional restrictions such as types that would complicate the description unnecessarily (for our purpose).
In addition, partial evaluation provides a number of examples of higher-order rewriting where being higher order is a central (rather than an occasional or merely exotic) property. We illustrate this by demonstrating how standard but non-trivial partial-evaluation examples are handled with higher-order rewriting.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Henk Barendregt. The Lambda Calculus —Its Syntax and Semantics. North-Holland, 1984.
Anders Bondorf. Towards a self-applicable partial evaluator for term rewriting systems. In Dines BjØrner, Andrei P. Ershov, and Neil D. Jones, editors, Partial Evaluation and Mixed Computation, pages 27–50. North-Holland, 1988.
Charles Consel and Olivier Danvy. Tutorial notes on partial evaluation. In Susan L. Graham, editor, Proceedings of the Twentieth Annual ACM Symposium on Principles of Programming Languages, pages 493–501, Charleston, South Carolina, January 1993. ACM Press.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361–391, December 1992.
Olivier Danvy and Frank Pfenning. The occurrence of continuation parameters in CPS terms. Technical report CMU-CS-95-121, School of Computer Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, February 1995.
Olivier Danvy and Kristoffer H0gsbro Rose. Higher-order rewriting and partial evaluation. Technical Report BRICS RS-97-46, Department of Computer Science, University of Aarhus, Aarhus, Denmark, December 1997.
Nachum Dershowitz. Program abstraction and instantiation. ACM Transactions on Programming Languages and Systems, 7(3):446–477, 1985.
Nachum Dershowitz and Zohar Manna. Proving termination with multiset orderings. Communications of the ACM, 22(8):465–476, 1979.
Daniel P. Friedman, Mitchell Wand, and Christopher T. Haynes. Essentials of Programming Languages. The MIT Press and McGraw-Hill, 1991.
John Hughes. Super combinators: A new implementation method for applicative languages. In Daniel P. Friedman and David S. Wise, editors, Conference Record of the 1982 ACM Symposium on Lisp and Functional Programming, pages 1–10, Pittsburgh, Pennsylvania, August 1982.
Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall International Series in Computer Science. Prentice-Hall, 1993.
Neil D. Jones, Peter Sestoft, and Harald SØndergaard. An experiment in partial evaluation: The generation of a compiler generator. In Jean-Pierre Jouannaud, editor, Rewriting Techniques and Applications, number 202 in Lecture Notes in Computer Science, pages 124–140, Dijon, France, May 1985.
Stephen C. Kleene. Introduction to Metamathematics. D. van Nostrand, Princeton, New Jersey, 1952.
Jan Willem Klop. Combinatory Reduction Systems. Mathematical Centre Tracts 127. Mathematisch Centrum, Amsterdam, 1980.
Jan Willem Klop. Term rewriting systems. In Samson Abramsky, Dov M. Gabby, and T. S. E. Maibaum, editors, Handbook of Logic in Computer Science, Vol. 2, chapter 1, pages 2–116. Oxford University Press, Oxford, 1992.
Jan Willem Klop, Vincent van Oostrom, and Femke van Raamsdonk. Combinatory reduction systems: Introduction and survey. Theoretical Computer Science, 121:279–308, 1993.
Flemming Nielson and Hanne Riis Nielson. 2-level λ-lifting. In Harald Ganzinger, editor, Proceedings of the Second European Symposium on Programming, number 300 in Lecture Notes in Computer Science, pages 328–343, Nancy, France, March 1988.
Tobias Nipkow. Orthogonal higher-order rewrite systems are confluent. In M. Bezem and J. F. Groote, editors, Typed Lambda Calculi and Applications, number 664 in Lecture Notes in Computer Science, pages 306–317, Utrecht, The Netherlands, March 1993.
Jens Palsberg. Correctness of binding-time analysis. Journal of Functional Programming, 3(3):347–363, July 1993.
Gordon D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1:125–159, 1975.
Kristoffer HØgsbro Rose. Operational Reduction Models for Functional Programming Languages. PhD thesis, DIKU, Computer Science Department, University of Copenhagen, Universitetsparken 1, DK-2100 KØbenhavn Ø, February 1996. DIKU report 96/1, available from (URL: http://www.diku.dk/ research/published/96-1.ps.gz).
Amr Sabry and Matthias Felleisen. Reasoning about programs in continuationpassing style. LISP and Symbolic Computation, 6(3/4):289–360, December 1993.
Amr Sabry and Philip Wadler. Compiling with reflections. In R. Kent Dybvig, editor, Proceedings of the 1996 ACM SIGPLAN International Conference on Functional Programming, pages 13–24, Philadelphia, Pennsylvania, May 1996. ACM Press.
David Sherman and Robert Strandh. Optimization of equational programs using partial evaluation. In Paul Hudak and Neil D. Jones, editors, Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, SIGPLAN Notices, Vol. 26, No 9, pages 72–82, New Haven, Connecticut, June 1991. ACM Press.
Vincent van Oostrom and Femke van Raamsdonk. Comparing combinatory reduction systems and higher-order rewrite systems. In HOA-93, volume 816 of LNCS, pages 276–304. Springer-Verlag, 1993.
Vincent van Oostrom and Femke van Raamsdonk. Weak orthogonality implies confluence: the higher-order case. Technical Report CS-R9501, CWI, 1995.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1998 Springer-Verlag
About this paper
Cite this paper
Danvy, O., Rose, K.H. (1998). Higher-order rewriting and partial evaluation. In: Nipkow, T. (eds) Rewriting Techniques and Applications. RTA 1998. Lecture Notes in Computer Science, vol 1379. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0052377
Download citation
DOI: https://doi.org/10.1007/BFb0052377
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-64301-2
Online ISBN: 978-3-540-69721-3
eBook Packages: Springer Book Archive