\documentclass{article}
\input{packages}
\input{def}

\lecture{Natural Transformations}

\begin{document}
\maketitle

\begin{definition}[Natural Transformation from $F : \cat{C} \mto \cat{D}$ to $G : \cat{C} \mto \cat{D}$]
A tuple $\langle \alpha, \prf{n} \rangle$ where the components have the following types:
\begin{framed}
\begin{description}
\item[Transformation $\alpha$:] For every object $\ob{C}$ of $\cat{C}$, a morphism $\alpha_\ob{C} : F(\ob{C}) \mto G(\ob{C})$ of $\cat{D}$
\item[Naturality $\prf{n}$:] $\forall \ob{C}_1 \xmto{\mo{m}} \ob{C}_2 : \cat{C}.\; \alpha_{\ob{C}_1} \cocomp G(\mo{m}) = F(\mo{m}) \cocomp \alpha_{\ob{C}_2}$
\end{description}
\end{framed}
\end{definition}

\begin{notation}
$F \nto G$ denotes the set of natural transformations from $F$ to $G$.
\end{notation}

\begin{notation}
The identity morphism on an object $\ob{O}$ is often denoted simply as $\ob{O}$.
Similarly, the identity functor on a category $\cat{C}$ is often denoted simply as $\cat{C}$.
\end{notation}

\begin{notation}
The functor from $\cat{C}$ to $\cat{D}$ mapping everything to an object $\ob{D}$ or its identity morphism is denoted with $\ob{D}$.
\end{notation}

\begin{definition}[Endofunctor]
A functor whose domain and codomain are the same.
\end{definition}

\begin{example}
The following are natural transformations between endofunctors on~$\cat{Set}$:
\begin{description}
\setlength{\itemsep}{0pt}
\item[$\mathtt{singleton} : \cat{Set} \nto \List$:] $\langle \lambda \tau.\; \lambda t.\; [t], \noprf \rangle$
\item[$\mathtt{doubleton} : \cat{Set} \nto \List$:] $\langle \lambda \tau.\; \lambda t.\; [t,t], \noprf \rangle$
\item[$\mathtt{flatten} : \List \cocomp \List \nto \List$:] $\langle \lambda \tau.\; \lambda [\vec{t}_1, \dots, \vec{t}_n].\; \vec{t}_1 \append \dots \append \vec{t}_n, \noprf \rangle$
\item[$\mathtt{reverse} : \List \nto \List$:] $\langle \lambda \tau.\; \lambda [t_1, \dots, t_n].\; [t_n, \dots, t_1], \noprf \rangle$
\item[$\mathtt{length} : \List \nto \N$:] $\langle \lambda \tau.\; \lambda [t_1, \dots, t_n].\; n, \noprf \rangle$
\end{description}
\end{example}

\begin{exercise}
Prove that the set of natural transformations from $\ob{C}_1 : \cat{1} \mto \cat{C}$ to $\ob{C}_2 : \cat{1} \mto \cat{C}$ is isomorphic to the set of morphisms from the object selected by~$\ob{C}_1$ to the object selected by~$\ob{C}_2$.
\end{exercise}

\begin{exercise}
Prove that a natural transformation from $\mo{m}_1 : \cat{2} \mto \cat{C}$ to $\mo{m}_2 : \cat{2} \mto \cat{C}$ is a commuting square with the morphism selected by~$\mo{m}_1$ on the left and the morphism selected by~$\mo{m}_2$ on the right.
\end{exercise}

\begin{exercise}
Prove that the reflection arrows of a reflective subcategory~$\cat{S} \xmono{I} \cat{C}$ form a natural transformation $\mo{r} : \cat{C} \nto R \cocomp I : \cat{C} \mto \cat{C}$.
\end{exercise}

\begin{exercise}
Prove that for any reflective subcategory there is a natural transformation $\varepsilon : I \cocomp R \nto \cat{S}$.
Specify this natural transformation in detail for the reflective subcategory $\cat{Mon} \mono \cat{Sgr}$.
\end{exercise}

\begin{exercise}
Prove that a natural transformation could equivalently be defined as a tuple $\langle \alpha, \prf{n} \rangle$ where the components have the following types:
\begin{framed}
\begin{description}
\item[Transformation $\alpha$:] $\forall \ob{C}_1 \xmto{\mo{m}} \ob{C}_2 : \cat{C}.\; F(\ob{C}_1) \mto G(\ob{C}_2)$
\item[Naturality $\prf{n}$:] $\forall \ob{C}_1 \xmto{\mo{m}_1} \ob{C}_2 \xmto{\mo{m}_2} \ob{C}_3.\; F(\mo{m}_1) \cocomp \alpha_{\mo{m}_2} = \alpha_{\mo{m}_1 \cocomp \mo{m}_2} = \alpha_{\mo{m}_1} \cocomp G(\mo{m}_2)$
\end{description}
\end{framed}
\end{exercise}

\begin{exercise}
Define the category $\cat{C} \expto \cat{D}$ whose objects are functors from $\cat{C}$ to $\cat{D}$ and whose morphisms are natural transformations between those functors.
\end{exercise}

\begin{exercise}
Prove that $\mathtt{reverse}$ is an isomorphism in $\cat{Set} \expto \cat{Set}$.
\end{exercise}

\begin{exercise}
Prove that the isomorphisms in $\cat{C} \expto \cat{D}$ are precisely the natural transformations for which every morphism component is an isomorphism (referred to as a natural isomorphism).
\end{exercise}

\begin{exercise}
Prove that the monomorphisms in $\cat{C} \expto \cat{D}$ are precisely the natural transformations for which every morphism component is a monomorphism (referred to as a natural monomorphism).
\end{exercise}

\begin{exercise}
Prove that there is a binary functor from $[\cat{C} \expto \cat{D}, \cat{D} \expto \cat{E}]$ to $\cat{C} \expto \cat{E}$.
\end{exercise}

\newcommand{\hcocomp}{\cocomp}

\begin{exercise}
Determine what $5$ would be mapped to by $\mathtt{singleton} \hcocomp \mathtt{doubleton} : \cat{Set} \nto \List \cocomp \List$.
\end{exercise}

\begin{exercise}
Prove that, for any reflective subcategory, $(\mo{r} \hcocomp R) \cocomp (R \hcocomp \varepsilon) : R \nto R : \cat{C} \mto \cat{S}$ and $(I \hcocomp \mo{r}) \cocomp (\varepsilon \hcocomp I) : I \nto I : \cat{S} \mto \cat{C}$ equal the identity natural transformation on $R$ and $I$ respectively, where we overload $R$ and~$I$ to denote their identity natural transformations.
\end{exercise}

\end{document}
