Compilers are a prime target for formal verification, since compiler bugs invalidate higher-level correctness guarantees, but compiler changes may become more labor-intensive to implement, if they must come with proof patches. One appealing approach is to present compilers as sets of algebraic rewrite rules, which a generic engine can apply efficiently. Now each rewrite rule can be proved separately, with no need to revisit past proofs for other parts of the compiler. We present the first realization of this idea, in the form of a framework for the Coq proof assistant. Our new Coq command takes normal proved theorems and combines them automatically into fast compilers with proofs. We applied our framework to improve the Fiat Cryptography toolchain for generating cryptographic arithmetic, producing an extracted command-line compiler that is about 1000$\times$ faster while actually featuring simpler compiler-specific proofs.
翻译:编译器是正式核查的首要目标, 因为编译器错误使更高层次的正确性保障失效, 但编译器的修改如果必须配有校对补丁, 则可能变得更加劳动密集型, 需要执行。 一个颇具吸引力的方法是将编译器作为代数重写规则显示, 通用引擎可以有效应用。 现在, 每一个重写规则都可以单独证明, 无需为编译器的其他部分重审过去的证据 。 我们以 Coq 校准助理框架的形式展示了这个想法的首次实现情况。 我们的新 Coq 命令使用正常的代数, 并将它们自动合并成快速编译器, 并配有校对。 我们应用了我们的框架来改进 Fiat 加密工具链, 生成加密算术, 生成一个提取的指令线编译器, 速度约为 1000\ times, 并实际使用更简单的编译器具体的证据 。