# Monad-Based Logics for Computational Effects

• Till Mossakowski
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4019)

## Abstract

The presence of computational effects, such as state, store, exceptions, input, output, non-determinism, backtracking etc., complicates the reasoning about programs. In particular, usually for each effect (or each combination of these), an own logic needs to be designed.

Monads are a well-known tool from category theory that originally has been invented for studying algebraic structures. Monads have been used very successfully by Moggi [1] to model computational effects (in particular, all of those mentioned above) in an elegent way. This has been applied both to the semantics of programming languages (e.g. [2,3,4,5] ) and to the encapsulation of effects in pure functional languages such as Haskell [6].

Several logics for reasoning about monadic programs have been introduced, such as evaluation logic [7,8], Hoare logic [9] and dynamic logic [10,11]. Some of these logics have a semantics and proof calculus given in a completely monad independent (and hence, effect independent) way. We give an overview of these logics, discuss completeness of their calculi, as well as some application of these logics to the reasoning about Haskell and Java programs, and a coding in the theorem prover Isabelle [12].

## Keywords

Programming Language Software Engineer Algebraic Structure Formal Language Category Theory
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.

## References

1. 1.
Moggi, E.: Notions of computation and monads. Inform. and Comput. 93, 55–92 (1991)
2. 2.
Moggi, E.: An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Dept. of Computer Science, Edinburgh Univ. (90)Google Scholar
3. 3.
Wadler, P.: Comprehending monads. In: LFP 1990: Proceedings of the 1990 ACM conference on LISP and functional programming, pp. 61–78. ACM Press, New York (1990)
4. 4.
Jacobs, B., Poll, E.: Coalgebras and Monads in the Semantics of Java. Theoret. Comput. Sci. 291, 329–349 (2003)
5. 5.
Shinwell, M.R., Pitts, A.M.: On a monadic semantics for freshness. Theoret. Comput. Sci. 342, 28–55 (2005)
6. 6.
Wadler, P.: How to declare an imperative. ACM Computing Surveys 29, 240–263 (1997)
7. 7.
Pitts, A.: Evaluation logic. In: Higher Order Workshop. Workshops in Computing, pp. 162–189. Springer, Heidelberg (1991)Google Scholar
8. 8.
Moggi, E.: A semantics for evaluation logic. Fund. Inform. 22, 117–152 (1995)
9. 9.
Schröder, L., Mossakowski, T.: Monad-independent Hoare logic in HASCASL. In: Pezzé, M. (ed.) ETAPS 2003 and FASE 2003. LNCS, vol. 2621, pp. 261–277. Springer, Heidelberg (2003)
10. 10.
Schröder, L., Mossakowski, T.: Monad-independent dynamic logic in HASCASL. J. Logic Comput. 14, 571–619 (2004)
11. 11.
Mossakowski, T., Schröder, L., Goncharov, S.: Completeness of monad-based dynamic logic. Technical report, University of Bremen (2006)Google Scholar
12. 12.
Walter, D.: Monadic dynamic logic: Application and implementation. Master’s thesis, University of Bremen (2005)Google Scholar