Skip to main content

Validated Compilation through Logic

  • Conference paper
FM 2011: Formal Methods (FM 2011)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6664))

Included in the following conference series:

Abstract

To reason about programs written in a language, one needs to define its formal semantics, derive a reasoning mechanism (e.g. a program logic), and maximize the proof automation. Unfortunately, a compiler may involve multiple languages and phases; it is tedious and error prone to do so for each language and each phase.

We present an approach based on the use of higher order logic to ease this burden. All the Intermediate Representations (IRs) are special forms of the logic of a prover such that IR programs can be reasoned about directly in the logic. We use this technique to construct and validate an optimizing compiler. New techniques are used to compile-with-proof all the programs into the logic, e.g. a logic specification is derived automatically from the monad interpretation of a piece of assembly code.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Benton, N., Hur, C.-K.: Biorthogonality, step-indexing and compiler correctness. In: ACM International Conference on Functional programming, ICFP (2009)

    Google Scholar 

  2. Blazy, S., Dargaye, Z., Leroy, X.: Formal verification of a C compiler front-end. In: Misra, J., Nipkow, T., Karakostas, G. (eds.) FM 2006. LNCS, vol. 4085, pp. 460–475. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  3. Charguéraud, A.: Program verification through characteristic formulae. In: ACM International Conference on Functional Programming, ICFP (2010)

    Google Scholar 

  4. Chlipala, A.: A certified type-preserving compiler from lambda calculus to assembly language. In: Programming Language Design and Implementation, PLDI (2007)

    Google Scholar 

  5. Chlipala, A.: A verified compiler for an impure functional language. In: ACM Symposium on the Principles of Programming Languages, POPL (2010)

    Google Scholar 

  6. Hannan, J., Pfenning, F.: Compiler verification in LF. In: 7th Symposium on Logic in Computer Science, LICS (1992)

    Google Scholar 

  7. Hickey, J., Nogin, A.: Formal compiler construction in a logical framework. Journal of Higher-Order and Symbolic Computation 19(2-3), 197–230 (2006)

    Article  MATH  Google Scholar 

  8. The HOL-4 Theorem Prover, http://hol.sourceforge.net/

  9. Leroy, X.: Formal certification of a compiler backend, or: programming a compiler with a proof assistant. In: ACM Symposium on the Principles of Programming Languages, POPL (2006)

    Google Scholar 

  10. Li, G., Owens, S., Slind, K.: Structure of a proof-producing compiler for a subset of higher order logic. In: 16th European Symposium on Programming, ESOP (2007)

    Google Scholar 

  11. Li, G., Slind, K.: Compilation as rewriting in higher order logic. In: 21th Conference on Automated Deduction, CADE-21 (2007)

    Google Scholar 

  12. Li, G., Slind, K.: Trusted source translation of a total function language. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 471–485. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  13. Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML, Revised Edition. MIT Press, Cambridge (1997)

    Google Scholar 

  14. Myreen, M.O.: Verified just-in-time compiler on x86. In: ACM Symposium on the Principles of Programming Languages, POPL (2010)

    Google Scholar 

  15. Myreen, M.O., Gordon, M.J.C.: Hoare logic for realistically modelled machine code. In: Grumberg, O., Huth, M. (eds.) TACAS 2007. LNCS, vol. 4424, pp. 568–582. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  16. Myreen, M.O., Gordon, M.J.C., Slind, K.: Machine-code verification for multiple architectures: An application of decompilation into logic. In: Formal Methods in Computer Aided Design, FMCAD (2008)

    Google Scholar 

  17. Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL— A Proof Assistant for Higher-Order Logic. LNCS, vol. 2283. Springer, Heidelberg (2002)

    MATH  Google Scholar 

  18. Reynolds, J.C.: Separation logic: A logic for shared mutable data structures. In: IEEE Symposium on Logic in Computer Science, LICS (2002)

    Google Scholar 

  19. Saabas, A., Uustalu, T.: A compositional natural semantics and hoare logic for low-level languages. Theoretical Computer Science 373(3), 273–302 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  20. Slind, K.: Reasoning about Terminating Functional Programs. PhD thesis, Institut für Informatik, Technische Universität München (1999)

    Google Scholar 

  21. Tolmach, A., Oliva, D.P.: From ML to Ada: Strongly-typed language interoperability via source translation. Journal of Functional Programming 8(4), 367–412 (1998)

    Article  MATH  Google Scholar 

  22. Tristan, J.-B., Leroy, X.: Formal verification of translation validators: A case study on instruction scheduling optimizations. In: ACM Symposium on the Principles of Programming Languages, POPL (2008)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Li, G. (2011). Validated Compilation through Logic. In: Butler, M., Schulte, W. (eds) FM 2011: Formal Methods. FM 2011. Lecture Notes in Computer Science, vol 6664. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-21437-0_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-21437-0_15

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-21436-3

  • Online ISBN: 978-3-642-21437-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics