The Science of Deep Specification

The formal verification of compilers Xavier Leroy

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:

We use the Coq proof assistant and build on the formalization of the IMP language from Logical Foundations by Pierce et al.

Lecture material

The dsss17 repository contains lecture notes and homework for this lecture in the compiler/ directory.

The slides for the lecture.

Day one: compiling IMP to a virtual machine

Suggested homework

Lecture recordings

Day two: notions of semantic preservation; using small-step semantics

Suggested homework

Lecture recordings

Day three: liveness analysis, dead code optimization, register allocation

Suggested homework

Lecture recordings

Day four: compiler verification "in the large" with CompCert

Lecture recordings