# Can we build set theory from category theory?

Can we get set theory from category theory? Or maybe can we consider both of them at the same time when building a foundation for mathematics?

And also, I have read that almost every known mathematical structure can be represented as a category. I have read the same for set theory, that almost all mathematical structures can be represented as sets. But what about those mathematical structures that cannot be represented as categories or sets? If set theory or category theory can serve as a foundation for all mathematics, how can we get these structures from this basis or foundation?

• How would you define a category without knowing what a set/class is? Commented Apr 3, 2020 at 19:00
• @ε-δ That's not the problem; see single-sorted defintion of category on nLab. Regarding the question: yes, we can. For example, see W. Lawvere's ETCS (Elementary Theory of Category of Sets) Commented Apr 3, 2020 at 19:04
• @ε-δ Presumably the same way we can define what a set is without defining what an element is or what containment is: By dictating how they behave through axioms. Commented Apr 3, 2020 at 19:05

There are in fact formulations of Set Theory using purely Category Theory. One famous is given by W. Lawvere's $$\sf ETCS$$ (Elementary Theory of Category of Sets) which was also one of the first attempts of basing Set Theory on Category Theory (a revised version of his original paper can be found here). Of course, then you have to define the concepts of Category Theory without ever mention sets. This is doable, even though a little tedious, see for example single-sorted defintion of categories in nLab (which cites S. Mac Lanes "Categories for the working mathematician" as source, chapter I.$$1$$ in particular).

The key idea behind Lawvere's paper is to formalize how sets and, especially, functions maps between sets (i.e. functions) behave instead of arguing how sets look like from inside (roughly). Thus, $$\sf ETCS$$ is an external set theory (or structuralistic) in contrast to, lets say $$\sf ZFC$$ which is an internal set theory (or materialistic). For a more recent approach towards Lawvere's $$\sf ETCS$$ see also T. Leinster's "Rethinking Set Theory" which tries to capture the essence of Lawvere's idea in more intuitive terms.

Speaking about foundations: actually,$$\sf ZFC$$ and $$\sf ETCS$$ are nearly equiconsistent (i.e. are both able to prove exactly the same things). By nearly I refer to the fact the $$\sf ETCS$$ is weaker in so far that there is no analogue of the Axiom Schema of Replacement. Adding a variant of this axiom, however, yields to the two theories being equiconsistent. (EDIT (as pointed out by jgon): this is not like replacing Set Theory by Category Theory in foundational matters but more like describing the fundamental principles in a different language).

That we can represent nearly every mathematical strcuture in terms of sets stems from the fact that many structures are in fact defined as sets with extra structure (this is especially true for algebraic structures such as groups, rings, fields, etc.). But we can also view these as objects of their respective categories, where the categories carry the information making them special (for example, the category of groups does have a zero object, while the category of sets does not). Currently I cannot think of a mathematical concepts that is not describable via sets/categories but I might be missing something out.

• You don't need to go as far as the single-sorted definition of category to avoid talking about sets. Many-sorted first order logic is perfectly respectable first order logic, and a two-sorted theory of categories is very natural. Commented Apr 3, 2020 at 19:34
• Do any of the approaches you mention give a good way of capturing the axiom of replacement? And do any of them do better than set theory in supporting what we really need, which is a formal system that lets us talk in the way one does in algebraic topology, for example, about situations involving multiple different categories, functors between those categories, natural transformations between those functions etc? Commented Apr 3, 2020 at 19:50
• I think this answer should perhaps be more clear that ETCS (plus replacement) isn't replacing set theory with category theory as foundations, but rather reaxiomatizing set theory, with the axioms inspired by topos theory. (See Leinster's linked article). I presume the benefit of this is that this allows easier generalization to other toposes.
– jgon
Commented Apr 3, 2020 at 20:02
• @jgon Another important benefit is that the axioms of ETCS reflect more closely how mathematicians actually work with sets, which is not via the membership relation-for instance it doesn’t allow standard angels-on-pinheads questions like whether $\pi\in 3$. Commented Apr 4, 2020 at 7:14
• @AsafKaragila Maybe I regret opening this up at all, but now that we’re here...There’s a stronger sense in which the real $\pi$ and the irrational $\pi$ are equal, namely that the one becomes equal to the other under the canonical inclusion of the irrationality into the reals. In this sense I’m not sure how the “two different $\pi$s” issue here is any worse than the fact that the equivalence class of Cauchy sequences $\pi$ is not equal to the Dedekind cut $\pi$-those two are also made equal by a canonical isomorphism. Commented Apr 5, 2020 at 17:19