@@ -4,8 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Mario Carneiro, Johan Commelin
5
5
-/
6
6
import order.with_bot
7
- import algebra.hom.equiv.basic
8
- import algebra.group_with_zero.units.basic
9
7
import algebra.ring.defs
10
8
11
9
/-!
@@ -134,103 +132,8 @@ instance [comm_semigroup α] : comm_monoid (with_one α) :=
134
132
{ mul_comm := (option.lift_or_get_comm _).1 ,
135
133
..with_one.monoid }
136
134
137
- section
138
- -- workaround: we make `with_one`/`with_zero` irreducible for this definition, otherwise `simps`
139
- -- will unfold it in the statement of the lemma it generates.
140
- local attribute [irreducible] with_one with_zero
141
- /-- `coe` as a bundled morphism -/
142
- @[to_additive " `coe` as a bundled morphism" , simps apply]
143
- def coe_mul_hom [has_mul α] : α →ₙ* (with_one α) :=
144
- { to_fun := coe, map_mul' := λ x y, rfl }
145
-
146
- end
147
-
148
- section lift
149
-
150
- variables [has_mul α] [mul_one_class β]
151
-
152
- /-- Lift a semigroup homomorphism `f` to a bundled monoid homorphism. -/
153
- @[to_additive " Lift an add_semigroup homomorphism `f` to a bundled add_monoid homorphism." ]
154
- def lift : (α →ₙ* β) ≃ (with_one α →* β) :=
155
- { to_fun := λ f,
156
- { to_fun := λ x, option.cases_on x 1 f,
157
- map_one' := rfl,
158
- map_mul' := λ x y,
159
- with_one.cases_on x (by { rw one_mul, exact (one_mul _).symm }) $ λ x,
160
- with_one.cases_on y (by { rw mul_one, exact (mul_one _).symm }) $ λ y,
161
- f.map_mul x y },
162
- inv_fun := λ F, F.to_mul_hom.comp coe_mul_hom,
163
- left_inv := λ f, mul_hom.ext $ λ x, rfl,
164
- right_inv := λ F, monoid_hom.ext $ λ x, with_one.cases_on x F.map_one.symm $ λ x, rfl }
165
-
166
- variables (f : α →ₙ* β)
167
-
168
- @[simp, to_additive]
169
- lemma lift_coe (x : α) : lift f x = f x := rfl
170
-
171
- @[simp, to_additive]
172
- lemma lift_one : lift f 1 = 1 := rfl
173
-
174
- @[to_additive]
175
- theorem lift_unique (f : with_one α →* β) : f = lift (f.to_mul_hom.comp coe_mul_hom) :=
176
- (lift.apply_symm_apply f).symm
177
-
178
- end lift
179
-
180
135
attribute [irreducible] with_one
181
136
182
- section map
183
-
184
- variables [has_mul α] [has_mul β] [has_mul γ]
185
-
186
- /-- Given a multiplicative map from `α → β` returns a monoid homomorphism
187
- from `with_one α` to `with_one β` -/
188
- @[to_additive " Given an additive map from `α → β` returns an add_monoid homomorphism
189
- from `with_zero α` to `with_zero β`" ]
190
- def map (f : α →ₙ* β) : with_one α →* with_one β :=
191
- lift (coe_mul_hom.comp f)
192
-
193
- @[simp, to_additive] lemma map_coe (f : α →ₙ* β) (a : α) : map f (a : with_one α) = f a :=
194
- lift_coe _ _
195
-
196
- @[simp, to_additive]
197
- lemma map_id : map (mul_hom.id α) = monoid_hom.id (with_one α) :=
198
- by { ext, induction x using with_one.cases_on; refl }
199
-
200
- @[to_additive]
201
- lemma map_map (f : α →ₙ* β) (g : β →ₙ* γ) (x) :
202
- map g (map f x) = map (g.comp f) x :=
203
- by { induction x using with_one.cases_on; refl }
204
-
205
- @[simp, to_additive]
206
- lemma map_comp (f : α →ₙ* β) (g : β →ₙ* γ) :
207
- map (g.comp f) = (map g).comp (map f) :=
208
- monoid_hom.ext $ λ x, (map_map f g x).symm
209
-
210
- /-- A version of `equiv.option_congr` for `with_one`. -/
211
- @[to_additive " A version of `equiv.option_congr` for `with_zero`." , simps apply]
212
- def _root_.mul_equiv.with_one_congr (e : α ≃* β) : with_one α ≃* with_one β :=
213
- { to_fun := map e.to_mul_hom,
214
- inv_fun := map e.symm.to_mul_hom,
215
- left_inv := λ x, (map_map _ _ _).trans $ by induction x using with_one.cases_on; { simp },
216
- right_inv := λ x, (map_map _ _ _).trans $ by induction x using with_one.cases_on; { simp },
217
- .. map e.to_mul_hom }
218
-
219
- @[simp]
220
- lemma _root_.mul_equiv.with_one_congr_refl : (mul_equiv.refl α).with_one_congr = mul_equiv.refl _ :=
221
- mul_equiv.to_monoid_hom_injective map_id
222
-
223
- @[simp]
224
- lemma _root_.mul_equiv.with_one_congr_symm (e : α ≃* β) :
225
- e.with_one_congr.symm = e.symm.with_one_congr := rfl
226
-
227
- @[simp]
228
- lemma _root_.mul_equiv.with_one_congr_trans (e₁ : α ≃* β) (e₂ : β ≃* γ) :
229
- e₁.with_one_congr.trans e₂.with_one_congr = (e₁.trans e₂).with_one_congr :=
230
- mul_equiv.to_monoid_hom_injective (map_comp _ _).symm
231
-
232
- end map
233
-
234
137
@[simp, norm_cast, to_additive]
235
138
lemma coe_mul [has_mul α] (a b : α) : ((a * b : α) : with_one α) = a * b := rfl
236
139
@@ -441,14 +344,6 @@ instance [semiring α] : semiring (with_zero α) :=
441
344
..with_zero.mul_zero_class,
442
345
..with_zero.monoid_with_zero }
443
346
444
- /-- Any group is isomorphic to the units of itself adjoined with `0`. -/
445
- def units_with_zero_equiv [group α] : (with_zero α)ˣ ≃* α :=
446
- { to_fun := λ a, unzero a.ne_zero,
447
- inv_fun := λ a, units.mk0 a coe_ne_zero,
448
- left_inv := λ _, units.ext $ by simpa only [coe_unzero],
449
- right_inv := λ _, rfl,
450
- map_mul' := λ _ _, coe_inj.mp $ by simpa only [coe_unzero, coe_mul] }
451
-
452
347
attribute [irreducible] with_zero
453
348
454
349
end with_zero
0 commit comments