10.1145/3167092acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article
Public Access

Total Haskell is reasonable Coq

Online:08 January 2018Publication History

ABSTRACT

We would like to use the Coq proof assistant to mechanically verify properties of Haskell programs. To that end, we present a tool, named <tt>hs-to-coq</tt>, that translates total Haskell programs into Coq programs via a shallow embedding. We apply our tool in three case studies – a lawful <tt>Monad</tt> instance, “Hutton’s razor”, and an existing data structure library – and prove their correctness. These examples show that this approach is viable: both that <tt>hs-to-coq</tt> applies to existing Haskell code, and that the output it produces is amenable to verification.

References

  1. Andreas Abel, Marcin Benke, Ana Bove, John Hughes, and Ulf Norell. 2005. Verifying Haskell Programs Using Constructive Type Theory. In Haskell Workshop. ACM, 62-73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Gilles Barthe, Julien Forest, David Pichardie, and Vlad Rusu. 2006. Defining and Reasoning About Recursive Functions: A Practical Tool for the Coq Proof Assistant. In FLOPS (LNCS), Vol. 3945. Springer, 114-129. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Joachim Breitner. 2017. successors: An applicative functor to manage successors. https://hackage.haskell.org/package/successors-0.1. (1 February 2017).Google ScholarGoogle Scholar
  4. Joachim Breitner, Brian Huffman, Neil Mitchell, and Christian Sternagel. 2013. Certified HLints with Isabelle/HOLCF-Prelude. In Haskell and Rewriting Techniques (HART). arXiv:1306.1340.Google ScholarGoogle Scholar
  5. Arthur Charguéraud. 2010. Program verification through characteristic formulae. In ICFP. ACM, 321-332. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Haogang Chen, Daniel Ziegler, Tej Chajed, Adam Chlipala, M. Frans Kaashoek, and Nickolai Zeldovich. 2015. Using Crash Hoare Logic for Certifying the FSCQ File System. In SOSP. ACM, 18-37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Haskell Core Libraries Comittee. 2017. base: Basic libraries. https://hackage.haskell.org/package/base-4.9.1.0. (14 January 2017).Google ScholarGoogle Scholar
  8. Nils Anders Danielsson, John Hughes, Patrik Jansson, and Jeremy Gibbons. 2006. Fast and loose reasoning is morally correct. In POPL. ACM, 206-217. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Leonardo Mendonça de Moura and Nikolaj Bjørner. 2008. Z3: An Efficient SMT Solver. In TACAS (LNCS), Vol. 4963. Springer, 337-340.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Philip Derrin, Kevin Elphinstone, Gerwin Klein, David Cock, and Manuel M. T. Chakravarty. 2006. Running the Manual: An Approach to High-assurance Microkernel Development. In Haskell Symposium. ACM, 60-71. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Peter Dybjer, Qiao Haiyan, and Makoto Takeyama. 2004. Verifying Haskell programs by combining testing, model checking and interactive theorem proving. Information & Software Technology 46, 15 (2004), 1011-1025.Google ScholarGoogle ScholarCross RefCross Ref
  12. Georges Gonthier, Assia Mahboubi, and Enrico Tassi. 2016. A Small Scale Reflection Extension for the Coq system. Research Report RR-6455. Inria Saclay Ile de France. https://hal.inria.fr/inria-00258384.Google ScholarGoogle Scholar
  13. Florian Haftmann. 2010. From higher-order logic to Haskell: there and back again. In '10. ACM, 155-158. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Thomas Hallgren, James Hook, Mark P. Jones, and Richard B. Kieburtz. 2004. An overview of the programatica toolset. In HCSS.Google ScholarGoogle Scholar
  15. Brian Huffman. 2012. HOLCF '11: A Definitional Domain Theory for Verifying Functional Programs. Ph.D. Dissertation. Portland State University. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Graham Hutton. 2016. Programming in Haskell (2nd ed.). Cambridge University Press. 241-246 pages.Google ScholarGoogle Scholar
  17. Adam Megacz Joseph. 2014. Generalized Arrows. (May 2014). http://www2.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-130.html also see http://www.megacz.com/berkeley/coq-in-ghc/.Google ScholarGoogle Scholar
  18. Pierre Letouzey. 2002. A New Extraction for Coq. In TYPES (LNCS), Vol. 2646. Springer, 200-219. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Cyprien Mangin and Matthieu Sozeau. 2017. Equations Reloaded. (2017). http://www.irif.fr/~sozeau/research/publications/drafts/Equations_Reloaded.pdf (submitted).Google ScholarGoogle Scholar
  20. Simon Marlow (Ed.). 2010. Haskell 2010 Language Report.Google ScholarGoogle Scholar
  21. Simon Marlow and Simon Peyton Jones. 2012. The Glasgow Haskell Compiler. In The Architecture of Open Source Applications, Volume 2. Lulu. http://www.aosabook.org/en/ghc.html.Google ScholarGoogle Scholar
  22. The Coq development team. 2016. The Coq proof assistant reference manual. LogiCal Project. http://coq.inria.fr Version 8.6.1.Google ScholarGoogle Scholar
  23. Olaf Müller, Tobias Nipkow, David von Oheimb, and Oskar Slotosch. 1999. HOLCF = HOL + LCF. Journal of Functional Programming 9 (1999), 191-223. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Chris Okasaki. 1999. Purely functional data structures. Cambridge University Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Will Partain. 1996. GHC commit 6c381e873e. http://git.haskell.org/ghc.git/commit/6c381e873e. (19 March 1996).Google ScholarGoogle Scholar
  26. Lawrence C. Paulson. 1987. Logic and Computation: Interactive Proof with Cambridge LCF. Cambridge University Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Matthew Pickering, Gergo Érdi, Simon Peyton Jones, and Richard A. Eisenberg. 2016. Pattern synonyms. In Haskell. ACM, 80-91. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Alexandre Riazanov and Andrei Voronkov. 1999. Vampire. In CADE-16 (LNCS), Vol. 1632. Springer, 292-296. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Matthieu Sozeau and Nicolas Oury. 2008. First-Class Type Classes. In TPHOLs (LNCS), Vol. 5170. Springer, 278-293. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Niki Vazou, Leonidas Lampropoulos, and Jeff Polakow. 2017. A Tale of Two Provers: Verifying Monoidal String Matching in Liquid Haskell and Coq. In Haskell Symposium. ACM, 63-74. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Niki Vazou, Eric L. Seidel, Ranjit Jhala, Dimitrios Vytiniotis, and Simon Peyton-Jones. 2014. Refinement Types for Haskell. In ICFP. ACM, 269-282. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Dimitrios Vytiniotis, Simon Peyton Jones, Koen Claessen, and Dan Rosén. 2013. HALO: Haskell to Logic Through Denotational Semantics. In POPL. ACM, 431-442. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Philip Wadler and Stephen Blott. 1989. How to Make ad-hoc Polymorphism Less ad-hoc. In POPL. ACM, 60-76. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. John Wiegley. 2017. coq-haskell: A library for formalizing Haskell types and functions in Coq. https://github.com/jwiegley/coq-haskell. (2017).Google ScholarGoogle Scholar

Index Terms

  1. Total Haskell is reasonable Coq

    Comments

    Login options

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

    Sign in
    • Published in

      ACM Conferences cover image
      CPP 2018: Proceedings of the 7th ACM SIGPLAN International Conference on Certified Programs and Proofs
      January 2018
      306 pages
      ISBN:9781450355865
      DOI:10.1145/3176245

      Copyright © 2018 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Online: 8 January 2018
      • Published: 8 January 2018

      Permissions

      Request permissions about this article.

      Request Permissions

      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!