Unifying Guarded and Unguarded Iteration
Sergey Goncharov1 , Lutz Schröder1 , Christoph Rauch1 , and Maciej Piróg2
1
2
Friedrich-Alexander-Universität Erlangen-Nürnberg
Department of Computer Science, KU Leuven, Belgium
Abstract. Models of iterated computation, such as (completely) iterative monads, often depend on a notion of guardedness, which guarantees
unique solvability of recursive equations and requires roughly that recursive calls happen only under certain guarding operations. On the other
hand, many models of iteration do admit unguarded iteration. Solutions
are then no longer unique, and in general not even determined as least
or greatest fixpoints, being instead governed by quasi-equational axioms.
Monads that support unguarded iteration in this sense are called (complete) Elgot monads. Here, we propose to equip monads with an abstract
notion of guardedness and then require solvability of abstractly guarded
recursive equations; examples of such abstractly guarded pre-iterative
monads include both iterative monads and Elgot monads, the latter by
deeming any recursive definition to be abstractly guarded. Our main
result is then that Elgot monads are precisely the iteration-congruent
retracts of abstractly guarded iterative monads, the latter being defined
as admitting unique solutions of abstractly guarded recursive equations;
in other words, models of unguarded iteration come about by quotienting
models of guarded iteration.
1
Introduction
In recursion theory, notions of guardedness traditionally play a central role.
Guardedness typically means that recursive calls must be in the scope of certain
guarding operations, a condition aimed, among other things, at ensuring progress.
The paradigmatic case are recursive definitions in process algebra, which are
usually called guarded if recursive calls occur only under action prefixing [6]. A
more abstract example are completely iterative theories [11] and monads [19],
where, in the latter setting, a recursive definition is guarded if it factors through
a given ideal of the monad. Guarded recursive definitions typically have unique
solutions; e.g. the unique solution of the guarded recursive definition
X “ a. X
is the process that keeps performing the action a.
For unguarded recursive definitions, the picture is, of course, different. E.g. to
obtain the denotational semantics of an unproductive while loop while true do skip
characterized by circular operational behavior
while true do skip Ñ skip; while true do skip Ñ while true do skip
one will select one of many solutions of this trivial equation, e.g. the least solution
in a domain-theoretic semantics.
Sometimes, however, one has a selection among non-unique solutions of
unguarded recursive equations that is not determined order-theoretically, i.e.
by picking least or greatest fixpoints. One example arises from coinductive
resumptions [16,26,25]. In the paradigm of monad-based encapsulation of sideeffects [21], coinductive resumptions over a base effect encapsulated by a monad T
form a coinductive resumption transform monad T ν given by
T ν X “ νγ. T pX ` γq
(1)
– that is, a computation over X performs a step with effects from T , and then
returns either a value from X or a resumption that, when resumed, proceeds
similarly, possibly ad infinitum. We generally restrict to monads T for which (1)
exists for all X (although many of our results do not depend on this assumption).
Functors (or monads) T for which this holds are called iteratable [1]. Most computationally relevant monads are iteratable (notable exceptions in the category of
sets are the powerset monad and the continuation monad). Notice that one has a
natural delay map T ν X Ñ T ν X that converts a computation into a resumption,
i.e. prefixes it with a delay step. In fact, for T “ id, T ν is precisely Capretta’s
partiality monad [8], also called the delay monad. It is not in general possible to
equip T ν X with a domain structure that would allow for selecting least or greatest
solutions of unguarded recursive definitions over T ν . However, one can select
solutions in a coherent way, that is, such that a range of natural quasi-equational
axioms is satisfied, making T ν into a (complete) Elgot monad [2,15].
In the current work we aim to unify theories of guarded and unguarded
iteration. To this end, we introduce a notion of abstractly guarded monads, that
is, monads T equipped with a distinguished class of abstractly guarded equation
morphisms satisfying some natural closure properties (Section 3). The notion
of abstract guardedness can be instantiated in various ways, e.g. with the class
of immediately terminating ‘recursive’ definitions, with the class of guarded
morphisms in a completely iterative monad, or with the class of all equation
morphisms. We call an abstractly guarded monad pre-iterative if all abstractly
guarded equation morphisms have a solution, and iterative if these solutions
are unique. Then completely iterative monads are iterative abstractly guarded
monads in this sense, and (complete) Elgot monads are pre-iterative, where we
deem every equation morphism to be abstractly guarded in the latter case.
The quasi-equational axioms of Elgot monads are easily seen to be satisfied
when fixpoints are unique, i.e. in iterative abstractly guarded monads, and
moreover stable under iteration-congruent retractions in a fairly obvious sense.
Our first main result (Section 5, Theorem 22) states that the converse holds as
well, i.e. a monad T is a complete Elgot monad iff T is an iteration-congruent
retract of an iterative abstractly guarded monad – specifically of T ν as in (1). As
a slogan,
monad-based models of unguarded recursion arise by quotienting models
of guarded recursion.
2
Our second main result (Theorem 26) is an algebraic characterization of complete
Elgot monads: We show that the construction p´qν mapping a monad T to T ν
as in (1) is a monad on the category of monads (modulo existence of T ν ), and
complete Elgot monads are precisely those p´qν -algebras T that cancel the delay
map on T ν , i.e. interpret the delay operation as identity.
As an illustration of these results, we show (Section 6) that sandwiching a
complete Elgot monad between adjoint functors again yields a complete Elgot
monad, in analogy to a corresponding result for completely iterative monads [26].
Specifically, we prove a sandwich theorem for iterative abstractly guarded monads and transfer it to complete Elgot monads using our first main result. For
illustration, we then relate iteration in ultrametric spaces using Escardó’s metric
lifting monad [12] to iteration in pointed cpo’s, by noting that the corresponding monads on sets obtained using our sandwich theorems are related by an
iteration-congruent retraction in the sense of our first main result.
2
Preliminaries
We work in a category C with finite coproducts. We fix the notation ini : Xi Ñ
X1 ` . . . ` Xn for the i-th injection. A morphism σ : Y Ñ X is a summand of X,
which we denote σ : Y
X, if there is σ 1 : X 1 Ñ X such that X is a coproduct
of Y and X 1 with σ and σ 1 being coproduct injections. The morphism σ 1 is called
a (coproduct) complement of σ and by definition is also a summand. We are not
assuming that C is extensive, and coproduct complements are not in general
uniquely determined.
A monad T over C can be given in a form of a Kleisli triple pT, η, --‹ q where
T is an endomap over the objects |C| of C, the unit η is a family of morphisms
pηX : X Ñ T XqXP|C| , Kleisli lifting p--q‹ is a family of maps : HompX, T Y q Ñ
HompT X, T Y q, and the monad laws are satisfied:
η ‹ “ id,
f ‹ η “ f,
pf ‹ gq‹ “ f ‹ g ‹ .
The standard (equivalent) categorical definition [18] of T as an endofunctor with
natural transformation unit η : Id Ñ T and multiplication µ : T T Ñ T can
be recovered by taking T f “ pη f q‹ , µ “ id‹ . (We adopt the convention that
monads and their functor parts are denoted by the same letter, with the former
in blackboard bold.) We call morphisms X Ñ T Y Kleisli morphisms and view
them as a high level abstraction of sequential programs with T encapsulating the
underlying computational effect as proposed by Moggi [22], with X representing
the input type and Y the output type. A more traditional use of monads in
semantics is due to Lawvere [17], who identified finitary monads on Set with
algebraic theories, hence objects T X can be viewed as sets of terms of the theory
over free variables from X, the unit as the operation of casting a variable to a
term, and Kleisli composition as substitution. We informally refer to this use of
monads as algebraic monads.
A(n F -)coalgebra is a pair pX, f : X Ñ F Xq where X P |C| and F : C Ñ C
is an endofunctor. Coalgebras form a category, with morphisms pX, f q Ñ pY, gq
3
being C-morphisms h : X Ñ Y such that pF hqf “ gh. A final object of this
category is called a final coalgebra, and we denote it by pνF, out : νF Ñ F νF q if
it exists. For brevity, we will be cavalier about existence of final coalgebras and
silently assume they exist when we need them; that is, we hide sanity conditions
on the involved functors, such as accessibility. By definition, νF comes with
coiteration as a definition principle (dual to the iteration principle for algebras):
given a coalgebra pX, f : X Ñ F Xq there is a unique morphism pcoit f q : X Ñ νF
such that
out pcoit f q “ F pcoit f q f.
This implies that out is an isomorphism (Lambek’s lemma) and that coit out “ id
(see [30] for more details about coalgebras for coiteration).
We generally drop sub- and superscripts, e.g. on natural transformations,
whenever this improves readability.
3
Guarded Monads
The notion of guardedness is paramount in process algebra: typically one considers
systems of mutually recursive process definitions of the form xi “ ti , and a
variable xi is said to be guarded in tj if it occurs in tj only in subterms of the
form a.s where a.p--q is action prefixing. A standard categorical approach is to
replace the set of terms over variables X by an object T X where T is a monad.
We then can model separate variables by partitioning X into a sum X1 ` . . . ` Xn
and thus talk about guardedness of a morphism f : X Ñ T pX1 ` . . . ` Xn q
in any Xi , meaning that every variable from Xi is guarded in f . Since Kleisli
morphisms can be thought of as abstract programs we can therefore speak
about guardedness of a program in a certain portion of the output type, e.g.
Xi
X1 ` . . . ` Xn . One way to capture guardedness categorically is to identify
the operations of T that serve as guards by distinguishing a suitable subobject
of T; e.g. the definition of completely iterative monad [19] follows this approach.
For our purposes, we require a yet more general notion where we just distinguish
some Kleisli morphisms as being guarded in certain output variables. This is
formalized as follows.
Definition 1 ((Abstractly) guarded monad). We call a monad T (abstractly) guarded if it is equipped with a notion of (abstract) guardedness, i.e.
with a relation between morphisms f : X Ñ T Y and summands of Y (by putting
the word ‘abstract’ in brackets we mean that we will often omit it later). We call
Y are in this relation,
f : X Ñ T Y (abstractly) σ-guarded if f and σ : Y 1
and then write f : X Ñσ T Y . Abstract guardedness is required to be closed
under the rules in Figure 1. In rule (wkn), σ and θ are composable summands.
Given guarded monads T, S, a monad morphism α : T Ñ S is (abstractly)
guarded if whenever f : X Ñσ T Y then αf : X Ñσ SY .
Intuitively, (trv) says that if a program does not output anything via a
summand of the output type then it is guarded in that summand. Rule (wkn)
4
(trv)
f : X Ñ TY
pT in1 q f : X Ñin2 T pY ` Zq
(cmp)
(wkn)
f : X Ñin2 T pY ` Zq
g : Y Ñσ T V
rg, hs‹ f : X Ñσ T V
(sum)
f : X Ñσ T Y
f : X Ñσθ T Y
h : Z Ñ TV
f : X Ñ σ T Z g : Y Ñσ T Z
rf, gs : X ` Y Ñσ T Z
Fig. 1: Axioms of guardedness.
is a weakening principle: if a program is guarded in some summand then it
is guarded in any subsummand of that summand. Rule (cmp) asserts that
guardedness is preserved by composition: if the unguarded part of the output of a
program is postcomposed with a σ-guarded program then the result is σ-guarded,
no matter how the guarded part is transformed. Finally, rule (sum) says that
putting two guarded equation systems side by side again produces a guarded
system. The rules are designed so as to enable a reformulation of the classical
laws of iteration w.r.t. abstract guardedness, as we shall see in Section 5.
We write f : X Ñi1 ,...,ik T pX1 ` . . . ` Xn q as a shorthand for f : X Ñσ
T pX1 ` . . . ` Xn q with σ “ rini1 , . . . , inik s : Xi1 ` . . . ` Xik
X1 ` . . . ` Xn .
More generally, we sometimes need to refer to components of some Xij . This
amounts to replacing the corresponding ij with a sequence of pairs ij nj,m , and
inij with inij rinnj,1 , . . . , innj,kj s, so, e.g. we write f : X Ñ12,2 T ppY ` Zq ` Zq to
mean that f is rin1 in2 , in2 s-guarded. Where coproducts Y ` Z etc. appear in the
rules, we mean any coproduct, not just some selected coproduct. We defined the
notion of guardedness as a certain relation over Kleisli morphisms and summands.
Clearly, the largest such relation is the one declaring all Kleisli morphisms to be
σ-guarded for all σ. We call monads equipped with this notion of guardedness
totally guarded. It turns out that for every monad we also have a least guardedness
relation.
Definition 2. Let T be a monad. A morphism f : X Ñ T Y is trivially σ-guarded
for σ : Z
Y if f factors through T σ 1 for a coproduct complement σ 1 of σ.
Proposition 3. Let T be a monad. Then taking the abstractly guarded morphisms
to be the trivially guarded morphisms is the least guardedness relation making T
into a guarded monad.
We call a guarded monad trivially guarded if all its abstractly guarded morphisms
are trivially guarded. As we see, the notion of abstract guardedness can vary on
a large spectrum from trivial guardedness to total guardedness, thus somewhat
detaching abstract guardedness from the original intuition. It is for this reason
that we introduced the qualifier abstract into the terminology; for brevity, we will
omit this qualifier in the sequel in contexts where no confusion is likely, speaking
only of guarded monads, guarded morphisms etc.
5
Remark 4. Although by (wkn), f : X Ñ1,2 T pY ` Zq implies both f : X Ñ1
T pY ` Zq and f : X Ñ2 T pY ` Zq, the converse is not required to be true, and
in fact can fail even for trivial guardedness. This is witnessed by the following
simple counterexample. Let T be the algebraic monad given by taking T X to be
the free commutative semigroup over X satisfying the additional law x ` y “ x.
Now the term x ` y P T pX ` Y q (seen as a morphism 1 Ñ T pX ` Y q) with x P X
and y P Y is both in1 -guarded and in2 -guarded, being equivalent both to y and
to x. But it is not id-guarded, because it does not factor through T ∅ “ ∅.
As usual, guardedness serves to identify systems of equations that admit solutions
according to some global principle:
Definition 5 (Guarded (pre-)iterative monad). Given f : X Ñ2 T pY `Xq,
we say that f : : X Ñ T Y is a solution of f if f : satisfies the fixpoint identity
f : “ rη, f : s‹ f . A guarded monad T is guarded pre-iterative if it is equipped
with an iteration operator that assigns to every in2 -guarded morphism f : X Ñ2
T pY ` Xq a solution f : of f . If every such f has a unique solution, we call T
guarded iterative.
We can readily check that the iteration operator preserves guardedness.
Proposition 6. Let T be a guarded pre-iterative monad, let σ : Y 1
let f : X Ñσ`id T pY ` Xq. Then f : : X Ñσ T Y .
Y , and
In trivially guarded monads, there is effectively nothing to iterate, so we have
Proposition 7. Every trivially guarded monad is guarded iterative.
Guardedness in completely iterative monads One instance of our notion
of abstract guardedness is found in completely iterative monads [19], which
are based on idealised monads. To make this precise, we need to recall some
definitions. First, a module over a monad T on C is a pair pM, --˝ q, where M is
an endomap over the objects of C, while the lifting --˝ is a map HompX, T Y q Ñ
HompM X, M Y q such that the following laws are satisfied:
η ˝ “ id,
g ˝ f ˝ “ pg ‹ f q˝ .
Note that M extends to an endofunctor by taking M f “ pηf q˝ . Next, a module-tomonad morphism is a natural transformation ξ : M Ñ T that satisfies ξf ˝ “ f ‹ ξ.
We call the triple pT, M, --˝ , ξq an idealised monad ; when no confusion is likely,
we refer to these data just as T. Following [19], we can then define guardedness
as follows:
Definition 8. Given an idealised monad T as above, a morphism f : X Ñ
T pY ` Xq is guarded if it factors via rη in1 , ξs : Y ` M pY ` Xq Ñ T pY ` Xq.
Then, T is a completely iterative monad if every such guarded f has a unique
solution.
It turns out that this notion of guardedness is not an instance of our notion of
abstract guardedness. Fortunately, we can fix this by noticing that completely
iterative monads actually support iteration for a wider class of morphisms:
6
Definition 9. Let pT, M, --˝ , ξq be an idealised monad. Given σ : Z
Y , we
say that a morphism f : X Ñ T Y is weakly σ-guarded if it factors through
rησ 1 , ξs‹ : T pY 1 ` M Y q Ñ T Y for a complement σ 1 : Y 1
Y of σ.
Since a morphism that factors as rη in1 , ξsf can be rewritten as rη in1 , ξs‹ ηf ,
every guarded morphism in an idealised monad is also weakly guarded.
Theorem 10. Let pT, M, --˝ , ξq be an idealised monad. Then the following hold.
1. T becomes abstractly guarded when equipped with weak guardedness as the
notion of abstract guardedness.
2. If T is completely iterative, then every weakly in2 -guarded morphism f : X Ñ
T pY ` Xq has a unique solution.
That is, completely iterative monads are abstractly guarded iterative monads
w.r.t. weak guardedness.
4
Parametrizing Guardedness
Uustalu [29] defines a parametrized monad to be a functor from a category C
to the category of monads over C. We need a minor adaptation of this notion
where we allow parameters from a different category than C, and simultaneously
introduce a guarded version of parametrized monads:
Definition 11 (Parametrized guarded monad). A parametrized (guarded)
monad is a functor from a category D to the category of (guarded) monads
and (guarded) monad morphisms over C. Alternatively (by uncurrying), it is
a bifunctor # : C ˆ D Ñ C such that for any X P |D|, -- #X : C Ñ C is a
(guarded) monad, and for every f : X Ñ Y , id # f : Z # X Ñ Z # Y is the
Z-component of a (guarded) monad morphism -- #f : -- #X Ñ -- #Y .
A parametrized (guarded) monad morphism between guarded monads qua
functors into the category of monads over C is a natural transformation that is
componentwise a monad morphism. In uncurried notation, given parametrized
monads #, #̂ : C ˆ D Ñ C a natural transformation α : # Ñ #̂ is a parametrized
(guarded) monad morphism if for each X P |D|, α--,X : -- #X Ñ -- #̂X is a
(guarded) monad morphism.
Guardedness of the monad morphisms -- #f means explicitly that g : Z Ñσ V #X
implies pid # f q g : Z Ñσ V # Y .
Example 12. For the purposes of the present work, the most important example
(taken from [29]) is # “ T p-- `Σ --q : C ˆ C Ñ C where T is a (non-parametrized)
monad on C and Σ is an endofunctor on C. Informally, T captures a computational effect, e.g. nondeterminism for T being powerset, and Σ captures a
signature of actions, e.g. ΣX “ A ˆ X, as in process algebra. Specifically, taking
A “ 1 we obtain X # Y “ T pX ` Y q; in this case, we have only one guard, which
can be interpreted as a delay. The second argument of # can thus be thought of
as designated for guarded recursion.
7
Incidentally, our modification of parametrized monads also covers Atkey’s
parametrized monads [5], which are certain functors S ˆ Sop ˆ C Ñ C forming a
monad in the third argument. The first and the second arguments serve, e.g., to
parametrize the computational effect of interest with initial and final states of
different types.
Theorem 13. Let # : C ˆ pC ˆ Dq Ñ C be a parametrized monad, with unit η
and Kleisli lifting p´q‹ . Then
X #ν Y “ νγ. X # pγ, Y q
defines a parametrized monad #ν : C ˆ D Ñ C whose unit and Kleisli lifting we
denote η ν and --6 , respectively. Moreover,
1. If # is guarded then so is #ν with guardedness defined as follows: given
σ :Y1
Y , f : X Ñ Y #ν Z is σ-guarded if out f : X Ñ Y # pY #ν Z, Zq
is σ-guarded.
2. If # is pre-iterative under an iteration operator --: then so is #ν with the
iteration operator --; defined as follows:
`
˘;
`
˘
f : X Ñ2 pY ` Xq #ν Z “ coit rη, pout f q: s‹ out η ν in2
3. If # is iterative then so is #ν under the definition from the previous clause.
Example 14. We spell out one instance of Theorem 13 in case D “ 1 and
# “ T p-- ` --q where T “ pT, η, --‹ q is a monad. Then #ν is isomorphically a
monad Tν on C with T ν X “ νγ. T pX ` γq, unit η ν “ η in1 and Kleisli star
pf : X Ñ T ν Y q6 being uniquely determined by the equation
out f 6 “ rout f, η in2 f 6 s‹ out .
If T is pre-iterative then so is Tν with iteration
`
˘
pf : X Ñ T ν pY ` Xqq; “ coit rη in2 , pT rin1 `id, in1 in2 s out f q: s‹ out η ν in2 .
Example 15. Theorem 13 shows that our notion of guardedness extends along
the applications of the final coalgebra transformer # ÞÑ #ν on parametrized
monads. This can be used to capture existing notions of guardedness as follows.
Consider X # Y “ T pX ` p1 ` Aq ˆ Y q where T is some monad. In Set, 1 ` A
can be thought of as consisting of a set A of visible actions and a silent action τ .
In process algebra we standardly consider a process definition to be guarded if
every recursive call is preceded by a visible action from A. In our framework this
can be reconstructed as follows. The obvious isomorphism
νγ. T pX ` p1 ` Aq ˆ γq – νγ 1 . νγ. T pX ` γ ` A ˆ γ 1 q
involves two more parametrized monads: T p-- ` -- `A ˆ --q : C ˆ C ˆ C Ñ C and
νγ. T p-- `γ ` A ˆ --q : C ˆ C Ñ C. By taking the latter to be trivially guarded
and then defining guardedness for νγ 1 . νγ. T pX ` γ ` A ˆ γ 1 q using Theorem 13,
we arrive precisely at the notion we expected for the isomorphic monad #ν .
8
Fixpoint:
Y
X
Y
X
f
Y
f
=
f
X
X
X
Naturality:
Y
X
Z
g
f
Y
X
=
Z
g
f
X
X
Dinaturality 1:
Y
X
Y
X
Y
g
=
h
Y
g
Y
h
g
Z
Z
X
X
Z
Dinaturality 2:
Y
X
Y
X
Y
g
=
h
Y
g
Y
h
g
Z
Z
X
X
Z
Codiagonal:
Y
Y
X
X
g
g
=
X
X
X
X
Uniformity:
Z
h
X
Y
“
f
Z
Y
g
h
Z
X
ó
Z
h
X
Y
Z
f
“
Y
g
X
Z
Fig. 2: Axioms of guarded iteration.
9
X
5
Complete Elgot Monads and Iteration Congruences
Besides the fixpoint identity we are interested in the following classical properties
of the iteration operator, which we refer to as the iteration laws [10,7,27]:
naturality: g ‹ f : “ prpT in1 q g, η in2 s‹ f q: for f : X Ñ2 T pY `Xq, g : Y Ñ T Z;
dinaturality: prη in1 , hs‹ gq: “ rη, prη in1 , gs‹ hq: s‹ g for g : X Ñ2 T pY ` Zq
and h : Z Ñ T pY ` Xq or g : X Ñ T pY ` Zq and h : Z Ñ2 T pY ` Xq;
codiagonal: pT rid, in2 s f q: “ f :: for f : X Ñ12,2 T ppY ` Xq ` Xq;
uniformity: f h “ T pid ` hq g implies f : h “ g : for f : X Ñ2 T pY ` Xq,
g : Z Ñ2 T pY ` Zq and h : Z Ñ X.
The axioms are summarized in graphical form in Figure 2, and then become
quite intuitive. The two versions of the dinaturality axiom correspond to the
alternative sets of guardedness assumptions mentioned above. We indicate the
scope of the iteration operator by a shaded box and guardedness by bullets at
the outputs of a morphism.
A guarded pre-iterative monad is called a complete Elgot monad if it is totally
guarded and satisfies all iteration laws. In the sequel we shorten ‘complete Elgot
monads’ to ‘Elgot monads’ (to be distinguished from Elgot monads in the sense
of [2], which have solutions only for morphisms with finitely presentable domain).
In general, the fact that the iteration laws are correctly formulated relies on
the axioms for guardedness. E.g., in the dinaturality axiom it suffices to assume
that g : X Ñ T pY ` Zq is in2 -guarded and this implies that both rη in1 , hs‹ g
and rη in1 , gs‹ h are in2 -guarded by (cmp) and (trv), and additionally (sum)
in the latter case. Symmetrically, it suffices to make the analogous assumption
about h. In the codiagonal axiom, it follows from the assumption f : X Ñ12,2
T ppY ` Xq ` Xq by (cmp) that T rid, in2 s f is in2 -guarded and by Proposition 6
that f : is in2 -guarded. Indeed, the axioms for guarded monads are designed
precisely to enable the formulation of the iteration laws.
We show that for guarded iterative monads all iteration laws are automatic.
Prior to that, we show that dinaturality follows from the others (thus generalizing
the corresponding observation made recently [15,13]).
Proposition 16. Any guarded pre-iterative monad satisfying naturality, codiagonal and uniformity also satisfies dinaturality, as well as the Bekić identity
“
T rid ` in1 , in2 s‹ f, T rid ` in1 , in2 s‹ g
‰:
“ rh: , rη, h: s‹ g : s
where f : X Ñ12,2 T ppY ` Xq ` Zq, g : Z Ñ12,2 T ppY ` Xq ` Zq, and h “
rη, g : s‹ f : X Ñ2 T pY ` Xq.
The proof of the following result runs in accordance with the original ideas of
Elgot [10] for iterative theories, except that, by Proposition 16, dinaturality is
now replaced by uniformity.
Theorem 17. Every guarded iterative monad validates naturality, dinaturality,
codiagonal and uniformity.
10
We now proceed to introduce key properties of morphisms of guarded monads
that allow for transferring pre-iterativity and the iteration laws, respectively.
Definition 18 (Guarded retraction). Let T and S be guarded monads. We
call a monad morphism ρ : T Ñ S a guarded retraction if there is a family of
morphisms pυX : SX Ñ T XqXP|C| (not necessarily natural in X!) such that
1. for every f : X Ñσ SY , we have υY f : X Ñσ T Y ,
2. ρX υX “ id for all X P |C|.
Theorem 19. Let ρ : T Ñ S be a guarded retraction, witnessed by υ : S Ñ T,
and suppose that pT, --: q is guarded pre-iterative. Then S is guarded pre-iterative
with the iteration operator p--q; given by f ; “ ρ pυf q: .
Definition 20 (Iteration congruence). Let T be a guarded pre-iterative
monad and let S be a monad. We call a monad morphism ρ : T Ñ S an iteration congruence if for every pair of morphisms f, g : X Ñ2 T pY ` Xq,
ρf “ ρg ùñ ρf : “ ρg : .
(2)
If ρ is moreover a guarded retraction, we call ρ an iteration-congruent retraction.
Theorem 21. Under the premises of Theorem 19, assume moreover that ρ is an
iteration-congruent retraction. Then any property out of naturality, dinaturality,
codiagonal, and uniformity that is satisfied by T is also satisfied by S.
Proof (Sketch). The crucial observation is that under our assumptions, (2) is
equivalent to the condition that for all f : X Ñ2 T pY ` Xq,
ρ pυρ f q: “ ρf : .
(3)
Indeed, (2) ùñ (3), for ρυρ f “ ρ f and therefore ρpυρ f q: “ ρ f : and conversely,
assuming (3) both for f and for g, and ρf “ ρg, we obtain that ρf : “ ρpυρ f q: “
ρpυρ gq: “ ρg : . Using (3), the claim is established routinely.
\
[
Recall from the introduction that a monad S is iteratable if its coinductive
resumption transform Sν exists. We make Sν into a guarded monad by applying
Theorem 13 to S as a trivially guarded monad; explicitly: f : X Ñ S ν pY ` Xq
is guarded iff out f “ Spin1 `idq g for some g : X Ñ SpY ` S ν pY ` Xqq. We are
now set to prove our first main result, which states that every iteratable Elgot
monad can be obtained by quotienting a guarded iterative monad; that is, every
choice of solutions that obeys the iteration laws arises by quotienting a more
fine-grained model in which solutions are uniquely determined:
Theorem 22. A totally guarded iteratable monad S is an Elgot monad iff there
is a guarded iterative monad T and an iteration-congruent retraction ρ : T Ñ S.
Specifically, every iteratable Elgot monad S is an iteration-congruent retract of
its coinductive resumption transform Sν .
11
Proof (Sketch). Direction (ð) immediately follows from Theorems 17 and 21 .
In order to prove (ñ), we show that S “ pS, η, --‹ , --: q is an iteration-congruent
retract of Sν “ pνγ. Sp-- `γq, η ν , --‹ , --; q. Let υX “ out -1 η in2 out -1pS in1 q and
`
˘:
out
ρX “ S ν X ÝÝÝÑ SpX ` T Xq .
Clearly, υf is σ-guarded for every f : X Ñ SY and it is easy to verify that υ is
left inverse to ρ by using the fixpoint identity for --: twice.
Naturality of ρ is proved straightforwardly from naturality of --: . The remaining calculations showing that ρ is a monad morphism and moreover an iteration
congruence make heavy use of the Elgot monad laws.
\
[
The notions of guarded retraction and iteration congruence straightforwardly
extend to parametrized monads. We then can take the claims of Theorem 13
further.
Theorem 23. Let #, #̂ : C ˆ pC ˆ Dq Ñ C be guarded parametrized monads
and let ρ : # Ñ #̂ be an iteration-congruent retraction. By Theorem 13, #ν “
-- #pγ, --q and #̂ν “ -- #̂pγ, --q are also parametrized guarded monads. Then ρν :
#ν Ñ #̂ν , with components
`
˘
ρ out
ρνX,Y “ coit νγ. X # pγ, Y q ÝÝÝÝÑ X #̂ pνγ. X # pγ, Y q, Y q ,
is again an iteration-congruent retraction.
Theorems 22 and 23 jointly provide a simple and structured way of showing
that Elgotness extends along the parametrized monad transformer # ÞÑ #̂: If
-- #X is Elgot then by Theorem 22 there is an iteration-congruent retraction
ρ : νγ. -- `γ # X Ñ -- #X; by Theorem 23, it gives rise to an iteration-congruent
retraction
ρν : νγ 1 . νγ. -- `γ # pγ 1 , Xq Ñ νγ 1 . -- #pγ 1 , Xq
and by Theorem 22, the right-hand side is again Elgot. We have thus proved
Corollary 24. Given a parametrized monad # and X P |C|, if -- #X is Elgot
then so is -- #ν X “ νγ. -- #pγ, Xq.
This yields a more general and simpler proof of one of the main results in [15].
Example 25. By instantiating # in Corollary 24 with Pω p-- `A ˆ --q : Set ˆ
Set Ñ Set where Pω is the countable powerset monad, we obtain νγ. Pω pX `Aˆ
γq, which can be viewed as a semantic domain for countably branching processes
that possibly terminate with results in X and are taken modulo strong bisimilarity.
The simple fact that Pω is Elgot [15] implies that so is νγ. Pω pX ` A ˆ γq. This
justifies the use of systems of possibly unguarded recursive process algebra
equations (as done, e.g., in [6]). It is worth noting that the iteration operator
of the transformed monad is neither least nor unique. It arises by introducing
an additional delay action that guards all recursive calls and then eliminating
these delays from the unique solution of the new recursive definition; the delay
elimination is the effect of ρν in Theorem 23.
12
Theorem 22 characterizes iteratable Elgot monads as iteration-congruent retracts
of their p--qν -transforms. We take this perspective further as follows. Let us call
T strongly iteratable if every T ν...ν exists. Consider the functor T ÞÑ Tν on the
category of strongly iteratable monads over C. This is itself a monad: the unit η
is the natural transformation with components η X “ out -1pT in1 q : T X Ñ T ν X
and the multiplication µ : T νν Ñ T ν has components
`
˘
µX “ coit T rid, in2 out -1s out out : T νν X Ñ T pX ` T νν Xq .
For every T we define the delay transformation “ out -1 η in2 : T ν Ñ T ν . This
leads to our second main result:
Theorem 26. The category of strongly iteratable Elgot monads over C is isomorphic to the full subcategory of the category of p--qν -algebras for strongly iteratable
S consisting of the p--qν -algebras pS ν , ρ : S ν Ñ Sq satisfying ρ “ ρ.
Proof (Sketch). To show that every strongly iteratable Elgot monad is a p--qν algebra, one has to check the equations ρη “ id and ρµ “ ρρν where ρν “
coitpρ outq : S νν Ñ S ν . The first equation follows relatively easily. The second
one is shown along the following lines:
`
˘; piiiq
piq
piiq
ρµ ““ ρrη, p outq; s6 out ““ ρ out -1 Spin1 ` η ν in2 qρ out ““ ρρν .
Here, (i) and (iii) only amount to equivalent transformations of µ and ρν , respectively, while (ii) makes crucial use of the fact that ρ is an iteration congruence,
as implied by Theorem 22.
For the converse implication, we start with a p--qν -algebra and verify the Elgot
monad laws for the iteration operator f : “ ρpcoit f q.
\
[
Remark 27. The delay cancellation condition ρ “ ρ is essential, as can be
seen on a simple example. Let MonpCqν be the category of p--qν -algebras and let
MonpCqν be its subcategory figuring in Theorem 26. Since the identity functor
is the initial monad, the initial object of MonpCqν is Capretta’s delay monad [8]
D “ νγ. p-- `γq. On the other hand, the initial object of MonpCqν (if it exists)
is the initial Elgot monad L, which on C “ Set is the maybe monad p--q ` 1.
If C “ Set, then DX “ pX ˆ N ` 1q does turn out to be Elgot [14] (but
applying Theorem 26 to D qua Elgot monad yields a different p--qν -algebra
structure than the initial one), and L is, in this case, a retract of D in MonpCqν .
The situation is more intricate in categories with a non-classical internal logic,
for which D is mainly intended. We believe that in such a setting, neither is D
Elgot in general, nor is L the maybe monad. However, there will still be a unique
p--qν -algebra morphism D Ñ L in MonpCqν .
6
A Sandwich Theorem for Elgot Monads
As an application of Theorem 22, we show that sandwiching an Elgot monad
between adjoint functors again yields an Elgot monad. A similar result has been
shown for completely iterative monads [26]; this result generalizes straightforwardly to guarded iterative monads:
13
Theorem 28. Let F : C Ñ D and U : D Ñ C be a pair of adjoint functors
with the associated natural isomorphism Φ : DpF X, Y q Ñ CpX, U Y q, and let T
be a guarded iterative monad on D. Then the monad induced on the composite
functor U T F is guarded iterative, with the guardedness relation defined by taking
f : X Ñσ U T F Y if and only if Φ´1 f : F X Ñσ T F Y , and the unique solutions
given by f ÞÑ ΦppΦ´1 f q: q.
Now, to obtain a similar result for Elgot monads, we can easily combine Theorems 22 and 28 without having to verify the equational properties by hand.
Theorem 29. With an adjunction as in Theorem 28, let S be an Elgot monad
on D. Then, the monad induced on the composition U SF is an Elgot monad.
Proof (Sketch). By Theorem 22, there exists a guarded iterative monad T and an
iteration-congruent retraction ρ : T Ñ S. By Theorem 28, the monad induced on
U T F is guarded iterative. Again by Theorem 22, it suffices to show that U ρF :
U T F Ñ U SF is an iteration-congruent retraction, which is straightforward. \
[
Example 30 (From Metric to CPO-based Iteration). As an example exhibiting sandwiching as well as the setting of Theorem 22, we compare two
iteration operators on Set that arise from different fixed-point theorems: Banach’s, for complete metric spaces, and Kleene’s, for complete partial orders,
respectively. We obtain the first operator by sandwiching Escardo’s metric lifting
monad S [12] in the adjunction between sets and bounded complete ultrametric
spaces (which forgets the metric in one direction and takes discrete spaces in the
other), obtaining a monad S̄ on Set. Given a bounded complete metric space
pX, dq, SpX, dq is a metric on the set pX ˆ Nq Y tKu. As we show in the appendix,
S is guarded iterative if we define f : pX, dq Ñ SpY, d1 q to be σ-guarded if k ą 0
whenever f pxq “ pσpyq, kq. By Theorem 28, S̄ is also guarded iterative (of course,
this can also be shown directly). The second monad arises by sandwiching the
identity monad on cpos with bottom in the adjunction between sets and cpos
with bottom that forgets the ordering in one direction and adjoins bottom in the
other, obtaining an Elgot monad L on Set according to Theorem 29. The latter
is unsurprising, of course, as L is just the maybe monad LX “ X ` 1.
The monad S̄ keeps track of the number of steps needed to obtain the final
result. We have an evident extensional collapse map ρ : S̄ Ñ L, which just
forgets the number of steps. One can show that ρ is in fact an iteration-congruent
retraction, so we obtain precisely the situation of Theorem 22.
7
Related Work
Alternatively to our guardedness relation on Kleisli morphisms, guardedness
can be formalized using type constructors [23] or, categorically, functors, as in
guarded fixpoint categories [20]; the latter cover also total guardedness, like we do.
Our approach is slightly more fine-grained, and in particular natively supports
the two variants of the dinaturality axiom (Figure 2), which, e.g., in guarded
14
fixpoint categories require additional assumptions [20, Proposition 3.15] akin to
the one we discuss in Remark 4.
A result that resembles our Theorem 26, due to Adámek et. al. [3], states
roughly that if C is locally finitely presentable and hyperextensive (e.g. C “ Set)
then the finitary Elgot monads are the algebras for a monad on the category
of endofunctors given by H ÞÑ LH “ ργ. p-- `1 ` Hγq where ρ takes rational
fixpoints (i.e. final coalgebras among those where every point generates a finite
subcoalgebra). Besides Theorem 26 making fewer assumptions on C, the key
difference is that, precisely by dint of this result, LH is already an Elgot monad;
contrastingly, we characterize Elgot monads as quotients of guarded iterative
monads, i.e. of monads where guarded recursive definitions have unique fixpoints.
8
Conclusions and Further Work
We have given a unified account of monad-based guarded and unguarded iteration
by axiomatizing the notion of guardedness to cover standard definitions of
guardedness, and additionally, as a corner case, what we call total guardedness,
i.e. the situation when all morphisms are declared to be guarded. We thus obtain
a common umbrella for guarded iterative monads, i.e. monads with unique iterates
of guarded morphisms, and Elgot monads, i.e. totally guarded monads satisfying
Elgot’s classical laws of iteration. We reinforce the view that the latter constitute
a canonical model for monad-based unguarded iteration by establishing the
following equivalent characterizations: provided requisite final coalgebras exist, a
monad T is Elgot iff
it satisfies the quasi-equational theory of iteration [2,15] (definition);
it is an iteration-congruent retract of a guarded iterative monad (Theorem 22);
it is an algebra pT, ρq of the monad T ÞÑ νγ. T pX ` γq in the category of
monads satisfying a natural delay cancellation condition (Theorem 26).
In future work, we aim to investigate further applications of this machinery, in
particular to examples which did not fit previous formalizations. One prospective
target is suggested by the work of Nakata and Uustalu [24], who give a coinductive
big-step trace semantics for a while-language. We conjecture that this work has
an implicit guarded iterative monad TR under the hood, for which guardedness
cannot be defined using the standard argument based on a final coalgebra
structure of the monad because TR is not a final coalgebra.
In type theory, there is growing interest in forming an extensional quotient of
the delay monad [9,4]. It is shown in [9] that under certain reasonable conditions,
a suitable collapse of the delay monad by removing delays is again a monad;
however, the proof is already quite complex, and proving directly that the collapse
is in fact an Elgot monad, as one would be inclined to expect, seems daunting.
We expect that Theorem 26 may shed light on this issue. A natural question that
arises in this regard is whether the subcategory of p--qν -algebras figuring in the
theorem is reflexive. A positive answer would provide a means of constructing
canonical quotients of p--qν -algebras (such as the delay monad) with the results
automatically being Elgot monads.
15
References
1. P. Aczel, J. Adámek, S. Milius, and J. Velebil. Infinite trees and completely iterative
theories: a coalgebraic view. Theoretical Computer Science, 300(1–3):1–45, 2003.
2. J. Adámek, S. Milius, and J. Velebil. Equational properties of iterative monads.
Inf. Comput., 208:1306 – 1348, 2010.
3. J. Adámek, S. Milius, and J. Velebil. Elgot theories: a new perspective of the
equational properties of iteration. Math. Struct. Comput. Sci., 21:417–480, 2011.
4. T. Altenkirch and N. Danielsson. Partiality, revisited. In Types for Proofs and
Programs, TYPES 2016, 2016.
5. R. Atkey. Parameterised notions of computation. J. Funct. Prog., 19:335, 2009.
6. J. Bergstra, A. Ponse, and S. Smolka, eds. Handbook of Process Algebra. Elsevier,
2001.
7. S. Bloom and Z. Ésik. Iteration theories: the equational logic of iterative processes.
Springer, 1993.
8. V. Capretta. General recursion via coinductive types. Log. Meth. Comput. Sci.,
1(2), 2005.
9. J. Chapman, T. Uustalu, and N. Veltri. Quotienting the delay monad by weak
bisimilarity. In Theoretical Aspects of Computing, ICTAC 2015, vol. 9399 of LNCS,
pp. 110–125. Springer, 2015.
10. C. Elgot. Monadic computation and iterative algebraic theories. In Logic Colloquium
1973, vol. 80 of Studies in Logic and the Foundations of Mathematics, pp. 175 – 230.
Elsevier, 1975.
11. C. Elgot, S. Bloom, and R. Tindell. On the algebraic atructure of rooted trees. J.
Comput. Syst. Sci., 16:362–399, 1978.
12. M. H. Escardó. A metric model of PCF. In Realizability Semantics and Applications,
1999.
13. Z. Ésik and S. Goncharov. Some remarks on Conway and iteration theories. CoRR,
abs/1603.00838, 2016.
14. S. Goncharov, S. Milius, and C. Rauch. Complete Elgot monads and coalgebraic
resumptions. In Mathematical Foundations of Programming Semantics, MFPS
2016, ENTCS, 2016.
15. S. Goncharov, C. Rauch, and L. Schröder. Unguarded recursion on coinductive
resumptions. In Mathematical Foundations of Programming Semantics, MFPS
2015, ENTCS, 2015.
16. S. Goncharov and L. Schröder. A coinductive calculus for asynchronous side-effecting
processes. Inf. Comput., 231:204 – 232, 2013.
17. W. Lawvere. Functorial semantics of algebraic theories. Proc. Natl. Acad. Sci. USA,
50:869–872, 1963.
18. S. Mac Lane. Categories for the Working Mathematician. Springer, 1971.
19. S. Milius. Completely iterative algebras and completely iterative monads. Inf.
Comput., 196:1–41, 2005.
20. S. Milius and T. Litak. Guard your daggers and traces: Properties of guarded
(co-)recursion. Fund. Inform. To appear.
21. E. Moggi. A modular approach to denotational semantics. In Category Theory and
Computer Science, CTCS 1991, vol. 530 of LNCS, pp. 138–139. Springer, 1991.
22. E. Moggi. Notions of computation and monads. Inf. Comput., 93:55–92, 1991.
23. H. Nakano. A modality for recursion. In Logic in Computer Science, LICS 2000,
pp. 255–266. IEEE Computer Society, 2000.
16
24. K. Nakata and T. Uustalu. A Hoare logic for the coinductive trace-based big-step
semantics of while. Log. Meth. Comput. Sci., 11(1), 2015.
25. M. Piróg and J. Gibbons. The coinductive resumption monad. In Mathematical
Foundations of Programming Semantics, MFPS 2014, vol. 308 of ENTCS, pp.
273–288, 2014.
26. M. Piróg and J. Gibbons. Monads for behaviour. In Mathematical Foundations of
Programming Semantics, MFPS 2013, vol. 298 of ENTCS, pp. 309–324, 2015.
27. A. Simpson and G. Plotkin. Complete axioms for categorical fixed-point operators.
In Logic in Computer Science, LICS 2000, pp. 30–41, 2000.
28. M. Smyth. Topology. In Handbook of Logic in Computer Science, vol. 1, pp. 641–761.
Clarendon Press, 1992.
29. T. Uustalu. Generalizing substitution. ITA, 37:315–336, 2003.
30. T. Uustalu and V. Vene. Primitive (Co)Recursion and Course-of-Value (Co)Iteration,
Categorically. Informatica (Lithuanian Academy of Sciences), 10(1):5–26, 1999.
17
A
Appendix: Omitted proofs
A.1
Proof of Proposition 3
It is immediate from (trv) that every trivially guarded morphism is guarded
under any guardedness relation making T into a guarded monad. It remains to
show that trivial guardedness is closed under the rules in Definition 1; in the
following we write f : X Ñσ T Y to mean that f is trivially σ-guarded.
• (trv): Immediate from the definition of trivial guardedness.
• (wkn): Suppose f : X Ñσ T Y , i.e. f “ pT σ 1 qg for some g : X Ñ T Y 1
where σ : Y 1
Y and σ 1 is a coproduct complement of σ : Z
Y . Moreover,
suppose θ : W
Z, and let θ1 : Z 1
Z be a coproduct complement of θ.
Then rσθ1 , σ 1 s : Z 1 ` Y 1 Ñ Y is a coproduct complement of σθ, and f factors as
g
T in
rσθ 1 ,σ 1 s
2
XÝ
Ñ T Y 1 ÝÝÝÑ
T pZ 1 ` Y 1 q ÝÝÝÝÝÑ T Y , so f is trivially σθ-guarded.
• (cmp): Suppose f : X Ñ2 T pY `Zq, i.e. f “ pT in1 q w for some w : X Ñ T Y .
Now, for g : Y Ñσ T V and h : Z Ñ T V , rg, hs‹ f “ g ‹ w. Let σ 1 : W
V
be a complement of σ : V 1
V . By assumption, g factors through T σ 1 , i.e.
w “ pT σ 1 qt for some t. Therefore rg, hs‹ f “ pT σ 1 q t‹ w which by definition means
that rg, hs‹ f is trivially σ-guarded.
• (sum): Suppose that f : X Ñσ T Z and g : X Ñσ T Z, i.e. f “ pT σ 1 qf 1 and
g “ pT σ 1 qg 1 for some f 1 : X Ñ T Z 1 and g 1 : X Ñ T Z 1 where σ : Z 1
Z and
σ 1 is a coproduct complement of σ. Then, of course, rf, gs “ pT σ 1 qrf 1 , g 1 s, i.e.
rf, gs : X ` Y
T Z.
\
[
A.2
Proof of Proposition 6
Let σ 1 : Z Ñ Y be the complement of σ : Y 1 Ñ Y and let h : Y Ñ Z ` Y 1 be the
inverse of rσ 1 , σs. Then
f : “ rη, f : s‹ f
“ rη, f : s‹ T prσ 1 , σs ` idq T ph ` idq f
“ rηrσ 1 , σs, f : s‹ T ph ` idq f
“ rησ 1 , rσ, f : ss‹ rrη in1 , η in2 in1 s h, η in2 in2 s‹ f.
Note that by (wkn), rrη in1 , η in2 in1 s h, η in2 in2 s‹ f : X Ñ2 T pZ ` pY 1 ` Xqq.
Since by (trv), ησ 1 “ pT σ 1 qη : Y 1 Ñσ T Y is σ-guarded, we are done by (cmp).
\
[
A.3
Proof of Theorem 10
1: We need to verify that weak guardedness is closed under the rules from
Definition 1.
18
(trv) Given a morphism f : X Ñ T Y , the following holds:
pT in1 qf “ pη in1 q‹ f
// Kleisli
“ prη in1 , ξs in1 q‹ f
// coproducts
“ rη in1 , ξs‹ pT in1 qf
// Kleisli
(wkn) Let rθ, θ1 s : V ` V 1 Ñ Z be an isomorphism. Assume that a morphism
f : X Ñσ T Y factors as rησ 1 , ξs‹ f 1 for some morphism f 1 . Then, the following
holds:
f “ rησ 1 , ξs‹ f 1
“ rηrσθ1 , σ 1 s in2 , ξs‹ f 1
1
1
// coproducts
‹
“ rηrσθ , σ s, ξs pT pin2 `idqqf
1
// Kleisli
(cmp) Given f : X Ñ2 T pY ` Zq, g : Y Ñσ T V , and h : Y Ñ T V , assume
that f factors as rη in1 , ξs‹ f 1 , while g factors as rησ 1 , ξs‹ g 1 . Then, the following
holds:
rg, hs‹ f “ rrησ 1 , ξs‹ g 1 , hs‹ rη in1 , ξs‹ f 1
“ prrησ 1 , ξs‹ g 1 , hs‹ rη in1 , ξsq‹ f 1
1
‹ 1
1
‹ 1
‹
// Klesli
1
‹ 1
‹
‹ 1
“ rrrησ , ξs g , hs η in1 , rrησ , ξs g , hs ξs f
1
‹ 1
‹
‹ 1
“ rrrησ , ξs g , hs in1 , rrησ , ξs g , hs ξs f
“ rrησ 1 , ξs‹ g 1 , rrησ 1 , ξs‹ g 1 , hs‹ ξs‹ f 1
‹ 1
1
1
‹ 1
1
1
// m-to-m morph.
‹ 1
˝ ‹ 1
“ rrησ , ξs g , rησ , ξs in2 rrησ , ξs g , hs s f
‹
1
// Kleisli
// coproducts
“ rrησ 1 , ξs‹ g 1 , ξrrησ 1 , ξs‹ g 1 , hs˝ s‹ f 1
1
// coproducts
‹ 1
˝ ‹ 1
“ rrησ , ξs g , rησ , ξs η in2 rrησ , ξs g , hs s f
“ prησ 1 , ξs‹ rg 1 , η in2 rrησ 1 , ξs‹ g 1 , hs˝ sq‹ f 1
“ rησ 1 , ξs‹ rg 1 , η in2 rrησ 1 , ξs‹ g 1 , hs˝ s‹ f 1
// coproducts
// Kleisli
// coproducts
// Kleisli
(sum) Given a morphism f : X Ñσ T Z and Y Ñσ T Z assume that f factors
as rη in1 , ξs‹ f 1 , and g factors as rη in1 , ξs‹ g 1 . Then, the following holds:
rf, gs “ rrησ 1 , ξs‹ f 1 , rησ 1 , ξs‹ g 1 s
1
‹
1
1
“ rησ , ξs rf , g s
// guardedness
// coproducts
2: Let f “ rη in1 , ξs‹ j for a morphism j : X Ñ T pY ` M pY ` Xqq. We define
an auxiliary morphism g “ rη in1 , js‹ ξ : M pY ` Xq Ñ T pY ` M pY ` Xqq. Note
that g is guarded since it can be rewritten as follows:
rη in1 , js‹ ξ “ ξrη in1 , js˝
// module-to-monad morphism
“ rη in1 , ξs in2 rη in1 , js˝
19
// coproducts
Thus, g is guarded in the sense of [19], so it has a unique solution g : : M pY `Xq Ñ
T Y . We use it to define a solution to f , namely f ; “ rη, g : s‹ j. It is left to show
that it is indeed a solution and that it is unique:
Solution:
f ; “ rη, g : s‹ j
“ rη, rη, g : s‹ gs‹ j
// solution
: ‹
‹
‹
“ rη, rη, g s rη in1 , js ξs j
“ rη, prη, g : s‹ rη in1 , jsq‹ ξs‹ j
: ‹
: ‹
// Kleisli
‹
‹
“ rη, rrη, g s η in1 , rη, g s js ξs j
:
: ‹
‹
// coproducts
‹
“ rη, rrη, g s in1 , rη, g s js ξs j
: ‹
‹
// Kleisli
‹
“ rη, rη, rη, g s js ξs j
// coproducts
: ‹
: ‹
‹
‹
“ rrη, rη, g s js in1 , rη, rη, g s js ξs j
: ‹
‹
: ‹
‹
: ‹
‹
// coproducts
‹
“ rrη, rη, g s js η in1 , rη, rη, g s js ξs j
‹
“ prη, rη, g s js rη in1 , ξsq j
: ‹
‹
// Kleisli
// coproducts
‹
“ rη, rη, g s js rη in1 , ξs j
// Kleisli
“ rη, f ; s‹ f
Uniqueness: Let r : X Ñ T Y be a solution of f , that is, it is the case that
r “ rη, rs‹ f . First, we calculate:
rη, rs‹ ξ “ rη, rη, rs‹ f s‹ ξ
“ rη, rη, rs‹ rη in1 , ξs‹ js‹ ξ
“ rη, prη, rs‹ rη in1 , ξsq‹ js‹ ξ
‹
‹
‹
// Kleisli
‹
“ rη, rrη, rs η in1 , rη, rs ξs js ξ
‹
‹
// coproducts
‹
“ rη, rrη, rs in1 , rη, rs ξs js ξ
// Kleisli
“ rη, rη, rη, rs‹ ξs‹ js‹ ξ
// coproducts
“ rrη, rη, rs‹ ξs in1 , rη, rη, rs‹ ξs‹ js‹ ξ
‹
‹
‹
‹
‹
‹
// coproducts
‹
“ rrη, rη, rs ξs η in1 , rη, rη, rs ξs js ξ
‹
“ prη, rη, rs ξs rη in1 , jsq ξ
“ rη, rη, rs‹ ξs‹ rη in1 , js‹ ξ
‹
// Kleisli
// coproducts
// Kleisli
‹
“ rη, rη, rs ξs g
Thus, rη, rs‹ ξ is a solution of g. By uniqueness, we obtain that g : “ rη, rs‹ ξ.
With this, we can check the uniqueness of f ; :
r “ rη, rs‹ f
20
“ rη, rs‹ rη in1 , ξs‹ j
“ prη, rs‹ rη in1 , ξsq‹ j
‹
// Kleisli
‹
‹
“ rrη, rs η in1 , rη, rs ξs j
“ rrη, rs in1 , rη, rs‹ ξs‹ j
‹
‹
“ rη, rη, rs ξs j
// Kleisli
// coproducts
: ‹
“ rη, g s j
“f
// coproducts
// the above
;
\
[
A.4
Proof of Proposition 7
The fact that f is in2 -guarded by assumption means that f “ pT in1 qg for
some g : X Ñ T Y . Then, of course, for any f : satisfying f : “ rη, f : s‹ f ,
f : “ rη, f : s‹ f “ rη, f : s‹ pT in1 qg “ g, i.e. f : can be taken to be g, and this
is the unique choice satisfying the fixpoint identity.
\
[
A.5
Proof of Proposition 16
Following [13], we consider a specific instance of uniformity:
f : “ rT pid ` in1 qf, gs: in1
(4)
where f : X Ñ2 T pY ` Xq and g : Z Ñ2 T pY ` pX ` Zqq and prove the following
instance of Bekić identity:
rT pid ` in1 qf, T pid ` in1 qgs: “ rf : , rη, f : s‹ gs
(5)
where f : X Ñ2 T pY ` Xq and g : Z Ñ2 T pY ` Xq. Indeed, on the one hand,
by (4),
f : “ rT pid ` in1 qf, T pid ` in1 qgs: in1 ,
(6)
and on the other hand
rT pid ` in1 qf, T pid ` in1 qgs: in2
“ rη, rT pid ` in1 qf, T pid ` in1 qgs: s‹
rT pid ` in1 qf, T pid ` in1 qgs in2
// fixpoint
: ‹
“ rη, rT pid ` in1 qf, T pid ` in1 qgs s T pid ` in1 qg
“ rη, rT pid ` in1 qf, T pid ` in1 qgs: in1 s‹ g
“ rη, h: s‹ g.
// (6)
As the result we obtain (5). Analogously, we prove another instance of Bekić
identity, which is
rT pid ` in2 qf, T pid ` in2 qgs: “ rrη, g : s‹ f, g : s
21
(7)
where f : X Ñ2 T pY ` Zq and g : Z Ñ2 T pY ` Zq. Under the further axioms
we are assuming these two instances imply the full Bekić identity:
rT rid ` in1 , in2 s‹ f, T rid ` in1 , in2 s‹ gs: “ rh: , rη, h: s‹ g : s
(8)
where f : X Ñ12,2 T ppY ` Xq ` Zq and g : Z Ñ12,2 T ppY ` Xq ` Zq and
h “ rη, g : s‹ f : X Ñ T pY ` Xq. Let us argue briefly, that h is in2 -guarded. Note
that the assumption for f implies that f 1 “ T rid`in1 , in2 s f : X Ñ T pY `pX `Zqq
is in2 -guarded and therefore h “ rη in1 , rη in1 , g : ss‹ f 1 is in2 -guarded by (cmp).
Now, the proof of (8) runs as follows:
rT rid` in1 , in2 s f, T rid ` in1 , in2 s gs:
`
˘:
“ T rid, in2 s rT ppid ` in1 q ` in2 q f, T ppid ` in1 q ` in2 q gs
“ rT ppid ` in1 q ` in2 q f, T ppid ` in1 q ` in2 q gs::
// codiagonal
: ‹
“ rrη, pT ppid ` in1 q ` idq gq s T ppid ` in1 q ` idq f,
pT ppid ` in1 q ` idq gq: s:
// (7)
: ‹
“ rrηpid ` in1 q, pT ppid ` in1 q ` idq gq s f,
pT ppid ` in1 q ` idq gq: s:
// naturality
“ rT pid ` in1 q rη, g : s‹ , T pid ` in1 q g : s:
“ rT pid ` in1 q h, T pid ` in1 q g : s:
“ rh: , rη, h: s‹ g : s.
// (5)
Finally, let us derive dinaturality from (8). Suppose that g : X Ñ2 T pY ` Zq
and h : Z Ñ T pY ` Xq satisfy either guardedness premise of the dinaturality
axiom and let us form
s “ rη in1 , gs‹ h : Z Ñ2 T pY ` Zq,
t “ rη in1 , hs‹ g : X Ñ2 T pY ` Xq,
w “ T pin1 `idq s : Z Ñ12,2 T ppY ` Xq ` Zq,
u “ T pin1 `idq g : X Ñ12,2 T ppY ` Xq ` Zq.
By naturality, w: “ pT in1 qs: and therefore,
prη, w: s‹ uq: “ prη in1 , pT in1 q w: s‹ gq:
“ prη in1 , pT in1 qs: s‹ gq:
“ rη, prη in1 , pT in1 qs: s‹ gq: s‹ rη in1 , pT in1 qs: s‹ g
“ rη, s: s‹ g.
By instantiating f in (8) with u and g with w we obtain:
rT pid ` in1 q t, T pid ` in2 q gs: “ rrη, s: s‹ g, s: s.
22
Note that by (4),
rT pid ` in1 q t, T pid ` in2 q gs: in1 “ t: ,
and therefore
rη, s: s‹ g “ t: ,
which was our goal. The case of in2 -guarded h is derived analogously.
A.6
\
[
Proof of Theorem 17
By Proposition 16 we need to verify naturality, codiagonal and uniformity.
Naturality. Let f : X Ñ2 T pY ` Xq and g : Y Ñ T Z. Then
g ‹ f : “ g ‹ rη, f : s‹ f
“ rg ‹ η, g ‹ f : s‹ f
“ rg, g ‹ f : s‹ f
“ rη, g ‹ f : s‹ rpT in1 q g, η in2 s‹ f.
Since the same equation uniquely characterizes prpT in1 q g, η in2 s‹ f q: the
latter is equal to g ‹ f : .
Codiagonal. Let f : X Ñ12,2 T ppY ` Xq ` Xq. Then
pf : q: “ rη, pf : q: s‹ f :
“ rη, pf : q: s‹ rη, f : s‹ f
“ rrη, pf : q: s, rη, pf : q: s‹ f : s‹ f
“ rrη, pf : q: s, pf : q: s‹ f
“ rη, pf : q: s‹ T rin2 , ids f.
Therefore pf : q: satisfies the fixpoint identity for pT rin2 , ids f q: and thus
pf : q: “ pT rin2 , ids f q: .
Uniformity. Suppose that f h “ T pid ` hq g for some f : X Ñ2 T pY ` Xq,
g : Z Ñ2 T pY ` Zq and h : Z Ñ X. Then
f : h “ rη, f : s‹ f h “ rη, f : s‹ T pid ` hq g “ rη, f : hs‹ g,
that is f : h satisfies the fixpoint equation for g : . Hence g : “ f : h.
A.7
\
[
Proof of Theorem 19
Since T satisfies the fixpoint identity, rη, pυf q: s‹ υf “ pυf q: and therefore,
f ; “ ρ pυf q:
“ ρ rη, pυf q: s‹ υf
“ rρη, ρpυf q: s‹ ρυf
; ‹
“ rη, f s f.
// ρ is a mon. morph.
// since ρυ “ id
\
[
23
A.8
Proof of Theorem 21
Recall that under our assumptions (2) is equivalent to (3).
1. Naturality:
g ‹ f ; “ g ‹ ρ pυ f q:
“ pρυ gq‹ ρ pυ f q:
// since ρυ “ id
“ ρ pυ gq‹ pυ f q:
// ρ is a mon. morph.
‹
:
// naturality for --:
“ ρ prpT in1 q υ g, η in2 s υ f q
“ ρ pυρ rpT in1 q υ g, η in2 s‹ υ f q:
‹
“ ρ pυrρ pT in1 q υ g, η in2 s ρ υ f q
‹
“ ρ pυrpS in1 q g, η in2 s f q
‹
// (3)
:
// ρ is a mon. morph.
:
// since ρυ “ id
;
“ prpS in1 q g, η in2 s f q .
2. Dinaturality: First observe that it follows from the fact that ρ is a monad
morphism and ρυ “ id that ρυrη in1 , hs‹ g “ ρrη in1 , υhs‹ υg, and therefore,
by (2) that
ρpυrη in1 , hs‹ gq: “ ρprη in1 , υhs‹ υgq: .
(9)
Then we obtain the goal as follows:
prη in1 , hs‹ gq; “ ρpυrη in1 , hs‹ gq:
“ ρprη in1 , υhs‹ υgq:
// (9)
‹
: ‹
“ ρrη, prη in1 , υgs υhq s υg
// dinaturality for --:
“ rη, ρprη in1 , υgs‹ υhq: s‹ ρυg
// ρ is a mon. morph.
‹
: ‹
“ rη, ρprη in1 , υgs υhq s g
‹
: ‹
“ rη, ρpυrη in1 , gs hq s g
‹
// since ρυ “ id
// analog. to (9)
; ‹
“ rη, prη in1 , gs hq s g.
3. Codiagonal:
pf ; q; “ ρ pυρpυ f q: q:
“ ρ ppυ f q: q:
// (3)
:
“ ρ pT rid, in2 s υ f q
“ ρ pυρ T rid, in2 s υ f q:
:
“ ρ pυ Srid, in2 s f q
“ pSrid, in2 s f q; .
4. Uniformity: Suppose that f h “ Spid ` hq g. Then
υ f h “ υ Spid ` hq g
24
// codiagonal for --:
// (3)
// since ρυ “ id
“ υ Spid ` hq ρυ g
“ T pid ` hq υ g
and therefore pυ f q: h “ pυ gq: . This implies f ; h “ g ; by definition.
A.9
\
[
Proof of Theorem 13
By currying we can equivalently see # as a functor from D to the category of
parametrized guarded monads of type C ˆ C Ñ C. It therefore suffices to show
that the assignment
# ÞÑ z#
where
z# X “ νγ. X # γ
and f : X Ñ z# Y is σ-guarded iff out f : X Ñ Y # z# Y is σ-guarded, where
out : z# X Ñ X # z# X
is the coalgebra structure of z# X, induces a functor N from parametrized guarded
monads of type C ˆ C Ñ C to guarded monads over C. Uustalu [29] already
proves that z# is a monad; we proceed to check that his construction is in fact
functorial.
We denote the monad structure on z# by η ν , p--q6 . These data are uniquely
determined by commutation of
X
ν
ηX
ηX,X
X#X
out
X#ηX
X#z# X
rf 6 ,ids
z# X ` z# Y
z# X
z# Y
rfˆ,pY # in2 q outs
out
Y #pz# X ` z# Y q
Y #rf § ,ids
Y #pz# Y q
where
¯‹
f
X# in1
out
fˆ “ z# X ÝÝÑ X#z# X ÝÝÝÝÑ
X#pz# X`z# Y q ÝÝÑ Y #pz# X ` z# Y q
with
f
Y # in2
out
f¯ “ X Ý
Ñ z# X ÝÝÑ X#z# X ÝÝÝÝÑ
Y #pz# X ` z# Y q.
ν
That is, ηX
is the unique pX # --q-coalgebra morphism pX, ηX,X q Ñ pz# X, outq,
§
and rf , ids is the unique pY # --q-coalgebra morphism
pz# X ` z# Y, rfˆ, pY # in2 q outsq Ñ pz# Y, outq,
the latter being essentially a definition of f § by primitive corecursion. In the
sequel, we will omit the object part of coalgebras when convenient, saying, e.g.,
ν
that ηX
is a coalgebra morphism ηX,X Ñ out.
We need to define the action of N on morphisms: Let #1 be a further
parametrized monad, with all data of #1 and z#1 indicated by primes, and
let
α : # Ñ #1
25
be a parametrized monad morphism. We then define a monad morphism zα :
z# Ñ z#1 by commutation of
pzα qX
z# X
z#1 X
αX,X out
X #1 z# X
out1
X#pzα qX
X#1 z#1 X,
i.e. pzα qX is the unique pX #1 --q-coalgebra morphism pz# X, α outq Ñ pz#1 X, out1 q.
We first check functoriality of z. For preservation of identities, just note that
id : pz# X, id outq Ñ pz# X, outq is a coalgebra morphism. For preservation of composition, we have that if β : #1 Ñ #2 is a further parametrized monad morphism
then by naturality of β, the pX #1 --q-coalgebra morphism pzα qX : α out Ñ out1
is also an pX #2 --q-coalgebra morphism βα out Ñ β out1 ; so pzβ qX pzα qX is a
coalgebra morphism βα out Ñ out2 , and hence equals pzβα qX .
It remains to verify that zα is indeed a monad morphism. First, we show
compatibility with the unit, i.e.
ν
ν
pzα qX ηX
“ η 1 X : X Ñ z#1 X.
ν
We note that by naturality of α, the pX #--q-coalgebra morphism ηX
: ηX,X Ñ out
1
1
ν
is also an pX # --q-coalgebra morphism ηX,X “ αηX,X Ñ α out, so that pzα qX ηX
ν
1
is a coalgebra morphism ηX,X
Ñ out1 and hence equals η 1 X .
For compatibility of zα with Kleisli lifting, we have to show that for f : X Ñ
z# Y ,
1
pzα f q§ zα “ zα f § .
We strengthen this goal to one concerning rf § , ids, specifically we show that
rf § ,ids
z# X ` z# Y
z# Y
pzα qX `pzα qY
pzα qY
1
z#1 X ` z#1 Y
rppzα qY f q§ ,ids
z#1 Y
commutes. By definition, the bottom arrow is a Y #1 p--q-coalgebra morphism
1
1
1
{
rpz
α qY f , pY # in2 q out s Ñ out ,
and by now-familiar arguments, the top and right-hand arrows compose to yield
a Y #1 p--q-coalgebra morphism
rαfˆ, αpY # in2 q outs Ñ out1 .
It therefore suffices to show that
1
1
{
pzα qX ` pzα qY : rαfˆ, αpY # in2 q outs Ñ rpz
α qY f , pY # in2 q out s
26
is a Y #1 p--q-coalgebra morphism. We first check commutation of the corresponding
square on the right hand summand z# Y :
pY #1 ppzα qX ` pzα qY qqαpY # in2 q out
“ pY #1 ppzα qX ` pzα qY qqpY #1 in2 qα out
1
// naturality of α
1
“ pY # in2 qpY # pzα qY qα out
“ pY #1 in2 q out1 pzα qY
// definition of zα .
For commutation on the left hand summand we have to show that
{
pY #1 ppzα qX ` pzα qY qq αfˆ “ pz
α qY f pzα qX .
(10)
We rewrite the left hand side of (10):
pY #1 ppzα qX ` pzα qY qqαfˆ
“ pY #1 ppzα qX ` pzα qY qqαf¯‹ pX# in1 q out
1
“ pY #1 ppzα qX ` pzα qY qqpαf¯q‹ αpX# in1 q out
// definition of fˆ
// α a monad morphism
1
“ pY #1 ppzα qX ` pzα qY qqpαf¯q‹ pX#1 in1 qα out
// naturality of α.
We next rewrite the right hand side of (10):
{
pz
α qY f pzα qX
‹1
“ pzα qY f pX#1 in1 q out1 pzα qX
{
// definition of pz
α qY f
‹1
“ pzα qY f pX#1 in1 qpX#1 pzα qX q α out
{
// definition of pz
α qY f
‹1
“ pzα qY f pX#1 ppzα qX ` pzα qY qqpX #1 zin1 q α out
It thus suffices to show that
‹1
1
pY #1 ppzα qX ` pzα qY qqpαf¯q‹ “ pzα qY f pX#1 ppzα qX ` pzα qY qq.
(11)
We further rewrite the right hand side of (11):
‹1
pzα qY f pX#1 ppzα qX ` pzα qY qq
1
“ ppY #1 in2 q out1 pzα qY f q‹
pX#1 ppzα qX ` pzα qY qq
1
// definition of pzα qY f
‹1
1
“ ppY # in2 qpY # pzα qY qα out f q
pX#1 ppzα qX ` pzα qY qq
1
// definition of pzα qY
1
“ ppY # ppzα qX ` pzα qY qqpY # in2 q α out f q
‹1
pX#1 ppzα qX ` pzα qY qq
1
“ pY #1 ppzα qX ` pzα qY qqppY #1 in2 q α out f q‹
27
where we use in the last step that Y #1 ppzα qX ` pzα qY q is a monad morphism.
We have thus reduced (11) to showing that
αf¯ “ pY #1 in2 qα out f.
But this is straightforward:
αf¯ “ α pY # in2 q out f
1
“ pY # in2 q α out f
// definition of f¯
// naturality of α.
Next, we need to check the axioms of guarded monads for z# .
(trv) Let f : X Ñ z# Y . Then
outpz# in1 qf “ pin1 #pz# in1 qq out f.
By (trv) for #, outpz# in1 qf is in2 -guarded, and thus, by definition so is
pz# in1 qf .
(wkn) Let f : X Ñσ z# Y , which by definition means that out f : X Ñσ
Y # pz# Y q. By (wkn) for #, out f is σθ-guarded and hence, by definition,
so is f .
(cmp) Let f : X Ñ2 z# pY ` Zq, g : Y Ñσ z# V , h : Z Ñ z# V . Then we
obtain
out rg, hs‹ f “ rout g, out hs‹ pid # prg, hs‹ qq out f.
By assumption out f is in2 -guarded, and therefore, since # is a parametrized
guarded monad, so is pid # prg, hs‹ qq out f . Also, by assumption, out h is σguarded. By (cmp) for #, this implies that the composite rout g, out hs‹ pid#
prg, hs‹ qq out f is σ-guarded and thus so is rg, hs‹ f .
(sum) Let fi : Xi Ñσ z# Y for i “ 1, 2, which by definition means that
out fi : Xi Ñσ Y #pz# Y q. By (sum) for #, outrf1 , f2 s “ rout f1 , out f2 s :
Xi Ñσ Y #pz# Y q, so that rf1 , f2 s : X1 ` X2 Ñσ z# Y as required.
This shows that z# is indeed a guarded monad; it remains to show that given
a parametrized guarded monad morphism α : # Ñ #1 as above, the monad
morphism zα preserves guardedness. That is, for f : Z Ñσ z# V we have to show
that zα f : Z Ñσ z#1 V , i.e. that out zα f is σ-guarded. Indeed, by definition of zα ,
out zα f “ pid # zα q α out f.
By assumption, out f is σ-guarded and hence, since # is a parametrized guarded
monad and α is a parametrized guarded monad morphism, so is pid # zα q α out f .
\
[
A.10
Proof of Theorem 22
Direction (ð) immediately follows from Theorems 21 and 17.
28
In order to prove (ñ), we show that S “ pS, η, --‹ , --: q is an iteration-congruent
retract of Sν “ pνγ. Sp-- `γq, η ν , --‹ , --; q. We define υX “ out -1 η in2 out -1pS in1 q
and
`
˘:
out
ρX “ S ν X ÝÝÑ SpX ` T Xq .
Clearly, υf is σ-guarded for every f : X Ñ SY and υ is left inverse to ρ, for
ρυ “ out: out -1 η in2 out -1pS in1 q
“ rη, ρs‹ out out -1 η in2 out -1pS in1 q
// fixpoint for --:
“ ρ out -1pS in1 q
“ rη, ρs‹ out out -1pS in1 q
// fixpoint for --:
“ η‹
“ id.
It follows straightforwardly by naturality of --: that ρ is a natural transformation.
Note the following property of ρ: for any h : X Ñ SpY ` Xq, outpcoit hq “
Spid ` coit hq h, and hence, by uniformity
ρpcoit hq “ h: .
(12)
Let us verify that ρ is a monad morphism. For one thing
ρη ν “ rη, ρs‹ out η ν “ rη, ρs‹ η in1 “ η.
Next, we have to check that ρf 6 “ pρf q‹ ρ for any f : X Ñ S ν Y . Note that
`
˘
f 6 “ coit rrη in1 , Spid ` S ν in1 q out f s, η in2 s‹ out pS ν in2 q.
Therefore
`
˘
ρf 6 “ ρ coit rrη in1 , Spid ` S ν in1 q out f s, η in2 s‹ out pS ν in2 q
`
˘:
“ rrη in1 , Spid ` S ν in1 q out f s, η in2 s‹ out pS ν in2 q
`
“ Srid, in2 s rpS in1 q rη in1 , Spid ` S ν in1 q out f s,
˘:
η in2 s‹ out pS ν in2 q
`
“ prpS in1 q rη in1 , Spid ` S ν in1 q out f s,
˘:
η in2 s‹ outq: pS ν in2 q
ν
‹
ν
‹
: :
ν
“ prη in1 , Spid ` S in1 q out f s out q pS in2 q
:
// (12)
// codiagonal
// naturality
ν
“ prη in1 , Spid ` S in1 q out f s ρq pS in2 q
“ rη, prη in1 , ρs‹ Spid ` S ν in1 q out f q: s‹ ρ pT in2 q
‹
ν
: ‹
“ rη, prη in1 , ρs Spid ` S in1 q out f q s pS in2 q ρ
“ pprη in1 , ρs‹ Spid ` S ν in1 q out f q: q‹ ρ
“ pppS in1 q rη, ρs‹ out f q: q‹ ρ
29
// dinaturality
“ pppS in1 q ρf q: q‹ ρ
“ prη, ppS in1 q ρf q: s‹ pS in1 q ρf q‹ ρ
// fixpoint
‹
“ pρf q ρ.
Finally, let us check that ρ is an iteration congruence. Let f, g : X Ñ2 S ν pY ` Xq,
which means that there are f 1 , g 1 : X Ñ SpY ` S ν pX ` Y qq such that out f “
Spin1 `idqf 1 and out f “ Spin1 `idqg 1 . Suppose that ρf “ ρg, which amounts to
rη in1 , ρs‹ f 1 “ rη in1 , ρs‹ g 1 ,
(13)
for
ρf “ rη, ρs‹ out f “ rη, ρs‹ Spin1 `idqf 1 “ rη in1 , ρs‹ f 1
and analogously for g. Our goal is to prove that
ρf ; “ rη, prη in1 , ρs‹ f 1 q; s‹ η in2
from which ρf : “ ρg : will follow from the analogous formula for ρg : and (13).
Observe that
f ; “ pcoit hq η ν in2
where h “ rrη in1 , f 1 s, η in2 s‹ out. Now
ρf ; “ ρ pcoit hq η ν in2
“ h: η ν in2
// (12)
1
‹
:
ν
“ prrη in1 , f s, η in2 s outq η in2
“ pSrid, in2 s rrη in1 in1 , pS in1 qf 1 s, η in2 s‹ outq: η ν in2
“ pprrη in1 in1 , pS in1 qf 1 s, η in2 s‹ outq: q: η ν in2
1
‹
: :
// codiagonal
ν
“ pprpS in1 qrη in1 , f s, η in2 s outq q η in2
“ prη in1 , f 1 s‹ out: q: η ν in2
1 ‹
:
// naturality
ν
“ prη in1 , f s ρq η in2
“ rη, prη in1 , ρs‹ f 1 q: s‹ ρ η ν in2
// dinaturality
‹ 1 : ‹ ν
“ rη, prη in1 , ρs f q s η in2
and we are done.
A.11
\
[
Proof of Theorem 23
It is already shown in Theorem 13 that ρν is a monad morphism.
Let us define υ ν “ coitpυ outq. Then it is easy to check that ρν υ ν “ id: since
out ρν υ ν “ pid #̂ ρν q ρ out υ ν
30
“ pid #̂ ρν q ρpid # υ ν q υ out
“ pid #̂ ρν qpid #̂ υ ν q ρυ out
“ pid #̂ ρν υ ν q out .
and also out id “ pid #̂ idq out, ρν υ ν must be equal id.
Suppose that f : X Ñ Y #̂ν Z is σ-guarded and let us show that so is
ν
υ f : X Ñ Y #ν Z. According to Theorem 13, this means that out f is σ-guarded.
Now
out υ ν f “ pid # υ ν q υ out f
is σ-guarded because by assumption υ out f is σ-guarded and id # υ ν is a
parametrized guarded monads morphism. Hence, again, according to Theorem 13,
υ ν f is σ-guarded. We thus proved that ρν is a guarded retraction.
We are left to check that ρν is an iteration congruence. Suppose that ρν f “ ρν g
for some f, g : X Ñ2 pY ` Xq #ν Z. Then
ρ pid # ρν q out f “ pid #̂ ρν q ρ out f “ out ρν f
and analogously for g, so by applying the assumption that ρ is an iteration
congruence, we obtain
ρ ppid # ρν q out f q: “ ρ ppid # ρν q out gq: .
(14)
Observe that for suitably typed h,
out coitpρ outq pcoit hq “ pid #̂ coitpρ outqq ρ out pcoit hq
“ pid #̂ coitpρ outqq ρ pid # pcoit hqq h
“ pid #̂ coitpρ outq pcoit hqq ρ h,
and therefore, by finality of coitpρhq,
coitpρ outq pcoit hq “ coitpρhq.
(15)
Therefore,
ρν f ; “ ρν coitprη, pout f q: s‹ outq η in2
// Theorem 13
: ‹
“ coitpρ outq coitprη, pout f q s outq η in2
“ coitpρrη, pout f q: s‹ outq η in2
ν
: ‹
// (15)
ν
“ coitprη, ρ ppid # ρ q out f q s outq ρ η in2 .
The last step is due to the finality of coitprη, ρ pout f q: s‹ ρ outq and the following
calculation:
out coitprη, ρ ppid # ρν q out f q: s‹ outq ρν
“ pid #̂ coitprη, ρ ppid # ρν q out f q: s‹ outqq
31
rη, ρ ppid # ρν q out f q: s‹ out ρν
“ pid #̂ coitprη, ρ ppid # ρν q out f q: s‹ outqq
ρ rη, ppid # ρν q out f q: s‹ pid # ρν q out
// ρ is a monad morph.
“ pid #̂ coitprη, ρ ppid # ρν q out f q: s‹ outqq
ρ pid # ρν q rη, pout f q: s‹ out
// id # ρν is a monad morph.
“ pid #̂ coitprη, ρ ppid # ρν q out f q: s‹ outq ρν q
ρ rη, pout f q: s‹ out .
An analogous calculation can be done for ρν g ; and therefore by (14), ρν f ; “ ρν g ; .
\
[
A.12
Proof of Theorem 26
We fix the notation pη, --‹ , :q for (potential) Elgot monads over C and pη ν , --6 , ;q
for their p--qν -transforms. We recored the following identity, satisfied by any
monad morphism ρ for which ρη “ id and ρ “ ρ:
ρ “ rη, ρs‹ out .
(16)
Indeed,
rη, ρs‹ out “ rη, ρs‹ ρη out
// for ρη “ id
‹
“ rη, ρ s ρη out
// for ρ “ ρ
“ ρ rη, s6 η out
// ρ is mon. morh.
“ ρ rη, s6 out -1pS in1 q out
“ ρ out -1 routrη, ids, η in2 rη, ids6 s‹ pS in1 q out
“ ρ out -1 rη in1 , η in2 s‹ out
“ ρ.
Let S be an Elgot monad, hence by construction from Theorem 22, it is an
iteration-congruent retract of Sν with S ν “ νγ. SpX ` γq, and more specifically,
υ “ η is a left inverse to ρ “ out: .
First of all, it is easy to see that ρ “ ρ:
ρ “ rη, ρs‹ out “ rη, ρs‹ η in2
“ ρ.
We need to show the axioms of p--qν -algebras:
ρη “ id
and
32
ρµ “ ρρν
(17)
where ρν “ coitpρ outq : S νν Ñ S ν . As for the left one we readily have id “ ρυ “
ρ η “ ρη. The right axiom is shown as follows:
`
˘; piiiq
piq
piiq
ρµ ““ ρrη, p outq; s6 out ““ ρ out -1 Spin1 `η in2 qρ out ““ ρρν .
To show transition (i), first observe that
`
˘
µ “ coit Srid ` out, in2 s out out
`
˘
Indeed, let t “ coit Srid ` out, in2 s out . Then
out t out “ Spid ` tq Srid ` out, in2 s out out
“ Srid ` t out, t in2 s out out
“ Spid ` t outq Srid, in2 out -1s out out,
which means that t out satisfies the equation uniquely characterizing µ, hence
µ “ t out. On the other hand, rη, p outq; s6 satisfies the equation characterizing t.
In order to see that, note that
outp outq; “ η in2 rη ν , p outq; s6
(18)
and therefore
outrη ν , p outq; s6 “ routrη ν , p outq; s, η in2 rη ν , p outq; s6 s‹ out
“ routrη ν , p outq; s, η in2 rη ν , p outq; s6 s‹ out
“ Spid ` rη ν , p outq; s6 q Srid ` out, in2 s out
// (18)
In summary we obtain
`
˘
µ “ coit Srid ` out, in2 s out out “ rη ν , p outq; s6 out,
which justifies (i). Let us check (iii). Let us denote out -1 Spin1 `η ν in2 qρ out by t.
Then
out t; “ outrη ν , t; s6 out -1 Spin1 `η ν in2 qρ out
“ routrη ν , t; s, η in2 rη ν , t; s6 s‹ Spin1 `η ν in2 qρ out
“ rout η ν , η in2 t; s‹ ρ out
“ Spid ` t; qρ out,
and therefore t; satisfies the equation characterizing ρν , hence ρν “ t; . Finally,
we proceed with the proof of (ii). Using the fact that ρ is a monad morphism
and that it cancels , we obtain that
ρrη, p outq; s6 “ rη, ρ p outq; s6 ρ
“ rη, ρ p outq; s6 ρ 33
“ ρrη, p outq; s6 ρ “ ρp outq; .
In order to finish the proof of (ii), it suffices to check that
ρ out “ ρ out -1 Spin1 `η in2 qρ out
(19)
and call the assumption that ρ is an iteration congruence. The proof of (19) runs
as follows:
ρ out -1 Spin1 `η in2 qρ out “ rη, ρs‹ out out -1 Spin1 `η in2 qρ out
“ rη, ρs‹ Spin1 `η in2 qρ out
“ rη in1 , ρη in2 s‹ ρ out
“ ρ out
“ ρ out .
Suppose that α : S Ñ T is an Elgot monad morphism, i.e. a monad morphism such
that αf : “ pαf q: , and let us show that it is also a morphism of the corresponding
p--qν -algebras, i.e. αρ “ ραν . Indeed, on the one hand αρ “ α out: “ pα outq: ,
and also on the other hand, by uniformity of --: , ραν “ out: αν “ pα outq: , for
out αν “ T pid ` αν qα out.
We proceed with the other direction of the claim. Assume that pS, ρq is a
p--qν -algebra, i.e. the laws (17) are satisfied, and ρ “ ρ and let us show that
S equipped with the iteration operation f : “ ρpcoit f q is an Elgot monad by
verifying the axioms.
• Fixpoint. Let f : X Ñ SpY ` Xq. Then f ; “ ρpcoit f q and hence
f ; “ ρpcoit f q
“ rη, ρs‹ outpcoit f q
“ rη, ρs‹ Spid ` coit f qf
// (16)
‹
“ rη, ρ coit f s f
“ rη, f ; s‹ f.
• Naturality. Let f : X Ñ SpY ` Xq and g : Y Ñ SZ. Then
g ‹ f : “ g ‹ ρpcoit f q “ ρ pηgq6 pcoit f q,
prpT in1 q g, η in2 s‹ f q: “ ρ coitprpT in1 q g, η in2 s‹ f q.
We are left to show that pηgq6 pcoit f q
coitprpS in1 q g, η in2 s‹ f q. This runs as follows:
satisfies
the
equation
outpηgq6 pcoit f q “ rout η g, η in2 pηgq6 s‹ outpcoit f q
“ rpS in1 qg, η in2 pηgq6 s‹ Spid ` coit f qf
“ rpS in1 qg, η in2 pηgq6 coit f s‹ f
“ Spid ` pηgq6 pcoit f qq rpS in1 q g, η in2 s‹ f.
34
for
• Coadiagonal. Let f : X Ñ SppY ` Xq ` Xq.
f :: “ ρpcoit ρpcoit f qq
“ ρ ρν pcoitpcoit f qq
// definition of ρν
“ ρ µpcoitpcoit f qq.
// (17)
Since by definition, pSrid, in2 s f q: “ ρ coitpSrid, in2 s f q, we are only left to check
that coitpSrid, in2 s f q “ µpcoitpcoit f qq. This is easy to establish directly by
showing that the right hand side satisfies the equation characterizing the left one:
out µ coitpcoit f q
“ Spid ` µqSrid, in2 out -1s out out coitpcoit f q
“ Srid ` µ, in2 µ out -1s out out coitpcoit f q
“ Srid ` µ, in2 µ out -1s
Spid ` coitpcoit f q ` S ν pid ` coitpcoit f qqq Spid ` coit f qf
“ Srid ` µ coitpcoit f q, in2 µ out -1 S ν pid ` coitpcoit f qqpcoit f qs f
“ Srid ` µ coitpcoit f q, in2 µ coitpcoit f qs f
“ Spid ` µ coitpcoit f qq Srid, in2 s f.
• Uniformity. Let f : X Ñ T pY ` Xq, g : Z Ñ SpY ` Zq, h : Z Ñ X and
suppose that f h “ T pid ` hq g. If follows standardly by the finality argument
that pcoit f q h “ coit g and therefore
f ; h “ ρ pcoit f q h
“ ρ pcoit gq
“ g; .
Finally, let us check that a p--qν -algebra morphism α : T Ñ S is an Elgot
monad morphism. As a premise we have that αρ “ ραν , and therefore, for every
f : X Ñ SpY ` Xq, αf : “ αρpcoit f q “ ραν pcoit f q “ ρ coitpα outqpcoit f q. It is
then straightforward to verify that ρ coitpα outqpcoit f q “ ρ coitpαf q “ pαf q: . \
[
A.13
Proof of Theorem 28
First, we need to verify that the defined guardedness relation satisfies the rules
from Definition 1. Note that since left adjoints preserve coproducts (LAPC),
without loss of generality we assume that F pX ` Y q “ F X ` F Y .
(trv) Let f : X Ñ U T F Y be a morphism. By (trv) for T, it is the case that
pT in1 qpΦ´1 f q : F X Ñσ T pF Y ` F Xq. Then, the following holds:
pT in1 qpΦ´1 f q “ pT F in1 qpΦ´1 f q
´1
“Φ
ppU T F in1 qf q
// LAPC
// Φ is a natural isomorphism
Thus, it is the case that Φ´1 ppU T F in1 qf q : F X Ñσ T pF Y ` F Xq, so
pU T F in1 qf : X Ñσ U T F pY ` Xq.
35
(wkn) Let f : X Ñσ U T F Y . Then, Φ´1 f : F X Ñσ T F Y in T. By (wkn)
we obtain Φ´1 f : F X Ñσθ T F Y in T, hence f : X Ñσθ U T F Y in the monad
on U T F .
(cmp) Let f : X Ñ2 U T F pY ` Zq, g : Y Ñσ U T F V , and h : Z Ñ U T F V
be morphisms. Then, by (cmp) for T, we obtain that rΦ´1 g, Φ´1 hs‹ pΦ´1 f q :
F X Ñσ T F V . Then, the following holds:
rΦ´1 g, Φ´1 hs‹ pΦ´1 f q
“ µT pT rΦ´1 g, Φ´1 hsqpΦ´1 f q
“ µT pΦ´1 pU T rΦ´1 g, Φ´1 hsqf q
´1
“Φ
´1
“Φ
´1
T
ppU µ qpU T rΦ
´1
T
ppU µ qpU T Φ
g, Φ
´1
hsqf q
“Φ
´1
“Φ
UT F
pµ
// Φ is a nat. iso.
rg, hsqf q
“ Φ´1 ppU µT qpU T Φ´1 idqpU T F rg, hsqf q
´1
// Φ is a nat. iso.
// LAPC
// Φ is a nat. iso.
pU T F rg, hsqf q
‹
prg, hs f q
Thus, it is the case that Φ´1 prg, hs‹ f q : X Ñσ U T F pY ` Xq in T, so rg, hs‹ f
in the monad on U T F .
This means that if f : X Ñ2 U T F pY ` Xq, then it is the case that Φ´1 f :
F X Ñ2 T pF Y ` F Xq, so Φ´1 f has a unique solution due to the fact that T is
guarded iterative. The rest of the proof is the same as for Theorem 3.1 in [26]. \
[
A.14
Proof of Theorem 29
By Theorem 22, there exists a guarded iterative monad T and an iterationcongruent retraction ρ : T Ñ S. By Theorem 28, the monad induced on U T F
is guarded iterative. Thus, it is enough to show that U ρF : U T F Ñ U SF is an
iteration-congruent retraction.
It is a retraction, since retractions are preserved by all functors.
To see that it is guarded, let f : X Ñ U SF Y be σ-guarded. By definition,
it means that Φ´1 f : F X Ñ SF Y is σ-guarded in S. Since ρ is a guarded
retraction, it follows that υpΦ´1 f q, for ρ’s family of sections υ, is also σguarded. By the fact that Φ is a natural isomorphism, we obtain υpΦ´1 f q “
Φ´1 ppU υqf q, hence, by definition, pU υqf is also σ-guarded.
To see that U ρF is an iteration congruence, let us denote by p--q: the solution
in T, and by p--q; the solution in the monad on U T F . Let f, g : X Ñ2
U T F pX ` Y q be morphisms such that pU ρqf “ pU ρqg. First, using this and
the fact that Φ is a natural isomorphism, we obtain the following:
ρpΦ´1 f q “ Φ´1 ppU ρqf q “ Φ´1 ppU ρqgq “ ρpΦ´1 gq
36
Thus, by the fact that ρ is an iteration congruence, we obtain that ρpΦ´1 f q: “
ρpΦ´1 gq: . Now, we check that U ρF is an iteration congruence:
pU ρqf ; “ pU ρqpΦpΦ´1 f q: q
“ ΦpρpΦ´1 f q: q
´1
“ ΦpρpΦ
// Φ is a natural isomorphism
:
gq q
// the above
“ pU ρqpΦpΦ´1 gq: q
“ pU ρqg
// Φ is a natural isomorphism
;
\
[
A.15
Details for Example 30
As an example of the setting described in Theorem 22, we compare two iteration
operators on Set that arise from different fixed-point theorems: Banach’s for
complete metric spaces and Kleene’s for complete partial orders, respectively.
The first operator keeps track of the number of steps needed to obtain the final
result. We show that its extensional collapse, defined as a morphism that forgets
the number of steps, is an iteration-congruent retraction with the second operator
as the retract.
First, we consider the category CbUMet of complete 1-bounded ultrametric
spaces and non-expansive maps. Note that CbUMet has coproducts and is
Cartesian closed [28]. Following Escardo [12], one has a mond T on CbUMet
given on objects as T pA, dq “ ppA ˆ Nq Y t8u, d1 q, with d1 given by
d1 p8, 8q “ 0
d1 ppx, kq, 8q “ d1 p8, px, kqq “ p1{2qk
d1 ppx, kq, py, kqq “ p1{2qk dpx, yq
d1 ppx, kq, py, tqq “ p1{2qminpk,tq if k ‰ t
The monad structure on S is defined as expected, by ηpaq “ pa, 0q and f ‹ pa, kq “
pb, k ` tq where f paq “ pb, tq
Theorem 31. The monad T is guarded iterative with f : X Ñ T Y being σguarded if for all x and y, it is the case that f pxq “ pσpyq, kq implies k ą 0.
Proof. First, note that the product of pA, dA q and pB, dB q in Cbus is given by
pA ˆ B, dAˆB q, where
dAˆB ppx1 , y1 q, px2 , y2 qq “ maxtdA px1 , x2 q, dB py1 , y2 qu.
The exponential object is equal to pB A , dAñB q where
dAñB pf, gq “ suptdB pf pxq, gpxqq | x P Au.
The coproduct is given by pA ` B, dA`B q, where
$
’
&dA px1 , x2 q if p “ in1 x1 and q “ in1 x2
dA`B pp, qq “ dB py1 , y2 q if p “ in2 y1 and q “ in2 y2
’
%
1
otherwise
37
Now, we show that the monad T is guarded. The only non-trivial case is
(cmp). So, assume prg, hs‹ f qpxq “ pσpyq, kq. We consider two cases:
f pxq “ pin2 z, k 1 q. Then, since f is in2 -guarded, k 1 ą 0, so, by definition of --‹ ,
it is the case that k ą 0.
f pxq “ pin1 z, k 1 q. Then, prg, hs‹ f qpxq “ rg, hs‹ pin1 z, k 1 q “ pσpyq, k 1 ` k 2 q,
where gpzq “ pσpyq, k 2 q. Since g is σ-guarded, k 2 ą 0, so k “ k 1 ` k 2 ą 0.
Given a guarded morphism f : X Ñ1 T pY ` Xq, we define the morphism
f : : X Ñ T Y as the unique fixed point of the following map ψ : pX Ñ T Y q Ñ
pX Ñ T Y q:
ψpgq “ rη, gs‹ f
One can easily see that any fixed point of ψ satisfies the fixed-point identity,
and that the uniqueness of such a fixed point gives us that f has a unique solution.
We use Banach’s theorem to achieve both.
By Banach’s theorem, it is enough to show that ψ is contractive, that is, there
exists a non-negative real c ă 1 such that for maps g, g 1 : X Ñ T Y , the following
holds:
dXñT Y pψpgq, ψpg 1 qq ď c ¨ dXñT Y pg, g 1 q
(20)
The left-hand side of the equation (20) is equal to:
dXñT Y pψpgq, ψpg 1 qq “ suptdT Y pψpgqpxq, ψpg 1 qpxqq | x P Xu
In turn, the right-hand side is as follows:
c ¨ dXñT Y pg, g 1 q “ c ¨ suptdT Y pgpxq, g 1 pxqq | x P Xu
“ suptc ¨ dT Y pgpxq, g 1 pxqq | x P Xu
Thus, it is enough to show that for all x P X, there exists y P X such that:
dT Y pψpgqpxq, ψpg 1 qpxqq ď c ¨ dT Y pgpyq, g 1 pyqq
We show this for c “ 1{2. We consider two cases:
f pxq “ pin1 y, kq for some y P Y and k P N. Then, for all g : X Ñ T Y , the
following holds:
ψpgqpxq “ prη, gs‹ f qpxq
“ rη, gs‹ pin1 y, kq
“ py, kq
So, the following holds:
dT Y pψpgqpxq, ψpg 1 qpxqq “ dT Y ppy, kq, py, kqq
“0
ď p1{2q ¨ dT Y pgpxq, g 1 pxqq
38
f pxq “ pin2 y, k ` 1q for some y P X and k P N (the ‘`1’ part follows from
the fact that f is guarded). Assume that gpyq “ pz, tq for some z and t. Then
it is the case that:
ψpgqpxq “ prη, gs‹ f qpxq
“ rη, gs‹ pin2 y, k ` 1q
“ pz, t ` k ` 1q
Similarly, let g 1 pyq “ pz 1 , t1 q, and so ψpg 1 qpxq “ pz 1 , t1 ` k ` 1q. Then, it follows
that:
dT Y pψpgqpxq, ψpg 1 qpxqq “ dT Y ppz, t ` k ` 1q, pz 1 , t1 ` k ` 1qq
“ p1{2qk`1 ¨ dT Y ppz, tq, pz 1 , t1 qq
“ p1{2qk ¨ p1{2q ¨ dT Y ppz, tq, pz 1 , t1 qq
ď p1{2q ¨ dT Y ppz, tq, pz 1 , t1 qq
“ p1{2q ¨ dT Y pgpyq, g 1 pyqq
\
[
We thus obtain a monad UD T FD on Set by sandwiching T in the adjunction
FD % UD where UD is the forgetful functor CbUMet Ñ Set and FD takes
discrete metrics. By Theorem 28, UD T FD is guarded iterative.
For the second operator, let CpoK be the category of complete partial
orders and continuous bottom-preserving functions. The identity on CpoK is
an Elgot monad, hence, by Theorem 29, we obtain an Elgot monad UL FL on
Set by sandwiching in the adjunction FL % UL where UL is the forgetful functor
CpoK Ñ Set and FL adjoins bottom. The relation between the two monads on
Set is an instance of our notion of iteration-congruent retraction:
Theorem 32. Define ρ : UD T FD Ñ U LFL by ρpa, kq “ a and ρp8q “ K.
Then ρ is an iteration-congruent retraction with the section given by υpaq “ pa, 1q
and υpKq “ 8. Moreover, the respective iteration operators induced by ρ and the
sandwich theorem coincide.
Proof. It is trivial that ρ is a guarded retraction. To see that it is a retraction
congruence, we first define an auxiliary relation: given two functions f, h : X :
pB ˆ Nq Y t8u, we write f „ g if it is the case that f pxq “ pa, kq for some a P B,
and k P N if and only if hpxq “ pa, k 1 q for some k 1 P N and f pxq “ 8 if and only
if hpxq “ 8 (i.e. the two functions differ only in the number of steps needed to
obtain the value). We also write ψf pgq “ rη, gs‹ f for the function ψ from the
proof of Theorem 31.
Given a 2-guarded function f : X Ñ ppY ` Xq ˆ Nq Y t8u, the function f :
can be defined as the unique fixed point of ψf (see the proof of Theorem 31),
whihc, by Banach’s fixed-point theorem is given by the limit of the sequence
39
f
W0f “ c and Wpn`1q
“ ψf pWnf q, where c is the constant function cpxq “ 8. It is
easy to see that for each x the sequence Wnf pxq stabilises. Given a function h such
that f „ h, it is easy to show by induction that for every x, the sequence Wnf pxq
stabilises with pa, kq for some k if and only if Wnh pxq stabilises with pa, k 1 q for
some k 1 at the same index n. Then, for all x, f : pxq “ pa, kq and h: pxq “ pa, k 1 q,
so ρpf : pxqq “ ρph: pxqq. Then, the result is obtained by noticing that for all f
and h, it is the case that ρf “ ρh implies f „ h.
It is left to see that the solution operator that follows from the sandwich
theorem and the one that follows from the iteration-congruent retraction coincide.
Given f : X Ñ pX ` Y q Y tKu, its solution in the Elgot monad UL FL is given
by the fixed point of the equation φpgq “ rη, gs‹ f , that is, by Kleene’s theorem,
1
by the limit of the sequence W01 “ c1 and Wpn`1q
“ φf pWn1 q, where c1 is the
pυf q
constatnt function c1 pxq “ K. It is easy to see that Wn1 “ ρWn
coincide.
40
, so the solutions
\
[
© Copyright 2026 Paperzz