245 19 39MB
English Pages 321 [328] Year 1991
Table of contents :
Cover
Distribution
Half Title
Foundations of Computing
Title
Copyright
Table of Contents
Series Foreword
Introduction
Dedication
Book Title
PART I - Categories and Structures
1 - CATEGORIES
1.1 Category: Definition and Examples
1.2 Diagrams
1.3 Categories out of Categories
1.4 Monic, Epic, and Principal Morphisms
1.5 Subobjects
2 - CONSTRUCTIONS
2.1 Initial and Terminal Objects
2.2 Products and Coproducts
2.3 Exponentials
2.4 Examples of CCC’s
2.5 Equalizers and Pullbacks
2.6 Partial Morphisms and Complete Objects
2.7 Subobject Classifiers and Topoi
3 - FUNCTORS AND NATURAL TRANSFORMATIONS
3.1 Functors
3.2 Natural Transformations
3.3 Cartesian and Cartesian Closed Categories Revisited
3.4 More Examples of CCC’s
3.5 Yoneda's Lemma
3.6 Presheaves
4 - CATEGORIES DERIVED FROM FUNCTORS AND NATURAL TRANSFORMATIONS
4.1 Algebras Derived from Functors
4.2 From Monoids to Monads
4.3 Monoidal and Monoidal Closed Categories
4.4 Monoidal Categories and Linear Logic
5 - UNIVERSAL ARROWS AND ADJUNCTIONS
5.1 Universal Arrows
5.2 From Universal Arrows toward Adjunctions
5.3 Adjunctions
5.4 Adjunctions and Monads
5.5 More on Linear Logic
6 - CONES AND LIMITS
6.1 Limits and Colimits
6.2 Some Constructions Revisited
6.3 Existence of Limits
6.4 Preservation and Creation of Limits
6.5 ω-limits
7 - INDEXED AND INTERNAL CATEGORIES
7.1 Indexed Categories
7.2 Internal Category Theory
7.3 Internal Presheaves
7.4 Externalization
7.5 Internalization
Appendix
PART II: Types as Objects
8 - FORMULAE, TYPES, AND OBJECTS
8.1 λ-Notation
8.2 The Typed λ-Calculus with Explicit Pairs (λβηπt)
8.3 The Intuitionistic Calculus of Sequents
8.4 The Cut-Elimination Theorem
8.5 Categorical Semantics of Derivations
8.6 The Cut-Elimination Theorem Revisited
8.7 Categorical Semantics of the Simply Typed Lambda Calculus
8.8 Fixpoint Operators and CCCs
9 - REFLEXIVE OBJECTS AND THE TYPE-FREE LAMBDA CALCULUS
9.1 Combinatory Logic
9.2 From Categories to Functionally Complete Applicative Structures
9.3 Categorical Semantics of the λ-Calculus
9.4 The Categorical Abstract Machine
9.5 From Applicative Structures to Categories
9.6 Typed and Applicative Structures: Applications and Examples
10 - RECURSIVE DOMAIN EQUATIONS
10.1 The Problem of Contravariant Functors
10.2 0-Categories
11 - SECOND ORDER LAMBDA CALCULUS
11.1 Syntax
11.2 The External Model
11.3 The External Interpretation
11.4 The Internal Model
11.5 The Internal Interpretation
11.6 Relating Models
12 - EXAMPLES OF INTERNAL MODELS
12.1 Provable Retractions
12.2 PER inside ω-Set
12.3 PL-Categories Inside their Groethendiek Completion
BIBLIOGRAPHY
Index
, MIT LIBRARIES
is 3
9080
00720
of
Computing Series
0824
t t
t l t t t
t
C ategories Types ,
t
t t
and Structures
t
t t t
An
Introduction to Category Theory
for the
Working Computer
t t t
t
t
t t t t
t t
t l t
t t
Andrea Asperti and Giuseppe Longo
Scientist
The MIT Press
This
file
has been authorized and provided by the
publisher,
to
make
The MIT
available
Press, as part of
in digital
its
form older
ongoing efforts
titles
that are
no
longer readily available.
This
file is
lending,
provided through internet Archive for library
and no further reproduction or
distribution
allowed except as permitted by applicable law or writing
by the MIT Press.
in
is
Categories, Types,
and Structures
,
Foundations of Computing Michael Garey and Albert Meyer, editors
Complexity Issues
in
VLSI: Optimal Layouts for the Shuffle-Exchange Graph and Other
Networks Frank Thomson Leighton, 1983 Equational Logic as a Programming Language, Michael
J.
O’Donnell, 1985
General Theory of Deductive Systems and Its Applications,
S.
Yu
Maslov, 1987
Resource Allocation Problems: Algorithmic Approaches, Toshihide Ibaraki and Naoki Katoh, 1988
Algebraic Theory of Processes, Michael Hennessy, 1988
PX:
A
Computational Logic, Susumu Hayashi and Hiroshi Nakano, 1989
The Stable Marriage Problem: Structure and Algorithms, Dan Gusfield and Robert
Irving,
Realistic Compiler Generation, Peter Lee, 1989
Single-Layer Wire Routing and Compaction,
F. Miller
Maley, 1990
Basic Category Theory for Computer Scientists, Benjamin C. Pierce, 1991
Categories, Types,
and Structures: An Introduction
to
Category Theory for the Working
Computer Scientist, Andrea Asperti and Giuseppe Longo, 1991
1989
Categories, Types, and Structures
An
Introduction to Category Theory for the
Andrea Asperti Giuseppe Longo
The MIT Press Cambridge, Massachusetts
London, England
Working Computer
Scientist
© 1991
Massachusetts Institute of Technology
All rights reserved.
No part of this book may be reproduced in any form by any electronic or mechanical means
(including photocopying, recording, or information storage and retrieval) without permission in writing from the publisher.
This book was printed and
set in
bound
Times Roman and Symbol using
in the
electronic
media supplied by the authors.
It
was
United States of America.
Library of Congess Cataloging-in-Publication Data
Asperti, Andrea.
Categories, types, and structures scientist / P.
:
an introduction to category theory for the working computer
Andrea Asperti, Giuseppe Longo.
cm.
— (Foundations of Computing)
Includes bibliographical references.
ISBN 0-262-01125-5 1.
Programming languages (Electronic computers)
G. (Giuseppe)
QA76.7.A76
005.13—dc20
II.
Title.
III.
2.
Categories (Mathematics)
I.
Longo,
Series.
1991
89-49085
CIP
7c, then there exist
0
g:
if
g:
a-*b and
h:
a-*c; moreover, composition must be associative and an identity must
exist for all objects.
This
1.1.1 -
is
the formal definition:
Definition a collection
A category C is ObQ of objects denoted by a, b ... A, B More of morphisms (arrows), denoted by f g .
,
-
a collection
-
two operations dom, cod assigning
-
an operation id assigning
( source )
dom(id\j) -
and codomain
-
cod(idfr)
an operation
"
arrow f g such 8
-
identity
that
.
.
.
(target) of f to
each object b a morphism id ^ (the identity of b) such that
= b each pair f g of arrows with dom(f) = cod(g) an
dom( f°g) = dom(g), cod( f 8 g ) =
and composition, moreover, must satisfy
identity law: for
.
each arrow f two objects respectively called domain
to
” (composition) assigning to
8
.
any arrows f g such
cod(f)
the following conditions:
that cod(f)
- b - dom(g)
Categories
4
idb’f = f
g'idb = 8 associative law: for any arrows
f
g,
h such that dom(f) = cod(g) and dom(g) = cod(h)
(fog) •h=f*(g*h).
We write
f:
two objects
a -* b to denote a a
and
b, the collection
writing fEC[a,b]
moment we
is
of
way
thus a third
all
morphisms
table lists
f
some common
and
target are respectively a
such that
to express the fact that
one notation or the other
shall use
The following
morphism whose source and
f:
a -*
b
dom(f) =
is a,
b.
Given
denoted by C[a,b]; the
and cod(f) =
b.
For the
indifferently.
categories
by specifying
their objects
and arrows,
letting
the definition of their operators as an exercise for the reader:
The
Category
Objects
Morphisms
Set
sets
functions
Top
topological spaces
continuous functions
Vect
vector spaces
linear transformations
Grp
groups
group homomorphisms
PO
partially ordered sets
monotone functions
intuition of the notion of “category” suggested
objects as a collection of “structured” sets and the
functions with respect to the structure. This the definition
which may force
simple example
is
the
is
by the previous examples
morphisms
to
is
the category Rel with sets as objects and relations as
usually called
1.
Note
that,
the identity
law
id^'
,
= id^
0
id^'
= id^
.
of some object: in this case a category
is
made
in
be “single valued” or to be functions in extenso: a
The simplest category has only one object and one arrow category
consider the
too restrictive, though, since no requirement
morphisms
has an identity id^: b-*b. The identity
is to
as the “associated” or “acceptable”
by
definition, if
is
unique, since
C
is
a category, then every object b of
id^'
if
morphisms.
(the identity for that object): this
is
C
another identity for b, then for
A category is called discrete if every arrow is the identity is fully
determined by the collection of
its
objects. 1 is a
discrete category.
A category is called a preorder if for every pair of objects f:
a-*b.
relation
The reason
among
defined; thus are
C
its is
for the
known
is
a,
there
is
f:
b there
that a preorder category is fully
objects. Indeed, in a preorder C, there is only
known when
known. But every arrow
target are
name
the collection of
morphisms
one way
More
a-*b may be identified with the pair
no choice about what the arrow
is
is
at
most one morphism
determined by a preordering that
composition
may be
dom
and cod
and the operations (a,b), since
once the source and
to be; thus, all the information about the
5
Categories
category
C
is
relation. (Exercise:
the category 2,
=
prove that the relation
Every discrete category
is
which has two
and an arrow
idg, idi
Rc
given by the relation
(0,1):
{(a,b)
there
/
is
an arrow fEC[a,b]}, that
Rc is a preorder for every category C them 0 and
objects, let us call
1,
way we can
0-*l. In a similar
preorder category n, from the usual ordering on the set {0,1,
common
property: they
may have
a preorder
is
and three arrows: the two
.
.
is
identities
number n
define for each natural .
a preorder
).
The simplest nondiscrete category which
a preorder.
by
is,
a
n-1}. Preorder categories have a
plenty of objects, but given two objects, there exists
at
most one
morphism between them.
A
dual situation
is
given by monoids, viewed as categories.
associative binary operation and an identity element.
where composition of morphisms
is
A
monoid
a set having an
is
A category with just one object yields a monoid,
the binary operation. Conversely, any
monoid (A,
•
) is
a
category with just one object. For example, the category with the set of natural numbers as unique object and the recursive functions as
As
yields the
monoid of the
recursive functions.
well as preorders, another example where objects are not necessarily understood as
given by deductive systems as categories. In these categories propositions are
“structured sets”
is
objects and each
morphism
b
(a entails b).
i
:
a
morphisms
Observe
f
:
a-*b corresponds
to (a suitable equivalence class of) a
proof of a
that a category is obtained easily in the presence of the identical entailment
a-+a and the associative composition of proofs f
:
a-*b
g This approach to deduction
is
0
g
f
:
:
b-»c
a-*c
very relevant in the categorical understanding of logics of a
constructive nature, such as intuitionistic logic, where the intended interpretation of proofs
by
(effective) operations.
It
will be the
main paradigm
and objects investigated in the second part of
1.2
An
|-
this
for understanding the relation
is
given
between types
book.
Diagrams important tool in the practice of Category Theory
equations. In a diagram a
commutes
if
morphism fEC[a,b]
the composition of the
is
drawn
is
the use of
as an arrow
diagrams
from a
to
for representing
b labeled
morphism along any path between two fixed
commuting diagrams:
A diagram
objects
For example, the associative and identity laws of the definition of “category” visualized by the following
f.
is
may be
equal.
nicely
;
Categories
6
Diagrams
are a typical
be particularly effective
diagramj and
as “if
.
way,
when .
.
in
Category Theory, to describe equational reasoning and turn out to
dealing with several equations
at a
diagram n commute, then diagram
time. In particular, assertions such
commutes” express conditional
statements about equalities.
We hope that the reader, while using this book, will will learn this
how
go back and forth from diagrams
to
book comes from our
acquire
some
to equations.
familiarity with diagrams
and
Our extended use of equations
desire to stress the “computational” nature of
in
most categorical reasoning.
Categories Out of Categories
1.3
A main feature
of Category Theory
simpler ones. In this section
we
is
the facility to define new,
more
structured categories out of
consider only a few simple constructions; a
number of
other
examples occur throughout the book.
A
1.3.1 Definition i.
ii.
Obj)
for all
iii.
A
category
D
is
a subcategory of a category C,
a,
b
in Obj),
D[a,b]
CC[a, b] D coincide with those of C. ;
composition and identities in
subcategory
is full iffor all a,
b
in
Obj) D[a,b] « C[a,b],
A full subcategory is fully determined by
morphisms ofC,
that
in the
collection of objects.
C
id°Pfr
=
idfr
dom°P(f) =
cod(f), cod°P(f)
has the same objects and the same
= dom(f), and f
P
g - g °f
C°P[b,a] = C[a,b] and (C°P)°P = C.
Exercise Set°P
Duality
its
The dual category C°P of a category
1.3.2 Definition
Note
if
C ObQ
is
is
a subcategory of Rel, but not of Set. Is
it
a very powerful technique of Category Theory. If
language of Category Theory, the dual of P (P°P)
word “dom” by “cod,” “cod” by “dom,” “g
0
h” by “h
0
is
a full subcategory?
P
is
a generic proposition expressed
the statement obtained
g.” If
P
is
by replacing
true in a category C, then
the
P°P
7
Categories
C°P;
is true in
P
if
is
P°P
true in every category, then also
since every category
is,
the dual of
is
its
dual.
may be
Duality
C°P
is
obtained by simply inverting the arrows; of course, a dual diagram commutes
if
and only
if
the original one does.
(iff)
the pairs (a,b)
is
and
(fg) °(f,g') = (f of,
g
o
Given a category
C
and an object a
Ob£ j a
so defined:
composition in
C
is
Cja
g
')
g
/
it is
A under g). Then
A-*I
(denoted C/I). stage
I.
B-*B'
h:
is a
{g‘*(a)} a
f:
B
and
C
Set j
in
A
as an
(these sets are the inverse images of
£A
morphism from
B-»A
g:
to
induced by g and
B'-*A
g':
i.e., if
g',
if
and only
and only
if
if (iff)
h(b)Eg'"l(a).
as a collection {{i}xg‘l(i)}iei>
An
of objects
b-*a, g: c-*a, a
B-*A
useful to think of an object g:
disjoint sets, namely,
CJI
Since the intended meaning behind the construction of a category object g:
C la
the category
Obc,
in
cod(f) - a}; given two objects
an arrow hEC[b, c] such that g °h = f Identities and
is
Set in the above definition,
Vb bEg'l(a) =>
(fg):
Finally, id(a> b)
m
= {fEMorc
target
consistent with the “decomposition” of
it is
has for objects
are inherited from C.
A-indexed family of elements in
CxD
'
morphism with source f and
In case
product category
the
where a and b are respectively objects of C and D, and for morphisms pairs
1.3.4 Definition
over a
and D,
where f: a —*a and g: b-*b' are respectively morphisms of C and D.
(a,b)-*(a',bj (ida, idfr)
C
Given two categories
1.3.3 Definition
=
applied to diagrams as well: given a diagram in a category C, the dual diagram in
object
A section of
g:
g:
A-*I of the
A-*I
C|I
usual to call
is
slice category is then called a
a function
is
it
s:
I-*A such
that
g
0 s
=
is
that to consider an
category over
a slice
generalized object of the idea
idj;
is that
s
C
I
at
gives,
for each index iEI, an element s(i)Eg'l(i).
Exercise Define the dual notion, that the arrows with source
1.4
the category
Cfa
of objects under
whose
a,
objects are
Monic, Epic, and Principal Morphisms
A function f(a')
is,
a.
f
then a =
between two a'.
A
sets
and
In particular, given any
cEC
= h(c)
then for
all
behaves
like a left identity
pair of functions
g(c)
g,
h
:
or, also, if
(it is left
C-*A
,
f
B
is
called “injective”
two functions
f°g
=
cancelable). °
g =
f
°
h
f°h
g,
h
:
when, for
C-*A,
then g = h
The converse implies
is
g = h
.
all
if for all
,
cEC
a'
EA
f(g(c))
,
if f(a)
=
=
f(h(c)),
Thus, every injective function
also true: given ,
a
then
f
f:
A-*B,
is injective.
if for
any
For suppose
Categories
8
otherwise: then there are a and
= a for
cEC
all
and h(c) =
,
such that
a'
=
but a *
f(a')
a'
f°g
cEC; of course
for all
a'
f(a)
;
=
define then g and h by g(c)
f°h
g * h
but
,
that
a
is,
contradiction.
We have proved thus that a function similar
way
it
f is injective if
not difficult to prove that f
is
These considerations motivate the following
C be
Let
1.4.1 Definition
an arrow hEC[a,b]
i.
g-h=f-h h‘g
implies g = h
g°f=h°f
.
In a
implies g = h.
a,
b&Ob£. Then
an epimorphism)
iff
monic
(is
a
monomorphism)
iff
= h'f => g -f;
g °h =
is
iso (is
is
and h
id
objects a and b are
any isomorphism
(is
f°g = f°h
g=f;
is
an arrow hEC[a,b]
iii.
Two
=>
an arrow hEC[a,b]
ii.
epic
if
definitions.
a category and
is
and only
surjective if and only if
is
0
g=
an isomorphism )
gEC[b,a] such
that
id.
isomorphic
monic and
iff there exists
(a
* b)
there exists an
if
isomorphism hEC[a,b]. Clearly,
epic; the converse, though, does not
need
to
be true (see the example
and the exercises below).
A
monic
such that g
0
(or epic)
hEC[a,b]
h = id
0
(h'
=
g'
(or h'EC[a,b])
split if there exist
is
(or
g'EC[b,a])
id).
Although the
intuition of regarding
mono- and epimorphisms
many
interesting categories,
sometimes
correct for
gEC[b,a]
it
as injective
and surjective maps
Mon of monoids and the inclusion inc from co, the positive integers, into z, the relative ones. mono, inc
is
also epi, though.
\g(n) for g(-n).
Then g
a)).
As
inc = h
0
behavior of the monoids’
a matter of fact, take 0
we may
g,hEMon[z,a] for some monoid
inc implies g = h for g(-n)
homomorphism g
a side consequence,
an isomorphism:
As
is
can be misleading. Consider, say, the category
or h on z
is
=
\g(n) =\h(n)
entirely determined
= h(-n) by
also conclude that not every arrow that is both
a,
Clearly
and write
(that
is,
their behavior
the
on
monic and epic
is
this is clearly in contrast to the set-theoretic intuition.
Exercises 1.
Give an epi which
2.
Find a counterexample for the following assertion:
are 3.
mono, then
Prove
a
is
that a split
is
isomorphic to
monic
1.4.2 Definition Let i.
not surjective in Top.
C
is
an
b.
is
C be
(Note that the assertion
iso.
be a category and
an arrow hEC[a,b]
let
a,
bEObQ. Then
a principal morphism
Vf€C[a>.,b]3geC[a,a]
f=h-g;
iff
a category; if fEC[a,b] is
true in Set.)
and gEC[b,a]
.
.
9
Categories
ii.
By
a pair of arrows f&C[a,b] and gEC[b,a]
is
retract of b (a h°i°g = h°i°f => g = f
h°g. Just take
h°i 6 f
=
f.
2.
g°h = f°h => g°k = g°h°g' = f°h°g' = f°k (for a suitable
3.
Let a
Cja
common
target a, then
that in this case, the
f°k = f°k' => k =
unique k'.
determined by monomorphisms
11
Categories
When
f^g
and
gsf
we
write
monomorphisms with common
f
target
*
(prove
a
equivalence relation are called subobjects of
1.5.1 Definition Let a
class of a
Very
we
we
it
an equivalence relation
the
as an exercise); the equivalence classes of this
A
subobject
of a
[f]
*
b-*a, with respect to the equivalence relation
make no
among
a.
be an object of a category C. f:
is
between equivalence classes and
is
an equivalence
defined above.
their representatives,
and
should be clear that the categorical approach to “subsets” carries more information than the
set-
often,
shall It
monomorphism
Then *
g.
shall
distinction
denote a subobject with a single monomorphism.
theoretic one.
Monomorphisms,
like all
category. For example, in the category
must take the
identity to the identity
morphisms, preserve the structural information of the
Grp
of groups subobjects are subgroups: (mono)morphisms
and preserve the group operation. Similarly consider the category
of p.o. sets (partially ordered sets) with a bottom element. a structured subset as well,
and
References Any book
in
(1973), Arbib and specific notions settings,
Manes
it
A subobject of one such p.o.
must contain an element smaller than
all
set
must be
the others.
Category Theory, such as MacLane (1971), Herrlich and Strecker
(1975), Barr and Wells (1985), Rydeheard and Burstall (1988).
and categories introduced (such as retractions) will be used
with the appropriate references.
later in
more
The
structured
Chapter 2 Constructions
In this chapter
morphisms)
we
consider
language there
this
some fundamental
that satisfy a given set of
no way
is
must be defined by
categorical constructions,
axioms described
to look at the internal
their relations
in the
i.e.,
particular objects (and
language of Category Theory. Since
membership
structure of objects,
all
in
the concepts
with other objects, and these relations are established by the
existence and the equality of particular morphisms. This property of the categorical language,
compared
to the traditional set-theoretic jargon,
science; namely, as
we
may be
well understood by an analogy with computer
already mentioned, the categorical description corresponds to an abstract data
specification, while the traditional set-theoretic approach is
2.1 Initial
if
more
similar to a concrete implementation.
and Terminal Objects
2.1.1 Definition Let
C be a
category.
An
object 0
is initial iff for
any
bEObQ
there
is
a unique
f€C[0,b].
the 0 in Set; indeed the empty function function whose graph is empty) is the unique arrow with 0 for source. A more interesting example is the following. Let 2 be a signature. The class Alg£ of 2-algebras
The
typical
example of an
initial
object
is
the
empty
set
(i.e.,
with 2-homomorphisms as arrows forms a category. Alg£ has an word-algebra, or also Herbrand Universe for 2. The set of
set
all
well-formed expressions of
are nonterminals
sort
If
s.
2
is
derived by a context free
grammar from
the nonterminal
corresponds to the syntax of a language of signature 2.
Any
semantic domain; the semantic function (interpretation)
is
Initially
is
object
T^ which
grammar
and operator symbols are productions of the grammar), then
parse trees for derivations in the
unicity of
initial
s.
called 2-
other 2-algebras
the unique
satisfying certain properties. This
T^s
is
(that
is:
sorts
the set of
all
In general the initial 2-algebra Tj;
method
A in Alg^ is a possible
homomorphism from
the simplest universal notion in Category Theory, since
morphisms
is
T^ s (the carrier of Tj of sort s) is just the
is
it
is
Tj; to A.
given by the existence and
used everywhere
in
Category
Theory.
2.1.2 Proposition If
Proof Let 0
i:
then
i:
0—O', j:
0 and
O
O'—
O'
the
are two
initial objects in
morphisms
0-*0, but also idg: 0-*0, and since by 0 j
i
=
idg; in the
same way, by
initiality
initiality
a category C, then they are isomorphic.
respectively given
of
O'
by the
of 0, there
we
have
i
0 j
initiality
is
exactly one
=
idg'.
of 0 and
morphism
O'.
Then
j
in C[0,0],
Constructions
14
We will now show how duality can be used to define new concepts and to prove new assertions. such that dom(f) = c, cod(f) = b.” By Let P(c) be the property “for any bEObc there is a unique f,
definition c
P defines
is,
initiality.
The dual statement of P
c, bEObc there is a unique f, such Q defines a concept named by prefixing “co-” to the name of the property
“for any
cod(f) =
that
property
P°P
say that
P(c) holds; that
is initial iff
common
defines coinitiality.
An
object c such that P°P(c) holds,
is
known
as terminal object.
Note
P°P(c) =
Q°P
of a
we
Q. In our case,
Anyway
is called coinitial.
name which
practice to assign to every coentity an independent
properties; for example, a coinitial object
is
dom(f) = b.” Usually the dual
is
it
better expresses
its
that an initial object
is
coterminal.
Terminal objects are usually represented with the number
morphism from an object
Any
singleton set
terminal. If c
Consider dual
Its
to
is:
in C, then
“If 0
be an isomorphism
chapter
1
is
and
it
is
is
1
or with the letter
usually written
t.
The unique
a-*t.
!a:
is initial
and the other one
is
terminal in the dual category C°P.
P^ = “If 0 and
the statement
Pi°P =
t
terminal in Set. In the category 2 one object
is
is initial
now
a to the terminal object
O' are
the dual of
O' are
two terminal itself:
prove
two
initial objects,
then they are isomorphic .”
objects, then they are isomorphic.” it
as an exercise.)
By
and, since by proposition 2.1.2 Pi holds in every category,
(The property
our discussion of duality in
Pi°P
also does.
We conclude
the following:
2.1.3 Proposition
If
and
0
O'
are two terminal objects in a category C, then they are
isomorphic.
Proof By
An
duality and
by proposition
object c in a category
in this case,
it
C may be both
it is
quite
a.
and terminal.
the singleton {*} to a set
arrow from a terminal object or a point of
initial
An
example
is
the unit group in
Grp;
called a zero object.
is
morphism from
In Set, a
2.1.2.
t
to
A defines an element of A.
an object a in a generic category
In this case, however, the set-theoretic intuition
common
to
work
in categories
where
C
is
For
this
reason an
usually called an element
must be used very
carefully, because
the categorical notion does not reflect the behavior of
elements in Set. For example the set-theoretic intuition would suggest that every noninitial object
must have s
at least
2; clearly
0
one element: but consider the
is initial
two arrows are equal one has
f
* g
generic category
iff
iff
there
and 2
is
terminal,
they coincide on is
all
1
partial order category is
noninitial but has
points, or,
no elements. Similarly,
more formally, given functions
an element x of their domain such that
C with terminal object
t,
3 which has 3 objects 0 s
this is not necessarily true.
f (x)
*
g(x).
f
Set
in
and
However,
1
g,
in a
;
15
Constructions
C
2.1.4 Definition Let
fgEC[a,b], one has:
C
tEObQ
be a category.
is
=> 3hEC[t,a] f°h * g°h
f*g
has enough points (or
is
well pointed),
if
a generator
a,bEObc and
iff for all
all
.
there exists a generator
that is terminal in the
t
given category.
In short, a category has
enough points when the arrows from the terminal object allow
between morphisms, similarly as for elements over
Set.
Of course,
theoretic notions of “element” and of “extensionality” are
not a surprise that the set-
is
it
to discriminate
somewhat awkward
with in the
to deal
language of Category Theory.
and Coproducts
2.2 Products
The
categorical product
Given two
sets.
merely a “structural” generalization of the notion of Cartesian product of
A and B, their Cartesian product is
sets
AxB
is
= {
/
xEA, yEB}.
Associated with this set there are two special maps p^;
such that for every in
Pb( c )> = Let
C
=
f.
(c) = =
C
2.2.1 Definition Let
,
>c
PB^^)
g.
)
=
pg:
,
y-
AxB-*B
Note
= pa(
Conversely,
h(c), that
called projections,
that for every c in
AxB,
is,
let
=
0
pa
0
for every
cEC,
h.
the following definition:
be a category and a,bEOb£. The categorical product of a and b ,
an object axb together with two morphisms
cEC, pa( (c)
same way, we obtain pg
pb
=x
c.
be another
for every
AxB PA( )
is
p a axb ->a, p^: axb -*b, and for every object c an C[c,a] xC[c,b] -*C[c,axb] such that for all morphisms f: c-*a, g: c-*b, h:
:
:
c-*axb, the following equations hold:
Pa °c=f; ibii.
It is
Pb °c-g c =
common practice
The operation < is
,
to
>
:
h.
omit the subscript c in
c when
its
meaning
is
C[c,a]xC[c,b]-*C[c,axb] of a categorical product
the operation that takes every arrow
The proof that these operations
hEC[c,axb]
to the pair (pa 0 h,
are inverse of each other
is
stated
Pb
above
0
clear is
from the context.
a bijection:
its
inverse
h )EC[c,a]xC[c,b].
in definition 2.2.1.
Constructions
16
Conversely, given a bijective operation < (ib),
then
(ii) is
necessarily true. Indeed,
pair (f,g)EC[c,a]xC[c,b] such that
= Pb
The
last
°
thus
>
h =
C[c,a]xC[c,b]-*C[c,axb] which
:
h£C[c,axb]. Then, since
satisfies (ia)
is bijective,
there
and is
a
h and analogously, g = pb
0
,
h >.
consideration leads us to a
more compact but equivalent
definition of a categorical
product.
2.2.2 Definition Let
C be
a category and a,bEObQ. The categorical product of a and b ,
an object axb together with two morphisms
and gEC[c,b], there
exists exactly
pa axb-*a :
,
p^: axb-*b, such
that,
for any fEC[c,a]
one hGC[c,axb] such that the following diagram commutes: c
a
b
axb
also has
if it exists.
and qb-
axb
By symmetry, one
axb-* cxd.
e-*b, fxg° = .
alternative product with projections q a
< Pa>Pb >
•'
0
qb> =
id a
®b
-
is
.
17
Constructions
Exercises Prove the following 1.
a
2.
axb
a'
and b *
facts:
imply axb
b’
a'xb\
bxa.
2.2.5 Definition
A
C
category
contains a terminal object
L
it
ii.
every pair
Cartesian (C
is
is
a CC)
iff
t;
a,bEObQ has a
categorical product (axb,
p a,b,l
:
axb-*a,
p a> b,2
:
axb-+b).
Exercises 1.
Generalize the definition of a product of two objects to arbitrary products.
2.
Prove that a Cartesian category
3.
Let
C be a CC and let
Examples The
An
t
be
its
C
always contains
terminal object. Prove that for
categories Set, Top,
Grp
EN
are pairs a
enumeration of
a).
=
(a,e a ),
fEEN[a,b]
where
iff for
Theory
a
some
is
is
b
in
Ob^, b * txb
the category
a countable set
bxt
*
to
EN
and e a w-*a :
of numbered is
an onto
sets.
map
(an
f the following diagram commutes:
total recursive
f
e
all
are all Cartesian.
interesting Cartesian category in Computability
Objects in
products.
all finite
w
e
a
a
b
b f
We [,]:
say that f represents
The product
is
easily obtained
by using any
effective pairing of 0)2,
o)xa)-*a>.
A typical
numbered
set
with a Godel numbering
Of
f.
course, this
is
:
which
is
worth studying
is
PR
=
(PR,-*o) be an effective pairing. Define then, as usual,
function
3f EPR
iff
f(x,y)
= f ([x,y])
f:
partial recursive functions
coxod-^o)
is
f:
o)xo)-*o)
is partial
[,]:
a binary partial recursive
n *
(similarly, for n-ary functions,
s-m-n iteration theorem one immediately has
and
2).
recursive
By
iff
this
and by the
3sER
=
4>s(x)(y)
f(x,y)-
Thus, a two- (or more) argument function f
and the function x
|- f(x,_)
computability theory, f
also “computable,”
we need
C
is in
is
it
4> s
computable
(x )
=
in
each argument
f(x,_). In other
words,
in
cd-^cd-^o)). Similarly, the categoryf:
cxa-*b, of a morphism within
as s or x |- f(x,_) in recursion theory.
computable
We will call
it
A(f).
each argument needs
to
be
be a Cartesian category, and a,bEObQ. The exponent of a and b
is
computable. {Hint: take g
2.3.1 Definition Let
3sER
i.e.,
not every n-ary function which
2,
iff
concerns the existence, for any
which does the same job
Exercise For n *
computable
coxcu-^o) iff x |- f(x,_)
is in
theoretic closure property
the category,
is
is
total
is
in
nonrecursive and set f(x,y) = g(min{x,y})
).
an object b° together with a morphism evalajj: b°xa-*b (evaluation map), and for every object c an
Ac
operation
:
C[cxa,b]-*C[c,ba] such that for
all
morphisms
f:
cxa-*b, h: c-*b a the following ,
equations hold:
A q.
eva la,b °(A(f)xida)
=/;
Ac(evala> b °(hxida)) = h.
(We may omit
the indexes
when unambiguous, as
usual.)
A and B is B A = {f / f is a function from A to B}, thus B A = Set[A,B]. The function eval: B A xA-*B is given by the rule: eval() = f(x) A: Set[CxA,B]-*Set[C,B A takes every function CxA-*B to the function A(f): C-*B A defined by A(f)(c) = Xa.f(c,a), where Xa.f(c,a)EB A -Set[A,B] is the function which takes aEA to In Set the exponent set of
f:
]
The proof of (P) and
f(c,a)EB.
As
in the case
definition 2.3.1
hEC[c,b a ]
Indeed,
let
A(eval a> b
0
if
A
b
0
:
C[cxa,b]-*C[c,b a ]
(r|),
is
A‘l
is
the operation
a bijection and (p) holds, then
take fEC[cxa,b] such that
(A(f)xid a )) = A(f) = h is
by (p) and
which takes every
(hxida)EC[cxa,b].
hEC[c,b a ] and
The following
almost immediate.
a bijection. Indeed,
is
to eval a
Conversely,
(rj) is
of the product, observe that in general the operation A: C[cxa,b]-*C[c,b a ] in
h = A(f); then
.
thus an equivalent definition of “exponent”:
(r\) is
necessarily true.
A(eval a> b
0
(hxid a )) =
Constructions
20
2.3.2 Definition Let
C be
object b° together with a exists
a Cartesian category and a,bEOb£. The exponent of a and b
morphism evala
fr tflxa-*bf such that for all
morphisms
is
an
cxa-*b, there
f:
one and only one h: c-*ba such that the following diagram commutes:
Exercise
By
setting A(f)
=
h,
give the details of the equivalence proof between the two definitions.
The previous diagram should suggest
in
which sense b a “represents” C[a,b]. The eval morphism
generalizes the set-theoretic evaluation function eval(f,x)
Then
object.
C[t,b a
« C[txa,b] a C[a,b] as
]
This
sets.
=
is
Moreover, take c =
t,
the terminal
particularly significant if
C
has enough
f(x).
points (why?).
a Cartesian closed category
is
(CCC)
iff
C is Cartesian;
i.
ii.
Set
C
Definition
2.3.3
for every pair
a
is
CCC:
Another simple
known, given
a,bEObQ
there
is
an exponent.
the previous definition of exponents in Set clearly holds for every pair of sets.
CCC is CPO, a
c.p.o.’s
and
the category of complete partial orders and continuous maps. b,
CPO[a,b]
is
As
well-
also a c.p.o., with respect to the pointwise ordering.
Moreover, both eval and A(f), defined as for Set by using continuous functions, are continuous
and
satisfy the required conditions.
function
is
continuous
Actually, even
Among
A
is
iff
it
is
Note
that the proof uses the
so in each argument and the
|-
fact that in
Xy.f(x,y)
is
CPO
a
continuous.
continuous.
the various examples of categories mentioned in these notes, an important one does not
satisfy Cartesian closedness: the category
EN[ia,&] (= R, the recursive functions) a
well-known
map x
morphism eval with
is
EN
in section 2.2. Consider, say,
surely countable.
However,
the above properties existed, then u(x,y)
=
if a
& - (co,id).
numbered
eval(qp(x),y)
Then
set (co^qp)
would be
and
a universal
function for R.
Also, the (o-algebraic c.p.o.’s, that
approximating
form
a
all
is,
the others (see Scott
CCC. They
contain, though,
the c.p.o.’s with a countable collection of
compact elements
domains below) and continuous maps
morphisms do not
some fundamental sub-CCCs
as
for the purposes of denotational
)
)
)
:
21
Constructions
semantics of programming languages and higher type Recursion Theory. They will be explored in the
examples below.
Given a
CCC D,
A
collection
it
subcategory such that
Exercise Prove that
In definition 1.4.2, 0
may be
interesting to consider specific "structures of types" in
of objects in D,
=
id a
ACD^ any
in
we
be the
let
full
and a,bED^ =>
CCC one has
a^ xc
sub-CCC generated by
(a^) c
turns out to be
mono and
a subobject of b in the sense of section 1.5. In the case of Set,
is
happen
is,
for a
the least full
introduced the notion of “retract”: in a category C, a
i.e.,
A function f: X->Y is
set
{y
of finite elements
|
y £ xq}
compact and y £ xq then y
Let
order preserving,
finite set
compact then the
xq
2.4. 1.2 Definition is
a Scott domain. This topology
|
usually called the Scott topology.
i
*Y)
(Y*
*x J implies
continuous
if for
f(i)
be
is
*Yf(j)
finite, if
function
will often
2.4.1.3 Definition
The category
morphisms. Let X,
Y
X
to
Y
f:
X->Y is monotonic
DCX, f(UD) =
In order to
is
show
is
D has
be objects ofD.
Ud(=Df(d).
f:
X-»Y
is
continuous
continuous with respect to the Scott topology.
Scott domains for objects
Y%
is
and continuous functions for
just the collection of the continuous functions
directed set
U
thus,
D
in
We have to prove that
a c.p.o.
Y^
that
then h by h(x) =
by g(x) and,
is
X
from
algebraic.
an upper bound
well defined since the set {fi(x)}j(=i is
g. is
Define
bounded
continuous because for every
=U ieI {fi(UD)}
= easy to check that h is
is
that {fi)i(=i has
one has:
=
Y^
bounded complete and
has a least upper bound in Y. Moreover, h
=
that
it is
bounded complete, assume
iElffiW}- The function h it
h(UD)
To show
it
if it
X in *x)
ordered pointwise.
Of course
It
iff
exists.
omit the subscript
Exercise Let (X,^x)> (Y, ^y) be Scott domains. Prove that a function according to the previous definition
it
is finite;
A
(We
every directed
always
compact.
c.p.o.’ s. •
is
is
U iei U X ED (fj(x)} U xED U iei {fi(x)> U xED {h(x)}-
a least upper
algebraic,
2.4.1.4 Definition
A
defined by: step-a,b
(x)
we
bound
if a
for {fi}i£I-
explicitly define the set
step function from
=
by the continuity of fj
zx then
X to Y is
b else
1
.
(Y^)q of its compact elements.
a function
step-a,b
where oEXq, bGYg,
25
Constructions
We claim that the compact elements of
are exactly the least upper
bounds of finite bounded
some
of step functions. In other words, for every fQG(Y^)o, (*) fo = Ui 6Ei{step-aj,bj} for
Let us prove
that every function f = Uiei{step-ai,bj}
first
Ui£i{step-ai,bi} exists,
(We
exists
Then, in
J
then say that
when
compatible
set
let
kED
for
,
=> bj = Uj£j{bi}
f
£ UheDigh}- 1°
particular, for every
u hED
{gh( a j)}- Clearly, for each
£ gh(j)(aj) for some h(J)ED. Since
be such
,
I.
and
exists
= Uj 0 j{aj}
aj
such that
directed. Let then bj
{ghlhED is directed, we are done.
I,
finite
is finite
I
of indexes.)
Y^
= bj £ (UheD{gh})( a j) =
compact and {gh( a j)}hED and
a
is
I
for each subset J of
be a directed family in
{ghlhED
let
as above, f(aj)
I
i.e.,
compact, when
is
sets
for all J in
* gh(j)
that
J,
bj
is
is finite
I
Clearly f £
I.
gk and
Prove
now
as an exercise that for every continuous function
1.
2.
f
{ UjQ{step-ai,bi}|
that
compatible
By
f
is
every
the exercise, f
element
finite
is
Interesting
and
bj
f:
£
X-*Y, one has f(aj) }
need
= UF,
f=
for
UF ^
to
is
directed;
F
prove that f = Ui£i(step-ai,bj}
directed; thus, there exists
:
Y^xX-*Y
is
some
for
finite
such that U^i{step-
I
UiQ{step-ai,bi}. In conclusion f
has the form (*) and, in particular,
in
The function evalx,Y continuous
We
compact.
ai,bj}EF and Ui(=i(step-ai,bi} ^ is,
I finite,
= UF.
Suppose then I.
F=
the set
= Uj£i{step-ai,bj};
that
X^ is a Scott domain.
defined by evalx,Y(f> x ) =
f( x )*
The proof
eval
that
is
straightforward.
examples of Scott domains may be found everywhere
of denotational
in the literature
semantics. Indeed, the Cartesian closedness of the category allows you to construct plenty of them as
products and exponents over
commonly used ground
of data (integers, booleans, strings,
and
set
x £
x'
iff
x =
1
or x
=
etc.).
x'.
That
types.
Organize them as
is,
consider your preferred types
add a
flat p.o. sets, i.e.,
These are clearly objects of
D
least
1
element
as well as their products and
exponents.
Other relevant examples are given, for example, by the co,
the natural numbers, and Pco, the powerset of
inclusion, f(n)).
exercise, the reader
Interestingly enough, these this for Pco
,
>
:
,
may check that both P and
two familar
see section 9.6-2 for
P of
p.o. sets
the partial
i.e.,
f
£ g
iff
Vn
(f(n) j
co to
given by set
=
g(n) =
Pco live in D.
structures are also reflexive objects in
more on
maps from
partial order, in these cases, is
D
.
We sketch the
P.
be a canonical (bijective and effective) enumeration of the
Let
BEX.
Let X,
Y
be two coherent domains.
A
function F:
X -* Y
is
stable
iff
continuous;
BEX A fB
Definition
=> F(ADB) = F(A)DF(B).
The category Stab has coherent domains as objects and stable functions as
morphisms.
Given two coherent domains 1.
X
|XxY| = {(0,z)
2. (a,z)t(a',z')
/
and Y, zE|X|
}
[mod XxY]
their
U
product
XxY
is
defined by the following:
{(l,z) / zE|Y| }; iff
a
a'
=> z
f z'
[mod
D(a)],
where D(0) =
X
and
D(l) = Y.
Exercise Define the projections and check that they are stable,
There
is
a simple
way
to obtain stable functions over coherent
i.e.,
prove that Stab
domains.
is
Cartesian.
28
Constructions
2.4.2.4 Definition Let to
X,Y be coherent domains. Let one has
such that, for all x,x'E\X\,
|y]
x}EX
{x,
also
f be an
{f(x),
injective function
f(x')}EY. Define then
from
\X\
f+:X-+Y
and /-: Y-*X by t
f+(a) = {f(z)/zea};
it
f(b) =
It is
{z
/
f(z)Eb }.
a matter of a simple exercise to prove that both f+ and
f'
are stable functions.
We need to construct next an exponent object out of the set of stable maps over coherent domains.
a
zE|y|, zEF(a),
is finite,
F
is
X-*Y
Let F:
2.4.2.5 Definition
be a stable function. The Trace of
(Va'Ca zEF(a') => a ,
completely determined by
its
trace
by means of
F
is
Tr(F) = {(a,z)
/
aEX,
a')}.
the following equation:
F(A) = {zE|Y|
/
3a
CA
(a,z)ETr(F)}.
Exercise Prove that the correspondence between stable functions and their traces
Notation The symbol ft
to represent strict
Definition Let \Y%\ = {(a,z)
2. 4. 2. 6 i.
a ff a'
ii.
a
f a'
Yx
Then
used
is
is
[modX] => z
[modX] => the
z
f f z'
f z'
/
aEX, a
coherence,
is finite,
zE\Y\
}.
i.e.,
A| TB
Moreover,
is bijective.
AfBandA^B.
iff
let
(a,z)
f (a',z')
iff
[modY], and
[modY].
arrow domain (exponent
object).
Exercises 1.
Prove that conditions
2.
Prove
=
(a,z)
3.
X—Y
is
X
Y
Let f,g
Define
f
:
sg
may be
stable then
stated equivalently as
not a|a'. is
a trace of
tr(F)EY x
=»
ftg
X,Y be
i.
a
U bEX
ii.
f(
0
)
=
0
(f
sB g
f
s
p
.
from
iff
Vx,yEX
f(a
xCy
=>
f(x)
X
to
Y
,
and conversely
= f(y)Dg(x)
Let moreover £p be the pointwise order. Prove that
g).
coherent domains.
=>
stable function
be two stable functions.
if and only if Tr(f) C Tr(g).
Let
some
.
that f £3 g fs B g => fspg;
ii.
4.
or
g (Berry's order)
Prove i.
(ii)
element of
that every
that if F:
and
z\\z'
or
(a',z')
(i)
A stable function
U b) = f(a) U
f(b);
f:
X-*Y
is
linear
iff
f
29
Constructions
Prove that singleton.
X-*Y
f:
Observe
linear iff
is
its
trace
is
f+
and
f"
maps
that the
formed of pairs
where the component
(a,z),
in definition 2.4. 2.4 are actually linear. Call
a
is
Lin
a
the
category of coherent domains and linear maps. 5.
Let
in
X
X-*Y,
f:
f(x)
X-*Y
g:
be two linear functions. Prove
£ g(x). Deduce as a corollary
that
on
that Tr(f)
linear functions
C Tr(g)
if
and only
if
for all x
between coherent domains the order
of Berry coincides with the pointwise order.
2.4.2.7 Definition
The function evalxy Y :
VA Y(A,B) = fy
stable. Continuity is trivial.
[mod Y^] then evalx,Y( (A,B)Pl(A',B')
defined by the following equation:
is /
3(b,y)eA, b
We
must only check
= evalx,Y( (A,B)
)
C B}.
Cl
)
(A,B)t(A',B')
that if
evalx,Y( (A',B')
).
The
inclusion
C is immediate by continuity. Take then z
evalx,Y( (A,B)
in
C
Note
3(b',z)EA',
b'
hypothesis,
Af A' and C BOB'
B'.
In conclusion, the category
f+
and
f~
Prove that f’°f+ = idx,
By
this
evalx,Y(
(A',B')
by definition of consistency
be defined as
X
0
h:c'-*a) such that f
exists a
unque
k: c'-*c
33
Constructions
Pullback
2.5.7
Lemma
(PBL)
If a
diagram of the form
commutes, then i.
ii.
if the
two small squares are pullbacks, then the outer rectangle
if the
is
a pullback;
outer rectangle and the right-hand square are pullbacks, then the left-hand square
is
a
pullback.
Proof Exercise.
2.5.8 Proposition
is
a pullback and g
If the square
is
monic, then
p
is
monic as
well.
Proof Exercise.
The previous property suggests an If f is a
under It is
f,
function from a set
denoted f“l(C)
easy to
show
that the
A
is that
interesting generalization of a
to a set
subset of
B, and
A
C
is a
* _1 1
f
(C)
C in
in’
f
Ais
a pullback square in Set.
set-theoretic construction.
subset of B, then the inverse image of
defined by f"l(C) = {x/
diagram
f
common
B
xEA, f(x)EC
}.
C
:
Constructions
34
monic
In general, given a is
the subobject of a (if
required,
There actual
is
exists) obtained
in the introduction, the
Category Theory
when
morphism
c -*b and a
f:
a-*b, the inverse image of g under f
by pulling back g along
f.
Morphisms and Complete Objects
Partial
2.6
As mentioned
it
g:
due
is
is
to the priority
common
perspective of
Programming Language Theory and
given to “functions” with respect to “sets.” The
latter notion,
a derived notion of the former, in a sense.
an other aspect, though, that should be considered. In Computation Theory, as well as
programming, diverging computations cannot be avoided unless a
restriction is
made
in
to a
subclass of the computable functions.
The notion of partiality has domain of convergence of moreover the
f,
a natural interpretation over sets. Let call
restriction of f to
it
f j,
fj,
is
If
map
we f
f,
h
is
just a subset of its
a total
represented by a pair of total functions
convergence of
is
(i:
map
the restriction of f to D, and
try to simulate the
f|(f|)
D-»A,
h: i:
D-»A
is
in a
C
category
we
to
are forced to identify partial
morphisms up
Given a category
C and two objects
R (m
map
partial
DC A
the
is
a and
to
d'->a, h': d'->b)
m
is
iff
b,
f
maybe
domain of
natural to define a partial
it is
d-»a
h:
,
choose d
d-*b), where
in a canonical
isomorphic variations of d (see section
equivalence class of pairs (m: d-»a, h: d-*b), where (m: d-*-a, h: d-*b)
the broader sense;
the canonical injection.
as a pair (m:
we have no way
a partial function; the
A in
fi~*B. Thus a
:
previous definition in categorical language,
between two objects a and b
relation R:
A-*B be
D-*B), where
monic. However, as in the case of subobjects,
2.6.1 Definition
f:
“domain”
a partial
map
m
is
way, so
1.5.)
[m, h]: a->b
an
is
monic, with respect to the following
3k: d-*d', k
m' =
iso,
m
°k, h' = h
0
k.
Taking some license, actually
mean
Our next aim composition.
we
will often speak about a particular pair
(m: d-*a,
h:
d-»b) when
we
[(m: d-*>a, h: d-*b)]R.
If
is
C
to define a category
pC
of partial
maps on C. The main problem
has pullbacks for every pair of arrows, then the problem
is
is
in defining
resolved in the
following way.
Given
(n:
e-*b,
k:
e-*c)
and
(m: d-*a,
h:
d-*b), define
[n, k] 0
[m, h]: a-*b
equivalence class determined by the outermost sides in the following diagram, k°h':
dx^e-^c)
i.e.,
as the
(m°n': dx^e-*a,
35
Constructions
e
dx^e
c
k n
n'
b
d
h
m a
where the square Let us see partial
how
{(x,y)
by proposition
works
}
=
{(x,y)
domain of convergence of
canonical injection
= k(h(x))
i:
as
,
2.5.8, since
in Set.
{x
we
/
{x
/
the
/
xEd, yEe
composed
xEd, h(x)Ee}
pC
map
in
pC
is
of total maps.
will
is
monic,
n'
is
monic, too.
,
e-*b as canonical
h(x) = y } « {x
function.
xEd, h(x)Ee}-*>d. In conclusion,
for all
The
h|{ x
/
injections.
xEd, h(x)Ee
/
projections
}, that
and
h'
n'
a °d
X Ed, h(x)Ee}
xE{x / xEd, h(x)Ee
Then
},
one has
wanted.
total iff
As
n:
are respectively
Every arrow fEC[a,b] has a natural associated arrow that a
n
For the equivalence relation defined on
suppose dCa, eCb and take m: d-»a,
associated with the pullback
k(h'(x))
that
xEd, yEe, h(x) = n(y)
/
the expected
is,
Note
the previous definition
we
morphisms,
dxbe =
a pullback.
is
it
in
pC,
that is (id: a-*a,
has the above form (up to equivalences). (pC)t
become
clearer in the next chapter,
is
f:
a-»b).
We
say
the subcategory of
C is “isomorphic” to (pC)t-
Exercises Prove the following assertions: 1.
id is total.
2.
f,g total
3.
f°g total =>
=>f°g
Example pSet
total.
g
total.
is
the category of sets with partial
the partial recursive functions. that defines the
commutes
iff
(pSet) t = Set,
pEN
is
PR t
=
Remark Sometimes,
R
fEPR
as morphisms.
pR
=
PR
is
the
monoid of
defined by using partial recursive functions in the diagram
morphisms, instead of the
eb°f = f°e a for
maps
total
ones (see section
2.2).
Observe
and, hence, e a (n) = e a (m) and f(n)j
that the
diagrams
=> f(m)|. Clearly,
and (pEN) t = EN.
in the construction of the category
pC
from C,
it
may be
intersting to restrict
our attention to only a subset of the class of monies of C. Consider, for example, the category p.o. sets:
an interesting definition of a partial
be defined
in
an upward closed subset. Let
map
C be
f
between two
p.o. sets
would
PO of
also require f to
a category with pullbacks for every pair of arrows.
Constructions
36
An admissible
M
family
of monies of C,
a family of
is
monies closed under
identities,
M on a category C gives rise to a different category
compositions, and pullbacks. Every admissible
(M)(pC) of partial maps.
As
already recalled, diverging computations play an essential role in the theory of computation.
They
also have an obvious interpretation in Set Theory.
computations
may
However, the
not suffice. Type-free languages and
set-theoretic understanding of
many typed
we
ones, as
shall see later,
escape a “naive” interpretation as sets and functions.
As need
days of denotational semantics of programming languages, the
a matter of fact, since the early to give
meaning
to (possibly) diverging
computations over nontrivial mathematical structures
suggested the introduction of various categories of p.o. sets with least elements. The naive understanding of this
them
is
immediate: add to
a p.o. set structure as flat p.o. sets
all
(i.e.,
required data types, as sets, an extra element and give
1
is
the least element and
all
others are incomparable).
We already dealt with this in practice, when presenting various categories of p.o. CCCs.
In a sense, the bottom element
1
provides the
first
sets as
examples of
hint of the introduction of approximation
and continuity notions to the mathematical semantics of programs.
As we have
demonstrated, this concept
is
very clear mathematically,
at least in several specific
categories, such as continuous or algebraic lattices, c.p.o’s, and Scott domains. interesting categories for computations such as setting
and avoid any abuse of
this
EN,
It is
not so simple in
though. In order to understand
simple concept, a category-theoretic perspective
it
in a general
may
provide a
sound mathematical frame.
In the rest of this section, C is a category of partial maps, i.e., C = pD for D with pullbacks for every pair of arrows. Ct is the associated category of total maps.
Notation
some
category
Since
Ct
is
a subcategory of
C,
we compose
composition. For typographical reasons,
The
set-theoretic idea
we
total
we
and
partial
write a
0
adding an extra least element, then any hom-set of
Definition The lifting of
exa EC[a°,a] and for every
L
exa oxc(f) =f;
H Tc( exa°g) = i
same operation of
total
when an
maps with
object a
target
a
is
0
is
“lifted” to a
isomorphic
0
by
to the
.
aEObQ
is
an object
cEObQ an operation rc
and for every gGC([c,a°] one has
the
1
try to formalize categorically is that,
corresponding hom-set with target a
2.6.2
morphisms by using
instead of a- -.
:
a°EObc (
together with a morphism
C[c,a]-*Ct[c,a °] such
that,
for every fEC[c,a]
37
Constructions
The operation x c C[c,a]-»Ct[c,a°] Conversely,
xc
if
bijective
is
and
Thus, the following
h.
2.6.3 Definition The lifting of
equation: exa
°g-f
we
x c (ex a
g)
= x c (ex a
0
];
wanted, for
may be
b,
all
0
(g).
since x c
is
x c (f)) = x c (f) =
lifting object:
an object a °EOb(j together with a morphism exa E
is
c
that,
fEC[b,a]
aEOb£
is,
0
0
for every fEC[c,a], there exists one and only one gEC([c,a j
C[a°,a] such
Thus, as
That
g.
an equivalent definition of the
is
x c ’l(g) = ex a
defined by
is
(1) holds, then also (2) does. Indeed, let gECt[c,a
such that x c (f) =
surjective, then there is fEC[c,a]
t c _1
as
is bijective,
:
satisfying the
C[b,a] and Ct[b,a°] are isomorphic, since any partial morphism
when
uniquely extended to a total one
the target object
is lifted
(and the
lifting
exists).
Exercise Prove that the
2.6.4 Proposition
C
(notation:
Let a
a
f °h = f oh.
2.6.8
Theorem Let
0
a
be the
lifting
of aEObQ. Then a < a°
Vb, VfEC[b,a],
3fECt[b,a]
such that f extends f Proof(=>) Set f = out
°
Tb(f).
Then, for every hECt[c,b], such that
(f 0
h)ECt[c,a]
f°h =out°Tb(f)°h
= out°rc(ex a oTt,(f) o h = outor^foh)
by
(ii)
by
(i)
= out^c( ex a oTa(id a)°f°h
by
(i)
= outox^id^ofoh
by
(ii)
=
in def. 2.6.2
f°h
( b
where mg:
B-*A is the
subset inclusion, and true: {*}-*{true, false} takes
The above diagram suggests
2.7.1 Definition
object
Q
C
Let
{true .false}
to “true.”
the following definition in Category Theory:
be a category with a terminal object
together with a morphism true:
arrow cfr a-*Q such
*
t->Q such
that for every
t.
A
subobject classifier
monic
i:
b-*a there
is
is
an
a unique
that the following is a pullback diagram:
a
b i
cb
!b
true t
Exercise
A subobject classifier, when
The subobject It
classifier
exists in
it
C,
is
unique up to isomorphisms.
Q plays a central role in the translation of Set Theory into Category Theory.
allows the simulation into the categorical language of concepts like intersection, union, and
complement, by the definition of a Hey ting algebra of truth-morphisms over Q.
2.7.2 Definition
A
topos
is
a category
C with
a terminal object, a subobject
classifier,
pullbacks
for every pairs of arrows, and exponents for all pairs of objects.
It
will turn out that a topos
confidence as
we do
is
in Set.
a “universe”
where we can carry out constructions with almost
Of course, Set
itself is a topos.
Exercises 1.
Prove
2. In
that if
a topos C,
C is
a topos, then
what
is
C
is
a
the arrow eval:
CCC.
Q a xa-» Q
?
the
same
Constructions
40
In the spirit of a categorical description of set-theoretic concepts,
one may also
talk in topoi of
“relations,” “power-sets,” and so forth. Quite generally, given objects a and b, a relation on a
and
b, is
simply a monic
given by a relation
2.7.3 Definition
object of
which r:
is
C
Ea Let
:
r:
d-*axb. In particular, then, one
may
consider power-objects P(a) as
d-*axP(a) with the following universal property:
C
be a Cartesian category and
together with an object
universal in the sense
that,
b-*P(a) and a (forcedly unique)
d and a monic
aEObc
Ea
:
for any object b and monic
map
g:
e—>d
to
make
•
The power-object P(a)
d-*axP(a)
m
:
(a
is
an
membership-relation)
e—*axb, there
is
a unique
map
the following square a pullback:
m
€
a
idxr
axb
As
Q
is
axP(a)
the truth value object, the set-theoretic intuition suggests that, in a topos, the object
should represent exactly the power-object of
2.7.4 Proposition In a topos
Proof Let
Ea
:
C every
Qa
a.
object a has a power-object
Qa
.
d-*axP(a) be defined by the following pullback square:
true
aXQ a
Q eval
Then
the required universality of
1.
of the subobject classifier,
2.
of the
3.
of the above pullback
map
eval
,
i.e.,
Ea
i.e.,
is
given by the properties
the existence of the characteristic
the existence and unicity of
map
c e of m;
A(c e );
;
and by an application of the pullback lemma diagram, where the squares are pullbacks:
2.5.7. All this is described
by
the following
commuting
41
Constructions
!e
m
truue
aXQ a
aXb ldXA(c
^
e
eval
)
c
The reader who has completed
e
exercise (2) above
compare
the construction in definition 2.7.3 and
eval says whether “an element of a
is in
it
may
easily understand the intuitive
to his set-theoretic understanding.
a given subset of a
meaning of
In particular,
.”
Exercises any topos has
1.
Prove
that
2.
Prove
that a category
C
lifting. is
a topos
if
and only
if it
has a terminal objects, and
all
pullbacks and
power-objects.
References The though
general notions can be found in the texts mentioned at the end of chapter
their presentation
and notation may be
different.
For example, in the case of CCCs,
also because these categories play a greater role in the categorical approach to
Type Theory,
denotational semantics, than in other applications of Category Theory. Notice that not
CCCs
and consider
that the origin of
Category Theory
is
1,
so
this is
or to
Grp and Top
are
largely indebted to algebraic geometry.
Applications of universal concepts from Category Theory to Programming Language Theory have
been developed by several authors, the
ADJ group
data types; see categories
aims of
is
explicitly
Goguen
et al.
may be found
this
(1973/78)
in Burstall
for the
category
used
in
program
specification. For instance, the
).
An
(initial
early insight in the connections
examples
EN was
first
we
work by
algebras of abstract
between programs and
and Thatcher (1974). All these aspects go beyond the limited
book, which privileges “theories of functions” over “algebraic theories.”
notions with an algebraic flavor
As
in particular for
based on universal conditions for specification
may be found
Some more
in chapter 4.
have provided, they originated entire areas of research. In
particular, the
introduced by Malcev, as a general setting of Recursion Theory, and widely
Ershov (1973/75). Scott domains and related categories are broadly treated
in several places,
42
Constructions
e.g.,
Scott (1981/82), Scott and Gunter (1989), or
many books
in denotational
semantics. Scott
(1976) presents Poo as a reflexive object and discusses categories of retractions. The (generalized) Myhill- Shepherdson theorem and related matters (1984), Berger (1986), Rosolini (1986), and
Coherent domains are given introduced (with
There
is
some
in
may be found
in Scott (1976), Giannini
Longo (1988a), among
others.
Berry (1978) and used in Girard (1986), where linear maps are
relevant consequences, see section 4.4).
a broad literature
on categories with
DiPaola and Heller (1984), and
in
partial
Longo and Moggi
maps.
We
partly followed the approach in
(1984), where the notions of “complete object”
and partial Cartesian closed category were introduced (and applied
The
properties of complete objects carry on also
shown
in
Moggi
(1988), which
is
when using
a
in Asperti
more
and Longo (1987)
).
topos-theoretic perspective, as
devoted to a deeper insight into the concepts just sketched here.
New results and surveys on categories with partial Moggi
and Longo
morphisms may be
also found in Rosolini (1986),
(1988a), Robinson and Rosolini (1988) and Curien and Obtulowicz (1988). Independently of
the category-theoretic approach, Plotkin (1984) used the category
pCPO
for the purposes of
denotational semantics.
Topoi originated by works of Lawvere and Tierney.
may be found
in
Johnstone (1977). The reader
(1985) on this subject.
may
A (difficult)
introduction to
Topos Theory
also consult Goldblatt (1979) or Barr
and Wells
Chapter 3 Functors and Natural Transformations
The
starting point of
object
Category Theory
comes equipped with
morphism functor
is
is
the premise that every kind of mathematically structured
a notion of “acceptable” transformation or construction, that
that preserves the structure of the object. This
the “natural” notion of
morphisms between
is,
a
premise holds for categories themselves: a categories.
By
a further step, the question
about what a morphism between functors should look like suggests the notion of natural
transformation.
Of course,
this is not a
matter of arbitrary generalizations:
may
it is
mathematics
a habit of
to build
in this
way, by the uniformity of
methods and language, the reasonableness of specific constructions. And
this theoretical unification,
constructions on top of constructions, since one
suggesting power and intellectual unity,
is
understand
one of the major merits of Category Theory and
its
applications.
we
Moreover, as essential
way
shall see in several
that are easily
met
3.1
Functors
If a
transformation
of D,
it
in
an
or even suggested by the categorical language of functors and natural transformations.
Indeed, there are even too
few
examples, there are notions which are clarified
in
many examples
for our purposes, and
we
will
be able
to
mention only
a
computer science.
F between two
C and D must map the categorical structure of C to that must of C to objects and morphisms of D; moreover,
categories
must take objects and morphisms
it
preserve source, target, identities, and composition. Such a transformation
F:
C-*D
is
called a
functor.
C
3.1.1 Definition Let
F0 fr ObQ Fmor(f) Fob(a)
operations "
"
"
•’
D
and
be categories.
Fmor MorQ Fob(b)
-* Obj)
,
:
A
(covariant) functor
-* Morj) such
that,
for each
F C :
f:
-*
D
is
a pair of
a-*b g: b->c ,
in C,
= FmoAs) °^moAf) Ffnor(ida) = ^F0 b(a)
FmoAs
°f)
*
It is
usual practice to omit the subscripts “ob” and “mor” as
whether the functor
is
meant
to operate
it
is
on objects or on morphisms.
always clear from the context
Functors and Natural Transformations
44
Examples
C
1. If
C
and
D
are preorders, then a functor F:
D, indeed
to the objects of
F(f)ED[F(a),F(b)]
between two
f
among
partial orders
C
the objects of
F(a)
and D, there
the categories associated with
C
is
D and iff
G
be functors and t:
aEObQ,
ra
0
:
F - idc and F
F-+G
E D[F(a),G(a)]
°
G
:
G-*F by
x"l
)‘l. a = (x a
x‘l
is
idc
idj)).
be a natural transformation from is
an isomorphism.
natural isomorphism.
Proof Define x"l
-
are
natural, since
VfEC[a,b].
Then t
is
a
t
51
Functors and Natural Transformations
= t(j -1
t-ib’G®
®
0
G(f) » a
ta'
= tb_lo tb°F(f)«V = F(£)«x-l a
A simple
Example
little
One may
xc
Inc:
Ct~*C be
C be
The
lifting
When
.
writing this
a Category of partial maps,
is
the object a
0
is
by
hidden behind definition
down
explicitly, the definition is tidier
C* be
the associated category of total maps, and
the obvious inclusion. Thus, definition 2.6.2
of aEOb(j
“liftings” (see
actually understand the general notion better,
exercise on natural transformations. Indeed, what
2.6.2, is the “naturality” of
expressive. Let
.
example of natural transformation may be given by studying
section 2.6), in various categories.
completing a
1
1
may be simply
and more
restated as
such that the functors C[_,a] °Inc, Ct[_,a°]
:
C(-*Set
are naturally isomorphic.
Then, by definition of natural transformation and horn-functor,
this requires the existence
function x such that the following diagram commutes, for any object b and c in
Tb
C[b,a;
C
C and
of a
fECt[c,b].
[b,a°]
t
_ °f
_of
C
Clc,aj
That
is,
With
this definition, to
(x c) l(h°f)
isomorphism. Set
=
'(id): a
Then a
0
,
liftings is
Let
we
are
C be a pC
(j>
=
(
f (n)(0))
else _L
fER
.
defined, then (J>f(n)(0) converges and, hence,
x a b(f) = f
For each
.
f(n) =
f(e'(n))
=
x a gives the required natural
a,
g'(n)(0).
the fact above, this defines the lifting functor in
Exercise Define the category
as for
.
is
2.6.2.
Thus,
isomorphism, as VgEEN[b,al] 3!fEpEN[b,a] diagram.)
to the set a
o)-*a°
:
such that f
sets in section 2.2. Let
example before propoition
e°(f(n))
= e(f(n))
f( e '( n ))-
.
a
which represents
(iteration) theorem. f(e'(n)) =
have a bottom element. As
numbered
the category of
sets in the
by adding
fEEN[b,al] of exists
EN,
given by
fEpEN[b,a]. By f
to
pPo.
numbered
(a°,e°)
do not need
with open subsets as domains. Clearly, the
(Exercise: check the due
pEN.
of equivalence relations on
and the morphisms are induced by
co
and effective maps
{hint: the
total recursive functions similarly
ER and EN are equivalent, but not isomorphic.
Indeed, one
is
small, while
is not.
next discuss ways to derive natural transformations from a given one and, finally, the notion of
horizontal composition.
Let
H: A-*B, F: B-*C, G: B-*C, K:
transformation as
shown
C-*D
in the following diagram:
be functors, and
let
x:
F-*G
be
a natural
53
Functors and Natural Transformations
H
K
B
x induces two natural transformations Kx: (Kx)b = K(xjj) (tH) a = XH( a )
We
:
:
KF-»KG, and xH: FH-»GH,
respectively defined by
KF(b)-*KG(b) FH(a)-*GH(a).
have, for every fSB[b,b'] and every geA[a,a'],
(Kx) b '° KF(f) = K(xb ) (xH) a
'°
o
FH(g) = x H (a')
that proves the naturality
K(F(f)) = K(x b ° F(f)
F(H(g)) = G(H(g))
•
)
= K(G(f)
«
xb ) = KG(f)
x H(a = GH(g) )
of
Kx and xH
—
KF(b)
b
«
KF(f)
KG(b)
in
Consider
now
*
FH(g)
KG(b')
B
o
(Kx) b
(xH) a
FH(a)
a
KG(f)
KF(b')-
Kxb = KG(f)
.
Kt V b'
•
•
inD
in
GH(g)
—
FH(a')
a'
A
GH(a)
in
.
GH(a')
C
categories, functors, and natural transformations as described in the following
diagram:
F
H
G
K
B
Then, for the naturality of for every
a
with respect to the arrow T5, the following diagram
bGObg: HF(h)-
H(x b )
'G(b)
'F(b)
KF(b)
HG(b)
K(x b )
KG(b)
(in
D
)
commutes
o
(
.
Functors and Natural Transformations
54
The horizontal composition of o and t for every
b€ObB,
crtb
oq
=
We check the naturality of crtb' o
b)
or
Let f£B[b,b’]
.
that if
we
0
=
0
=
0
= K(G(f)
»
HOty
0
= KG(f)
K
identify the functors
K(xb)
H
and
H(xb') ° HF(f)
)
by
the naturality of x
xt, )
by
the diagram
Tb
F(b)
«
o CTTb.
0
° F(f) )
H( G(f) Xb)
defined by,
op(b)-
°
•
HF-*KG
then
,
H( G(f)
= KG(f)
Kx and xH may be understood
idjj,
°
= aQ(b ')
HF(f)
= °G(b ')
Note
the natural trasformation or:
is
H(tb) = K(tb)
»
oF(b )
•
with the identity natural transformation idj£ and
as particular cases of the horizontal application
between
natural transformations (why?).
Exercise Prove the following equality (v
3.3 Cartesian
By
p)(x
among °
natural transformations (interchange law):
o) « (vx)
pa)
° (
and Cartesian Closed Categories Revisited
C is
definition, a category
there
o
Cartesian
iff
contains a terminal object
it
an object axb together with two morphisms p^: axb-*a
is
an isomorphism
c
:
C[c,a]xC[c,b]-*C[c,axb] such that for
,
t
,
and for every a,bEOb^
p2: axb-*b, and for every object c all
morphisms
f:
c-*a, g: c-*b, h:
c-*axb, the following equations hold: i.
ii.
Pi
°
c = f
P2
°
c =
We want now to show that (nat)
Indeed,
we have
The previous A:
C-*CxC
then
is
c
g-
is
also “natural in c”,
for every k: c-*c' c
c
*
0
'
the functor defined
by A(c) =
(c,c),
,
>
'
1
°
k,
c
is
A(f)
isomorphism from CxC[_,(a,b)]
0
0
k >c
k >c
is
:
by
(ii)
by
(i).
actually a natural isomorphism. Indeed, let
= °
'
g
(f,f)
A
(A
is
called the diagonal functor);
to C[_,axb].
Note
C[_,axb]: C-»Set are contravariant functors. Conversely suppose
and b an object axb and a natural isomorphism x
of x
0
satisfies the property:
i.e., it
k = b: b a xa-*b (evaluation map) and, for every object c a function A c C[cxa,b]-»C[c,b a such that, for all morphisms cxa-*b, h: category
and b
it
in
,
c-*b a
,
:
p. eval a T|.
It
f:
]
one has
turns out that
Ac
is
check
°
(A(f)xida)
=
f
h.
“natural in c”, in the sense that for any fEC[cxa,b], gEC[d,c] Ac'(f)
In order to
b
A(eval°(hxid)) =
this, recall that (|3)
°
g = Ac(f
o
gxid).
corresponds to f
exa
(Diag.Eval)
A(f)Xid
b
a
xa
Thus, by twice (Diag.Eval), the following diagram commutes:
b
.
Functors and Natural Transformations
56
Moreover,
set
A‘l = eval°(_xid).
Then
A'1°A =
id
by
and
A°A"1 =
id
by ( q ).
That
is,
cEOb^, A c C[cxa,b]-*C[c,b a
for each
:
isomorphism, by proposition
Note
A
that, formally,
to the contravariant functor
We
(p)
abbreviate C[_,b]
0
A
is
a natural
3.2.2.
a natural transformation
is
,b a
C[
_xa
Conversely, suppose
an isomorphism. Thus
is
]
]
(where _xa
as C[_xa,b].
is
a
0
_*a
the product functor defined in the obvious way).
Note also
that, for all objects
from the contravariant functor C[_,b]
that C[_xa,b],
and
an
b, there is
A
isomorphism A: C[_xa,b] a C[_,b a ]. Then the naturality of
C[_,b a ]: C-*Set.
"1
is
object
ba
and a natural
expressed by the following
commutative diagram:
A' 1 c
C[c,b a
C[cxa,b]
c
]
ba
ofxid
A-l,
C[c'xa,b
Set
now
eval a> b
= A’l^a
C[cVb a ]
]
(id^a) and note that
exponent with eval a> b as evaluation
map
.
eval^: b a xa-*b
Indeed,
let
f
=
c'
.
We want
A
to
a c (g): c-*b in the
prove that b a
is
an
above diagram. Then
we have eval a,b
0
(
Ac(g) xid ) =
°
Mg)
)
=
This argument gives the following equivalent characterization of
3.3.2
Proposition
a,bEObQ
Observe
there
is
C
is
a
Cartesian closed category
an object b° and a natural isomorphism
that propositions 3.3.1
and 3.3.2 require
A
g-
CCC:
iff it :
is
Cartesian and for every
C[_xa,b] -* C[_,ba]
that the category
based on horn-functors. Thus, in a sense, the equational definition
C be locally is
more
small, since they are
general.
.
57
Functors and Natural Transformations
Remark
It is
easy to prove that the following (natural) isomorphisms hold in
all
CCCs,
for any
object A, B, and C:
A « A;
1.
2.
txA»A;
3.
AxB * BxA;
4.
(AxB)xC * Ax(BxC);
5.
(AxB)-*C « A-»-(B-»C);
6.
A— (BxC) * (A-*B)x(A-*C);
7.
t-*A «A;
8.
A-*t «
What i.e.,
is
worth mentioning, though,
no other isomorphism
application of
by the
3.4
t.
Its
More Examples
that these are exactly the
valid in
is
lambda calculus
of this book!).
title
is
all
CCCs. The proof of
to categories (an application in
key idea will be mentioned
of
isomorphisms
that hold in all
this fact is nontrivial
and
the other direction from what
CCCs,
is a is
nice
meant
in chapter 9.
CCCs
Both examples here derive from bordering areas of (generalized) computability and Proof Theory.
The
first,
in particular, like
many
aspects of these theories,
is
widely used in the type theoretical
understanding of programming languages constructs.
3.4.1
Partial Equivalence Relations
A very relevant example of CCC is suggested by
a long story.
interpretation of intuitionistic logic and continued with the
Proof Theory. The idea
is
to
look
but by a simple and insightful
at
way
As
K
=
usual, let
Cartesian closedness
(to,-)
defined by
semantics of polymorphism in cp:
is
work of Kreisel,
obtained.
cp
m (n) A partial
nRm
3.4.1. 1 Definition
iff
n relates
to
The category
m
iff
Girard, and Troelstra in
The approach
co.
is
EN,
also used in the
will give us a paradigmatic structure
•
:
partial recursive functions. Let
coxco-^co
R
on a
is
set
the partial application
V
is
a symmetric and
on V.
in R;
PER
symmetric and transitive relations on
fePER[A,B]
realizability
PART II.
equivalence relation
.
transitive relation, not necessarily reflexive,
(Notation:
It
co-*PR be an acceptable Godel numbering of the
be Kleene's applicative structure, where
m-n =
began with Kleene’s
functions as computable ones, as in the case of the category
“quotient-set” semantics of types, in functional programming. in the categorical
It
{p}R = {q
|
qRp};
Q(R) = {{p}R
of partial equivalence relations on
a)
|
p
Rp
has as objects the
Morphisms are defined by
f : Q(A) -» Q(B) and 3n Vp (pAp =>
f({p}A)
})
= {np} B ).
)
Functors and Natural Transformations
58
PER
Thus, the morphisms in recursive functions,
Let
AxB
is
now
: (dxcd-*o)
,
are
when
defining the computable elements in Scott domains
The
D
idea
is to
generalize the
(see section 2.4.1), in the
explained below (in short, the computable elements are the limits of recursively enumerable
indexed sequences.) This suggests several CCCs, such as limit spaces (L-spaces) and
(FIL) with examples
3.4.2. 1
their relevant subcategories.
in sections 5.3
Definition
A
and
8.4, together
They
spaces
with other ideas for higher type computations.
limit space (L-space) (X,i)
between countable sequences {xJiEw
filter
will be introduced here and discussed also in the
—X
is
and elements
a set
xEX
X
and a
relation
(convergence
(notation: {xj} lx) such that
,
59
Functors and Natural Transformations
if all
i.
if
ii.
if not({xj} lx),
iii.
h(0)
An
but finitely
many
X[ are x,
{x \}[x and k(0)
dl
:
is
also a Petri net, since
f:
where
category).
:
As
(3'q,
T'-*V'),
:
(S+S')©,
i.e.,
:
N
and
N'.
is
their
Petri
is,
TxT'-»S©xS'©)
the product of
two
free
and S'© coincides with the monoid freely generated by (S+S'). The synchronous product of the nets
g:
the careful reader
d';[:
N' = (d'o,d'i: T'-*S'®), their product as graphs, that
S©xS'© «
S©
T-*T' and
with the extra condition that g
= (do>dl T-*V) and G' =
NxN' = (doxd'o^ixd'i is
comma
as a
,
are pairs
4.1.4.),
as objects,
GxG' = (do x d'o>dl x
I
)
A—oB, A
r 2>
ri,
A, A'
I-
r2 b
Ml- a, a
—°» r
r
AUB
,
,
A—oB
I-
a’
A, A'
I-
3. additive rules
r|-T,
(T,r)
(
r|- a,
a
0
,
r,
1
)
o
r|-B,A (n,
I-
AflB,
r,
ADB A I-
b
r, i,
a,
I-
a
2) r,
I-
l-
i)
i,
A
(n,
r
a a
r,
(n,r)
r
a
I-
AHB A I-
a
(®,r,l)
r
I-
A©B, A
r
I-
b,
a
r,
(®,r,2)
r
4. linear
a
I-
A©B, A
r,
r,
b
|-
a
A©B A I-
r l- a, a
I\A|-A (
suggested by the rule (®, as
disjunction
while the
which
is
1
,1
)
r,Ai|-A
rl-A-1-A
meaning
a
negation
CM)
As
I-
(®,1)
1),
the
commas
dual to ®.
comma
in the left
in the right
hand side of a sequent has the same logical
hand side correspond
to the tensor
sum U,
the
A
)
.
87
Categories Derived from Functors and Natural Transformations
Observe
that the rules (1, r)
and (1,1) are equivalent
to
r,A|-B,A (contrap) T,
1,1
the rest
From
is
1-
gives both
1
’
steps,
(cxabc)
Exercise (A-L)J-
and
1
and
1- 1-*-
1
|-
A—oB
1- -
while 1
1
,
1,1 gives both l- 1
|-
1-
1
and
l-1-
1-
1;
|-
B
by
(
by
(
®
r)
>
—
o,
1
one also obtains
(A®B)®C
Show
I-
(a-iABC) A®(B®C)
A®(B®C)
the logical equivalence of
and (A- -)-!1
1-
may be enough
A,
)-*-
i.e.,
(
is
(A®B)—oC
to suggest that the categorical
=> given
and the bifunctor
and
|-
(A®B)®C
A—o(B —oC).
Derive also that
®
meaning of linear logic may be found and
—o
are interpreted
in definition 4.3.5, respectively.
too, so to provide an interpretation for
D
and
its
Observe
|-
identity
T
by the
in particular
tensorial product
that the cartesian product is
(see later). Negation and
constructions are taken care of by a “dualizing” endofunctor (-)*, which
is
all
dual
closed in the sense of
Indeed, theorem 4.4.5 below shows that this functor, given
definition 4.3.6.
A
“dualizing.”
symmetric monoidal closed categories, where
needed
l-l-l-l
(1,2)
easily derive the following sequents:
a®b
I'
A,
(eval^B)
This
may
the rules one
few
,
obvious).
Oab) A B
In a
A1
1-
1|-±J-
(1,1)
(Hint:
B1
®
and
fl
,
immediately yields their duals.
4.4.3 Definition
A *-autonomous
contravariant closed functor (-)*:
category
K —> K
-
there exists a natural isomorphism
-
the following
K
is
a symmetric monoidal closed category and a
such that
d : Id a
diagram commutes (where
(-)**
(-)* is the action
of the functor on exponents)
.
Categories Derived from Functors and Natural Transformations
88
—
(-)*
A =>B
>B*=>A*
d o_od-\.
(-)•
^ A
*-autonomous category
is
linear if it
is
A** =>B**
also Cartesian.
In other words, a linear category has both a
monoidal and a Cartesian
structure,
©
and
PI
plus a
,
dualizing functor (-)*.
Both the vertical and the horizontal arrows
4.4.4 Proposition
in the
diagram
in definition 4.4.3
are isomorphisms. Moreover
,
L
A* sB*
iff
A e B;
A* sA=>l*.
ii.
Proof By
definition, the following
diagram commutes and d
0
_
0
d* 1 is
an isomorphism:
f**
Then
the horizontal (-)*, in the diagram in definition 4.4.3,
vertical
one
split epis as
implies
B*
iff
4.4.5
is
is
a split
mono
(see section 1.4) and the
a split epi. Since the latter is an instance of the former, they are both split
well and, thus, isomorphisms. In conclusion,
A=>B
K be a
A*
a B*
a 1=>A*. Thus,
A* a
a B*^>A*. Finally,
A a A** a B** a B and, by exercise (3) below definition 4.3.5, A a B and, moreover, A* a A 1*.
Theorem Let
monos and
A*
linear category. Define
AUB = (A*®B*)* A®B = (A*DB*)*. Then
U
is
a dual to the tensor product and
0 = T*
respectively.
Proof
U
is
a well-defined dual to
®:
®
is
just
the coproduct in K.
Their identies are
compare with definition
AU1 - (A*®1)*
-
(A*®B*)®C* a A*®(B*®C*)
a A** a
A
(similarly for the identity to the left),
implies
((AUB)*®C*)* a (A*®(BUC)*)*
(AUB)*®C* a A*®(BUC)*
implies
(AUB)UC a AU(BUC)
= 1* and
4.3.1 (and the
afterwards) and note that -
1
implies
remark
Categories Derived from Functors and Natural Transformations
As
images (pa*)* and (PB*)* v ^ a the
(A*®1)* «
The of
pa* and pg*
for the Cartesian coproduct, note that, if
their
A
and
A©0 = (A*OT)*
1=
1*. In particular,
when
A*OB*,
are the projections for
A©B.
functor are the injections for
(")*
Finally,
then
AU1 =
« A.
and theorem 4.4.5 prove the “dualizing” role of the
results in proposition 4.4.4
linear logic,
89
theorem 4.4.5
is
a version of
De Morgan
functor and
(-)*
rules in the semantic structures for
described in categorical terms. Note also that
A*UB
a (A®B*)* a (A®B*)=*1 a A=>(B*=>1) a A^(1=>B) a
A=>B
which gives the “classic” flavor of this fragment of linear
The meaning of linear |-
B
as a
logic as a deductive system
morphism between
interpretation,
is
logic.
then given by interpreting each entailment
the interpretation of the formulas. Linear categories yield such an
which we sketch
here,
by induction on
rules.
crucial ones are simply the properties corresponding to
are interpreted by
for 1 and
1
Here are some of the basic cases. Some
(mab)> ( eva lAB)>
given before definition 4.4.3, in monoidal closed categories.
the rules
As
(
a ABC)
anc*
1
and
1
are (the unique) identies for
by commas, on
®
and U, which
the left or right, respectively,
|-
(®,r) and (U,l)
®
and
U
are bifunctors
(H,r) and (©,1)
0
and
©
have pairing and sum of morphisms
there exist projections for
(©,r,l) and (©,r,2)
there exist injections for
(contrap)
(-)*
(-U-L)
1
(By the argument before definition
a “^ABC)»
the fact that
are expressed
and (0,1,2)
(
for the others,
of
(0,1,1)
A
is
O
©
so defined in linear categories
= 1* and, thus, 1* «
4.4.3, (contrap)
1
.
and (1,1) are equivalent
to (l,r)
and
(1,1)
.)
Categories Derived from Functors and Natural Transformations
90
Example The
category Lin of coherent domains and linear maps, in section 2.4.2, not only
provides an example of linear category, but
it
has even been the source of inspiration for linear logic,
since linear functions depend on inputs “additively” as deductions from assumptions in this logic.
(There
is
We
more than
example and section 5.5 should
that analogy, though, as this
noticed that
Lin
is
Cartesian in 2.3.7(11). Lin
is
X©Y
be coherent structures. Define then the coproduct
(|Y|,t)
zE|X|}U
with the coherent structure ({(0,z)
{(l,z) |
|
and x|y
.
maps
,
category. Indeed,
initial in the
domain associated
is
iff
a
=
a'
the same, but the coherence relation
as an exercise.)
The singleton coherent domain T = 0 = {0} both terminal and
as the coherent
zE|Y|},|®), where (a,x)t®(a',y)
(Note the difference with the product: the support
changes. Give the embedding linear
clarify.)
also co-Cartesian. Indeed, let (|X|,f) and
associated with the it
is
empty coherent
structure, is
the identity for both the product and the
coproduct. In the previous section
exercise
below
we
turned Lin into a symmetric monoidal closed category (see the
coherent domain associated with the coherent structure
(|A|x|B|, f®),
A@B
product
Recall, in particular, that the tensor
definition 4.3.5).
is
the
where (x,y)f®(x',y')
iff
xfx' and yty'.
The dual of
the tensor product, is
domain associated with (x',y')
or xf fx' or
yt
U
given by the tensor
the coherent structure ty')-
Also * n
sum AUB,
product and
this case, the tensor
that
is,
(x,y)t u (x',y')
u ), where
(|A|x|B|, f
sum have
the
the coherent iff
same
(
(x,y)
=
support,
but the coherence relation changes.
Notice that the identity for both the tensor product and
{0,{1}}, associated with ({1},
As
coherent domain associated with f*:
As one =1
.
B*-*A*
is
(-)*
,
is
the coherent
(|A|, f *),
given a coherent structure
where xf*y
~(x|y)
iff
defined in the following way: (y,x)ETr(f*)
domain 1 =
in
iff
define
(|A|, t)>
A
.
On
in
1-
theorem 4.4.5 are realized
For the reader's convenience,
we summarize
A*
as the
a linear function
(x,y)ETr(f)
f:
.
could expect (and easily compute), in coherent domains one has T* = 0 =
Moreover, the equations
Memo
dual
=).
for the contravariant functor
A-*B,
its
T
and 1* =
1
in Lin.
the identities in linear logic (and linear
categories) 1
which
are interpreted in
Lin
® 1 1 = 1-
for
as
;
for
D
{0,{1}} and
T
for
U
;
T
;
0 for
©
= 0 = {0}, with the obvious coherent
structure.
References Textbooks, which
stress the applications of
Category Theory
to
computer science
with an algebraic perspective, are Arbib and Manes (1975) and Rydeheard and Burstall (1988).
Goguen and
Burstall (1984) contains a survey and references to part of this area, broadly construed,
Categories Derived from Functors and Natural Transformations
which ranges from the work
in Elgot (1971), to the contributions of the
volume, the many references
this
91
that include the
Besides the references to general Category Theory, the reader
and Wells (1985) for monoidal categories, monads, and references,
The
which
ADJ group
their
may
the understanding of programs as “functions
Montanari (1988) or Degano and
al.
we
consult Barr (1979) and Barr
described are borrowed from
from values
(1989), as for the
end of
or Wright).
mathematical applications. Further
also discuss linear logic, are Barr (1990) and Marti-Oliet and
recent applications of “monoidal notions”
(see, at the
names of Goguen, Thatcher, Wagner,
to computations,"
examples on
Meseguer (1990).
Moggi
(1989), as for
and from Meseguer and
Petri nets (see also Marti-Oliet
and Meseguer (1989)).
The main reference in Girard
for linear logic is Girard (1987). Further
work may be found, among
others,
and Lafont (1987), Lafont (1988), DePavia (1987), and Seely (1987), where *-autonomous
categories are proposed for
its
semantics.
Lambek
(1968) contains early work on the categorical
significance of logical systems and discusses weakenings of the structural rules.
Chapter 5 Universal Arrows and Adjunctions
In chapter 3,
we
The reader may have noticed
constructions in Category Theory. construction F:
way
introduced the notion of functor as a uniform
C-*D,
there exists a particular object c in
C
that in
u
,
i.e.,
some
and an arrow
a “universal behavior” with respect to d, in the sense that every other
factorizes through
to describe “acceptable”
u:
arrow
there exists a unique f c-*c' such that f = u :
0
cases, for a given
F(c)-*d f:
which has
,
F(c')-*>d
uniquely
F(f) or the following
diagram commutes: f -
F(c')
c'
1
2.
c*c'
be a functor and dEObj)
.
Assume
that
is
universal
is
universal from
=>
via (h,h~l)
d
F
to
=> etc';
u'= F(h°h>u'. But u = F(id) (
Proof
1.
By
unicity, h°h'
2.
Exercise.
By
C-+D
Then
=
id
.
Similarly, h'°h =
id
°u'.
.
the proof of proposition 5.1.3, one even has that the
property of universal constructions as a very
common
isomorphism
tool in
is
unique.
This
a strong
is
mathematics (see the examples below).
hard to think of a more suitable language than the categorical one for expressing properties like
It is
this.
We
next give two alternative characterizations of the notion of universal arrow: the
theorem
5.1.4, is of
first
one, in
an equational nature; the second one, in theorem 5.1.5, makes use only of the
notion of a natural isomorphism. In a sense, the definition of universal arrow given in definition 5.1.1 is in the middle
way:
it is
based on one equation and on the existence of an isomorphism (does
we
the reader see any analogy with the various characterizations of products and exponents
have
given?).
5.1.4
Theorem
Let G:
uED[d,G(c^)] such
that
C->D
be a functor
operation tc : D[d,G(c)] -*C[c^c] such
Proof ()
let
xc
only prove that
:
D^G^J-^Qc^c] it
is
be an operation which
satisfies
and (2) above.
(1)
an isomorphism. Define then, for every hECIc^c]
x c "l(h) = G(h)
We 0
u
;
must thus,
we have
V^c©) =
G(x c (f)) "u =
x c(Tc' 1 (b)) = tc (G(h)
5.1.5
Theorem Let
there exists
C,
D
•
u)
by (1)
f
=h
by
(2).
be locally small categories, G: C-*D, dEObj) and
uED[d,G(c cj)] such
that
Proof (D, dEObj) and
uED[d,G(c ci)] such
exists
5.2
D
F:
we assume
that
a functor such that
D-*C such
that
we
are dealing with locally small categories.
VdEObj) 3
universal from d to
.
Universal Arrows and Adjunctions
98
F(d) = cd ;
L ii.
(Note that
C[F_,J “D[_,GJ
D[_,G _/
C[F_,_],
:
D°P xC -*Set).
Moreover, the functor
F
is
unique, up to
isomorphism.)
Proof By assumption we know
fED[d,d']
that, for all
,
F(d)
G(F(d))
3!g
G(g)
F(d')
Set then F(f) = g, that
is,
u^'of
G(F(d'))
= G(Ff))°Ud
.
By
the uniqueness property, G(id)
=
id.
Moreover, by twice the definition of F,
G(F(d))
G(F(h)oF(f))
And
again by unicity of F(h
We need now to define for a suitable
qp,
0 f),
a natural
one then has F(f°h) = F(f)
isomorphism
that for all gED[d',d]
qp:
0
F(h).
D[__,G_] « C[F_,_].
Thus we
first
need
and hEC[c,c'] the following diagram commutes:
to check,
.
99
Universal Arrows and Adjunctions
i
D[d,G(c)]
C[F(c),d]
ho_oF(g)
G(h)o_og
?
D[d',F(c')]
C[F(d'),C']
Equivalently,
VfED[d,Fc] qp(G(h)°f°g) = h°qp(f)°Fg
1.
Now write = G(f)
0
u
u .
(u')
for
Define
u^ cp(f)
(u^', respectively).
= f
,
that
is,
By
G
the definition of the functors
and
we have
Moreover, for
all
only to prove the naturality
F, the following
diagram commutes:
G(F(d'»
d'
2.
cp(f « g)
.
VfED[d,G(c)] 3!fEC[F(d),c]
= G(cp(f))°u (compare with the definition of F
f
clearly a set-theoretic isomorphism; thus,
We know then that
=
cp(f) °
F(g)
fED[d,G(c)], G(F(d'))
(1).
).
qp
f is
)
)
.
Universal Arrows and Adjunctions
100
G
by the definition of
.
Therefore,
(G(h)
This proves
Dually,
5.2.2
0
f 0 g)
=h
0 qp(f 0
=h
° cp(f) • F(g)
(1), i.e., the naturality
we have
of
by
g)
cp
dc
i.
G(c) =
ii.
C[F_,J *D[_,GJ
is
completed.
G:
C—>D
VcEObg 3
that
universal from
F to
c.
such that
;
result follows
.
by
duality;
technique from the one used above. she or he
is
the following:
exists a (unique) functor
Proof The
(2).
and by proposition 3.2.2 the proof
,
Theorem Let F:D-*C be a functor such
Then there
the diagram and unicity
by
As
anyway we
explicitly reprove
it,
but by using a different
is
essentially notational, but
the reader will see, the difference
good examples of two common proof styles
invited to study both proofs since they are
in
Category Theory. Let
Gob Obc-*ObD :
universal arrow.
be the function defined by
GQb( c) =
define,
For every
VgED[d,GQb(c)] T d>c (g) = u c
dEObj) and cEObc,
isomorphism. Note 1-
By
that,
^d',c(g
T d;C -l(f)
we now
For simplicity, Let Gjy^or
1
T d,c
:
More
o
•
o
F( g
h
)
we have
is
the
F(g).
D[d,Gob( c )] -*’C[ F ( cO,c]
= uc
F(g)
°
o
F(h) = x d>c (g)
x d c ( x d>c ‘l(f) «
is
0
h
)
=
f
0
°
F(h).
Morj) be the function defined by
GMor( k) =
= x-l(u c
'
' t 1 (k °
«c)
is a
eD GOb(c G Ob(c')]).
[
functor
« id
F(G(c))
= t!(u c ° F(id G c)) ( = f 1 (x(id G c )))
)
(
=
id G(c)
c'-*c", k: c-*c', °
clearly a set-theoretic
F(h), or equivalently,
).
G(id c ) =x-!(u c )
G(f
°
F (g)-
°
h = Td>c-l(f»F(h)
We want to prove that G = (GQb» GM or)
f:
= uc
omit the indexes of x and x'l
VkeC[c,c']
and, for every
f
VhED[d',d],
h) = u c
0
taking x d?c "l(f) for g in (1), 2.
:
,
We have VfGC[F(d),c] 3!gED[d,G 0b (c)]
Now
d c where u c F(d c )-*c
k)
= x“l( f
°
k
°
Uc)
= x*!(f °u c '°F(T-\k
°
u c)
)
d
)
101
Universal Arrows and Adjunctions
= x-!(f = G(f) (1)
o
U C ')
°
r !(k
°
by
u c)
(2)
G(k).
-
proves the naturality of x d c in the component d
We have still to prove the naturality in
.
c, that
VgED[d,G 0b (c)] VkEC[c,c']
is,
f
G ( k)
3- *d,c'(
»
g
0
= k
)
x d)C (g).
•
We have
By
x(G(k)°g) =x(x-!(k
0
u c)
= x(x-!(k
0
uc
=k
°
= k
o x(g).
taking x d c "l(f) for g in (3)
and
Note
we
(4) state the naturality
obtain x d>c '(G(k) °
x^c"
,
(2)
1
®
xd c“l(f)
°
= x d)C --l(k
)
= k
0
f
,
or equivalently,
o f).
then
G(k) = G(k)
which shows
by
) )
of x“l.
G must satisfies (4)
that since
g F(g)
F(g)
®
G(k)
4.
(2)
uc
0
o
id
= G(k)
that the adopted definition for
G
x-!(u c) = x’l(k
o
was
°
u c)
actually forced. This proves the unicity of the
functor G.
Example An
interesting
By
categories.
the previous section,
axb-*a, p2 axb-*b) :
to b.
Then
is
to
we know
universal from
the functions _x_:
axb and b
to
example of application of theorem 5.2.2
A
to
b a can be extended ,
definition is the following: for every
to f:
and _a
a-»c
,
g:
a
(_ )(g) = A(eval a> b
may be
T:
C-*l
1-*C
to
t.
is trivial,
is
aEObc
°
g)
g
ba
:
0
—
c-*t
!c:
it
Obc^Obc
Cp-^Cj. The
is
as in the second
there exists the lifting a
which takes every object a
explicit definition of the functor (_°)(f)
where x(f°exa)
is
a,b
all
=
in
Ob£,
:
P2 >
axb-*cxd
:
a .
may be
,1]
seen as universal arrow from the
lEObj
example below definition
0 .
By example Cj-^Cp
to its lifting a°,
5.1.4
to a.
5.1.2,
we know
By theorem
may be extended
_° on a partial arrow
0
to
in
t
t
C
a C[c,T(l)=t].
f =x(foexb)eq[bV]
the only arrow such that ex c
(p:
_xa
universal from
interesting that the existence of the terminal object
an universal arrow from the embedding functor Inc:
_°:
is
Obc-*Obc which respectively take (a,b) CxC-*C and _ a C->C. The explicit
:
expressed by the natural isomorphism l[!C(c)=l
each object
then for
In this case, the extension of the function that takes
but
Example Consider C, Cj and Inc that for
CCC,
b-*d
f 0 pi,
For every object c in C, even the unique arrow
to a functor
a
two functors _x_:
(_ x _)( f>g) = fxg =
cp D[f(c),d]-»>C[c,G(d)] be the function defined by
Equations (1) and (2) express exactly the fact that x c>cj and x c>cf * define an
We have still to prove their naturality.
Let kED[d,d'], hEC[c,G(d)], h'EC[c',c], and
then
x _1 (G(k) «h) =
r !(G(k)
= x‘l(G(k = k nat-2.
°
0
unit°k)
x"l(h
°
k)
0
0
°
G(x'l(h)) -
x l(h))
0
°
unit c )
unit c
)
_ x l(h)
= x _ l(G(x"l(h)
o )
unit
0
k
by
(1)
;
.
107
Universal Arrows and Adjunctions
= x -1 (h)
°
_ T l(unit
°
k)
by
(nat-1)
by
(nat-2)
= x-l(h)oF(k); x(k'
nat-3.
0
F(h')
)
=x
(x"l(x(k')) ° F(k) )
=x
(x"l(x(k')
= x(k
nat-4.
= G( k
° k' )
rj :
0 h' 0 k') °
= G( k
)
= G( k
)
°
unit
G(k')
°
unit
o x(k').
:
5.3.6 Proposition Let
transformations
x(k')
0 h')
C-*D
be an adjunction. Then there exist two natural
Idc~*GF and e:FG-*Idj) such
e(d) are respectively the unit
and counit of the
that,
for every c in
C and d in D,
r](c)
and
adjunction.
Proof Exercise.
In other words, that, if y\
:
one may construct the unit and counit “uniformely” and naturally.
Idc“*GF and
FG-*Id]) are the natural transformations
e:
Observe also
in proposition 5.3.6, then the
following diagram commutes:
The previous diagrams
fully characterize an adjunction: as a matter of fact
define an adjunction between two categories
C-*D
and G:
D-*C
are functors, and
r\
:
C
D
and
Idc“*GF
,
e:
as a quadruple
many (F,
G,
authors prefer to r\
,
e)
where
F:
FG-»Idj) are natural transformations
such that
We leave
it
adopted.
We
(Ge)
°
(eF)
° (Ft))
=
(riG)
id
G
= idp
as an exercise for the reader to prove the equivalence of this notion with the
one
we have
shall use the definition of adjunction as a quadruple in the next section, since
simplifies the investigation of the relation
it
between adjunctions and monads.
Exercises 1.
An
adjointness (F, G, r\
,
e)
from
C
to
are natural isomorphisms. Prove that given is
2.
D
is
an adjoint equivalence
two equivalent categories
C
if
and
and
e
(see section 3.2)
it
and only
D
if
r)
always possible to define an adjoint equivalence between them.
Given an adjointness
statements: i.
tiGF = GFri;
(F,
G,
T],
e)
from
C
to
D, prove the equivalence of the following
.
Universal Arrows and Adjunctions
108
an isomorphism;
ii.
r]G
iii.
eFG = FGe;
iv.
eF
is
Example
we
In section 3.4
respectively,
example
that
an isomorphism.
is
defined the
CCCs
H(f) = f by the definition of continuity.
in this case, filter continuity
easily define the natural
H
:
={01 O
has a
where OEtop
T((X, F)) = (X,top)
may
H Top
are actually adjunctions. Recall that
H((X,top)) = (X,F) where F(x)
Also
of limit and
which generalize topological spaces, Top. The
is
filter
functorial
-*•
FIL
a filter
left adjoint
is
“embeddings” mentioned
T FIL :
-*>
Top
corresponds to topological continuity,
isomorphism x
in
given by
and VOEtop (xEO
VxEO VOEF(x) OEO
iff
L-spaces and FIL
spaces,
OEO)}.
=>
defined by .
i.e.,
T(f) = f
.
The reader
.
A stronger notion of convergence, to be used for
In general, limits are not unique in filter spaces.
computability (see the final remark in section 8.4),
may be
given as follows. For (X,F) in
FIL
consider (X,top) = T((X, F)) and define (s-conv.)
Then top Let
Tq
iff
s x iff
s-convergent
xEO
{xj}CO
eventually).
Adjunctions and Monads
In this section
monad. As
we
study the relation between two seemingly distant concepts as adjunction and
a matter of fact, every adjunction immediately defines a
monad, and conversely every
,
.
Universal Arrows and Adjunctions
monad can be thought of
109
by an adjunction, called
as generated
definition 5.4.2 below). Resolutions for a given
a natural notion of
morphism between them;
Categories associated with the
and
which
presentation
is
a
C and
monad on
GF,
we
=
p
0
Tr|
p
0
rjT =
eFG =
Indeed, for any
Then one has
GeF
D' such
,
a category C.
C to D e): C->D
from
resolutions (F, G, r]
that F'
=
A
resolution for
such that
and
(F',
H °F, G = G'
\
resolutions for that
monad.
r]
p)
is
a
,
°H and He ,
prove that the Eilenberg-Moore and Kleisli categories associated with a they are respectively the terminal and
(T,
T = GF and p = GeF. A G', r e'): C-+D' (for the
proved that resolutions with the associated morphisms form a category.
rise to resolutions. In particular, all
is
.
,
5.4.2 Definition
easily
e)
first that
FGe
e 0
= n
category
be an adjunction from
GeF ° r|GF = (Ge
= GeF
rest is
e)
GFr| - G(eF
0
dEObj) and
p
to
theorem,
at the first
We must prove the unity and associative laws for the monad.
e d ° e FG(d)
It is
may just look
have
For the associative law, note e 0
,
- GrjF,
and
r|,
GFGF-*GF.
for the unity laws
tj
(T = FG,
first that
and p - GeF:
The
then happens that the Eilenberg-Moore and the Kleisli
will be applied in the next section.
Proof Note
As
(see
by introducing
(see definitions 4.2.3 and 4.2.4) are respectively the terminal
rather technical; at first reading, the reader
5.4.1 Proposition Let (F, G, is
it
monad
a resolution for the
build up in a category
object of the category.
initial
The
monad
monad can be
monad
initial
=
e'H.
Now we (T,
r
\
,
are going
p) both give
objects in the category of
F
Universal Arrows and Adjunctions
110
5.4.3 Proposition Let (T,
Moore category
rj
monad over
p) be a
,
morphism of algebras h
which
is
an
C-*CT
C. Let F^:
in
and every morhism
f:
be the natural transformation defined by e^(c,a) = (F^, l/T
UT o Ft = T UT e T FT = p, since for any object .
ri
e^)
,
a
a resolution for (T,
is
be the
c-*c' to (note
ri
,
p).
c one has
=UT( e T fT(c)) Ut(et(T(c),
=
of FT
by
def.
= llT(nc )
by
def. of
= pc
by
def.
have to prove that (pT,
UT
^
(U T e T) (e
e T)
>
js
(r|UT)
o
TFT) o
hc ))
(fT-t,)
an adjunction from
of U^-
to
C,
that is,
= idpjT
= idpT
has, for every T-algebra (c,a),
(U T£ T
•
UT(eT(c>a) ) • TluT(c ,a)
riUT) (c,a) =
a 0 »l c
=
= idc for every (e
TFT.FTr,)(c)
= eTpT(c) 0
l^c
=
We say that the resolution by proposition
5.4.3, is associated
77
(F,
G,
tj
,
e):
C-+D
unique arrow from
such an arrow
is
(F,
a functor H:
Define, for any object
d,
G,
r\
def. of T-algebra.
by
def. of
,
any
to the
monad over a
Eilenberg-Moore category C^, and given
category
monad (T,
C .Then
,
e) ,
to (F^,
U^,
such that
and any morphism )
cEObc, any hEMorc,
is
the resolution
(F^, U^,
a terminal object in the
rj, pt).
be another resolution for (T,
H(f) = G(f). has, for
C
e^) from
the Eilenberg-Moore Category C?,
r|
e^ and F^
with C^.
D-^C^
H(d) = (G(d), G(e(d))
Then one
by
by the unity law of the monad.
be a
p)
,
category of all the resolution for the
exists a
uT
def.
c)
T(i1c)
U^,
C--CT, associated with
Proof Let
T(r|
•
idT(c)
(F^,
5.4.4 Proposition Let (T,
E?):
of eT and
by
cEObc,
=
r\y
fi)
,
morphism
as a
We want to prove that
T(c)-F^ljT(c,a)-»c).
(UTeT FT)(c)
And
rj
(c,a) to c, and every
to its free algebra (T(c),p c ),
c
F^uT-Md^T
F^(f) = T(f). Let e^:
One
be the Eilenberg-
that takes every algebra
same h regarded
to the
functor which takes every object
We still
CT
let
C? to C.
Proof Let U^: cT-*-C be the forgetful functor
Obviously
and
,
associated with the monad. Then there exists a resolution for (T}
adjunction from
that a:
C
a category
f
r\
,
F^ = H of D,
e^). 0
F,
r\
,
p).
We
Remember
G = uT o h
must prove
(cf.
,
that there
definition 5.4.2) that
and He -
e
TH.
,
Universal Arrows and Adjunctions
111
H(F(c)) = (G(F(c)), G(e(F(c)))
)
=
(T(c),
nc ) = FT(c)
H(F(h)) = G(F(h)) = T(h) = FT(h) that
H°F= F^.
proves the equality
Moreover, for any dEObj), and any fEMoq),
uT(H(d)) = uT(G(d), G(e(d))
)
= G(d)
uT(H(f)) = uT(G(f)) = G(f), as IjT
G
That proves the equality Finally, for e
that
have
o
h
the identity
is
on morphisms.
.
any dEObi),
TH(d)
proves the
We
= IjT
= eT(G(d), G(e(d)) equality He - e^H.
still
prove that
to
H
= )
G ( e (d ))
the unique
is
= H(e(d))
morphism from
(F,
G,
r\
e) to
,
(F^,
U^,
ri
,
e^).
Let H' be another morphism; then, for any fEMorj), H'(f)
and, for any
=
U T (H'(f)
= G(f) =
U T (H(f)
= H(f)
dEMorp, (
U T (H'(d), e TH'(d))
by def of uT and eT
=
(
G(d), H'(e T (d))
as
=
(
uT(H(d), H(eT(d))
H'(d) =
*
)
G
=
UT ° H' = H(f)
as H'(f)
)
= (UT(H'(d), eT H d )) ( = H(d). This completes the proof.
The unique functor p,)
is
called
to (F^, IjT, r\
eT) in the category of
,
comparison functor and
The category of
resolutions of a
it
is
all
usually denoted by
monad has
monad
resolutions for a given
(T,
r]
kT.
also an initial object,
which
is
based on the Kleisli
category associated with the monad.
5.4.5 Proposition
Let
(T,
rj
}
n)
be a
monad over a
category C, and
category associated with the monad. Then there exists a resolution for
from
Cj
Cj-^C
any object c of
Ux(h) =
for
Cj (i.e., of C ),
that
is
an adjunction
and any morphism hECj[c,c'] (and thus hEC[c,T(c')])
Pc’
0
T(h).
C-*Cx be functor defined by the following:
any object c of C, and any morphism fEC[c,c'], Ft(c) = c
FT(0 = ’1c’°f Let ej:
fi)
be the Kleisli
be the functor defined by the following:
Uj(c) = T(c)
Let Fj:
rj,
Cj
to C.
Proof Let Uj: for
(T,
let
FjUj-^id be
(
= T(f)
° t) ). c
the natural transformation defined
by the following:
Universal Arrows and Adjunctions
112
for
any object c of Ct, ®T( c) = id T(c)
(inC).
ej): C-*Ct We want to prove that (Ft, Ut, Obviously, Up 0 Ft = T Moreover, Uj ej Ft = p, since for any object c r|
is
,
a resolution for (T,
r\
,
p).
.
(Uj et Ft)(c) = Ut(et (c)
We have still to prove that
One
by
def. of
Ft
= UT(idT(c))
by
def. of
et
= pc
by
def. of
Ut.
(Ft,
Ut,
ti
(Utet)
°
(etFt)
0
has, for every object c of
(Ujst ° nUj)
)
et)
,
(F-m) =
an adjunction from
Ct,
that
is,
Ut~*Ut
id: id:
C to
Ft~*Ft.
Ct,
= He
6
= He
0
=
is
(tiU T) =
= Ux(id T c)) (
(c)
one has
•
rix(c )
T(idT(c))
6
nT(C )
by
def. of
by
def.
as
^TCc)
T is
et and
Ut
Ut
on morphisms
a functor
by the unity law of the monad.
id c
And, for every cEObc,
(ejFx
°
Fxn)
(c)
= ex(c) =
by
def. of
by
def.
by
def. of
’Ic
by
the unity
id c
by
def. of the identity in
°
OlT(c)
idT(c) °
= hc
°
0
(mcc)
Tlc) 0
n c)
T(idT(c)) 0 nT(c) ° n c
Ft
of et
composition
° in
Ct
= HC ° ,1T(c) ° Tlc = —
5.4.6 Proposition Let (T,
C-^Cj associated with the
monad
Proof Let exists a
(T,
rj
(F,
,
rj,
n) be a
the Kleisli Category
F=
over a category C. The resolution (Fj, Uj,
Cjis an
initial object in the
r\
,
C-*D
e):
be another resolution for (T,
K 0 Ft, Ut = G K 0
t]
,
et) to (F, G,
Ket
and
,
Define, for any object c of Ct, and any
K(f) = ef(c')
Then one
r\,
ej):
category of resolutions for
r\
,
r|
,
p).
e), that is
We
must prove
f are
»
morphism fECT[c,c'],
F(f)
regarded as object and morphism of C.
has, for any
cEObc, any
hEC[c,c'],
K(Fx(c)) = K(c) = F(c)
K(Fx(h)) = K(r) c
'
»
h)
that there
a unique functor K:
eK.
K(c) = F(c)
where c and
Ct-
p).
G,
unique arrow from (Ft, Ut,
such that
monad
law of the monad
by
def. of
Ft
Ct^D,
)
.
Universal Arrows and Adjunctions
= =
113
by
E F(c') ° F(r)c' ° h) 0
EF(c')
FOlc’)
°
F(h)
as
= F(h)
as
def. of
F
K
a functor
is
G,
(F,
r\
,
e )
an
is
adjunction.
K 0 ¥j = F
This proves the equality
.
Moreover, for any object c of Cj, and any morphism fECT[c,c'], G(K(c)) = G(F(c)) = T(c) = Ut(c) G(K(f)) = G(e F(c ')
=
Me'
°
by
° F(f))
= G(e F(c .))
»
G(F(f))
as
as (F, G,
T(f)
= Ux(£) that
that
,
e) is a resolution
Uj
def. of
K(ex(c)) -K(id T(c) )
by
def.
of ej
=
E F(c')
by
def.
of
-
e F(c')
as
F
-
E K(c')
by
def.
Uj = G 0 K
any dEObj),
proves the equality
Kej -
0
F(idT c)) (
Op-^D be
K
a functor
is
of
K
eK.
We have still to prove that K is the unique morphism from Let K':
ri
by
proves the equality Finally, for
def. of K G is a functor
(Fj,
Uj,
r\
,
ej) to (F, G,
ri
,
e).
another morphism; then, for every object c of Cj,
K'(c)
= K'(Ft (c)) =
by
F(c)
def.
as K'
of
0
F^
FT = F
= K(Fi0
is
exactly what
is
1-
!A
|-!(ATIB).
needed
to recover the intuitionistic calculus:
it is
an embedding of intuitionistic (and classical) logic into linear logic. The
intuitionistic
A A
formula
A=A
if
to a linear is
A
formula
in the
following way:
an atomic formula
=An B A vB = !A® !B A =>B = A —o B
AaB
!
(
!
is
supposed
to bind tighter than
The absurdum
F
—o
of intuitionistic
is
U
and
).
translated into 0, the identity for
©
.
Thus
zA
=
!A—oO.
In other words, the iterated use of the premises, in a linear implication, gives exactly the intuitionistic
implication. Then,
Our aim now
T
if,
is to
|-j
A,
in intuitionistic logic, then
T
|-
A
in linear logic.
give categorical meaning to the connective
we
categories (see definition 4.4.4),
We
!
have already remarked
also obtain an interpretation for
that a resource
6:
®!A
!A-*!A
?,
why
duality, in linear
not.
such as !A can be duplicated and erased, and
sense these properties characterize the meaning of the connective
expect to have two morphisms
By
of course.
!,
monoidal category. (Commutative) comonoids
,
and
in 4.3.4
characterized by a sort of diagonal map, such as
6,
e:
seem
and a
!
Thus,
.
where
!A-*1
at the
1
is
in a
sematic level,
we
the identity of the
the right structure for this, as they are
map
e
which dualizes
the
map
r|
in
definitions 4.2.1 and 4.3.3.
We
start
then with a monoidal category C.
isomorphisms, given in 4.3.1, which 1.
assoc:
2.
ins-1:
3.
exch:
4.
ins-r
we rename
By
definition,
C
must
satisfy certain natural
in this section, for convenience, as follows:
X® Y® Z) « (X® Y)® Z; (
X « 1 ® X; X ® Y * Y ® X.
Let also
As mentioned
= exch
0 ins-1
:
X « X ® 1.
in section 4.4, the connective of linear implication
adjoint to the tensor product
®
,
when
C
is a
—
o
is
interpreted
monoidal closed category, as defined
by the
right
in section 4.3.
.
!
117
Universal Arrows and Adjunctions
Recall that the category
C,
as objects, for c in
arrow
f:
c-*c' in
C
,
CoMon^ c-*c®c,
(c, 6:
f
e' °
f-
- (f®f) e:
(e®id c)
exch
°
assoc
As
c-*l), and morphisms
e:
0
0
6
for each
c-*c'®c'
:
c-*l
(c, 6:
6 =
6 = 6
° (id
:
c-*c®c,
ins-1
c-*l) observe that the following equations hold:
e:
c-*l®c
:
c-*c®c
c®6)
6 - (6®id c)
°
pointed out below definition 4.3.6,
Cartesian product
6, e)-*>(c', 6', e'),
f: (c,
such that 6' °
Given a commutative comonoid
Exercise
of commutative comonoids over a monoidal category C, has
0
6
:
C
if
c-*(c®c)®c
.
and the isomorphisms are the canonical ones, then
fl
isomorphisms above can be constructed for each object canonically given; namely, 6 = the terminal object). Prove that, if
C is
c-*cflc
:
is
C
in
all
e:
c-*t
is
is
the
(in particular, recall that
the diagonal and
Cartesian, then
®
Cartesian, in the sense that
is
actually a
maps and
6 and
the unique
C is actually isomorphic to
e
are
map
to
CoMon^;. Does
the converse hold?
5.5.3 Definition exist natural
A
! -
model
is
a linear category
C
and a comonad
(!,D,E)
such that there
isomorphisms
I: !(ADB) * !(A)®!(B)
J:!t*l where
t
and
1 are the identities for tl
and ®,
the Cartesian
and tensor products
in C.
Indeed, by definition, in a linear category one has both a monoidal and a Cartesian structure. The relation established
5.5.4
Lemma
d':!c-*!c(8)!c
Proof
by the
natural isomorphisms gives the
Let be an ! -model.
and
e':
!c-*l, such that
6'« I°!6
Just set
e'-
where 6 = to the Cartesian
:
:
Me:
!c
!:
C
C-*C, -*
is
in C, there exist
maps
a comonoid.
c-*t are the monoidal
e:
D:
!
is
CoMonc !(c)
=
maps
in the
remark above, with respect
easy.
—
0
!,
E:
!-*Idc
ingredients for the interpretation of the connective
define the functor
,
!c-» !t-»l
c-*cflc and
(!:
Then for each object c
-*!(cDc) -*!c®!c
product D. The rest
Thus, the comonad
(7c, 6', e')
monoids we need.
!,
)
associated with a !-model gives
of course. In view of the above lemma,
by (!c, 6':!c
—*-!c®!c,
e':
!c
-*1)
.
all
the
we
can
A
Universal Arrows and Adjunctions
118
D
This gives the required monoids, while the natural transformations
Dc
:
!c
We
Ec
-*!°!c and
!c —*c, which
:
are
needed
and
E
to interpret the rules in (!,r)
uniformly yield maps
and
(!,1).
already mentioned in section 4.4 that the idea of the interpretation relies on viewing
entailments as morphisms. In short, observe that, with an informal blend of syntax and semantics,
are interpreted by
the rules
the fact that
each morphism
(weakenings)
gives a
each morphism
(contractions)
gives a
gives a
gives a
for the rules :
which contain
?,
their
meaning
is
that is
5.5.5
!a-»A
:
!a®!a-»A f°6 a !a-*A :
:
-
*
f:
morphism
!c-»a !f°D c !c —*•! :
easily derivable
by
duality.
The idea
is to
define a
C-»C by ?
why
f°e a
f: a-*A morphism f°E a !a-*A
each morphism
(!.r)
functor ?
f:
morphism
l-*-
each morphism
(U)
As
f:
morphism
?A =
Then
(!A*)*.
the following
o
.
*
j
theorem gives the categorical meaning of the modality
?,
not.
Theorem Let be an
'.-model.
Then there
exist a
monad
(?,
D': ?° ?-*?, E':
Id-*?) and natural isomorphisms
where 0 and
1
/':
?(A®B) * ?(A)U?(B)
J':
?0*1
are the identities for
®
and
U, the duals of the Cartesian
and tensor products
in
C.
Proof Set D:
!-*!!,
?
=
*
°
• !
*
:
C
-*
C
and, for each object A,
D'a = (Da*)* and E'a = (Ea*)*- As
one has
Da*: !A*-*!°!A* (Da *)*: (!°!A*)*-(!A*)* (Da*)*: D'
Each of these Similarly,
steps
from
is
E:
a
by by
def. of (-)* id
»
(-)**
?°?A— ?A.
an isomorphism, uniform in A, and gives a natural transformation D': ? 0 ?-*?.
!-*Idc one has Ea*: !A*-*-A* and,
properties required for a
As
:
(!°* 0 *°!A*)*-*(!A*)*
monad follow by
for the natural isomorphisms,
compute
duality.
thus,
E'a = (Ea*)* A-*-?A. The :
119
Universal Arrows and Adjunctions
?(A@B) =*°!°*(A®B) -
Finally, ?0
is
Next we
0 !
0
by theorem 4.4.6
!(A*DB*)
« (!(A*)®!(B*))*
by
- ?AU?B
by theorem
*0 »
0
Endow
Exercise product
=
*
*
*
0
* 1* *
t
!
a structure of
1
find, within fl
Then give
to intuitionistic logic,
from
we
use
its
categorical
once the connective
is
!
?.
logic, an interpretation for the intuitionistic
As
in the
!
-model. Namely, given an
the purpose of the iterator
meaning
we
a matter of fact, in the previous remark,
linear ones,
4.4.6.
!-
“and” and “implication” by Cartesian product and
exponential in a suitable category derived from C.
As
4.4.6.
the details of the interpretation of the rules for
any categorical model of linear
interpret intuitionistic
!-model
monoidal category whose tensor
in a
and =>, by using the comonad construction
model C, one may
back
theorem
definition and
monoid over each object
actually a Cartesian coproduct.
connectives
by
,
def. of
to construct this
hinted
available.
how
new
!
was
to take us
category.
to derive intuitionistic connectives
The following
result gives the categorical
counterpart of that construction.
Observe
comonad
that in general, given a
(T, 6, e)
category whose objects are those of C, and the set K[A,B] of morphisms from
C[T(A),B]. The identity in K[A,A] in
K is the B in K
over C, the co-Kleisli category
A
to
is
T(A)-*A. The composition of fEK[A,B] and gEK[B,C]
is
K is gof=g° T(f)
(see definition 4.2.4
5.5.6
where
Proof
is
8
A T(A)-T2(A)-T(B)-C :
Kleisli categories over
Theorem IfC be an
(!,D,E)
o
monads were
defined).
Then the co-Kleisli category
! -model.
K associated with
the
comonad
Cartesian closed.
(hint)
The exponent of two
objects
B
and
C
(!B
is
—
oC).
We
then have the following
chain of isomorphisms:
K[ADB,
C] * C[!(A(TB), C]
by definition of
* C[!(A)®!(B), C]
—oC
a C[!(A), !B
a K[A,
Example
In section 2.4.2
we
!B—oC
]
]
as
C is monoidal closed
by
(see section 4.4),
it
definition of K.
defined the category Stab of coherent domains and stable functions.
In that section (see exercise 4) the subcategory Lin, with linear maps,
was given
coherent domains as follows:
K
as !(AflB) a !(A)®!(B)
if
as an
example of
X is a
linear category.
coherent domain, then !X
We is
was
also introduced and, later
also defined a function
the coherent
!
on
domain defined by
Universal Arrows and Adjunctions
120
determined by
map
f
Tr(!f)
=
Next,
we
to a functor
!
:
is
aUbEX.
iff
Stab-*Lin. Recall
map may be
that a linear
equivalently described in terms of
map
i.e.,
g:
Z-*Z'
is
uniquely
on the elements of
its trace.
|Z|.
Set then, for each
X-*Y,
:
bEY, b
{({a}, b) |
finite,
aEX,
define an adjunction between
Stab. This
a finite};
behavior on the points of the coherent domain Z,
its
Moreover, any stable stable
it
aEX,
/
afb [mod !X]
ii.
We need now to extend
= {a
|!X|
i.
a finite and least such
b
C f(a) }.
and the obvious inclusion functor Inc from Lin into
!
given by a natural isomorphism
(iso)
qp
:
Lin[!A,B] * Stab[A,B]
where the inclusion functor
Once more we use
omitted.
is
traces, that
Tr()
= Q(
= Q(
0
snd
B °!snd = e (E
!fst
EAn B
>)
•
(!fst
0!snd)
o
=
(!fst
0!snd)
- (
=
(!fst o
b
by
naturality of
by
def.
of
E
Ap| B ® Q(k) Q(k)0Q(k)
Q(k) )0(!snd
®
Q(k)
) )
• »
b 6
0
b^s >)
°
!snd >)
and !snd are comonoid morphisms
Q(k) =
=
I
AnB = £A°- lst
B0id B ) 0 bs
Eahb)
= i d !(AflB)
k 2 and
by properties of comonoids
!snd >) °
0
def. of k\,
as e
1 0
k
by (hom-1)
E
0
0
))
)
Universal Arrows and Adjunctions
=
(
Q(
k) )®(
fst °
Q(
123
fst 0
k)
)
°
6
-(Q(ki))®(Q(k2))°6
Ea
° ins-r' 1 °
-
(
-
1 ° ( ins-r' (id;
-
1 ( ins-r"
-
1 o ( ins-r'
=
1 ( ins-r'
Q(
(idiA
®
eg) )®(
Q(Eb
0 ins-1' 1 °
a ® eg) )®(
ins-1" 1
(ea ® idg) )°8
(idiA
® eb) )®(
ins-1' 1
(ea ® idg)
0
(idjA
® ea) )®(
ins-1' 1 °
® idg)
0
by
(nat-1)
by
def. of
(ea ®
0
6
by
def. of
by
(nat-2) and def. of
and k 2
E
niix ° (6a®$b)
by (Eg
k
idg)
def. of
6
(6 a®&b)
by application of mix
a ® ea) &A )®(
(id
°
!
ins-1" 1 °
(eb
® idg)
0
&b)
by properties of comonoids = id!(A)®idi(B)
= id!(A)®!(B)
The construction
As
is
•
clearly uniform in
for the natural
isomorphism
J,
A
and B.
note that !A » !(ADt) * !A®!t
,
!A
at
!(tHA) s !t®!A and that
the right and left identity, in a monoidal category, are unique.
References
Universal arrows and adjunctions are fundamental notions in Category Theory.
Their treatment, in various forms, and references to their origin
mentioned
in the previous chapters.
may be found
in all textbooks
References for linear logic have been given in chapter
4.
we
Chapter 6
Cones and Limits
In chapter 2,
we
how common
learned
constructions can be defined in the language of Category
Theory by means of equations between arrows of given definitions
we saw
objects. In chapter 4,
were based on the existence of an universal arrow
given functor. The category-
to a
theoretic notion of limit is merely a generalization of those particular constructions, as
common
universal character.
From
another point of view, the limit
of universal arrow, where the involved functor see.
To
help the reader
become confident with
we
is
this
is
that those
it
stresses their
a particular and important case
a “diagonal,” or “constant” functor, as
new
notion,
we begin
this
we
chapter by looking back
regard them as particular instances of limits.
Then we study
at the
constructions of chapter 2 and
some
relevant properties concerning the existence, creation, and preservation of limits.
computer science,
limits
have been brought
to the limelight
shall
As
for
mainly by the semantic investigation of
recursive definition of data types: this particular application of the material in this chapter will be
discussed in chapter 10.
6.1 Limits
and Colimits
The concept of
limit
embodies the general idea of universal construction,
has a privileged behavior
among
is,
essentially
is,
of an entity which
a class of objects that satisfy a certain property.
define a property in the categorical language
arrows, that
that
is
The only way
by specifying the existence and equality of
by imposing the existence of
a particular
to
certain
commutative diagram among
objects inside the category.
6.1.1 Definition
A
diagram
nor must
More
it
in
C
is
a category
C
is
a directed graph whose vertices
similar to a subcategory of C; however,
iEI are
it
does not need to contain
identities,
be closed under composition of morphisms.
formally, a diagram in a category
from an index graph I”.
in
and whose edges eEE are labeled by morphisms
labeled by objects di
A diagram D
D
I
to the (graph
C
should be defined as a graph
underlyng the) category
For the adjunction between graphs and categories,
category I freely generated by the graph the index category
is
small.
I
C
.
Such
a
this is exactly the
(the index category) to C.
homomorphism
diagram
same
is
D
called “of type
as a functor
from the
A graph is called small when
Cones and Limits
126
6.1.2 Definition Let is
C be
a category and
D
a diagram with objects
c and a family ofmorphisms {fiEC[c,dj]
an object
Vi,jG VeEE fe eC[db dj]
Cocones
Note now
hj 0
Clearly,
that,
given a diagram D, the cones to
g=
f[.
That
to
D
=> fe
°
=fj.
fi
Cones^D
Cones(j
j) f
|
D
form a category,
call
it
ConesQD
iEI}) any gEC[c,c']
iEI}) to (c',{hjEC[c',di]
•
Just take
such that
|
is,
is
6.1.3 Definition. Let in
Then a cone
.
In a partial order P, cones correspond to lower bounds, cocones to upper bounds.
morphisms from (c,{fj£C[c,di]
ViEI
iEl
dj,
i£7 } such that
are defined dually.
Example
as
1
a category.
C be a
Dually one defines the category
category and
D
CoconesQD
a diagram. Then a limit for
D
is
•
a terminal object
Colimits are defined dually.
.
iEI})
(c,{fiEC[dj,c] |
commutative diagram:
is
the initial object in
CoconesQD, ^ ma y
visualized by the following
Cones and Limits
127
Limits are also called universal cones, as any other cone uniquely factorizes via them. Dually, colimits are called universal cocones.
Examples 1.
Let
P be
Then
a partial order.
limits correspond to greater lower bounds, while colimits
correspond to least upper bounds. 2.
Let
D
= ({djjqeoj, {fjESet[dj, dj+iJIieo)
Then
(the set-theoretic inclusion).
(Exercise: what
is
the limit of the
now
a
of the category
be a diagram
same diagram?)
Exercise Prove that the colimits in
Consider
)
C
are the limits in
C°P
is
the
image of
degenerate diagram of type
in
I
natural transformation
from
D
to
Once diagrams
D'
is
for a
diagram
Kq
D to
of type
I
K c (i) = c
K c (e) = id c
K c (j) = c
and
d[+i -*
is
fj
=
incl
U{dj}
I to
C. Note YLq
first that
D
any object c
can be regarded as it
makes sense
and D' are two diagrams of type f|
indexed on objects
in
I
such
I,
a to
a
that,
I),
from an object c
D as follows:
C d[+\,
are defined as functors,
a family of arrows
for each arrow e in I (each edge of the graph of type
constant diagram
-*>
I-*C, and so
a constant functor
C.
dj
of the dual diagram.
diagram as a functor from an index category
C
such that dj
.
consider natural transformations between diagrams. If
A cone
in Set
do -*
the colimit of
is
then a natural transformation from the
Cones and Limits
128
D
Dually, a cocone for a diagram the constant diagram
6.2
of type
I
to
an object c
a natural transformation
is
from
D
to
.
Some Constructions
Revisited
D be an empty diagram, that is a diagram with no objects and no arrows. By definition, a cone C to D is then just an object c of C, with no other structure (and every object of C can be seen
Let in
as a cone).
A limit for the empty diagram is then an object
exactly one arrow from c to
i.e., it is
t,
a
t
such that for any other object c there
terminal object. Dually, the
is
initial object is the colimit
of the empty diagram.
A graph is called discrete if A diagram of type
it
has no arrows. For example the set {1,2} can be regarded as a {1,2} in a category
discrete graph.
limit for such a that for fi
0
But
diagram
is
an object
d,
any other cone (d',{giEC[d',q]
C
is
A
an ordered pair of objects, (ci,C2).
together with two arrows i\: d-»ci and f2: d-*C2, such |
iE{l,2} }) there exists exactly one arrow
h: d'-*d,
with
h = gi for iE{l,2}.
this is just the definition
of product d of c\
and C 2 with
fy.
d-*ci and
f2
:
d-*C2
as
projections.
Dually, the coproduct q#cj,
The product of any indexed
n^Di,
I
kEC[d,b] such for 1
=
that
any other cone k'.
I
I
in a category
for this
g
0
is
the index set considered as a discrete graph. This product is
is
often omitted.
with two vertices and two edges:
C
is
a pair of objects,
a
diagram consists of an object
h = k and
diagram {q,cj}.
defined analogously as the limit
is
although explicit mention of the index set
Consider the following graph
A diagram of type f,gEC[a,b]. A cone
the the colimit of the
collection of objects in a category
of the diagram D: I-+C where usually denoted by
if it exists, is just
f 0
h =
k.
and
(d',{h',k'}) there exists exactly
one arrow
(d,{h,k}) that
d —d f
1:
and a pair of parallel arrows
and two arrows hEC[d,a]
d,
A limit is a cone
b,
is
and
universal, that
such that h
0
1
=
h',
is,
and k
0
129
Cones and Limits
f
ZZZTtb
a
Note now
that the existence of
two arrows, h and
equivalent to the existence of an arrow h such that g k',
k°l = f°h°l = f°h' =
since
k',
now the
k,
h =
thus the above limit
Dually, coequalizers are the colimits for the
Consider
0
such that f is
°h = k and
g
Moreover, h
° h.
° 1
=
h =
implies
h'
just the equalizer of f
f °
and g
k,
k
°
is 1
=
.
same diagram.
following graph:
A diagram of this type in a category C is a given by three objects, a, c, and b, and two morphisms, fEC[a,c] and gEC[b,c]. A cone to this diagram is an object d, together with three morphisms h a EC[d,a], h c EC[d,c] and ht,EC[d,b], such
A cone arrow
(d,
k:
{h a hb, h c }) ,
d'-*d such that
is
that the following
a limit, if for any other cone
h'{
=
Thus, the diagram for the cone
commutative “square”,
i.e.,
(d', {h' a , h'b, h' }) c
there exists a unique
h[ 0 k, for iE{a,b,c}.
The commutativity of the previous diagram implies arrows h a and hb such that f
diagram commutes:
0
ha = g
(d,
,
(d,
ha = g
0
h^; conversely, given
hb, one obtains a cone by defining h c =
0
{h a hb, h c })
by giving
that f 0
is
f 0
ha = g
usual,
two
h^
equivalently expressed by giving only the outer
{h a hb}). In conclusion, a universal cone for a diagram ,
of this type turns out to be just a pullback.
As
0
by taking the colimit of the same diagram we obtain
the dual notion of pushout.
.
Cones and Limits
130
Existence of Limits
6.3
we
In this section,
study the important question about the existence of limits in a given category.
Starting with the familiar category of sets,
we
common
generalize a
construction that allows the
existence of complex limits to be states, provided that simpler ones exist.
D
every diagram
Note
first that
Let
{Dj}i 0 i be a family of objects in
indexed by
I.
n^Di
The elements of
equivalently functions f
:
I
has limit in Set.
:
pj
* fe°Pi
condition xj
pj
•
The
idea
= fe °Pi- That
n^iDi-^Di
for
= fe (xj). Let then
the limit (prove
it
to take the subset
is
be the projection
Yi
n(Dj
projections
/
jij:
X2,
i.e.,
the product
such that xfEDi, for
...}
all
iEI, or
L if
defined by Pi({xQ,xi,X 2
is, if
fe
:
Di~»Dj
fl^Di
of
and only
if,
of
...})
,
=
X[.
an edge of D, one
In
may
the tuples that satisfy the
for all edges fe
Then
pi restricted to L.
all
is
(L,{ Yi
:
D^Dj,
E C[L,Df]
|
one has
iEI})
is
as an exercise).
This set-theoretic construction Let
xj_,
iEI,
all
{xq, x\, X2, ...}EL
is,
n^Di,
that f(i)EDi
general these projections do not form a cone on D, that
have
obtained as follows.
It is
and consider the object
are tuples {xq,
-*Ui£iDi, such
riieiDi has projections pi
D
3iEI
3eEE
n(Dj
3iEI
/
fe
better formalized in
is
)
:
3eEE
fe
Df-*Dj
:
Category Theory in the following way.
be the product of -*• )
Dj.
By
codomains of edges
all
definition of product, there
in
D, with
is
a unique
function \pl
such that
pj
=
Jtjoapi
for
This
is
fe °pi
=
Jtj °\p
2
ni eI Di— n(Dj
any edge \\>
such that
:
2
:
fe
:
/
3iEI
3eEE fe
)
:
Dj-»Dj of D. Analogously there
HEIDI- n(Dj / 3iEI 3eEE fe
f° r an Y edge ^e
:
is
a unique function
)
:
D.
Di-*Dj
visualized in the following diagram:
Note now
that, in set-theoretic terms, for all the tuples
{xq,
xj_,
X2,
...}
in
properties are equivalent: 1.
for all edges fe Dj-*Dj,
2- i(>l({xo.
:
*1. x 2>
•••})
xj
=
fe (xj)
= ^2({ x 0- x l> x 2>
•••})•
the following
131
Cones and Limits
Then, what
we
aleady
we
are looking for
know
that this is
maximal subset L of nj^jDj whose elements
the
is
none other than the equalizer of
and
\p2*
By
satisfy (2), but
a diagram,
We are now ready to generalize to every category C the previous construction of limits in Set. 6.3.1
Theorem Let
D
be a diagram
in
C
with sets I of vertices
and
E
of edges. If every
/-
indexed family and every E-indexed family of objects has a product and every pair of morphisms ,
has an equalizer, then
D
has a
limit.
Proof Exercise (use the previous diagrams).
6.3.2 Corollary
If a category
C
has arbitrary products, and equalizers for every pair of
morphisms, then every diagram has a
6.3.3 Corollary
If a category
C
limit.
has
all finite products,
morphisms, then every finite diagram has a
The relevance of theorem
and coequalizers for every pair of
limit.
6.3.1 is that, in general,
it
is
simpler to check the existence of products and
equalizers than to prove directly the existence of limits.
Example
a family of c.p.o.’s, let
is
structure Pi
Corollary 6.3.2
:
may be used
n^jCj
by the componentwise
prove that every diagram has a limit in
be the product indexed by
order, that
HiEi(Ci)-*Ci are defined by
c.p.o., that the projections are
to
pj(
(q)j£i s (dj)iei
is,
(q)jei
)
=
q
.
It is
I
.
iff
may be
ITj^jCj
V
iEI
CPO.
q
s;
If
{Cj}jei
given a c.p.o.
dp The projections
easy to prove that rij(=i(Cj)
is
indeed a
continuous, and that rij(=i(Ci) satisfies the universal property of the
product.
Given
f,g
:
A-*B
,
their equalizer is
ordering inherited by A, and h
is
h:
A'-* A, where A' =
the injection. A'
is
{aEA
a c.p.o. Indeed, let
/
f(a)
D
= g(a)} with the
be a direct subset of
.
Cones and Limits
132
then
A';
D
is
UDEA'. The
this,
and thus f(UD)=
also a direct subset of A,
U a ei)f(a)
=
u aEDg( a)
= g(UD). By
continuity of h and the universal property for equalizers are easy to prove.
and 2.5.6
In propositions 2.5.5
we showed how
products and equalizers from terminal
to define
objects and pullbacks. This suggests an even simpler sufficient (and necessary) condition for the existence of
all finite limits.
6.3.4 Corollary If
C has
a terminal objects and pullbacks for every pair of morphisms, then
it
has
all finite limits.
Exercise State the dual versions of theorem 6.3.1 and corollaries 6.3.2 to 6.3.4.
and Creation of Limits
6.4 Preservation In this section
we
some cases of functors which “preserve”
study
the property of objects to be limits
of a diagram.
6.4.1 Definition Let
G:
A-*X be
from a on the diagram
D
iEI}) if and only if (Ga,{G%[
G(D)
in
WiEI
>
a functor, and
We
A.
EX[Ga,Gdj]
A
in
has
X, and the limit
iEI})
G:
limit
is
A -*X
has a
in
Proof By
the properties of functors, ({Gdi}j£i,
it
is
universal.
left
{TiEA[a,dJ
(a>
adjoint F:
(a,{x[
E A[a,d\]
\
and
the
diagram
D
=
G(D) = ({Gdj} iEj, {Gfe} e eE)
then
iEI}), iEI}). \
{Gfe } e £E
is
)
a cone;
iEI}) be another cone, and
let
|
the
be an universal cone
iEl}) |
X -*A,
\
(Ga,{GxiEX[Ga,Gdj]
Let (x,{ajEX[x,Gdj]
EA[a,di]
preserves the limit
defined dually.
has a limit
is
G
an universal cone from Ga on the diagram
is
\
If the functor
{fe}eEE)
(a,{Tj
let
then say that
Preservation of colimits
.
Theorem
6.4.2 (
X
in
isomorphism of the adjunction. Then (Fx, {cp~l(oi)EA[Fx,dj]
we qp:
iEI})
only need to prove that
A[Fx,dj] * X[x,Gdf] be is
a cone. Indeed, for
all
|
fe dj :
—dj
one has fe»(p-l(oj)
=qr l(G(fe)°Oi)
by
= (p“l(oj)
By
the universality of
(a,
because (a[)
{xjEA[a,dj]
iEI} |
ViEI Ti°h =
qp“l(oi).
a mediating
morphism between
Take then
qp(h):
naturality
)
=
x-*>Ga. Since Grj°cp(h)
the cones
(x,
is
a cone
on G(D)
there exists a unique arrow h: cp(xi°h)
=
)
at first sight.
.
Note
A(f): A(s')-»A(s)
o x(s')
and B(f) o
H(s)
:
:
B(f)
A(f) o
0 x(s')
that
x(s):
H(s)-*K(s),
and B(f): B(s')-»B(s)
— K(s)
o
H(s') -> B(f)
are natural transformations of the following type:
A(f) o K(s').
But, according to the definition of S-indexed functors, for any
and K(s)
0
A(f) = B(f)
0
K(s'), thus equation (t) is
f:
s-*s',
one has H(s)
S and any object
a in A(s'),
T ( s )A(f)(a) =
where the previous equation holds
The previous
situation can
B(f)(x(s') a )
in the category B(s).
be summarized
0
A(f) = B(f)
0
well typed.
Spelling out the composition of natural transformations and functors in (t), s-*s' in
°
We are thus composing natural transformations and functors in the way described at the
end of section
H(s')
o
f: s->s' in S,
x(s) °A(f) = B(f) ox(s')
H(s')-»K(s')
are functors.
H->K consists
for any
(f)
t(s'):
f*
Let H: A-*B, K: A->B, be two S-indexed functors.
7.1.4 Definition
transformation
the identity natural transformation
=
composition
component-wise
is
a
collection of functors H(s): A(s)-*B(s), for s object of
(being the composition of natural transformations),
identity id a:
is
B: S°P-*CAT.
to
A(f) = B(f)
A-*B
Given two indexed functors H:
An S-indexed functor H: A-*B
in the following
diagram:
we have
for
any
f:
139
Indexed and Internal Categories
componentwise,
(Vertical) composition of S-indexed natural transformations is defined
H, K,
good
L
:
A-»B,x:
H-*K
(P
0
rj:
idj^-^K°H,
e:
K-*L, p
p: f:
s-*s' in
x )(s )A(f)(a)
7.1.5 Definition Let A,
and
and
definition since, for any
B
° x:
H-*L
given by (p
is
S and any object a °
=
(P(s)
=
P(s)A(f)(a)
0
x)(s)
=
p(s)
given
This
is
a
x (s))A(f)(a) °
T (s)A(f)(a)
=
B(f)(p(s') a ) o B(f)(T(s')a)
=
B(£)(p(s') a ° T(s’) a )
=
B(£)((p ° T)(s')a).
be S-indexed categories
if and only
is,
in A(s'),
,
H: A-*B, K: B-+A be S-indexed functors,
H°K—*idft be S-indexed natural transformations.
:
A—>B
is
an
if
K
(Ke) o(rjK) = id
(eH) o(Hr]) = id
H
The notion of indexed adjunction particular
it
is
is
.
the obvious generalization of the usual notion of adjunction. In
easy to check that for any object
s
of S,
:
A(s)-*B(s)
is
an
adjunction in the usual sense.
The main problem with
the definition of adjunction as a quadruple
generalization of the case with parameters
adjunction of this kind).
As
(remember
:
A-*B
is
in its
exponents requires an
a triple, an indexed adjunction can be defined in the following,
somewhat
informal, way:
7.1.6 Definition functors. i.