# The Stacks Project

## Tag 003G

### 4.28. 2-categories

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 4.27 and Example 4.29.2. Basically, you take this example and you write out all the rules satisfied by the objects, $1$-morphisms and $2$-morphisms in that example.

Definition 4.28.1. A (strict) $2$-category $\mathcal{C}$ consists of the following data

1. A set of objects $\mathop{\rm Ob}\nolimits(\mathcal{C})$.
2. For each pair $x, y \in \mathop{\rm Ob}\nolimits(\mathcal{C})$ a category $\mathop{\rm Mor}\nolimits_\mathcal{C}(x, y)$. The objects of $\mathop{\rm Mor}\nolimits_\mathcal{C}(x, y)$ will be called $1$-morphisms and denoted $F : x \to y$. The morphisms between these $1$-morphisms will be called $2$-morphisms and denoted $t : F' \to F$. The composition of $2$-morphisms in $\mathop{\rm Mor}\nolimits_\mathcal{C}(x, y)$ will be called vertical composition and will be denoted $t \circ t'$ for $t : F' \to F$ and $t' : F'' \to F'$.
3. For each triple $x, y, z\in \mathop{\rm Ob}\nolimits(\mathcal{C})$ a functor $$(\circ, \star) : \mathop{\rm Mor}\nolimits_\mathcal{C}(y, z) \times \mathop{\rm Mor}\nolimits_\mathcal{C}(x, y) \longrightarrow \mathop{\rm Mor}\nolimits_\mathcal{C}(x, z).$$ The image of the pair of $1$-morphisms $(F, G)$ on the left hand side will be called the composition of $F$ and $G$, and denoted $F\circ G$. The image of the pair of $2$-morphisms $(t, s)$ will be called the horizontal composition and denoted $t \star s$.

These data are to satisfy the following rules:

1. The set of objects together with the set of $1$-morphisms endowed with composition of $1$-morphisms forms a category.
2. Horizontal composition of $2$-morphisms is associative.
3. The identity $2$-morphism $\text{id}_{\text{id}_x}$ of the identity $1$-morphism $\text{id}_x$ is a unit for horizontal composition.

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 4.27. 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.

Definition 4.28.2. Let $\mathcal{C}$ be a $2$-category. A sub $2$-category $\mathcal{C}'$ of $\mathcal{C}$, is given by a subset $\mathop{\rm Ob}\nolimits(\mathcal{C}')$ of $\mathop{\rm Ob}\nolimits(\mathcal{C})$ and sub categories $\mathop{\rm Mor}\nolimits_{\mathcal{C}'}(x, y)$ of the categories $\mathop{\rm Mor}\nolimits_\mathcal{C}(x, y)$ for all $x, y \in \mathop{\rm Ob}\nolimits(\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.

Remark 4.28.3. 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):

1. The $2$-category of categories $\textit{Cat}$.
2. The $(2, 1)$-category of categories $\textit{Cat}$.
3. The $2$-category of groupoids $\textit{Groupoids}$.
4. The $(2, 1)$-category of groupoids $\textit{Groupoids}$.
5. The $2$-category of fibred categories over a fixed category.
6. The $(2, 1)$-category of fibred categories over a fixed category.

See Definition 4.29.1. 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 \mathop{\rm Ob}\nolimits(C)$ the category $\mathop{\rm Mor}\nolimits_\mathcal{C}(x, y)$ is ''small'' (according to our conventions).

The notion of equivalence of categories that we defined in Section 4.2 extends to the more general setting of $2$-categories as follows.

Definition 4.28.4. Two objects $x, y$ of a $2$-category are 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$.

Sometimes we need to say what it means to have a functor from a category into a $2$-category.

Definition 4.28.5. Let $\mathcal{A}$ be a category and let $\mathcal{C}$ be a $2$-category.

1. A 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.
2. A weak functor, or a pseudo functor $\varphi$ from $\mathcal{A}$ into the 2-category $\mathcal{C}$ is given by the following data
1. a map $\varphi : \mathop{\rm Ob}\nolimits(\mathcal{A}) \to \mathop{\rm Ob}\nolimits(\mathcal{C})$,
2. for every pair $x, y\in \mathop{\rm Ob}\nolimits(\mathcal{A})$, and every morphism $f : x \to y$ a $1$-morphism $\varphi(f) : \varphi(x) \to \varphi(y)$,
3. for every $x\in \mathop{\rm Ob}\nolimits(A)$ a $2$-morphism $\alpha_x : \text{id}_{\varphi(x)} \to \varphi(\text{id}_x)$, and
4. 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)$.
These data are subject to the following conditions:
1. the $2$-morphisms $\alpha_x$ and $\alpha_{g, f}$ are all isomorphisms,
2. 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) }$$
3. for any morphism $f : x \to y$ in $\mathcal{A}$ we have $\alpha_{f, \text{id}_x} = \text{id}_{\varphi(f)} \star \alpha_x$,
4. 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) }$$

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 functor between $2$-categories, and 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!

The code snippet corresponding to this tag is a part of the file categories.tex and is located in lines 4634–4835 (see updates for more information).

\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}$.
\item The $(2, 1)$-category of groupoids $\textit{Groupoids}$.
\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!

## Comments (0)

There are no comments yet for this tag.

## Add a comment on tag 003G

Your email address will not be published. Required fields are marked.

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the lower-right corner).

All contributions are licensed under the GNU Free Documentation License.

In order to prevent bots from posting comments, we would like you to prove that you are human. You can do this by filling in the name of the current tag in the following box. So in case this where tag 0321 you just have to write 0321. Beware of the difference between the letter 'O' and the digit 0.

This captcha seems more appropriate than the usual illegible gibberish, right?