Typed closure conversion for the calculus of constructions

Dependently typed languages such as Coq are used to specify and verify the full functional correctness of source programs. Type-preserving compilation can be used to preserve these specifications and proofs of correctness through compilation into the generated target-language programs. Unfortunately, type-preserving compilation of dependent types is hard. In essence, the problem is that dependent type systems are designed around high-level compositional abstractions to decide type checking, but compilation interferes with the type-system rules for reasoning about run-time terms. We develop a type-preserving closure-conversion translation from the Calculus of Constructions (CC) with strong dependent pairs (Σ types)—a subset of the core language of Coq—to a type-safe, dependently typed compiler intermediate language named CC-CC. The central challenge in this work is how to translate the source type-system rules for reasoning about functions into target type-system rules for reasoning about closures. To justify these rules, we prove soundness of CC-CC by giving a model in CC. In addition to type preservation, we prove correctness of separate compilation.

[1]  Zhong Shao,et al.  CertiKOS: An Extensible Architecture for Building Certified Concurrent OS Kernels , 2016, OSDI.

[2]  Andrew W. Appel,et al.  Verification of a Cryptographic Primitive: SHA-256 , 2015, TOPL.

[3]  Amal Ahmed,et al.  FunTAL: reasonably mixing a functional language with assembly , 2017, PLDI.

[4]  Hugo Herbelin,et al.  On the Degeneracy of Sigma-Types in Presence of Computational Classical Logic , 2005, TLCA.

[5]  Yu Guo,et al.  Deep Specifications and Certified Abstraction Layers , 2015, POPL.

[6]  Derek Dreyer,et al.  Internalizing Relational Parametricity in the Extensional Calculus of Constructions , 2013, CSL.

[7]  Andrew W. Appel,et al.  Compositional CompCert , 2015, POPL.

[8]  Conor McBride,et al.  A List of Successes That Can Change the World , 2016, Lecture Notes in Computer Science.

[9]  Amal Ahmed,et al.  Verifying an Open Compiler Using Multi-language Semantics , 2014, ESOP.

[10]  Douglas J. Howe,et al.  Impredicative Strong Existential Equivalent to Type:Type , 1986 .

[11]  Chung-Kil Hur,et al.  Pilsner: a compositionally verified compiler for a higher-order imperative language , 2015, ICFP.

[12]  John Hatcliff,et al.  CPS Translations and Applications: The Cube and Beyond , 1999, High. Order Symb. Comput..

[13]  Amal Ahmed,et al.  Linking Types for Multi-Language Software: Have Your Cake and Eat It Too , 2017, SNAPL.

[14]  Patrik Jansson,et al.  Proofs for free - Parametricity for dependent types , 2012, J. Funct. Program..

[15]  Nathan Mishra-Linger,et al.  Erasure and Polymorphism in Pure Type Systems , 2008, FoSSaCS.

[16]  Amal Ahmed Verified Compilers for a Multi-Language World , 2015, SNAPL.

[17]  Eduardo Giménez,et al.  Codifying Guarded Definitions with Recursive Schemes , 1994, TYPES.

[18]  Simon Boulier,et al.  The next 700 syntactical models of type theory , 2017, CPP.

[19]  Robert Harper,et al.  Typed Closure Conversion for Recursively-Defined Functions , 1997, Electron. Notes Theor. Comput. Sci..

[20]  Dominique Devriese,et al.  Parametric quantifiers for dependent type theory , 2017, Proc. ACM Program. Lang..

[21]  Zhong Shao,et al.  A type system for certified binaries , 2005, TOPL.

[22]  Alexandre Miquel The Implicit Calculus of Constructions , 2001, TLCA.

[23]  J. Gregory Morrisett,et al.  L3: A Linear Language with Locations , 2007, Fundam. Informaticae.

[24]  Gilles Barthe,et al.  CPS translating inductive and coinductive types , 2002, PEPM '02.

[25]  Robert Harper,et al.  Typed closure conversion , 1996, POPL '96.

[26]  Zhaohui Luo,et al.  ECC, an extended calculus of constructions , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[27]  Chantal Keller,et al.  Parametricity in an Impredicative Sort , 2012, ArXiv.

[28]  Conor McBride,et al.  I Got Plenty o' Nuttin' , 2016, A List of Successes That Can Change the World.

[29]  Matthew Z. Weaver,et al.  CertiCoq : A verified compiler for Coq , 2016 .

[30]  Bruno Barras,et al.  The Implicit Calculus of Constructions as a Programming Language with Dependent Types , 2008, FoSSaCS.

[31]  Amal Ahmed,et al.  Noninterference for free , 2015, ICFP.

[32]  Matthias Blume,et al.  An equivalence-preserving CPS translation via multi-language semantics , 2011, ICFP '11.

[33]  Benjamin Grégoire,et al.  On Strong Normalization of the Calculus of Constructions with Type-Based Termination , 2010, LPAR.

[34]  Ross P Aterson Proofs for free Parametricity for dependent types JEAN -P HILIPPE B ERNARDY and P ATRIK J ANSSON , 2012 .

[35]  Jeehoon Kang,et al.  Lightweight verification of separate compilation , 2016, POPL.

[36]  Richard Nathan Mishra-Linger Irrelevance, polymorphism, and erasure in type theory , 2008 .

[37]  Matthias Blume,et al.  Typed closure conversion preserves observational equivalence , 2008, ICFP 2008.

[38]  Thierry Coquand,et al.  An Analysis of Girard's Paradox , 1986, LICS.

[39]  A. Ahmed,et al.  Typed closure conversion for the calculus of constructions , 2018, PLDI.

[40]  Juan Chen,et al.  Type-preserving compilation of end-to-end verification of security enforcement , 2010, PLDI '10.

[41]  Benjamin Grégoire,et al.  Formal certification of code-based cryptographic proofs , 2009, POPL '09.

[42]  Max S. New,et al.  Fully abstract compilation via universal embedding , 2016, ICFP.

[43]  Xavier Leroy,et al.  A Formally Verified Compiler Back-end , 2009, Journal of Automated Reasoning.

[44]  Amal Ahmed,et al.  Type-preserving CPS translation of Σ and Π types is not not possible , 2017, Proc. ACM Program. Lang..

[45]  Karl Crary,et al.  From system F to typed assembly language , 1999, TOPL.

[46]  Christine Paulin-Mohring,et al.  The coq proof assistant reference manual , 2000 .