There is a basic construction in category theory which I've only just recently become acquainted with, that is the comma category.

It seems to be a quite basic construction for which, however, I've seen really few "real life" examples.

I know the slice, coslice and arrow categories are particular cases of a comma category. This is in MacLane, or in the wikipedia article. In that article there are also the examples of pointed sets or graphs, which are of a more concrete nature.

I'm asking, then, for more examples of this construction in mathematics. Examples of (co)slice categories are also welcome.

Here's one example I've come up with. The completion of a metric space $M$ consists of a pair $(\overline{M},i)$ where $\overline{M}$ is a complete metric space and $i:M\to \overline{M}$ is a uniformly continuous function which satisfies the following universal property: if $N$ is another complete metric space and $g:M\to N$ is a uniformly continuous function, then there exists a unique uniformly continuous function $h:\overline{M}\to N$ such that the following diagram commutes:

Completion

I claim this completion is an initial object in a suitable comma category. Consider the functors enter image description here where $\mathbf{Met_u}$ is the category of metric spaces with uniformly continuous functions and $\mathbf{CompMet_u}$ is the category of complete metric spaces with uniformly continuous functions. The functor $F$ is such that $F(\star)=M$ where $\star$ is the sole object of $\mathbf{1}$, and $U$ is the inclusion functor.

Then an initial object of $(F\downarrow U)$ is exactly a completion of $M$.

Bonus question: is this approach to the completion not interesting/not useful? I ask this because it seems the categorial approach to completions has nothing to do with comma categories. (I can see, though, that the universal property of this completion can also be seen as an adjunction).


Ok, if you are interested in slice/coslice categories then there are two obviously interesting ones:

It's pretty trivial that the category $\mathbf{Top}_\ast$ of pointed topological spaces is just $(\bullet\downarrow\mathbf{Top})$.

As another example let's find out what $(R\downarrow\mathbf{CRing})$ looks like, when $R$ is come commutative unital ring. We see that, almost by definition, we can think of the objects of $(R\downarrow\mathbf{CRing})$ as being commutative unital rings $A$ with a distinguished ring homomorphism $f:R\to A$. Ok, there's no more "simplification" that can be done there. So, what do the arrows in this comma category look like? Well, if we have two objects $f:R\to A$ and $g:R\to B$, we see that an arrow between them is an arrow $h:A\to B$ (of course, technically it's a pair of arrows, but when the left element of $(-\downarrow-)$ is discrete this is always the identity arrow, and so unimportant) such that $g=h\circ f$. But, this precisely the formulation for commutative algebras over $R$. In other words, we have commutative unital rings $A$ with specified $\mathbf{CRing}$-arrows $R\to A$ and the morphisms between two such objects $(R,A,f)$ and $(R,B,g)$ is just a $\mathbf{CRing}$-arrow $A\to B$ which respects $f$ and $g$. Thus, we see that $\left(R\downarrow\mathbf{CRing}\right)\cong R\text{-}\mathbf{CAlg}$.


One example of a comma category $(F \downarrow G)$, I think of it as "simplified" comma category but I don't think that's a commonly used term, is what you get when you take $F: A \to C$ to be the selection functor (i.e. $A = \textbf{1}$).

More concretely, if $G:\textbf{Group} \to \textbf{Set}$ is the forgetful functor mapping a group to its underlying set and $F: \textbf{1} \to \textbf{Set}$ is the selection functor selecting a set $S$ then you get the category $(S \downarrow G)$ where the objects are pairs $(f,Y)$ where $f:S \to Y$ is a morphism in $\textbf{Set}$ and $Y = G(X)$ is the underlying set of some group $X$. The morphisms $(f,Y) \to (f^\prime, Y^\prime)$ are induced by group homomorphisms $\varphi : X \to X^\prime$ such that $G(\varphi) \circ f = f^\prime$.

You can use this category to define the free group over a set $S$, namely, it is a group $F$ such that $(f,G(F))$ is an initial object in $(S \downarrow G)$.

Hope this serves as an example. As for the bonus question: I'll have to pass on that.