Definition:Functor

A functor is a morphism of categories.

Covariant Functor
Let $\mathcal C$ and $\mathcal D$ be categories.

A covariant functor $F : \mathcal C \to \mathcal D$ consists of:


 * An object functor that assigns to each object $X$ of $\mathcal C$ an object $FX$ of $\mathcal D$.


 * An arrow function that assigns to each arrow $f : X \to Y$ of $\mathcal C$ an arrow $Ff : FX \to FY$ of $\mathcal D$.

These functors must satisfy: for any morphisms $X \stackrel{f}{\longrightarrow} Y \stackrel{g}{\longrightarrow} Z$ in $\mathcal C$:


 * $F(g \circ f) = Fg \circ Ff$, and $F(\operatorname{id}_X) = \operatorname{id}_{FX}$,

where $\operatorname{id}_W$ denotes the identity arrow on an object $W$, and $\circ$ is the composition of morphisms.

Contravariant Functor
Let $\mathcal C$ and $\mathcal D$ be categories.

A contravariant functor $F : \mathcal C \to \mathcal D$ consists of:


 * An object functor that assigns to each object $X$ of $\mathcal C$ an object $FX$ of $\mathcal D$.


 * An arrow functor that assigns to each arrow $f : X \to Y$ of $\mathcal C$ an arrow $Ff : FY \to FX$ of $\mathcal D$.

These functors must satisfy: for any morphisms $X \stackrel{f}{\longrightarrow} Y \stackrel{g}{\longrightarrow} Z$ in $\mathcal C$:


 * $F(g \circ f) = Ff \circ Fg$, and $F(\operatorname{id}_X) = \operatorname{id}_{FX}$.