\documentclass{article}
\input{packages}
\input{def}

\homework{Adjunctions}

\begin{document}
\maketitle

\begin{wrapfigure}{r}{6cm}
\begin{tikzpicture}
\node(n1) at (0,0) {$\N$};
\node(r1)[circle,draw] at (1,2) {$\mathtt{repeat}$};
\node(r2)[circle,draw] at (-1,4) {$\mathtt{repeat}$};
\node(f)[circle,draw] at (1,6) {$\mathtt{flatten}$};
\node(s)[circle,draw] at (-1,8) {$\mathtt{sum}$};
\node(n2) at (0,10) {$\N$};
\draw[->] (n1.north) .. controls +(0,1) and ($(r1.south) + (0,-1)$) .. (r1.south);
\draw[->] (r1) -- node[below left]{$\N$} (r2);
\draw[->] (r1.north east) .. controls +(1,1) and ($(f.south east) + (1,-1)$) .. node[right]{$\List$} (f.south east);
\draw[->] (r2.north west) .. controls +(-1,1) and ($(s.south west) + (-1,-1)$) .. node[left]{$\N$} (s.south west);
\draw[->] (r2) -- node[below right]{$\List$} (f);
\draw[->] (f) -- node[below left]{$\List$} (s);
\draw[->] (s.north) .. controls +(0,1) and ($(n2.south) + (0,-1)$) .. (n2.south);
\end{tikzpicture}
\end{wrapfigure}
~
\begin{exercise}
Prove that the inclusion functor $\cat{Set} \xmono{I} \cat{Rel}$ has a right adjoint.
You may use any of the equivalent definitions of adjunction.
For clarification, $I$ is the functor mapping each set $X$ (an object of $\cat{Set}$) to the set $X$ (also an object of $\cat{Rel}$) and each function $X \to Y$ (a morphism of $\cat{Set}$) to the relation $\lambda \langle x, y \rangle.\; f(x) = y$ (a morphism of $\cat{Rel}$).
\end{exercise}

\begin{exercise}
There is a functor from $\cat{1}$ to $\cat{Set}$ picking out the empty set, and another functor from $\cat{1}$ to $\cat{Set}$ picking out the singleton set.
One is the left adjoint to the unique functor from $\cat{Set}$ to $\cat{1}$, and the other is the right adjoint to the unique functor from $\cat{Set}$ to $\cat{1}$.
Determine and prove which is which.
\end{exercise}

\begin{exercise}
$\N : \cat{1} \mto \cat{Set}$ maps the only object of $\cat{1}$ to the set $\N$.
$\mathtt{repeat}$ is the natural transformation from $\N$ to $\N \cocomp \List$ (i.e.~$\List(\N)$) mapping the sole object of $\cat{1}$ to the function mapping $n$ to the length-$n$ list $[n, \dots, n]$.
$\mathtt{sum}$ is the natural transformation from $\N \cocomp \List$ to $\N$ mapping the sole object of $\cat{1}$ to the function mapping a list of numbers and returns its sum.

The string diagram to the right denotes a natural transformation from the functor $\N : \cat{1} \mto \cat{Set}$ to itself ($\N$ maps the only object of $\cat{1}$ to the set $\N$).
In particular, this means it describes a function from $\N$ to $\N$.
Determine what that function is in terms of basic arithmetic.
(No proof necessary; the purpose of this is to learn the notation.)
\end{exercise}

\end{document}