interchangetheoremProved here from basic factspropext, Classical.choice, Quot.sound
interchangeLean 4Proved here from basic factsFormally verified
/-- **The interchange law** in the 2-category of categories. For natural transformations`α : F ⟶ G`, `β : G ⟶ H` (between functors `C ⥤ D`) and `γ : I ⟶ J`, `δ : J ⟶ K` (betweenfunctors `D ⥤ E`), composing vertically first and then horizontally (`◫`) gives the sameresult as composing horizontally first and then vertically:`(α ≫ β) ◫ (γ ≫ δ) = (α ◫ γ) ≫ (β ◫ δ)`.Mathlib's horizontal composite has components `(α ◫ γ)_X = γ_{F X} ≫ J(α_X)`. At an object `X`the two sides differ only by the order of `δ_{F X}` and `J(α_X)`, and the naturality squareof `δ` at the morphism `α_X` swaps them. -/theorem interchange {C D E : Type*} [Category C] [Category D] [Category E] {F G H : C ⥤ D} {I J K : D ⥤ E} (α : F ⟶ G) (β : G ⟶ H) (γ : I ⟶ J) (δ : J ⟶ K) : (α ≫ β) ◫ (γ ≫ δ) = (α ◫ γ) ≫ (β ◫ δ) := by ext X simp only [NatTrans.hcomp_app, NatTrans.comp_app, Functor.map_comp, Category.assoc] -- Goal: γ ≫ δ_{FX} ≫ K(α_X) ≫ K(β_X) = γ ≫ J(α_X) ≫ δ_{GX} ≫ K(β_X) (γ at F X). -- Naturality of `δ` at `α_X : F X ⟶ G X`: `J(α_X) ≫ δ_{GX} = δ_{FX} ≫ K(α_X)`. rw [δ.naturality_assoc]
interchange_librarytheoremApplies a library theorempropext, Classical.choice, Quot.sound
interchange_libraryLean 4Applies a library theoremFormally verified
/-- The interchange law again, now by Mathlib's `CategoryTheory.NatTrans.exchange`(proved there by the automation `cat_disch`, which finds the same naturality argument). -/theorem interchange_library {C D E : Type*} [Category C] [Category D] [Category E] {F G H : C ⥤ D} {I J K : D ⥤ E} (α : F ⟶ G) (β : G ⟶ H) (γ : I ⟶ J) (δ : J ⟶ K) : (α ≫ β) ◫ (γ ≫ δ) = (α ◫ γ) ≫ (β ◫ δ) := NatTrans.exchange α β γ δ
cat_stricttheoremApplies a library theorempropext, Classical.choice, Quot.sound
cat_strictLean 4Applies a library theoremFormally verified
/-- Categories, functors and natural transformations form a **strict** 2-category: compositionof functors is associative and unital on the nose, so Mathlib's bicategory structure on `Cat`has associators and unitors that are identities (`eqToIso` of equalities). This is Mathlib'sinstance `CategoryTheory.Cat.bicategory.strict`. -/theorem cat_strict : Bicategory.Strict Cat.{0, 0} := inferInstance
units_coincidetheoremProved here from basic factsNo axioms
units_coincideLean 4Proved here from basic factsFormally verified
/-- If two binary operations each have a two-sided unit (`e₁` for `m₁`, `e₂` for `m₂`) andsatisfy the interchange law `m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)`, then the units areequal. Proof: put `a = d = e₂` and `b = c = e₁` in the interchange law; the left sidecollapses to `m₁ e₁ e₁ = e₁` and the right side to `m₂ e₂ e₂ = e₂`. -/theorem units_coincide {X : Type*} (m₁ m₂ : X → X → X) (e₁ e₂ : X) (h₁l : ∀ a, m₁ e₁ a = a) (h₁r : ∀ a, m₁ a e₁ = a) (h₂l : ∀ a, m₂ e₂ a = a) (h₂r : ∀ a, m₂ a e₂ = a) (interchange : ∀ a b c d, m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)) : e₁ = e₂ := calc e₁ = m₁ e₁ e₁ := (h₁l e₁).symm _ = m₁ (m₂ e₂ e₁) (m₂ e₁ e₂) := by rw [h₂l, h₂r] _ = m₂ (m₁ e₂ e₁) (m₁ e₁ e₂) := interchange e₂ e₁ e₁ e₂ _ = m₂ e₂ e₂ := by rw [h₁l, h₁r] _ = e₂ := h₂l e₂
eckmann_hiltontheoremProved here from basic factsNo axioms
eckmann_hiltonLean 4Proved here from basic factsFormally verified
/-- **The Eckmann–Hilton argument.** Two unital binary operations on the same set that satisfythe interchange law are equal, and the common operation is commutative. This is the algebrabehind "π₂ is abelian" and behind `endo_id_comm` below. The proof slides `a` and `b` past eachother using the units, exactly as in the lesson's picture of 2-cells moving around each otherin the plane. -/theorem eckmann_hilton {X : Type*} (m₁ m₂ : X → X → X) (e₁ e₂ : X) (h₁l : ∀ a, m₁ e₁ a = a) (h₁r : ∀ a, m₁ a e₁ = a) (h₂l : ∀ a, m₂ e₂ a = a) (h₂r : ∀ a, m₂ a e₂ = a) (interchange : ∀ a b c d, m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)) : (∀ a b, m₁ a b = m₂ a b) ∧ (∀ a b, m₂ a b = m₂ b a) := by have he : e₁ = e₂ := units_coincide m₁ m₂ e₁ e₂ h₁l h₁r h₂l h₂r interchange subst he have same : ∀ a b, m₁ a b = m₂ a b := fun 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 ⟨same, fun a b => ?_⟩ calc m₂ a b = m₁ a b := (same a b).symm _ = 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]
eckmann_hilton_librarytheoremApplies a library theorempropext, Quot.sound
eckmann_hilton_libraryLean 4Applies a library theoremFormally verified
/-- Mathlib's version: `EckmannHilton.mul_comm` (in `Mathlib.GroupTheory.EckmannHilton`), statedwith Mathlib's `EckmannHilton.IsUnital`. Mathlib uses it to prove that the higher homotopy groups`πₙ` with `n ≥ 2` are commutative. -/theorem eckmann_hilton_library {X : Type*} {m₁ m₂ : X → X → X} {e₁ e₂ : X} (h₁ : EckmannHilton.IsUnital m₁ e₁) (h₂ : EckmannHilton.IsUnital m₂ e₂) (interchange : ∀ a b c d, m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)) : ∀ a b, m₂ a b = m₂ b a := (EckmannHilton.mul_comm h₁ h₂ interchange).comm
endo_id_commtheoremProved here from basic factspropext, Classical.choice, Quot.sound
endo_id_commLean 4Proved here from basic factsFormally verified
/-- **2-endomorphisms of an identity 1-morphism commute**, in any bicategory: for 2-morphisms`η θ : 𝟙 a ⟶ 𝟙 a`, `η ≫ θ = θ ≫ η`. This is Eckmann–Hilton inside a bicategory. The two"operations" are vertical composition and horizontal composition (whiskering), and theinterchange law is Mathlib's axiom `whisker_exchange`. The unitors enter because `𝟙 a ≫ 𝟙 a` isonly isomorphic to `𝟙 a`; the key coherence fact is `λ_(𝟙 a) = ρ_(𝟙 a)` (`unitors_equal`). -/theorem endo_id_comm {B : Type*} [Bicategory B] {a : B} (η θ : 𝟙 a ⟶ 𝟙 a) : η ≫ θ = θ ≫ η := by -- Interchange for the two whiskerings of η and θ. have ex : 𝟙 a ◁ θ ≫ η ▷ 𝟙 a = η ▷ 𝟙 a ≫ 𝟙 a ◁ θ := whisker_exchange η θ -- Whiskering by an identity is conjugation by a unitor; for `𝟙 a` both unitors agree. rw [id_whiskerLeft, whiskerRight_id, unitors_equal, unitors_inv_equal] at ex -- Now ex : (ρ ≫ θ ≫ ρ⁻¹) ≫ (ρ ≫ η ≫ ρ⁻¹) = (ρ ≫ η ≫ ρ⁻¹) ≫ (ρ ≫ θ ≫ ρ⁻¹). simp only [Category.assoc, Iso.inv_hom_id_assoc, cancel_epi] at ex -- ex : θ ≫ η ≫ ρ⁻¹ = η ≫ θ ≫ ρ⁻¹; cancel the isomorphism ρ⁻¹ on the right. rw [← Category.assoc, ← Category.assoc, cancel_mono] at ex exact ex.symm
nat_trans_id_commtheoremApplies a library theorempropext, Classical.choice, Quot.sound
nat_trans_id_commLean 4Applies a library theoremFormally verified
/-- The special case of `endo_id_comm` in `Cat`: natural transformations from the identityfunctor of a category to itself commute. (Their monoid is sometimes called the *centre* of thecategory.) This applies Mathlib's `CategoryTheory.NatTrans.id_comm`. -/theorem nat_trans_id_comm {C : Type*} [Category C] (α β : 𝟭 C ⟶ 𝟭 C) : α ≫ β = β ≫ α := NatTrans.id_comm α β
free_bicategory_coherencetheoremApplies a library theorempropext, Classical.choice, Quot.sound
free_bicategory_coherenceLean 4Applies a library theoremFormally verified
/-- **Coherence for bicategories**, in the form Mathlib proves it: in the free bicategory on aquiver `B` (1-morphisms are formal composites of arrows of `B` and identities; 2-morphisms arebuilt from associators, unitors and their inverses only), any two parallel 2-morphisms areequal. So every "formal" diagram of associators and unitors commutes, in every bicategory. Thisapplies Mathlib's instance `CategoryTheory.FreeBicategory.locally_thin` (proved by normalisation,following Beylin and Dybjer). -/theorem free_bicategory_coherence {B : Type*} [Quiver B] {a b : FreeBicategory B} {f g : a ⟶ b} (η θ : f ⟶ g) : η = θ := Subsingleton.elim η θ
/-- **A bicategory with one object is a monoidal category**, one direction: the 1-morphisms`a ⟶ a` of any object `a` form a monoidal category whose tensor product is composition, whoseunit is `𝟙 a`, and whose associator and unitors are those of the bicategory. This is Mathlib'sinstance on `CategoryTheory.EndMonoidal`. -/abbrev endMonoidal {B : Type*} [Bicategory B] (a : B) : MonoidalCategory (a ⟶ a) := inferInstance
/-- The other direction: a monoidal category `C` becomes a bicategory `MonoidalSingleObj C` with asingle object `⋆`, objects of `C` as 1-morphisms and morphisms of `C` as 2-morphisms; and themonoidal category of endomorphisms of `⋆` is equivalent to `C` again. This is Mathlib's`CategoryTheory.MonoidalSingleObj.endMonoidalStarFunctorEquivalence`. -/noncomputable def singleObjEquiv (C : Type*) [Category C] [MonoidalCategory C] : EndMonoidal (MonoidalSingleObj.star C) ≌ C := MonoidalSingleObj.endMonoidalStarFunctorEquivalence C
/-- The first step of Eckmann–Hilton: two unital operations satisfying the interchange law havethe same unit. Hint: start a `calc` with `e₁ = m₁ e₁ e₁`, rewrite each `e₁` inside as a productin `m₂` (`e₁ = m₂ e₂ e₁` and `e₁ = m₂ e₁ e₂`), and apply `interchange e₂ e₁ e₁ e₂`. -/theorem units_coincide {X : Type*} (m₁ m₂ : X → X → X) (e₁ e₂ : X) (h₁l : ∀ a, m₁ e₁ a = a) (h₁r : ∀ a, m₁ a e₁ = a) (h₂l : ∀ a, m₂ e₂ a = a) (h₂r : ∀ a, m₂ a e₂ = a) (interchange : ∀ a b c d, m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)) : e₁ = e₂ := by sorry
Show the compiled solution
units_coincideLean 4Proved here from basic factsFormally verified
/-- If two binary operations each have a two-sided unit (`e₁` for `m₁`, `e₂` for `m₂`) andsatisfy the interchange law `m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)`, then the units areequal. Proof: put `a = d = e₂` and `b = c = e₁` in the interchange law; the left sidecollapses to `m₁ e₁ e₁ = e₁` and the right side to `m₂ e₂ e₂ = e₂`. -/theorem units_coincide {X : Type*} (m₁ m₂ : X → X → X) (e₁ e₂ : X) (h₁l : ∀ a, m₁ e₁ a = a) (h₁r : ∀ a, m₁ a e₁ = a) (h₂l : ∀ a, m₂ e₂ a = a) (h₂r : ∀ a, m₂ a e₂ = a) (interchange : ∀ a b c d, m₁ (m₂ a b) (m₂ c d) = m₂ (m₁ a c) (m₁ b d)) : e₁ = e₂ := calc e₁ = m₁ e₁ e₁ := (h₁l e₁).symm _ = m₁ (m₂ e₂ e₁) (m₂ e₁ e₂) := by rw [h₂l, h₂r] _ = m₂ (m₁ e₂ e₁) (m₁ e₁ e₂) := interchange e₂ e₁ e₁ e₂ _ = m₂ e₂ e₂ := by rw [h₁l, h₁r] _ = e₂ := h₂l e₂
/-- Natural transformations from the identity functor to itself commute. Hint: after `ext X`,the goal is `α.app X ≫ β.app X = β.app X ≫ α.app X` (up to unfolding); this is the naturalitysquare of `α` at the morphism `β.app X : X ⟶ X`, i.e. `α.naturality (β.app X)`. -/theorem nat_trans_id_comm {C : Type*} [Category C] (α β : 𝟭 C ⟶ 𝟭 C) : α ≫ β = β ≫ α := by sorry
Show the compiled solution
nat_trans_id_commLean 4Applies a library theoremFormally verified
/-- The special case of `endo_id_comm` in `Cat`: natural transformations from the identityfunctor of a category to itself commute. (Their monoid is sometimes called the *centre* of thecategory.) This applies Mathlib's `CategoryTheory.NatTrans.id_comm`. -/theorem nat_trans_id_comm {C : Type*} [Category C] (α β : 𝟭 C ⟶ 𝟭 C) : α ≫ β = β ≫ α := NatTrans.id_comm α β