-- Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
theorem isRoot_of_unity_of_root_cyclotomic {ζ : R} {i : ℕ} (hi : i ∈ n.divisors)
    (h : (cyclotomic i R).IsRoot ζ) : ζ ^ n = 1

Proof state:
case inr
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
⊢ ζ ^ n = 1

Tactic:
have := congr_arg (eval ζ) (prod_cyclotomic_eq_X_pow_sub_one hn R).symm

Result:
case inr
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : eval ζ (X ^ n - 1) = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ ζ ^ n = 1

Proof state:
case inr
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : eval ζ (X ^ n - 1) = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ ζ ^ n = 1

Tactic:
rw [eval_sub, eval_pow, eval_X, eval_one] at this

Result:
case inr
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : ζ ^ n - 1 = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ ζ ^ n = 1

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : ζ ^ n - 1 = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ cyclotomic i R ∣ ∏ i ∈ n.divisors, cyclotomic i R

Tactic:
exact Finset.dvd_prod_of_mem _ hi

Result:
no goals

Proof state:
case inl
R : Type u_1
inst✝ : CommRing R
ζ : R
i : ℕ
h : (cyclotomic i R).IsRoot ζ
hi : i ∈ Nat.divisors 0
⊢ ζ ^ 0 = 1

Tactic:
exact pow_zero _

Result:
no goals

Proof state:
case h.e'_3
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : ζ ^ n - 1 = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ 1 = 1 + eval ζ (∏ i ∈ n.divisors, cyclotomic i R)

Tactic:
convert (add_zero (M := R) _).symm

Result:
case h.e'_3.h.e'_6
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : ζ ^ n - 1 = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ eval ζ (∏ i ∈ n.divisors, cyclotomic i R) = 0

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
⊢ ζ ^ n = 1

Tactic:
rcases n.eq_zero_or_pos with (rfl | hn)

Result:
case inl
R : Type u_1
inst✝ : CommRing R
ζ : R
i : ℕ
h : (cyclotomic i R).IsRoot ζ
hi : i ∈ Nat.divisors 0
⊢ ζ ^ 0 = 1

case inr
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
⊢ ζ ^ n = 1

Proof state:
case h.e'_3.h.e'_6
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : ζ ^ n - 1 = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ eval ζ (∏ i ∈ n.divisors, cyclotomic i R) = 0

Tactic:
apply eval_eq_zero_of_dvd_of_eval_eq_zero _ h

Result:
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : ζ ^ n - 1 = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ cyclotomic i R ∣ ∏ i ∈ n.divisors, cyclotomic i R

Proof state:
case inr
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : ζ ^ n - 1 = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ ζ ^ n = 1

Tactic:
convert eq_add_of_sub_eq' this

Result:
case h.e'_3
R : Type u_1
inst✝ : CommRing R
n : ℕ
ζ : R
i : ℕ
hi : i ∈ n.divisors
h : (cyclotomic i R).IsRoot ζ
hn : n > 0
this : ζ ^ n - 1 = eval ζ (∏ i ∈ n.divisors, cyclotomic i R)
⊢ 1 = 1 + eval ζ (∏ i ∈ n.divisors, cyclotomic i R)