π€ AI Summary
Formal verification of compilers incurs high maintenance costs, especially when modifications necessitate extensive re-verification. Method: This paper introduces the first trusted rewriting engine framework for Coq, modeling compilers as collections of algebraic rewrite rulesβeach independently verifiable. It employs theorem-driven modeling, metaprogramming-based automated synthesis, and proof reuse to enable rule-level formal verification and automatic composition. Contribution/Results: The framework decouples rule verification from compiler construction, significantly reducing verification and maintenance overhead. Evaluated in the Fiat Cryptography toolchain, the generated command-line compiler achieves approximately 1000Γ speedup over prior verified counterparts. Moreover, its proofs are more concise and exhibit substantially higher reusability across compiler transformations.
π Abstract
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 Γ faster while actually featuring simpler compiler-specific proofs.