Skip to content

Commit 5dfc72f

Browse files
committed
feat(CategoryTheory/Products): generalize prod to CategoryStruct's (leanprover-community#31160)
This will allow us to recycle these lemmas when defining the product of bicategories. In doing this I have renamed the product category instance to `prod'` so that the simp lemmas (which are generated for the categorystruct version) get the names `prod_`. Fruthermore, I removed the manual specification of simp lemmas as it did not seem necessary (it generates the same list anyways). Note that the diff does not make it clear that `prod.hom_ext` `prod_id` and `prod_comp` have been generalized.
1 parent d0082ef commit 5dfc72f

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

Mathlib/CategoryTheory/Products/Basic.lean

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄
3434

3535
section
3636

37-
variable (C : Type u₁) [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D]
37+
variable (C : Type u₁) [CategoryStruct.{v₁} C] (D : Type u₂) [CategoryStruct.{v₂} D]
3838

39-
-- the generates simp lemmas like `id_fst` and `comp_snd`
40-
/-- `prod C D` gives the Cartesian product of two categories. -/
41-
@[simps (notRecursive := []) Hom id_fst id_snd comp_fst comp_snd, stacks 001K]
42-
instance prod : Category.{max v₁ v₂} (C × D) where
39+
/-- `CategoryStruct.prod C D` gives the Cartesian product of two `CategoryStruct`'s. -/
40+
@[simps (notRecursive := [])] -- notRecursive to generate simp lemmas like `id_fst` and `comp_snd`
41+
instance prod : CategoryStruct.{max v₁ v₂} (C × D) where
4342
Hom X Y := (X.1 ⟶ Y.1) × (X.2 ⟶ Y.2)
4443
id X := ⟨𝟙 X.1, 𝟙 X.2
4544
comp f g := (f.1 ≫ g.1, f.2 ≫ g.2)
@@ -72,6 +71,17 @@ abbrev mkHom {X₁ X₂ : C} {Y₁ Y₂ : D} (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y
7271
scoped infixr:70 " ×ₘ " => Prod.mkHom
7372

7473
end Prod
74+
75+
end
76+
77+
section
78+
79+
variable (C : Type u₁) [Category.{v₁} C] (D : Type u₂) [Category.{v₂} D]
80+
81+
/-- `prod C D` gives the Cartesian product of two categories. -/
82+
@[stacks 001K]
83+
instance prod' : Category.{max v₁ v₂} (C × D) where
84+
7585
theorem isIso_prod_iff {P Q : C} {S T : D} {f : (P, S) ⟶ (Q, T)} :
7686
IsIso f ↔ IsIso f.1 ∧ IsIso f.2 := by
7787
constructor
@@ -113,7 +123,7 @@ variable (C : Type u₁) [Category.{v₁} C] (D : Type u₁) [Category.{v₁} D]
113123
universe levels. This helps typeclass resolution.
114124
-/
115125
instance uniformProd : Category (C × D) :=
116-
CategoryTheory.prod C D
126+
CategoryTheory.prod' C D
117127

118128
end
119129

Mathlib/CategoryTheory/Yoneda.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,10 @@ variable (C)
455455

456456
-- We need to help typeclass inference with some awkward universe levels here.
457457
instance prodCategoryInstance1 : Category ((Cᵒᵖ ⥤ Type v₁) × Cᵒᵖ) :=
458-
CategoryTheory.prod.{max u₁ v₁, v₁} (Cᵒᵖ ⥤ Type v₁) Cᵒᵖ
458+
CategoryTheory.prod'.{max u₁ v₁, v₁} (Cᵒᵖ ⥤ Type v₁) Cᵒᵖ
459459

460460
instance prodCategoryInstance2 : Category (Cᵒᵖ × (Cᵒᵖ ⥤ Type v₁)) :=
461-
CategoryTheory.prod.{v₁, max u₁ v₁} Cᵒᵖ (Cᵒᵖ ⥤ Type v₁)
461+
CategoryTheory.prod'.{v₁, max u₁ v₁} Cᵒᵖ (Cᵒᵖ ⥤ Type v₁)
462462

463463
open Yoneda
464464

0 commit comments

Comments
 (0)