@@ -22,12 +22,62 @@ universes u
22
22
23
23
variables (α : Type u)
24
24
25
+ instance [has_zero α] : has_zero (opposite α) :=
26
+ { zero := op 0 }
27
+
28
+ instance [has_one α] : has_one (opposite α) :=
29
+ { one := op 1 }
30
+
25
31
instance [has_add α] : has_add (opposite α) :=
26
32
{ add := λ x y, op (unop x + unop y) }
27
33
28
34
instance [has_sub α] : has_sub (opposite α) :=
29
35
{ sub := λ x y, op (unop x - unop y) }
30
36
37
+ instance [has_neg α] : has_neg (opposite α) :=
38
+ { neg := λ x, op $ -(unop x) }
39
+
40
+ instance [has_mul α] : has_mul (opposite α) :=
41
+ { mul := λ x y, op (unop y * unop x) }
42
+
43
+ instance [has_inv α] : has_inv (opposite α) :=
44
+ { inv := λ x, op $ (unop x)⁻¹ }
45
+
46
+ instance (R : Type *) [has_scalar R α] : has_scalar R (opposite α) :=
47
+ { smul := λ c x, op (c • unop x) }
48
+
49
+ section
50
+ variables (α)
51
+
52
+ @[simp] lemma op_zero [has_zero α] : op (0 : α) = 0 := rfl
53
+ @[simp] lemma unop_zero [has_zero α] : unop (0 : αᵒᵖ) = 0 := rfl
54
+
55
+ @[simp] lemma op_one [has_one α] : op (1 : α) = 1 := rfl
56
+ @[simp] lemma unop_one [has_one α] : unop (1 : αᵒᵖ) = 1 := rfl
57
+
58
+ variable {α}
59
+
60
+ @[simp] lemma op_add [has_add α] (x y : α) : op (x + y) = op x + op y := rfl
61
+ @[simp] lemma unop_add [has_add α] (x y : αᵒᵖ) : unop (x + y) = unop x + unop y := rfl
62
+
63
+ @[simp] lemma op_neg [has_neg α] (x : α) : op (-x) = -op x := rfl
64
+ @[simp] lemma unop_neg [has_neg α] (x : αᵒᵖ) : unop (-x) = -unop x := rfl
65
+
66
+ @[simp] lemma op_mul [has_mul α] (x y : α) : op (x * y) = op y * op x := rfl
67
+ @[simp] lemma unop_mul [has_mul α] (x y : αᵒᵖ) : unop (x * y) = unop y * unop x := rfl
68
+
69
+ @[simp] lemma op_inv [has_inv α] (x : α) : op (x⁻¹) = (op x)⁻¹ := rfl
70
+ @[simp] lemma unop_inv [has_inv α] (x : αᵒᵖ) : unop (x⁻¹) = (unop x)⁻¹ := rfl
71
+
72
+ @[simp] lemma op_sub [add_group α] (x y : α) : op (x - y) = op x - op y := rfl
73
+ @[simp] lemma unop_sub [add_group α] (x y : αᵒᵖ) : unop (x - y) = unop x - unop y := rfl
74
+
75
+ @[simp] lemma op_smul {R : Type *} [has_scalar R α] (c : R) (a : α) : op (c • a) = c • op a := rfl
76
+ @[simp] lemma unop_smul {R : Type *} [has_scalar R α] (c : R) (a : αᵒᵖ) :
77
+ unop (c • a) = c • unop a := rfl
78
+
79
+ end
80
+
31
81
instance [add_semigroup α] : add_semigroup (opposite α) :=
32
82
{ add_assoc := λ x y z, unop_injective $ add_assoc (unop x) (unop y) (unop z),
33
83
.. opposite.has_add α }
@@ -44,8 +94,6 @@ instance [add_comm_semigroup α] : add_comm_semigroup (opposite α) :=
44
94
{ add_comm := λ x y, unop_injective $ add_comm (unop x) (unop y),
45
95
.. opposite.add_semigroup α }
46
96
47
- instance [has_zero α] : has_zero (opposite α) :=
48
- { zero := op 0 }
49
97
50
98
instance [nontrivial α] : nontrivial (opposite α) :=
51
99
let ⟨x, y, h⟩ := exists_pair_ne α in nontrivial_of_ne (op x) (op y) (op_injective.ne h)
@@ -76,9 +124,6 @@ instance [add_monoid α] : add_monoid (opposite α) :=
76
124
instance [add_comm_monoid α] : add_comm_monoid (opposite α) :=
77
125
{ .. opposite.add_monoid α, .. opposite.add_comm_semigroup α }
78
126
79
- instance [has_neg α] : has_neg (opposite α) :=
80
- { neg := λ x, op $ -(unop x) }
81
-
82
127
instance [add_group α] : add_group (opposite α) :=
83
128
{ add_left_neg := λ x, unop_injective $ add_left_neg $ unop x,
84
129
sub_eq_add_neg := λ x y, unop_injective $ sub_eq_add_neg (unop x) (unop y),
@@ -87,9 +132,6 @@ instance [add_group α] : add_group (opposite α) :=
87
132
instance [add_comm_group α] : add_comm_group (opposite α) :=
88
133
{ .. opposite.add_group α, .. opposite.add_comm_monoid α }
89
134
90
- instance [has_mul α] : has_mul (opposite α) :=
91
- { mul := λ x y, op (unop y * unop x) }
92
-
93
135
instance [semigroup α] : semigroup (opposite α) :=
94
136
{ mul_assoc := λ x y z, unop_injective $ eq.symm $ mul_assoc (unop z) (unop y) (unop x),
95
137
.. opposite.has_mul α }
@@ -106,9 +148,6 @@ instance [comm_semigroup α] : comm_semigroup (opposite α) :=
106
148
{ mul_comm := λ x y, unop_injective $ mul_comm (unop y) (unop x),
107
149
.. opposite.semigroup α }
108
150
109
- instance [has_one α] : has_one (opposite α) :=
110
- { one := op 1 }
111
-
112
151
section
113
152
local attribute [semireducible] opposite
114
153
@[simp] lemma unop_eq_one_iff {α} [has_one α] (a : αᵒᵖ) : a.unop = 1 ↔ a = 1 :=
@@ -124,7 +163,15 @@ instance [mul_one_class α] : mul_one_class (opposite α) :=
124
163
.. opposite.has_mul α, .. opposite.has_one α }
125
164
126
165
instance [monoid α] : monoid (opposite α) :=
127
- { .. opposite.semigroup α, .. opposite.mul_one_class α }
166
+ { npow := λ n x, op $ monoid.npow n x.unop,
167
+ npow_zero' := λ x, unop_injective $ monoid.npow_zero' x.unop,
168
+ npow_succ' := λ n x, unop_injective $ (monoid.npow_succ' n x.unop).trans begin
169
+ dsimp,
170
+ induction n with n ih,
171
+ { rw [monoid.npow_zero', one_mul, mul_one] },
172
+ { rw [monoid.npow_succ' n x.unop, mul_assoc, ih], },
173
+ end ,
174
+ .. opposite.semigroup α, .. opposite.mul_one_class α }
128
175
129
176
instance [right_cancel_monoid α] : left_cancel_monoid (opposite α) :=
130
177
{ .. opposite.left_cancel_semigroup α, ..opposite.monoid α }
@@ -141,12 +188,21 @@ instance [comm_monoid α] : comm_monoid (opposite α) :=
141
188
instance [cancel_comm_monoid α] : cancel_comm_monoid (opposite α) :=
142
189
{ .. opposite.cancel_monoid α, ..opposite.comm_monoid α }
143
190
144
- instance [has_inv α] : has_inv (opposite α) :=
145
- { inv := λ x, op $ (unop x)⁻¹ }
191
+ instance [div_inv_monoid α] : div_inv_monoid (opposite α) :=
192
+ { gpow := λ n x, op $ div_inv_monoid.gpow n x.unop,
193
+ gpow_zero' := λ x, unop_injective $ div_inv_monoid.gpow_zero' x.unop,
194
+ gpow_succ' := λ n x, unop_injective $ (div_inv_monoid.gpow_succ' n x.unop).trans begin
195
+ dsimp,
196
+ induction n with n ih,
197
+ { rw [int.of_nat_zero, div_inv_monoid.gpow_zero', one_mul, mul_one] },
198
+ { rw [div_inv_monoid.gpow_succ' n x.unop, mul_assoc, ih], },
199
+ end ,
200
+ gpow_neg' := λ z x, unop_injective $ div_inv_monoid.gpow_neg' z x.unop,
201
+ .. opposite.monoid α, .. opposite.has_inv α }
146
202
147
203
instance [group α] : group (opposite α) :=
148
204
{ mul_left_inv := λ x, unop_injective $ mul_inv_self $ unop x,
149
- .. opposite.monoid α, .. opposite.has_inv α }
205
+ .. opposite.div_inv_monoid α, }
150
206
151
207
instance [comm_group α] : comm_group (opposite α) :=
152
208
{ .. opposite.group α, .. opposite.comm_monoid α }
@@ -181,7 +237,8 @@ instance [non_assoc_semiring α] : non_assoc_semiring (opposite α) :=
181
237
{ .. opposite.mul_zero_one_class α, .. opposite.non_unital_non_assoc_semiring α }
182
238
183
239
instance [semiring α] : semiring (opposite α) :=
184
- { .. opposite.non_unital_semiring α, .. opposite.non_assoc_semiring α }
240
+ { .. opposite.non_unital_semiring α, .. opposite.non_assoc_semiring α,
241
+ .. opposite.monoid_with_zero α }
185
242
186
243
instance [comm_semiring α] : comm_semiring (opposite α) :=
187
244
{ .. opposite.semiring α, .. opposite.comm_semigroup α }
@@ -203,17 +260,14 @@ instance [integral_domain α] : integral_domain (opposite α) :=
203
260
instance [group_with_zero α] : group_with_zero (opposite α) :=
204
261
{ mul_inv_cancel := λ x hx, unop_injective $ inv_mul_cancel $ unop_injective.ne hx,
205
262
inv_zero := unop_injective inv_zero,
206
- .. opposite.monoid_with_zero α, .. opposite.nontrivial α, .. opposite.has_inv α }
263
+ .. opposite.monoid_with_zero α, .. opposite.div_inv_monoid α, .. opposite.nontrivial α }
207
264
208
265
instance [division_ring α] : division_ring (opposite α) :=
209
266
{ .. opposite.group_with_zero α, .. opposite.ring α }
210
267
211
268
instance [field α] : field (opposite α) :=
212
269
{ .. opposite.division_ring α, .. opposite.comm_ring α }
213
270
214
- instance (R : Type *) [has_scalar R α] : has_scalar R (opposite α) :=
215
- { smul := λ c x, op (c • unop x) }
216
-
217
271
instance (R : Type *) [monoid R] [mul_action R α] : mul_action R (opposite α) :=
218
272
{ one_smul := λ x, unop_injective $ one_smul R (unop x),
219
273
mul_smul := λ r₁ r₂ x, unop_injective $ mul_smul r₁ r₂ (unop x),
@@ -285,33 +339,8 @@ instance _root_.cancel_monoid_with_zero.to_has_faithful_opposite_scalar
285
339
[cancel_monoid_with_zero α] [nontrivial α] : has_faithful_scalar (opposite α) α :=
286
340
⟨λ x y h, unop_injective $ mul_left_cancel₀ one_ne_zero (h 1 )⟩
287
341
288
- @[simp] lemma op_zero [has_zero α] : op (0 : α) = 0 := rfl
289
- @[simp] lemma unop_zero [has_zero α] : unop (0 : αᵒᵖ) = 0 := rfl
290
-
291
- @[simp] lemma op_one [has_one α] : op (1 : α) = 1 := rfl
292
- @[simp] lemma unop_one [has_one α] : unop (1 : αᵒᵖ) = 1 := rfl
293
-
294
342
variable {α}
295
343
296
- @[simp] lemma op_add [has_add α] (x y : α) : op (x + y) = op x + op y := rfl
297
- @[simp] lemma unop_add [has_add α] (x y : αᵒᵖ) : unop (x + y) = unop x + unop y := rfl
298
-
299
- @[simp] lemma op_neg [has_neg α] (x : α) : op (-x) = -op x := rfl
300
- @[simp] lemma unop_neg [has_neg α] (x : αᵒᵖ) : unop (-x) = -unop x := rfl
301
-
302
- @[simp] lemma op_mul [has_mul α] (x y : α) : op (x * y) = op y * op x := rfl
303
- @[simp] lemma unop_mul [has_mul α] (x y : αᵒᵖ) : unop (x * y) = unop y * unop x := rfl
304
-
305
- @[simp] lemma op_inv [has_inv α] (x : α) : op (x⁻¹) = (op x)⁻¹ := rfl
306
- @[simp] lemma unop_inv [has_inv α] (x : αᵒᵖ) : unop (x⁻¹) = (unop x)⁻¹ := rfl
307
-
308
- @[simp] lemma op_sub [add_group α] (x y : α) : op (x - y) = op x - op y := rfl
309
- @[simp] lemma unop_sub [add_group α] (x y : αᵒᵖ) : unop (x - y) = unop x - unop y := rfl
310
-
311
- @[simp] lemma op_smul {R : Type *} [has_scalar R α] (c : R) (a : α) : op (c • a) = c • op a := rfl
312
- @[simp] lemma unop_smul {R : Type *} [has_scalar R α] (c : R) (a : αᵒᵖ) :
313
- unop (c • a) = c • unop a := rfl
314
-
315
344
lemma semiconj_by.op [has_mul α] {a x y : α} (h : semiconj_by a x y) :
316
345
semiconj_by (op a) (op y) (op x) :=
317
346
begin
0 commit comments