1. Typeful Normalization by Evaluation
- Author
-
Olivier Danvy and Chantal Keller and Matthias Puech, Danvy, Olivier, Keller, Chantal, Puech, Matthias, Olivier Danvy and Chantal Keller and Matthias Puech, Danvy, Olivier, Keller, Chantal, and Puech, Matthias
- Abstract
We present the first typeful implementation of Normalization by Evaluation for the simply typed lambda-calculus with sums and control operators: we guarantee type preservation and eta-long (modulo commuting conversions), beta-normal forms using only Generalized Algebraic Data Types in a general-purpose programming language, here OCaml; and we account for sums and control operators with Continuation-Passing Style. First, we implement the standard NbE algorithm for the implicational fragment in a typeful way that is correct by construction. We then derive its call-by-value continuation-passing counterpart, that maps a lambda-term with sums and call/cc into a CPS term in normal form, which we express in a typed dedicated syntax. Beyond showcasing the expressive power of GADTs, we emphasize that type inference gives a smooth way to re-derive the encodings of the syntax and typing of normal forms in Continuation-Passing Style.
- Published
- 2015
- Full Text
- View/download PDF