# How are (small) categories defined using set theory?

A category consists of a collection of objects and a collection of morphisms such that any morphism has a specified domain and codomain, there is the identity morphism for every object and such that there is a composition of morphisms in the usual sense. In my opinion "consists of" and "collection" are a bit vague, so I wondered how this could possibly be defined in set theory. As you can read below, I tried translating "consists of" as an ordered pair and "collection" as set in the case of small categories.

Consider for example a group $$G$$. Then it is well known that this can be viewed as a category with one object such that any morphism is given by a group element $$g \in G$$ and that the composition of $$g,h \in G$$ is given by group multiplication $$gh$$. Being nit picking, this is not correct since group elements alone certainly don't specify a domain and codomain, even though the context suggests what the domain and codomain are supposed to be. Here we are dealing with a small category, so I wondered whether one could (or whether this is done) by using triples.

I am neither well educated in set theory nor in category theory, so this is probably a naive question and approach, but perhaps one could say that a small category $$C$$ is an ordered pair of sets $$(\mathsf{Ob}(C),\mathsf{Mor}(C))$$ where any element of $$\mathsf{Mor}(C)$$ is given by a triple $$(X,Y,f)$$, where $$X,Y$$ are elements of $$\mathsf{Ob}(C)$$ and $$f$$ is a set such that the usual axioms are satisfied. If this were possible, one would always have a specified domain and codomain. This could also easily make precise that the opposite category is given by the objects of $$C$$ and as morphisms the triples $$(Y,X,f)$$ whenever $$(X,Y,f) \in \mathsf{Mor}(C).$$

This is obviously not possible when dealing with larger categories, so I wonder: Is this one way to define small categories or is even this naive suggestion false? Either way, is there a common way to define categories (large or small) in $$\mathsf{ZFC}$$?

• Regarding the category of a group $G$, your objection is not entirely clear to me. The context suggests more than just what the domain and codomain are supposed to be, there is really only one possibility: because the category has only one object, the domain and codomain of every morphism in the category must be that one object. Commented Feb 8, 2023 at 14:42
• @LeeMosher I admit that it sounds a bit strange, yes. Perhaps it is more clear when assuming that my implementation is correct, so assume that a morphism is built as a triple by definition. Then I wanted to express that, being nit picky, there is a difference between $g$ and $(\bullet,\bullet,g)$. The former doesn't give a domain and codomain unless the context makes it clear, whereas the latter always does. This doesn't matter too much, but I thought it may matter in other examples. This was, however, the simplest I could think of. Commented Feb 8, 2023 at 14:45
• Okay, well, in the definition of a category, morphisms are not "built", one simply axiomatizes their behavior. The wikipedia definition of a category is reasonably good and succinct on this topic. What you seem to be missing is that the domains of morphisms are specified by a given function $\text{dom} : \mathsf{Mor}(C) \mapsto \mathsf{Ob}(C)$, and the codomains are similarly specified. Commented Feb 8, 2023 at 14:51
• Compositions of morphisms are themselves specified by a function whose input is an ordered triple of objects $a,b,c$ and whose output is a function $\text{hom}(a,b) \times \text{hom}(b,c) \mapsto \text{hom}(a,c)$. Commented Feb 8, 2023 at 14:52
• What you are doing with your encoding of a small category is close to the notion of an "internal category in the category of sets". The rough idea of internal categories is you take the category theory axioms but say "object" and "morphism" whenever you had "collection" or "function". If you do this within the category of sets then you get precisely the small categories, but it can be done in other categories too. Commented Feb 8, 2023 at 15:54

Your speculations about how one can formalize the axioms of a category are kind of interesting, although they differ somewhat from the details of how that formalization is actually carried out.

Let me answer your question by filling out the details of the description of the category that is associated to a group.

As indicated in my comments, the formal definition of a small category requires not just a set of objects and a set of morphisms, but various functions must also be given which describe how the objects and morphisms interact with each other.

So, suppose we are given a group, consisting formally of a triple $$(G,e,\star)$$ where $$G$$ is a set, $$e \in G$$, and the group operation itself is $$\star \,\, : \,\, G \times G \mapsto G$$

To turn this into a small category $$C$$, the one missing element in the definition of a category that is not already staring us in the face is the set of objects: this will be a one point set which I shall denote $$\mathsf{Ob}(C) = \{\mathcal O\}$$.

The set of morphisms is already present: $$\mathsf{Mor}(C) = G$$.

You wrote

... If this were possible, one would always have a specified domain and codomain...

Well, that's exactly correct. The definition of a small category also requires one to give two functions named $$\text{dom}$$ and $$\text{cod}$$, each a function from $$\mathsf{Mor}(C)$$ to $$\mathsf{Ob}(C)$$. In our special case there is only one choice: $$\text{dom}(g)=\text{cod}(g)=\mathcal O \quad\text{for each} \quad g \in G$$ Next there's some notation: for any ordered pair of objects $$a,b$$ one defines $$\text{hom}(a,b)$$ to be the set of all $$f \in \mathsf{Mor}(C)$$ such that $$\text{dom}(f)=a$$ and $$\text{cod}(f)=b$$. In our special case, the only such ordered pair to be concerned with is $$a=b=\mathcal O$$, and clearly $$\text{hom}(\mathcal O,\mathcal O) = G$$.

The final thing required to be given in the definition of a small category is a function which inputs an ordered triple of objects $$a,b,c$$ and which outputs a "composition function" $$\text{hom}(a,b) \times \text{hom}(b,c) \to \text{hom}(a,b)$$ In our special case, we must have $$a=b=c=\mathcal O$$, and so there is only one composition function to be given, namely $$\underbrace{\text{hom}(\mathcal O,\mathcal O)}_G \times \underbrace{\text{hom}(\mathcal O,\mathcal O)}_G \to \underbrace{\text{hom}(\mathcal O,\mathcal O)}_G$$ Well, there's only one reasonable choice for this composition function, namely the group operation $$\star$$ itself.

That's basically it, although of course one must still walk through the axioms of a category and verify that they all hold for this special case, but I'll leave that to you.

Oh, maybe I forgot to specify that in a small category there is one more piece of data that must be given: a function that inputs a single object $$\mathcal O$$ and that outputs the identity element of its set of self-morphisms $$\text{hom}(\mathcal O,\mathcal O)$$. In our special case, the identity element of $$\text{hom}(\mathcal O,\mathcal O) = G$$ is ... well ... of course ... the identity element $$e$$ of the group $$G$$.

So, for some final words, one key feature of the definition of a category is that you are not required to say anything more about the nature of the elements $$f \in \mathsf{Mor}(C)$$, nor about their internal structure as sets or whatever, etc. etc. As in any good axiom system, all the definition of a category requires is that certain data be given (objects; morphisms; domains; codomains; composition operations; identity elements) and that this data obey certain properties (the axioms of a category).

• Thanks for your detailed answer. I don't know too much about classes and what is allowed when working with them, which is why I wasn't aware of class functions, which obviously helps here. Without functions of classes I had to use some other way to provide the relevant domain and codomain, which is why I thought of triples. I guess this isn't really "wrong" at least for small categories, but rather unusual. If there is something like a triple of classes, I suppose one can extend my idea to categories as well, but I would have to think and read about that. Anyways, thanks a lot. Commented Feb 8, 2023 at 16:12