Verifying efficient function calls in CakeML

We have designed an intermediate language (IL) for the CakeML compiler that supports the verified, efficient compilation of functions and calls. Verified compilation steps include batching of multiple curried arguments, detecting calls to statically known functions, and specialising calls to known functions with no free variables. Finally, we verify the translation to a lower-level IL that only supports closed, first-order functions. These compilation steps resemble those found in other compilers (especially OCaml). Our contribution here is the design of the semantics of the IL, and the demonstration that our verification techniques over this semantics work well in practice at this scale. The entire development was carried out in the HOL4 theorem prover.

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

[2]  Andrew W. Appel,et al.  Compiling with Continuations , 1991 .

[3]  Ramana Kumar,et al.  A new verified compiler backend for CakeML , 2016, ICFP.

[4]  Joachim Breitner Formally proving a compiler transformation safe , 2015, Haskell.

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

[6]  Umut A. Acar,et al.  Imperative self-adjusting computation , 2008, POPL '08.

[7]  Chung-Kil Hur,et al.  A kripke logical relation between ML and assembly , 2011, POPL '11.

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

[9]  Chung-Kil Hur,et al.  Biorthogonality, step-indexing and compiler correctness , 2009, ICFP.

[10]  Xavier Leroy,et al.  A verified framework for higher-order uncurrying optimizations , 2009, High. Order Symb. Comput..

[11]  Nada Amin,et al.  Type soundness proofs with definitional interpreters , 2017, POPL.

[12]  Robert S. Boyer,et al.  Mechanized formal reasoning about programs and computing machines , 1997 .

[13]  Amr Sabry,et al.  The essence of compiling with continuations , 1993, PLDI '93.

[14]  Magnus O. Myreen,et al.  Proof-producing translation of higher-order logic into pure and stateful ML , 2014, Journal of Functional Programming.

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

[16]  Simon L. Peyton Jones,et al.  Making a fast curry: push/enter vs. eval/apply for higher-order languages , 2006, J. Funct. Program..

[17]  Ramana Kumar,et al.  CakeML: a verified implementation of ML , 2014, POPL.

[18]  Ramana Kumar,et al.  A verified type system for CakeML , 2015, IFL '15.

[19]  Amal Ahmed,et al.  Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types , 2006, ESOP.

[20]  Magnus O. Myreen,et al.  A Verified Runtime for a Verified Theorem Prover , 2011, ITP.

[21]  Andrew W. Appel,et al.  An indexed model of recursive types for foundational proof-carrying code , 2001, TOPL.

[22]  Lars Birkedal,et al.  The impact of higher-order state and control effects on local relational reasoning , 2012, J. Funct. Program..

[23]  Ramana Kumar,et al.  Functional Big-Step Semantics , 2016, ESOP.

[24]  Dominique Devriese,et al.  Fully-abstract compilation by approximate back-translation , 2016, POPL.

[25]  BirkedalLars,et al.  The impact of higher-order state and control effects on local relational reasoning , 2010 .

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

[27]  Adam Chlipala,et al.  A verified compiler for an impure functional language , 2010, POPL '10.

[28]  Andrew M. Pitts,et al.  Computational Adequacy via "Mixed" Inductive Definitions , 1993, MFPS.

[29]  William D. Young,et al.  A mechanically verified code generator , 1989, Journal of Automated Reasoning.

[30]  Simon L. Peyton Jones,et al.  Making a fast curry: push/enter vs. eval/apply for higher-order languages , 2004, ICFP '04.

[31]  Ramana Kumar,et al.  Verified Characteristic Formulae for CakeML , 2017, ESOP.