Professional Documents
Culture Documents
August 2008
Categories
A category C consists of
1
objects c, d, . . .
morphisms f , g , . . ..
Each morphism has a domain and codomain.
f : c d means that c is the domain of f ,
and d is the codomain.
a composition operation:
if f : a b and g : b c, then g f : a c.
Examples of Categories
Functors
Let d be an object of D.
We get F : C D, the constant functor d by:
Fc = d,
Ff = id d .
ha, fxi.
/ FX
id
Fe
/ FN
X
e
/ PX
id
Pe
/ PV
Signature Functors
{hf , x1 , . . . , xn i : arity (f ) = n; x X }
hf , g (x1 ), . . . , g (xn )i
Signature Functors
{hf , x1 , . . . , xn i : arity (f ) = n; x X }
hf , g (x1 ), . . . , g (xn )i
Signature Functors
A signature is set of function symbols with arities.
Each gives us H : Set Set by
H (X )
for g : X Y
H g (hf , x1 , . . . , xn i)
{hf , x1 , . . . , xn i : arity (f ) = n; x X }
hf , g (x1 ), . . . , g (xn )i
The point is that now tree systems and solutions are represented:
X
e
Tr
/ H X
id
H e
/ H (Tr )
Coproducts
Let C be a category.
A coproduct of objects x and y , is an object x + y
with morphisms inl : x x + y and inr : y x + y meeting the
following condition:
if f : x z and g : y z, then there is a unique
[f , g ] : x + y z such that [f , g ] inl = f and [f , g ] inr = g .
x
inl
[f ,g ]
$
x +O y _ _ _ _ _ _ _ _ _ _ _:/ z
inr
Coproducts
Let C be a category.
A coproduct of objects x and y , is an object x + y
with morphisms inl : x x + y and inr : y x + y meeting the
following condition:
if f : x z and g : y z, then there is a unique
[f , g ] : x + y z such that [f , g ] inl = f and [f , g ] inr = g .
Technically, the coproduct of x and y is the triple (x + y , inl, inr).
Usually theres no need to add the names of the objects to the
coproduct maps inl and inr.
But if we would need to, we could write
inla,a+b : a a + b,
and similarly for inrb,a+b .
Using coproducts
If f : a b and g : c d, then we have
f +g :a+c b+d
given by
f + g = [inl f , inr g ].
In pictures,
a
a+b
/c N
NNN
NNinl
NNN
NNN
'
[inlf ,inrg ]
/c +d
8
ppp
p
p
ppp
ppp inr
p
/d
(x {0}) (y {1}),
Coproducts of functors
Ff + Gf
c is terminal, or final
if for every object a, there is a unique ! : a c.
In Set, the final objects are exactly the singletons.
Let F : C C be a functor.
An algebra for F is a pair (A, a), where a : FA A in C .
The leading example is when F is a signature functor, say F .
Then an F -algebra is a set A together with interpretations of the
symbols in .
x
y
x
x
y
y
x
x
a(h, y , xi) = y
a(h, y , y i) = x
Category Theory Background
Let F : C C be a functor.
An algebra for F is a pair (A, a), where a : FA A in C .
The leading example is when F is a signature functor, say F .
A morphism from (A, a) to (B, b) is h : A B such that
FA
Fh
/A
FB
/B
commutes.
This gives a category of F -algebras.
Initial algebras
Lets return to with and e, and its associated H : Set Set.
Let T0 be the set of finite trees (=terms) on the signature.
So T0 contains e, (e, e), ((e, e), e), etc.
We have
i
H(T0 )
c
T0
Pfin A
/A
??
Pfin A
/A
a(Pfin h(x))
a({h(y ) : y x}).
Let F : C C be a functor.
A coalgebra for F is a pair (A, a), where a : A FA in C .
Well shortly see many examples.
A morphism from (A, a) to (B, b) is h : A B such that
A
h
/ FA
Fh
/ FB
commutes.
a,c
9y
xM m
b
b,c
ze
=
=
=
9y
xM m
b,c
ze a
Let A be the set of finite words on A, including the empty word .
We define : X A X by recursion:
a,c
(s, )
(s, wi)
=
=
s
fst(e((s, w )))(i)
=
=
then
l(L)
Let l : L F L be given by
l(L)
Let l : L F L be given by
l(L)
=
=
=
=
/ FS
F acc
/ FL
S
acc
/ FS
F acc
/ FL
acc(L,l) ((s))
(s).
algebra
initial algebra
least fixed point
congruence relation
Foundation Axiom
iterative conception
equational logic
recursion: map out of
an initial algebra
useful in syntax
construct
bottom-up
coalgebra
final coalgebra
greatest fixed point
bisimulation equivalence relation
Anti-Foundation Axiom
coiterative conception
modal logic
corecursion: map into
a final coalgebra
useful in semantics
observe
top-down
Lambeks Lemma
Fa
/a
FFa
Ff
Ff
Fa
/a
g
/ Fa
/a
FFa
Ff
/a
Ff
/ Fa
f g
Fa
/a}
Natural transformations
Let F : C D be a functor between two categories,
and let G : C D also be a functor between the same two.
Then a natural transformation from F to G is a family
of morphisms of D indexed by objects of C , in particular each x
is a morphism in D from Fx to Gx.
The requirement on is that for each morphism in C of the form
f : x y , the square below commutes:
x
Fx
f
Ff
Fy
/ Gx
Gf
/ Gy
In symbols, Gf x = y Ff .
One writes : F G .
For each object x of C , x is called the component of at x.
MATHLOGAPS 2008: Coalgebra and Circularity
Hb .
Hb .
(H)x
(F H)y
/ (G H)x
(H)y
(G H)f
/ (G H)y
Hx
/ G (Hx)
Category Theory Background
F HII
II
G H
/F K
II
G
II$
/G K
That is, we claim that the outside of the figure commutes, and
then we define to be the composite in either direction; this
will be a natural transformation by the three constructions which
we have already seen. But for each object x of C the square above
is a naturality square for , applied to the morphsim
x : Hx Kx.
MATHLOGAPS 2008: Coalgebra and Circularity
Category Theory Background
Definition
A functor F : C D preserves pullbacks if the image of every
pullback square is a pullback square.
Lemma
Concerning preservation of pullbacks:
1