Skip to content

Commit 50d5513

Browse files
committed
fix(Translate): unfold hcongr and congr_simp aux theorems (#37948)
This PR removes the need to tag automatically generated `hcongr` and `congr_simp` lemmas in `to_dual`.
1 parent 663c249 commit 50d5513

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Mathlib/CategoryTheory/Functor/Category.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def hcomp {H I : D ⥤ E} (α : F ⟶ G) (β : H ⟶ I) : F ⋙ H ⟶ G ⋙ I wh
113113

114114
-- Horizontal composition has two possible definitions that are dual to each other,
115115
-- and we need to prove to `to_dual` that these are equivalent.
116-
attribute [to_dual none] CategoryStruct.comp.hcongr_7 hcomp._proof_2 hcomp._proof_3
116+
attribute [to_dual none] hcomp._proof_2 hcomp._proof_3
117117
to_dual_insert_cast hcomp := by ext x; exact β.naturality' (α.app x)
118118

119119
/-- Notation for horizontal composition of natural transformations. -/

Mathlib/CategoryTheory/Iso.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ structure Iso {C : Type u} [Category.{v} C] (X Y : C) where
6363

6464
attribute [to_dual existing inv] Iso.hom
6565
attribute [to_dual self] Iso.mk Iso.casesOn
66-
attribute [to_dual none] Iso.mk.hcongr_8 -- needed in `Iso.ext`
6766

6867
attribute [reassoc +to_dual (attr := simp), grind =] Iso.hom_inv_id Iso.inv_hom_id
6968

Mathlib/CategoryTheory/Limits/Cones.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ structure CoconeMorphism (A B : Cocone F) where
244244
w (j : J) : dsimp% A.ι.app j ≫ hom = B.ι.app j := by cat_disch
245245

246246
attribute [reassoc (attr := simp)] ConeMorphism.w CoconeMorphism.w
247-
attribute [to_dual existing] ConeMorphism.mk.congr_simp ConeMorphism.casesOn
247+
attribute [to_dual existing] ConeMorphism.casesOn
248248

249249
@[to_dual]
250250
instance inhabitedConeMorphism (A : Cone F) : Inhabited (ConeMorphism A A) :=

Mathlib/Tactic/Translate/Core.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,13 +680,14 @@ def updateAndAddDecl (t : TranslateData) (tgt : Name) (srcDecl : ConstantInfo)
680680
{ex.toMessageData}"
681681
throwError "@[{t.attrName}] failed. Nested error message:\n{ex.toMessageData}"
682682

683-
/-- Unfold `simp` and `gcongr` auxlemmas in the type and value.
683+
/-- Unfold `simp`, `gcongr` and `hcongr`/`congr_simp` auxlemmas in the type and value.
684684
The reason why we can't just translate them is that they are generated by the `@[simp]` attribute,
685685
so it would require a change in the implementation of `@[simp]` to add these translations.
686686
Additionally, these lemmas have very short proofs, so unfolding them is not costly. -/
687687
def declUnfoldSimpAuxLemmas (decl : ConstantInfo) : MetaM ConstantInfo := do
688688
let unfold (e : Expr) := deltaExpand e (allowOpaque := true) fun
689-
| .str _ s => "_simp_".isPrefixOf s || "_gcongr_".isPrefixOf s
689+
| .str _ s => "_simp_".isPrefixOf s || "_gcongr_".isPrefixOf s ||
690+
isHCongrReservedNameSuffix s || s == congrSimpSuffix
690691
| _ => false
691692
let mut decl := decl
692693
decl := decl.updateType <| ← unfold decl.type

0 commit comments

Comments
 (0)