Abstract
Even well-typed programs can go wrong in modern functional languages, by encountering a pattern-match failure, or simply returning the wrong answer. An increasingly-popular response is to allow programmers to write contracts that express semantic properties, such as crash-freedom or some useful post-condition. We study the static verification of such contracts. Our main contribution is a novel translation to first-order logic of both Haskell programs, and contracts written in Haskell, all justified by denotational semantics. This translation enables us to prove that functions satisfy their contracts using an off-the-shelf first-order logic theorem prover.
Supplemental Material
- Andreas Abel, Thierry Coquand, and Ulf Norell. Connecting a logical framework to a first-order logic prover. In 5th International Workshop on Frontiers of Combining Systems (FroCoS), LNCS. Springer Verlag, 2005. Google Scholar
Digital Library
- Michael Barnett, Bor-Yuh Evan Chang, Robert DeLine, Bart Jacobs, and K. Rustan M. Leino. Boogie: A modular reusable verifier for objectoriented programs. In Formal methods for Components and Objects, pages 364--387, 2005. Google Scholar
Digital Library
- Nick Benton, Andrew Kennedy, and Carsten Varming. Some domain theory and denotational semantics in coq. In Proceedings of the 22nd International Conference on Theorem Proving in Higher Order Logics, TPHOLs'09, pages 115--130, Berlin, Heidelberg, 2009. Springer-Verlag. Google Scholar
Digital Library
- Gavin M. Bierman, Andrew D. Gordon, Catalin Hritcu, and David Langworthy. Semantic subtyping with an SMT solver. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional programming, ICFP'10, pages 105--116, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- Jasmin Blanchette, Sascha Bohme, and Lawrence Paulson. Extending Sledgehammer with SMT solvers. In Conference on Automated Deduction (CADE), LNCS. Springer Verlag, 2011. Google Scholar
Digital Library
- Matthias Blume and David McAllester. Sound and complete models of contracts. J. Funct. Program., 16(4-5):375--414, July 2006. ISSN 0956-7968. Google Scholar
Digital Library
- Ana Bove, Peter Dybjer, and Andrés Sicard-Ram1rez. Combining interactive and automatic reasoning in first order theories of functional programs. In Lars Birkedal, editor, 15th International Conference on Foundations of Software Science and Computational Structures, FoSSaCS 2012, volume 7213 of LNCS, pages 104--118, March 2012. Google Scholar
Digital Library
- Arthur Charguéraud. Characteristic formulae for the verification of imperative programs. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming, ICFP'11, pages 418--430, New York, NY, USA, 2011. ACM. Google Scholar
Digital Library
- Koen Claessen and Niklas Sörensson. New techniques that improve MACEstyle model finding. In Proc. of Workshop on Model Computation (MODEL), 2003.Google Scholar
- Leonardo De Moura and Nikolaj Bjørner. Z3: an efficient SMT solver. In Proceedings of the Theory and Practice of Software, 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS'08/ETAPS'08, pages 337--340, Berlin, Heidelberg, 2008. Springer-Verlag. Google Scholar
Digital Library
- Robert Bruce Findler and Matthias Felleisen. Contracts for higher-order functions. In Proceedings of the seventh ACM SIGPLAN International Conference on Functional programming, ICFP'02, pages 48--59, New York, NY, USA, 2002. ACM. Google Scholar
Digital Library
- Ralf Hinze, Johan Jeuring, and Andres Löh. Typed contracts for functional programming. In Proceedings of the 8th International Conference on Functional and Logic Programming, FLOPS'06, pages 208--225, Berlin, Heidelberg, 2006. Springer-Verlag. Google Scholar
Digital Library
- Krystof Hoder, Laura Kovacs, and Andrei Voronkov. Interpolation and symbol elimination in Vampire. In Proceedings of the 5th International Conference on Automated Reasoning, IJCAR'10, pages 188--195, Berlin, Heidelberg, 2010. Springer-Verlag. Google Scholar
Digital Library
- Brian Huffman. Formal verification of monad transformers. In Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, ICFP'12, pages 15--16, New York, NY, USA, 2012. ACM. Google Scholar
Digital Library
- Kenneth Knowles and Cormac Flanagan. Hybrid type checking. ACM Trans. Program. Lang. Syst., 32(2):6:1--6:34, February 2010. ISSN 0164-0925. Google Scholar
Digital Library
- Naoki Kobayashi. Types and higher-order recursion schemes for verification of higher-order programs. In Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL'09, pages 416--428, New York, NY, USA, 2009a. ACM. Google Scholar
Digital Library
- Naoki Kobayashi. Model-checking higher-order functions. In Proceedings of the 11th ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, PPDP'09, pages 25--36, New York, NY, USA, 2009b. ACM. Google Scholar
Digital Library
- K. Rustan M. Leino. Automating induction with an SMT solver. In Proceedings of the 13th International Conference on Verification, Model Checking, and Abstract Interpretation, VMCAI'12, pages 315--331, Berlin, Heidelberg, 2012. Springer-Verlag. Google Scholar
Digital Library
- Neil Mitchell and Colin Runciman. Not all patterns, but enough: an automatic verifier for partial but sufficient pattern matching. In Proceedings of the 1st ACM SIGPLAN Symposium on Haskell, Haskell'08, pages 49--60, New York, NY, USA, 2008. ACM. Google Scholar
Digital Library
- Ulf Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology, 2007.Google Scholar
- Andrew M. Pitts. Relational properties of domains. Inf. Comput., 127(2): 66--90, 1996.Google Scholar
Cross Ref
- Patrick M. Rondon, Ming Kawaguci, and Ranjit Jhala. Liquid types. In Proceedings of the 2008 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI'08, pages 159--169, New York, NY, USA, 2008. ACM. Google Scholar
Digital Library
- Yann Rgis-Gianas and Franois Pottier. A Hoare logic for call-by-value functional programs. In Proceedings of the Ninth International Conference on Mathematics of Program Construction (MPC'08), pages 305--335, July 2008. Google Scholar
Digital Library
- Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In IN SCHEME AND FUNCTIONAL PROGRAMMING WORKSHOP, pages 81--92, 2006.Google Scholar
- William Sonnex, Sophia Drossopoulou, and Susan Eisenbach. Zeno: an automated prover for properties of recursive data structures. In Proceedings of the 18th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS'12, pages 407--421, Berlin, Heidelberg, 2012. Springer-Verlag. Google Scholar
Digital Library
- Martin Sulzmann, Manuel M. T. Chakravarty, Simon Peyton Jones, and Kevin Donnelly. System F with type equality coercions. In Proceedings of the 2007 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation, TLDI'07, pages 53--66, New York, NY, USA, 2007. ACM. Google Scholar
Digital Library
- G. Sutcliffe. The TPTP Problem Library and Associated Infrastructure: The FOF and CNF Parts, v3.5.0. Journal of Automated Reasoning, 43 (4):337--362, 2009. Google Scholar
Digital Library
- Philippe Suter, Ali Sinan Koksal, and Viktor Kuncak. Satisfiability modulo recursive programs. In Proceedings of the 18th International Conference on Static analysis, SAS'11, pages 298--315, Berlin, Heidelberg, 2011. Springer-Verlag. Google Scholar
Digital Library
- Nikhil Swamy, Juan Chen, Cedric Fournet, Pierre-Yves Strub, Karthikeyan Bhargavan, and Jean Yang. Secure distributed programming with valuedependent types. In International Conference on Functional Programming, pages 266--278, 2011. Google Scholar
Digital Library
- Sam Tobin-Hochstadt and David Van Horn. Higher-order symbolic execution via contracts. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA'12, 2012. Google Scholar
Digital Library
- Philip Wadler and Robert Bruce Findler. Well-typed programs can't be blamed. In Proceedings of the 18th European Symposium on Programming Languages and Systems, ESOP'09, pages 1--16, Berlin, Heidelberg, 2009. Springer-Verlag. Google Scholar
Digital Library
- Glynn Winskel. The formal semantics of programming languages -- an introduction. Foundation of computing series. MIT Press, 1993. Google Scholar
Digital Library
- Hongwei Xi. Dependent ML: an approach to practical programming with dependent types. J. Funct. Program., 17(2):215--286, March 2007. ISSN 0956-7968. Google Scholar
Digital Library
- Dana N. Xu. Hybrid contract checking via symbolic simplification. In Proceedings of the ACM SIGPLAN 2012 Workshop on Partial Evaluation and Program Manipulation, PEPM'12, pages 107--116, New York, NY, USA, 2012. ACM. Google Scholar
Digital Library
- Dana N. Xu, Simon Peyton Jones, and Koen Claessen. Static contract checking for Haskell. In Proceedings of the 36th annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL'09, pages 41--52, New York, NY, USA, 2009. ACM. Google Scholar
Digital Library
Index Terms
HALO: haskell to logic through denotational semantics
Recommendations
HALO: haskell to logic through denotational semantics
POPL '13: Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesEven well-typed programs can go wrong in modern functional languages, by encountering a pattern-match failure, or simply returning the wrong answer. An increasingly-popular response is to allow programmers to write contracts that express semantic ...
Formalization of the Resolution Calculus for First-Order Logic
I present a formalization in Isabelle/HOL of the resolution calculus for first-order logic with formal soundness and completeness proofs. To prove the calculus sound, I use the substitution lemma, and to prove it complete, I use Herbrand interpretations ...
Soundness and Completeness Proofs by Coinductive Methods
We show how codatatypes can be employed to produce compact, high-level proofs of key results in logic: the soundness and completeness of proof systems for variations of first-order logic. For the classical completeness result, we first establish an ...







Comments