\documentclass{article}
\input{packages}
\input{def}

\lecture{Nulls}

\begin{document}
\maketitle

\begin{definition}[(Biased) Semigroup]
A tuple $\langle S, *, \prf{a} \rangle$ where the components have the following types:
\begin{description}
\item[Underlying Set $S$:] $\Type$
\item[Operator $*$:] $S \times S \to S$ (infix)
\item[Associativity $\prf{a}$:] $\forall s_1, s_2, s_3 : S.\; (s_1 * s_2) * s_3 = s_1 * (s_2 * s_3)$
\end{description}
\end{definition}

\begin{example}
\begin{description}
\setlength{\itemsep}{0pt}
\item[$\N_{\min} =$] $\langle \N, \min, \noprf \rangle$
\item[$(\List_+ T)_{\append} =$] $\langle \List_+ T, \append, \cdot \rangle$ where $\List_+ T$ denotes nonempty (finite) lists of~$T$
\item[$(\Multiset_+ T)_+ =$] $\langle \Multiset_+ T, +, \cdot \rangle$ where $\Multiset_+ T$ denotes nonempty multisets of~$T$
\item[$(\Finset_+ T)_\cup =$] $\langle \Finset_+ T, \cup, \cdot \rangle$ where $\Finset_+ T$ denotes nonempty finite subsets of~$T$
\item[$(\Finset_+ T)_\cap =$] $\langle \Finset_+ T, \cap, \cdot \rangle$
\item[$(\Set_+ T)_\cup =$] $\langle \Set_+ T, \cup, \cdot \rangle$ where $\Set_+ T$ denotes nonempty subsets of~$T$
\item[$(\Set_+ T)_\cap =$] $\langle \Set_+ T, \cap, \cdot \rangle$
\end{description}
\end{example}

\begin{definition}[(Biased) Semigroup Homomorphism from $\langle S, *, \noprf \rangle$ to $\langle T, +, \noprf \rangle$]
A tuple $\langle f, \prf{d} \rangle$ where the components have the following types:
\begin{framed}
\begin{description}
\item[Underlying Function $f$:] $S \to T$
\item[Distributivity $\prf{d}$:] $\forall s_1, s_2 : S.\; f(s_1) + f(s_2) = f(s_1 * s_2)$
\end{description}
\end{framed}
\end{definition}

\begin{example}
$\langle \lambda n.\; n + 1, \noprf \rangle$ from $\N_{\min}$ to $\N_{\min}$ (and from $\N_{\max}$ to $\N_{\max}$).
\end{example}

\begin{exercise}
Prove that $\cat{Mon}$ is a non-full subcategory of $\cat{Sgr}$, the category of semigroups and semigroup homomorphisms (with the obvious composition and identity), via the obvious inclusion functor.
\end{exercise}

\begin{definition}[(Biased) Group]
A tuple $\langle G, *, \prf{a}, e, \prf{i}, ~^\inv, \prf{inv} \rangle$ where the components have the following types:
\begin{framed}
\begin{description}
\item[Underlying Set $G$:] $\Type$
\item[Operator $*$:] $G \times G \to G$ (infix)
\item[Associativity $\prf{a}$:] $\forall g_1, g_2, g_3 : G.\; (g_1 * g_2) * g_3 = g_1 * (g_2 * g_3)$
\item[Identity Element $e$:] $G$
\item[Identity $\prf{i}$:] $\forall g : G.\; e * g = g = g * e$
\item[Inverse Operator $^\inv$:] $G \to G$ (postfix)
\item[Inverse $\prf{inv}$:] $\forall g : G.\; g * g^\inv = e = g^\inv * g$
\end{description}
\end{framed}
\end{definition}

\begin{definition}[(Biased) Group Homomorphism from $\langle G, *, \noprf, e, \noprf, ~^\inv, \noprf \rangle$ to $\langle H, +, \noprf, i, \noprf, {-}, \noprf \rangle$]
A tuple $\langle f, \prf{d}, \prf{i}, \prf{inv} \rangle$ where the components have the following types:
\begin{framed}
\begin{description}
\item[Underlying Function $f$:] $G \to H$
\item[Distributivity $\prf{d}$:] $\forall g_1, g_2 : G.\; f(g_1) + f(g_2) = f(g_1 * g_2)$
\item[Identity $\prf{i}$:] $i = f(e)$
\item[Inverse $\prf{inv}$:] $\forall g : G.\; {-f(g)} = f(g^\inv)$
\end{description}
\end{framed}
\end{definition}

\begin{exercise}
Prove that $\cat{Grp}$, the category of groups and group homomorphism (with the obvious composition and identity), is a full subcategory of~$\cat{Mon}$.
\end{exercise}

\begin{definition}[Reflection Arrow for $\cat{S} \xmono{I} \cat{C}$]
An object~$\ob{C}$ of~$\cat{C}$ and object~$\ob{R}$ of~$\cat{S}$ with a morphism~$\ob{C} \xmto{\mo{r}} I(\ob{R})$ of~$\cat{C}$ such that for every object~$\ob{S}$ of~$\cat{S}$ with a morphism~$\ob{C} \xmto{\mo{m}} I(\ob{S})$ of~$\cat{C}$ there exists a unique morphism~$\ob{R} \xmto{\mo{m}^\rtol} \ob{S}$ of~$\cat{S}$ with $\mo{r} \cocomp I(\mo{m}^\rtol) = \mo{m}$.
\end{definition}

\begin{exercise}
Prove that, for $\cat{Grp} \mono \cat{Mon}$, the identity on a monoid is a reflection arrow if and only if that monoid is a group.
\end{exercise}

\begin{exercise}
Prove that, for $\cat{Mon} \mono \cat{Sgr}$, the identity on a semigroup is never a reflection arrow even if that semigroup is a monoid.
\end{exercise}

\begin{definition}[Reflective Subcategory]
A subcategory~$\cat{S} \xmono{I} \cat{C}$ with a reflection arrow~$\ob{C} \xmto{\mo{r}_\ob{C}} I(\ob{R}_\ob{C})$ for every object~$\ob{C}$ of~$\cat{C}$.
\end{definition}

\begin{exercise}
Prove that $\cat{Grp}$ is a reflective subcategory of~$\cat{Mon}$, and that $\cat{Mon}$ is a reflective subcategory of~$\cat{Sgr}$.
\end{exercise}

\begin{exercise}
Prove that every reflective subcategory~$\cat{S} \xmono{I} \cat{C}$ has a unique way to extend a function~$R(\ob{C}) = \ob{R}_\ob{C}$ to a functor so that the following diagram commutes for every morphism~$\ob{C}_1 \xmto{\mo{m}} \ob{C}_2$ of~$\cat{C}$ (meaning all paths are equal):
\begin{center}
\begin{tikzpicture}[scale=.75]
\node(c1) at (-1,1) {$\ob{C}_1$};
\node(r1) at (1,1) {$I(R(\ob{C}_1))$};
\node(c2) at (-1,-1) {$\ob{C}_2$};
\node(r2) at (1,-1) {$I(R(\ob{C}_2))$};
\draw[->] (c1) -- node[above] {$\mo{r}_{\ob{C}_1}$} (r1);
\draw[->] (c2) -- node[below] {$\mo{r}_{\ob{C}_2}$} (r2);
\draw[->] (c1) -- node[left] {$\mo{m}$} (c2);
\draw[->] (r1) -- node[right] {$I(R(\mo{m}))$} (r2);
\end{tikzpicture}
\end{center}
\begin{comment}
$$\begindc{\commdiag}[250]
\obj(-1,1)[c1]{$\ob{C}_1$}
\obj(1,1)[r1]{$I(R(\ob{C}_1))$}
\obj(-1,-1)[c2]{$\ob{C}_2$}
\obj(1,-1)[r2]{$I(R(\ob{C}_2))$}
\mor{c1}{r1}{$\mo{r}_{\ob{C}_1}$}
\mor{c2}{r2}{$\mo{r}_{\ob{C}_2}$}[\atright,\solidarrow]
\mor{c1}{c2}{$\mo{m}$}[\atright,\solidarrow]
\mor{r1}{r2}{$I(R(\mo{m}))$}
\enddc$$
\end{comment}
\end{exercise}

\begin{exercise}
Prove that, for a reflective subcategory~$\cat{S} \xmono{I} \cat{C}$, the subcategory $\langle \cat{S}, I \rangle$ is full if and only if for every object~$\ob{S}$ of~$\cat{S}$ the identity on~$I(\ob{S})$ is a reflection arrow.
\end{exercise}

\end{document}
