2
$\begingroup$

The question is a duplicate of this question Monad as a monoid: intuition but I don't understand that answer.

Let $T: \mathcal{C} \to \mathcal{C}$ be a monad with multiplication $\mu: T^2 \to T$ and identity $\eta: id_{\mathcal{C}} \to T$.

If I understand correctly, the 'elements' of the monad $T$ are natural transformations $x: X \to T$ for $X$ any functor $\mathcal{C} \to \mathcal{C}$. The answer talks about $xy$ for $x: X \to T$ and $y: Y \to T$, what does this mean? I think the idea is for it to be a natural transformation $? \to T^2$ and then we can see the multiplication of $x$ by $y$ as $\mu \circ xy$ to get a natural transformation $? \to T$.

I also don't see what the point of introducing $T\mu$ and $\mu T$ into this is. The identity

$$\mu \circ(\mu \circ xy)z = \mu \circ x(\mu \circ yz)$$ for any three natural transformations with codomain $T$ makes more sense to me if I have interpreted everything correctly.

Edit: ok, forgot that $x, y, z$ are natural transformations between endofunctors, so I suppose that $xy$ is simply the composition $x \circ y: XY \to T^2$, but the other questions remain.

$\endgroup$
  • 3
    $\begingroup$ A monad is just a monoid in a category of endofunctors. $\endgroup$ – Lord Shark the Unknown Oct 28 at 18:43
  • $\begingroup$ You have to think of $T\mu$ and $\mu T$ as analogous to $id_M\times m, m\times id_M$ for a monoid $M$ with $m:M\times M\to M$. In fact, more generally, in a monoidal category $(A,\otimes, I)$, you have a notion of monoid object, and in there this is all analogous to $id_M\otimes m, m\otimes id_M$, and in fact it's more than an analogy : it's a special case with $A=C^C, \otimes = \circ, I = id_C$ $\endgroup$ – Max Oct 28 at 19:12
3
$\begingroup$

What you've written, $\mu \circ (\mu \circ xy)z = \mu \circ x(\mu \circ yz)$, is the same as $\mu \circ \mu T \circ xyz = \mu \circ T\mu \circ xyz$, so there's no problem with either one.

$xy$ is the horizontal composition of natural transformations, so I'll write it as $x * y$ from here on to draw attention to it. Given functors $P, R: \mathcal{D} \to \mathcal{E}$, functors $Q, S: \mathcal{C} \to \mathcal{D}$ and natural transformations $\alpha: P \to Q$ and $\beta: R \to S$, their horizontal composite is a natural transformation $\alpha * \beta: PQ \to RS$. Note that it's not the same as vertical composition, which I'll continue to notate with $\circ$. Given functors $P, Q, R: \mathcal{C} \to \mathcal{D}$ and natural transformations $\alpha: Q \to R$, $\beta: P \to Q$, the vertical composite is a natural transformation $\alpha \circ \beta: P \to R$.

Vertical and horizontal composition obey the interchange law, meaning they distribute over each other. Essentially, $(\alpha \circ \beta) * (\gamma \circ \delta) = (\alpha * \gamma) \circ (\beta * \delta)$ (try drawing a picture!).

When horizontally composing with the identity natural transformation (which isn't an identity for horizontal composition), we get, for each natural transformation $\alpha: P \to Q$, natural transformations $id_R * \alpha: RP \to RQ$ and $\alpha * id_R: PR \to QR$. These maps are traditionally denoted $R \alpha$ and $\alpha R$ (it lines up nicely with how these horizontal composites are actually defined). This is sometimes known as "whiskering" (again, try drawing a picture).

Returning to our problem, what you wrote is $\mu \circ ((\mu \circ (x * y)) * z) = \mu \circ (x * (\mu \circ (y * z)))$.

$$ \begin{align} \mu \circ ((\mu \circ (x * y)) * z) & = \mu \circ ((\mu \circ (x * y)) * (id_T \circ z)) & \text{(identity natural transformation)} \\ & = \mu \circ ((\mu * id_T) \circ ((x * y) * z)) & \text{(interchange law)} \\ & = \mu \circ ((\mu T) \circ ((xy)z)) & \text{(the notations from before)} \\ & = \mu \circ \mu T \circ xyz & \text{(associativity)} \\ \end{align} $$

Similarly,

$$ \begin{align} \mu \circ (x * (\mu \circ (y * z))) & = \mu \circ ((id_T \circ x) * (\mu \circ (y * z))) & \text{(identity natural transformation)} \\ & = \mu \circ (((id_T * \mu) \circ (x * (y * z))) & \text{(interchange law)} \\ & = \mu \circ (((T\mu) \circ (x(yz))) & \text{(the notations from before)} \\ & = \mu \circ T \mu \circ xyz & \text{(associativity)} \\ \end{align} $$

Arguably, from the generalized element perspective, what you have is more natural. Still, the other version is more traditional, so you're more likely to see it in practice. Even more common is the element-free version $\mu \circ (T \mu) = \mu \circ (\mu T)$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.