Theorem: Polynomial.coeff_comp_degree_mul_degree
File: Mathlib/Data/Polynomial/Eval.lean

tactic: rw [comp, eval₂_def, coeff_sum]
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ coeff (comp p q) (natDegree p * natDegree q) = leadingCoeff p * leadingCoeff q ^ natDegree p

tactic: refine Eq.trans (Finset.sum_eq_single p.natDegree ?h₀ ?h₁) ?h₂
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ (sum p fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) = leadingCoeff p * leadingCoeff q ^ natDegree p

tactic: case h₂ =>
  simp only [coeff_natDegree, coeff_C_mul, coeff_pow_mul_natDegree]
state_before: case h₀
R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ ∀ (b : ℕ),
    b ∈ support p → b ≠ natDegree p → (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) b (coeff p b) = 0

case h₁
R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ ¬natDegree p ∈ support p →
    (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) (natDegree p) (coeff p (natDegree p)) = 0

case h₂
R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) (natDegree p) (coeff p (natDegree p)) =
    leadingCoeff p * leadingCoeff q ^ natDegree p

tactic: case h₀ =>
  intro b hbs hbp
  refine' coeff_eq_zero_of_natDegree_lt (natDegree_mul_le.trans_lt _)
  rw [natDegree_C, zero_add]
  refine' natDegree_pow_le.trans_lt ((mul_lt_mul_right (pos_iff_ne_zero.mpr hqd0)).mpr _)
  exact lt_of_le_of_ne (le_natDegree_of_mem_supp _ hbs) hbp
state_before: case h₀
R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ ∀ (b : ℕ),
    b ∈ support p → b ≠ natDegree p → (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) b (coeff p b) = 0

case h₁
R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ ¬natDegree p ∈ support p →
    (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) (natDegree p) (coeff p (natDegree p)) = 0

tactic: case h₁ =>
  simp (config := { contextual := true })
state_before: case h₁
R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ ¬natDegree p ∈ support p →
    (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) (natDegree p) (coeff p (natDegree p)) = 0

tactic: simp only [coeff_natDegree, coeff_C_mul, coeff_pow_mul_natDegree]
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) (natDegree p) (coeff p (natDegree p)) =
    leadingCoeff p * leadingCoeff q ^ natDegree p

tactic: intro b hbs hbp
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ ∀ (b : ℕ),
    b ∈ support p → b ≠ natDegree p → (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) b (coeff p b) = 0

tactic: refine' coeff_eq_zero_of_natDegree_lt (natDegree_mul_le.trans_lt _)
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
b : ℕ
hbs : b ∈ support p
hbp : b ≠ natDegree p
⊢ (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) b (coeff p b) = 0

tactic: rw [natDegree_C, zero_add]
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
b : ℕ
hbs : b ∈ support p
hbp : b ≠ natDegree p
⊢ natDegree (↑C (coeff p b)) + natDegree (q ^ b) < natDegree p * natDegree q

tactic: refine' natDegree_pow_le.trans_lt ((mul_lt_mul_right (pos_iff_ne_zero.mpr hqd0)).mpr _)
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
b : ℕ
hbs : b ∈ support p
hbp : b ≠ natDegree p
⊢ natDegree (q ^ b) < natDegree p * natDegree q

tactic: exact lt_of_le_of_ne (le_natDegree_of_mem_supp _ hbs) hbp
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
b : ℕ
hbs : b ∈ support p
hbp : b ≠ natDegree p
⊢ b < natDegree p

tactic: simp (config := { contextual := true })
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
hqd0 : natDegree q ≠ 0
⊢ ¬natDegree p ∈ support p →
    (fun a b => coeff (↑C b * q ^ a) (natDegree p * natDegree q)) (natDegree p) (coeff p (natDegree p)) = 0