<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass{article}
\input{packages}
\input{def}

\lecture{Monads}

\begin{document}
\maketitle

\begin{definition}[Monad for a 2-Category $\cat{C}$]
A tuple $\langle \ob{C}, \mo{m}, \mu, \prf{a}, \eta, \prf{i} \rangle$ whose components have the following types:
\begin{framed}
\begin{description}
\item[Object $\ob{C}$] is an object of $\cat{C}$
\item[Morphism $\mo{m}$] is a morphism of $\cat{C}$ from $\ob{C}$ to $\ob{C}$
\item[Join $\mu$] is a 2-cell of $\cat{C}$ from $\mo{m} \cocomp \mo{m} \nto \mo{m}$
\item[Associativity $\prf{a}$] is a proof that
\begin{tikzpicture}[baseline=0]
\node(c1) at (0,1) {$\ob{C}$};
\node(c2) at (1,-1) {$\ob{C}$};
\node(c3) at (3,-1) {$\ob{C}$};
\node(c4) at (4,1) {$\ob{C}$};
\draw[-&gt;] (c1) -- node[below left]{$\mo{m}$} (c2);
\draw[-&gt;] (c2) -- node[below]{$\mo{m}$} (c3);
\draw[-&gt;] (c3) -- node[below right]{$\mo{m}$} (c4);
\draw[-&gt;] (c1) -- node(f12){} node[above]{$\mo{m}$} (c3);
\draw[-&gt;] (c1) -- node(f123){} node[above]{$\mo{m}$} (c4);
\draw[double,double equal sign distance,-implies] (c2) -- node[below right]{$\mu$} (f12);
\draw[double,double equal sign distance,-implies] (c3) -- node[above right]{$\mu$} (f123);
\end{tikzpicture}
equals
\begin{tikzpicture}[baseline=0]
\node(c1) at (0,1) {$\ob{C}$};
\node(c2) at (1,-1) {$\ob{C}$};
\node(c3) at (3,-1) {$\ob{C}$};
\node(c4) at (4,1) {$\ob{C}$};
\draw[-&gt;] (c1) -- node[below left]{$\mo{m}$} (c2);
\draw[-&gt;] (c2) -- node[below]{$\mo{m}$} (c3);
\draw[-&gt;] (c3) -- node[below right]{$\mo{m}$} (c4);
\draw[-&gt;] (c2) -- node(f23){} node[above]{$\mo{m}$} (c4);
\draw[-&gt;] (c1) -- node(f123){} node[above]{$\mo{m}$} (c4);
\draw[double,double equal sign distance,-implies] (c3) -- node[below left]{$\mu$} (f23);
\draw[double,double equal sign distance,-implies] (c2) -- node[above left]{$\mu$} (f123);
\end{tikzpicture}
.\\
In other words,
\begin{tikzpicture}[baseline=1.5cm]
\node(f1) at (0,0) {$\mo{m}$};
\node(f2) at (2,0) {$\mo{m}$};
\node(f3) at (4,0) {$\mo{m}$};
\node(n1)[circle,draw] at (1,1) {$\mu$};
\node(n2)[circle,draw] at (2,2) {$\mu$};
\node(f123) at (2,3) {$\mo{m}$};
\draw[-&gt;] (f1) -- (n1);
\draw[-&gt;] (f2) -- (n1);
\draw[-&gt;] (f3) -- (n2);
\draw[-&gt;] (n1) -- node(f12)[above left]{$\mo{m}$} (n2);
\draw[-&gt;] (n2) -- (f123);
\node at (.5,2.5) {$\ob{C}$};
\node at (1,.25) {$\ob{C}$};
\node at (2.25,.75) {$\ob{C}$};
\node at (3.5,2) {$\ob{C}$};
\end{tikzpicture}
equals
\begin{tikzpicture}[baseline=1.5cm]
\node(f1) at (0,0) {$\mo{m}$};
\node(f2) at (2,0) {$\mo{m}$};
\node(f3) at (4,0) {$\mo{m}$};
\node(n1)[circle,draw] at (3,1) {$\mu$};
\node(n2)[circle,draw] at (2,2) {$\mu$};
\node(f123) at (2,3) {$\mo{m}$};
\draw[-&gt;] (f1) -- (n2);
\draw[-&gt;] (f2) -- (n1);
\draw[-&gt;] (f3) -- (n1);
\draw[-&gt;] (n1) -- node(f12)[above right]{$\mo{m}$} (n2);
\draw[-&gt;] (n2) -- (f123);
\node at (3.5,2.5) {$\ob{C}$};
\node at (3,.25) {$\ob{C}$};
\node at (1.75,.75) {$\ob{C}$};
\node at (.5,2) {$\ob{C}$};
\end{tikzpicture}
.
\item[Unit $\eta$] is a 2-cell of $\cat{C}$ from $\ob{C}$ to $\mo{m}$
\item[Identity $\prf{i}$] is a proof that
\begin{tikzpicture}[baseline=(c1.base)]
\node(c1) at (0,0) {$\ob{C}$};
\node(c2) at (4,0) {$\ob{C}$};
\draw[-&gt;] (c1) .. controls (1.5,-1.5) and (2.5,-1.5) .. node(f1){} node[below]{$\mo{m}$} (c2);
\draw[-&gt;] (c2) .. controls (1.75,-1.5) and (1.75,1.5) .. node(f2){} node[left]{$\mo{m}$} (c2);
\draw[-&gt;] (c1) .. controls (1.5,1.5) and (2.5,1.5) .. node(f12){} node[above]{$\mo{m}$} (c2);
\draw[double,double equal sign distance,-implies] (c2) -- node[above]{$\eta$} (f2);
\draw[double,double equal sign distance,-implies] ($(f1.west) !.5! (c2.south)$) .. controls +(-1.5,-.5) and ($(f12.south west) + (-.5,-1)$) .. node[left]{$\mu$} (f12.south west);
\end{tikzpicture}
and
\begin{tikzpicture}[baseline=(c1.base)]
\node(c1) at (0,0) {$\ob{C}$};
\node(c2) at (4,0) {$\ob{C}$};
\draw[-&gt;] (c1) .. controls (2.25,1.5) and (2.25,-1.5) .. node(f1){} node[right]{$\mo{m}$} (c1);
\draw[-&gt;] (c1) .. controls (1.5,-1.5) and (2.5,-1.5) .. node(f2){} node[below]{$\mo{m}$} (c2);
\draw[-&gt;] (c1) .. controls (1.5,1.5) and (2.5,1.5) .. node(f12){} node[above]{$\mo{m}$} (c2);
\draw[double,double equal sign distance,-implies] (c1) -- node[above]{$\eta$} (f1);
\draw[double,double equal sign distance,-implies] ($(f2.east) !.5! (c1.south)$) .. controls +(1.5,-.5) and ($(f12.south east) + (.5,-1)$) .. node[right]{$\mu$} (f12.south east);
\end{tikzpicture}
equal
\begin{tikzpicture}[baseline=(c1.base)]
\node(c1) at (0,0) {$\ob{C}$};
\node(c2) at (1.5,0) {$\ob{C}$};
\draw[-&gt;] (c1) to[bend right=30] node[below]{$\mo{m}$} node(f1){} (c2);
\draw[-&gt;] (c1) to[bend left=30] node[above]{$\mo{m}$} node(f2){} (c2);
\draw[double,double equal sign distance] (f1) -- (f2);
\end{tikzpicture}
.\\
In other words,
\begin{tikzpicture}[baseline=1.5cm]
\node(f1) at (0,0) {$\mo{m}$};
\node(n1)[circle,draw] at (1,1) {$\eta$};
\node(n2)[circle,draw] at (0,2) {$\mu$};
\node(f12) at (0,3) {$\mo{m}$};
\draw[-&gt;] (f1) -- ++(0,.5) .. controls +(0,.5) and ($(n2.south west) + (-.5,-.5)$) .. (n2.south west);
\draw[-&gt;] (n1) -- node[above right]{$\mo{m}$} (n2);
\draw[-&gt;] (n2) -- (f12);
\node at (-1,1) {$\ob{C}$};
\node at (1.5,2.25) {$\ob{C}$};
\end{tikzpicture}
and
\begin{tikzpicture}[baseline=1.5cm]
\node(f1) at (0,0) {$\mo{m}$};
\node(n1)[circle,draw] at (-1,1) {$\eta$};
\node(n2)[circle,draw] at (0,2) {$\mu$};
\node(f12) at (0,3) {$\mo{m}$};
\draw[-&gt;] (f1) -- ++(0,.5) .. controls +(0,.5) and ($(n2.south east) + (.5,-.5)$) .. (n2.south east);
\draw[-&gt;] (n1) -- node[above left]{$\mo{m}$} (n2);
\draw[-&gt;] (n2) -- (f12);
\node at (1,1) {$\ob{C}$};
\node at (-1.5,2.25) {$\ob{C}$};
\end{tikzpicture}
equal
\begin{tikzpicture}[baseline=1.5cm]
\node(f1) at (0,0) {$\mo{m}$};
\node(f2) at (0,3) {$\mo{m}$};
\draw[-&gt;] (f1) -- (f2);
\node at (-.5,1.5) {$\ob{C}$};
\node at (.5,1.5) {$\ob{C}$};
\end{tikzpicture}
.
\end{description}
\end{framed}
\end{definition}

\begin{remark}
Given a 2-category, one can construct a multicategory whose objects are the 1-cells of the multicategory and whose morphisms are 2-cells from the composition of the inputs to the output.
A monad is an internal monoid of that multicategory.
\end{remark}

\begin{theorem}
For any monad $\langle \ob{C}, \mo{m}, \mu, \noprf, \eta, \noprf \rangle$ and $n : \N$, all 2-cells from $\mo{m}^n$ to $\mo{m}$ built from $\mu$, $\eta$, and identities are equal.
\end{theorem}

\begin{example}
$\langle \cat{Set}, \List, \mathtt{flatten}, \noprf, [\bullet], \noprf \rangle$ is a monad in $\cat{CAT}$.
Similar monads on $\cat{Set}$ exist for $\Multiset$, $\Finset$, and $\Set$.
\end{example}

\begin{definition}[Monad Morphism from $\langle \ob{C}_1, \mo{m}_1, \mu_1, \noprf, \eta_1, \noprf \rangle$ to $\langle \ob{C}_2, \mo{m}_2, \mu_2, \noprf, \eta_2, \noprf \rangle$]
A morphism $\mo{f} : \ob{C}_1 \mto \ob{C}_2$ and a 2-cell $\alpha : \mo{m}_1 \cocomp \mo{f} \nto \mo{f} \cocomp \mo{m}_2$ such that:
\begin{center}
\begin{tikzpicture}[baseline=(f.base)]
\node(c11) at (-1,0) {$\ob{C}_1$};
\node(c12) at (0,-1) {$\ob{C}_1$};
\node(c13) at (1,0) {$\ob{C}_1$};
\node(c21) at (-1,2) {$\ob{C}_2$};
\node(c23) at (1,2) {$\ob{C}_2$};
\draw[-&gt;] (c11) -- node(m11){} node[below left]{$\mo{m}_1$} (c12);
\draw[-&gt;] (c12) -- node(m12){} node[below right]{$\mo{m}_1$} (c13);
\draw[-&gt;] (c11) -- node(f)[left]{$\mo{f}$} (c21);
\draw[-&gt;] (c13) -- node[right]{$\mo{f}$} (c23);
\draw[-&gt;] (c21) to[bend left=45] node(m2){} node[above]{$\mo{m}_2$} (c23);
\draw[-&gt;] (c11) to[bend left=45] node(m1){} node[above](m1n){$\mo{m}_1$} (c13);
\draw[double,double equal sign distance,-implies] (c12) -- node[right]{$\mu_1$} (m1);
\draw[double,double equal sign distance,-implies] (m1n) -- node[right]{$\alpha$} (m2);
\end{tikzpicture}
equals
\begin{tikzpicture}[baseline=(f.base)]
\node(c11) at (-1,0) {$\ob{C}_1$};
\node(c12) at (0,-1) {$\ob{C}_1$};
\node(c13) at (1,0) {$\ob{C}_1$};
\node(c21) at (-1,2) {$\ob{C}_2$};
\node(c22) at (0,1) {$\ob{C}_2$};
\node(c23) at (1,2) {$\ob{C}_2$};
\draw[-&gt;] (c11) -- node(m11){} node[below left]{$\mo{m}_1$} (c12);
\draw[-&gt;] (c12) -- node(m12){} node[below right]{$\mo{m}_1$} (c13);
\draw[-&gt;] (c11) -- node(f)[left]{$\mo{f}$} (c21);
\draw[-&gt;] (c13) -- node[right]{$\mo{f}$} (c23);
\draw[-&gt;] (c21) to[bend left=45] node(m2){} node[above]{$\mo{m}_2$} (c23);
\draw[-&gt;] (c12) -- node[right]{$\mo{f}$} (c22);
\draw[-&gt;] (c21) -- node(m21){} node[above]{$\mo{m}_2$} (c22);
\draw[-&gt;] (c22) -- node(m22){} node[above]{$\mo{m}_2$} (c23);
\draw[double,double equal sign distance,-implies] (c22) -- node[right,near end]{$\mu_2$} (m2);
\draw[double,double equal sign distance,-implies] (m11) -- node[right]{$\alpha$} (m21);
\draw[double,double equal sign distance,-implies] (m12) -- node[right]{$\alpha$} (m22);
\end{tikzpicture}
, and
\begin{tikzpicture}[baseline=(f.base)]
\node(c11) at (-1,0) {$\ob{C}_1$};
\node(c13) at (1,0) {$\ob{C}_1$};
\node(c21) at (-1,2) {$\ob{C}_2$};
\node(c23) at (1,2) {$\ob{C}_2$};
\draw (c11) to[bend right=45] node(i1){} (c13);
\draw[-&gt;] (c11) -- node(f)[left]{$\mo{f}$} (c21);
\draw[-&gt;] (c13) -- node[right]{$\mo{f}$} (c23);
\draw[-&gt;] (c21) to[bend left=45] node(m2){} node[above]{$\mo{m}_2$} (c23);
\draw[-&gt;] (c11) to[bend left=45] node(m1){} node[above](m1n){$\mo{m}_1$} (c13);
\draw[double,double equal sign distance,-implies] (i1) -- node[right]{$\eta_1$} (m1);
\draw[double,double equal sign distance,-implies] (m1n) -- node[right]{$\alpha$} (m2);
\end{tikzpicture}
equals
\begin{tikzpicture}[baseline=(f.base)]
\node(c11) at (-1,0) {$\ob{C}_1$};
\node(c13) at (1,0) {$\ob{C}_1$};
\node(c21) at (-1,2) {$\ob{C}_2$};
\node(c23) at (1,2) {$\ob{C}_2$};
\draw (c11) to[bend right=45] node(i1){} (c13);
\draw[-&gt;] (c11) -- node(f)[left]{$\mo{f}$} (c21);
\draw[-&gt;] (c13) -- node[right]{$\mo{f}$} (c23);
\draw[-&gt;] (c21) to[bend left=45] node(m2){} node[above]{$\mo{m}_2$} (c23);
\draw (c21) to[bend right=45] node(i2){} (c23);
\draw[double,double equal sign distance,-implies] (i2) -- node[right]{$\eta_2$} (m2);
\draw[double,double equal sign distance] (i1) -- (i2);
\end{tikzpicture}
.
\end{center}
\end{definition}

\begin{remark}
Note that, if $\mo{f}$ above is required to be an identity morphism, then the above definition corresponds to a morpishm of an internal monoids of a multicategory.
The generality above comes from viewing monads as internal monoids of an opetory.
\end{remark}

\begin{example}
The obvious natural transformations from $\List$ to $\Multiset$ to $\Finset$ to $\Set$ are all monad morphisms where $\mo{f}$ is the identity functor of $\cat{Set}$.
\end{example}

\end{document}</pre></body></html>