Scholarly article on topic 'A Coalgebraic View of Infinite Trees and Iteration'

A Coalgebraic View of Infinite Trees and Iteration Academic research paper on "Mathematics"

Share paper
OECD Field of science
{monad / coalgebra / "monoidal category"}

Abstract of research paper on Mathematics, author of scientific article — Peter Aczel, Jiří Adámek, Jiří Velebil

Abstract The algebra of infinite trees is, as proved by C. Elgot, completely iterative, i.e., all ideal recursive equations are uniquely solvable. This is proved here to be a general coalgebraic phenomenon: let H be an endofunctor such that for every object X a final coalgebra, TX, of H(_) + X exists. Then TX is an object-part of a monad which is completely iterative. Moreover, a similar contruction of a “completely iterative monoid” is possible in every monoidal category satisfying mild side conditions.

Academic research paper on topic "A Coalgebraic View of Infinite Trees and Iteration"

Electronic Notes in Theoretical Computer Science 44 No. 1 (2001) URL: 26 pages

A Coalgebraic View of Infinite Trees and


Peter Aczel 1

Department of Mathematics and Computer Science, Manchester University, Manchester, United Kingdom

Jirí Adámek

Institute of Theoretical Computer Science, Technical University, Braunschweig, Germany

Jirí Velebil 3'4

Faculty of Electrical Engineering, Technical University, Praha, Czech Republic


The algebra of infinite trees is, as proved by C. Elgot, completely iterative, i.e., all ideal recursive equations are uniquely solvable. This is proved here to be a general coalgebraic phenomenon: let H be an endofunctor such that for every object X a final coalgebra, TX, of H(_)+X exists. Then TX is an object-part of a monad which is completely iterative. Moreover, a similar contruction of a "completely iterative monoid" is possible in every monoidal category satisfying mild side conditions.

Key words: monad, coalgebra, monoidal category




4 The support of the Grant Agency of the Czech Republic under the Grant No. 201/99/0310 is gratefully acknowledged.

©2001 Published by Elsevier Science B. V.

1 Introduction

There are various algebraic approaches to the formalization of computations of data through a given program, taking into account that such computations are potentially infinite. In 1970's the ADJ group have proposed continuous algebras, i.e., algebras built upon CPO's so that all operations are continuous. Here, an infinite computation is a join of the directed set of all finite approximations, see e.g. [7]. Later, algebras on complete metric spaces were considered, where an infinite computation is a limit of a Cauchy sequence of finite approximations, see e.g. [6].

In the present paper we show that a coalgebraic approach makes it possible to study infinite computations without any additional (always a bit arbitrary) structure — that is, we can simply work in Set, the category of sets. We use the simple and well-known fact that for polynomial endofunctors H of Set the algebra of all (finite and infinite) properly labelled trees is a final H-coalgebra. Well, this is not enough: what we need is working with "trees with variables", i.e., given a set X of variables, we work with trees whose internal nodes are labelled by operations, and leaves are labelled by variables and constants. This is a final coalgebra again: not for the original functor, but for the functor

H + CX : Set —> Set

where CX is the constant functor with value X. We are going to show that for every polynomial functor H : Set —► Set

(a) final coalgebras TX of the functors H + CX form a monad, called the completely iterative monad generated by H,

(b) there is also a canonical structure of an H-algebra on each TX, and all these canonical H-algebras form the Kleisli category of the completely iterative monad,

(c) the H-algebra TX has unique solutions of all ideal systems of recursive equations.

A surprising feature of the result we prove is its generality: this has nothing to do with polynomiality of H, nor with the base category Set. In fact, given an endofunctor H of a category A with binary coproducts, and assuming that each H+CX has a final coalgebra, then (a)-(c) hold. Moreover, the completely iterative monad T : A —► A, as an object of the endofunctor category [A, A], is a final coalgebra of the following endofunctor H of [A, A]: H(B) = H • B + 1A for all B : A —► A.

Now [A, A] is a monoidal category whose tensor product ® is composition and unit I is 1A. And the completely iterative monad generated by H is a monoid in [A, A]. We thus turn to the more general problem: given a monoidal category B, we call an object H iteratable provided that the endofunctor H : B —► B given by H(B) = H ® B + I has a final coalgebra T. Assuming

that binary coproducts of B distribute on the left with the tensor product, we deduce that T has a structure of a monoid, called the completely iterative monoid generated by the object H.

Coming back to polynomial endofunctors of Set: the solutions of equations mentioned in (c) above refer to a topic extensively studied in 1970's by C. C. Elgot [11], J. Tiuryn [18], the ADJ group [7] and others: suppose that X and Y are disjoint sets of variables and consider equations of the form

X0 = t0(x0 ,X1,X2,... ,y0,y1,y2,...) X1 = t1(X0 ,X1,X2,...,y0,y1,y2,...)

where Xi are variables in X and yj are variables in Y, while ti are trees using those variables. Following Elgot, we call the system ideal provided that each tree ti is different from any variable, more precisely,

ti E T(X + Y) \ ^[X + Y] for each i = 0,1, 2,...

It then turns out that the system has a unique solution in TY. That is, there exists a unique sequence Si,(y0,y1,y2,...) of trees in TY for which the following equalities

s0 (Уi)=to(so(Уi),Sl(Уi), ...,yi,...)

(1) S1 (Уi)=tl(so(Уi),sl(Уi), ...,yi,...)

hold. Expressed categorically, an ideal system of equations is a morphism

e : X —► T (X + Y) which factors through the H-algebra structure

+y : HT (X + Y) T (X + Y)

mentioned in (b) above:

X----- T(X + Y)

HT (X + Y) A solution of e is given by a morphism

e^ : X —► TY

for which the following diagram

X---» TY

T (X + Y ^-Fi-wT TTY

commutes. (Here, /iY : TTY —► TY is the multiplication of the completely iterative monad. In case of polynomial functors this takes a properly labelled

tree whose leaves are again properly labelled trees, and it delivers the properly labelled tree obtained by ignoring the internal structure.) In fact, the morphism T[e*,Vy] takes a tree with variables from X + Y on its leaves and substitutes the solution-tree e*(x) for each occurence of the variable x E X. Thus the equality (3), i.e.,

e^(x) = ¡iY • T[e\ nY](e(x)) for all x E X

precisely corresponds to the condition (1) above.

Now in this categorical formulation we can, again, forget about polynomi-ality and about Set: if H has final coalgebras for all functors H + CX, then we prove that every ideal equation-morphism e : X —► T(X + Y) has a unique solution, i.e., a unique morphism e) : X —► TY for which (3) commutes.

Related work. After finishing the present version of our paper we have found out that a similar topic is discussed by L. Moss in his preprints [15] and [16].

2 A Completely Iterative Monad of an Endofunctor

Assumption 2.1 Throughout this section, H denotes an endofunctor of a category A with finite coproducts. Whenever possible we denote by

inl : X —► X + Y and inr : Y —► X + Y the first and the second coproduct injections. Remark 2.2 For the functor

H(_) + Cx : A —► A

i.e., for the coproduct of H with CX (the constant functor of value X) it is well-known that

initial (H + CX)-algebra = free H-algebra on X. (See [4].)

More precisely, suppose that FX together with

aX : HFX + X —► FX

is an initial (H + CX)-algebra. The components of aX form

an H-algebra pX : HFX —► FX

a universal arrow nX : X —► FX. That is, for every H-algebra

HA —► A

and for every morphism f : X —► A there exists a unique homomorphism f H : FX —► A of H-algebras with

f = fH • nX.

Example 2.3 Polynomial endofunctors of Set. These are the endofunctors of the form

HZ = A0 + A1 x Z + A2 x Z x Z + ... = K x Zn

Y = (ao,ai,a2,...)

is a sequence of pairwise disjoint sets called the signature. An initial H-algebra can be described as the algebra of all finite Y-labelled trees. Here a Y-labelled tree t is represented by a partial function

t : u* |J An

whose definition domain Dt is a nonempty and prefix-closed subset of u* (the set of all finite sequences of natural numbers), such that for any i1i2 E Dt with t(i1 E An we have

i1 i2 ...iri E Dt iff i < n (for all i < u).

Now the functor

H + Cx

is also polynomial of signature

Yx = (X + Ao,Ai,A2,...).


can be described as the algebra of all finite YX-labelled trees. Remark 2.4

(i) Dualizing the concept of a free H-algebra, we can study cofree H-coalgebras. A cofree H-coalgebra on an object X of A is just a free Hop-algebra on X in Aop, where Hop : Aop —► Aop is the obvious endofunctor. If A has finite products then, by dualizing 2.2, we see that

initial (H x CX )-algebra = cofree H-coalgebra on X. Example: let H be a polynomial functor on Set. Then

H x Cx

is also a polynomial functor, since

(H x Cx)Z = JJ X x An x Zn.

This is the polynomial functor of signature

YX = (X x A0,X x AUX x A2,...).

A cofree H-coalgebra can be described as the coalgebra TX of all (finite and infinite) YX-labelled trees. Thus every node is labelled by (i) an operation from An and (ii) a variable from X.

(ii) Besides a free H-algebra on X and a cofree H-coalgebra on X we have a third structure associated with X: a final coalgebra of H + CX. We will show that it has an important universal property.

Definition 2.5 An endofunctor H of A is called iteratable provided that for every object X of A the endofunctor

H + cx

has a final coalgebra. Notation 2.6 Let

denote a final coalgebra of H + CX. The coalgebra map

ax : TX —► H (TX) + X is, by Lambek's lemma [13], an isomorphism. Thus, we have

TX = H (TX) + X

with coproduct injections

tx : H (TX) —► TX and nx : X —► TX

where [tx ,nx ] = aX1 : H (TX) + X —► TX. In particular, TX is an H-algebra via tx.

We can also define T on morphisms f : X —► Y of A in the expected manner: we turn TX into the following coalgebra of type H + CY:

TX-^^ H (TX) + X ■id+f H (TX) + Y

and denote by

Tf : TX —► TY the unique homomorphism of coalgebras:

TX<................?-H (TX) + X-id+f > H (TX) + Y

[tx ,nx ]


TY<......................................"Y......................................?■■ H (TY) + Y

[ty ,VY ]

That is, Tf is the unique morphism such that the following squares



commute. Shortly,

Tf is the unique homomorphism of H-algebras extending f. It is easy to verify that (due to the uniqueness) we obtain a well-defined functor

T : A ^ A

and a natural transformation

V : 1a T

Example 2.7 Continuous functors are iteratable. Here we assume that A has

1. a terminal object 1

2. limits of w^-sequences and

3. binary coproducts commuting with w^-limits.

Suppose that H is -continuous, i.e., preserves wop-limits. Due to 3., all functors H + CX are wop-continuous, thus, have a final coalgebra (see [2])

TX = lim(H + Cx )nl.

Observe that the functor T is also continuous: in fact, as we will see in Section 4, T is a final coalgebra of the functor

H : [A, A] —► [A, A]

defined on objects by

H(B) = H • B + 1A for all B : A —► A. Now [A, A] satisfies 1.-3. above, and H is continuous, thus,

T = lim Hn(C1).

This, being a limit of continuous functors, is continuous.

Example 2.8 Polynomial endofunctors of Set.

They are continuous, thus iteratable. A final coalgebra

of the (polynomial!) functor H + CX of signature EX is the algebra of all EX-labelled trees. That is, unlike the coalgebra

of all EX-labelled trees, see 2.4, where every node carries a label from X and one from An (for the case of n children), the trees in TX have nodes labelled in An except for leaves: they are labelled in X + A0. As a concrete example, consider the unary signature:

HZ = A x Z.

We have defined three algebras for a set X of variables: the free algebra

FX = A* x X

of all finite E-labelled trees for E = (0,A, 0, 0,...), the cofree coalgebra

TX = (A x X

(where denotes the set of all finite and infinite words in the given alphabet), and the algebra

TX = A* x X + A" (where (_)" denotes the set of all infinite words in the given alphabet).

Example 2.9 Generalized polynomial functors.

We want to include functors such as HZ = ZB, where B is a (not necessarily finite) set: since these functors are continuous, the description of TX is quite analogous to the preceding case. Here we introduce a generalized signature as a collection

£ = (Ai)ieCard

of pairwise disjoint sets indexed by all cardinals such that for some cardinal A we have

i > A implies Ai =

(We say that £ is a A-ary generalized signature; the case A = u being the above one.) The generalized polynomial functor of generalized signature £ is defined on objects by

HZ = JJ Aj x Zj

and analogously on morphisms.

A final coalgebra is, again, described as the coalgebra of all £-labelled trees, i.e., partial maps

t : A* — |J Aj

defined on a nonempty, prefixed-closed subset Dt of A* (the set of all finite sequences of ordinals smaller than A) such that for all i1i2 E Dt with t(iii2 . E Aj we have

i1i2 ...iri E Dt iff i < j (for all i < A).

Since H+ CX is a generalized polynomial functor of signature £x, obtained from £ by changing A0 to X + A0, we conclude that

is the coalgebra of all (finite and infinite) £x-labelled trees.

Remark 2.10 Denote by U : H-Alg —► A the forgetful functor of the category of all H-algebras and H-homomorphisms. The universal property of free H-algebras : HFX —► FX (provided they exist on all objects X of A) makes U a right adjoint. The left adjoint is the functor

X ^ (FX, px).

We now show a related universal property of the H-algebras tx : HTX —► TX: given a morphism s : X —► TY we prove that there is a unique ho-momorphism SS : TX —► TY of H-algebras extending s. This is interesting

even for the basic case of the polynomial endofunctors of Set: here a mor-phism s : X —► TY can be viewed as a substitution rule, substituting a variable x E X by a EY-labelled tree s(x). We obviously have a homomor-phism SS : TX —► TY extending s: take a tree t E TX, substitute every variable x E X on any leave of t by the tree s(x) and obtain a tree

t' = Ts(t) E TTY

over TY. Now forget that t' is a tree of trees and obtain a tree s(t) in TY. However, it is not obvious that such a homomorphism is unique. This is what we prove now:

Substitution Theorem 2.11 For every iteratable endofunctor H of A and any morphism

s : X —► TY in A there exists a unique extension into a homomorphism

s : TX —► TY

of H-algebras. That is, a unique homomorphism SS : (TX, tx) —► (TY, ty) with s = SS • r¡x.

Proof. We turn TX + TY into a coalgebra of type H + CY as follows: the coalgebra map is

TX + ty-^htx + X + HTY + Y^ H (TX + TY) + Y

where the components of fy (denoted by (3\, f32, and from left to right) are as follows:

H (TX + TY)


H inr+id

H (TX + TY) + Y There exists a unique homomorphism

TX + TY ax- ■ H (TX) + X + HTY + Y-

[TX ,nx ]+[Ty ,ny ]

H (TX + TY) + Y

TY<........................................................................................................................HTY + Y

[Ty ,ny ]

of (H + CY)-coalgebras. Equivalently, a unique morphism

/ = [/ ,/2]: TX + TY TY

in A for which the following two squares HTX + X-^^ TX

[01,02^ H (TX + TY) + Y


HTY + Y lrYny]TY

fi and Hf2+id

HTY + Yr->TY

[ry ,nY ]

[ry ,nY ]

commute. The right-hand square shows that f2 is an endomorphism of the final (H + CY)-coalgebra — thus,

f2 = id.

The left-hand square is equivalent to the commutativity of the following two squares (recall the definition of f31 and f32):




[ry ,VY ]

The square on the left tells us that f1 is a homomorphism of H-algebras. And since f2 = id (thus Hf2 + id = id) and a^1 = [ty,nY], the square on the right states f1 • nX = s, i.e., f1 extends s. This proves that there is a unique extension of s to a homomorphism: put SS = f 1. □

Corollary 2.12 Let K denote the full subcategory of H-Alg formed by all the H-algebras (TX,tx), for X in A. The functor

^ : A —► K, X ^ (TX, TX)

is left adjoint to the forgetful functor

U/K : K —► A, (TX, Tx) ^ TX.

This adjunction defines a monad

T = (T, n, T)

In fact, the natural transformation t : TT Substitution Theorem, precisely

TY = idTY : T (TY)

T is, in the notation of the

Definition 2.13 The above monad T, associated with any iteratable endo-functor H, is called the completely iterative monad generated by H.

Examples 2.14

(i) The completely iterative monad generated by the endofunctor

HZ = A x Z

of Set is the monad

TX = A* x X + A".

This can be described as the free-algebra monad of the variety of algebras with

(a) unary operations oa for a E A,

(b) nullary operations indexed by A" (i.e., constants of the names aoaia2 ... E

(c) satisfying the equations

oa(a0a1a2 ...) = aa0a1a2 ... for all a,a0,a1,... E A In this case, T is a finitary monad on Set.

(ii) The completely iterative monad generated by the endofunctor

HZ = Z x Z

of Set is the monad TX of all binary trees with leaves indexed in X. This is not finitary: consider the following element of T:

in which all xi are pairwise distinct. (iii) Let

denote the category of CPO's (say, posets with a smallest element L and joins of w-chains) and strict continuous functions (i.e., those preserving L and joins of w-chains). For all locally continuous functors H : CPO —► CPO, i.e., such that the derived functions

CPO(A, B) —► CPO(HA, HB), f ^ Hf

are all continuous, it is well-known that initial H-algebra = final H-coalgebra, see [17]. Since each H + CX is also locally continuous, we deduce that

locally continuous functors are iteratable, and in this case


that is, the completely iterative monad T is just the free algebra monad F of H.

Aczel, Adamek, Velebil (iv) Analogously for the category

of all complete metric spaces and contractions: every locally contractive endofunctor H : CMS —► CMS, i.e., such that the derived functions

CMS(A, B) —► CMS(HA,HB), f ^ Hf

are all contractive with a common constant < 1, has a single fixed point, i.e.,

initial H-algebra = final H-coalgebra, see [6]. Since each H + Cx is also locally contractive, we again get

T = F.

Remark 2.15

(i) The Kleisli category

At —► A

of the completely iterative monad is the above category K of all H-algebras tx : HTX —► TX (with its forgetful functor K —► A). This follows from the Substitution Theorem.

(ii) The Eilenberg-Moore category

of all T-algebras and T-homomorphisms seems to be a new construct. As seen in 2.14, it is usually infinitary. For example, if

H : Set —► Set, HZ = Z x Z

we can describe SetT as the category of all algebras on one binary operation (say, o) and on u-ary operations t(x0,x1,x2,...) for all infinite trees t(x0,x1 ,x2,...) in T{xn | n < u} satisfying the following equations:

(a) x o t = x o t,

(b) to x = t o x, and

(c) t(t0,t1 ,t2,...) = st if s is the tree obtained by substituting ti for xi, i < u, into t(x0,x1,x2,...).

3 Solution Theorem

In the introduction above we have motivated the following Definition 3.1 Let H be an iteratable endofunctor of A.

(i) By an equation-morphism we understand a morphism in A of the following form

e : X —► T(X + Y), X,Y are objects of A.

(ii) An equation-morphism is called ideal if it factorizes through

Tx+y : HT (X + Y) T (X + Y).

(iii) A solution of an equation-morphism e is a morphism

ef : X —► TY such that the following diagram

X---» TY

T (X + Y )-FjewT TTY


Examples 3.2

(i) Consider the following endofunctor

HZ = A x Z

of Set with

TX = (A* x X) + A". The only interesting equations are of the form

x = a1a2 ... anx

for a word a1a2 E A*. This equation is ideal iff the word is nonempty. Then it has a unique solution:

e^(x) = a1a2 ... ana1a2 ... ana1 a2 ... E A".

(ii) For the functor

HZ = Z x Z

on Set we have as TX the algebra of all binary trees with leaves labelled in X. Consider the following system e of equations

Xl = X2 yi x = /\

X2 = Xl y2 It is ideal. The unique solution is


e\x2 ):

Solution Theorem 3.3 Let H be an iteratable endofunctor. Then every ideal equation-morphism has a unique solution.

Proof. Let e : X —► T(X + Y) be an ideal equation-morphism and denote by e0 : X —► HT(X + Y) a morphism such that the triangle

X.-2-- T(X + Y)

eo\. ^ffX+Y

HT (X + Y)


We are going to use the definition of a final (H + CY )-coalgebra for defining a morphism h : T(X + Y) + TY —► TY. To do this, we must first define an (H + CY )-coalgebra

Y : T(X + Y) + TY —► h(T(X + Y) + TY^j + Y

on T(X + Y) + TY. The morphism y is defined as a composite

T (X + Y) + TY ax+YHT (X + Y) + X + Y + HTY + Y

h(T (X + Y) + TY^j + Y

where the components of 8 are as follows:

HT (X + Y)

HT (X + Y) h(T (X + Y) + TY

H(T (X + Y) + TY


Hinr+id y

h(t (X + Y) + TY^j + Y

Denote by h the unique homomorphism of (H + CY)-coalgebras:

T (X + Y) + TY-Y-h(t (X + Y) + TY^j + Y

Hf+id Y


h1 = h • inl : T(X + Y) —► TY and h2 = h • inr : TY —► TY

The commutativity of the above square is (since ax+y + aY is inverse to [tx+y , nX+y] + [ty , nY]) equivalent to the commutativity of the following four


HT(X + Y) ^^ T (X + Y)

Hhi hi


HT (X + Y)

HTY + Y-Y_inr

X + Y ^^ T (X + Y)

HTY + Y-

[Ty ,ny ]

.x + Y T (X + Y) hi TY

[ty ,ny ]


Hh2+id y


[ty ,VY ]

The square (7) asserts that h2 is an endomorphism of the final (H + CY)-coalgebra, i.e.,

h2 = id ty .

The diagram (4) tells us that hi is a homomorphism of H-algebras, thus, by Substitution Theorem, h1 is uniquely determined by

hi • nx+Y : X + Y TY.

The last morphism is determined uniquely by its first component, s : X —► TY, because, using the diagram (6), we conclude that the second component of h1 • nX+Y is nY (=[ty,nY] • 'nr). That is h1 • nX+Y = [s,nY] or, equivalently

hi = [s,VY]. Finally, the diagram (5) asserts that

s = hi • nx+y • inl = [ty,nY] • inl • Hhi • eo = ty • Hhi • e0 = hi • tx+y • eo = hi • e

where we use naturality of t and the above triangle for e0.

We have proved that there exists s : X —> TY with

s = h\ • e = [s, nY] • e.

Moreover, this s is uniquely determined by h = [hi, idY], hence s is uniquely determined by e. □

4 A Completely Iterative Monoid of an Object

We can view the procedure of Section 2 globally by working, instead of in the given category A, in the endofunctor category [A, A]. Here H is an object. If H is iteratable, then it defines another object, T, together with a morphism (natural transformation)

a : T HT + 1a. This is a coalgebra of the functor

H : [A, A] —► [A, A]

defined on objects by

H(S) = H • S + 1a (for all S : A —► A)

and analogously on morphisms. We prove below that T is a final H-coalgebra.

Within the realm of locally small categories with coproducts this global approach is equivalent to that of Section 2 as we now prove.

Proposition 4.1 Let A be a locally small category with coproducts. Then, for every endofunctor H, the following are equivalent:

(i) H is an iteratable object of [A, A], i.e., a final H-coalgebra exists.

(ii) H is an iteratable endofunctor, i.e., all final (H + CX)-coalgebras exist.

Remark. The proof that (ii) implies (i) holds for all categories A with binary coproducts.

For the proof that (i) implies (ii), only copowers indexed by hom-sets of the category A are used. Thus the proposition holds also for any poset A and for the category A = Sefi of finite sets.

Proof. (i) implies (ii): For every pair X, Y of objects in A denote by KX,Y the following endofunctor

Kxyy A = H Y


for objects A, analogously for morphisms. This is just a left Kan extension of Y, considered as a functor 1 —► A along X : 1 —► A. In fact, for every functor P : A —► A we have a bijection

Kx,y P Y —> PX

natural in P, which to every natural transformation p : Kx,Y —► P assigns the composite



where u is the idX-injection. Conversely, given a morphism f : Y —► PX, the corresponding natural transformation f @ : KX,Y —► P has components

f@ : (II Y) PA

e@ - ^

h:X—> A

determined by Y —^ PX-^^ PA .

Let a : T —► HT + 1A be a final ii-coalgebra. We are to show that

aX : TX —► HTX + X

is a final (H + CX)-coalgebra for every X. In fact, for every (H + CX)-coalgebra

b : Y —► HY + X

when composing b with

Hu + id : HY + X —► H^ JJ y) + X = (HKx,y + 1a)X


we obtain a morphism

b : Y —► ( HKxy )X

which by the above adjointness yields an H-coalgebra

Y -> H Kx, Y.

Let p be the unique homomorphism of H-coalgebras

Kx, y^^ H Kx, y

V H <p

T—^^ H T

Then p = f @ for a unique f : Y —► TX, and the commutativity of the above square yields the commutativity of

Y—^ HY + X

Hf+id x

TX—^ HTX + X

(ii) implies (i): It has been noted above (see 2.6) that if aX : TX —► HTX + X denotes a final coalgebra for H + CX, then the assignment X ^ TX can be extended to a functor T : A —► A.

Analogously one can show that the collection of all aX 's constitutes a natural transformation a : T —► H•T+1A. Thus, a makes T an H-coalgebra.

To verify that a is indeed a final ii-coalgebra, consider any coalgebra f3 : S —► H • S + 1A. For each X in A there exists a unique morphism fX : SX —► TX such that the square

SX-^- HSX + X


TX—^ HTX + X

commutes. It is easy to show that the collection of fX 's is natural in X and that it defines a unique natural transformation f : S —> T for which the square

S — HS +1a

f Hf+id


commutes. □

Now [A, A] is a monoidal category with composition as tensor product and 1A as a unit. Moreover composition distributes with coproducts on the left: (H + K) • L = (H • L) + (K • L). This leads us to consider an arbitrary monoidal category

(B, 0,I)

with coherence isomorphisms (for all H, K, L in B):

Ih : I 0 H —► H гн : H 0 I —► H

aH, K, L : H 0 (K 0 L) (H 0 K) 0 L satisfying the usual laws, and distributive in the following sense:

Definition 4.2

(i) A monoidal category is called left distributive if it has binary coproducts and the canonical morphisms

dH,K,L : (H 0 L) + (K 0 L) (H + K) 0 L

are all isomorphisms.

(ii) An object H of a monoidal category B is said to be iteratable provided that the endofunctor H : B —> B defined by

H (B) = H 0 в +1

has a final coalgebra.

(iii) A left distributive monoidal category with each object iteratable is called an iteratable category.

Examples 4.3

(i) The category

Cont [Set, Set]

of continuous endofunctors (i.e., those preserving w^-limits) of Set is iteratable: we know that continuous functors are closed under

(a) composition (here: a tensor product)

(b) identity functor (here: unit I) and

(c) finite coproducts,

thus Cont [Set, Set] is a distributive monoidal subcategory of [Set, Set]. Now, as observed in 2.7, every continuous functor is iteratable, and the completely iterative monad is also continuous; therefore Cont [Set, Set] is an iteratable category.

(ii) More in general, Cont [A, A] is an iteratable category for every category A satisfying conditions 1.-3. of Example 2.7.

(iii) The category

Fin [Set, Set]

of all finitary endofunctors of Set (i.e., those preserving filtered colimits) is an iteratable category. In fact, finitary functors are closed under composition, identity functor, and finite coproducts, thus, Fin [Set, Set] is a distributive monoidal subcategory of [Set, Set].

A completely iterative monad T of a finitary functor H exists, since finitary functors always have final coalgebras, see [8], Theorem 1.2, and each H + CX is clearly finitary. However, this monad is seldom finitary, see 2.14.(ii) above.

We can form a finitary part Tfin of every monad T on Set (see [14]): it is obtained by restricting the underlying functor T to the full subcategory Sefin of finite sets, and then forming a left Kan extension of T/Sefin along the embedding of Sefin in Set.

It is quite easy to verify that Tfin is a final coalgebra of the endofunctor H • (_) + 1$et of Fin [Set, Set]. In fact, given any coalgebra

S -► H • S + lset

(with S finitary, of course) the unique ií-homomorphism f : S —► T is easily seen to have a factorization through the canonical morphism m : Tfin —► T. That is, we have a unique f' : S —► Tfin with f = m• f'. And f' is the unique homomorphism of coalgebras of the functor H • (_) + 1Set, considered as an endofunctor of Fin [Set, Set]. Example: the functor

H : Set —► Set with HZ = Z x Z

has the completely iterative monad T where TX are all binary trees with leaves indexed in X. And Tfin is the finitary monad where TfinX are all binary trees with leaves indexed in a finite subset of X.

(iv) More generally, if A is a locally finitely presentable category (see [5]) then

Fin [A, A], the category of finitary endofunctors of A, is iteratable. The argument is the same: we form a completely iterative monad T in [A, A], which exists by Theorem 1.2 in [8] (although formulated for Set, it holds in all locally presentable categories) and then take a finitary part Tfin just as in (iii) above.

(v) In the formal language theory we study the monoidal category B of all subsets of r* (for the basic alphabet r) which is a complete lattice exp (r*) considered as a category. Here

Li 0 L2 = concatenation of languages Li and L2

L1 + L2 = union of languages L1 and L2. Every language L is iteratable with

T = L* (Kleene star).

(vi) Kleene algebras, cf. [12], are distributive symmetric monoidal categories (B, 0,1) where B is a join semilattice such that each of the endofunctors H = H 0 (_) +1 has a least fixed point H*. This is closely related to our concept, except that we are concerned with the largest fixed points. Since the basic motivation for Kleene algebras is the previous example of formal languages and since this example has the property that H = H 0 (-) + I always has a unique fixed point, the choice of least or largest seems to be rather arbitrary.

(vii) Let B have a terminal object 1 and limits of w^-chains which commute with both the tensor product and the binary coproduct. Then every object H is iteratable and T is a limit of the following countable chain:

1-!- H 0 1 + I : ml+ld H 0 (H 0 1 + I) + I ,m(H &-+ld )+ld ...

For example: the category of sets with a binary product as 0 and a terminal object I as a unit is an iteratable category: the (polynomial) functor

H(Z) = H x Z + I

has a final coalgebra

T = H ~

for every set H.

And the cartesian closed category Cat of all small categories is an iteratable category. Every small category H is iteratable with

T = 1 + H + (H x H) + ... + H"

(viii) Let H be an iteratable Abelian group (where we consider the category Ab of all Abelian groups with the usual tensor product). Then a final coalgebra of H is, as we show below in 4.6, a monoid in the given monoidal category — thus, in the present case

T is a ring.

Notation 4.4 For every iteratable object H we denote by T and a : T —> H 0 T + I a final coalgebra of H. By Lambek's Lemma, T is a coproduct of H 0 T and I with injections

t : H 0 T —► T and n : I —► T

where a-1 = [t, n].

This makes T into an algebra for the functor H 0 _. More generally, every object S of B yields an algebra

ts = H 0 (T 0 S) ^ (H 0 T) 0 S ^T 0 S (where aH,T,s is the associativity isomorphism). Put

ns = S^I 0 St 0 S

Substitution Theorem 4.5 Let H be an iteratable object in a monoidal category B. For every morphism

s : S —► T in B there is a unique homomorphism

s : T 0 S —► T

of algebras of type H 0 _ with

s = s • ns.

Proof. This is quite analogous to the proof of Theorem 2.11. We turn the object T 0 S + T into an H-coalgebra as follows:

t 0 s + t a®lds(H 0 T + I) + (H 0 T + I) = = H 0 (T 0 S) + S + H 0 T + I-^-H 0 (T 0 S + T) + I

where the isomorphism in the middle is the combination of the canonical isomorphism (H0T+I)0S = (H0T)0S+10S with aH)Tts : (H0T)0S —► H 0 (T 0 S) and r-1 : 10 S —> S, and в has the following components (from left to right):

S H 0 T

s H®inr

H 0 (T 0 S) T H 0 (T 0 S + T)

The unique homomorphism

f = [fif]: T 0 S + T T

of H-coalgebras is the unique morphism of B which has the second component, /2, an endomorphism of the final H-coalgebra a : T —► H 0 T + I, thus,

f2 = id,

and for the first component we get two commutative diagrams: one tells us that /1 is a homomorphism of (H0_)-algebras, and the other one is as follows:

H 0 T + I

H 0/2+id

H 0 T + I-

Since /2 = id, this diagram tells us that f1 • nS tution Theorem.

= s, which proves the Substi-

Corollary 4.6 For every iteratable object H, a final H-coalgebra T is a monoid with respect to

n : I —► T

1 = idT : T 0 T —► T.

Proof. In fact, the equality 1 • nT = id follows from the definition of 1 and the other two equalities defining monoids in (B, 0,I) easily follow from the uniqueness of s. □

Definition 4.7 The monoid from the above Corollary is called a completely iterative monoid generated by an iteratable object H.

We now show a remarkable property of completely iterative monoids: if a left distributive monoidal category is an iteratable category, then the assignment of a completely iterative monoid is a functor which underlies a completely iterative monoid again. Example: Set is an iteratable category, see item (vii) in 4.3, and the assignment H ^ H^ is, as an object of [Set, Set], itself a completely iterative monoid generated by Id.

For every monoidal category B we consider [B, B] as a monoidal category (with the "pointwise" tensor product P 0 Q : H ^ P(H) 0 Q(H) and the "pointwise" unit CI : H ^ I).

Theorem 4.8 Suppose that (B, 0,I) is an iteratable category. Then the following hold:

(i) The functor category [B, B] is an iteratable category.

(ii) The assignment of a completely iterative monoid to every object is an endofunctor of B and which, as an object of [B, B], is itself a completely iterative monoid generated by Id

Proof. (i). First observe that [B, B] is indeed a distributive monoidal category, since the required structure is transported pointwise from B.

Consider now any functor H : B —> B. To show that the derived functor H = H 0 (_) + Ci : [B, B] —► [B, B]

has a final coalgebra, form, for each B in B, a final coalgebra of the functor H(B) 0 (_) + I:

ав : T(B) H(B) 0 T(B) + I.

It is clear that there is a unique canonical way of making the assignment B ^ T(B) functorial: consider any morphism f : B —> C in B and define T(f) : T(B) —> T(C) to be the unique morphism such that the diagram

T (B ) H (B) 0 T (B) + f(f YsT (B)+;dH (C) 0 T (B) + I

т (f)

H (C)®T (f )+id

T(C)-55-- H(C) 0 T(C) + I

commutes. It is easy to show that this indeed defines a functor T : B —► B.

The collection of morphisms aB : T(B) —► H(B) 0 T(B) + I is natural in B and thus defines a coalgebra for H 0 (_) + CI:

a : T —► H ® T + CI.

To show that a is a final coalgebra, consider any coalgebra

b : S —► H 0 S + Ci .

For every B in B there exists a unique morphism XB : S(B) —► T(B) such that the square

S(B) ^^ H(B) 0 S(B) + I

H (B)®XB +id

T(B)^ H(B) 0 T(B) + I

commutes. To show that the collection (XB) constitutes a natural transformation, observe that, for every f : B —► C, both

Ac • S(f): S(B) T(C) and T(f) • Ab : S(B) T(C) are homomorphisms of (H(C) 0 (_) +1)-coalgebras from

(H(f) 0 S(B) + id) • bB : S(B) H(C) 0 S(B) + I

ac : T(C) H(C) 0 T(C) + I

and therefore they are equal.

We have formed a final coalgebra

a : T —► H 0 T + CI.

(ii) Put $(B) = TB for every object B and extend the assignment B ^ $(B) to a functor $ : B —► B as in the first part of the proof. Let us now consider the functor

Id 0 (_) + Ci : [B, B] —► [B, B].

The collection of morphisms aB : $(B) —► B 0 $(B) + I defines a coalgebra for Id 0 (_) + CI:

a : T —► Id 0 T + CI

and it follows from the first part of the proof that this coalgebra is final.

To conclude the proof use now the monoidal version of the existence of a completely iterative monad from 4.6. □

5 Conclusions and Connections

We have seen that with every endofunctor H satisfying rather weak hypothesis we can associate a monad T by assigning to every object X a final coalgebra, TX, of the endofunctor H( _ )+X. This monad is specified by the Substitution Theorem for final coalgebras. It has the remarkable property that every ideal system of recursive equations in it has a unique solution (Solution Theorem). Even in the basic case, where a signature in (or a polynomial endofunctor of) the category of sets is given, this monad T of finite and infinite trees over given variables seems to be new. We can introduce T more globally, as an object of the endofunctor category [A, A]: here, T is simply a final coalgebra of the endofunctor H • _ + Id, and this generalizes to monoidal categories satisfying mild additional assumptions.

One of the sources for the ideas in this paper has been the so-called hyperset theory which is an approach to axiomatic set theory that allows for non-well-founded sets. In hyperset theory the Foundation Axiom of the standard axiomatic set theory ZFC is replaced by the Anti-Foundation Axiom, AFA. This axiom expresses that every flat system of set equations

Xi = {xj I j t Ji} (i t I)

has a unique solution in the hyperuniverse of possibly non-well-founded sets. Here the Xi are variables, indexed by a set I, and each Ji is a subset of I. By considering the variables as atoms (urelemente) taken from a class X, the right hand sides become sets of atoms taken from a hyperuniverse V [X] of possibly non-well-founded sets that are built out atoms taken from X. The hyperuniverses V[Y], for classes Y, satisfy relativized forms of AFA which generalize to non-flat systems of equations. In general we get the Solution Theorem for the V [Y].

It was only the recent collaboration between the authors that led us to realise that the Substitution Theorem just expresses that the natural endo-functor T determined by the operation X ^ V [X] forms a monad T on the category of classes and that the Solution Theorem just expresses that T is the

completely iterative monad generated by the endofunctor Pow on the category of classes that associates to each class X the class Pow (X) of its subsets.

The approach to working with hypersets using the Substitution and Solution Theorems has been presented in the books [9], [1] and [10].


[1] Aczel, P., "Non-Well-Founded Sets", CSLI Lecture Notes Number 14, CSLI Publications, Stanford, 1988.

[2] Adamek, J., Free Algebras and Automata Realizations in the Language of Categories, Comment. Math. Univ. Carolinae 15 (1974), 589-602.

[3] Adamek, J., and V. Koubek, On the Greatest Fixed Point of a Set Functor, Theor. Comp. Science 150 (1995), 57-75.

[4] Adamek, J., and V. Trnkova, "Automata and Algebras in Categories", Kluwer Academic Publishers, Dordrecht, 1990.

[5] Adamek, J., and J. Rosicky, "Locally presentable and accessible categories", Cambridge University Press, 1994.

[6] America, P., and J. Rutten, Solving Reflexive Domain Equations in a Category of Complete Metric Spaces, J. Comp. System Sci. 39 (1989), 343375.

[7] Goguen, J. A., S. W. Thatcher, E. G. Wagner and J. B. Wright, Initial Algebra Semantics and Continuous Algebras, manuscript.

[8] Barr, M., Terminal Coalgebras in Well-founded Set Theory, Theor. Comp. Science 114 (1993), 299-315.

[9] Barwise, J., and J. Etchemendy, "The Liar: An Essay in Truth and Circularity", Oxford University Press, 1987.

[10] Barwise, J., and L. Moss, "Vicious Circles", CSLI Lecture Notes Number 60, CSLI Publications, Stanford, 1996.

[11] Elgot, C. C, Monadic Computation and Iterative Algebraic Theories, in: "Logic Colloquium '73" (eds: H. E. Rose and J. C. Shepherdson), North-Holland Publishers, Amsterdam, 1975.

[12] Kozen, D., A Completeness Theorem for Kleene Algebras and the Algebra of Regular Events, Inform. and Comput. 110 (1994), 366-390.

[13] Lambek, J., A Fixpoint Theorem for Complete Categories, Mathematische Zeitschrift 103 (1968), 151-161.

[14] Linton, F. E. J., Some aspects of equational categories, in: "Proc. Conf. Categorical Algebra, La Jolla 1965", Springer-Verlag 1966, 84-94.

[15] Moss, L., Parametric Corecursion, preprint, available at

[16] Moss, L., Recursion and Corecursion Have the Same Equational Logic, preprint, available at

[17] Smyth, M. B., and G. D. Plotkin, The Category-theoretic Solution of Recursive Domain Equations, SIAM J. Comput., 11 (1982), 761-783.

[18] Tiurin, J., Unique Fixed Points vs. Least Fixed Points, Theoretical Computer Science 12 (1980), 229-254.