\chapter{Limits in categories (TO DO)}
\label{ch:category_limits}
We saw near the start of our category theory chapter
the nice construction of products by drawing
a bunch of arrows.
It turns out that this concept can be generalized immensely,
and I want to give you a taste of that here.

To run this chapter, we follow the approach of \cite{ref:msci}.
\todo{write introduction}

\section{Equalizers}
\prototype{The equalizer of $f,g \colon X \to Y$ is the set of points with $f(x) = g(x)$.}
Given two sets $X$ and $Y$, and maps $X \taking{f,g} Y$, we define their \vocab{equalizer} to be
\[ \left\{ x \in X \mid f(x) = g(x) \right\}. \]
We would like a categorical way of defining this, too.

Consider two objects $X$ and $Y$ with two maps $f$ and $g$ between them:
\begin{center}
\begin{tikzcd}
	X \ar[r, "f", shift left] \ar[r, "g"', shift right] & Y
\end{tikzcd}
\end{center}
A cone over this diagram is an object $A$ and arrows over $X$ and $Y$
which make the diagram commute, like so.
\begin{center}
\begin{tikzcd}
	A \ar[d, "q"'] \ar[rd, "f \circ q = g \circ q"] & \\
	X \ar[r, "f", shift left, near start] \ar[r, "g"', shift right, near start] & Y
\end{tikzcd}
\end{center}
As per \cite{ref:msci}, we call this cone a \vocab{fork}.
The name coming from the shape obtained if one writes $A \to X \rightrightarrows Y$
all in the same line; but to emphasize the cone-ness, we have bent the fork in our pictures.

Effectively, the arrow over $Y$ is just forcing $f \circ q = g \circ q$.
In any case, the \vocab{equalizer} of $f$ and $g$ is a ``universal fork'':
it is an object $E$ and a map $E \taking{e} X$ such that
for each $A \taking q X$ the diagram
\begin{center}
\begin{tikzcd}
	& A \ar[dd, "\exists! h"] \ar[lddd, "q"'] \ar[rddd, dashed, bend left] \\
	\\
	& E \ar[ld, "e"', near start] \ar[rd, dashed] & \\
	X \ar[rr, "f", shift left] \ar[rr, "g"', shift right] && Y
\end{tikzcd}
\end{center}
commutes for a unique $A \taking h E$.
In other words, any map $A \taking{q} X$ as above
must factor uniquely through $E$.

Again, the dotted arrows can be omitted, and as before equalizers may not exist.
But when they do exist:
\begin{exercise}
	If $E \taking{e} X$ and $E' \taking{e'} X$ are equalizers,
	show that $E \cong E'$.
\end{exercise}

\begin{example}
	[Examples of equalizers]
	\listhack
	\begin{enumerate}[(a)]
		\ii In $\catname{Set}$, given $X \taking{f,g} Y$
		the equalizer $E$ can be realized as $E = \{x \mid f(x) = g(x)\}$,
		with the inclusion $e \colon E \injto X$ as the morphism.
		As usual, by abuse we'll often just refer to $E$ as the equalizer.

		\ii Ditto in $\catname{Top}$, $\catname{Grp}$.
		One has to check that the appropriate structures are preserved
		(e.g.\ one should check that $\{\phi(g) = \psi(g) \mid g \in G\}$ is a group).

		\ii In particular, given a homomorphism $\phi \colon G \to H$, the inclusion
		$ \ker\phi \injto G $
		is an equalizer for $\phi \colon G \to H$ and the trivial homomorphism $G \to H$.
	\end{enumerate}
\end{example}

According to (c) equalizers let us get at the concept of a kernel
if there is a distinguished
``trivial map'', like the trivial homomorphism in $\catname{Grp}$.
We'll flesh this idea out in the chapter on abelian categories.

\section{Pullback squares (TO DO)}
\todo{write me}
Great example: differentiable functions on $(-3,1)$ and $(-1,3)$

\begin{example}
	\label{ex:diff_pullback}
\end{example}

\section{Limits}
We've defined cones over discrete sets of $X_i$ (to get products)
and over pairs of arrows (to get forks).
It turns out you can also define a cone over any general \vocab{diagram} of objects and arrows;
we specify a projection from $A$ to each object and
require that the projections from $A$ commute with the arrows in the diagram.

If you then demand the cone be universal,
you have the extremely general definition of a \vocab{limit}.
As always, these are unique up to unique isomorphism.
We can also define the dual notion of a \vocab{colimit} in the same way.

\section{\problemhead}
\begin{sproblem}[Equalizers are monic]
	Show that the equalizer of any diagram $X \rightrightarrows Y$ is monic.
	\label{prob:equalizer_monic}
\end{sproblem}

pushout square gives tenor product

p-adic

relative Chinese remainder theorem!!
