\input{preamble} % OK, start here. % \begin{document} \title{Categories} \maketitle \phantomsection \label{section-phantom} \tableofcontents \section{Introduction} \label{section-introduction} \noindent Categories were first introduced in \cite{GenEqui}. The category of categories (which is a proper class) is a $2$-category. Similarly, the category of stacks forms a $2$-category. If you already know about categories, but not about $2$-categories you should read Section \ref{section-formal-cat-cat} as an introduction to the formal definitions later on. \section{Definitions} \label{section-definition-categories} \noindent We recall the definitions, partly to fix notation. \begin{definition} \label{definition-category} A {\it category} $\mathcal{C}$ consists of the following data: \begin{enumerate} \item A set of objects $\Ob(\mathcal{C})$. \item For each pair $x, y \in \Ob(\mathcal{C})$ a set of morphisms $\Mor_\mathcal{C}(x, y)$. \item For each triple $x, y, z\in \Ob(\mathcal{C})$ a composition map $ \Mor_\mathcal{C}(y, z) \times \Mor_\mathcal{C}(x, y) \to \Mor_\mathcal{C}(x, z) $, denoted $(\phi, \psi) \mapsto \phi \circ \psi$. \end{enumerate} These data are to satisfy the following rules: \begin{enumerate} \item For every element $x\in \Ob(\mathcal{C})$ there exists a morphism $\text{id}_x\in \Mor_\mathcal{C}(x, x)$ such that $\text{id}_x \circ \phi = \phi$ and $\psi \circ \text{id}_x = \psi $ whenever these compositions make sense. \item Composition is associative, i.e., $(\phi \circ \psi) \circ \chi = \phi \circ ( \psi \circ \chi)$ whenever these compositions make sense. \end{enumerate} \end{definition} \noindent It is customary to require all the morphism sets $\Mor_\mathcal{C}(x, y)$ to be disjoint. In this way a morphism $\phi : x \to y$ has a unique {\it source} $x$ and a unique {\it target} $y$. This is not strictly necessary, although care has to be taken in formulating condition (2) above if it is not the case. It is convenient and we will often assume this is the case. In this case we say that $\phi$ and $\psi$ are {\it composable} if the source of $\phi$ is equal to the target of $\psi$, in which case $\phi \circ \psi$ is defined. An equivalent definition would be to define a category as a quintuple $(\text{Ob}, \text{Arrows}, s, t, \circ)$ consisting of a set of objects, a set of morphisms (arrows), source, target and composition subject to a long list of axioms. We will occasionally use this point of view. \begin{remark} \label{remark-big-categories} Big categories. In some texts a category is allowed to have a proper class of objects. We will allow this as well in these notes but only in the following list of cases (to be updated as we go along). In particular, when we say: ``Let $\mathcal{C}$ be a category'' then it is understood that $\Ob(\mathcal{C})$ is a set. \begin{enumerate} \item The category $\textit{Sets}$ of sets. \item The category $\textit{Ab}$ of abelian groups. \item The category $\textit{Groups}$ of groups. \item Given a group $G$ the category $G\textit{-Sets}$ of sets with a left $G$-action. \item Given a ring $R$ the category $\text{Mod}_R$ of $R$-modules. \item Given a field $k$ the category of vector spaces over $k$. \item The category of rings. \item The category of divided power rings, see Divided Power Algebra, Section \ref{dpa-section-divided-power-rings}. \item The category of schemes. \item The category $\textit{Top}$ of topological spaces. \item Given a topological space $X$ the category $\textit{PSh}(X)$ of presheaves of sets over $X$. \item Given a topological space $X$ the category $\Sh(X)$ of sheaves of sets over $X$. \item Given a topological space $X$ the category $\textit{PAb}(X)$ of presheaves of abelian groups over $X$. \item Given a topological space $X$ the category $\textit{Ab}(X)$ of sheaves of abelian groups over $X$. \item Given a small category $\mathcal{C}$ the category of functors from $\mathcal{C}$ to $\textit{Sets}$. \item Given a category $\mathcal{C}$ the category of presheaves of sets over $\mathcal{C}$. \item Given a site $\mathcal{C}$ the category of sheaves of sets over $\mathcal{C}$. \end{enumerate} One of the reason to enumerate these here is to try and avoid working with something like the ``collection'' of ``big'' categories which would be like working with the collection of all classes which I think definitively is a meta-mathematical object. \end{remark} \begin{remark} \label{remark-unique-identity} It follows directly from the definition that any two identity morphisms of an object $x$ of $\mathcal{A}$ are the same. Thus we may and will speak of {\it the} identity morphism $\text{id}_x$ of $x$. \end{remark} \begin{definition} \label{definition-isomorphism} A morphism $\phi : x \to y$ is an {\it isomorphism} of the category $\mathcal{C}$ if there exists a morphism $\psi : y \to x$ such that $\phi \circ \psi = \text{id}_y$ and $\psi \circ \phi = \text{id}_x$. \end{definition} \noindent An isomorphism $\phi$ is also sometimes called an {\it invertible} morphism, and the morphism $\psi$ of the definition is called the {\it inverse} and denoted $\phi^{-1}$. It is unique if it exists. Note that given an object $x$ of a category $\mathcal{A}$ the set of invertible elements $\text{Aut}_\mathcal{A}(x)$ of $\Mor_\mathcal{A}(x, x)$ forms a group under composition. This group is called the {\it automorphism} group of $x$ in $\mathcal{A}$. \begin{definition} \label{definition-groupoid} A {\it groupoid} is a category where every morphism is an isomorphism. \end{definition} \begin{example} \label{example-group-groupoid} A group $G$ gives rise to a groupoid with a single object $x$ and morphisms $\Mor(x, x) = G$, with the composition rule given by the group law in $G$. Every groupoid with a single object is of this form. \end{example} \begin{example} \label{example-set-groupoid} A set $C$ gives rise to a groupoid $\mathcal{C}$ defined as follows: As objects we take $\Ob(\mathcal{C}) := C$ and for morphisms we take $\Mor(x, y)$ empty if $x\neq y$ and equal to $\{\text{id}_x\}$ if $x = y$. \end{example} \begin{definition} \label{definition-functor} A {\it functor} $F : \mathcal{A} \to \mathcal{B}$ between two categories $\mathcal{A}, \mathcal{B}$ is given by the following data: \begin{enumerate} \item A map $F : \Ob(\mathcal{A}) \to \Ob(\mathcal{B})$. \item For every $x, y \in \Ob(\mathcal{A})$ a map $F : \Mor_\mathcal{A}(x, y) \to \Mor_\mathcal{B}(F(x), F(y))$, denoted $\phi \mapsto F(\phi)$. \end{enumerate} These data should be compatible with composition and identity morphisms in the following manner: $F(\phi \circ \psi) = F(\phi) \circ F(\psi)$ for a composable pair $(\phi, \psi)$ of morphisms of $\mathcal{A}$ and $F(\text{id}_x) = \text{id}_{F(x)}$. \end{definition} \noindent Note that every category $\mathcal{A}$ has an {\it identity} functor $\text{id}_\mathcal{A}$. In addition, given a functor $G : \mathcal{B} \to \mathcal{C}$ and a functor $F : \mathcal{A} \to \mathcal{B}$ there is a {\it composition} functor $G \circ F : \mathcal{A} \to \mathcal{C}$ defined in an obvious manner. \begin{definition} \label{definition-faithful} Let $F : \mathcal{A} \to \mathcal{B}$ be a functor. \begin{enumerate} \item We say $F$ is {\it faithful} if for any objects $x, y \in \Ob(\mathcal{A})$ the map $$ F : \Mor_\mathcal{A}(x, y) \to \Mor_\mathcal{B}(F(x), F(y)) $$ is injective. \item If these maps are all bijective then $F$ is called {\it fully faithful}. \item The functor $F$ is called {\it essentially surjective} if for any object $y \in \Ob(\mathcal{B})$ there exists an object $x \in \Ob(\mathcal{A})$ such that $F(x)$ is isomorphic to $y$ in $\mathcal{B}$. \end{enumerate} \end{definition} \begin{definition} \label{definition-subcategory} A {\it subcategory} of a category $\mathcal{B}$ is a category $\mathcal{A}$ whose objects and arrows form subsets of the objects and arrows of $\mathcal{B}$ and such that source, target and composition in $\mathcal{A}$ agree with those of $\mathcal{B}$. We say $\mathcal{A}$ is a {\it full subcategory} of $\mathcal{B}$ if $\Mor_\mathcal{A}(x, y) = \Mor_\mathcal{B}(x, y)$ for all $x, y \in \Ob(\mathcal{A})$. We say $\mathcal{A}$ is a {\it strictly full} subcategory of $\mathcal{B}$ if it is a full subcategory and given $x \in \Ob(\mathcal{A})$ any object of $\mathcal{B}$ which is isomorphic to $x$ is also in $\mathcal{A}$. \end{definition} \noindent If $\mathcal{A} \subset \mathcal{B}$ is a subcategory then the identity map is a functor from $\mathcal{A}$ to $\mathcal{B}$. Furthermore a subcategory $\mathcal{A} \subset \mathcal{B}$ is full if and only if the inclusion functor is fully faithful. Note that given a category $\mathcal{B}$ the set of full subcategories of $\mathcal{B}$ is the same as the set of subsets of $\Ob(\mathcal{B})$. \begin{remark} \label{remark-functor-into-sets} Suppose that $\mathcal{A}$ is a category. A functor $F$ from $\mathcal{A}$ to $\textit{Sets}$ is a mathematical object (i.e., it is a set not a class or a formula of set theory, see Sets, Section \ref{sets-section-sets-everything}) even though the category of sets is ``big''. Namely, the range of $F$ on objects will be a set $F(\Ob(\mathcal{A}))$ and then we may think of $F$ as a functor between $\mathcal{A}$ and the full subcategory of the category of sets whose objects are elements of $F(\Ob(\mathcal{A}))$. \end{remark} \begin{example} \label{example-group-homomorphism-functor} A homomorphism $p : G\to H$ of groups gives rise to a functor between the associated groupoids in Example \ref{example-group-groupoid}. It is faithful (resp.\ fully faithful) if and only if $p$ is injective (resp.\ an isomorphism). \end{example} \begin{example} \label{example-category-over-X} Given a category $\mathcal{C}$ and an object $X\in \Ob(\mathcal{C})$ we define the {\it category of objects over $X$}, denoted $\mathcal{C}/X$ as follows. The objects of $\mathcal{C}/X$ are morphisms $Y\to X$ for some $Y\in \Ob(\mathcal{C})$. Morphisms between objects $Y\to X$ and $Y'\to X$ are morphisms $Y\to Y'$ in $\mathcal{C}$ that make the obvious diagram commute. Note that there is a functor $p_X : \mathcal{C}/X\to \mathcal{C}$ which simply forgets the morphism. Moreover given a morphism $f : X'\to X$ in $\mathcal{C}$ there is an induced functor $F : \mathcal{C}/X' \to \mathcal{C}/X$ obtained by composition with $f$, and $p_X\circ F = p_{X'}$. \end{example} \begin{example} \label{example-category-under-X} Given a category $\mathcal{C}$ and an object $X\in \Ob(\mathcal{C})$ we define the {\it category of objects under $X$}, denoted $X/\mathcal{C}$ as follows. The objects of $X/\mathcal{C}$ are morphisms $X\to Y$ for some $Y\in \Ob(\mathcal{C})$. Morphisms between objects $X\to Y$ and $X\to Y'$ are morphisms $Y\to Y'$ in $\mathcal{C}$ that make the obvious diagram commute. Note that there is a functor $p_X : X/\mathcal{C}\to \mathcal{C}$ which simply forgets the morphism. Moreover given a morphism $f : X'\to X$ in $\mathcal{C}$ there is an induced functor $F : X/\mathcal{C} \to X'/\mathcal{C}$ obtained by composition with $f$, and $p_{X'}\circ F = p_X$. \end{example} \begin{definition} \label{definition-transformation-functors} Let $F, G : \mathcal{A} \to \mathcal{B}$ be functors. A {\it natural transformation}, or a {\it morphism of functors} $t : F \to G$, is a collection $\{t_x\}_{x\in \Ob(\mathcal{A})}$ such that \begin{enumerate} \item $t_x : F(x) \to G(x)$ is a morphism in the category $\mathcal{B}$, and \item for every morphism $\phi : x \to y$ of $\mathcal{A}$ the following diagram is commutative $$ \xymatrix{ F(x) \ar[r]^{t_x} \ar[d]_{F(\phi)} & G(x) \ar[d]^{G(\phi)} \\ F(y) \ar[r]^{t_y} & G(y) } $$ \end{enumerate} \end{definition} \noindent Sometimes we use the diagram $$ \xymatrix{ \mathcal{A} \rtwocell^F_G{t} & \mathcal{B} } $$ to indicate that $t$ is a morphism from $F$ to $G$. \medskip\noindent Note that every functor $F$ comes with the {\it identity} transformation $\text{id}_F : F \to F$. In addition, given a morphism of functors $t : F \to G$ and a morphism of functors $s : E \to F$ then the {\it composition} $t \circ s$ is defined by the rule $$ (t \circ s)_x = t_x \circ s_x : E(x) \to G(x) $$ for $x \in \Ob(\mathcal{A})$. It is easy to verify that this is indeed a morphism of functors from $E$ to $G$. In this way, given categories $\mathcal{A}$ and $\mathcal{B}$ we obtain a new category, namely the category of functors between $\mathcal{A}$ and $\mathcal{B}$. \begin{remark} \label{remark-functors-sets-sets} This is one instance where the same thing does not hold if $\mathcal{A}$ is a ``big'' category. For example consider functors $\textit{Sets} \to \textit{Sets}$. As we have currently defined it such a functor is a class and not a set. In other words, it is given by a formula in set theory (with some variables equal to specified sets)! It is not a good idea to try to consider all possible formulae of set theory as part of the definition of a mathematical object. The same problem presents itself when considering sheaves on the category of schemes for example. We will come back to this point later. \end{remark} \begin{definition} \label{definition-equivalence-categories} An {\it equivalence of categories} $F : \mathcal{A} \to \mathcal{B}$ is a functor such that there exists a functor $G : \mathcal{B} \to \mathcal{A}$ such that the compositions $F \circ G$ and $G \circ F$ are isomorphic to the identity functors $\text{id}_\mathcal{B}$, respectively $\text{id}_\mathcal{A}$. In this case we say that $G$ is a {\it quasi-inverse} to $F$. \end{definition} \begin{lemma} \label{lemma-construct-quasi-inverse} Let $F : \mathcal{A} \to \mathcal{B}$ be a fully faithful functor. Suppose for every $X \in \Ob(\mathcal{B})$ given an object $j(X)$ of $\mathcal{A}$ and an isomorphism $i_X : X \to F(j(X))$. Then there is a unique functor $j : \mathcal{B} \to \mathcal{A}$ such that $j$ extends the rule on objects, and the isomorphisms $i_X$ define an isomorphism of functors $\text{id}_\mathcal{B} \to F \circ j$. Moreover, $j$ and $F$ are quasi-inverse equivalences of categories. \end{lemma} \begin{proof} This lemma proves itself. \end{proof} \begin{lemma} \label{lemma-equivalence-categories} A functor is an equivalence of categories if and only if it is both fully faithful and essentially surjective. \end{lemma} \begin{proof} Let $F : \mathcal{A} \to \mathcal{B}$ be essentially surjective and fully faithful. As by convention all categories are small and as $F$ is essentially surjective we can, using the axiom of choice, choose for every $X \in \Ob(\mathcal{B})$ an object $j(X)$ of $\mathcal{A}$ and an isomorphism $i_X : X \to F(j(X))$. Then we apply Lemma \ref{lemma-construct-quasi-inverse} using that $F$ is fully faithful. \end{proof} \begin{definition} \label{definition-product-category} Let $\mathcal{A}$, $\mathcal{B}$ be categories. We define the {\it product category} $\mathcal{A} \times \mathcal{B}$ to be the category with objects $\Ob(\mathcal{A} \times \mathcal{B}) = \Ob(\mathcal{A}) \times \Ob(\mathcal{B})$ and $$ \Mor_{\mathcal{A} \times \mathcal{B}}((x, y), (x', y')) := \Mor_\mathcal{A}(x, x')\times \Mor_\mathcal{B}(y, y'). $$ Composition is defined componentwise. \end{definition} \section{Opposite Categories and the Yoneda Lemma} \label{section-opposite} \begin{definition} \label{definition-opposite} Given a category $\mathcal{C}$ the {\it opposite category} $\mathcal{C}^{opp}$ is the category with the same objects as $\mathcal{C}$ but all morphisms reversed. \end{definition} \noindent In other words $\Mor_{\mathcal{C}^{opp}}(x, y) = \Mor_\mathcal{C}(y, x)$. Composition in $\mathcal{C}^{opp}$ is the same as in $\mathcal{C}$ except backwards: if $\phi : y \to z$ and $\psi : x \to y$ are morphisms in $\mathcal{C}^{opp}$, in other words arrows $z \to y$ and $y \to x$ in $\mathcal{C}$, then $\phi \circ^{opp} \psi$ is the morphism $x \to z$ of $\mathcal{C}^{opp}$ which corresponds to the composition $z \to y \to x$ in $\mathcal{C}$. \begin{definition} \label{definition-contravariant} Let $\mathcal{C}$, $\mathcal{S}$ be categories. A {\it contravariant} functor $F$ from $\mathcal{C}$ to $\mathcal{S}$ is a functor $\mathcal{C}^{opp}\to \mathcal{S}$. \end{definition} \noindent Concretely, a contravariant functor $F$ is given by a map $F : \Ob(\mathcal{C}) \to \Ob(\mathcal{S})$ and for every morphism $\psi : x \to y$ in $\mathcal{C}$ a morphism $F(\psi) : F(y) \to F(x)$. These should satisfy the property that, given another morphism $\phi : y \to z$, we have $F(\phi \circ \psi) = F(\psi) \circ F(\phi)$ as morphisms $F(z) \to F(x)$. (Note the reverse of order.) \begin{definition} \label{definition-presheaf} Let $\mathcal{C}$ be a category. \begin{enumerate} \item A {\it presheaf of sets on $\mathcal{C}$} or simply a {\it presheaf} is a contravariant functor $F$ from $\mathcal{C}$ to $\textit{Sets}$. \item The category of presheaves is denoted $\textit{PSh}(\mathcal{C})$. \end{enumerate} \end{definition} \noindent Of course the category of presheaves is a proper class. \begin{example} \label{example-hom-functor} Functor of points. For any $U\in \Ob(\mathcal{C})$ there is a contravariant functor $$ \begin{matrix} h_U & : & \mathcal{C} & \longrightarrow & \textit{Sets} \\ & & X & \longmapsto & \Mor_\mathcal{C}(X, U) \end{matrix} $$ which takes an object $X$ to the set $\Mor_\mathcal{C}(X, U)$. In other words $h_U$ is a presheaf. Given a morphism $f : X\to Y$ the corresponding map $h_U(f) : \Mor_\mathcal{C}(Y, U)\to \Mor_\mathcal{C}(X, U)$ takes $\phi$ to $\phi\circ f$. We will always denote this presheaf $h_U : \mathcal{C}^{opp} \to \textit{Sets}$. It is called the {\it representable presheaf} associated to $U$. If $\mathcal{C}$ is the category of schemes this functor is sometimes referred to as the \emph{functor of points} of $U$. \end{example} \noindent Note that given a morphism $\phi : U \to V$ in $\mathcal{C}$ we get a corresponding natural transformation of functors $h(\phi) : h_U \to h_V$ defined by composing with the morphism $U \to V$. This turns composition of morphisms in $\mathcal{C}$ into composition of transformations of functors. In other words we get a functor $$ h : \mathcal{C} \longrightarrow \textit{PSh}(\mathcal{C}) $$ Note that the target is a ``big'' category, see Remark \ref{remark-big-categories}. On the other hand, $h$ is an actual mathematical object (i.e.\ a set), compare Remark \ref{remark-functor-into-sets}. \begin{lemma}[Yoneda lemma] \label{lemma-yoneda} \begin{reference} Appeared in some form in \cite{Yoneda-homology}. Used by Grothendieck in a generalized form in \cite{Gr-II}. \end{reference} Let $U, V \in \Ob(\mathcal{C})$. Given any morphism of functors $s : h_U \to h_V$ there is a unique morphism $\phi : U \to V$ such that $h(\phi) = s$. In other words the functor $h$ is fully faithful. More generally, given any contravariant functor $F$ and any object $U$ of $\mathcal{C}$ we have a natural bijection $$ \Mor_{\textit{PSh}(\mathcal{C})}(h_U, F) \longrightarrow F(U), \quad s \longmapsto s_U(\text{id}_U). $$ \end{lemma} \begin{proof} For the first statement, just take $\phi = s_U(\text{id}_U) \in \Mor_\mathcal{C}(U, V)$. For the second statement, given $\xi \in F(U)$ define $s$ by $s_V : h_U(V) \to F(V)$ by sending the element $f : V \to U$ of $h_U(V) = \Mor_\mathcal{C}(V, U)$ to $F(f)(\xi)$. \end{proof} \begin{definition} \label{definition-representable-functor} A contravariant functor $F : \mathcal{C}\to \textit{Sets}$ is said to be {\it representable} if it is isomorphic to the functor of points $h_U$ for some object $U$ of $\mathcal{C}$. \end{definition} \noindent Let $\mathcal{C}$ be a category and let $F : \mathcal{C}^{opp} \to \textit{Sets}$ be a representable functor. Choose an object $U$ of $\mathcal{C}$ and an isomorphism $s : h_U \to F$. The Yoneda lemma guarantees that the pair $(U, s)$ is unique up to unique isomorphism. The object $U$ is called an object {\it representing} $F$. By the Yoneda lemma the transformation $s$ corresponds to a unique element $\xi \in F(U)$. This element is called the {\it universal object}. It has the property that for $V \in \Ob(\mathcal{C})$ the map $$ \Mor_\mathcal{C}(V, U) \longrightarrow F(V),\quad (f : V \to U) \longmapsto F(f)(\xi) $$ is a bijection. Thus $\xi$ is universal in the sense that every element of $F(V)$ is equal to the image of $\xi$ via $F(f)$ for a unique morphism $f : V \to U$ in $\mathcal{C}$. \section{Products of pairs} \label{section-products-pairs} \begin{definition} \label{definition-products} Let $x, y\in \Ob(\mathcal{C})$. A {\it product} of $x$ and $y$ is an object $x \times y \in \Ob(\mathcal{C})$ together with morphisms $p\in \Mor_{\mathcal C}(x \times y, x)$ and $q\in\Mor_{\mathcal C}(x \times y, y)$ such that the following universal property holds: for any $w\in \Ob(\mathcal{C})$ and morphisms $\alpha \in \Mor_{\mathcal C}(w, x)$ and $\beta \in \Mor_\mathcal{C}(w, y)$ there is a unique $\gamma\in \Mor_{\mathcal C}(w, x \times y)$ making the diagram $$ \xymatrix{ w \ar[rrrd]^\beta \ar@{-->}[rrd]_\gamma \ar[rrdd]_\alpha & & \\ & & x \times y \ar[d]_p \ar[r]_q & y \\ & & x & } $$ commute. \end{definition} \noindent If a product exists it is unique up to unique isomorphism. This follows from the Yoneda lemma as the definition requires $x \times y$ to be an object of $\mathcal{C}$ such that $$ h_{x \times y}(w) = h_x(w) \times h_y(w) $$ functorially in $w$. In other words the product $x \times y$ is an object representing the functor $w \mapsto h_x(w) \times h_y(w)$. \begin{definition} \label{definition-has-products-of-pairs} We say the category $\mathcal{C}$ {\it has products of pairs of objects} if a product $x \times y$ exists for any $x, y \in \Ob(\mathcal{C})$. \end{definition} \noindent We use this terminology to distinguish this notion from the notion of ``having products'' or ``having finite products'' which usually means something else (in particular it always implies there exists a final object). \section{Coproducts of pairs} \label{section-coproducts-pairs} \begin{definition} \label{definition-coproducts} Let $x, y \in \Ob(\mathcal{C})$. A {\it coproduct}, or {\it amalgamated sum} of $x$ and $y$ is an object $x \amalg y \in \Ob(\mathcal{C})$ together with morphisms $i \in \Mor_{\mathcal C}(x, x \amalg y)$ and $j \in \Mor_{\mathcal C}(y, x \amalg y)$ such that the following universal property holds: for any $w \in \Ob(\mathcal{C})$ and morphisms $\alpha \in \Mor_{\mathcal C}(x, w)$ and $\beta \in \Mor_\mathcal{C}(y, w)$ there is a unique $\gamma \in \Mor_{\mathcal C}(x \amalg y, w)$ making the diagram $$ \xymatrix{ & y \ar[d]^j \ar[rrdd]^\beta \\ x \ar[r]^i \ar[rrrd]_\alpha & x \amalg y \ar@{-->}[rrd]^\gamma \\ & & & w } $$ commute. \end{definition} \noindent If a coproduct exists it is unique up to unique isomorphism. This follows from the Yoneda lemma (applied to the opposite category) as the definition requires $x \amalg y$ to be an object of $\mathcal{C}$ such that $$ \Mor_\mathcal{C}(x \amalg y, w) = \Mor_\mathcal{C}(x, w) \times \Mor_\mathcal{C}(y, w) $$ functorially in $w$. \begin{definition} \label{definition-has-coproducts-of-pairs} We say the category $\mathcal{C}$ {\it has coproducts of pairs of objects} if a coproduct $x \amalg y$ exists for any $x, y \in \Ob(\mathcal{C})$. \end{definition} \noindent We use this terminology to distinguish this notion from the notion of ``having coproducts'' or ``having finite coproducts'' which usually means something else (in particular it always implies there exists an initial object in $\mathcal{C}$). \section{Fibre products} \label{section-fibre-products} \begin{definition} \label{definition-fibre-products} Let $x, y, z\in \Ob(\mathcal{C})$, $f\in \Mor_\mathcal{C}(x, y)$ and $g\in \Mor_{\mathcal C}(z, y)$. A {\it fibre product} of $f$ and $g$ is an object $x \times_y z\in \Ob(\mathcal{C})$ together with morphisms $p \in \Mor_{\mathcal C}(x \times_y z, x)$ and $q \in \Mor_{\mathcal C}(x \times_y z, z)$ making the diagram $$ \xymatrix{ x \times_y z \ar[r]_q \ar[d]_p & z \ar[d]^g \\ x \ar[r]^f & y } $$ commute, and such that the following universal property holds: for any $w\in \Ob(\mathcal{C})$ and morphisms $\alpha \in \Mor_{\mathcal C}(w, x)$ and $\beta \in \Mor_\mathcal{C}(w, z)$ with $f \circ \alpha = g \circ \beta$ there is a unique $\gamma \in \Mor_{\mathcal C}(w, x \times_y z)$ making the diagram $$ \xymatrix{ w \ar[rrrd]^\beta \ar@{-->}[rrd]_\gamma \ar[rrdd]_\alpha & & \\ & & x \times_y z \ar[d]^p \ar[r]_q & z \ar[d]^g \\ & & x \ar[r]^f & y } $$ commute. \end{definition} \noindent If a fibre product exists it is unique up to unique isomorphism. This follows from the Yoneda lemma as the definition requires $x \times_y z$ to be an object of $\mathcal{C}$ such that $$ h_{x \times_y z}(w) = h_x(w) \times_{h_y(w)} h_z(w) $$ functorially in $w$. In other words the fibre product $x \times_y z$ is an object representing the functor $w \mapsto h_x(w) \times_{h_y(w)} h_z(w)$. \begin{definition} \label{definition-cartesian} We say a commutative diagram $$ \xymatrix{ w \ar[r] \ar[d] & z \ar[d] \\ x \ar[r] & y } $$ in a category is {\it cartesian} if $w$ and the morphisms $w \to x$ and $w \to z$ form a fibre product of the morphisms $x \to y$ and $z \to y$. \end{definition} \begin{definition} \label{definition-has-fibre-products} We say the category $\mathcal{C}$ {\it has fibre products} if the fibre product exists for any $f\in \Mor_{\mathcal C}(x, y)$ and $g\in \Mor_{\mathcal C}(z, y)$. \end{definition} \begin{definition} \label{definition-representable-morphism} A morphism $f : x \to y$ of a category $\mathcal{C}$ is said to be {\it representable} if for every morphism $z \to y$ in $\mathcal{C}$ the fibre product $x \times_y z$ exists. \end{definition} \begin{lemma} \label{lemma-composition-representable} Let $\mathcal{C}$ be a category. Let $f : x \to y$, and $g : y \to z$ be representable. Then $g \circ f : x \to z$ is representable. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-base-change-representable} Let $\mathcal{C}$ be a category. Let $f : x \to y$ be representable. Let $y' \to y$ be a morphism of $\mathcal{C}$. Then the morphism $x' := x \times_y y' \to y'$ is representable also. \end{lemma} \begin{proof} Let $z \to y'$ be a morphism. The fibre product $x' \times_{y'} z$ is supposed to represent the functor \begin{eqnarray*} w & \mapsto & h_{x'}(w)\times_{h_{y'}(w)} h_z(w) \\ & = & (h_x(w) \times_{h_y(w)} h_{y'}(w)) \times_{h_{y'}(w)} h_z(w) \\ & = & h_x(w) \times_{h_y(w)} h_z(w) \end{eqnarray*} which is representable by assumption. \end{proof} \section{Examples of fibre products} \label{section-example-fibre-products} \noindent In this section we list examples of fibre products and we describe them. \medskip\noindent As a really trivial first example we observe that the category of sets has fibre products and hence every morphism is representable. Namely, if $f : X \to Y$ and $g : Z \to Y$ are maps of sets then we define $X \times_Y Z$ as the subset of $X \times Z$ consisting of pairs $(x, z)$ such that $f(x) = g(z)$. The morphisms $p : X \times_Y Z \to X$ and $q : X \times_Y Z \to Z$ are the projection maps $(x, z) \mapsto x$, and $(x, z) \mapsto z$. Finally, if $\alpha : W \to X$ and $\beta : W \to Z$ are morphisms such that $f \circ \alpha = g \circ \beta$ then the map $W \to X \times Z$, $w\mapsto (\alpha(w), \beta(w))$ obviously ends up in $X \times_Y Z$ as desired. \medskip\noindent In many categories whose objects are sets endowed with certain types of algebraic structures the fibre product of the underlying sets also provides the fibre product in the category. For example, suppose that $X$, $Y$ and $Z$ above are groups and that $f$, $g$ are homomorphisms of groups. Then the set-theoretic fibre product $X \times_Y Z$ inherits the structure of a group, simply by defining the product of two pairs by the formula $(x, z) \cdot (x', z') = (xx', zz')$. Here we list those categories for which a similar reasoning works. \begin{enumerate} \item The category $\textit{Groups}$ of groups. \item The category $G\textit{-Sets}$ of sets endowed with a left $G$-action for some fixed group $G$. \item The category of rings. \item The category of $R$-modules given a ring $R$. \end{enumerate} \section{Fibre products and representability} \label{section-representable-map-presheaves} \noindent In this section we work out fibre products in the category of contravariant functors from a category to the category of sets. This will later be superseded during the discussion of sites, presheaves, sheaves. Of some interest is the notion of a ``representable morphism'' between such functors. \begin{lemma} \label{lemma-fibre-product-presheaves} Let $\mathcal{C}$ be a category. Let $F, G, H : \mathcal{C}^{opp} \to \textit{Sets}$ be functors. Let $a : F \to G$ and $b : H \to G$ be transformations of functors. Then the fibre product $F \times_{a, G, b} H$ in the category $\textit{PSh}(\mathcal{C})$ exists and is given by the formula $$ (F \times_{a, G, b} H)(X) = F(X) \times_{a_X, G(X), b_X} H(X) $$ for any object $X$ of $\mathcal{C}$. \end{lemma} \begin{proof} Omitted. \end{proof} \noindent As a special case suppose we have a morphism $a : F \to G$, an object $U \in \Ob(\mathcal{C})$ and an element $\xi \in G(U)$. According to the Yoneda Lemma \ref{lemma-yoneda} this gives a transformation $\xi : h_U \to G$. The fibre product in this case is described by the rule $$ (h_U \times_{\xi, G, a} F)(X) = \{ (f, \xi') \mid f : X \to U, \ \xi' \in F(X), \ G(f)(\xi) = a_X(\xi')\} $$ If $F$, $G$ are also representable, then this is the functor representing the fibre product, if it exists, see Section \ref{section-fibre-products}. The analogy with Definition \ref{definition-representable-morphism} prompts us to define a notion of representable transformations. \begin{definition} \label{definition-representable-map-presheaves} Let $\mathcal{C}$ be a category. Let $F, G : \mathcal{C}^{opp} \to \textit{Sets}$ be functors. We say a morphism $a : F \to G$ is {\it representable}, or that {\it $F$ is relatively representable over $G$}, if for every $U \in \Ob(\mathcal{C})$ and any $\xi \in G(U)$ the functor $h_U \times_G F$ is representable. \end{definition} \begin{lemma} \label{lemma-representable-over-representable} Let $\mathcal{C}$ be a category. Let $a : F \to G$ be a morphism of contravariant functors from $\mathcal{C}$ to $\textit{Sets}$. If $a$ is representable, and $G$ is a representable functor, then $F$ is representable. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-representable-diagonal} Let $\mathcal{C}$ be a category. Let $F : \mathcal{C}^{opp} \to \textit{Sets}$ be a functor. Assume $\mathcal{C}$ has products of pairs of objects and fibre products. The following are equivalent: \begin{enumerate} \item the diagonal $\Delta : F \to F \times F$ is representable, \item for every $U$ in $\mathcal{C}$, and any $\xi \in F(U)$ the map $\xi : h_U \to F$ is representable, \item for every pair $U, V$ in $\mathcal{C}$ and any $\xi \in F(U)$, $\xi' \in F(V)$ the fibre product $h_U \times_{\xi, F, \xi'} h_V$ is representable. \end{enumerate} \end{lemma} \begin{proof} We will continue to use the Yoneda lemma to identify $F(U)$ with transformations $h_U \to F$ of functors. \medskip\noindent Equivalence of (2) and (3). Let $U, \xi, V, \xi'$ be as in (3). Both (2) and (3) tell us exactly that $h_U \times_{\xi, F, \xi'} h_V$ is representable; the only difference is that the statement (3) is symmetric in $U$ and $V$ whereas (2) is not. \medskip\noindent Assume condition (1). Let $U, \xi, V, \xi'$ be as in (3). Note that $h_U \times h_V = h_{U \times V}$ is representable. Denote $\eta : h_{U \times V} \to F \times F$ the map corresponding to the product $\xi \times \xi' : h_U \times h_V \to F \times F$. Then the fibre product $F \times_{\Delta, F \times F, \eta} h_{U \times V}$ is representable by assumption. This means there exist $W \in \Ob(\mathcal{C})$, morphisms $W \to U$, $W \to V$ and $h_W \to F$ such that $$ \xymatrix{ h_W \ar[d] \ar[r] & h_U \times h_V \ar[d]^{\xi \times \xi'} \\ F \ar[r] & F \times F } $$ is cartesian. Using the explicit description of fibre products in Lemma \ref{lemma-fibre-product-presheaves} the reader sees that this implies that $h_W = h_U \times_{\xi, F, \xi'} h_V$ as desired. \medskip\noindent Assume the equivalent conditions (2) and (3). Let $U$ be an object of $\mathcal{C}$ and let $(\xi, \xi') \in (F \times F)(U)$. By (3) the fibre product $h_U \times_{\xi, F, \xi'} h_U$ is representable. Choose an object $W$ and an isomorphism $h_W \to h_U \times_{\xi, F, \xi'} h_U$. The two projections $\text{pr}_i : h_U \times_{\xi, F, \xi'} h_U \to h_U$ correspond to morphisms $p_i : W \to U$ by Yoneda. Consider $W' = W \times_{(p_1, p_2), U \times U} U$. It is formal to show that $W'$ represents $F \times_{\Delta, F \times F} h_U$ because $$ h_{W'} = h_W \times_{h_U \times h_U} h_U = (h_U \times_{\xi, F, \xi'} h_U) \times_{h_U \times h_U} h_U = F \times_{F \times F} h_U. $$ Thus $\Delta$ is representable and this finishes the proof. \end{proof} \section{Pushouts} \label{section-pushouts} \noindent The dual notion to fibre products is that of pushouts. \begin{definition} \label{definition-pushouts} Let $x, y, z\in \Ob(\mathcal{C})$, $f\in \Mor_\mathcal{C}(y, x)$ and $g\in \Mor_{\mathcal C}(y, z)$. A {\it pushout} of $f$ and $g$ is an object $x\amalg_y z\in \Ob(\mathcal{C})$ together with morphisms $p\in \Mor_{\mathcal C}(x, x\amalg_y z)$ and $q\in\Mor_{\mathcal C}(z, x\amalg_y z)$ making the diagram $$ \xymatrix{ y \ar[r]_g \ar[d]_f & z \ar[d]^q \\ x \ar[r]^p & x\amalg_y z } $$ commute, and such that the following universal property holds: For any $w\in \Ob(\mathcal{C})$ and morphisms $\alpha \in \Mor_{\mathcal C}(x, w)$ and $\beta \in \Mor_\mathcal{C}(z, w)$ with $\alpha \circ f = \beta \circ g$ there is a unique $\gamma\in \Mor_{\mathcal C}(x\amalg_y z, w)$ making the diagram $$ \xymatrix{ y \ar[r]_g \ar[d]_f & z \ar[d]^q \ar[rrdd]^\beta & & \\ x \ar[r]^p \ar[rrrd]^\alpha & x \amalg_y z \ar@{-->}[rrd]^\gamma & & \\ & & & w } $$ commute. \end{definition} \noindent It is possible and straightforward to prove the uniqueness of the triple $(x\amalg_y z, p, q)$ up to unique isomorphism (if it exists) by direct arguments. Another possibility is to think of the pushout as the fibre product in the opposite category, thereby getting this uniqueness for free from the discussion in Section \ref{section-fibre-products}. \begin{definition} \label{definition-cocartesian} We say a commutative diagram $$ \xymatrix{ y \ar[r] \ar[d] & z \ar[d] \\ x \ar[r] & w } $$ in a category is {\it cocartesian} if $w$ and the morphisms $x \to w$ and $z \to w$ form a pushout of the morphisms $y \to x$ and $y \to z$. \end{definition} \section{Equalizers} \label{section-equalizers} \begin{definition} \label{definition-equalizers} Suppose that $X$, $Y$ are objects of a category $\mathcal{C}$ and that $a, b : X \to Y$ are morphisms. We say a morphism $e : Z \to X$ is an {\it equalizer} for the pair $(a, b)$ if $a \circ e = b \circ e$ and if $(Z, e)$ satisfies the following universal property: For every morphism $t : W \to X$ in $\mathcal{C}$ such that $a \circ t = b \circ t$ there exists a unique morphism $s : W \to Z$ such that $t = e \circ s$. \end{definition} \noindent As in the case of the fibre products above, equalizers when they exist are unique up to unique isomorphism. There is a straightforward generalization of this definition to the case where we have more than $2$ morphisms. \section{Coequalizers} \label{section-coequalizers} \begin{definition} \label{definition-coequalizers} Suppose that $X$, $Y$ are objects of a category $\mathcal{C}$ and that $a, b : X \to Y$ are morphisms. We say a morphism $c : Y \to Z$ is a {\it coequalizer} for the pair $(a, b)$ if $c \circ a = c \circ b$ and if $(Z, c)$ satisfies the following universal property: For every morphism $t : Y \to W$ in $\mathcal{C}$ such that $t \circ a = t \circ b$ there exists a unique morphism $s : Z \to W$ such that $t = s \circ c$. \end{definition} \noindent As in the case of the pushouts above, coequalizers when they exist are unique up to unique isomorphism, and this follows from the uniqueness of equalizers upon considering the opposite category. There is a straightforward generalization of this definition to the case where we have more than $2$ morphisms. \section{Initial and final objects} \label{section-initial-final} \begin{definition} \label{definition-initial-final} Let $\mathcal{C}$ be a category. \begin{enumerate} \item An object $x$ of the category $\mathcal{C}$ is called an {\it initial} object if for every object $y$ of $\mathcal{C}$ there is exactly one morphism $x \to y$. \item An object $x$ of the category $\mathcal{C}$ is called a {\it final} object if for every object $y$ of $\mathcal{C}$ there is exactly one morphism $y \to x$. \end{enumerate} \end{definition} \noindent In the category of sets the empty set $\emptyset$ is an initial object, and in fact the only initial object. Also, any {\it singleton}, i.e., a set with one element, is a final object (so it is not unique). \section{Monomorphisms and Epimorphisms} \label{section-mono-epi} \begin{definition} \label{definition-mono-epi} Let $\mathcal{C}$ be a category and let $f : X \to Y$ be a morphism of $\mathcal{C}$. \begin{enumerate} \item We say that $f$ is a {\it monomorphism} if for every object $W$ and every pair of morphisms $a, b : W \to X$ such that $f \circ a = f \circ b$ we have $a = b$. \item We say that $f$ is an {\it epimorphism} if for every object $W$ and every pair of morphisms $a, b : Y \to W$ such that $a \circ f = b \circ f$ we have $a = b$. \end{enumerate} \end{definition} \begin{example} \label{example-mono-epi-sets} In the category of sets the monomorphisms correspond to injective maps and the epimorphisms correspond to surjective maps. \end{example} \begin{lemma} \label{lemma-characterize-mono-epi} Let $\mathcal{C}$ be a category, and let $f : X \to Y$ be a morphism of $\mathcal{C}$. Then \begin{enumerate} \item $f$ is a monomorphism if and only if $X$ is the fibre product $X \times_Y X$, and \item $f$ is an epimorphism if and only if $Y$ is the pushout $Y \amalg_X Y$. \end{enumerate} \end{lemma} \begin{proof} Omitted. \end{proof} \section{Limits and colimits} \label{section-limits} \noindent Let $\mathcal{C}$ be a category. A {\it diagram} in $\mathcal{C}$ is simply a functor $M : \mathcal{I} \to \mathcal{C}$. We say that $\mathcal{I}$ is the {\it index category} or that $M$ is an $\mathcal{I}$-diagram. We will use the notation $M_i$ to denote the image of the object $i$ of $\mathcal{I}$. Hence for $\phi : i \to i'$ a morphism in $\mathcal{I}$ we have $M(\phi) : M_i \to M_{i'}$. \begin{definition} \label{definition-limit} A {\it limit} of the $\mathcal{I}$-diagram $M$ in the category $\mathcal{C}$ is given by an object $\lim_\mathcal{I} M$ in $\mathcal{C}$ together with morphisms $p_i : \lim_\mathcal{I} M \to M_i$ such that \begin{enumerate} \item for $\phi : i \to i'$ a morphism in $\mathcal{I}$ we have $p_{i'} = M(\phi) \circ p_i$, and \item for any object $W$ in $\mathcal{C}$ and any family of morphisms $q_i : W \to M_i$ (indexed by $i \in \Ob(\mathcal{I})$) such that for all $\phi : i \to i'$ in $\mathcal{I}$ we have $q_{i'} = M(\phi) \circ q_i$ there exists a unique morphism $q : W \to \lim_\mathcal{I} M$ such that $q_i = p_i \circ q$ for every object $i$ of $\mathcal{I}$. \end{enumerate} \end{definition} \noindent Limits $(\lim_\mathcal{I} M, (p_i)_{i\in \Ob(\mathcal{I})})$ are (if they exist) unique up to unique isomorphism by the uniqueness requirement in the definition. Products of pairs, fibre products, and equalizers are examples of limits. The limit over the empty diagram is a final object of $\mathcal{C}$. In the category of sets all limits exist. The dual notion is that of colimits. \begin{definition} \label{definition-colimit} A {\it colimit} of the $\mathcal{I}$-diagram $M$ in the category $\mathcal{C}$ is given by an object $\colim_\mathcal{I} M$ in $\mathcal{C}$ together with morphisms $s_i : M_i \to \colim_\mathcal{I} M$ such that \begin{enumerate} \item for $\phi : i \to i'$ a morphism in $\mathcal{I}$ we have $s_i = s_{i'} \circ M(\phi)$, and \item for any object $W$ in $\mathcal{C}$ and any family of morphisms $t_i : M_i \to W$ (indexed by $i \in \Ob(\mathcal{I})$) such that for all $\phi : i \to i'$ in $\mathcal{I}$ we have $t_i = t_{i'} \circ M(\phi)$ there exists a unique morphism $t : \colim_\mathcal{I} M \to W$ such that $t_i = t \circ s_i$ for every object $i$ of $\mathcal{I}$. \end{enumerate} \end{definition} \noindent Colimits $(\colim_\mathcal{I} M, (s_i)_{i\in \Ob(\mathcal{I})})$ are (if they exist) unique up to unique isomorphism by the uniqueness requirement in the definition. Coproducts of pairs, pushouts, and coequalizers are examples of colimits. The colimit over an empty diagram is an initial object of $\mathcal{C}$. In the category of sets all colimits exist. \begin{remark} \label{remark-diagram-small} The index category of a (co)limit will never be allowed to have a proper class of objects. In this project it means that it cannot be one of the categories listed in Remark \ref{remark-big-categories} \end{remark} \begin{remark} \label{remark-limit-colim} We often write $\lim_i M_i$, $\colim_i M_i$, $\lim_{i\in \mathcal{I}} M_i$, or $\colim_{i\in \mathcal{I}} M_i$ instead of the versions indexed by $\mathcal{I}$. Using this notation, and using the description of limits and colimits of sets in Section \ref{section-limit-sets} below, we can say the following. Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram. \begin{enumerate} \item The object $\lim_i M_i$ if it exists satisfies the following property $$ \Mor_\mathcal{C}(W, \lim_i M_i) = \lim_i \Mor_\mathcal{C}(W, M_i) $$ where the limit on the right takes place in the category of sets. \item The object $\colim_i M_i$ if it exists satisfies the following property $$ \Mor_\mathcal{C}(\colim_i M_i, W) = \lim_{i \in \mathcal{I}^{opp}} \Mor_\mathcal{C}(M_i, W) $$ where on the right we have the limit over the opposite category with value in the category of sets. \end{enumerate} By the Yoneda lemma (and its dual) this formula completely determines the limit, respectively the colimit. \end{remark} \begin{remark} \label{remark-cones-and-cocones} Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram. In this setting a {\it cone} for $M$ is given by an object $W$ and a family of morphisms $q_i : W \to M_i$, $i \in \Ob(\mathcal{I})$ such that for all morphisms $\phi : i \to i'$ of $\mathcal{I}$ the diagram $$ \xymatrix{ & W \ar[dl]_{q_i} \ar[dr]^{q_{i'}} \\ M_i \ar[rr]^{M(\phi)} & & M_{i'} } $$ is commutative. The collection of cones forms a category with an obvious notion of morphisms. Clearly, the limit of $M$, if it exists, is a final object in the category of cones. Dually, a {\it cocone} for $M$ is given by an object $W$ and a family of morphisms $t_i : M_i \to W$ such that for all morphisms $\phi : i \to i'$ in $\mathcal{I}$ the diagram $$ \xymatrix{ M_i \ar[rr]^{M(\phi)} \ar[dr]_{t_i} & & M_{i'} \ar[dl]^{t_{i'}} \\ & W } $$ commutes. The collection of cocones forms a category with an obvious notion of morphisms. Similarly to the above the colimit of $M$ exists if and only if the category of cocones has an initial object. \end{remark} \noindent As an application of the notions of limits and colimits we define products and coproducts. \begin{definition} \label{definition-product} Suppose that $I$ is a set, and suppose given for every $i \in I$ an object $M_i$ of the category $\mathcal{C}$. A {\it product} $\prod_{i\in I} M_i$ is by definition $\lim_\mathcal{I} M$ (if it exists) where $\mathcal{I}$ is the category having only identities as morphisms and having the elements of $I$ as objects. \end{definition} \noindent An important special case is where $I = \emptyset$ in which case the product is a final object of the category. The morphisms $p_i : \prod M_i \to M_i$ are called the {\it projection morphisms}. \begin{definition} \label{definition-coproduct} Suppose that $I$ is a set, and suppose given for every $i \in I$ an object $M_i$ of the category $\mathcal{C}$. A {\it coproduct} $\coprod_{i\in I} M_i$ is by definition $\colim_\mathcal{I} M$ (if it exists) where $\mathcal{I}$ is the category having only identities as morphisms and having the elements of $I$ as objects. \end{definition} \noindent An important special case is where $I = \emptyset$ in which case the coproduct is an initial object of the category. Note that the coproduct comes equipped with morphisms $M_i \to \coprod M_i$. These are sometimes called the {\it coprojections}. \begin{lemma} \label{lemma-functorial-colimit} Suppose that $M : \mathcal{I} \to \mathcal{C}$, and $N : \mathcal{J} \to \mathcal{C}$ are diagrams whose colimits exist. Suppose $H : \mathcal{I} \to \mathcal{J}$ is a functor, and suppose $t : M \to N \circ H$ is a transformation of functors. Then there is a unique morphism $$ \theta : \colim_\mathcal{I} M \longrightarrow \colim_\mathcal{J} N $$ such that all the diagrams $$ \xymatrix{ M_i \ar[d]_{t_i} \ar[r] & \colim_\mathcal{I} M \ar[d]^{\theta} \\ N_{H(i)} \ar[r] & \colim_\mathcal{J} N } $$ commute. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-functorial-limit} Suppose that $M : \mathcal{I} \to \mathcal{C}$, and $N : \mathcal{J} \to \mathcal{C}$ are diagrams whose limits exist. Suppose $H : \mathcal{I} \to \mathcal{J}$ is a functor, and suppose $t : N \circ H \to M$ is a transformation of functors. Then there is a unique morphism $$ \theta : \lim_\mathcal{J} N \longrightarrow \lim_\mathcal{I} M $$ such that all the diagrams $$ \xymatrix{ \lim_\mathcal{J} N \ar[d]^{\theta} \ar[r] & N_{H(i)} \ar[d]_{t_i} \\ \lim_\mathcal{I} M \ar[r] & M_i } $$ commute. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-colimits-commute} Let $\mathcal{I}$, $\mathcal{J}$ be index categories. Let $M : \mathcal{I} \times \mathcal{J} \to \mathcal{C}$ be a functor. We have $$ \colim_i \colim_j M_{i, j} = \colim_{i, j} M_{i, j} = \colim_j \colim_i M_{i, j} $$ provided all the indicated colimits exist. Similar for limits. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-limits-products-equalizers} Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram. Write $I = \Ob(\mathcal{I})$ and $A = \text{Arrows}(\mathcal{I})$. Denote $s, t : A \to I$ the source and target maps. Suppose that $\prod_{i \in I} M_i$ and $\prod_{a \in A} M_{t(a)}$ exist. Suppose that the equalizer of $$ \xymatrix{ \prod_{i \in I} M_i \ar@<1ex>[r]^\phi \ar@<-1ex>[r]_\psi & \prod_{a \in A} M_{t(a)} } $$ exists, where the morphisms are determined by their components as follows: $p_a \circ \psi = M(a) \circ p_{s(a)}$ and $p_a \circ \phi = p_{t(a)}$. Then this equalizer is the limit of the diagram. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-colimits-coproducts-coequalizers} \begin{slogan} If all coproducts and coequalizers exist, all colimits exist. \end{slogan} Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram. Write $I = \Ob(\mathcal{I})$ and $A = \text{Arrows}(\mathcal{I})$. Denote $s, t : A \to I$ the source and target maps. Suppose that $\coprod_{i \in I} M_i$ and $\coprod_{a \in A} M_{s(a)}$ exist. Suppose that the coequalizer of $$ \xymatrix{ \coprod_{a \in A} M_{s(a)} \ar@<1ex>[r]^\phi \ar@<-1ex>[r]_\psi & \coprod_{i \in I} M_i } $$ exists, where the morphisms are determined by their components as follows: The component $M_{s(a)}$ maps via $\psi$ to the component $M_{t(a)}$ via the morphism $M(a)$. The component $M_{s(a)}$ maps via $\phi$ to the component $M_{s(a)}$ by the identity morphism. Then this coequalizer is the colimit of the diagram. \end{lemma} \begin{proof} Omitted. \end{proof} \section{Limits and colimits in the category of sets} \label{section-limit-sets} \noindent Not only do limits and colimits exist in $\textit{Sets}$ but they are also easy to describe. Namely, let $M : \mathcal{I} \to \textit{Sets}$, $i \mapsto M_i$ be a diagram of sets. Denote $I = \Ob(\mathcal{I})$. The limit is described as $$ \lim_\mathcal{I} M = \{ (m_i)_{i\in I} \in \prod\nolimits_{i\in I} M_i \mid \forall \phi : i \to i' \text{ in }\mathcal{I}, M(\phi)(m_i) = m_{i'} \}. $$ So we think of an element of the limit as a compatible system of elements of all the sets $M_i$. \medskip\noindent On the other hand, the colimit is $$ \colim_\mathcal{I} M = (\coprod\nolimits_{i\in I} M_i)/\sim $$ where the equivalence relation $\sim$ is the equivalence relation generated by setting $m_i \sim m_{i'}$ if $m_i \in M_i$, $m_{i'} \in M_{i'}$ and $M(\phi)(m_i) = m_{i'}$ for some $\phi : i \to i'$. In other words, $m_i \in M_i$ and $m_{i'} \in M_{i'}$ are equivalent if there are a chain of morphisms in $\mathcal{I}$ $$ \xymatrix{ & i_1 \ar[ld] \ar[rd] & & i_3 \ar[ld] & & i_{2n-1} \ar[rd] & \\ i = i_0 & & i_2 & & \ldots & & i_{2n} = i' } $$ and elements $m_{i_j} \in M_{i_j}$ mapping to each other under the maps $M_{i_{2k-1}} \to M_{i_{2k-2}}$ and $M_{i_{2k-1}} \to M_{i_{2k}}$ induced from the maps in $\mathcal{I}$ above. \medskip\noindent This is not a very pleasant type of object to work with. But if the diagram is filtered then it is much easier to describe. We will explain this in Section \ref{section-directed-colimits}. \section{Connected limits} \label{section-connected-limits} \noindent A (co)limit is called connected if its index category is connected. \begin{definition} \label{definition-category-connected} We say that a category $\mathcal{I}$ is {\it connected} if the equivalence relation generated by $x \sim y \Leftrightarrow \Mor_\mathcal{I}(x, y) \not = \emptyset$ has exactly one equivalence class. \end{definition} \noindent Here we follow the convention of Topology, Definition \ref{topology-definition-connected-components} that connected spaces are nonempty. The following in some vague sense characterizes connected limits. \begin{lemma} \label{lemma-connected-limit-over-X} Let $\mathcal{C}$ be a category. Let $X$ be an object of $\mathcal{C}$. Let $M : \mathcal{I} \to \mathcal{C}/X$ be a diagram in the category of objects over $X$. If the index category $\mathcal{I}$ is connected and the limit of $M$ exists in $\mathcal{C}/X$, then the limit of the composition $\mathcal{I} \to \mathcal{C}/X \to \mathcal{C}$ exists and is the same. \end{lemma} \begin{proof} Let $L \to X$ be an object representing the limit in $\mathcal{C}/X$. Consider the functor $$ W \longmapsto \lim_i \Mor_\mathcal{C}(W, M_i). $$ Let $(\varphi_i)$ be an element of the set on the right. Since each $M_i$ comes equipped with a morphism $s_i : M_i \to X$ we get morphisms $f_i = s_i \circ \varphi_i : W \to X$. But as $\mathcal{I}$ is connected we see that all $f_i$ are equal. Since $\mathcal{I}$ is nonempty there is at least one $f_i$. Hence this common value $W \to X$ defines the structure of an object of $W$ in $\mathcal{C}/X$ and $(\varphi_i)$ defines an element of $\lim_i \Mor_{\mathcal{C}/X}(W, M_i)$. Thus we obtain a unique morphism $\phi : W \to L$ such that $\varphi_i$ is the composition of $\phi$ with $L \to M_i$ as desired. \end{proof} \begin{lemma} \label{lemma-connected-colimit-under-X} Let $\mathcal{C}$ be a category. Let $X$ be an object of $\mathcal{C}$. Let $M : \mathcal{I} \to X/\mathcal{C}$ be a diagram in the category of objects under $X$. If the index category $\mathcal{I}$ is connected and the colimit of $M$ exists in $X/\mathcal{C}$, then the colimit of the composition $\mathcal{I} \to X/\mathcal{C} \to \mathcal{C}$ exists and is the same. \end{lemma} \begin{proof} Omitted. Hint: This lemma is dual to Lemma \ref{lemma-connected-limit-over-X}. \end{proof} \section{Cofinal and initial categories} \label{section-cofinal} \noindent In the literature sometimes the word ``final'' is used instead of cofinal in the following definition. \begin{definition} \label{definition-cofinal} Let $H : \mathcal{I} \to \mathcal{J}$ be a functor between categories. We say {\it $\mathcal{I}$ is cofinal in $\mathcal{J}$} or that $H$ is {\it cofinal} if \begin{enumerate} \item for all $y \in \Ob(\mathcal{J})$ there exist an $x \in \Ob(\mathcal{I})$ and a morphism $y \to H(x)$, and \item given $y \in \Ob(\mathcal{J})$, $x, x' \in \Ob(\mathcal{I})$ and morphisms $y \to H(x)$ and $y \to H(x')$ there exist a sequence of morphisms $$ x = x_0 \leftarrow x_1 \rightarrow x_2 \leftarrow x_3 \rightarrow \ldots \rightarrow x_{2n} = x' $$ in $\mathcal{I}$ and morphisms $y \to H(x_i)$ in $\mathcal{J}$ such that the diagrams $$ \xymatrix{ & y \ar[ld] \ar[d] \ar[rd] \\ H(x_{2k}) & H(x_{2k + 1}) \ar[l] \ar[r] & H(x_{2k + 2}) } $$ commute for $k = 0, \ldots, n - 1$. \end{enumerate} \end{definition} \begin{lemma} \label{lemma-cofinal} Let $H : \mathcal{I} \to \mathcal{J}$ be a functor of categories. Assume $\mathcal{I}$ is cofinal in $\mathcal{J}$. Then for every diagram $M : \mathcal{J} \to \mathcal{C}$ we have a canonical isomorphism $$ \colim_\mathcal{I} M \circ H = \colim_\mathcal{J} M $$ if either side exists. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{definition} \label{definition-initial} Let $H : \mathcal{I} \to \mathcal{J}$ be a functor between categories. We say {\it $\mathcal{I}$ is initial in $\mathcal{J}$} or that $H$ is {\it initial} if \begin{enumerate} \item for all $y \in \Ob(\mathcal{J})$ there exist an $x \in \Ob(\mathcal{I})$ and a morphism $H(x) \to y$, \item for any $y \in \Ob(\mathcal{J})$, $x , x' \in \Ob(\mathcal{I})$ and morphisms $H(x) \to y$, $H(x') \to y$ in $\mathcal{J}$ there exist a sequence of morphisms $$ x = x_0 \leftarrow x_1 \rightarrow x_2 \leftarrow x_3 \rightarrow \ldots \rightarrow x_{2n} = x' $$ in $\mathcal{I}$ and morphisms $H(x_i) \to y$ in $\mathcal{J}$ such that the diagrams $$ \xymatrix{ H(x_{2k}) \ar[rd] & H(x_{2k + 1}) \ar[l] \ar[r] \ar[d] & H(x_{2k + 2}) \ar[ld] \\ & y } $$ commute for $k = 0, \ldots, n - 1$. \end{enumerate} \end{definition} \noindent This is just the dual notion to ``cofinal'' functors. \begin{lemma} \label{lemma-initial} Let $H : \mathcal{I} \to \mathcal{J}$ be a functor of categories. Assume $\mathcal{I}$ is initial in $\mathcal{J}$. Then for every diagram $M : \mathcal{J} \to \mathcal{C}$ we have a canonical isomorphism $$ \lim_\mathcal{I} M \circ H = \lim_\mathcal{J} M $$ if either side exists. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-colimit-constant-connected-fibers} Let $F : \mathcal{I} \to \mathcal{I}'$ be a functor. Assume \begin{enumerate} \item the fibre categories (see Definition \ref{definition-fibre-category}) of $\mathcal{I}$ over $\mathcal{I}'$ are all connected, and \item for every morphism $\alpha' : x' \to y'$ in $\mathcal{I}'$ there exists a morphism $\alpha : x \to y$ in $\mathcal{I}$ such that $F(\alpha) = \alpha'$. \end{enumerate} Then for every diagram $M : \mathcal{I}' \to \mathcal{C}$ the colimit $\colim_\mathcal{I} M \circ F$ exists if and only if $\colim_{\mathcal{I}'} M$ exists and if so these colimits agree. \end{lemma} \begin{proof} One can prove this by showing that $\mathcal{I}$ is cofinal in $\mathcal{I}'$ and applying Lemma \ref{lemma-cofinal}. But we can also prove it directly as follows. It suffices to show that for any object $T$ of $\mathcal{C}$ we have $$ \lim_{\mathcal{I}^{opp}} \Mor_\mathcal{C}(M_{F(i)}, T) = \lim_{(\mathcal{I}')^{opp}} \Mor_\mathcal{C}(M_{i'}, T) $$ If $(g_{i'})_{i' \in \Ob(\mathcal{I}')}$ is an element of the right hand side, then setting $f_i = g_{F(i)}$ we obtain an element $(f_i)_{i \in \Ob(\mathcal{I})}$ of the left hand side. Conversely, let $(f_i)_{i \in \Ob(\mathcal{I})}$ be an element of the left hand side. Note that on each (connected) fibre category $\mathcal{I}_{i'}$ the functor $M \circ F$ is constant with value $M_{i'}$. Hence the morphisms $f_i$ for $i \in \Ob(\mathcal{I})$ with $F(i) = i'$ are all the same and determine a well defined morphism $g_{i'} : M_{i'} \to T$. By assumption (2) the collection $(g_{i'})_{i' \in \Ob(\mathcal{I}')}$ defines an element of the right hand side. \end{proof} \begin{lemma} \label{lemma-product-with-connected} Let $\mathcal{I}$ and $\mathcal{J}$ be a categories and denote $p : \mathcal{I} \times \mathcal{J} \to \mathcal{J}$ the projection. If $\mathcal{I}$ is connected, then for a diagram $M : \mathcal{J} \to \mathcal{C}$ the colimit $\colim_\mathcal{J} M$ exists if and only if $\colim_{\mathcal{I} \times \mathcal{J}} M \circ p$ exists and if so these colimits are equal. \end{lemma} \begin{proof} This is a special case of Lemma \ref{lemma-colimit-constant-connected-fibers}. \end{proof} \section{Finite limits and colimits} \label{section-finite-limits} \noindent A {\it finite} (co)limit is a (co)limit whose index category is finite, i.e., the index category has finitely many objects and finitely many morphisms. A (co)limit is called {\it nonempty} if the index category is nonempty. A (co)limit is called {\it connected} if the index category is connected, see Definition \ref{definition-category-connected}. It turns out that there are ``enough'' finite index categories. \begin{lemma} \label{lemma-finite-diagram-category} Let $\mathcal{I}$ be a category with \begin{enumerate} \item $\Ob(\mathcal{I})$ is finite, and \item there exist finitely many morphisms $f_1, \ldots, f_m \in \text{Arrows}(\mathcal{I})$ such that every morphism of $\mathcal{I}$ is a composition $f_{j_1} \circ f_{j_2} \circ \ldots \circ f_{j_k}$. \end{enumerate} Then there exists a functor $F : \mathcal{J} \to \mathcal{I}$ such that \begin{enumerate} \item[(a)] $\mathcal{J}$ is a finite category, and \item[(b)] for any diagram $M : \mathcal{I} \to \mathcal{C}$ the (co)limit of $M$ over $\mathcal{I}$ exists if and only if the (co)limit of $M \circ F$ over $\mathcal{J}$ exists and in this case the (co)limits are canonically isomorphic. \end{enumerate} Moreover, $\mathcal{J}$ is connected (resp.\ nonempty) if and only if $\mathcal{I}$ is so. \end{lemma} \begin{proof} Say $\Ob(\mathcal{I}) = \{x_1, \ldots, x_n\}$. Denote $s, t : \{1, \ldots, m\} \to \{1, \ldots, n\}$ the functions such that $f_j : x_{s(j)} \to x_{t(j)}$. We set $\Ob(\mathcal{J}) = \{y_1, \ldots, y_n, z_1, \ldots, z_n\}$ Besides the identity morphisms we introduce morphisms $g_j : y_{s(j)} \to z_{t(j)}$, $j = 1, \ldots, m$ and morphisms $h_i : y_i \to z_i$, $i = 1, \ldots, n$. Since all of the nonidentity morphisms in $\mathcal{J}$ go from a $y$ to a $z$ there are no compositions to define and no associativities to check. Set $F(y_i) = F(z_i) = x_i$. Set $F(g_j) = f_j$ and $F(h_i) = \text{id}_{x_i}$. It is clear that $F$ is a functor. It is clear that $\mathcal{J}$ is finite. It is clear that $\mathcal{J}$ is connected, resp.\ nonempty if and only if $\mathcal{I}$ is so. \medskip\noindent Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram. Consider an object $W$ of $\mathcal{C}$ and morphisms $q_i : W \to M(x_i)$ as in Definition \ref{definition-limit}. Then by taking $q_i : W \to M(F(y_i)) = M(F(z_i)) = M(x_i)$ we obtain a family of maps as in Definition \ref{definition-limit} for the diagram $M \circ F$. Conversely, suppose we are given maps $qy_i : W \to M(F(y_i))$ and $qz_i : W \to M(F(z_i))$ as in Definition \ref{definition-limit} for the diagram $M \circ F$. Since $$ M(F(h_i)) = \text{id} : M(F(y_i)) = M(x_i) \longrightarrow M(x_i) = M(F(z_i)) $$ we conclude that $qy_i = qz_i$ for all $i$. Set $q_i$ equal to this common value. The compatibility of $q_{s(j)} = qy_{s(j)}$ and $q_{t(j)} = qz_{t(j)}$ with the morphism $M(f_j)$ guarantees that the family $q_i$ is compatible with all morphisms in $\mathcal{I}$ as by assumption every such morphism is a composition of the morphisms $f_j$. Thus we have found a canonical bijection $$ \lim_{B \in \Ob(\mathcal{J})} \Mor_\mathcal{C}(W, M(F(B))) = \lim_{A \in \Ob(\mathcal{I})} \Mor_\mathcal{C}(W, M(A)) $$ which implies the statement on limits in the lemma. The statement on colimits is proved in the same way (proof omitted). \end{proof} \begin{lemma} \label{lemma-fibre-products-equalizers-exist} Let $\mathcal{C}$ be a category. The following are equivalent: \begin{enumerate} \item Connected finite limits exist in $\mathcal{C}$. \item Equalizers and fibre products exist in $\mathcal{C}$. \end{enumerate} \end{lemma} \begin{proof} Since equalizers and fibre products are finite connected limits we see that (1) implies (2). For the converse, let $\mathcal{I}$ be a finite connected index category. Let $F : \mathcal{J} \to \mathcal{I}$ be the functor of index categories constructed in the proof of Lemma \ref{lemma-finite-diagram-category}. Then we see that we may replace $\mathcal{I}$ by $\mathcal{J}$. The result is that we may assume that $\Ob(\mathcal{I}) = \{x_1, \ldots, x_n\} \amalg \{y_1, \ldots, y_m\}$ with $n, m \geq 1$ such that all nonidentity morphisms in $\mathcal{I}$ are morphisms $f : x_i \to y_j$ for some $i$ and $j$. \medskip\noindent Suppose that $n > 1$. Since $\mathcal{I}$ is connected there exist indices $i_1, i_2$ and $j_0$ and morphisms $a : x_{i_1} \to y_{j_0}$ and $b : x_{i_2} \to y_{j_0}$. Consider the category $$ \mathcal{I}' = \{x\} \amalg \{x_1, \ldots, \hat x_{i_1}, \ldots, \hat x_{i_2}, \ldots x_n\} \amalg \{y_1, \ldots, y_m\} $$ with $$ \Mor_{\mathcal{I}'}(x, y_j) = \Mor_\mathcal{I}(x_{i_1}, y_j) \amalg \Mor_\mathcal{I}(x_{i_2}, y_j) $$ and all other morphism sets the same as in $\mathcal{I}$. For any functor $M : \mathcal{I} \to \mathcal{C}$ we can construct a functor $M' : \mathcal{I}' \to \mathcal{C}$ by setting $$ M'(x) = M(x_{i_1}) \times_{M(a), M(y_{j_0}), M(b)} M(x_{i_2}) $$ and for a morphism $f' : x \to y_j$ corresponding to, say, $f : x_{i_1} \to y_j$ we set $M'(f) = M(f) \circ \text{pr}_1$. Then the functor $M$ has a limit if and only if the functor $M'$ has a limit (proof omitted). Hence by induction we reduce to the case $n = 1$. \medskip\noindent If $n = 1$, then the limit of any $M : \mathcal{I} \to \mathcal{C}$ is the successive equalizer of pairs of maps $x_1 \to y_j$ hence exists by assumption. \end{proof} \begin{lemma} \label{lemma-almost-finite-limits-exist} Let $\mathcal{C}$ be a category. The following are equivalent: \begin{enumerate} \item Nonempty finite limits exist in $\mathcal{C}$. \item Products of pairs and equalizers exist in $\mathcal{C}$. \item Products of pairs and fibre products exist in $\mathcal{C}$. \end{enumerate} \end{lemma} \begin{proof} Since products of pairs, fibre products, and equalizers are limits with nonempty index categories we see that (1) implies both (2) and (3). Assume (2). Then finite nonempty products and equalizers exist. Hence by Lemma \ref{lemma-limits-products-equalizers} we see that finite nonempty limits exist, i.e., (1) holds. Assume (3). If $a, b : A \to B$ are morphisms of $\mathcal{C}$, then the equalizer of $a, b$ is $$ (A \times_{a, B, b} A)\times_{(\text{pr}_1, \text{pr}_2), A \times A, \Delta} A. $$ Thus (3) implies (2), and the lemma is proved. \end{proof} \begin{lemma} \label{lemma-finite-limits-exist} Let $\mathcal{C}$ be a category. The following are equivalent: \begin{enumerate} \item Finite limits exist in $\mathcal{C}$. \item Finite products and equalizers exist. \item The category has a final object and fibre products exist. \end{enumerate} \end{lemma} \begin{proof} Since finite products, fibre products, equalizers, and final objects are limits over finite index categories we see that (1) implies both (2) and (3). By Lemma \ref{lemma-limits-products-equalizers} above we see that (2) implies (1). Assume (3). Note that the product $A \times B$ is the fibre product over the final object. If $a, b : A \to B$ are morphisms of $\mathcal{C}$, then the equalizer of $a, b$ is $$ (A \times_{a, B, b} A)\times_{(\text{pr}_1, \text{pr}_2), A \times A, \Delta} A. $$ Thus (3) implies (2) and the lemma is proved. \end{proof} \begin{lemma} \label{lemma-push-outs-coequalizers-exist} Let $\mathcal{C}$ be a category. The following are equivalent: \begin{enumerate} \item Connected finite colimits exist in $\mathcal{C}$. \item Coequalizers and pushouts exist in $\mathcal{C}$. \end{enumerate} \end{lemma} \begin{proof} Omitted. Hint: This is dual to Lemma \ref{lemma-fibre-products-equalizers-exist}. \end{proof} \begin{lemma} \label{lemma-almost-finite-colimits-exist} Let $\mathcal{C}$ be a category. The following are equivalent: \begin{enumerate} \item Nonempty finite colimits exist in $\mathcal{C}$. \item Coproducts of pairs and coequalizers exist in $\mathcal{C}$. \item Coproducts of pairs and pushouts exist in $\mathcal{C}$. \end{enumerate} \end{lemma} \begin{proof} Omitted. Hint: This is the dual of Lemma \ref{lemma-almost-finite-limits-exist}. \end{proof} \begin{lemma} \label{lemma-colimits-exist} Let $\mathcal{C}$ be a category. The following are equivalent: \begin{enumerate} \item Finite colimits exist in $\mathcal{C}$. \item Finite coproducts and coequalizers exist in $\mathcal{C}$. \item The category has an initial object and pushouts exist. \end{enumerate} \end{lemma} \begin{proof} Omitted. Hint: This is dual to Lemma \ref{lemma-finite-limits-exist}. \end{proof} \section{Filtered colimits} \label{section-directed-colimits} \noindent Colimits are easier to compute or describe when they are over a filtered diagram. Here is the definition. \begin{definition} \label{definition-directed} We say that a diagram $M : \mathcal{I} \to \mathcal{C}$ is {\it directed}, or {\it filtered} if the following conditions hold: \begin{enumerate} \item the category $\mathcal{I}$ has at least one object, \item for every pair of objects $x, y$ of $\mathcal{I}$ there exist an object $z$ and morphisms $x \to z$, $y \to z$, and \item for every pair of objects $x, y$ of $\mathcal{I}$ and every pair of morphisms $a, b : x \to y$ of $\mathcal{I}$ there exists a morphism $c : y \to z$ of $\mathcal{I}$ such that $M(c \circ a) = M(c \circ b)$ as morphisms in $\mathcal{C}$. \end{enumerate} We say that an index category $\mathcal{I}$ is {\it directed}, or {\it filtered} if $\text{id} : \mathcal{I} \to \mathcal{I}$ is filtered (in other words you erase the $M$ in part (3) above). \end{definition} \noindent We observe that any diagram with filtered index category is filtered, and this is how filtered colimits usually come about. In fact, if $M : \mathcal{I} \to \mathcal{C}$ is a filtered diagram, then we can factor $M$ as $\mathcal{I} \to \mathcal{I}' \to \mathcal{C}$ where $\mathcal{I}'$ is a filtered index category\footnote{Namely, let $\mathcal{I}'$ have the same objects as $\mathcal{I}$ but where $\Mor_{\mathcal{I}'}(x, y)$ is the quotient of $\Mor_\mathcal{I}(x, y)$ by the equivalence relation which identifies $a, b : x \to y$ if $M(a) = M(b)$.} such that $\colim_\mathcal{I} M$ exists if and only if $\colim_{\mathcal{I}'} M'$ exists in which case the colimits are canonically isomorphic. \medskip\noindent Suppose that $M : \mathcal{I} \to \textit{Sets}$ is a filtered diagram. In this case we may describe the equivalence relation in the formula $$ \colim_\mathcal{I} M = (\coprod\nolimits_{i\in I} M_i)/\sim $$ simply as follows $$ m_i \sim m_{i'} \Leftrightarrow \exists i'', \phi : i \to i'', \phi': i' \to i'', M(\phi)(m_i) = M(\phi')(m_{i'}). $$ In other words, two elements are equal in the colimit if and only if they ``eventually become equal''. \begin{lemma} \label{lemma-directed-commutes} Let $\mathcal{I}$ and $\mathcal{J}$ be index categories. Assume that $\mathcal{I}$ is filtered and $\mathcal{J}$ is finite. Let $M : \mathcal{I} \times \mathcal{J} \to \textit{Sets}$, $(i, j) \mapsto M_{i, j}$ be a diagram of diagrams of sets. In this case $$ \colim_i \lim_j M_{i, j} = \lim_j \colim_i M_{i, j}. $$ In particular, colimits over $\mathcal{I}$ commute with finite products, fibre products, and equalizers of sets. \end{lemma} \begin{proof} Omitted. In fact, it is a fun exercise to prove that a category is filtered if and only if colimits over the category commute with finite limits (into the category of sets). \end{proof} \noindent We give a counter example to the lemma in the case where $\mathcal{J}$ is infinite. Namely, let $\mathcal{I}$ consist of $\mathbf{N} = \{1, 2, 3, \ldots\}$ with a unique morphism $i \to i'$ whenever $i \leq i'$. Let $\mathcal{J}$ be the discrete category $\mathbf{N} = \{1, 2, 3, \ldots\}$ (only morphisms are identities). Let $M_{i, j} = \{1, 2, \ldots, i\}$ with obvious inclusion maps $M_{i, j} \to M_{i', j}$ when $i \leq i'$. In this case $\colim_i M_{i, j} = \mathbf{N}$ and hence $$ \lim_j \colim_i M_{i, j} = \prod\nolimits_j \mathbf{N} = \mathbf{N}^\mathbf{N} $$ On the other hand $\lim_j M_{i, j} = \prod\nolimits_j M_{i, j}$ and hence $$ \colim_i \lim_j M_{i, j} = \bigcup\nolimits_i \{1, 2, \ldots, i\}^{\mathbf{N}} $$ which is smaller than the other limit. \begin{lemma} \label{lemma-cofinal-in-filtered} Let $\mathcal{I}$ be a category. Let $\mathcal{J}$ be a full subcategory. Assume that $\mathcal{I}$ is filtered. Assume also that for any object $i$ of $\mathcal{I}$, there exists a morphism $i \to j$ to some object $j$ of $\mathcal{J}$. Then $\mathcal{J}$ is filtered and cofinal in $\mathcal{I}$. \end{lemma} \begin{proof} Omitted. Pleasant exercise of the notions involved. \end{proof} \noindent It turns out we sometimes need a more finegrained control over the possible conditions one can impose on index categories. Thus we add some lemmas on the possible things one can require. \begin{lemma} \label{lemma-preserve-products} Let $\mathcal{I}$ be an index category, i.e., a category. Assume that for every pair of objects $x, y$ of $\mathcal{I}$ there exist an object $z$ and morphisms $x \to z$ and $y \to z$. Then \begin{enumerate} \item If $M$ and $N$ are diagrams of sets over $\mathcal{I}$, then $\colim (M_i \times N_i) \to \colim M_i \times \colim N_i$ is surjective, \item in general colimits of diagrams of sets over $\mathcal{I}$ do not commute with finite nonempty products. \end{enumerate} \end{lemma} \begin{proof} Proof of (1). Let $(\overline{m}, \overline{n})$ be an element of $\colim M_i \times \colim N_i$. Then we can find $m \in M_x$ and $n \in N_y$ for some $x, y \in \Ob(\mathcal{I})$ such that $m$ maps to $\overline{m}$ and $n$ maps to $\overline{n}$. See Section \ref{section-limit-sets}. Choose $a : x \to z$ and $b : y \to z$ in $\mathcal{I}$. Then $(M(a)(m), N(b)(n))$ is an element of $(M \times N)_z$ whose image in $\colim (M_i \times N_i)$ maps to $(\overline{m}, \overline{n})$ as desired. \medskip\noindent Proof of (2). Let $G$ be a non-trivial group and let $\mathcal{I}$ be the one-object category with endomorphism monoid $G$. Then $\mathcal{I}$ trivially satisfies the condition stated in the lemma. Now let $G$ act on itself by translation and view the $G$-set $G$ as a set-valued $\mathcal{I}$-diagram. Then $$ \colim_\mathcal{I} G \times \colim_\mathcal{I} G \cong G/G \times G/G $$ is not isomorphic to $$ \colim_\mathcal{I} (G \times G) \cong (G \times G)/G $$ This example indicates that you cannot just drop the additional condition Lemma \ref{lemma-directed-commutes} even if you only care about finite products. \end{proof} \begin{lemma} \label{lemma-colimits-abelian-as-sets} Let $\mathcal{I}$ be an index category, i.e., a category. Assume that for every pair of objects $x, y$ of $\mathcal{I}$ there exist an object $z$ and morphisms $x \to z$ and $y \to z$. Let $M : \mathcal{I} \to \textit{Ab}$ be a diagram of abelian groups over $\mathcal{I}$. Then the colimit of $M$ in the category of sets surjects onto the colimit of $M$ in the category of abelian groups. \end{lemma} \begin{proof} Recall that the colimit in the category of sets is the quotient of the disjoint union $\coprod M_i$ by relation, see Section \ref{section-limit-sets}. Similarly, the colimit in the category of abelian groups is a quotient of the direct sum $\bigoplus M_i$. The assumption of the lemma means that given $i, j \in \Ob(\mathcal{I})$ and $m \in M_i$ and $n \in M_j$, then we can find an object $k$ and morphisms $a : i \to k$ and $b : j \to k$. Thus $m + n$ is represented in the colimit by the element $M(a)(m) + M(b)(n)$ of $M_k$. Thus the $\coprod M_i$ surjects onto the colimit. \end{proof} \begin{lemma} \label{lemma-split-into-connected} Let $\mathcal{I}$ be an index category, i.e., a category. Assume that for every solid diagram $$ \xymatrix{ x \ar[d] \ar[r] & y \ar@{..>}[d] \\ z \ar@{..>}[r] & w } $$ in $\mathcal{I}$ there exist an object $w$ and dotted arrows making the diagram commute. Then $\mathcal{I}$ is either empty or a nonempty disjoint union of connected categories having the same property. \end{lemma} \begin{proof} If $\mathcal{I}$ is the empty category, then the lemma is true. Otherwise, we define a relation on objects of $\mathcal{I}$ by saying that $x \sim y$ if there exist a $z$ and morphisms $x \to z$ and $y \to z$. This is an equivalence relation by the assumption of the lemma. Hence $\Ob(\mathcal{I})$ is a disjoint union of equivalence classes. Let $\mathcal{I}_j$ be the full subcategories corresponding to these equivalence classes. Then $\mathcal{I} = \coprod \mathcal{I}_j$ with $\mathcal{I}_j$ nonempty as desired. \end{proof} \begin{lemma} \label{lemma-preserve-injective-maps} Let $\mathcal{I}$ be an index category, i.e., a category. Assume that for every solid diagram $$ \xymatrix{ x \ar[d] \ar[r] & y \ar@{..>}[d] \\ z \ar@{..>}[r] & w } $$ in $\mathcal{I}$ there exist an object $w$ and dotted arrows making the diagram commute. Then \begin{enumerate} \item an injective morphism $M \to N$ of diagrams of sets over $\mathcal{I}$ gives rise to an injective map $\colim M_i \to \colim N_i$ of sets, \item in general the same is not the case for diagrams of abelian groups and their colimits. \end{enumerate} \end{lemma} \begin{proof} If $\mathcal{I}$ is the empty category, then the lemma is true. Thus we may assume $\mathcal{I}$ is nonempty. In this case we can write $\mathcal{I} = \coprod \mathcal{I}_j$ where each $\mathcal{I}_j$ is nonempty and satisfies the same property, see Lemma \ref{lemma-split-into-connected}. Since $\colim_\mathcal{I} M = \coprod_j \colim_{\mathcal{I}_j} M|_{\mathcal{I}_j}$ this reduces the proof of (1) to the connected case. \medskip\noindent Assume $\mathcal{I}$ is connected and $M \to N$ is injective, i.e., all the maps $M_i \to N_i$ are injective. We identify $M_i$ with the image of $M_i \to N_i$, i.e., we will think of $M_i$ as a subset of $N_i$. We will use the description of the colimits given in Section \ref{section-limit-sets} without further mention. Let $s, s' \in \colim M_i$ map to the same element of $\colim N_i$. Say $s$ comes from an element $m$ of $M_i$ and $s'$ comes from an element $m'$ of $M_{i'}$. Then we can find a sequence $i = i_0, i_1, \ldots, i_n = i'$ of objects of $\mathcal{I}$ and morphisms $$ \xymatrix{ & i_1 \ar[ld] \ar[rd] & & i_3 \ar[ld] & & i_{2n-1} \ar[rd] & \\ i = i_0 & & i_2 & & \ldots & & i_{2n} = i' } $$ and elements $n_{i_j} \in N_{i_j}$ mapping to each other under the maps $N_{i_{2k-1}} \to N_{i_{2k-2}}$ and $N_{i_{2k-1}} \to N_{i_{2k}}$ induced from the maps in $\mathcal{I}$ above with $n_{i_0} = m$ and $n_{i_{2n}} = m'$. We will prove by induction on $n$ that this implies $s = s'$. The base case $n = 0$ is trivial. Assume $n \geq 1$. Using the assumption on $\mathcal{I}$ we find a commutative diagram $$ \xymatrix{ & i_1 \ar[ld] \ar[rd] \\ i_0 \ar[rd] & & i_2 \ar[ld] \\ & w } $$ We conclude that $m$ and $n_{i_2}$ map to the same element of $N_w$ because both are the image of the element $n_{i_1}$. In particular, this element is an element $m'' \in M_w$ which gives rise to the same element as $s$ in $\colim M_i$. Then we find the chain $$ \xymatrix{ & i_3 \ar[ld] \ar[rd] & & i_5 \ar[ld] & & i_{2n-1} \ar[rd] & \\ w & & i_4 & & \ldots & & i_{2n} = i' } $$ and the elements $n_{i_j}$ for $j \geq 3$ which has a smaller length than the chain we started with. This proves the induction step and the proof of (1) is complete. \medskip\noindent Let $G$ be a group and let $\mathcal{I}$ be the one-object category with endomorphism monoid $G$. Then $\mathcal{I}$ satisfies the condition stated in the lemma because given $g_1, g_2 \in G$ we can find $h_1, h_2 \in G$ with $h_1 g_1 = h_2 g_2$. An diagram $M$ over $\mathcal{I}$ in $\textit{Ab}$ is the same thing as an abelian group $M$ with $G$-action and $\colim_\mathcal{I} M$ is the coinvariants $M_G$ of $M$. Take $G$ the group of order $2$ acting trivially on $M = \mathbf{Z}/2\mathbf{Z}$ mapping into the first summand of $N = \mathbf{Z}/2\mathbf{Z} \times \mathbf{Z}/2\mathbf{Z}$ where the nontrivial element of $G$ acts by $(x, y) \mapsto (x + y, y)$. Then $M_G \to N_G$ is zero. \end{proof} \begin{lemma} \label{lemma-split-into-directed} Let $\mathcal{I}$ be an index category, i.e., a category. Assume \begin{enumerate} \item for every pair of morphisms $a : w \to x$ and $b : w \to y$ in $\mathcal{I}$ there exist an object $z$ and morphisms $c : x \to z$ and $d : y \to z$ such that $c \circ a = d \circ b$, and \item for every pair of morphisms $a, b : x \to y$ there exists a morphism $c : y \to z$ such that $c \circ a = c \circ b$. \end{enumerate} Then $\mathcal{I}$ is a (possibly empty) union of disjoint filtered index categories $\mathcal{I}_j$. \end{lemma} \begin{proof} If $\mathcal{I}$ is the empty category, then the lemma is true. Otherwise, we define a relation on objects of $\mathcal{I}$ by saying that $x \sim y$ if there exist a $z$ and morphisms $x \to z$ and $y \to z$. This is an equivalence relation by the first assumption of the lemma. Hence $\Ob(\mathcal{I})$ is a disjoint union of equivalence classes. Let $\mathcal{I}_j$ be the full subcategories corresponding to these equivalence classes. The rest is clear from the definitions. \end{proof} \begin{lemma} \label{lemma-almost-directed-commutes-equalizers} Let $\mathcal{I}$ be an index category satisfying the hypotheses of Lemma \ref{lemma-split-into-directed} above. Then colimits over $\mathcal{I}$ commute with fibre products and equalizers in sets (and more generally with finite connected limits). \end{lemma} \begin{proof} By Lemma \ref{lemma-split-into-directed} we may write $\mathcal{I} = \coprod \mathcal{I}_j$ with each $\mathcal{I}_j$ filtered. By Lemma \ref{lemma-directed-commutes} we see that colimits of $\mathcal{I}_j$ commute with equalizers and fibre products. Thus it suffices to show that equalizers and fibre products commute with coproducts in the category of sets (including empty coproducts). In other words, given a set $J$ and sets $A_j, B_j, C_j$ and set maps $A_j \to B_j$, $C_j \to B_j$ for $j \in J$ we have to show that $$ (\coprod\nolimits_{j \in J} A_j) \times_{(\coprod\nolimits_{j \in J} B_j)} (\coprod\nolimits_{j \in J} C_j) = \coprod\nolimits_{j \in J} A_j \times_{B_j} C_j $$ and given $a_j, a'_j : A_j \to B_j$ that $$ \text{Equalizer}( \coprod\nolimits_{j \in J} a_j, \coprod\nolimits_{j \in J} a'_j) = \coprod\nolimits_{j \in J} \text{Equalizer}(a_j, a'_j) $$ This is true even if $J = \emptyset$. Details omitted. \end{proof} \section{Cofiltered limits} \label{section-codirected-limits} \noindent Limits are easier to compute or describe when they are over a cofiltered diagram. Here is the definition. \begin{definition} \label{definition-codirected} We say that a diagram $M : \mathcal{I} \to \mathcal{C}$ is {\it codirected} or {\it cofiltered} if the following conditions hold: \begin{enumerate} \item the category $\mathcal{I}$ has at least one object, \item for every pair of objects $x, y$ of $\mathcal{I}$ there exist an object $z$ and morphisms $z \to x$, $z \to y$, and \item for every pair of objects $x, y$ of $\mathcal{I}$ and every pair of morphisms $a, b : x \to y$ of $\mathcal{I}$ there exists a morphism $c : w \to x$ of $\mathcal{I}$ such that $M(a \circ c) = M(b \circ c)$ as morphisms in $\mathcal{C}$. \end{enumerate} We say that an index category $\mathcal{I}$ is {\it codirected}, or {\it cofiltered} if $\text{id} : \mathcal{I} \to \mathcal{I}$ is cofiltered (in other words you erase the $M$ in part (3) above). \end{definition} \noindent We observe that any diagram with cofiltered index category is cofiltered, and this is how this situation usually occurs. \medskip\noindent As an example of why cofiltered limits of sets are ``easier'' than general ones, we mention the fact that a cofiltered diagram of finite nonempty sets has nonempty limit (Lemma \ref{lemma-nonempty-limit}). This result does not hold for a general limit of finite nonempty sets. \section{Limits and colimits over preordered sets} \label{section-posets-limits} \noindent A special case of diagrams is given by systems over preordered sets. \begin{definition} \label{definition-directed-set} Let $I$ be a set and let $\leq$ be a binary relation on $I$. \begin{enumerate} \item We say $\leq$ is a {\it preorder} if it is transitive (if $i \leq j$ and $j \leq k$ then $i \leq k$) and reflexive ($i \leq i$ for all $i \in I$). \item A {\it preordered set} is a set endowed with a preorder. \item A {\it directed set} is a preordered set $(I, \leq)$ such that $I$ is not empty and such that $\forall i, j \in I$, there exists $k \in I$ with $i \leq k, j \leq k$. \item We say $\leq$ is a {\it partial order} if it is a preorder which is antisymmetric (if $i \leq j$ and $j \leq i$, then $i = j$). \item A {\it partially ordered set} is a set endowed with a partial order. \item A {\it directed partially ordered set} is a directed set whose ordering is a partial order. \end{enumerate} \end{definition} \noindent It is customary to drop the $\leq$ from the notation when talking about preordered sets, that is, one speaks of the preordered set $I$ rather than of the preordered set $(I, \leq)$. Given a preordered set $I$ the symbol $\geq$ is defined by the rule $i \geq j \Leftrightarrow j \leq i$ for all $i, j \in I$. The phrase ``partially ordered set'' is sometimes abbreviated to ``poset''. \medskip\noindent Given a preordered set $I$ we can construct a category: the objects are the elements of $I$, there is exactly one morphism $i \to i'$ if $i \leq i'$, and otherwise none. Conversely, given a category $\mathcal{C}$ with at most one arrow between any two objects, the set $\Ob(\mathcal{C})$ is endowed with a preorder defined by the rule $x \leq y \Leftrightarrow \Mor_\mathcal{C}(x, y) \not = \emptyset$. \begin{definition} \label{definition-system-over-poset} Let $(I, \leq)$ be a preordered set. Let $\mathcal{C}$ be a category. \begin{enumerate} \item A {\it system over $I$ in $\mathcal{C}$}, sometimes called a {\it inductive system over $I$ in $\mathcal{C}$} is given by objects $M_i$ of $\mathcal{C}$ and for every $i \leq i'$ a morphism $f_{ii'} : M_i \to M_{i'}$ such that $f_{ii} = \text{id}$ and such that $f_{ii''} = f_{i'i''} \circ f_{i i'}$ whenever $i \leq i' \leq i''$. \item An {\it inverse system over $I$ in $\mathcal{C}$}, sometimes called a {\it projective system over $I$ in $\mathcal{C}$} is given by objects $M_i$ of $\mathcal{C}$ and for every $i' \leq i$ a morphism $f_{ii'} : M_i \to M_{i'}$ such that $f_{ii} = \text{id}$ and such that $f_{ii''} = f_{i'i''} \circ f_{i i'}$ whenever $i'' \leq i' \leq i$. (Note reversal of inequalities.) \end{enumerate} We will say $(M_i, f_{ii'})$ is a (inverse) system over $I$ to denote this. The maps $f_{ii'}$ are sometimes called the {\it transition maps}. \end{definition} \noindent In other words a system over $I$ is just a diagram $M : \mathcal{I} \to \mathcal{C}$ where $\mathcal{I}$ is the category we associated to $I$ above: objects are elements of $I$ and there is a unique arrow $i \to i'$ in $\mathcal{I}$ if and only if $i \leq i'$. An inverse system is a diagram $M : \mathcal{I}^{opp} \to \mathcal{C}$. From this point of view we could take (co)limits of any (inverse) system over $I$. However, it is customary to take {\it only colimits of systems over $I$} and {\it only limits of inverse systems over $I$}. More precisely: Given a system $(M_i, f_{ii'})$ over $I$ the colimit of the system $(M_i, f_{ii'})$ is defined as $$ \colim_{i \in I} M_i = \colim_\mathcal{I} M, $$ i.e., as the colimit of the corresponding diagram. Given a inverse system $(M_i, f_{ii'})$ over $I$ the limit of the inverse system $(M_i, f_{ii'})$ is defined as $$ \lim_{i \in I} M_i = \lim_{\mathcal{I}^{opp}} M, $$ i.e., as the limit of the corresponding diagram. \begin{remark} \label{remark-preorder-versus-partial-order} Let $I$ be a preordered set. From $I$ we can construct a canonical partially ordered set $\overline{I}$ and an order preserving map $\pi : I \to \overline{I}$. Namely, we can define an equivalence relation $\sim$ on $I$ by the rule $$ i \sim j \Leftrightarrow (i \leq j\text{ and }j \leq i). $$ We set $\overline{I} = I/\sim$ and we let $\pi : I \to \overline{I}$ be the quotient map. Finally, $\overline{I}$ comes with a unique partial ordering such that $\pi(i) \leq \pi(j) \Leftrightarrow i \leq j$. Observe that if $I$ is a directed set, then $\overline{I}$ is a directed partially ordered set. Given an (inverse) system $N$ over $\overline{I}$ we obtain an (inverse) system $M$ over $I$ by setting $M_i = N_{\pi(i)}$. This construction defines a functor between the category of inverse systems over $I$ and $\overline{I}$. In fact, this is an equivalence. The reason is that if $i \sim j$, then for any system $M$ over $I$ the maps $M_i \to M_j$ and $M_j \to M_i$ are mutually inverse isomorphisms. More precisely, choosing a section $s : \overline{I} \to I$ of $\pi$ a quasi-inverse of the functor above sends $M$ to $N$ with $N_{\overline{i}} = M_{s(\overline{i})}$. Finally, this correspondence is compatible with colimits of systems: if $M$ and $N$ are related as above and if either $\colim_{\overline{I}} N$ or $\colim_I M$ exists then so does the other and $\colim_{\overline{I}} N = \colim_I M$. Similar results hold for inverse systems and limits of inverse systems. \end{remark} \noindent The upshot of Remark \ref{remark-preorder-versus-partial-order} is that while computing a colimit of a system or a limit of an inverse system, we may always assume the preorder is a partial order. \begin{definition} \label{definition-directed-system} Let $I$ be a preordered set. We say a system (resp.\ inverse system) $(M_i, f_{ii'})$ is a {\it directed system} (resp.\ {\it directed inverse system}) if $I$ is a directed set (Definition \ref{definition-directed-set}): $I$ is nonempty and for all $i_1, i_2 \in I$ there exists $i\in I$ such that $i_1 \leq i$ and $i_2 \leq i$. \end{definition} \noindent In this case the colimit is sometimes (unfortunately) called the ``direct limit''. We will not use this last terminology. It turns out that diagrams over a filtered category are no more general than directed systems in the following sense. \begin{lemma} \label{lemma-directed-category-system} Let $\mathcal{I}$ be a filtered index category. There exist a directed set $I$ and a system $(x_i, \varphi_{ii'})$ over $I$ in $\mathcal{I}$ with the following properties: \begin{enumerate} \item For every category $\mathcal{C}$ and every diagram $M : \mathcal{I} \to \mathcal{C}$ with values in $\mathcal{C}$, denote $(M(x_i), M(\varphi_{ii'}))$ the corresponding system over $I$. If $\colim_{i \in I} M(x_i)$ exists then so does $\colim_\mathcal{I} M$ and the transformation $$ \theta : \colim_{i \in I} M(x_i) \longrightarrow \colim_\mathcal{I} M $$ of Lemma \ref{lemma-functorial-colimit} is an isomorphism. \item For every category $\mathcal{C}$ and every diagram $M : \mathcal{I}^{opp} \to \mathcal{C}$ in $\mathcal{C}$, denote $(M(x_i), M(\varphi_{ii'}))$ the corresponding inverse system over $I$. If $\lim_{i \in I} M(x_i)$ exists then so does $\lim_\mathcal{I} M$ and the transformation $$ \theta : \lim_{\mathcal{I}^{opp}} M \longrightarrow \lim_{i \in I} M(x_i) $$ of Lemma \ref{lemma-functorial-limit} is an isomorphism. \end{enumerate} \end{lemma} \begin{proof} As explained in the text following Definition \ref{definition-system-over-poset}, we may view preordered sets as categories and systems as functors. Throughout the proof, we will freely shift between these two points of view. We prove the first statement by constructing a category $\mathcal{I}_0$, corresponding to a directed set\footnote{In fact, our construction will produce a directed partially ordered set.}, and a cofinal functor $M_0 : \mathcal{I}_0 \to \mathcal{I}$. Then, by Lemma \ref{lemma-cofinal}, the colimit of a diagram $M : \mathcal{I} \to \mathcal{C}$ coincides with the colimit of the diagram $M \circ M_0 : \mathcal{I}_0 \to \mathcal{C}$, from which the statement follows. The second statement is dual to the first and may be proved by interpreting a limit in $\mathcal{C}$ as a colimit in $\mathcal{C}^{opp}$. We omit the details. \medskip\noindent A category $\mathcal{F}$ is called {\em finitely generated} if there exists a finite set $F$ of arrows in $\mathcal{F}$, such that each arrow in $\mathcal{F}$ may be obtained by composing arrows from $F$. In particular, this implies that $\mathcal{F}$ has finitely many objects. We start the proof by reducing to the case when $\mathcal{I}$ has the property that every finitely generated subcategory of $\mathcal{I}$ may be extended to a finitely generated subcategory with a unique final object. \medskip\noindent Let $\omega$ denote the directed set of finite ordinals, which we view as a filtered category. It is easy to verify that the product category $\mathcal{I}\times \omega$ is also filtered, and the projection $\Pi : \mathcal{I} \times \omega \to \mathcal{I}$ is cofinal. \medskip\noindent Now let $\mathcal{F}$ be any finitely generated subcategory of $\mathcal{I}\times \omega$. By using the axioms of a filtered category and a simple induction argument on a finite set of generators of $\mathcal{F}$, we may construct a cocone $(\{f_i\}, i_\infty)$ in $\mathcal{I}$ for the diagram $\mathcal{F} \to \mathcal{I}$. That is, a morphism $f_i : i \to i_\infty$ for every object $i$ in $\mathcal{F}$ such that for each arrow $f : i \to i'$ in $\mathcal{F}$ we have $f_i = f\circ f_{i'}$. We can also choose $i_\infty$ such that there are no arrows from $i_\infty$ to an object in $\mathcal{F}$. This is possible since we may always post-compose the arrows $f_i$ with an arrow which is the identity on the $\mathcal{I}$-component and strictly increasing on the $\omega$-component. Now let $\mathcal{F}^+$ denote the category consisting of all objects and arrows in $\mathcal{F}$ together with the object $i_\infty$, the identity arrow $\text{id}_{i_\infty}$ and the arrows $f_i$. Since there are no arrows from $i_\infty$ in $\mathcal{F}^+$ to any object of $\mathcal{F}$, the arrow set in $\mathcal{F}^+$ is closed under composition, so $\mathcal{F}^+$ is indeed a category. By construction, it is a finitely generated subcategory of $\mathcal{I}$ which has $i_\infty$ as unique final object. Since, by Lemma \ref{lemma-cofinal}, the colimit of any diagram $M : \mathcal{I} \to \mathcal{C}$ coincides with the colimit of $M\circ\Pi$ , this gives the desired reduction. \medskip\noindent The set of all finitely generated subcategories of $\mathcal{I}$ with a unique final object is naturally ordered by inclusion. We take $\mathcal{I}_0$ to be the category corresponding to this set. We also have a functor $M_0 : \mathcal{I}_0 \to \mathcal{I}$, which takes an arrow $\mathcal{F} \subset \mathcal{F'}$ in $\mathcal{I}_0$ to the unique map from the final object of $\mathcal{F}$ to the final object of $\mathcal{F}'$. Given any two finitely generated subcategories of $\mathcal{I}$, the category generated by these two categories is also finitely generated. By our assumption on $\mathcal{I}$, it is also contained in a finitely generated subcategory of $\mathcal{I}$ with a unique final object. This shows that $\mathcal{I}_0$ is directed. \medskip\noindent Finally, we verify that $M_0$ is cofinal. Since any object of $\mathcal{I}$ is the final object in the subcategory consisting of only that object and its identity arrow, the functor $M_0$ is surjective on objects. In particular, Condition (1) of Definition \ref{definition-cofinal} is satisfied. Given an object $i$ of $\mathcal{I}$, objects $\mathcal{F}_1, \mathcal{F}_2$ in $\mathcal{I}_0$ and maps $\varphi_1 : i \to M_0(\mathcal{F}_1)$ and $\varphi_2 : i \to M_0(\mathcal{F}_2)$ in $\mathcal{I}$, we can take $\mathcal{F}_{12}$ to be a finitely generated category with a unique final object containing $\mathcal{F}_1$, $\mathcal{F}_2$ and the morphisms $\varphi_1, \varphi_2$. The resulting diagram commutes $$ \xymatrix{ & M_0(\mathcal{F}_{12}) & \\ M_0(\mathcal{F}_{1}) \ar[ru] & & M_0(\mathcal{F}_{2}) \ar[lu] \\ & i \ar[lu] \ar[ru] } $$ since it lives in the category $\mathcal{F}_{12}$ and $M_0(\mathcal{F}_{12})$ is final in this category. Hence also Condition (2) is satisfied, which concludes the proof. \end{proof} \begin{remark} \label{remark-trick-needed} Note that a finite directed set $(I, \geq)$ always has a greatest object $i_\infty$. Hence any colimit of a system $(M_i, f_{ii'})$ over such a set is trivial in the sense that the colimit equals $M_{i_\infty}$. In contrast, a colimit indexed by a finite filtered category need not be trivial. For instance, let $\mathcal{I}$ be the category with a single object $i$ and a single non-trivial morphism $e$ satisfying $e = e \circ e$. The colimit of a diagram $M : \mathcal{I} \to Sets$ is the image of the idempotent $M(e)$. This illustrates that something like the trick of passing to $\mathcal{I}\times \omega$ in the proof of Lemma \ref{lemma-directed-category-system} is essential. \end{remark} \begin{lemma} \label{lemma-nonempty-limit} If $S : \mathcal{I} \to \textit{Sets}$ is a cofiltered diagram of sets and all the $S_i$ are finite nonempty, then $\lim_i S_i$ is nonempty. In other words, the limit of a directed inverse system of finite nonempty sets is nonempty. \end{lemma} \begin{proof} The two statements are equivalent by Lemma \ref{lemma-directed-category-system}. Let $I$ be a directed set and let $(S_i)_{i \in I}$ be an inverse system of finite nonempty sets over $I$. Let us say that a {\it subsystem} $T$ is a family $T = (T_i)_{i \in I}$ of nonempty subsets $T_i \subset S_i$ such that $T_{i'}$ is mapped into $T_i$ by the transition map $S_{i'} \to S_i$ for all $i' \geq i$. Denote $\mathcal{T}$ the set of subsystems. We order $\mathcal{T}$ by inclusion. Suppose $T_\alpha$, $\alpha \in A$ is a totally ordered family of elements of $\mathcal{T}$. Say $T_\alpha = (T_{\alpha, i})_{i \in I}$. Then we can find a lower bound $T = (T_i)_{i \in I}$ by setting $T_i = \bigcap_{\alpha \in A} T_{\alpha, i}$ which is manifestly a finite nonempty subset of $S_i$ as all the $T_{\alpha, i}$ are nonempty and as the $T_\alpha$ form a totally ordered family. Thus we may apply Zorn's lemma to see that $\mathcal{T}$ has minimal elements. \medskip\noindent Let's analyze what a minimal element $T \in \mathcal{T}$ looks like. First observe that the maps $T_{i'} \to T_i$ are all surjective. Namely, as $I$ is a directed set and $T_i$ is finite, the intersection $T'_i = \bigcap_{i' \geq i} \Im(T_{i'} \to T_i)$ is nonempty. Thus $T' = (T'_i)$ is a subsystem contained in $T$ and by minimality $T' = T$. Finally, we claim that $T_i$ is a singleton for each $i$. Namely, if $x \in T_i$, then we can define $T'_{i'} = (T_{i'} \to T_i)^{-1}(\{x\})$ for $i' \geq i$ and $T'_j = T_j$ if $j \not \geq i$. This is another subsystem as we've seen above that the transition maps of the subsystem $T$ are surjective. By minimality we see that $T = T'$ which indeed implies that $T_i$ is a singleton. This holds for every $i \in I$, hence we see that $T_i = \{x_i\}$ for some $x_i \in S_i$ with $x_{i'} \mapsto x_i$ under the map $S_{i'} \to S_i$ for every $i' \geq i$. In other words, $(x_i) \in \lim S_i$ and the lemma is proved. \end{proof} \section{Essentially constant systems} \label{section-essentially-constant} \noindent Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram in a category $\mathcal{C}$. Assume the index category $\mathcal{I}$ is filtered. In this case there are three successively stronger notions which pick out an object $X$ of $\mathcal{C}$. The first is just $$ X = \colim_{i \in \mathcal{I}} M_i. $$ Then $X$ comes equipped with the coprojections $M_i \to X$. A stronger condition would be to require that $X$ is the colimit and that there exist an $i \in \mathcal{I}$ and a morphism $X \to M_i$ such that the composition $X \to M_i \to X$ is $\text{id}_X$. An even stronger condition is the following. \begin{definition} \label{definition-essentially-constant-diagram} Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram in a category $\mathcal{C}$. \begin{enumerate} \item Assume the index category $\mathcal{I}$ is filtered and let $(X, \{M_i \to X\}_i)$ be a cocone for $M$, see Remark \ref{remark-cones-and-cocones}. We say $M$ is {\it essentially constant} with {\it value} $X$ if there exist an $i \in \mathcal{I}$ and a morphism $X \to M_i$ such that \begin{enumerate} \item $X \to M_i \to X$ is $\text{id}_X$, and \item for all $j$ there exist $k$ and morphisms $i \to k$ and $j \to k$ such that the morphism $M_j \to M_k$ equals the composition $M_j \to X \to M_i \to M_k$. \end{enumerate} \item Assume the index category $\mathcal{I}$ is cofiltered and let $(X, \{X \to M_i\}_i)$ be a cone for $M$, see Remark \ref{remark-cones-and-cocones}. We say $M$ is {\it essentially constant} with {\it value} $X$ if there exist an $i \in \mathcal{I}$ and a morphism $M_i \to X$ such that \begin{enumerate} \item $X \to M_i \to X$ is $\text{id}_X$, and \item for all $j$ there exist $k$ and morphisms $k \to i$ and $k \to j$ such that the morphism $M_k \to M_j$ equals the composition $M_k \to M_i \to X \to M_j$. \end{enumerate} \end{enumerate} Please keep in mind Lemma \ref{lemma-essentially-constant-is-limit-colimit} when using this definition. \end{definition} \noindent Which of the two versions is meant will be clear from context. If there is any confusion we will distinguish between these by saying that the first version means $M$ is essentially constant as an {\it ind-object}, and in the second case we will say it is essentially constant as a {\it pro-object}. This terminology is further explained in Remarks \ref{remark-ind-category} and \ref{remark-pro-category}. In fact we will often use the terminology ``essentially constant system'' which formally speaking is only defined for systems over directed sets. \begin{definition} \label{definition-essentially-constant-system} Let $\mathcal{C}$ be a category. A directed system $(M_i, f_{ii'})$ is an {\it essentially constant system} if $M$ viewed as a functor $I \to \mathcal{C}$ defines an essentially constant diagram. A directed inverse system $(M_i, f_{ii'})$ is an {\it essentially constant inverse system} if $M$ viewed as a functor $I^{opp} \to \mathcal{C}$ defines an essentially constant inverse diagram. \end{definition} \noindent If $(M_i, f_{ii'})$ is an essentially constant system and the morphisms $f_{ii'}$ are monomorphisms, then for all $i \leq i'$ sufficiently large the morphisms $f_{ii'}$ are isomorphisms. On the other hand, consider the system $$ \mathbf{Z}^2 \to \mathbf{Z}^2 \to \mathbf{Z}^2 \to \ldots $$ with maps given by $(a, b) \mapsto (a + b, 0)$. This system is essentially constant with value $\mathbf{Z}$ but every transition map has a kernel. \medskip\noindent Here is an example of a system which is not essentially constant. Let $M = \bigoplus_{n \geq 0} \mathbf{Z}$ and to let $S : M \to M$ be the shift operator $(a_0, a_1, \ldots) \mapsto (a_1, a_2, \ldots)$. In this case the system $M \to M \to M \to \ldots$ with transition maps $S$ has colimit $0$ and the composition $0 \to M \to 0$ is the identity, but the system is not essentially constant. \medskip\noindent The following lemma is a sanity check. \begin{lemma} \label{lemma-essentially-constant-is-limit-colimit} Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram. If $\mathcal{I}$ is filtered and $M$ is essentially constant as an ind-object, then $X = \colim M_i$ exists and $M$ is essentially constant with value $X$. If $\mathcal{I}$ is cofiltered and $M$ is essentially constant as a pro-object, then $X = \lim M_i$ exists and $M$ is essentially constant with value $X$. \end{lemma} \begin{proof} Omitted. This is a good excercise in the definitions. \end{proof} \begin{remark} \label{remark-ind-category} Let $\mathcal{C}$ be a category. There exists a big category $\text{Ind-}\mathcal{C}$ of {\it ind-objects of} $\mathcal{C}$. Namely, if $F : \mathcal{I} \to \mathcal{C}$ and $G : \mathcal{J} \to \mathcal{C}$ are filtered diagrams in $\mathcal{C}$, then we can define $$ \Mor_{\text{Ind-}\mathcal{C}}(F, G) = \lim_i \colim_j \Mor_\mathcal{C}(F(i), G(j)). $$ There is a canonical functor $\mathcal{C} \to \text{Ind-}\mathcal{C}$ which maps $X$ to the {\it constant system} on $X$. This is a fully faithful embedding. In this language one sees that a diagram $F$ is essentially constant if and only if $F$ is isomorphic to a constant system. If we ever need this material, then we will formulate this into a lemma and prove it here. \end{remark} \begin{remark} \label{remark-pro-category} Let $\mathcal{C}$ be a category. There exists a big category $\text{Pro-}\mathcal{C}$ of {\it pro-objects} of $\mathcal{C}$. Namely, if $F : \mathcal{I} \to \mathcal{C}$ and $G : \mathcal{J} \to \mathcal{C}$ are cofiltered diagrams in $\mathcal{C}$, then we can define $$ \Mor_{\text{Pro-}\mathcal{C}}(F, G) = \lim_j \colim_i \Mor_\mathcal{C}(F(i), G(j)). $$ There is a canonical functor $\mathcal{C} \to \text{Pro-}\mathcal{C}$ which maps $X$ to the {\it constant system} on $X$. This is a fully faithful embedding. In this language one sees that a diagram $F$ is essentially constant if and only if $F$ is isomorphic to a constant system. If we ever need this material, then we will formulate this into a lemma and prove it here. \end{remark} \begin{example} \label{example-pro-morphism-inverse-systems} Let $\mathcal{C}$ be a category. Let $(X_n)$ and $(Y_n)$ be inverse systems in $\mathcal{C}$ over $\mathbf{N}$ with the usual ordering. Picture: $$ \ldots \to X_3 \to X_2 \to X_1 \quad\text{and}\quad \ldots \to Y_3 \to Y_2 \to Y_1 $$ Let $a : (X_n) \to (Y_n)$ be a morphism of pro-objects of $\mathcal{C}$. What does $a$ amount to? Well, for each $n \in \mathbf{N}$ there should exist an $m(n)$ and a morphism $a_n : X_{m(n)} \to Y_n$. These morphisms ought to agree in the following sense: for all $n' \geq n$ there exists an $m(n', n) \geq m(n'), m(n)$ such that the diagram $$ \xymatrix{ X_{m(n, n')} \ar[rr] \ar[d] & & X_{m(n)} \ar[d]^{a_n} \\ X_{m(n')} \ar[r]^{a_{n'}} & Y_{n'} \ar[r] & Y_n } $$ commutes. After replacing $m(n)$ by $\max_{k, l \leq n}\{m(n, k), m(k, l)\}$ we see that we obtain $\ldots \geq m(3) \geq m(2) \geq m(1)$ and a commutative diagram $$ \xymatrix{ \ldots \ar[r] & X_{m(3)} \ar[d]^{a_3} \ar[r] & X_{m(2)} \ar[d]^{a_2} \ar[r] & X_{m(1)} \ar[d]^{a_1} \\ \ldots \ar[r] & Y_3 \ar[r] & Y_2 \ar[r] & Y_1 } $$ Given an increasing map $m' : \mathbf{N} \to \mathbf{N}$ with $m' \geq m$ and setting $a'_i : X_{m'(i)} \to X_{m(i)} \to Y_i$ the pair $(m', a')$ defines the same morphism of pro-systems. Conversely, given two pairs $(m_1, a_1)$ and $(m_1, a_2)$ as above then these define the same morphism of pro-objects if and only if we can find $m' \geq m_1, m_2$ such that $a'_1 = a'_2$. \end{example} \begin{remark} \label{remark-pro-category-copresheaves} Let $\mathcal{C}$ be a category. Let $F : \mathcal{I} \to \mathcal{C}$ and $G : \mathcal{J} \to \mathcal{C}$ be cofiltered diagrams in $\mathcal{C}$. Consider the functors $A, B : \mathcal{C} \to \textit{Sets}$ defined by $$ A(X) = \colim_i \Mor_\mathcal{C}(F(i), X) \quad\text{and}\quad B(X) = \colim_j \Mor_\mathcal{C}(G(j), X) $$ We claim that a morphism of pro-systems from $F$ to $G$ is the same thing as a transformation of functors $t : B \to A$. Namely, given $t$ we can apply $t$ to the class of $\text{id}_{G(j)}$ in $B(G(j))$ to get a compatible system of elements $\xi_j \in A(G(j)) = \colim_i \Mor_\mathcal{C}(F(i), G(j))$ which is exactly our definition of a morphism in $\text{Pro-}\mathcal{C}$ in Remark \ref{remark-pro-category}. We omit the construction of a transformation $B \to A$ given a morphism of pro-objects from $F$ to $G$. \end{remark} \begin{lemma} \label{lemma-image-essentially-constant} Let $\mathcal{C}$ be a category. Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram with filtered (resp.\ cofiltered) index category $\mathcal{I}$. Let $F : \mathcal{C} \to \mathcal{D}$ be a functor. If $M$ is essentially constant as an ind-object (resp.\ pro-object), then so is $F \circ M : \mathcal{I} \to \mathcal{D}$. \end{lemma} \begin{proof} If $X$ is a value for $M$, then it follows immediately from the definition that $F(X)$ is a value for $F \circ M$. \end{proof} \begin{lemma} \label{lemma-characterize-essentially-constant-ind} Let $\mathcal{C}$ be a category. Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram with filtered index category $\mathcal{I}$. The following are equivalent \begin{enumerate} \item $M$ is an essentially constant ind-object, and \item $X = \colim_i M_i$ exists and for any $W$ in $\mathcal{C}$ the map $$ \colim_i \Mor_\mathcal{C}(W, M_i) \longrightarrow \Mor_\mathcal{C}(W, X) $$ is bijective. \end{enumerate} \end{lemma} \begin{proof} Assume (2) holds. Then $\text{id}_X \in \Mor_\mathcal{C}(X, X)$ comes from a morphism $X \to M_i$ for some $i$, i.e., $X \to M_i \to X$ is the identity. Then both maps $$ \Mor_\mathcal{C}(W, X) \longrightarrow \colim_i \Mor_\mathcal{C}(W, M_i) \longrightarrow \Mor_\mathcal{C}(W, X) $$ are bijective for all $W$ where the first one is induced by the morphism $X \to M_i$ we found above, and the composition is the identity. This means that the composition $$ \colim_i \Mor_\mathcal{C}(W, M_i) \longrightarrow \Mor_\mathcal{C}(W, X) \longrightarrow \colim_i \Mor_\mathcal{C}(W, M_i) $$ is the identity too. Setting $W = M_j$ and starting with $\text{id}_{M_j}$ in the colimit, we see that $M_j \to X \to M_i \to M_k$ is equal to $M_j \to M_k$ for some $k$ large enough. This proves (1) holds. The proof of (1) $\Rightarrow$ (2) is omitted. \end{proof} \begin{lemma} \label{lemma-characterize-essentially-constant-pro} Let $\mathcal{C}$ be a category. Let $M : \mathcal{I} \to \mathcal{C}$ be a diagram with cofiltered index category $\mathcal{I}$. The following are equivalent \begin{enumerate} \item $M$ is an essentially constant pro-object, and \item $X = \lim_i M_i$ exists and for any $W$ in $\mathcal{C}$ the map $$ \colim_{i \in \mathcal{I}^{opp}} \Mor_\mathcal{C}(M_i, W) \longrightarrow \Mor_\mathcal{C}(X, W) $$ is bijective. \end{enumerate} \end{lemma} \begin{proof} Assume (2) holds. Then $\text{id}_X \in \Mor_\mathcal{C}(X, X)$ comes from a morphism $M_i \to X$ for some $i$, i.e., $X \to M_i \to X$ is the identity. Then both maps $$ \Mor_\mathcal{C}(X, W) \longrightarrow \colim_i \Mor_\mathcal{C}(M_i, W) \longrightarrow \Mor_\mathcal{C}(X, W) $$ are bijective for all $W$ where the first one is induced by the morphism $M_i \to X$ we found above, and the composition is the identity. This means that the composition $$ \colim_i \Mor_\mathcal{C}(M_i, W) \longrightarrow \Mor_\mathcal{C}(X, W) \longrightarrow \colim_i \Mor_\mathcal{C}(M_i, W) $$ is the identity too. Setting $W = M_j$ and starting with $\text{id}_{M_j}$ in the colimit, we see that $M_k \to M_i \to X \to M_j$ is equal to $M_k \to M_j$ for some $k$ large enough. This proves (1) holds. The proof of (1) $\Rightarrow$ (2) is omitted. \end{proof} \begin{lemma} \label{lemma-cofinal-essentially-constant} Let $\mathcal{C}$ be a category. Let $H : \mathcal{I} \to \mathcal{J}$ be a functor of filtered index categories. If $H$ is cofinal, then any diagram $M : \mathcal{J} \to \mathcal{C}$ is essentially constant if and only if $M \circ H$ is essentially constant. \end{lemma} \begin{proof} This follows formally from Lemmas \ref{lemma-characterize-essentially-constant-ind} and \ref{lemma-cofinal}. \end{proof} \begin{lemma} \label{lemma-essentially-constant-over-product} Let $\mathcal{I}$ and $\mathcal{J}$ be filtered categories and denote $p : \mathcal{I} \times \mathcal{J} \to \mathcal{J}$ the projection. Then $\mathcal{I} \times \mathcal{J}$ is filtered and a diagram $M : \mathcal{J} \to \mathcal{C}$ is essentially constant if and only if $M \circ p : \mathcal{I} \times \mathcal{J} \to \mathcal{C}$ is essentially constant. \end{lemma} \begin{proof} We omit the verification that $\mathcal{I} \times \mathcal{J}$ is filtered. The equivalence follows from Lemma \ref{lemma-cofinal-essentially-constant} because $p$ is cofinal (verification omitted). \end{proof} \begin{lemma} \label{lemma-initial-essentially-constant} Let $\mathcal{C}$ be a category. Let $H : \mathcal{I} \to \mathcal{J}$ be a functor of cofiltered index categories. If $H$ is initial, then any diagram $M : \mathcal{J} \to \mathcal{C}$ is essentially constant if and only if $M \circ H$ is essentially constant. \end{lemma} \begin{proof} This follows formally from Lemmas \ref{lemma-characterize-essentially-constant-pro}, \ref{lemma-initial}, \ref{lemma-cofinal}, and the fact that if $\mathcal{I}$ is initial in $\mathcal{J}$, then $\mathcal{I}^{opp}$ is cofinal in $\mathcal{J}^{opp}$. \end{proof} \section{Exact functors} \label{section-exact-functor} \noindent In this section we define exact functors. \begin{definition} \label{definition-exact} Let $F : \mathcal{A} \to \mathcal{B}$ be a functor. \begin{enumerate} \item Suppose all finite limits exist in $\mathcal{A}$. We say $F$ is {\it left exact} if it commutes with all finite limits. \item Suppose all finite colimits exist in $\mathcal{A}$. We say $F$ is {\it right exact} if it commutes with all finite colimits. \item We say $F$ is {\it exact} if it is both left and right exact. \end{enumerate} \end{definition} \begin{lemma} \label{lemma-characterize-left-exact} Let $F : \mathcal{A} \to \mathcal{B}$ be a functor. Suppose all finite limits exist in $\mathcal{A}$, see Lemma \ref{lemma-finite-limits-exist}. The following are equivalent: \begin{enumerate} \item $F$ is left exact, \item $F$ commutes with finite products and equalizers, and \item $F$ transforms a final object of $\mathcal{A}$ into a final object of $\mathcal{B}$, and commutes with fibre products. \end{enumerate} \end{lemma} \begin{proof} Lemma \ref{lemma-limits-products-equalizers} shows that (2) implies (1). Suppose (3) holds. The fibre product over the final object is the product. If $a, b : A \to B$ are morphisms of $\mathcal{A}$, then the equalizer of $a, b$ is $$ (A \times_{a, B, b} A)\times_{(\text{pr}_1, \text{pr}_2), A \times A, \Delta} A. $$ Thus (3) implies (2). Finally (1) implies (3) because the empty limit is a final object, and fibre products are limits. \end{proof} \begin{lemma} \label{lemma-characterize-right-exact} Let $F : \mathcal{A} \to \mathcal{B}$ be a functor. Suppose all finite colimits exist in $\mathcal{A}$, see Lemma \ref{lemma-colimits-exist}. The following are equivalent: \begin{enumerate} \item $F$ is right exact, \item $F$ commutes with finite coproducts and coequalizers, and \item $F$ transforms an initial object of $\mathcal{A}$ into an initial object of $\mathcal{B}$, and commutes with pushouts. \end{enumerate} \end{lemma} \begin{proof} Dual to Lemma \ref{lemma-characterize-left-exact}. \end{proof} \section{Adjoint functors} \label{section-adjoint} \begin{definition} \label{definition-adjoint} Let $\mathcal{C}$, $\mathcal{D}$ be categories. Let $u : \mathcal{C} \to \mathcal{D}$ and $v : \mathcal{D} \to \mathcal{C}$ be functors. We say that $u$ is a {\it left adjoint} of $v$, or that $v$ is a {\it right adjoint} to $u$ if there are bijections $$ \Mor_\mathcal{D}(u(X), Y) \longrightarrow \Mor_\mathcal{C}(X, v(Y)) $$ functorial in $X \in \Ob(\mathcal{C})$, and $Y \in \Ob(\mathcal{D})$. \end{definition} \noindent In other words, this means that there is a {\it given} isomorphism of functors $\mathcal{C}^{opp} \times \mathcal{D} \to \textit{Sets}$ from $\Mor_\mathcal{D}(u(-), -)$ to $\Mor_\mathcal{C}(-, v(-))$. For any object $X$ of $\mathcal{C}$ we obtain a morphism $X \to v(u(X))$ corresponding to $\text{id}_{u(X)}$. Similarly, for any object $Y$ of $\mathcal{D}$ we obtain a morphism $u(v(Y)) \to Y$ corresponding to $\text{id}_{v(Y)}$. These maps are called the {\it adjunction maps}. The adjunction maps are functorial in $X$ and $Y$, hence we obtain morphisms of functors $$ \eta : \text{id}_\mathcal{C} \to v \circ u\quad (\text{unit}) \quad\text{and}\quad \epsilon : u \circ v \to \text{id}_\mathcal{D}\quad (\text{counit}). $$ Moreover, if $\alpha : u(X) \to Y$ and $\beta : X \to v(Y)$ are morphisms, then the following are equivalent \begin{enumerate} \item $\alpha$ and $\beta$ correspond to each other via the bijection of the definition, \item $\beta$ is the composition $X \to v(u(X)) \xrightarrow{v(\alpha)} v(Y)$, and \item $\alpha$ is the composition $u(X) \xrightarrow{u(\beta)} u(v(Y)) \to Y$. \end{enumerate} In this way one can reformulate the notion of adjoint functors in terms of adjunction maps. \begin{lemma} \label{lemma-adjoint-exists} Let $u : \mathcal{C} \to \mathcal{D}$ be a functor between categories. If for each $y \in \Ob(\mathcal{D})$ the functor $x \mapsto \Mor_\mathcal{D}(u(x), y)$ is representable, then $u$ has a right adjoint. \end{lemma} \begin{proof} For each $y$ choose an object $v(y)$ and an isomorphism $\Mor_\mathcal{C}(-, v(y)) \to \Mor_\mathcal{D}(u(-), y)$ of functors. By Yoneda's lemma (Lemma \ref{lemma-yoneda}) for any morphism $g : y \to y'$ the transformation of functors $$ \Mor_\mathcal{C}(-, v(y)) \to \Mor_\mathcal{D}(u(-), y) \to \Mor_\mathcal{D}(u(-), y') \to \Mor_\mathcal{C}(-, v(y')) $$ corresponds to a unique morphism $v(g) : v(y) \to v(y')$. We omit the verification that $v$ is a functor and that it is right adjoint to $u$. \end{proof} \begin{lemma} \label{lemma-left-adjoint-composed-fully-faithful} \begin{reference} Bhargav Bhatt, private communication. \end{reference} Let $u$ be a left adjoint to $v$ as in Definition \ref{definition-adjoint}. \begin{enumerate} \item If $v \circ u$ is fully faithful, then $u$ is fully faithful. \item If $u \circ v$ is fully faithful, then $v$ is fully faithful. \end{enumerate} \end{lemma} \begin{proof} Proof of (2). Assume $u \circ v$ is fully faithful. Say we have $X$, $Y$ in $\mathcal{D}$. Then the natural composite map $$ \Mor(X,Y) \to \Mor(v(X),v(Y)) \to \Mor(u(v(X)), u(v(Y))) $$ is a bijection, so $v$ is at least faithful. To show full faithfulness, we must show that the second map above is injective. But the adjunction between $u$ and $v$ says that $$ \Mor(v(X), v(Y)) \to \Mor(u(v(X)), u(v(Y))) \to \Mor(u(v(X)), Y) $$ is a bijection, where the first map is natural one and the second map comes from the counit $u(v(Y)) \to Y$ of the adjunction. So this says that $\Mor(v(X), v(Y)) \to \Mor(u(v(X)), u(v(Y)))$ is also injective, as wanted. The proof of (1) is dual to this. \end{proof} \begin{lemma} \label{lemma-adjoint-fully-faithful} Let $u$ be a left adjoint to $v$ as in Definition \ref{definition-adjoint}. Then \begin{enumerate} \item $u$ is fully faithful $\Leftrightarrow$ $\text{id} \cong v \circ u$ $\Leftrightarrow$ $\eta : \text{id} \to v \circ u$ is an isomorphism, \item $v$ is fully faithful $\Leftrightarrow$ $u \circ v \cong \text{id}$ $\Leftrightarrow$ $\epsilon : u \circ v \to \text{id}$ is an isomorphism. \end{enumerate} \end{lemma} \begin{proof} Proof of (1). Assume $u$ is fully faithful. We will show $\eta_X : X \to v(u(X))$ is an isomorphism. Let $X' \to v(u(X))$ be any morphism. By adjointness this corresponds to a morphism $u(X') \to u(X)$. By fully faithfulness of $u$ this corresponds to a unique morphism $X' \to X$. Thus we see that post-composing by $\eta_X$ defines a bijection $\Mor(X', X) \to \Mor(X', v(u(X)))$. Hence $\eta_X$ is an isomorphism. If there exists an isomorphism $\text{id} \cong v \circ u$ of functors, then $v \circ u$ is fully faithful. By Lemma \ref{lemma-left-adjoint-composed-fully-faithful} we see that $u$ is fully faithful. By the above this implies $\eta$ is an isomorphism. Thus all $3$ conditions are equivalent (and these conditions are also equivalent to $v \circ u$ being fully faithful). \medskip\noindent Part (2) is dual to part (1). \end{proof} \begin{lemma} \label{lemma-adjoint-exact} Let $u$ be a left adjoint to $v$ as in Definition \ref{definition-adjoint}. \begin{enumerate} \item Suppose that $M : \mathcal{I} \to \mathcal{C}$ is a diagram, and suppose that $\colim_\mathcal{I} M$ exists in $\mathcal{C}$. Then $u(\colim_\mathcal{I} M) = \colim_\mathcal{I} u \circ M$. In other words, $u$ commutes with (representable) colimits. \item Suppose that $M : \mathcal{I} \to \mathcal{D}$ is a diagram, and suppose that $\lim_\mathcal{I} M$ exists in $\mathcal{D}$. Then $v(\lim_\mathcal{I} M) = \lim_\mathcal{I} v \circ M$. In other words $v$ commutes with representable limits. \end{enumerate} \end{lemma} \begin{proof} A morphism from a colimit into an object is the same as a compatible system of morphisms from the constituents of the limit into the object, see Remark \ref{remark-limit-colim}. So $$ \begin{matrix} \Mor_\mathcal{D}(u(\colim_{i \in \mathcal{I}} M_i), Y) & = & \Mor_\mathcal{C}(\colim_{i \in \mathcal{I}} M_i, v(Y)) \\ & = & \lim_{i \in \mathcal{I}^{opp}} \Mor_\mathcal{C}(M_i, v(Y)) \\ & = & \lim_{i \in \mathcal{I}^{opp}} \Mor_\mathcal{D}(u(M_i), Y) \end{matrix} $$ proves that $u(\colim_{i \in \mathcal{I}} M_i)$ is the colimit we are looking for. A similar argument works for the other statement. \end{proof} \begin{lemma} \label{lemma-exact-adjoint} Let $u$ be a left adjoint of $v$ as in Definition \ref{definition-adjoint}. \begin{enumerate} \item If $\mathcal{C}$ has finite colimits, then $u$ is right exact. \item If $\mathcal{D}$ has finite limits, then $v$ is left exact. \end{enumerate} \end{lemma} \begin{proof} Obvious from the definitions and Lemma \ref{lemma-adjoint-exact}. \end{proof} \begin{lemma} \label{lemma-unit-counit-relations} Let $u : \mathcal{C} \to \mathcal{D}$ be a left adjoint to the functor $v : \mathcal{D} \to \mathcal{C}$. Let $\eta_X : X \to v(u(X))$ be the unit and $\epsilon_Y : u(v(Y)) \to Y$ be the counit. Then $$ u(X) \xrightarrow{u(\eta_X)} u(v(u(X)) \xrightarrow{\epsilon_{u(X)}} u(X) \quad\text{and}\quad v(Y) \xrightarrow{\eta_{v(Y)}} v(u(v(Y))) \xrightarrow{v(\epsilon_Y)} v(Y) $$ are the identity morphisms. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-transformation-between-functors-and-adjoints} Let $u_1, u_2 : \mathcal{C} \to \mathcal{D}$ be functors with right adjoints $v_1, v_2 : \mathcal{D} \to \mathcal{C}$. Let $\beta : u_2 \to u_1$ be a transformation of functors. Let $\beta^\vee : v_1 \to v_2$ be the corresponding transformation of adjoint functors. Then $$ \xymatrix{ u_2 \circ v_1 \ar[r]_\beta \ar[d]_{\beta^\vee} & u_1 \circ v_1 \ar[d] \\ u_2 \circ v_2 \ar[r] & \text{id} } $$ is commutative where the unlabeled arrows are the counit transformations. \end{lemma} \begin{proof} This is true because $\beta^\vee_D : v_1D \to v_2D$ is the unique morphism such that the induced maps $\Mor(C, v_1D) \to \Mor(C, v_2D)$ is the map $\Mor(u_1C, D) \to \Mor(u_2C, D)$ induced by $\beta_C : u_2C \to u_1C$. Namely, this means the map $$ \Mor(u_1 v_1 D, D') \to \Mor(u_2 v_1 D, D') $$ induced by $\beta_{v_1 D}$ is the same as the map $$ \Mor(v_1 D, v_1 D') \to \Mor(v_1 D, v_2 D') $$ induced by $\beta^\vee_{D'}$. Taking $D' = D$ we find that the counit $u_1 v_1 D \to D$ precomposed by $\beta_{v_1D}$ corresponds to $\beta^\vee_D$ under adjunction. This exactly means that the diagram commutes when evaluated on $D$. \end{proof} \begin{lemma} \label{lemma-compose-counits} Let $\mathcal{A}$, $\mathcal{B}$, and $\mathcal{C}$ be categories. Let $v : \mathcal{A} \to \mathcal{B}$ and $v' : \mathcal{B} \to \mathcal{C}$ be functors with left adjoints $u$ and $u'$ respectively. Then \begin{enumerate} \item The functor $v'' = v' \circ v$ has a left adjoint equal to $u'' = u \circ u'$. \item Given $X$ in $\mathcal{A}$ we have \begin{equation} \label{equation-compose-counits} \epsilon_X^v \circ u(\epsilon^{v'}_{v(X)}) = \epsilon^{v''}_X : u''(v''(X)) \to X \end{equation} Where $\epsilon$ is the counit of the adjunctions. \end{enumerate} \end{lemma} \begin{proof} Let us unwind the formula in (2) because this will also immediately prove (1). First, the counit of the adjunctions for the pairs $(u, v)$ and $(u', v')$ are maps $\epsilon_X^v : u(v(X)) \to X$ and $\epsilon_Y^{v'} : u'(v'(Y)) \to Y$, see discussion following Definition \ref{definition-adjoint}. With $u''$ and $v''$ as in (1) we unwind everything $$ u''(v''(X)) = u(u'(v'(v(X)))) \xrightarrow{u(\epsilon_{v(X)}^{v'})} u(v(X)) \xrightarrow{\epsilon_X^v} X $$ to get the map on the left hand side of (\ref{equation-compose-counits}). Let us denote this by $\epsilon_X^{v''}$ for now. To see that this is the counit of an adjoint pair $(u'', v'')$ we have to show that given $Z$ in $\mathcal{C}$ the rule that sends a morphism $\beta : Z \to v''(X)$ to $\alpha = \epsilon_X^{v''} \circ u''(\beta) : u''(Z) \to X$ is a bijection on sets of morphisms. This is true because, this is the composition of the rule sending $\beta$ to $\epsilon_{v(X)}^{v'} \circ u'(\beta)$ which is a bijection by assumption on $(u', v')$ and then sending this to $\epsilon_X^v \circ u(\epsilon_{v(X)}^{v'} \circ u'(\beta))$ which is a bijection by assumption on $(u, v)$. \end{proof} \section{A criterion for representability} \label{section-representable} \noindent The following lemma is often useful to prove the existence of universal objects in big categories, please see the discussion in Remark \ref{remark-how-to-use-it}. \begin{lemma} \label{lemma-a-version-of-brown} Let $\mathcal{C}$ be a big\footnote{See Remark \ref{remark-big-categories}.} category which has limits. Let $F : \mathcal{C} \to \textit{Sets}$ be a functor. Assume that \begin{enumerate} \item $F$ commutes with limits, \item there exist a family $\{x_i\}_{i \in I}$ of objects of $\mathcal{C}$ and for each $i \in I$ an element $f_i \in F(x_i)$ such that for $y \in \Ob(\mathcal{C})$ and $g \in F(y)$ there exist an $i$ and a morphism $\varphi : x_i \to y$ with $F(\varphi)(f_i) = g$. \end{enumerate} Then $F$ is representable, i.e., there exists an object $x$ of $\mathcal{C}$ such that $$ F(y) = \Mor_\mathcal{C}(x, y) $$ functorially in $y$. \end{lemma} \begin{proof} Let $\mathcal{I}$ be the category whose objects are the pairs $(x_i, f_i)$ and whose morphisms $(x_i, f_i) \to (x_{i'}, f_{i'})$ are maps $\varphi : x_i \to x_{i'}$ in $\mathcal{C}$ such that $F(\varphi)(f_i) = f_{i'}$. Set $$ x = \lim_{(x_i, f_i) \in \mathcal{I}} x_i $$ (this will not be the $x$ we are looking for, see below). The limit exists by assumption. As $F$ commutes with limits we have $$ F(x) = \lim_{(x_i, f_i) \in \mathcal{I}} F(x_i). $$ Hence there is a universal element $f \in F(x)$ which maps to $f_i \in F(x_i)$ under $F$ applied to the projection map $x \to x_i$. Using $f$ we obtain a transformation of functors $$ \xi : \Mor_\mathcal{C}(x, - ) \longrightarrow F(-) $$ see Section \ref{section-opposite}. Let $y$ be an arbitrary object of $\mathcal{C}$ and let $g \in F(y)$. Choose $x_i \to y$ such that $f_i$ maps to $g$ which is possible by assumption. Then $F$ applied to the maps $$ x \longrightarrow x_i \longrightarrow y $$ (the first being the projection map of the limit defining $x$) sends $f$ to $g$. Hence the transformation $\xi$ is surjective. \medskip\noindent In order to find the object representing $F$ we let $e : x' \to x$ be the equalizer of all self maps $\varphi : x \to x$ with $F(\varphi)(f) = f$. Since $F$ commutes with limits, it commutes with equalizers, and we see there exists an $f' \in F(x')$ mapping to $f$ in $F(x)$. Since $\xi$ is surjective and since $f'$ maps to $f$ we see that also $\xi' : \Mor_\mathcal{C}(x', -) \to F(-)$ is surjective. Finally, suppose that $a, b : x' \to y$ are two maps such that $F(a)(f') = F(b)(f')$. We have to show $a = b$. Consider the equalizer $e' : x'' \to x'$. Again we find $f'' \in F(x'')$ mapping to $f'$. Choose a map $\psi : x \to x''$ such that $F(\psi)(f) = f''$. Then we see that $e \circ e' \circ \psi : x \to x$ is a morphism with $F(e \circ e' \circ \psi)(f) = f$. Hence $e \circ e' \circ \psi \circ e = e$. Since $e$ is a monomorphism, this implies that $e'$ is an epimorphism, thus $a = b$ as desired. \end{proof} \begin{remark} \label{remark-how-to-use-it} The lemma above is often used to construct the free something on something. For example the free abelian group on a set, the free group on a set, etc. The idea, say in the case of the free group on a set $E$ is to consider the functor $$ F : \textit{Groups} \to \textit{Sets},\quad G \longmapsto \text{Map}(E, G) $$ This functor commutes with limits. As our family of objects we can take a family $E \to G_i$ consisting of groups $G_i$ of cardinality at most $\max(\aleph_0, |E|)$ and set maps $E \to G_i$ such that every isomorphism class of such a structure occurs at least once. Namely, if $E \to G$ is a map from $E$ to a group $G$, then the subgroup $G'$ generated by the image has cardinality at most $\max(\aleph_0, |E|)$. The lemma tells us the functor is representable, hence there exists a group $F_E$ such that $\Mor_{\textit{Groups}}(F_E, G) = \text{Map}(E, G)$. In particular, the identity morphism of $F_E$ corresponds to a map $E \to F_E$ and one can show that $F_E$ is generated by the image without imposing any relations. \medskip\noindent Another typical application is that we can use the lemma to construct colimits once it is known that limits exist. We illustrate it using the category of topological spaces which has limits by Topology, Lemma \ref{topology-lemma-limits}. Namely, suppose that $\mathcal{I} \to \textit{Top}$, $i \mapsto X_i$ is a functor. Then we can consider $$ F : \textit{Top} \longrightarrow \textit{Sets},\quad Y \longmapsto \lim_\mathcal{I} \Mor_{\textit{Top}}(X_i, Y) $$ This functor commutes with limits. Moreover, given any topological space $Y$ and an element $(\varphi_i : X_i \to Y)$ of $F(Y)$, there is a subspace $Y' \subset Y$ of cardinality at most $|\coprod X_i|$ such that the morphisms $\varphi_i$ map into $Y'$. Namely, we can take the induced topology on the union of the images of the $\varphi_i$. Thus it is clear that the hypotheses of the lemma are satisfied and we find a topological space $X$ representing the functor $F$, which precisely means that $X$ is the colimit of the diagram $i \mapsto X_i$. \end{remark} \begin{theorem}[Adjoint functor theorem] \label{theorem-adjoint-functor} Let $G : \mathcal{C} \to \mathcal{D}$ be a functor of big categories. Assume $\mathcal{C}$ has limits, $G$ commutes with them, and for every object $y$ of $\mathcal{D}$ there exists a set of pairs $(x_i, f_i)_{i \in I}$ with $x_i \in \Ob(\mathcal{C})$, $f_i \in \Mor_\mathcal{D}(y, G(x_i))$ such that for any pair $(x, f)$ with $x \in \Ob(\mathcal{C})$, $f \in \Mor_\mathcal{D}(y, G(x))$ there are an $i$ and a morphism $h : x_i \to x$ such that $f = G(h) \circ f_i$. Then $G$ has a left adjoint $F$. \end{theorem} \begin{proof} The assumptions imply that for every object $y$ of $\mathcal{D}$ the functor $x \mapsto \Mor_\mathcal{D}(y, G(x))$ satisfies the assumptions of Lemma \ref{lemma-a-version-of-brown}. Thus it is representable by an object, let's call it $F(y)$. An application of Yoneda's lemma (Lemma \ref{lemma-yoneda}) turns the rule $y \mapsto F(y)$ into a functor which by construction is an adjoint to $G$. We omit the details. \end{proof} \section{Categorically compact objects} \label{section-compact} \noindent A little bit about ``small'' objects of a category. \begin{definition} \label{definition-compact-object} Let $\mathcal{C}$ be a big\footnote{See Remark \ref{remark-big-categories}.} category. An object $X$ of $\mathcal{C}$ is called a {\it categorically compact} if we have $$ \Mor_\mathcal{C}(X, \colim_i M_i) = \colim_i \Mor_\mathcal{C}(X, M_i) $$ for every filtered diagram $M : \mathcal{I} \to \mathcal{C}$ such that $\colim_i M_i$ exists. \end{definition} \noindent Often this definition is made only under the assumption that $\mathcal{C}$ has all filtered colimits. \begin{lemma} \label{lemma-extend-functor-by-colim} Let $\mathcal{C}$ and $\mathcal{D}$ be big categories having filtered colimits. Let $\mathcal{C}' \subset \mathcal{C}$ be a small full subcategory consisting of categorically compact objects of $\mathcal{C}$ such that every object of $\mathcal{C}$ is a filtered colimit of objects of $\mathcal{C}'$. Then every functor $F' : \mathcal{C}' \to \mathcal{D}$ has a unique extension $F : \mathcal{C} \to \mathcal{D}$ commuting with filtered colimits. \end{lemma} \begin{proof} For every object $X$ of $\mathcal{C}$ we may write $X$ as a filtered colimit $X = \colim X_i$ with $X_i \in \Ob(\mathcal{C}')$. Then we set $$ F(X) = \colim F'(X_i) $$ in $\mathcal{D}$. We will show below that this construction does not depend on the choice of the colimit presentation of $X$. \medskip\noindent Suppose given a morphism $\alpha : X \to Y$ of $\mathcal{C}$ and $X = \colim_{i \in I} X_i$ and $Y = \colim_{j \in J} Y_i$ are written as filtered colimit of objects in $\mathcal{C}'$. For each $i \in I$ since $X_i$ is a categorically compact object of $\mathcal{C}$ we can find a $j \in J$ and a commutative diagram $$ \xymatrix{ X_i \ar[r] \ar[d] & X \ar[d]^\alpha \\ Y_j \ar[r] & Y } $$ Then we obtain a morphism $F'(X_i) \to F'(Y_j) \to F(Y)$ where the second morphism is the coprojection into $F(Y) = \colim F'(Y_j)$. The arrow $\beta_i : F'(X_i) \to F(Y)$ does not depend on the choice of $j$. For $i \leq i'$ the composition $$ F'(X_i) \to F'(X_{i'}) \xrightarrow{\beta_{i'}} F(Y) $$ is equal to $\beta_i$. Thus we obtain a well defined arrow $$ F(\alpha) : F(X) = \colim F(X_i) \to F(Y) $$ by the universal property of the colimit. If $\alpha' : Y \to Z$ is a second morphism of $\mathcal{C}$ and $Z = \colim Z_k$ is also written as filtered colimit of objects in $\mathcal{C}'$, then it is a pleasant exercise to show that the induced morphisms $F(\alpha) : F(X) \to F(Y)$ and $F(\alpha') : F(Y) \to F(Z)$ compose to the morphism $F(\alpha' \circ \alpha)$. Details omitted. \medskip\noindent In particular, if we are given two presentations $X = \colim X_i$ and $X = \colim X'_{i'}$ as filtered colimits of systems in $\mathcal{C}'$, then we get mutually inverse arrows $\colim F'(X_i) \to \colim F'(X'_{i'})$ and $\colim F'(X'_{i'}) \to \colim F'(X_i)$. In other words, the value $F(X)$ is well defined independent of the choice of the presentation of $X$ as a filtered colimit of objects of $\mathcal{C}'$. Together with the functoriality of $F$ discussed in the previous paragraph, we find that $F$ is a functor. Also, it is clear that $F(X) = F'(X)$ if $X \in \Ob(\mathcal{C}')$. \medskip\noindent The uniqueness statement in the lemma is clear, provided we show that $F$ commutes with filtered colimits (because this statement doesn't make sense otherwise). To show this, suppose that $X = \colim_{\lambda \in \Lambda} X_\lambda$ is a filtered colimit of $\mathcal{C}$. Since $F$ is a functor we certainly get a map $$ \colim_\lambda F(X_\lambda) \longrightarrow F(X) $$ On the other hand, write $X = \colim X_i$ as a filtered colimit of objects of $\mathcal{C}'$. As above, for each $i \in I$ we can choose a $\lambda \in \Lambda$ and a commutative diagram $$ \xymatrix{ X_i \ar[rr] \ar[rd] & & X_\lambda \ar[ld] \\ & X } $$ As above this determines a well defined morphism $F'(X_i) \to \colim_\lambda F(X_\lambda)$ compatible with transition morphisms and hence a morphism $$ F(X) = \colim_i F'(X_i) \longrightarrow \colim_\lambda F(X_\lambda) $$ This morphism is inverse to the morphism above (details omitted) and proves that $F(X) = \colim_\lambda F(X_\lambda)$ as desired. \end{proof} \section{Localization in categories} \label{section-localization} \noindent The basic idea of this section is given a category $\mathcal{C}$ and a set of arrows $S$ to construct a functor $F : \mathcal{C} \to S^{-1}\mathcal{C}$ such that all elements of $S$ become invertible in $S^{-1}\mathcal{C}$ and such that $F$ is universal among all functors with this property. References for this section are \cite[Chapter I, Section 2]{GZ} and \cite[Chapter II, Section 2]{Verdier}. \begin{definition} \label{definition-multiplicative-system} Let $\mathcal{C}$ be a category. A set of arrows $S$ of $\mathcal{C}$ is called a {\it left multiplicative system} if it has the following properties: \begin{enumerate} \item[LMS1] The identity of every object of $\mathcal{C}$ is in $S$ and the composition of two composable elements of $S$ is in $S$. \item[LMS2] Every solid diagram $$ \xymatrix{ X \ar[d]_t \ar[r]_g & Y \ar@{..>}[d]^s \\ Z \ar@{..>}[r]^f & W } $$ with $t \in S$ can be completed to a commutative dotted square with $s \in S$. \item[LMS3] For every pair of morphisms $f, g : X \to Y$ and $t \in S$ with target $X$ such that $f \circ t = g \circ t$ there exists an $s \in S$ with source $Y$ such that $s \circ f = s \circ g$. \end{enumerate} A set of arrows $S$ of $\mathcal{C}$ is called a {\it right multiplicative system} if it has the following properties: \begin{enumerate} \item[RMS1] The identity of every object of $\mathcal{C}$ is in $S$ and the composition of two composable elements of $S$ is in $S$. \item[RMS2] Every solid diagram $$ \xymatrix{ X \ar@{..>}[d]_t \ar@{..>}[r]_g & Y \ar[d]^s \\ Z \ar[r]^f & W } $$ with $s \in S$ can be completed to a commutative dotted square with $t \in S$. \item[RMS3] For every pair of morphisms $f, g : X \to Y$ and $s \in S$ with source $Y$ such that $s \circ f = s \circ g$ there exists a $t \in S$ with target $X$ such that $f \circ t = g \circ t$. \end{enumerate} A set of arrows $S$ of $\mathcal{C}$ is called a {\it multiplicative system} if it is both a left multiplicative system and a right multiplicative system. In other words, this means that MS1, MS2, MS3 hold, where MS1 $=$ LMS1 $+$ RMS1, MS2 $=$ LMS2 $+$ RMS2, and MS3 $=$ LMS3 $+$ RMS3. (That said, of course LMS1 $=$ RMS1 $=$ MS1.) \end{definition} \noindent These conditions are useful to construct the categories $S^{-1}\mathcal{C}$ as follows. \medskip\noindent {\bf Left calculus of fractions.} Let $\mathcal{C}$ be a category and let $S$ be a left multiplicative system. We define a new category $S^{-1}\mathcal{C}$ as follows (we verify this works in the proof of Lemma \ref{lemma-left-localization}): \begin{enumerate} \item We set $\Ob(S^{-1}\mathcal{C}) = \Ob(\mathcal{C})$. \item Morphisms $X \to Y$ of $S^{-1}\mathcal{C}$ are given by pairs $(f : X \to Y', s : Y \to Y')$ with $s \in S$ up to equivalence. (The equivalence is defined below. Think of the equivalence class of a pair $(f, s)$ as $s^{-1}f : X \to Y$.) \item Two pairs $(f_1 : X \to Y_1, s_1 : Y \to Y_1)$ and $(f_2 : X \to Y_2, s_2 : Y \to Y_2)$ are said to be equivalent if there exist a third pair $(f_3 : X \to Y_3, s_3 : Y \to Y_3)$ and morphisms $u : Y_1 \to Y_3$ and $v : Y_2 \to Y_3$ of $\mathcal{C}$ fitting into the commutative diagram $$ \xymatrix{ & Y_1 \ar[d]^u & \\ X \ar[ru]^{f_1} \ar[r]^{f_3} \ar[rd]_{f_2} & Y_3 & Y \ar[lu]_{s_1} \ar[l]_{s_3} \ar[ld]^{s_2} \\ & Y_2 \ar[u]_v & } $$ \item The composition of the equivalence classes of the pairs $(f : X \to Y', s : Y \to Y')$ and $(g : Y \to Z', t : Z \to Z')$ is defined as the equivalence class of a pair $(h \circ f : X \to Z'', u \circ t : Z \to Z'')$ where $h$ and $u \in S$ are chosen to fit into a commutative diagram $$ \xymatrix{ Y \ar[d]_s \ar[r]_g & Z' \ar[d]^u \\ Y' \ar[r]^h & Z'' } $$ which exists by assumption. \item The identity morphism $X \to X$ in $S^{-1} \mathcal{C}$ is the equivalence class of the pair $(\text{id} : X \to X, \text{id} : X \to X)$. \end{enumerate} \begin{lemma} \label{lemma-left-localization} Let $\mathcal{C}$ be a category and let $S$ be a left multiplicative system. \begin{enumerate} \item The relation on pairs defined above is an equivalence relation. \item The composition rule given above is well defined on equivalence classes. \item Composition is associative (and the identity morphisms satisfy the identity axioms), and hence $S^{-1}\mathcal{C}$ is a category. \end{enumerate} \end{lemma} \begin{proof} Proof of (1). Let us say two pairs $p_1 = (f_1 : X \to Y_1, s_1 : Y \to Y_1)$ and $p_2 = (f_2 : X \to Y_2, s_2 : Y \to Y_2)$ are elementary equivalent if there exists a morphism $a : Y_1 \to Y_2$ of $\mathcal{C}$ such that $a \circ f_1 = f_2$ and $a \circ s_1 = s_2$. Diagram: $$ \xymatrix{ X \ar@{=}[d] \ar[r]_{f_1} & Y_1 \ar[d]^a & Y \ar[l]^{s_1} \ar@{=}[d] \\ X \ar[r]^{f_2} & Y_2 & Y \ar[l]_{s_2} } $$ Let us denote this property by saying $p_1Ep_2$. Note that $pEp$ and $aEb, bEc \Rightarrow aEc$. (Despite its name, $E$ is not an equivalence relation.) Part (1) claims that the relation $p \sim p' \Leftrightarrow \exists q: pEq \wedge p'Eq$ (where $q$ is supposed to be a pair satisfying the same conditions as $p$ and $p'$) is an equivalence relation. A simple formal argument, using the properties of $E$ above, shows that it suffices to prove $p_3Ep_1, p_3Ep_2 \Rightarrow p_1 \sim p_2$. Thus suppose that we are given a commutative diagram $$ \xymatrix{ & Y_1 & \\ X \ar[ru]^{f_1} \ar[r]^{f_3} \ar[rd]_{f_2} & Y_3 \ar[u]_{a_{31}} \ar[d]^{a_{32}} & Y \ar[lu]_{s_1} \ar[l]_{s_3} \ar[ld]^{s_2} \\ & Y_2 & } $$ with $s_i \in S$. First we apply LMS2 to get a commutative diagram $$ \xymatrix{ Y \ar[d]_{s_1} \ar[r]_{s_2} & Y_2 \ar@{..>}[d]^{a_{24}} \\ Y_1 \ar@{..>}[r]^{a_{14}} & Y_4 } $$ with $a_{24} \in S$. Then, we have $$ a_{14} \circ a_{31} \circ s_3 = a_{14} \circ s_1 = a_{24} \circ s_2 = a_{24} \circ a_{32} \circ s_3. $$ Hence, by LMS3, there exists a morphism $s_{44} : Y_4 \to Y'_4$ such that $s_{44} \in S$ and $s_{44} \circ a_{14} \circ a_{31} = s_{44} \circ a_{24} \circ a_{32}$. Hence, after replacing $Y_4$, $a_{14}$ and $a_{24}$ by $Y'_4$, $s_{44} \circ a_{14}$ and $s_{44} \circ a_{24}$, we may assume that $a_{14} \circ a_{31} = a_{24} \circ a_{32}$ (and we still have $a_{24} \in S$ and $a_{14} \circ s_1 = a_{24} \circ s_2$). Set $$ f_4 = a_{14} \circ f_1 = a_{14} \circ a_{31} \circ f_3 = a_{24} \circ a_{32} \circ f_3 = a_{24} \circ f_2 $$ and $s_4 = a_{14} \circ s_1 = a_{24} \circ s_2$. Then, the diagram $$ \xymatrix{ X \ar@{=}[d] \ar[r]_{f_1} & Y_1 \ar[d]^{a_{14}} & Y \ar[l]^{s_1} \ar@{=}[d] \\ X \ar[r]^{f_4} & Y_4 & Y \ar[l]_{s_4} } $$ commutes, and we have $s_4 \in S$ (by LMS1). Thus, $p_1 E p_4$, where $p_4 = (f_4, s_4)$. Similarly, $p_2 E p_4$. Combining these, we find $p_1 \sim p_2$. \medskip\noindent Proof of (2). Let $p = (f : X \to Y', s : Y \to Y')$ and $q = (g : Y \to Z', t : Z \to Z')$ be pairs as in the definition of composition above. To compose we choose a diagram $$ \xymatrix{ Y \ar[d]_s \ar[r]_g & Z' \ar[d]^{u_2} \\ Y' \ar[r]^{h_2} & Z_2 } $$ with $u_2 \in S$. We first show that the equivalence class of the pair $r_2 = (h_2 \circ f : X \to Z_2, u_2 \circ t : Z \to Z_2)$ is independent of the choice of $(Z_2, h_2, u_2)$. Namely, suppose that $(Z_3, h_3, u_3)$ is another choice with corresponding composition $r_3 = (h_3 \circ f : X \to Z_3, u_3 \circ t : Z \to Z_3)$. Then by LMS2 we can choose a diagram $$ \xymatrix{ Z' \ar[d]_{u_2} \ar[r]_{u_3} & Z_3 \ar[d]^{u_{34}} \\ Z_2 \ar[r]^{h_{24}} & Z_4 } $$ with $u_{34} \in S$. We have $h_2 \circ s = u_2 \circ g$ and similarly $h_3 \circ s = u_3 \circ g$. Now, $$ u_{34} \circ h_3 \circ s = u_{34} \circ u_3 \circ g = h_{24} \circ u_2 \circ g = h_{24} \circ h_2 \circ s. $$ Hence, LMS3 shows that there exist a $Z'_4$ and an $s_{44} : Z_4 \to Z'_4$ such that $s_{44} \circ u_{34} \circ h_3 = s_{44} \circ h_{24} \circ h_2$. Replacing $Z_4$, $h_{24}$ and $u_{34}$ by $Z'_4$, $s_{44} \circ h_{24}$ and $s_{44} \circ u_{34}$, we may assume that $u_{34} \circ h_3 = h_{24} \circ h_2$. Meanwhile, the relations $u_{34} \circ u_3 = h_{24} \circ u_2$ and $u_{34} \in S$ continue to hold. We can now set $h_4 = u_{34} \circ h_3 = h_{24} \circ h_2$ and $u_4 = u_{34} \circ u_3 = h_{24} \circ u_2$. Then, we have a commutative diagram $$ \xymatrix{ X \ar@{=}[d] \ar[r]_{h_2\circ f} & Z_2 \ar[d]^{h_{24}} & Z \ar[l]^{u_2 \circ t} \ar@{=}[d] \\ X \ar@{=}[d] \ar[r]^{h_4\circ f} & Z_4 & Z \ar@{=}[d] \ar[l]_{u_4 \circ t} \\ X \ar[r]^{h_3 \circ f} & Z_3 \ar[u]^{u_{34}} & Z \ar[l]_{u_3 \circ t} } $$ Hence we obtain a pair $r_4 = (h_4 \circ f : X \to Z_4, u_4 \circ t : Z \to Z_4)$ and the above diagram shows that we have $r_2Er_4$ and $r_3Er_4$, whence $r_2 \sim r_3$, as desired. Thus it now makes sense to define $p \circ q$ as the equivalence class of all possible pairs $r$ obtained as above. \medskip\noindent To finish the proof of (2) we have to show that given pairs $p_1, p_2, q$ such that $p_1Ep_2$ then $p_1 \circ q = p_2 \circ q$ and $q \circ p_1 = q \circ p_2$ whenever the compositions make sense. To do this, write $p_1 = (f_1 : X \to Y_1, s_1 : Y \to Y_1)$ and $p_2 = (f_2 : X \to Y_2, s_2 : Y \to Y_2)$ and let $a : Y_1 \to Y_2$ be a morphism of $\mathcal{C}$ such that $f_2 = a \circ f_1$ and $s_2 = a \circ s_1$. First assume that $q = (g : Y \to Z', t : Z \to Z')$. In this case choose a commutative diagram as the one on the left $$ \vcenter{ \xymatrix{ Y \ar[d]_{s_2} \ar[r]^g & Z' \ar[d]^u \\ Y_2 \ar[r]^h & Z'' } } \quad \Rightarrow \quad \vcenter{ \xymatrix{ Y \ar[d]_{s_1} \ar[r]^g & Z' \ar[d]^u \\ Y_1 \ar[r]^{h \circ a} & Z'' } } $$ (with $u \in S$), which implies the diagram on the right is commutative as well. Using these diagrams we see that both compositions $q \circ p_1$ and $q \circ p_2$ are the equivalence class of $(h \circ a \circ f_1 : X \to Z'', u \circ t : Z \to Z'')$. Thus $q \circ p_1 = q \circ p_2$. The proof of the other case, in which we have to show $p_1 \circ q = p_2 \circ q$, is omitted. (It is similar to the case we did.) \medskip\noindent Proof of (3). We have to prove associativity of composition. Consider a solid diagram $$ \xymatrix{ & & & Z \ar[d] \\ & & Y \ar[d] \ar[r] & Z' \ar@{..>}[d] \\ & X \ar[d] \ar[r] & Y' \ar@{..>}[d] \ar@{..>}[r] & Z'' \ar@{..>}[d] \\ W \ar[r] & X' \ar@{..>}[r] & Y'' \ar@{..>}[r] & Z''' } $$ (whose vertical arrows belong to $S$) which gives rise to three composable pairs. Using LMS2 we can choose the dotted arrows making the squares commutative and such that the vertical arrows are in $S$. Then it is clear that the composition of the three pairs is the equivalence class of the pair $(W \to Z''', Z \to Z''')$ gotten by composing the horizontal arrows on the bottom row and the vertical arrows on the right column. \medskip\noindent We leave it to the reader to check the identity axioms. \end{proof} \begin{remark} \label{remark-motivation-localization} The motivation for the construction of $S^{-1} \mathcal{C}$ is to ``force'' the morphisms in $S$ to be invertible by artificially creating inverses to them (at the cost of some existing morphisms possibly becoming identified with each other). This is similar to the localization of a commutative ring at a multiplicative subset, and more generally to the localization of a noncommutative ring at a right denominator set (see \cite[Section 10A]{Lam}). This is more than just a similarity: The construction of $S^{-1} \mathcal{C}$ (or, more precisely, its version for additive categories $\mathcal{C}$) actually generalizes the latter type of localization. Namely, a noncommutative ring can be viewed as a pre-additive category with a single object (the morphisms being the elements of the ring); a multiplicative subset of this ring then becomes a set $S$ of morphisms satisfying LMS1 (aka RMS1). Then, the conditions RMS2 and RMS3 for this category and this subset $S$ translate into the two conditions (``right permutable'' and ``right reversible'') of a right denominator set (and similarly for LMS and left denominator sets), and $S^{-1} \mathcal{C}$ (with a properly defined additive structure) is the one-object category corresponding to the localization of the ring. \end{remark} \begin{definition} \label{definition-left-localization-as-fraction} Let $\mathcal{C}$ be a category and let $S$ be a left multiplicative system of morphisms of $\mathcal{C}$. Given any morphism $f : X \to Y'$ in $\mathcal{C}$ and any morphism $s : Y \to Y'$ in $S$, we denote by {\it $s^{-1} f$} the equivalence class of the pair $(f : X \to Y', s : Y \to Y')$. This is a morphism from $X$ to $Y$ in $S^{-1} \mathcal{C}$. \end{definition} \noindent This notation is suggestive, and the things it suggests are true: Given any morphism $f : X \to Y'$ in $\mathcal{C}$ and any two morphisms $s : Y \to Y'$ and $t : Y' \to Y''$ in $S$, we have $\left(t \circ s\right)^{-1} \left(t \circ f\right) = s^{-1} f$. Also, for any $f : X \to Y'$ and $g : Y' \to Z'$ in $\mathcal{C}$ and all $s : Z \to Z'$ in $S$, we have $s^{-1} \left(g \circ f\right) = \left(s^{-1} g\right) \circ \left(\text{id}_{Y'}^{-1} f\right)$. Finally, for any $f : X \to Y'$ in $\mathcal{C}$, all $s : Y \to Y'$ in $S$, and $t : Z \to Y$ in $S$, we have $\left(s \circ t\right)^{-1} f = \left(t^{-1} \text{id}_Y\right) \circ \left(s^{-1} f\right)$. This is all clear from the definition. We can ``write any finite collection of morphisms with the same target as fractions with common denominator''. \begin{lemma} \label{lemma-morphisms-left-localization} Let $\mathcal{C}$ be a category and let $S$ be a left multiplicative system of morphisms of $\mathcal{C}$. Given any finite collection $g_i : X_i \to Y$ of morphisms of $S^{-1}\mathcal{C}$ (indexed by $i$), we can find an element $s : Y \to Y'$ of $S$ and a family of morphisms $f_i : X_i \to Y'$ of $\mathcal{C}$ such that each $g_i$ is the equivalence class of the pair $(f_i : X_i \to Y', s : Y \to Y')$. \end{lemma} \begin{proof} For each $i$ choose a representative $(X_i \to Y_i, s_i : Y \to Y_i)$ of $g_i$. The lemma follows if we can find a morphism $s : Y \to Y'$ in $S$ such that for each $i$ there is a morphism $a_i : Y_i \to Y'$ with $a_i \circ s_i = s$. If we have two indices $i = 1, 2$, then we can do this by completing the square $$ \xymatrix{ Y \ar[d]_{s_1} \ar[r]_{s_2} & Y_2 \ar[d]^{t_2} \\ Y_1 \ar[r]^{a_1} & Y' } $$ with $t_2 \in S$ as is possible by Definition \ref{definition-multiplicative-system}. Then $s = t_2 \circ s_2 \in S$ works. If we have $n > 2$ morphisms, then we use the above trick to reduce to the case of $n - 1$ morphisms, and we win by induction. \end{proof} \noindent There is an easy characterization of equality of morphisms if they have the same denominator. \begin{lemma} \label{lemma-equality-morphisms-left-localization} Let $\mathcal{C}$ be a category and let $S$ be a left multiplicative system of morphisms of $\mathcal{C}$. Let $A, B : X \to Y$ be morphisms of $S^{-1}\mathcal{C}$ which are the equivalence classes of $(f : X \to Y', s : Y \to Y')$ and $(g : X \to Y', s : Y \to Y')$. The following are equivalent \begin{enumerate} \item $A = B$ \item there exists a morphism $t : Y' \to Y''$ in $S$ with $t \circ f = t \circ g$, and \item there exists a morphism $a : Y' \to Y''$ such that $a \circ f = a \circ g$ and $a \circ s \in S$. \end{enumerate} \end{lemma} \begin{proof} We are going to use that $S^{-1}\mathcal{C}$ is a category (Lemma \ref{lemma-left-localization}) and we will use the notation of Definition \ref{definition-left-localization-as-fraction} as well as the discussion following that definition to identify some morphisms in $S^{-1}\mathcal{C}$. Thus we write $A = s^{-1}f$ and $B = s^{-1}g$. \medskip\noindent If $A = B$ then $(\text{id}_{Y'}^{-1}s) \circ A = (\text{id}_{Y'}^{-1}s) \circ B$. We have $(\text{id}_{Y'}^{-1}s) \circ A = \text{id}_{Y'}^{-1}f$ and $(\text{id}_{Y'}^{-1}s) \circ B = \text{id}_{Y'}^{-1}g$. The equality of $\text{id}_{Y'}^{-1}f$ and $\text{id}_{Y'}^{-1}g$ means by definition that there exists a commutative diagram $$ \xymatrix{ & Y' \ar[d]^u & \\ X \ar[ru]^f \ar[r]^h \ar[rd]_g & Z & Y' \ar[lu]_{\text{id}_{Y'}} \ar[l]_t \ar[ld]^{\text{id}_{Y'}} \\ & Y' \ar[u]_v & } $$ with $t \in S$. In particular $u = v = t \in S$ and $t \circ f = t\circ g$. Thus (1) implies (2). \medskip\noindent The implication (2) $\Rightarrow$ (3) is immediate. Assume $a$ is as in (3). Denote $s' = a \circ s \in S$. Then $\text{id}_{Y''}^{-1}s'$ is an isomorphism in the category $S^{-1}\mathcal{C}$ (with inverse $(s')^{-1}\text{id}_{Y''}$). Thus to check $A = B$ it suffices to check that $\text{id}_{Y''}^{-1}s' \circ A = \text{id}_{Y''}^{-1}s' \circ B$. We compute using the rules discussed in the text following Definition \ref{definition-left-localization-as-fraction} that $\text{id}_{Y''}^{-1}s' \circ A = \text{id}_{Y''}^{-1}(a \circ s) \circ s^{-1}f = \text{id}_{Y''}^{-1}(a \circ f) = \text{id}_{Y''}^{-1}(a \circ g) = \text{id}_{Y''}^{-1}(a \circ s) \circ s^{-1}g = \text{id}_{Y''}^{-1}s' \circ B$ and we see that (1) is true. \end{proof} \begin{remark} \label{remark-left-localization-morphisms-colimit} Let $\mathcal{C}$ be a category. Let $S$ be a left multiplicative system. Given an object $Y$ of $\mathcal{C}$ we denote $Y/S$ the category whose objects are $s : Y \to Y'$ with $s \in S$ and whose morphisms are commutative diagrams $$ \xymatrix{ & Y \ar[ld]_s \ar[rd]^t & \\ Y' \ar[rr]^a & & Y'' } $$ where $a : Y' \to Y''$ is arbitrary. We claim that the category $Y/S$ is filtered (see Definition \ref{definition-directed}). Namely, LMS1 implies that $\text{id}_Y : Y \to Y$ is in $Y/S$; hence $Y/S$ is nonempty. LMS2 implies that given $s_1 : Y \to Y_1$ and $s_2 : Y \to Y_2$ we can find a diagram $$ \xymatrix{ Y \ar[d]_{s_1} \ar[r]_{s_2} & Y_2 \ar[d]^t \\ Y_1 \ar[r]^a & Y_3 } $$ with $t \in S$. Hence $s_1 : Y \to Y_1$ and $s_2 : Y \to Y_2$ both have maps to $t \circ s_2 : Y \to Y_3$ in $Y/S$. Finally, given two morphisms $a, b$ from $s_1 : Y \to Y_1$ to $s_2 : Y \to Y_2$ in $Y/S$ we see that $a \circ s_1 = b \circ s_1$; hence by LMS3 there exists a $t : Y_2 \to Y_3$ in $S$ such that $t \circ a = t \circ b$. Now the combined results of Lemmas \ref{lemma-morphisms-left-localization} and \ref{lemma-equality-morphisms-left-localization} tell us that \begin{equation} \label{equation-left-localization-morphisms-colimit} \Mor_{S^{-1}\mathcal{C}}(X, Y) = \colim_{(s : Y \to Y') \in Y/S} \Mor_\mathcal{C}(X, Y') \end{equation} This formula expressing morphism sets in $S^{-1}\mathcal{C}$ as a filtered colimit of morphism sets in $\mathcal{C}$ is occasionally useful. \end{remark} \begin{lemma} \label{lemma-properties-left-localization} Let $\mathcal{C}$ be a category and let $S$ be a left multiplicative system of morphisms of $\mathcal{C}$. \begin{enumerate} \item The rules $X \mapsto X$ and $(f : X \to Y) \mapsto (f : X \to Y, \text{id}_Y : Y \to Y)$ define a functor $Q : \mathcal{C} \to S^{-1}\mathcal{C}$. \item For any $s \in S$ the morphism $Q(s)$ is an isomorphism in $S^{-1}\mathcal{C}$. \item If $G : \mathcal{C} \to \mathcal{D}$ is any functor such that $G(s)$ is invertible for every $s \in S$, then there exists a unique functor $H : S^{-1}\mathcal{C} \to \mathcal{D}$ such that $H \circ Q = G$. \end{enumerate} \end{lemma} \begin{proof} Parts (1) and (2) are clear. (In (2), the inverse of $Q(s)$ is the equivalence class of the pair $(\text{id}_Y, s)$.) To see (3) just set $H(X) = G(X)$ and set $H((f : X \to Y', s : Y \to Y')) = G(s)^{-1} \circ G(f)$. Details omitted. \end{proof} \begin{lemma} \label{lemma-left-localization-limits} Let $\mathcal{C}$ be a category and let $S$ be a left multiplicative system of morphisms of $\mathcal{C}$. The localization functor $Q : \mathcal{C} \to S^{-1}\mathcal{C}$ commutes with finite colimits. \end{lemma} \begin{proof} Let $\mathcal{I}$ be a finite category and let $\mathcal{I} \to \mathcal{C}$, $i \mapsto X_i$ be a functor whose colimit exists. Then using (\ref{equation-left-localization-morphisms-colimit}), the fact that $Y/S$ is filtered, and Lemma \ref{lemma-directed-commutes} we have \begin{align*} \Mor_{S^{-1}\mathcal{C}}(Q(\colim X_i), Q(Y)) & = \colim_{(s : Y \to Y') \in Y/S} \Mor_\mathcal{C}(\colim X_i, Y') \\ & = \colim_{(s : Y \to Y') \in Y/S} \lim_i \Mor_\mathcal{C}(X_i, Y') \\ & = \lim_i \colim_{(s : Y \to Y') \in Y/S} \Mor_\mathcal{C}(X_i, Y') \\ & = \lim_i \Mor_{S^{-1}\mathcal{C}}(Q(X_i), Q(Y)) \end{align*} and this isomorphism commutes with the projections from both sides to the set $\Mor_{S^{-1}\mathcal{C}}(Q(X_j), Q(Y))$ for each $j \in \Ob(\mathcal{I})$. Thus, $Q(\colim X_i)$ satisfies the universal property for the colimit of the functor $i \mapsto Q(X_i)$; hence, it is this colimit, as desired. \end{proof} \begin{lemma} \label{lemma-left-localization-diagram} Let $\mathcal{C}$ be a category. Let $S$ be a left multiplicative system. If $f : X \to Y$, $f' : X' \to Y'$ are two morphisms of $\mathcal{C}$ and if $$ \xymatrix{ Q(X) \ar[d]_{Q(f)} \ar[r]_a & Q(X') \ar[d]^{Q(f')} \\ Q(Y) \ar[r]^b & Q(Y') } $$ is a commutative diagram in $S^{-1}\mathcal{C}$, then there exist a morphism $f'' : X'' \to Y''$ in $\mathcal{C}$ and a commutative diagram $$ \xymatrix{ X \ar[d]_f \ar[r]_g & X'' \ar[d]^{f''} & X' \ar[d]^{f'} \ar[l]^s \\ Y \ar[r]^h & Y'' & Y' \ar[l]_t } $$ in $\mathcal{C}$ with $s, t \in S$ and $a = s^{-1}g$, $b = t^{-1}h$. \end{lemma} \begin{proof} We choose maps and objects in the following way: First write $a = s^{-1}g$ for some $s : X' \to X''$ in $S$ and $g : X \to X''$. By LMS2 we can find $t : Y' \to Y''$ in $S$ and $f'' : X'' \to Y''$ such that $$ \xymatrix{ X \ar[d]_f \ar[r]_g & X'' \ar[d]^{f''} & X' \ar[d]^{f'} \ar[l]^s \\ Y & Y'' & Y' \ar[l]_t } $$ commutes. Now in this diagram we are going to repeatedly change our choice of $$ X'' \xrightarrow{f''} Y'' \xleftarrow{t} Y' $$ by postcomposing both $t$ and $f''$ by a morphism $d : Y'' \to Y'''$ with the property that $d \circ t \in S$. According to Remark \ref{remark-left-localization-morphisms-colimit} we may after such a replacement assume that there exists a morphism $h : Y \to Y''$ such that $b = t^{-1}h$ holds\footnote{Here is a more down-to-earth way to see this: Write $b = q^{-1}i$ for some $q : Y' \to Z$ in $S$ and some $i : Y \to Z$. By LMS2 we can find $r : Y'' \to Y'''$ in $S$ and $j : Z \to Y'''$ such that $j \circ q = r \circ t$. Now, set $d = r$ and $h = j \circ i$.}. At this point we have everything as in the lemma except that we don't know that the left square of the diagram commutes. But the definition of composition in $S^{-1} \mathcal{C}$ shows that $b \circ Q\left(f\right)$ is the equivalence class of the pair $(h \circ f : X \to Y'', t : Y' \to Y'')$ (since $b$ is the equivalence class of the pair $(h : Y \to Y'', t : Y' \to Y'')$, while $Q\left(f\right)$ is the equivalence class of the pair $(f : X \to Y, \text{id} : Y \to Y)$), while $Q\left(f'\right) \circ a$ is the equivalence class of the pair $(f'' \circ g : X \to Y'', t : Y' \to Y'')$ (since $a$ is the equivalence class of the pair $(g : X \to X'', s : X' \to X'')$, while $Q\left(f'\right)$ is the equivalence class of the pair $(f' : X' \to Y', \text{id} : Y' \to Y')$). Since we know that $b \circ Q\left(f\right) = Q\left(f'\right) \circ a$, we thus conclude that the equivalence classes of the pairs $(h \circ f : X \to Y'', t : Y' \to Y'')$ and $(f'' \circ g : X \to Y'', t : Y' \to Y'')$ are equal. Hence using Lemma \ref{lemma-equality-morphisms-left-localization} we can find a morphism $d : Y'' \to Y'''$ such that $d \circ t \in S$ and $d \circ h \circ f = d \circ f'' \circ g$. Hence we make one more replacement of the kind described above and we win. \end{proof} \noindent {\bf Right calculus of fractions.} Let $\mathcal{C}$ be a category and let $S$ be a right multiplicative system. We define a new category $S^{-1}\mathcal{C}$ as follows (we verify this works in the proof of Lemma \ref{lemma-right-localization}): \begin{enumerate} \item We set $\Ob(S^{-1}\mathcal{C}) = \Ob(\mathcal{C})$. \item Morphisms $X \to Y$ of $S^{-1}\mathcal{C}$ are given by pairs $(f : X' \to Y, s : X' \to X)$ with $s \in S$ up to equivalence. (The equivalence is defined below. Think of the equivalence class of a pair $(f, s)$ as $fs^{-1} : X \to Y$.) \item Two pairs $(f_1 : X_1 \to Y, s_1 : X_1 \to X)$ and $(f_2 : X_2 \to Y, s_2 : X_2 \to X)$ are said to be equivalent if there exist a third pair $(f_3 : X_3 \to Y, s_3 : X_3 \to X)$ and morphisms $u : X_3 \to X_1$ and $v : X_3 \to X_2$ of $\mathcal{C}$ fitting into the commutative diagram $$ \xymatrix{ & X_1 \ar[ld]_{s_1} \ar[rd]^{f_1} & \\ X & X_3 \ar[l]_{s_3} \ar[u]_u \ar[d]^v \ar[r]^{f_3} & Y \\ & X_2 \ar[lu]^{s_2} \ar[ru]_{f_2} & } $$ \item The composition of the equivalence classes of the pairs $(f : X' \to Y, s : X' \to X)$ and $(g : Y' \to Z, t : Y' \to Y)$ is defined as the equivalence class of a pair $(g \circ h : X'' \to Z, s \circ u : X'' \to X)$ where $h$ and $u \in S$ are chosen to fit into a commutative diagram $$ \xymatrix{ X'' \ar[d]_u \ar[r]^h & Y' \ar[d]^t \\ X' \ar[r]^f & Y } $$ which exists by assumption. \item The identity morphism $X \to X$ in $S^{-1} \mathcal{C}$ is the equivalence class of the pair $(\text{id} : X \to X, \text{id} : X \to X)$. \end{enumerate} \begin{lemma} \label{lemma-right-localization} Let $\mathcal{C}$ be a category and let $S$ be a right multiplicative system. \begin{enumerate} \item The relation on pairs defined above is an equivalence relation. \item The composition rule given above is well defined on equivalence classes. \item Composition is associative (and the identity morphisms satisfy the identity axioms), and hence $S^{-1}\mathcal{C}$ is a category. \end{enumerate} \end{lemma} \begin{proof} This lemma is dual to Lemma \ref{lemma-left-localization}. It follows formally from that lemma by replacing $\mathcal{C}$ by its opposite category in which $S$ is a left multiplicative system. \end{proof} \begin{definition} \label{definition-right-localization-as-fraction} Let $\mathcal{C}$ be a category and let $S$ be a right multiplicative system of morphisms of $\mathcal{C}$. Given any morphism $f : X' \to Y$ in $\mathcal{C}$ and any morphism $s : X' \to X$ in $S$, we denote by {\it $f s^{-1}$} the equivalence class of the pair $(f : X' \to Y, s : X' \to X)$. This is a morphism from $X$ to $Y$ in $S^{-1} \mathcal{C}$. \end{definition} \noindent Identities similar (actually, dual) to the ones in Definition \ref{definition-left-localization-as-fraction} hold. We can ``write any finite collection of morphisms with the same source as fractions with common denominator''. \begin{lemma} \label{lemma-morphisms-right-localization} Let $\mathcal{C}$ be a category and let $S$ be a right multiplicative system of morphisms of $\mathcal{C}$. Given any finite collection $g_i : X \to Y_i$ of morphisms of $S^{-1}\mathcal{C}$ (indexed by $i$), we can find an element $s : X' \to X$ of $S$ and a family of morphisms $f_i : X' \to Y_i$ of $\mathcal{C}$ such that $g_i$ is the equivalence class of the pair $(f_i : X' \to Y_i, s : X' \to X)$. \end{lemma} \begin{proof} This lemma is the dual of Lemma \ref{lemma-morphisms-left-localization} and follows formally from that lemma by replacing all categories in sight by their opposites. \end{proof} \noindent There is an easy characterization of equality of morphisms if they have the same denominator. \begin{lemma} \label{lemma-equality-morphisms-right-localization} Let $\mathcal{C}$ be a category and let $S$ be a right multiplicative system of morphisms of $\mathcal{C}$. Let $A, B : X \to Y$ be morphisms of $S^{-1}\mathcal{C}$ which are the equivalence classes of $(f : X' \to Y, s : X' \to X)$ and $(g : X' \to Y, s : X' \to X)$. The following are equivalent \begin{enumerate} \item $A = B$, \item there exists a morphism $t : X'' \to X'$ in $S$ with $f \circ t = g \circ t$, and \item there exists a morphism $a : X'' \to X'$ with $f \circ a = g \circ a$ and $s \circ a \in S$. \end{enumerate} \end{lemma} \begin{proof} This is dual to Lemma \ref{lemma-equality-morphisms-left-localization}. \end{proof} \begin{remark} \label{remark-right-localization-morphisms-colimit} Let $\mathcal{C}$ be a category. Let $S$ be a right multiplicative system. Given an object $X$ of $\mathcal{C}$ we denote $S/X$ the category whose objects are $s : X' \to X$ with $s \in S$ and whose morphisms are commutative diagrams $$ \xymatrix{ X' \ar[rd]_s \ar[rr]_a & & X'' \ar[ld]^t \\ & X } $$ where $a : X' \to X''$ is arbitrary. The category $S/X$ is cofiltered (see Definition \ref{definition-codirected}). (This is dual to the corresponding statement in Remark \ref{remark-left-localization-morphisms-colimit}.) Now the combined results of Lemmas \ref{lemma-morphisms-right-localization} and \ref{lemma-equality-morphisms-right-localization} tell us that \begin{equation} \label{equation-right-localization-morphisms-colimit} \Mor_{S^{-1}\mathcal{C}}(X, Y) = \colim_{(s : X' \to X) \in (S/X)^{opp}} \Mor_\mathcal{C}(X', Y) \end{equation} This formula expressing morphisms in $S^{-1}\mathcal{C}$ as a filtered colimit of morphisms in $\mathcal{C}$ is occasionally useful. \end{remark} \begin{lemma} \label{lemma-properties-right-localization} Let $\mathcal{C}$ be a category and let $S$ be a right multiplicative system of morphisms of $\mathcal{C}$. \begin{enumerate} \item The rules $X \mapsto X$ and $(f : X \to Y) \mapsto (f : X \to Y, \text{id}_X : X \to X)$ define a functor $Q : \mathcal{C} \to S^{-1}\mathcal{C}$. \item For any $s \in S$ the morphism $Q(s)$ is an isomorphism in $S^{-1}\mathcal{C}$. \item If $G : \mathcal{C} \to \mathcal{D}$ is any functor such that $G(s)$ is invertible for every $s \in S$, then there exists a unique functor $H : S^{-1}\mathcal{C} \to \mathcal{D}$ such that $H \circ Q = G$. \end{enumerate} \end{lemma} \begin{proof} This lemma is the dual of Lemma \ref{lemma-properties-left-localization} and follows formally from that lemma by replacing all categories in sight by their opposites. \end{proof} \begin{lemma} \label{lemma-right-localization-limits} Let $\mathcal{C}$ be a category and let $S$ be a right multiplicative system of morphisms of $\mathcal{C}$. The localization functor $Q : \mathcal{C} \to S^{-1}\mathcal{C}$ commutes with finite limits. \end{lemma} \begin{proof} This is dual to Lemma \ref{lemma-left-localization-limits}. \end{proof} \begin{lemma} \label{lemma-right-localization-diagram} Let $\mathcal{C}$ be a category. Let $S$ be a right multiplicative system. If $f : X \to Y$, $f' : X' \to Y'$ are two morphisms of $\mathcal{C}$ and if $$ \xymatrix{ Q(X) \ar[d]_{Q(f)} \ar[r]_a & Q(X') \ar[d]^{Q(f')} \\ Q(Y) \ar[r]^b & Q(Y') } $$ is a commutative diagram in $S^{-1}\mathcal{C}$, then there exist a morphism $f'' : X'' \to Y''$ in $\mathcal{C}$ and a commutative diagram $$ \xymatrix{ X \ar[d]_f & X'' \ar[l]^s \ar[d]^{f''} \ar[r]_g & X' \ar[d]^{f'} \\ Y & Y'' \ar[l]_t \ar[r]^h & Y' } $$ in $\mathcal{C}$ with $s, t \in S$ and $a = gs^{-1}$, $b = ht^{-1}$. \end{lemma} \begin{proof} This lemma is dual to Lemma \ref{lemma-left-localization-diagram}. \end{proof} \noindent {\bf Multiplicative systems and two sided calculus of fractions.} If $S$ is a multiplicative system then left and right calculus of fractions give canonically isomorphic categories. \begin{lemma} \label{lemma-multiplicative-system} Let $\mathcal{C}$ be a category and let $S$ be a multiplicative system. The category of left fractions and the category of right fractions $S^{-1}\mathcal{C}$ are canonically isomorphic. \end{lemma} \begin{proof} Denote $\mathcal{C}_{left}$, $\mathcal{C}_{right}$ the two categories of fractions. By the universal properties of Lemmas \ref{lemma-properties-left-localization} and \ref{lemma-properties-right-localization} we obtain functors $\mathcal{C}_{left} \to \mathcal{C}_{right}$ and $\mathcal{C}_{right} \to \mathcal{C}_{left}$. By the uniqueness statement in the universal properties, these functors are each other's inverse. \end{proof} \begin{definition} \label{definition-saturated-multiplicative-system} Let $\mathcal{C}$ be a category and let $S$ be a multiplicative system. We say $S$ is {\it saturated} if, in addition to MS1, MS2, MS3, we also have \begin{enumerate} \item[MS4] Given three composable morphisms $f, g, h$, if $fg, gh \in S$, then $g \in S$. \end{enumerate} \end{definition} \noindent Note that a saturated multiplicative system contains all isomorphisms. Moreover, if $f, g, h$ are composable morphisms in a category and $fg, gh$ are isomorphisms, then $g$ is an isomorphism (because then $g$ has both a left and a right inverse, hence is invertible). \begin{lemma} \label{lemma-what-gets-inverted} Let $\mathcal{C}$ be a category and let $S$ be a multiplicative system. Denote $Q : \mathcal{C} \to S^{-1}\mathcal{C}$ the localization functor. The set $$ \hat S = \{f \in \text{Arrows}(\mathcal{C}) \mid Q(f) \text{ is an isomorphism}\} $$ is equal to $$ S' = \{f \in \text{Arrows}(\mathcal{C}) \mid \text{there exist }g, h\text{ such that }gf, fh \in S\} $$ and is the smallest saturated multiplicative system containing $S$. In particular, if $S$ is saturated, then $\hat S = S$. \end{lemma} \begin{proof} It is clear that $S \subset S' \subset \hat S$ because elements of $S'$ map to morphisms in $S^{-1}\mathcal{C}$ which have both left and right inverses. Note that $S'$ satisfies MS4, and that $\hat S$ satisfies MS1. Next, we prove that $S' = \hat S$. \medskip\noindent Let $f \in \hat S$. Let $s^{-1}g = ht^{-1}$ be the inverse morphism in $S^{-1}\mathcal{C}$. (We may use both left fractions and right fractions to describe morphisms in $S^{-1}\mathcal{C}$, see Lemma \ref{lemma-multiplicative-system}.) The relation $\text{id}_X = s^{-1}gf$ in $S^{-1}\mathcal{C}$ means there exists a commutative diagram $$ \xymatrix{ & X' \ar[d]^u & \\ X \ar[ru]^{gf} \ar[r]^{f'} \ar[rd]_{\text{id}_X} & X'' & X \ar[lu]_s \ar[l]_{s'} \ar[ld]^{\text{id}_X} \\ & X \ar[u]_v & } $$ for some morphisms $f', u, v$ and $s' \in S$. Hence $ugf = s' \in S$. Similarly, using that $\text{id}_Y = fht^{-1}$ one proves that $fhw \in S$ for some $w$. We conclude that $f \in S'$. Thus $S' = \hat S$. Provided we prove that $S' = \hat S$ is a multiplicative system it is now clear that this implies that $S' = \hat S$ is the smallest saturated system containing $S$. \medskip\noindent Our remarks above take care of MS1 and MS4, so to finish the proof of the lemma we have to show that LMS2, RMS2, LMS3, RMS3 hold for $\hat S$. Let us check that LMS2 holds for $\hat S$. Suppose we have a solid diagram $$ \xymatrix{ X \ar[d]_t \ar[r]_g & Y \ar@{..>}[d]^s \\ Z \ar@{..>}[r]^f & W } $$ with $t \in \hat S$. Pick a morphism $a : Z \to Z'$ such that $at \in S$. Then we can use LMS2 for $S$ to find a commutative diagram $$ \xymatrix{ X \ar[d]_t \ar[r]_g & Y \ar[dd]^s \\ Z \ar[d]_a \\ Z' \ar[r]^{f'} & W } $$ and setting $f = f' \circ a$ we win. The proof of RMS2 is dual to this. Finally, suppose given a pair of morphisms $f, g : X \to Y$ and $t \in \hat S$ with target $X$ such that $ft = gt$. Then we pick a morphism $b$ such that $tb \in S$. Then $ftb = gtb$ which implies by LMS3 for $S$ that there exists an $s \in S$ with source $Y$ such that $sf = sg$ as desired. The proof of RMS3 is dual to this. \end{proof} \section{Formal properties} \label{section-formal-cat-cat} \noindent In this section we discuss some formal properties of the $2$-category of categories. This will lead us to the definition of a (strict) $2$-category later. \medskip\noindent Let us denote $\Ob(\textit{Cat})$ the class of all categories. For every pair of categories $\mathcal{A}, \mathcal{B} \in \Ob(\textit{Cat})$ we have the ``small'' category of functors $\text{Fun}(\mathcal{A}, \mathcal{B})$. Composition of transformation of functors such as $$ \xymatrix{ \mathcal{A} \rruppertwocell^{F''}{t'} \ar[rr]_(.3){F'} \rrlowertwocell_F{t} & & \mathcal{B} } \text{ composes to } \xymatrix{ \mathcal{A} \rrtwocell^{F''}_F{\ \ t \circ t'} & & \mathcal{B} } $$ is called {\it vertical} composition. We will use the usual symbol $\circ$ for this. Next, we will define {\it horizontal} composition. In order to do this we explain a bit more of the structure at hand. \medskip\noindent Namely for every triple of categories $\mathcal{A}$, $\mathcal{B}$, and $\mathcal{C}$ there is a composition law $$ \circ : \Ob(\text{Fun}(\mathcal{B}, \mathcal{C})) \times \Ob(\text{Fun}(\mathcal{A}, \mathcal{B})) \longrightarrow \Ob(\text{Fun}(\mathcal{A}, \mathcal{C})) $$ coming from composition of functors. This composition law is associative, and identity functors act as units. In other words -- forgetting about transformations of functors -- we see that $\textit{Cat}$ forms a category. How does this structure interact with the morphisms between functors? \medskip\noindent Well, given $t : F \to F'$ a transformation of functors $F, F' : \mathcal{A} \to \mathcal{B}$ and a functor $G : \mathcal{B} \to \mathcal{C}$ we can define a transformation of functors $G\circ F \to G \circ F'$. We will denote this transformation ${}_Gt$. It is given by the formula $({}_Gt)_x = G(t_x) : G(F(x)) \to G(F'(x))$ for all $x \in \mathcal{A}$. In this way composition with $G$ becomes a functor $$ \text{Fun}(\mathcal{A}, \mathcal{B}) \longrightarrow \text{Fun}(\mathcal{A}, \mathcal{C}). $$ To see this you just have to check that ${}_G(\text{id}_F) = \text{id}_{G \circ F}$ and that ${}_G(t_1 \circ t_2) = {}_Gt_1 \circ {}_Gt_2$. Of course we also have that ${}_{\text{id}_\mathcal{A}}t = t$. \medskip\noindent Similarly, given $s : G \to G'$ a transformation of functors $G, G' : \mathcal{B} \to \mathcal{C}$ and $F : \mathcal{A} \to \mathcal{B}$ a functor we can define $s_F$ to be the transformation of functors $G\circ F \to G' \circ F$ given by $(s_F)_x = s_{F(x)} : G(F(x)) \to G'(F(x))$ for all $x \in \mathcal{A}$. In this way composition with $F$ becomes a functor $$ \text{Fun}(\mathcal{B}, \mathcal{C}) \longrightarrow \text{Fun}(\mathcal{A}, \mathcal{C}). $$ To see this you just have to check that $(\text{id}_G)_F = \text{id}_{G\circ F}$ and that $(s_1 \circ s_2)_F = s_{1, F} \circ s_{2, F}$. Of course we also have that $s_{\text{id}_\mathcal{B}} = s$. \medskip\noindent These constructions satisfy the additional properties $$ {}_{G_1}({}_{G_2}t) = {}_{G_1\circ G_2}t, \ (s_{F_1})_{F_2} = s_{F_1 \circ F_2}, \text{ and }{}_H(s_F) = ({}_Hs)_F $$ whenever these make sense. Finally, given functors $F, F' : \mathcal{A} \to \mathcal{B}$, and $G, G' : \mathcal{B} \to \mathcal{C}$ and transformations $t : F \to F'$, and $s : G \to G'$ the following diagram is commutative $$ \xymatrix{ G \circ F \ar[r]^{{}_Gt} \ar[d]_{s_F} & G \circ F' \ar[d]^{s_{F'}} \\ G' \circ F \ar[r]_{{}_{G'}t} & G' \circ F' } $$ in other words ${}_{G'}t \circ s_F = s_{F'}\circ {}_Gt$. To prove this we just consider what happens on any object $x \in \Ob(\mathcal{A})$: $$ \xymatrix{ G(F(x)) \ar[r]^{G(t_x)} \ar[d]_{s_{F(x)}} & G(F'(x)) \ar[d]^{s_{F'(x)}} \\ G'(F(x)) \ar[r]_{G'(t_x)} & G'(F'(x)) } $$ which is commutative because $s$ is a transformation of functors. This compatibility relation allows us to define horizontal composition. \begin{definition} \label{definition-horizontal-composition} Given a diagram as in the left hand side of: $$ \xymatrix{ \mathcal{A} \rtwocell^F_{F'}{t} & \mathcal{B} \rtwocell^G_{G'}{s} & \mathcal{C} } \text{ gives } \xymatrix{ \mathcal{A} \rrtwocell^{G \circ F} _{G' \circ F'}{\ \ s \star t} & & \mathcal{C} } $$ we define the {\it horizontal} composition $s \star t$ to be the transformation of functors ${}_{G'}t \circ s_F = s_{F'}\circ {}_Gt$. \end{definition} \noindent Now we see that we may recover our previously constructed transformations ${}_Gt$ and $s_F$ as $ {}_Gt = \text{id}_G \star t $ and $ s_F = s \star \text{id}_F $. Furthermore, all of the rules we found above are consequences of the properties stated in the lemma that follows. \begin{lemma} \label{lemma-properties-2-cat-cats} The horizontal and vertical compositions have the following properties \begin{enumerate} \item $\circ$ and $\star$ are associative, \item the identity transformations $\text{id}_F$ are units for $\circ$, \item the identity transformations of the identity functors $\text{id}_{\text{id}_\mathcal{A}}$ are units for $\star$ and $\circ$, and \item given a diagram $$ \xymatrix{ \mathcal{A} \rruppertwocell^F{t} \ar[rr]_(.3){F'} \rrlowertwocell_{F''}{t'} & & \mathcal{B} \rruppertwocell^G{s} \ar[rr]_(.3){G'} \rrlowertwocell_{G''}{s'} & & \mathcal{C} } $$ we have $ (s' \circ s) \star (t' \circ t) = (s' \star t') \circ (s \star t)$. \end{enumerate} \end{lemma} \begin{proof} The last statement turns using our previous notation into the following equation $$ s'_{F''} \circ {}_{G'}t' \circ s_{F'} \circ {}_Gt = (s' \circ s)_{F''} \circ {}_G(t' \circ t). $$ According to our result above applied to the middle composition we may rewrite the left hand side as $ s'_{F''} \circ s_{F''} \circ {}_Gt' \circ {}_Gt $ which is easily shown to be equal to the right hand side. \end{proof} \noindent Another way of formulating condition (4) of the lemma is that composition of functors and horizontal composition of transformation of functors gives rise to a functor $$ (\circ, \star) : \text{Fun}(\mathcal{B}, \mathcal{C}) \times \text{Fun}(\mathcal{A}, \mathcal{B}) \longrightarrow \text{Fun}(\mathcal{A}, \mathcal{C}) $$ whose source is the product category, see Definition \ref{definition-product-category}. \section{2-categories} \label{section-2-categories} \noindent We will give a definition of (strict) $2$-categories as they appear in the setting of stacks. Before you read this take a look at Section \ref{section-formal-cat-cat} and Example \ref{example-2-1-category-of-categories}. Basically, you take this example and you write out all the rules satisfied by the objects, $1$-morphisms and $2$-morphisms in that example. \begin{definition} \label{definition-2-category} A (strict) {\it $2$-category} $\mathcal{C}$ consists of the following data \begin{enumerate} \item A set of objects $\Ob(\mathcal{C})$. \item For each pair $x, y \in \Ob(\mathcal{C})$ a category $\Mor_\mathcal{C}(x, y)$. The objects of $\Mor_\mathcal{C}(x, y)$ will be called {\it $1$-morphisms} and denoted $F : x \to y$. The morphisms between these $1$-morphisms will be called {\it $2$-morphisms} and denoted $t : F' \to F$. The composition of $2$-morphisms in $\Mor_\mathcal{C}(x, y)$ will be called {\it vertical} composition and will be denoted $t \circ t'$ for $t : F' \to F$ and $t' : F'' \to F'$. \item For each triple $x, y, z\in \Ob(\mathcal{C})$ a functor $$ (\circ, \star) : \Mor_\mathcal{C}(y, z) \times \Mor_\mathcal{C}(x, y) \longrightarrow \Mor_\mathcal{C}(x, z). $$ The image of the pair of $1$-morphisms $(F, G)$ on the left hand side will be called the {\it composition} of $F$ and $G$, and denoted $F\circ G$. The image of the pair of $2$-morphisms $(t, s)$ will be called the {\it horizontal} composition and denoted $t \star s$. \end{enumerate} These data are to satisfy the following rules: \begin{enumerate} \item The set of objects together with the set of $1$-morphisms endowed with composition of $1$-morphisms forms a category. \item Horizontal composition of $2$-morphisms is associative. \item The identity $2$-morphism $\text{id}_{\text{id}_x}$ of the identity $1$-morphism $\text{id}_x$ is a unit for horizontal composition. \end{enumerate} \end{definition} \noindent This is obviously not a very pleasant type of object to work with. On the other hand, there are lots of examples where it is quite clear how you work with it. The only example we have so far is that of the $2$-category whose objects are a given collection of categories, $1$-morphisms are functors between these categories, and $2$-morphisms are natural transformations of functors, see Section \ref{section-formal-cat-cat}. As far as this text is concerned all $2$-categories will be sub $2$-categories of this example. Here is what it means to be a sub $2$-category. \begin{definition} \label{definition-sub-2-category} Let $\mathcal{C}$ be a $2$-category. A {\it sub $2$-category} $\mathcal{C}'$ of $\mathcal{C}$, is given by a subset $\Ob(\mathcal{C}')$ of $\Ob(\mathcal{C})$ and sub categories $\Mor_{\mathcal{C}'}(x, y)$ of the categories $\Mor_\mathcal{C}(x, y)$ for all $x, y \in \Ob(\mathcal{C}')$ such that these, together with the operations $\circ$ (composition $1$-morphisms), $\circ$ (vertical composition $2$-morphisms), and $\star$ (horizontal composition) form a $2$-category. \end{definition} \begin{remark} \label{remark-big-2-categories} Big $2$-categories. In many texts a $2$-category is allowed to have a class of objects (but hopefully a ``class of classes'' is not allowed). We will allow these ``big'' $2$-categories as well, but only in the following list of cases (to be updated as we go along): \begin{enumerate} \item The $2$-category of categories $\textit{Cat}$. \item The $(2, 1)$-category of categories $\textit{Cat}$. \item The $2$-category of groupoids $\textit{Groupoids}$; this is a $(2, 1)$-category. \item The $2$-category of fibred categories over a fixed category. \item The $(2, 1)$-category of fibred categories over a fixed category. \end{enumerate} See Definition \ref{definition-2-1-category}. Note that in each case the class of objects of the $2$-category $\mathcal{C}$ is a proper class, but for all objects $x, y \in \Ob(C)$ the category $\Mor_\mathcal{C}(x, y)$ is ``small'' (according to our conventions). \end{remark} \noindent The notion of equivalence of categories that we defined in Section \ref{section-definition-categories} extends to the more general setting of $2$-categories as follows. \begin{definition} \label{definition-equivalence} Two objects $x, y$ of a $2$-category are {\it equivalent} if there exist $1$-morphisms $F : x \to y$ and $G : y \to x$ such that $F \circ G$ is $2$-isomorphic to $\text{id}_y$ and $G \circ F$ is $2$-isomorphic to $\text{id}_x$. \end{definition} \noindent Sometimes we need to say what it means to have a functor from a category into a $2$-category. \begin{definition} \label{definition-functor-into-2-category} Let $\mathcal{A}$ be a category and let $\mathcal{C}$ be a $2$-category. \begin{enumerate} \item A {\it functor} from an ordinary category into a $2$-category will ignore the $2$-morphisms unless mentioned otherwise. In other words, it will be a ``usual'' functor into the category formed out of 2-category by forgetting all the 2-morphisms. \item A {\it weak functor}, or a {\it pseudo functor} $\varphi$ from $\mathcal{A}$ into the 2-category $\mathcal{C}$ is given by the following data \begin{enumerate} \item a map $\varphi : \Ob(\mathcal{A}) \to \Ob(\mathcal{C})$, \item for every pair $x, y\in \Ob(\mathcal{A})$, and every morphism $f : x \to y$ a $1$-morphism $\varphi(f) : \varphi(x) \to \varphi(y)$, \item for every $x\in \Ob(A)$ a $2$-morphism $\alpha_x : \text{id}_{\varphi(x)} \to \varphi(\text{id}_x)$, and \item for every pair of composable morphisms $f : x \to y$, $g : y \to z$ of $\mathcal{A}$ a $2$-morphism $\alpha_{g, f} : \varphi(g \circ f) \to \varphi(g) \circ \varphi(f)$. \end{enumerate} These data are subject to the following conditions: \begin{enumerate} \item the $2$-morphisms $\alpha_x$ and $\alpha_{g, f}$ are all isomorphisms, \item for any morphism $f : x \to y$ in $\mathcal{A}$ we have $\alpha_{\text{id}_y, f} = \alpha_y \star \text{id}_{\varphi(f)}$: $$ \xymatrix{ \varphi(x) \rrtwocell^{\varphi(f)}_{\varphi(f)}{\ \ \ \ \text{id}_{\varphi(f)}} & & \varphi(y) \rrtwocell^{\text{id}_{\varphi(y)}}_{\varphi(\text{id}_y)}{\alpha_y} & & \varphi(y) } = \xymatrix{ \varphi(x) \rrtwocell^{\varphi(f)}_{\varphi(\text{id}_y) \circ \varphi(f)}{\ \ \ \ \alpha_{\text{id}_y, f}} & & \varphi(y) } $$ \item for any morphism $f : x \to y$ in $\mathcal{A}$ we have $\alpha_{f, \text{id}_x} = \text{id}_{\varphi(f)} \star \alpha_x$, \item for any triple of composable morphisms $f : w \to x$, $g : x \to y$, and $h : y \to z$ of $\mathcal{A}$ we have $$ (\text{id}_{\varphi(h)} \star \alpha_{g, f}) \circ \alpha_{h, g \circ f} = (\alpha_{h, g} \star \text{id}_{\varphi(f)}) \circ \alpha_{h \circ g, f} $$ in other words the following diagram with objects $1$-morphisms and arrows $2$-morphisms commutes $$ \xymatrix{ \varphi(h \circ g \circ f) \ar[d]_{\alpha_{h, g \circ f}} \ar[rr]_{\alpha_{h \circ g, f}} & & \varphi(h \circ g) \circ \varphi(f) \ar[d]^{\alpha_{h, g} \star \text{id}_{\varphi(f)}} \\ \varphi(h) \circ \varphi(g \circ f) \ar[rr]^{\text{id}_{\varphi(h)} \star \alpha_{g, f}} & & \varphi(h) \circ \varphi(g) \circ \varphi(f) } $$ \end{enumerate} \end{enumerate} \end{definition} \noindent Again this is not a very workable notion, but it does sometimes come up. There is a theorem that says that any pseudo-functor is isomorphic to a functor. Finally, there are the notions of {\it functor between $2$-categories}, and {\it pseudo functor between $2$-categories}. This last notion leads us into $3$-category territory. We would like to avoid having to define this at almost any cost! \section{(2, 1)-categories} \label{section-2-1-categories} \noindent Some $2$-categories have the property that all $2$-morphisms are isomorphisms. These will play an important role in the following, and they are easier to work with. \begin{definition} \label{definition-2-1-category} A (strict) {\it $(2, 1)$-category} is a $2$-category in which all $2$-morphisms are isomorphisms. \end{definition} \begin{example} \label{example-2-1-category-of-categories} The $2$-category $\textit{Cat}$, see Remark \ref{remark-big-2-categories}, can be turned into a $(2, 1)$-category by only allowing isomorphisms of functors as $2$-morphisms. \end{example} \noindent In fact, more generally any $2$-category $\mathcal{C}$ produces a $(2, 1)$-category by considering the sub $2$-category $\mathcal{C}'$ with the same objects and $1$-morphisms but whose $2$-morphisms are the invertible $2$-morphisms of $\mathcal{C}$. In this situation we will say ``{\it let $\mathcal{C}'$ be the $(2, 1)$-category associated to $\mathcal{C}$}'' or similar. For example, the $(2, 1)$-category of groupoids means the $2$-category whose objects are groupoids, whose $1$-morphisms are functors and whose $2$-morphisms are isomorphisms of functors. Except that this is a bad example as a transformation between functors between groupoids is automatically an isomorphism! \begin{remark} \label{remark-other-2-categories} Thus there are variants of the construction of Example \ref{example-2-1-category-of-categories} above where we look at the $2$-category of groupoids, or categories fibred in groupoids over a fixed category, or stacks. And so on. \end{remark} \section{2-fibre products} \label{section-2-fibre-products} \noindent In this section we introduce $2$-fibre products. Suppose that $\mathcal{C}$ is a 2-category. We say that a diagram $$ \xymatrix{ w \ar[r] \ar[d] & y \ar[d] \\ x \ar[r] & z } $$ 2-commutes if the two 1-morphisms $w \to y \to z$ and $w \to x \to z$ are 2-isomorphic. In a 2-category it is more natural to ask for 2-commutativity of diagrams than for actually commuting diagrams. (Indeed, some may say that we should not work with strict 2-categories at all, and in a ``weak'' 2-category the notion of a commutative diagram of 1-morphisms does not even make sense.) Correspondingly the notion of a fibre product has to be adjusted. \medskip\noindent Let $\mathcal{C}$ be a $2$-category. Let $x, y, z\in \Ob(\mathcal{C})$ and $f\in \Mor_\mathcal{C}(x, z)$ and $g\in \Mor_{\mathcal C}(y, z)$. In order to define the 2-fibre product of $f$ and $g$ we are going to look at 2-commutative diagrams $$ \xymatrix{ & w \ar[r]_a \ar[d]_b & x \ar[d]^{f} \\ & y \ar[r]^{g} & z. } $$ Now in the case of categories, the fibre product is a final object in the category of such diagrams. Correspondingly a 2-fibre product is a final object in a 2-category (see definition below). The {\it $2$-category of $2$-commutative diagrams over $f$ and $g$} is the $2$-category defined as follows: \begin{enumerate} \item Objects are quadruples $(w, a, b, \phi)$ as above where $\phi$ is an invertible 2-morphism $\phi : f \circ a \to g \circ b$, \item 1-morphisms from $(w', a', b', \phi')$ to $(w, a, b, \phi)$ are given by $(k : w' \to w, \alpha : a' \to a \circ k, \beta : b' \to b \circ k)$ such that $$ \xymatrix{ f \circ a' \ar[rr]_{\text{id}_f \star \alpha} \ar[d]_{\phi'} & & f \circ a \circ k \ar[d]^{\phi \star \text{id}_k} \\ g \circ b' \ar[rr]^{\text{id}_g \star \beta} & & g \circ b \circ k } $$ is commutative, \item given a second $1$-morphism $(k', \alpha', \beta') : (w'', a'', b'', \phi'') \to (w', \alpha', \beta', \phi')$ the composition of $1$-morphisms is given by the rule $$ (k, \alpha, \beta) \circ (k', \alpha', \beta') = (k \circ k', (\alpha \star \text{id}_{k'}) \circ \alpha', (\beta \star \text{id}_{k'}) \circ \beta'), $$ \item a 2-morphism between $1$-morphisms $(k_i, \alpha_i, \beta_i)$, $i = 1, 2$ with the same source and target is given by a 2-morphism $\delta : k_1 \to k_2$ such that $$ \xymatrix{ a' \ar[rd]_{\alpha_2} \ar[r]_{\alpha_1} & a \circ k_1 \ar[d]^{\text{id}_a \star \delta} & & b \circ k_1 \ar[d]_{\text{id}_b \star \delta} & b' \ar[l]^{\beta_1} \ar[ld]^{\beta_2} \\ & a \circ k_2 & & b \circ k_2 & } $$ commute, \item vertical composition of $2$-morphisms is given by vertical composition of the morphisms $\delta$ in $\mathcal{C}$, and \item horizontal composition of the diagram $$ \xymatrix{ (w'', a'', b'', \phi'') \rrtwocell^{(k'_1, \alpha'_1, \beta'_1)}_{(k'_2, \alpha'_2, \beta'_2)}{\delta'} & & (w', a', b', \phi') \rrtwocell^{(k_1, \alpha_1, \beta_1)}_{(k_2, \alpha_2, \beta_2)}{\delta} & & (w, a, b, \phi) } $$ is given by the diagram $$ \xymatrix@C=12pc{ (w'', a'', b'', \phi'') \rtwocell^{(k_1 \circ k'_1, (\alpha_1 \star \text{id}_{k'_1}) \circ \alpha'_1, (\beta_1 \star \text{id}_{k'_1}) \circ \beta'_1)}_{(k_2 \circ k'_2, (\alpha_2 \star \text{id}_{k'_2}) \circ \alpha'_2, (\beta_2 \star \text{id}_{k'_2}) \circ \beta'_2)}{\ \ \ \delta \star \delta'} & (w, a, b, \phi) } $$ \end{enumerate} Note that if $\mathcal{C}$ is actually a $(2, 1)$-category, the morphisms $\alpha$ and $\beta$ in (2) above are automatically also isomorphisms\footnote{In fact it seems in the $2$-category case that one could define another 2-category of 2-commutative diagrams where the direction of the arrows $\alpha$, $\beta$ is reversed, or even where the direction of only one of them is reversed. This is why we restrict to $(2, 1)$-categories later on.}. In addition the $2$-category of $2$-commutative diagrams is also a $(2, 1)$-category if $\mathcal{C}$ is a $(2, 1)$-category. \begin{definition} \label{definition-final-object-2-category} A {\it final object} of a $(2, 1)$-category $\mathcal{C}$ is an object $x$ such that \begin{enumerate} \item for every $y \in \Ob(\mathcal{C})$ there is a morphism $y \to x$, and \item every two morphisms $y \to x$ are isomorphic by a unique 2-morphism. \end{enumerate} \end{definition} \noindent Likely, in the more general case of $2$-categories there are different flavours of final objects. We do not want to get into this and hence we only define $2$-fibre products in the $(2, 1)$-case. \begin{definition} \label{definition-2-fibre-products} Let $\mathcal{C}$ be a $(2, 1)$-category. Let $x, y, z\in \Ob(\mathcal{C})$ and $f\in \Mor_\mathcal{C}(x, z)$ and $g\in \Mor_{\mathcal C}(y, z)$. A {\it 2-fibre product of $f$ and $g$} is a final object in the category of 2-commutative diagrams described above. If a 2-fibre product exists we will denote it $x \times_z y\in \Ob(\mathcal{C})$, and denote the required morphisms $p\in \Mor_{\mathcal C}(x \times_z y, x)$ and $q\in \Mor_{\mathcal C}(x \times_z y, y)$ making the diagram $$ \xymatrix{ & x \times_z y \ar[r]^{p} \ar[d]_q & x \ar[d]^{f} \\ & y \ar[r]^{g} & z } $$ 2-commute and we will denote the given invertible 2-morphism exhibiting this by $\psi : f \circ p \to g \circ q$. \end{definition} \noindent Thus the following universal property holds: for any $w\in \Ob(\mathcal{C})$ and morphisms $a \in \Mor_{\mathcal C}(w, x)$ and $b \in \Mor_\mathcal{C}(w, y)$ with a given 2-isomorphism $\phi : f \circ a \to g\circ b$ there is a $\gamma \in \Mor_{\mathcal C}(w, x \times_z y)$ making the diagram $$ \xymatrix{ w\ar[rrrd]^a \ar@{-->}[rrd]_\gamma \ar[rrdd]_b & & \\ & & x \times_z y \ar[r]_p \ar[d]_q & x \ar[d]^{f} \\ & & y \ar[r]^{g} & z } $$ 2-commute such that for suitable choices of $a \to p \circ \gamma$ and $b \to q \circ \gamma$ the diagram $$ \xymatrix{ f \circ a \ar[r] \ar[d]_\phi & f \circ p \circ \gamma \ar[d]^{\psi \star \text{id}_\gamma} \\ g\circ b \ar[r] & g \circ q \circ \gamma } $$ commutes. Moreover $\gamma$ is unique up to isomorphism. Of course the exact properties are finer than this. All of the cases of 2-fibre products that we will need later on come from the following example of 2-fibre products in the 2-category of categories. \begin{example} \label{example-2-fibre-product-categories} Let $\mathcal{A}$, $\mathcal{B}$, and $\mathcal{C}$ be categories. Let $F : \mathcal{A} \to \mathcal{C}$ and $G : \mathcal{B} \to \mathcal{C}$ be functors. We define a category $\mathcal{A} \times_\mathcal{C} \mathcal{B}$ as follows: \begin{enumerate} \item an object of $\mathcal{A} \times_\mathcal{C} \mathcal{B}$ is a triple $(A, B, f)$, where $A\in \Ob(\mathcal{A})$, $B\in \Ob(\mathcal{B})$, and $f : F(A) \to G(B)$ is an isomorphism in $\mathcal{C}$, \item a morphism $(A, B, f) \to (A', B', f')$ is given by a pair $(a, b)$, where $a : A \to A'$ is a morphism in $\mathcal{A}$, and $b : B \to B'$ is a morphism in $\mathcal{B}$ such that the diagram $$ \xymatrix{ F(A) \ar[r]^f \ar[d]^{F(a)} & G(B) \ar[d]^{G(b)} \\ F(A') \ar[r]^{f'} & G(B') } $$ is commutative. \end{enumerate} Moreover, we define functors $p : \mathcal{A} \times_\mathcal{C}\mathcal{B} \to \mathcal{A}$ and $q : \mathcal{A} \times_\mathcal{C}\mathcal{B} \to \mathcal{B}$ by setting $$ p(A, B, f) = A, \quad q(A, B, f) = B, $$ in other words, these are the forgetful functors. We define a transformation of functors $\psi : F \circ p \to G \circ q$. On the object $\xi = (A, B, f)$ it is given by $\psi_\xi = f : F(p(\xi)) = F(A) \to G(B) = G(q(\xi))$. \end{example} \begin{lemma} \label{lemma-2-fibre-product-categories} In the $(2, 1)$-category of categories $2$-fibre products exist and are given by the construction of Example \ref{example-2-fibre-product-categories}. \end{lemma} \begin{proof} Let us check the universal property: let $\mathcal{W}$ be a category, let $a : \mathcal{W} \to \mathcal{A}$ and $b : \mathcal{W} \to \mathcal{B}$ be functors, and let $t : F \circ a \to G \circ b$ be an isomorphism of functors. \medskip\noindent Consider the functor $\gamma : \mathcal{W} \to \mathcal{A} \times_\mathcal{C}\mathcal{B}$ given by $W \mapsto (a(W), b(W), t_W)$. (Check this is a functor omitted.) Moreover, consider $\alpha : a \to p \circ \gamma$ and $\beta : b \to q \circ \gamma$ obtained from the identities $p \circ \gamma = a$ and $q \circ \gamma = b$. Then it is clear that $(\gamma, \alpha, \beta)$ is a morphism from $(W, a, b, t)$ to $(\mathcal{A} \times_\mathcal{C} \mathcal{B}, p, q, \psi)$. \medskip\noindent Let $(k, \alpha', \beta') : (W, a, b, t) \to (\mathcal{A} \times_\mathcal{C} \mathcal{B}, p, q, \psi)$ be a second such morphism. For an object $W$ of $\mathcal{W}$ let us write $k(W) = (a_k(W), b_k(W), t_{k, W})$. Hence $p(k(W)) = a_k(W)$ and so on. The map $\alpha'$ corresponds to functorial maps $\alpha' : a(W) \to a_k(W)$. Since we are working in the $(2, 1)$-category of categories, in fact each of the maps $a(W) \to a_k(W)$ is an isomorphism. We can use these (and their counterparts $b(W) \to b_k(W)$) to get isomorphisms $$ \delta_W : \gamma(W) = (a(W), b(W), t_W) \longrightarrow (a_k(W), b_k(W), t_{k, W}) = k(W). $$ It is straightforward to show that $\delta$ defines a $2$-isomorphism between $\gamma$ and $k$ in the $2$-category of $2$-commutative diagrams as desired. \end{proof} \begin{remark} \label{remark-other-description-2-fibre-product} Let $\mathcal{A}$, $\mathcal{B}$, and $\mathcal{C}$ be categories. Let $F : \mathcal{A} \to \mathcal{C}$ and $G : \mathcal{B} \to \mathcal{C}$ be functors. Another, slightly more symmetrical, construction of a $2$-fibre product $\mathcal{A} \times_\mathcal{C} \mathcal{B}$ is as follows. An object is a quintuple $(A, B, C, a, b)$ where $A, B, C$ are objects of $\mathcal{A}, \mathcal{B}, \mathcal{C}$ and where $a : F(A) \to C$ and $b : G(B) \to C$ are isomorphisms. A morphism $(A, B, C, a, b) \to (A', B', C', a', b')$ is given by a triple of morphisms $A \to A', B \to B', C \to C'$ compatible with the morphisms $a, b, a', b'$. We can prove directly that this leads to a $2$-fibre product. However, it is easier to observe that the functor $(A, B, C, a, b) \mapsto (A, B, b^{-1} \circ a)$ gives an equivalence from the category of quintuples to the category constructed in Example \ref{example-2-fibre-product-categories}. \end{remark} \begin{lemma} \label{lemma-functoriality-2-fibre-product} Let $$ \xymatrix{ & \mathcal{Y} \ar[d]_I \ar[rd]^K & \\ \mathcal{X} \ar[r]^H \ar[rd]^L & \mathcal{Z} \ar[rd]^M & \mathcal{B} \ar[d]^G \\ & \mathcal{A} \ar[r]^F & \mathcal{C} } $$ be a $2$-commutative diagram of categories. A choice of isomorphisms $\alpha : G \circ K \to M \circ I$ and $\beta : M \circ H \to F \circ L$ determines a morphism $$ \mathcal{X} \times_\mathcal{Z} \mathcal{Y} \longrightarrow \mathcal{A} \times_\mathcal{C} \mathcal{B} $$ of $2$-fibre products associated to this situation. \end{lemma} \begin{proof} Just use the functor $$ (X, Y, \phi) \longmapsto (L(X), K(Y), \alpha^{-1}_Y \circ M(\phi) \circ \beta^{-1}_X) $$ on objects and $$ (a, b) \longmapsto (L(a), K(b)) $$ on morphisms. \end{proof} \begin{lemma} \label{lemma-equivalence-2-fibre-product} Assumptions as in Lemma \ref{lemma-functoriality-2-fibre-product}. \begin{enumerate} \item If $K$ and $L$ are faithful then the morphism $\mathcal{X} \times_\mathcal{Z} \mathcal{Y} \to \mathcal{A} \times_\mathcal{C} \mathcal{B}$ is faithful. \item If $K$ and $L$ are fully faithful and $M$ is faithful then the morphism $\mathcal{X} \times_\mathcal{Z} \mathcal{Y} \to \mathcal{A} \times_\mathcal{C} \mathcal{B}$ is fully faithful. \item If $K$ and $L$ are equivalences and $M$ is fully faithful then the morphism $\mathcal{X} \times_\mathcal{Z} \mathcal{Y} \to \mathcal{A} \times_\mathcal{C} \mathcal{B}$ is an equivalence. \end{enumerate} \end{lemma} \begin{proof} Let $(X, Y, \phi)$ and $(X', Y', \phi')$ be objects of $\mathcal{X} \times_\mathcal{Z} \mathcal{Y}$. Set $Z = H(X)$ and identify it with $I(Y)$ via $\phi$. Also, identify $M(Z)$ with $F(L(X))$ via $\alpha_X$ and identify $M(Z)$ with $G(K(Y))$ via $\beta_Y$. Similarly for $Z' = H(X')$ and $M(Z')$. The map on morphisms is the map $$ \xymatrix{ \Mor_\mathcal{X}(X, X') \times_{\Mor_\mathcal{Z}(Z, Z')} \Mor_\mathcal{Y}(Y, Y') \ar[d] \\ \Mor_\mathcal{A}(L(X), L(X')) \times_{\Mor_\mathcal{C}(M(Z), M(Z'))} \Mor_\mathcal{B}(K(Y), K(Y')) } $$ Hence parts (1) and (2) follow. Moreover, if $K$ and $L$ are equivalences and $M$ is fully faithful, then any object $(A, B, \phi)$ is in the essential image for the following reasons: Pick $X$, $Y$ such that $L(X) \cong A$ and $K(Y) \cong B$. Then the fully faithfulness of $M$ guarantees that we can find an isomorphism $H(X) \cong I(Y)$. Some details omitted. \end{proof} \begin{lemma} \label{lemma-associativity-2-fibre-product} Let $$ \xymatrix{ \mathcal{A} \ar[rd] & & \mathcal{C} \ar[ld] \ar[rd] & & \mathcal{E} \ar[ld] \\ & \mathcal{B} & & \mathcal{D} } $$ be a diagram of categories and functors. Then there is a canonical isomorphism $$ (\mathcal{A} \times_\mathcal{B} \mathcal{C}) \times_\mathcal{D} \mathcal{E} \cong \mathcal{A} \times_\mathcal{B} (\mathcal{C} \times_\mathcal{D} \mathcal{E}) $$ of categories. \end{lemma} \begin{proof} Just use the functor $$ ((A, C, \phi), E, \psi) \longmapsto (A, (C, E, \psi), \phi) $$ if you know what I mean. \end{proof} \noindent Henceforth we do not write the parentheses when dealing with fibre products of more than 2 categories. \begin{lemma} \label{lemma-triple-2-fibre-product-pr02} Let $$ \xymatrix{ \mathcal{A} \ar[rd] & & \mathcal{C} \ar[ld] \ar[rd] & & \mathcal{E} \ar[ld] \\ & \mathcal{B} \ar[rd]_F & & \mathcal{D} \ar[ld]^G \\ & & \mathcal{F} & } $$ be a commutative diagram of categories and functors. Then there is a canonical functor $$ \text{pr}_{02} : \mathcal{A} \times_\mathcal{B} \mathcal{C} \times_\mathcal{D} \mathcal{E} \longrightarrow \mathcal{A} \times_\mathcal{F} \mathcal{E} $$ of categories. \end{lemma} \begin{proof} If we write $\mathcal{A} \times_\mathcal{B} \mathcal{C} \times_\mathcal{D} \mathcal{E}$ as $(\mathcal{A} \times_\mathcal{B} \mathcal{C}) \times_\mathcal{D} \mathcal{E}$ then we can just use the functor $$ ((A, C, \phi), E, \psi) \longmapsto (A, E, G(\psi) \circ F(\phi)) $$ if you know what I mean. \end{proof} \begin{lemma} \label{lemma-2-fibre-product-erase-factor} Let $$ \mathcal{A} \to \mathcal{B} \leftarrow \mathcal{C} \leftarrow \mathcal{D} $$ be a diagram of categories and functors. Then there is a canonical isomorphism $$ \mathcal{A} \times_\mathcal{B} \mathcal{C} \times_\mathcal{C} \mathcal{D} \cong \mathcal{A} \times_\mathcal{B} \mathcal{D} $$ of categories. \end{lemma} \begin{proof} Omitted. \end{proof} \noindent We claim that this means you can work with these $2$-fibre products just like with ordinary fibre products. Here are some further lemmas that actually come up later. \begin{lemma} \label{lemma-diagonal-1} Let $$ \xymatrix{ \mathcal{C}_3 \ar[r] \ar[d] & \mathcal{S} \ar[d]^\Delta \\ \mathcal{C}_1 \times \mathcal{C}_2 \ar[r]^{G_1 \times G_2} & \mathcal{S} \times \mathcal{S} } $$ be a $2$-fibre product of categories. Then there is a canonical isomorphism $\mathcal{C}_3 \cong \mathcal{C}_1 \times_{G_1, \mathcal{S}, G_2} \mathcal{C}_2$. \end{lemma} \begin{proof} We may assume that $\mathcal{C}_3$ is the category $(\mathcal{C}_1 \times \mathcal{C}_2)\times_{\mathcal{S} \times \mathcal{S}} \mathcal{S}$ constructed in Example \ref{example-2-fibre-product-categories}. Hence an object is a triple $((X_1, X_2), S, \phi)$ where $\phi = (\phi_1, \phi_2) : (G_1(X_1), G_2(X_2)) \to (S, S)$ is an isomorphism. Thus we can associate to this the triple $(X_1, X_2, \phi_2^{-1} \circ \phi_1)$. Conversely, if $(X_1, X_2, \psi)$ is an object of $\mathcal{C}_1 \times_{G_1, \mathcal{S}, G_2} \mathcal{C}_2$, then we can associate to this the triple $((X_1, X_2), G_2(X_2), (\psi, \text{id}_{G_2(X_2)}))$. We claim these constructions given mutually inverse functors. We omit describing how to deal with morphisms and showing they are mutually inverse. \end{proof} \begin{lemma} \label{lemma-diagonal-2} Let $$ \xymatrix{ \mathcal{C}' \ar[r] \ar[d] & \mathcal{S} \ar[d]^\Delta \\ \mathcal{C} \ar[r]^{G_1 \times G_2} & \mathcal{S} \times \mathcal{S} } $$ be a $2$-fibre product of categories. Then there is a canonical isomorphism $$ \mathcal{C}' \cong (\mathcal{C} \times_{G_1, \mathcal{S}, G_2} \mathcal{C}) \times_{(p, q), \mathcal{C} \times \mathcal{C}, \Delta} \mathcal{C}. $$ \end{lemma} \begin{proof} An object of the right hand side is given by $((C_1, C_2, \phi), C_3, \psi)$ where $\phi : G_1(C_1) \to G_2(C_2)$ is an isomorphism and $\psi = (\psi_1, \psi_2) : (C_1, C_2) \to (C_3, C_3)$ is an isomorphism. Hence we can associate to this the triple $(C_3, G_1(C_1), (G_1(\psi_1^{-1}), \phi^{-1} \circ G_2(\psi_2^{-1})))$ which is an object of $\mathcal{C}'$. Details omitted. \end{proof} \begin{lemma} \label{lemma-fibre-product-after-map} Let $\mathcal{A} \to \mathcal{C}$, $\mathcal{B} \to \mathcal{C}$ and $\mathcal{C} \to \mathcal{D}$ be functors between categories. Then the diagram $$ \xymatrix{ \mathcal{A} \times_\mathcal{C} \mathcal{B} \ar[d] \ar[r] & \mathcal{A} \times_\mathcal{D} \mathcal{B} \ar[d] \\ \mathcal{C} \ar[r]^-{\Delta_{\mathcal{C}/\mathcal{D}}} \ar[r] & \mathcal{C} \times_\mathcal{D} \mathcal{C} } $$ is a $2$-fibre product diagram. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-base-change-diagonal} Let $$ \xymatrix{ \mathcal{U} \ar[d] \ar[r] & \mathcal{V} \ar[d] \\ \mathcal{X} \ar[r] & \mathcal{Y} } $$ be a $2$-fibre product of categories. Then the diagram $$ \xymatrix{ \mathcal{U} \ar[d] \ar[r] & \mathcal{U} \times_\mathcal{V} \mathcal{U} \ar[d] \\ \mathcal{X} \ar[r] & \mathcal{X} \times_\mathcal{Y} \mathcal{X} } $$ is $2$-cartesian. \end{lemma} \begin{proof} This is a purely $2$-category theoretic statement, valid in any $(2, 1)$-category with $2$-fibre products. Explicitly, it follows from the following chain of equivalences: \begin{align*} \mathcal{X} \times_{(\mathcal{X} \times_\mathcal{Y} \mathcal{X})} (\mathcal{U} \times_\mathcal{V} \mathcal{U}) & = \mathcal{X} \times_{(\mathcal{X} \times_\mathcal{Y} \mathcal{X})} ((\mathcal{X} \times_\mathcal{Y} \mathcal{V}) \times_\mathcal{V} (\mathcal{X} \times_\mathcal{Y} \mathcal{V})) \\ & = \mathcal{X} \times_{(\mathcal{X} \times_\mathcal{Y} \mathcal{X})} (\mathcal{X} \times_\mathcal{Y} \mathcal{X} \times_\mathcal{Y} \mathcal{V}) \\ & = \mathcal{X} \times_\mathcal{Y} \mathcal{V} = \mathcal{U} \end{align*} see Lemmas \ref{lemma-associativity-2-fibre-product} and \ref{lemma-2-fibre-product-erase-factor}. \end{proof} \section{Categories over categories} \label{section-categories-over-categories} \noindent In this section we have a functor $p : \mathcal{S} \to \mathcal{C}$. We think of $\mathcal{S}$ as being on top and of $\mathcal{C}$ as being at the bottom. To make sure that everybody knows what we are talking about we define the $2$-category of categories over $\mathcal{C}$. \begin{definition} \label{definition-categories-over-C} Let $\mathcal{C}$ be a category. The {\it $2$-category of categories over $\mathcal{C}$} is the $2$-category defined as follows: \begin{enumerate} \item Its objects will be functors $p : \mathcal{S} \to \mathcal{C}$. \item Its $1$-morphisms $(\mathcal{S}, p) \to (\mathcal{S}', p')$ will be functors $G : \mathcal{S} \to \mathcal{S}'$ such that $p' \circ G = p$. \item Its $2$-morphisms $t : G \to H$ for $G, H : (\mathcal{S}, p) \to (\mathcal{S}', p')$ will be morphisms of functors such that $p'(t_x) = \text{id}_{p(x)}$ for all $x \in \Ob(\mathcal{S})$. \end{enumerate} In this situation we will denote $$ \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{S}, \mathcal{S}') $$ the category of $1$-morphisms between $(\mathcal{S}, p)$ and $(\mathcal{S}', p')$ \end{definition} \noindent In this $2$-category we define horizontal and vertical composition exactly as is done for $\textit{Cat}$ in Section \ref{section-formal-cat-cat}. The axioms of a $2$-category are satisfied for the same reason that the hold in $\textit{Cat}$. To see this one can also use that the axioms hold in $\textit{Cat}$ and verify things such as ``vertical composition of $2$-morphisms over $\mathcal{C}$ gives another $2$-morphism over $\mathcal{C}$''. This is clear. \medskip\noindent Analogously to the fibre of a map of spaces, we have the notion of a fibre category, and some notions of lifting associated to this situation. \begin{definition} \label{definition-fibre-category} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ be a category over $\mathcal{C}$. \begin{enumerate} \item The {\it fibre category} over an object $U\in \Ob(\mathcal{C})$ is the category $\mathcal{S}_U$ with objects $$ \Ob(\mathcal{S}_U) = \{x\in \Ob(\mathcal{S}) : p(x) = U\} $$ and morphisms $$ \Mor_{\mathcal{S}_U}(x, y) = \{ \phi \in \Mor_\mathcal{S}(x, y) : p(\phi) = \text{id}_U\}. $$ \item A {\it lift} of an object $U \in \Ob(\mathcal{C})$ is an object $x\in \Ob(\mathcal{S})$ such that $p(x) = U$, i.e., $x\in \Ob(\mathcal{S}_U)$. We will also sometime say that {\it $x$ lies over $U$}. \item Similarly, a {\it lift} of a morphism $f : V \to U$ in $\mathcal{C}$ is a morphism $\phi : y \to x$ in $\mathcal{S}$ such that $p(\phi) = f$. We sometimes say that {\it $\phi$ lies over $f$}. \end{enumerate} \end{definition} \noindent There are some observations we could make here. For example if $F : (\mathcal{S}, p) \to (\mathcal{S}', p')$ is a $1$-morphism of categories over $\mathcal{C}$, then $F$ induces functors of fibre categories $F : \mathcal{S}_U \to \mathcal{S}'_U$. Similarly for $2$-morphisms. \medskip\noindent Here is the obligatory lemma describing the $2$-fibre product in the $(2, 1)$-category of categories over $\mathcal{C}$. \begin{lemma} \label{lemma-2-product-categories-over-C} Let $\mathcal{C}$ be a category. The $(2, 1)$-category of categories over $\mathcal{C}$ has 2-fibre products. Suppose that $F : \mathcal{X} \to \mathcal{S}$ and $G : \mathcal{Y} \to \mathcal{S}$ are morphisms of categories over $\mathcal{C}$. An explicit 2-fibre product $\mathcal{X} \times_\mathcal{S}\mathcal{Y}$ is given by the following description \begin{enumerate} \item an object of $\mathcal{X} \times_\mathcal{S} \mathcal{Y}$ is a quadruple $(U, x, y, f)$, where $U \in \Ob(\mathcal{C})$, $x\in \Ob(\mathcal{X}_U)$, $y\in \Ob(\mathcal{Y}_U)$, and $f : F(x) \to G(y)$ is an isomorphism in $\mathcal{S}_U$, \item a morphism $(U, x, y, f) \to (U', x', y', f')$ is given by a pair $(a, b)$, where $a : x \to x'$ is a morphism in $\mathcal{X}$, and $b : y \to y'$ is a morphism in $\mathcal{Y}$ such that \begin{enumerate} \item $a$ and $b$ induce the same morphism $U \to U'$, and \item the diagram $$ \xymatrix{ F(x) \ar[r]^f \ar[d]^{F(a)} & G(y) \ar[d]^{G(b)} \\ F(x') \ar[r]^{f'} & G(y') } $$ is commutative. \end{enumerate} \end{enumerate} The functors $p : \mathcal{X} \times_\mathcal{S}\mathcal{Y} \to \mathcal{X}$ and $q : \mathcal{X} \times_\mathcal{S}\mathcal{Y} \to \mathcal{Y}$ are the forgetful functors in this case. The transformation $\psi : F \circ p \to G \circ q$ is given on the object $\xi = (U, x, y, f)$ by $\psi_\xi = f : F(p(\xi)) = F(x) \to G(y) = G(q(\xi))$. \end{lemma} \begin{proof} Let us check the universal property: let $p_\mathcal{W} : \mathcal{W}\to \mathcal{C}$ be a category over $\mathcal{C}$, let $X : \mathcal{W} \to \mathcal{X}$ and $Y : \mathcal{W} \to \mathcal{Y}$ be functors over $\mathcal{C}$, and let $t : F \circ X \to G \circ Y$ be an isomorphism of functors over $\mathcal{C}$. The desired functor $\gamma : \mathcal{W} \to \mathcal{X} \times_\mathcal{S} \mathcal{Y}$ is given by $W \mapsto (p_\mathcal{W}(W), X(W), Y(W), t_W)$. Details omitted; compare with Lemma \ref{lemma-2-fibre-product-categories}. \end{proof} \begin{lemma} \label{lemma-fibre-2-fibre-product-categories-over-C} Let $\mathcal{C}$ be a category. Let $f : \mathcal{X} \to \mathcal{S}$ and $g : \mathcal{Y} \to \mathcal{S}$ be morphisms of categories over $\mathcal{C}$. For any object $U$ of $\mathcal{C}$ we have the following identity of fibre categories $$ \left(\mathcal{X} \times_\mathcal{S}\mathcal{Y}\right)_U = \mathcal{X}_U \times_{\mathcal{S}_U} \mathcal{Y}_U $$ \end{lemma} \begin{proof} Omitted. \end{proof} \section{Fibred categories} \label{section-fibred-categories} \noindent A very brief discussion of fibred categories is warranted. \medskip\noindent Let $p : \mathcal{S} \to \mathcal{C}$ be a category over $\mathcal{C}$. Given an object $x \in \mathcal{S}$ with $p(x) = U$, and given a morphism $f : V \to U$, we can try to take some kind of ``fibre product $V \times_U x$'' (or a {\it base change} of $x$ via $V \to U$). Namely, a morphism from an object $z \in \mathcal{S}$ into ``$V \times_U x$'' should be given by a pair $(\varphi, g)$, where $\varphi : z \to x$, $g : p(z) \to V$ such that $p(\varphi) = f \circ g$. Pictorially: $$ \xymatrix{ z \ar@{~>}[d]^p \ar@{-}[r] & ? \ar[r] \ar@{~>}[d]^p & x \ar@{~>}[d]^p \\ p(z) \ar[r] & V \ar[r]^f & U } $$ If such a morphism $V \times_U x \to x$ exists then it is called a strongly cartesian morphism. \begin{definition} \label{definition-cartesian-over-C} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ be a category over $\mathcal{C}$. A {\it strongly cartesian morphism}, or more precisely a {\it strongly $\mathcal{C}$-cartesian morphism} is a morphism $\varphi : y \to x$ of $\mathcal{S}$ such that for every $z \in \Ob(\mathcal{S})$ the map $$ \Mor_\mathcal{S}(z, y) \longrightarrow \Mor_\mathcal{S}(z, x) \times_{\Mor_\mathcal{C}(p(z), p(x))} \Mor_\mathcal{C}(p(z), p(y)), $$ given by $\psi \longmapsto (\varphi \circ \psi, p(\psi))$ is bijective. \end{definition} \noindent Note that by the Yoneda Lemma \ref{lemma-yoneda}, given $x \in \Ob(\mathcal{S})$ lying over $U \in \Ob(\mathcal{C})$ and the morphism $f : V \to U$ of $\mathcal{C}$, if there is a strongly cartesian morphism $\varphi : y \to x$ with $p(\varphi) = f$, then $(y, \varphi)$ is unique up to unique isomorphism. This is clear from the definition above, as the functor $$ z \longmapsto \Mor_\mathcal{S}(z, x) \times_{\Mor_\mathcal{C}(p(z), U)} \Mor_\mathcal{C}(p(z), V) $$ only depends on the data $(x, U, f : V \to U)$. Hence we will sometimes use $V \times_U x \to x$ or $f^*x \to x$ to denote a strongly cartesian morphism which is a lift of $f$. \begin{lemma} \label{lemma-composition-cartesian} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ be a category over $\mathcal{C}$. \begin{enumerate} \item The composition of two strongly cartesian morphisms is strongly cartesian. \item Any isomorphism of $\mathcal{S}$ is strongly cartesian. \item Any strongly cartesian morphism $\varphi$ such that $p(\varphi)$ is an isomorphism, is an isomorphism. \end{enumerate} \end{lemma} \begin{proof} Proof of (1). Let $\varphi : y \to x$ and $\psi : z \to y$ be strongly cartesian. Let $t$ be an arbitrary object of $\mathcal{S}$. Then we have \begin{align*} & \Mor_\mathcal{S}(t, z) \\ & = \Mor_\mathcal{S}(t, y) \times_{\Mor_\mathcal{C}(p(t), p(y))} \Mor_\mathcal{C}(p(t), p(z)) \\ & = \Mor_\mathcal{S}(t, x) \times_{\Mor_\mathcal{C}(p(t), p(x))} \Mor_\mathcal{C}(p(t), p(y)) \times_{\Mor_\mathcal{C}(p(t), p(y))} \Mor_\mathcal{C}(p(t), p(z)) \\ & = \Mor_\mathcal{S}(t, x) \times_{\Mor_\mathcal{C}(p(t), p(x))} \Mor_\mathcal{C}(p(t), p(z)) \end{align*} hence $z \to x$ is strongly cartesian. \medskip\noindent Proof of (2). Let $y \to x$ be an isomorphism. Then $p(y) \to p(x)$ is an isomorphism too. Hence $\Mor_\mathcal{C}(p(z), p(y)) \to \Mor_\mathcal{C}(p(z), p(x))$ is a bijection. Hence $\Mor_\mathcal{S}(z, x) \times_{\Mor_\mathcal{C}(p(z), p(x))} \Mor_\mathcal{C}(p(z), p(y))$ is bijective to $\Mor_\mathcal{S}(z, x)$. Hence the displayed map of Definition \ref{definition-cartesian-over-C} is a bijection as $y \to x$ is an isomorphism, and we conclude that $y \to x$ is strongly cartesian. \medskip\noindent Proof of (3). Assume $\varphi : y \to x$ is strongly cartesian with $p(\varphi) : p(y) \to p(x)$ an isomorphism. Applying the definition with $z = x$ shows that $(\text{id}_x, p(\varphi)^{-1})$ comes from a unique morphism $\chi : x \to y$. We omit the verification that $\chi$ is the inverse of $\varphi$. \end{proof} \begin{lemma} \label{lemma-cartesian-over-cartesian} Let $F : \mathcal{A} \to \mathcal{B}$ and $G : \mathcal{B} \to \mathcal{C}$ be composable functors between categories. Let $x \to y$ be a morphism of $\mathcal{A}$. If $x \to y$ is strongly $\mathcal{B}$-cartesian and $F(x) \to F(y)$ is strongly $\mathcal{C}$-cartesian, then $x \to y$ is strongly $\mathcal{C}$-cartesian. \end{lemma} \begin{proof} This follows directly from the definition. \end{proof} \begin{lemma} \label{lemma-strongly-cartesian-fibre-product} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ be a category over $\mathcal{C}$. Let $x \to y$ and $z \to y$ be morphisms of $\mathcal{S}$. Assume \begin{enumerate} \item $x \to y$ is strongly cartesian, \item $p(x) \times_{p(y)} p(z)$ exists, and \item there exists a strongly cartesian morphism $a : w \to z$ in $\mathcal{S}$ with $p(w) = p(x) \times_{p(y)} p(z)$ and $p(a) = \text{pr}_2 : p(x) \times_{p(y)} p(z) \to p(z)$. \end{enumerate} Then the fibre product $x \times_y z$ exists and is isomorphic to $w$. \end{lemma} \begin{proof} Since $x \to y$ is strongly cartesian there exists a unique morphism $b : w \to x$ such that $p(b) = \text{pr}_1$. To see that $w$ is the fibre product we compute \begin{align*} & \Mor_\mathcal{S}(t, w) \\ & = \Mor_\mathcal{S}(t, z) \times_{\Mor_\mathcal{C}(p(t), p(z))} \Mor_\mathcal{C}(p(t), p(w)) \\ & = \Mor_\mathcal{S}(t, z) \times_{\Mor_\mathcal{C}(p(t), p(z))} (\Mor_\mathcal{C}(p(t), p(x)) \times_{\Mor_\mathcal{C}(p(t), p(y))} \Mor_\mathcal{C}(p(t), p(z))) \\ & = \Mor_\mathcal{S}(t, z) \times_{\Mor_\mathcal{C}(p(t), p(y))} \Mor_\mathcal{C}(p(t), p(x)) \\ & = \Mor_\mathcal{S}(t, z) \times_{\Mor_\mathcal{S}(t, y)} \Mor_\mathcal{S}(t, y) \times_{\Mor_\mathcal{C}(p(t), p(y))} \Mor_\mathcal{C}(p(t), p(x)) \\ & = \Mor_\mathcal{S}(t, z) \times_{\Mor_\mathcal{S}(t, y)} \Mor_\mathcal{S}(t, x) \end{align*} as desired. The first equality holds because $a : w \to z$ is strongly cartesian and the last equality holds because $x \to y$ is strongly cartesian. \end{proof} \begin{definition} \label{definition-fibred-category} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ be a category over $\mathcal{C}$. We say $\mathcal{S}$ is a {\it fibred category over $\mathcal{C}$} if given any $x \in \Ob(\mathcal{S})$ lying over $U \in \Ob(\mathcal{C})$ and any morphism $f : V \to U$ of $\mathcal{C}$, there exists a strongly cartesian morphism $f^*x \to x$ lying over $f$. \end{definition} \noindent Assume $p : \mathcal{S} \to \mathcal{C}$ is a fibred category. For every $f : V \to U$ and $x\in \Ob(\mathcal{S}_U)$ as in the definition we may choose a strongly cartesian morphism $f^\ast x \to x$ lying over $f$. By the axiom of choice we may choose $f^*x \to x$ for all $f: V \to U = p(x)$ simultaneously. We claim that for every morphism $\phi : x \to x'$ in $\mathcal{S}_U$ and $f : V \to U$ there is a unique morphism $f^\ast \phi : f^\ast x \to f^\ast x'$ in $\mathcal{S}_V$ such that $$ \xymatrix{ f^\ast x \ar[r]_{f^\ast \phi} \ar[d] & f^\ast x' \ar[d] \\ x \ar[r]^{\phi} & x' } $$ commutes. Namely, the arrow exists and is unique because $f^*x' \to x'$ is strongly cartesian. The uniqueness of this arrow guarantees that $f^\ast$ (now also defined on morphisms) is a functor $ f^\ast : \mathcal{S}_U \to \mathcal{S}_V$. \begin{definition} \label{definition-pullback-functor-fibred-category} Assume $p : \mathcal{S} \to \mathcal{C}$ is a fibred category. \begin{enumerate} \item A {\it choice of pullbacks}\footnote{This is probably nonstandard terminology. In some texts this is called a ``cleavage'' but it conjures up the wrong image. Maybe a ``cleaving'' would be a better word. A related notion is that of a ``splitting'', but in many texts a ``splitting'' means a choice of pullbacks such that $g^*f^* = (f \circ g)^*$ for any composable pair of morphisms. Compare also with Definition \ref{definition-split-fibred-category}.} for $p : \mathcal{S} \to \mathcal{C}$ is given by a choice of a strongly cartesian morphism $f^\ast x \to x$ lying over $f$ for any morphism $f: V \to U$ of $\mathcal{C}$ and any $x \in \Ob(\mathcal{S}_U)$. \item Given a choice of pullbacks, for any morphism $f : V \to U$ of $\mathcal{C}$ the functor $f^* : \mathcal{S}_U \to \mathcal{S}_V$ described above is called a {\it pullback functor} (associated to the choices $f^*x \to x$ made above). \end{enumerate} \end{definition} \noindent Of course we may always assume our choice of pullbacks has the property that $\text{id}_U^*x = x$, although in practice this is a useless property without imposing further assumptions on the pullbacks. \begin{lemma} \label{lemma-fibred} Assume $p : \mathcal{S} \to \mathcal{C}$ is a fibred category. Assume given a choice of pullbacks for $p : \mathcal{S} \to \mathcal{C}$. \begin{enumerate} \item For any pair of composable morphisms $f : V \to U$, $g : W \to V$ there is a unique isomorphism $$ \alpha_{g, f} : (f \circ g)^\ast \longrightarrow g^\ast \circ f^\ast $$ as functors $\mathcal{S}_U \to \mathcal{S}_W$ such that for every $y\in \Ob(\mathcal{S}_U)$ the following diagram commutes $$ \xymatrix{ g^\ast f^\ast y \ar[r] & f^\ast y \ar[d] \\ (f \circ g)^\ast y \ar[r] \ar[u]^{(\alpha_{g, f})_y} & y } $$ \item If $f = \text{id}_U$, then there is a canonical isomorphism $\alpha_U : \text{id} \to (\text{id}_U)^*$ as functors $\mathcal{S}_U \to \mathcal{S}_U$. \item The quadruple $(U \mapsto \mathcal{S}_U, f \mapsto f^*, \alpha_{g, f}, \alpha_U)$ defines a pseudo functor from $\mathcal{C}^{opp}$ to the $(2, 1)$-category of categories, see Definition \ref{definition-functor-into-2-category}. \end{enumerate} \end{lemma} \begin{proof} In fact, it is clear that the commutative diagram of part (1) uniquely determines the morphism $(\alpha_{g, f})_y$ in the fibre category $\mathcal{S}_W$. It is an isomorphism since both the morphism $(f \circ g)^*y \to y$ and the composition $g^*f^*y \to f^*y \to y$ are strongly cartesian morphisms lifting $f \circ g$ (see discussion following Definition \ref{definition-cartesian-over-C} and Lemma \ref{lemma-composition-cartesian}). In the same way, since $\text{id}_x : x \to x$ is clearly strongly cartesian over $\text{id}_U$ (with $U = p(x)$) we see that there exists an isomorphism $(\alpha_U)_x : x \to (\text{id}_U)^*x$. (Of course we could have assumed beforehand that $f^*x = x$ whenever $f$ is an identity morphism, but it is better for the sake of generality not to assume this.) We omit the verification that $\alpha_{g, f}$ and $\alpha_U$ so obtained are transformations of functors. We also omit the verification of (3). \end{proof} \begin{lemma} \label{lemma-fibred-equivalent} Let $\mathcal{C}$ be a category. Let $\mathcal{S}_1$, $\mathcal{S}_2$ be categories over $\mathcal{C}$. Suppose that $\mathcal{S}_1$ and $\mathcal{S}_2$ are equivalent as categories over $\mathcal{C}$. Then $\mathcal{S}_1$ is fibred over $\mathcal{C}$ if and only if $\mathcal{S}_2$ is fibred over $\mathcal{C}$. \end{lemma} \begin{proof} Denote $p_i : \mathcal{S}_i \to \mathcal{C}$ the given functors. Let $F : \mathcal{S}_1 \to \mathcal{S}_2$, $G : \mathcal{S}_2 \to \mathcal{S}_1$ be functors over $\mathcal{C}$, and let $i : F \circ G \to \text{id}_{\mathcal{S}_2}$, $j : G \circ F \to \text{id}_{\mathcal{S}_1}$ be isomorphisms of functors over $\mathcal{C}$. We claim that in this case $F$ maps strongly cartesian morphisms to strongly cartesian morphisms. Namely, suppose that $\varphi : y \to x$ is strongly cartesian in $\mathcal{S}_1$. Set $f : V \to U$ equal to $p_1(\varphi)$. Suppose that $z' \in \Ob(\mathcal{S}_2)$, with $W = p_2(z')$, and we are given $g : W \to V$ and $\psi' : z' \to F(x)$ such that $p_2(\psi') = f \circ g$. Then $$ \psi = j \circ G(\psi') : G(z') \to G(F(x)) \to x $$ is a morphism in $\mathcal{S}_1$ with $p_1(\psi) = f \circ g$. Hence by assumption there exists a unique morphism $\xi : G(z') \to y$ lying over $g$ such that $\psi = \varphi \circ \xi$. This in turn gives a morphism $$ \xi' = F(\xi) \circ i^{-1} : z' \to F(G(z')) \to F(y) $$ lying over $g$ with $\psi' = F(\varphi) \circ \xi'$. We omit the verification that $\xi'$ is unique. \end{proof} \noindent The conclusion from Lemma \ref{lemma-fibred-equivalent} is that equivalences map strongly cartesian morphisms to strongly cartesian morphisms. But this may not be the case for an arbitrary functor between fibred categories over $\mathcal{C}$. Hence we define the $2$-category of fibred categories as follows. \begin{definition} \label{definition-fibred-categories-over-C} Let $\mathcal{C}$ be a category. The {\it $2$-category of fibred categories over $\mathcal{C}$} is the sub $2$-category of the $2$-category of categories over $\mathcal{C}$ (see Definition \ref{definition-categories-over-C}) defined as follows: \begin{enumerate} \item Its objects will be fibred categories $p : \mathcal{S} \to \mathcal{C}$. \item Its $1$-morphisms $(\mathcal{S}, p) \to (\mathcal{S}', p')$ will be functors $G : \mathcal{S} \to \mathcal{S}'$ such that $p' \circ G = p$ and such that $G$ maps strongly cartesian morphisms to strongly cartesian morphisms. \item Its $2$-morphisms $t : G \to H$ for $G, H : (\mathcal{S}, p) \to (\mathcal{S}', p')$ will be morphisms of functors such that $p'(t_x) = \text{id}_{p(x)}$ for all $x \in \Ob(\mathcal{S})$. \end{enumerate} In this situation we will denote $$ \Mor_{\textit{Fib}/\mathcal{C}}(\mathcal{S}, \mathcal{S}') $$ the category of $1$-morphisms between $(\mathcal{S}, p)$ and $(\mathcal{S}', p')$ \end{definition} \noindent Note the condition on $1$-morphisms. Note also that this is a true $2$-category and not a $(2, 1)$-category. Hence when taking $2$-fibre products we first pass to the associated $(2, 1)$-category. \begin{lemma} \label{lemma-2-product-fibred-categories-over-C} Let $\mathcal{C}$ be a category. The $(2, 1)$-category of fibred categories over $\mathcal{C}$ has 2-fibre products, and they are described as in Lemma \ref{lemma-2-product-categories-over-C}. \end{lemma} \begin{proof} Basically what one has to show here is that given $F : \mathcal{X} \to \mathcal{S}$ and $G : \mathcal{Y} \to \mathcal{S}$ morphisms of fibred categories over $\mathcal{C}$, then the category $\mathcal{X} \times_\mathcal{S} \mathcal{Y}$ described in Lemma \ref{lemma-2-product-categories-over-C} is fibred. Let us show that $\mathcal{X} \times_\mathcal{S} \mathcal{Y}$ has plenty of strongly cartesian morphisms. Namely, suppose we have $(U, x, y, \phi)$ an object of $\mathcal{X} \times_\mathcal{S} \mathcal{Y}$. And suppose $f : V \to U$ is a morphism in $\mathcal{C}$. Choose strongly cartesian morphisms $a : f^*x \to x$ in $\mathcal{X}$ lying over $f$ and $b : f^*y \to y$ in $\mathcal{Y}$ lying over $f$. By assumption $F(a)$ and $G(b)$ are strongly cartesian. Since $\phi : F(x) \to G(y)$ is an isomorphism, by the uniqueness of strongly cartesian morphisms we find a unique isomorphism $f^*\phi : F(f^*x) \to G(f^*y)$ such that $G(b) \circ f^*\phi = \phi \circ F(a)$. In other words $(a, b) : (V, f^*x, f^*y, f^*\phi) \to (U, x, y, \phi)$ is a morphism in $\mathcal{X} \times_\mathcal{S} \mathcal{Y}$. We omit the verification that this is a strongly cartesian morphism (and that these are in fact the only strongly cartesian morphisms). \end{proof} \begin{lemma} \label{lemma-cute} Let $\mathcal{C}$ be a category. Let $U \in \Ob(\mathcal{C})$. If $p : \mathcal{S} \to \mathcal{C}$ is a fibred category and $p$ factors through $p' : \mathcal{S} \to \mathcal{C}/U$ then $p' : \mathcal{S} \to \mathcal{C}/U$ is a fibred category. \end{lemma} \begin{proof} Suppose that $\varphi : x' \to x$ is strongly cartesian with respect to $p$. We claim that $\varphi$ is strongly cartesian with respect to $p'$ also. Set $g = p'(\varphi)$, so that $g : V'/U \to V/U$ for some morphisms $f : V \to U$ and $f' : V' \to U$. Let $z \in \Ob(\mathcal{S})$. Set $p'(z) = (W \to U)$. To show that $\varphi$ is strongly cartesian for $p'$ we have to show $$ \Mor_\mathcal{S}(z, x') \longrightarrow \Mor_\mathcal{S}(z, x) \times_{\Mor_{\mathcal{C}/U}(W/U, V/U)} \Mor_{\mathcal{C}/U}(W/U, V'/U), $$ given by $\psi' \longmapsto (\varphi \circ \psi', p'(\psi'))$ is bijective. Suppose given an element $(\psi, h)$ of the right hand side, then in particular $g \circ h = p(\psi)$, and by the condition that $\varphi$ is strongly cartesian we get a unique morphism $\psi' : z \to x'$ with $\psi = \varphi \circ \psi'$ and $p(\psi') = h$. OK, and now $p'(\psi') : W/U \to V/U$ is a morphism whose corresponding map $W \to V$ is $h$, hence equal to $h$ as a morphism in $\mathcal{C}/U$. Thus $\psi'$ is a unique morphism $z \to x'$ which maps to the given pair $(\psi, h)$. This proves the claim. \medskip\noindent Finally, suppose given $g : V'/U \to V/U$ and $x$ with $p'(x) = V/U$. Since $p : \mathcal{S} \to \mathcal{C}$ is a fibred category we see there exists a strongly cartesian morphism $\varphi : x' \to x$ with $p(\varphi) = g$. By the same argument as above it follows that $p'(\varphi) = g : V'/U \to V/U$. And as seen above the morphism $\varphi$ is strongly cartesian. Thus the conditions of Definition \ref{definition-fibred-category} are satisfied and we win. \end{proof} \begin{lemma} \label{lemma-fibred-over-fibred} Let $\mathcal{A} \to \mathcal{B} \to \mathcal{C}$ be functors between categories. If $\mathcal{A}$ is fibred over $\mathcal{B}$ and $\mathcal{B}$ is fibred over $\mathcal{C}$, then $\mathcal{A}$ is fibred over $\mathcal{C}$. \end{lemma} \begin{proof} This follows from the definitions and Lemma \ref{lemma-cartesian-over-cartesian}. \end{proof} \begin{lemma} \label{lemma-fibred-category-representable-goes-up} Let $p : \mathcal{S} \to \mathcal{C}$ be a fibred category. Let $x \to y$ and $z \to y$ be morphisms of $\mathcal{S}$ with $x \to y$ strongly cartesian. If $p(x) \times_{p(y)} p(z)$ exists, then $x \times_y z$ exists, $p(x \times_y z) = p(x) \times_{p(y)} p(z)$, and $x \times_y z \to z$ is strongly cartesian. \end{lemma} \begin{proof} Pick a strongly cartesian morphism $\text{pr}_2^*z \to z$ lying over $\text{pr}_2 : p(x) \times_{p(y)} p(z) \to p(z)$. Then $\text{pr}_2^*z = x \times_y z$ by Lemma \ref{lemma-strongly-cartesian-fibre-product}. \end{proof} \begin{lemma} \label{lemma-ameliorate-morphism-fibred-categories} Let $\mathcal{C}$ be a category. Let $F : \mathcal{X} \to \mathcal{Y}$ be a $1$-morphism of fibred categories over $\mathcal{C}$. There exist $1$-morphisms of fibred categories over $\mathcal{C}$ $$ \xymatrix{ \mathcal{X} \ar@<1ex>[r]^u & \mathcal{X}' \ar[r]^v \ar@<1ex>[l]^w & \mathcal{Y} } $$ such that $F = v \circ u$ and such that \begin{enumerate} \item $u : \mathcal{X} \to \mathcal{X}'$ is fully faithful, \item $w$ is left adjoint to $u$, and \item $v : \mathcal{X}' \to \mathcal{Y}$ is a fibred category. \end{enumerate} \end{lemma} \begin{proof} Denote $p : \mathcal{X} \to \mathcal{C}$ and $q : \mathcal{Y} \to \mathcal{C}$ the structure functors. We construct $\mathcal{X}'$ explicitly as follows. An object of $\mathcal{X}'$ is a quadruple $(U, x, y, f)$ where $x \in \Ob(\mathcal{X}_U)$, $y \in \Ob(\mathcal{Y}_U)$ and $f : y \to F(x)$ is a morphism in $\mathcal{Y}_U$. A morphism $(a, b) : (U, x, y, f) \to (U', x', y', f')$ is given by $a : x \to x'$ and $b : y \to y'$ with $p(a) = q(b) : U \to U'$ and such that $f' \circ b = F(a) \circ f$. \medskip\noindent Let us make a choice of pullbacks for both $p$ and $q$ and let us use the same notation to indicate them. Let $(U, x, y, f)$ be an object and let $h : V \to U$ be a morphism. Consider the morphism $c : (V, h^*x, h^*y, h^*f) \to (U, x, y, f)$ coming from the given strongly cartesian maps $h^*x \to x$ and $h^*y \to y$. We claim $c$ is strongly cartesian in $\mathcal{X}'$ over $\mathcal{C}$. Namely, suppose we are given an object $(W, x', y', f')$ of $\mathcal{X}'$, a morphism $(a, b) : (W, x', y', f') \to (U, x, y, f)$ lying over $W \to U$, and a factorization $W \to V \to U$ of $W \to U$ through $h$. As $h^*x \to x$ and $h^*y \to y$ are strongly cartesian we obtain morphisms $a' : x' \to h^*x$ and $b' : y' \to h^*y$ lying over the given morphism $W \to V$. Consider the diagram $$ \xymatrix{ y' \ar[d]_{f'} \ar[r] & h^*y \ar[r] \ar[d]_{h^*f} & y \ar[d]_f \\ F(x') \ar[r] & F(h^*x) \ar[r] & F(x) } $$ The outer rectangle and the right square commute. Since $F$ is a $1$-morphism of fibred categories the morphism $F(h^*x) \to F(x)$ is strongly cartesian. Hence the left square commutes by the universal property of strongly cartesian morphisms. This proves that $\mathcal{X}'$ is fibred over $\mathcal{C}$. \medskip\noindent The functor $u : \mathcal{X} \to \mathcal{X}'$ is given by $x \mapsto (p(x), x, F(x), \text{id})$. This is fully faithful. The functor $\mathcal{X}' \to \mathcal{Y}$ is given by $(U, x, y, f) \mapsto y$. The functor $w : \mathcal{X}' \to \mathcal{X}$ is given by $(U, x, y, f) \mapsto x$. Each of these functors is a $1$-morphism of fibred categories over $\mathcal{C}$ by our description of strongly cartesian morphisms of $\mathcal{X}'$ over $\mathcal{C}$. Adjointness of $w$ and $u$ means that $$ \Mor_\mathcal{X}(x, x') = \Mor_{\mathcal{X}'}((U, x, y, f), (p(x'), x', F(x'), \text{id})), $$ which follows immediately from the definitions. \medskip\noindent Finally, we have to show that $\mathcal{X}' \to \mathcal{Y}$ is a fibred category. Let $c : y' \to y$ be a morphism in $\mathcal{Y}$ and let $(U, x, y, f)$ be an object of $\mathcal{X}'$ lying over $y$. Set $V = q(y')$ and let $h = q(c) : V \to U$. Let $a : h^*x \to x$ and $b : h^*y \to y$ be the strongly cartesian morphisms covering $h$. Since $F$ is a $1$-morphism of fibred categories we may identify $h^*F(x) = F(h^*x)$ with strongly cartesian morphism $F(a) : F(h^*x) \to F(x)$. By the universal property of $b : h^*y \to y$ there is a morphism $c' : y' \to h^*y$ in $\mathcal{Y}_V$ such that $c = b \circ c'$. We claim that $$ (a, c) : (V, h^*x, y', h^*f \circ c') \longrightarrow (U, x, y, f) $$ is strongly cartesian in $\mathcal{X}'$ over $\mathcal{Y}$. To see this let $(W, x_1, y_1, f_1)$ be an object of $\mathcal{X}'$, let $(a_1, b_1) : (W, x_1, y_1, f_1) \to (U, x, y, f)$ be a morphism and let $b_1 = c \circ b_1'$ for some morphism $b_1' : y_1 \to y'$. Then $$ (a_1', b_1') : (W, x_1, y_1, f_1) \longrightarrow (V, h^*x, y', h^*f \circ c') $$ (where $a_1' : x_1 \to h^*x$ is the unique morphism lying over the given morphism $q(b_1') : W \to V$ such that $a_1 = a \circ a_1'$) is the desired morphism. \end{proof} \section{Inertia} \label{section-inertia} \noindent Given fibred categories $p : \mathcal{S} \to \mathcal{C}$ and $p' : \mathcal{S}' \to \mathcal{C}$ over a category $\mathcal{C}$ and a $1$-morphism $F : \mathcal{S} \to \mathcal{S}'$ we have the diagonal morphism $$ \Delta = \Delta_{\mathcal{S}/\mathcal{S}'} : \mathcal{S} \longrightarrow \mathcal{S} \times_{\mathcal{S}'} \mathcal{S} $$ in the $(2, 1)$-category of fibred categories over $\mathcal{C}$. \begin{lemma} \label{lemma-inertia-fibred-category} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ and $p' : \mathcal{S}' \to \mathcal{C}$ be fibred categories. Let $F : \mathcal{S} \to \mathcal{S}'$ be a $1$-morphism of fibred categories over $\mathcal{C}$. Consider the category $\mathcal{I}_{\mathcal{S}/\mathcal{S}'}$ over $\mathcal{C}$ whose \begin{enumerate} \item objects are pairs $(x, \alpha)$ where $x \in \Ob(\mathcal{S})$ and $\alpha : x \to x$ is an automorphism with $F(\alpha) = \text{id}$, \item morphisms $(x, \alpha) \to (y, \beta)$ are given by morphisms $\phi : x \to y$ such that $$ \xymatrix{ x\ar[r]_\phi\ar[d]_\alpha & y\ar[d]^{\beta} \\ x\ar[r]^\phi & y \\ } $$ commutes, and \item the functor $\mathcal{I}_{\mathcal{S}/\mathcal{S}'} \to \mathcal{C}$ is given by $(x, \alpha) \mapsto p(x)$. \end{enumerate} Then \begin{enumerate} \item there is an equivalence $$ \mathcal{I}_{\mathcal{S}/\mathcal{S}'} \longrightarrow \mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S} $$ in the $(2, 1)$-category of categories over $\mathcal{C}$, and \item $\mathcal{I}_{\mathcal{S}/\mathcal{S}'}$ is a fibred category over $\mathcal{C}$. \end{enumerate} \end{lemma} \begin{proof} Note that (2) follows from (1) by Lemmas \ref{lemma-2-product-fibred-categories-over-C} and \ref{lemma-fibred-equivalent}. Thus it suffices to prove (1). We will use without further mention the construction of the $2$-fibre product from Lemma \ref{lemma-2-product-fibred-categories-over-C}. In particular an object of $\mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S}$ is a triple $(x, y, (\iota, \kappa))$ where $x$ and $y$ are objects of $\mathcal{S}$, and $(\iota, \kappa) : (x, x, \text{id}_{F(x)}) \to (y, y, \text{id}_{F(y)})$ is an isomorphism in $\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}$. This just means that $\iota, \kappa : x \to y$ are isomorphisms and that $F(\iota) = F(\kappa)$. Consider the functor $$ I_{\mathcal{S}/\mathcal{S}'} \longrightarrow \mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S} $$ which to an object $(x, \alpha)$ of the left hand side assigns the object $(x, x, (\alpha, \text{id}_x))$ of the right hand side and to a morphism $\phi$ of the left hand side assigns the morphism $(\phi, \phi)$ of the right hand side. We claim that a quasi-inverse to that morphism is given by the functor $$ \mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S} \longrightarrow I_{\mathcal{S}/\mathcal{S}'} $$ which to an object $(x, y, (\iota, \kappa))$ of the left hand side assigns the object $(x, \kappa^{-1} \circ \iota)$ of the right hand side and to a morphism $(\phi, \phi') : (x, y, (\iota, \kappa)) \to (z, w, (\lambda, \mu))$ of the left hand side assigns the morphism $\phi$. Indeed, the endo-functor of $I_{\mathcal{S}/\mathcal{S}'}$ induced by composing the two functors above is the identity on the nose, and the endo-functor induced on $\mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S}$ is isomorphic to the identity via the natural isomorphism $$ (\text{id}_x, \kappa) : (x, x, (\kappa^{-1} \circ \iota, \text{id}_x)) \longrightarrow (x, y, (\iota, \kappa)). $$ Some details omitted. \end{proof} \begin{definition} \label{definition-inertia-fibred-category} Let $\mathcal{C}$ be a category. \begin{enumerate} \item Let $F : \mathcal{S} \to \mathcal{S}'$ be a $1$-morphism of fibred categories over $\mathcal{C}$. The {\it relative inertia of $\mathcal{S}$ over $\mathcal{S}'$} is the fibred category $\mathcal{I}_{\mathcal{S}/\mathcal{S}'} \to \mathcal{C}$ of Lemma \ref{lemma-inertia-fibred-category}. \item By the {\it inertia fibred category $\mathcal{I}_\mathcal{S}$ of $\mathcal{S}$} we mean $\mathcal{I}_\mathcal{S} = \mathcal{I}_{\mathcal{S}/\mathcal{C}}$. \end{enumerate} \end{definition} \noindent Note that there are canonical $1$-morphisms \begin{equation} \label{equation-inertia-structure-map} \mathcal{I}_{\mathcal{S}/\mathcal{S}'} \longrightarrow \mathcal{S} \quad\text{and}\quad \mathcal{I}_\mathcal{S} \longrightarrow \mathcal{S} \end{equation} of fibred categories over $\mathcal{C}$. In terms of the description of Lemma \ref{lemma-inertia-fibred-category} these simply map the object $(x, \alpha)$ to the object $x$ and the morphism $\phi : (x, \alpha) \to (y, \beta)$ to the morphism $\phi : x \to y$. There is also a {\it neutral section} \begin{equation} \label{equation-neutral-section} e : \mathcal{S} \to \mathcal{I}_{\mathcal{S}/\mathcal{S}'} \quad\text{and}\quad e : \mathcal{S} \to \mathcal{I}_\mathcal{S} \end{equation} defined by the rules $x \mapsto (x, \text{id}_x)$ and $(\phi : x \to y) \mapsto \phi$. This is a right inverse to (\ref{equation-inertia-structure-map}). Given a $2$-commutative square $$ \xymatrix{ \mathcal{S}_1 \ar[d]_{F_1} \ar[r]_G & \mathcal{S}_2 \ar[d]^{F_2} \\ \mathcal{S}'_1 \ar[r]^{G'} & \mathcal{S}'_2 } $$ there are {\it functoriality maps} \begin{equation} \label{equation-functorial} \mathcal{I}_{\mathcal{S}_1/\mathcal{S}'_1} \longrightarrow \mathcal{I}_{\mathcal{S}_2/\mathcal{S}'_2} \quad\text{and}\quad \mathcal{I}_{\mathcal{S}_1} \longrightarrow \mathcal{I}_{\mathcal{S}_2} \end{equation} defined by the rules $(x, \alpha) \mapsto (G(x), G(\alpha))$ and $\phi \mapsto G(\phi)$. In particular there is always a comparison map \begin{equation} \label{equation-comparison} \mathcal{I}_{\mathcal{S}/\mathcal{S}'} \longrightarrow \mathcal{I}_\mathcal{S} \end{equation} and all the maps above are compatible with this. \begin{lemma} \label{lemma-relative-inertia-as-fibre-product} Let $F : \mathcal{S} \to \mathcal{S}'$ be a $1$-morphism of categories fibred over a category $\mathcal{C}$. Then the diagram $$ \xymatrix{ \mathcal{I}_{\mathcal{S}/\mathcal{S}'} \ar[d]_{F \circ (\ref{equation-inertia-structure-map})} \ar[rr]_{(\ref{equation-comparison})} & & \mathcal{I}_\mathcal{S} \ar[d]^{(\ref{equation-functorial})} \\ \mathcal{S}' \ar[rr]^e & & \mathcal{I}_{\mathcal{S}'} } $$ is a $2$-fibre product. \end{lemma} \begin{proof} Omitted. \end{proof} \section{Categories fibred in groupoids} \label{section-fibred-groupoids} \noindent In this section we explain how to think about categories fibred in groupoids and we see how they are basically the same as functors with values in the $(2, 1)$-category of groupoids. \begin{definition} \label{definition-fibred-groupoids} Let $p : \mathcal{S} \to \mathcal{C}$ be a functor. We say that $\mathcal{S}$ is {\it fibred in groupoids} over $\mathcal{C}$ if the following two conditions hold: \begin{enumerate} \item For every morphism $f : V \to U$ in $\mathcal{C}$ and every lift $x$ of $U$ there is a lift $\phi : y \to x$ of $f$ with target $x$. \item For every pair of morphisms $\phi : y \to x$ and $ \psi : z \to x$ and any morphism $f : p(z) \to p(y)$ such that $p(\phi) \circ f = p(\psi)$ there exists a unique lift $\chi : z \to y$ of $f$ such that $\phi \circ \chi = \psi$. \end{enumerate} \end{definition} \noindent Condition (2) phrased differently says that applying the functor $p$ gives a bijection between the sets of dotted arrows in the following commutative diagram below: $$ \xymatrix{ y \ar[r] & x & p(y) \ar[r] & p(x) \\ z \ar@{-->}[u] \ar[ru] & & p(z) \ar@{-->}[u]\ar[ru] & \\ } $$ Another way to think about the second condition is the following. Suppose that $g : W \to V$ and $f : V \to U$ are morphisms in $\mathcal{C}$. Let $x \in \Ob(\mathcal{S}_U)$. By the first condition we can lift $f$ to $ \phi : y \to x$ and then we can lift $g$ to $\psi : z \to y$. Instead of doing this two step process we can directly lift $g \circ f$ to $\gamma : z' \to x$. This gives the solid arrows in the diagram \begin{equation} \label{equation-fibred-groupoids} \vcenter{ \xymatrix{ z' \ar@{-->}[d]\ar[rrd]^\gamma & & \\ z \ar@{-->}[u] \ar[r]^\psi \ar@{~>}[d]^p & y \ar[r]^\phi \ar@{~>}[d]^p & x \ar@{~>}[d]^p \\ W \ar[r]^g & V \ar[r]^f & U \\ } } \end{equation} where the squiggly arrows represent not morphisms but the functor $p$. Applying the second condition to the arrows $\phi \circ \psi$, $\gamma$ and $\text{id}_W$ we conclude that there is a unique morphism $\chi : z \to z'$ in $\mathcal{S}_W$ such that $\gamma \circ \chi = \phi \circ \psi$. Similarly there is a unique morphism $z' \to z$. The uniqueness implies that the morphisms $z' \to z$ and $z\to z'$ are mutually inverse, in other words isomorphisms. \medskip\noindent It should be clear from this discussion that a category fibred in groupoids is very closely related to a fibred category. Here is the result. \begin{lemma} \label{lemma-fibred-groupoids} Let $p : \mathcal{S} \to \mathcal{C}$ be a functor. The following are equivalent \begin{enumerate} \item $p : \mathcal{S} \to \mathcal{C}$ is a category fibred in groupoids, and \item all fibre categories are groupoids and $\mathcal{S}$ is a fibred category over $\mathcal{C}$. \end{enumerate} Moreover, in this case every morphism of $\mathcal{S}$ is strongly cartesian. In addition, given $f^\ast x \to x$ lying over $f$ for all $f: V \to U = p(x)$ the data $(U \mapsto \mathcal{S}_U, f \mapsto f^*, \alpha_{f, g}, \alpha_U)$ constructed in Lemma \ref{lemma-fibred} defines a pseudo functor from $\mathcal{C}^{opp}$ in to the $(2, 1)$-category of groupoids. \end{lemma} \begin{proof} Assume $p : \mathcal{S} \to \mathcal{C}$ is fibred in groupoids. To show all fibre categories $\mathcal{S}_U$ for $U \in \Ob(\mathcal{C})$ are groupoids, we must exhibit for every $f : y \to x$ in $\mathcal{S}_U$ an inverse morphism. The diagram on the left (in $\mathcal{S}_U$) is mapped by $p$ to the diagram on the right: $$ \xymatrix{ y \ar[r]^f & x & U \ar[r]^{\text{id}_U} & U \\ x \ar@{-->}[u] \ar[ru]_{\text{id}_x} & & U \ar@{-->}[u]\ar[ru]_{\text{id}_U} & \\ } $$ Since only $\text{id}_U$ makes the diagram on the right commute, there is a unique $g : x \to y$ making the diagram on the left commute, so $fg = \text{id}_x$. By a similar argument there is a unique $h : y \to x$ so that $gh = \text{id}_y$. Then $fgh = f : y \to x$. We have $fg = \text{id}_x$, so $h = f$. Condition (2) of Definition \ref{definition-fibred-groupoids} says exactly that every morphism of $\mathcal{S}$ is strongly cartesian. Hence condition (1) of Definition \ref{definition-fibred-groupoids} implies that $\mathcal{S}$ is a fibred category over $\mathcal{C}$. \medskip\noindent Conversely, assume all fibre categories are groupoids and $\mathcal{S}$ is a fibred category over $\mathcal{C}$. We have to check conditions (1) and (2) of Definition \ref{definition-fibred-groupoids}. The first condition follows trivially. Let $\phi : y \to x$, $\psi : z \to x$ and $f : p(z) \to p(y)$ such that $p(\phi) \circ f = p(\psi)$ be as in condition (2) of Definition \ref{definition-fibred-groupoids}. Write $U = p(x)$, $V = p(y)$, $W = p(z)$, $p(\phi) = g : V \to U$, $p(\psi) = h : W \to U$. Choose a strongly cartesian $g^*x \to x$ lying over $g$. Then we get a morphism $i : y \to g^*x$ in $\mathcal{S}_V$, which is therefore an isomorphism. We also get a morphism $j : z \to g^*x$ corresponding to the pair $(\psi, f)$ as $g^*x \to x$ is strongly cartesian. Then one checks that $\chi = i^{-1} \circ j$ is a solution. \medskip\noindent We have seen in the proof of (1) $\Rightarrow$ (2) that every morphism of $\mathcal{S}$ is strongly cartesian. The final statement follows directly from Lemma \ref{lemma-fibred}. \end{proof} \begin{lemma} \label{lemma-fibred-gives-fibred-groupoids} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ be a fibred category. Let $\mathcal{S}'$ be the subcategory of $\mathcal{S}$ defined as follows \begin{enumerate} \item $\Ob(\mathcal{S}') = \Ob(\mathcal{S})$, and \item for $x, y \in \Ob(\mathcal{S}')$ the set of morphisms between $x$ and $y$ in $\mathcal{S}'$ is the set of strongly cartesian morphisms between $x$ and $y$ in $\mathcal{S}$. \end{enumerate} Let $p' : \mathcal{S}' \to \mathcal{C}$ be the restriction of $p$ to $\mathcal{S}'$. Then $p' : \mathcal{S}' \to \mathcal{C}$ is fibred in groupoids. \end{lemma} \begin{proof} Note that the construction makes sense since by Lemma \ref{lemma-composition-cartesian} the identity morphism of any object of $\mathcal{S}$ is strongly cartesian, and the composition of strongly cartesian morphisms is strongly cartesian. The first lifting property of Definition \ref{definition-fibred-groupoids} follows from the condition that in a fibred category given any morphism $f : V \to U$ and $x$ lying over $U$ there exists a strongly cartesian morphism $\varphi : y \to x$ lying over $f$. Let us check the second lifting property of Definition \ref{definition-fibred-groupoids} for the category $p' : \mathcal{S}' \to \mathcal{C}$ over $\mathcal{C}$. To do this we argue as in the discussion following Definition \ref{definition-fibred-groupoids}. Thus in Diagram \ref{equation-fibred-groupoids} the morphisms $\phi$, $\psi$ and $\gamma$ are strongly cartesian morphisms of $\mathcal{S}$. Hence $\gamma$ and $\phi \circ \psi$ are strongly cartesian morphisms of $\mathcal{S}$ lying over the same arrow of $\mathcal{C}$ and having the same target in $\mathcal{S}$. By the discussion following Definition \ref{definition-cartesian-over-C} this means these two arrows are isomorphic as desired (here we use also that any isomorphism in $\mathcal{S}$ is strongly cartesian, by Lemma \ref{lemma-composition-cartesian} again). \end{proof} \begin{example} \label{example-group-homomorphism-fibreedingroupoids} A homomorphism of groups $p : G \to H$ gives rise to a functor $p : \mathcal{S}\to\mathcal{C}$ as in Example \ref{example-group-homomorphism-functor}. This functor $p : \mathcal{S}\to\mathcal{C}$ is fibred in groupoids if and only if $p$ is surjective. The fibre category $\mathcal{S}_U$ over the (unique) object $U\in \Ob(\mathcal{C})$ is the category associated to the kernel of $p$ as in Example \ref{example-group-groupoid}. \end{example} \noindent Given $p : \mathcal{S} \to \mathcal{C}$, we can ask: if the fibre category $\mathcal{S}_U$ is a groupoid for all $U \in \Ob(\mathcal{C})$, must $\mathcal{S}$ be fibred in groupoids over $\mathcal{C}$? We can see the answer is no as follows. Start with a category fibred in groupoids $p : \mathcal{S} \to \mathcal{C}$. Altering the morphisms in $\mathcal{S}$ which do not map to the identity morphism on some object does not alter the categories $\mathcal{S}_U$. Hence we can violate the existence and uniqueness conditions on lifts. One example is the functor from Example \ref{example-group-homomorphism-fibreedingroupoids} when $G \to H$ is not surjective. Here is another example. \begin{example} \label{example-not-fibred-in-groupoids-but-fibre-cats-are} Let $\Ob(\mathcal{C}) = \{A, B, T\}$ and $\Mor_\mathcal{C}(A, B) = \{f\}$, $\Mor_\mathcal{C}(B, T) = \{g\}$, $\Mor_\mathcal{C}(A, T) = \{h\} = \{gf\}, $ plus the identity morphism for each object. See the diagram below for a picture of this category. Now let $\Ob(\mathcal{S}) = \{A', B', T'\}$ and $\Mor_\mathcal{S}(A', B') = \emptyset$, $\Mor_\mathcal{S}(B', T') = \{g'\}$, $\Mor_\mathcal{S}(A', T') = \{h'\}, $ plus the identity morphisms. The functor $p : \mathcal{S} \to \mathcal{C}$ is obvious. Then for every $U \in \Ob(\mathcal{C})$, $\mathcal{S}_U$ is the category with one object and the identity morphism on that object, so a groupoid, but the morphism $f: A \to B$ cannot be lifted. Similarly, if we declare $\Mor_\mathcal{S}(A', B') = \{f'_1, f'_2\}$ and $ \Mor_\mathcal{S}(A', T') = \{h'\} = \{g'f'_1 \} = \{g'f'_2\}$, then the fibre categories are the same and $f: A \to B$ in the diagram below has two lifts. $$ \xymatrix{ B' \ar[r]^{g'} & T' & & B \ar[r]^g & T & \\ A' \ar@{-->}[u]^{??} \ar[ru]_{h'} & & \ar@{}[u]^{above} & A \ar[u]^f \ar[ru]_{gf = h} & \\ } $$ \end{example} \noindent Later we would like to make assertions such as ``any category fibred in groupoids over $\mathcal{C}$ is equivalent to a split one'', or ``any category fibred in groupoids whose fibre categories are setlike is equivalent to a category fibred in sets''. The notion of equivalence depends on the $2$-category we are working with. \begin{definition} \label{definition-categories-fibred-in-groupoids-over-C} Let $\mathcal{C}$ be a category. The {\it $2$-category of categories fibred in groupoids over $\mathcal{C}$} is the sub $2$-category of the $2$-category of fibred categories over $\mathcal{C}$ (see Definition \ref{definition-fibred-categories-over-C}) defined as follows: \begin{enumerate} \item Its objects will be categories $p : \mathcal{S} \to \mathcal{C}$ fibred in groupoids. \item Its $1$-morphisms $(\mathcal{S}, p) \to (\mathcal{S}', p')$ will be functors $G : \mathcal{S} \to \mathcal{S}'$ such that $p' \circ G = p$ (since every morphism is strongly cartesian $G$ automatically preserves them). \item Its $2$-morphisms $t : G \to H$ for $G, H : (\mathcal{S}, p) \to (\mathcal{S}', p')$ will be morphisms of functors such that $p'(t_x) = \text{id}_{p(x)}$ for all $x \in \Ob(\mathcal{S})$. \end{enumerate} \end{definition} \noindent Note that every $2$-morphism is automatically an isomorphism! Hence this is actually a $(2, 1)$-category and not just a $2$-category. Here is the obligatory lemma on $2$-fibre products. \begin{lemma} \label{lemma-2-product-fibred-categories} Let $\mathcal{C}$ be a category. The $2$-category of categories fibred in groupoids over $\mathcal{C}$ has 2-fibre products, and they are described as in Lemma \ref{lemma-2-product-categories-over-C}. \end{lemma} \begin{proof} By Lemma \ref{lemma-2-product-fibred-categories-over-C} the fibre product as described in Lemma \ref{lemma-2-product-categories-over-C} is a fibred category. Hence it suffices to prove that the fibre categories are groupoids, see Lemma \ref{lemma-fibred-groupoids}. By Lemma \ref{lemma-fibre-2-fibre-product-categories-over-C} it is enough to show that the $2$-fibre product of groupoids is a groupoid, which is clear (from the construction in Lemma \ref{lemma-2-fibre-product-categories} for example). \end{proof} \begin{lemma} \label{lemma-equivalence-fibred-categories} Let $p : \mathcal{S}\to \mathcal{C}$ and $p' : \mathcal{S'}\to \mathcal{C}$ be categories fibred in groupoids, and suppose that $G : \mathcal{S}\to \mathcal {S}'$ is a functor over $\mathcal{C}$. \begin{enumerate} \item Then $G$ is faithful (resp.\ fully faithful, resp.\ an equivalence) if and only if for each $U\in\Ob(\mathcal{C})$ the induced functor $G_U : \mathcal{S}_U\to \mathcal{S}'_U$ is faithful (resp.\ fully faithful, resp.\ an equivalence). \item If $G$ is an equivalence, then $G$ is an equivalence in the $2$-category of categories fibred in groupoids over $\mathcal{C}$. \end{enumerate} \end{lemma} \begin{proof} Let $x, y$ be objects of $\mathcal{S}$ lying over the same object $U$. Consider the commutative diagram $$ \xymatrix{ \Mor_\mathcal{S}(x, y) \ar[rd]_p \ar[rr]_G & & \Mor_{\mathcal{S}'}(G(x), G(y)) \ar[ld]^{p'} \\ & \Mor_\mathcal{C}(U, U) & } $$ From this diagram it is clear that if $G$ is faithful (resp.\ fully faithful) then so is each $G_U$. \medskip\noindent Suppose $G$ is an equivalence. For every object $x'$ of $\mathcal{S}'$ there exists an object $x$ of $\mathcal{S}$ such that $G(x)$ is isomorphic to $x'$. Suppose that $x'$ lies over $U'$ and $x$ lies over $U$. Then there is an isomorphism $f : U' \to U$ in $\mathcal{C}$, namely, $p'$ applied to the isomorphism $x' \to G(x)$. By the axioms of a category fibred in groupoids there exists an arrow $f^*x \to x$ of $\mathcal{S}$ lying over $f$. Hence there exists an isomorphism $\alpha : x' \to G(f^*x)$ such that $p'(\alpha) = \text{id}_{U'}$ (this time by the axioms for $\mathcal{S}'$). All in all we conclude that for every object $x'$ of $\mathcal{S}'$ we can choose a pair $(o_{x'}, \alpha_{x'})$ consisting of an object $o_{x'}$ of $\mathcal{S}$ and an isomorphism $\alpha_{x'} : x' \to G(o_{x'})$ with $p'(\alpha_{x'}) = \text{id}_{p'(x')}$. From this point on we proceed as usual (see proof of Lemma \ref{lemma-equivalence-categories}) to produce an inverse functor $F : \mathcal{S}' \to \mathcal{S}$, by taking $x' \mapsto o_{x'}$ and $\varphi' : x' \to y'$ to the unique arrow $\varphi_{\varphi'} : o_{x'} \to o_{y'}$ with $\alpha_{y'}^{-1} \circ G(\varphi_{\varphi'}) \circ \alpha_{x'} = \varphi'$. With these choices $F$ is a functor over $\mathcal{C}$. We omit the verification that $G \circ F$ and $F \circ G$ are $2$-isomorphic to the respective identity functors (in the $2$-category of categories fibred in groupoids over $\mathcal{C}$). \medskip\noindent Suppose that $G_U$ is faithful (resp.\ fully faithful) for all $U\in\Ob(\mathcal C)$. To show that $G$ is faithful (resp.\ fully faithful) we have to show for any objects $x, y\in\Ob(\mathcal{S})$ that $G$ induces an injection (resp.\ bijection) between $\Mor_\mathcal{S}(x, y)$ and $\Mor_{\mathcal{S}'}(G(x), G(y))$. Set $U = p(x)$ and $V = p(y)$. It suffices to prove that $G$ induces an injection (resp.\ bijection) between morphism $x \to y$ lying over $f$ to morphisms $G(x) \to G(y)$ lying over $f$ for any morphism $f : U \to V$. Now fix $f : U \to V$. Denote $f^*y \to y$ a pullback. Then also $G(f^*y) \to G(y)$ is a pullback. The set of morphisms from $x$ to $y$ lying over $f$ is bijective to the set of morphisms between $x$ and $f^*y$ lying over $\text{id}_U$. (By the second axiom of a category fibred in groupoids.) Similarly the set of morphisms from $G(x)$ to $G(y)$ lying over $f$ is bijective to the set of morphisms between $G(x)$ and $G(f^*y)$ lying over $\text{id}_U$. Hence the fact that $G_U$ is faithful (resp.\ fully faithful) gives the desired result. \medskip\noindent Finally suppose for all $G_U$ is an equivalence for all $U$, so it is fully faithful and essentially surjective. We have seen this implies $G$ is fully faithful, and thus to prove it is an equivalence we have to prove that it is essentially surjective. This is clear, for if $z'\in \Ob(\mathcal{S}')$ then $z'\in \Ob(\mathcal{S}'_U)$ where $U = p'(z')$. Since $G_U$ is essentially surjective we know that $z'$ is isomorphic, in $\mathcal{S}'_U$, to an object of the form $G_U(z)$ for some $z\in \Ob(\mathcal{S}_U)$. But morphisms in $\mathcal{S}'_U$ are morphisms in $\mathcal{S}'$ and hence $z'$ is isomorphic to $G(z)$ in $\mathcal{S}'$. \end{proof} \begin{lemma} \label{lemma-fully-faithful-diagonal-equivalence} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S}\to \mathcal{C}$ and $p' : \mathcal{S'}\to \mathcal{C}$ be categories fibred in groupoids. Let $G : \mathcal{S}\to \mathcal {S}'$ be a functor over $\mathcal{C}$. Then $G$ is fully faithful if and only if the diagonal $$ \Delta_G : \mathcal{S} \longrightarrow \mathcal{S} \times_{G, \mathcal{S}', G} \mathcal{S} $$ is an equivalence. \end{lemma} \begin{proof} By Lemma \ref{lemma-equivalence-fibred-categories} it suffices to look at fibre categories over an object $U$ of $\mathcal{C}$. An object of the right hand side is a triple $(x, x', \alpha)$ where $\alpha : G(x) \to G(x')$ is a morphism in $\mathcal{S}'_U$. The functor $\Delta_G$ maps the object $x$ of $\mathcal{S}_U$ to the triple $(x, x, \text{id}_{G(x)})$. Note that $(x, x', \alpha)$ is in the essential image of $\Delta_G$ if and only if $\alpha = G(\beta)$ for some morphism $\beta : x \to x'$ in $\mathcal{S}_U$ (details omitted). Hence in order for $\Delta_G$ to be an equivalence, every $\alpha$ has to be the image of a morphism $\beta : x \to x'$, and also every two distinct morphisms $\beta, \beta' : x \to x'$ have to give distinct morphisms $G(\beta), G(\beta')$. This proves the lemma. \end{proof} \begin{lemma} \label{lemma-morphisms-equivalent-fibred-groupoids} Let $\mathcal{C}$ be a category. Let $\mathcal{S}_i$, $i = 1, 2, 3, 4$ be categories fibred in groupoids over $\mathcal{C}$. Suppose that $\varphi : \mathcal{S}_1 \to \mathcal{S}_2$ and $\psi : \mathcal{S}_3 \to \mathcal{S}_4$ are equivalences over $\mathcal{C}$. Then $$ \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{S}_2, \mathcal{S}_3) \longrightarrow \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{S}_1, \mathcal{S}_4), \quad \alpha \longmapsto \psi \circ \alpha \circ \varphi $$ is an equivalence of categories. \end{lemma} \begin{proof} This is a generality and holds in any $2$-category. \end{proof} \begin{lemma} \label{lemma-inertia-fibred-groupoids} Let $\mathcal{C}$ be a category. If $p : \mathcal{S} \to \mathcal{C}$ is fibred in groupoids, then so is the inertia fibred category $\mathcal{I}_\mathcal{S} \to \mathcal{C}$. \end{lemma} \begin{proof} Clear from the construction in Lemma \ref{lemma-inertia-fibred-category} or by using (from the same lemma) that $I_\mathcal{S} \to \mathcal{S} \times_{\Delta, \mathcal{S} \times_\mathcal{C} \mathcal{S}, \Delta}\mathcal{S}$ is an equivalence and appealing to Lemma \ref{lemma-2-product-fibred-categories}. \end{proof} \begin{lemma} \label{lemma-cute-groupoids} Let $\mathcal{C}$ be a category. Let $U \in \Ob(\mathcal{C})$. If $p : \mathcal{S} \to \mathcal{C}$ is a category fibred in groupoids and $p$ factors through $p' : \mathcal{S} \to \mathcal{C}/U$ then $p' : \mathcal{S} \to \mathcal{C}/U$ is fibred in groupoids. \end{lemma} \begin{proof} We have already seen in Lemma \ref{lemma-cute} that $p'$ is a fibred category. Hence it suffices to prove the fibre categories are groupoids, see Lemma \ref{lemma-fibred-groupoids}. For $V \in \Ob(\mathcal{C})$ we have $$ \mathcal{S}_V = \coprod\nolimits_{f : V \to U} \mathcal{S}_{(f : V \to U)} $$ where the left hand side is the fibre category of $p$ and the right hand side is the disjoint union of the fibre categories of $p'$. Hence the result. \end{proof} \begin{lemma} \label{lemma-fibred-in-groupoids-over-fibred-in-groupoids} Let $\mathcal{A} \to \mathcal{B} \to \mathcal{C}$ be functors between categories. If $\mathcal{A}$ is fibred in groupoids over $\mathcal{B}$ and $\mathcal{B}$ is fibred in groupoids over $\mathcal{C}$, then $\mathcal{A}$ is fibred in groupoids over $\mathcal{C}$. \end{lemma} \begin{proof} One can prove this directly from the definition. However, we will argue using the criterion of Lemma \ref{lemma-fibred-groupoids}. By Lemma \ref{lemma-fibred-over-fibred} we see that $\mathcal{A}$ is fibred over $\mathcal{C}$. To finish the proof we show that the fibre category $\mathcal{A}_U$ is a groupoid for $U$ in $\mathcal{C}$. Namely, if $x \to y$ is a morphism of $\mathcal{A}_U$, then its image in $\mathcal{B}$ is an isomorphism as $\mathcal{B}_U$ is a groupoid. But then $x \to y$ is an isomorphism, for example by Lemma \ref{lemma-composition-cartesian} and the fact that every morphism of $\mathcal{A}$ is strongly $\mathcal{B}$-cartesian (see Lemma \ref{lemma-fibred-groupoids}). \end{proof} \begin{lemma} \label{lemma-fibred-groupoids-fibre-product-goes-up} Let $p : \mathcal{S} \to \mathcal{C}$ be a category fibred in groupoids. Let $x \to y$ and $z \to y$ be morphisms of $\mathcal{S}$. If $p(x) \times_{p(y)} p(z)$ exists, then $x \times_y z$ exists and $p(x \times_y z) = p(x) \times_{p(y)} p(z)$. \end{lemma} \begin{proof} Follows from Lemma \ref{lemma-fibred-category-representable-goes-up}. \end{proof} \begin{lemma} \label{lemma-ameliorate-morphism-categories-fibred-groupoids} Let $\mathcal{C}$ be a category. Let $F : \mathcal{X} \to \mathcal{Y}$ be a $1$-morphism of categories fibred in groupoids over $\mathcal{C}$. There exists a factorization $\mathcal{X} \to \mathcal{X}' \to \mathcal{Y}$ by $1$-morphisms of categories fibred in groupoids over $\mathcal{C}$ such that $\mathcal{X} \to \mathcal{X}'$ is an equivalence over $\mathcal{C}$ and such that $\mathcal{X}'$ is a category fibred in groupoids over $\mathcal{Y}$. \end{lemma} \begin{proof} Denote $p : \mathcal{X} \to \mathcal{C}$ and $q : \mathcal{Y} \to \mathcal{C}$ the structure functors. We construct $\mathcal{X}'$ explicitly as follows. An object of $\mathcal{X}'$ is a quadruple $(U, x, y, f)$ where $x \in \Ob(\mathcal{X}_U)$, $y \in \Ob(\mathcal{Y}_U)$ and $f : F(x) \to y$ is an isomorphism in $\mathcal{Y}_U$. A morphism $(a, b) : (U, x, y, f) \to (U', x', y', f')$ is given by $a : x \to x'$ and $b : y \to y'$ with $p(a) = q(b)$ and such that $f' \circ F(a) = b \circ f$. In other words $\mathcal{X}' = \mathcal{X} \times_{F, \mathcal{Y}, \text{id}} \mathcal{Y}$ with the construction of the $2$-fibre product from Lemma \ref{lemma-2-product-categories-over-C}. By Lemma \ref{lemma-2-product-fibred-categories} we see that $\mathcal{X}'$ is a category fibred in groupoids over $\mathcal{C}$ and that $\mathcal{X}' \to \mathcal{Y}$ is a morphism of categories over $\mathcal{C}$. As functor $\mathcal{X} \to \mathcal{X}'$ we take $x \mapsto (p(x), x, F(x), \text{id}_{F(x)})$ on objects and $(a : x \to x') \mapsto (a, F(a))$ on morphisms. It is clear that the composition $\mathcal{X} \to \mathcal{X}' \to \mathcal{Y}$ equals $F$. We omit the verification that $\mathcal{X} \to \mathcal{X}'$ is an equivalence of fibred categories over $\mathcal{C}$. \medskip\noindent Finally, we have to show that $\mathcal{X}' \to \mathcal{Y}$ is a category fibred in groupoids. Let $b : y' \to y$ be a morphism in $\mathcal{Y}$ and let $(U, x, y, f)$ be an object of $\mathcal{X}'$ lying over $y$. Because $\mathcal{X}$ is fibred in groupoids over $\mathcal{C}$ we can find a morphism $a : x' \to x$ lying over $U' = q(y') \to q(y) = U$. Since $\mathcal{Y}$ is fibred in groupoids over $\mathcal{C}$ and since both $F(x') \to F(x)$ and $y' \to y$ lie over the same morphism $U' \to U$ we can find $f' : F(x') \to y'$ lying over $\text{id}_{U'}$ such that $f \circ F(a) = b \circ f'$. Hence we obtain $(a, b) : (U', x', y', f') \to (U, x, y, f)$. This verifies the first condition (1) of Definition \ref{definition-fibred-groupoids}. To see (2) let $(a, b) : (U', x', y', f') \to (U, x, y, f)$ and $(a', b') : (U'', x'', y'', f'') \to (U, x, y, f)$ be morphisms of $\mathcal{X}'$ and let $b'' : y' \to y''$ be a morphism of $\mathcal{Y}$ such that $b' \circ b'' = b$. We have to show that there exists a unique morphism $a'' : x' \to x''$ such that $f'' \circ F(a'') = b'' \circ f'$ and such that $(a', b') \circ (a'', b'') = (a, b)$. Because $\mathcal{X}$ is fibred in groupoids we know there exists a unique morphism $a'' : x' \to x''$ such that $a' \circ a'' = a$ and $p(a'') = q(b'')$. Because $\mathcal{Y}$ is fibred in groupoids we see that $F(a'')$ is the unique morphism $F(x') \to F(x'')$ such that $F(a') \circ F(a'') = F(a)$ and $q(F(a'')) = q(b'')$. The relation $f'' \circ F(a'') = b'' \circ f'$ follows from this and the given relations $f \circ F(a) = b \circ f'$ and $f \circ F(a') = b' \circ f''$. \end{proof} \begin{lemma} \label{lemma-amelioration-unique} Let $\mathcal{C}$ be a category. Let $F : \mathcal{X} \to \mathcal{Y}$ be a $1$-morphism of categories fibred in groupoids over $\mathcal{C}$. Assume we have a $2$-commutative diagram $$ \xymatrix{ \mathcal{X}' \ar[rd]_f & \mathcal{X} \ar[l]^a \ar[d]^F \ar[r]_b & \mathcal{X}'' \ar[ld]^g \\ & \mathcal{Y} } $$ where $a$ and $b$ are equivalences of categories over $\mathcal{C}$ and $f$ and $g$ are categories fibred in groupoids. Then there exists an equivalence $h : \mathcal{X}'' \to \mathcal{X}'$ of categories over $\mathcal{Y}$ such that $h \circ b$ is $2$-isomorphic to $a$ as $1$-morphisms of categories over $\mathcal{C}$. If the diagram above actually commutes, then we can arrange it so that $h \circ b$ is $2$-isomorphic to $a$ as $1$-morphisms of categories over $\mathcal{Y}$. \end{lemma} \begin{proof} We will show that both $\mathcal{X}'$ and $\mathcal{X}''$ over $\mathcal{Y}$ are equivalent to the category fibred in groupoids $\mathcal{X} \times_{F, \mathcal{Y}, \text{id}} \mathcal{Y}$ over $\mathcal{Y}$, see proof of Lemma \ref{lemma-ameliorate-morphism-categories-fibred-groupoids}. Choose a quasi-inverse $b^{-1} : \mathcal{X}'' \to \mathcal{X}$ in the $2$-category of categories over $\mathcal{C}$. Since the right triangle of the diagram is $2$-commutative we see that $$ \xymatrix{ \mathcal{X} \ar[d]_F & \mathcal{X}'' \ar[l]^{b^{-1}} \ar[d]^g \\ \mathcal{Y} & \mathcal{Y} \ar[l] } $$ is $2$-commutative. Hence we obtain a $1$-morphism $c : \mathcal{X}'' \to \mathcal{X} \times_{F, \mathcal{Y}, \text{id}} \mathcal{Y}$ by the universal property of the $2$-fibre product. Moreover $c$ is a morphism of categories over $\mathcal{Y}$ (!) and an equivalence (by the assumption that $b$ is an equivalence, see Lemma \ref{lemma-equivalence-2-fibre-product}). Hence $c$ is an equivalence in the $2$-category of categories fibred in groupoids over $\mathcal{Y}$ by Lemma \ref{lemma-equivalence-fibred-categories}. \medskip\noindent We still have to construct a $2$-isomorphism between $c \circ b$ and the functor $d : \mathcal{X} \to \mathcal{X} \times_{F, \mathcal{Y}, \text{id}} \mathcal{Y}$, $x \mapsto (p(x), x, F(x), \text{id}_{F(x)})$ constructed in the proof of Lemma \ref{lemma-ameliorate-morphism-categories-fibred-groupoids}. Let $\alpha : F \to g \circ b$ and $\beta : b^{-1} \circ b \to \text{id}$ be $2$-isomorphisms between $1$-morphisms of categories over $\mathcal{C}$. Note that $c \circ b$ is given by the rule $$ x \mapsto (p(x), b^{-1}(b(x)), g(b(x)), \alpha_x \circ F(\beta_x)) $$ on objects. Then we see that $$ (\beta_x, \alpha_x) : (p(x), x, F(x), \text{id}_{F(x)}) \longrightarrow (p(x), b^{-1}(b(x)), g(b(x)), \alpha_x \circ F(\beta_x)) $$ is a functorial isomorphism which gives our $2$-morphism $d \to b \circ c$. Finally, if the diagram commutes then $\alpha_x$ is the identity for all $x$ and we see that this $2$-morphism is a $2$-morphism in the $2$-category of categories over $\mathcal{Y}$. \end{proof} \section{Presheaves of categories} \label{section-presheaves-categories} \noindent In this section we compare the notion of fibred categories with the closely related notion of a ``presheaf of categories''. The basic construction is explained in the following example. \begin{example} \label{example-functor-categories} Let $\mathcal{C}$ be a category. Suppose that $F : \mathcal{C}^{opp} \to \textit{Cat}$ is a functor to the $2$-category of categories, see Definition \ref{definition-functor-into-2-category}. For $f : V \to U$ in $\mathcal{C}$ we will suggestively write $F(f) = f^\ast$ for the functor from $F(U)$ to $F(V)$. From this we can construct a fibred category $\mathcal{S}_F$ over $\mathcal{C}$ as follows. Define $$ \Ob(\mathcal{S}_F) = \{(U, x) \mid U\in \Ob(\mathcal{C}), x\in \Ob(F(U))\}. $$ For $(U, x), (V, y) \in \Ob(\mathcal{S}_F)$ we define \begin{align*} \Mor_{\mathcal{S}_F}((V, y), (U, x)) & = \{ (f, \phi) \mid f \in \Mor_\mathcal{C}(V, U), \phi \in \Mor_{F(V)}(y, f^\ast x)\} \\ & = \coprod\nolimits_{f \in \Mor_\mathcal{C}(V, U)} \Mor_{F(V)}(y, f^\ast x) \end{align*} In order to define composition we use that $g^\ast \circ f^\ast = (f \circ g)^\ast$ for a pair of composable morphisms of $\mathcal{C}$ (by definition of a functor into a $2$-category). Namely, we define the composition of $\psi : z \to g^\ast y$ and $ \phi : y \to f^\ast x$ to be $ g^\ast(\phi) \circ \psi$. The functor $p_F : \mathcal{S}_F \to \mathcal{C}$ is given by the rule $(U, x) \mapsto U$. Let us check that this is indeed a fibred category. Given $f: V \to U$ in $\mathcal{C}$ and $(U, x)$ a lift of $U$, then we claim $(f, \text{id}_{f^\ast x}): (V, {f^\ast x}) \to (U, x)$ is a strongly cartesian lift of $f$. We have to show a $h$ in the diagram on the left determines $(h, \nu)$ on the right: $$ \xymatrix{ V \ar[r]^f & U & (V, f^*x) \ar[r]^{(f, \text{id}_{f^*x})} & (U, x) \\ W \ar@{-->}[u]^h \ar[ru]_g & & (W, z) \ar@{-->}[u]^{(h, \nu)} \ar[ru]_{(g, \psi)} & } $$ Just take $\nu = \psi$ which works because $f \circ h = g$ and hence $g^*x = h^*f^*x$. Moreover, this is the only lift making the diagram (on the right) commute. \end{example} \begin{definition} \label{definition-split-fibred-category} Let $\mathcal{C}$ be a category. Suppose that $F : \mathcal{C}^{opp} \to \textit{Cat}$ is a functor to the $2$-category of categories. We will write $p_F : \mathcal{S}_F \to \mathcal{C}$ for the fibred category constructed in Example \ref{example-functor-categories}. A {\it split fibred category} is a fibred category isomorphic (!) over $\mathcal{C}$ to one of these categories {\it $\mathcal{S}_F$}. \end{definition} \begin{lemma} \label{lemma-when-split} Let $\mathcal{C}$ be a category. Let $\mathcal{S}$ be a fibred category over $\mathcal{C}$. Then $\mathcal{S}$ is split if and only if for some choice of pullbacks (see Definition \ref{definition-pullback-functor-fibred-category}) the pullback functors $(f \circ g)^*$ and $g^* \circ f^*$ are equal. \end{lemma} \begin{proof} This is immediate from the definitions. \end{proof} \begin{lemma} \label{lemma-fibred-strict} Let $ p : \mathcal{S} \to \mathcal{C}$ be a fibred category. There exists a contravariant functor $F : \mathcal{C} \to \textit{Cat}$ such that $\mathcal{S}$ is equivalent to $\mathcal{S}_F$ in the $2$-category of fibred categories over $\mathcal{C}$. In other words, every fibred category is equivalent to a split one. \end{lemma} \begin{proof} Let us make a choice of pullbacks (see Definition \ref{definition-pullback-functor-fibred-category}). By Lemma \ref{lemma-fibred} we get pullback functors $f^*$ for every morphism $f$ of $\mathcal{C}$. \medskip\noindent We construct a new category $\mathcal{S}'$ as follows. The objects of $\mathcal{S}'$ are pairs $(x, f)$ consisting of a morphism $f : V \to U$ of $\mathcal{C}$ and an object $x$ of $\mathcal{S}$ over $U$, i.e., $x\in \Ob(\mathcal{S}_U)$. The functor $p' : \mathcal{S}' \to \mathcal{C}$ will map the pair $(x, f)$ to the source of the morphism $f$, in other words $p'(x, f : V\to U) = V$. A morphism $\varphi : (x_1, f_1: V_1 \to U_1) \to (x_2, f_2 : V_2 \to U_2)$ is given by a pair $(\varphi, g)$ consisting of a morphism $g : V_1 \to V_2$ and a morphism $\varphi : f_1^\ast x_1 \to f_2^\ast x_2$ with $p(\varphi) = g$. It is no problem to define the composition law: $(\varphi, g) \circ (\psi, h) = (\varphi \circ \psi, g\circ h)$ for any pair of composable morphisms. There is a natural functor $\mathcal{S} \to \mathcal{S}'$ which simply maps $x$ over $U$ to the pair $(x, \text{id}_U)$. \medskip\noindent At this point we need to check that $p'$ makes $\mathcal{S}'$ into a fibred category over $\mathcal{C}$, and we need to check that $\mathcal{S} \to \mathcal{S}'$ is an equivalence of categories over $\mathcal{C}$ which maps strongly cartesian morphisms to strongly cartesian morphisms. We omit the verifications. \medskip\noindent Finally, we can define pullback functors on $\mathcal{S}'$ by setting $g^\ast(x, f) = (x, f \circ g)$ on objects if $g : V' \to V$ and $f : V \to U$. On morphisms $(\varphi, \text{id}_V) : (x_1, f_1) \to (x_2, f_2)$ between morphisms in $\mathcal{S}'_V$ we set $g^\ast(\varphi, \text{id}_V) = (g^\ast\varphi, \text{id}_{V'})$ where we use the unique identifications $g^\ast f_i^\ast x_i = (f_i \circ g)^\ast x_i$ from Lemma \ref{lemma-fibred} to think of $g^\ast\varphi$ as a morphism from $(f_1 \circ g)^\ast x_1$ to $(f_2 \circ g)^\ast x_2$. Clearly, these pullback functors $g^\ast$ have the property that $g_1^\ast \circ g_2^\ast = (g_2\circ g_1)^\ast$, in other words $\mathcal{S}'$ is split as desired. \end{proof} \section{Presheaves of groupoids} \label{section-presheaves-groupoids} \noindent In this section we compare the notion of categories fibred in groupoids with the closely related notion of a ``presheaf of groupoids''. The basic construction is explained in the following example. \begin{example} \label{example-functor-groupoids} This example is the analogue of Example \ref{example-functor-categories}, for ``presheaves of groupoids'' instead of ``presheaves of categories''. The output will be a category fibred in groupoids instead of a fibred category. Suppose that $F : \mathcal{C}^{opp} \to \textit{Groupoids}$ is a functor to the category of groupoids, see Definition \ref{definition-functor-into-2-category}. For $f : V \to U$ in $\mathcal{C}$ we will suggestively write $F(f) = f^\ast$ for the functor from $F(U)$ to $F(V)$. We construct a category $\mathcal{S}_F$ fibred in groupoids over $\mathcal{C}$ as follows. Define $$ \Ob(\mathcal{S}_F) = \{(U, x) \mid U\in \Ob(\mathcal{C}), x\in \Ob(F(U))\}. $$ For $(U, x), (V, y) \in \Ob(\mathcal{S}_F)$ we define \begin{align*} \Mor_{\mathcal{S}_F}((V, y), (U, x)) & = \{ (f, \phi) \mid f \in \Mor_\mathcal{C}(V, U), \phi \in \Mor_{F(V)}(y, f^\ast x)\} \\ & = \coprod\nolimits_{f \in \Mor_\mathcal{C}(V, U)} \Mor_{F(V)}(y, f^\ast x) \end{align*} In order to define composition we use that $g^\ast \circ f^\ast = (f \circ g)^\ast$ for a pair of composable morphisms of $\mathcal{C}$ (by definition of a functor into a $2$-category). Namely, we define the composition of $\psi : z \to g^\ast y$ and $ \phi : y \to f^\ast x$ to be $ g^\ast(\phi) \circ \psi$. The functor $p_F : \mathcal{S}_F \to \mathcal{C}$ is given by the rule $(U, x) \mapsto U$. The condition that $F(U)$ is a groupoid for every $U$ guarantees that $\mathcal{S}_F$ is fibred in groupoids over $\mathcal{C}$, as we have already seen in Example \ref{example-functor-categories} that $\mathcal{S}_F$ is a fibred category, see Lemma \ref{lemma-fibred-groupoids}. But we can also prove conditions (1), (2) of Definition \ref{definition-fibred-groupoids} directly as follows: (1) Lifts of morphisms exist since given $f: V \to U$ in $\mathcal{C}$ and $(U, x)$ an object of $\mathcal{S}_F$ over $U$, then $(f, \text{id}_{f^\ast x}): (V, {f^\ast x}) \to (U, x)$ is a lift of $f$. (2) Suppose given solid diagrams as follows $$ \xymatrix{ V \ar[r]^f & U & (V, y) \ar[r]^{(f, \phi)} & (U, x) \\ W \ar@{-->}[u]^h \ar[ru]_g & & (W, z) \ar@{-->}[u]^{(h, \nu)} \ar[ru]_{(g, \psi)} & \\ } $$ Then for the dotted arrows we have $\nu = (h^\ast \phi)^{-1} \circ \psi$ so given $h$ there exists a $\nu$ which is unique by uniqueness of inverses. \end{example} \begin{definition} \label{definition-split-category-fibred-in-groupoids} Let $\mathcal{C}$ be a category. Suppose that $F : \mathcal{C}^{opp} \to \textit{Groupoids}$ is a functor to the $2$-category of groupoids. We will write $p_F : \mathcal{S}_F \to \mathcal{C}$ for the category fibred in groupoids constructed in Example \ref{example-functor-groupoids}. A {\it split category fibred in groupoids} is a category fibred in groupoids isomorphic (!) over $\mathcal{C}$ to one of these categories {\it $\mathcal{S}_F$}. \end{definition} \begin{lemma} \label{lemma-fibred-groupoids-strict} Let $ p : \mathcal{S} \to \mathcal{C}$ be a category fibred in groupoids. There exists a contravariant functor $F : \mathcal{C} \to \textit{Groupoids}$ such that $\mathcal{S}$ is equivalent to $\mathcal{S}_F$ over $\mathcal{C}$. In other words, every category fibred in groupoids is equivalent to a split one. \end{lemma} \begin{proof} Make a choice of pullbacks (see Definition \ref{definition-pullback-functor-fibred-category}). By Lemmas \ref{lemma-fibred} and \ref{lemma-fibred-groupoids} we get pullback functors $f^*$ for every morphism $f$ of $\mathcal{C}$. \medskip\noindent We construct a new category $\mathcal{S}'$ as follows. The objects of $\mathcal{S}'$ are pairs $(x, f)$ consisting of a morphism $f : V \to U$ of $\mathcal{C}$ and an object $x$ of $\mathcal{S}$ over $U$, i.e., $x\in \Ob(\mathcal{S}_U)$. The functor $p' : \mathcal{S}' \to \mathcal{C}$ will map the pair $(x, f)$ to the source of the morphism $f$, in other words $p'(x, f : V\to U) = V$. A morphism $\varphi : (x_1, f_1: V_1 \to U_1) \to (x_2, f_2 : V_2 \to U_2)$ is given by a pair $(\varphi, g)$ consisting of a morphism $g : V_1 \to V_2$ and a morphism $\varphi : f_1^\ast x_1 \to f_2^\ast x_2$ with $p(\varphi) = g$. It is no problem to define the composition law: $(\varphi, g) \circ (\psi, h) = (\varphi \circ \psi, g\circ h)$ for any pair of composable morphisms. There is a natural functor $\mathcal{S} \to \mathcal{S}'$ which simply maps $x$ over $U$ to the pair $(x, \text{id}_U)$. \medskip\noindent At this point we need to check that $p'$ makes $\mathcal{S}'$ into a category fibred in groupoids over $\mathcal{C}$, and we need to check that $\mathcal{S} \to \mathcal{S}'$ is an equivalence of categories over $\mathcal{C}$. We omit the verifications. \medskip\noindent Finally, we can define pullback functors on $\mathcal{S}'$ by setting $g^\ast(x, f) = (x, f \circ g)$ on objects if $g : V' \to V$ and $f : V \to U$. On morphisms $(\varphi, \text{id}_V) : (x_1, f_1) \to (x_2, f_2)$ between morphisms in $\mathcal{S}'_V$ we set $g^\ast(\varphi, \text{id}_V) = (g^\ast\varphi, \text{id}_{V'})$ where we use the unique identifications $g^\ast f_i^\ast x_i = (f_i \circ g)^\ast x_i$ from Lemma \ref{lemma-fibred-groupoids} to think of $g^\ast\varphi$ as a morphism from $(f_1 \circ g)^\ast x_1$ to $(f_2 \circ g)^\ast x_2$. Clearly, these pullback functors $g^\ast$ have the property that $g_1^\ast \circ g_2^\ast = (g_2\circ g_1)^\ast$, in other words $\mathcal{S}'$ is split as desired. \end{proof} \noindent We will see an alternative proof of this lemma in Section \ref{section-representable-1-morphisms}. \section{Categories fibred in sets} \label{section-fibred-in-sets} \begin{definition} \label{definition-discrete} A category is called {\it discrete} if the only morphisms are the identity morphisms. \end{definition} \noindent A discrete category has only one interesting piece of information: its set of objects. Thus we sometime confuse discrete categories with sets. \begin{definition} \label{definition-category-fibred-sets} Let $\mathcal{C}$ be a category. A {\it category fibred in sets}, or a {\it category fibred in discrete categories} is a category fibred in groupoids all of whose fibre categories are discrete. \end{definition} \noindent We want to clarify the relationship between categories fibred in sets and presheaves (see Definition \ref{definition-presheaf}). To do this it makes sense to first make the following definition. \begin{definition} \label{definition-categories-fibred-in-sets-over-C} Let $\mathcal{C}$ be a category. The {\it $2$-category of categories fibred in sets over $\mathcal{C}$} is the sub $2$-category of the category of categories fibred in groupoids over $\mathcal{C}$ (see Definition \ref{definition-categories-fibred-in-groupoids-over-C}) defined as follows: \begin{enumerate} \item Its objects will be categories $p : \mathcal{S} \to \mathcal{C}$ fibred in sets. \item Its $1$-morphisms $(\mathcal{S}, p) \to (\mathcal{S}', p')$ will be functors $G : \mathcal{S} \to \mathcal{S}'$ such that $p' \circ G = p$ (since every morphism is strongly cartesian $G$ automatically preserves them). \item Its $2$-morphisms $t : G \to H$ for $G, H : (\mathcal{S}, p) \to (\mathcal{S}', p')$ will be morphisms of functors such that $p'(t_x) = \text{id}_{p(x)}$ for all $x \in \Ob(\mathcal{S})$. \end{enumerate} \end{definition} \noindent Note that every $2$-morphism is automatically an isomorphism. Hence this $2$-category is actually a $(2, 1)$-category. Here is the obligatory lemma on the existence of $2$-fibre products. \begin{lemma} \label{lemma-2-product-categories-fibred-sets} Let $\mathcal{C}$ be a category. The 2-category of categories fibred in sets over $\mathcal{C}$ has 2-fibre products. More precisely, the 2-fibre product described in Lemma \ref{lemma-2-product-categories-over-C} returns a category fibred in sets if one starts out with such. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{example} \label{example-presheaf} This example is the analogue of Examples \ref{example-functor-categories} and \ref{example-functor-groupoids} for presheaves instead of ``presheaves of categories''. The output will be a category fibred in sets instead of a fibred category. Suppose that $F : \mathcal{C}^{opp} \to \textit{Sets}$ is a presheaf. For $f : V \to U$ in $\mathcal{C}$ we will suggestively write $F(f) = f^\ast : F(U) \to F(V)$. We construct a category $\mathcal{S}_F$ fibred in sets over $\mathcal{C}$ as follows. Define $$ \Ob(\mathcal{S}_F) = \{(U, x) \mid U \in \Ob(\mathcal{C}), x \in \Ob(F(U))\}. $$ For $(U, x), (V, y) \in \Ob(\mathcal{S}_F)$ we define \begin{align*} \Mor_{\mathcal{S}_F}((V, y), (U, x)) & = \{f \in \Mor_\mathcal{C}(V, U) \mid f^*x = y\} \end{align*} Composition is inherited from composition in $\mathcal{C}$ which works as $g^\ast \circ f^\ast = (f \circ g)^\ast$ for a pair of composable morphisms of $\mathcal{C}$. The functor $p_F : \mathcal{S}_F \to \mathcal{C}$ is given by the rule $(U, x) \mapsto U$. As every fibre category $\mathcal{S}_{F, U}$ is discrete with underlying set $F(U)$ and we have already see in Example \ref{example-functor-groupoids} that $\mathcal{S}_F$ is a category fibred in groupoids, we conclude that $\mathcal{S}_F$ is fibred in sets. \end{example} \begin{lemma} \label{lemma-2-category-fibred-sets} \begin{slogan} Categories fibred in sets are precisely presheaves. \end{slogan} Let $\mathcal{C}$ be a category. The only $2$-morphisms between categories fibred in sets are identities. In other words, the $2$-category of categories fibred in sets is a category. Moreover, there is an equivalence of categories $$ \left\{ \begin{matrix} \text{the category of presheaves}\\ \text{of sets over }\mathcal{C} \end{matrix} \right\} \leftrightarrow \left\{ \begin{matrix} \text{the category of categories}\\ \text{fibred in sets over }\mathcal{C} \end{matrix} \right\} $$ The functor from left to right is the construction $F \to \mathcal{S}_F$ discussed in Example \ref{example-presheaf}. The functor from right to left assigns to $p : \mathcal{S} \to \mathcal{C}$ the presheaf of objects $U \mapsto \Ob(\mathcal{S}_U)$. \end{lemma} \begin{proof} The first assertion is clear, as the only morphisms in the fibre categories are identities. \medskip\noindent Suppose that $p : \mathcal{S} \to \mathcal{C}$ is fibred in sets. Let $f : V \to U$ be a morphism in $\mathcal{C}$ and let $x \in \Ob(\mathcal{S}_U)$. Then there is exactly one choice for the object $f^\ast x$. Thus we see that $(f \circ g)^\ast x = g^\ast(f^\ast x)$ for $f, g$ as in Lemma \ref{lemma-fibred-groupoids}. It follows that we may think of the assignments $U \mapsto \Ob(\mathcal{S}_U)$ and $f \mapsto f^\ast$ as a presheaf on $\mathcal{C}$. \end{proof} \noindent Here is an important example of a category fibred in sets. \begin{example} \label{example-fibred-category-from-functor-of-points} Let $\mathcal{C}$ be a category. Let $X \in \Ob(\mathcal{C})$. Consider the representable presheaf $h_X = \Mor_\mathcal{C}(-, X)$ (see Example \ref{example-hom-functor}). On the other hand, consider the category $p : \mathcal{C}/X \to \mathcal{C}$ from Example \ref{example-category-over-X}. The fibre category $(\mathcal{C}/X)_U$ has as objects morphisms $h : U \to X$, and only identities as morphisms. Hence we see that under the correspondence of Lemma \ref{lemma-2-category-fibred-sets} we have $$ h_X \longleftrightarrow \mathcal{C}/X. $$ In other words, the category $\mathcal{C}/X$ is canonically equivalent to the category $\mathcal{S}_{h_X}$ associated to $h_X$ in Example \ref{example-presheaf}. \end{example} \noindent For this reason it is tempting to define a ``representable'' object in the 2-category of categories fibred in groupoids to be a category fibred in sets whose associated presheaf is representable. However, this is would not be a good definition for use since we prefer to have a notion which is invariant under equivalences. To make this precise we study exactly which categories fibred in groupoids are equivalent to categories fibred in sets. \section{Categories fibred in setoids} \label{section-fibred-in-setoids} \begin{definition} \label{definition-setoid} Let us call a category a {\it setoid}\footnote{A set on steroids!?} if it is a groupoid where every object has exactly one automorphism: the identity. \end{definition} \noindent If $C$ is a set with an equivalence relation $\sim$, then we can make a setoid $\mathcal{C}$ as follows: $\Ob(\mathcal{C}) = C$ and $\Mor_\mathcal{C}(x, y) = \emptyset$ unless $x \sim y$ in which case we set $\Mor_\mathcal{C}(x, y) = \{1\}$. Transitivity of $\sim$ means that we can compose morphisms. Conversely any setoid category defines an equivalence relation on its objects (isomorphism) such that you recover the category (up to unique isomorphism -- not equivalence) from the procedure just described. \medskip\noindent Discrete categories are setoids. For any setoid $\mathcal{C}$ there is a canonical procedure to make a discrete category equivalent to it, namely one replaces $\Ob(\mathcal{C})$ by the set of isomorphism classes (and adds identity morphisms). In terms of sets endowed with an equivalence relation this corresponds to taking the quotient by the equivalence relation. \begin{definition} \label{definition-category-fibred-setoids} Let $\mathcal{C}$ be a category. A {\it category fibred in setoids} is a category fibred in groupoids all of whose fibre categories are setoids. \end{definition} \noindent Below we will clarify the relationship between categories fibred in setoids and categories fibred in sets. \begin{definition} \label{definition-categories-fibred-in-setoids-over-C} Let $\mathcal{C}$ be a category. The {\it $2$-category of categories fibred in setoids over $\mathcal{C}$} is the sub $2$-category of the category of categories fibred in groupoids over $\mathcal{C}$ (see Definition \ref{definition-categories-fibred-in-groupoids-over-C}) defined as follows: \begin{enumerate} \item Its objects will be categories $p : \mathcal{S} \to \mathcal{C}$ fibred in setoids. \item Its $1$-morphisms $(\mathcal{S}, p) \to (\mathcal{S}', p')$ will be functors $G : \mathcal{S} \to \mathcal{S}'$ such that $p' \circ G = p$ (since every morphism is strongly cartesian $G$ automatically preserves them). \item Its $2$-morphisms $t : G \to H$ for $G, H : (\mathcal{S}, p) \to (\mathcal{S}', p')$ will be morphisms of functors such that $p'(t_x) = \text{id}_{p(x)}$ for all $x \in \Ob(\mathcal{S})$. \end{enumerate} \end{definition} \noindent Note that every $2$-morphism is automatically an isomorphism. Hence this $2$-category is actually a $(2, 1)$-category. \noindent Here is the obligatory lemma on the existence of $2$-fibre products. \begin{lemma} \label{lemma-2-product-categories-fibred-setoids} Let $\mathcal{C}$ be a category. The 2-category of categories fibred in setoids over $\mathcal{C}$ has 2-fibre products. More precisely, the 2-fibre product described in Lemma \ref{lemma-2-product-categories-over-C} returns a category fibred in setoids if one starts out with such. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-setoid-fibres} Let $\mathcal{C}$ be a category. Let $\mathcal{S}$ be a category over $\mathcal{C}$. \begin{enumerate} \item If $\mathcal{S} \to \mathcal{S}'$ is an equivalence over $\mathcal{C}$ with $\mathcal{S}'$ fibred in sets over $\mathcal{C}$, then \begin{enumerate} \item $\mathcal{S}$ is fibred in setoids over $\mathcal{C}$, and \item for each $U \in \Ob(\mathcal{C})$ the map $\Ob(\mathcal{S}_U) \to \Ob(\mathcal{S}'_U)$ identifies the target as the set of isomorphism classes of the source. \end{enumerate} \item If $p : \mathcal{S} \to \mathcal{C}$ is a category fibred in setoids, then there exists a category fibred in sets $p' : \mathcal{S}' \to \mathcal{C}$ and an equivalence $\text{can} : \mathcal{S} \to \mathcal{S}'$ over $\mathcal{C}$. \end{enumerate} \end{lemma} \begin{proof} Let us prove (2). An object of the category $\mathcal{S}'$ will be a pair $(U, \xi)$, where $U \in \Ob(\mathcal{C})$ and $\xi$ is an isomorphism class of objects of $\mathcal{S}_U$. A morphism $(U, \xi) \to (V , \psi)$ is given by a morphism $x \to y$, where $x \in \xi$ and $y \in \psi$. Here we identify two morphisms $x \to y$ and $x' \to y'$ if they induce the same morphism $U \to V$, and if for some choices of isomorphisms $x \to x'$ in $\mathcal{S}_U$ and $y \to y'$ in $\mathcal{S}_V$ the compositions $x \to x' \to y'$ and $x \to y \to y'$ agree. By construction there are surjective maps on objects and morphisms from $\mathcal{S} \to \mathcal{S}'$. We define composition of morphisms in $\mathcal{S}'$ to be the unique law that turns $\mathcal{S} \to \mathcal{S}'$ into a functor. Some details omitted. \end{proof} \noindent Thus categories fibred in setoids are exactly the categories fibred in groupoids which are equivalent to categories fibred in sets. Moreover, an equivalence of categories fibred in sets is an isomorphism by Lemma \ref{lemma-2-category-fibred-sets}. \begin{lemma} \label{lemma-2-category-fibred-setoids} Let $\mathcal{C}$ be a category. The construction of Lemma \ref{lemma-setoid-fibres} part (2) gives a functor $$ F : \left\{ \begin{matrix} \text{the 2-category of categories}\\ \text{fibred in setoids over }\mathcal{C} \end{matrix} \right\} \longrightarrow \left\{ \begin{matrix} \text{the category of categories}\\ \text{fibred in sets over }\mathcal{C} \end{matrix} \right\} $$ (see Definition \ref{definition-functor-into-2-category}). This functor is an equivalence in the following sense: \begin{enumerate} \item for any two 1-morphisms $f, g : \mathcal{S}_1 \to \mathcal{S}_2$ with $F(f) = F(g)$ there exists a unique 2-isomorphism $f \to g$, \item for any morphism $h : F(\mathcal{S}_1) \to F(\mathcal{S}_2)$ there exists a 1-morphism $f : \mathcal{S}_1 \to \mathcal{S}_2$ with $F(f) = h$, and \item any category fibred in sets $\mathcal{S}$ is equal to $F(\mathcal{S})$. \end{enumerate} In particular, defining $F_i \in \textit{PSh}(\mathcal{C})$ by the rule $F_i(U) = \Ob(\mathcal{S}_{i, U})/\cong$, we have $$ \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{S}_1, \mathcal{S}_2) \Big/ 2\text{-isomorphism} = \Mor_{\textit{PSh}(\mathcal{C})}(F_1, F_2) $$ More precisely, given any map $\phi : F_1 \to F_2$ there exists a $1$-morphism $f : \mathcal{S}_1 \to \mathcal{S}_2$ which induces $\phi$ on isomorphism classes of objects and which is unique up to unique $2$-isomorphism. \end{lemma} \begin{proof} By Lemma \ref{lemma-2-category-fibred-sets} the target of $F$ is a category hence the assertion makes sense. The construction of Lemma \ref{lemma-setoid-fibres} part (2) assigns to $\mathcal{S}$ the category fibred in sets whose value over $U$ is the set of isomorphism classes in $\mathcal{S}_U$. Hence it is clear that it defines a functor as indicated. Let $f, g : \mathcal{S}_1 \to \mathcal{S}_2$ with $F(f) = F(g)$ be as in (1). For each object $U$ of $\mathcal{C}$ and each object $x$ of $\mathcal{S}_{1, U}$ we see that $f(x) \cong g(x)$ by assumption. As $\mathcal{S}_2$ is fibred in setoids there exists a unique isomorphism $t_x : f(x) \to g(x)$ in $\mathcal{S}_{2, U}$. Clearly the rule $x \mapsto t_x$ gives the desired $2$-isomorphism $f \to g$. We omit the proofs of (2) and (3). To see the final assertion use Lemma \ref{lemma-2-category-fibred-sets} to see that the right hand side is equal to $\Mor_{\textit{Cat}/\mathcal{C}}(F(\mathcal{S}_1), F(\mathcal{S}_2))$ and apply (1) and (2) above. \end{proof} \noindent Here is another characterization of categories fibred in setoids among all categories fibred in groupoids. \begin{lemma} \label{lemma-characterize-fibred-setoids-inertia} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ be a category fibred in groupoids. The following are equivalent: \begin{enumerate} \item $p : \mathcal{S} \to \mathcal{C}$ is a category fibred in setoids, and \item the canonical $1$-morphism $\mathcal{I}_\mathcal{S} \to \mathcal{S}$, see (\ref{equation-inertia-structure-map}), is an equivalence (of categories over $\mathcal{C}$). \end{enumerate} \end{lemma} \begin{proof} Assume (2). The category $\mathcal{I}_\mathcal{S}$ has objects $(x, \alpha)$ where $x \in \mathcal{S}$, say with $p(x) = U$, and $\alpha : x \to x$ is a morphism in $\mathcal{S}_U$. Hence if $\mathcal{I}_\mathcal{S} \to \mathcal{S}$ is an equivalence over $\mathcal{C}$ then every pair of objects $(x, \alpha)$, $(x, \alpha')$ are isomorphic in the fibre category of $\mathcal{I}_\mathcal{S}$ over $U$. Looking at the definition of morphisms in $\mathcal{I}_\mathcal{S}$ we conclude that $\alpha$, $\alpha'$ are conjugate in the group of automorphisms of $x$. Hence taking $\alpha' = \text{id}_x$ we conclude that every automorphism of $x$ is equal to the identity. Since $\mathcal{S} \to \mathcal{C}$ is fibred in groupoids this implies that $\mathcal{S} \to \mathcal{C}$ is fibred in setoids. We omit the proof of (1) $\Rightarrow$ (2). \end{proof} \begin{lemma} \label{lemma-category-fibred-setoids-presheaves-products} Let $\mathcal{C}$ be a category. The construction of Lemma \ref{lemma-2-category-fibred-setoids} which associates to a category fibred in setoids a presheaf is compatible with products, in the sense that the presheaf associated to a $2$-fibre product $\mathcal{X} \times_\mathcal{Y} \mathcal{Z}$ is the fibre product of the presheaves associated to $\mathcal{X}, \mathcal{Y}, \mathcal{Z}$. \end{lemma} \begin{proof} Let $U \in \Ob(\mathcal{C})$. The lemma just says that $$ \Ob((\mathcal{X} \times_\mathcal{Y} \mathcal{Z})_U)/\!\cong \quad \text{equals} \quad \Ob(\mathcal{X}_U)/\!\cong \ \times_{\Ob(\mathcal{Y}_U)/\!\cong} \ \Ob(\mathcal{Z}_U)/\!\cong $$ the proof of which we omit. (But note that this would not be true in general if the category $\mathcal{Y}_U$ is not a setoid.) \end{proof} \section{Representable categories fibred in groupoids} \label{section-representable-fibred-groupoids} \noindent Here is our definition of a representable category fibred in groupoids. As promised this is invariant under equivalences. \begin{definition} \label{definition-representable-fibred-category} Let $\mathcal{C}$ be a category. A category fibred in groupoids $p : \mathcal{S} \to \mathcal{C}$ is called {\it representable} if there exist an object $X$ of $\mathcal{C}$ and an equivalence $j : \mathcal{S} \to \mathcal{C}/X$ (in the $2$-category of groupoids over $\mathcal{C}$). \end{definition} \noindent The usual abuse of notation is to say that {\it $X$ represents $\mathcal{S}$} and not mention the equivalence $j$. We spell out what this entails. \begin{lemma} \label{lemma-characterize-representable-fibred-category} Let $\mathcal{C}$ be a category. Let $p : \mathcal{S} \to \mathcal{C}$ be a category fibred in groupoids. \begin{enumerate} \item $\mathcal{S}$ is representable if and only if the following conditions are satisfied: \begin{enumerate} \item $\mathcal{S}$ is fibred in setoids, and \item the presheaf $U \mapsto \Ob(\mathcal{S}_U)/\cong$ is representable. \end{enumerate} \item If $\mathcal{S}$ is representable the pair $(X, j)$, where $j$ is the equivalence $j : \mathcal{S} \to \mathcal{C}/X$, is uniquely determined up to isomorphism. \end{enumerate} \end{lemma} \begin{proof} The first assertion follows immediately from Lemma \ref{lemma-setoid-fibres}. For the second, suppose that $j' : \mathcal{S} \to \mathcal{C}/X'$ is a second such pair. Choose a $1$-morphism $t' : \mathcal{C}/X' \to \mathcal{S}$ such that $j' \circ t' \cong \text{id}_{\mathcal{C}/X'}$ and $t' \circ j' \cong \text{id}_\mathcal{S}$. Then $j \circ t' : \mathcal{C}/X' \to \mathcal{C}/X$ is an equivalence. Hence it is an isomorphism, see Lemma \ref{lemma-2-category-fibred-sets}. Hence by the Yoneda Lemma \ref{lemma-yoneda} (via Example \ref{example-fibred-category-from-functor-of-points} for example) it is given by an isomorphism $X' \to X$. \end{proof} \begin{lemma} \label{lemma-morphisms-representable-fibred-categories} Let $\mathcal{C}$ be a category. Let $\mathcal{X}$, $\mathcal{Y}$ be categories fibred in groupoids over $\mathcal{C}$. Assume that $\mathcal{X}$, $\mathcal{Y}$ are representable by objects $X$, $Y$ of $\mathcal{C}$. Then $$ \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{X}, \mathcal{Y}) \Big/ 2\text{-isomorphism} = \Mor_\mathcal{C}(X, Y) $$ More precisely, given $\phi : X \to Y$ there exists a $1$-morphism $f : \mathcal{X} \to \mathcal{Y}$ which induces $\phi$ on isomorphism classes of objects and which is unique up to unique $2$-isomorphism. \end{lemma} \begin{proof} By Example \ref{example-fibred-category-from-functor-of-points} we have $\mathcal{C}/X = \mathcal{S}_{h_X}$ and $\mathcal{C}/Y = \mathcal{S}_{h_Y}$. By Lemma \ref{lemma-2-category-fibred-setoids} we have $$ \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{X}, \mathcal{Y}) \Big/ 2\text{-isomorphism} = \Mor_{\textit{PSh}(\mathcal{C})}(h_X, h_Y) $$ By the Yoneda Lemma \ref{lemma-yoneda} we have $\Mor_{\textit{PSh}(\mathcal{C})}(h_X, h_Y) = \Mor_\mathcal{C}(X, Y)$. \end{proof} \section{The 2-Yoneda lemma} \label{section-2-yoneda} \noindent Let $\mathcal{C}$ be a category. The $2$-category of fibred categories over $\mathcal{C}$ was constructed/defined in Definition \ref{definition-fibred-categories-over-C}. If $\mathcal{S}$, $\mathcal{S}'$ are fibred categories over $\mathcal{C}$ then $$ \Mor_{\textit{Fib}/\mathcal{C}}(\mathcal{S}, \mathcal{S}') $$ denotes the category of $1$-morphisms in this $2$-category. Here is the $2$-category analogue of the Yoneda lemma in the setting of fibred categories. \begin{lemma}[2-Yoneda lemma for fibred categories] \label{lemma-yoneda-2category-fibred} Let $\mathcal{C}$ be a category. Let $\mathcal{S} \to \mathcal{C}$ be a fibred category over $\mathcal{C}$. Let $U \in \Ob(\mathcal{C})$. The functor $$ \Mor_{\textit{Fib}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S}) \longrightarrow \mathcal{S}_U $$ given by $G \mapsto G(\text{id}_U)$ is an equivalence. \end{lemma} \begin{proof} Make a choice of pullbacks for $\mathcal{S}$ (see Definition \ref{definition-pullback-functor-fibred-category}). We define a functor $$ \mathcal{S}_U \longrightarrow \Mor_{\textit{Fib}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S}) $$ as follows. Given $x \in \Ob(\mathcal{S}_U)$ the associated functor is \begin{enumerate} \item on objects: $(f : V \to U) \mapsto f^*x$, and \item on morphisms: the arrow $(g : V'/U \to V/U)$ maps to the composition $$ (f \circ g)^*x \xrightarrow{(\alpha_{g, f})_x} g^*f^*x \rightarrow f^*x $$ where $\alpha_{g, f}$ is as in Lemma \ref{lemma-fibred}. \end{enumerate} We omit the verification that this is an inverse to the functor of the lemma. \end{proof} \noindent Let $\mathcal{C}$ be a category. The $2$-category of categories fibred in groupoids over $\mathcal{C}$ is a ``full'' sub $2$-category of the $2$-category of categories over $\mathcal{C}$ (see Definition \ref{definition-categories-fibred-in-groupoids-over-C}). Hence if $\mathcal{S}$, $\mathcal{S}'$ are fibred in groupoids over $\mathcal{C}$ then $$ \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{S}, \mathcal{S}') $$ denotes the category of $1$-morphisms in this $2$-category (see Definition \ref{definition-categories-over-C}). These are all groupoids, see remarks following Definition \ref{definition-categories-fibred-in-groupoids-over-C}. Here is the $2$-category analogue of the Yoneda lemma. \begin{lemma}[2-Yoneda lemma] \label{lemma-yoneda-2category} Let $\mathcal{S}\to \mathcal{C}$ be fibred in groupoids. Let $U \in \Ob(\mathcal{C})$. The functor $$ \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S}) \longrightarrow \mathcal{S}_U $$ given by $G \mapsto G(\text{id}_U)$ is an equivalence. \end{lemma} \begin{proof} Make a choice of pullbacks for $\mathcal{S}$ (see Definition \ref{definition-pullback-functor-fibred-category}). We define a functor $$ \mathcal{S}_U \longrightarrow \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S}) $$ as follows. Given $x \in \Ob(\mathcal{S}_U)$ the associated functor is \begin{enumerate} \item on objects: $(f : V \to U) \mapsto f^*x$, and \item on morphisms: the arrow $(g : V'/U \to V/U)$ maps to the composition $$ (f \circ g)^*x \xrightarrow{(\alpha_{g, f})_x} g^*f^*x \rightarrow f^*x $$ where $\alpha_{g, f}$ is as in Lemma \ref{lemma-fibred-groupoids}. \end{enumerate} We omit the verification that this is an inverse to the functor of the lemma. \end{proof} \begin{remark} \label{remark-alternative-fibred-groupoids-strict} We can use the $2$-Yoneda lemma to give an alternative proof of Lemma \ref{lemma-fibred-groupoids-strict}. Let $p : \mathcal{S} \to \mathcal{C}$ be a category fibred in groupoids. We define a contravariant functor $F$ from $\mathcal{C}$ to the category of groupoids as follows: for $U\in \Ob(\mathcal{C})$ let $$ F(U) = \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S}). $$ If $f : U \to V$ the induced functor $\mathcal{C}/U \to \mathcal{C}/V$ induces the morphism $F(f) : F(V) \to F(U)$. Clearly $F$ is a functor. Let $\mathcal{S}'$ be the associated category fibred in groupoids from Example \ref{example-functor-groupoids}. There is an obvious functor $G : \mathcal{S}' \to \mathcal{S}$ over $\mathcal{C}$ given by taking the pair $(U, x)$, where $U \in \Ob(\mathcal{C})$ and $x \in F(U)$, to $x(\text{id}_U) \in \mathcal{S}$. Now Lemma \ref{lemma-yoneda-2category} implies that for each $U$, $$ G_U : \mathcal{S}'_U = F(U)= \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S}) \to \mathcal{S}_U $$ is an equivalence, and thus $G$ is an equivalence between $\mathcal{S}$ and $\mathcal{S}'$ by Lemma \ref{lemma-equivalence-fibred-categories}. \end{remark} \section{Representable 1-morphisms} \label{section-representable-1-morphisms} \noindent Let $\mathcal{C}$ be a category. In this section we explain what it means for a $1$-morphism between categories fibred in groupoids over $\mathcal{C}$ to be representable. \medskip\noindent Let $\mathcal{C}$ be a category. Let $\mathcal{X}$, $\mathcal{Y}$ be categories fibred in groupoids over $\mathcal{C}$. Let $U \in \Ob(\mathcal{C})$. Let $F : \mathcal{X} \to \mathcal{Y}$ and $G : \mathcal{C}/U \to \mathcal{Y}$ be $1$-morphisms of categories fibred in groupoids over $\mathcal{C}$. We want to describe the $2$-fibre product $$ \xymatrix{ (\mathcal{C}/U) \times_\mathcal{Y} \mathcal{X} \ar[r] \ar[d] & \mathcal{X} \ar[d]^F \\ \mathcal{C}/U \ar[r]^G & \mathcal{Y} } $$ Let $y = G(\text{id}_U) \in \mathcal{Y}_U$. Make a choice of pullbacks for $\mathcal{Y}$ (see Definition \ref{definition-pullback-functor-fibred-category}). Then $G$ is isomorphic to the functor $(f : V \to U) \mapsto f^*y$, see Lemma \ref{lemma-yoneda-2category} and its proof. We may think of an object of $(\mathcal{C}/U) \times_\mathcal{Y} \mathcal{X}$ as a quadruple $(V, f : V \to U, x, \phi)$, see Lemma \ref{lemma-2-product-categories-over-C}. Using the description of $G$ above we may think of $\phi$ as an isomorphism $\phi : f^*y \to F(x)$ in $\mathcal{Y}_V$. \begin{lemma} \label{lemma-identify-fibre-product} In the situation above the fibre category of $(\mathcal{C}/U) \times_\mathcal{Y} \mathcal{X}$ over an object $f : V \to U$ of $\mathcal{C}/U$ is the category described as follows: \begin{enumerate} \item objects are pairs $(x, \phi)$, where $x \in \Ob(\mathcal{X}_V)$, and $\phi : f^*y \to F(x)$ is a morphism in $\mathcal{Y}_V$, \item the set of morphisms between $(x, \phi)$ and $(x', \phi')$ is the set of morphisms $\psi : x \to x'$ in $\mathcal{X}_V$ such that $F(\psi) = \phi' \circ \phi^{-1}$. \end{enumerate} \end{lemma} \begin{proof} See discussion above. \end{proof} \begin{lemma} \label{lemma-prepare-representable-map-stack-in-groupoids} Let $\mathcal{C}$ be a category. Let $\mathcal{X}$, $\mathcal{Y}$ be categories fibred in groupoids over $\mathcal{C}$. Let $F : \mathcal{X} \to \mathcal{Y}$ be a $1$-morphism. Let $G : \mathcal{C}/U \to \mathcal{Y}$ be a $1$-morphism. Then $$ (\mathcal{C}/U) \times_\mathcal{Y} \mathcal{X} \longrightarrow \mathcal{C}/U $$ is a category fibred in groupoids. \end{lemma} \begin{proof} We have already seen in Lemma \ref{lemma-2-product-fibred-categories} that the composition $$ (\mathcal{C}/U) \times_\mathcal{Y} \mathcal{X} \longrightarrow \mathcal{C}/U \longrightarrow \mathcal{C} $$ is a category fibred in groupoids. Then the lemma follows from Lemma \ref{lemma-cute-groupoids}. \end{proof} \begin{definition} \label{definition-representable-map-categories-fibred-in-groupoids} Let $\mathcal{C}$ be a category. Let $\mathcal{X}$, $\mathcal{Y}$ be categories fibred in groupoids over $\mathcal{C}$. Let $F : \mathcal{X} \to \mathcal{Y}$ be a $1$-morphism. We say $F$ is {\it representable}, or that {\it $\mathcal{X}$ is relatively representable over $\mathcal{Y}$}, if for every $U \in \Ob(\mathcal{C})$ and any $G : \mathcal{C}/U \to \mathcal{Y}$ the category fibred in groupoids $$ (\mathcal{C}/U) \times_\mathcal{Y} \mathcal{X} \longrightarrow \mathcal{C}/U $$ is representable. \end{definition} \begin{lemma} \label{lemma-spell-out-representable-map-stack-in-groupoids} Let $\mathcal{C}$ be a category. Let $\mathcal{X}$, $\mathcal{Y}$ be categories fibred in groupoids over $\mathcal{C}$. Let $F : \mathcal{X} \to \mathcal{Y}$ be a $1$-morphism. If $F$ is representable then every one of the functors $$ F_U : \mathcal{X}_U \longrightarrow \mathcal{Y}_U $$ between fibre categories is faithful. \end{lemma} \begin{proof} Clear from the description of fibre categories in Lemma \ref{lemma-identify-fibre-product} and the characterization of representable fibred categories in Lemma \ref{lemma-characterize-representable-fibred-category}. \end{proof} \begin{lemma} \label{lemma-criterion-representable-map-stack-in-groupoids} Let $\mathcal{C}$ be a category. Let $\mathcal{X}$, $\mathcal{Y}$ be categories fibred in groupoids over $\mathcal{C}$. Let $F : \mathcal{X} \to \mathcal{Y}$ be a $1$-morphism. Make a choice of pullbacks for $\mathcal{Y}$. Assume \begin{enumerate} \item each functor $F_U : \mathcal{X}_U \longrightarrow \mathcal{Y}_U$ between fibre categories is faithful, and \item for each $U$ and each $y \in \mathcal{Y}_U$ the presheaf $$ (f : V \to U) \longmapsto \{(x, \phi) \mid x \in \mathcal{X}_V, \phi : f^*y \to F(x)\}/\cong $$ is a representable presheaf on $\mathcal{C}/U$. \end{enumerate} Then $F$ is representable. \end{lemma} \begin{proof} Clear from the description of fibre categories in Lemma \ref{lemma-identify-fibre-product} and the characterization of representable fibred categories in Lemma \ref{lemma-characterize-representable-fibred-category}. \end{proof} \noindent Before we state the next lemma we point out that the $2$-category of categories fibred in groupoids is a $(2, 1)$-category, and hence we know what it means to say that it has a final object (see Definition \ref{definition-final-object-2-category}). And it has a final object namely $\text{id} : \mathcal{C} \to \mathcal{C}$. Thus we define {\it $2$-products} of categories fibred in groupoids over $\mathcal{C}$ as the $2$-fibre products $$ \mathcal{X} \times \mathcal{Y} := \mathcal{X} \times_\mathcal{C} \mathcal{Y}. $$ With this definition in place the following lemma makes sense. \begin{lemma} \label{lemma-representable-diagonal-groupoids} Let $\mathcal{C}$ be a category. Let $\mathcal{S} \to \mathcal{C}$ be a category fibred in groupoids. Assume $\mathcal{C}$ has products of pairs of objects and fibre products. The following are equivalent: \begin{enumerate} \item The diagonal $\mathcal{S} \to \mathcal{S} \times \mathcal{S}$ is representable. \item For every $U$ in $\mathcal{C}$, any $G : \mathcal{C}/U \to \mathcal{S}$ is representable. \end{enumerate} \end{lemma} \begin{proof} Suppose the diagonal is representable, and let $U, G$ be given. Consider any $V \in \Ob(\mathcal{C})$ and any $G' : \mathcal{C}/V \to \mathcal{S}$. Note that $\mathcal{C}/U \times \mathcal{C}/V = \mathcal{C}/U \times V$ is representable. Hence the fibre product $$ \xymatrix{ (\mathcal{C}/U \times V) \times_{(\mathcal{S} \times \mathcal{S})} \mathcal{S} \ar[r] \ar[d] & \mathcal{S} \ar[d] \\ \mathcal{C}/U \times V \ar[r]^{(G, G')} & \mathcal{S} \times \mathcal{S} } $$ is representable by assumption. This means there exists $W \to U \times V$ in $\mathcal{C}$, such that $$ \xymatrix{ \mathcal{C}/W \ar[d] \ar[r] & \mathcal{S} \ar[d] \\ \mathcal{C}/U \times \mathcal{C}/V \ar[r] & \mathcal{S} \times \mathcal{S} } $$ is cartesian. This implies that $\mathcal{C}/W \cong \mathcal{C}/U \times_\mathcal{S} \mathcal{C}/V$ (see Lemma \ref{lemma-diagonal-1}) as desired. \medskip\noindent Assume (2) holds. Consider any $V \in \Ob(\mathcal{C})$ and any $(G, G') : \mathcal{C}/V \to \mathcal{S} \times \mathcal{S}$. We have to show that $\mathcal{C}/V \times_{\mathcal{S} \times \mathcal{S}} \mathcal{S}$ is representable. What we know is that $\mathcal{C}/V \times_{G, \mathcal{S}, G'} \mathcal{C}/V$ is representable, say by $a : W \to V$ in $\mathcal{C}/V$. The equivalence $$ \mathcal{C}/W \to \mathcal{C}/V \times_{G, \mathcal{S}, G'} \mathcal{C}/V $$ followed by the second projection to $\mathcal{C}/V$ gives a second morphism $a' : W \to V$. Consider $W' = W \times_{(a, a'), V \times V} V$. There exists an equivalence $$ \mathcal{C}/W' \cong \mathcal{C}/V \times_{\mathcal{S} \times \mathcal{S}} \mathcal{S} $$ namely \begin{eqnarray*} \mathcal{C}/W' & \cong & \mathcal{C}/W \times_{(\mathcal{C}/V \times \mathcal{C}/V)} \mathcal{C}/V \\ & \cong & \left(\mathcal{C}/V \times_{(G, \mathcal{S}, G')} \mathcal{C}/V\right) \times_{(\mathcal{C}/V \times \mathcal{C}/V)} \mathcal{C}/V \\ & \cong & \mathcal{C}/V \times_{(\mathcal{S} \times \mathcal{S})} \mathcal{S} \end{eqnarray*} (for the last isomorphism see Lemma \ref{lemma-diagonal-2}) which proves the lemma. \end{proof} \noindent {\bf Bibliographic notes:} Parts of this have been taken from Vistoli's notes \cite{Vis2}. \section{Monoidal categories} \label{section-monoidal} \noindent Let $\mathcal{C}$ be a category. Suppose we are given a functor $$ \otimes : \mathcal{C} \times \mathcal{C} \longrightarrow \mathcal{C} $$ We often want to know whether $\otimes$ satisfies an associative rule and whether there is a unit for $\otimes$. \medskip\noindent An {\it associativity constraint} for $(\mathcal{C}, \otimes)$ is a functorial isomorphism $$ \phi_{X, Y, Z} : X \otimes (Y \otimes Z) \to (X \otimes Y) \otimes Z $$ such that for all objects $X, Y, Z, W$ the diagram $$ \xymatrix{ X \otimes (Y \otimes ( Z \otimes W)) \ar[r] \ar[d] & (X \otimes Y) \otimes (Z \otimes W) \ar[r] & ((X \otimes Y) \otimes Z) \otimes W \\ X \otimes ((Y \otimes Z) \otimes W) \ar[rr] & & (X \otimes (Y \otimes Z)) \otimes W \ar[u] } $$ is commutative where every arrow is determined by a suitable application of $\phi$ and functoriality of $\otimes$. Given an associativity constraint there are well defined functors $$ \mathcal{C} \times \ldots \times \mathcal{C} \longrightarrow \mathcal{C}, \quad (X_1, \ldots, X_n) \longmapsto X_1 \otimes \ldots \otimes X_n $$ for all $n \geq 1$. \medskip\noindent Let $\phi$ be an associativity constraint. A {\it unit} for $(\mathcal{C}, \otimes, \phi)$ is an object $\mathbf{1}$ of $\mathcal{C}$ together with functorial isomorphisms $$ \mathbf{1} \otimes X \to X \quad\text{and}\quad X \otimes \mathbf{1} \to X $$ such that for all objects $X, Y$ the diagram $$ \xymatrix{ X \otimes (\mathbf{1} \otimes Y) \ar[rr]_\phi \ar[rd] & & (X \otimes \mathbf{1}) \otimes Y \ar[ld] \\ & X \otimes Y } $$ is commutative where the diagonal arrows are given by the isomorphisms introduced above. \medskip\noindent An equivalent definition would be that a unit is a pair $(\mathbf{1}, 1)$ where $\mathbf{1}$ is an object of $\mathcal{C}$ and $1 : \mathbf{1} \otimes \mathbf{1} \to \mathbf{1}$ is an isomorphism such that the functors $L : X \mapsto \mathbf{1} \otimes X$ and $R : X \mapsto X \otimes \mathbf{1}$ are equivalences. Certainly, given a unit as above we get the isomorphism $1 : \mathbf{1} \otimes \mathbf{1} \to \mathbf{1}$ for free and $L$ and $R$ are equivalences as they are isomorphic to the identity functor. Conversely, given $(\mathbf{1}, 1)$ such that $L$ and $R$ are equivalences, we obtain functorial isomorphisms $l : \mathbf{1} \otimes X \to X$ and $r : X \otimes \mathbf{1} \to X$ characterized by $L(l) = 1 \otimes \text{id}_X$ and $R(r) = \text{id}_X \otimes 1$. Then we can use $r$ and $l$ in the notion of unit as above. \medskip\noindent A unit is unique up to unique isomorphism if it exists (exercise). \begin{definition} \label{definition-monoidal-category} A triple $(\mathcal{C}, \otimes, \phi)$ where $\mathcal{C}$ is a category, $\otimes : \mathcal{C} \times \mathcal{C} \to \mathcal{C}$ is a functor, and $\phi$ is an associativity constraint is called a {\it monoidal category} if there exists a unit $\mathbf{1}$. \end{definition} \noindent We always write $\mathbf{1}$ to denote a unit of a monoidal category; as it is determined up to unique isomorphism there is no harm in choosing one. From now on we no longer write the brackets when taking tensor products in monoidal categories and we always identify $X \otimes \mathbf{1}$ and $\mathbf{1} \otimes X$ with $X$. Moreover, we will say ``let $\mathcal{C}$ be a monoidal category'' with $\otimes, \phi, \mathbf{1}$ understood. \begin{definition} \label{definition-functor-monoidal-categories} Let $\mathcal{C}$ and $\mathcal{C}'$ be monoidal categories. A {\it functor of monoidal categories} $F : \mathcal{C} \to \mathcal{C}'$ is given by a functor $F$ as indicated and a isomorphism $$ F(X) \otimes F(Y) \to F(X \otimes Y) $$ functorial in $X$ and $Y$ such that for all objects $X$, $Y$, and $Z$ the diagram $$ \xymatrix{ F(X) \otimes (F(Y) \otimes F(Z)) \ar[r] \ar[d] & F(X) \otimes F(Y \otimes Z) \ar[r] & F(X \otimes (Y \otimes Z)) \ar[d] \\ (F(X) \otimes F(Y)) \otimes F(Z) \ar[r] & F(X \otimes Y) \otimes F(Z) \ar[r] & F((X \otimes Y) \otimes Z) } $$ commutes and such that $F(\mathbf{1})$ is a unit in $\mathcal{C}'$. \end{definition} \noindent By our conventions about units, we may always assume $F(\mathbf{1}) = \mathbf{1}$ if $F$ is a functor of monoidal categories. As an example, if $A \to B$ is a ring homomorphism, then the functor $M \mapsto M \otimes_A B$ is functor of monoidal categories from $\text{Mod}_A$ to $\text{Mod}_B$. \begin{lemma} \label{lemma-invertible} Let $\mathcal{C}$ be a monoidal category. Let $X$ be an object of $\mathcal{C}$. The following are equivalent \begin{enumerate} \item the functor $L : Y \mapsto X \otimes Y$ is an equivalence, \item the functor $R : Y \mapsto Y \otimes X$ is an equivalence, \item there exists an object $X'$ such that $X \otimes X' \cong X' \otimes X \cong \mathbf{1}$. \end{enumerate} \end{lemma} \begin{proof} Assume (1). Choose $X'$ such that $L(X') = \mathbf{1}$, i.e., $X \otimes X' \cong \mathbf{1}$. Denote $L'$ and $R'$ the functors corresponding to $X'$. The equation $X \otimes X' \cong \mathbf{1}$ implies $L \circ L' \cong \text{id}$. Thus $L'$ must be the quasi-inverse to $L$ (which exists by assumption). Hence $L' \circ L \cong \text{id}$. Hence $X' \otimes X \cong \mathbf{1}$. Thus (3) holds. \medskip\noindent The proof of (2) $\Rightarrow$ (3) is dual to what we just said. \medskip\noindent Assume (3). Then it is clear that $L'$ and $L$ are quasi-inverse to each other and it is clear that $R'$ and $R$ are quasi-inverse to each other. Thus (1) and (2) hold. \end{proof} \begin{definition} \label{definition-invertible} Let $\mathcal{C}$ be a monoidal category. An object $X$ of $\mathcal{C}$ is called {\it invertible} if any (or all) of the equivalent conditions of Lemma \ref{lemma-invertible} hold. \end{definition} \noindent Observe that if $F : \mathcal{C} \to \mathcal{C}'$ is a functor of monoidal categories, then $F$ sends invertible objects to invertible objects. \begin{definition} \label{definition-dual} Given a monoidal category $(\mathcal{C}, \otimes, \phi)$ and an object $X$ a {\it left dual} is an object $Y$ together with morphisms $\eta : \mathbf{1} \to X \otimes Y$ and $\epsilon : Y \otimes X \to \mathbf{1}$ such that the diagrams $$ \vcenter{ \xymatrix{ X \ar[rd]_1 \ar[r]_-{\eta \otimes 1} & X \otimes Y \otimes X \ar[d]^{1 \otimes \epsilon} \\ & X } } \quad\text{and}\quad \vcenter{ \xymatrix{ Y \ar[rd]_1 \ar[r]_-{1 \otimes \eta} & Y \otimes X \otimes Y \ar[d]^{\epsilon \otimes 1} \\ & Y } } $$ commute. In this situation we say that $X$ is a {\it right dual} of $Y$. \end{definition} \noindent Observe that if $F : \mathcal{C} \to \mathcal{C}'$ is a functor of monoidal categories, then $F(Y)$ is a left dual of $F(X)$ if $Y$ is a left dual of $X$. \begin{lemma} \label{lemma-left-dual} Let $\mathcal{C}$ be a monoidal category. If $Y$ is a left dual to $X$, then $$ \Mor(Z' \otimes X, Z) = \Mor(Z', Z \otimes Y) \quad\text{and}\quad \Mor(Y \otimes Z', Z) = \Mor(Z', X \otimes Z) $$ functorially in $Z$ and $Z'$. \end{lemma} \begin{proof} Consider the maps $$ \Mor(Z' \otimes X, Z) \to \Mor(Z' \otimes X \otimes Y, Z \otimes Y) \to \Mor(Z', Z \otimes Y) $$ where we use $\eta$ in the second arrow and the sequence of maps $$ \Mor(Z', Z \otimes Y) \to \Mor(Z' \otimes X, Z \otimes Y \otimes X) \to \Mor(Z' \otimes X, Z) $$ where we use $\epsilon$ in the second arrow. A straightforward calculation using the properties of $\eta$ and $\epsilon$ shows that the compositions of these are mutually inverse. Similarly for the other equality. \end{proof} \begin{remark} \label{remark-left-dual-adjoint} Lemma \ref{lemma-left-dual} says in particular that $Z \mapsto Z \otimes Y$ is the right adjoint of $Z' \mapsto Z' \otimes X$. In particular, uniqueness of adjoint functors guarantees that a left dual of $X$, if it exists, is unique up to unique isomorphism. Conversely, assume the functor $Z \mapsto Z \otimes Y$ is a right adjoint of the functor $Z' \mapsto Z' \otimes X$, i.e., we're given a bijection $$ \Mor(Z' \otimes X, Z) \longrightarrow \Mor(Z', Z \otimes Y) $$ functorial in both $Z$ and $Z'$. The unit of the adjunction produces maps $$ \eta_Z : Z \to Z \otimes X \otimes Y $$ functorial in $Z$ and the counit of the adjoint produces maps $$ \epsilon_{Z'} : Z' \otimes Y \otimes X \to Z' $$ functorial in $Z'$. In particular, we find $\eta = \eta_\mathbf{1} : \mathbf{1} \to X \otimes Y$ and $\epsilon = \epsilon_\mathbf{1} : Y \otimes X \to \mathbf{1}$. As an exercise in the relationship between units, counits, and the adjunction isomorphism, the reader can show that we have $$ (\epsilon \otimes \text{id}_Y) \circ \eta_Y = \text{id}_Y \quad\text{and}\quad \epsilon_X \circ (\eta \otimes \text{id}_X) = \text{id}_X $$ However, this isn't enough to show that $(\epsilon \otimes \text{id}_Y) \circ (\text{id}_Y \otimes \eta) = \text{id}_Y$ and $(\text{id}_X \otimes \epsilon) \circ (\eta \otimes \text{id}_X) = \text{id}_X$, because we don't know in general that $\eta_Y = \text{id}_Y \otimes \eta$ and we don't know that $\epsilon_X = \epsilon \otimes \text{id}_X$. For this it would suffice to know that our adjunction isomorphism has the following property: for every $W, Z, Z'$ the diagram $$ \xymatrix{ \Mor(Z' \otimes X, Z) \ar[r] \ar[d]_{\text{id}_W \otimes -} & \Mor(Z', Z \otimes Y) \ar[d]^{\text{id}_W \otimes -} \\ \Mor(W \otimes Z' \otimes X, W \otimes Z) \ar[r] & \Mor(W \otimes Z', W \otimes Z \otimes Y) } $$ If this holds, we will say {\it the adjunction is compatible with the given tensor structure}. Thus the requirement that $Z \mapsto Z \otimes Y$ be the right adjoint of $Z' \mapsto Z' \otimes X$ compatible with the given tensor structure is an equivalent formulation of the property of being a left dual. \end{remark} \begin{lemma} \label{lemma-tensor-dual} Let $\mathcal{C}$ be a monoidal category. If $Y_i$, $i = 1, 2$ are left duals of $X_i$, $i = 1, 2$, then $Y_2 \otimes Y_1$ is a left dual of $X_1 \otimes X_2$. \end{lemma} \begin{proof} Follows from uniqueness of adjoints and Remark \ref{remark-left-dual-adjoint}. \end{proof} \noindent A {\it commutativity constraint} for $(\mathcal{C}, \otimes)$ is a functorial isomorphism $$ \psi : X \otimes Y \longrightarrow Y \otimes X $$ such that the composition $$ X \otimes Y \xrightarrow{\psi} Y \otimes X \xrightarrow{\psi} X \otimes Y $$ is the identity. We say $\psi$ is {\it compatible} with a given associativity constraint $\phi$ if for all objects $X, Y, Z$ the diagram $$ \xymatrix{ X \otimes (Y \otimes Z) \ar[r]_\phi \ar[d]^\psi & (X \otimes Y) \otimes Z \ar[r]_\psi & Z \otimes (X \otimes Y) \ar[d]^\phi \\ X \otimes (Z \otimes Y) \ar[r]^\phi & (X \otimes Z) \otimes Y \ar[r]^\psi & (Z \otimes X) \otimes Y } $$ commutes. \begin{definition} \label{definition-symmetric-monoidal-category} A quadruple $(\mathcal{C}, \otimes, \phi, \psi)$ where $\mathcal{C}$ is a category, $\otimes : \mathcal{C} \otimes \mathcal{C} \to \mathcal{C}$ is a functor, $\phi$ is an associativity constraint, and $\psi$ is a commutativity constraint compatible with $\phi$ is called a {\it symmetric monoidal category} if there exists a unit. \end{definition} \noindent To be sure, if $(\mathcal{C}, \otimes, \phi, \psi)$ is a symmetric monoidal category, then $(\mathcal{C}, \otimes, \phi)$ is a monoidal category. \begin{lemma} \label{lemma-dual-symmetric} Let $(\mathcal{C}, \otimes, \phi, \psi)$ be a symmetric monoidal category. Let $X$ be an object of $\mathcal{C}$ and let $Y$, $\eta : \mathbf{1} \to X \otimes Y$, and $\epsilon : Y \otimes X \to \mathbf{1}$ be a left dual of $X$ as in Definition \ref{definition-dual}. Then $\eta' = \psi \circ \eta : \mathbf{1} \to Y \otimes X$ and $\epsilon' = \epsilon \circ \psi : X \otimes Y \to \mathbf{1}$ makes $X$ into a left dual of $Y$. \end{lemma} \begin{proof} Omitted. Hint: pleasant exercise in the definitions. \end{proof} \begin{definition} \label{definition-functor-symmetric-monoidal-categories} Let $\mathcal{C}$ and $\mathcal{C}'$ be symmetric monoidal categories. A {\it functor of symmetric monoidal categories} $F : \mathcal{C} \to \mathcal{C}'$ is given by a functor $F$ as indicated and an isomorphism $$ F(X) \otimes F(Y) \to F(X \otimes Y) $$ functorial in $X$ and $Y$ such that $F$ is a functor of monoidal categories and such that for all objects $X$ and $Y$ the diagram $$ \xymatrix{ F(X) \otimes F(Y) \ar[r] \ar[d] & F(X \otimes Y) \ar[d] \\ F(Y) \otimes F(X) \ar[r] & F(Y \otimes X) } $$ commutes. \end{definition} \begin{remark} \label{remark-internal-hom-monoidal} Let $\mathcal{C}$ be a monoidal category. We say $\mathcal{C}$ has an {\it internal hom} if for every pair of objects $X, Y$ of $\mathcal{C}$ there is an object $hom(X, Y)$ of $\mathcal{C}$ such that we have $$ \Mor(X, hom(Y, Z)) = \Mor(X \otimes Y, Z) $$ functorially in $X, Y, Z$. By the Yoneda lemma the bifunctor $(X, Y) \mapsto hom(X, Y)$ is determined up to unique isomorphism if it exists. Given an internal hom we obtain canonical maps \begin{enumerate} \item $hom(X, Y) \otimes X \to Y$, \item $hom(Y, Z) \otimes hom(X, Y) \to hom(X, Z)$, \item $Z \otimes hom(X, Y) \to hom(X, Z \otimes Y)$, \item $Y \to hom(X, Y \otimes X)$, and \item $hom(Y, Z) \otimes X \to hom(hom(X, Y), Z)$ in case $\mathcal{C}$ is symmetric monoidal. \end{enumerate} Namely, the map in (1) is the image of $\text{id}_{hom(X, Y)}$ by $\Mor(hom(X, Y), hom(X, Y)) \to \Mor(hom(X, Y) \otimes X, Y)$. To construct the map in (2) by the defining property of $hom(X, Z)$ we need to construct a map $$ hom(Y, Z) \otimes hom(X, Y) \otimes X \longrightarrow Z $$ and such a map exists since by (1) we have maps $hom(X, Y) \otimes X \to Y$ and $hom(Y, Z) \otimes Y \to Z$. To construct the map in (3) by the defining property of $hom(X, Z \otimes Y)$ we need to construct a map $$ Z \otimes hom(X, Y) \otimes X \to Z \otimes Y $$ for which we use $\text{id}_Z \otimes a$ where $a$ is the map in (1). To construct the map in (4) we note that we already have the map $Y \otimes hom(X, X) \to hom(X, Y \otimes X)$ by (3). Thus it suffices to construct a map $\mathbf{1} \to hom(X, X)$ and for this we take the element in $\Mor(\mathbf{1}, hom(X, X))$ corresponding to the canonical isomorphism $\mathbf{1} \otimes X \to X$ in $\Mor(\mathbf{1} \otimes X, X)$. Finally, we come to (5). By the universal property of $hom(hom(X, Y), Z)$ it suffices to construct a map $$ hom(Y, Z) \otimes X \otimes hom(X, Y) \longrightarrow Z $$ We do this by swapping the last two tensor products using the commutativity constraint and then using the maps $hom(X, Y) \otimes X \to Y$ and $hom(Y, Z) \otimes Y \to Z$. \end{remark} \section{Categories of dotted arrows} \label{section-dotted-arrows} \noindent We discuss certain ``categories of dotted arrows'' in $(2,1)$-categories. These will appear when formulating various lifting criteria for algebraic stacks, see for example Morphisms of Stacks, Section \ref{stacks-morphisms-section-valuative} and More on Morphisms of Stacks, Section \ref{stacks-more-morphisms-section-formally-smooth}. \begin{definition} \label{definition-dotted-arrows} Let $\mathcal{C}$ be a $(2,1)$-category. Consider a $2$-commutative solid diagram \begin{equation} \label{equation-dotted-arrows} \vcenter{ \xymatrix{ S \ar[r]_-x \ar[d]_j & X \ar[d]^f \\ T \ar[r]^-y \ar@{..>}[ru] & Y } } \end{equation} in $\mathcal{C}$. Fix a $2$-isomorphism $$ \gamma : y \circ j \rightarrow f \circ x $$ witnessing the $2$-commutativity of the diagram. Given (\ref{equation-dotted-arrows}) and $\gamma$, a \emph{dotted arrow} is a triple $(a, \alpha, \beta)$ consisting of a morphism $a \colon T \to X$ and and $2$-isomorphisms $\alpha : a \circ j \to x$, $\beta : y \to f \circ a$ such that $\gamma = (\text{id}_f \star \alpha) \circ (\beta \star \text{id}_j)$, in other words such that $$ \xymatrix{ & f \circ a \circ j \ar[rd]^{\text{id}_f \star \alpha} \\ y \circ j \ar[ru]^{\beta \star \text{id}_j} \ar[rr]^\gamma & & f \circ x } $$ is commutative. A {\it morphism of dotted arrows} $(a, \alpha, \beta) \to (a', \alpha', \beta')$ is a $2$-arrow $\theta : a \to a'$ such that $\alpha = \alpha' \circ (\theta \star \text{id}_j)$ and $\beta' = (\text{id}_f \star \theta) \circ \beta$. \end{definition} \noindent In the situation of Definition \ref{definition-dotted-arrows}, there is an associated \emph{category of dotted arrows}. This category is a groupoid. It may depend on $\gamma$ in general. The next two lemmas say that categories of dotted arrows are well-behaved with respect to base change and composition for $f$. \begin{lemma} \label{lemma-cat-dotted-arrows-base-change} Let $\mathcal{C}$ be a $(2,1)$-category. Assume given a $2$-commutative diagram $$ \xymatrix{ S \ar[r]_-{x'} \ar[d]_j & X' \ar[d]^p \ar[r]_q & X \ar[d]^f \\ T \ar[r]^-{y'} & Y' \ar[r]^g & Y } $$ in $\mathcal{C}$, where the right square is $2$-cartesian with respect to a $2$-isomorphism $\phi \colon g \circ p \to f \circ q$. Choose a $2$-arrow $\gamma' : y' \circ j \to p \circ x'$. Set $x = q \circ x'$, $y = g \circ y'$ and let $\gamma : y \circ j \to f \circ x$ be the $2$-isomorphism $\gamma = (\phi \star \text{id}_{x'}) \circ (\text{id}_g \star \gamma')$. Then the category $\mathcal{D}'$ of dotted arrows for the left square and $\gamma'$ is equivalent to the category $\mathcal{D}$ of dotted arrows for the outer rectangle and $\gamma$. \end{lemma} \begin{proof} There is a functor $\mathcal{D}' \to \mathcal{D}$ which is $(a, \alpha, \beta) \mapsto (q \circ a, \text{id}_q \star \alpha, (\phi \star \text{id}_a) \circ (\text{id}_g \star \beta))$ on objects and $\theta \mapsto \text{id}_q \star \theta$ on arrows. Checking that this functor $\mathcal{D}' \to \mathcal{D}$ is an equivalence follows formally from the universal property for $2$-fibre products as in Section \ref{section-2-fibre-products}. Details omitted. \end{proof} \begin{lemma} \label{lemma-cat-dotted-arrows-composition} Let $\mathcal{C}$ be a $(2,1)$-category. Assume given a solid $2$-commutative diagram $$ \xymatrix{ S \ar[r]_-x \ar[dd]_j & X \ar[d]^f \\ & Y \ar[d]^g \\ T \ar[r]^-z \ar@{..>}[ruu] & Z } $$ in $\mathcal{C}$. Choose a $2$-isomorphism $\gamma \colon z \circ j \to g \circ f \circ x$. Let $\mathcal{D}$ be the category of dotted arrows for the outer rectangle and $\gamma$. Let $\mathcal{D}'$ be the category of dotted arrows for the solid square $$ \xymatrix{ S \ar[r]_-{f \circ x} \ar[d]_j & Y \ar[d]^g \\ T \ar[r]^-z \ar@{..>}[ru] & Z } $$ and $\gamma$. Then $\mathcal{D}$ is equivalent to a category $\mathcal{D}''$ which has the following property: there is a functor $\mathcal{D}'' \to \mathcal{D}'$ which turns $\mathcal{D}''$ into a category fibred in groupoids over $\mathcal{D}'$ and whose fibre categories are isomorphic to categories of dotted arrows for certain solid squares of the form $$ \xymatrix{ S \ar[r]_-x \ar[d]_j & X \ar[d]^f \\ T \ar[r]^-y \ar@{..>}[ru] & Y } $$ and some choices of $2$-isomorphism $y \circ j \to f \circ x$. \end{lemma} \begin{proof} Construct the category $\mathcal{D}''$ whose objects are tuples $(a,\alpha,\beta,b,\eta)$ where $(a,\alpha,\beta)$ is an object of $\mathcal{D}$ and $b \colon T \rightarrow Y$ is a $1$-morphism and $\eta \colon b \rightarrow f \circ a$ is a $2$-isomorphism. Morphisms $(a,\alpha,\beta,b,\eta) \rightarrow (a',\alpha',\beta',b',\eta')$ in $\mathcal{D}''$ are pairs $(\theta_1,\theta_2)$, where $\theta_1 \colon a \rightarrow a'$ defines an arrow $(a, \alpha, \beta) \rightarrow (a', \alpha', \beta')$ in $\mathcal{D}$ and $\theta_2 \colon b \rightarrow b'$ is a $2$-isomorphism with the compatibility condition $\eta' \circ \theta_2 = (\text{id}_f \star \theta_1) \circ \eta$. \medskip\noindent There is a functor $\mathcal{D}'' \rightarrow \mathcal{D}'$ which is $(a, \alpha, \beta, b, \eta) \mapsto (b, (\text{id}_f \star \alpha) \circ (\eta \star \text{id}_j), (\text{id}_g \star \eta^{-1}) \circ \beta)$ on objects and $(\theta_1,\theta_2) \mapsto \theta_2$ on arrows. Then $\mathcal{D}'' \rightarrow \mathcal{D}'$ is fibred in groupoids. \medskip\noindent If $(y, \delta, \epsilon)$ is an object of $\mathcal{D}'$, write $\mathcal{D}_{y,\delta}$ for the category of dotted arrows for the last displayed diagram with $y \circ j \rightarrow f \circ x$ given by $\delta$. There is a functor $\mathcal{D}_{y,\delta} \rightarrow \mathcal{D}''$ given by $(a, \alpha, \eta) \mapsto (a, \alpha, (\text{id}_g \star \eta) \circ \epsilon, y, \eta)$ on objects and $\theta \mapsto (\theta, \text{id}_y)$ on arrows. This exhibits an isomorphism from $\mathcal{D}_{y,\delta}$ to the fibre category of $\mathcal{D}'' \rightarrow \mathcal{D}'$ over $(y,\delta,\epsilon)$. \medskip\noindent There is also a functor $\mathcal{D} \rightarrow \mathcal{D}''$ which is $(a,\alpha,\beta) \mapsto (a,\alpha,\beta,f \circ a, \text{id}_{f \circ a})$ on objects and $\theta \mapsto (\theta, \text{id}_f \star \theta)$ on arrows. This functor is fully faithful and essentially surjective, hence an equivalence. Details omitted. \end{proof} \input{chapters} \bibliography{my} \bibliographystyle{amsalpha} \end{document}