## Author manuscript, published in "Twelfth International Symposium on Practical Aspects of Declarative Languages (2010)" Conversion by Evaluation Mathieu Boespflug ⋆ (2009)

### BibTeX

@MISC{Inria09authormanuscript,,

author = {École Polytechnique Inria},

title = {Author manuscript, published in "Twelfth International Symposium on Practical Aspects of Declarative Languages (2010)" Conversion by Evaluation Mathieu Boespflug ⋆},

year = {2009}

}

### OpenURL

### Abstract

Abstract. We show how testing convertibility of two types in dependently typed systems can advantageously be implemented instead untyped normalization by evaluation, thereby reusing existing compilers and runtime environments for stock functional languages, without peeking under the hood, for a fast yet cheap system in terms of implementation effort. Our focus is on performance of untyped normalization by evaluation. We demonstrate that with the aid of a standard optimization for higher order programs (namely uncurrying), the reuse of native datatypes and pattern matching facilities of the underlying evaluator, we may obtain a normalizer with little to no performance overhead compared to a regular evaluator. 1

### Citations

207 | Type-directed partial evaluation
- Danvy
(Show Context)
Citation Context ...A particularly elegant idea, normalization by evaluation (NbE), proposes to exploit off-the-shelf evaluators to implement normalization, rather than rolling out a custom built normalizer from scratch =-=[2, 3, 4, 7, 10, 11]-=-. All the better for speedy execution on stock hardware: some evaluators for functional languages have benefited from dozens of man years spent pouring over complex optimizations and tweaking the exec... |

101 |
Réductions correctes et optimales dans le lambda-calcul
- Lévy
- 1978
(Show Context)
Citation Context ...normalization by evaluation is that terms are always evaluated to weak head normal forms before normalizing under binders. When strongly normalizing a term, this may not be the best strategy: in fact =-=[17]-=- has shown that this could lead to redundant copying of exponentially many λ-terms, which an optimal strategy might avoid. But seeking the optimal strategy may introduce far too much overhead to be vi... |

92 |
The ZINC experiment: an economical implementation of the ML language
- Leroy
- 1990
(Show Context)
Citation Context ...nvironments such as the OCaml interpreter can avoid any allocation of environments on the heap in the common case of n-ary functions applied to n arguments, instead pushing all arguments on the stack =-=[16]-=-. 3.2 Specialized constructors Representing all datatypes as functions via Church encodings induces needlessly many β-reductions and wastes opportunities for optimization. Haskell and many other stati... |

67 | X.: A compiled implementation of strong reduction
- Grégoire, Leroy
- 2002
(Show Context)
Citation Context ...mbly code, resulting in an efficient but more heavyweight (in the sense of implementation effort) and less portable execution model compared to NbE based approaches. The machine of Grégoire and Leroy =-=[13]-=- that Coq sometimes uses for the conversion test should also be mentioned here. Theirs is a modified and formalized version of a bytecode interpreter for OCaml (the ZAM), to do normalization via reduc... |

44 | Intuitionistic model constructions and normalization proofs
- Coquand, Dybjer
- 1993
(Show Context)
Citation Context ...A particularly elegant idea, normalization by evaluation (NbE), proposes to exploit off-the-shelf evaluators to implement normalization, rather than rolling out a custom built normalizer from scratch =-=[2, 3, 4, 7, 10, 11]-=-. All the better for speedy execution on stock hardware: some evaluators for functional languages have benefited from dozens of man years spent pouring over complex optimizations and tweaking the exec... |

39 | Normalization by evaluation for typed lambda calculus with coproducts - Altenkirch, Dybjer, et al. - 2001 |

29 |
Making a fast curry: push/enter vs eval/apply for higher-order languages
- Marlow, Peyton-Jones
- 2006
(Show Context)
Citation Context ...nctions could avoid this. The literature abounds with various encodings of n-ary functions (i.e. calling conventions) targeted by compilers to avoid costly closure allocation. Marlow and Peyton-Jones =-=[19]-=- proposes the Push/Enter and Eval/Apply dichotomy to describe them. We pick the Eval/Apply model here for its very cheap implementation cost and good performance in the common case [19]. That is, assu... |

27 | Proving equalities in a commutative ring done right in Coq
- Grégoire, Mahboubi
- 2005
(Show Context)
Citation Context ...s. Efficient (full) normalization is particularly important when checking types entails a large amount of computation, as can often be the case, notably in proofs by reflection. Grégoire and Mahboubi =-=[14]-=- and Gonthier [12] provide ideal examples of such proofs. ⋆ The research presented here was supported by a grant from Région Ile-de-France.inria-00434282, version 1 - 21 Nov 2009 Other heavy users of... |

21 | Embedding Pure type systems in the lambda-Picalculus modulo
- Cousineau, Dowek
- 2007
(Show Context)
Citation Context ...for the conversion test in the Calculus of Inductive Constructions used by Coq for instance, but it is useful for reduction in Isabelle/HOL and for the conversion test in formalisms such as λΠ-modulo =-=[8]-=-. Blanqui et al. [5] independently propose a similar translation of rewrite rules into OCaml though in the context of finding canonical forms for non-free algebraic datatypes rather than applied to no... |

11 | Term rewriting for normalization by evaluation
- Berger, Eberl, et al.
(Show Context)
Citation Context ...A particularly elegant idea, normalization by evaluation (NbE), proposes to exploit off-the-shelf evaluators to implement normalization, rather than rolling out a custom built normalizer from scratch =-=[2, 3, 4, 7, 10, 11]-=-. All the better for speedy execution on stock hardware: some evaluators for functional languages have benefited from dozens of man years spent pouring over complex optimizations and tweaking the exec... |

11 |
Strongly reducing variants of the Krivine abstract machine
- Crégut
(Show Context)
Citation Context ...gh in the context of finding canonical forms for non-free algebraic datatypes rather than applied to normalization. A variety of virtual machines have been proposed for normalization. Notably, Crégut =-=[9]-=- proves correct a normalizer for the λ-calculus. The code can be executed by expansion to Motorola 68000 assembly code, resulting in an efficient but more heavyweight (in the sense of implementation e... |

11 | The Four Colour Theorem: Engineering of a Formal Proof - Gonthier - 2007 |

10 | Optimizing Pattern Matching
- Fessant, Maranget
- 2001
(Show Context)
Citation Context ...tatypes and pattern matching facilities on these datatypes, enabling more natural and more efficient data manipulation. Compiling complex pattern matches to decision trees or to backtracking automata =-=[15]-=- can drastically reduce the amount of computation needed to access and manipulate algebraic structures. With the current definition of Term, it is already possible to parse patterns in the syntax to c... |

9 | On the implementation of construction functions for non-free concrete data types
- BLANQUI, HARDIN, et al.
- 2007
(Show Context)
Citation Context ...est in the Calculus of Inductive Constructions used by Coq for instance, but it is useful for reduction in Isabelle/HOL and for the conversion test in formalisms such as λΠ-modulo [8]. Blanqui et al. =-=[5]-=- independently propose a similar translation of rewrite rules into OCaml though in the context of finding canonical forms for non-free algebraic datatypes rather than applied to normalization. A varie... |

9 | Normalisation by evaluation in the compilation of typed functional programming languages
- Lindley
- 2005
(Show Context)
Citation Context ...bed in Section 3.1. For simplicity, constructors in the object language are not translated to constructors in the metalanguage but rather represented with a special constructor for constants. Lindley =-=[18]-=- also considers untyped normalization by evaluation in a performance sensitive context, giving a quantitative analysis of the performance of a number of algorithms and variants compared to reduction b... |

5 |
A Compiled Implementation of Normalization by Evaluation. Theorem Proving
- Aehlig, Haftmann, et al.
- 2008
(Show Context)
Citation Context ...act syntax (HOAS), ultimately deriving a form of normalization by evaluation. In contrast to usual approaches to NbE, where the normalization is type driven, and along the same lines as Aehlig et al. =-=[1]-=- and Filinski and Rohde [11], we shunt the first problem by deriving an untyped variant of NbE that finds the normal form of all λ-terms if there is one (Section 2). We then show how to improve on thi... |

4 |
H.: Normalization by evaluation. Prospects for Hardware Foundations
- Berger, Eberl, et al.
- 1998
(Show Context)
Citation Context |

3 |
From self-interpreters to normalization by evaluation
- Boespflug
- 2009
(Show Context)
Citation Context ... boxed into lists), by which means we may port the results found therein. Correctness may alternatively be derived via meaning preserving transformations from preexisting normalizers, in the style of =-=[6]-=-. 6 Related Work inria-00434282, version 1 - 21 Nov 2009 Our work is a continuation of many other contributions regarding normalization by evaluation and its applications. Whilst many treatments of Nb... |

2 |
H.: A denotational account of untyped normalization by evaluation (2004
- Filinski, Rohde
(Show Context)
Citation Context |