Category theory: abstracting mathematical construction (essay): Difference between revisions
(Created page with "In real life, and in particular, in mathematics, there are ''entities'' and ''actions''. We can consider types of entities. For example, let us consider two such types <math>X</math> and <math>Y</math>, where <math>X = \text{apples}</math> and <math>Y = \text{pie}</math>. There is a specific apple sitting in my fridge, There's an action of baking apple pie too broad Definition of a category '''Definition.''' A ''category'' <math>\mathcal{C}</math> consists o...") |
mNo edit summary |
||
Line 1: | Line 1: | ||
'''Definition.''' A ''category'' <math>\mathcal{C}</math> consists<ref group="note">In the literature this is called a "locally small" category.</ref> of the following data: | |||
We can | # A class<ref group="note">A class is just another word for a set. In conventional mathematics, we aren't allowed to use the word "set" here, because for many categories it would give rise to a Russell's paradox. I think that Russell's paradox only arises in situations where we aren't being careful about our what math refers to in reality, but that discussion would take us too far afield.</ref> <math>\text{ob}(\mathcal{C})</math>, called the "objects" of the category | ||
# For any two objects <math>X,Y \in \text{ob}(\mathcal{C})</math>, a set <math>\text{mor}_{\mathcal{C}}(X,Y)</math>, called the "morphisms from <math>X </math> to <math>Y </math>." We take <math>f : X \rightarrow Y</math> to be a statement which means the exact same thing as the statement <math>f \in \text{mor}_{\mathcal{C}}(X,Y)</math>. | |||
# For any two morphisms <math>f : X \rightarrow Y</math> and <math>g : Y \rightarrow Z</math> , a function <math display="block">\circ : \text{mor}_{\mathcal{C}}(Y,Z) \times \text{mor}_{\mathcal{C}}(X,Y) \rightarrow \text{mor}_{\mathcal{C}}(X,Z), </math> which we call "composition." That is, we can compose <math>f </math> and <math>g </math> to get an element <math>g \circ f : X \rightarrow Z </math>, | |||
subject to the following conditions: | |||
For | # For any object <math>X \in \text{ob}(\mathcal{C}) </math>, there exists an "identity" morphism <math>1_X : X \rightarrow X </math>, satisfying <math>1_X \circ f = f </math> for any <math>f : Y \rightarrow X </math> and <math>g \circ 1_X = g </math> for any <math>g : X \rightarrow Z </math> . | ||
# Composition is associative: <math>(f \circ g) \circ h = f \circ (g \circ h) </math>. | |||
♦ | |||
One example of a category---''the'' example, in fact---is <math>\text{Set} </math>, the category of sets. The objects of <math>\text{Set} </math> are sets, the morphisms of <math>\text{Set} </math> are functions, and composition of morphisms of <math>\text{Set} </math> is composition of functions: <math>(g \circ f)(x) : = g(f(x)). </math> The identity morphism of a set <math>X</math> is the function <math>X \rightarrow X </math> which does nothing. | |||
Another example of a category is "the discrete category with 2 elements," which I shall call <math>\mathbb{I} </math>. The objects <math>\text{ob}(\mathbb{I}) </math> are a set consisting of 2 elements (for concreteness we could take <math>\text{ob}(\mathbb{I}) := \{ a,b \} </math> where <math>a = \emptyset </math> and <math>b = \{ \emptyset \} </math>).<ref group="note">I don't like this approach to sets. I think sets should contain actual existents. But I won't fight that battle today. </ref> The morphisms of <math>\mathbb{I} </math> are the identity elements, and nothing else. More formally, we have<math>\text{mor}_{\mathbb{I}}(a,a) = \{ * \} </math>, <math>\text{mor}_{\mathbb{I}}(a,b) = \emptyset </math>, and <math>\text{mor}_{\mathbb{I}}(b,b) = \{ * \} </math>. | |||
Another example of a category is the category <math>\text{Grp} </math> of groups. Here, the objects are groups, and the morphisms are group homomorphisms. | |||
Another example of a category is the (naive) category <math>\text{Top} </math> of topological spaces. Here, the objects are topological spaces, and the morphisms are continuous maps. | |||
We could go on like this ''ad infinitum''. There are a huge variety of mathematical objects that form categories. Rings, graphs, vector spaces, representations, the points of the sphere, the open subsets of the plane, the natural numbers, and even categories themselves. In fact, ''every'' mathematical object forms a category,<ref group="note">Indeed, suppose that some "''thing"'' in mathematics is defined as <math>(E,\Sigma) </math>, where <math>E </math> is a set and <math>\Sigma </math> is a structure (I won't define what a "structure" is; see Bourbaki for that. But think about it as an additional set. [TODO look up]). We get a category <math>\text{Thng} </math> of "things" for free. The objects of <math>\text{Thng} </math> are "thing"s, and a morphism <math>(E,\Sigma) \rightarrow (E', \Sigma') </math> is an isomorphism <math>\varphi : E \rightarrow E' </math> of sets, such that: the structure <math>\varphi_*\Sigma </math> living over <math>E' </math> that you get when you transport <math>\Sigma </math> by <math>\varphi </math>, is equal to <math>\Sigma' </math>, or in symbols <math>\varphi_*\Sigma = \Sigma' </math></ref> though perhaps not in an interesting sense. Part of modern mathematical folklore is that you should always "categorify" whatever mathematical objects it is that you are working with, i.e. you should find a way to define everything in a category-theoretic way. | |||
Note that the definition I gave of categories is set theoretic. Shea has informed me that category theory can be taken as foundational, see e.g. [TODO]. I have never studied Lawvere's formalism, but I can provide a couple insights about it nonetheless. 1) This formalism is not mainstream at all; few of the mathematicians using category theory know it. 2) When it comes to actually proving things, set theory is much ''easier'' than category theory. It has been my experience that even the most routine, "obvious" things can become very difficult to prove when phrased categorically (there is a reason for that, which I will get to later). When mathematicians want to understand a category, they often embed it into the category of sets and try to understand it there (see "Yoneda embedding"). | |||
== Functors == | |||
Let's suppose I'm doing some construction. Like | |||
== Notes == | == Notes == | ||
<references group="note" /> | <references group="note" /> |
Revision as of 00:49, 15 May 2025
Definition. A category Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathcal{C}} consists[note 1] of the following data:
- A class[note 2] Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{ob}(\mathcal{C})} , called the "objects" of the category
- For any two objects Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X,Y \in \text{ob}(\mathcal{C})} , a set Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{mor}_{\mathcal{C}}(X,Y)} , called the "morphisms from Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X } to Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle Y } ." We take Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f : X \rightarrow Y} to be a statement which means the exact same thing as the statement Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f \in \text{mor}_{\mathcal{C}}(X,Y)} .
- For any two morphisms Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f : X \rightarrow Y} and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g : Y \rightarrow Z} , a function Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \circ : \text{mor}_{\mathcal{C}}(Y,Z) \times \text{mor}_{\mathcal{C}}(X,Y) \rightarrow \text{mor}_{\mathcal{C}}(X,Z), } which we call "composition." That is, we can compose Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f } and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g } to get an element Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g \circ f : X \rightarrow Z } ,
subject to the following conditions:
- For any object Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X \in \text{ob}(\mathcal{C}) } , there exists an "identity" morphism , satisfying Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle 1_X \circ f = f } for any Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle f : Y \rightarrow X } and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g \circ 1_X = g } for any Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g : X \rightarrow Z } .
- Composition is associative: Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (f \circ g) \circ h = f \circ (g \circ h) } .
♦
One example of a category---the example, in fact---is Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Set} } , the category of sets. The objects of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Set} } are sets, the morphisms of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Set} } are functions, and composition of morphisms of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Set} } is composition of functions: Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (g \circ f)(x) : = g(f(x)). } The identity morphism of a set Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X} is the function Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle X \rightarrow X } which does nothing.
Another example of a category is "the discrete category with 2 elements," which I shall call Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbb{I} } . The objects Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{ob}(\mathbb{I}) } are a set consisting of 2 elements (for concreteness we could take Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{ob}(\mathbb{I}) := \{ a,b \} } where Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle a = \emptyset } and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle b = \{ \emptyset \} } ).[note 3] The morphisms of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathbb{I} } are the identity elements, and nothing else. More formally, we haveFailed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{mor}_{\mathbb{I}}(a,a) = \{ * \} } , Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{mor}_{\mathbb{I}}(a,b) = \emptyset } , and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{mor}_{\mathbb{I}}(b,b) = \{ * \} } .
Another example of a category is the category Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Grp} } of groups. Here, the objects are groups, and the morphisms are group homomorphisms.
Another example of a category is the (naive) category Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Top} } of topological spaces. Here, the objects are topological spaces, and the morphisms are continuous maps.
We could go on like this ad infinitum. There are a huge variety of mathematical objects that form categories. Rings, graphs, vector spaces, representations, the points of the sphere, the open subsets of the plane, the natural numbers, and even categories themselves. In fact, every mathematical object forms a category,[note 4] though perhaps not in an interesting sense. Part of modern mathematical folklore is that you should always "categorify" whatever mathematical objects it is that you are working with, i.e. you should find a way to define everything in a category-theoretic way.
Note that the definition I gave of categories is set theoretic. Shea has informed me that category theory can be taken as foundational, see e.g. [TODO]. I have never studied Lawvere's formalism, but I can provide a couple insights about it nonetheless. 1) This formalism is not mainstream at all; few of the mathematicians using category theory know it. 2) When it comes to actually proving things, set theory is much easier than category theory. It has been my experience that even the most routine, "obvious" things can become very difficult to prove when phrased categorically (there is a reason for that, which I will get to later). When mathematicians want to understand a category, they often embed it into the category of sets and try to understand it there (see "Yoneda embedding").
Functors
Let's suppose I'm doing some construction. Like
Notes
- ↑ In the literature this is called a "locally small" category.
- ↑ A class is just another word for a set. In conventional mathematics, we aren't allowed to use the word "set" here, because for many categories it would give rise to a Russell's paradox. I think that Russell's paradox only arises in situations where we aren't being careful about our what math refers to in reality, but that discussion would take us too far afield.
- ↑ I don't like this approach to sets. I think sets should contain actual existents. But I won't fight that battle today.
- ↑ Indeed, suppose that some "thing" in mathematics is defined as Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (E,\Sigma) } , where Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle E } is a set and Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \Sigma } is a structure (I won't define what a "structure" is; see Bourbaki for that. But think about it as an additional set. [TODO look up]). We get a category Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Thng} } of "things" for free. The objects of Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Thng} } are "thing"s, and a morphism Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (E,\Sigma) \rightarrow (E', \Sigma') } is an isomorphism Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \varphi : E \rightarrow E' } of sets, such that: the structure Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \varphi_*\Sigma } living over Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle E' } that you get when you transport Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \Sigma } by Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \varphi } , is equal to , or in symbols