## Kleene Monads: Handling Iteration in a Framework of Generic Effects

Citations: | 1 - 0 self |

### BibTeX

@MISC{Goncharov_kleenemonads:,

author = {Sergey Goncharov and Lutz Schröder and Till Mossakowski},

title = {Kleene Monads: Handling Iteration in a Framework of Generic Effects},

year = {}

}

### OpenURL

### Abstract

Abstract. Monads are a well-established tool for modelling various computational effects. They form the semantic basis of Moggi’s computational metalanguage, the metalanguage of effects for short, which made its way into modern functional programming in the shape of Haskell’s do-notation. Standard computational idioms call for specific classes of monads that support additional control operations. Here, we introduce Kleene monads, which additionally feature nondeterministic choice and Kleene star, i.e. nondeterministic iteration, and we provide a metalanguage and a sound calculus for Kleene monads, the metalanguage of control and effects, which is the natural joint extension of Kleene algebra and the metalanguage of effects. This provides a framework for studying abstract program equality focussing on iteration and effects. These aspects are known to have decidable equational theories when studied in isolation. However, it is well known that decidability breaks easily; e.g. the Horn theory of continuous Kleene algebras fails to be recursively enumerable. Here, we prove several negative results for the metalanguage of control and effects; in particular, already the equational theory of the unrestricted metalanguage of control and effects over continuous Kleene monads fails to be recursively enumerable. We proceed to identify a fragment of this language which still contains both Kleene algebra and the metalanguage of effects and for which the natural axiomatisation is complete, and indeed the equational theory is decidable. 1

### Citations

733 | Notions of Computation and Monads
- Moggi
- 1991
(Show Context)
Citation Context ... logics, is encapsulated at lower levels, typically the data level. Two approaches of this kind are Kleene algebra (used here in the version of [9]) and Moggi’s monad-based computational metalanguage =-=[12]-=-, to which we refer for both brevity and distinctness as the metalanguage of effects. Kleene algebra is essentially the equational logic of regular expressions. Seen as a programming language, Kleene ... |

301 |
Word problems requiring exponential time: Preliminary report
- Stockmeyer, Meyer
- 1973
(Show Context)
Citation Context ...Kleene algebra and the metalanguage of effects are equationally complete over the respective natural classes of models [9, 12] and have decidable equational theories (Kleene algebra is even in PSPACE =-=[18]-=-), it is unsurprising in view of our introductory remarks that these properties are sensitive to small extensions of the language; e.g. the Horn theory of continuous Kleene algebras fails to be r.e. [... |

185 | A completeness theorem for Kleene algebras and the algebra of regular events
- Kozen
- 1994
(Show Context)
Citation Context ...ore complex logics, e.g. first or higher order predicate logics, is encapsulated at lower levels, typically the data level. Two approaches of this kind are Kleene algebra (used here in the version of =-=[9]-=-) and Moggi’s monad-based computational metalanguage [12], to which we refer for both brevity and distinctness as the metalanguage of effects. Kleene algebra is essentially the equational logic of reg... |

145 |
Completion of a set of rules modulo a set of equations
- Jouannaud, Kirchner
- 1986
(Show Context)
Citation Context ...n ACI law and p ↣ r, there must exist s such that q ↣ + s, and s is ACI-equivalent to r. This is easily verified by a case analysis. Together with confluence and strong normalisation, this implies by =-=[7]-=- the Church-Rosser property of ↣ modulo ACI. As the theory of additive monads is precisely ACI plus the unoriented version of rules, defining ↣, the last property is equivalent to the claim of the lem... |

124 |
98 Language and Libraries: The Revised Report
- Haskell
- 2003
(Show Context)
Citation Context ...over side effects. E.g. monads have appeared in an abstract modelling of the Java semantics [6] and in region analysis [13, 3], and they form the basis of functional-imperative programming in Haskell =-=[15]-=-; indeed Haskell’s do-notation is essentially the metalanguage of effects. Here, we study the natural combination of Kleene algebra and the metalanguage of effects, which we call the metalanguage of c... |

54 | Computational types from a logical perspective
- Benton, Bierman, et al.
- 1998
(Show Context)
Citation Context ...mpletely axiomatised by the standard rules of many-sorted 5equational logic plus the equations do x ← (do y ← p; q); r = do x ← p; y ← q; r do x ← ret a; p = p[a/x] do x ← p; ret x = p By results of =-=[1]-=-, it is moreover immediate that the metalanguage of effects is decidable. 3 Kleene monads The metalanguage of effects recalled in the previous section is essentially Haskell’s do-notation [15]. Howeve... |

29 | Combining effects: sum and tensor - Hyland, Plotkin, et al. |

28 | Monadic encapsulation of effects: a revised approach (extended version - Moggi, Sabry - 2001 |

27 | Deriving backtracking monad transformers
- Hinze
- 2000
(Show Context)
Citation Context ...– one way of dealing with this phenomenon is to treat exceptions separately as an outermost layer, in this case on top of the additive monad P [16]. Alternative axiomatic formulations can be found in =-=[4, 8]-=-. The computational model behind additive monads is angelic nondeterminism, i.e. like in nondeterministic Turing machines, nonterminating computation paths are ignored. We can compare elements of T A ... |

12 | Monad-independent dynamic logic in HasCasl, J. Logic Comput., to appear. Earlier version
- Schröder, Mossakowski
- 2003
(Show Context)
Citation Context ...rams involving monadic do-notation, Kleene star, and nondeterminism, as well as the use of programs as values in a higher-order style. The MCE forms part of an evolving system of formalisms (see e.g. =-=[17, 16, 14]-=-) aimed at the development of a verification framework for functional-imperative programs in the style of Haskell. The further development of this framework will include the integration of Kleene mona... |

10 |
Kleene algebra with tests and commutativity conditions
- Kozen
- 1996
(Show Context)
Citation Context ...]), it is unsurprising in view of our introductory remarks that these properties are sensitive to small extensions of the language; e.g. the Horn theory of continuous Kleene algebras fails to be r.e. =-=[10]-=-. Specifically, we establish the following negative results. – The equational theory of the MCE over Kleene monads is (r.e. but) undecidable. – The equational theory of the MCE over continuous Kleene ... |

7 |
Backtracking, interleaving, and terminating monad transformers
- Kiselyov, Shan, et al.
(Show Context)
Citation Context ...– one way of dealing with this phenomenon is to treat exceptions separately as an outermost layer, in this case on top of the additive monad P [16]. Alternative axiomatic formulations can be found in =-=[4, 8]-=-. The computational model behind additive monads is angelic nondeterminism, i.e. like in nondeterministic Turing machines, nonterminating computation paths are ignored. We can compare elements of T A ... |

6 | Generic exception handling and the Java monad
- Schröder, Mossakowski
- 2004
(Show Context)
Citation Context ...ion (do x ← p; 0 may terminate if p raises an exception) – one way of dealing with this phenomenon is to treat exceptions separately as an outermost layer, in this case on top of the additive monad P =-=[16]-=-. Alternative axiomatic formulations can be found in [4, 8]. The computational model behind additive monads is angelic nondeterminism, i.e. like in nondeterministic Turing machines, nonterminating com... |

4 |
Nonlocal flow of control and Kleene algebra with tests
- Kozen
- 2008
(Show Context)
Citation Context ...mposition, nondeterministic choice, and iteration in the shape of the Kleene star. When extended with tests, Kleene algebra allows encoding complex control structures including e.g. loops with breaks =-=[11]-=-. Thus, the focus of Kleene algebra as an abstract programming language is the modelling of nondeterministic control. The metalanguage of effects [12] is based on the observation that the bind and ret... |

4 | A generic complete dynamic logic for reasoning about purity and effects
- Mossakowski, Schröder, et al.
(Show Context)
Citation Context ...rams involving monadic do-notation, Kleene star, and nondeterminism, as well as the use of programs as values in a higher-order style. The MCE forms part of an evolving system of formalisms (see e.g. =-=[17, 16, 14]-=-) aimed at the development of a verification framework for functional-imperative programs in the style of Haskell. The further development of this framework will include the integration of Kleene mona... |

3 |
Coalgebras and Monads in the Semantics of Java. Theoret
- Jacobs, Poll
(Show Context)
Citation Context ...language semantics and in functional programming both to encapsulate side effects and to achieve genericity over side effects. E.g. monads have appeared in an abstract modelling of the Java semantics =-=[6]-=- and in region analysis [13, 3], and they form the basis of functional-imperative programming in Haskell [15]; indeed Haskell’s do-notation is essentially the metalanguage of effects. Here, we study t... |

2 |
A confluent reduction for the lambda-calculus with surjective pairing and terminal object
- Curien, Cosmo
- 1996
(Show Context)
Citation Context ... machinery for additive monads, which as a side product induces a simple normalisation-based algorithm for deciding equality over additive monads. Consider the following rewriting system, inspired by =-=[2]-=-. (p : 1 n ) ↣ 〈〉 n 〈fst(p), 〈〉 n 〉 ↣ p 〈〈〉 n , snd(p)〉 ↣ p 〈fst(p), snd(p)〉 ↣ p do x ← (p : T 1 n ); ret〈〉 n ↣ p do x ← p; ret x ↣ p fst〈p, q〉 ↣ p snd〈p, q〉 ↣ q do x ← ret p; q ↣ q[p/x] do x ← (do y ... |