Advertisement

Higher-Order and Symbolic Computation

, Volume 22, Issue 3, pp 233–273 | Cite as

A type-theoretic foundation of delimited continuations

  • Zena M. Ariola
  • Hugo Herbelin
  • Amr Sabry
Article

Abstract

There is a correspondence between classical logic and programming language calculi with first-class continuations. With the addition of control delimiters, the continuations become composable and the calculi become more expressive. We present a fine-grained analysis of control delimiters and formalise that their addition corresponds to the addition of a single dynamically-scoped variable modelling the special top-level continuation. From a type perspective, the dynamically-scoped variable requires effect annotations. In the presence of control, the dynamically-scoped variable can be interpreted in a purely functional way by applying a store-passing style. At the type level, the effect annotations are mapped within standard classical logic extended with the dual of implication, namely subtraction. A continuation-passing-style transformation of lambda-calculus with control and subtraction is defined. Combining the translations provides a decomposition of standard CPS transformations for delimited continuations. Incidentally, we also give a direct normalisation proof of the simply-typed lambda-calculus with control and subtraction.

Keywords

Callcc Monad Prompt Reset Shift Subcontinuation Subtraction 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Ariola, Z.M., Herbelin, H.: Minimal classical logic and control operators. In: Thirtieth International Colloquium on Automata, Languages and Programming, ICALP’03, Eindhoven, The Netherlands, June 30–July 4, 2003. Lecture Notes in Comput. Sci., vol. 2719, pp. 871–885. Springer, New York (2003) Google Scholar
  2. 2.
    Ariola, Z.M., Herbelin, H.: Control reduction theories: the benefit of structural substitution. J. Funct. Program. (2007, to appear) Google Scholar
  3. 3.
    Ariola, Z.M., Herbelin, H., Sabry, A.: A type-theoretic foundation of continuations and prompts. In: ACM SIGPLAN International Conference on Functional Programming, pp. 40–53. ACM Press, New York (2004) Google Scholar
  4. 4.
    Baba, K., Hirokawa, S., Fujita, K.: Parallel reduction in type free λ μ-calculus. Electron. Notes Theor. Comput. Sci. 42, 52–66 (2001) CrossRefGoogle Scholar
  5. 5.
    Barbanera, F., Berardi, S.: Extracting constructive content from classical logic via control-like reductions. In: Bezem, M., Groote, J.F. (eds.) Proceedings 1st Intl. Conf. on Typed Lambda Calculi and Applications, TLCA’93, Utrecht, The Netherlands, 16–18 March 1993. Lecture Notes in Comput. Sci., vol. 664, pp. 45–59. Springer, Berlin (1993) Google Scholar
  6. 6.
    Crolard, T.: Subtractive logic. Theor. Comput. Sci. 254(1–2), 151–185 (2001) zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Crolard, T.: A formulae-as-types interpretation of subtractive logic. J. Log. Comput. 14(4), 529–570 (2004) (Special issue on Modalities in Constructive Logics and Type Theories) zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    Curien, P.-L., Herbelin, H.: The duality of computation. In: ACM SIGPLAN International Conference on Functional Programming, pp. 233–243. ACM Press, New York (2000) Google Scholar
  9. 9.
    Danvy, O., Filinski, A.: A functional abstraction of typed contexts. Technical Report 89/12, DIKU, University of Copenhagen, Copenhagen, Denmark (1989) Google Scholar
  10. 10.
    Danvy, O., Filinski, A.: Abstracting control. In: Proceedings of the 1990 ACM Conference on LISP and Functional Programming, Nice, pp. 151–160. ACM Press, New York (1990) CrossRefGoogle Scholar
  11. 11.
    David, R., Py, W.: Lambda-mu-calculus and Böhm’s theorem. J. Symb. Log. 66(1), 407–413 (2001) zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Dybvig, R.K., Peyton-Jones, S., Sabry, A.: A monadic framework for subcontinuations. J. Funct. Program. (2007, to appear). http://journals.cambridge.org/action/displayIssue?iid=168229
  13. 13.
    Felleisen, M.: The theory and practice of first-class prompts. In: Proceedings of the 15th ACM Symposium on Principles of Programming Languages (POPL ’88), pp. 180–190. ACM Press, New York (1988) CrossRefGoogle Scholar
  14. 14.
    Felleisen, M.: On the expressive power of programming languages. In: Jones, N. (ed.) ESOP ’90 3rd European Symposium on Programming, Copenhagen, Denmark. Lecture Notes in Comput. Sci., vol. 432, pp. 134–151. Springer, New York (1990) Google Scholar
  15. 15.
    Felleisen, M., Hieb, R.: The revised report on the syntactic theories of sequential control and state. Theor. Comput. Sci. 103(2), 235–271 (1992) zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    Felleisen, M., Friedman, D., Kohlbecker, E.: A syntactic theory of sequential control. Theor. Comput. Sci. 52(3), 205–237 (1987) zbMATHCrossRefMathSciNetGoogle Scholar
  17. 17.
    Felleisen, M., Wand, M., Friedman, D.P., Duba, B.F.: Abstract continuations: a mathematical semantics for handling full functional jumps. In: Conference on LISP and Functional Programming, Snowbird, Utah, pp. 52–62. ACM Press, New York (1988) Google Scholar
  18. 18.
    Filinski, A.: Declarative continuations: an investigation of duality in programming language semantics. In: Category Theory and Computer Science, Manchester, UK, September 5–8, 1989, Proceedings. Lecture Notes in Comput. Sci., vol. 389, pp. 224–249. Springer, New York (1989) Google Scholar
  19. 19.
    Filinski, A.: Representing monads. In: Conf. Record 21st ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL’94, Portland, OR, USA, 17–21 Jan. 1994, pp. 446–457. ACM Press, New York (1994) CrossRefGoogle Scholar
  20. 20.
    Filinski, A.: Representing layered monads. In: Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 175–188. ACM Press, New York (1999) CrossRefGoogle Scholar
  21. 21.
    Fischer, M.J.: Lambda-calculus schemata. In: Proc. ACM Conference on Proving Assertions About Programs. SIGPLAN Notices, vol. 7(1), pp. 104–109. ACM Press, New York (1972) CrossRefGoogle Scholar
  22. 22.
    Fischer, M.J.: Lambda-calculus schemata. Lisp Symb. Comput. 6(3/4), 259–288 (1993). http://www.brics.dk/~hosc/vol06/03-fischer.html. Earlier version available in the proceedings of an ACM Conference on Proving Assertions about Programs, SIGPLAN Notices, vol. 7, no. 1, January 1972 CrossRefGoogle Scholar
  23. 23.
    Griffin, T.G.: The formulae-as-types notion of control. In: Conf. Record 17th Annual ACM Symp. on Principles of Programming Languages, POPL’90, San Francisco, CA, USA, 17–19 Jan. 1990, pp. 47–57. ACM Press, New York (1990) Google Scholar
  24. 24.
    Gunter, C.A., Rémy, D., Riecke, J.G.: A generalization of exceptions and control in ML-like languages. In: Functional Programming & Computer Architecture. ACM Press, New York (1995) Google Scholar
  25. 25.
    Guzmán, J., Suárez, A.: An extended type system for exceptions. In: Record of the fifth ACM SIGPLAN workshop on ML and its Applications. Also appeared as Research Report 2265, INRIA, BP 105-78153, Le Chesnay Cedex, France (1994) Google Scholar
  26. 26.
    Haynes, C.T.: Logic continuations. In: Proceedings of the Third International Conference on Logic Programming. Lecture Notes in Comput. Sci., vol. 225, pp. 671–685. Springer, Berlin (1986) Google Scholar
  27. 27.
    Haynes, C.T., Friedman, D., Wand, M.: Obtaining coroutines from continuations. J. Comput. Lang. 11, 143–153 (1986) zbMATHCrossRefGoogle Scholar
  28. 28.
    Herbelin, H.: Explicit substitutions and reducibility. J. Log. Comput. 11(3), 431–451 (2001) zbMATHCrossRefMathSciNetGoogle Scholar
  29. 29.
    Hieb, R., Dybvig, R.K.: Continuations and concurrency. In: PPoPP ’90, Symposium on Principles and Practice of Parallel Programming, Seattle, Washington, March 14–16. SIGPLAN Notices, vol. 25(3), pp. 128–136. ACM Press, New York (1990) CrossRefGoogle Scholar
  30. 30.
    Hieb, R., Dybvig, K., Anderson, C.W. III: Subcontinuations. Lisp Symb. Comput. 7(1), 83–110 (1994) CrossRefGoogle Scholar
  31. 31.
    Hofmann, M.: Sound and complete axiomatisations of call-by-balue control operators. Math. Struct. Comput. Sci. 5(4), 461–482 (1995) zbMATHCrossRefGoogle Scholar
  32. 32.
    Howard, W.: The formulae-as-types notion of construction. In: Hindley, J.R., Seldin, J.P. (eds.) To H.B. Curry: Essays in Combinatory Logic, Lambda Calculus and Formalism, pp. 479–490. Academic, New York (1980) Google Scholar
  33. 33.
    Kameyama, Y.: A type-theoretic study on partial continuations. In: IFIP TCS, pp. 489–504 (2000) Google Scholar
  34. 34.
    Kameyama, Y.: Towards logical understanding of delimited continuations. In: Proceedings of the Third ACM SIGPLAN Workshop on Continuations (CW’01) (2001) Google Scholar
  35. 35.
    Kameyama, Y., Hasegawa, M.: A sound and complete axiomatization of delimited continuations. In: Proc. of 8th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP’03, Uppsala, Sweden, 25–29 Aug. 2003. SIGPLAN Notices, vol. 38(9), pp. 177–188. ACM Press, New York (2003) Google Scholar
  36. 36.
    Lillibridge, M.: Unchecked exceptions can be strictly more powerful than Call/CC. Higher-Order Symb. Comput. 12(1), 75–104 (1999) zbMATHCrossRefGoogle Scholar
  37. 37.
    Moggi, E.: Computational lambda-calculus and monads. In: Proceedings of the Fourth Annual Symposium on Logic in Computer Science, pp. 14–23. IEEE Press (1989) Google Scholar
  38. 38.
    Moreau, L.: A syntactic theory of dynamic binding. Higher-Order Symb. Comput. 11(3), 233–279 (1998) zbMATHCrossRefGoogle Scholar
  39. 39.
    Moreau, L., Queinnec, C.: Partial continuations as the difference of continuations. A duumvirate of control operators. In: International Conference on Programming Language Implementation and Logic Programming (PLILP’94), Madrid, Spain, pp. 182–197. Springer, Berlin (1994) Google Scholar
  40. 40.
    Murthy, C.: Control operators, hierarchies, and pseudo-classical type systems: a—translation at work. In: ACM workshop on Continuations, pp. 49–71 (1992) Google Scholar
  41. 41.
    Ong, C.-H.L., Stewart, C.A.: A Curry-Howard foundation for functional computation with control. In: Conf. Record 24th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL’97, Paris, France, 15–17 Jan. 1997, pp. 215–227. ACM Press, New York (1997) CrossRefGoogle Scholar
  42. 42.
    Parigot, M.: Lambda-mu-calculus: an algorithmic interpretation of classical natural deduction. In: Logic Programming and Automated Reasoning: International Conference LPAR ’92 Proceedings, St. Petersburg, Russia, pp. 190–201. Springer, Berlin (1992) Google Scholar
  43. 43.
    Rauszer, C.: Semi-boolean algebras and their application to intuitionistic logic with dual connectives. Fundam. Math. 83, 219–249 (1974) zbMATHMathSciNetGoogle Scholar
  44. 44.
    Riecke, J.G., Thielecke, H.: Typed exceptions and continuations cannot macro-express each other. In: Proceedings of the 26th International Colloquium on Automata, Languages and Programming (ICALP). Lecture Notes in Comput. Sci., vol. 1644, pp. 635–644. Springer, Berlin (1999) CrossRefGoogle Scholar
  45. 45.
    Shan, C.: Shift to control. In: Shivers, O., Waddell, O. (eds.) Proceedings of the 5th Workshop on Scheme and Functional Programming, pp. 99–107. Technical report, Computer Science Department, Indiana University (2004) Google Scholar
  46. 46.
    Sitaram, D., Felleisen, M.: Control delimiters and their hierarchies. Lisp Symb. Comput. 3(1), 67–99 (1990a) CrossRefGoogle Scholar
  47. 47.
    Sitaram, D., Felleisen, M.: Reasoning with continuations II: full abstraction for models of control. In: LFP ’90: Proceedings of the 1990 ACM Conference on LISP and Functional Programming, pp. 161–175. ACM Press, New York (1990b) CrossRefGoogle Scholar
  48. 48.
    Thielecke, H.: On exceptions versus continuations in the presence of state. In: Proceedings of the Ninth European Symposium On Programming (ESOP). Lecture Notes in Comput. Sci., vol. 1782, pp. 397–411. Springer, Berlin (2000) Google Scholar
  49. 49.
    Thielecke, H.: Contrasting exceptions and continuations. Available from http://www.cs.bham.ac.uk/~hxt/research/exncontjournal.pdf (2001)
  50. 50.
    Thielecke, H.: Comparing control constructs by double-barrelled CPS. Higher-Order Symb. Comput. 15(2/3), 119–136 (2002) CrossRefGoogle Scholar
  51. 51.
    Wadler, P.: Monads and composable continuations. Lisp Symb. Comput. 7(1), 39–56 (1994) CrossRefGoogle Scholar
  52. 52.
    Wand, M.: Continuation-based multiprocessing. Higher-Order Symb. Comput. 12(3), 285–299 (1999), http://www.brics.dk/~hosc/vol12/3-wand.html. Reprinted from the Proceedings of the 1980 Lisp Conference, with a foreword CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC 2007

Authors and Affiliations

  1. 1.University of OregonEugeneUSA
  2. 2.INRIA-FutursOrsayFrance
  3. 3.Indiana UniversityBloomingtonUSA

Personalised recommendations