@@ -71,16 +71,12 @@ by simp only [mem_iff, star_bit0, mem_iff.mp hx]
71
71
72
72
end add_group
73
73
74
- instance [add_comm_group R] [star_add_monoid R] : add_comm_group (self_adjoint R) :=
75
- { add_comm := add_comm,
76
- ..add_subgroup.to_add_group (self_adjoint R) }
77
-
78
74
section ring
79
75
variables [ring R] [star_ring R]
80
76
81
77
instance : has_one (self_adjoint R) := ⟨⟨1 , by rw [mem_iff, star_one]⟩⟩
82
78
83
- @[simp, norm_cast] lemma coe_one : (coe : self_adjoint R → R) (1 : self_adjoint R) = (1 : R) := rfl
79
+ @[simp, norm_cast] lemma coe_one : ↑ (1 : self_adjoint R) = (1 : R) := rfl
84
80
85
81
instance [nontrivial R] : nontrivial (self_adjoint R) := ⟨⟨0 , 1 , subtype.ne_of_val_ne zero_ne_one⟩⟩
86
82
@@ -103,36 +99,59 @@ variables [comm_ring R] [star_ring R]
103
99
instance : has_mul (self_adjoint R) :=
104
100
⟨λ x y, ⟨(x : R) * y, by simp only [mem_iff, star_mul', star_coe_eq]⟩⟩
105
101
106
- @[simp, norm_cast] lemma coe_mul (x y : self_adjoint R) :
107
- (coe : self_adjoint R → R) (x * y) = (x : R) * y := rfl
102
+ @[simp, norm_cast] lemma coe_mul (x y : self_adjoint R) : ↑(x * y) = (x : R) * y := rfl
103
+
104
+ instance : has_pow (self_adjoint R) ℕ :=
105
+ ⟨λ x n, ⟨(x : R) ^ n, by simp only [mem_iff, star_pow, star_coe_eq]⟩⟩
106
+
107
+ @[simp, norm_cast] lemma coe_pow (x : self_adjoint R) (n : ℕ) : ↑(x ^ n) = (x : R) ^ n := rfl
108
108
109
109
instance : comm_ring (self_adjoint R) :=
110
- { mul_assoc := λ x y z, by { ext, exact mul_assoc _ _ _ },
111
- one_mul := λ x, by { ext, simp only [coe_mul, one_mul, coe_one] },
112
- mul_one := λ x, by { ext, simp only [mul_one, coe_mul, coe_one] },
113
- mul_comm := λ x y, by { ext, exact mul_comm _ _ },
114
- left_distrib := λ x y z, by { ext, exact left_distrib _ _ _ },
115
- right_distrib := λ x y z, by { ext, exact right_distrib _ _ _ },
116
- ..self_adjoint.add_comm_group,
117
- ..self_adjoint.has_one,
118
- ..self_adjoint.has_mul }
110
+ { npow := λ n x, x ^ n,
111
+ nsmul := (•),
112
+ zsmul := (•),
113
+ -- note: we have to do this in four pieces because there is no `injective.comm_ring_pow`.
114
+ ..(function.injective.monoid_pow _ subtype.coe_injective coe_one coe_mul coe_pow :
115
+ monoid (self_adjoint R)),
116
+ ..(function.injective.distrib _ subtype.coe_injective (self_adjoint R).coe_add coe_mul :
117
+ distrib (self_adjoint R)),
118
+ ..(function.injective.comm_semigroup _ subtype.coe_injective coe_mul :
119
+ comm_semigroup (self_adjoint R)),
120
+ ..(self_adjoint R).to_add_comm_group }
119
121
120
122
end comm_ring
121
123
122
124
section field
123
125
124
126
variables [field R] [star_ring R]
125
127
128
+ instance : has_inv (self_adjoint R) :=
129
+ { inv := λ x, ⟨(x.val)⁻¹, by simp only [mem_iff, star_inv', star_coe_eq, subtype.val_eq_coe]⟩ }
130
+
131
+ @[simp, norm_cast] lemma coe_inv (x : self_adjoint R) : ↑(x⁻¹) = (x : R)⁻¹ := rfl
132
+
133
+ instance : has_div (self_adjoint R) :=
134
+ { div := λ x y, ⟨x / y, by simp only [mem_iff, star_div', star_coe_eq, subtype.val_eq_coe]⟩ }
135
+
136
+ @[simp, norm_cast] lemma coe_div (x y : self_adjoint R) : ↑(x / y) = (x / y : R) := rfl
137
+
138
+ instance : has_pow (self_adjoint R) ℤ :=
139
+ { pow := λ x z, ⟨x ^ z, by simp only [mem_iff, star_zpow₀, star_coe_eq, subtype.val_eq_coe]⟩ }
140
+
141
+ @[simp, norm_cast] lemma coe_zpow (x : self_adjoint R) (z : ℤ) : ↑(x ^ z) = (x : R) ^ z := rfl
142
+
126
143
instance : field (self_adjoint R) :=
127
- { inv := λ x, ⟨(x.val)⁻¹, by simp only [mem_iff, star_inv', star_coe_eq, subtype.val_eq_coe]⟩,
128
- exists_pair_ne := ⟨0 , 1 , subtype.ne_of_val_ne zero_ne_one⟩,
129
- mul_inv_cancel := λ x hx, by { ext, exact mul_inv_cancel (λ H, hx $ subtype.eq H) },
130
- inv_zero := by { ext, exact inv_zero },
144
+ { npow := λ n x, x ^ n,
145
+ zpow := λ z x, x ^ z,
146
+ nsmul := (•),
147
+ zsmul := (•),
148
+ -- note: we have to do this in three pieces because there is no `injective.field_pow`.
149
+ ..(function.injective.div_inv_monoid_pow _ subtype.coe_injective _ _ coe_inv coe_div _ coe_zpow :
150
+ div_inv_monoid (self_adjoint R)),
151
+ ..(function.injective.group_with_zero _ subtype.coe_injective (self_adjoint R).coe_zero _ _ _ _ :
152
+ group_with_zero (self_adjoint R)),
131
153
..self_adjoint.comm_ring }
132
154
133
- @[simp, norm_cast] lemma coe_inv (x : self_adjoint R) :
134
- (coe : self_adjoint R → R) (x⁻¹) = (x : R)⁻¹ := rfl
135
-
136
155
end field
137
156
138
157
section has_scalar
0 commit comments