21 research outputs found
Coinductive Resumption Monads: Guarded Iterative and Guarded Elgot
We introduce a new notion of "guarded Elgot monad", that is a monad equipped with a form of iteration. It requires every guarded morphism to have a specified fixpoint, and classical equational laws of iteration to be satisfied. This notion includes Elgot monads, but also further examples of partial non-unique iteration, emerging in the semantics of processes under infinite trace equivalence.
We recall the construction of the "coinductive resumption monad" from a monad and endofunctor, that is used for modelling programs up to bisimilarity. We characterize this construction via a universal property: if the given monad is guarded Elgot, then the coinductive resumption monad is the guarded Elgot monad that freely extends it by the given endofunctor
Unguarded Recursion on Coinductive Resumptions
We study a model of side-effecting processes obtained by starting from a
monad modelling base effects and adjoining free operations using a cofree
coalgebra construction; one thus arrives at what one may think of as types of
non-wellfounded side-effecting trees, generalizing the infinite resumption
monad. Correspondingly, the arising monad transformer has been termed the
coinductive generalized resumption transformer. Monads of this kind have
received some attention in the recent literature; in particular, it has been
shown that they admit guarded iteration. Here, we show that they also admit
unguarded iteration, i.e. form complete Elgot monads, provided that the
underlying base effect supports unguarded iteration. Moreover, we provide a
universal characterization of the coinductive resumption monad transformer in
terms of coproducts of complete Elgot monads.Comment: 47 pages, extended version of
http://www.sciencedirect.com/science/article/pii/S157106611500079
Representing Guardedness in Call-By-Value
Like the notion of computation via (strong) monads serves to classify various flavours of impurity, including exceptions, non-determinism, probability, local and global store, the notion of guardedness classifies well-behavedness of cycles in various settings. In its most general form, the guardedness discipline applies to general symmetric monoidal categories and further specializes to Cartesian and co-Cartesian categories, where it governs guarded recursion and guarded iteration respectively. Here, even more specifically, we deal with the semantics of call-by-value guarded iteration. It was shown by Levy, Power and Thielecke that call-by-value languages can be generally interpreted in Freyd categories, but in order to represent effectful function spaces, such a category must canonically arise from a strong monad. We generalize this fact by showing that representing guarded effectful function spaces calls for certain parametrized monads (in the sense of Uustalu). This provides a description of guardedness as an intrinsic categorical property of programs, complementing the existing description of guardedness as a predicate on a category
Representing Guardedness in Call-by-Value and Guarded Parametrized Monads
Like the notion of computation via (strong) monads serves to classify various
flavours of impurity, including exceptions, non-determinism, probability, local
and global store, the notion of guardedness classifies well-behavedness of
cycles in various settings. In its most general form, the guardedness
discipline applies to general symmetric monoidal categories and further
specializes to Cartesian and co-Cartesian categories, where it governs guarded
recursion and guarded iteration respectively. Here, even more specifically, we
deal with the semantics of call-by-value guarded iteration. It was shown by
Levy, Power and Thielecke that call-by-value languages can be generally
interpreted in Freyd categories, but in order to represent effectful function
spaces, such a category must canonically arise from a strong monad. We
generalize this fact by showing that representing guarded effectful function
spaces calls for certain parametrized monads (in the sense of Uustalu). This
provides a description of guardedness as an intrinsic categorical property of
programs, complementing the existing description of guardedness as a predicate
on a category.Comment: Extended version of
https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.FSCD.2023.3
Flag-based big-step semantics
Structural operational semantic specifications come in different styles: small-step and big-step. A problem with the big-step style is that specifying divergence and abrupt termination gives rise to annoying duplication. We present a novel approach to representing divergence and abrupt termination in big-step semantics using status flags. This avoids the duplication problem, and uses fewer rules and premises for representing divergence than previous approaches in the literature
A coalgebraic treatment of conditional transition systems with upgrades
We consider conditional transition systems, that model software product lines with upgrades, in a coalgebraic setting. By using Birkhoff's duality for distributive lattices, we derive two equivalent Kleisli categories in which these coalgebras live: Kleisli categories based on the reader and on the so-called lattice monad over Poset. We study two different functors describing the branching type of the coalgebra and investigate the resulting behavioural equivalence. Furthermore we show how an existing algorithm for coalgebra minimisation can be instantiated to derive behavioural equivalences in this setting
ContextWorkflow: A Monadic DSL for Compensable and Interruptible Executions
Context-aware applications, whose behavior reactively depends on the time-varying status of the surrounding environment - such as network connection, battery level, and sensors - are getting more and more pervasive and important. The term "context-awareness" usually suggests prompt reactions to context changes: as the context change signals that the current execution cannot be continued, the application should immediately abort its execution, possibly does some clean-up tasks, and suspend until the context allows it to restart. Interruptions, or asynchronous exceptions, are useful to achieve context-awareness. It is, however, difficult to program with interruptions in a compositional way in most programming languages because their support is too primitive, relying on synchronous exception handling mechanism such as try-catch.
We propose a new domain-specific language ContextWorkflow for interruptible programs as a solution to the problem. A basic unit of an interruptible program is a workflow, i.e., a sequence of atomic computations accompanied with compensation actions. The uniqueness of ContextWorkflow is that, during its execution, a workflow keeps watching the context between atomic actions and decides if the computation should be continued, aborted, or suspended. Our contribution of this paper is as follows; (1) the design of a workflow-like language with asynchronous interruption, checkpointing, sub-workflows and suspension; (2) a formal semantics of the core language; (3) a monadic interpreter corresponding to the semantics; and (4) its concrete implementation as an embedded domain-specific language in Scala