A Logical Foundation for Environment Classifiers

  • Takeshi Tsukada
  • Atsushi Igarashi
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5608)


Taha and Nielsen have developed a multi-stage calculus λ α with a sound type system using the notion of environment classifiers. They are special identifiers, with which code fragments and variable declarations are annotated, and their scoping mechanism is used to ensure statically that certain code fragments are closed and safely runnable.

In this paper, we investigate the Curry-Howard isomorphism for environment classifiers by developing a typed λ-calculus λ  ⊳ . It corresponds to multi-modal logic that allows quantification by transition variables—a counterpart of classifiers—which range over (possibly empty) sequences of labeled transitions between possible worlds. This interpretation will reduce the “run” construct—which has a special typing rule in λ α —and embedding of closed code into other code fragments of different stages—which would be only realized by the cross-stage persistence operator in λ α —to merely a special case of classifier application. We prove that λ  ⊳  enjoys basic properties including subject reduction, confluence, and strong normalization and that the execution of a well-typed λ  ⊳  program is properly staged. Finally, we show that the proof system augmented with a classical axiom is sound and complete with respect to a Kripke semantics of the logic.


Transition Variable Proof System Dynamic Logic Logical Foundation Typing Rule 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs (1993)zbMATHGoogle Scholar
  2. 2.
    Consel, C., Lawall, J.L., Meur, A.F.L.: A tour of Tempo: A program specializer for the C language. Science of Computer Programming 52(1-3), 341–370 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Wickline, P., Lee, P., Pfenning, F.: Run-time code generation and Modal-ML. In: Proc. of PLDI 1998, pp. 224–235 (1998)Google Scholar
  4. 4.
    Poletto, M., Hsieh, W.C., Engler, D.R., Kaashoek, M.F.: ‘C and tcc: A language and compiler for dynamic code generation. ACM TOPLAS 21(2), 324–369 (1999)CrossRefGoogle Scholar
  5. 5.
    Taha, W., Sheard, T.: MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science 248, 211–242 (2000)CrossRefzbMATHGoogle Scholar
  6. 6.
    Glück, R., Jørgensen, J.: Efficient multi-level generating extensions for program specialization. In: Swierstra, S.D. (ed.) PLILP 1995. LNCS, vol. 982, pp. 259–278. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  7. 7.
    Davies, R.: A temporal-logic approach to binding-time analysis. In: Proc. of LICS 1996, pp. 184–195 (1996)Google Scholar
  8. 8.
    Davies, R., Pfenning, F.: A modal analysis of staged computation. J. ACM 48(3), 555–604 (2001)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Taha, W., Nielsen, M.F.: Environment classifiers. In: Proc. of POPL 2003, pp. 26–37 (2003)Google Scholar
  10. 10.
    Yuse, Y., Igarashi, A.: A modal type system for multi-level generating extensions with persistent code. In: Proc. of PPDP 2006, pp. 201–212 (2006)Google Scholar
  11. 11.
    Kim, I.S., Yi, K., Calcagno, C.: A polymorphic modal type system for lisp-like multi-staged languages. In: Proc. of POPL 2006, pp. 257–268 (2006)Google Scholar
  12. 12.
    Stirling, C.: Modal and temporal logics. In: Handbook of Logic in Computer Science, vol. 2, pp. 477–563. Oxford University Press, Oxford (1992)Google Scholar
  13. 13.
    Moggi, E., Taha, W., Benaissa, Z.E.A., Sheard, T.: An idealized MetaML: Simpler, and more expressive. In: Swierstra, S.D. (ed.) ESOP 1999. LNCS, vol. 1576, pp. 193–207. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  14. 14.
    Benaissa, Z.E.A., Moggi, E., Taha, W., Sheard, T.: Logical modalities and multi-stage programming. In: Proc. of IMLA 1999 (1999)Google Scholar
  15. 15.
    Calcagno, C., Moggi, E., Taha, W.: ML-like inference for classifiers. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 79–93. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  16. 16.
    Kojima, K., Igarashi, A.: On constructive linear-time temporal logic. In: Proc. of IMLA 2008 (2008)Google Scholar
  17. 17.
    Nanevski, A., Pfenning, F.: Staged computation with names and necessity. J. Functional Programming 15(5), 893–939 (2005)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Calcagno, C., Moggi, E., Sheard, T.: Closed types for a safe imperative MetaML. Journal of Functional Programming 13(3), 545–571 (2003)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Sato, M., Sakurai, T., Kameyama, Y.: A simply typed context calculus with first-class environments. J. Functional and Logic Programming 2002(4), 1–41 (2002)MathSciNetzbMATHGoogle Scholar
  20. 20.
    Nanevski, A., Pfenning, F., Pientka, B.: Contextual modal type theory. ACM Transactions on Computational Logic 9(3) (2008)Google Scholar
  21. 21.
    Harel, D., Kozen, D., Tiuryn, J.: Dynamic logic. In: Gabbay, D., Guenther, F. (eds.) Handbook of Philosophical Logic, 2nd edn., vol. 4, pp. 99–218. Springer, Heidelberg (2002)Google Scholar
  22. 22.
    Areces, C., ten Cate, B.: Hybrid logics. In: Blackburn, P., Wolter, F., van Benthem, J. (eds.) Handbook of Modal Logics, pp. 821–868. Elsevier, Amsterdam (2007)CrossRefGoogle Scholar
  23. 23.
    Reed, J., Pfenning, F.: Intuitionistic letcc via labelled deduction. In: Proc. of M4M 2007 (2007)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Takeshi Tsukada
    • 1
  • Atsushi Igarashi
    • 2
  1. 1.Tohoku UniversityJapan
  2. 2.Kyoto UniversityJapan

Personalised recommendations