Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit c5930f5

Browse files
ChrisHughes24johoelzl
authored andcommitted
feat(group_theory.order_of_element): subgroups of cyclic groups are cyclic (#423)
* feat(group_theory.order_of_element): subgroups of cyclic groups are cyclic * delete new line
1 parent a33ab12 commit c5930f5

File tree

3 files changed

+75
-3
lines changed

3 files changed

+75
-3
lines changed

group_theory/order_of_element.lean

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ set.ext (λ x, ⟨λ ⟨n, hn⟩, ⟨n, by simp * at *⟩,
182182

183183
end
184184

185+
end order_of
186+
185187
section cyclic
186188

187189
local attribute [instance] set_fintype
@@ -200,6 +202,51 @@ lemma order_of_eq_card_of_forall_mem_gppowers [group α] [fintype α] [decidable
200202
by rw [← fintype.card_congr (equiv.set.univ α), order_eq_card_gpowers];
201203
simp [hx]; congr
202204

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

group_theory/subgroup.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ instance subtype.add_group {s : set β} [is_add_subgroup s] : add_group s :=
5454
by subtype_instance
5555
attribute [to_additive subtype.add_group] subtype.group
5656

57+
@[simp, to_additive is_add_subgroup.coe_neg]
58+
lemma is_subgroup.coe_inv {s : set α} [is_subgroup s] (a : s) : ((a⁻¹ : s) : α) = a⁻¹ := rfl
59+
60+
@[simp] lemma is_subgroup.coe_gpow {s : set α} [is_subgroup s] (a : s) (n : ℤ) : ((a ^ n : s) : α) = a ^ n :=
61+
by induction n; simp [is_submonoid.coe_pow a]
62+
63+
@[simp] lemma is_add_subgroup.gsmul_coe {β : Type*} [add_group β] {s : set β} [is_add_subgroup s] (a : s) (n : ℤ) :
64+
((gsmul n a : s) : β) = gsmul n a :=
65+
by induction n; simp [is_add_submonoid.smul_coe a]
66+
attribute [to_additive is_add_subgroup.gsmul_coe] is_subgroup.coe_gpow
67+
5768
theorem is_subgroup.of_div (s : set α)
5869
(one_mem : (1:α) ∈ s) (div_mem : ∀{a b:α}, a ∈ s → b ∈ s → a * b⁻¹ ∈ s):
5970
is_subgroup s :=

group_theory/submonoid.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ attribute [to_additive subtype.add_monoid._proof_4] subtype.monoid._proof_4
9191
attribute [to_additive subtype.add_monoid._proof_5] subtype.monoid._proof_5
9292
attribute [to_additive subtype.add_monoid] subtype.monoid
9393

94+
@[simp, to_additive is_add_submonoid.coe_zero]
95+
lemma is_submonoid.coe_one [is_submonoid s] : ((1 : s) : α) = 1 := rfl
96+
97+
@[simp, to_additive is_add_submonoid.coe_add]
98+
lemma is_submonoid.coe_mul [is_submonoid s] (a b : s) : ((a * b : s) : α) = a * b := rfl
99+
100+
@[simp] lemma is_submonoid.coe_pow [is_submonoid s] (a : s) (n : ℕ) : ((a ^ n : s) : α) = a ^ n :=
101+
by induction n; simp [*, pow_succ]
102+
103+
@[simp] lemma is_add_submonoid.smul_coe {β : Type*} [add_monoid β] {s : set β}
104+
[is_add_submonoid s] (a : s) (n : ℕ) : ((add_monoid.smul n a : s) : β) = add_monoid.smul n a :=
105+
by induction n; [refl, simp [*, succ_smul]]
106+
attribute [to_additive is_add_submonoid.smul_coe] is_submonoid.coe_pow
107+
94108
namespace monoid
95109

96110
inductive in_closure (s : set α) : α → Prop

0 commit comments

Comments
 (0)