A verified compiler for an impure functional language
Author:
Open Access
- 2 January 2010
- journal article
- Published by Association for Computing Machinery (ACM) in ACM SIGPLAN Notices
- Vol. 45 (1) , 93-106
Abstract
We present a verified compiler to an idealized assembly language from a small, untyped functional language with mutable references and exceptions. The compiler is programmed in the Coq proof assistant and has a proof of total correctness with respect to big-step operational semantics for the source and target languages. Compilation is staged and includes standard phases like translation to continuation-passing style and closure conversion, as well as a common subexpression elimination optimization. In this work, our focus has been on discovering and using techniques that make our proofs easy to engineer and maintain. While most programming language work with proof assistants uses very manual proof styles, all of our proofs are implemented as adaptive programs in Coq's tactic language, making it possible to reuse proofs unchanged as new language features are added. In this paper, we focus especially on phases of compilation that rearrange the structure of syntax with nested variable binders. That aspect has been a key challenge area in past compiler verification projects, with much more effort expended in the statement and proof of binder-related lemmas than is found in standard pencil-and-paper proofs. We show how to exploit the representation technique of parametric higher-order abstract syntax to avoid the need to prove any of the usual lemmas about binder manipulation, often leading to proofs that are actually shorter than their pencil-and-paper analogues. Our strategy is based on a new approach to encoding operational semantics which delegates all concerns about substitution to the meta language, without using features incompatible with general-purpose type theories like Coq's logic.Keywords
This publication has 16 references indexed in Scilit:
- Coinductive big-step operational semanticsInformation and Computation, 2009
- Engineering formal metatheory2008
- Boxes go bananas: Encoding higher-order abstract syntax with parametric polymorphism*Journal of Functional Programming, 2008
- Formal certification of a compiler back-end or2006
- Nominal Techniques in Isabelle/HOL2005
- Compiler verificationACM SIGSOFT Software Engineering Notes, 2003
- Abstract models of memory management1995
- A framework for defining logicsJournal of the ACM, 1993
- Representing Control: a Study of the CPS TransformationMathematical Structures in Computer Science, 1992
- Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theoremIndagationes Mathematicae, 1972