Abstract
We prove that the Call Arity analysis and transformation, as implemented in the Haskell compiler GHC, is safe, i.e. does not impede the performance of the program. We formalized syntax, semantics, the analysis and the transformation in the interactive theorem prover Isabelle to obtain a machine-checked proof and hence a level of rigor rarely obtained for compiler optimization safety theorems. The proof is modular and introduces trace trees as a suitable abstraction in abstract cardinality analyses. We discuss the breadth of the formalization gap.
- D. Aspinall, L. Beringer, and A. Momigliano. Optimisation validation. In COCV’06, volume 176(3) of ENTCS, pages 37 – 59, 2007. Google Scholar
Digital Library
- C. Ballarin. Locales: A module system for mathematical theories. Journal of Automated Reasoning, 52(2):123–153, 2014. Google Scholar
Digital Library
- 2 see GHC commit 306d255Google Scholar
- J. Breitner. The correctness of Launchbury’s natural semantics for lazy evaluation. Archive of Formal Proofs, Jan. 2013. http://afp.sf.net/ entries/Launchbury.shtml.Google Scholar
- J. Breitner. The Safety of Call Arity. Archive of Formal Proofs, Feb. 2015. http://afp.sf.net/entries/Call Arity.shtml.Google Scholar
- J. Breitner. Call Arity. In TFP’14, volume 8843 of LNCS, pages 34–50. Springer, 2015.Google Scholar
- A. Chlipala. A verified compiler for an impure functional language. In POPL’10, pages 93–106. ACM, 2010. Google Scholar
Digital Library
- Z. Dargaye and X. Leroy. Mechanized Verification of CPS Transformations. In LPAR’07, volume 4790 of LNCS, pages 211–225. Springer, 2007. Google Scholar
Digital Library
- R. Eisenberg. System FC, as implemented in GHC, 2013. URL https://github.com/ghc/ghc/blob/master/docs/core-spec/ core-spec.pdf.Google Scholar
- P. Gammie. The worker/wrapper transformation. Archive of Formal Proofs, Oct. 2009. http://afp.sf.net/entries/WorkerWrapper.shtml.Google Scholar
- A. J. Gill. Cheap deforestation for non-strict functional languages. PhD thesis, University of Glasgow, 1996.Google Scholar
- J. Gustavsson and D. Sands. A foundation for space-safe transformations of call-by-need programs. In HOOTS’99, volume 26 of ENTCS, pages 69–86, 1999.Google Scholar
Cross Ref
- J. Gustavsson and D. Sands. Possibilities and limitations of call-byneed space improvement. In ICFP’01, pages 265–276. ACM, 2001. Google Scholar
Digital Library
- J. Hackett and G. Hutton. Worker/Wrapper/Makes It/Faster. In ICFP’14, pages 95–107. ACM, 2014. Google Scholar
Digital Library
- B. Huffman. HOLCF ’11: A Definitional Domain Theory for Verifying Functional Programs. PhD thesis, Portland State University, 2012. Google Scholar
Digital Library
- R. Kumar, M. O. Myreen, M. Norrish, and S. Owens. Cakeml: A verified implementation of ml. In POPL’14, pages 179–191. ACM, 2014. Google Scholar
Digital Library
- J. Launchbury. A natural semantics for lazy evaluation. In POPL, 1993. Google Scholar
Digital Library
- X. Leroy. Mechanized semantics for compiler verification. In APLAS’12, volume 7705 of LNCS, pages 386–388. Springer, 2012.Google Scholar
- Invited talk.Google Scholar
- A. Lochbihler. Verifying a compiler for java threads. In ESOP’10, volume 6012 of LNCS, pages 427–447. Springer, Mar. 2010. Google Scholar
Digital Library
- S. Marlow and S. L. Peyton Jones. Making a fast curry: push/enter vs. eval/apply for higher-order languages. Journal of Functional Programming, 16(4-5):415–449, 2006. Google Scholar
Digital Library
- Y. Minamide and K. Okuma. Verifying CPS Transformations in Isabelle/HOL. In MERLIN’03, pages 1–8. ACM, 2003. Google Scholar
Digital Library
- A. K. Moran and D. Sands. Improvement in a Lazy Context: An Operational Theory for Call-By-Need. In POPL’99, pages 43–56. ACM, 1999. Google Scholar
Digital Library
- T. Nipkow, L. C. Paulson, and M. Wenzel. Isabelle/HOL — A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, 2002. Google Scholar
Digital Library
- D. Sands. Operational theories of improvement in functional languages (extended abstract). In Glasgow Workshop on Functional Programming, Workshops in Computing Series, pages 298–311. Springer, August 1991. Google Scholar
Digital Library
- I. Sergey, D. Vytiniotis, and S. Peyton Jones. Modular, Higher-order Cardinality Analysis in Theory and Practice. POPL, 2014. Google Scholar
Digital Library
- P. Sestoft. Deriving a lazy abstract machine. Journal of Functional Programming, 7:231–264, 1997. Google Scholar
Digital Library
- Y. H. Tian. Mechanically Verifying Correctness of CPS Compilation. In CATS’06, volume 51 of CRPIT, pages 41–51. ACS, 2006. Google Scholar
Digital Library
- C. Urban and C. Kaliszyk. General Bindings and Alpha-Equivalence in Nominal Isabelle. Logical Methods in Computer Science, 8(2), 2012..Google Scholar
- D. N. Xu and S. Peyton Jones. Arity analysis, 2005. Working Notes. Introduction Overview and Example From the Example… …to the General Case Syntax and Semantics Semantics Arities and Eta-Expansion Arity Analyses Cardinality Analyses Abstract Cardinality Analysis Trace Tree Cardinality Analysis Co-Call Cardinality Analysis Call Arity, Concretely The Formalization in Isabelle The Formalization Effort The Formalization Gap Related Work ConclusionGoogle Scholar
Index Terms
Formally proving a compiler transformation safe
Recommendations
Formally proving a compiler transformation safe
Haskell '15: Proceedings of the 2015 ACM SIGPLAN Symposium on HaskellWe prove that the Call Arity analysis and transformation, as implemented in the Haskell compiler GHC, is safe, i.e. does not impede the performance of the program. We formalized syntax, semantics, the analysis and the transformation in the interactive ...
On Automatic Theorem Proving with ML
MICAI '14: Proceedings of the 2014 13th Mexican International Conference on Artificial IntelligenceIn this paper, we describe the development of a series of automatic theorem provers for a variety of logics. Provers are developed from a functional approach. The first prover is for Classical Propositional Calculus (CPC), which is based on a ...
Reasoning about Object-based Calculi in (Co)Inductive Type Theory and the Theory of Contexts
AbstractWe illustrate a methodology for formalizing and reasoning about Abadi and Cardelli’s object-based calculi, in (co)inductive type theory, such as the Calculus of (Co)Inductive Constructions, by taking advantage of natural deduction semantics and ...






Comments