Program Logics for Homogeneous Meta-programming

  • Martin Berger
  • Laurence Tratt
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6355)


A meta-program is a program that generates or manipulates another program; in homogeneous meta-programming, a program may generate new parts of, or manipulate, itself. Meta-programming has been used extensively since macros were introduced to Lisp, yet we have little idea how formally to reason about meta-programs. This paper provides the first program logics for homogeneous meta-programming – using a variant of MiniML\(_e^{\square}\) by Davies and Pfenning as underlying meta-programming language. We show the applicability of our approach by reasoning about example meta-programs from the literature. We also demonstrate that our logics are relatively complete in the sense of Cook, enable the inductive derivation of characteristic formulae, and exactly capture the observational properties induced by the operational semantics.


Program Logic Modal Variable Operational Semantic Total Correctness Typing Judgement 
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.
    Berger, M.: Program Logics for Sequential Higher-Order Control. In: Arbab, F., Sirjani, M. (eds.) Fundamentals of Software Engineering. LNCS, vol. 5961, pp. 194–211. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  2. 2.
    Berger, M., Honda, K., Yoshida, N.: A Logical Analysis of Aliasing in Imperative Higher-Order Functions. J. Funct. Program. 17(4-5), 473–546 (2007)MathSciNetzbMATHGoogle Scholar
  3. 3.
    Berger, M., Honda, K., Yoshida, N.: Completeness and logical full abstraction in modal logics for typed mobile processes. In: Aceto, L., Damgård, I., Goldberg, L.A., Halldórsson, M.M., Ingólfsdóttir, A., Walukiewicz, I. (eds.) ICALP 2008, Part II. LNCS, vol. 5126, pp. 99–111. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  4. 4.
    Berger, M., Tratt, L.: Program Logics for Homogeneous Metaprogramming. Long version of the present paper (to appear)Google Scholar
  5. 5.
    Cook, S.A.: Soundness and completeness of an axiom system for program verification. SIAM J. Comput. 7(1), 70–90 (1978)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Davies, R., Pfenning, F.: A modal analysis of staged computation. J. ACM 48(3), 555–604 (2001)MathSciNetzbMATHGoogle Scholar
  7. 7.
    Fogarty, S., Pašalić, E., Siek, J., Taha, W.: Concoqtion: Indexed Types Now! In: Proc. PEPM, pp. 112–121 (2007)Google Scholar
  8. 8.
    Gunter, C.A.: Semantics of Programming Languages. MIT Press, Cambridge (1995)Google Scholar
  9. 9.
    Honda, K.: From Process Logic to Program Logic. In: ICFP 2004, pp. 163–174. ACM Press, New York (2004)Google Scholar
  10. 10.
    Honda, K., Berger, M., Yoshida, N.: Descriptive and Relative Completeness of Logics for Higher-Order Functions. In: Bugliesi, M., Preneel, B., Sassone, V., Wegener, I. (eds.) ICALP 2006. LNCS, vol. 4052, pp. 360–371. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  11. 11.
    Honda, K., Yoshida, N.: A compositional logic for polymorphic higher-order functions. In: Proc. PPDP, pp. 191–202 (2004)Google Scholar
  12. 12.
    Honda, K., Yoshida, N., Berger, M.: An Observationally Complete Program Logic for Imperative Higher-Order Functions. In: LICS 2005, pp. 270–279 (2005)Google Scholar
  13. 13.
    Longley, J., Plotkin, G.: Logical Full Abstraction and PCF. In: Tbilisi Symposium on Logic, Language and Information, CSLI (1998)Google Scholar
  14. 14.
    Reynolds, J.C.: Separation logic: a logic for shared mutable data structures. In: Proc. LICS 2002, pp. 55–74 (2002)Google Scholar
  15. 15.
    Sheard, T., Linger, N.: Programming in Ωmega. In: Proc. Central European Functional Programming School, pp. 158–227 (2007)Google Scholar
  16. 16.
    Sheard, T., Peyton Jones, S.: Template meta-programming for Haskell. In: Proc. Haskell Workshop, pp. 1–16 (2002)Google Scholar
  17. 17.
    Taha, W.: Multi-Stage Programming: Its Theory and Applications. PhD thesis, Oregon Graduate Institute of Science and Technology (1993)Google Scholar
  18. 18.
    Taha, W., Nielsen, M.F.: Environment classifiers. In: Proc. POPL, pp. 26–37 (2003)Google Scholar
  19. 19.
    Tratt, L.: Compile-time meta-programming in a dynamically typed OO language. In: Proc. DLS, pp. 49–64 (October 2005)Google Scholar
  20. 20.
    Westbrook, E., Ricken, M., Inoue, J., Yao, Y., Abdelatif, T., Taha, W.: Mint: Java multi-stage programming using weak separability. In: Proc. PLDI (2010) (to appear)Google Scholar
  21. 21.
    Yoshida, N., Honda, K., Berger, M.: Logical reasoning for higher-order functions with local state. In: Seidl, H. (ed.) FOSSACS 2007. LNCS, vol. 4423, pp. 361–377. Springer, Heidelberg (2007)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Martin Berger
    • 1
  • Laurence Tratt
    • 2
  1. 1.University of SussexUK
  2. 2.Middlesex UniversityUK

Personalised recommendations