Category Theory

$$\newcommand{\Hom}{\text{Hom}} \newcommand{\C}{\textbf{C}} \newcommand{\D}{\textbf{D}} \newcommand{\1}{\textbf{1}} \newcommand{\F}{\mathcal F} \newcommand{\Grp}{\textbf{Grp}} \newcommand{\Ab}{\textbf{Ab}} $$

Learn categories myself!

Why categories? Category theory provides the language and the mathematical foundations for discussing properties of large classes of mathematical objects such as the class of “all sets” or “all groups” while circumventing problems such as Russell’s Paradox.

1. Categories and Functors

Definition. Category
A category $\C$ consists of a class of objects and sets of morphisms (态射) between these objects, and

  • for every ordered pair $A, B$ of objects, there is a set $\Hom_\C(A, B)$ of morphisms from $A$ to $B$
  • for every ordered triple $A, B, C$, of objects, there’s a law of composition of morphisms, i.e. the map
$$\begin{aligned} \Hom_\C(A,B)\times \Hom_\C(B,C)&\to\Hom_\C(A,C)\\ (f,g)&\mapsto gf \end{aligned} $$

where $gf$ is called the composition of $g$ with $f$.

Axiom. for any object $A$, $B$, $C$ and $D$

  1. $A\neq B\implies \Hom_\C(A,C)\cap \Hom_\C(B,C)=\emptyset$, $C\neq D\implies \Hom_\C(A, C)\cap\Hom_\C(A,D)=\emptyset$
  2. composition of morphisms are associative, i.e.
$$\forall f\in\Hom_\C(A,B),g\in\Hom_\C(B,C),h\in\Hom_\C(C,D).f(gh)=(fg)h $$
  1. Each object has an identity morphism, i.e. for any object $A$ there exists a morphism $\1_A\in\Hom_\C(A, A)$ such that
$$\begin{aligned} &\forall f\in\Hom_\C(A, B).f\1_A=f\\ &\forall g\in\Hom_\C(B,A).\1_Ag=g \end{aligned} $$

Remark.

  1. The identity map for an object is unique (same proof as the uniqueness of a group’s identity)
  2. When the category is clear from the context, we write $\Hom$ instead of $\Hom_\C$

Definition. Domain, codomain
A morphism, or an arrow, from $A$ to $B$, can be denoted as $f:A\to B$ or $A\stackrel{f}\to B$. The object $A$ is called the domain of $f$ and $B$ is called codomain of $f$.

Definition. Endomorphism
A morphism from an object $A$ to itself is called an endomorphism of $A$.

Definition. Isomorphism
A morphism $f:A\to B$ is an isomorphism if there exists a morphism $g:B\to A$ such that

$$gf=\1_A\quad\quad fg=\1_B $$

Definition. Subcategory
There’s a natural notion of subcategory category $\C$ of $\D$ if every object of $\C$ is also a object of $\D$ and for objects $A,B$ in $\C$ we have the containment

$$\Hom_\C(A,B)\subset \Hom_\D(A, B) $$

Example. $\Grp$
$\Grp$ is the category of all groups with morphisms defined as group homomorphisms. Note that compositions of group homomorphisms are still homomorphism. $\Ab$, the category of all abelian groups, is a subcategory of $\Grp$.

Definition. (Covariant) functors
Let $\C$ and $\D$ be two categories, we say $\F$ is a covariant functor or a functor from $\C$ to $\D$ if

  • for every object $A$ in $\C$, $\F A$ is an object in $\D$ and
  • for every $f\in\Hom_\C(A, B)$, we have $\F(f)\in\Hom_\D(\F A, \F B)$
    such that the following axioms are satisfied
  • if $gf$ is a composition of morphisms in $\C$, then $\F(gf)=\F(g)\F(f)$ in $\D$ and
  • $\F(\1_A)=\1(\F_A)$

Definition. Contravariant functors
Let $\C$ and $\D$ be two categories, we say $\F$ is a covariant functor or a functor from $\C$ to $\D$ if

  • for every object $A$ in $\C$, $\F A$ is an object in $\D$ and
  • for every $f\in\Hom_\C(A, B)$, we have $\F(f)\in\Hom_\D(\F B, \F A)$
    such that the following axioms are satisfied
  • if $gf$ is a composition of morphisms in $\C$, then $\F(gf)=\F(f)\F(g)$ in $\D$ and
  • $\F(\1_A)=\1(\F_A)$

2. Natural Transformations

// Universal property