---- > [!definition] Definition. ([[category]]) > A **(locally small) category** $\mathsf{C}$ consists of >- a class $\text{obj}(\mathsf{C})$ of **objects** of the category; and >- or every two objects $A,B$ of $\mathsf{C}$, a set $\text{Hom}_{\mathsf{C}}(A,B)$ of **morphisms** or **arrows** satisfying: >1. For every object $A$ of $\mathsf{C}$, there exists (at least) one morphism $1_{A} \in \text{Hom}_{\mathsf{C}}(A,A)$, the 'identity' on $A$; >2. For every three objects $A,B,C$ there is defined a [[binary operation]] $\text{Hom}_{\mathsf{C}}(A,B) \times \text{Hom}_{\mathsf{C}}(B,C) \to \text{Hom}_{\mathsf{C}}(A,C)$ which determines from morphisms $f \in \text{Hom}_{\mathsf{C}}(A,B)$ and $g \in \text{Hom}_{\mathsf{C}}(B,C)$ a **composition** $gf \in \text{Hom}_{\text{C}}(A,C)$; >3. This 'composition law' is [[associative]]; >4. The identity morphisms are identities with respect to composition: for all $f \in \text{Hom}_{\mathsf{C}}(A,B)$, we have $f1_{A}=f$ and $1_{B}f=f$; >5. We always have $\text{Hom}_{\mathsf{C}}(A,B) \cap \text{Hom}_{\mathsf{C}}(C,D) = \emptyset$ unless $A=C$ and $B=D$. > When the category is understood, one may drop the index $\mathsf{C}$ — $f \in \text{Hom}(A,B)$ — or even use arrows as we do with set-functions: $f:A \to B$. $f \in \text{Hom}(A,A)=: \text{End}(A)$ is called an **endomorphism**. \ In general, $\text{Obj}(\mathsf{C})$ is 'too big' (in the sense of Russell's paradox) to be a set. When it *is* a set, we call $\mathsf{C}$ a **small category**. > Categories are objects of category $\mathsf{Cat}$, whose morphisms are [[covariant functor|functors]]. ^definition > [!intuition] > As a prototype to keep it mind, it helps to think of the objects as 'sets' and of morphisms as 'functions'. This make properties 1-5 feel natural. ^intuition > [!basicexample] > Sets (as objects) together with set-functions (as morphisms) evidently form a category. It is denoted $\mathsf{Set}$. ^basic-example > [!basicexample] Basic Example. (A pleasing small category) > Suppose $S$ is a set and $\sim$ is a [[relation]] on $S$ satisfying reflexivity and transitivity. Then we may define a category thus: >- Objects: the elements of $S$; >- Morphisms: if $a,b$ are objects (that is, if $a,b \in S$), then let $\text{Hom}(a,b):= \ \begin{cases} \{(a,b) \in S \times S \} & \text{if } a \sim b \\ \emptyset & \text{else.} \end{cases}$. > Note that (unlike in $\mathsf{Set}$) the are very few morphisms: at most one for any pair of objects, and no morphisms at all between 'unrelated' objects. > We have to define 'composition of morphisms' and verify that the category definitions are satisfied. To begin, do we have 'identities'? Given an object $a \in S$, reflexivity implies $a \sim a$ and thus $\text{Hom}(a,a)=\{ (a,a) \}$. So we have no choice but to choose $1_{a}=\text{Hom}(a,a)$. > As for composition, let $a,b,c \in S$ be objects and $f \in \text{Hom}(a,b) , \ g \in \text{Hom}(b,c);$ we have to define a corresponding morphism $gf \in \text{Hom}(a,c)$. Of course $\text{Hom}(a,c)$ equals $(a,c)$ if $a \sim c$ and is empty otherwise. Since $a \sim b$, $b \sim c$ (their morphism sets are nonempty) it is indeed the case that $a \sim c$. And so we must define $gf=(a,c) \in \text{Hom}(a,c)$. > This operation is [[associative]]. Indeed, given additionally $h \in \text{Hom}(c,d)$, we have $hg=(b,d)$ and hence $h(gf)=(a,d)=(hg)f.$ It is immediate to show $1_{a}$ is an identity wrt composition. \ The most trivial case of this construction is when the [[equivalence relation]] is '$=. Then the only morphisms are the identity morphisms. These categories are called **discrete**. \ As another instance, consider the category corresponding to endowing $\mathbb{Z}$ with the [[relation]] $\leq$. In this category, very diagram drawn necessarily commutes, something which is *very far* from being the case in, e.g., $\mathsf{Set}$. ^basic-example-2 > [!basicexample] Example. ((Small) category from inclusion) > Let $S$ be a set and $\mathcal{P}(S)$ its [[power set]]. Define a [[category]] $\hat{\mathsf{S}}$ by setting >- $\text{Obj}(\hat{\mathsf{S}})=\mathcal{P}(S)$; >- For objects $A$ and $B$ in $S$, define $\hom(A,B)$ to be $\{ (A,B) \}$ if $A \subset B$ and $\emptyset$ otherwise. > The identity $1_{A}$ consists of the pair $(A,A)$ (after all, $A \subset A$). Composition is obtaining by stringing together inclusions: if there are morphisms $A \to B$ and $B \to C$ in $\hat{\mathsf{S}}$, then there is a morphism $A \to C$ since $A \subset B \subset C$ implies $A \subset C$. The other axioms are immediate. \ (Note that this is another special case of [[category#^basic-example-2|the previous example]]) where '$\subset is a reflexive/transitive relation on $\mathcal{P}(S)$. ^basic-example-3 ---- #### ---- #### References > [!backlink] > ```dataview > TABLE rows.file.link as "Further Reading" > FROM [[]] > FLATTEN file.tags as Tag > WHERE Tag = "#definition" OR Tag = "#theorem" OR Tag = "#MOC" OR Tag = "#proposition" OR Tag = "#axiom" > GROUP BY Tag > ``` > [!frontlink] > ```dataview > TABLE rows.file.link as "Further Reading" > FROM outgoing([[]]) > FLATTEN file.tags as Tag > WHERE Tag = "#definition" OR Tag = "#theorem" OR Tag = "#MOC" OR Tag = "#proposition" OR Tag = "#axiom" > GROUP BY Tag > ```