-
Notifications
You must be signed in to change notification settings - Fork 259
/
Opposite.lean
564 lines (467 loc) · 22.6 KB
/
Opposite.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
/-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Algebra.Group.InjSurj
import Mathlib.Algebra.Group.Commute
import Mathlib.Algebra.Hom.Equiv.Basic
import Mathlib.Algebra.Opposites
import Mathlib.Data.Int.Cast.Defs
/-!
# Group structures on the multiplicative and additive opposites
-/
universe u v
variable (α : Type u)
namespace MulOpposite
/-!
### Additive structures on `αᵐᵒᵖ`
-/
instance [AddSemigroup α] : AddSemigroup αᵐᵒᵖ :=
unop_injective.addSemigroup _ fun _ _ => rfl
instance [AddLeftCancelSemigroup α] : AddLeftCancelSemigroup αᵐᵒᵖ :=
unop_injective.addLeftCancelSemigroup _ fun _ _ => rfl
instance [AddRightCancelSemigroup α] : AddRightCancelSemigroup αᵐᵒᵖ :=
unop_injective.addRightCancelSemigroup _ fun _ _ => rfl
instance [AddCommSemigroup α] : AddCommSemigroup αᵐᵒᵖ :=
unop_injective.addCommSemigroup _ fun _ _ => rfl
instance [AddZeroClass α] : AddZeroClass αᵐᵒᵖ :=
unop_injective.addZeroClass _ rfl fun _ _ => rfl
instance [AddMonoid α] : AddMonoid αᵐᵒᵖ :=
unop_injective.addMonoid _ rfl (fun _ _ => rfl) fun _ _ => rfl
instance [AddMonoidWithOne α] : AddMonoidWithOne αᵐᵒᵖ :=
{ instAddMonoidMulOpposite α, instOneMulOpposite α with
natCast := fun n => op n,
natCast_zero := show op ((0 : ℕ) : α) = 0 by simp,
natCast_succ := show ∀ n, op ((n + 1 : ℕ) : α) = op ((n : ℕ) : α) + 1 by simp
}
instance [AddCommMonoid α] : AddCommMonoid αᵐᵒᵖ :=
unop_injective.addCommMonoid _ rfl (fun _ _ => rfl) fun _ _ => rfl
instance [SubNegMonoid α] : SubNegMonoid αᵐᵒᵖ :=
unop_injective.subNegMonoid _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl)
(fun _ _ => rfl) fun _ _ => rfl
instance [AddGroup α] : AddGroup αᵐᵒᵖ :=
unop_injective.addGroup _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
fun _ _ => rfl
instance [AddGroupWithOne α] : AddGroupWithOne αᵐᵒᵖ :=
{ instAddMonoidWithOneMulOpposite α, instAddGroupMulOpposite α with
intCast := fun n => op n,
intCast_ofNat := fun n => show op ((n : ℤ) : α) = op (n : α) by rw [Int.cast_ofNat],
intCast_negSucc := fun n =>
show op _ = op (-unop (op ((n + 1 : ℕ) : α))) by erw [unop_op, Int.cast_negSucc] }
instance [AddCommGroup α] : AddCommGroup αᵐᵒᵖ :=
unop_injective.addCommGroup _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl)
(fun _ _ => rfl) fun _ _ => rfl
/-!
### Multiplicative structures on `αᵐᵒᵖ`
We also generate additive structures on `αᵃᵒᵖ` using `to_additive`
-/
@[to_additive]
instance [Semigroup α] : Semigroup αᵐᵒᵖ :=
{ instMulMulOpposite α with
mul_assoc := fun x y z => unop_injective <| Eq.symm <| mul_assoc (unop z) (unop y) (unop x) }
@[to_additive]
instance [RightCancelSemigroup α] : LeftCancelSemigroup αᵐᵒᵖ :=
{ instSemigroupMulOpposite α with
mul_left_cancel := fun _ _ _ H => unop_injective <| mul_right_cancel <| op_injective H }
@[to_additive]
instance [LeftCancelSemigroup α] : RightCancelSemigroup αᵐᵒᵖ :=
{ instSemigroupMulOpposite α with
mul_right_cancel := fun _ _ _ H => unop_injective <| mul_left_cancel <| op_injective H }
@[to_additive]
instance [CommSemigroup α] : CommSemigroup αᵐᵒᵖ :=
{ instSemigroupMulOpposite α with
mul_comm := fun x y => unop_injective <| mul_comm (unop y) (unop x) }
@[to_additive]
instance [MulOneClass α] : MulOneClass αᵐᵒᵖ :=
{ instMulMulOpposite α, instOneMulOpposite α with
one_mul := fun x => unop_injective <| mul_one <| unop x,
mul_one := fun x => unop_injective <| one_mul <| unop x }
@[to_additive]
instance [Monoid α] : Monoid αᵐᵒᵖ :=
{ instSemigroupMulOpposite α, instMulOneClassMulOpposite α with
npow := fun n x => op <| x.unop ^ n,
npow_zero := fun x => unop_injective <| Monoid.npow_zero x.unop,
npow_succ := fun n x => unop_injective <| pow_succ' x.unop n }
@[to_additive]
instance [RightCancelMonoid α] : LeftCancelMonoid αᵐᵒᵖ :=
{ instLeftCancelSemigroupMulOpposite α, instMonoidMulOpposite α with }
@[to_additive]
instance [LeftCancelMonoid α] : RightCancelMonoid αᵐᵒᵖ :=
{ instRightCancelSemigroupMulOpposite α, instMonoidMulOpposite α with }
@[to_additive]
instance [CancelMonoid α] : CancelMonoid αᵐᵒᵖ :=
{ instRightCancelMonoidMulOpposite α, instLeftCancelMonoidMulOpposite α with }
@[to_additive]
instance [CommMonoid α] : CommMonoid αᵐᵒᵖ :=
{ instMonoidMulOpposite α, instCommSemigroupMulOpposite α with }
@[to_additive]
instance [CancelCommMonoid α] : CancelCommMonoid αᵐᵒᵖ :=
{ instCancelMonoidMulOpposite α, instCommMonoidMulOpposite α with }
@[to_additive AddOpposite.subNegMonoid]
instance [DivInvMonoid α] : DivInvMonoid αᵐᵒᵖ :=
{ instMonoidMulOpposite α, instInvMulOpposite α with
zpow := fun n x => op <| x.unop ^ n,
zpow_zero' := fun x => unop_injective <| DivInvMonoid.zpow_zero' x.unop,
zpow_succ' := fun n x =>
unop_injective <| by rw [unop_op, zpow_ofNat, pow_succ', unop_mul, unop_op, zpow_ofNat],
zpow_neg' := fun z x => unop_injective <| DivInvMonoid.zpow_neg' z x.unop }
@[to_additive AddOpposite.subtractionMonoid]
instance [DivisionMonoid α] : DivisionMonoid αᵐᵒᵖ :=
{ instDivInvMonoidMulOpposite α, instInvolutiveInvMulOpposite α with
mul_inv_rev := fun a b => unop_injective <| mul_inv_rev _ _,
inv_eq_of_mul := fun a b h => unop_injective <| inv_eq_of_mul_eq_one_left <| congr_arg unop h }
@[to_additive AddOpposite.subtractionCommMonoid]
instance [DivisionCommMonoid α] : DivisionCommMonoid αᵐᵒᵖ :=
{ instDivisionMonoidMulOpposite α, instCommSemigroupMulOpposite α with }
@[to_additive]
instance [Group α] : Group αᵐᵒᵖ :=
{ instDivInvMonoidMulOpposite α with
mul_left_inv := fun x => unop_injective <| mul_inv_self <| unop x }
@[to_additive]
instance [CommGroup α] : CommGroup αᵐᵒᵖ :=
{ instGroupMulOpposite α, instCommMonoidMulOpposite α with }
variable {α}
@[simp, to_additive]
theorem unop_div [DivInvMonoid α] (x y : αᵐᵒᵖ) : unop (x / y) = (unop y)⁻¹ * unop x :=
rfl
#align mul_opposite.unop_div MulOpposite.unop_div
@[simp, to_additive]
theorem op_div [DivInvMonoid α] (x y : α) : op (x / y) = (op y)⁻¹ * op x := by simp [div_eq_mul_inv]
#align mul_opposite.op_div MulOpposite.op_div
@[simp, to_additive]
theorem semiconj_by_op [Mul α] {a x y : α} : SemiconjBy (op a) (op y) (op x) ↔ SemiconjBy a x y :=
by simp only [SemiconjBy, ← op_mul, op_inj, eq_comm] ; rfl
#align mul_opposite.semiconj_by_op MulOpposite.semiconj_by_op
@[simp, to_additive]
theorem semiconj_by_unop [Mul α] {a x y : αᵐᵒᵖ} :
SemiconjBy (unop a) (unop y) (unop x) ↔ SemiconjBy a x y := by
conv_rhs => rw [← op_unop a, ← op_unop x, ← op_unop y, semiconj_by_op]
#align mul_opposite.semiconj_by_unop MulOpposite.semiconj_by_unop
@[to_additive]
theorem _root_.SemiconjBy.op [Mul α] {a x y : α} (h : SemiconjBy a x y) :
SemiconjBy (op a) (op y) (op x) :=
semiconj_by_op.2 h
#align mul_opposite.semiconj_by.op SemiconjBy.op
@[to_additive]
theorem _root_.SemiconjBy.unop [Mul α] {a x y : αᵐᵒᵖ} (h : SemiconjBy a x y) :
SemiconjBy (unop a) (unop y) (unop x) :=
semiconj_by_unop.2 h
#align semiconj_by.unop SemiconjBy.unop
@[to_additive]
theorem _root_.Commute.op [Mul α] {x y : α} (h : Commute x y) : Commute (op x) (op y) :=
SemiconjBy.op h
#align commute.op Commute.op
@[to_additive]
theorem Commute.unop [Mul α] {x y : αᵐᵒᵖ} (h : Commute x y) : Commute (unop x) (unop y) :=
h.unop
#align mul_opposite.commute.unop MulOpposite.Commute.unop
@[simp, to_additive]
theorem commute_op [Mul α] {x y : α} : Commute (op x) (op y) ↔ Commute x y :=
semiconj_by_op
#align mul_opposite.commute_op MulOpposite.commute_op
@[simp, to_additive]
theorem commute_unop [Mul α] {x y : αᵐᵒᵖ} : Commute (unop x) (unop y) ↔ Commute x y :=
semiconj_by_unop
#align mul_opposite.commute_unop MulOpposite.commute_unop
/-- The function `mul_opposite.op` is an additive equivalence. -/
@[simps (config := { fullyApplied := false, simpRhs := true })]
def opAddEquiv [Add α] : α ≃+ αᵐᵒᵖ :=
{ opEquiv with map_add' := fun _ _ => rfl }
#align mul_opposite.op_add_equiv MulOpposite.opAddEquiv
@[simp]
theorem op_add_equiv_to_equiv [Add α] : (opAddEquiv : α ≃+ αᵐᵒᵖ).toEquiv = opEquiv := rfl
#align mul_opposite.op_add_equiv_to_equiv MulOpposite.op_add_equiv_to_equiv
end MulOpposite
/-!
### Multiplicative structures on `αᵃᵒᵖ`
-/
namespace AddOpposite
instance [Semigroup α] : Semigroup αᵃᵒᵖ :=
unop_injective.semigroup _ fun _ _ => rfl
instance [LeftCancelSemigroup α] : LeftCancelSemigroup αᵃᵒᵖ :=
unop_injective.leftCancelSemigroup _ fun _ _ => rfl
instance [RightCancelSemigroup α] : RightCancelSemigroup αᵃᵒᵖ :=
unop_injective.rightCancelSemigroup _ fun _ _ => rfl
instance [CommSemigroup α] : CommSemigroup αᵃᵒᵖ :=
unop_injective.commSemigroup _ fun _ _ => rfl
instance [MulOneClass α] : MulOneClass αᵃᵒᵖ :=
unop_injective.mulOneClass _ rfl fun _ _ => rfl
instance {β} [Pow α β] : Pow αᵃᵒᵖ β where pow a b := op (unop a ^ b)
@[simp]
theorem op_pow {β} [Pow α β] (a : α) (b : β) : op (a ^ b) = op a ^ b :=
rfl
#align add_opposite.op_pow AddOpposite.op_pow
@[simp]
theorem unop_pow {β} [Pow α β] (a : αᵃᵒᵖ) (b : β) : unop (a ^ b) = unop a ^ b :=
rfl
#align add_opposite.unop_pow AddOpposite.unop_pow
instance [Monoid α] : Monoid αᵃᵒᵖ :=
unop_injective.monoid _ rfl (fun _ _ => rfl) fun _ _ => rfl
instance [CommMonoid α] : CommMonoid αᵃᵒᵖ :=
unop_injective.commMonoid _ rfl (fun _ _ => rfl) fun _ _ => rfl
instance [DivInvMonoid α] : DivInvMonoid αᵃᵒᵖ :=
unop_injective.divInvMonoid _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl)
(fun _ _ => rfl) fun _ _ => rfl
instance [Group α] : Group αᵃᵒᵖ :=
unop_injective.group _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
fun _ _ => rfl
instance [CommGroup α] : CommGroup αᵃᵒᵖ :=
unop_injective.commGroup _ rfl (fun _ _ => rfl) (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl)
fun _ _ => rfl
variable {α}
/-- The function `add_opposite.op` is a multiplicative equivalence. -/
@[simps (config := { fullyApplied := false, simpRhs := true })]
def opMulEquiv [Mul α] : α ≃* αᵃᵒᵖ :=
{ opEquiv with map_mul' := fun _ _ => rfl }
#align add_opposite.op_mul_equiv AddOpposite.opMulEquiv
@[simp]
theorem op_mul_equiv_to_equiv [Mul α] : (opMulEquiv : α ≃* αᵃᵒᵖ).toEquiv = opEquiv :=
rfl
#align add_opposite.op_mul_equiv_to_equiv AddOpposite.op_mul_equiv_to_equiv
end AddOpposite
open MulOpposite
/-- Inversion on a group is a `mul_equiv` to the opposite group. When `G` is commutative, there is
`mul_equiv.inv`. -/
@[to_additive
"Negation on an additive group is an `add_equiv` to the opposite group. When `G`\nis commutative, there is `add_equiv.inv`.",
simps (config := { fullyApplied := false, simpRhs := true })]
def MulEquiv.inv' (G : Type _) [DivisionMonoid G] : G ≃* Gᵐᵒᵖ :=
{ (Equiv.inv G).trans opEquiv with map_mul' := fun x y => unop_injective <| mul_inv_rev x y }
#align mul_equiv.inv' MulEquiv.inv'
/-- A semigroup homomorphism `f : M →ₙ* N` such that `f x` commutes with `f y` for all `x, y`
defines a semigroup homomorphism to `Nᵐᵒᵖ`. -/
@[to_additive
"An additive semigroup homomorphism `f : add_hom M N` such that `f x` additively\ncommutes with `f y` for all `x, y` defines an additive semigroup homomorphism to `Sᵃᵒᵖ`.",
simps (config := { fullyApplied := false })]
def MulHom.toOpposite {M N : Type _} [Mul M] [Mul N] (f : M →ₙ* N)
(hf : ∀ x y, Commute (f x) (f y)) :
M →ₙ* Nᵐᵒᵖ where
toFun := MulOpposite.op ∘ f
map_mul' x y := by simp [(hf x y).eq]
#align mul_hom.to_opposite MulHom.toOpposite
/-- A semigroup homomorphism `f : M →ₙ* N` such that `f x` commutes with `f y` for all `x, y`
defines a semigroup homomorphism from `Mᵐᵒᵖ`. -/
@[to_additive
"An additive semigroup homomorphism `f : add_hom M N` such that `f x` additively\ncommutes with `f y` for all `x`, `y` defines an additive semigroup homomorphism from `Mᵃᵒᵖ`.",
simps (config := { fullyApplied := false })]
def MulHom.fromOpposite {M N : Type _} [Mul M] [Mul N] (f : M →ₙ* N)
(hf : ∀ x y, Commute (f x) (f y)) :
Mᵐᵒᵖ →ₙ* N where
toFun := f ∘ MulOpposite.unop
map_mul' _ _ := (f.map_mul _ _).trans (hf _ _).eq
#align mul_hom.from_opposite MulHom.fromOpposite
/-- A monoid homomorphism `f : M →* N` such that `f x` commutes with `f y` for all `x, y` defines
a monoid homomorphism to `Nᵐᵒᵖ`. -/
@[to_additive
"An additive monoid homomorphism `f : M →+ N` such that `f x` additively commutes\nwith `f y` for all `x, y` defines an additive monoid homomorphism to `Sᵃᵒᵖ`.",
simps (config := { fullyApplied := false })]
def MonoidHom.toOpposite {M N : Type _} [MulOneClass M] [MulOneClass N] (f : M →* N)
(hf : ∀ x y, Commute (f x) (f y)) :
M →* Nᵐᵒᵖ where
toFun := MulOpposite.op ∘ f
map_one' := congrArg op f.map_one
map_mul' x y := by simp [(hf x y).eq]
#align monoid_hom.to_opposite MonoidHom.toOpposite
/-- A monoid homomorphism `f : M →* N` such that `f x` commutes with `f y` for all `x, y` defines
a monoid homomorphism from `Mᵐᵒᵖ`. -/
@[to_additive
"An additive monoid homomorphism `f : M →+ N` such that `f x` additively commutes\nwith `f y` for all `x`, `y` defines an additive monoid homomorphism from `Mᵃᵒᵖ`.",
simps (config := { fullyApplied := false })]
def MonoidHom.fromOpposite {M N : Type _} [MulOneClass M] [MulOneClass N] (f : M →* N)
(hf : ∀ x y, Commute (f x) (f y)) :
Mᵐᵒᵖ →* N where
toFun := f ∘ MulOpposite.unop
map_one' := f.map_one
map_mul' _ _ := (f.map_mul _ _).trans (hf _ _).eq
#align monoid_hom.from_opposite MonoidHom.fromOpposite
/-- The units of the opposites are equivalent to the opposites of the units. -/
@[to_additive
"The additive units of the additive opposites are equivalent to the additive opposites\nof the additive units."]
def Units.opEquiv {M} [Monoid M] :
Mᵐᵒᵖˣ ≃*
Mˣᵐᵒᵖ where
toFun u := op ⟨unop u, unop ↑u⁻¹, op_injective u.4, op_injective u.3⟩
invFun := MulOpposite.rec fun u => ⟨op ↑u, op ↑u⁻¹, unop_injective <| u.4, unop_injective u.3⟩
map_mul' x y := unop_injective <| Units.ext <| rfl
left_inv x := Units.ext <| by simp
right_inv x := unop_injective <| Units.ext <| rfl
#align units.op_equiv Units.opEquiv
@[simp, to_additive]
theorem Units.coe_unop_op_equiv {M} [Monoid M] (u : Mᵐᵒᵖˣ) :
((Units.opEquiv u).unop : M) = unop (u : Mᵐᵒᵖ) :=
rfl
#align units.coe_unop_op_equiv Units.coe_unop_op_equiv
@[simp, to_additive]
theorem Units.coe_op_equiv_symm {M} [Monoid M] (u : Mˣᵐᵒᵖ) :
(Units.opEquiv.symm u : Mᵐᵒᵖ) = op (u.unop : M) :=
rfl
#align units.coe_op_equiv_symm Units.coe_op_equiv_symm
/-- A semigroup homomorphism `M →ₙ* N` can equivalently be viewed as a semigroup homomorphism
`Mᵐᵒᵖ →ₙ* Nᵐᵒᵖ`. This is the action of the (fully faithful) `ᵐᵒᵖ`-functor on morphisms. -/
@[to_additive
"An additive semigroup homomorphism `add_hom M N` can equivalently be viewed as an\nadditive semigroup homomorphism `add_hom Mᵃᵒᵖ Nᵃᵒᵖ`. This is the action of the (fully faithful)\n`ᵃᵒᵖ`-functor on morphisms.",
simps]
def MulHom.op {M N} [Mul M] [Mul N] :
(M →ₙ* N) ≃
(Mᵐᵒᵖ →ₙ*
Nᵐᵒᵖ) where
toFun f :=
{ toFun := MulOpposite.op ∘ f ∘ unop, map_mul' := fun x y => unop_injective (f.map_mul y.unop x.unop) }
invFun f :=
{ toFun := unop ∘ f ∘ MulOpposite.op, map_mul' := fun x y => congrArg unop (f.map_mul (MulOpposite.op y) (MulOpposite.op x)) }
left_inv f := by
ext
rfl
right_inv f := by
ext x
simp
#align mul_hom.op MulHom.op
/-- The 'unopposite' of a semigroup homomorphism `Mᵐᵒᵖ →ₙ* Nᵐᵒᵖ`. Inverse to `mul_hom.op`. -/
@[simp,
to_additive
"The 'unopposite' of an additive semigroup homomorphism `Mᵃᵒᵖ →ₙ+ Nᵃᵒᵖ`. Inverse\nto `add_hom.op`."]
def MulHom.unop {M N} [Mul M] [Mul N] : (Mᵐᵒᵖ →ₙ* Nᵐᵒᵖ) ≃ (M →ₙ* N) :=
MulHom.op.symm
#align mul_hom.unop MulHom.unop
/-- An additive semigroup homomorphism `add_hom M N` can equivalently be viewed as an additive
homomorphism `add_hom Mᵐᵒᵖ Nᵐᵒᵖ`. This is the action of the (fully faithful) `ᵐᵒᵖ`-functor on
morphisms. -/
@[simps]
def AddHom.mulOp {M N} [Add M] [Add N] :
AddHom M N ≃
AddHom Mᵐᵒᵖ
Nᵐᵒᵖ where
toFun f :=
{ toFun := MulOpposite.op ∘ f ∘ MulOpposite.unop, map_add' := fun x y => unop_injective (f.map_add x.unop y.unop) }
invFun f :=
{ toFun := MulOpposite.unop ∘ f ∘ MulOpposite.op, map_add' := fun x y => congrArg MulOpposite.unop (f.map_add (MulOpposite.op x) (MulOpposite.op y)) }
left_inv f := by
ext
rfl
right_inv f := by
ext
simp
#align add_hom.mul_op AddHom.mulOp
/-- The 'unopposite' of an additive semigroup hom `αᵐᵒᵖ →+ βᵐᵒᵖ`. Inverse to
`add_hom.mul_op`. -/
@[simp]
def AddHom.mulUnop {α β} [Add α] [Add β] : AddHom αᵐᵒᵖ βᵐᵒᵖ ≃ AddHom α β :=
AddHom.mulOp.symm
#align add_hom.mul_unop AddHom.mulUnop
/-- A monoid homomorphism `M →* N` can equivalently be viewed as a monoid homomorphism
`Mᵐᵒᵖ →* Nᵐᵒᵖ`. This is the action of the (fully faithful) `ᵐᵒᵖ`-functor on morphisms. -/
@[to_additive
"An additive monoid homomorphism `M →+ N` can equivalently be viewed as an\nadditive monoid homomorphism `Mᵃᵒᵖ →+ Nᵃᵒᵖ`. This is the action of the (fully faithful)\n`ᵃᵒᵖ`-functor on morphisms.",
simps]
def MonoidHom.op {M N} [MulOneClass M] [MulOneClass N] :
(M →* N) ≃
(Mᵐᵒᵖ →*
Nᵐᵒᵖ) where
toFun f :=
{ toFun := MulOpposite.op ∘ f ∘ unop, map_one' := congrArg MulOpposite.op f.map_one,
map_mul' := fun x y => unop_injective (f.map_mul y.unop x.unop) }
invFun f :=
{ toFun := unop ∘ f ∘ MulOpposite.op, map_one' := congrArg unop f.map_one,
map_mul' := fun x y => congrArg unop (f.map_mul (MulOpposite.op y) (MulOpposite.op x)) }
left_inv f := by
ext
rfl
right_inv f := by
ext x
simp
#align monoid_hom.op MonoidHom.op
/-- The 'unopposite' of a monoid homomorphism `Mᵐᵒᵖ →* Nᵐᵒᵖ`. Inverse to `monoid_hom.op`. -/
@[simp,
to_additive
"The 'unopposite' of an additive monoid homomorphism `Mᵃᵒᵖ →+ Nᵃᵒᵖ`. Inverse to\n`add_monoid_hom.op`."]
def MonoidHom.unop {M N} [MulOneClass M] [MulOneClass N] : (Mᵐᵒᵖ →* Nᵐᵒᵖ) ≃ (M →* N) :=
MonoidHom.op.symm
#align monoid_hom.unop MonoidHom.unop
/-- An additive homomorphism `M →+ N` can equivalently be viewed as an additive homomorphism
`Mᵐᵒᵖ →+ Nᵐᵒᵖ`. This is the action of the (fully faithful) `ᵐᵒᵖ`-functor on morphisms. -/
@[simps]
def AddMonoidHom.mulOp {M N} [AddZeroClass M] [AddZeroClass N] :
(M →+ N) ≃
(Mᵐᵒᵖ →+
Nᵐᵒᵖ) where
toFun f :=
{ toFun := MulOpposite.op ∘ f ∘ MulOpposite.unop, map_zero' := unop_injective f.map_zero,
map_add' := fun x y => unop_injective (f.map_add x.unop y.unop) }
invFun f :=
{ toFun := MulOpposite.unop ∘ f ∘ MulOpposite.op, map_zero' := congrArg MulOpposite.unop f.map_zero,
map_add' := fun x y => congrArg MulOpposite.unop (f.map_add (MulOpposite.op x) (MulOpposite.op y)) }
left_inv f := by
ext
rfl
right_inv f := by
ext
simp
#align add_monoid_hom.mul_op AddMonoidHom.mulOp
/-- The 'unopposite' of an additive monoid hom `αᵐᵒᵖ →+ βᵐᵒᵖ`. Inverse to
`add_monoid_hom.mul_op`. -/
@[simp]
def AddMonoidHom.mulUnop {α β} [AddZeroClass α] [AddZeroClass β] : (αᵐᵒᵖ →+ βᵐᵒᵖ) ≃ (α →+ β) :=
AddMonoidHom.mulOp.symm
#align add_monoid_hom.mul_unop AddMonoidHom.mulUnop
/-- A iso `α ≃+ β` can equivalently be viewed as an iso `αᵐᵒᵖ ≃+ βᵐᵒᵖ`. -/
@[simps]
def AddEquiv.mulOp {α β} [Add α] [Add β] :
α ≃+ β ≃
(αᵐᵒᵖ ≃+ βᵐᵒᵖ) where
toFun f := opAddEquiv.symm.trans (f.trans opAddEquiv)
invFun f := opAddEquiv.trans (f.trans opAddEquiv.symm)
left_inv f := by
ext
rfl
right_inv f := by
ext
simp
#align add_equiv.mul_op AddEquiv.mulOp
/-- The 'unopposite' of an iso `αᵐᵒᵖ ≃+ βᵐᵒᵖ`. Inverse to `add_equiv.mul_op`. -/
@[simp]
def AddEquiv.mulUnop {α β} [Add α] [Add β] : αᵐᵒᵖ ≃+ βᵐᵒᵖ ≃ (α ≃+ β) :=
AddEquiv.mulOp.symm
#align add_equiv.mul_unop AddEquiv.mulUnop
/-- A iso `α ≃* β` can equivalently be viewed as an iso `αᵐᵒᵖ ≃* βᵐᵒᵖ`. -/
@[to_additive
"A iso `α ≃+ β` can equivalently be viewed as an iso `αᵃᵒᵖ ≃+ βᵃᵒᵖ`.", simps]
def MulEquiv.op {α β} [Mul α] [Mul β] :
α ≃* β ≃
(αᵐᵒᵖ ≃*
βᵐᵒᵖ) where
toFun f :=
{ toFun := MulOpposite.op ∘ f ∘ unop, invFun := MulOpposite.op ∘ f.symm ∘ unop,
left_inv := fun x => unop_injective (f.symm_apply_apply x.unop),
right_inv := fun x => unop_injective (f.apply_symm_apply x.unop),
map_mul' := fun x y => unop_injective (f.map_mul y.unop x.unop) }
invFun f :=
{ toFun := unop ∘ f ∘ MulOpposite.op, invFun := unop ∘ f.symm ∘ MulOpposite.op, left_inv := fun x => by simp,
right_inv := fun x => by simp,
map_mul' := fun x y => congr_arg unop (f.map_mul (MulOpposite.op y) (MulOpposite.op x)) }
left_inv f := by
ext
rfl
right_inv f := by
ext
simp
#align mul_equiv.op MulEquiv.op
/-- The 'unopposite' of an iso `αᵐᵒᵖ ≃* βᵐᵒᵖ`. Inverse to `mul_equiv.op`. -/
@[simp, to_additive
"The 'unopposite' of an iso `αᵃᵒᵖ ≃+ βᵃᵒᵖ`. Inverse to `add_equiv.op`."]
def MulEquiv.unop {α β} [Mul α] [Mul β] : αᵐᵒᵖ ≃* βᵐᵒᵖ ≃ (α ≃* β) :=
MulEquiv.op.symm
#align mul_equiv.unop MulEquiv.unop
section Ext
/-- This ext lemma change equalities on `αᵐᵒᵖ →+ β` to equalities on `α →+ β`.
This is useful because there are often ext lemmas for specific `α`s that will apply
to an equality of `α →+ β` such as `finsupp.add_hom_ext'`. -/
@[ext]
theorem AddMonoidHom.mul_op_ext {α β} [AddZeroClass α] [AddZeroClass β] (f g : αᵐᵒᵖ →+ β)
(h :
f.comp (opAddEquiv : α ≃+ αᵐᵒᵖ).toAddMonoidHom =
g.comp (opAddEquiv : α ≃+ αᵐᵒᵖ).toAddMonoidHom) :
f = g :=
AddMonoidHom.ext <| MulOpposite.rec fun x => (AddMonoidHom.congr_fun h : _) x
#align add_monoid_hom.mul_op_ext AddMonoidHom.mul_op_ext
end Ext