pathterminuspages/math/aboutcontactabout me





A natural transformation is a map between two functors that preserves structure. That is given two categories $\mathcal{C}$ and $\mathcal{D}$, two functors between these, $F,G : A \rightarrow B$, a natural transformation is a a function that assigns to every $\mathcal{C}$-object, $A$, the $\mathcal{D}$-arrow $\mu_A : F(A) \rightarrow G(A)$ such that for every $\mathcal{C}$-arrow, $f : A \rightarrow B$, the following diagram commutes:

Diagram of a natural transformation

Note that $\mu_A$ are a set (or family) of arrows - these are indexed by objects of $\mathcal{C}$. And that these arrows are in $\mathcal{D}$, alongside the arrows mapped by the functors, eg. alongside $F(f),G(f)$ for $f$ arrow in $\mathcal{C}$.

Example - The monoid category

Recall that the single object monoid category has arrows as elements and a single object representing the underlying set. Functors between two such categories are monoid homomorhisms. Given two such functors $F,G : M \rightarrow N$, natural transformations are elements $n \in N$ such that $$ n F(x) = G(x) n $$ for all $x \in M$. Given two monoids that commute, every element gives rise to a natural transformation.

Example - Between two preorders

Let $\mathcal{P}$ a preorder regarded as a category. Let $\mathcal{C}$ be an arbitrary category. Let $S,T : \mathcal{C} \rightarrow \mathcal{P}$ be functors. There is a unique natural transformation $\tau : S \rightarrow T$ if and only if $S(C) \leq T(C)$ for every $\mathcal{C}$-object $C$. We can show this:

  • Right direction: Let $\tau : S \rightarrow T$ a unique natural transformation. Given any $\mathcal{C}$ objects, $C$ we have the $\mathcal{P}$-arrow $$ \tau_C : S(C) \rightarrow T(C) $$ given that $\tau$ is a natural transformation. Since $\tau_C \in \mathcal{P}$ (which is a preorder), we know that no co-arrows are present. Hence $S(C) \leq T(C)$ for every $\mathcal{C}$-object $C$.
  • Left direction: Let $S(C) \leq T(C)$ for every $\mathcal{C}$-object $C$. That is we know that the arrow $$ \tau_C : S(C) \rightarrow T(C) $$ for every object $C$ in $\mathcal{C}$, exists in $\mathcal{D}$.

Example - The reverse list function

In functional programming languages we have the function $rev$ that reverses the elements of a list. That is $$ rev([1,2,3]) = [3,2,1] $$ This function works on any type of list - it is polymorphic. We can compose it with the $map$ function on lists. That is $$ map(f,rev[e_1,e_2,e_3]) = [f(e_3),f(e_2),f(e_1)] $$ Now $map$ is a functor between the category of lists of different types. For example we have a map given as $$ map : List\ String \rightarrow List\ Int $$ Since $rev$ is polymorphic we have that $$ map \circ rev = rev \circ map $$ Hence $rev$ is a natural transformation.

CommentsGuest Name:Comment: