## Definition ## A __monoid__ or __$A_3$-algebra in sets__ consists of * A type $A$, * A basepoint $e:A$ * A binary operation $\mu : A \to A \to A$ * A left unitor $$\lambda:\prod_{(a:A)} \mu(e,a)=a$$ * A right unitor $$\rho:\prod_{(a:A)} \mu(a,e)=a$$ * An asssociator $$\alpha:\prod_{(a:A)} \prod_{(b:A)} \prod_{(c:A)} \mu(\mu(a, b),c)=\mu(a,\mu(b,c))$$ * A 0-truncator $$\tau_0: \prod_{(a:A)} \prod_{(b:A)} \prod_{(c:a=b)} \prod_{(d:a=b)} \sum_{(x:c=d)} \prod_{(y:c=d)} x=y$$ ### Homomorphisms of monoids ### A __homomorphism of monoids__ 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 monoid $A$, the 0-truncator means that the identity types between any two terms of $A$ are propositions, and thus the dependent product types $$\prod_{(a:A)} \mu(e,a)=a$$ $$\prod_{(a:A)} \mu(a,e)=a$$ $$\prod_{(a:A)} \prod_{(b:A)} \prod_{(c:A)} \mu(\mu(a, b),c)=\mu(a,\mu(b,c))$$ are propositions, and thus contractible because they are inhabited by definition of a monoid. As a result, given monoids $A$ and $B$, for any function $$\phi_\lambda:\left(\prod_{(a:A)} \mu(e_A,a)=a\right) \to \left(\prod_{(b:B)} \mu(e_B,b)=b\right)$$ the left unitor is preserved: $$\phi_\lambda(\lambda_A) = \lambda_B$$ because $$\prod_{(b:B)} \mu(e_B,b)=b$$ is contractible. Likewise, for any function $$\phi_\rho:\left(\prod_{(a:A)} \mu(a, e_A)=a\right) \to \left(\prod_{(b:B)} \mu(b, e_B)=b\right)$$ the right unitor is preserved: $$\phi_\rho(\rho_A) = \rho_B$$ because $$\prod_{(b:B)} \mu(b,e_B)=b$$ is contractible, and for any function $$\phi_\alpha:\left(\prod_{(a_1:A)} \prod_{(a_2:A)} \prod_{(a_3:A)} \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)} \mu(\mu(b_1, b_2),b_3)=\mu(b_1,\mu(b_2,b_3))\right)$$ the associator is preserved: $$\phi_\alpha(\alpha_A) = \alpha_B$$ because $$\prod_{(b_1:B)} \prod_{(b_2:B)} \prod_{(b_3:B)} \mu(\mu(b_1, b_2),b_3)=\mu(b_1,\mu(b_2,b_3))$$ is contractible. This means that a homomorphism of monoids is also a homomorphism of $A_3$-spaces. Finally, the 0-truncator is always preserved in a function between two sets. ## Examples ## * 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 ## * [[Synthetic homotopy theory]] * [[A3-space]] * [[commutative monoid]] * [[group]] * [[monoidal groupoid]] ## References ## * Univalent Foundations Project, [[HoTT book|Homotopy Type Theory – Univalent Foundations of Mathematics]] (2013)