Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 2efd242

Browse files
committed
chore(category_theory): simps should not add hom lemmas (#18742)
`@[simps]` should not be used to simplify the `hom` field of a category instance. Very little needs to be changed when removing it. However the problem in leanprover-community/mathlib4#3244 with a proof by `simp` failing seems to be implicated by this problem. If we remove the `@[simps]` generated lemma for `Hom` there, the original proof works (although is extremely slow). Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 3a2039a commit 2efd242

5 files changed

Lines changed: 15 additions & 6 deletions

File tree

src/category_theory/category/basic.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ extends quiver.{v+1} obj : Type (max u (v+1)) :=
8585
notation `𝟙` := category_struct.id -- type as \b1
8686
infixr ` ≫ `:80 := category_struct.comp -- type as \gg
8787

88+
initialize_simps_projections category_struct (-to_quiver_hom)
89+
8890
/--
8991
The typeclass `category C` describes morphisms associated to objects of type `C`.
9092
The universe levels of the objects and morphisms are unconstrained, and will often need to be
@@ -122,8 +124,8 @@ abbreviation small_category (C : Type u) : Type (u+1) := category.{u} C
122124
section
123125
variables {C : Type u} [category.{v} C] {X Y Z : C}
124126

125-
initialize_simps_projections category (to_category_struct_to_quiver_hom → hom,
126-
to_category_struct_comp → comp, to_category_struct_id → id, -to_category_struct)
127+
initialize_simps_projections category
128+
(to_category_struct_comp → comp, to_category_struct_id → id, -to_category_struct)
127129

128130
/-- postcompose an equation between morphisms by another morphism -/
129131
lemma eq_whisker {f g : X ⟶ Y} (w : f = g) (h : Y ⟶ Z) : f ≫ h = g ≫ h :=

src/category_theory/fin_category.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,14 @@ noncomputable def obj_as_type_equiv : obj_as_type α ≌ α :=
6060
/-- A fin_category `α` is equivalent to a fin_category with in `Type`. -/
6161
@[nolint unused_arguments] abbreviation as_type : Type := fin (fintype.card α)
6262

63-
@[simps hom id comp (lemmas_only)] noncomputable
63+
@[simps id comp (lemmas_only)] noncomputable
6464
instance category_as_type : small_category (as_type α) :=
6565
{ hom := λ i j, fin (fintype.card (@quiver.hom (obj_as_type α) _ i j)),
6666
id := λ i, fintype.equiv_fin _ (𝟙 i),
6767
comp := λ i j k f g, fintype.equiv_fin _
6868
((fintype.equiv_fin _).symm f ≫ (fintype.equiv_fin _).symm g) }
6969

70-
local attribute [simp] category_as_type_hom category_as_type_id
71-
category_as_type_comp
70+
local attribute [simp] category_as_type_id category_as_type_comp
7271

7372
/-- The "identity" functor from `as_type α` to `obj_as_type α`. -/
7473
@[simps] noncomputable def as_type_to_obj_as_type : as_type α ⥤ obj_as_type α :=

src/category_theory/groupoid.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ class groupoid (obj : Type u) extends category.{v} obj : Type (max u (v+1)) :=
4545
restate_axiom groupoid.inv_comp'
4646
restate_axiom groupoid.comp_inv'
4747

48+
49+
initialize_simps_projections groupoid (-to_category_to_category_struct_to_quiver_hom,
50+
to_category_to_category_struct_comp → comp, to_category_to_category_struct_id → id,
51+
-to_category_to_category_struct, -to_category)
52+
4853
/--
4954
A `large_groupoid` is a groupoid
5055
where the objects live in `Type (u+1)` while the morphisms live in `Type u`.

src/category_theory/monoidal/braided.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ class symmetric_category (C : Type u) [category.{v} C] [monoidal_category.{v} C]
221221
restate_axiom symmetric_category.symmetry'
222222
attribute [simp,reassoc] symmetric_category.symmetry
223223

224+
initialize_simps_projections symmetric_category
225+
(to_braided_category_braiding → braiding, -to_braided_category)
226+
224227
variables (C : Type u₁) [category.{v₁} C] [monoidal_category C] [braided_category C]
225228
variables (D : Type u₂) [category.{v₂} D] [monoidal_category D] [braided_category D]
226229
variables (E : Type u₃) [category.{v₃} E] [monoidal_category E] [braided_category E]

src/category_theory/sites/sheaf.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ instance : has_add (P ⟶ Q) :=
373373
instance : add_comm_group (P ⟶ Q) :=
374374
function.injective.add_comm_group (λ (f : Sheaf.hom P Q), f.1)
375375
(λ _ _ h, Sheaf.hom.ext _ _ h) rfl (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl)
376-
(λ _ _, by { dsimp at *, ext, simpa [*] }) (λ _ _, by { dsimp at *, ext, simpa [*] })
376+
(λ _ _, by { ext, simpa [*] }) (λ _ _, by { ext, simpa [*] })
377377

378378
instance : preadditive (Sheaf J A) :=
379379
{ hom_group := λ P Q, infer_instance,

0 commit comments

Comments
 (0)