Category Theory (PENDING)
A primer on Basic Category theory.
1. Category
In mathematics, every object has a natural notion of morphisms between them. Groups have homomorphism, sets have functions, topological spaces have continous maps, etc. A Category is the abstraction of these (~ helps us pin down what is attributed to the specific internal structure of object vs what is just algebraic consequence of this association of objects with morphisms).
A category (\(\mathcal{C}\)) is defined as a collection of objects (data) and sets of maps bw each pair of objects (morphisms, denoted by \(Hom(A,B)\) for \(A, B\) in \(Obj(\mathcal{C})\)) with composition operation. There are 2 structural requirements -
- If \(f \in Hom(A, B)\) and \(g \in Hom(B, C)\), then \(gof \in Hom(A, C)\).
- \(I_A \in Hom(A, A)\), where \(I_A\) is the identity map (i.e if \(f \in Hom(A,B)\) then \(foI_A = f\), and \(I_Bof = f\)).
Lastly 1 axioms for our wellbeing -
- (Associativity) Let \(f, g, h \in Hom(A, B)\), \(Hom(B, C)\), \(Hom(C, D)\). Then \((hg)f = h(gf)\).
Note: Most religiously it is a bit awkward to talk about set of all sets owing to Russel’s paradox, as such existence of objects in a category is shaky. But we will bypass such technicalities for I don’t myself know how to deal with them.
Let us now look at some standard examples -
- Category of Sets: The objects are all the sets and the Hom set (bw any 2 sets) is defined as set of all functions bw them.
- Category of Topological Spaces: The objects of this category are all the topological spaces and the hom set are continous maps bw them.
- Category of Groups: The objects of this category are all the groups and the hom set are homomorphims bw them.
It is a trivial exercise to see both the structural properties and the axiom are followed.1
A fancier example would be -
- Poset: Let \(S\) be a set. The objects of our category are the elements of the power set of \(S\). The \(Hom(A,B)\) set is just \({f}\)2 if the \(A \le B\) otherwise empty.
- Single Group: Let \(G\) be a group. The object of our category is a single element. The \(Hom(A,A)\) is the set \(G\) with the same composition rule.
It is also trivial to see (without any calculations) that they indeed are categories.
Before going forward, a few terminologies -
Isomorphism: \(f \in Hom(A,B)\) is isomorphism if \(\exists g \in Hom(B, A)\) s.t \(gof = I_A\) and \(fog = I_B\).
Monomorphism: We want to generalize the notion of injective maps. A small issue is, injectivity uses internal structure of the object. A way to get around is the following - Let \(g_1, g_2 \in Hom(A, B)\), and \(f \in Hom(B, C)\), we say \(f\) is monomorphism if \(fog_1 = fog_2\) \(\rightarrow g_1 = g_2\). You can convince yourself if \(f\) wasn’t injective the former equality wouldn’t imply later equality. Notice we bypass the use of internal structure and thus is applicable in a category. (Also note composition \(g_i\) after \(f\) doesn’t really work.)
Epimorphism: This time we would like to abstract surjection. A quick think tells us doing the composition in reverse gets the job done. I.e. Let \(g_1, g_2 \in Hom(B, C)\), and \(f \in Hom(A, B)\) is epimorphism if \(g_1of = g_2of\) \(\rightarrow g_1 = g_2\).
Note: Actually Epimorphism doesn’t really behave like surjective most often (except for sets ofc). For example - consider category of rings (morphism are ring homs). Consider the embedding of \(\mathbb{Z}\) in \(\mathbb{Q}\), this is clearly not a surjection however it is an epimorphism. If you have any map out of \(\mathbb{Q}\) and if they agree of \(\mathbb{Z}\) they agree on rest as well. In general a better intuitive notion of epimorphism is: they are defined w.r.t to maps out of it and as such if they agree on the base space (\(\mathbb{Z}\)) they agree on the output space (\(\mathbb{Q}\)). Similarly Monomorphism don’t really behave like a injective function always (except sets). A example is slightly niche as it turns out all our usual categories have some object that behaves like \(\mathbb{Z}\) (free object on 1 generator of sorts)3. Example: Consider the category of divisible abelian groups4, consider the quotient map \(\pi: \mathbb{Q} \rightarrow \mathbb{Q}/\mathbb{Z}\). This has \(Ker(\pi) = \mathbb{Z} \le \mathbb{Q}\). Consider maps \(f, g: D \rightarrow \mathbb{Q}\), \(D\) being a divisible abelian group. Notice \(\pi o f = \pi o g\) implies \(\pi o (f - g) = 0\), but this means \((f - g)(D) \le Ker(\pi)\)5. But the only divible subgroup6 of \(\mathbb{Z}\) is 0, i.e. \(f = g\) however \(\pi\) is clearly not a injection (kernel is non-zero).
Just one more definition, dual of a category is just the same category but all the arrows (morphisms) are reversed. Comes handy sometimes.
2. Functor
Self-Referential of sorts; Study of every mathematical object is intertwined with study of its “natural” morphism. It makes sense to ask whats the natural morphism between categories.
The classic example would be from Algebraic Topology. For any topological space \(X\) one can associate \(\pi_1(X)\) (fundamental groups), and the homology groups. And the hall mark feature is - If you have a continous map bw topological spaces \(X\) and \(Y\), it induces a homomorphism bw their fundamental groups and homology groups.
A functor is a map bw 2 categories defined by a map between objects and a map between Hom sets. I.e. If \(F: \mathcal{C} \rightarrow \mathcal{D}\) be a functor, it sends \(Obj(\mathcal{C})\) to \(Obj(\mathcal{D})\) and maps \(Hom(c_1, c_2)\) to \(Hom(F(c_1), F(c_2))\). Also 2 expected properties have to be followed -
- Identity function maps to identity.
- Composition: \(F(fg) = F(f)F(g)\).
Examples:
- Fundamental Group (& Homology): From elementary algebraic topology, one finds a functor bw category of topological spaces and category of groups.
- Functor bw sets and groups (Artificial): A set \(S\) is mapped to Free group on set \(S\), and a map \(S \rightarrow T\) natural induces a map \(F(S) \rightarrow F(T)\) (\(F(X)\) meaning free group on set \(X\)).
- Abelianization (Functor bw category of groups and category of abelian groups): Consider the functor that sends groups to there Abelianization (i.e \(G/[G,G]\)). If you have group hom from \(G_1 \rightarrow G_2\), it defines map from \(G_1/[G_1, G_1] \rightarrow G_2/[G_2, G_2]\) (namely the restriction map7). Easy to see composition and identity follows8.
- Functor bw category of Vector spaces (finite dim): The functor maps vector space \(V\) to \(V^*\) (dual vector space of \(V\))9, and maps the linear maps (morphisms in category of vector space) \(g: V_2 \rightarrow V_1\) to \(g': V_1^* \rightarrow V_2^*\) defined as (let \(f \in V_1^*\)) \(f \mapsto fog\). (Check \(fog \in V_2^*\)).
- Forgetful Functor (bw category of groups and sets): \(G \mapsto G\), where former is group \(G\) and later is just the set \(G\). Morphism are mapped to the same morphisms. (Pretty useless)
- Presheave10: Consider the category of open sets on topological space \(X\) (i.e. the objects are open sets of \(X\) and there is a arrow bw 2 open sets if former is contained in the later) and the category of continous real-valued functions. The functor maps \(U\) (open set in \(X\)) to \(C(U)\) (cts functions on \(U\) i.e. \(\{f: U \rightarrow \mathbb{R}\}\)), and maps the arrow (\(U \subseteq V\)) to the restriction map \(C(V) \rightarrow C(U)\). Easy to see image of the arrows \(U \subseteq V \subseteq W\) composes well in \(C(W) \rightarrow C(V) \rightarrow C(U)\).
Techincally the 4th functor is not a functor as the direction is reversed. We call them contravariant functor. All the properties still work but the arrows are reversed. Another way of saying is our functor is defined bw category of vector spaces and the dual of the category of vector spaces. Also Presheaves are contravariant functors.
Covariant functor just means our usual functor (with correct arrows).
3. Natural Transformation
Consider the following example: We know \(V \cong V^*\) (finite dim) as same dim imply isomorphism and the iso can be explicitly described by sending the basis vector to the basis of the other (in any fashion, no restriction). However there is no canonical choice for the iso, it is quite arbitary. However consider the dual of \(V^*\), we know there is canonical map bw \(V\) and its double dual!11 We are going to encode this notion of natural / canonical translation between the two objects (in the same category, here category of vector spaces!).
Consider functors \(F, G: \mathcal{C} \rightarrow \mathcal{D}\). We say \(\alpha\) (\(= \{f \in Hom(F(c), G(c))\}\), i.e. 1 morphism (of morphisms of \(\mathcal{D}\)) per object in \(\mathcal{C}\), i.e. think of this as translation or the canonical map discussed above) is a natural transformation bw them if - (admittedly intimidating but trivial definition) \(G(f) \circ \alpha_{c1} = \alpha_{c2} \circ F(f)\) or the following diagram commutes.
Definition of Natural Transformation
Intuitively, (first) replace both categories, \((\mathcal{C}, \mathcal{D})\), by category of vector spaces. \(F\) is the identity functor and \(G\) is the double dual functor, i.e. \(v \mapsto v^{**}\). Now we fix a translation or the canonical map we discussed above, call it \(\alpha\). The definition is just saying for all purposes (which is talking about morphisms bw objects of \(\mathcal{D}\)), either applying the map bw \(v_1, v_2\) and then translating to double dual is same as first applying the double dual and then the map bw double duals. I.e. we are saying our \(\alpha\) is sort of a natural, or there is really no difference in \(v\) or \(v^{**}\). (The way we define no difference is the ordering is irrelevant for the maps).
If the chosen morphisms in \(\alpha\) were isomorphisms in \(\mathcal{D}\), we call it a natural isomorphism (our identity functor and double dual functor are naturally isomorphic). We will use \(F \sim G\) to mean they are natural transformation.
Example:
- Determinant12: Consider the category of commutative rings and category of groups, and 2 functors bw them defined by \(R \mapsto GL_n(R)\) and \(R \mapsto R^*\), where \(R^*\) is \(R\) after removing all points w/o multiplicative inverse. The former functor sends maps \(f: R_1 \rightarrow R_2\) to \(F(f): GL_n(R_1) \rightarrow GL_n(R_2)\) by replacing each entry pointwise by the map \(f\), and later functor sends it the restriction map. Our \(\alpha = \{\alpha_R: GL_n(R) \rightarrow R^*\}\) is the determinant map (as invertible lands in \(R^*\)). Its trivial to see (think of the recursive formula) its a natural transformation.
Just for fun consider the category whose objects are categories and the morphisms are functor bw those categories13. This gives a notion of isomorphism bw 2 categories (namely if the functor from \(\mathcal{C_1}\) to \(\mathcal{C_2}\) and opposite compose to form identity). This turns out to be not a useful thing, for not many categories are isomorphic. A better notion is equivalence of categories - we say \(\mathcal{C} \sim \mathcal{D}\) is \(\exists\) functors \(F: \mathcal{C} \rightarrow \mathcal{D}\) and \(G: \mathcal{D} \rightarrow \mathcal{C}\) s.t \(F \circ G \sim 1_{\mathcal{D}}\) and \(G \circ F \sim 1_{\mathcal{C}}\). The intuitive picture is they might not be isomorphic i.e. the object in \(\mathcal{C}\) you come back to might not be the exact same but they are sort of the same (natural translation), similarly for \(\mathcal{D}\).
Example:
- (Bad example) Just to illustrate the point, consider \(F\) be the identity functor from category of (finite dim) vector spaces to itself. And think of \(G\) as functor defined in opposite direction, given by double dual of the vector space. Now \(G \circ F \neq 1\) as \(v^{**} \neq v\) (literraly!)14 however \(G \circ F \sim 1\) as we have already established.
- (Essentially the same example but more politically correct) Consider the category of finite dim vector spaces and category of “matrices” over field \(K\) (objects are non-negative integers and \(Hom(n,m) \mathrel{:=} M_{n\times m}\) whose entries belong to \(K\)). Call them \(Vect_{fd}(K)\) and \(Mat_K\). Consider functor \(F: Mat_K \rightarrow Vect_{fd}(K)\) which sends \(n \mapsto K^n\) and sends any matrix in \(M_{n \times m}\) to its obvious linear transformation. Define \(G: Vect_{fd}(K) \rightarrow Mat_K\) by sending \(V \mapsto Dim(V)\) and linear transformation bw \(V\) & \(W\) gets mapped to the matrix of the linear transformation. Now \(F \circ G \neq 1_{Vect_{fd}(K)}\) but is \(\sim\) (define \(\alpha\) by fixing basis for each vector space and then send it to canonical map to \(K^n\) given by the coordinates). On the other hand \(G \circ F = 1_{Mat_K}\). Overall \(Vect_{fd}(K) \sim Mat_K\).
Remarks
I mean they have to workout, otherwise our abstraction was useless! The whole point is to abstract the key commonalities of natural morphism every mathematical object has. ↩︎
The symbol \(f\) is useless. We just want to indicate there is an arrow from \(A\) to \(B\). ↩︎
For injection we are looking at maps into the object. If you probe it from a free generator with say 1 generator like \(\mathbb{Z}\), where that maps sends \(1\) defines the map completely. Say \(f \in Hom(B, C)\) is a monomorphism, and let it be surjection with \(f(x) = f(y)\) with \(x, y \in B\). Consider map from our free object (I will just use \(\mathbb{Z}\) to mean that), \(g_x, g_y: \mathbb{Z} \rightarrow B\) that sends 1 to \(x\) and to \(y\) respectively (determining the entire map). As \(f\) is a monomorphism and \(f o g_x = f o g_y\) by construction this should imply \(g_x = g_y\) which is not the case. Its actually trivial construction if you think about it. Exactly same as one would prove monomorphism implies injection in sets because if f wasn’t an injection, you can find 2 maps into \(B\) that maps to something same as our \(x, y\) above. As \(\mathbb{Z}\) is not divisible group, this reasoning doesn’t work in example given. ↩︎
A group \(G\) is Divisible (abelian) group if \(\forall x \in G\), and positive integer \(n\), \(\exists y\) s.t \(ny = x\) (\(ny = y + y + \dots + y\)). Example - \(\mathbb{Q}\), any characterstic 0 field (non-char 0 (say \(p\) char) fields aren’t as take \(n = p\) and \(x = 1\), \(ny = 0 \forall y\) and \(0 \ne 1\)), etc. ↩︎
\((f - g)\) is a homomorphism, remember in abelian the composition is written as \(+-\). ↩︎
The image of a divisible subgroup under homomorphism is a divisible subgroup (trivial verification). ↩︎
Formally, Let \(\phi: G_1 \rightarrow G_2\), and let \(\pi_1\) and \(\pi_2\) be the projection map to from \(G_i \rightarrow G_i/[G_i, G_i]\) (they are homs as commutator are normal subgroups). Easy to check \([G_1, G_1] \le Ker(\pi_2 o \phi)\), i.e. by factorization theorem \(\pi_2 o \phi\) factors through \(G_1/[G_1, G_1]\). ↩︎
Follows from uniquess of factorization (mentioned in point 7). ↩︎
If \(V\) is a vector space, then \(V^*\) (dual vector space) is \(Hom_K(V, K)\) (where \(K\) is any field, and homs are field / ring hom). It is easy to see \(Hom_K(V, K)\) is a vector space with basis \(\{f_i\}\), where \(f_i(v_i) = 1\) else 0 (\(\{v_i\}\) is the basis for \(V\)). (Hint: a function uniquely extends to entire \(V\) from its definition on the basis). As a corollary, if \(V\) is finite dimensional, then both \(V\) and \(V^*\) have the same dimension. ↩︎
Concretely, a Presheave is a contravariant functor bw category of poset and category of abelian group (continous maps are abelian groups as composition is pointwise addition and \(\mathbb{R}\) is abelian). Apparently this abstraction comes handy to define etale cohomology (don’t ask me!). ↩︎
Here is a quick primer, in case you haven’t seen it. The dual of \(V^* = Hom(V, K)\), call it \(V^{**}\) is a vector space whose elements are \(\{f: V^* \rightarrow K\}\) or \(Hom(V^*, K)\). There is a canonical way to represent each element \(v^{**} \in V^{**}\) w.r.t \(v \in V\), namely (let \(f \in V^*\)), \(v^{**}(f) \mathrel{:=} f(v)\). (Check \(v^{**}\) indeed sends every \(f \in V^*\) to the field \(K\)). ↩︎
The determinant is defined for any \(GL_n(R)\) (group of invertible matrices, whose entries are in \(R\), under multiplication), where \(R\) is any commutative ring. The definition is the same recursive formula which finds volume of the parallelepipe formed by column vectors (as if they were in \(\mathbb{R}\)). Note: the determinant will send that matrix to an element in \(R\). We set \(R\) to be commutative because otherwise formula like \(det(ABA^{-1}B^{-1})\) \(= det(A)det(B)det(A)^{-1}det(B)^{-1}\) \(\neq 1\). I.e. just life improvemening feature. ↩︎
Russell’s paradox and the likes are conveniently ignored. ↩︎
Category of finite dimensional vector space has many vector spaces of same dimension. Example; \(V = K^n\) (i.e. vector space whose element are n-tuples), \(V^{**}\) (whose elements are functions but has the same dimension n), \(V^*\), etc. ↩︎