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
where $gf$ is called the composition of $g$ with $f$.
Axiom. for any object $A$, $B$, $C$ and $D$
- $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$
- composition of morphisms are associative, i.e.
- 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
Remark.
- The identity map for an object is unique (same proof as the uniqueness of a group’s identity)
- 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
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
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
Definition. Natural transformation / morphism of functors
Let $\C$ and $\D$ be categories and let $\F$ and $\G$ be covariant functors from $\C$ to $\D$. A natural transformation or morphism of functors from $\F$ to $\G$ is a map $\eta$ that assigns to each object $A$ in $\C$ a morphism $\eta_A\in\Hom_\D(\F A, \G A)$ with the following property. For every pair of objects $A$ and $B$ in $\C$ and every $f\in\Hom_\C(A, B)$ we have
i.e. The following diagram commutes
// Universal property