re **Puzzle 165** about adjoints for the forgetful functor \$$U : \textbf{Grp} \rightarrow \textbf{Mon}\$$:

I think people are on the right track in trying to construct a left adjoint as the free group on a monoid \$$M\$$ but the construction is trickier and involves words/quotients.

Specifically, we take words (ie finite sequences) comprising elements of \$$M\$$ and their formal inverses (ie tokens of the form \$$x^{-1}\$$ where \$$x \in M\$$).

We "reduce" these words as far as possible using these following rules:

• multiply together any adjacent "plain" elements – so \$$[x, y]\$$ becomes \$$[xy]\$$
• multiply together any adjacent "inverse" elements – so \$$[y^{-1}, x^{-1}]\$$ becomes \$$[(xy)^{-1}]\$$
• remove any adjacent pairs of elements and their inverses – so \$$[x, x^{-1}]\$$ becomes \$$[\ ]\$$
• remove any adjacent pairs of inverses and plain elements – so \$$[y^{-1}, y]\$$ becomes \$$[\ ]\$$
• remove any units or inverses of units – so \$$[1]\$$ becomes \$$[\ ]\$$, as does \$$[1^{-1}]\$$

To multiply two reduced words we concatenate them and reduce. The empty word is the identity, and every word has an inverse (reverse the order of terms and invert each one, so \$$[x, y^{-1}, z]^{-1} = [z^{-1}, y, x^{-1}]\$$).

So we have a group, which we'll call \$$FM\$$. We can check any monoid homomorphism from \$$M\$$ into the underlying monoid of a group \$$G\$$ can be uniquely extended to a group homomorphism \$$FM \rightarrow G\$$, and any such group homomorphism restricts to a monoid homomorphism \$$M \rightarrow UG\$$. So \$$F\$$ is left adjoint to \$$U\$$.

The right adjoint is simpler to construct – it just sends every monoid \$$M\$$ to its submonoid \$$RM\$$ of invertible elements (considered as a group). Then group homomorphisms \$$G \rightarrow RM\$$ correspond naturally to monoid homomorphisms \$$UG \rightarrow M\$$.