Initial and final object

The initial and final object(s) take up the extreme positions in a category.

An initial object, if it exists, is an object SS of a category CC, with the property that there exists a unique morphism from SS to AA, for all AA in the category:

SA,ACS \rightarrow {} A, \forall A \in C

And the final (or terminal) object is an object SS of a category CC, with the property that there exists a unique morphism from AA to SS, for all AA in the category:

AS,ACA \rightarrow S, \forall A \in C

That is the initial object is the object that has a single morphism going from itself to all other objects in the category (including itself). The final object is the object that has a single morphism coming to it from every other object in the category (including itself). The uniqueness of the morphism is the crucial part.

Again, as an example, we use the category SetSet of sets and total functions. Let:

1=1 = {*}

be a singleton set. For each set A there is a unique morphism:

A1A \rightarrow 1

which is the function (in Set) that sends everything to *. Thus 11 is the final object of the category SetSet. That is, everything in the category ends up as the final object when composed to the extremes.

Then consider the empty set, \emptyset, which for each set there exists the unique morphism (which exists as from nothing anything can be constructed):

A\emptyset \rightarrow A

This \emptyset is an initial object of the category SetSet.

\emptyset corresponds to the type VoidVoid in Haskell and the unique polymorphic function from VoidVoid:

means that VoidVoid is the initial object in HaskHask.

Similarly, 11 corresponds to the type ()() (unit) in Haskell and again the unique polymorphic function to ()():

means that is the final (or terminal) object in HaskHask.

A category can have both an initial and final object or none, it can have only one, and it can even have more than one initial and/or final objects. More than one initial (or final) objects in a category are isomorphic. This means, that by the definition of inital/final object there can only be one morphism to/from any other object in the category. So take, for example, two initial objects and two unique morphisms between them:

I1fI2I1gI2I_1 \xrightarrow {f} I_2 \\ I_1 \xleftarrow {g} I_2

The composition of gf=id1g \circ f = id_1 and fg=id2f \circ g = id_2 which means that I1I_1 and I2I_2 are isomorphic. A similar argument applies for the terminal objects.

A category in which the initial and final object are the same is said to be a zero object.

Furthermore, an initial/final object in a category CC is the final/initial object in the opposite category CopC^{op}. The opposite category is the category in which all the morphisms are reversed.

AfBgC=ahCh=gfAfopBgopC=AhopChop=fopgopA \xrightarrow {f} B \xrightarrow {g} C = a \xrightarrow {h} C \\ h = g \circ f \\ A \xleftarrow {f^{op}} B \xleftarrow {g^{op}} C = A \xleftarrow {h^{op}} C \\ h^{op} = f^{op} \circ g^{op}

And as we learned before, there is a morphism ()fA() \xrightarrow {f} A that simply selects a value from the type AA in the category HaskHask. This morphism allows us to select elements of the set without actually having any notion of elements of a set as in category theory we only deal with objects (think points) and all morphisms between those objects.