@@ -182,6 +182,8 @@ set.ext (λ x, ⟨λ ⟨n, hn⟩, ⟨n, by simp * at *⟩,
182
182
183
183
end
184
184
185
+ end order_of
186
+
185
187
section cyclic
186
188
187
189
local attribute [instance] set_fintype
@@ -200,6 +202,51 @@ lemma order_of_eq_card_of_forall_mem_gppowers [group α] [fintype α] [decidable
200
202
by rw [← fintype.card_congr (equiv.set.univ α), order_eq_card_gpowers];
201
203
simp [hx]; congr
202
204
203
- end cyclic
204
-
205
- end order_of
205
+ instance [group α] : is_cyclic (is_subgroup.trivial α) :=
206
+ ⟨⟨(1 : is_subgroup.trivial α), λ x, ⟨0 , subtype.eq $ eq.symm (is_subgroup.mem_trivial.1 x.2 )⟩⟩⟩
207
+
208
+ instance is_subgroup.is_cyclic [group α] [is_cyclic α] (H : set α) [is_subgroup H] : is_cyclic H :=
209
+ by haveI := classical.prop_decidable; exact
210
+ let ⟨g, hg⟩ := is_cyclic.exists_generator α in
211
+ if hx : ∃ (x : α), x ∈ H ∧ x ≠ (1 : α) then
212
+ let ⟨x, hx₁, hx₂⟩ := hx in
213
+ let ⟨k, hk⟩ := hg x in
214
+ have hex : ∃ n : ℕ, 0 < n ∧ g ^ n ∈ H,
215
+ from ⟨k.nat_abs, nat.pos_of_ne_zero
216
+ (λ h, hx₂ $ by rw [← hk, int.eq_zero_of_nat_abs_eq_zero h, gpow_zero]),
217
+ match k, hk with
218
+ | (k : ℕ), hk := by rw [int.nat_abs_of_nat, ← gpow_coe_nat, hk]; exact hx₁
219
+ | -[1 + k], hk := by rw [int.nat_abs_of_neg_succ_of_nat,
220
+ ← is_subgroup.inv_mem_iff H]; simp * at *
221
+ end ⟩,
222
+ ⟨⟨⟨g ^ nat.find hex, (nat.find_spec hex).2 ⟩,
223
+ λ ⟨x, hx⟩, let ⟨k, hk⟩ := hg x in
224
+ have hk₁ : g ^ ((nat.find hex : ℤ) * (k / nat.find hex)) ∈ gpowers (g ^ nat.find hex),
225
+ from ⟨k / nat.find hex, eq.symm $ gpow_mul _ _ _⟩,
226
+ have hk₂ : g ^ ((nat.find hex : ℤ) * (k / nat.find hex)) ∈ H,
227
+ by rw gpow_mul; exact is_subgroup.gpow_mem (nat.find_spec hex).2 ,
228
+ have hk₃ : g ^ (k % nat.find hex) ∈ H,
229
+ from (is_subgroup.mul_mem_cancel_left H hk₂).1 $
230
+ by rw [← gpow_add, int.mod_add_div, hk]; exact hx,
231
+ have hk₄ : k % nat.find hex = (k % nat.find hex).nat_abs,
232
+ by rw int.nat_abs_of_nonneg (int.mod_nonneg _
233
+ (int.coe_nat_ne_zero_iff_pos.2 (nat.find_spec hex).1 )),
234
+ have hk₅ : g ^ (k % nat.find hex ).nat_abs ∈ H,
235
+ by rwa [← gpow_coe_nat, ← hk₄],
236
+ have hk₆ : (k % (nat.find hex : ℤ)).nat_abs = 0 ,
237
+ from by_contradiction (λ h,
238
+ nat.find_min hex (int.coe_nat_lt.1 $ by rw [← hk₄];
239
+ exact int.mod_lt_of_pos _ (int.coe_nat_pos.2 (nat.find_spec hex).1 ))
240
+ ⟨nat.pos_of_ne_zero h, hk₅⟩),
241
+ ⟨k / (nat.find hex : ℤ), subtype.coe_ext.2 begin
242
+ suffices : g ^ ((nat.find hex : ℤ) * (k / nat.find hex)) = x,
243
+ { simpa [gpow_mul] },
244
+ rw [int.mul_div_cancel' (int.dvd_of_mod_eq_zero (int.eq_zero_of_nat_abs_eq_zero hk₆)), hk]
245
+ end ⟩⟩⟩
246
+ else
247
+ have H = is_subgroup.trivial α,
248
+ from set.ext $ λ x, ⟨λ h, by simp at *; tauto,
249
+ λ h, by rw [is_subgroup.mem_trivial.1 h]; exact is_submonoid.one_mem _⟩,
250
+ by clear _let_match; subst this ; apply_instance
251
+
252
+ end cyclic
0 commit comments