# Elegant approach to coproducts of monoids and magmas - does everything work without units?

From this answer by Martin Brandenburg I learned an elegant way of constructing and describing elements of coproducts of monoids. There he writes this construction shows the existence of colimits in every finitary algebraic category. I'm trying to understand the significance of having units, and it seems to me units are actually used in the very final step of the verification that the elements of coproducts are indeed "reduced words".

I'll repeat (hopefully correctly) the construction the coproduct of associative magmas $$A,B$$. The underlying set will be the set of finite nonempty sequences of elements of $$A\amalg B$$ (the empty sequences would be a unit) and the operation will be concatenation. The only relations we need to quotient by is $$(a_1a_2)\sim (a_1,a_2)$$. One can verify this satisfies the universal property of the coproduct.

The next step is to prove the coproduct is isomorphic to the submonoid of reduced words alone. For starters, the submonoid of $$A\amalg B$$ given by the set of elements of $$U(A\amalg B)$$ which are products of images of either coproduct injection is isomorphic to $$A\amalg B$$ because it satisfies the same universal property. Since the coproduct injections are homomorphisms the canonical arrow taking reduced words inside of $$U(A\amalg B)$$ is surjective, i.e every sequence in $$U(A\amalg B)$$ has a reduction. To show injectivity we'll prove the reduction is unique.

For this we define an action of $$A\amalg B$$ on $$X$$ which imitates concatenation by first formally concatenating and then reducing in $$X$$. Since an action is just a homomorphism $$A\amalg B\to \mathsf{End}(X)$$ we use the universal property of the coproduct to define it's "parts". To define the action of $$A$$ on $$X$$, let $$a\in UA$$ and $$\mathbf w\in UX$$ and define $$a\mathbf w$$ to be the concatentation of $$a$$ with $$\bf w$$ if $$\mathbf w$$ starts with an element of $$UA$$, and replace the first coordinate of $$\bf w$$ with its product with $$a$$ on left if it starts with an element of $$UA$$. Similarly for $$UB$$.

Now the final step: if the magmas are unital then the coproduct needs the empty sequence $$()$$ to serve as a unit. Then we have evaluation at the empty sequence $$\mathsf{End}\to X$$, which makes the composite $$X\to A\amalg B\to \mathsf{End}X\to X$$ equal to the identity. This proves the left arrow is injective as desired.

But what if the magmas aren't unital? Can this approach to describing reduced words be saved? Does absence of units even present a problem? I think everything should still be true...

(I understand that if the magmas are unital we need to force additional relations on the set of sequences.)

• "Associative magmas" are more typically called semigroups. I was confused for a bit because I lost that you were talking about associative magmas and I was like "what even is a magma action?" Nov 3 '16 at 0:36
• To partially answer one of your questions, without the unit there is no obvious choice for the semigroup homomorphism $\mathsf{End}X \to X$. In fact, since $\emptyset$ forms a semigroup, such a function need not even exist. Nov 3 '16 at 4:17

Every semigroup gives rise to a monoid via a free-forgetful adjunction. Let's write it $(-)_+ \dashv \overline{(-)}$. It does the obvious thing of just formally adding a unit. Since left adjoints preserve colimits, we have $(A \amalg B)_+ \cong A_+ \amalg B_+$. We can then use the argument for monoids to establish that $\varphi_+ : X_+ \cong (A \amalg B)_+$. The desired result would now follow if $(-)_+$ reflected isomorphisms.
There's probably some abstract nonsense proof of this, but this is pretty easy to prove concretely. Sketching a slightly more abstract argument, say $\psi : C \to D$ and we've established that $\psi_+ : C_+ \cong D_+$. Then $\overline{\psi_+^{-1}} \circ \eta_D : D \to \overline{C_+}$ where $\eta$ is the unit of the adjunction. Now we'd need to show that $\mathsf{Im}(\overline{\psi_+^{-1}}\circ\eta_D) \cong C$, i.e. that $D \stackrel{e}{\to} C \stackrel{\eta_C}{\to} \overline{C_+}$ is an epi-mono factorization of $\overline{\psi_+^{-1}}\circ\eta_D$ which we know exists since the category is regular. (It's very easy to show that $\eta$ is a mono.) We have the naturality squares:
$\require{AMScd}$ $$\begin{CD} C @>\psi>>D @>e>> C \\ @V\eta_CVV @V\eta_DVV @VV\eta_CV \\ \overline{C_+} @>>\overline{\psi_+}> \overline{D_+} @>>\overline{\psi_+^{-1}}> \overline{C_+} \end{CD}$$
We then establish $e \circ \psi = \mathsf{id}$ by using that $\eta$ is a mono and the equation from the above diagram $\eta_C \circ e \circ \psi = \eta_C$. Pasting the squares the other way around gives you the other direction.
As mentioned, the hole in the above proof is the proof that $\overline{\psi_+^{-1}}\circ\eta_D$ factors through $\eta_C$. In fact, we only need this and not the stronger statement from above that this is the image factorization — any factorization through $\eta_C$ would do. (Of course, it will turn out to be the image factorization.)