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

Commit 12921e9

Browse files
committed
feat(tactic/simps): some improvements (#5541)
* `@[simps]` would previously fail if the definition is not a constructor application (with the suggestion to add option `{rhs_md := semireducible}` and maybe `simp_rhs := tt`). Now it automatically adds `{rhs_md := semireducible, simp_rhs := tt}` whenever it reaches this situation. * Remove all (now) unnecessary occurrences of `{rhs_md := semireducible}` from the library. There are still a couple left where the `simp_rhs := tt` is undesirable. * `@[simps {simp_rhs := tt}]` now also applies `dsimp, simp` to the right-hand side of the lemmas it generates. * Add some `@[simps]` in `category_theory/limits/cones.lean` * `@[simps]` would not recursively apply projections of `prod` or `pprod`. This is now customizable with the `not_recursive` option. * Add an option `trace.simps.debug` with some debugging information.
1 parent 78d5bd3 commit 12921e9

39 files changed

+218
-184
lines changed

src/algebra/category/Algebra/limits.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ begin
8888
refine is_limit.of_faithful
8989
(forget (Algebra R)) (types.limit_cone_is_limit _)
9090
(λ s, { .. }) (λ s, rfl),
91-
{ simp only [forget_map_eq_coe, alg_hom.map_one, functor.map_cone_π], refl, },
92-
{ intros x y, simp only [forget_map_eq_coe, alg_hom.map_mul, functor.map_cone_π], refl, },
93-
{ simp only [forget_map_eq_coe, alg_hom.map_zero, functor.map_cone_π], refl, },
94-
{ intros x y, simp only [forget_map_eq_coe, alg_hom.map_add, functor.map_cone_π], refl, },
91+
{ simp only [forget_map_eq_coe, alg_hom.map_one, functor.map_cone_π_app], refl, },
92+
{ intros x y, simp only [forget_map_eq_coe, alg_hom.map_mul, functor.map_cone_π_app], refl, },
93+
{ simp only [forget_map_eq_coe, alg_hom.map_zero, functor.map_cone_π_app], refl, },
94+
{ intros x y, simp only [forget_map_eq_coe, alg_hom.map_add, functor.map_cone_π_app], refl, },
9595
{ intros r, ext j, exact (s.π.app j).commutes r, },
9696
end
9797

src/algebra/category/Group/basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@ namespace category_theory.iso
198198

199199
/-- Build a `mul_equiv` from an isomorphism in the category `Group`. -/
200200
@[to_additive AddGroup_iso_to_add_equiv "Build an `add_equiv` from an isomorphism in the category
201-
`AddGroup`.", simps {rhs_md := semireducible}]
201+
`AddGroup`.", simps]
202202
def Group_iso_to_mul_equiv {X Y : Group} (i : X ≅ Y) : X ≃* Y :=
203203
i.hom.to_mul_equiv i.inv i.hom_inv_id i.inv_hom_id
204204

205205
/-- Build a `mul_equiv` from an isomorphism in the category `CommGroup`. -/
206206
@[to_additive AddCommGroup_iso_to_add_equiv "Build an `add_equiv` from an isomorphism
207-
in the category `AddCommGroup`.", simps {rhs_md := semireducible}]
207+
in the category `AddCommGroup`.", simps]
208208
def CommGroup_iso_to_mul_equiv {X Y : CommGroup} (i : X ≅ Y) : X ≃* Y :=
209209
i.hom.to_mul_equiv i.inv i.hom_inv_id i.inv_hom_id
210210

src/algebra/category/Group/limits.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ end
264264
The categorical kernel inclusion for `f : G ⟶ H`, as an object over `G`,
265265
agrees with the `subtype` map.
266266
-/
267-
@[simps {rhs_md:=semireducible}]
267+
@[simps]
268268
def kernel_iso_ker_over {G H : AddCommGroup.{u}} (f : G ⟶ H) :
269269
over.mk (kernel.ι f) ≅ @over.mk _ _ G (AddCommGroup.of f.ker) (add_subgroup.subtype f.ker) :=
270270
over.iso_mk (kernel_iso_ker f) (by simp)

src/algebraic_geometry/presheafed_space/has_colimits.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def colimit_cocone_is_colimit (F : J ⥤ PresheafedSpace C) : is_colimit (colimi
252252
have t : m.base = colimit.desc (F ⋙ PresheafedSpace.forget C) ((PresheafedSpace.forget C).map_cocone s),
253253
{ ext,
254254
dsimp,
255-
simp only [colimit.ι_desc_apply, map_cocone_ι],
255+
simp only [colimit.ι_desc_apply, map_cocone_ι_app],
256256
rw ← w j,
257257
simp, },
258258
fapply PresheafedSpace.ext, -- could `ext` please not reorder goals?

src/category_theory/Fintype.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ instance {X : Fintype} : fintype X := X.2
4040
instance : category Fintype := induced_category.category bundled.α
4141

4242
/-- The fully faithful embedding of `Fintype` into the category of types. -/
43-
@[derive [full, faithful], simps {rhs_md:=semireducible}]
43+
@[derive [full, faithful], simps]
4444
def incl : Fintype ⥤ Type* := induced_functor _
4545

4646
instance : concrete_category Fintype := ⟨incl⟩

src/category_theory/adjunction/basic.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def left_adjoint_of_equiv : C ⥤ D :=
351351

352352
/-- Show that the functor given by `left_adjoint_of_equiv` is indeed left adjoint to `G`. Dual
353353
to `adjunction_of_equiv_right`. -/
354-
@[simps {rhs_md := semireducible}]
354+
@[simps]
355355
def adjunction_of_equiv_left : left_adjoint_of_equiv e he ⊣ G :=
356356
mk_of_hom_equiv
357357
{ hom_equiv := e,
@@ -390,7 +390,7 @@ def right_adjoint_of_equiv : D ⥤ C :=
390390

391391
/-- Show that the functor given by `right_adjoint_of_equiv` is indeed right adjoint to `F`. Dual
392392
to `adjunction_of_equiv_left`. -/
393-
@[simps {rhs_md := semireducible}]
393+
@[simps]
394394
def adjunction_of_equiv_right : F ⊣ right_adjoint_of_equiv e he :=
395395
mk_of_hom_equiv
396396
{ hom_equiv := e,
@@ -419,7 +419,7 @@ def to_equivalence (adj : F ⊣ G) [∀ X, is_iso (adj.unit.app X)] [∀ Y, is_i
419419
If the unit and counit for the adjunction corresponding to a right adjoint functor are (pointwise)
420420
isomorphisms, then the functor is an equivalence of categories.
421421
-/
422-
@[simps {rhs_md := semireducible}]
422+
@[simps]
423423
def is_right_adjoint_to_is_equivalence [is_right_adjoint G]
424424
[∀ X, is_iso ((adjunction.of_right_adjoint G).unit.app X)]
425425
[∀ Y, is_iso ((adjunction.of_right_adjoint G).counit.app Y)] :

src/category_theory/currying.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def curry : ((C × D) ⥤ E) ⥤ (C ⥤ (D ⥤ E)) :=
8989
/--
9090
The equivalence of functor categories given by currying/uncurrying.
9191
-/
92-
@[simps {rhs_md := semireducible}] -- create projection simp lemmas even though this isn't a `{ .. }`.
92+
@[simps] -- create projection simp lemmas even though this isn't a `{ .. }`.
9393
def currying : (C ⥤ (D ⥤ E)) ≌ ((C × D) ⥤ E) :=
9494
equivalence.mk uncurry curry
9595
(nat_iso.of_components (λ F, nat_iso.of_components

src/category_theory/equivalence.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ by { dsimp [inv_fun_id_assoc], tidy }
272272
by { dsimp [inv_fun_id_assoc], tidy }
273273

274274
/-- If `C` is equivalent to `D`, then `C ⥤ E` is equivalent to `D ⥤ E`. -/
275-
@[simps functor inverse unit_iso counit_iso {rhs_md:=semireducible}]
275+
@[simps functor inverse unit_iso counit_iso]
276276
def congr_left (e : C ≌ D) : (C ⥤ E) ≌ (D ⥤ E) :=
277277
equivalence.mk
278278
((whiskering_left _ _ _).obj e.inverse)
@@ -281,7 +281,7 @@ equivalence.mk
281281
(nat_iso.of_components (λ F, e.inv_fun_id_assoc F) (by tidy))
282282

283283
/-- If `C` is equivalent to `D`, then `E ⥤ C` is equivalent to `E ⥤ D`. -/
284-
@[simps functor inverse unit_iso counit_iso {rhs_md:=semireducible}]
284+
@[simps functor inverse unit_iso counit_iso]
285285
def congr_right (e : C ≌ D) : (E ⥤ C) ≌ (E ⥤ D) :=
286286
equivalence.mk
287287
((whiskering_right _ _ _).obj e.functor)

src/category_theory/essential_image.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ lemma obj_mem_ess_image (F : D ⥤ C) (Y : D) : F.obj Y ∈ ess_image F := ⟨Y,
6868
instance : category F.ess_image := category_theory.full_subcategory _
6969

7070
/-- The essential image as a subcategory has a fully faithful inclusion into the target category. -/
71-
@[derive [full, faithful], simps {rhs_md := semireducible}]
71+
@[derive [full, faithful], simps]
7272
def ess_image_inclusion (F : C ⥤ D) : F.ess_image ⥤ D :=
7373
full_subcategory_inclusion _
7474

@@ -85,7 +85,7 @@ def to_ess_image (F : C ⥤ D) : C ⥤ F.ess_image :=
8585
The functor `F` factorises through its essential image, where the first functor is essentially
8686
surjective and the second is fully faithful.
8787
-/
88-
@[simps {rhs_md := semireducible}]
88+
@[simps]
8989
def to_ess_image_comp_essential_image_inclusion :
9090
F.to_ess_image ⋙ F.ess_image_inclusion ≅ F :=
9191
nat_iso.of_components (λ X, iso.refl _) (by tidy)

src/category_theory/limits/cones.lean

Lines changed: 28 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,17 @@ variables {J C} (F : J ⥤ C)
3030
natural transformations from the constant functor with value `X` to `F`.
3131
An object representing this functor is a limit of `F`.
3232
-/
33+
@[simps]
3334
def cones : Cᵒᵖ ⥤ Type v := (const J).op ⋙ (yoneda.obj F)
3435

35-
lemma cones_obj (X : Cᵒᵖ) : F.cones.obj X = ((const J).obj (unop X) ⟶ F) := rfl
36-
37-
@[simp] lemma cones_map_app {X₁ X₂ : Cᵒᵖ} (f : X₁ ⟶ X₂) (t : F.cones.obj X₁) (j : J) :
38-
(F.cones.map f t).app j = f.unop ≫ t.app j := rfl
39-
4036
/--
4137
`F.cocones` is the functor assigning to an object `X` the type of
4238
natural transformations from `F` to the constant functor with value `X`.
4339
An object corepresenting this functor is a colimit of `F`.
4440
-/
41+
@[simps]
4542
def cocones : C ⥤ Type v := const J ⋙ coyoneda.obj (op F)
4643

47-
lemma cocones_obj (X : C) : F.cocones.obj X = (F ⟶ (const J).obj X) := rfl
48-
49-
@[simp] lemma cocones_map_app {X₁ X₂ : C} (f : X₁ ⟶ X₂) (t : F.cocones.obj X₁) (j : J) :
50-
(F.cocones.map f t).app j = t.app j ≫ f := rfl
51-
5244
end functor
5345

5446
section
@@ -167,7 +159,7 @@ def equiv (F : J ⥤ C) : cocone F ≅ Σ X, F.cocones.obj X :=
167159
{ X := X,
168160
ι := c.extensions.app X f }
169161

170-
@[simp] lemma extend_ι (c : cocone F) {X : C} (f : c.X ⟶ X) :
162+
@[simp] lemma extend_ι (c : cocone F) {X : C} (f : c.X ⟶ X) :
171163
(extend c f).ι = c.extensions.app X f :=
172164
rfl
173165

@@ -280,17 +272,11 @@ def whiskering_equivalence {K : Type v} [small_category K] (e : K ≌ J) :
280272
The categories of cones over `F` and `G` are equivalent if `F` and `G` are naturally isomorphic
281273
(possibly after changing the indexing category by an equivalence).
282274
-/
275+
@[simps functor_obj]
283276
def equivalence_of_reindexing {K : Type v} [small_category K] {G : K ⥤ C}
284277
(e : K ≌ J) (α : e.functor ⋙ F ≅ G) : cone F ≌ cone G :=
285278
(whiskering_equivalence e).trans (postcompose_equivalence α)
286279

287-
@[simp]
288-
lemma equivalence_of_reindexing_functor_obj {K : Type v} [small_category K] {G : K ⥤ C}
289-
(e : K ≌ J) (α : e.functor ⋙ F ≅ G) (c : cone F) :
290-
(equivalence_of_reindexing e α).functor.obj c =
291-
(postcompose α.hom).obj (cone.whisker e.functor c) :=
292-
rfl
293-
294280
section
295281
variable (F)
296282

@@ -447,17 +433,11 @@ def whiskering_equivalence {K : Type v} [small_category K] (e : K ≌ J) :
447433
The categories of cocones over `F` and `G` are equivalent if `F` and `G` are naturally isomorphic
448434
(possibly after changing the indexing category by an equivalence).
449435
-/
436+
@[simps functor_obj]
450437
def equivalence_of_reindexing {K : Type v} [small_category K] {G : K ⥤ C}
451438
(e : K ≌ J) (α : e.functor ⋙ F ≅ G) : cocone F ≌ cocone G :=
452439
(whiskering_equivalence e).trans (precompose_equivalence α.symm)
453440

454-
@[simp]
455-
lemma equivalence_of_reindexing_functor_obj {K : Type v} [small_category K] {G : K ⥤ C}
456-
(e : K ≌ J) (α : e.functor ⋙ F ≅ G) (c : cocone F) :
457-
(equivalence_of_reindexing e α).functor.obj c =
458-
(precompose α.inv).obj (cocone.whisker e.functor c) :=
459-
rfl
460-
461441
section
462442
variable (F)
463443

@@ -535,25 +515,19 @@ variables {F : J ⥤ C} {G : J ⥤ C} (H : C ⥤ D)
535515
open category_theory.limits
536516

537517
/-- The image of a cone in C under a functor G : C ⥤ D is a cone in D. -/
518+
@[simps]
538519
def map_cone (c : cone F) : cone (F ⋙ H) := (cones.functoriality F H).obj c
539520
/-- The image of a cocone in C under a functor G : C ⥤ D is a cocone in D. -/
521+
@[simps]
540522
def map_cocone (c : cocone F) : cocone (F ⋙ H) := (cocones.functoriality F H).obj c
541523

542-
@[simp] lemma map_cone_X (c : cone F) : (H.map_cone c).X = H.obj c.X := rfl
543-
@[simp] lemma map_cocone_X (c : cocone F) : (H.map_cocone c).X = H.obj c.X := rfl
544-
545524
/-- Given a cone morphism `c ⟶ c'`, construct a cone morphism on the mapped cones functorially. -/
546525
def map_cone_morphism {c c' : cone F} (f : c ⟶ c') :
547526
H.map_cone c ⟶ H.map_cone c' := (cones.functoriality F H).map f
548527
/-- Given a cocone morphism `c ⟶ c'`, construct a cocone morphism on the mapped cocones functorially. -/
549528
def map_cocone_morphism {c c' : cocone F} (f : c ⟶ c') :
550529
H.map_cocone c ⟶ H.map_cocone c' := (cocones.functoriality F H).map f
551530

552-
@[simp] lemma map_cone_π (c : cone F) (j : J) :
553-
(map_cone H c).π.app j = H.map (c.π.app j) := rfl
554-
@[simp] lemma map_cocone_ι (c : cocone F) (j : J) :
555-
(map_cocone H c).ι.app j = H.map (c.ι.app j) := rfl
556-
557531
/-- If `H` is an equivalence, we invert `H.map_cone` and get a cone for `F` from a cone
558532
for `F ⋙ H`.-/
559533
def map_cone_inv [is_equivalence H]
@@ -587,7 +561,7 @@ def map_cocone_inv_map_cocone {F : J ⥤ D} (H : D ⥤ C) [is_equivalence H] (c
587561
(limits.cocones.functoriality_equivalence F (as_equivalence H)).unit_iso.symm.app c
588562

589563
/-- `functoriality F _ ⋙ postcompose (whisker_left F _)` simplifies to `functoriality F _`. -/
590-
@[simps {rhs_md:=semireducible}]
564+
@[simps]
591565
def functoriality_comp_postcompose {H H' : C ⥤ D} (α : H ≅ H') :
592566
cones.functoriality F H ⋙ cones.postcompose (whisker_left F α.hom) ≅ cones.functoriality F H' :=
593567
nat_iso.of_components (λ c, cones.ext (α.app _) (by tidy)) (by tidy)
@@ -597,7 +571,7 @@ For `F : J ⥤ C`, given a cone `c : cone F`, and a natural isomorphism `α : H
597571
`H H' : C ⥤ D`, the postcomposition of the cone `H.map_cone` using the isomorphism `α` is
598572
isomorphic to the cone `H'.map_cone`.
599573
-/
600-
@[simps {rhs_md:=semireducible}]
574+
@[simps]
601575
def postcompose_whisker_left_map_cone {H H' : C ⥤ D} (α : H ≅ H') (c : cone F) :
602576
(cones.postcompose (whisker_left F α.hom : _)).obj (H.map_cone c) ≅ H'.map_cone c :=
603577
(functoriality_comp_postcompose α).app c
@@ -607,7 +581,7 @@ def postcompose_whisker_left_map_cone {H H' : C ⥤ D} (α : H ≅ H') (c : cone
607581
natural transformation `α : F ⟶ G` and a functor `H : C ⥤ D`, we have two obvious ways of producing
608582
a cone over `G ⋙ H`, and they are both isomorphic.
609583
-/
610-
@[simps {rhs_md:=semireducible}]
584+
@[simps]
611585
def map_cone_postcompose {α : F ⟶ G} {c} :
612586
H.map_cone ((cones.postcompose α).obj c) ≅
613587
(cones.postcompose (whisker_right α H : _)).obj (H.map_cone c) :=
@@ -616,14 +590,14 @@ cones.ext (iso.refl _) (by tidy)
616590
/--
617591
`map_cone` commutes with `postcompose_equivalence`
618592
-/
619-
@[simps {rhs_md:=semireducible}]
593+
@[simps]
620594
def map_cone_postcompose_equivalence_functor {α : F ≅ G} {c} :
621595
H.map_cone ((cones.postcompose_equivalence α).functor.obj c) ≅
622596
(cones.postcompose_equivalence (iso_whisker_right α H : _)).functor.obj (H.map_cone c) :=
623597
cones.ext (iso.refl _) (by tidy)
624598

625599
/-- `functoriality F _ ⋙ precompose (whisker_left F _)` simplifies to `functoriality F _`. -/
626-
@[simps {rhs_md:=semireducible}]
600+
@[simps]
627601
def functoriality_comp_precompose {H H' : C ⥤ D} (α : H ≅ H') :
628602
cocones.functoriality F H ⋙ cocones.precompose (whisker_left F α.inv)
629603
≅ cocones.functoriality F H' :=
@@ -634,7 +608,7 @@ For `F : J ⥤ C`, given a cocone `c : cocone F`, and a natural isomorphism `α
634608
`H H' : C ⥤ D`, the precomposition of the cocone `H.map_cocone` using the isomorphism `α` is
635609
isomorphic to the cocone `H'.map_cocone`.
636610
-/
637-
@[simps {rhs_md:=semireducible}]
611+
@[simps]
638612
def precompose_whisker_left_map_cocone {H H' : C ⥤ D} (α : H ≅ H') (c : cocone F) :
639613
(cocones.precompose (whisker_left F α.inv : _)).obj (H.map_cocone c) ≅ H'.map_cocone c :=
640614
(functoriality_comp_precompose α).app c
@@ -644,7 +618,7 @@ def precompose_whisker_left_map_cocone {H H' : C ⥤ D} (α : H ≅ H') (c : coc
644618
`c : cocone F`, a natural transformation `α : F ⟶ G` and a functor `H : C ⥤ D`, we have two obvious
645619
ways of producing a cocone over `G ⋙ H`, and they are both isomorphic.
646620
-/
647-
@[simps {rhs_md:=semireducible}]
621+
@[simps]
648622
def map_cocone_precompose {α : F ⟶ G} {c} :
649623
H.map_cocone ((cocones.precompose α).obj c) ≅
650624
(cocones.precompose (whisker_right α H : _)).obj (H.map_cocone c) :=
@@ -653,7 +627,7 @@ cocones.ext (iso.refl _) (by tidy)
653627
/--
654628
`map_cocone` commutes with `precompose_equivalence`
655629
-/
656-
@[simps {rhs_md:=semireducible}]
630+
@[simps]
657631
def map_cocone_precompose_equivalence_functor {α : F ≅ G} {c} :
658632
H.map_cocone ((cocones.precompose_equivalence α).functor.obj c) ≅
659633
(cocones.precompose_equivalence (iso_whisker_right α H : _)).functor.obj (H.map_cocone c) :=
@@ -664,15 +638,15 @@ variables {K : Type v} [small_category K]
664638
/--
665639
`map_cone` commutes with `whisker`
666640
-/
667-
@[simps {rhs_md:=semireducible}]
641+
@[simps]
668642
def map_cone_whisker {E : K ⥤ J} {c : cone F} :
669643
H.map_cone (c.whisker E) ≅ (H.map_cone c).whisker E :=
670644
cones.ext (iso.refl _) (by tidy)
671645

672646
/--
673647
`map_cocone` commutes with `whisker`
674648
-/
675-
@[simps {rhs_md:=semireducible}]
649+
@[simps]
676650
def map_cocone_whisker {E : K ⥤ J} {c : cocone F} :
677651
H.map_cocone (c.whisker E) ≅ (H.map_cocone c).whisker E :=
678652
cocones.ext (iso.refl _) (by tidy)
@@ -762,25 +736,23 @@ variables {F : J ⥤ Cᵒᵖ}
762736
/-- Change a cocone on `F.left_op : Jᵒᵖ ⥤ C` to a cocone on `F : J ⥤ Cᵒᵖ`. -/
763737
-- Here and below we only automatically generate the `@[simp]` lemma for the `X` field,
764738
-- as we can write a simpler `rfl` lemma for the components of the natural transformation by hand.
765-
@[simps X] def cone_of_cocone_left_op (c : cocone F.left_op) : cone F :=
739+
@[simps {rhs_md := semireducible, simp_rhs := tt}]
740+
def cone_of_cocone_left_op (c : cocone F.left_op) : cone F :=
766741
{ X := op c.X,
767742
π := nat_trans.remove_left_op (c.ι ≫ (const.op_obj_unop (op c.X)).hom) }
768743

769-
@[simp] lemma cone_of_cocone_left_op_π_app (c : cocone F.left_op) (j) :
770-
(cone_of_cocone_left_op c).π.app j = (c.ι.app (op j)).op :=
771-
by { dsimp [cone_of_cocone_left_op], simp }
772-
773744
/-- Change a cone on `F : J ⥤ Cᵒᵖ` to a cocone on `F.left_op : Jᵒᵖ ⥤ C`. -/
774-
@[simps X] def cocone_left_op_of_cone (c : cone F) : cocone (F.left_op) :=
745+
@[simps {rhs_md := semireducible, simp_rhs := tt}]
746+
def cocone_left_op_of_cone (c : cone F) : cocone (F.left_op) :=
775747
{ X := unop c.X,
776748
ι := nat_trans.left_op c.π }
777749

778-
@[simp] lemma cocone_left_op_of_cone_ι_app (c : cone F) (j) :
779-
(cocone_left_op_of_cone c).ι.app j = (c.π.app (unop j)).unop :=
780-
by { dsimp [cocone_left_op_of_cone], simp }
781-
782750
/-- Change a cone on `F.left_op : Jᵒᵖ ⥤ C` to a cocone on `F : J ⥤ Cᵒᵖ`. -/
783-
@[simps X] def cocone_of_cone_left_op (c : cone F.left_op) : cocone F :=
751+
/- When trying use `@[simps]` to generate the `ι_app` field of this definition, `@[simps]` tries to
752+
reduce the RHS using `expr.dsimp` and `expr.simp`, but for some reason the expression is not
753+
being simplified properly. -/
754+
@[simps X]
755+
def cocone_of_cone_left_op (c : cone F.left_op) : cocone F :=
784756
{ X := op c.X,
785757
ι := nat_trans.remove_left_op ((const.op_obj_unop (op c.X)).hom ≫ c.π) }
786758

@@ -789,14 +761,11 @@ by { dsimp [cocone_left_op_of_cone], simp }
789761
by { dsimp [cocone_of_cone_left_op], simp }
790762

791763
/-- Change a cocone on `F : J ⥤ Cᵒᵖ` to a cone on `F.left_op : Jᵒᵖ ⥤ C`. -/
792-
@[simps X] def cone_left_op_of_cocone (c : cocone F) : cone (F.left_op) :=
764+
@[simps {rhs_md := semireducible, simp_rhs := tt}]
765+
def cone_left_op_of_cocone (c : cocone F) : cone (F.left_op) :=
793766
{ X := unop c.X,
794767
π := nat_trans.left_op c.ι }
795768

796-
@[simp] lemma cone_left_op_of_cocone_π_app (c : cocone F) (j) :
797-
(cone_left_op_of_cocone c).π.app j = (c.ι.app (unop j)).unop :=
798-
by { dsimp [cone_left_op_of_cocone], simp }
799-
800769
end
801770

802771
end category_theory.limits

0 commit comments

Comments
 (0)