_Posted on September 24, 2024_ ##### Introduction Category theory has been described as a meta-mathematical theory, the "mathematics of mathematics"[^1], or the study of "algebras of functions"[^2]. #TODO Add some motivational material... Why is it useful to define "categories"... a thing with the properties of the thing below? ##### Definition > [!definition] A category consists of the following: > - **Objects:** A collection of objects $X,Y,Z,\ldots$ > - **Morphisms:** A collection of morphisms $f,g,h,\ldots$. Morphisms are also called _arrows_ or _maps_. > - **Identity morphisms:** For each object $X$, there is a designated identity morphism $1_X: X\rightarrow X$. > - **Composite morphisms:** For each pair of morphisms $f$ and $g$ with the codomain of $f$ equal to the domain of $g$, there exists a specified composite $g \circ f$ whose domain is equal to the domain of $f$ and whose codomain is equal to the codomain of $g$. I.e.: $f:X\rightarrow Y,\quad g:Y\rightarrow Z, \quad\leadsto \quad g\circ f:X\rightarrow Z$ A category is subject to the following two axioms: > [!todo] Category Axioms: > 1. For any $f:X\rightarrow Y$, the composites $1_Y \circ f$ and $f\circ 1_X$ are both equal to $f$. > 2. For any composable triple of morphisms $f,g,h,$ the composites $h\circ (g\circ f)$ and $(h\circ g)\circ f$ are equal and henceforth denoted by $h\circ g\circ f$.$f:X\rightarrow Y, \quad g:Y\rightarrow Z, \quad h:Z\rightarrow W \quad \leadsto \quad h\circ g\circ f:X\rightarrow W.$That is, the composition law is associative and unital with the identity morphisms serving as two-sided identities. | ![Morphism Diagram](a96af229822a0e19d271f6e2e8d96818.svg) | | :-----------------------------------------------------------------------------------------------------------------------------: | | (Left to Right) A morphism $f: X \rightarrow Y$. An identity morphism $1_X: X \rightarrow X$. A composite morphism $g \circ f$. | | ![Axioms Diagram](ecf09d88de7dfd47ca81c7593df8d10a.svg) | | :---------------------------------------------------------------------------------: | | (Left to Right) Axiom 2, associativity of composition. Axiom 1, unital composition. | This definition is adapted from Emily Riehl's _Category Theory In Context_. ##### Example > [!definition] The category **Set** is defined as follows: > **Objects:** The objects of **Set** are sets. > > **Morphisms:** The morphisms between sets are called functions, defined as follows. A function $f: X \rightarrow Y$ with domain $X$ and codomain $Y$ is defined to be some subset of the cartesean product $X \times Y$ such that for all $x \in X$, there is a _unique_ $y \in Y$ such that $(x,y)\in f$. We say that $f(x) = y$. > > **Identity Morphisms:** For a set $X$, the identity function $1_X:X \rightarrow X$ contains, for all $x \in X$, the ordered pair $(x,x)$, so that $1_X(x) = x$. Such a function clearly exists (i.e. $1_X$ is a function). > > **Composite Morphisms:** Given two functions $f: X \rightarrow Y$ and $g: Y\rightarrow Z$, the composition of $g$ and $f$, denoted $g \circ f$ is the function $g\circ f: X \rightarrow Z$ defined by $g \circ f = \{(x,g(f(x))) \mid x \in X\}.$ > [!theorem] _**Set** is a category_. _Proof:_ First, we must show that function composition is unital with the identity morphisms serving as two-sided identities. For an arbitrary function $f: X \rightarrow Y,$ we have$1_Y \circ f = \{(x, 1_Y(f(x))) \mid x \in X\} = \{(x,f(x)) \mid x \in X\} = f$by the definition of function composition and the identity function. Similarly, $f \circ 1_X = \{(x, f(1_X(x))) \mid x \in X\} = \{(x,f(x)) \mid x \in X\} = f.$This is the desired result. Now, we show that function composition is associative. Suppose we have functions $f:X\rightarrow Y, \quad g:Y\rightarrow Z,$ and $h:Z\rightarrow W$. Then, we have $h \circ (g \circ f) = h \circ \{(x, g(f(x))) \mid x \in X\} = \{(x, h(g(f(x))) \mid x \in X\}$ and $(h \circ g) \circ f = \{(x, (h \circ g) (f(x))) \mid x \in X\} = \{(x, h(g(f(x)))) \mid x \in X\}.$Thus, $h \circ (g \circ f) = (h \circ g) \circ f$, as desired. $\blacksquare$ [^1]: Topos Institute. (2022, September 28). _What is category theory?_ [Video]. YouTube. [https://youtu.be/eXBwU9ieLL0](https://youtu.be/eXBwU9ieLL0) [^2]: Awodey, S. (2010). _Category theory_ (2nd ed.). Oxford University Press.