Theorem: Finset.sum_pow_of_commute
File: Mathlib/Data/Nat/Choose/Multinomial.lean

tactic: induction' s using Finset.induction with a s ha ih
state_before: α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
⊢ ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: intro n
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
ih :
  ∀ (hc : Set.Pairwise ↑s fun i j => Commute (x i) (x j)) (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
⊢ ∀ (n : ℕ),
    Finset.sum (insert a s) x ^ n =
      ∑ k : { x // x ∈ Finset.sym (insert a s) n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: specialize ih (hc.mono <| s.subset_insert a)
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
ih :
  ∀ (hc : Set.Pairwise ↑s fun i j => Commute (x i) (x j)) (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
⊢ Finset.sum (insert a s) x ^ n =
    ∑ k : { x // x ∈ Finset.sym (insert a s) n },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: rw [sum_insert ha, (Commute.sum_right s _ _ _).add_pow, sum_range]
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
⊢ Finset.sum (insert a s) x ^ n =
    ∑ k : { x // x ∈ Finset.sym (insert a s) n },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: swap
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
⊢ ∑ i : Fin (n + 1), x a ^ ↑i * (∑ i in s, x i) ^ (n - ↑i) * ↑(Nat.choose n ↑i) =
    ∑ k : { x // x ∈ Finset.sym (insert a s) n },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
⊢ ∀ (i : α), i ∈ s → Commute (x a) (x i)

tactic: rw [sum_empty]
state_before: case empty
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
⊢ ∀ (n : ℕ),
    Finset.sum ∅ x ^ n =
      ∑ k : { x // x ∈ Finset.sym ∅ n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: rintro (_ | n)
state_before: case empty
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
⊢ ∀ (n : ℕ),
    0 ^ n =
      ∑ k : { x // x ∈ Finset.sym ∅ n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: haveI : Subsingleton (Sym α 0) := Unique.instSubsingleton
state_before: case empty.zero
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
⊢ 0 ^ zero =
    ∑ k : { x // x ∈ Finset.sym ∅ zero },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: rw [_root_.pow_zero, Fintype.sum_subsingleton]
state_before: case empty.zero
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ 0 ^ zero =
    ∑ k : { x // x ∈ Finset.sym ∅ zero },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: swap
state_before: case empty.zero
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ 1 =
    ↑(Multiset.multinomial ↑↑?empty.zero.a) *
      Multiset.noncommProd (Multiset.map x ↑↑?empty.zero.a)
        (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑?empty.zero.a} Commute)

case empty.zero.a
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ { x // x ∈ Finset.sym ∅ zero }

tactic: convert (@one_mul R _ _).symm
state_before: case empty.zero
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ 1 =
    ↑(Multiset.multinomial
          ↑↑(let_fun this_1 := Sym.instZeroSymOfNatNatInstOfNatNat;
              { val := 0, property := (_ : 0 ∈ {∅}) })) *
      Multiset.noncommProd
        (Multiset.map x
          ↑↑(let_fun this_1 := Sym.instZeroSymOfNatNatInstOfNatNat;
              { val := 0, property := (_ : 0 ∈ {∅}) }))
        (_ :
          Set.Pairwise
            {b |
              b ∈
                Multiset.map x
                  ↑↑(let_fun this_1 := Sym.instZeroSymOfNatNatInstOfNatNat;
                      { val := 0, property := (_ : 0 ∈ {∅}) })}
            Commute)

tactic: dsimp only
state_before: case h.e'_3.h.e'_5
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ ↑(Multiset.multinomial
        ↑↑(let_fun this_1 := Sym.instZeroSymOfNatNatInstOfNatNat;
            { val := 0, property := (_ : 0 ∈ {∅}) })) =
    1

tactic: convert @Nat.cast_one R _
state_before: case h.e'_3.h.e'_5
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ ↑(Multiset.multinomial ↑0) = 1

tactic: simp only [zero_eq, Sym.val_eq_coe]
state_before: case h.e'_2.h.e'_3
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ Multiset.multinomial ↑0 = 1

tactic: unfold Multiset.multinomial
state_before: case h.e'_2.h.e'_3
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ Multiset.multinomial ↑0 = 1

tactic: unfold Finsupp.multinomial
state_before: case h.e'_2.h.e'_3
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ Finsupp.multinomial (↑Multiset.toFinsupp ↑0) = 1

tactic: unfold Finsupp.prod
state_before: case h.e'_2.h.e'_3
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ ((Finsupp.sum (↑Multiset.toFinsupp ↑0) fun x => id)! / Finsupp.prod (↑Multiset.toFinsupp ↑0) fun x n => n !) = 1

tactic: simp only [factorial, prod_const_one, zero_lt_one, Nat.div_self]
state_before: case h.e'_2.h.e'_3
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ (Finsupp.sum (↑Multiset.toFinsupp ↑0) fun x => id)! /
      ∏ a in (↑Multiset.toFinsupp ↑0).support, (fun x n => n !) a (↑(↑Multiset.toFinsupp ↑0) a) =
    1

tactic: have : Zero (Sym α 0) := Sym.instZeroSymOfNatNatInstOfNatNat
state_before: case empty.zero.a
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this : Subsingleton (Sym α 0)
⊢ { x // x ∈ Finset.sym ∅ zero }

tactic: exact ⟨0, by simp⟩
state_before: case empty.zero.a
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this✝ : Subsingleton (Sym α 0)
this : Zero (Sym α 0)
⊢ { x // x ∈ Finset.sym ∅ zero }

tactic: simp
state_before: α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
this✝ : Subsingleton (Sym α 0)
this : Zero (Sym α 0)
⊢ 0 ∈ Finset.sym ∅ zero

tactic: rw [_root_.pow_succ, zero_mul]
state_before: case empty.succ
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
n : ℕ
⊢ 0 ^ succ n =
    ∑ k : { x // x ∈ Finset.sym ∅ (succ n) },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: haveI : IsEmpty (Finset.sym (∅ : Finset α) (succ n)) :=
Finset.instIsEmptySubtypeMemFinsetInstMembershipFinsetEmptyCollectionInstEmptyCollectionFinset
state_before: case empty.succ
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
n : ℕ
⊢ 0 =
    ∑ k : { x // x ∈ Finset.sym ∅ (succ n) },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: apply (Fintype.sum_empty _).symm
state_before: case empty.succ
α : Type u_2
inst✝¹ : DecidableEq α
s : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s fun i j => Commute (x i) (x j)
hc : Set.Pairwise ↑∅ fun i j => Commute (x i) (x j)
n : ℕ
this : IsEmpty { x // x ∈ Finset.sym ∅ (succ n) }
⊢ 0 =
    ∑ k : { x // x ∈ Finset.sym ∅ (succ n) },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: exact fun _ hb => hc (mem_insert_self a s) (mem_insert_of_mem hb)
  (ne_of_mem_of_not_mem hb ha).symm
state_before: α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
⊢ ∀ (i : α), i ∈ s → Commute (x a) (x i)

tactic: simp_rw [ih, mul_sum, sum_mul, sum_sigma', univ_sigma_univ]
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
⊢ ∑ i : Fin (n + 1), x a ^ ↑i * (∑ i in s, x i) ^ (n - ↑i) * ↑(Nat.choose n ↑i) =
    ∑ k : { x // x ∈ Finset.sym (insert a s) n },
      ↑(Multiset.multinomial ↑↑k) *
        Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)

tactic: refine' (Fintype.sum_equiv (symInsertEquiv ha) _ _ fun m => _).symm
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
⊢ ∑ x_1 : (i : Fin (n + 1)) × { x // x ∈ Finset.sym s (n - ↑i) },
      x a ^ ↑x_1.fst *
          (↑(Multiset.multinomial ↑↑x_1.snd) *
            Multiset.noncommProd (Multiset.map x ↑↑x_1.snd)
              (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑x_1.snd} Commute)) *
        ↑(Nat.choose n ↑x_1.fst) =
    ∑ x_1 : { x // x ∈ Finset.sym (insert a s) n },
      ↑(Multiset.multinomial ↑↑x_1) *
        Multiset.noncommProd (Multiset.map x ↑↑x_1) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑x_1} Commute)

tactic: rw [m.1.1.multinomial_filter_ne a]
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
m : { x // x ∈ Finset.sym (insert a s) n }
⊢ ↑(Multiset.multinomial ↑↑m) *
      Multiset.noncommProd (Multiset.map x ↑↑m) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑m} Commute) =
    x a ^ ↑(↑(symInsertEquiv ha) m).fst *
        (↑(Multiset.multinomial ↑↑(↑(symInsertEquiv ha) m).snd) *
          Multiset.noncommProd (Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd)
            (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd} Commute)) *
      ↑(Nat.choose n ↑(↑(symInsertEquiv ha) m).fst)

tactic: simp_rw [Multiset.noncommProd_add, m.1.1.filter_eq, Multiset.map_replicate, m.1.2]
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
m : { x // x ∈ Finset.sym (insert a s) n }
⊢ ↑(Nat.choose (↑Multiset.card ↑↑m) (Multiset.count a ↑↑m) *
          Multiset.multinomial (Multiset.filter ((fun x x_1 => x ≠ x_1) a) ↑↑m)) *
      Multiset.noncommProd
        (Multiset.map x (Multiset.filter ((fun x x_1 => x = x_1) a) ↑↑m) +
          Multiset.map x (Multiset.filter (fun a_1 => ¬(fun x x_1 => x = x_1) a a_1) ↑↑m))
        (_ :
          Set.Pairwise
            {x_1 |
              x_1 ∈
                Multiset.map x (Multiset.filter ((fun x x_2 => x = x_2) a) ↑↑m) +
                  Multiset.map x (Multiset.filter (fun a_1 => ¬(fun x x_2 => x = x_2) a a_1) ↑↑m)}
            Commute) =
    x a ^ ↑(↑(symInsertEquiv ha) m).fst *
        (↑(Multiset.multinomial ↑↑(↑(symInsertEquiv ha) m).snd) *
          Multiset.noncommProd (Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd)
            (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd} Commute)) *
      ↑(Nat.choose n ↑(↑(symInsertEquiv ha) m).fst)

tactic: rw [Multiset.noncommProd_eq_pow_card _ _ _ fun _ => Multiset.eq_of_mem_replicate]
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
m : { x // x ∈ Finset.sym (insert a s) n }
⊢ ↑(Nat.choose n (Multiset.count a ↑↑m) * Multiset.multinomial (Multiset.filter (fun x => a ≠ x) ↑↑m)) *
      (Multiset.noncommProd (Multiset.replicate (Multiset.count a ↑↑m) (x a))
          (_ : Set.Pairwise {x_1 | x_1 ∈ Multiset.replicate (Multiset.count a ↑↑m) (x a)} Commute) *
        Multiset.noncommProd (Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m))
          (_ : Set.Pairwise {x_1 | x_1 ∈ Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m)} Commute)) =
    x a ^ ↑(↑(symInsertEquiv ha) m).fst *
        (↑(Multiset.multinomial ↑↑(↑(symInsertEquiv ha) m).snd) *
          Multiset.noncommProd (Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd)
            (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd} Commute)) *
      ↑(Nat.choose n ↑(↑(symInsertEquiv ha) m).fst)

tactic: rw [Multiset.card_replicate, Nat.cast_mul, mul_assoc, Nat.cast_comm]
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
m : { x // x ∈ Finset.sym (insert a s) n }
⊢ ↑(Nat.choose n (Multiset.count a ↑↑m) * Multiset.multinomial (Multiset.filter (fun x => a ≠ x) ↑↑m)) *
      (x a ^ ↑Multiset.card (Multiset.replicate (Multiset.count a ↑↑m) (x a)) *
        Multiset.noncommProd (Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m))
          (_ : Set.Pairwise {x_1 | x_1 ∈ Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m)} Commute)) =
    x a ^ ↑(↑(symInsertEquiv ha) m).fst *
        (↑(Multiset.multinomial ↑↑(↑(symInsertEquiv ha) m).snd) *
          Multiset.noncommProd (Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd)
            (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd} Commute)) *
      ↑(Nat.choose n ↑(↑(symInsertEquiv ha) m).fst)

tactic: congr 1
state_before: case insert
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
m : { x // x ∈ Finset.sym (insert a s) n }
⊢ ↑(Multiset.multinomial (Multiset.filter (fun x => a ≠ x) ↑↑m)) *
        (x a ^ Multiset.count a ↑↑m *
          Multiset.noncommProd (Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m))
            (_ : Set.Pairwise {x_1 | x_1 ∈ Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m)} Commute)) *
      ↑(Nat.choose n (Multiset.count a ↑↑m)) =
    x a ^ ↑(↑(symInsertEquiv ha) m).fst *
        (↑(Multiset.multinomial ↑↑(↑(symInsertEquiv ha) m).snd) *
          Multiset.noncommProd (Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd)
            (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd} Commute)) *
      ↑(Nat.choose n ↑(↑(symInsertEquiv ha) m).fst)

tactic: simp_rw [← mul_assoc, Nat.cast_comm]
state_before: case insert.e_a
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
m : { x // x ∈ Finset.sym (insert a s) n }
⊢ ↑(Multiset.multinomial (Multiset.filter (fun x => a ≠ x) ↑↑m)) *
      (x a ^ Multiset.count a ↑↑m *
        Multiset.noncommProd (Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m))
          (_ : Set.Pairwise {x_1 | x_1 ∈ Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m)} Commute)) =
    x a ^ ↑(↑(symInsertEquiv ha) m).fst *
      (↑(Multiset.multinomial ↑↑(↑(symInsertEquiv ha) m).snd) *
        Multiset.noncommProd (Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd)
          (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd} Commute))

tactic: rfl
state_before: case insert.e_a
α : Type u_2
inst✝¹ : DecidableEq α
s✝ : Finset α
R : Type u_1
inst✝ : Semiring R
x : α → R
hc✝ : Set.Pairwise ↑s✝ fun i j => Commute (x i) (x j)
a : α
s : Finset α
ha : ¬a ∈ s
hc : Set.Pairwise ↑(insert a s) fun i j => Commute (x i) (x j)
n : ℕ
ih :
  ∀ (n : ℕ),
    Finset.sum s x ^ n =
      ∑ k : { x // x ∈ Finset.sym s n },
        ↑(Multiset.multinomial ↑↑k) *
          Multiset.noncommProd (Multiset.map x ↑↑k) (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑k} Commute)
m : { x // x ∈ Finset.sym (insert a s) n }
⊢ x a ^ Multiset.count a ↑↑m * ↑(Multiset.multinomial (Multiset.filter (fun x => a ≠ x) ↑↑m)) *
      Multiset.noncommProd (Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m))
        (_ : Set.Pairwise {x_1 | x_1 ∈ Multiset.map x (Multiset.filter (fun a_1 => ¬a = a_1) ↑↑m)} Commute) =
    x a ^ ↑(↑(symInsertEquiv ha) m).fst * ↑(Multiset.multinomial ↑↑(↑(symInsertEquiv ha) m).snd) *
      Multiset.noncommProd (Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd)
        (_ : Set.Pairwise {b | b ∈ Multiset.map x ↑↑(↑(symInsertEquiv ha) m).snd} Commute)