Skip to main content

Higher-order rewriting and partial evaluation

  • Conference paper
  • First Online:

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

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

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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Henk Barendregt. The Lambda CalculusIts Syntax and Semantics. North-Holland, 1984.

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  4. Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361–391, December 1992.

    Article  MathSciNet  MATH  Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  7. Nachum Dershowitz. Program abstraction and instantiation. ACM Transactions on Programming Languages and Systems, 7(3):446–477, 1985.

    Article  MATH  Google Scholar 

  8. Nachum Dershowitz and Zohar Manna. Proving termination with multiset orderings. Communications of the ACM, 22(8):465–476, 1979.

    Article  MathSciNet  MATH  Google Scholar 

  9. Daniel P. Friedman, Mitchell Wand, and Christopher T. Haynes. Essentials of Programming Languages. The MIT Press and McGraw-Hill, 1991.

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  13. Stephen C. Kleene. Introduction to Metamathematics. D. van Nostrand, Princeton, New Jersey, 1952.

    MATH  Google Scholar 

  14. Jan Willem Klop. Combinatory Reduction Systems. Mathematical Centre Tracts 127. Mathematisch Centrum, Amsterdam, 1980.

    Google Scholar 

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

    Google Scholar 

  16. Jan Willem Klop, Vincent van Oostrom, and Femke van Raamsdonk. Combinatory reduction systems: Introduction and survey. Theoretical Computer Science, 121:279–308, 1993.

    Article  MathSciNet  MATH  Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  19. Jens Palsberg. Correctness of binding-time analysis. Journal of Functional Programming, 3(3):347–363, July 1993.

    Article  MathSciNet  Google Scholar 

  20. Gordon D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1:125–159, 1975.

    Article  MathSciNet  MATH  Google Scholar 

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

    Google Scholar 

  22. Amr Sabry and Matthias Felleisen. Reasoning about programs in continuationpassing style. LISP and Symbolic Computation, 6(3/4):289–360, December 1993.

    Article  Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  26. Vincent van Oostrom and Femke van Raamsdonk. Weak orthogonality implies confluence: the higher-order case. Technical Report CS-R9501, CWI, 1995.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Tobias Nipkow

Rights and permissions

Reprints 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

Publish with us

Policies and ethics