Skip to content

Commit 44efe04

Browse files
committed
chore(GroupTheory/Finiteness): move Group.rank to a new file (#24326)
That reduces imports by quite a lot: We don't even import `MonoidWithZero` anymore! See leanprover-community/mathlib3#12765 for the new copyright header. From Toric
1 parent 6225383 commit 44efe04

File tree

8 files changed

+96
-78
lines changed

8 files changed

+96
-78
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3693,6 +3693,7 @@ import Mathlib.GroupTheory.PushoutI
36933693
import Mathlib.GroupTheory.QuotientGroup.Basic
36943694
import Mathlib.GroupTheory.QuotientGroup.Defs
36953695
import Mathlib.GroupTheory.QuotientGroup.Finite
3696+
import Mathlib.GroupTheory.Rank
36963697
import Mathlib.GroupTheory.Schreier
36973698
import Mathlib.GroupTheory.SchurZassenhaus
36983699
import Mathlib.GroupTheory.SemidirectProduct

Mathlib/GroupTheory/Abelianization.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kenny Lau, Michael Howes, Antoine Chambert-Loir
55
-/
66
import Mathlib.Data.Finite.Card
7-
import Mathlib.Data.Finite.Prod
87
import Mathlib.GroupTheory.Commutator.Basic
98
import Mathlib.GroupTheory.Coset.Basic
10-
import Mathlib.GroupTheory.Finiteness
9+
import Mathlib.GroupTheory.Rank
1110

1211
/-!
1312
# The abelianization of a group

Mathlib/GroupTheory/Commutator/Finite.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Jordan Brown, Thomas Browning, Patrick Lutz
55
-/
66
import Mathlib.Algebra.Group.Subgroup.Finite
77
import Mathlib.GroupTheory.Commutator.Basic
8-
import Mathlib.GroupTheory.Finiteness
8+
import Mathlib.GroupTheory.Rank
99
import Mathlib.GroupTheory.Index
1010

1111
/-!

Mathlib/GroupTheory/Finiteness.lean

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Authors: Riccardo Brasca
66
import Mathlib.Algebra.Group.Pointwise.Set.Finite
77
import Mathlib.Algebra.Group.Subgroup.Pointwise
88
import Mathlib.GroupTheory.QuotientGroup.Defs
9-
import Mathlib.SetTheory.Cardinal.Finite
109

1110
/-!
1211
# Finitely generated monoids and groups
@@ -25,6 +24,7 @@ group.
2524
2625
-/
2726

27+
assert_not_exists MonoidWithZero
2828

2929
/-! ### Monoids and submonoids -/
3030

@@ -317,80 +317,8 @@ instance Group.closure_finite_fg (s : Set G) [Finite s] : Group.FG (Subgroup.clo
317317
haveI := Fintype.ofFinite s
318318
s.coe_toFinset ▸ Group.closure_finset_fg s.toFinset
319319

320-
variable (G)
321-
322-
/-- The minimum number of generators of a group. -/
323-
@[to_additive "The minimum number of generators of an additive group"]
324-
noncomputable def Group.rank [h : Group.FG G] :=
325-
@Nat.find _ (Classical.decPred _) (Group.fg_iff'.mp h)
326-
327-
@[to_additive]
328-
theorem Group.rank_spec [h : Group.FG G] :
329-
∃ S : Finset G, S.card = Group.rank G ∧ Subgroup.closure (S : Set G) = ⊤ :=
330-
@Nat.find_spec _ (Classical.decPred _) (Group.fg_iff'.mp h)
331-
332-
@[to_additive]
333-
theorem Group.rank_le [h : Group.FG G] {S : Finset G} (hS : Subgroup.closure (S : Set G) = ⊤) :
334-
Group.rank G ≤ S.card :=
335-
@Nat.find_le _ _ (Classical.decPred _) (Group.fg_iff'.mp h) ⟨S, rfl, hS⟩
336-
337-
variable {G} {G' : Type*} [Group G']
338-
339-
@[to_additive]
340-
theorem Group.rank_le_of_surjective [Group.FG G] [Group.FG G'] (f : G →* G')
341-
(hf : Function.Surjective f) : Group.rank G' ≤ Group.rank G := by
342-
classical
343-
obtain ⟨S, hS1, hS2⟩ := Group.rank_spec G
344-
trans (S.image f).card
345-
· apply Group.rank_le
346-
rw [Finset.coe_image, ← MonoidHom.map_closure, hS2, Subgroup.map_top_of_surjective f hf]
347-
· exact Finset.card_image_le.trans_eq hS1
348-
349-
@[to_additive]
350-
theorem Group.rank_range_le [Group.FG G] {f : G →* G'} : Group.rank f.range ≤ Group.rank G :=
351-
Group.rank_le_of_surjective f.rangeRestrict f.rangeRestrict_surjective
352-
353-
@[to_additive]
354-
theorem Group.rank_congr [Group.FG G] [Group.FG G'] (f : G ≃* G') : Group.rank G = Group.rank G' :=
355-
le_antisymm (Group.rank_le_of_surjective f.symm f.symm.surjective)
356-
(Group.rank_le_of_surjective f f.surjective)
357-
358320
end Group
359321

360-
namespace Subgroup
361-
362-
@[to_additive]
363-
theorem rank_congr {H K : Subgroup G} [Group.FG H] [Group.FG K] (h : H = K) :
364-
Group.rank H = Group.rank K := by subst h; rfl
365-
366-
@[to_additive]
367-
theorem rank_closure_finset_le_card (s : Finset G) : Group.rank (closure (s : Set G)) ≤ s.card := by
368-
classical
369-
let t : Finset (closure (s : Set G)) := s.preimage Subtype.val Subtype.coe_injective.injOn
370-
have ht : closure (t : Set (closure (s : Set G))) = ⊤ := by
371-
rw [Finset.coe_preimage]
372-
exact closure_preimage_eq_top (s : Set G)
373-
apply (Group.rank_le (closure (s : Set G)) ht).trans
374-
suffices H : Set.InjOn Subtype.val (t : Set (closure (s : Set G))) by
375-
rw [← Finset.card_image_of_injOn H, Finset.image_preimage]
376-
apply Finset.card_filter_le
377-
apply Subtype.coe_injective.injOn
378-
379-
@[to_additive]
380-
theorem rank_closure_finite_le_nat_card (s : Set G) [Finite s] :
381-
Group.rank (closure s) ≤ Nat.card s := by
382-
haveI := Fintype.ofFinite s
383-
rw [Nat.card_eq_fintype_card, ← s.toFinset_card, ← rank_congr (congr_arg _ s.coe_toFinset)]
384-
exact rank_closure_finset_le_card s.toFinset
385-
386-
theorem nat_card_centralizer_nat_card_stabilizer (g : G) :
387-
Nat.card (Subgroup.centralizer {g}) =
388-
Nat.card (MulAction.stabilizer (ConjAct G) g) := by
389-
rw [Subgroup.centralizer_eq_comap_stabilizer]
390-
rfl
391-
392-
end Subgroup
393-
394322
section QuotientGroup
395323

396324
@[to_additive]

Mathlib/GroupTheory/Perm/Centralizer.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ Authors: Antoine Chambert-Loir
55
-/
66
import Mathlib.Algebra.Order.BigOperators.GroupWithZero.Multiset
77
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
8-
import Mathlib.GroupTheory.Finiteness
98
import Mathlib.GroupTheory.NoncommCoprod
109
import Mathlib.GroupTheory.Perm.ConjAct
1110
import Mathlib.GroupTheory.Perm.Cycle.PossibleTypes
1211
import Mathlib.GroupTheory.Perm.DomMulAct
12+
import Mathlib.GroupTheory.Rank
1313

1414
/-!
1515
# Centralizer of a permutation and cardinality of conjugacy classes in the symmetric groups

Mathlib/GroupTheory/Rank.lean

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/-
2+
Copyright (c) 2025 Thomas Browning. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Thomas Browning
5+
-/
6+
import Mathlib.GroupTheory.Finiteness
7+
import Mathlib.SetTheory.Cardinal.Finite
8+
9+
/-!
10+
# Rank of a group
11+
12+
This file defines the rank of a group, namely the minimum size of a generating set.
13+
14+
## TODO
15+
16+
Should we define `erank G : ℕ∞` the rank of a not necessarily finitely generated group `G`,
17+
then redefine `rank G` as `(erank G).toNat`? Maybe a `Cardinal`-valued version too?
18+
-/
19+
20+
open Function Group
21+
22+
variable {G H : Type*} [Group G] [Group H]
23+
24+
namespace Group
25+
26+
variable (G) in
27+
/-- The minimum number of generators of a group. -/
28+
@[to_additive "The minimum number of generators of an additive group."]
29+
noncomputable def rank [h : FG G] : ℕ := @Nat.find _ (Classical.decPred _) (fg_iff'.mp h)
30+
31+
variable (G) in
32+
@[to_additive]
33+
lemma rank_spec [h : FG G] : ∃ S : Finset G, S.card = rank G ∧ .closure S = (⊤ : Subgroup G) :=
34+
@Nat.find_spec _ (Classical.decPred _) (fg_iff'.mp h)
35+
36+
@[to_additive]
37+
lemma rank_le [h : FG G] {S : Finset G} (hS : .closure S = (⊤ : Subgroup G)) : rank G ≤ S.card :=
38+
@Nat.find_le _ _ (Classical.decPred _) (fg_iff'.mp h) ⟨S, rfl, hS⟩
39+
40+
@[to_additive]
41+
lemma rank_le_of_surjective [FG G] [FG H] (f : G →* H) (hf : Surjective f) : rank H ≤ rank G := by
42+
classical
43+
obtain ⟨S, hS1, hS2⟩ := rank_spec G
44+
trans (S.image f).card
45+
· apply rank_le
46+
rw [Finset.coe_image, ← MonoidHom.map_closure, hS2, Subgroup.map_top_of_surjective f hf]
47+
· exact Finset.card_image_le.trans_eq hS1
48+
49+
@[to_additive]
50+
lemma rank_range_le [FG G] {f : G →* H} : rank f.range ≤ rank G :=
51+
rank_le_of_surjective f.rangeRestrict f.rangeRestrict_surjective
52+
53+
@[to_additive]
54+
lemma rank_congr [FG G] [FG H] (e : G ≃* H) : rank G = rank H :=
55+
le_antisymm (rank_le_of_surjective e.symm e.symm.surjective)
56+
(rank_le_of_surjective e e.surjective)
57+
58+
end Group
59+
60+
namespace Subgroup
61+
62+
@[to_additive]
63+
lemma rank_congr {H K : Subgroup G} [Group.FG H] [Group.FG K] (h : H = K) : rank H = rank K := by
64+
subst h; rfl
65+
66+
@[to_additive]
67+
lemma rank_closure_finset_le_card (s : Finset G) : rank (closure (s : Set G)) ≤ s.card := by
68+
classical
69+
let t : Finset (closure (s : Set G)) := s.preimage Subtype.val Subtype.coe_injective.injOn
70+
have ht : closure (t : Set (closure (s : Set G))) = ⊤ := by
71+
rw [Finset.coe_preimage]
72+
exact closure_preimage_eq_top (s : Set G)
73+
apply (rank_le ht).trans
74+
suffices H : Set.InjOn Subtype.val (t : Set (closure (s : Set G))) by
75+
rw [← Finset.card_image_of_injOn H, Finset.image_preimage]
76+
apply Finset.card_filter_le
77+
apply Subtype.coe_injective.injOn
78+
79+
@[to_additive]
80+
lemma rank_closure_finite_le_nat_card (s : Set G) [Finite s] : rank (closure s) ≤ Nat.card s := by
81+
haveI := Fintype.ofFinite s
82+
rw [Nat.card_eq_fintype_card, ← s.toFinset_card, ← rank_congr (congr_arg _ s.coe_toFinset)]
83+
exact rank_closure_finset_le_card s.toFinset
84+
85+
lemma nat_card_centralizer_nat_card_stabilizer (g : G) :
86+
Nat.card (centralizer {g}) = Nat.card (MulAction.stabilizer (ConjAct G) g) := by
87+
rw [centralizer_eq_comap_stabilizer]; rfl
88+
89+
end Subgroup

Mathlib/GroupTheory/Schreier.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ theorem rank_le_index_mul_rank [hG : Group.FG G] [FiniteIndex H] :
159159
obtain ⟨S, hS₀, hS⟩ := Group.rank_spec G
160160
obtain ⟨T, hT₀, hT⟩ := exists_finset_card_le_mul H hS
161161
calc
162-
Group.rank H ≤ #T := Group.rank_le H hT
162+
Group.rank H ≤ #T := Group.rank_le hT
163163
_ ≤ H.index * #S := hT₀
164164
_ = H.index * Group.rank G := congr_arg (H.index * ·) hS₀
165165

Mathlib/NumberTheory/PellMatiyasevic.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Copyright (c) 2017 Mario Carneiro. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Mario Carneiro
55
-/
6+
import Mathlib.Data.Nat.ModEq
67
import Mathlib.Data.Nat.Prime.Basic
78
import Mathlib.NumberTheory.Zsqrtd.Basic
89

0 commit comments

Comments
 (0)