Abstract
A benefit of pure functional programming is that it encourages equational reasoning. However, the Haskell language has lacked direct tool support for such reasoning. Consequently, reasoning about Haskell programs is either performed manually, or in another language that does provide tool support (e.g. Agda or Coq). HERMIT is a Haskell-specific toolkit designed to support equational reasoning and user-guided program transformation, and to do so as part of the GHC compilation pipeline. This paper describes HERMIT's recently developed support for equational reasoning, and presents two case studies of HERMIT usage: checking that type-class laws hold for specific instance declarations, and mechanising textbook equational reasoning.
- M. D. Adams, A. Farmer, and J. P. Magalh˜aes. Optimizing SYB is easy! In Workshop on Partial Evaluation and Program Manipulation, pages 71–82. ACM, 2014. Google Scholar
Digital Library
- R. Bird. Pearls of Functional Algorithm Design. Cambridge University Press, 2010. Google Scholar
Cross Ref
- T. Braibant and D. Pous. Tactics for reasoning modulo AC in Coq. In International Conference on Certified Programs and Proofs, volume 7086 of LNCS, pages 167–182. Springer, 2011. Google Scholar
Digital Library
- J. Breitner, R. A. Eisenberg, S. Peyton Jones, and S. Weirich. Safe zero-cost coercions for Haskell. In International Conference on Functional Programming, pages 189–202. ACM, 2014. Google Scholar
Digital Library
- R. M. Burstall and J. Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24(1):44–67, 1977. Google Scholar
Digital Library
- K. Claessen and J. Hughes. QuickCheck: A lightweight tool for random testing of Haskell programs. In International Conference on Functional Programming, pages 268–279. ACM, 2000. Google Scholar
Digital Library
- K. Claessen, M. Johansson, D. Rosén, and N. Smallbone. Automating inductive proofs using theory exploration. In International Conference on Automated Deduction, volume 7898 of LNCS, pages 392–406. Springer, 2013. Google Scholar
Digital Library
- N. A. Danielsson and P. Jansson. Chasing bottoms: A case study in program verification in the presence of partial and infinite values. In International Conference on Mathematics of Program Construction, volume 3125 of LNCS, pages 85–109. Springer, 2004.Google Scholar
- A. L. de M. Santos. Compilation by Transformation in Non-Strict Functional Languages. PhD thesis, University of Glasgow, 1995.Google Scholar
- N. Dershowitz, J. Hsiang, N. A. Josephson, and D. A. Plaisted. Associative-commutative rewriting. In International Joint Conference on Artificial Intelligence, volume 2, pages 940–944. Morgan Kaufmann, 1983. Google Scholar
Digital Library
- A. Farmer. HERMIT: Mechanized Reasoning during Compilation in the Glasgow Haskell Compiler. PhD thesis, University of Kansas, 2015.Google Scholar
- A. Farmer, A. Gill, E. Komp, and N. Sculthorpe. The HERMIT in the machine: A plugin for the interactive transformation of GHC core language programs. In Haskell Symposium, pages 1–12. ACM, 2012. Google Scholar
Digital Library
- A. Farmer, C. Höner zu Siederdissen, and A. Gill. The HERMIT in the stream: Fusing Stream Fusion’s concatMap. In Workshop on Partial Evaluation and Program Manipulation, pages 97–108. ACM, 2014. Google Scholar
Digital Library
- A. Farmer, A. Gill, E. Komp, and N. Sculthorpe. http://hackage. haskell.org/package/hermit, 2015.Google Scholar
- A. Farmer, N. Sculthorpe, and A. Gill. Hermit case studies: Proving Type-Class Laws & Making a Century, 2015. URL http://www. ittc.ku.edu/csdl/fpg/HERMIT/case-studies-2015/.Google Scholar
- GHC Team. GHC User’s Guide, Version 7.8.4, 2014. URL http: //downloads.haskell.org/~ghc/7.8.4/docs/html.Google Scholar
- J. Gibbons and G. Hutton. Proof methods for corecursive programs. Fundamenta Informaticae, 66(4):353–366, 2005. Google Scholar
Digital Library
- A. Gill. Introducing the Haskell equational reasoning assistant. In Haskell Workshop, pages 108–109. ACM, 2006. Google Scholar
Digital Library
- A. Gill and G. Hutton. The worker/wrapper transformation. Journal of Functional Programming, 19(2):227–251, 2009. Google Scholar
Digital Library
- J.-Y. Girard. Interprétation fonctionelle et élimination des coupures de l’arithmétique d’ordre supérieur. PhD thesis, Université Paris Diderot, 1972.Google Scholar
- W. Guttmann, H. Partsch, W. Schulte, and T. Vullinghs. Tool support for the interactive derivation of formally correct functional programs. Journal of Universal Computer Science, 9(2):173–188, 2003.Google Scholar
- J. Jeuring, P. Jansson, and C. Amaral. Testing type class laws. In Haskell Symposium, pages 49–60. ACM, 2012. Google Scholar
Digital Library
- H. Kirchner and P.-E. Moreau. Promoting rewriting to a programming language: A compiler for non-deterministic rewrite programs in associative-commutative theories. Journal of Functional Programming, 11(2):207–251, 2001. Google Scholar
Digital Library
- H. Li, S. Thompson, and C. Reinke. The Haskell refactorer, HaRe, and its API. In Workshop on Language Descriptions, Tools, and Applications, volume 141 of ENTCS, pages 29–34. Elsevier, 2005. Google Scholar
Digital Library
- E. Meijer, M. M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In Conference on Functional Programming Languages and Computer Architecture, volume 523 of LNCS, pages 124–144. Springer, 1991. Google Scholar
Digital Library
- S.-C. Mu, H.-S. Ko, and P. Jansson. Algebra of programming in Agda: Dependent types for relational program derivation. Journal of Functional Programming, 19(5):545–579, 2009. Google Scholar
Digital Library
- S. Peyton Jones, A. Tolmach, and T. Hoare. Playing by the rules: Rewriting as a practical optimisation technique in GHC. In Haskell Workshop, pages 203–233. ACM, 2001.Google Scholar
- J. S. Reich, M. Naylor, and C. Runciman. Advances in lazy smallcheck. In International Symposium on Implementation and Application of Functional Languages, volume 8241 of LNCS, pages 53–70. Springer, 2013.Google Scholar
- J. C. Reynolds. Towards a theory of type structure. In Colloque sur la Programmation, volume 19 of LNCS, pages 408–423. Springer, 1974. Google Scholar
Digital Library
- D. Rosén. Proving equational Haskell properties using automated theorem provers. Master’s thesis, University of Gothenburg, 2012.Google Scholar
- C. Runciman, M. Naylor, and F. Lindblad. Smallcheck and Lazy Smallcheck: Automatic exhaustive testing for small values. In Haskell Symposium, pages 37–48. ACM, 2008. Google Scholar
Digital Library
- N. Sculthorpe and G. Hutton. Work it, wrap it, fix it, fold it. Journal of Functional Programming, 24(1):113–127, 2014.Google Scholar
Cross Ref
- N. Sculthorpe, A. Farmer, and A. Gill. The HERMIT in the tree: Mechanizing program transformations in the GHC core language. In International Symposium on Implementation and Application of Functional Languages, volume 8241 of LNCS, pages 86–103. Springer, 2013.Google Scholar
- N. Sculthorpe, N. Frisby, and A. Gill. The Kansas University Rewrite Engine: A Haskell-embedded strategic programming language with custom closed universes. Journal of Functional Programming, 24(4): 434–473, 2014.Google Scholar
Cross Ref
- T. Sheard and S. Peyton Jones. Template metaprogramming for Haskell. In Haskell Workshop, pages 1–16. ACM, 2002. Google Scholar
Digital Library
- W. Sonnex, S. Drossopoulou, and S. Eisenbach. Zeno: An automated prover for properties of recursive data structures. In International Conference on Tools and Algorithms for the Construction and Analysis of Systems, volume 7214 of LNCS, pages 407–421. Springer, 2012. Google Scholar
Digital Library
- M. Sulzmann, M. M. T. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In Workshop on Types in Language Design and Implementation, pages 53–66. ACM, 2007. Google Scholar
Digital Library
- J. Tesson, H. Hashimoto, Z. Hu, F. Loulergue, and M. Takeichi. Program calculation in Coq. In Algebraic Methodology and Software Technology, volume 6486 of LNCS, pages 163–179. Springer, 2011. Google Scholar
Digital Library
- S. Thompson and H. Li. Refactoring tools for functional languages. Journal of Functional Programming, 23(3):293–350, 2013.Google Scholar
Cross Ref
- M. Tullsen. PATH, A Program Transformation System for Haskell. PhD thesis, Yale University, 2002. Google Scholar
Digital Library
- N. Vazou, E. L. Seidel, and R. Jhala. LiquidHaskell: Experience with refinement types in the real world. In Haskell Symposium, pages 39– 51. ACM, 2014. Google Scholar
Digital Library
- N. Vazou, E. L. Seidel, R. Jhala, D. Vytiniotis, and S. Peyton Jones. Refinement types for Haskell. In International Conference on Functional Programming, pages 269–282. ACM, 2014. Google Scholar
Digital Library
- D. Vytiniotis and S. Peyton Jones. Evidence normalization in System FC. In International Conference on Rewriting Techniques and Applications, pages 20–38. Schloss Dagstuhl, 2013.Google Scholar
- D. Vytiniotis, S. Peyton Jones, K. Claessen, and D. Rosén. HALO: Haskell to logic through denotational semantics. In Symposium on Principles of Programming Languages, pages 431–442. ACM, 2013. Google Scholar
Digital Library
- P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In Symposium on Principles of Programming Languages, pages 60–76. ACM, 1989. Google Scholar
Digital Library
Index Terms
Reasoning with the HERMIT: tool support for equational reasoning on GHC core programs
Recommendations
Reasoning with the HERMIT: tool support for equational reasoning on GHC core programs
Haskell '15: Proceedings of the 2015 ACM SIGPLAN Symposium on HaskellA benefit of pure functional programming is that it encourages equational reasoning. However, the Haskell language has lacked direct tool support for such reasoning. Consequently, reasoning about Haskell programs is either performed manually, or in ...
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 ...
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