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

Commit da66bb8

Browse files
committed
feat(*): preparations for roots of unity (#4322)
1 parent 743f82c commit da66bb8

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

src/algebra/group_power/lemmas.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ theorem list.sum_repeat : ∀ (a : A) (n : ℕ), (list.repeat a n).sum = n •
4848
@[simp, norm_cast] lemma units.coe_pow (u : units M) (n : ℕ) : ((u ^ n : units M) : M) = u ^ n :=
4949
(units.coe_hom M).map_pow u n
5050

51+
lemma is_unit_of_pow_eq_one (x : M) (n : ℕ) (hx : x ^ n = 1) (hn : 0 < n) :
52+
is_unit x :=
53+
begin
54+
cases n, { exact (nat.not_lt_zero _ hn).elim },
55+
refine ⟨⟨x, x ^ n, _, _⟩, rfl⟩,
56+
{ rwa [pow_succ] at hx },
57+
{ rwa [pow_succ'] at hx }
58+
end
59+
5160
end monoid
5261

5362
theorem nat.nsmul_eq_mul (m n : ℕ) : m •ℕ n = m * n :=

src/data/int/gcd.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,14 @@ begin
126126
end
127127

128128
end int
129+
130+
lemma pow_gcd_eq_one {M : Type*} [monoid M] (x : M) {m n : ℕ} (hm : x ^ m = 1) (hn : x ^ n = 1) :
131+
x ^ m.gcd n = 1 :=
132+
begin
133+
cases m, { simp only [hn, nat.gcd_zero_left] },
134+
obtain ⟨x, rfl⟩ : is_unit x,
135+
{ apply is_unit_of_pow_eq_one _ _ hm m.succ_pos },
136+
simp only [← units.coe_pow] at *,
137+
rw [← units.coe_one, ← gpow_coe_nat, ← units.ext_iff] at *,
138+
simp only [nat.gcd_eq_gcd_ab, gpow_add, gpow_mul, hm, hn, one_gpow, one_mul]
139+
end

src/data/polynomial/ring_division.lean

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,21 @@ calc ((roots ((X : polynomial R) ^ n - C a)).card : with_bot ℕ)
348348
≤ degree ((X : polynomial R) ^ n - C a) : card_roots (X_pow_sub_C_ne_zero hn a)
349349
... = n : degree_X_pow_sub_C hn a
350350

351+
section nth_roots
351352

352353
/-- `nth_roots n a` noncomputably returns the solutions to `x ^ n = a`-/
353-
def nth_roots {R : Type*} [integral_domain R] (n : ℕ) (a : R) : multiset R :=
354+
def nth_roots (n : ℕ) (a : R) : multiset R :=
354355
roots ((X : polynomial R) ^ n - C a)
355356

356-
@[simp] lemma mem_nth_roots {R : Type*} [integral_domain R] {n : ℕ} (hn : 0 < n) {a x : R} :
357+
@[simp] lemma mem_nth_roots {n : ℕ} (hn : 0 < n) {a x : R} :
357358
x ∈ nth_roots n a ↔ x ^ n = a :=
358359
by rw [nth_roots, mem_roots (X_pow_sub_C_ne_zero hn a),
359360
is_root.def, eval_sub, eval_C, eval_pow, eval_X, sub_eq_zero_iff_eq]
360361

361-
lemma card_nth_roots {R : Type*} [integral_domain R] (n : ℕ) (a : R) :
362+
@[simp] lemma nth_roots_zero (r : R) : nth_roots 0 r = 0 :=
363+
by simp only [empty_eq_zero, pow_zero, nth_roots, ← C_1, ← C_sub, roots_C]
364+
365+
lemma card_nth_roots (n : ℕ) (a : R) :
362366
(nth_roots n a).card ≤ n :=
363367
if hn : n = 0
364368
then if h : (X : polynomial R) ^ n - C a = 0
@@ -369,6 +373,8 @@ then if h : (X : polynomial R) ^ n - C a = 0
369373
else by rw [← with_bot.coe_le_coe, ← degree_X_pow_sub_C (nat.pos_of_ne_zero hn) a];
370374
exact card_roots (X_pow_sub_C_ne_zero (nat.pos_of_ne_zero hn) a)
371375

376+
end nth_roots
377+
372378
lemma coeff_comp_degree_mul_degree (hqd0 : nat_degree q ≠ 0) :
373379
coeff (p.comp q) (nat_degree p * nat_degree q) =
374380
leading_coeff p * leading_coeff q ^ nat_degree p :=

src/group_theory/order_of_element.lean

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Johannes Hölzl
66
import algebra.big_operators.order
77
import group_theory.coset
88
import data.nat.totient
9+
import data.int.gcd
910
import data.set.finite
1011

1112
open function
@@ -271,12 +272,7 @@ open_locale classical
271272

272273
lemma pow_gcd_card_eq_one_iff {n : ℕ} {a : α} :
273274
a ^ n = 1 ↔ a ^ (gcd n (fintype.card α)) = 1 :=
274-
⟨λ h, have hn : order_of a ∣ n, from dvd_of_mod_eq_zero $
275-
by_contradiction (λ ha, by rw pow_eq_mod_order_of at h;
276-
exact (not_le_of_gt (nat.mod_lt n (order_of_pos a)))
277-
(order_of_le_of_pow_eq_one (nat.pos_of_ne_zero ha) h)),
278-
let ⟨m, hm⟩ := dvd_gcd hn order_of_dvd_card_univ in
279-
by rw [hm, pow_mul, pow_order_of_eq_one, one_pow],
275+
⟨λ h, pow_gcd_eq_one _ h $ pow_card_eq_one _,
280276
λ h, let ⟨m, hm⟩ := gcd_dvd_left n (fintype.card α) in
281277
by rw [hm, pow_mul, h, one_pow]⟩
282278

0 commit comments

Comments
 (0)