Theorem: Complex.mem_rootsOfUnity
File: Mathlib/RingTheory/RootsOfUnity/Complex.lean

tactic: rw [mem_rootsOfUnity, Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one]
state_before: n : ℕ+
x : ℂˣ
⊢ x ∈ rootsOfUnity n ℂ ↔ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
state_after: n : ℕ+
x : ℂˣ
⊢ ↑x ^ ↑n = 1 ↔ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x

tactic: have hn0 : (n : ℂ) ≠ 0 := mod_cast n.ne_zero
state_before: n : ℕ+
x : ℂˣ
⊢ ↑x ^ ↑n = 1 ↔ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
state_after: n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
⊢ ↑x ^ ↑n = 1 ↔ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x

tactic: constructor
state_before: n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
⊢ ↑x ^ ↑n = 1 ↔ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
state_after: case mp
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
⊢ ↑x ^ ↑n = 1 → ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x

case mpr
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
⊢ (∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x) → ↑x ^ ↑n = 1

tactic: intro h
state_before: case mp
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
⊢ ↑x ^ ↑n = 1 → ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
state_after: case mp
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
⊢ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x

tactic: obtain ⟨i, hi, H⟩ : ∃ i < (n : ℕ), exp (2 * π * I / n) ^ i = x := by
  simpa only using (isPrimitiveRoot_exp n n.ne_zero).eq_pow_of_pow_eq_one h n.pos
state_before: case mp
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
⊢ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
state_after: case mp.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
i : ℕ
hi : i < ↑n
H : cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
⊢ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x

tactic: refine ⟨i, hi, ?_⟩
state_before: case mp.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
i : ℕ
hi : i < ↑n
H : cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
⊢ ∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
state_after: case mp.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
i : ℕ
hi : i < ↑n
H : cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
⊢ cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x

tactic: rw [← H, ← exp_nat_mul]
state_before: case mp.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
i : ℕ
hi : i < ↑n
H : cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
⊢ cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
state_after: case mp.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
i : ℕ
hi : i < ↑n
H : cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
⊢ cexp (2 * ↑π * I * (↑i / ↑↑n)) = cexp (↑i * (2 * ↑π * I / ↑↑n))

tactic: congr 1
state_before: case mp.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
i : ℕ
hi : i < ↑n
H : cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
⊢ cexp (2 * ↑π * I * (↑i / ↑↑n)) = cexp (↑i * (2 * ↑π * I / ↑↑n))
state_after: case mp.intro.intro.e_z
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
i : ℕ
hi : i < ↑n
H : cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
⊢ 2 * ↑π * I * (↑i / ↑↑n) = ↑i * (2 * ↑π * I / ↑↑n)

tactic: field_simp [hn0, mul_comm (i : ℂ)]
state_before: case mp.intro.intro.e_z
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
i : ℕ
hi : i < ↑n
H : cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
⊢ 2 * ↑π * I * (↑i / ↑↑n) = ↑i * (2 * ↑π * I / ↑↑n)
state_after: no goals

tactic: simpa only using (isPrimitiveRoot_exp n n.ne_zero).eq_pow_of_pow_eq_one h n.pos
state_before: n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
h : ↑x ^ ↑n = 1
⊢ ∃ i < ↑n, cexp (2 * ↑π * I / ↑↑n) ^ i = ↑x
state_after: no goals

tactic: rintro ⟨i, _, H⟩
state_before: case mpr
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
⊢ (∃ i < ↑n, cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x) → ↑x ^ ↑n = 1
state_after: case mpr.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
i : ℕ
left✝ : i < ↑n
H : cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
⊢ ↑x ^ ↑n = 1

tactic: rw [← H, ← exp_nat_mul, exp_eq_one_iff]
state_before: case mpr.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
i : ℕ
left✝ : i < ↑n
H : cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
⊢ ↑x ^ ↑n = 1
state_after: case mpr.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
i : ℕ
left✝ : i < ↑n
H : cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
⊢ ∃ n_1, ↑↑n * (2 * ↑π * I * (↑i / ↑↑n)) = ↑n_1 * (2 * ↑π * I)

tactic: use i
state_before: case mpr.intro.intro
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
i : ℕ
left✝ : i < ↑n
H : cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
⊢ ∃ n_1, ↑↑n * (2 * ↑π * I * (↑i / ↑↑n)) = ↑n_1 * (2 * ↑π * I)
state_after: case h
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
i : ℕ
left✝ : i < ↑n
H : cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
⊢ ↑↑n * (2 * ↑π * I * (↑i / ↑↑n)) = ↑↑i * (2 * ↑π * I)

tactic: field_simp [hn0, mul_comm ((n : ℕ) : ℂ), mul_comm (i : ℂ)]
state_before: case h
n : ℕ+
x : ℂˣ
hn0 : ↑↑n ≠ 0
i : ℕ
left✝ : i < ↑n
H : cexp (2 * ↑π * I * (↑i / ↑↑n)) = ↑x
⊢ ↑↑n * (2 * ↑π * I * (↑i / ↑↑n)) = ↑↑i * (2 * ↑π * I)
state_after: no goals