@@ -79,35 +79,35 @@ instance [comm_semigroup α] : comm_monoid (with_one α) :=
79
79
{ mul_comm := (option.lift_or_get_comm _).1 ,
80
80
..with_one.monoid }
81
81
82
+ /-- `coe` as a bundled morphism -/
83
+ @[simps apply, to_additive " `coe` as a bundled morphism" ]
84
+ def coe_mul_hom [has_mul α] : mul_hom α (with_one α) :=
85
+ { to_fun := coe, map_mul' := λ x y, rfl }
86
+
82
87
section lift
83
88
84
89
variables [semigroup α] {β : Type v} [monoid β]
85
90
86
- /-- Lift a semigroup homomorphism `f` to a bundled monoid homorphism.
87
- We have no bundled semigroup homomorphisms, so this function
88
- takes `∀ x y, f (x * y) = f x * f y` as an explicit argument. -/
89
- @[to_additive " Lift an add_semigroup homomorphism `f` to a bundled add_monoid homorphism.
90
- We have no bundled add_semigroup homomorphisms, so this function
91
- takes `∀ x y, f (x + y) = f x + f y` as an explicit argument." ]
92
- def lift (f : α → β) (hf : ∀ x y, f (x * y) = f x * f y) :
93
- (with_one α) →* β :=
91
+ /-- Lift a semigroup homomorphism `f` to a bundled monoid homorphism. -/
92
+ @[to_additive " Lift an add_semigroup homomorphism `f` to a bundled add_monoid homorphism." ]
93
+ def lift (f : mul_hom α β) : (with_one α) →* β :=
94
94
{ to_fun := λ x, option.cases_on x 1 f,
95
95
map_one' := rfl,
96
96
map_mul' := λ x y,
97
97
with_one.cases_on x (by { rw one_mul, exact (one_mul _).symm }) $ λ x,
98
98
with_one.cases_on y (by { rw mul_one, exact (mul_one _).symm }) $ λ y,
99
- hf x y }
99
+ f.map_mul x y }
100
100
101
- variables (f : α → β) (hf : ∀ x y, f (x * y) = f x * f y )
101
+ variables (f : mul_hom α β )
102
102
103
103
@[simp, to_additive]
104
- lemma lift_coe (x : α) : lift f hf x = f x := rfl
104
+ lemma lift_coe (x : α) : lift f x = f x := rfl
105
105
106
106
@[simp, to_additive]
107
- lemma lift_one : lift f hf 1 = 1 := rfl
107
+ lemma lift_one : lift f 1 = 1 := rfl
108
108
109
109
@[to_additive]
110
- theorem lift_unique (f : with_one α →* β) : f = lift (f ∘ coe) (λ x y, f.map_mul x y ) :=
110
+ theorem lift_unique (f : with_one α →* β) : f = lift (f.to_mul_hom.comp coe_mul_hom ) :=
111
111
monoid_hom.ext $ λ x, with_one.cases_on x f.map_one $ λ x, rfl
112
112
113
113
end lift
@@ -120,9 +120,8 @@ variables {β : Type v} [semigroup α] [semigroup β]
120
120
from `with_one α` to `with_one β` -/
121
121
@[to_additive " Given an additive map from `α → β` returns an add_monoid homomorphism
122
122
from `with_zero α` to `with_zero β`" ]
123
- def map (f : α → β) (hf : ∀ x y, f (x * y) = f x * f y) :
124
- with_one α →* with_one β :=
125
- lift (coe ∘ f) (λ x y, coe_inj.2 $ hf x y)
123
+ def map (f : mul_hom α β) : with_one α →* with_one β :=
124
+ lift (coe_mul_hom.comp f)
126
125
127
126
end map
128
127
0 commit comments