Xavier Leroy

Proving a Compiler: Mechanized Verification of Program Transformations and Static Analyses

Formal semantics of programming languages supports not only reasoning over individual programs (program correctness), but also reasoning over program transformations and static analyses, as typically found in compilers (tool correctness). With the help of a proof assistant, we can prove semantic preservation properties of program transformations and semantic soundness properties of static analyses that greatly increase the confidence we can have in compilers and program verification tools.

The topics covered in this lecture include:

  • Non-optimizing compilation of a structured imperative language to a virtual machine, and its correctness proof.
  • Notions of semantic preservation.
  • A panorama of mechanized semantics: small-step, big-step, coinductive big-step, definitional interpreter, denotational semantics.
  • Examples of program optimizations: dead code elimination, register allocation.
  • Design and soundness proof of a generic static analyzer based on abstract interpretation.
  • Compiler verification "in the large" : an overview of the CompCert verified C compiler.

We will use the Coq proof assistant and build on the formalization of the IMP language shown in Benjamin Pierce's "Software Foundations" lectures. 

Course material available here, especially the corresponding Coq development (compiler-verification.tar.gz).