Meta-programming with names and necessity

Meta-programming languages provide infrastructure to generate and execute object programs at run-time. In a typed setting, they contain a modal type constructor which classifies object code. These code types generally come in two flavors: closed and open. Closed code expressions can be invoked at run-time, but the computations over them are more rigid, and typically produce less efficient residual object programs. Open code provides better inlining and partial evaluation of object programs, but once constructed, expressions of this type cannot in general be evaluated.Recent work in this area has focused on combining the two notions into a sound system. We present a novel way to achieve this. It is based on adding the notion of names from the work on Nominal Logic and FreshML to the λ -calculus of proof terms for the necessity fragment of modal logic S4. The resulting language provides a more fine-grained control over free variables of object programs when compared to the existing languages for meta-programming. In addition, this approach lends itself well to addition of intensional code analysis, i.e. ability of meta programs to inspect and destruct object programs at run-time in a type-safe manner, which we also undertake.

[1]  Olivier Danvy,et al.  Type-directed partial evaluation , 1995, POPL '96.

[2]  Walid Taha,et al.  A sound reduction semantics for untyped CBN mutli-stage computation. Or, the theory of MetaML is non-trival (extended abstract) , 1999, PEPM '00.

[3]  G. Boolos,et al.  Self-Reference and Modal Logic , 1985 .

[4]  Peter Lee,et al.  Run-time code generation and modal-ML , 1998, PLDI.

[5]  F. Pfenning,et al.  Automating the meta theory of deductive systems , 2000 .

[6]  José D. P. Rolim,et al.  Automata, Languages and Programming , 2002, Lecture Notes in Computer Science.

[7]  Frank Pfenning,et al.  Higher-order abstract syntax , 1988, PLDI '88.

[8]  Martin Hofmann Semantical analysis of higher-order abstract syntax , 1999, Proceedings. 14th Symposium on Logic in Computer Science (Cat. No. PR00158).

[9]  D. Scott Identity and existence in intuitionistic logic , 1979 .

[10]  Guillermo J. Rozas,et al.  Translucent Procedures, Abstraction without Opacity , 1993 .

[11]  Griewank,et al.  On automatic differentiation , 1988 .

[12]  Martin Odersky,et al.  A functional theory of local names , 1994, POPL '94.

[13]  Andrew M. Pitts,et al.  A First Order Theory of Names and Binding , 2001 .

[14]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[15]  Richard L. Mendelsohn,et al.  First-Order Modal Logic , 1998 .

[16]  Andrew M. Pitts,et al.  A Metalanguage for Programming with Bound Names Modulo Renaming , 2000, MPC.

[17]  Rowan Davies,et al.  A temporal-logic approach to binding-time analysis , 1995, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[18]  Dana S. Scott,et al.  Advice on Modal Logic , 1970 .

[19]  Robert Glück,et al.  Efficient Multi-level Generating Extensions for Program Specialization , 1995, PLILP.

[20]  NanevskiAleksandar Meta-programming with names and necessity , 2002 .

[21]  Walid Taha,et al.  Environment classifiers , 2003, POPL '03.

[22]  Frank Pfenning,et al.  Primitive recursion for higher-order abstract syntax , 1997, Theor. Comput. Sci..

[23]  Andrew M. Pitts,et al.  Nominal Logic: A First Order Theory of Names and Binding , 2001, TACS.

[24]  Robert Harper,et al.  Proof-directed debugging , 1999, Journal of Functional Programming.

[25]  Gerhard J. Woeginger,et al.  Automata, Languages and Programming , 2003, Lecture Notes in Computer Science.

[26]  Maria Simi,et al.  A Formalization of Viewpoints , 1995, Fundam. Informaticae.

[27]  Ulrich Berger,et al.  An inverse of the evaluation functional for typed lambda -calculus , 1991, [1991] Proceedings Sixth Annual IEEE Symposium on Logic in Computer Science.

[28]  Norman Ramsey,et al.  Stochastic lambda calculus and monads of probability distributions , 2002, POPL '02.

[29]  Tim Sheard,et al.  Accomplishments and Research Challenges in Meta-programming , 2001, SAIG.

[30]  Walid Taha,et al.  An Idealized MetaML: Simpler, and More Expressive , 1999, ESOP.

[31]  Marcelo P. Fiore,et al.  Semantic analysis of normalisation by evaluation for typed lambda calculus , 2002, PPDP '02.

[32]  Peter Lee,et al.  Modal types as staging specifications for run-time code generation , 1998, CSUR.

[33]  Frank Pfenning,et al.  A judgmental reconstruction of modal logic , 2001, Mathematical Structures in Computer Science.

[34]  Saul A. Kripke,et al.  Naming and Necessity , 1980 .

[35]  Gordon D. Plotkin,et al.  Abstract syntax and variable binding , 1999, Proceedings. 14th Symposium on Logic in Computer Science (Cat. No. PR00158).

[36]  Walid Taha,et al.  Closed Types as a Simple Approach to Safe Imperative Multi-stage Programming , 2000, ICALP.

[37]  Helmut Schwichtenberg,et al.  Normalisation by Evaluation , 1998, Prospects for Hardware Foundations.

[38]  Walid Taha,et al.  A Sound Reduction Semantics for Untyped CBN Multi-stage Computation. Or, the Theory of MetaML is Non-trivial (Extended Abstract) , 1999, PEPM.

[39]  Andrei P. Ershov,et al.  On the Partial Computation Principle , 1977, Inf. Process. Lett..

[40]  Peter Lee,et al.  Optimizing ML with run-time code generation , 1996, PLDI '96.

[41]  Frank Pfenning,et al.  Intensionality, extensionality, and proof irrelevance in modal type theory , 2001, Proceedings 16th Annual IEEE Symposium on Logic in Computer Science.

[42]  Andrew M. Pitts,et al.  A New Approach to Abstract Syntax with Variable Binding , 2002, Formal Aspects of Computing.

[43]  Dale Miller,et al.  An Extension to ML to Handle Bound Variables in Data Structures: Preliminary Report , 1990 .

[44]  John McCarthy,et al.  Notes on Formalizing Context , 1993, IJCAI.

[45]  Tim Sheard,et al.  Closed types for a safe imperative MetaML , 2003, J. Funct. Program..

[46]  Walid Taha,et al.  Multi-Stage Programming: Its Theory and Applications , 1999 .

[47]  Peter Sestoft,et al.  An experiment in partial evaluation: the generation of a compiler generator , 1985, SIGP.

[48]  Walid Taha,et al.  Semantics, Applications, and Implementation of Program Generation , 2001, Lecture Notes in Computer Science.

[49]  Yoshihiko Futamura,et al.  Partial Evaluation of Computation Process--An Approach to a Compiler-Compiler , 1999, High. Order Symb. Comput..

[50]  Robert Glück,et al.  An Automatic Program Generator for Multi-Level Specialization , 1997, LISP Symb. Comput..

[51]  Walid Taha,et al.  Environment classifiers , 2003, POPL.

[52]  Jean-Yves Girard,et al.  The System F of Variable Types, Fifteen Years Later , 1986, Theor. Comput. Sci..