#Contents# * table of contents {:toc} ## Definition ## A __monoid__ consists of * A type $A$, * A basepoint $e:A$ * A binary operation $\mu : A \to A \to A$ * A contractible left unit identity $$c_\lambda:\prod_{(a:G)} isContr(\mu(e,a)=a)$$ * A contractible right unit identity $$c_\rho:\prod_{(a:G)} isContr(\mu(a,e)=a)$$ * A contractible associative identity $$c_\alpha:\prod_{(a:G)} \prod_{(b:G)} \prod_{(c:G)} isContr(\mu(\mu(a, b),c)=\mu(a,\mu(b,c)))$$ * A 0-truncator $$\tau_0: \prod_{(a:A)} \prod_{(b:A)} isProp(a=b)$$ ## Properties ## ### Monoid homomorphisms ### A __monoid homomorphism__ between two monoids $A$ and $B$ consists of * A function $\phi:A \to B$ such that * The basepoint is preserved $$\phi(e_A) = e_B$$ * The binary operation is preserved $$\prod_{(a:A)} \prod_{(b:A)} \phi(\mu_A(a, b)) = \mu_B(\phi(a),\phi(b))$$ For any function $$\phi_{c_\lambda}:\left(\prod_{(a:A)} isContr(\mu(e_A,a)=a)\right) \to \left(\prod_{(b:B)} isContr(\mu(e_B,b)=b)\right)$$ the contractible left unit identity is preserved: $$\phi_{c_\lambda}({c_\lambda}_A) = {c_\lambda}_B$$ because $$\prod_{(b:B)} isContr(\mu(e_B,b)=b)$$ is contractible. Likewise, for any function $$\phi_{c_\rho}:\left(\prod_{(a:A)} isContr(\mu(a, e_A)=a)\right) \to \left(\prod_{(b:B)} isContr(\mu(b, e_B)=b)\right)$$ the contractible right unit identity is preserved: $$\phi_{c_\rho}({c_\rho}_A) = {c_\rho}_B$$ because $$\prod_{(b:B)} isContr(\mu(b,e_B)=b)$$ is contractible, and for any function $$\phi_{c_\alpha}:\left(\prod_{(a_1:A)} \prod_{(a_2:A)} \prod_{(a_3:A)} isContr(\mu(\mu(a_1, a_2),a_3)=\mu(a_1,\mu(a_2,a_3)))\right) \to \left(\prod_{(b_1:B)} \prod_{(b_2:B)} \prod_{(b_3:B)} isContr(\mu(\mu(b_1, b_2),b_3)=\mu(b_1,\mu(b_2,b_3)))\right)$$ the contractible associative identity is preserved: $$\phi_{c_\alpha}({c_\alpha}_A) = {c_\alpha}_B$$ because $$\prod_{(b_1:B)} \prod_{(b_2:B)} \prod_{(b_3:B)} isContr(\mu(\mu(b_1, b_2),b_3)=\mu(b_1,\mu(b_2,b_3)))$$ is contractible. Finally, the 0-truncator is always preserved in a function between two sets. ### Monoid isomorphisms ### A __monoid isomorphism__ between two monoids $A$ and $B$ consists of * a monoid homomorphism $f: A \to B$ * a monoid homomorphism $f^{-1}: B \to A$ that is an inverse function of $f$. ## Examples ## * Every [[contractible]] magma is a monoid. * The [[integers]] are a monoid. * Given a [[set]] $A$, the type of endofunctions $A \to A$ has the structure of an monoid, with basepoint $id_A$, operation function composition. ## See also ## * [[commutative monoid]] * [[group]] * [[action]] ## References ## * Univalent Foundations Project, [[HoTT book|Homotopy Type Theory – Univalent Foundations of Mathematics]] (2013)