Skip to content

Commit fdd1b31

Browse files
committed
feat(RingTheory/RootsOfUnity/Complex): exp(pi * i * q) is a root of unity for rational q
1 parent a2df56f commit fdd1b31

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

Mathlib/RingTheory/RootsOfUnity/Complex.lean

Lines changed: 28 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,33 @@ 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+
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+
4774
theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by
4875
simpa only [Nat.cast_one, one_div] using
4976
isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left

0 commit comments

Comments
 (0)