# 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 $S$ of a category** **$C$, with the property that there exists a unique morphism from $S$ to $A$, for all $A$ in the category:

And the **final** (or **terminal**) object is an object $S$ of a category** **$C$, with the property that there exists a unique morphism from $A$ to $S$, for all $A$ in the category:

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 $Set$ of sets and total functions. Let:

$1 = {*}$be a singleton set. For each set A there is a unique morphism:

$A \rightarrow 1$which is the function (in Set) that sends everything to $*$. Thus $1$ is the **final** object of the category $Set$. 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):

$\emptyset \rightarrow A$This $\emptyset$ is an **initial** object of the category $Set$.

$\emptyset$** **corresponds to the type $Void$ in Haskell and the unique polymorphic function from $Void$:** **

means that $Void$ is the initial object in $Hask$.

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

means that is the **final** (or **terminal**) object in $Hask$.

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:

$I_1 \xrightarrow {f} I_2 \\ I_1 \xleftarrow {g} I_2$The composition of $g \circ f = id_1$ and $f \circ g = id_2$ which means that $I_1$ and $I_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 $C$ is the **final/initial** object in the opposite category $C^{op}$. The opposite category is the category in which all the morphisms are reversed.

And as we learned before, there is a morphism $() \xrightarrow {f} A$ that simply selects a value from the type $A$ in the category $Hask$. 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.