定义
$(M,\otimes,e)$ 是 monoid $\iff$
- $M$ 为基集
- $\otimes$ 为满足结合律的二元运算符 $$(a\otimes b)\otimes c=a\otimes (b\otimes c) \ \forall a,b,c\in M$$
- $e$ 为幺元 $$e\otimes x=x \ \forall x \in M$$
monoid 例子
- $(\mathbb{Z},+,0)$
- $(\mathbb{Z},\times,1)$
- $(\text{vector},\text{concat}, \text{empty\_vector})$
性质
- 【笛卡尔积】$A,B$ 都是 monoid $\implies$ $A\times B$ 也是 monoid