The good thing about category theory is that it abstracts everything down to a couple of very simple, bare-bones concepts, and lets us play with those concepts in really fascinating ways. But the bad thing about category theory is that it abstracts everything down so much that it can be difficult to have any intuitive sense about what things actually mean.

We said that a category is, basically, a collection of objects connected by arrows, and a composition operation over the arrows. But what the heck is an object, and what is an arrow?

In some sense, the point of category theory is that *it doesn't matter*. There's a set of fundamental concepts that underly all composable mapping-like things, and category theory focuses in on those fundamental concepts, and what they mean.

But still, to understand category theory, you need to be able to get some kind of intuitive handle on what's going on. And so, we'll take a look at a few examples.

## The Category **Set**

One of the easiest examples is the category **Set**. The objects of the category are, obviously, sets; the morphisms are functions between sets; and composition is (obviously) function composition.

That much is easy. Now, what about the special arrows? What do all of the epi, iso, endo, and auto arrows in the category of sets?

An monomorphism over the category of sets is an injective function - that is, a function which maps each value in the domain to a distinct value in the range. So you can always reverse the function: given a value in the range of the function, you can always say, specifically, exactly what value in the domain maps to it. In a monomorphism in the category set, there may be values in the target of the morphism that aren't mapped to by any element of the range; but *if* a value of the range is mapped to, you know which value in the domain mapped to it.

The key property of the monomorphism is that it's *left-cancellative* - that is, if \(f\) is a monomorphism, then we know that \(f circ g == f circ h\) is only true if \(g = h\). We can *cancel* the left side of the composion. Why? Because we know that \(f\) maps each value in its domain to a *unique* value in its range. So \(f circ g\) and \(f circ h\) can only be the same if they map all of the same values in their domain to the same values in their range - that is, if they're the same function.

An epimorphism is an onto function - that is, a mapping \(f\) from a set \(X\) to a set \(Y\) in which for every value \(y in Y\), there's some value in \(x in X\) such that \(f(x)=y\). It's a dual of the notion of a monomorphism; for each value in the range, there is at least one value in the domain that maps to it. But it's not necessary that the domain values be unique - there can be multiple values in the domain that map onto a particular value in the range, but for every element of the domain, there's always *at least* one value that maps to it. It's *right-cancellative* in the same way that the monomorphism is left-cancellative.

What about iso-morphism? If you combine the ideas of mono-morphism and epi-morphism, what you end up with is a function where every member of the domain is mapped onto a unique value in the range, and every value in the range is mapped onto by at least one value: it's a one-to-one function.

## The Category **Poset**

**Poset** is the category of *partially ordered sets*. A partially ordered set is a set with a binary relation, \(le\), which satisfies the following properties:

- Reflexivity: \(forall a: a le a\)
- Antisymmetry: if \(a le b land b le a\) then \(a = b\).
- Transitivity: if \(a le b land b le c\) then \(a le c\)

In the category of partially ordered sets, the arrows are *monotonic* functions - that is, functions that preserve the partial ordering. So if \(x le y\), then if \(f\) is monotonic, \(f(x) le f(y)\).

The arrow composition operation, \(circ\), is still just function composition. In terms of meaning, it's pretty much the same as it was for simple sets: a monomorphism is still a surjective function; etc. But in **Poset** it needs to be a surjective function that preserves the ordering relation.

We know that monotonic functions fit the associative and identity properties of category arrows - they're still just functions, and monotonicity has no effect on those. But for posets, the composition is a bit tricky - we need to ensure that composition maintains the partial order. Fortunately, that's easy.

- Suppose we have arrows \(f : A rightarrow B\), \(g : B rightarrow C\). We know that \(f\) and \(g\) are monotonic functions.
- So for any pair of \(x\) and \(y\) in the domain of \(f\), we know that if \(x le y\), then \(f(x) le f(y)\).
- Likewise, for any pair \(s,t\) in the domain of \(g\), we know that if \(s le t\), then \(g(s) le g(t)\).
- So we just put those together: if \(x le y\), then \(f(x) le f(y)\). \(f(x)\) and \(f(y)\) are in the domain of \(g\), so if \(f(x) le f(y)\) then we know \(g(f(x)) le g(f(y))\)

## The category **Grp**

Our last example is the category of *groups*, which is called **Grp**. In this category, the objects are (obviously) groups. What are arrows? Group homomorphisms - that is, essentially, functions between sets that preserve the group structure.

What's a homomorphism in this category? That's a bit confusing, because we get stuck with some overloaded terminology. But it's basically just a symmetry-preserving surjection - that is, it's a reversable mapping from a group into a second group, where the group symmetry of the first group is mapped onto the group symmetry of the second by the arrow. You should be able to follow the meanings of the other kinds of morphisms by using similar reasoning.

These are all, of course, very simple examples. They're all *concrete* categories, where the objects are (speaking very loosely) sets. There are categories - many very interesting ones - where the objects aren't sets or even particularly set-like - but we'll get to those later. For now, the ideas of objects as sets gives you an intuitive handle to grab onto.