Theorem: Polynomial.cyclotomic_coeff_zero
File: Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean

tactic: induction' n using Nat.strong_induction_on with n hi
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hn : 1 < n
⊢ (cyclotomic n R).coeff 0 = 1
state_after: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
⊢ (cyclotomic n R).coeff 0 = 1

tactic: have hprod : (∏ i ∈ Nat.properDivisors n, (Polynomial.cyclotomic i R).coeff 0) = -1 := by
  rw [← Finset.insert_erase (Nat.one_mem_properDivisors_iff_one_lt.2
    (lt_of_lt_of_le one_lt_two hn)), Finset.prod_insert (Finset.not_mem_erase 1 _),
    cyclotomic_one R]
  have hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j := by
    intro j hj
    apply Nat.succ_le_of_lt
    exact (Ne.le_iff_lt (Finset.mem_erase.1 hj).1.symm).mp
      (Nat.succ_le_of_lt (Nat.pos_of_mem_properDivisors (Finset.mem_erase.1 hj).2))
  have hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1 := by
    intro j hj
    exact hi j (Nat.mem_properDivisors.1 (Finset.mem_erase.1 hj).2).2 (hleq j hj)
  have hrw : (∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0) = 1 := by
    rw [Finset.prod_congr (refl (n.properDivisors.erase 1)) hcongr]
    simp only [Finset.prod_const_one]
  simp only [hrw, mul_one, zero_sub, coeff_one_zero, coeff_X_zero, coeff_sub]
state_before: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
⊢ (cyclotomic n R).coeff 0 = 1
state_after: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
⊢ (cyclotomic n R).coeff 0 = 1

tactic: have heq : (X ^ n - 1 : R[X]).coeff 0 = -(cyclotomic n R).coeff 0 := by
  rw [← prod_cyclotomic_eq_X_pow_sub_one (zero_le_one.trans_lt hn), ←
    Nat.cons_self_properDivisors hn.ne_bot, Finset.prod_cons, mul_coeff_zero, coeff_zero_prod,
    hprod, mul_neg, mul_one]
state_before: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
⊢ (cyclotomic n R).coeff 0 = 1
state_after: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
⊢ (cyclotomic n R).coeff 0 = 1

tactic: have hzero : (X ^ n - 1 : R[X]).coeff 0 = (-1 : R) := by
  rw [coeff_zero_eq_eval_zero _]
  simp only [zero_pow (by positivity : n ≠ 0), eval_X, eval_one, zero_sub, eval_pow, eval_sub]
state_before: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
⊢ (cyclotomic n R).coeff 0 = 1
state_after: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
hzero : (X ^ n - 1).coeff 0 = -1
⊢ (cyclotomic n R).coeff 0 = 1

tactic: rw [hzero] at heq
state_before: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
hzero : (X ^ n - 1).coeff 0 = -1
⊢ (cyclotomic n R).coeff 0 = 1
state_after: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : -1 = -(cyclotomic n R).coeff 0
hzero : (X ^ n - 1).coeff 0 = -1
⊢ (cyclotomic n R).coeff 0 = 1

tactic: exact neg_inj.mp (Eq.symm heq)
state_before: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : -1 = -(cyclotomic n R).coeff 0
hzero : (X ^ n - 1).coeff 0 = -1
⊢ (cyclotomic n R).coeff 0 = 1
state_after: no goals

tactic: rw [← Finset.insert_erase (Nat.one_mem_properDivisors_iff_one_lt.2
  (lt_of_lt_of_le one_lt_two hn)), Finset.prod_insert (Finset.not_mem_erase 1 _),
  cyclotomic_one R]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
⊢ ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
state_after: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
⊢ (X - 1).coeff 0 * ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = -1

tactic: have hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j := by
  intro j hj
  apply Nat.succ_le_of_lt
  exact (Ne.le_iff_lt (Finset.mem_erase.1 hj).1.symm).mp
    (Nat.succ_le_of_lt (Nat.pos_of_mem_properDivisors (Finset.mem_erase.1 hj).2))
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
⊢ (X - 1).coeff 0 * ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = -1
state_after: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
⊢ (X - 1).coeff 0 * ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = -1

tactic: have hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1 := by
  intro j hj
  exact hi j (Nat.mem_properDivisors.1 (Finset.mem_erase.1 hj).2).2 (hleq j hj)
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
⊢ (X - 1).coeff 0 * ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = -1
state_after: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1
⊢ (X - 1).coeff 0 * ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = -1

tactic: have hrw : (∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0) = 1 := by
  rw [Finset.prod_congr (refl (n.properDivisors.erase 1)) hcongr]
  simp only [Finset.prod_const_one]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1
⊢ (X - 1).coeff 0 * ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = -1
state_after: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1
hrw : ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = 1
⊢ (X - 1).coeff 0 * ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = -1

tactic: simp only [hrw, mul_one, zero_sub, coeff_one_zero, coeff_X_zero, coeff_sub]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1
hrw : ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = 1
⊢ (X - 1).coeff 0 * ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = -1
state_after: no goals

tactic: intro j hj
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
⊢ ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
state_after: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
j : ℕ
hj : j ∈ n.properDivisors.erase 1
⊢ 2 ≤ j

tactic: apply Nat.succ_le_of_lt
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
j : ℕ
hj : j ∈ n.properDivisors.erase 1
⊢ 2 ≤ j
state_after: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
j : ℕ
hj : j ∈ n.properDivisors.erase 1
⊢ 1 < j

tactic: exact (Ne.le_iff_lt (Finset.mem_erase.1 hj).1.symm).mp
  (Nat.succ_le_of_lt (Nat.pos_of_mem_properDivisors (Finset.mem_erase.1 hj).2))
state_before: case h
R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
j : ℕ
hj : j ∈ n.properDivisors.erase 1
⊢ 1 < j
state_after: no goals

tactic: intro j hj
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
⊢ ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1
state_after: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
j : ℕ
hj : j ∈ n.properDivisors.erase 1
⊢ (cyclotomic j R).coeff 0 = 1

tactic: exact hi j (Nat.mem_properDivisors.1 (Finset.mem_erase.1 hj).2).2 (hleq j hj)
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
j : ℕ
hj : j ∈ n.properDivisors.erase 1
⊢ (cyclotomic j R).coeff 0 = 1
state_after: no goals

tactic: rw [Finset.prod_congr (refl (n.properDivisors.erase 1)) hcongr]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1
⊢ ∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0 = 1
state_after: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1
⊢ ∏ x ∈ n.properDivisors.erase 1, 1 = 1

tactic: simp only [Finset.prod_const_one]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j
hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1
⊢ ∏ x ∈ n.properDivisors.erase 1, 1 = 1
state_after: no goals

tactic: rw [← prod_cyclotomic_eq_X_pow_sub_one (zero_le_one.trans_lt hn), ←
  Nat.cons_self_properDivisors hn.ne_bot, Finset.prod_cons, mul_coeff_zero, coeff_zero_prod,
  hprod, mul_neg, mul_one]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
⊢ (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
state_after: no goals

tactic: rw [coeff_zero_eq_eval_zero _]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
⊢ (X ^ n - 1).coeff 0 = -1
state_after: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
⊢ eval 0 (X ^ n - 1) = -1

tactic: simp only [zero_pow (by positivity : n ≠ 0), eval_X, eval_one, zero_sub, eval_pow, eval_sub]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
⊢ eval 0 (X ^ n - 1) = -1
state_after: no goals

tactic: positivity
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
hi : ∀ m < n, 1 < m → (cyclotomic m R).coeff 0 = 1
hn : 1 < n
hprod : ∏ i ∈ n.properDivisors, (cyclotomic i R).coeff 0 = -1
heq : (X ^ n - 1).coeff 0 = -(cyclotomic n R).coeff 0
⊢ n ≠ 0
state_after: no goals