Theorem: Multiset.prod_X_add_C_coeff
File: Mathlib/RingTheory/Polynomial/Vieta.lean

tactic: convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ (map (fun r => X + C r) s).prod.coeff k = s.esymm (card s - k)
state_after: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ s.esymm (card s - k) = (∑ j ∈ Finset.range (card s + 1), C (s.esymm j) * X ^ (card s - j)).coeff k

tactic: simp_rw [finset_sum_coeff, coeff_C_mul_X_pow]
state_before: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ s.esymm (card s - k) = (∑ j ∈ Finset.range (card s + 1), C (s.esymm j) * X ^ (card s - j)).coeff k
state_after: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ s.esymm (card s - k) = ∑ x ∈ Finset.range (card s + 1), if k = card s - x then s.esymm x else 0

tactic: rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _]
state_before: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ s.esymm (card s - k) = ∑ x ∈ Finset.range (card s + 1), if k = card s - x then s.esymm x else 0
state_after: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ s.esymm (card s - k) = if k = card s - (card s - k) then s.esymm (card s - k) else 0

case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ ∀ b ∈ Finset.range (card s + 1), b ≠ card s - k → (if k = card s - b then s.esymm b else 0) = 0

R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ card s - k ∈ Finset.range (card s + 1)

tactic: rw [if_pos (Nat.sub_sub_self h).symm]
state_before: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ s.esymm (card s - k) = if k = card s - (card s - k) then s.esymm (card s - k) else 0
state_after: no goals

tactic: intro j hj1 hj2
state_before: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ ∀ b ∈ Finset.range (card s + 1), b ≠ card s - k → (if k = card s - b then s.esymm b else 0) = 0
state_after: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ card s - k
⊢ (if k = card s - j then s.esymm j else 0) = 0

tactic: suffices k ≠ card s - j by rw [if_neg this]
state_before: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ card s - k
⊢ (if k = card s - j then s.esymm j else 0) = 0
state_after: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ card s - k
⊢ k ≠ card s - j

tactic: intro hn
state_before: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ card s - k
⊢ k ≠ card s - j
state_after: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ card s - k
hn : k = card s - j
⊢ False

tactic: rw [hn, Nat.sub_sub_self (Nat.lt_succ_iff.mp (Finset.mem_range.mp hj1))] at hj2
state_before: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ card s - k
hn : k = card s - j
⊢ False
state_after: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ j
hn : k = card s - j
⊢ False

tactic: exact Ne.irrefl hj2
state_before: case h.e'_3
R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ j
hn : k = card s - j
⊢ False
state_after: no goals

tactic: rw [if_neg this]
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
j : ℕ
hj1 : j ∈ Finset.range (card s + 1)
hj2 : j ≠ card s - k
this : k ≠ card s - j
⊢ (if k = card s - j then s.esymm j else 0) = 0
state_after: no goals

tactic: rw [Finset.mem_range]
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ card s - k ∈ Finset.range (card s + 1)
state_after: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ card s - k < card s + 1

tactic: exact Nat.lt_succ_of_le (Nat.sub_le (Multiset.card s) k)
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
k : ℕ
h : k ≤ card s
⊢ card s - k < card s + 1
state_after: no goals