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.
- C. Barrett, A. Stump, and C. Tinelli. The SMT-LIB Standard: Version 2.0. 2010.Google Scholar
- Y. Bertot and P. Castéran. Coq’Art: The Calculus of Inductive Constructions. Springer Verlag, 2004.Google Scholar
- C. Casinghino, V. Sjöberg, and S. Weirich. Combining proofs and programs in a dependently typed language. In POPL, 2014. Google Scholar
Digital Library
- A. Chlipala. Certified Programming with Dependent Types: A Pragmatic Introduction to the Coq Proof Assistant. The MIT Press, 2013. Google Scholar
Digital Library
- T. Coq development team. The Coq proof assistant reference manual, 2009. URL http://coq.inria.fr/doc/ .Google Scholar
- L. de Moura and N. Bjorner. Efficient E-matching for Smt Solvers. In CADE, 2007. Google Scholar
Digital Library
- R. A. Eisenberg. Dependent Types in Haskell: Theory and Practise. PhD thesis, UPenn, 2016.Google Scholar
- J. Filliâtre and A. Paskevich. Why3 – Where Programs Meet Provers. In ESOP, 2013.Google Scholar
Digital Library
- C. Flanagan. Hybrid type checking. In POPL, 2006. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- T. Freeman and F. Pfenning. Refinement types for ML. In PLDI, 1991. Google Scholar
Digital Library
- G. Gonthier and A. Mahboubi. A small scale reflection extension for the Coq system. Technical report, Microsoft Research INRIA, 2009.Google Scholar
- K. R. M. Leino. Dafny: An automatic program verifier for functional correctness. LPAR, 2010. Google Scholar
Digital Library
- K. R. M. Leino and C. Pit-Claudel. Trigger selection strategies to stabilize program verifiers. In CAV, 2016.Google Scholar
- X. Leroy. Formal certification of a compiler back-end, or: programming a compiler with a proof assistant. In POPL, 2006. Google Scholar
Digital Library
- S. Lindley and C. McBride. Hasochism: the pleasure and pain of dependently typed haskell programming. In Haskell, 2013. Google Scholar
Digital Library
- F. Loulergue, W. Bousdira, and J. Tesson. Calculating Parallel Programs in Coq using List Homomorphisms. In Int J of Parallel Prog, 2016. Google Scholar
Digital Library
- M. Moskal, J. Lopuszański, and J. R. Kiniry. E-matching for Fun and Profit. In Electron. Notes Theor. Comput. Sci., 2008. Google Scholar
Digital Library
- U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers, 2007.Google Scholar
- L. C. Paulson. Isabelle - A Generic Theorem prover. Lecture Notes in Computer Science, 1994.Google Scholar
- W. Pugh. The omega test: A fast and practical integer programming algorithm for dependence analysis. In Supercomputing, 1991. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- W. Swierstra. More dependent types for distributed arrays. Higher-Order and Symbolic Computation, 2010. Google Scholar
Digital Library
- N. Vazou. Liquid Haskell: Haskell as a theorem prover. PhD thesis, UCSD, 2016.Google Scholar
- N. Vazou and R. Jhala. Refinement Reflection. arXiv:1610.04641, 2016.Google Scholar
- N. Vazou, E. L. Seidel, and R. Jhala. Liquidhaskell: Experience with refinement types in the real world. In Haskell Symposium, 2014. Google Scholar
Digital Library
- N. Vazou, E. L. Seidel, R. Jhala, D. Vytiniotis, and S. Peyton-Jones. Refinement Types for Haskell. In ICFP, 2014. Google Scholar
Digital Library
- N. Vazou, L. Lampropoulos, and J. Polakow. Implementation. 2017. https: //github.com/nikivazou/verified_string_matching .Google Scholar
Index Terms
A tale of two provers: verifying monoidal string matching in liquid Haskell and Coq
Recommendations
Theorem proving for all: equational reasoning in liquid Haskell (functional pearl)
Haskell 2018: Proceedings of the 11th ACM SIGPLAN International Symposium on HaskellEquational reasoning is one of the key features of pure functional languages such as Haskell. To date, however, such reasoning always took place externally to Haskell, either manually on paper, or mechanised in a theorem prover. This article shows how ...
A tale of two provers: verifying monoidal string matching in liquid Haskell and Coq
Haskell 2017: Proceedings of the 10th ACM SIGPLAN International Symposium on HaskellWe 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 ...
Theorem proving for all: equational reasoning in liquid Haskell (functional pearl)
Haskell '18Equational reasoning is one of the key features of pure functional languages such as Haskell. To date, however, such reasoning always took place externally to Haskell, either manually on paper, or mechanised in a theorem prover. This article shows how ...







Comments