definition example

A monoid in a Monoidal Category (a monoid object) is an object with morphisms

such that the unit laws , and the associativity law hold — the monoid laws “formulated in bulk, without recourse to elements”, using only functoriality of , the unit and associativity isomorphisms; “we never had to use projections”, so the definition works for any tensor product, even non-symmetric. A comonoid is the dual: , .

(m¬m)¬mm¬(m¬m)I¬mm¬mm¬Im¬mm¬mmm®¹¬idid¬¹´¬id¸¹id¬´½¹¹(m¬m)¬mm¬(m¬m)I¬mm¬mm¬Im¬mm¬mmm®¹¬idid¬¹´¬id¸¹id¬´½¹¹

Sources: DaoFP §5.3 (“Monoids”), §10.9 (“The category of monoids” ), §14.7 (“Monad as a monoid”), §17.7 (“Applicative functors as monoids”); 7 Sketches §5.4.2 (“Aside: monoid objects in a monoidal category”, Definition 5.65, Exercises), §6.3.1 (Frobenius Monoid); Kittenlab Lecture 5 (ordinary monoids).

Examples

  • In : ordinary monoids — mappend :: (m, m) -> m, mempty :: () -> m (DaoFP). In : every set uniquely, .
  • In : monads — “a monad is a monoid in the category of endofunctors” (DaoFP §14.7). In : lax monoidal (applicative) functors (DaoFP §17.7). In : algebras; comonoids are coalgebras; both: bialgebras, Hopf algebras.
  • In a Prop presented by generators , with the monoid equations (7 Sketches §5.4.2): the free prop on a monoid, whose algebras in an SMC are exactly monoid objects — e.g. in the matrices and ; the signal flow icons for “add” and “zero”.
  • A Frobenius Monoid is a monoid and comonoid on the same object satisfying the Frobenius law; a Cartesian Category is an SMC where every object is a cocommutative comonoid naturally (Discard and Copy Axioms).
  • Monoid morphisms satisfy and , forming (DaoFP §10.9), with a forgetful functor to and, when is nice, a free left adjoint.

Docs: Theories & presentations — Kittenlab Lecture 5

# Catlab: a monoid object presented in the free (symmetric) monoidal category
using Catlab
@present MonoidOb(FreeSymmetricMonoidalCategory) begin
  M::Ob
  μ::Hom(M ⊗ M, M)
  η::Hom(munit(), M)
  (μ ⊗ id(M)) ⋅ μ == (id(M) ⊗ μ) ⋅ μ
  (η ⊗ id(M)) ⋅ μ == id(M)
  (id(M) ⊗ η) ⋅ μ == id(M)
end
#check Mon_                    -- Mon_ C : monoid objects in a monoidal category C (one, mul, one_mul, mul_one, mul_assoc)
#check Comon_
#check CategoryTheory.Monad    -- monads are monoids in [C, C]
-- DaoFP §5.3: a monoid in (Hask, (,), ()) with operations "in bulk"
class MonoidObj m where
  mappend :: (m, m) -> m      -- μ
  mempty  :: () -> m          -- η
-- laws: mappend (mempty (), x) = x = mappend (x, mempty ()); mappend (mappend (x, y), z) = mappend (x, mappend (y, z))