Monoid homomorphism I have read here and in some other places that if $$(a \circ b) \star (c \circ d) = (a \star c) \circ (b \star d)$$ for all $a,b,c,d$ in a set with two binary operations $\circ$ and $\star$, then each one is a monoid homomorphism.
My problem is that I don't quite understand in what sense these are monoid homomorphisms, since neither is a function $M \to M'$, but instead $M^2 \to M$, which confuses me somewhat. So, what exactly are these homomorphisms? Is $M^2$ supposed to be a monoid? If so, how?
Thanks.
 A: If $M$ is a monoid, $M^2=M\times M$ is a monoid with coordinate-wise multiplication: that is, if $(a,b)$, $(a',b')\in M^2$, then the product is such that $$(a,b)\cdot(a',b')=(aa',bb').$$
Now suppose $M$ is a monoid, and that $M^2$ is endowed with this monoid structure. Suppose additionally that we have a function $\phi:M^2\to M$. It then makes sense to say that $\phi$ is a morphism of monoids. 
Finally, it may well happen that the function $\phi$ defines itself a monoid structure on $M$. That is the situation of the lemma you have in mind, which is called the Eckmann-Hilton lemma.
A: I realize that this is not exactly the answer you asked for, but...
The character of the morphisms doesn't depend on all the properties of a structure. For example, properties like associativity doesn't influence at all. What do influence is the outer structure, in the case of monoids the function
$$M\times M\to M$$
To that outer structure morphisms always are characterized by
$$f(xy)=f(x)f(y)$$
How come? Well, I don't know if there is a definite answer, but there are certain patterns:
Given a set $X$. Let $S\subseteq X$ and consider $(X,S)$ as a very simple mathematical structure, here to be called a spotted set. Given two spotted sets, then a morphism $\alpha :(X,S)\longrightarrow(X^\prime,S^\prime)$ is a function
$\alpha :X\longrightarrow X^\prime$ such that $x\in S\Rightarrow \alpha(x)\in S^\prime$. Call the category sSet.
Group-like structures as magmas and categories are characterized by relations
$R\subseteq (X\times X)\times X$ and can obviously be expressed as spotted sets. Morphisms are functions 
$\alpha:(X\times X)\times X\longrightarrow(X^\prime\times X^\prime)\times X^\prime$ such that 
$((x,y),z)\in R \Rightarrow \alpha((x,y),z)\in R^\prime$.
Functions 
$\alpha_1,\alpha_2,\alpha_3:X\longrightarrow X^\prime$ exists such that
$\alpha((x,y),z)=((\alpha_1(x),\alpha_2(y)),\alpha_3(z))$ and if $\alpha$ is such that $\alpha_1=\alpha_2=\alpha_3$, then $\alpha_1$ correspond to group homomorphisms etc.
Action-like structures $R\subseteq (A\times X)\times X$. Here morphisms are functions 
$(A\times X)\times X\overset{\alpha}{\longrightarrow}(A\times X^\prime)\times X^\prime$ such that $((a,x),y)\in R \Rightarrow \alpha((a,x),y)\in R^\prime$. It exists functions 
$\alpha_0,\alpha_1,\alpha_2$ such that 
$\alpha((a,x),y)=((\alpha_0(a),\alpha_1(x)),\alpha_2(y))$. If $\alpha_0=1_A$ and $\alpha_1=\alpha_2$ this correspond to morphisms of actions.
Metric-like structures $R\subseteq (X\times X)\times B$. $((x,y),b)\in R \Rightarrow \alpha((x,y),b)\in R^\prime$.
Topological spaces. The spotted set is simply defined as $\tau\subseteq \mathcal{P}(X)$. Morphisms are 
functions $\mathcal{P}(X)\overset{\alpha}{\longrightarrow}\mathcal{P}(X^\prime)$ such that 
$\mathcal{O}\in\tau \Rightarrow \alpha(\mathcal{O})\in \tau^\prime$. If there is a function
$f:X^\prime\longrightarrow X$ such that $\alpha = \mathcal{Q}(f)$, where $\mathcal{Q}$ is the contra-variant power set functor, this correspond to Top and $f$ is continuous with respect to the topologies. 
Uniform spaces with a set of entourages $\phi\subseteq\mathcal{P}(X\times X)$. Morphisms are functions 
$\mathcal{P}(X\times X)\overset{\alpha}{\longrightarrow}\mathcal{P}(X^\prime\times X^\prime)$ such that
$\mathcal{U}\in\phi \Rightarrow \alpha(\mathcal{U})\in \phi^\prime$. The condition on the $sSet$-morphism to correspond to a uniformly continuous function is similar as above.
Undirected graphs. $E\subseteq\mathcal{P}(X)$, $e\in E\Rightarrow \alpha(e)\in E^\prime$, 
where $\alpha$ is a function $\mathcal{P}(X)\rightarrow\mathcal{P}(X^\prime)$.
Multigraphs. Function $\varepsilon \subset E\times V^2$.
Matroids. $\mathcal{I}\subseteq \mathcal{P}(X)$. If there is a function $f:X^\prime\rightarrow X$ 
such that $\alpha=\mathcal{Q}(f)$ and $X=X^\prime$, then $\alpha$ correspond to maps of matroids with weak relation.
There are also other patterns.
