I am studying the definition of a monad from Saunders Mac Lane, Categories for the Working Mathematician, Springer Verlag, 1971. I have some difficulties getting an intuition about the relation to monoids explained on page 134. Here is the relevant content from page 133, 134, where I replaced the diagrams with text.

Since I am not able to draw the diagrams, I have replaced them with three equations, where $\circ$ is the composition of natural transformations and $id_T : T\dot\rightarrow T$ is the identity natural transformation. I am not sure if this notation is correct. If it is not, please let me know so I can correct it.

The text continues on page 134 as follows.

Formally, the definition of a monad is like that of a monoid $M$ in sets, as described in the introduction. The set $M$ of elements of the monoid is replaced by the endofunctor $T : X \rightarrow X$, while the cartesian product $\times$ of two sets is replaced by composite of two functors, the binary operation $\mu : M \times M \rightarrow M$ of multiplication by the transformation $\mu : T^2 \dot\rightarrow T$ and the unit (identity) element $\eta : 1 \rightarrow M$ by $\eta : I_X \dot\rightarrow T$. We shall thus call $\eta$ the unit and $\mu$ the multiplication of the monad $T$; the first commutative diagram of (2) is then the associative law for the monad, while the second and third diagram express the left and right unit laws, respectively. All told, a monad in $X$ is just a monoid in the category of endofunctors of $X$, with product $\times$ replaced by composition of endofunctors and unit set by the identity endofunctor.

So, here are my questions.

What does it mean to replace the set $M$ of elements of the monoid by the endofunctor $T$? What are the elements of the new monoid as defined by this functor $T$?

If $\mu : T^2 \rightarrow T$ is the multiplication in the new monoid, I would expect to write the associative law for $\mu$ as $$\forall x, y, z \in T : \mu(\mu(x, y), z) = \mu(x, \mu(y, z))$$ But what are these $x, y, z\in T$? $T$ is not a set!

From my difficulties with points 1 and 2 above, I fail to see how the three monad laws in the definition express the associative law and the unit laws of this monoid.

I have read the example of a monoid from the introduction (pages 2 and 3) and I see that the diagrams for a monoid are similar to those for a monad, but my intuition is still very poor. How can I simply use a functor instead of a set and replace the Cartesian product of sets with functor composition?

$\begingroup$It's "like a monoid", it isn't actually a monoid. It is a monoid object in the categorical sense, but this is a vast generalization of a monoid.$\endgroup$
– Derek ElkinsJan 30 '17 at 21:13

$\begingroup$To amplify: this is only an analogy. He means "replace" in the sense of "write down this symbol instead!" It's not (at this level) a mathematical claim. Of course, all mathematical analogies are just waiting to become theorems, as Derek point out...$\endgroup$
– Kevin CarlsonJan 30 '17 at 23:45

$\begingroup$@DerekElkins: Thanks for the clarification. I was probably misled by the last sentence: "... a monad in $X$ is just a monoid ..."$\endgroup$
– GiorgioJan 31 '17 at 5:48

1

$\begingroup$I mention this just because it will help reading other category theoretic texts, but really the portion of that last sentence that you should read is "...a monad on $X$ is just a monoid in the category of..." as if the boldfaced portion were a single unit replacing "monoid." In this case that phrase means "monoid object", but the turn of phrase "a $\mathsf{Blah}$ in the category $\mathcal{C}$" is a general way of saying "we have a version of this $\mathsf{Blah}$ expressed in category theoretic language, and an instance of that in $\mathcal{C}$.$\endgroup$
– Malice VidrineSep 25 '18 at 19:32

1 Answer
1

Regarding point 2, we can actually interpret such equations in categories. In categorical logic, there is a notion of "generalized element". If we take the objects of a category as types, then we interpret variables of that type as being morphisms with codomain of that type.

I'm going to do this in a somewhat ad-hoc fashion because this particular case has some extra features I've not studied in the context of logic, so I'm just going to write true things rather than do it systematically.