Any two objects X and Y of C have a productX ×Y in C.
Any two objects Y and Z of C have an exponentialZY in C.
The first two conditions can be combined to the single requirement that any finite (possibly empty) family of objects of C admit a product in C, because of the natural associativity of the categorical product and because the empty product in a category is the terminal object of that category.
The third condition is equivalent to the requirement that the functor – ×Y (i.e. the functor from C to C that maps objects X to X ×Y and morphisms φ to φ × idY) has a right adjoint, usually denoted –Y, for all objects Y in C.
For locally small categories, this can be expressed by the existence of a bijection between the hom-sets
Take care to note that a Cartesian closed category need not have finite limits; only finite products are guaranteed.
If a category has the property that all its slice categories are Cartesian closed, then it is called locally cartesian closed. Note that if C is locally Cartesian closed, it need not actually be Cartesian closed; that happens if and only if C has a terminal object.
For each object Y, the counit of the exponential adjunction is a natural transformation
called the (internal) evaluation map. More generally, we can construct the partial application map as the composite
In the particular case of the category Set, these reduce to the ordinary operations:
Evaluating the exponential in one argument at a morphism p : X → Y gives morphisms
corresponding to the operation of composition with p. Alternate notations for the operation pZ include p* and p∘-. Alternate notations for the operation Zp include p* and -∘p.
Evaluation maps can be chained as
the corresponding arrow under the exponential adjunction
is called the (internal) composition map.
In the particular case of the category Set, this is the ordinary composition operation:
For a morphism p:X → Y, suppose the following pullback square exists, which defines the subobject of XY corresponding to maps whose composite with p is the identity:
where the arrow on the right is pY and the arrow on the bottom corresponds to the identity on Y. Then ΓY(p) is called the object of sections of p. It is often abbreviated as ΓY(X).
If ΓY(p) exists for every morphism p with codomain Y, then it can be assembled into a functor ΓY : C/Y → C on the slice category, which is right adjoint to a variant of the product functor:
The exponential by Y can be expressed in terms of sections:
Examples of Cartesian closed categories include:
The category Set of all sets, with functions as morphisms, is Cartesian closed. The product X×Y is the Cartesian product of X and Y, and ZY is the set of all functions from Y to Z. The adjointness is expressed by the following fact: the function f : X×Y → Z is naturally identified with the curried function g : X → ZY defined by g(x)(y) = f(x,y) for all x in X and y in Y.
The category of finite sets, with functions as morphisms, is Cartesian closed for the same reason.
If G is a group, then the category of all G-sets is Cartesian closed. If Y and Z are two G-sets, then ZY is the set of all functions from Y to Z with G action defined by (g.F)(y) = g.F(g−1.y) for all g in G, F:Y → Z and y in Y.
The category of finite G-sets is also Cartesian closed.
The category Cat of all small categories (with functors as morphisms) is Cartesian closed; the exponential CD is given by the functor category consisting of all functors from D to C, with natural transformations as morphisms.
If C is a small category, then the functor category SetC consisting of all covariant functors from C into the category of sets, with natural transformations as morphisms, is Cartesian closed. If F and G are two functors from C to Set, then the exponential FG is the functor whose value on the object X of C is given by the set of all natural transformations from (X,−) × G to F.
The earlier example of G-sets can be seen as a special case of functor categories: every group can be considered as a one-object category, and G-sets are nothing but functors from this category to Set
The category of all directed graphs is Cartesian closed; this is a functor category as explained under functor category.
In particular, the category of simplicial sets (which are functors X : Δop → Set) is Cartesian closed.
Even more generally, every elementary topos is Cartesian closed.
A Heyting algebra is a Cartesian closed (bounded) lattice. An important example arises from topological spaces. If X is a topological space, then the open sets in X form the objects of a category O(X) for which there is a unique morphism from U to V if U is a subset of V and no morphism otherwise. This poset is a Cartesian closed category: the "product" of U and V is the intersection of U and V and the exponential UV is the interior of U∪(X\V).
A category with a zero object is Cartesian closed if and only if it is equivalent to a category with only one object and one identity morphism. Indeed, if 0 is an initial object and 1 is a final object and we have , then which has only one element.
In particular, any non-trivial category with a zero object, such as an abelian category, is not Cartesian closed. So the category of modules over a ring is not Cartesian closed. However, the functor tensor product with a fixed module does have a right adjoint. The tensor product is not a categorical product, so this does not contradict the above. We obtain instead that the category of modules is monoidal closed.
Examples of locally Cartesian closed categories include:
Every elementary topos is locally Cartesian closed. This example includes Set, FinSet, G-sets for a group G, as well as SetC for small categories C.
The category LH whose objects are topological spaces and whose morphisms are local homeomorphisms is locally Cartesian closed, since LH/X is equivalent to the category of sheaves . However, LH does not have a terminal object, and thus is not Cartesian closed.
If C has pullbacks and for every arrow p : X → Y, the functor p* : C/Y → C/X given by taking pullbacks has a right adjoint, then C is locally Cartesian closed.
If C is locally Cartesian closed, then all of its slice categories C/X are also locally Cartesian closed.
Non-examples of locally Cartesian closed categories include:
Cat is not locally Cartesian closed.
In Cartesian closed categories, a "function of two variables" (a morphism f : X×Y → Z) can always be represented as a "function of one variable" (the morphism λf : X → ZY). In computer science applications, this is known as currying; it has led to the realization that simply-typed lambda calculus can be interpreted in any Cartesian closed category.