Abstract

Equational 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 equational reasoning can be performed directly and seamlessly within Haskell itself, and be checked using Liquid Haskell. In particular, language learners --- to whom external theorem provers are out of reach --- can benefit from having their proofs mechanically checked. Concretely, we show how the equational proofs and derivations from Graham's textbook can be recast as proofs in Haskell (spoiler: they look essentially the same).

Highlights

  • IntroductionWe mechanize equational reasoning in Haskell using an expressive type system

  • Advocates for pure functional languages such as Haskell have long argued that a key benefit of these languages is the ability to reason equationally, using basic mathematics to reason about, verify, and derive programs

  • To demonstrate the applicability of our approach, we present a series of examples1 that replay equational reasoning, program optimizations, and program calculations from the literature

Read more

Summary

Introduction

We mechanize equational reasoning in Haskell using an expressive type system. Doing so remains faithful to the traditional techniques for verifying and deriving programs, while enjoying the added benefit of being mechanically checked for correctness This approach is well-suited to beginners because the language of proofs is Haskell itself. Even though these proofs can be performed in external tools such as Agda, Coq, Dafny, Isabelle or Lean, equational reasoning using Liquid Haskell is unique in that the proofs are literally just Haskell functions. It can be used by any Haskell programmer or learner

Reasoning about Programs
Lightweight Reasoning
Deep Reasoning
Induction on Lists
Proof Automation
Totality and Termination
Totality Checking
Termination Checking
Uncaught Termination
Example
Case Study
Related Work
Operator-Based Equational Reasoning
Verification in Haskell
Conclusion

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.