Side by side
Composition puts two processes in sequence. Much of mathematics and physics also needs to put things in parallel: two independent choices form a pair ; a quantum system made of two subsystems has state space ; two electrical circuits sit next to each other on a board; two strands of a braid hang side by side; two programs run on separate inputs. Each situation has a binary operation on objects and on morphisms, , together with a "do nothing" object .
Such an operation is almost never associative on the nose. The sets and are different (their elements are and ), though canonically isomorphic. A monoidal category keeps these canonical isomorphisms as data and asks for exactly the right laws between them: Mac Lane's pentagon and triangle. The surprise is that two small diagrams are enough to make every formal diagram built from these canonical isomorphisms commute — the coherence theorem. Asking for "commutativity up to isomorphism" leads to braidings, the hexagon axioms, and a genuine fork in the road: braidings that square to the identity (symmetric) and braidings that do not, the latter governed by Artin's braid groups and found in quantum groups, knot invariants and anyonic physics.
This lesson builds on natural transformations and products and coproducts.
Strings, boxes and bracketings
Draw an object as a vertical string and a morphism as a box on a string, read from bottom to top. Composition stacks boxes vertically; the tensor product places strings and boxes side by side; the unit is drawn as no string at all. Functoriality of , the interchange law
says that boxes on different strings slide freely past each other in height. A braiding is drawn as a crossing of two strings — and whether is the identity is the question of whether a doubly-crossed pair of strings can be pulled straight.
Bracketings are the other half of the picture. A word can be bracketed in ways (the Catalan numbers ), and single applications of the associator connect them into a graph: for it is a pentagon, for the 1-skeleton of a 3-dimensional polytope with 14 vertices and 21 edges (Stasheff's associahedron; the underlying order is Tamari's lattice). Coherence says that if the pentagon commutes, then every 2-dimensional face of every associahedron does, so any two paths of associators between two bracketings agree.
Monoidal, braided and symmetric
Definition— monoidal category
A monoidal category is a category with a functor , an object (the unit), and natural isomorphisms
(the associator and the left and right unitors) such that the pentagon and triangle diagrams below commute for all objects. It is strict if , , are identities.
Definition— monoidal functor
A (strong) monoidal functor is a functor with natural isomorphisms and compatible with the associators and unitors. If are merely morphisms it is lax monoidal. A monoidal equivalence is a strong monoidal functor that is an equivalence of categories.
Definition— braiding; symmetric monoidal category
A braiding on a monoidal category is a natural isomorphism satisfying the two hexagon axioms; with the associators suppressed they read
i.e. moving past is moving it past then past , and likewise on the other side. A braided monoidal category is symmetric if for all .
Definition— monoid object
A monoid object in a monoidal category is an object with morphisms and such that and , . A morphism of monoid objects is a morphism commuting with and .
Definition— closed monoidal category
A monoidal category is (right) closed if every functor has a right adjoint , the internal hom: naturally in and .
Examples
Example— Cartesian: (Set, ×, 1)
, , , , , and the braiding . More generally any category with finite products is monoidal under with the terminal object as unit (a cartesian monoidal category), and symmetric. It is closed: and currying is the adjunction.
Example— Cocartesian: (Set, ⊔, ∅)
(disjoint union, e.g. ), ; the associator and unitors are the evident relabellings, and the braiding swaps the tags . Any category with finite coproducts is monoidal under with the initial object as unit. This structure is not closed: does not preserve the initial object (for ), so it has no right adjoint.
Example— Linear: (Vect_k, ⊗, k)
is the tensor product over a field , , , , and the braiding , all defined on pure tensors and extended linearly (well defined by the universal property). It is symmetric and closed with . Here is not a categorical product: a linear map is not a pair of maps, and there are no natural projections . The same holds for , for -modules over a commutative ring, and for .
Example— Endofunctors: a strict, non-symmetric monoidal category
For any category , the functor category is strict monoidal with and ; on natural transformations is horizontal composition. It is usually not braided: in general. Monoid objects here are exactly monads (see monads).
Example— Graded vector spaces with a twisted associator
Let be a group and a function. is the category of finite-dimensional -graded vector spaces with , unit the one-dimensional space in degree , and associator acting on as multiplication by . On the simple objects the pentagon axiom becomes the 3-cocycle condition
and the triangle axiom (with identity unitors) the normalisation . For and , the cochains , where if (for representatives ) and otherwise, are 3-cocycles. Proof: write the condition additively in exponents. The number of wrap-arounds in computing does not depend on the bracketing, so ; substituting, the two sides differ by . These cochains represent all of : up to changing the tensor-product isomorphisms by a 2-cochain, there are exactly associators on -graded vector spaces with .
Example— Representations
For a group , finite-dimensional representations form a symmetric monoidal category with and the trivial representation as unit. For a Hopf algebra the comultiplication makes monoidal, and an -matrix (a quasi-triangular structure) makes it braided. For the quantum group at generic the resulting braiding is not symmetric (see the second experiment).
Example— Braids
The braid category has objects , morphisms the elements of Artin's braid group (none between different ), and by placing braids side by side. The crossing is a braiding . Since is generated by , : is braided but not symmetric. By a theorem of Joyal and Street, is the free braided monoidal category on one object.
Theorems
Theorem— Proposition 1 ((Set, ×, 1) is symmetric monoidal)
With the structure maps above, satisfies the pentagon, triangle and hexagon axioms, and .
Proof
Naturality of is immediate from the formulas. Pentagon: both composites send to — the upper path via , the lower via and . Triangle: both sides send to . Hexagon (first form, associators included): both sides send to ; the second is similar. Symmetry: . The same element-chasing proves the claims for , and for it suffices to check on pure tensors , which span.
∎
The next result is the first sign that "commutativity" is forced one dimension up.
Theorem— Theorem 2 (Eckmann–Hilton)
Let be a set with two binary operations and , with units and , satisfying the interchange law . Then , the two operations coincide, and they are commutative (and associative).
Proof
Put , : the left side is and the right side is . Call the common unit . Then
Associativity follows similarly: .
∎
Theorem— Theorem 3 (End(I) is commutative; Kelly, Kelly–Laplaza)
In any monoidal category, , and the monoid is commutative.
Proof
That follows from the pentagon and triangle axioms (Kelly 1964; the commutativity of is recorded by Kelly and Laplaza, 1980); a proof is in Etingof–Gelaki–Nikshych–Ostrik, Tensor Categories, §2.2, and Mathlib proves it as unitors_equal. Write . For , naturality of and gives
and the interchange law gives . Hence
and since is invertible, .
∎
This is Eckmann–Hilton in disguise: on , composition and (transported along ) are two unital operations satisfying interchange. For example, in , and in it is the commutative monoid of natural transformations (the centre of ).
Theorem— Theorem 4 (Mac Lane's coherence theorem, 1963)
(a) In a monoidal category, every formal diagram built from components of , , , their inverses, identities and commutes. Precisely: in the free monoidal category on a set of objects, any two parallel morphisms are equal. (b) Every monoidal category is monoidally equivalent to a strict monoidal category.
Proof sketch and reference. For (a), send every bracketed word to its normal form (all brackets to the right, units deleted); one shows that the canonical map from a word to its normal form is well defined, using the pentagon to commute any two associator moves and the triangle to handle units. Then any two canonical paths both factor through the normal form, hence agree. Mac Lane's original argument contains this; a careful account is in Mac Lane, CWM, VII.2 (coherence) and XI.3 (strictification), and Mathlib formalises (a) (FreeMonoidalCategory.subsingleton_hom). For (b), replace by the category of finite lists of objects of , with concatenation as a strict tensor product and morphisms computed after tensoring out (EGNO, §2.8). Coherence is about formal diagrams: in the swap and the identity are both "canonical", yet different — they come from different formal expressions.
For braided categories the analogue is that formal diagrams commute when their underlying braids are equal (Joyal–Street); for symmetric ones, when their underlying permutations are equal.
Theorem— Proposition 5 (monoid objects)
Monoid objects in are monoids; in they are rings; in they are -algebras; in they are monads; in every object has exactly one monoid structure.
Proof
In , is a binary operation and picks an element; the axioms, evaluated on elements, are associativity and the unit laws. In , a homomorphism is the same as a biadditive map (universal property of ), i.e. a multiplication distributing over addition, and is determined by ; the axioms (checked on pure tensors) are associativity and the unit laws, so is a ring. Replacing by gives -algebras. In endofunctors, and , and the axioms are the monad laws. In , is unique and the unit laws force to be the identity on each copy (the codiagonal); it is associative.
∎
Theorem— Proposition 6 (monoids in monoids are commutative)
A monoid object in the cartesian monoidal category is a commutative monoid, and its two multiplications coincide.
Proof
A monoid object in is a monoid whose multiplication and unit are monoid homomorphisms. " is a homomorphism" is exactly the interchange law , so Eckmann–Hilton applies: and both are commutative.
∎
Monoidal categories in Lean
Mathlib's MonoidalCategory has the pentagon and triangle as fields. Mathlib writes composition in diagrammatic order, f ≫ g for , and uses whiskering: X ◁ g is and f ▷ Y is .
/-- **The pentagon axiom.** The two ways of rebracketing `((W ⊗ X) ⊗ Y) ⊗ Z` into
`W ⊗ (X ⊗ (Y ⊗ Z))` using associators agree. In Mathlib this is a field of `MonoidalCategory`
(composition is written `≫`, in diagrammatic order, and `f ▷ Z`, `W ◁ g` are whiskerings). -/
theorem pentagon (W X Y Z : C) :
(α_ W X Y).hom ▷ Z ≫ (α_ W (X ⊗ Y) Z).hom ≫ W ◁ (α_ X Y Z).hom =
(α_ (W ⊗ X) Y Z).hom ≫ (α_ W X (Y ⊗ Z)).hom :=
MonoidalCategory.pentagon W X Y Z/-- **The triangle axiom**: `(X ⊗ I) ⊗ Y ⟶ X ⊗ (I ⊗ Y) ⟶ X ⊗ Y` equals `ρ_X ⊗ Y`.
A field of Mathlib's `MonoidalCategory`. -/
theorem triangle (X Y : C) :
(α_ X (𝟙_ C) Y).hom ≫ X ◁ (λ_ Y).hom = (ρ_ X).hom ▷ Y :=
MonoidalCategory.triangle X Y/-- **Kelly's identity** `λ_I = ρ_I : I ⊗ I ⟶ I`. It is *not* an axiom: it follows from the
pentagon and triangle axioms (Kelly 1964). Mathlib's `unitors_equal`. -/
theorem unitors_equal : (λ_ (𝟙_ C)).hom = (ρ_ (𝟙_ C)).hom :=
CategoryTheory.MonoidalCategory.unitors_equalThe proof of Theorem 3 is formalised step by step: naturality of the unitors, the interchange law (Mathlib's whisker_exchange), and cancellation of the isomorphism .
/-- **The endomorphisms of the unit object commute.** For `f g : I ⟶ I`, `f ≫ g = g ≫ f`.
Human proof. Write `u = λ_I = ρ_I : I ⊗ I ≅ I` (Kelly's identity). Naturality of the unitors says
`I ◁ g` is `g` conjugated by `u`, and `f ▷ I` is `f` conjugated by `u`. The interchange law says
`I ◁ g` and `f ▷ I` commute (both orders equal `f ⊗ g`). Conjugating back by `u`, `g` and `f`
commute. -/
theorem end_unit_comm (f g : 𝟙_ C ⟶ 𝟙_ C) : f ≫ g = g ≫ f := by
-- naturality of the unitors at `g` and at `f`
have hl : 𝟙_ C ◁ g ≫ (λ_ (𝟙_ C)).hom = (λ_ (𝟙_ C)).hom ≫ g :=
MonoidalCategory.leftUnitor_naturality g
have hr : f ▷ 𝟙_ C ≫ (λ_ (𝟙_ C)).hom = (λ_ (𝟙_ C)).hom ≫ f := by
rw [unitors_equal]
exact MonoidalCategory.rightUnitor_naturality f
-- the interchange law: `I ◁ g ≫ f ▷ I = f ▷ I ≫ I ◁ g`
have hx : 𝟙_ C ◁ g ≫ f ▷ 𝟙_ C = f ▷ 𝟙_ C ≫ 𝟙_ C ◁ g := whisker_exchange f g
-- conjugate back by the isomorphism `λ_I`
have key : (λ_ (𝟙_ C)).hom ≫ g ≫ f = (λ_ (𝟙_ C)).hom ≫ f ≫ g := by
calc (λ_ (𝟙_ C)).hom ≫ g ≫ f = (𝟙_ C ◁ g ≫ (λ_ (𝟙_ C)).hom) ≫ f := by
rw [hl, Category.assoc]
_ = 𝟙_ C ◁ g ≫ (f ▷ 𝟙_ C ≫ (λ_ (𝟙_ C)).hom) := by rw [Category.assoc, hr]
_ = (𝟙_ C ◁ g ≫ f ▷ 𝟙_ C) ≫ (λ_ (𝟙_ C)).hom := by rw [Category.assoc]
_ = (f ▷ 𝟙_ C ≫ 𝟙_ C ◁ g) ≫ (λ_ (𝟙_ C)).hom := by rw [hx]
_ = f ▷ 𝟙_ C ≫ ((λ_ (𝟙_ C)).hom ≫ g) := by rw [Category.assoc, hl]
_ = (λ_ (𝟙_ C)).hom ≫ f ≫ g := by rw [← Category.assoc, hr, Category.assoc]
exact ((cancel_epi (λ_ (𝟙_ C)).hom).mp key).symm/-- **The Eckmann–Hilton argument.** Suppose a type carries two binary operations `m₁`, `m₂`
with units `e₁`, `e₂`, satisfying the interchange law
`m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)`. Then the units agree, the operations agree, and
the operation is commutative. (Mathlib: `EckmannHilton.one`, `EckmannHilton.mul`,
`EckmannHilton.mul_comm`.)
Proof. Interchange with `(a, b, c, d) = (e₂, e₁, e₁, e₂)` gives `e₁ = e₂ =: e`. Then
`m₁ a b = m₁ (m₂ a e) (m₂ e b) = m₂ (m₁ a e) (m₁ e b) = m₂ a b`, and
`m₁ a b = m₁ (m₂ e a) (m₂ b e) = m₂ (m₁ e b) (m₁ a e) = m₂ b a = m₁ b a`. -/
theorem eckmann_hilton {X : Type u} (m₁ m₂ : X → X → X) (e₁ e₂ : X)
(h₁l : ∀ x, m₁ e₁ x = x) (h₁r : ∀ x, m₁ x e₁ = x)
(h₂l : ∀ x, m₂ e₂ x = x) (h₂r : ∀ x, m₂ x e₂ = x)
(interchange : ∀ a b c d, m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)) :
e₁ = e₂ ∧ m₁ = m₂ ∧ ∀ a b, m₁ a b = m₁ b a := by
have units : e₁ = e₂ := by
have h := interchange e₂ e₁ e₁ e₂
rw [h₂l, h₂r, h₁l, h₁r, h₁l, h₂l] at h
exact h
subst units
have same : m₁ = m₂ := by
funext a b
calc m₁ a b = m₁ (m₂ a e₁) (m₂ e₁ b) := by rw [h₂r, h₂l]
_ = m₂ (m₁ a e₁) (m₁ e₁ b) := interchange a e₁ e₁ b
_ = m₂ a b := by rw [h₁r, h₁l]
refine ⟨rfl, same, fun a b => ?_⟩
calc m₁ a b = m₁ (m₂ e₁ a) (m₂ b e₁) := by rw [h₂l, h₂r]
_ = m₂ (m₁ e₁ b) (m₁ a e₁) := interchange e₁ a b e₁
_ = m₂ b a := by rw [h₁l, h₁r]
_ = m₁ b a := by rw [same]Mac Lane's coherence theorem is in Mathlib for the free monoidal category:
/-- **Mac Lane's coherence theorem**, in Mathlib's form: in the free monoidal category on a type
`C` (objects are formal bracketed words in `C` and `I`, morphisms are built from associators,
unitors and identities), any two parallel morphisms are equal.
Mathlib's `FreeMonoidalCategory.subsingleton_hom`. -/
theorem coherence (C : Type u) (X Y : FreeMonoidalCategory C) (f g : X ⟶ Y) : f = g :=
Subsingleton.elim f g/-- **`(Type, ×, PUnit)` is symmetric.** The braiding `X × Y ≅ Y × X` swaps the coordinates, so
braiding twice is the identity. Checked on elements: `(x, y) ↦ (y, x) ↦ (x, y)`. -/
theorem types_symmetric (X Y : Type u) :
(β_ X Y).hom ≫ (β_ Y X).hom = 𝟙 (X ⊗ Y) := by
ext ⟨x, y⟩ <;> rfl/-- **Monoid objects in `(Type, ×, PUnit)` are monoids.** The category of monoid objects is
equivalent to the category of monoids (Mathlib's `Mon.monTypeEquivalenceMon`). -/
theorem monoid_objects_in_types : Nonempty (Mon (Type u) ≌ MonCat.{u}) :=
⟨monTypeEquivalenceMon⟩/-- **Monads are monoid objects in the strict monoidal category `(C ⥤ C, ∘, 𝟭)`**
(Mathlib's `Monad.monadMonEquiv`). -/
theorem monads_are_monoids (C : Type u) [Category.{v} C] :
Nonempty (Monad C ≌ Mon (C ⥤ C)) :=
⟨Monad.monadMonEquiv C⟩Finally, the twisted associator on -graded vector spaces. We record the exponent of , so the multiplicative cocycle condition becomes an additive identity in that Lean checks in all 243 cases; a naive alternative fails.
/-- The **carry cochain** on `ℤ/3` with parameter `p`: `ω(a, b, c) = p · a · carry(b, c)` in
`ℤ/3`, where `carry(b, c) = 1` if `b + c` wraps around (as integers `b + c ≥ 3`) and `0`
otherwise. Read `ω(a, b, c)` as the exponent of the cube root of unity `ζ = e^{2πi/3}` that
the associator `(δ_a ⊗ δ_b) ⊗ δ_c ⟶ δ_a ⊗ (δ_b ⊗ δ_c)` multiplies by, in the category of
`ℤ/3`-graded vector spaces. -/
def carryCochain (p : Fin 3) (a b c : Fin 3) : Fin 3 :=
p * a * (if 3 ≤ b.val + c.val then 1 else 0)/-- **The pentagon holds for the twisted associator.** For simple objects the pentagon axiom of
`Vec_{ℤ/3}^ω` says exactly that `ω` is a 3-cocycle:
`ω(b,c,d) + ω(a,b+c,d) + ω(a,b,c) = ω(a+b,c,d) + ω(a,b,c+d)` (exponents of `ζ`, added in `ℤ/3`).
We check it for all `3 · 3⁴ = 243` cases by computation (`decide`). The lesson gives the general
proof for `ℤ/n`. -/
theorem carry_pentagon : ∀ p a b c d : Fin 3,
carryCochain p b c d + carryCochain p a (b + c) d + carryCochain p a b c =
carryCochain p (a + b) c d + carryCochain p a b (c + d) := by
decide/-- **A naive associator fails the pentagon.** Twisting by the carry of the *first* two indices,
`ω'(a, b, c) = carry(a, b)`, does *not* satisfy the cocycle condition:
`(a, b, c, d) = (1, 2, 0, 0)` is a counterexample (the two sides are `2` and `1` in `ℤ/3`).
Checked by computation. -/
theorem naive_not_cocycle :
let ω' : Fin 3 → Fin 3 → Fin 3 → Fin 3 := fun a b _ => if 3 ≤ a.val + b.val then 1 else 0
¬ ∀ a b c d : Fin 3,
ω' b c d + ω' a (b + c) d + ω' a b c = ω' (a + b) c d + ω' a b (c + d) := by
decideWhat is and is not formalised. Independently proved: the commutativity of (from Kelly's identity, which is taken from Mathlib), Eckmann–Hilton, symmetry of the cartesian braiding on types, and the cocycle computations for . From Mathlib: the axioms, Kelly's identity, coherence for free monoidal categories, monoid objects in types, and monads as monoids. Not formalised here: strictification, the general cocycle identity for (proved above in prose), the construction of itself, and braided-but-not-symmetric examples.
Associahedra, cocycles and R-matrices
The first experiment builds the associahedra (bracketings and associator moves) for up to six objects, checks the cocycle condition for the carry cochains on for , and then tests coherence directly: for every grading of five simple objects in , all paths of associators between bracketings carry the same total twist — and for a naive twist, many gradings fail.
"""Pentagons, associahedra and a twisted associator.
Bracketings of n objects are the vertices of the associahedron; one
application of an associator (X Y) Z -> X (Y Z) inside a bracketing is an
edge. For n = 4 the graph is the pentagon. Mac Lane's coherence theorem says
that once the pentagon commutes, every diagram of associators commutes.
We test this in the category of Z/n-graded vector spaces with associator
twisted by a function w(a, b, c) in Z/n (the exponent of a root of unity).
The pentagon for simple objects is the 3-cocycle condition. For the carry
cochain w(a, b, c) = p * a * carry(b, c) it holds, and then every path
between two bracketings of five graded objects has the same total twist;
for a naive guess it fails, and so does path-independence. Exact integer
arithmetic; exhaustive over the finite ranges stated.
"""
import itertools
def bracketings(leaves):
"""All full bracketings of a tuple of leaves, as nested pairs."""
if len(leaves) == 1:
return [leaves[0]]
out = []
for k in range(1, len(leaves)):
for left in bracketings(leaves[:k]):
for right in bracketings(leaves[k:]):
out.append((left, right))
return out
def moves(tree):
"""All (result, (x, y, z)) for one associator ((x y) z) -> (x (y z))."""
out = []
if isinstance(tree, tuple):
left, right = tree
if isinstance(left, tuple):
x, y = left
out.append(((x, (y, right)), (x, y, right)))
out += [((new, right), xyz) for new, xyz in moves(left)]
out += [((left, new), xyz) for new, xyz in moves(right)]
return out
def associahedron(n):
"""(number of vertices, number of edges) for bracketings of n objects."""
trees = bracketings(tuple(range(n)))
edges = sum(len(moves(t)) for t in trees)
return len(trees), edges
def carry(b, c, n):
"""1 if b + c wraps around modulo n, else 0."""
return 1 if b + c >= n else 0
def carry_cochain(p, n):
"""The cochain w(a, b, c) = p * a * carry(b, c) mod n."""
return lambda a, b, c: p * a * carry(b, c, n) % n
def naive_cochain(n):
"""A wrong guess: twist by the carry of the first two indices."""
return lambda a, b, c: carry(a, b, n)
def cocycle_failures(w, n):
"""Quadruples (a, b, c, d) where the pentagon (cocycle) condition fails."""
bad = []
for a, b, c, d in itertools.product(range(n), repeat=4):
lhs = w(b, c, d) + w(a, (b + c) % n, d) + w(a, b, c)
rhs = w((a + b) % n, c, d) + w(a, b, (c + d) % n)
if (lhs - rhs) % n:
bad.append((a, b, c, d))
return bad
def path_independent(w, grades, n):
"""True if all associator paths between bracketings carry the same twist.
The twist of a move ((x y) z) -> (x (y z)) is w(deg x, deg y, deg z);
going backwards along a move contributes minus that twist. Leaves are
tagged with their position, and grades[i] is the grade of leaf i. We
try to assign each bracketing a "potential" consistent with every edge.
"""
trees = bracketings(tuple(range(len(grades))))
def deg(t):
if isinstance(t, tuple):
return (deg(t[0]) + deg(t[1])) % n
return grades[t] % n
neighbours = {t: [] for t in trees}
for tree in trees:
for new, (x, y, z) in moves(tree):
twist = w(deg(x), deg(y), deg(z))
neighbours[tree].append((new, twist))
neighbours[new].append((tree, -twist))
potential = {trees[0]: 0}
frontier = [trees[0]]
while frontier:
tree = frontier.pop()
for new, twist in neighbours[tree]:
value = (potential[tree] + twist) % n
if new not in potential:
potential[new] = value
frontier.append(new)
elif potential[new] != value:
return False
return len(potential) == len(trees)
def main():
print("Associahedra: bracketings (vertices) and associator moves (edges)")
for n in range(2, 7):
v, e = associahedron(n)
print(f" {n} objects: {v:3d} bracketings, {e:3d} moves")
print("Pentagon = 3-cocycle condition for w(a,b,c) = p*a*carry(b,c) mod n")
for n in range(2, 7):
bad = sum(len(cocycle_failures(carry_cochain(p, n), n))
for p in range(n))
print(f" Z/{n}: all {n} values of p, {n ** 4} quadruples each: "
f"{bad} failures")
naive = cocycle_failures(naive_cochain(3), 3)
print(f" naive w(a,b,c) = carry(a,b) on Z/3: {len(naive)} failures, "
f"first {naive[0]}")
print("Coherence: all paths in the associahedron for 5 graded objects")
grades = list(itertools.product(range(3), repeat=5))
good = sum(path_independent(carry_cochain(1, 3), g, 3) for g in grades)
bad = sum(path_independent(naive_cochain(3), g, 3) for g in grades)
print(f" carry cochain, p = 1: {good} of {len(grades)} gradings "
"path-independent")
print(f" naive cochain: {bad} of {len(grades)} gradings "
"path-independent")
print()
print("Epistemic status: exact, exhaustive checks over the finite ranges "
"shown.\nThey illustrate Mac Lane's coherence theorem (pentagon => "
"all diagrams\ncommute) in one family of examples; the theorem "
"itself, and the cocycle\nidentity for every n, are proved in the "
"lesson, not here.")
if __name__ == "__main__":
main()The second experiment checks, symbolically in , that the R-matrix satisfies the braid relation and the Hecke relation, and squares to the identity only for .
"""A braiding that is not symmetric: the R-matrix of the quantum group.
On V = C^2 (basis e1, e2) take the 4 x 4 matrix acting on V (x) V
R(q) = [[q, 0, 0, 0], [0, 0, 1, 0], [0, 1, q - 1/q, 0], [0, 0, 0, q]].
Up to a scalar it is the braiding c_{V,V} of the category of representations
of the quantum group U_q(sl_2). At q = 1 it is the swap of tensor factors,
the symmetric braiding of vector spaces. SymPy checks, with q a symbol:
* the braid (Yang-Baxter) relation on V (x) V (x) V, which every braiding in a
braided monoidal category satisfies;
* the Hecke relation (R - q)(R + 1/q) = 0;
* that R^2 = 1 exactly when q^2 = 1, so for other q braiding twice is not the
identity: the category is braided but not symmetric.
"""
import sympy
Q = sympy.symbols("q", nonzero=True)
def r_matrix(q):
"""The braiding matrix R(q) on V (x) V, basis e11, e12, e21, e22."""
return sympy.Matrix([[q, 0, 0, 0],
[0, 0, 1, 0],
[0, 1, q - sympy.Integer(1) / q, 0],
[0, 0, 0, q]])
def swap():
"""The symmetric braiding of vector spaces: v (x) w -> w (x) v."""
return sympy.Matrix([[1, 0, 0, 0],
[0, 0, 1, 0],
[0, 1, 0, 0],
[0, 0, 0, 1]])
def on_first_two(m):
"""m (x) id_V acting on V (x) V (x) V."""
return sympy.kronecker_product(m, sympy.eye(2))
def on_last_two(m):
"""id_V (x) m acting on V (x) V (x) V."""
return sympy.kronecker_product(sympy.eye(2), m)
def braid_defect(m):
"""(m1 m2 m1 - m2 m1 m2), simplified, for m1 = m (x) 1, m2 = 1 (x) m."""
a, b = on_first_two(m), on_last_two(m)
return sympy.simplify(a * b * a - b * a * b)
def hecke_defect(m, q):
"""(m - q)(m + 1/q), simplified."""
eye = sympy.eye(m.shape[0])
return sympy.simplify((m - q * eye) * (m + eye / q))
def square_minus_identity(m):
"""m^2 - 1, simplified."""
return sympy.simplify(m * m - sympy.eye(m.shape[0]))
def main():
r = r_matrix(Q)
print("R(q) on V (x) V, basis e1e1, e1e2, e2e1, e2e2:")
for row in r.tolist():
print(" " + " ".join(f"{str(x):>7}" for x in row))
print(f"R(1) is the swap of tensor factors: "
f"{r_matrix(1) == swap()}")
zero8 = sympy.zeros(8, 8)
print(f"braid relation R1 R2 R1 = R2 R1 R2 (8 x 8): "
f"{braid_defect(r) == zero8}")
print(f"Hecke relation (R - q)(R + 1/q) = 0: "
f"{hecke_defect(r, Q) == sympy.zeros(4, 4)}")
diff = square_minus_identity(r)
print(f"R^2 - 1 = (q - 1/q) R: "
f"{sympy.simplify(diff - (Q - 1 / Q) * r) == sympy.zeros(4, 4)}")
roots = sympy.solve([x for x in diff if x != 0], Q, dict=True)
print(f"values of q with R^2 = 1: "
f"{sorted(s[Q] for s in roots)}")
r2 = r_matrix(sympy.Integer(2))
print(f"q = 2: R^2 = 1? {square_minus_identity(r2) == sympy.zeros(4, 4)}"
f"; braid relation? {braid_defect(r2) == zero8}")
print()
print("Epistemic status: exact symbolic verification of matrix "
"identities, as\nreliable as SymPy's simplification of rational "
"functions of q. It checks\nconsequences of the braiding axioms on "
"one representation; that these\nmatrices come from a braided "
"monoidal category (Drinfeld, Jimbo) is a\ntheorem cited in the "
"lesson, not proved here.")
if __name__ == "__main__":
main()Exercises
1. Monoidal categories
Warm-upHumanIn the monoidal category whose tensor product is disjoint union, what must the unit object be (up to isomorphism)?
2. Monoidal categories
Warm-upHumanHow many different full bracketings are there of the word (keeping the order of the letters)? These are the vertices of the 3-dimensional associahedron.
3. Monoidal categories
CoreHumanThe proof that is commutative uses that and commute, for . Which fact gives this?
4. Monoidal categories
CoreHumanWhat is a monoid object in ?
5. Monoidal categories
CoreHumanWhich of these braided monoidal categories is not symmetric?
6. Monoidal categories
StretchHumanA monoid object in is a monoid together with a multiplication and unit that are monoid homomorphisms. What can you conclude?
7. Monoidal categories
CoreFormalWhich Lean statement (in Mathlib's notation, ≫ = composition in diagrammatic order) formalises " is commutative"?
8. Monoidal categories
StretchComputationalAn associator on -graded vector spaces is given by exponents of . Write is_cocycle(w, n) that returns True exactly when the pentagon (3-cocycle) condition
holds for all (sums of grades taken mod ).
Common misconceptions
Misconception
"Every braided monoidal category is symmetric." A braiding need not square to the identity. In the braid category because ; in at generic the R-matrix satisfies . Symmetric is a property; braided is extra structure, and a monoidal category may carry several braidings.
Misconception
"The monoidal product is the cartesian product." in , or is not a product: there are no natural projections and no natural diagonal (copying would give — the linear-algebra core of the quantum no-cloning theorem). Cartesian monoidal categories are a special case, characterised by natural diagonals and projections.
Misconception
"Coherence means every diagram commutes." Only formal diagrams built from commute. If two different formal expressions happen to evaluate to the same object (e.g. ), the canonical maps between them may differ: the symmetry of is not the identity.
Misconception
"By strictification we may always assume the associator is the identity and the category is skeletal." Every monoidal category is equivalent to a strict one, but not always to one that is both strict and skeletal: an observation of Isbell (discussed in Mac Lane's book) shows that the skeleton of cannot be made strict. Likewise in with the associator cannot be made the identity while keeping one object per isomorphism class: a strict model needs many isomorphic copies of each simple object.
Viewpoints
Topology— Loops, configuration spaces and E_n
Eckmann and Hilton found their argument for homotopy groups: for , has two composition laws (concatenate in the first or the second coordinate of ) satisfying interchange, so is abelian, while need not be. The same mechanism stratifies monoidal structures: a monoidal category is an "-algebra" in categories (objects can be multiplied along a line), a braided monoidal category an -algebra (in the plane, where points can circle each other), and for an -structure on a 1-category is just a symmetric monoidal structure. The braid group is the fundamental group of the space of unordered distinct points in (Fox–Neuwirth 1962); in that fundamental group is the symmetric group , because a double exchange can be undone in three dimensions. This is the topological reason why braidings are "2-dimensional" and symmetries "3-dimensional and up" (see the fundamental group and homotopy theory).
Geometry— String diagrams and knot invariants
Joyal and Street (1991) proved that string diagrams are a sound and complete calculus: an equation between morphisms of the free monoidal category on a set of generating boxes holds if and only if the corresponding planar diagrams are isotopic (in the plane, keeping endpoints fixed). For braided categories the diagrams live in 3-dimensional space and isotopy is of braids and tangles; for symmetric categories strings may pass through each other. Adding duals and a twist gives ribbon categories, whose diagrams are framed tangles; Reshetikhin and Turaev (1990) turned this into invariants of framed links and 3-manifolds from quantum groups — the Jones polynomial arises from the R-matrix of in the second experiment (see knot theory and low-dimensional topology).
Physics— Composite systems, no-cloning and anyons
In quantum mechanics the state space of a composite system is , and entangled states are exactly the elements that are not pure tensors — a phenomenon impossible in a cartesian category, where every map into is a pair. Abramsky and Coecke (2004) recast quantum protocols such as teleportation as calculations in symmetric monoidal categories with duals, drawn with string diagrams (see quantum mechanics). Exchange statistics are a braiding: in three spatial dimensions exchanging two identical particles twice is trivial, giving bosons and fermions (the symmetric case, with the sign rule of super vector spaces for fermions); in two spatial dimensions it need not be, and quasiparticles called anyons are described by braided (modular) tensor categories (Leinaas and Myrheim 1977; Wilczek 1982). Kitaev (2003) proposed using non-abelian anyons for fault-tolerant quantum computation.
Algebra— Cohomology, Hopf algebras and Tannaka duality
The associators on -graded vector spaces with are classified by , so group cohomology measures exactly how non-associative (up to coherent isomorphism) such a category can be; braidings on them are classified by Eilenberg–Mac Lane's abelian cohomology. For an algebra , monoidal structures on compatible with the forgetful functor correspond to bialgebra structures, and braidings to R-matrices (Drinfeld). Conversely, Tannaka–Krein duality recovers a group from its symmetric monoidal category of representations with the forgetful functor; Deligne (2002) showed that, over an algebraically closed field of characteristic 0, symmetric tensor categories of moderate growth are representation categories of affine supergroups (see representation theory).
Category theory— One object, one dimension up
A monoidal category is a bicategory with one object: objects of become 1-cells, becomes composition of 1-cells, and morphisms become 2-cells. Iterating: a braided monoidal category is a tricategory with one object and one 1-cell, and the Eckmann–Hilton argument explains why one-object, one-1-cell 2-categories are commutative monoids. Monoidal categories are also the natural bases for enrichment: replacing hom-sets by hom-objects in a monoidal category gives additive categories, 2-categories and Lawvere's metric spaces (see enriched categories and higher categories).
History and global context
- Products of spaces, tensor products of modules and convolution of functions were used long before the axioms; the interchange law appeared in Beno Eckmann and Peter Hilton's work on group-like structures (1962), and the bracketings of a product were studied by Dov Tamari (1951) and, as cell complexes, by Jim Stasheff (1963) in his theory of -spaces.
- Jean Bénabou (1963, "catégories avec multiplication") and Saunders Mac Lane (1963, "Natural associativity and commutativity") introduced monoidal categories; Mac Lane proved the coherence theorem and found the pentagon and hexagon. G. Max Kelly (1964) showed that some of Mac Lane's axioms were redundant, and with Samuel Eilenberg developed closed categories (1966).
- André Joyal and Ross Street introduced braided monoidal categories (circulated 1986, published 1993) and the geometry of string diagrams (1991). Vladimir Drinfeld and Michio Jimbo introduced quantum groups (1985–86), and Nicolai Reshetikhin and Vladimir Turaev (1990–91) built link and 3-manifold invariants from their braided categories of representations, following Vaughan Jones's discovery of his polynomial (1984).
- Samson Abramsky and Bob Coecke (2004) began categorical quantum mechanics; Alexei Kitaev (2003) and Michael Freedman and collaborators connected braided categories to topological quantum computation.
Further reading
- Pavel Etingof, Shlomo Gelaki, Dmitri Nikshych and Victor Ostrik, Tensor Categories (2015) — the standard modern reference, Chapters 1–2 and 8.
- Saunders Mac Lane, Categories for the Working Mathematician (2nd edition, 1998), Chapters VII and XI — monoidal categories and coherence.
- André Joyal and Ross Street, "Braided tensor categories", Advances in Mathematics 102 (1993), and "The geometry of tensor calculus I", Advances in Mathematics 88 (1991).
- Christian Kassel, Quantum Groups (1995) — braided categories, R-matrices and knot invariants.
- Chris Heunen and Jamie Vicary, Categories for Quantum Theory (2019) — monoidal categories and string diagrams for physics.
- Emily Riehl, Category Theory in Context (2016), for the background on functors and adjunctions.