\documentclass{article}
\input{packages}
\input{def}

\lecture{Homomorphisms}

\begin{document}
\maketitle

\begin{definition}[(Biased) Monoid Homomorphism from $\langle M, *, \noprf, e, \noprf \rangle$ to $\langle N, +, \noprf, i, \noprf \rangle$]
A tuple $\langle f, \prf{d}, \prf{i} \rangle$ where the components have the following types:
\begin{framed}
\begin{description}
\item[Underlying Function $f$:] $M \to N$
\item[Distributivity $\prf{d}$:] $\forall m_1, m_2 : M.\; f(m_1) + f(m_2) = f(m_1 * m_2)$
\item[Identity $\prf{i}$:] $i = f(e)$
\end{description}
\end{framed}
\end{definition}

\begin{example}
\begin{description}
\setlength{\itemsep}{0pt}
\item[$\langle \lambda \vec{t}.~\vec{t}\mathrm{~as~}\Multiset T, \noprf, \noprf \rangle$] from $(\List T)_{\append}$ to $(\Multiset T)_+$
\item[$\langle \det, \noprf, \noprf \rangle$] from $\R^{n \times n}_\cdot$ to $\R_*$ where $\R^{n \times n}_\cdot$ is matrices with matrix multiplication and $\det$ is the determinant
\item[$\langle \lambda m.~\lambda \vec{x}.~M \cdot \vec{x}, \noprf, \noprf \rangle$] from $\R^{n \times n}_\cdot$ to $(\R^n \to \R^n)_\circ$
\end{description}
\end{example}

\begin{notation}
We will say a function~$f : M \to N$ is a biased monoid homomorphism from $\langle M, *, \noprf, e, \noprf \rangle$ to $\langle N, +, \noprf, i, \noprf \rangle$ if there exist proofs $\prf{d}$ and~$\prf{i}$ such that $\langle f, \prf{d}, \prf{i} \rangle$ is a biased monoid homomorphism from $\langle M, *, \noprf, e, \noprf \rangle$ to $\langle N, +, \noprf, i, \noprf \rangle$.
\end{notation}

\begin{definition}[(Unbiased) Monoid Homomorphism from $\langle M, \Pi, \noprf, \noprf \rangle$ to $\langle N, \Sigma, \noprf, \noprf \rangle$]
A tuple $\langle f, \prf{d} \rangle$ where the components have the following types:
\begin{framed}
\begin{description}
\item[Underlying Function $f$:] $M \to N$
\item[Distributivity $\prf{d}$:] $\forall n : \N,\; m_1, \dots, m_n : M.\; \Sigma \left[f(m_1), \dots, f(m_n)\right] = f\left(\Pi \left[m_1, \dots, m_n\right]\right)$
\end{description}
\end{framed}
\end{definition}

\begin{example}
\begin{description}
\setlength{\itemsep}{0pt}
\item[$\langle -, \noprf \rangle$] from $\Z_\Sigma$ to $\Z_\Sigma$
\item[$\langle -, \noprf \rangle$] from $\R_\Sigma$ to $\R_\Sigma$
\item[$\langle -, \noprf \rangle$] from $\N_\Sigma$ to $\Z_\Sigma$
\item[$\langle -, \noprf \rangle$] from $\Z^{+\infty}_{\min}$ to $\Z^{-\infty}_{\max}$
\item[$\langle -, \noprf \rangle$] from $\Z^{-\infty}_{\max}$ to $\Z^{+\infty}_{\min}$
\item[$\langle \left\vert~\right\vert, \noprf \rangle$] from $\Z_\Pi$ to $\N_\Pi$
\item[$\langle \lambda n.~n\mathrm{~as~}\Z, \noprf \rangle$] from $\N_\Sigma$ to $\Z_\Sigma$
\item[$\langle \lambda i.~i\mathrm{~as~}\R, \noprf \rangle$] from $\Z_\Pi$ to $\R_\Pi$
\end{description}
\end{example}

\begin{notation}
We will say a function $f : M \to N$ is an unbiased monoid homomorphism from $\langle M, \Pi, \noprf, \noprf \rangle$ to $\langle N, \Sigma, \noprf, \noprf \rangle$ if there exists some proof~$\prf{d}$ such that $\langle f, \prf{d} \rangle$ is an unbiased monoid homomorphism from $\langle M, \Pi, \noprf, \noprf \rangle$ to $\langle N, \Sigma, \noprf, \noprf \rangle$.
\end{notation}

\begin{exercise}
Suppose that $\alg{M}_U$ and~$\alg{M}_B$ are an unbiased monoid and a biased monoid with the same underlying set~$M$ and with $\mathit{Bias}(\alg{M}_U) = \alg{M}_B$ and $\mathit{Unbias}(\alg{M}_B) = \alg{M}_U$, and suppose that $\alg{N}_U$ and~$\alg{N}_B$ are an unbiased monoid and a biased monoid with the same underlying set~$N$ and with $\mathit{Bias}(\alg{N}_U) = \alg{N}_B$ and $\mathit{Unbias}(\alg{N}_B) = \alg{N}_U$.
Prove for any function~$f : M \to N$, that $f$~is an unbiased monoid homomorphism from~$\alg{M}_U$ to~$\alg{N}_U$ if and only if $f$~is a biased monoid homomorphism from~$\alg{M}_B$ to~$\alg{N}_B$.
\end{exercise}

\end{document}