While reading Bartosz' excellent Category theory for Programmers, I got stuck in the second exercise, which deals with products in posets. Given a poset,
b e
↗ ⤭ ↘
a → c f → h
↘ ⤭ ↗
d g
how can I define a product in the categorical sense? What is categorized by the product of two objects? And what about the coproduct?
Let's have a look at the definition of a product first:
A product of objects
a
andb
is the objectc
equipped with morphismsp :: c -> a
andq :: c -> b
exist, such that for any other objectc'
(with morphismsp' :: c' -> a
andq' :: c' -> b
), there exists a morphismm :: c' -> c
such thatp' = p . m
andq' = q . m
.
Remember that a morphism in a poset basically describes the relationship "less than or equal to".
Now the product c
between two objects a
and b
must be an object less than or equal to both a
and b
. As an example, lets choose a
as e
and b
as g
from your graph:
b e -- this one is a
↗ ⤭ ↘
a → c f → h
↘ ⤭ ↗
d g -- this one is b
Trivially, the first object that comes to mind which is always less than or equal to any other object is the smallest object, in this case a
.
Now is a
a valid candidate for the product of e
and g
? Let's check the definition of product:
Is there a morphism from a
to e
? Yes, this exists and can be written as pₐ = ce . ac
(read as: "first the arrow from a to c, then the arrow from c to e").
Is there a morphism from a
to g
? Yes, this exists too and can be written as qₐ = cg . ac
.
So far so good, the only question left is whether this is the 'best' candidate in the sense that no other object exists such that we can construct a unique isomorphism between a
and the other candidate?
Looking at the graph, we can see that the object c
also fulfills the required criteria, with p = ce
and q = cg
.
All that is left to do is rank these two objects according to the above definition. We see that there exists a morphism from a
to c
. This means c
has to be the best candidate since we can now define the morphism m = ac
such that pₐ = p . m = ce . ac
and qₐ = q . m = cg . ac
.
So, a product of two objects in a poset is actually the greatest object which is smaller than both (also called the greatest lower bound). It is worth noting that in a total ordering, this corresponds to the function min(a, b)
, since every object must be relateable to any other object (Wolfram call this trichotomy law).
In analogy to the product definition, the coproduct corresponds to the smallest object greater than or equal to both a
and b
. In a total ordering, this corresponds to the maximum of both objects. You can work this one out for yourself.