Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit f63b8f1

Browse files
committed
feat(algebra/star/basic): add some helper lemmas about star (#9651)
This adds the new lemmas: * `star_pow` * `star_nsmul` * `star_gsmul` * `star_prod` * `star_div` * `star_div'` * `star_inv` * `star_inv'` * `star_mul'` and generalizes the typeclass assumptions from `star_ring` to `star_add_monoid` on: * `star_neg` * `star_sub` * `star_sum`
1 parent b486c88 commit f63b8f1

File tree

1 file changed

+60
-19
lines changed

1 file changed

+60
-19
lines changed

src/algebra/star/basic.lean

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ class star_monoid (R : Type u) [monoid R] extends has_involutive_star R :=
8282
export star_monoid (star_mul)
8383
attribute [simp] star_mul
8484

85+
/-- In a commutative ring, make `simp` prefer leaving the order unchanged. -/
86+
@[simp] lemma star_mul' [comm_monoid R] [star_monoid R] (x y : R) :
87+
star (x * y) = star x * star y :=
88+
(star_mul x y).trans (mul_comm _ _)
89+
8590
/-- `star` as an `mul_equiv` from `R` to `Rᵒᵖ` -/
8691
@[simps apply]
8792
def star_mul_equiv [monoid R] [star_monoid R] : R ≃* Rᵒᵖ :=
@@ -93,19 +98,38 @@ def star_mul_equiv [monoid R] [star_monoid R] : R ≃* Rᵒᵖ :=
9398
@[simps apply]
9499
def star_mul_aut [comm_monoid R] [star_monoid R] : mul_aut R :=
95100
{ to_fun := star,
96-
map_mul' := λ x y, (star_mul x y).trans (mul_comm _ _),
101+
map_mul' := star_mul',
97102
..(has_involutive_star.star_involutive.to_equiv star) }
98103

99104
variables (R)
100105

101106
@[simp] lemma star_one [monoid R] [star_monoid R] : star (1 : R) = 1 :=
102-
begin
103-
have := congr_arg opposite.unop (star_mul_equiv : R ≃* Rᵒᵖ).map_one,
104-
rwa [star_mul_equiv_apply, opposite.unop_op, opposite.unop_one] at this,
105-
end
107+
op_injective $ (star_mul_equiv : R ≃* Rᵒᵖ).map_one.trans (op_one _).symm
106108

107109
variables {R}
108110

111+
@[simp] lemma star_pow [monoid R] [star_monoid R] (x : R) (n : ℕ) : star (x ^ n) = star x ^ n :=
112+
op_injective $
113+
((star_mul_equiv : R ≃* Rᵒᵖ).to_monoid_hom.map_pow x n).trans (op_pow (star x) n).symm
114+
115+
@[simp] lemma star_inv [group R] [star_monoid R] (x : R) : star (x⁻¹) = (star x)⁻¹ :=
116+
op_injective $
117+
((star_mul_equiv : R ≃* Rᵒᵖ).to_monoid_hom.map_inv x).trans (op_inv (star x)).symm
118+
119+
/-- When multiplication is commutative, `star` preserves division. -/
120+
@[simp] lemma star_div [comm_group R] [star_monoid R] (x y : R) : star (x / y) = star x / star y :=
121+
(star_mul_aut : R ≃* R).to_monoid_hom.map_div _ _
122+
123+
section
124+
open_locale big_operators
125+
126+
@[simp] lemma star_prod [comm_monoid R] [star_monoid R] {α : Type*}
127+
(s : finset α) (f : α → R):
128+
star (∏ x in s, f x) = ∏ x in s, star (f x) :=
129+
(star_mul_aut : R ≃* R).map_prod _ _
130+
131+
end
132+
109133
instance [monoid R] [star_monoid R] : star_monoid (Rᵒᵖ) :=
110134
{ star_mul := λ x y, unop_injective (star_mul y.unop x.unop) }
111135

@@ -155,6 +179,31 @@ variables (R)
155179

156180
variables {R}
157181

182+
@[simp] lemma star_neg [add_group R] [star_add_monoid R] (r : R) : star (-r) = - star r :=
183+
(star_add_equiv : R ≃+ R).map_neg _
184+
185+
@[simp] lemma star_sub [add_group R] [star_add_monoid R] (r s : R) :
186+
star (r - s) = star r - star s :=
187+
(star_add_equiv : R ≃+ R).map_sub _ _
188+
189+
@[simp] lemma star_nsmul [add_comm_monoid R] [star_add_monoid R] (x : R) (n : ℕ) :
190+
star (n • x) = n • star x :=
191+
(star_add_equiv : R ≃+ R).to_add_monoid_hom.map_nsmul _ _
192+
193+
@[simp] lemma star_gsmul [add_comm_group R] [star_add_monoid R] (x : R) (n : ℤ) :
194+
star (n • x) = n • star x :=
195+
(star_add_equiv : R ≃+ R).to_add_monoid_hom.map_gsmul _ _
196+
197+
section
198+
open_locale big_operators
199+
200+
@[simp] lemma star_sum [add_comm_monoid R] [star_add_monoid R] {α : Type*}
201+
(s : finset α) (f : α → R):
202+
star (∑ x in s, f x) = ∑ x in s, star (f x) :=
203+
(star_add_equiv : R ≃+ R).map_sum _ _
204+
205+
end
206+
158207
/--
159208
A `*`-ring `R` is a (semi)ring with an involutive `star` operation which is additive
160209
which makes `R` with its multiplicative structure into a `*`-monoid
@@ -184,21 +233,13 @@ def star_ring_aut [comm_semiring R] [star_ring R] : ring_aut R :=
184233
..star_add_equiv,
185234
..star_mul_aut }
186235

187-
section
188-
open_locale big_operators
236+
@[simp] lemma star_inv' [division_ring R] [star_ring R] (x : R) : star (x⁻¹) = (star x)⁻¹ :=
237+
op_injective $
238+
((star_ring_equiv : R ≃+* Rᵒᵖ).to_ring_hom.map_inv x).trans (op_inv (star x)).symm
189239

190-
@[simp] lemma star_sum [semiring R] [star_ring R] {α : Type*}
191-
(s : finset α) (f : α → R):
192-
star (∑ x in s, f x) = ∑ x in s, star (f x) :=
193-
(star_add_equiv : R ≃+ R).map_sum _ _
194-
195-
end
196-
197-
@[simp] lemma star_neg [ring R] [star_ring R] (r : R) : star (-r) = - star r :=
198-
(star_add_equiv : R ≃+ R).map_neg _
199-
200-
@[simp] lemma star_sub [ring R] [star_ring R] (r s : R) : star (r - s) = star r - star s :=
201-
(star_add_equiv : R ≃+ R).map_sub _ _
240+
/-- When multiplication is commutative, `star` preserves division. -/
241+
@[simp] lemma star_div' [field R] [star_ring R] (x y : R) : star (x / y) = star x / star y :=
242+
(star_ring_aut : R ≃+* R).to_ring_hom.map_div _ _
202243

203244
@[simp] lemma star_bit0 [ring R] [star_ring R] (r : R) : star (bit0 r) = bit0 (star r) :=
204245
by simp [bit0]

0 commit comments

Comments
 (0)