# What exactly is the semantic difference between category and set?

In this question, I asked what the difference is between set and type. These answers have been really clarifying (e.g. @AndrejBauer), so in my thirst for knowledge, I submit to the temptation of asking the same about categories:

Every time I read about category theory (which admittedly is rather informal), I can't really understand how it differs from set theory, concretely.

So in the most concrete way possible, what exactly does it imply about $x$ to say that it is in the category $C$, compared to saying that $x\in S$? (e.g. what is the difference between saying $x$ is a group, versus saying that $x$ is in the Category $\mathrm {Grp}$?).

(You may pick any category and set that makes the comparison most clarifying).

• I'm not sure this question is well-formed. First you ask what the difference is between saying that 'x is in a category C' vs 'x is in a set S'. But then you give the example of asking 'x is in the category Grp' vs 'x is a group'. What? That's not an example of your question. An example of your question is asking what the difference is between 'x is in the category Grp' and 'x is in the set of all groups'. But even then it's not really what you're asking if you're asking what the differences between categories and sets are. – Miles Rout Apr 30 '18 at 21:12

In brief, set theory is about membership while category theory is about structure-preserving transformations.

Set theory is only about membership (i.e. being an element) and what can be expressed in terms of that (e.g. being a subset). It does not concern itself with any other properties of elements or sets.

Category theory is a way to talk about how mathematical structures of a given type1 can be transformed into one another2 by functions that preserve some aspect of their structure; it provides a uniform language for speaking of a great range of types1 of mathematical structure (groups, automata, vector spaces, sets, topological spaces, … and even categories!) and the mappings within those types1. Although it formalises the properties of mappings between structures (really: between the sets on which the structure is imposed), it only deals with abstract properties of maps and structures, calling them morphisms (or arrows) and objects; the elements of such structured sets are not the concern of category theory, and nor are the structures on those sets. You ask “what is it a theory of”; it is a theory of structure-preserving mappings of mathematical objects of an arbitrary type1.

The theory of Abstract categories3, however, as just stated, totally ignores the sets, operations, relations and axioms specifying the structure of the objects in question, and just provides a language in which to talk about how mappings that do preserve some such structure behave: without knowing what structure is preserved, we know that the combination of two such maps also preserves structure. For that reason, the axioms of category theory require that there be an associative composition law on morphisms and, similarly, that there be an identity morphism from each object to itself. But it does not assume that morphisms actually are functions between sets, just that they behave like them.

To be worked out: Concrete categories model the idea of adding structure to the objects of a ‘base category’; when this is $\mathsf{Set}$ we can have the situation where we add structure like a group operation to a set. In this case one may have more to say about how structure is added in terms of the specific base category.

As for the implications of your formulations, saying that “$G$ is a group”, that “$G$ is an element of the set of groups” (actually a proper class) or that “$G$ is (an object) in $\mathsf{Grp}$” (or a “$\mathsf{Grp}$-object”) mean the same thing logically, but talking about the category suggests you are interested in group homomorphisms (the morphisms in $\mathsf{Grp}$) and perhaps in what they have in common with other morphisms. On the other hand, saying $G$ is a group might suggest you are interested in the structure of the group (its multiplication operation) itself or perhaps in how the group acts on some other mathematical object. You would be unlikely to talk about $G$ belonging to the set of groups, though you could easily write $G ∈ S$ for some particular set $S$ of groups you are interested in.

1 Here and passim I do not refer to type in the sense of type theory, but rather a set of properties required of the mathematical objects/structures, i.e. a set of axioms they satisfy. Normally these describe the behaviour of some operations or relations on elements of the sets considered to carry the structure, though in the case of sets themselves ($\mathsf{Set}$) there is no structure beyond the sets themselves. In any case, as said above, category theory ignores the details of this structure.

2 I should perhaps say into all or part of one another: one allows the homomorphism from $\mathbb Z$ (integers) into $\mathbb Q$ (rationals) given by $n \mapsto \frac n 2$ .

3 Without qualification, ‘category’ normally means ‘abstract category’, introduced, as far as I can see, in 1945 and developed in the 1960’s while Concrete categories seem to appear in the 1970’s.

• I'm not sure if that was rhetorical, but there's definitely a proper class of groups. For example, every set gives rise to a trivial group on the singleton set containing that set. You can also produce a proper class of non-isomorphic examples. – Derek Elkins left SE May 1 '18 at 0:54
• Thank you. When you say: "it is a theory of structure-preserving mappings of mathematical objects of an arbitrary type", do you mean "type" in the sense of type theory, or more informally? – user56834 May 1 '18 at 5:17
• @Programmer2134: Sorry if type was confusing (I did wonder); I do not mean to refer to type theory (of which I know little), but rather meant mathematical objects/structures with a certain set of properties (i.e. satisfying certain axioms) by mathematical objects/structures of a given type. – PJTraill May 1 '18 at 10:54
• That clarifies. So does category theory also specifically assumes that there are such axioms, and that these objects all satisfy those axioms, or is that merely a meta criterion we use to define categories (i.e. meta to the category theory framework)? – user56834 May 1 '18 at 10:57
• @Programmer2134: No, category theory totally ignores the axioms, and just provides a language in which to talk about mappings that do preserve some such structure: without knowing what structure is preserved, we know that the combination of two such maps also preserves structure. For that reason, the axioms of category theory require that there be an associative composition law on morphisms and, similarly, that there be an identity morphism from each object to itself. But it does not assume that morphisms actually are functions between sets, just that they behave like them. – PJTraill May 1 '18 at 11:26

Category theory is in some sense a generalization of set theory: the category $C$ could be the category of sets, or it could be something else. So, you learn less if you learn that $x$ is an object in some unspecified category than if you learn that $x$ is a set (since in the latter case it follows that $x$ is an object in specifically the category of sets). If you learn that $x$ is an object in a particular specified category (other than the category of sets), what you learn is different from learning that $x$ is a set (i.e., an object in the category of sets); neither implies the other.

There's no difference between saying that $x$ is a group vs saying that $x$ is an object in the category Grp. Those two statements are equivalent.

Note: we don't say that $x$ is in the category Grp; we say that $x$ is an object in the category Grp. A category has both objects and arrows. You need to specify which you are talking about.

• So let me compare categories with sets and types as @AndrejBrauer did in his answer to my other question. A set formalizes the notion of a collection of objects. A type formalizes the notion of a construction of objects. What notion does "Category" formalize? What mathematical process/structure is category theory a theory of? – user56834 Apr 30 '18 at 16:55
• "So, you learn less if you learn that $x$ is an object in some unspecified category than if you learn that $x$ is a set". If you replace "is a set" with "is a member of some unspecified set", how would that statement change? Do we impose any restriction on $x$ by saying it is an object of an unspecified category? Surely we can just form a category in which that $x$ is the only object? – user56834 May 1 '18 at 5:21
• @Programmer2134, that is a good point. Makes sense. I accept your point. – D.W. May 1 '18 at 17:06

A further point on D.W.'s explanation

There's no difference between saying that $x$ is a group vs saying that $x$ is an object in the category $\mathsf{Grp}$. Those two statements are equivalent.

I'd like to make a stronger statement:

A concept is defined by its category

Think of it from the pespective of an inventor wanting to explain his concept. Suppose your new concept is called $M$. First, you might have to specify how many variations of instances of things that are $M$ can there be. Let's call that collection of instances $M_0$.

Now since you said that there are many things that are $M$, you have to explain each of them compares/relate to each other. You explain why do you think they are different instances of $M$. There might even be multiple ways in which $A \in M_0$ could be compared to $B \in M_0$ each other. Or in some cases, there might be no way to compare them at all. Let's denote that collection of ways to compare $A$ to $B$ as $M(A,B)$.

You probably notice already that $M_0$ forms the collection of objects and $M(A,B)$ is the homset of a category. The laws of category theory then lays out the expected behaviour of 'comparison'.

Once you have that, the category gives you many default property of the concept. Examples range from

• "which instances are essentially the same --- isomorphism",
• "which of these two instance is more and which is less --- section-retraction pair",
• "How many of the basic elements are inside this instance? --- homset from terminal object"

and so on.

As for the question you ask in comment

What mathematical process/structure is category theory a theory of?

You now know the drill. Want to know what a concept really is? Look at its category. In this case, $\mathsf{Cat}$ the category of small categories and functors between them.

• Hmm. I don't understand exactly how if we know a structure's category, we know everything about that structure. We don't know which axioms the structure satisfies do we? – user56834 May 1 '18 at 14:10
• @Programmer2134 Rethinking set theory by Tom Leinster (which is a summary of work by Lawvere) is a good example. The work defines the set theory itself by defining properties of (the morphisms of) the category of sets (without accessing 'inside' any objects to access any pre-existing assumption we might have about sets.) – Apiwat Chantawibul May 1 '18 at 18:14
• So you're saying that no information whatsoever is lost about set theory by just considering the category of sets, while forgetting its axioms? – user56834 May 1 '18 at 18:25
• @Programmer2134 Yes, in fact, it's more like the axioms that defines ZFC set theory got translated into purely properties of morphisms. So that category, which we asserts has some properties on morphisms, defines the set theory. – Apiwat Chantawibul May 1 '18 at 18:31
• Do you know of a text that specifically explains this point about category theory in a clear way? – user56834 May 3 '18 at 8:00

Sets

Basic concept. membership relation $$x\in A$$

Other concepts. Function is explained in terms of membership relation as a set $f$ of ordered pairs with $$(x,y)\in f\text{ and }(x,z)\in f \Rightarrow y=z$$

Philosophy. Sets have an inner structure - they are completely determined by their elements.

Remark. An axiomatic system widely used by set theorists is ZFC. Its strength is the simplicity: there are only sets and a membership relation. On the other hand many mathematicians feel that this leads to a set concept that diverges from their understanding and usage of sets (compare below Leinster). In fact tha vast majority of mathematicians (except set theorists) seems not to use the ZFC axioms. However, sets do not necessarily refer to ZFC (see below categories and ETCS).

Categories

Basic concept. function (arrow, morphism) $$A\rightarrow B$$

Other concepts. Membership relation $x\in A$ is explained in terms of an arrow from a terminal object (in Set a terminal object is a singleton set $\{y\})$ $$x:1\rightarrow A$$

Philosophy. Objects of a category have a priori no inner structure. They are just characterized by their relations (morphisms) to other objects.

Remark. The basic concept of categories is function and this coincides with the usage of sets by the vast majority of mathematicians. Therefore you might see categories as a conceptual generalization of the way that (most) mathematicians from very different fields use sets in their daily work. Apart from categories (and toposes) as a generalization you might have a look at the axiomatic system ETCS that is axiomatizing sets (compare below Leinster and Lawvere).

Question. What is the difference between saying x is a group, versus saying that x is in the Category Grp?

One might say the difference is not in the object $x$ itself but rather how you intend to deal with $x$.

(1) Do you ask for the inner structure of $x$? In this case it might appear natural to regard $x$ as a set.

(2) Do you ask how $x$ relates to other objects of same kind (via morphisms) or of other kind (via functors)? In this case you might tend to see $x$ as an object in the category of groups.

Critics

In case of ZFC and ETCS these approaches can be translated into each other, although ETCS is weaker than ZFC but (seemingly) covers most mathematics (see MathStackExchange and Leinster). In principle (using an extension of ETCS) you can prove the same results with both approaches. So the above mentioned philosophies of both concepts are not claiming a fundamental distinction in what you can express or what results you can prove.

The expressions set and membership in ZFC are abstract concepts just like the concepts of categories or any other axiomatic system and can mean anything. So from this formal viewpoint, to claim, that ZFC is concerned with the inner structure of sets whereas categories deal with the outer relations of objects to each other seems inappropriate. On the other hand this seems to be the philosophy or intuition of the regarding theories.

However in practice you will prefer a certain Approach for e.g. the sake of clarity or simplicity or because some concept or a connection to another area evolves more naturally than elsewhere.

References

Spivak.Category theory for scientists

Leinster.Rethinking set theory

Lawvere.An elementary theory of the category of sets

MathStackExchange.Category theory without sets