skip to main content
article

A tale of two provers: verifying monoidal string matching in liquid Haskell and Coq

Published:07 September 2017Publication History
Skip Abstract Section

Abstract

We demonstrate for the first time that Liquid Haskell, a refinement type checker for Haskell programs, can be used for arbitrary theorem proving by verifying a parallel, monoidal string matching algorithm implemented in Haskell. We use refinement types to specify correctness properties, Haskell terms to express proofs of these properties, and Liquid Haskell to check the proofs. We evaluate Liquid Haskell as a theorem prover by replicating our 1428 LoC proof in a dependently-typed language (Coq - 1136 LoC). Finally, we compare both proofs, uncovering the relative advantages and disadvantages of the two provers.

References

  1. C. Barrett, A. Stump, and C. Tinelli. The SMT-LIB Standard: Version 2.0. 2010.Google ScholarGoogle Scholar
  2. Y. Bertot and P. Castéran. Coq’Art: The Calculus of Inductive Constructions. Springer Verlag, 2004.Google ScholarGoogle Scholar
  3. C. Casinghino, V. Sjöberg, and S. Weirich. Combining proofs and programs in a dependently typed language. In POPL, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. Chlipala. Certified Programming with Dependent Types: A Pragmatic Introduction to the Coq Proof Assistant. The MIT Press, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. T. Coq development team. The Coq proof assistant reference manual, 2009. URL http://coq.inria.fr/doc/ .Google ScholarGoogle Scholar
  6. L. de Moura and N. Bjorner. Efficient E-matching for Smt Solvers. In CADE, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. A. Eisenberg. Dependent Types in Haskell: Theory and Practise. PhD thesis, UPenn, 2016.Google ScholarGoogle Scholar
  8. J. Filliâtre and A. Paskevich. Why3 – Where Programs Meet Provers. In ESOP, 2013.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. C. Flanagan. Hybrid type checking. In POPL, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Fortin and F. Gava. BSP-Why: A tool for deductive verification of BSP algorithms with subgroup synchronisation. In Int J Parallel Prog, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. T. Freeman and F. Pfenning. Refinement types for ML. In PLDI, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. G. Gonthier and A. Mahboubi. A small scale reflection extension for the Coq system. Technical report, Microsoft Research INRIA, 2009.Google ScholarGoogle Scholar
  13. K. R. M. Leino. Dafny: An automatic program verifier for functional correctness. LPAR, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. K. R. M. Leino and C. Pit-Claudel. Trigger selection strategies to stabilize program verifiers. In CAV, 2016.Google ScholarGoogle Scholar
  15. X. Leroy. Formal certification of a compiler back-end, or: programming a compiler with a proof assistant. In POPL, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. Lindley and C. McBride. Hasochism: the pleasure and pain of dependently typed haskell programming. In Haskell, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. F. Loulergue, W. Bousdira, and J. Tesson. Calculating Parallel Programs in Coq using List Homomorphisms. In Int J of Parallel Prog, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Moskal, J. Lopuszański, and J. R. Kiniry. E-matching for Fun and Profit. In Electron. Notes Theor. Comput. Sci., 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers, 2007.Google ScholarGoogle Scholar
  20. L. C. Paulson. Isabelle - A Generic Theorem prover. Lecture Notes in Computer Science, 1994.Google ScholarGoogle Scholar
  21. W. Pugh. The omega test: A fast and practical integer programming algorithm for dependence analysis. In Supercomputing, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. N. Swamy, C. Hriţcu, C. Keller, A. Rastogi, A. Delignat-Lavaud, S. Forest, K. Bhargavan, C. Fournet, P. Strub, M. Kohlweiss, J. Zinzindohoue, and S. ZanellaBéguelin. Dependent types and multi-monadic effects in F*. In POPL, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. W. Swierstra. More dependent types for distributed arrays. Higher-Order and Symbolic Computation, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. N. Vazou. Liquid Haskell: Haskell as a theorem prover. PhD thesis, UCSD, 2016.Google ScholarGoogle Scholar
  25. N. Vazou and R. Jhala. Refinement Reflection. arXiv:1610.04641, 2016.Google ScholarGoogle Scholar
  26. N. Vazou, E. L. Seidel, and R. Jhala. Liquidhaskell: Experience with refinement types in the real world. In Haskell Symposium, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. N. Vazou, E. L. Seidel, R. Jhala, D. Vytiniotis, and S. Peyton-Jones. Refinement Types for Haskell. In ICFP, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. N. Vazou, L. Lampropoulos, and J. Polakow. Implementation. 2017. https: //github.com/nikivazou/verified_string_matching .Google ScholarGoogle Scholar

Index Terms

  1. A tale of two provers: verifying monoidal string matching in liquid Haskell and Coq

    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

    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!