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

Commit 121c9a4

Browse files
committed
chore(algebra/group/hom): use coe_comp in simp lemmas (#4780)
This way Lean will simplify `⇑(f.comp g)` even if it is not applied to an element.
1 parent 6e4fe98 commit 121c9a4

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/algebra/group/hom.lean

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,23 @@ add_decl_doc add_hom.comp
279279
/-- Composition of additive monoid morphisms as an additive monoid morphism. -/
280280
add_decl_doc add_monoid_hom.comp
281281

282-
@[simp, to_additive] lemma one_hom.comp_apply [has_one M] [has_one N] [has_one P]
282+
@[simp, to_additive] lemma one_hom.coe_comp [has_one M] [has_one N] [has_one P]
283+
(g : one_hom N P) (f : one_hom M N) :
284+
⇑(g.comp f) = g ∘ f := rfl
285+
@[simp, to_additive] lemma mul_hom.coe_comp [has_mul M] [has_mul N] [has_mul P]
286+
(g : mul_hom N P) (f : mul_hom M N) :
287+
⇑(g.comp f) = g ∘ f := rfl
288+
@[simp, to_additive] lemma monoid_hom.coe_comp [monoid M] [monoid N] [monoid P]
289+
(g : N →* P) (f : M →* N) :
290+
⇑(g.comp f) = g ∘ f := rfl
291+
292+
@[to_additive] lemma one_hom.comp_apply [has_one M] [has_one N] [has_one P]
283293
(g : one_hom N P) (f : one_hom M N) (x : M) :
284294
g.comp f x = g (f x) := rfl
285-
@[simp, to_additive] lemma mul_hom.comp_apply [has_mul M] [has_mul N] [has_mul P]
295+
@[to_additive] lemma mul_hom.comp_apply [has_mul M] [has_mul N] [has_mul P]
286296
(g : mul_hom N P) (f : mul_hom M N) (x : M) :
287297
g.comp f x = g (f x) := rfl
288-
@[simp, to_additive] lemma monoid_hom.comp_apply [monoid M] [monoid N] [monoid P]
298+
@[to_additive] lemma monoid_hom.comp_apply [monoid M] [monoid N] [monoid P]
289299
(g : N →* P) (f : M →* N) (x : M) :
290300
g.comp f x = g (f x) := rfl
291301

src/algebra/ring/basic.lean

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,11 @@ def mul_right {R : Type*} [semiring R] (r : R) : R →+ R :=
197197
map_zero' := zero_mul r,
198198
map_add' := λ _ _, add_mul _ _ r }
199199

200-
@[simp] lemma mul_right_apply {R : Type*} [semiring R] (a r : R) :
201-
(mul_right r : R → R) a = a * r := rfl
200+
@[simp] lemma coe_mul_right {R : Type*} [semiring R] (r : R) :
201+
⇑(mul_right r) = (* r) := rfl
202+
203+
lemma mul_right_apply {R : Type*} [semiring R] (a r : R) :
204+
mul_right r a = a * r := rfl
202205

203206
end add_monoid_hom
204207

0 commit comments

Comments
 (0)