Abstract
Moggi's computational lambda calculus λc is a well-established model of computation. We define a two-level version λ c of the computational lambda calculus and demonstrate that it is an inevitable description for sound specialization. We implement the calculus in terms of a standard two-level lambda calculus via a continuation-passing style transformation. This transformation is sound and complete with respect to λc; it forms a reflection in the two-level lambda calculus of λ c. As a practical ramification of this work we show that several published specialization algorithms are unsound and develop a sound specializer similar to continuation-based specializers.
Preview
Unable to display preview. Download preview PDF.
References
H. P. Barendregt. The Lambda Calculus — Its Syntax and Semantics. NorthHolland, 1984.
Gilles Barthe, John Hatcliff, and Morten Heine Sørensen. Reflections on reflections. In Hugh Glaser and Herbert Kuchen, editors, Programming Languages, Implementations, Logics, and Programs (PLILP '97), volume ? of Lecture Notes in Computer Science, page To appear, Southampton, England, September 1996. Springer-Verlag.
Anders Bondorf. Improving binding-times without explicit CPS conversion. In Proc. 1992 ACM Conference on Lisp and Functional Programming, pages 1–10, San Francisco, California, USA, June 1992.
Anders Boudorf and Olivier Danvy. Automatic autoprojection of recursive equations with global variables and abstract data types. Science of Programming, 16(2):151–195, 1991.
Anders Bondorf and Dirk Dussart. Improving CPS-based partial evaluation: Writing cogen by hand. In Peter Sestoft and Harald Søndergaard, editors, Proc. ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation PEPM '94, pages 1–10, Orlando, Fla., June 1994. ACM.
Anders Bondorf and Jesper Jørgensen. Efficient analyses for realistic off-line partial evaluation: Extended version. Technical Report 93/4, DIKU, University of Copenhagen, Denmark, 1993. extended version of [7].
Anders Bondorf and Jesper Jørgensen, Efficient analysis for realistic off-line partial evaluation. Journal of Functional Programming, 3(3):315–346, July 1993.
William Clinger and Jonathan Rees. Revised 4 report on the algorithmic language scheme. Al Memo 84ßb, MIT, 1991. ftp://swiss-ftp.ai.mit.edu/pub/scm/r4rs.texi.
Charles Consel and Olivier Danvy. For a better support of static data flow. In John Hughes, editor, Proc. Functional Programming Languages and Computer Architecture 1991, volume 523 of Lecture Notes in Computer Science, pages 496–519, Cambridge, MA, 1991. Springer-Verlag.
Olivier Danvy. Back to direct style. Science of Programming, 22:183–195, 1994.
Olivier Danvy and Dirk Dussart. CPS transformation after binding-time analysis. Unpublished note, Computer Science Department, Aarhus University, April 1995.
B. A. Davey and H. A. Priestley. Introduction to Lattices and Order. Cambridge University Press, 1990.
Rowan Davies. A temporal-logic approach to binding-time analysis. In Proceedings, 11 th Annual IEEE Symposium on Logic in Computer Science, pages 184–195, New Brunswick, New Jersey, July 1996. IEEE Computer Society Press.
Rowan Davies and Frank Pfenning. A modal analysis of staged computation. In Proc. 23rd Annual ACM Symposium on Principles of Programming Languages, pages 258–270, St. Petersburg, Fla., January 1996. ACM Press.
Dirk Dussart and Eddy Bevers. CPS transformation after binding-time analysis (extended abstract). In Proceedings of the 7th Nordic Workshop on Programming Theory, pages 112–126, Göteborg, Sweden, November 1995.
Dirk Dussart and Peter Thiemann. Partial evaluation for higher-order languages with state. Berichte des Wilhelm-Schickard-Instituts WSI-97-XX, Universität Tübingen, April 1997.
R. Kent Dybvig, editor. International Conference on Functional Programming, Philadelphia, PA, May 1996. ACM Press, New York.
Cormac Flanagan, Amr Sabry, Bruce F. Duba, and Matthias Felleisen. The essence of compiling with continuations. In Proc. of the ACM SIGPLAN '93 Conference on Programming Language Design and Implementation, pages 237–247, Albuquerque, New Mexico, June 1993.
Robert Glück and Jesper Jørgensen. Efficient multi-level generating extensions for program specialization. In Swierstra and Hermenegildo [36], pages 259–278.
Carsten K. Gomard. A self-applicable partial evaluator for the lambda-calculus. ACM Transactions on Programming Languages and Systems, 14(2):147–172, 1992.
John Hatcliff. Mechanically verifying the correctness of an offline partial evaluator. In Swierstra and Hermenegildo [36], pages 279–298.
John Hatcliff and Olivier Danvy. A generic account of continuation-passing styles. In Proc. 21st Annual ACM Symposium on Principles of Programming Languages, pages 458–471, Portland, OG, January 1994. ACM Press.
John Hatcliff and Olivier Danvy. A computational formalization for partial evaluation. Mathematical Structures in Computer Science, 1997. To appear.
Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall, 1993.
Julia Lawall and Olivier Danvy. Continuation-based partial evaluation. In Proc. 1994 ACM Conference on Lisp and Functional Programming, pages 227–238, Orlando, Florida, USA, June 1994. ACM Press.
Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, 1990.
Eugenio Moggi. Computational lambda-calculus and monads. Technical Report ECS-LFCS-88-86, University of Edinburgh, 1988.
Eugenio Moggi. Computational lambda-calculus and monads. In Proc. of the 4rd Annual Symposium on Logic in Computer Science, pages 14–23, Pacific Grove, CA, June 1989. IEEE Computer Society Press.
Eugenio Moggi. A categorical account of two-level languages. In Proc. Mathematical Foundations of Programming Semantics, Thirteenth Annual Conference, volume 5 of Electronic Notes in Theoretical Computer Science, Pittsburgh, PA, March 1997. Carnegie Mellon University, Elsevier Science BV.
Flemming Nielson. A formal type system for comparing partial evaluators. In Dines Bjørner, Andrei P. Ershov, and Neil D. Jones, editors, Partial Evaluation and Mixed Computation, pages 349–384, Amsterdam, 1988. North-Holland.
Flemming Nielson and Hanne Riis Nielson. Two-Level Functional Languages. Cambridge University Press, 1992.
Jens Palsberg. Correctness of binding-time analysis. Journal of Functional Programming, 3(3):347–364, July 1993.
Gordon Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1:125–159, 1975.
Amr Sabry and Matthias Felleisen. Reasoning about programs in continuationpassing style. Lisp and Symbolic Computation, 6(3/4):289–360, 1993.
Amr Sabry and Philip Wadler. A reflection on call-by-value. In Dybvig [17], pages 13–24.
Doaitse Swierstra and Manuel Hermenegildo, editors. Programming Languages, Implementations, Logics, and Programs (PLILP '95), volume 982 of Lecture Notes in Computer Science, Utrecht, The Netherlands, September 1995. Springer-Verlag.
Peter Thiemann. Cogen in six lines. In Dybvig [I7], pages 180–189.
Mitchell Wand. Specifying the correctness of binding-time analysis. Journal of Functional Programming, 3(3):365–387, July 1993.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1997 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lawall, J.L., Thiemann, P. (1997). Sound specialization in the presence of computational effects. In: Abadi, M., Ito, T. (eds) Theoretical Aspects of Computer Software. TACS 1997. Lecture Notes in Computer Science, vol 1281. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0014551
Download citation
DOI: https://doi.org/10.1007/BFb0014551
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-63388-4
Online ISBN: 978-3-540-69530-1
eBook Packages: Springer Book Archive