-- Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
theorem cyclotomic_eq_X_pow_sub_one_div {R : Type*} [CommRing R] {n : ℕ} (hpos : 0 < n) :
    cyclotomic n R = (X ^ n - 1) /ₘ ∏ i ∈ Nat.properDivisors n, cyclotomic i R

Proof state:
case hs
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
⊢ ∀ i ∈ n.properDivisors, (cyclotomic i R).Monic

Tactic:
intro i _

Result:
case hs
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝¹ : Nontrivial R
i : ℕ
a✝ : i ∈ n.properDivisors
⊢ (cyclotomic i R).Monic

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
⊢ cyclotomic n R = (X ^ n - 1) /ₘ ∏ i ∈ n.properDivisors, cyclotomic i R

Tactic:
nontriviality R

Result:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
⊢ cyclotomic n R = (X ^ n - 1) /ₘ ∏ i ∈ n.properDivisors, cyclotomic i R

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
⊢ cyclotomic n R = (X ^ n - 1) /ₘ ∏ i ∈ n.properDivisors, cyclotomic i R

Tactic:
rw [← prod_cyclotomic_eq_X_pow_sub_one hpos, ← Nat.cons_self_properDivisors hpos.ne',
  Finset.prod_cons]

Result:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
⊢ cyclotomic n R = (cyclotomic n R * ∏ x ∈ n.properDivisors, cyclotomic x R) /ₘ ∏ i ∈ n.properDivisors, cyclotomic i R

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ cyclotomic n R = (cyclotomic n R * ∏ x ∈ n.properDivisors, cyclotomic x R) /ₘ ∏ i ∈ n.properDivisors, cyclotomic i R

Tactic:
rw [(div_modByMonic_unique (cyclotomic n R) 0 prod_monic _).1]

Result:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ 0 + (∏ i ∈ n.properDivisors, cyclotomic i R) * cyclotomic n R =
      cyclotomic n R * ∏ x ∈ n.properDivisors, cyclotomic x R ∧
    degree 0 < (∏ i ∈ n.properDivisors, cyclotomic i R).degree

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
⊢ cyclotomic n R = (cyclotomic n R * ∏ x ∈ n.properDivisors, cyclotomic x R) /ₘ ∏ i ∈ n.properDivisors, cyclotomic i R

Tactic:
have prod_monic : (∏ i ∈ Nat.properDivisors n, cyclotomic i R).Monic := by
  apply monic_prod_of_monic
  intro i _
  exact cyclotomic.monic i R

Result:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ cyclotomic n R = (cyclotomic n R * ∏ x ∈ n.properDivisors, cyclotomic x R) /ₘ ∏ i ∈ n.properDivisors, cyclotomic i R

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
⊢ (∏ i ∈ n.properDivisors, cyclotomic i R).Monic

Tactic:
apply monic_prod_of_monic

Result:
case hs
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
⊢ ∀ i ∈ n.properDivisors, (cyclotomic i R).Monic

Proof state:
case left
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ (∏ i ∈ n.properDivisors, cyclotomic i R) * cyclotomic n R = cyclotomic n R * ∏ i ∈ n.properDivisors, cyclotomic i R

Tactic:
rw [mul_comm]

Result:
no goals

Proof state:
case right
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
h : (∏ i ∈ n.properDivisors, cyclotomic i R).degree = ⊥
⊢ False

Tactic:
exact Monic.ne_zero prod_monic (degree_eq_bot.1 h)

Result:
no goals

Proof state:
case right
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ ⊥ < (∏ i ∈ n.properDivisors, cyclotomic i R).degree

Tactic:
rw [bot_lt_iff_ne_bot]

Result:
case right
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ (∏ i ∈ n.properDivisors, cyclotomic i R).degree ≠ ⊥

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ 0 + (∏ i ∈ n.properDivisors, cyclotomic i R) * cyclotomic n R =
      cyclotomic n R * ∏ x ∈ n.properDivisors, cyclotomic x R ∧
    degree 0 < (∏ i ∈ n.properDivisors, cyclotomic i R).degree

Tactic:
simp only [degree_zero, zero_add]

Result:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ (∏ i ∈ n.properDivisors, cyclotomic i R) * cyclotomic n R = cyclotomic n R * ∏ i ∈ n.properDivisors, cyclotomic i R ∧
    ⊥ < (∏ i ∈ n.properDivisors, cyclotomic i R).degree

Proof state:
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ (∏ i ∈ n.properDivisors, cyclotomic i R) * cyclotomic n R = cyclotomic n R * ∏ i ∈ n.properDivisors, cyclotomic i R ∧
    ⊥ < (∏ i ∈ n.properDivisors, cyclotomic i R).degree

Tactic:
constructor

Result:
case left
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ (∏ i ∈ n.properDivisors, cyclotomic i R) * cyclotomic n R = cyclotomic n R * ∏ i ∈ n.properDivisors, cyclotomic i R

case right
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ ⊥ < (∏ i ∈ n.properDivisors, cyclotomic i R).degree

Proof state:
case right
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
⊢ (∏ i ∈ n.properDivisors, cyclotomic i R).degree ≠ ⊥

Tactic:
intro h

Result:
case right
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝ : Nontrivial R
prod_monic : (∏ i ∈ n.properDivisors, cyclotomic i R).Monic
h : (∏ i ∈ n.properDivisors, cyclotomic i R).degree = ⊥
⊢ False

Proof state:
case hs
R : Type u_1
inst✝ : CommRing R
n : ℕ
hpos : 0 < n
a✝¹ : Nontrivial R
i : ℕ
a✝ : i ∈ n.properDivisors
⊢ (cyclotomic i R).Monic

Tactic:
exact cyclotomic.monic i R

Result:
no goals