I am an undergraduate maths student taking a category theory course this term. Very quickly I have run into the issue of how categories such as **Set** can be defined since we can’t have a set of all sets. The lecturer defined categories using the word ‘collection’ but I’ve never encountered a collection in maths that wasn’t a set yet. I’ve seen references to classes when I look this up, which seem to me to be sets but with a different name so that it’s not technically a set of all sets, but then what happens if you need a class of all classes?

The lecturer told us not to worry about it and that he would tell us when we need to consider this issue in our study of category theory but I’m struggling to move on in the class without finding out. I have tried to research this issue but I am struggling to find an explanation at my level.

Please could someone ELI5?

In: 13

Categories are defined on *classes*, not on *sets*. The category **Set** has the class of all sets (which is not the same thing as a set of all sets) as its objects and the class of (total) functions between sets as its morphisms.

A class is defined by a property, which is different from the axioms of a set (which treat membership as first-class and think of properties in terms of membership). To say “x is in the class C” is to say “a logical property P applies to x” or more succinctly, “P(x)”. For example, the property “contains two elements” is well-defined in set theory, and there is a class (which is not a set) of “sets that contain two elements”, with {1,2} and {R, C} as members of that class.

The standard formalism on which you do most math formalizes everything in terms of sets, so **Set** – being defined on a class that is not a set – can’t be formalized in that fashion. You need a larger, more powerful logical foundation than ZFC to work on classes.

—–

The reason that you run into problems with the set of all sets is that you want to do *comprehension* on sets, and in particular, you want sets to be able to contain other sets. So you have an axiom:

* Given a set S and a property P, it is possible to form a new set T = {x in S | P(x)} of elements of S that satisfy property P.

And if you have a set of all sets, you run into a contradiction by setting P(x) = x (not a member of) X.

You don’t run into the same problem with classes because classes aren’t members of classes. Only sets are members of classes, so there is no “class of all classes”.

You CAN define a set as the set of all sets. There is no problem there.

The set is a member of itself, which is not a problem.

Any set is contained in the set of all sets. No issue.

The set has infinitely many members, but this is also not a problem.

Maybe you’re thinking of the paradox:

“The set of all sets that do not contain themselves.”

This is indeed a paradox. We could go into that if you want (if it’s not self-evident), but to answer your question here: the set of all sets is a perfectly valid set.

>but then what happens if you need a class of all classes?

There are axioms called [ZFC](https://en.wikipedia.org/wiki/Zermelo%E2%80%93Fraenkel_set_theory) that roughly say that if you have some sets, there are some rules that you can follow to create new sets. If we try to make a set of all sets, then we run into paradoxes as those rules allow us to do things that result in contradictions.

For example, the axiom of regularity implies that no set is an element of itself. But the set of all sets have to contain itself.

With classes, we use [NBG](https://en.wikipedia.org/wiki/Von_Neumann%E2%80%93Bernays%E2%80%93G%C3%B6del_set_theory) instead. Classes follow different rules that don’t allow you to make those contradictory things. This allows us to make a class of all sets. Because the class of all sets is not itself a set, and doesn’t have to follow any of the rules that are imposed on sets.

Note that NBG still doesn’t allow you to make the “category of all categories”, since a proper class cannot be contained in another class.

Another approach is to use [Grothendieck universes](https://en.wikipedia.org/wiki/Grothendieck_universe). These are sets that are so large that you can essentially do all of “usual” mathematics in them. In this case, instead of considering the “set of all sets”, we look at the “set of all sets in some Grothendieck universe”. This set behaves just like how a “set of all sets” would behave, but doesn’t run into contradictions since it’s not actually the set of all sets.

However, uncountable Grothendieck universes step beyond ZFC. That is: ZFC cannot prove the existence of such Grothendieck universes, and it’s consistent that they don’t exist. Therefore, using them would require going beyond ZFC.

## Latest Answers