Skip to content

Commit 42019ce

Browse files
committed
feat: add theorem cast_subgroup_of_units_card_ne_zero (#6500)
Adds a theorem saying the cardinality of a multiplicative subgroup of a field, cast to the field, is nonzero. As well as `sum_subgroup_units_zero_of_ne_bot` and other theorems about summing over multiplicative subgroups. Co-authored-by: Pratyush Mishra <prat@upenn.edu> Co-authored-by: Buster <rcopley@gmail.com>
1 parent edaa10a commit 42019ce

File tree

5 files changed

+140
-8
lines changed

5 files changed

+140
-8
lines changed

Mathlib/Data/Fintype/Basic.lean

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,13 +1217,18 @@ end Trunc
12171217

12181218
namespace Multiset
12191219

1220-
variable [Fintype α] [DecidableEq α]
1220+
variable [Fintype α] [DecidableEq α] [Fintype β]
12211221

12221222
@[simp]
12231223
theorem count_univ (a : α) : count a Finset.univ.val = 1 :=
12241224
count_eq_one_of_mem Finset.univ.nodup (Finset.mem_univ _)
12251225
#align multiset.count_univ Multiset.count_univ
12261226

1227+
@[simp]
1228+
theorem map_univ_val_equiv (e : α ≃ β) :
1229+
map e univ.val = univ.val := by
1230+
rw [←congr_arg Finset.val (Finset.map_univ_equiv e), Finset.map_val, Equiv.coe_toEmbedding]
1231+
12271232
end Multiset
12281233

12291234
/-- Auxiliary definition to show `exists_seq_of_forall_finset_exists`. -/

Mathlib/FieldTheory/Finite/Basic.lean

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,107 @@ theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] :
111111
rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one]
112112
#align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one
113113

114+
theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K]
115+
(G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by
116+
let n := Fintype.card G
117+
intro nzero
118+
have ⟨p, char_p⟩ := CharP.exists K
119+
have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero
120+
cases CharP.char_is_prime_or_zero K p with
121+
| inr pzero =>
122+
exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd
123+
| inl pprime =>
124+
have fact_pprime := Fact.mk pprime
125+
-- G has an element x of order p by Cauchy's theorem
126+
have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd
127+
-- F has an element u (= ↑↑x) of order p
128+
let u := ((x : Kˣ) : K)
129+
have hu : orderOf u = p := by rwa [orderOf_units, orderOf_subgroup]
130+
-- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ...
131+
have h : u = 1 := by
132+
rw [← sub_left_inj, sub_self 1]
133+
apply pow_eq_zero (n := p)
134+
rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self]
135+
exact Commute.one_right u
136+
-- ... meaning x didn't have order p after all, contradiction
137+
apply pprime.one_lt.ne
138+
rw [← hu, h, orderOf_one]
139+
140+
/-- The sum of a nontrivial subgroup of the units of a field is zero. -/
141+
theorem sum_subgroup_units_eq_zero [Ring K] [NoZeroDivisors K]
142+
{G : Subgroup Kˣ} [Fintype G] (hg : G ≠ ⊥) :
143+
∑ x : G, (x.val : K) = 0 := by
144+
rw [Subgroup.ne_bot_iff_exists_ne_one] at hg
145+
rcases hg with ⟨a, ha⟩
146+
-- The action of a on G as an embedding
147+
let a_mul_emb : G ↪ G := mulLeftEmbedding a
148+
-- ... and leaves G unchanged
149+
have h_unchanged : Finset.univ.map a_mul_emb = Finset.univ := by simp
150+
-- Therefore the sum of x over a G is the sum of a x over G
151+
have h_sum_map := Finset.univ.sum_map a_mul_emb fun x => ((x : Kˣ) : K)
152+
-- ... and the former is the sum of x over G.
153+
-- By algebraic manipulation, we have Σ G, x = ∑ G, a x = a ∑ G, x
154+
simp only [h_unchanged, Function.Embedding.coeFn_mk, Function.Embedding.toFun_eq_coe,
155+
mulLeftEmbedding_apply, Submonoid.coe_mul, Subgroup.coe_toSubmonoid, Units.val_mul,
156+
← Finset.mul_sum] at h_sum_map
157+
-- thus one of (a - 1) or ∑ G, x is zero
158+
have hzero : (((a : Kˣ) : K) - 1) = 0 ∨ ∑ x : ↥G, ((x : Kˣ) : K) = 0 := by
159+
rw [←mul_eq_zero, sub_mul, ← h_sum_map, one_mul, sub_self]
160+
apply Or.resolve_left hzero
161+
contrapose! ha
162+
ext
163+
rwa [←sub_eq_zero]
164+
165+
/-- The sum of a subgroup of the units of a field is 1 if the subgroup is trivial and 1 otherwise -/
166+
@[simp]
167+
theorem sum_subgroup_units [Ring K] [NoZeroDivisors K]
168+
{G : Subgroup Kˣ} [Fintype G] [Decidable (G = ⊥)] :
169+
∑ x : G, (x.val : K) = if G = ⊥ then 1 else 0 := by
170+
by_cases G_bot : G = ⊥
171+
· subst G_bot
172+
simp only [ite_true, Subgroup.mem_bot, Fintype.card_ofSubsingleton, Nat.cast_ite, Nat.cast_one,
173+
Nat.cast_zero, univ_unique, Set.default_coe_singleton, sum_singleton, Units.val_one]
174+
· simp only [G_bot, ite_false]
175+
exact sum_subgroup_units_eq_zero G_bot
176+
177+
@[simp]
178+
theorem sum_subgroup_pow_eq_zero [CommRing K] [NoZeroDivisors K]
179+
{G : Subgroup Kˣ} [Fintype G] {k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) :
180+
∑ x : G, ((x : Kˣ) : K) ^ k = 0 := by
181+
nontriviality K
182+
have := NoZeroDivisors.to_isDomain K
183+
rcases (exists_pow_ne_one_of_isCyclic k_pos k_lt_card_G) with ⟨a, ha⟩
184+
rw [Finset.sum_eq_multiset_sum]
185+
have h_multiset_map :
186+
Finset.univ.val.map (fun x : G => ((x : Kˣ) : K) ^ k) =
187+
Finset.univ.val.map (fun x : G => ((x : Kˣ) : K) ^ k * ((a : Kˣ) : K) ^ k) := by
188+
simp_rw [← mul_pow]
189+
have as_comp :
190+
(fun x : ↥G => (((x : Kˣ) : K) * ((a : Kˣ) : K)) ^ k)
191+
= (fun x : ↥G => ((x : Kˣ) : K) ^ k) ∘ fun x : ↥G => x * a := by
192+
funext x
193+
simp only [Function.comp_apply, Submonoid.coe_mul, Subgroup.coe_toSubmonoid, Units.val_mul]
194+
rw [as_comp, ← Multiset.map_map]
195+
congr
196+
rw [eq_comm]
197+
exact Multiset.map_univ_val_equiv (Equiv.mulRight a)
198+
have h_multiset_map_sum :
199+
(Multiset.map (fun x : G => ((x : Kˣ) : K) ^ k) Finset.univ.val).sum =
200+
(Multiset.map (fun x : G => ((x : Kˣ) : K) ^ k * ((a : Kˣ) : K) ^ k) Finset.univ.val).sum
201+
rw [h_multiset_map]
202+
rw [Multiset.sum_map_mul_right] at h_multiset_map_sum
203+
have hzero : (((a : Kˣ) : K) ^ k - 1 : K)
204+
* (Multiset.map (fun i : G => (i.val : K) ^ k) Finset.univ.val).sum = 0 := by
205+
rw [sub_mul, mul_comm, ← h_multiset_map_sum, one_mul, sub_self]
206+
rw [mul_eq_zero] at hzero
207+
rcases hzero with h | h
208+
· contrapose! ha
209+
ext
210+
rw [←sub_eq_zero]
211+
simp_rw [SubmonoidClass.coe_pow, Units.val_pow_eq_pow_val, OneMemClass.coe_one,
212+
Units.val_one, h]
213+
· exact h
214+
114215
section
115216

116217
variable [GroupWithZero K] [Fintype K]

Mathlib/GroupTheory/OrderOfElement.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,12 @@ theorem orderOf_eq_card_zpowers : orderOf x = Fintype.card (zpowers x) :=
923923
#align order_eq_card_zpowers orderOf_eq_card_zpowers
924924
#align add_order_eq_card_zmultiples addOrderOf_eq_card_zmultiples
925925

926+
@[to_additive card_zmultiples_le]
927+
theorem card_zpowers_le (a : G) {k : ℕ} (k_pos : k ≠ 0)
928+
(ha : a ^ k = 1) : Fintype.card (Subgroup.zpowers a) ≤ k := by
929+
rw [← orderOf_eq_card_zpowers]
930+
apply orderOf_le_of_pow_eq_one k_pos.bot_lt ha
931+
926932
open QuotientGroup
927933

928934

Mathlib/GroupTheory/SpecificGroups/Cyclic.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,16 @@ theorem orderOf_eq_card_of_forall_mem_zpowers [Fintype α] {g : α} (hx : ∀ x,
152152
#align order_of_eq_card_of_forall_mem_zpowers orderOf_eq_card_of_forall_mem_zpowers
153153
#align add_order_of_eq_card_of_forall_mem_zmultiples addOrderOf_eq_card_of_forall_mem_zmultiples
154154

155+
@[to_additive exists_nsmul_ne_zero_of_isAddCyclic]
156+
theorem exists_pow_ne_one_of_isCyclic {G : Type*} [Group G] [Fintype G] [G_cyclic : IsCyclic G]
157+
{k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) : ∃ a : G, a ^ k ≠ 1 := by
158+
rcases G_cyclic with ⟨a, ha⟩
159+
use a
160+
contrapose! k_lt_card_G
161+
convert orderOf_le_of_pow_eq_one k_pos.bot_lt k_lt_card_G
162+
rw [orderOf_eq_card_zpowers, eq_comm, Subgroup.card_eq_iff_eq_top, eq_top_iff]
163+
exact fun x _ ↦ ha x
164+
155165
@[to_additive Infinite.addOrderOf_eq_zero_of_forall_mem_zmultiples]
156166
theorem Infinite.orderOf_eq_zero_of_forall_mem_zpowers [Infinite α] {g : α}
157167
(h : ∀ x, x ∈ zpowers g) : orderOf g = 0 := by

Mathlib/GroupTheory/Subgroup/Basic.lean

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -932,16 +932,21 @@ theorem nontrivial_iff_exists_ne_one (H : Subgroup G) : Nontrivial H ↔ ∃ x
932932
#align subgroup.nontrivial_iff_exists_ne_one Subgroup.nontrivial_iff_exists_ne_one
933933
#align add_subgroup.nontrivial_iff_exists_ne_zero AddSubgroup.nontrivial_iff_exists_ne_zero
934934

935+
@[to_additive]
936+
theorem exists_ne_one_of_nontrivial (H : Subgroup G) [Nontrivial H] :
937+
∃ x ∈ H, x ≠ 1 := by
938+
rwa [←Subgroup.nontrivial_iff_exists_ne_one]
939+
940+
@[to_additive]
941+
theorem nontrivial_iff_ne_bot (H : Subgroup G) : Nontrivial H ↔ H ≠ ⊥ := by
942+
rw [nontrivial_iff_exists_ne_one, ne_eq, eq_bot_iff_forall]
943+
simp only [ne_eq, not_forall, exists_prop]
944+
935945
/-- A subgroup is either the trivial subgroup or nontrivial. -/
936946
@[to_additive "A subgroup is either the trivial subgroup or nontrivial."]
937947
theorem bot_or_nontrivial (H : Subgroup G) : H = ⊥ ∨ Nontrivial H := by
938-
classical
939-
by_cases h : ∀ x ∈ H, x = (1 : G)
940-
· left
941-
exact H.eq_bot_iff_forall.mpr h
942-
· right
943-
simp only [not_forall] at h
944-
simpa [nontrivial_iff_exists_ne_one] using h
948+
have := nontrivial_iff_ne_bot H
949+
tauto
945950
#align subgroup.bot_or_nontrivial Subgroup.bot_or_nontrivial
946951
#align add_subgroup.bot_or_nontrivial AddSubgroup.bot_or_nontrivial
947952

@@ -953,6 +958,11 @@ theorem bot_or_exists_ne_one (H : Subgroup G) : H = ⊥ ∨ ∃ x ∈ H, x ≠ (
953958
#align subgroup.bot_or_exists_ne_one Subgroup.bot_or_exists_ne_one
954959
#align add_subgroup.bot_or_exists_ne_zero AddSubgroup.bot_or_exists_ne_zero
955960

961+
@[to_additive]
962+
lemma ne_bot_iff_exists_ne_one {H : Subgroup G} : H ≠ ⊥ ↔ ∃ a : ↥H, a ≠ 1 := by
963+
rw [←nontrivial_iff_ne_bot, nontrivial_iff_exists_ne_one]
964+
simp only [ne_eq, Subtype.exists, mk_eq_one_iff, exists_prop]
965+
956966
/-- The inf of two subgroups is their intersection. -/
957967
@[to_additive "The inf of two `AddSubgroup`s is their intersection."]
958968
instance : Inf (Subgroup G) :=

0 commit comments

Comments
 (0)