Academia.eduAcademia.edu

Outline

Bind Induction : Extracting Monadic Programs from Proofs

2013

Abstract

Container types can be modeled as instances of the Haskell MonadPlus type class which support a fold operation. In this paper we present subclasses that extend the MonadPlus type class to support a membership operator. The laws for the EMonadPlus type class specify how membership behaves with respect to the monad and monad plus operators. Using EMonads we are able write and prove properties of generic specifications of containers. In the second part of the paper we present an induction rule for monads we call bind induction. The computational content of the new induction rule is the Monad bind operator and the new proof rule is proved to be sound. Using this new proof rule we are able to extract monadic programs from proofs. We present an example that uses the rule to extract a simple monadic program from a proof of a specification. We have used the Coq theorem prover with the Coq Type Class mechanism to formalize the definitions presented here and to prove many properties of the fo...

References (16)

  1. Moggi, E.: Notions of computation and monads. Inf. Comput. 93(1) (July 1991) 55-92
  2. Wadler, P.: Monads for functional programming. In: Advanced Functional Pro- gramming, First International Spring School on Advanced Functional Program- ming Techniques-Tutorial Text, London, UK, UK, Springer-Verlag (1995) 24-52
  3. Hutton, G., Fulger, D.: Reasoning about effects: Seeing the wood through the trees. In: Proceedings of the Ninth Symposium on Trends in Functional Programming. (2008)
  4. Gibbons, J., Hinze, R.: Just do it: simple monadic equational reasoning. In: ACM SIGPLAN Notices. Volume 46., ACM (2011) 2-14
  5. Thompson, S.: Type theory and functional programming. International computer science series. Addison-Wesley (1991)
  6. Nordström, B., Petersson, K., Smith, J.M.: Programming in Martin-Löf type the- ory: an introduction. Clarendon (1990)
  7. Sozeau, M., Oury, N.: First-class type classes. In: Theorem Proving in Higher Order Logics. Springer (2008) 278-293
  8. Geuvers, H., Pollack, R., Wiedijk, F., Zwanenburg, J.: A constructive algebraic hierarchy in coq. Journal of Symbolic Computation 34(4) (2002) 271-286
  9. Garillot, F., Gonthier, G., Mahboubi, A., Rideau, L.: Packaging Mathematical Structures. In Nipkow, T., Urban, C., eds.: Theorem Proving in Higher Order Logics. Volume 5674 of Lecture Notes in Computer Science., Munich, Germany, Springer (2009)
  10. Spitters, B., Van Der Weegen, E.: Type classes for mathematics in type theory. Mathematical Structures in Computer Science 21 (7 2011) 795-825
  11. Caldwell, J., Shafei, H.: Coq files. http://www.cs.uwyo.edu/ ~jlc/papers_ chronological.html (2013)
  12. Sculthorpe, N., Bracker, J., Giorgidze, G., Gill, A.: The constrained-monad prob- lem. In: International Conference on Functional Programming, ACM (2013)
  13. Apfelmus, H.: The operational monad tutorial. (2010) 37-55
  14. Letouzey, P.: A new extraction for Coq. In: Types for proofs and programs. Springer (2003) 200-219
  15. Chipala, A.: Certified Programming with Dependent Types. MIT Press (to appear) (February, 13 2013) http://adam.chlipala.net/cpdt/.
  16. Pierce, B.C., Casinghino, C., Greenberg, M., Hrit ¸cu, C., Sjoberg, V., Yorgey, B.: Software Foundations. Electronic textbook (2012)