Skip to content

Commit 4585de0

Browse files
committed
feat(RingTheory/RootsOfUnity): exp(pi * i * q) is a root of unity for rational q
1 parent 6b0379c commit 4585de0

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

Mathlib/RingTheory/RootsOfUnity/Complex.lean

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/-
22
Copyright (c) 2020 Johan Commelin. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: Johan Commelin
4+
Authors: Johan Commelin, Snir Broshi
55
-/
66
import Mathlib.Analysis.SpecialFunctions.Complex.Log
77
import Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots
@@ -44,6 +44,41 @@ theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprim
4444
have : n ∣ l * i := by rw [← Int.natCast_dvd_natCast, hk]; apply dvd_mul_right
4545
exact hi.symm.dvd_of_dvd_mul_right this
4646

47+
theorem isPrimitiveRoot_exp_two_rat (q : ℚ) : IsPrimitiveRoot (exp (2 * π * I * q)) q.den := by
48+
nth_rw 1 [← Int.floor_add_fract q]
49+
push_cast
50+
rw [mul_add, Complex.exp_add, mul_comm _ (⌊q⌋ : ℂ), ← (Int.fract q).num_div_den]
51+
rw [← Rat.add_intCast_den q (-⌊q⌋)]
52+
simp
53+
rw [Int.eq_natAbs_of_nonneg <| (Int.fract q).num_nonneg.mpr <| Int.fract_nonneg _]
54+
rw [← sub_eq_add_neg]
55+
exact isPrimitiveRoot_exp_of_coprime _ _ (Int.fract q).den_ne_zero (Int.fract q).reduced
56+
57+
theorem isPrimitiveRoot_exp_rat_of_even_num (q : ℚ) (h : Even q.num) :
58+
IsPrimitiveRoot (exp (π * I * q)) q.den := by
59+
have ⟨n, h⟩ := even_iff_exists_two_nsmul _ |>.mp h
60+
nth_rw 1 [← q.num_div_den]
61+
rw [h]
62+
simp
63+
rw [show π * I * (2 * n / q.den) = 2 * π * I * (n / (q.den : ℤ) : ℚ) by simp; ring_nf]
64+
rw [← Rat.divInt_eq_div]
65+
have : q.num.natAbs = 2 * n.natAbs := by grind
66+
rw [← Rat.mk_eq_divInt _ _ (by simp) <| Nat.Coprime.coprime_mul_left <| this ▸ q.reduced]
67+
exact isPrimitiveRoot_exp_two_rat _
68+
69+
theorem isPrimitiveRoot_exp_rat_of_odd_num (q : ℚ) (h : Odd q.num) :
70+
IsPrimitiveRoot (exp (π * I * q)) (2 * q.den) := by
71+
have := isPrimitiveRoot_exp_two_rat (q / 2)
72+
push_cast at this
73+
rw [show 2 * π * I * (q / 2) = π * I * q by ring_nf] at this
74+
convert this
75+
nth_rw 2 [← q.num_div_den]
76+
rw [mul_comm, div_div]
77+
rw [show (q.num / (q.den * 2) : ℚ) = q.num / (q.den * 2 : ℤ) by simp]
78+
rw [← Rat.divInt_eq_div, show (q.den * 2 : ℤ) = (q.den * 2 : ℕ) by simp]
79+
have := Nat.Coprime.mul_right q.reduced h.natAbs.coprime_two_right
80+
rw [← Rat.mk_eq_divInt _ _ (by simp) this]
81+
4782
theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by
4883
simpa only [Nat.cast_one, one_div] using
4984
isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left

0 commit comments

Comments
 (0)