skip to main content
research-article

HALO: haskell to logic through denotational semantics

Published:23 January 2013Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

r1d3_talk5.mp4

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. Jasmin Blanchette, Sascha Bohme, and Lawrence Paulson. Extending Sledgehammer with SMT solvers. In Conference on Automated Deduction (CADE), LNCS. Springer Verlag, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. Koen Claessen and Niklas Sörensson. New techniques that improve MACEstyle model finding. In Proc. of Workshop on Model Computation (MODEL), 2003.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. Ulf Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology, 2007.Google ScholarGoogle Scholar
  21. Andrew M. Pitts. Relational properties of domains. Inf. Comput., 127(2): 66--90, 1996.Google ScholarGoogle ScholarCross RefCross Ref
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. Jeremy G. Siek and Walid Taha. Gradual typing for functional languages. In IN SCHEME AND FUNCTIONAL PROGRAMMING WORKSHOP, pages 81--92, 2006.Google ScholarGoogle Scholar
  25. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. Glynn Winskel. The formal semantics of programming languages -- an introduction. Foundation of computing series. MIT Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  34. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. HALO: haskell to logic through denotational semantics

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 48, Issue 1
      POPL '13
      January 2013
      561 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2480359
      Issue’s Table of Contents
      • cover image ACM Conferences
        POPL '13: Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
        January 2013
        586 pages
        ISBN:9781450318327
        DOI:10.1145/2429069

      Copyright © 2013 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 23 January 2013

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!