skip to main content
10.1145/2364527.2364532acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Formal verification of monad transformers

Published:09 September 2012Publication History

ABSTRACT

We present techniques for reasoning about constructor classes that (like the monad class) fix polymorphic operations and assert polymorphic axioms. We do not require a logic with first-class type constructors, first-class polymorphism, or type quantification; instead, we rely on a domain-theoretic model of the type system in a universal domain to provide these features. These ideas are implemented in the Tycon library for the Isabelle theorem prover, which builds on the HOLCF library of domain theory. The Tycon library provides various axiomatic type constructor classes, including functors and monads. It also provides automation for instantiating those classes, and for defining further subclasses.

We use the Tycon library to formalize three Haskell monad transformers: the error transformer, the writer transformer, and the resumption transformer. The error and writer transformers do not universally preserve the monad laws; however, we establish datatype invariants for each, showing that they are valid monads when viewed as abstract datatypes.

References

  1. Roberto M. Amadio and Pierre-Louis Curien. Domains and Lambda-Calculi. Cambridge University Press, New York, NY, USA, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Brian Huffman. A purely definitional universal domain. In Stefan Berghofer, Tobias Nipkow, Christian Urban, and Makarius Wenzel, editors, Proceedings of the 22nd International Conference on Theorem Proving in Higher Order Logics (TPHOLs '09), volume 5674 of LNCS, pages 260--275. Springer, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Brian Huffman. HOLCF '11: A Definitional Domain Theory for Verifying Functional Programs. Ph.D. thesis, Portland State University, 2012.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Brian Huffman. Type constructor classes and monad transformers. Archive of Formal Proofs, June 2012. http://afp.sf.net/entries/Tycon.shtml, Formal proof development.Google ScholarGoogle Scholar
  5. Brian Huffman, John Matthews, and Peter White. Axiomatic constructor classes in Isabelle/HOLCF. In Joe Hurd and Tom Melham, editors, Proceedings of the 18th International Conference on Theorem Proving in Higher Order Logics (TPHOLs '05), volume 3603 of LNCS, pages 147--162. Springer, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Mark P. Jones. Functional programming with overloading and higher-order polymorphism. In First International Spring School on Advanced Functional Programming Techniques, volume 925 of LNCS, Båstad, Sweden, May 1995. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Olaf Müller, Tobias Nipkow, David von Oheimb, and Oskar Slotosch. HOLCF = HOLGoogle ScholarGoogle Scholar
  8. LCF. Journal of Functional Programming, 9:191--223, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Tobias Nipkow, Lawrence C. Paulson, and Markus Wenzel. Isabelle/HOL -- A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Matthieu Sozeau and Nicolas Oury. First-class type classes. In Otmane Ait Mohamed, César Munoz, and Sofiène Tahar, editors, Theorem Proving in Higher Order Logics, 21st International Conference (TPHOLs '08), volume 5170 of LNCS, pages 278--293. Springer, August 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Philip Wadler. Theorems for free! In Functional Programming Languages and Computer Architecture, pages 347--359. ACM Press, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Formal verification of monad transformers

    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
    • Published in

      cover image ACM Conferences
      ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
      September 2012
      392 pages
      ISBN:9781450310543
      DOI:10.1145/2364527
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 47, Issue 9
        ICFP '12
        September 2012
        368 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2398856
        Issue’s Table of Contents

      Copyright © 2012 Copyright is held by the owner/author(s)

      Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 9 September 2012

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      ICFP '12 Paper Acceptance Rate32of88submissions,36%Overall Acceptance Rate333of1,064submissions,31%

      Upcoming Conference

      ICFP '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader