Towards Certified Meta-Programming with Typed Template-Coq
Towards Certified Meta-Programming with Typed Template-Coq
复制标题
DOI:
10.1007/978-3-319-94821-8_2
复制
发表时间:
2018-07
期刊:
影响因子:
--
通讯作者:
A. Anand;S. Boulier;C. Cohen;Matthieu Sozeau;Nicolas Tabareau
中科院分区:
文献类型:
--
作者:
A. Anand;S. Boulier;C. Cohen;Matthieu Sozeau;Nicolas Tabareau
Template-Coq( https://template-coq.github.io/template-coq ) is a plugin forCoq, originally implemented by Malecha [18], which provides a reifier forCoqterms and global declarations, as represented in theCoqkernel, as well as a denotation command. Initially, it was developed for the purpose of writing functions onCoq’s AST inGallina. Recently, it was used in theCertiCoqcertified compiler project [4], as its front-end language, to derive parametricity properties [3], and to extractCoqterms to a CBV-calculus [13]. However, the syntax lacked semantics, be it typing semantics or operational semantics, which should reflect, as formal specifications inCoq, the semantics ofCoq’s type theory itself. The tool was also rather bare bones, providing only rudimentary quoting and unquoting commands. We generalize it to handle the entire Calculus of Inductive Constructions (CIC), as implemented byCoq, including the kernel’s declaration structures for definitions and inductives, and implement a monad for general manipulation ofCoq’s logical environment. We demonstrate how this setup allowsCoqusers to define many kinds of general purpose plugins, whose correctness can be readily proved in the system itself, and that can be run efficiently after extraction. We give a few examples of implemented plugins, including a parametricity translation. We also advocate the use ofTemplate-Coqas a foundation for higher-level tools.