Category of sets
In the mathematical field of category theory, the category of sets, denoted as Set, is the category whose objects are sets. The arrows or morphisms between sets A and B are the total 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 and/or restrict the arrows to functions of a particular kind.
The axioms of a category are satisfied by Set because composition of functions is associative, and because every set X has an identity function idX : X → X which serves as identity element for function composition.
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.
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).
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 HomC(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.
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.
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 SetU 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 SetU but not of Set.