\[ \require{mathtools} \let\DeclarePairedDelimiter\DeclarePairedDelimiters % MathJax typo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % symbol %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % sets \newcommand{\N}{\mathbb{N}} % natural numbers \newcommand{\Z}{\mathbb{Z}} % integers \newcommand{\Q}{\mathbb{Q}} % rational numbers \newcommand{\R}{\mathbb{R}} % real numbers \newcommand{\C}{\mathbb{C}} % complex numbers % category \newcommand{\catf}[1]{{\mathbf{#1}}} \newcommand{\cA}{\catf{A}} \newcommand{\cB}{\catf{B}} \newcommand{\cC}{\catf{C}} \newcommand{\cD}{\catf{D}} \newcommand{\cE}{\catf{E}} \newcommand{\cF}{\catf{F}} \newcommand{\cG}{\catf{G}} \newcommand{\cH}{\catf{H}} \newcommand{\cI}{\catf{I}} \newcommand{\cJ}{\catf{J}} \newcommand{\cK}{\catf{K}} \newcommand{\cL}{\catf{L}} \newcommand{\cM}{\catf{M}} \newcommand{\cN}{\catf{N}} \newcommand{\cO}{\catf{O}} \newcommand{\cP}{\catf{P}} \newcommand{\cQ}{\catf{Q}} \newcommand{\cR}{\catf{R}} \newcommand{\cS}{\catf{S}} \newcommand{\cT}{\catf{T}} \newcommand{\cU}{\catf{U}} \newcommand{\cV}{\catf{V}} \newcommand{\cW}{\catf{W}} \newcommand{\cX}{\catf{X}} \newcommand{\cY}{\catf{Y}} \newcommand{\cZ}{\catf{Z}} \newcommand{\cZero}{\catf{0}} \newcommand{\cOne}{\catf{1}} \newcommand{\cTwo}{\catf{2}} \newcommand{\cArr}{\catf{Arr}} % arrow \newcommand{\cPSh}{\catf{PSh}} % presheaf \newcommand{\cCone}{\catf{Cone}} % cone \newcommand{\cCocone}{\catf{Cocone}} % cocone \newcommand{\cFin}{\catf{Fin}} % finite prefix \newcommand{\cSet}{\catf{Set}} % functions \newcommand{\cRel}{\catf{Rel}} % relations \newcommand{\cPos}{\catf{Pos}} % posets \newcommand{\cMon}{\catf{Mon}} % monoids \newcommand{\cCMon}{\catf{CMon}} % commutative monoids \newcommand{\cGrp}{\catf{Grp}} % groups \newcommand{\cAb}{\catf{Ab}} % abelian groups \newcommand{\cCat}{\catf{Cat}} % categories \newcommand{\cGrpd}{\catf{Grpd}} % groupoids \newcommand{\cVect}{\catf{Vect}} % vector spaces \newcommand{\cMat}{\catf{Mat}} % matrices \newcommand{\cTop}{\catf{Top}} % topological spaces and continuous maps \newcommand{\cMet}{\catf{Met}} % metric spaces and metric maps \newcommand{\cMeas}{\catf{Meas}} % measurable spaces and measurable functions \newcommand{\cStoch}{\catf{Stoch}} % measurable spaces and stochastic maps \newcommand{\cProb}{\catf{Prob}} % probability measures and measure-preserving functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % supscript %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\op}{^\mathrm{op}} \newcommand{\inv}{^{-1}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DeclareMathOperator{\lcm}{lcm} \DeclareMathOperator{\logsumexp}{log-sum-exp} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % arrow %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % morphism \newcommand{\xto}{\xrightarrow} % -> \newcommand{\xot}{\xleftarrow} % <- \newcommand{\toot}{\rightleftarrows} % <=> \newcommand{\xtoot}[2]{\xrightleftharpoons[#2]{#1}} \newcommand{\iso}{\cong} % ~= \newcommand{\klto}{\rightsquigarrow} % ~> \newcommand{\mono}{\rightarrowtail} % >-> \newcommand{\epi}{\twoheadrightarrow} % ->> \newcommand{\ihom}{\multimap} % -o % category \newcommand{\incl}{\hookrightarrow} \newcommand{\adjto}[2]{\overset{{}\xto[]{#1}{}}{\underset{{}\xot[#2]{}{}}{\bot}}} % functor \newcommand{\nat}{\Rightarrow} % => \newcommand{\xnat}{\xRightarrow} % => \newcommand{\comma}{\downarrow} \newcommand{\adj}{\dashv} % -| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % delimiter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DeclarePairedDelimiter{\parens}{(}{)} % parentheses ( ) \DeclarePairedDelimiter{\bracks}{[}{]} % brackets [ ] \DeclarePairedDelimiter{\braces}{\{}{\}} % braces { } \DeclarePairedDelimiter{\angles}{\langle}{\rangle} % angles \DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor} \DeclarePairedDelimiter{\ceil}{\lceil}{\rceil} \newcommand{\set}{\braces} \newcommand{\singleton}{{\set{*}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % operator %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\compL}{\mathbin{\circ}} \newcommand{\compR}{\mathbin{;}} \newcommand{\Kl}{\mathrm{Kl}} \DeclareMathOperator{\Obj}{Obj} \DeclareMathOperator{\Hom}{Hom} \DeclareMathOperator{\Sub}{Sub} \DeclareMathOperator{\Eq}{Eq} \DeclareMathOperator{\Coeq}{Coeq} \DeclareMathOperator{\Pull}{Pull} \DeclareMathOperator{\Push}{Push} \DeclareMathOperator{\Lan}{Lan} \DeclareMathOperator{\Ran}{Ran} \DeclareMathOperator{\Lift}{Lift} \DeclareMathOperator{\Rift}{Rift} \DeclareMathOperator{\id}{id} \DeclareMathOperator{\act}{act} \DeclareMathOperator{\colim}{colim} % exponential \DeclareMathOperator{\partf}{partial} \DeclareMathOperator{\curry}{curry} % natural number \DeclareMathOperator{\zero}{zero} \DeclareMathOperator{\successor}{succ} % list \DeclareMathOperator{\nil}{nil} \DeclareMathOperator{\cons}{cons} \newcommand{\concat}{\mathbin{{+}\mspace{-8mu}{+}}} % fold \DeclareMathOperator{\fold}{fold} \DeclareMathOperator{\map}{map} \DeclareMathOperator{\filter}{filter} % bool \DeclareMathOperator{\cond}{cond} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % order %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\meet}{\wedge} \newcommand{\join}{\vee} \newcommand{\bigmeet}{\bigwedge} \newcommand{\bigjoin}{\bigvee} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % logic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\lfal}{\bot} \newcommand{\ltru}{\top} \newcommand{\lcon}{\wedge} \newcommand{\lncon}{\uparrow} \newcommand{\ldis}{\vee} \newcommand{\lndis}{\downarrow} \newcommand{\limp}{\rightarrow} \newcommand{\lnimp}{\nrightarrow} \newcommand{\lcim}{\leftarrow} \newcommand{\lncim}{\nleftarrow} \newcommand{\leqv}{\leftrightarrow} \newcommand{\lneqv}{\nleftrightarrow} \newcommand{\lproves}{\vdash} % |- \newcommand{\lmodels}{\vDash} % |= \newcommand{\lnproves}{\nvdash} % |/- \newcommand{\lnmodels}{\nvDash} % |/= \]
A monoidal category is a category where morphisms can be composed in parallel.
1 Monoidal category
A monoidal category is a category \(\cC\) equipped with
- monoidal product: a bifunctor \(\otimes: \cC \times \cC \to \cC\)
- monoidal unit: a \(\cC\)-object \(I\)
- associator: a natural isomorphism \(\alpha_{A, B, C}: (A \otimes B) \otimes C \to A \otimes (B \otimes C)\)
- left unitor: a natural isomorphism \(\lambda_A: I \otimes A \to A\)
- right unitor: a natural isomorphism \(\rho_A: A \otimes I \to A\)
such that the triangle and pentagon diagrams commute.
Functoriality:
- \((g_1 \compL f_1) \otimes (g_2 \compL f_2) = (g_1 \otimes g_2) \compL (f_1 \otimes f_2)\)
- \(\id_A \otimes \id_B = \id_{A \otimes B}\)
A monoidal category is strict if \(\alpha\), \(\lambda\), and \(\rho\) are all identity morphisms.
1.1 Braided monoidal category
A braided monoidal category is a monoidal category \((\cC, \otimes, I, \alpha, \lambda, \rho)\) equipped with
- braiding: a natural isomorphism \(\beta_{A, B}: A \otimes B \to B \otimes A\)
such that the hexagon diagram commutes.
1.2 Symmetric monoidal category
A symmetric monoidal category is a braided monoidal category \((\cC, \otimes, I, \alpha, \lambda, \rho, \beta)\) whose braiding \(\beta\) is symmetric: \(\beta_{B, A} \compL \beta_{A, B} = \id_{A \otimes B}\).
2 Monoidal functor
For monoidal categories \(\cC\) and \(\cD\), a lax monoidal functor is a functor \(F: \cC \to \cD\) equipped with
- a natural transformation \(\mu_{A, B}: FA \otimes_\cD FB \to F(A \otimes_\cC B)\)
- a \(\cD\)-morphism \(\eta: I_\cD \to FI_\cC\)
subject to
- associativity: \((F\alpha_\cC) \compL \mu \compL (\mu \otimes \id) = \mu \compL (\id \otimes \mu) \compL \alpha_\cD\)
- identity: \((F \lambda_\cC) \compL \mu \compL (\eta \otimes \id) = \lambda_\cD\) and \((F \rho_\cC) \compL \mu \compL (\id \otimes \eta) = \rho_\cD\)
-- applicative function application
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
(<*) :: Applicative f => f a -> f b -> f a
(*>) :: Applicative f => f a -> f b -> f b
2.1 Properties
- Lax: morphisms
- Strong: isomorphisms
- Strict: identity morphisms
2.2 Braided monoidal functor
A braided monoidal functor is a monoidal functor that is compatible with
- braiding: \((F\beta_\cC) \compL \mu = \mu \compL \beta_\cD\)
2.3 Symmetric monoidal functor
A symmetric monoidal functor is a braided monoidal functor between symmetric monoidal categories.
3 Monoidal natural transformation
A monoidal natural transformation \(\alpha: F \to G\) between two monoidal functors is a natural transformation that is compatible with
- monoidal product: \(\alpha \compL \mu_F = \mu_G \compL (\alpha \otimes \alpha)\)
- monoidal unit: \(\alpha \compL \eta_F = \eta_G\)
\(\cMon\cCat\): 2-category of monoidal categories, monoidal functors, and monoidal natural transformations
4 Universal construction
4.1 Internal hom
Left internal hom:
\[A \otimes (-) \adj [A, -]\]
\[\Hom(A \otimes C, B) \iso \Hom(C, [A, B])\]
\[A \otimes [A, B] \xto{\epsilon_A} B \toot [A, B] \xto{\id_{[A, B]}} [A, B]\]
Right internal hom:
\[(-) \otimes A \adj [A, -]\]
\[\Hom(C \otimes A, B) \iso \Hom(C, [A, B])\]
\[[A, B] \otimes A \xto{\epsilon_A} B \toot [A, B] \xto{\id_{[A, B]}} [A, B]\]
A (left/right/bi) closed monoidal category has all (left/right/both side) internal homs.
Every right closed braided monoidal category becomes left closed in a canonical way, and vice versa.
4.2 Distributivity
Left distributive monoidal category:
\[A \otimes \coprod_i B_i \iso \coprod_i (A \otimes B_i)\]
Right distributive monoidal category:
\[\coprod_i A_i \otimes B \iso \coprod_i (A_i \otimes B)\]
Cocartesian and (left/right) closed monoidal category is (left/right) distributive.
5 Examples
5.1 Monoidal preorder
- \((\N, \leq, +, 0)\)
- \((\N, \mid, \times, 1)\)
- \((\set{\lfal, \ltru}, \lfal \lproves \ltru, \lcon, \ltru)\)
- \(([0, \infty], \geq, +, 0) \xtoot{\exp(-x)}{-\log(x)} ([0, 1], \leq, \times, 1)\)
5.2 Quantale
A (unital) quantale is a monoidal closed suplattice:
- preorder \(\leq\) (category)
- join \(\join\), bottom \(\bot\) (suplattice, cocartesian category)
- monoidal product \(\otimes\), monoidal unit \(I\) (monoidal category)
- internal hom \(\ihom\) (closed monoidal category)
By the adjoint functor theorem, a quantale is automatically a complete lattice (bicartesian category):
- meet \(\meet\), top \(\top\) (inflattice, cartesian category)
Because a quantale is cocartesian and (left/right) closed, it is (left/right) distributive:
\[A \otimes \bigjoin_i B_i = \bigjoin_i (A \otimes B_i)\]
\[\bigjoin_i A_i \otimes B = \bigjoin_i (A_i \otimes B)\]
Additionally, a quantale can be:
- commutative \(A \otimes B \iso B \otimes A\) (symmetric monoidal category)
- affineness \(I = \top\)(semicartesian category)
A quantale homomorphism is a cocontinuous monoidal functor.
6 Monoid
A monoid object in a monoidal category \((\cC, \otimes, I, \alpha, \lambda, \rho)\) is an object \(M\) equipped with two morphisms:
- product \(\mu: M \otimes M \to M\)
- unit \(\eta: I \to M\)
subject to
- associativity: \(\mu \compL (\mu \otimes \id) = \mu \compL (\id \otimes \mu) \compL \alpha\)
- identity: \(\mu \compL (\eta \otimes \id) = \lambda\) and \(\mu \compL (\id \otimes \eta) = \rho\)
-- mappend
(<>) :: Monoid m => m -> m -> m
-- unit
mempty :: Monoid a => a
-- associativity
<> (y <> z) = (x <> y) <> z
x -- left identity
mempty <> x = x
-- right identity
<> mempty = x x
A group object \(G\) in a cartesian category is a monoid object \((G, \mu, \eta)\) equipped with an inverse morphism \(\iota: G \to G\) subject to invertibility.
A monad is a monoid in the category of endofunctors \([\cC, \cC]\).
6.1 Monoid homomorphism
A monoid homomorphism between two monoid objects \(M\) and \(N\) is a morphism \(f: M \to N\) that preserves
- product: \(f \compL \mu_M = \mu_N \compL (f \otimes f)\)
- unit: \(f \compL \eta_M = \eta_N\)
- a monoid object = a lax monoidal functor \(M: (\cOne, \otimes, *) \to (\cC, \otimes, I)\)
- a monoid homomorphism = a monoidal natural transformation \(f: M \nat N\)
6.2 Commutative monoid
A commutative monoid object in a symmetric monoidal category is a monoid object whose product is commutative.
- commutativity: \(\mu \compL \beta = \mu\)
If a set \(M\) has two unital magma structures \((M, \circ, e_\circ)\) and \((M, \bullet, e_\bullet)\) that are interchangeable: \((a \circ b) \bullet (c \circ d) = (a \bullet c) \circ (b \bullet d)\), then they are the same commutative monoid.
Two units are the same:
\[e_\circ = e_\circ \circ e_\circ = (e_\circ \bullet e_\bullet) \circ (e_\bullet \bullet e_\circ) = (e_\circ \circ e_\bullet) \bullet (e_\bullet \circ e_\circ) = e_\bullet \bullet e_\bullet = e_\bullet.\]
Two binary operations are the same:
\[a \circ b = (a \bullet e) \circ (e \bullet b) = (a \circ e) \bullet (e \circ b) = a \bullet b.\]
The binary operation is associative:
\[(a \circ b) \circ c = (a \circ b) \circ (e \circ c) = (a \circ e) \circ (b \circ c) = a \circ (b \circ c).\]
The binary operation is commutative:
\[a \circ b = (e \circ a) \circ (b \circ e) = (e \circ b) \circ (a \circ e) = b \circ a.\]
Thus, \(\circ\) and \(\bullet\) define the same commutative monoid.
\(\circ: (M, \bullet) \otimes (M, \bullet) \to (M, \bullet)\) and \(\bullet: (M, \circ) \otimes (M, \circ) \to (M, \circ)\) are monoid homomorphisms.
6.3 Codiagonal
A monoidal category with codiagonals is a symmetric monoidal category in which every object is a commutative monoid in a compatible way.
7 Comonoid
A comonoid object in a monoidal category \((\cC, \otimes, I, \alpha, \lambda, \rho)\) is an object \(C\) equipped with two morphisms:
- coproduct \(\delta: C \to C \otimes C\)
- counit \(\epsilon: C \to I\)
subject to
- associativity: \(\alpha \compL (\delta \otimes \id) \compL \delta = (\id \otimes \delta) \compL \delta\)
- identity: \((\epsilon \otimes \id) \compL \delta = \lambda\inv\) and \((\id \otimes \epsilon) \compL \delta = \rho\inv\)
7.1 Comonoid homomorphism
A comonoid homomorphism between two comonoid objects \(C\) and \(D\) is a morphism \(f: C \to D\) that preserves
- coproduct: \(\delta_D \compL f = (f \otimes f) \compL \delta_C\)
- counit: \(\epsilon_D \compL f = \epsilon_C\)
7.2 Commutative comonoid
A commutative comonoid object in a symmetric monoidal category is a comonoid object whose coproduct is commutative.
- commutativity: \(\beta \compL \delta = \delta\)
7.3 Diagonal
A monoidal category with diagonals is a symmetric monoidal category in which every object is a commutative comonoid in a compatible way.