Skip to content

Commit 24d683e

Browse files
committed
chore(RingTheory/RootsOfUnity/Complex): golf using grind
1 parent abac742 commit 24d683e

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

Mathlib/RingTheory/RootsOfUnity/Complex.lean

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,21 @@ theorem isPrimitiveRoot_exp_two_rat (q : ℚ) : IsPrimitiveRoot (exp (2 * π * I
5555
theorem isPrimitiveRoot_exp_rat_of_even_num (q : ℚ) (h : Even q.num) :
5656
IsPrimitiveRoot (exp (π * I * q)) q.den := by
5757
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]
60-
simp [hn]
61-
ring_nf
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]
6261
· rw [← Int.cast_natCast, ← Rat.divInt_eq_div, ← Rat.mk_eq_divInt _ _ (by simp) ?_]
63-
refine Nat.Coprime.coprime_mul_left (k := 2) ?_
64-
convert q.reduced
65-
grind
62+
apply Nat.Coprime.coprime_mul_left (k := 2)
63+
grind [Rat.reduced]
6664

6765
theorem isPrimitiveRoot_exp_rat_of_odd_num (q : ℚ) (h : Odd q.num) :
6866
IsPrimitiveRoot (exp (π * I * q)) (2 * q.den) := by
6967
convert isPrimitiveRoot_exp_two_rat (q / 2) using 1
70-
· push_cast
71-
ring_nf
68+
· grind [Rat.cast_div, Rat.cast_ofNat]
7269
· nth_rw 2 [← q.num_div_den]
73-
rw [mul_comm, div_div, ← Int.cast_ofNat, ← Int.cast_natCast, ← Int.cast_mul]
74-
rw [← Rat.divInt_eq_div, ← Nat.cast_ofNat (R := ℤ), ← Nat.cast_mul]
75-
rw [← Rat.mk_eq_divInt _ _ (by simp) ?_]
76-
exact Nat.Coprime.mul_right q.reduced h.natAbs.coprime_two_right
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)]
7773

7874
theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by
7975
simpa only [Nat.cast_one, one_div] using

0 commit comments

Comments
 (0)