Products and Coproducts
Statement
In a category , the product of and is an object with projections , , universal in the sense that for any with morphisms , , there is a unique with and .
The coproduct (dual) has injections , , universal among cocones.
In : is Cartesian product, is disjoint union.
Visualization
Universal property of product in Set:
Product:
Z
/ | \
f | g
↙ ⟨f,g⟩ ↘
A ◀π₁ A×B π₂▶ B
Example: A = {0,1}, B = {red,blue}
A × B = {(0,red),(0,blue),(1,red),(1,blue)}
f : {*} → {0,1}, f(*) = 1
g : {*} → {red,blue}, g(*) = red
⟨f,g⟩(*) = (1, red) ✓ unique!
Coproduct:
A ──ι₁──▶ A ⊔ B ◀──ι₂── B
\ ↑ /
f [f,g] g
\ /
──────────▶ Z ◀──
A = {0,1}, B = {red,blue}
A ⊔ B = {inl 0, inl 1, inr red, inr blue} (disjoint union, 4 elements)
f : {0,1} → ℕ, f(0)=0, f(1)=1
g : {red,blue} → ℕ, g(red)=2, g(blue)=3
[f,g](inl 0)=0, [f,g](inl 1)=1, [f,g](inr red)=2, [f,g](inr blue)=3
Proof Sketch
-
Product in Set: Define with , . For any , , the map is the unique factorisation.
-
Coproduct in Set: Define (or use
Sumtype). Injections , . Copairing , . -
Uniqueness: Any morphism with and satisfies , so by universality.
-
Products and coproducts are adjoint to diagonal: has left adjoint and right adjoint .
Connections
Products and coproducts in the category of natural numbers (as a poset under divisibility) are LCM and GCD, connecting to Fundamental Theorem of ArithmeticFundamental Theorem of ArithmeticEvery integer greater than 1 has a unique prime factorizationRead more →. The isomorphism and underlies the Inclusion–Exclusion Principle in combinatorics.
Lean4 Proof
import Mathlib.CategoryTheory.Limits.Types.Products
open CategoryTheory CategoryTheory.Limits
/-- Binary products exist in Type u.
Derived from the general HasLimits instance. -/
theorem type_has_binary_products : HasBinaryProducts (Type 0) :=
inferInstance
/-- Binary coproducts exist in Type u. -/
theorem type_has_binary_coproducts : HasBinaryCoproducts (Type 0) :=
inferInstance
/-- The product in Type is the Cartesian product (Sum.inl / Sum.inr for coprod). -/
example (A B : Type) (a : A) (b : B) :
(prod.lift (C := Type) (fun _ : Unit => a) (fun _ : Unit => b)) () =
prod.lift (fun _ : Unit => a) (fun _ : Unit => b) () :=
rfl