# Category of sets

In the mathematical field of category theory, the category of sets, denoted by Set, is the category whose objects are sets. The arrows or morphisms between sets A and B are the functions from A to B, and the composition of morphisms is the composition of functions.
Many other categories (such as the category of groups, with group homomorphisms as arrows) add structure to the objects of the category of sets or restrict the arrows to functions of a particular kind (or both).

## Properties of the category of sets

The axioms of a category are satisfied by Set because composition of functions is associative, and because every set X has an identity function id$_X$ : X → X which serves as identity element for function composition.
The epimorphisms in Set are the surjective maps, the monomorphisms are the injective maps, and the isomorphisms are the bijective maps.
The empty set serves as the initial object in Set with empty functions as morphisms. Every singleton is a terminal object, with the functions mapping all elements of the source sets to the single target element as morphisms. There are thus no zero objects in Set.
The category Set is complete and co-complete. The product in this category is given by the cartesian product of sets. The coproduct is given by the disjoint union: given sets A$_i$ where i ranges over some index set I, we construct the coproduct as the union of A$_i$×{i} (the cartesian product with i serves to ensure that all the components stay disjoint).
Set is the prototype of a concrete category; other categories are concrete if they are "built on" Set in some well-defined way.
Every two-element set serves as a subobject classifier in Set. The power object of a set A is given by its power set, and the exponential object of the sets A and B is given by the set of all functions from A to B. Set is thus a topos (and in particular cartesian closed and exact in the sense of Barr).
Set is not abelian, additive nor preadditive.
Every non-empty set is an injective object in Set. Every set is a projective object in Set (assuming the axiom of choice).
The finitely presentable objects in Set are the finite sets. Since every set is a direct limit of its finite subsets, the category Set is a locally finitely presentable category.
If C is an arbitrary category, the contravariant functors from C to Set are often an important object of study. If A is an object of C, then the functor from C to Set that sends X to Hom$_C$(X,A) (the set of morphisms in C from X to A) is an example of such a functor. If C is a small category (i.e. the collection of its objects forms a set), then the contravariant functors from C to Set, together with natural transformations as morphisms, form a new category, a functor category known as the category of presheaves on C.

## Foundations for the category of sets

In Zermelo–Fraenkel set theory the collection of all sets is not a set; this follows from the axiom of foundation. One refers to collections that are not sets as proper classes. One cannot handle proper classes as one handles sets; in particular, one cannot write that those proper classes belong to a collection (either a set or a proper class). This is a problem because it means that the category of sets cannot be formalized straightforwardly in this setting. Categories like Set whose collection of objects forms a proper class are known as large categories, to distinguish them from the small categories whose objects form a set.
One way to resolve the problem is to work in a system that gives formal status to proper classes, such as NBG set theory. In this setting, categories formed from sets are said to be small and those (like Set) that are formed from proper classes are said to be large.
Another solution is to assume the existence of Grothendieck universes. Roughly speaking, a Grothendieck universe is a set which is itself a model of ZF(C) (for instance if a set belongs to a universe, its elements and its powerset will belong to the universe). The existence of Grothendieck universes (other than the empty set and the set $V_{\omega }$ of all hereditarily finite sets) is not implied by the usual ZF axioms; it is an additional, independent axiom, roughly equivalent to the existence of strongly inaccessible cardinals. Assuming this extra axiom, one can limit the objects of Set to the elements of a particular universe. (There is no "set of all sets" within the model, but one can still reason about the class U of all inner sets, i.e., elements of U.)
In one variation of this scheme, the class of sets is the union of the entire tower of Grothendieck universes. (This is necessarily a proper class, but each Grothendieck universe is a set because it is an element of some larger Grothendieck universe.) However, one does not work directly with the "category of all sets". Instead, theorems are expressed in terms of the category Set$_U$ whose objects are the elements of a sufficiently large Grothendieck universe U, and are then shown not to depend on the particular choice of U. As a foundation for category theory, this approach is well matched to a system like Tarski–Grothendieck set theory in which one cannot reason directly about proper classes; its principal disadvantage is that a theorem can be true of all Set$_U$ but not of Set.
Various other solutions, and variations on the above, have been proposed.
The same issues arise with other concrete categories, such as the category of groups or the category of topological spaces.