Parametric higher-order abstract syntax for mechanized semantics

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.

[1]  James McKinna,et al.  Some Lambda Calculus and Type Theory Formalized , 1997, Journal of Automated Reasoning.

[2]  Adam Chlipala,et al.  A certified type-preserving compiler from lambda calculus to assembly language , 2007, PLDI '07.

[3]  Brigitte Pientka A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions , 2008, POPL '08.

[4]  Mark Lillibridge,et al.  Explicit polymorphism and CPS conversion , 1993, POPL '93.

[5]  David Delahaye,et al.  A Tactic Language for the System Coq , 2000, LPAR.

[6]  Xavier Leroy,et al.  Mechanized Verification of CPS Transformations , 2007, LPAR.

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

[8]  Stefan Monnier,et al.  A type-preserving compiler in Haskell , 2008, ICFP 2008.

[9]  Zhong Shao,et al.  Fully reflexive intensional type analysis , 2000, ICFP '00.

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

[11]  Tim Sheard,et al.  Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space) , 1996, POPL '96.

[12]  J. Strother Moore,et al.  A mechanically verified language implementation , 1989, Journal of Automated Reasoning.

[13]  Thorsten Altenkirch A Formalization of the Strong Normalization Proof for System F in LEGO , 1993, TLCA.

[14]  Amy P. Felty,et al.  Higher-Order Abstract Syntax in Coq , 1995, TLCA.

[15]  Lawrence Charles Paulson,et al.  Isabelle: A Generic Theorem Prover , 1994 .

[16]  Stephanie Weirich,et al.  Boxes go bananas: Encoding higher-order abstract syntax with parametric polymorphism , 2008, J. Funct. Program..

[17]  Xavier Leroy,et al.  Formal certification of a compiler back-end or: programming a compiler with a proof assistant , 2006, POPL '06.

[18]  de Ng Dick Bruijn Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem , 1972 .

[19]  Christian Urban,et al.  Nominal Techniques in Isabelle/HOL , 2005, Journal of Automated Reasoning.

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

[21]  Amy P. Felty,et al.  Combining de Bruijn Indices and Higher-Order Abstract Syntax in Coq , 2006, TYPES.

[22]  Roy L. Crole,et al.  Combining Higher Order Abstract Syntax with Tactical Theorem Proving and (Co)Induction , 2002, TPHOLs.

[23]  Yasuhiko Minamide,et al.  Verifying CPS transformations in Isabelle/HOL , 2003, MERLIN '03.

[24]  Frank Pfenning,et al.  System Description: Twelf - A Meta-Logical Framework for Deductive Systems , 1999, CADE.

[25]  Xin Yu,et al.  Mechanized meta-reasoning using a hybrid HOAS/de bruijn representation and reflection , 2006, ICFP '06.

[26]  Martin Hofmann,et al.  Consistency of the theory of contexts , 2006, J. Funct. Program..

[27]  Maulik A. Dave,et al.  Compiler verification: a bibliography , 2003, SOEN.

[28]  Pierre Castéran,et al.  Interactive Theorem Proving and Program Development , 2004, Texts in Theoretical Computer Science An EATCS Series.

[29]  Robert Harper,et al.  A type-theoretic interpretation of standard ML , 2000, Proof, Language, and Interaction.

[30]  Benjamin C. Pierce,et al.  Mechanized Metatheory for the Masses: The PoplMark Challenge , 2005, TPHOLs.

[31]  Furio Honsell,et al.  An Axiomatic Approach to Metareasoning on Nominal Algebras in HOAS , 2001, ICALP.

[32]  Ye Henry Tian Mechanically Verifying Correctness of CPS Compilation , 2006, CATS.

[33]  Arthur Charguéraud,et al.  Engineering formal metatheory , 2008, POPL '08.