A Lean Companion to Conceptual Mathematics

Session 19: Terminal objectsπŸ”—

Definition: Terminal object (p. 226)

In any category π’ž, an object T is a terminal object if and only if it has the property: for each object X in π’ž there is exactly one map from X to T.

See the earlier definition of terminal object on p. 213.

Theorem (p. 229)

Suppose that π’ž is any category and that both T_1 and T_2 are terminal objects in π’ž. Then T_1 and T_2 are isomorphic; i.e. there are maps {f : T_1 \rightarrow T_2}, {g : T_2 \rightarrow T_1} such that {g \circ f} is the identity of T_1 and {f \circ g} is the identity of T_2.

Proof (p. 229)

To show that T_1 and T_2 are isomorphic we need first of all a map {T_1 \rightarrow T_2}. Because T_2 is terminal there is a map {f : T_1 \rightarrow T_2}. We need a map {g : T_2 \rightarrow T_1}. Again there is one because T_1 is terminal. But this does not prove yet that T_1 is isomorphic to T_2. These two maps have to be proved to be inverse to each other. Because T_1 is terminal, there is only one map from T_1 to T_1. Therefore, {g \circ f = 1_{T_1}}. [Because T_2 is terminal, there is only one map from T_2 to T_2. Therefore, {f \circ g = 1_{T_2}}.]

We provided a proof of this theorem in Article IV using the mathlib API for terminal objects. We repeat that proof here, but this time using only the book definition.

theorem uniqueness_of_terminal_objects' {π’ž : Type u} [Category.{v, u} π’ž] {T₁ Tβ‚‚ : π’ž} (hT₁ : βˆ€ X : π’ž, (βˆƒ f : X ⟢ T₁, (βˆ€ f' : X ⟢ T₁, f = f'))) (hTβ‚‚ : βˆ€ X : π’ž, (βˆƒ f : X ⟢ Tβ‚‚, (βˆ€ f' : X ⟢ Tβ‚‚, f = f'))) : Nonempty (T₁ β‰… Tβ‚‚) := π’ž:Type uinst✝:Category.{v, u} π’žT₁:π’žTβ‚‚:π’žhT₁:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ T₁), f = f'hTβ‚‚:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ Tβ‚‚), f = f'⊒ Nonempty (T₁ β‰… Tβ‚‚) π’ž:Type uinst✝:Category.{v, u} π’žT₁:π’žTβ‚‚:π’žhT₁:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ T₁), f = f'hTβ‚‚:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ Tβ‚‚), f = f'f:T₁ ⟢ Tβ‚‚ := Classical.choose β‹―βŠ’ Nonempty (T₁ β‰… Tβ‚‚) π’ž:Type uinst✝:Category.{v, u} π’žT₁:π’žTβ‚‚:π’žhT₁:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ T₁), f = f'hTβ‚‚:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ Tβ‚‚), f = f'f:T₁ ⟢ Tβ‚‚ := Classical.choose β‹―g:Tβ‚‚ ⟢ T₁ := Classical.choose β‹―βŠ’ Nonempty (T₁ β‰… Tβ‚‚) have hgf : g ⊚ f = πŸ™ T₁ := π’ž:Type uinst✝:Category.{v, u} π’žT₁:π’žTβ‚‚:π’žhT₁:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ T₁), f = f'hTβ‚‚:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ Tβ‚‚), f = f'⊒ Nonempty (T₁ β‰… Tβ‚‚) π’ž:Type uinst✝:Category.{v, u} π’žT₁:π’žTβ‚‚:π’žhT₁:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ T₁), f = f'hTβ‚‚:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ Tβ‚‚), f = f'f:T₁ ⟢ Tβ‚‚ := Classical.choose β‹―g:Tβ‚‚ ⟢ T₁ := Classical.choose β‹―t₁:T₁ ⟢ T₁ht₁:βˆ€ (f' : T₁ ⟢ T₁), t₁ = f'⊒ g ⊚ f = πŸ™ T₁ All goals completed! πŸ™ have hfg : f ⊚ g = πŸ™ Tβ‚‚ := π’ž:Type uinst✝:Category.{v, u} π’žT₁:π’žTβ‚‚:π’žhT₁:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ T₁), f = f'hTβ‚‚:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ Tβ‚‚), f = f'⊒ Nonempty (T₁ β‰… Tβ‚‚) π’ž:Type uinst✝:Category.{v, u} π’žT₁:π’žTβ‚‚:π’žhT₁:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ T₁), f = f'hTβ‚‚:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ Tβ‚‚), f = f'f:T₁ ⟢ Tβ‚‚ := Classical.choose β‹―g:Tβ‚‚ ⟢ T₁ := Classical.choose β‹―hgf:g ⊚ f = πŸ™ T₁ := Exists.casesOn (hT₁ T₁) fun t₁ ht₁ ↦ Eq.mpr (id (congrArg (fun _a ↦ _a = πŸ™ T₁) (Eq.symm (ht₁ (g ⊚ f))))) (Eq.mpr (id (congrArg (fun _a ↦ t₁ = _a) (Eq.symm (ht₁ (πŸ™ T₁))))) (Eq.refl t₁))tβ‚‚:Tβ‚‚ ⟢ Tβ‚‚htβ‚‚:βˆ€ (f' : Tβ‚‚ ⟢ Tβ‚‚), tβ‚‚ = f'⊒ f ⊚ g = πŸ™ Tβ‚‚ All goals completed! πŸ™ π’ž:Type uinst✝:Category.{v, u} π’žT₁:π’žTβ‚‚:π’žhT₁:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ T₁), f = f'hTβ‚‚:βˆ€ (X : π’ž), βˆƒ f, βˆ€ (f' : X ⟢ Tβ‚‚), f = f'f:T₁ ⟢ Tβ‚‚ := Classical.choose β‹―g:Tβ‚‚ ⟢ T₁ := Classical.choose β‹―hgf:g ⊚ f = πŸ™ T₁ := Exists.casesOn (hT₁ T₁) fun t₁ ht₁ ↦ Eq.mpr (id (congrArg (fun _a ↦ _a = πŸ™ T₁) (Eq.symm (ht₁ (g ⊚ f))))) (Eq.mpr (id (congrArg (fun _a ↦ t₁ = _a) (Eq.symm (ht₁ (πŸ™ T₁))))) (Eq.refl t₁))hfg:f ⊚ g = πŸ™ Tβ‚‚ := Exists.casesOn (hTβ‚‚ Tβ‚‚) fun tβ‚‚ htβ‚‚ ↦ Eq.mpr (id (congrArg (fun _a ↦ _a = πŸ™ Tβ‚‚) (Eq.symm (htβ‚‚ (f ⊚ g))))) (Eq.mpr (id (congrArg (fun _a ↦ tβ‚‚ = _a) (Eq.symm (htβ‚‚ (πŸ™ Tβ‚‚))))) (Eq.refl tβ‚‚))⊒ T₁ β‰… Tβ‚‚ All goals completed! πŸ™