Skip to content

Commit 2715441

Browse files
refactor(GroupTheory/Torsion): make primaryComponent total (#39484)
Change `primaryComponent` to the `IsPGroup`-style `{g | ∃ k, g ^ p ^ k = 1}`, making the definitions total over `p : ℕ` without requiring `[Fact p.Prime]`. Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 36c492b commit 2715441

1 file changed

Lines changed: 89 additions & 64 deletions

File tree

Mathlib/GroupTheory/Torsion.lean

Lines changed: 89 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,22 @@ def IsTorsion :=
5656
∀ g : G, IsOfFinOrder g
5757

5858
/-- A monoid is not a torsion monoid if it has an element of infinite order. -/
59-
@[to_additive (attr := simp) /-- An additive monoid is not a torsion monoid if it
60-
has an element of infinite order. -/]
61-
theorem not_isTorsion_iff : ¬IsTorsion G ↔ ∃ g : G, ¬IsOfFinOrder g := by
62-
rw [IsTorsion, not_forall]
59+
@[to_additive (attr := simp)
60+
/-- An additive monoid is not a torsion monoid if it has an element of infinite order. -/]
61+
theorem not_isTorsion_iff : ¬IsTorsion G ↔ ∃ g : G, ¬IsOfFinOrder g :=
62+
not_forall
6363

6464
end Monoid
6565

6666
open Monoid
6767

6868
/-- Torsion monoids are really groups. -/
6969
@[to_additive (attr := implicit_reducible)
70-
/-- Torsion additive monoids are really additive groups -/]
70+
/-- Torsion additive monoids are really additive groups -/]
7171
noncomputable def IsTorsion.group [Monoid G] (tG : IsTorsion G) : Group G :=
7272
{ ‹Monoid G› with
73-
inv := fun g => g ^ (orderOf g - 1)
74-
inv_mul_cancel := fun g => by
73+
inv g := g ^ (orderOf g - 1)
74+
inv_mul_cancel g := by
7575
rw [← pow_succ, tsub_add_cancel_of_le, pow_orderOf_eq_one]
7676
exact (tG g).orderOf_pos }
7777

@@ -81,51 +81,50 @@ variable [Group G] {N : Subgroup G} [Group H]
8181

8282
/-- Subgroups of torsion groups are torsion groups. -/
8383
@[to_additive /-- Subgroups of additive torsion groups are additive torsion groups. -/]
84-
theorem IsTorsion.subgroup (tG : IsTorsion G) (H : Subgroup G) : IsTorsion H := fun h =>
84+
theorem IsTorsion.subgroup (tG : IsTorsion G) (H : Subgroup G) : IsTorsion H := fun h
8585
Submonoid.isOfFinOrder_coe.1 <| tG h
8686

8787
/-- The image of a surjective torsion group homomorphism is torsion. -/
8888
@[to_additive AddIsTorsion.of_surjective
89-
/-- The image of a surjective additive torsion group homomorphism is torsion. -/]
89+
/-- The image of a surjective additive torsion group homomorphism is torsion. -/]
9090
theorem IsTorsion.of_surjective {f : G →* H} (hf : Function.Surjective f) (tG : IsTorsion G) :
91-
IsTorsion H := fun h => by
92-
obtain ⟨g, hg⟩ := hf h
93-
rw [← hg]
91+
IsTorsion H := fun h ↦ by
92+
obtain ⟨g, rfl⟩ := hf h
9493
exact f.isOfFinOrder (tG g)
9594

9695
/-- Torsion groups are closed under extensions. -/
9796
@[to_additive AddIsTorsion.extension_closed
9897
/-- Additive torsion groups are closed under extensions. -/]
9998
theorem IsTorsion.extension_closed {f : G →* H} (hN : N = f.ker) (tH : IsTorsion H)
100-
(tN : IsTorsion N) : IsTorsion G := fun g => by
99+
(tN : IsTorsion N) : IsTorsion G := fun g by
101100
obtain ⟨ngn, ngnpos, hngn⟩ := (tH <| f g).exists_pow_eq_one
102101
have hmem := MonoidHom.mem_ker.mpr ((f.map_pow g ngn).trans hngn)
103102
lift g ^ ngn to N using hN.symm ▸ hmem with gn h
104103
obtain ⟨nn, nnpos, hnn⟩ := (tN gn).exists_pow_eq_one
105104
exact isOfFinOrder_iff_pow_eq_one.mpr <| ⟨ngn * nn, mul_pos ngnpos nnpos, by
106-
rw [pow_mul, ← h, ← Subgroup.coe_pow, hnn, Subgroup.coe_one]⟩
105+
rw [pow_mul, ← h, ← Subgroup.coe_pow, hnn, Subgroup.coe_one]⟩
107106

108107
/-- The image of a quotient is torsion iff the group is torsion. -/
109108
@[to_additive AddIsTorsion.quotient_iff
110-
/-- The image of a quotient is additively torsion iff the group is torsion. -/]
109+
/-- The image of a quotient is additively torsion iff the group is torsion. -/]
111110
theorem IsTorsion.quotient_iff {f : G →* H} (hf : Function.Surjective f) (hN : N = f.ker)
112111
(tN : IsTorsion N) : IsTorsion H ↔ IsTorsion G :=
113-
fun tH => IsTorsion.extension_closed hN tH tN, fun tG => IsTorsion.of_surjective hf tG⟩
112+
fun tH IsTorsion.extension_closed hN tH tN, fun tG IsTorsion.of_surjective hf tG⟩
114113

115114
/-- If a group exponent exists, the group is torsion. -/
116115
@[to_additive ExponentExists.is_add_torsion
117-
/-- If a group exponent exists, the group is additively torsion. -/]
118-
theorem ExponentExists.isTorsion (h : ExponentExists G) : IsTorsion G := fun g => by
116+
/-- If a group exponent exists, the group is additively torsion. -/]
117+
theorem ExponentExists.isTorsion (h : ExponentExists G) : IsTorsion G := fun g by
119118
obtain ⟨n, npos, hn⟩ := h
120119
exact isOfFinOrder_iff_pow_eq_one.mpr ⟨n, npos, hn g⟩
121120

122121
/-- The group exponent exists for any bounded torsion group. -/
123122
@[to_additive IsAddTorsion.exponentExists
124-
/-- The group exponent exists for any bounded additive torsion group. -/]
123+
/-- The group exponent exists for any bounded additive torsion group. -/]
125124
theorem IsTorsion.exponentExists (tG : IsTorsion G)
126-
(bounded : (Set.range fun g : G => orderOf g).Finite) : ExponentExists G :=
125+
(bounded : (Set.range fun g : G orderOf g).Finite) : ExponentExists G :=
127126
exponent_ne_zero.mp <|
128-
(exponent_ne_zero_iff_range_orderOf_finite fun g => (tG g).orderOf_pos).mpr bounded
127+
(exponent_ne_zero_iff_range_orderOf_finite fun g (tG g).orderOf_pos).mpr bounded
129128

130129
/-- Finite groups are torsion groups. -/
131130
@[to_additive is_add_torsion_of_finite /-- Finite additive groups are additive torsion groups. -/]
@@ -158,8 +157,7 @@ namespace AddMonoid
158157

159158
/-- A module whose scalars are additively torsion is additively torsion. -/
160159
theorem IsTorsion.module_of_torsion [Semiring R] [Module R M] (tR : IsTorsion R) : IsTorsion M :=
161-
fun f =>
162-
isOfFinAddOrder_iff_nsmul_eq_zero.mpr <| by
160+
fun f ↦ isOfFinAddOrder_iff_nsmul_eq_zero.mpr <| by
163161
obtain ⟨n, npos, hn⟩ := (tR 1).exists_nsmul_eq_zero
164162
exact ⟨n, npos, by simp only [← Nat.cast_smul_eq_nsmul R _ f, ← nsmul_one, hn, zero_smul]⟩
165163

@@ -198,7 +196,7 @@ variable {G}
198196

199197
/-- Torsion submonoids are torsion. -/
200198
@[to_additive /-- Additive torsion submonoids are additively torsion. -/]
201-
theorem torsion.isTorsion : IsTorsion <| torsion G := fun ⟨x, n, npos, hn⟩ =>
199+
theorem torsion.isTorsion : IsTorsion <| torsion G := fun ⟨x, n, npos, hn⟩
202200
⟨n, npos,
203201
Subtype.ext <| by
204202
dsimp
@@ -207,44 +205,56 @@ theorem torsion.isTorsion : IsTorsion <| torsion G := fun ⟨x, n, npos, hn⟩ =
207205
rw [_root_.mul_one, SubmonoidClass.coe_pow, Subtype.coe_mk,
208206
(isPeriodicPt_mul_iff_pow_eq_one _).mp hn]⟩
209207

210-
variable (G) (p : ℕ) [hp : Fact p.Prime]
208+
variable (G) (p : ℕ)
211209

212-
/-- The `p`-primary component is the submonoid of elements with order prime-power of `p`. -/
213-
@[to_additive (attr := simps)
214-
/-- The `p`-primary component is the submonoid of elements with additive
215-
order prime-power of `p`. -/]
210+
/-- The `p`-primary component is the submonoid of elements `g` such that `g ^ p ^ k = 1`
211+
for some `k`. For prime `p`, these are exactly the elements of `p`-power order. -/
212+
@[to_additive
213+
/-- The additive `p`-primary component is the submonoid of elements `g` such that
214+
`p ^ k • g = 0` for some `k`. For prime `p`, these are exactly the elements of additive
215+
`p`-power order. -/]
216216
def primaryComponent : Submonoid G where
217-
carrier := { g | ∃ n : ℕ, orderOf g = p ^ n }
218-
one_mem' := ⟨0, by rw [pow_zero, orderOf_one]⟩
219-
mul_mem' hg₁ hg₂ :=
220-
exists_orderOf_eq_prime_pow_iff.mpr <| by
221-
obtain ⟨m, hm⟩ := exists_orderOf_eq_prime_pow_iff.mp hg₁
222-
obtain ⟨n, hn⟩ := exists_orderOf_eq_prime_pow_iff.mp hg₂
223-
exact
224-
⟨m + n, by
225-
rw [mul_pow, pow_add, pow_mul, hm, one_pow, Monoid.one_mul, mul_comm, pow_mul, hn,
226-
one_pow]⟩
217+
carrier := { g | ∃ k : ℕ, g ^ p ^ k = 1 }
218+
one_mem' := ⟨0, by simp⟩
219+
mul_mem' := fun {a b} ⟨m, hm⟩ ⟨n, hn⟩ ↦ ⟨m + n, by
220+
rw [mul_pow, pow_add, pow_mul, hm, one_pow, one_mul, mul_comm, pow_mul, hn, one_pow]⟩
227221

228222
variable {G} {p}
229223

224+
/-- `g` lies in the `p`-primary component iff `g ^ p ^ k = 1` for some `k`. -/
225+
@[to_additive (attr := simp)
226+
/-- `g` lies in the additive `p`-primary component iff `p ^ k • g = 0` for some `k`. -/]
227+
theorem mem_primaryComponent {g : G} : g ∈ primaryComponent G p ↔ ∃ k : ℕ, g ^ p ^ k = 1 :=
228+
.rfl
229+
230+
/-- For prime `p`, `g` lies in the `p`-primary component iff its order is a power of `p`. -/
231+
@[to_additive
232+
/-- For prime `p`, `g` lies in the additive `p`-primary component iff its additive
233+
order is a power of `p`. -/]
234+
theorem mem_primaryComponent_iff_orderOf [Fact p.Prime] {g : G} :
235+
g ∈ primaryComponent G p ↔ ∃ n : ℕ, orderOf g = p ^ n :=
236+
exists_orderOf_eq_prime_pow_iff.symm
237+
238+
variable [hp : Fact p.Prime]
239+
230240
/-- Elements of the `p`-primary component have order `p^n` for some `n`. -/
231241
@[to_additive primaryComponent.exists_orderOf_eq_prime_nsmul
232-
/-- Elements of the `p`-primary component have additive order `p^n` for some `n` -/]
242+
/-- Elements of the `p`-primary component have additive order `p^n` for some `n`. -/]
233243
theorem primaryComponent.exists_orderOf_eq_prime_pow (g : CommMonoid.primaryComponent G p) :
234244
∃ n : ℕ, orderOf g = p ^ n := by
235-
obtain ⟨_, hn⟩ := g.property
236-
rw [orderOf_submonoid g] at hn
237-
exact ⟨_, hn⟩
245+
rw [← orderOf_submonoid, ← mem_primaryComponent_iff_orderOf]
246+
exact g.property
238247

239248
/-- The `p`- and `q`-primary components are disjoint for `p ≠ q`. -/
240249
@[to_additive /-- The `p`- and `q`-primary components are disjoint for `p ≠ q`. -/]
241250
theorem primaryComponent.disjoint {p' : ℕ} [hp' : Fact p'.Prime] (hne : p ≠ p') :
242251
Disjoint (CommMonoid.primaryComponent G p) (CommMonoid.primaryComponent G p') :=
243-
Submonoid.disjoint_def.mpr <| by
244-
rintro g ⟨_ | n, hn⟩ ⟨n', hn'⟩
252+
Submonoid.disjoint_def.mpr fun {g} hg hg' ↦ by
253+
rw [mem_primaryComponent_iff_orderOf] at hg hg'
254+
obtain ⟨_ | n, hn⟩ := hg
245255
· rwa [pow_zero, orderOf_eq_one_iff] at hn
246-
· exact
247-
absurd (eq_of_prime_pow_eq hp.out.prime hp'.out.prime n.succ_pos (hn.symm.trans hn')) hne
256+
· obtain ⟨_, hn'⟩ := hg'
257+
exact absurd (eq_of_prime_pow_eq hp.out.prime hp'.out.prime n.succ_pos (hn hn')) hne
248258

249259
end CommMonoid
250260

@@ -278,8 +288,8 @@ end Monoid.IsTorsion
278288

279289
/-- Torsion submonoids of a torsion submonoid are isomorphic to the submonoid. -/
280290
@[to_additive (attr := simp) AddCommMonoid.Torsion.ofTorsion
281-
/-- Additive torsion submonoids of an additive torsion submonoid are
282-
isomorphic to the submonoid. -/]
291+
/-- Additive torsion submonoids of an additive torsion submonoid are
292+
isomorphic to the submonoid. -/]
283293
def Torsion.ofTorsion : torsion (torsion G) ≃* torsion G :=
284294
Monoid.IsTorsion.torsionMulEquiv CommMonoid.torsion.isTorsion
285295

@@ -294,12 +304,12 @@ namespace CommGroup
294304
/-- The torsion subgroup of an abelian group. -/
295305
@[to_additive /-- The torsion subgroup of an additive abelian group. -/]
296306
def torsion : Subgroup G :=
297-
{ CommMonoid.torsion G with inv_mem' := fun hx => IsOfFinOrder.inv hx }
307+
{ CommMonoid.torsion G with inv_mem' := fun hx IsOfFinOrder.inv hx }
298308

299309
/-- The torsion submonoid of an abelian group equals the torsion subgroup as a submonoid. -/
300310
@[to_additive add_torsion_eq_add_torsion_submonoid
301-
/-- The additive torsion submonoid of an abelian group equals the torsion
302-
subgroup as a submonoid. -/]
311+
/-- The additive torsion submonoid of an abelian group equals the torsion
312+
subgroup as a submonoid. -/]
303313
theorem torsion_eq_torsion_submonoid : CommMonoid.torsion G = (torsion G).toSubmonoid :=
304314
rfl
305315

@@ -327,22 +337,37 @@ lemma isTorsion_quotient_range_powMonoidHom {n : ℕ} (hn : n ≠ 0) :
327337
rw [← QuotientGroup.mk_pow, QuotientGroup.eq_one_iff]
328338
simp
329339

330-
variable (p : ℕ) [hp : Fact p.Prime]
340+
variable (p : ℕ)
331341

332-
/-- The `p`-primary component is the subgroup of elements with order prime-power of `p`. -/
333-
@[to_additive (attr := simps!)
334-
/-- The `p`-primary component is the subgroup of elements with additive order
335-
prime-power of `p`. -/]
342+
/-- The `p`-primary component is the subgroup of elements `g` such that `g ^ p ^ k = 1`
343+
for some `k`. For prime `p`, these are exactly the elements of `p`-power order. -/
344+
@[to_additive
345+
/-- The additive `p`-primary component is the subgroup of elements `g` such that
346+
`p ^ k • g = 0` for some `k`. For prime `p`, these are exactly the elements of additive
347+
`p`-power order. -/]
336348
def primaryComponent : Subgroup G :=
337349
{ CommMonoid.primaryComponent G p with
338-
inv_mem' := fun {g} ⟨n, hn⟩ => ⟨n, (orderOf_inv g).trans hn⟩ }
350+
inv_mem' := fun {g} ⟨k, hk⟩ ↦ ⟨k, by rw [inv_pow, hk, inv_one]⟩ }
339351

340352
variable {G} {p}
341353

342-
/-- The `p`-primary component is a `p` group. -/
343-
theorem primaryComponent.isPGroup : IsPGroup p <| primaryComponent G p := fun g =>
344-
(propext exists_orderOf_eq_prime_pow_iff.symm).mpr
345-
(CommMonoid.primaryComponent.exists_orderOf_eq_prime_pow g)
354+
/-- `g` lies in the `p`-primary component iff `g ^ p ^ k = 1` for some `k`. -/
355+
@[to_additive (attr := simp)
356+
/-- `g` lies in the additive `p`-primary component iff `p ^ k • g = 0` for some `k`. -/]
357+
theorem mem_primaryComponent {g : G} : g ∈ primaryComponent G p ↔ ∃ k : ℕ, g ^ p ^ k = 1 :=
358+
.rfl
359+
360+
/-- For prime `p`, `g` lies in the `p`-primary component iff its order is a power of `p`. -/
361+
@[to_additive
362+
/-- For prime `p`, `g` lies in the additive `p`-primary component iff its additive
363+
order is a power of `p`. -/]
364+
theorem mem_primaryComponent_iff_orderOf [Fact p.Prime] {g : G} :
365+
g ∈ primaryComponent G p ↔ ∃ n : ℕ, orderOf g = p ^ n :=
366+
exists_orderOf_eq_prime_pow_iff.symm
367+
368+
/-- The `p`-primary component is a `p`-group. -/
369+
theorem primaryComponent.isPGroup : IsPGroup p (primaryComponent G p) := fun g ↦
370+
g.property.imp fun _ hk ↦ Subtype.ext <| by simpa using hk
346371

347372
end CommGroup
348373

@@ -373,8 +398,8 @@ instance {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] :
373398
let e : (M ⧸ AddCommGroup.torsion M) ≃+ (M ⧸ S) := QuotientAddGroup.congr _ _ (.refl _)
374399
(by simp [S])
375400
-- So we can copy over scalar multiplication.
376-
letI : SMul R (M ⧸ AddCommGroup.torsion M) := ⟨fun r m => e.symm (r • e m)⟩
377-
Function.Injective.module R e.toAddMonoidHom e.injective (fun _ _ =>
401+
letI : SMul R (M ⧸ AddCommGroup.torsion M) := ⟨fun r m e.symm (r • e m)⟩
402+
Function.Injective.module R e.toAddMonoidHom e.injective (fun _ _
378403
e.symm.injective (e.symm_apply_apply _))
379404

380405
end AddCommGroup

0 commit comments

Comments
 (0)