|
1 | 1 | /- |
2 | 2 | Copyright (c) 2020 Johan Commelin. All rights reserved. |
3 | 3 | Released under Apache 2.0 license as described in the file LICENSE. |
4 | | -Authors: Johan Commelin |
| 4 | +Authors: Johan Commelin, Snir Broshi |
5 | 5 | -/ |
6 | 6 | import Mathlib.Analysis.SpecialFunctions.Complex.Log |
7 | 7 | import Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots |
@@ -44,6 +44,33 @@ theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprim |
44 | 44 | have : n ∣ l * i := by rw [← Int.natCast_dvd_natCast, hk]; apply dvd_mul_right |
45 | 45 | exact hi.symm.dvd_of_dvd_mul_right this |
46 | 46 |
|
| 47 | +theorem isPrimitiveRoot_exp_two_rat (q : ℚ) : IsPrimitiveRoot (exp (2 * π * I * q)) q.den := by |
| 48 | + convert isPrimitiveRoot_exp_of_coprime _ _ (Int.fract q).den_ne_zero (Int.fract q).reduced using 1 |
| 49 | + · nth_rw 1 [← Int.floor_add_fract q, ← Int.fract q |>.num_div_den] |
| 50 | + nth_rw 1 [Int.eq_natAbs_of_nonneg <| Int.fract q |>.num_nonneg.mpr <| Int.fract_nonneg _] |
| 51 | + rw [Rat.cast_add, Rat.cast_intCast, Rat.cast_div, Rat.cast_intCast] |
| 52 | + simp [mul_add, mul_comm _ (⌊q⌋ : ℂ), Complex.exp_add] |
| 53 | + · simp [← Rat.add_intCast_den q (-⌊q⌋), ← sub_eq_add_neg] |
| 54 | + |
| 55 | +theorem isPrimitiveRoot_exp_rat_of_even_num (q : ℚ) (h : Even q.num) : |
| 56 | + IsPrimitiveRoot (exp (π * I * q)) q.den := by |
| 57 | + have ⟨n, hn⟩ := even_iff_exists_two_nsmul _ |>.mp h |
| 58 | + convert isPrimitiveRoot_exp_two_rat (n / q.den) using 1 |
| 59 | + · nth_rw 1 [← q.num_div_den, hn] |
| 60 | + grind [Rat.cast_mul, Rat.cast_ofNat] |
| 61 | + · rw [← Int.cast_natCast, ← Rat.divInt_eq_div, ← Rat.mk_eq_divInt _ _ (by simp) ?_] |
| 62 | + apply Nat.Coprime.coprime_mul_left (k := 2) |
| 63 | + grind [Rat.reduced] |
| 64 | + |
| 65 | +theorem isPrimitiveRoot_exp_rat_of_odd_num (q : ℚ) (h : Odd q.num) : |
| 66 | + IsPrimitiveRoot (exp (π * I * q)) (2 * q.den) := by |
| 67 | + convert isPrimitiveRoot_exp_two_rat (q / 2) using 1 |
| 68 | + · grind [Rat.cast_div, Rat.cast_ofNat] |
| 69 | + · nth_rw 2 [← q.num_div_den] |
| 70 | + rw [mul_comm, div_div, ← Int.cast_ofNat, ← Int.cast_natCast, ← Int.cast_mul, |
| 71 | + ← Rat.divInt_eq_div, ← Nat.cast_ofNat (R := ℤ), ← Nat.cast_mul, |
| 72 | + ← Rat.mk_eq_divInt _ _ (by simp) (Nat.Coprime.mul_right q.reduced h.natAbs.coprime_two_right)] |
| 73 | + |
47 | 74 | theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by |
48 | 75 | simpa only [Nat.cast_one, one_div] using |
49 | 76 | isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left |
|
0 commit comments