skip to main content
10.1145/1411204.1411226acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Parametric higher-order abstract syntax for mechanized semantics

Published:20 September 2008Publication History

ABSTRACT

We present parametric higher-order abstract syntax (PHOAS), a new approach to formalizing the syntax of programming languages in computer proof assistants based on type theory. Like higher-order abstract syntax (HOAS), PHOAS uses the meta language's binding constructs to represent the object language's binding constructs. Unlike HOAS, PHOAS types are definable in general-purpose type theories that support traditional functional programming, like Coq's Calculus of Inductive Constructions. We walk through how Coq can be used to develop certified, executable program transformations over several statically-typed functional programming languages formalized with PHOAS; that is, each transformation has a machine-checked proof of type preservation and semantic preservation. Our examples include CPS translation and closure conversion for simply-typed lambda calculus, CPS translation for System F, and translation from a language with ML-style pattern matching to a simpler language with no variable-arity binding constructs. By avoiding the syntactic hassle associated with first-order representation techniques, we achieve a very high degree of proof automation.

Skip Supplemental Material Section

Supplemental Material

Video

References

  1. Thorsten Altenkirch. A formalization of the strong normalization proof for System F in LEGO. In Proc. TLCA, pages 13--28, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Simon Ambler, Roy L. Crole, and Alberto Momigliano. Combining higher order abstract syntax with tactical theorem proving and (co)induction. In Proc. TPHOLs, pages 13--30, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Brian Aydemir, Arthur Chargu´eraud, Benjamin C. Pierce, Randy Pollack, and StephanieWeirich. Engineering formal metatheory. In Proc. POPL, pages 3--15, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Brian E. Aydemir, Aaron Bohannon, Matthew Fairbairn, J. Nathan Foster, Benjamin C. Pierce, Peter Sewell, Dimitrios Vytiniotis, Geoffrey Washburn, Stephanie Weirich, and Steve Zdancewic. Mechanized metatheory for the masses: The PoplMark challenge. In Proc. TPHOLs, pages 50--65, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Eli Barzilay and Stuart F. Allen. Reflecting higher-order abstract syntax in Nuprl. In Proc. TPHOLs (Track B), pages 23--32, 2002.Google ScholarGoogle Scholar
  6. Yves Bertot and Pierre Castéran. Interactive Theorem Proving and Program Development. Coq'Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. Springer Verlag, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Anna Bucalo, Furio Honsell, Marino Miculan, Ivan Scagnetto, and Martin Hofmann. Consistency of the theory of contexts. J. Funct. Program., 16 (3): 327--372, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Venanzio Capretta and Amy P. Felty. Combining de Bruijn indices and higher-order abstract syntax in Coq. In Proc. TYPES, pages 63--77, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Adam Chlipala. A certified type-preserving compiler from lambda calculus to assembly language. In Proc. PLDI, pages 54--65, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Zaynah Dargaye and Xavier Leroy. Mechanized verification of CPS transformations. In Proc. LPAR, pages 211--225, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Maulik A. Dave. Compiler verification: a bibliography. SIGSOFT Softw. Eng. Notes, 28 (6): 2--2, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Nicolas G. de Bruijn. Lambda-calculus notation with nameless dummies: a tool for automatic formal manipulation with application to the Church-Rosser theorem. Indag. Math., 34(5): 381--392, 1972.Google ScholarGoogle ScholarCross RefCross Ref
  13. David Delahaye. A tactic language for the system Coq. In Proc. LPAR, pages 85--95, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Joëlle Despeyroux, Amy P. Felty, and André Hirschowitz. Higher-order abstract syntax in Coq. In Proc. TLCA, pages 124--138, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Leonidas Fegaras and Tim Sheard. Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space). In Proc. POPL, pages 284--294, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Louis-Julien Guillemette and Stefan Monnier. A type-preserving compiler in Haskell. In Proc. ICFP, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Robert Harper and Mark Lillibridge. Explicit polymorphism and CPS conversion. In Proc. POPL, pages 206--219, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Robert Harper and Christopher Stone. A type-theoretic interpretation of Standard ML. In Proof, language, and interaction: essays in honour of Robin Milner, pages 341--387, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Jason Hickey, Aleksey Nogin, Xin Yu, and Alexei Kopylov. Mechanized meta-reasoning using a hybrid HOAS/de Bruijn representation and reflection. In Proc. ICFP, pages 172--183, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Martin Hofmann. Semantical analysis of higher-order abstract syntax. In Proc. LICS, pages 204--213, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Furio Honsell, Marino Miculan, and Ivan Scagnetto. An axiomatic approach to metareasoning on nominal algebras in HOAS. In Proc. ICALP, pages 963--978, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Xavier Leroy. Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In Proc. POPL, pages 42--54, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. James Mckinna and Robert Pollack. Some lambda calculus and type theory formalized. J. Autom. Reason., 23 (3): 373--409, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Yasuhiko Minamide and Koji Okuma. Verifying CPS transformations in Isabelle/HOL. In Proc. MERLIN, pages 1--8, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. J. Strother Moore. A mechanically verified language implementation. J. Automated Reasoning, 5 (4): 461--492, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. L. C. Paulson. Isabelle: A generic theorem prover. Lecture Notes in Computer Science, 828: xvii + 321, 1994.Google ScholarGoogle Scholar
  27. F. Pfenning and C. Elliot. Higher-order abstract syntax. In Proc. PLDI, pages 199--208, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Frank Pfenning and Carsten Schürmann. System description: Twelf - a meta-logical framework for deductive systems. In Proc. CADE, pages 202--206, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Brigitte Pientka. A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions. In Proc. POPL, pages 371--382, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Carsten Schürmann, Joëlle Despeyroux, and Frank Pfenning. Primitive recursion for higher-order abstract syntax. Theoretical Computer Science, 266: 1--57, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Ye Henry Tian. Mechanically verifying correctness of CPS compilation. In Proc. CATS, pages 41--51, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Valery Trifonov, Bratin Saha, and Zhong Shao. Fully reflexive intensional type analysis. In Proc. ICFP, pages 82--93, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. C. Urban and C. Tasson. Nominal techniques in Isabelle/HOL. In Proc. CADE, pages 38--53, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Geoffrey Washburn and Stephanie Weirich. Boxes go bananas: Encoding higher-order abstract syntax with parametric polymorphism. J. Funct. Program., 18 (1): 87--140, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Parametric higher-order abstract syntax for mechanized semantics

                  Recommendations

                  Comments

                  Login options

                  Check if you have access through your login credentials or your institution to get full access on this article.

                  Sign in

                  PDF Format

                  View or Download as a PDF file.

                  PDF

                  eReader

                  View online with eReader.

                  eReader
                  About Cookies On This Site

                  We use cookies to ensure that we give you the best experience on our website.

                  Learn more

                  Got it!