Book of Abstracts - IRIT
Book of Abstracts - IRIT
Book of Abstracts - IRIT
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
A very generic implementation <strong>of</strong> data-types<br />
with binders in Coq<br />
Benjamin Werner<br />
Ecole Polytechnique<br />
Abstract<br />
Formalizing structures with binders, like first-order logic, lambda-calculus or programming<br />
languages in a system like Coq is a very common problem. The recent years have<br />
seen a lot <strong>of</strong> work devoted to it, which now gives us a quite clear picture <strong>of</strong> the respective<br />
advantages and drawbacks <strong>of</strong> various approaches: De Bruijn indices, nominal approach,<br />
the locally nameless approach which compromises between the former two, and many other<br />
variants. In any case, when starting a formalization, the user has to make an early choice<br />
about what encoding will be used. Furthermore, every approach still comes with a boilerplate<br />
part <strong>of</strong> work (typically defining the lifting functions for de Bruijn indices or stating<br />
and proving the co-finite induction principles for the locally nameless approach).<br />
We propose a generic data-type which allows to encode all languages with binders,<br />
provided all operators have a fixed arity. This data-type comes with a full set <strong>of</strong> functions<br />
and induction principles, thus allowing the user to avoid boilerplate work, and also to<br />
switch between diverse approaches in the same development.<br />
1 Motivation and setting<br />
When defining the syntax <strong>of</strong> a specific language in type theory, the obvious way is to use an<br />
inductive type: each operator <strong>of</strong> the language is mapped to a corresponding constructor <strong>of</strong> the<br />
inductive type; both having the same fixed arity. This approach generalized to many-sorted<br />
languages by using mutual inductive types.<br />
Things are more complicated when the formalized language yields binders. It is notorious<br />
one has to make an almost religious choice between various solutions :<br />
• named variables, which involves dealing with explicit α-conversion and various tricky<br />
points about freshness <strong>of</strong> identifiers,<br />
• “full” De Bruijn indices, which involves defining various lifting operators, which then<br />
appear in further definitions,<br />
• locally nameless approach, where De Bruijn indices are restricted to variables bound in<br />
the term,<br />
• trying to mimic at least the spirit <strong>of</strong> the Higher-Order Abstract Syntax approach, in which<br />
the binder <strong>of</strong> the meta formalism is used, as it can be done in weaker formalisms like LF.<br />
In all cases where De Bruijn indices are involved, one has to build a specific induction principle.<br />
This is particularly the case in the locally nameless approach, where Aydemir et. al have<br />
designed a clever co-finite quantification induction scheme.<br />
In all cases, there is thus a non-negligible amount <strong>of</strong> boilerplate work involved. The aim<br />
<strong>of</strong> this work is to provide a package which allows the user to handle, in a smooth way, all the<br />
approaches but the one using only named variables. We do this by proposing a generic type<br />
which :<br />
80