ABSTRACT
There has recently been great progress in proving the correctness of compilers for increasingly realistic languages with increasingly realistic runtime systems. Most work on this problem has focused on proving the correctness of a particular compiler, leaving open the question of how to verify the correctness of assembly code that is hand-optimized or linked together from the output of multiple compilers. This has led Benton and other researchers to propose more abstract, compositional notions of when a low-level program correctly realizes a high-level one. However, the state of the art in so-called "compositional compiler correctness" has only considered relatively simple high-level and low-level languages.
In this paper, we propose a novel, extensional, compiler-independent notion of equivalence between high-level programs in an expressive, impure ML-like λ-calculus and low-level programs in an (only slightly) idealized assembly language. We define this equivalence by means of a biorthogonal, step-indexed, Kripke logical relation, which enables us to reason quite flexibly about assembly code that uses local state in a different manner than the high-level code it implements (e.g. self-modifying code). In contrast to prior work, we factor our relation in a symmetric, language-generic fashion, which helps to simplify and clarify the formal presentation, and we also show how to account for the presence of a garbage collector. Our approach relies on recent developments in Kripke logical relations for ML-like languages, in particular the idea of possible worlds as state transition systems.
Supplemental Material
- A. Ahmed. Step-indexed syntactic logical relations for recursive and quantified types. In ESOP, 2006. Google ScholarDigital Library
- A. Ahmed, D. Dreyer, and A. Rossberg. State-dependent representation independence. In POPL, 2009. Google ScholarDigital Library
- A. Appel and D. McAllester. An indexed model of recursive types for foundational proof-carrying code. TOPLAS, 23(5):657--683, 2001. Google ScholarDigital Library
- A. Appel, P.-A. Melliès, C. Richards, and J. Vouillon. A very modal model of a modern, major, general type system. In POPL, 2007. Google ScholarDigital Library
- N. Benton and C.-K. Hur. Biorthogonality, step-indexing and compiler correctness. In ICFP, 2009. Google ScholarDigital Library
- N. Benton and C.-K. Hur. Realizability and compositional compiler correctness for a polymorphic language. Technical Report MSR-TR-2010-62, Microsoft Research, Apr. 2010.Google Scholar
- L. Birkedal, K. Støvring, and J. Thamsborg. A relational realizability model for higher-order stateful ADTs. Submitted for publication, 2010.Google Scholar
- N. Bohr. Advances in Reasoning Principles for Contextual Equivalence and Termination. PhD thesis, IT University of Copenhagen, 2007.Google Scholar
- H. Cai, Z. Shao, and A. Vaynberg. Certified self-modifying code. In PLDI, 2007. Google ScholarDigital Library
- A. Chlipala. A certified type-preserving compiler from lambda calculus to assembly language. In PLDI, 2007. Google ScholarDigital Library
- A. Chlipala. Syntactic proofs of compositional compiler correctness, 2009. Submitted for publication.Google Scholar
- A. Chlipala. A verified compiler for an impure functional language. In POPL, 2010. Google ScholarDigital Library
- Z. Dargaye. Vérification formelle d'un compilateur pour langages fonctionnels. PhD thesis, Université Paris 7 Denis Diderot, July 2009.Google Scholar
- D. Dreyer, G. Neis, and L. Birkedal. The impact of higher-order state and control effects on local relational reasoning. In ICFP, 2010. Google ScholarDigital Library
- C.-K. Hur and D. Dreyer. Technical appendix for this paper, 2010. URL: http://www.mpi-sws.org/~dreyer/papers/lrmlasm/Google Scholar
- G. Jaber and N. Tabareau. Krivine realizability for compiler correctness. In LOLA, 2010.Google Scholar
- J.-L. Krivine. Classical logic, storage operators and second-order lambda-calculus. Annals of Pure and Applied Logic, 68:53--78, 1994.Google ScholarCross Ref
- X. Leroy. A formally verified compiler back-end. Journal of Automated Reasoning, 43(4):363--446, 2009. Google ScholarDigital Library
- A. McCreight, T. Chevalier, and A. Tolmach. A certified framework for compiling and executing garbage-collected languages. In ICFP, 2010. Google ScholarDigital Library
- A. McCreight, Z. Shao, C. Lin, and L. Li. A general framework for certifying garbage collectors and their mutators. In PLDI, 2007. Google ScholarDigital Library
- A. Pitts. Typed operational reasoning. In B. C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 7. MIT Press, 2005.Google Scholar
- A. Pitts and I. Stark. Operational reasoning for functions with local state. In HOOTS, 1998. Google ScholarDigital Library
- E. Sumii. A complete characterization of observational equivalence in polymorphic lambda-calculus with general references. In CSL, 2009. Google ScholarDigital Library
- N. Torp-Smith, L. Birkedal, and J. C. Reynolds. Local reasoning about a copying garbage collector. TOPLAS, 30(4), 2008. Google ScholarDigital Library
Index Terms
- A kripke logical relation between ML and assembly
Recommendations
A kripke logical relation between ML and assembly
POPL '11There has recently been great progress in proving the correctness of compilers for increasingly realistic languages with increasingly realistic runtime systems. Most work on this problem has focused on proving the correctness of a particular compiler, ...
Proving Correctness of a Compiler Using Step-indexed Logical Relations
In this paper we prove the correctness of a compiler for a call-by-name language using step-indexed logical relations and biorthogonality. The source language is an extension of the simply typed lambda-calculus with recursion, and the target language is ...
The impact of higher-order state and control effects on local relational reasoning
ICFP '10Reasoning about program equivalence is one of the oldest problems in semantics. In recent years, useful techniques have been developed, based on bisimulations and logical relations, for reasoning about equivalence in the setting of increasingly ...
Comments