Skip to main content

Reasoning about programs in continuation-passing style

Abstract

Plotkin's λ v -calculus for call-by-value programs is weaker than the λβη-calculus for the same programs in continuation-passing style (CPS). To identify the call-by-value axioms that correspond to βη on CPS terms, we define a new CPS transformation and an inverse mapping, both of which are interesting in their own right. Using the new CPS transformation, we determine the precise language of CPS terms closed under βη-transformations, as well as the call-by-value axioms that correspond to the so-called administrative βη-reductions on CPS terms. Using the inverse mapping, we map the remaining β and η equalities on CPS terms to axioms on call-by-value terms. On the pure (constant free) set of Λ-terms, the resulting set of axioms is equivalent to Moggi's computational λ-calculus. If the call-by-value language includes the control operatorsabort andcall-with-current-continuation, the axioms are equivalent to an extension of Felleisenet al.'s λ v -C-calculus and to the equational subtheory of Talcott's logic IOCC.

This is a preview of subscription content, access via your institution.

References

  1. Allison, L.A Practical Introduction to Denotational Semantics. Volume 23 ofCambridge Computer Science Texts, Cambridge University Press (1986).

  2. Appel, A.Compiling with Continuations. Cambridge University Press (1992).

  3. Appel, A. and Jim, T. Continuation-passing, closure-passing style. InConference Record of the 16th ACM Symposium on Principles of Programming Languages (1989) 293–302.

  4. Barendregt, H. P.The Lambda Calculus: Its Syntax and Semantics. Volume 103 ofStudies in Logic and the Foundations of Mathematics, North-Holland, revised edition (1984).

  5. Bartley, D. H. and Jensen, J. C. The implementation of PC Scheme. InProceedings of the ACM Conference on Lisp and Functional Programming (1986) 86–93.

  6. Boehm, H.-J. and Demers, A. Implementing Russel. InProceedings of the ACM Sigplan Symposium on Compiler Construction, Sigplan Notices, 21, 7 (1986) 186–195.

  7. Bondorf, A. Improving binding times without explicit CPS-conversion. InProceedings of the ACM Conference on Lisp and Functional Programming (1992) 1–10.

  8. Clinger, W., Friedman, D., and Wand, M. A scheme for a higher-level semantic algebra. In Reynolds, J. and Nivat, M., editors,Algebraic Methods in Semantics, Cambridge University Press (1985) 237–250.

  9. Crank, E. and Felleisen, M. Parameter-passing and the lambda calculus. InConference Record of the 18th ACM Symposium on Principles of Programming Languages (1991) 233–244.

  10. Curry, H. B. and Feys, R.Combinatory Logic, Volume I. North-Holland, Amsterdam (1958).

    Google Scholar 

  11. Danvy, O. Back to direct style.Science of Computer Programming (1993). To appear. Preliminary version in: Proceedings of the 4th European Symposium on Programming, 1992. Lecture Notes in Computer Science, 582, Springer Verlag.

  12. Danvy, O. and Filinski, A. Abstracting control. InProceedings of the ACM Conference on Lisp and Functional Programming (1990) 151–160.

  13. Danvy, O. and Filinski, A. Representing control: A study of the CPS transformation.Mathematical Structures in Computer Science, 2, 4 (1992) 361–391.

    Google Scholar 

  14. Danvy, O. and Lawall, J. Back to direct style II: First-class continuations. InProceedings of the ACM Conference on Lisp and Functional Programming (1992) 299–310.

  15. Felleisen, M. The theory and practice of first-class prompts. InConference Record of the 15th ACM Symposium on Principles of Programming Languages (1988) 180–190.

  16. Felleisen, M. and Friedman, D. P. Control operators, the SECD-machine, and the λ-calculus. In Wirsing, M., editor,Formal Description of Programming Concepts-III, North-Holland (1986) 193–217.

  17. Felleisen, M. and Friedman, D. P. A syntactic theory of sequential state.Theoretical Computer Science, 69, 3 (1989) 243–287. Preliminary version in: Conference Record of the 14th ACM Symposium on Principles of Programming Languages, 1987.

    Google Scholar 

  18. Felleisen, M. and Hieb, R. The revised report on the syntactic theories of sequential control and state.Theoretical Computer Science, 102 (1992) 235–271. Technical Report 89–100, Rice University.

    Google Scholar 

  19. Felleisen, M., Friedman, D. P., Kohlbecker, E., and Duba, B. A syntactic theory of sequential control.Theoretical Computer Science, 52, 3 (1987) 205–237. Preliminary version: Reasoning with Continuations, in Proceedings of the 1st IEEE Symposium on Logic in Computer Science. 1986.

    Google Scholar 

  20. Felleisen, M., Wand, M., Friedman, D.P., and Duba, B.F. Abstract continuations: A mathematical semantics for handling full functional jumps. InProceedings of the ACM Conference on Lisp and Functional Programming (1988) 52–62.

  21. Fischer, M. Lambda calculus schemata. InProceedings of the ACM Conference on Proving Assertions About Programs, Sigplan Notices, 7, 1 (1972) 104–109. Expanded version inLISP and Symbolic Computation (this issue).

  22. Flanagan, C., Sabry, A., Duba, B. F., and Felleisen, M. The essence of compiling with continuations. InProceedings of the ACM Sigplan Conference on Programming Language Design and Implementation (1993). To appear.

  23. Friedman, D. P., Haynes, C.T., and Kohlbecker, E. Programming with continuations. In Pepper, P., editor,Program Transformations and Programming Environments, Springer-Verlag (1985) 263–274.

  24. Friedman, D. P., Wand, M., and Haynes, C.T.Essentials of Programming Languages. The MIT Press (1992).

  25. Galbiati, L. and Talcott, C. L. A simplifier for untyped lambda expressions. InProceedings Conditional Term Rewriting Systems, Lecture Notes in Computer Science, 516 (1990) 342–353.

  26. Griffin, T.G. A formulae-as-type notion of control. InConference Record of the 17th ACM Symposium on Principles of Programming Languages (1990) 47–58.

  27. Haynes, C.T., Friedman, D. P., and Wand, M. Obtaining coroutines from continuations.Journal of Computer Languages (Pergamon Press), 11, 3/4 (1986) 143–153.

    Google Scholar 

  28. Hieb, R., Dybvig, K., and Bruggeman, C. Representing control in the presence of first-class continuations. InProceedings of the ACM Sigplan Conference on Programming Language Design and Implementation (1990) 66–77.

  29. Kelsey, R. and Hudak, P. Realistic compilation by program transformation. InConference Record of the 16th ACM Symposium on Principles of Programming Languages (1989) 281–292.

  30. Kranz, D., Kelsey, R., Rees, J., Hudak, P., Philbin, J., and Adams, N. Orbit: An otpimizing compiler for Scheme. InProceedings of the ACM Sigplan Symposium on Compiler Construction, Sigplan Notices, 21, 7 (1986) 219–233.

  31. Landin, P.J. The mechanical evaluation of expressions.Computer Journal, 6, 4 (1964) 308–320.

    Google Scholar 

  32. Leroy, X.The Zinc Experiment: An Economical Implementation of the ML Language. Technical Report 117, INRIA (1990).

  33. Mason, I. and Talcott, C. L. Equivalence in functional languages with effects.Journal of Functional Programming, 1, 3 (July 1991) 287–327.

    Google Scholar 

  34. Mazurkiewicz, A. W. Proving algorithms by tail functions.Information and Control, 18 (1971) 220–226.

    Google Scholar 

  35. Meyer, A. R. and Wand, M. Continuation semantics in typed lambdacalculi. InProceedings Workshop Logics of Programs, Lecture Notes in Computer Science, 193 (1985) 219–224.

    Google Scholar 

  36. Moggi, E. Computational lambda-calculus and monads. InProceedings of the 4th IEEE Symposium on Logic in Computer Science (1989) 14–23. Also appeared as: LFCS Report ECS-LFCS-88-86, University of Edinburgh, 1988.

  37. Morris, L. The next 700 formal language descriptions.Lisp and Functional Programming (1993). In this issue. Original manuscript dated November 1970.

  38. Nielson, F. A denotational framework for data flow analysis.Acta Informatica, 18 (1982) 265–287.

    Google Scholar 

  39. Plotkin, G.D. Call-by-name, call-by-value, and the λ-calculus.Theoretical Computer Science, 1 (1975) 125–159.

    Google Scholar 

  40. Rees, J. and Clinger, W. Revised3 report on the algorithmic language Scheme.Sigplan Notices, 21, 12 (1986) 37–79.

    Google Scholar 

  41. Reynolds, J. C. Definitional interpreters for higher-order programming languages. InProceedings of the ACM Annual Conference (1972) 717–740.

  42. Sabry, A. and Felleisen, M. Reasoning about programs in continuationpassing style. InProceedings of the ACM Conference on Lisp and Functional Programming (1992) 288–298. Technical Report 92–180, Rice University.

  43. Shivers, O.Control-Flow Analysis of Higher-Order Languages or Taming Lambda. PhD thesis, Carneige-Mellon University (1991).

  44. Sitaram, D. and Felleisen, M. Reasoning with continuations II: Full abstraction for models of control. InProceedings of the ACM Conference on Lisp and Functional Programming (1990) 161–175.

  45. Steel, T.B., editor.Formal Language Description Languages for Computer Programming. North-Holland (1966).

  46. Steele Jr., Guy L.Rabbit: A Compiler for Scheme. MIT AI Memo 474. Massachusetts Institute of Technology (1978).

  47. Strachey, C. and Wadsworth, C.P.Continuations: A Mathematical Semantics for Handling Full Jumps. Technical Monograph PRG-11, Oxford University Computing Laboratory, Programming Research Group (1974).

  48. Talcott, C. L. A theory for program and data specification.Theoretical Computer Science, 104 (1992) 129–159. Preliminary version in Proceedings of the International Symposium on Design and Implementation of Symbolic Computation Systems, (Lecture Notes in Computer Science, 429, 1990).

  49. Wand, M. Correctness of procedure representations in higher-order assembly language. In Brookes, S., editor,Proceedings of the Conference on the Mathematical Foundations of Programing Semantics, Lecture Notes in Computer Science, 598, Springer Verlag (1992) 294–311.

Download references

Author information

Authors and Affiliations

Authors

Additional information

This article is a revised and extended version of the conference paper with the same title [42]. The technical report of the same title contains additional material.

The authors were supported in part by NSF grant CCR 89-17022 and by Texas ATP grant 91-003604014.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Sabry, A., Felleisen, M. Reasoning about programs in continuation-passing style. LISP and Symbolic Computation 6, 289–360 (1993). https://doi.org/10.1007/BF01019462

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01019462

Keywords

  • λ-calculus
  • λ v -calculus
  • continuation-passing style
  • CPS transformations
  • inverse CPS transformations
  • λ v -C-calculus
  • IOCC