Advertisement

A Hoare Logic for the State Monad

Proof Pearl
  • Wouter Swierstra
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5674)

Abstract

This pearl examines how to verify functional programs written using the state monad. It uses Coq’s Program framework to provide strong specifications for the standard operations that the state monad supports, such as return and bind. By exploiting the monadic structure of such programs during the verification process, it becomes easier to prove that they satisfy their specification.

Keywords

Type Theory Recursive Call Functional Programming Proof Obligation Proof Assistant 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Cock, D., Klein, G., Sewell, T.: Secure microkernels, state monads and scalable refinement. In: Munoz, C., Ait, O. (eds.) TPHOLs 2008. LNCS, vol. 5170, pp. 167–182. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  2. 2.
    Floyd, R.W.: Assigning meanings to programs. Mathematical Aspects of Computer Science 19 (1967)Google Scholar
  3. 3.
    Hoare, C.A.R.: An axiomatic basis for computer programming. Communications of the ACM 12(10), 576–580 (1969)CrossRefzbMATHGoogle Scholar
  4. 4.
    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)Google Scholar
  5. 5.
    Leroy, X.: Formal certification of a compiler back-end, or: programming a compiler with a proof assistant. In: POPL 2006: 33rd Symposium on Principles of Programming Languages, pp. 42–54. ACM Press, New York (2006)Google Scholar
  6. 6.
    Martin-Löf, P.: Constructive mathematics and computer programming. In: Proceedings of a discussion meeting of the Royal Society of London on Mathematical logic and programming languages, pp. 167–184. Prentice-Hall, Inc., Englewood Cliffs (1985)Google Scholar
  7. 7.
    McKinna, J.: Deliverables: a categorical approach to program development in type theory. Ph.D thesis, School of Informatics at the University of Edinburgh (1992)Google Scholar
  8. 8.
    Nanevski, A., Morrisett, G.: Dependent type theory of stateful higher-order functions. Technical Report TR-24-05, Harvard University (2005)Google Scholar
  9. 9.
    Nanevski, A., Morrisett, G., Birkedal, L.: Polymorphism and separation in Hoare Type Theory. In: ICFP 2006: Proceedings of the Eleventh ACM SIGPLAN Internation Conference on Functional Programming (2006)Google Scholar
  10. 10.
    Nanevski, A., Morrisett, G., Shinnar, A., Govereau, P., Birkedal, L.: Ynot: Reasoning with the awkward squad. In: ICFP 2008: Proceedings of the Twelfth ACM SIGPLAN International Conference on Functional Programming (2008)Google Scholar
  11. 11.
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)zbMATHGoogle Scholar
  12. 12.
    Sozeau, M.: Subset coercions in Coq. In: Altenkirch, T., McBride, C. (eds.) TYPES 2006. LNCS, vol. 4502, pp. 237–252. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  13. 13.
    Sozeau, M.: Un environnement pour la programmation avec types dépendants. Ph.D thesis, Université de Paris XI (2008)Google Scholar
  14. 14.
    Sprenger, C., Basin, D.: A monad-based modeling and verification toolbox with application to security protocols. In: Schneider, K., Brandt, J. (eds.) TPHOLs 2007. LNCS, vol. 4732, pp. 302–318. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  15. 15.
    The Coq development team. The Coq proof assistant reference manual. LogiCal Project, Version 8.2 (2008)Google Scholar
  16. 16.
    Wadler, P.: The essence of functional programming. In: POPL 1992: Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 1–14 (1992)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Wouter Swierstra
    • 1
  1. 1.Chalmers University of TechnologySweden

Personalised recommendations