COQ Cock Correct! Verification of Type Checking and Erasure for COQ, in COQ

被引:21
|
作者
Sozeau, Matthieu [1 ,2 ]
Boulier, Simon [3 ]
Forster, Yannick [4 ]
Tabareau, Nicolas [3 ]
Winterhalter, Theo [3 ]
机构
[1] Inria Paris, Paris, France
[2] Univ Paris Diderot, CNRS, IRIF, Paris, France
[3] Inria Nantes, Nantes, France
[4] Saarland Univ, Saarbrucken, Germany
基金
欧洲研究理事会;
关键词
proof assistants; type checker; certification; CALCULUS;
D O I
10.1145/3371076
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
COQ is built around a well-delimited kernel that perfoms typechecking for definitions in a variant of the Calculus of Inductive Constructions (CIC). Although the metatheory of CIC is very stable and reliable, the correctness of its implementation in COQ is less clear. Indeed, implementing an efficient type checker for CIC is a rather complex task, and many parts of the code rely on implicit invariants which can easily be broken by further evolution of the code. Therefore, on average, one critical bug has been found every year in COQ. This paper presents the first implementation of a type checker for the kernel of COQ (without the module system and template polymorphism), which is proven correct in COQ with respect to its formal specification and axiomatisation of part of its metatheory. Note that because of Godel's incompleteness theorem, there is no hope to prove completely the correctness of the specification of COQ inside COQ (in particular strong normalisation or canonicity), but it is possible to prove the correctness of the implementation assuming the correctness of the specification, thus moving from a trusted code base (TCB) to a trusted theory base (TTB) paradigm. Our work is based on the METACoQ project which provides metaprogramming facilities to work with terms and declarations at the level of this kernel. Our type checker is based on the specification of the typing relation of the Polymorphic, Cumulative Calculus of Inductive Constructions (PCUIC) at the basis of COQ and the verification of a relatively efficient and sound type-checker for it. In addition to the kernel implementation, an essential feature of COQ is the so-called extraction: the production of executable code in functional languages from COQ definitions. We present a verified version of this subtle type-and-proof erasure step, therefore enabling the verified extraction of a safe type-checker for COQ.
引用
收藏
页数:28
相关论文
共 50 条
  • [41] Circuits as streams in Coq: Verification of a sequential multiplier
    Paulin-Mohring, C
    TYPES FOR PROOFS AND PROGRAMS, 1996, 1158 : 216 - 230
  • [42] A Coq library for internal verification of running-times
    McCarthy, Jay
    Fetscher, Burke
    New, Max S.
    Feltey, Daniel
    Findler, Robert Bruce
    SCIENCE OF COMPUTER PROGRAMMING, 2018, 164 : 49 - 65
  • [43] Characterization of Arabidopsis thaliana Coq9 in the CoQ Biosynthetic Pathway
    Hu, Mei
    Jiang, Yan
    Xu, Jing-Jing
    METABOLITES, 2023, 13 (07)
  • [44] Verification of PLC Properties Based on Formal Semantics in Coq
    Blech, Jan Olaf
    Biha, Sidi Ould
    SOFTWARE ENGINEERING AND FORMAL METHODS, 2011, 7041 : 58 - +
  • [45] Modular Verification of Programs with Effects and Effect Handlers in Coq
    Letan, Thomas
    Regis-Gianas, Yann
    Chifflier, Pierre
    Hiet, Guillaume
    FORMAL METHODS, 2018, 10951 : 338 - 354
  • [46] Lethal Neonatal CoQ Deficiency due to a COQ9 Variant
    Finsterer, Josef
    Scorza, Fulvio A.
    Fiorini, Ana C.
    Scorza, Carla A.
    de Almeida, Antonio Carlos
    JOURNAL OF PEDIATRIC NEUROSCIENCES, 2018, 13 (02) : 286 - 287
  • [47] QWIRE Practice: Formal Verification of Quantum Circuits in Coq
    Rand, Robert
    Paykin, Jennifer
    Zdancewic, Steve
    ELECTRONIC PROCEEDINGS IN THEORETICAL COMPUTER SCIENCE, 2018, (266): : 119 - 132
  • [48] Description and Verification of Pattern-Based Composition in Coq
    Liu, Qiang
    Ynag, Zhongyuan
    Xie, Jinkui
    ADVANCES IN COMPUTATIONAL SCIENCE AND ENGINEERING, 2009, 28 : 231 - 245
  • [49] Using Coq for Formal Modeling and Verification of Timed Connectors
    Hong, Weijiang
    Nawaz, M. Saqib
    Zhang, Xiyue
    Li, Yi
    Sun, Meng
    SOFTWARE ENGINEERING AND FORMAL METHODS, SEFM 2017, 2018, 10729 : 558 - 573
  • [50] A NEW BEGINNING - COQ
    GUTT, TJ
    JOURNAL PRESTRESSED CONCRETE INSTITUTE, 1987, 32 (01): : 19 - 19