3451362246 20.1.1.2856.637 source_20Generalized Coiteration Schemata Coiterative functions can be explained categorically as final coalgebraic morphisms, once coinductive types are viewed as final coalgebras. However, the coiteration schema which arises in this way is too rigid to accommodate directly many interesting classes of circular specifications. In this paper, building on the notion of T -coiteration introduced by the third author and capitalizing on recent work on bialgebras by Turi-Plotkin and Bartels, we introduce and illustrate various generalized coiteration patterns. First we show that, by choosing the appropriate monad T , T -coiteration captures naturally a wide range of coiteration schemata, such as the duals of primitive recursion and course-of-value iteration, and mutual coiteration. Then we show that, in the more structured categorical setting of bialgebras, T -coiteration captures guarded coiterations schemata, i.e. specifications where recursive calls appear guarded by predefined algebraic operations. 2003 Article Daniela Cancila|Furio Honsell|Marina Lenisa Peter Aczel, Non-Well-Founded Sets, Article, Bibliovault OAI Repository, the University of Chicago Press.|B. Barbier, Solving stream equation systems, Article, 01/2002;|J.Robin B. Cockett, Dwight Spencer, Strong categorical datatypes II: A term logic for categorical programming, Article, Theoretical Computer Science. 01/1995; http://citeseer.ist.psu.edu/617247.htmlElectronic Notes in Theoretical Computer Science 82 No. 1 (2003)
URL: http://www.elsevier.nl/locate/entcs/volume82.html 18 pages
Generalized Coiteration Schemata1
Daniela Cancila, Furio Honsell, Marina Lenisa
Dipartimento di Matematica e Informatica, Universit` a di Udine
Via delle Scienze 206, 33100 Udine, Italy. cancila,honsell,lenisa@dimi.uniud.it
Abstract
Coiterative functions can be explained categorically as final coalgebraic morphisms,
once coinductive types are viewed as final coalgebras. However, the coiteration
schema which arises in this way is too rigid to accommodate directly many inte-
resting classes of circular specifications. In this paper, building on the notion of
T-coiteration introduced by the third author and capitalizing on recent work on
bialgebras by Turi-Plotkin and Bartels, we introduce and illustrate various genera-
lized coiteration patterns. First we show that, by choosing the appropriate monad
T, T-coiteration captures naturally a wide range of coiteration schemata, such as
the duals of primitive recursion and course-of-value iteration, and mutual coitera-
tion. Then we show that, in the more structured categorical setting of bialgebras,
T-coiteration captures guarded coiterations schemata, i.e. specifications where re-
cursive calls appear guarded by predefined algebraic operations.
Keywords: coinductive datatype, categorical semantics, coalgebra, bialgebra, coit-
eration schema, guarded specification.
Introduction
F-coalgebras, for F endofunctor on a category C, offer a uniform categorical
account of the behaviour of dynamical systems and various kinds of circular
and infinite objects [Acz88,JR96,BM96,Rut00]. According to this paradigm,
universal systems and coinductive datatypes are modeled as final coalgebras,
bisimulations are modeled as suitable coalgebras over binary relations on
states, called coalgebraic bisimulations, and coiterative functions into coin-
ductive datatypes are explained as the unique coalgebraic morphisms into the
final coalgebra.
This approach has been very fruitful and it originated a new area of se-
mantics called final semantics, whereby the operational behaviour of a pro-
cess algebra is captured as a coalgebra over the syntax and the interpreta-
tion function, inducing the intended observational equivalence, is construed
as a final mapping into a final coalgebra of suitable denotations, see e.g.
[Acz93,RT94,Len96,JR96].
1Research supported by the MIUR Project COFIN 2001013518 Cometa.
c ?2003 Published by Elsevier Science B. V.
Cancila, Honsell, Lenisa
However, the coiteration schema which arises from coalgebraic morphisms
is very rigid. Natural circular specifications of functions need a lot of pre-
processing before they can be cast into this pattern. To overcome this draw-
back, various authors [Gim94,Pav98,Len99,UV99,Bar01,UVP01] have recently
addressed the problem of generalizing the basic categorical setting to accom-
modate directly more expressive classes of circular specifications, e.g. duals of
primitive recursion and course-of-value iteration, mutual coiteration etc. To
this end, the third author of this paper introduced in [Len99] the schema of
T-coiteration for T pointed endofunctor.
A similar limitation arises in connection with bisimulations. In practice,
many notions of bisimulations up-to are in use, see e.g. [San98,Len99], offer-
ing often the advantage of being finite even when the corresponding stan-
dard bisimulations are not. These cannot be directly expressed in terms
of basic coalgebraic bisimulations, but require appropriate generalizations
[Len99,LPW00,Bar01].
Often dynamical systems come equipped with algebraic operations w.r.t.
which the intended behavioural semantics is a congruence, the standard case in
point being syntactic constructors on terms in process algebras. Plain unstruc-
tured coalgebras are too weak to allow for principled proofs of congruence. An
appropriate setting in which to discuss these issues is that of bialgebras and
structured coalgebras [TP97,CHM01], i.e. suitable objects which have both
an algebra and a coalgebra structure. In this setting, coiterative morphisms
appear also as algebra homomorphisms, and the equivalences induced by coit-
erative morphisms are congruences w.r.t. the operations on the algebra.
In this paper, building on the notion of T-coiteration and capitalizing
on recent work on bialgebras, we introduce and illustrate the expressivity of
various generalized categorical coiteration patterns.
First we show that the T-coiteration schema captures naturally a wide
range of patterns, such as the duals of primitive recursion and course-of-value
iteration, and mutual coiteration. Hence, in particular T-coiteration is exten-
sionally universal, i.e. it captures the graph of any morphism in the underlying
category. Then we show that, in the more structured categorical setting of gen-
eralized -bialgebras, the T-coiteration schema captures guarded coiterations,
i.e. specifications where recursive calls appear guarded by predefined algebraic
operations. In this setting, a very interesting and general class of T-coiteration
schemata is the one which arises when T is the free monad generated by the
functor for which the guard is an algebra operation. For ease of presentation,
many concrete examples are provided on the datatype of streams, including
Hamming, Fibonacci, as well as some operations on dynamical systems.
The use of -bialgebras and distributive laws in dealing with generalized
coiteration was first developed in [Bar01]. The present work stems from an
alternative categorical account of the results in [Bar01] on guarded schemata.
In our approach, we actually work in an ambient category of possibly gen-
eralized -bialgebras. We feel that our approach suggests a new perspective
on the use of bialgebras in the context of generalized coiteration, whereby
2
Cancila, Honsell, Lenisa
guards in coiteration schemata are construed as algebraic constructors and
coiterative morphisms appear also as algebra homomorphisms. Furthermore,
we introduce a notion of generalized distributive law, which generalizes that in
[Bar01].
We conclude the paper by hinting at a general language for mutual coin-
ductive specifications which features all the schemata discussed in the paper.
Its categorical semantics, based on T-coiteration, is compositional, i.e. the
semantics of complex schemata is obtained by composing the monads used for
dealing with the elementary component schemata separately.
This modular semantics suggests naturally effective syntactic procedures
for validating mutual circular specifications. These can be used in interac-
tive proof development environments, based on type theory, such as Coq, for
extending the classes of coiteration schema currently accepted, [Coq94].
Synopsis. In Section 1, we introduce the relevant categorical notions. In Sec-
tion 2, we present a collection of motivating examples of circular definitions of
functions on streams. We discuss coiteration and its limitations in Section 3.
The expressivity of T-coiteration is analyzed in Section 4. In Section 5 we dis-
cuss guarded specifications and illustrate the added value obtained by working
in a suitable ambient category of bialgebras. Final remarks and directions for
future work appear in Section 6.
Acknowledgement. The authors would like to thank F.Bartels for useful com-
ments on a preliminary version of the paper.
1Coalgebras and Bialgebras
In this section, we introduce various notions and results which are relevant
to the categorical treatment of coinductive types. We work in a category C
which has finite products and coproducts.
Definition 1.1 [G-algebra, F-coalgebra, ?G,F?-bialgebra] An algebra for the
functor G : C C (G-algebra) is a pair (X,X), where X is an object of C
(the carrier of the algebra) and X: GX X is an arrow in C (the operation
of the algebra). Dually, an F-coalgebra is a pair (X,X), where : X FX.
A ?G,F?-bialgebra is a triple (X,X,X), where (X,X) is a G-algebra and
(X,X) is an F-coalgebra.
Algebra operations allow to construct elements of the carrier. Coalgebra
operations, called destructors or unfoldings, yield information on the states of
the dynamical system represented by the coalgebra. It is often the case, as we
will see, that states in a dynamical system come equipped with an algebraic
structure. Bialgebras account for this richer structure.
G-algebras, F-coalgebras, and ?G,F?-bialgebras can all be endowed with
a suitable structure of category by definining the notions of G-algebra, F-
coalgebra, ?G,F?-bialgebra morphism, respectively, as follows:
Definition 1.2 An arrow f : X Y is a G-algebra morphism from the G-
algebra (X,X) to the G-algebra (Y,Y) if it makes diagram (1) commute.
3
Cancila, Honsell, Lenisa
An arrow f : X Y is an F-coalgebra morphism from the F-coalgebra
(X,X) to the F-coalgebra (Y,Y) if it makes diagram (2) commute. An arrow
f : X Y is a ?G,F?-bialgebra morphism from (X,X,X) to (Y,Y,Y),
if f makes both diagrams (1) and (2) commute.
GX
(1)Gf
??
X
??X
(2)f
??
X??FX
Ff
??
GY
Y
??Y
Y
??FY
We will denote by AlgG, CoalgF, and BialgG,Fthe categories of G-algebras,
F-coalgebras, and ?G,F?-bialgebras, respectively.
Bialgebras, as defined above, combine the algebraic and coalgebraic struc-
tures independently. Much more interesting are those bialgebras where there
is a tighter connection between the two structures, e.g. when F (G respec-
tively) lifts to a (co)algebra functor, so that X (X respectively) becomes
a (co)algebra morphism. This notion of structured bialgebra has been very
fruitful in the context of final semantics to streamline the proofs that bisimi-
larities are congruences w.r.t. suitable syntactical operators of the language.
A very natural sufficient condition for the above to happen is the pentagonal
law of -bialgebras, [TP97]. For a given bialgebra (X,X,X), such a law es-
sentially allows to endow with a G-algebra structure FX, in such a way that
Xis a G-algebra morphism between (X,X), and the G-algebra with carrier
FX thus defined. And dually.
We introduce a generalization of this condition, for F,G functors, called
the generalized pentagonal law, which will be used in Section 5 for capturing
generalized coiteration schemata. First we need the following definition:
Definition 1.3 [Strict Coalgebra Functor] Let F,H : C C. A strict coalge-
bra functor is a functor F : CoalgF CoalgHsuch that, for any F-coalgebra
(X,X), F(X,X) = (X,X), for some X : X HX, and for any F-
coalgebra morphism f : (X,X) (Y,Y), F(f) = f.
Definition 1.4 [Bialgebra for a (Generalized) Pentagonal Law] Let F,G,H :
C C, let F : CoalgF CoalgHbe strict. A -bialgebra for a F-generalized
pentagonal law is a ?G,F?-bialgebra (X,X,X) such that the following pen-
tagonal diagram commutes:
GX
G(X)
??
X
??X
X
??FX
G(HX)
X
??FGX
F(X)
??
where is a F-generalized distributive law of the functor G over the functor
F, i.e. : GH
The full subcategory of BialgG,F of -bialgebras is denoted by Bialg.
FG, and F(X,X) = (X,X).
Turi-Plotkins original notion of -bialgebra, for the case of F,G functors,
can be recovered by taking H ? F and F ? IdCoalgF. For the case of F,G
4
Cancila, Honsell, Lenisa
monad and comonad considered in [TP97], one can probably give a corre-
sponding generalization of the distributive law, but this is out of the scope of
the paper.
Interesting classes of generalized -bialgebras are the I-bialgebras, which
we define as follows:
Definition 1.5 [I-bialgebra] Let I finNat. A I-bialgebra is a generalized
-bialgebra for H ? iIFiand F : CoalgF CoalgHdefined by F(X,X) ?
(X,?(X)i?), where (X)i: X Fi(X) is defined by induction on i as follows:
(X)0? idX,(X)i+1? Fi(X) (X)i.
In particular, for I {0,1} we recover the class of generalized -bialgebras
introduced in [Bar01].
Notice that the commutativity of the generalized pentagonal diagram of
Definition 1.4 still implies that X is a coalgebra morphism from the F-
coalgebra (GX,X G(X)) to the F-coalgebra (X,X). However, the dual
fails, in general.
The important property of -bialgebras is that final coalgebras in the un-
derlying category of coalgebras lift uniquely to final bialgebras in Bialg:
Proposition 1.6 Let : GH
G over F. If (,) is a final F-coalgebra, then there exists a unique :
G such that (,,) is a -bialgebra. Moreover, (,,) is final
in Bialg.
FG be a F-generalized distributive law of
Finally we recall the definition of pointed endofunctor and monad, and we
introduce two distinguished monads which will be used in the sequel.
Definition 1.7 [Pointed Endofunctor, Monad]
A pointed endofunctor over a category C is a pair ?T,?, where T is an
endofunctor on C and : Id
A monad is a triple ?T,,?, where ?T,? is a pointed endofunctor, is
called the unit of the monad, : T2
the multiplication of the monad, such that the diagrams below commute:
T is a natural transformation.
T is a natural transformation, called
T
id
??????????
T??T2
??
T
T
??
id
??????????
T2
??
T3
T
??
T
??
TT
T2
??
Definition 1.8 [Corecursion Monad] Let F : C C have final coalgebra
(,). Let T+
X. T+
where in1, in2are the canonical sum injections.
The functor T+
defining
X= in1: X X + ,
5
F: C C be the functor defined by
FX = X + ,
f : X Y. T+
Ff = [in1 f,in2] ,
Fcan be endowed with a structure of monad ?T+
F,,? by
X= [id,in2] : (X + ) + X + . 0 3448190970 2457828852,1299928679,30648697