Abstract
Higher-order abstract syntax (HOAS) is a simple, powerful technique for implementing object languages, since it directly supports common and tricky routines dealing with variables, such as capture-avoiding substitution and renaming. This is achieved by representing binders in the object-language via binders in the meta-language. However, enriching functional programming languages with direct support for HOAS has been a major challenge, because recursion over HOAS encodings requires one to traverse lambda-abstractions and necessitates programming with open objects.
We present a novel type-theoretic foundation based on contextual modal types which allows us to recursively analyze open terms via higher-order pattern matching. By design, variables occurring in open terms can never escape their scope. Using several examples, we demonstrate that our framework provides a name-safe foundation to operations typically found in nominal systems. In contrast to nominal systems however, we also support capture-avoiding substitution operations and even provide first-class substitutions to the programmer. The main contribution of this paper is a syntax-directed bi-directional type system where we distinguish between the data language and the computation language together with the progress and preservation proof for our language.
- Martin Abadi, Luca Cardelli, Pierre-Louis Curien, and Jean-Jacques Levy. Explicit substitutions. In Conference Record of the Seventeenth Annual ACM Symposium on Principles of Programming Languages, San Francisco, California, pages 31--46. ACM, 1990. Google Scholar
Digital Library
- Joelle Despeyroux, Frank Pfenning, and Carsten Schürmann. Primitive recursion for higher--order abstract syntax. In R. Hindley, editor, Proceedings of the Third International Conference on Typed Lambda Calculus and Applications (TLCA'97), pages 147--163, Nancy, France, Lecture Notes in Computer Science (LNCS) 1210, Springer-Verlag, 1997. Google Scholar
Digital Library
- Murdoch Gabbay and Andrew Pitts. A new approach to abstract syntax involving binders. In G. Longo, editor, Proceedings of the 14th Annual Symposium on Logic in Computer Science (LICS'99), pages 214--224, Trento, Italy, IEEE Computer Society Press, 1999. Google Scholar
Digital Library
- Louis-Julien Guillemette and Stefan Monnier. Statically verified type--preserving code transformations in Haskell. In Programming Languages meets Program Verification (PLPV), Seattle, USA, Electronic Notes in Theoretical Computer Science (ENTCS), Elsevier, 2006.Google Scholar
- Robert Harper, Furio Honsell, and Gordon Plotkin. A framework for defining logics. Journal of the Association for Computing Machinery, 40(1): 143--184, January 1993. Google Scholar
Digital Library
- Masatomo Hashimoto and Atsushi Ohori. A typed context calculus. Theoretical Computer Science, 266(1--2): 249--272, 2001. Google Scholar
Digital Library
- Ik-Soon Kim, Kwangkeun Yi, and Cristiano Calcagno. A polymorphic modal type system for Lisp-like multi-staged languages. In 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages(POPL '06), pages 257--268, New York, NY, USA, ACM Press, 2006. Google Scholar
Digital Library
- Ian A. Mason. Computing with contexts. Higher-Order and Symbolic Computation, 12(2): 171--201, 1999. Google Scholar
Digital Library
- Andrew McCreight and Carsten Schürmann. A meta-linear logical framework. In Carsten Sch"urmann, editor, 4th International Workshop on Logical Frameworks and Meta-Languages (LFM'04), 2004.Google Scholar
- Dale Miller. Unification of simply typed lambda-terms as logic programming. In Eighth International Logic Programming Conference, pages 255--269, Paris, France, MIT Press, 1991.Google Scholar
- Dale Miller. An extension to ML to handle bound variables in data structures. In G. Huet and G. Plotkin, editors, Proceedings of the First Workshop on Logical Frameworks, pages 323--335, 1990.Google Scholar
- Aleksandar Nanevski, Frank Pfenning, and Brigitte Pientka. A contextual modal type theory. ACM Transactions on Computational Logic (accepted, to appear in 2008), page 56 pages, 2006. Google Scholar
Digital Library
- Shin-Ya Nishizaki. A polymorphic environment calculus and its type--inference algorithm. Higher Order Symbol. Comput., 13 (3): 239--278, 2000. Google Scholar
Digital Library
- Frank Pfenning and Carsten Schürmann. System description: Twelf -- a meta-logical framework for deductive systems. In H. Ganzinger, editor, Proceedings of the 16th International Conference on Automated Deduction (CADE-16), pages 202--206, Trento, Italy, Lecture Notes in Artificial Intelligence (LNAI) 1632, Springer-Verlag, 1999. Google Scholar
Digital Library
- Brigitte Pientka. Tabled higher-order logic programming. PhD thesis, Department of Computer Sciences, Carnegie Mellon University, 2003. CMU-CS-03-185. Google Scholar
Digital Library
- Brigitte Pientka and Frank Pfennning. Optimizing higher-order pattern unification. In F. Baader, editor, 19th International Conference on Automated Deduction, pages 473--487, Miami, USA, Lecture Notes in Artificial Intelligence (LNAI) 2741, Springer-Verlag, 2003.Google Scholar
- Adam Poswolsky and Carsten Schürmann. Programming with higher-order encodings and dependent types. Technical Report YALEU/DCS/TR1375, Department of Computer Science,Yale University, July 2007.Google Scholar
- Francois Pottier. Static name control for FreshML. In Twenty-Second Annual IEEE Symposium on Logic in Computer Science (LICS'07), pages 356--365, Wroclaw, Poland, IEEE Computer Society, 2007. Google Scholar
Digital Library
- Masahiko Sato, Takafumi Sakurai, and Rod Burstall. Explicit environments. Fundamenta Informaticae, 45 (1--2): 79--115, 2001. Google Scholar
Digital Library
- Masahiko Sato, Takafumi Sakurai, and Yukiyoshi Kameyama. A simply typed context calculus with first-class environments. Journal of Functional and Logic Programming, 2002 (4), March 2002. Google Scholar
Digital Library
- Carsten Schürmann. Automating the meta theory of deductive systems. PhD thesis, Department of Computer Sciences, Carnegie Mellon University, Available as Technical Report CMU-CS-00-146, 2000. Google Scholar
Digital Library
- Carsten Schürmann and Frank Pfenning. A coverage checking algorithm for LF. In D. Basin and B. Wolff, editors, Proceedings of the 16th International Conference on Theorem Proving in Higher Order Logics (TPHOLs 2003), pages 120--135, Rome, Italy, Lecture Notes in Computer Science(LNCS) 2758, Springer-Verlag, 2003.Google Scholar
- Carsten Schürmann, Adam Poswolsky, and Jeffrey Sarnat. The nabla-calculus. functional programming with higher-order encodings. In Pawel Urzyczyn, editor, Proceedings of the 7th International Conference on Typed Lambda Calculi and Application (TLCA'05), pages 339--353, Nara, Japan, Lecture Notes in Computer Science (LNCS) 3461, Springer, 2005. Google Scholar
Digital Library
- Mark R. Shinwell, Andrew M. Pitts, and Murdoch J. Gabbay. FreshML: programming with binders made simple. In Eighth ACM SIGPLAN International Conference on Functional Programming (ICFP'03), pages 263--274, New York, NY, USA, 2003. ACM Press. Google Scholar
Digital Library
- Geoff Washburn and Stephanie Weirich. Boxes go bananas: Encoding higher-order abstract syntax with parametric polymorphism. Journal of Functional Programming, 2007 (to appear). Google Scholar
Digital Library
- Kevin Watkins, Iliano Cervesato, Frank Pfenning, and David Walker. A concurrent logical framework I: Judgments and properties. Technical Report CMU-CS-02-101, Department of Computer Science, Carnegie Mellon University, 2002.Google Scholar
Index Terms
A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions
Recommendations
A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions
POPL '08: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesHigher-order abstract syntax (HOAS) is a simple, powerful technique for implementing object languages, since it directly supports common and tricky routines dealing with variables, such as capture-avoiding substitution and renaming. This is achieved by ...
Higher-order abstract syntax in classical higher-order logic
LFMTP '09: Proceedings of the Fourth International Workshop on Logical Frameworks and Meta-Languages: Theory and PracticeHigher-Order Abstract Syntax, or HOAS, is a technique for using a higher-order logic as a metalanguage for an object language with binding operators. It avoids formalizing syntactic details related to variable binding. This paper gives an extension to ...
Reasoning with higher-order abstract syntax in a logical framework
Logical frameworks based on intuitionistic or linear logics with higher-type quantification have been successfully used to give high-level, modular, and formal specifications of many important judgments in the area of programming languages and inference ...







Comments