@@ -111,6 +111,107 @@ theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] :
111
111
rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one]
112
112
#align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one
113
113
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
+
114
215
section
115
216
116
217
variable [GroupWithZero K] [Fintype K]
0 commit comments