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

Commit ce105fd

Browse files
urkudmergify[bot]
authored andcommitted
chore(algebra/group): rename as_monoid_hom into monoid_hom.of, define ring_hom.of (#1443)
* chore(algebra/group): rename `as_monoid_hom` into `monoid_hom.of` This is similar to `Mon.of` etc. * Fix compile * Docs, missing universe * Move variables declaration up as suggested by @jcommelin * doc-string
1 parent d910283 commit ce105fd

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

src/algebra/associated.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ by rcases h with ⟨y, rfl⟩; exact is_unit_unit (units.map f y)
2222

2323
lemma is_unit.map' [monoid α] [monoid β] (f : α → β) {x : α} (h : is_unit x) [is_monoid_hom f] :
2424
is_unit (f x) :=
25-
h.map (as_monoid_hom f)
25+
h.map (monoid_hom.of f)
2626

2727
@[simp] theorem is_unit_zero_iff [semiring α] : is_unit (0 : α) ↔ (0:α) = 1 :=
2828
⟨λ ⟨⟨_, a, (a0 : 0 * a = 1), _⟩, rfl⟩, by rwa zero_mul at a0,

src/algebra/group/hom.lean

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -246,23 +246,22 @@ infixr ` →* `:25 := monoid_hom
246246
instance {M : Type*} {N : Type*} [monoid M] [monoid N] : has_coe_to_fun (M →* N) :=
247247
⟨_, monoid_hom.to_fun⟩
248248

249-
/-- Reinterpret a map `f : M → N` as a homomorphism `M →* N` -/
250-
@[to_additive as_add_monoid_hom]
251-
def as_monoid_hom {M : Type u} {N : Type v} [monoid M] [monoid N]
252-
(f : M → N) [h : is_monoid_hom f] : M →* N :=
249+
250+
namespace monoid_hom
251+
variables {M : Type*} {N : Type*} {P : Type*} [monoid M] [monoid N] [monoid P]
252+
variables {G : Type*} {H : Type*} [group G] [comm_group H]
253+
254+
/-- Interpret a map `f : M → N` as a homomorphism `M →* N`. -/
255+
@[to_additive "Interpret a map `f : M → N` as a homomorphism `M →+ N`."]
256+
def of (f : M → N) [h : is_monoid_hom f] : M →* N :=
253257
{ to_fun := f,
254258
map_one' := h.2,
255259
map_mul' := h.1.1 }
256260

257-
@[simp, to_additive coe_as_add_monoid_hom]
258-
lemma coe_as_monoid_hom {M : Type u} {N : Type v} [monoid M] [monoid N]
259-
(f : M → N) [is_monoid_hom f] : ⇑ (as_monoid_hom f) = f :=
261+
@[simp, to_additive]
262+
lemma coe_of (f : M → N) [is_monoid_hom f] : ⇑ (monoid_hom.of f) = f :=
260263
rfl
261264

262-
namespace monoid_hom
263-
variables {M : Type*} {N : Type*} {P : Type*} [monoid M] [monoid N] [monoid P]
264-
variables {G : Type*} {H : Type*} [group G] [comm_group H]
265-
266265
@[extensionality, to_additive]
267266
lemma ext ⦃f g : M →* N⦄ (h : (f : M → N) = g) : f = g :=
268267
by cases f; cases g; cases h; refl

src/algebra/group/units_hom.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ monoid_hom.mk'
1919
by rw [← f.map_mul, u.inv_val, f.map_one]⟩)
2020
(λ x y, ext (f.map_mul x y))
2121

22+
/-- The group homomorphism on units induced by a multiplicative morphism. -/
2223
@[reducible] def map' (f : α → β) [is_monoid_hom f] : units α →* units β :=
23-
map (as_monoid_hom f)
24+
map (monoid_hom.of f)
2425

2526
@[simp] lemma coe_map (f : α →* β) (x : units α) : ↑(map f x) = f x := rfl
2627

src/algebra/ring.lean

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,16 @@ instance {α : Type*} {β : Type*} [semiring α] [semiring β] : has_coe (α →
322322

323323
namespace ring_hom
324324

325-
/-- Construct a bundled `ring_hom` from a bare function and the appropriate typeclasses. -/
326-
def of {α : Type u} {β : Type v} [semiring α] [semiring β]
327-
(f : α → β) [is_semiring_hom f] : α →+* β :=
325+
variables {β : Type v} {γ : Type w} [semiring α] [semiring β] [semiring γ]
326+
327+
/-- Interpret `f : α → β` with `is_semiring_hom f` as a ring homomorphism. -/
328+
def of (f : α → β) [is_semiring_hom f] : α →+* β :=
328329
{ to_fun := f,
329-
.. as_monoid_hom f,
330-
.. as_add_monoid_hom f }
330+
.. monoid_hom.of f,
331+
.. add_monoid_hom.of f }
331332

332-
@[simp] lemma coe_of {α : Type u} {β : Type v} [semiring α] [semiring β]
333-
(f : α → β) [is_semiring_hom f] : ⇑(of f) = f := rfl
333+
@[simp] lemma coe_of (f : α → β) [is_semiring_hom f] : ⇑(of f) = f := rfl
334334

335-
variables {β : Type v} {γ : Type w} [semiring α] [semiring β] [semiring γ]
336335
variables (f : α →+* β) {x y : α}
337336

338337
@[extensionality] theorem ext ⦃f g : α →+* β⦄ (h : (f : α → β) = g) : f = g :=

0 commit comments

Comments
 (0)