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

tactic: classical
  rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len,
    map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]
  intro _ _
  rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)]
  intro s ht
  rw [mem_powersetLen] at ht
  dsimp
  rw [prod_hom' s (Polynomial.C : R →+* R[X])]
  simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub]
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
⊢ prod (map (fun r => X + ↑C r) s) = ∑ j in Finset.range (↑card s + 1), ↑C (esymm s j) * X ^ (↑card s - j)

tactic: rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len,
  map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)]
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
⊢ prod (map (fun r => X + ↑C r) s) = ∑ j in Finset.range (↑card s + 1), ↑C (esymm s j) * X ^ (↑card s - j)

tactic: intro _ _
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
⊢ ∀ (x : ℕ),
    x ∈ range (↑card s + 1) →
      sum
          (map ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s - t, t))
            (powersetLen x s)) =
        ↑C (esymm s x) * X ^ (↑card s - x)

tactic: rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)]
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s + 1)
⊢ sum
      (map ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s - t, t))
        (powersetLen x✝ s)) =
    ↑C (esymm s x✝) * X ^ (↑card s - x✝)

tactic: intro s ht
state_before: R : Type u_1
inst✝ : CommSemiring R
s : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s + 1)
⊢ ∀ (x : Multiset R),
    x ∈ powersetLen x✝ s →
      ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s - t, t)) x =
        ↑C (prod x) * X ^ (↑card s - x✝)

tactic: rw [mem_powersetLen] at ht
state_before: R : Type u_1
inst✝ : CommSemiring R
s✝ : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s✝ + 1)
s : Multiset R
ht : s ∈ powersetLen x✝ s✝
⊢ ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s✝ - t, t)) s =
    ↑C (prod s) * X ^ (↑card s✝ - x✝)

tactic: dsimp
state_before: R : Type u_1
inst✝ : CommSemiring R
s✝ : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s✝ + 1)
s : Multiset R
ht : s ≤ s✝ ∧ ↑card s = x✝
⊢ ((fun p => prod (map (fun r => X) p.fst) * prod (map (fun r => ↑C r) p.snd)) ∘ fun t => (s✝ - t, t)) s =
    ↑C (prod s) * X ^ (↑card s✝ - x✝)

tactic: rw [prod_hom' s (Polynomial.C : R →+* R[X])]
state_before: R : Type u_1
inst✝ : CommSemiring R
s✝ : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s✝ + 1)
s : Multiset R
ht : s ≤ s✝ ∧ ↑card s = x✝
⊢ prod (map (fun r => X) (s✝ - s)) * prod (map (fun r => ↑C r) s) = ↑C (prod s) * X ^ (↑card s✝ - x✝)

tactic: simp [ht, map_const, prod_replicate, prod_hom', map_id', card_sub]
state_before: R : Type u_1
inst✝ : CommSemiring R
s✝ : Multiset R
x✝ : ℕ
a✝ : x✝ ∈ range (↑card s✝ + 1)
s : Multiset R
ht : s ≤ s✝ ∧ ↑card s = x✝
⊢ prod (map (fun r => X) (s✝ - s)) * ↑C (prod (map (fun r => r) s)) = ↑C (prod s) * X ^ (↑card s✝ - x✝)