l3lab/ntp-mathlib huggingface dataset:
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
⊢ ∑ t in filter (fun t => card t.1 < k) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
    ∑ a in filter (fun a => a.1 < k) (antidiagonal k), ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)

Next tactic:
have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
⊢ ∑ t in filter (fun t => card t.1 < k) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
    ∑ a in filter (fun a => a.1 < k) (antidiagonal k), ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)

Next tactic:
simp only [← sum_congr rfl equiv_i]
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
⊢ ∑ t in filter (fun t => card t.1 < k) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
    ∑ x in filter (fun a => a.1 < k) (antidiagonal k),
      ∑ t in filter (fun t => card t.1 = x.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t

Next tactic:
have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    intro x hx y hy xny s hs hs' a ha
    simp only [mem_univ, forall_true_left, Prod.forall] at hs hs'
    rw [ne_eq, antidiagonal_congr (mem_filter.mp hx).left (mem_filter.mp hy).left,
      ← (mem_filter.mp (hs ha)).right.right, ← (mem_filter.mp (hs' ha)).right.right] at xny
    exact (xny rfl).elim
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
⊢ Set.PairwiseDisjoint ↑(filter (fun a => a.1 < k) (antidiagonal k)) fun a =>
    filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)

Next tactic:
simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
⊢ Set.Pairwise (↑(filter (fun a => a.1 < k) (antidiagonal k)))
    (Disjoint on fun a =>
      filter (fun a_1 => (card a_1.1 ≤ k ∧ (card a_1.1 = k → a_1.2 ∈ a_1.1)) ∧ card a_1.1 = a.1) univ)

Next tactic:
intro x hx y hy xny s hs hs' a ha
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    intro x hx y hy xny s hs hs' a ha
    

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
x : ℕ × ℕ
hx : x ∈ ↑(filter (fun a => a.1 < k) (antidiagonal k))
y : ℕ × ℕ
hy : y ∈ ↑(filter (fun a => a.1 < k) (antidiagonal k))
xny : x ≠ y
s : Finset (Finset σ × σ)
hs : s ≤ (fun a => filter (fun a_1 => (card a_1.1 ≤ k ∧ (card a_1.1 = k → a_1.2 ∈ a_1.1)) ∧ card a_1.1 = a.1) univ) x
hs' : s ≤ (fun a => filter (fun a_1 => (card a_1.1 ≤ k ∧ (card a_1.1 = k → a_1.2 ∈ a_1.1)) ∧ card a_1.1 = a.1) univ) y
a : Finset σ × σ
ha : a ∈ s
⊢ a ∈ ⊥

Next tactic:
simp only [mem_univ, forall_true_left, Prod.forall] at hs hs'
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    intro x hx y hy xny s hs hs' a ha
    simp only [mem_univ, forall_true_left, Prod.forall] at hs hs'
    

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
x : ℕ × ℕ
hx : x ∈ ↑(filter (fun a => a.1 < k) (antidiagonal k))
y : ℕ × ℕ
hy : y ∈ ↑(filter (fun a => a.1 < k) (antidiagonal k))
xny : x ≠ y
s : Finset (Finset σ × σ)
hs : s ≤ filter (fun a => (card a.1 ≤ k ∧ (card a.1 = k → a.2 ∈ a.1)) ∧ card a.1 = x.1) univ
hs' : s ≤ filter (fun a => (card a.1 ≤ k ∧ (card a.1 = k → a.2 ∈ a.1)) ∧ card a.1 = y.1) univ
a : Finset σ × σ
ha : a ∈ s
⊢ a ∈ ⊥

Next tactic:
rw [ne_eq, antidiagonal_congr (mem_filter.mp hx).left (mem_filter.mp hy).left,
      ← (mem_filter.mp (hs ha)).right.right, ← (mem_filter.mp (hs' ha)).right.right] at xny
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    intro x hx y hy xny s hs hs' a ha
    simp only [mem_univ, forall_true_left, Prod.forall] at hs hs'
    rw [ne_eq, antidiagonal_congr (mem_filter.mp hx).left (mem_filter.mp hy).left,
      ← (mem_filter.mp (hs ha)).right.right, ← (mem_filter.mp (hs' ha)).right.right] at xny
    

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
x : ℕ × ℕ
hx : x ∈ ↑(filter (fun a => a.1 < k) (antidiagonal k))
y : ℕ × ℕ
hy : y ∈ ↑(filter (fun a => a.1 < k) (antidiagonal k))
s : Finset (Finset σ × σ)
hs : s ≤ filter (fun a => (card a.1 ≤ k ∧ (card a.1 = k → a.2 ∈ a.1)) ∧ card a.1 = x.1) univ
hs' : s ≤ filter (fun a => (card a.1 ≤ k ∧ (card a.1 = k → a.2 ∈ a.1)) ∧ card a.1 = y.1) univ
a : Finset σ × σ
xny : ¬card a.1 = card a.1
ha : a ∈ s
⊢ a ∈ ⊥

Next tactic:
exact (xny rfl).elim
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    intro x hx y hy xny s hs hs' a ha
    simp only [mem_univ, forall_true_left, Prod.forall] at hs hs'
    rw [ne_eq, antidiagonal_congr (mem_filter.mp hx).left (mem_filter.mp hy).left,
      ← (mem_filter.mp (hs ha)).right.right, ← (mem_filter.mp (hs' ha)).right.right] at xny
    exact (xny rfl).elim
  

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
pdisj :
  Set.PairwiseDisjoint ↑(filter (fun a => a.1 < k) (antidiagonal k)) fun a =>
    filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)
⊢ ∑ t in filter (fun t => card t.1 < k) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
    ∑ x in filter (fun a => a.1 < k) (antidiagonal k),
      ∑ t in filter (fun t => card t.1 = x.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t

Next tactic:
have hdisj := @sum_disjiUnion _ _ _ f _ ((antidiagonal k).filter (fun a ↦ a.fst < k))
    (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) pdisj
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    intro x hx y hy xny s hs hs' a ha
    simp only [mem_univ, forall_true_left, Prod.forall] at hs hs'
    rw [ne_eq, antidiagonal_congr (mem_filter.mp hx).left (mem_filter.mp hy).left,
      ← (mem_filter.mp (hs ha)).right.right, ← (mem_filter.mp (hs' ha)).right.right] at xny
    exact (xny rfl).elim
  have hdisj := @sum_disjiUnion _ _ _ f _ ((antidiagonal k).filter (fun a ↦ a.fst < k))
    (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) pdisj
  

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
pdisj :
  Set.PairwiseDisjoint ↑(filter (fun a => a.1 < k) (antidiagonal k)) fun a =>
    filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)
hdisj :
  ∑ x in
      disjiUnion (filter (fun a => a.1 < k) (antidiagonal k))
        (fun a => filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)) pdisj,
      f x =
    ∑ i in filter (fun a => a.1 < k) (antidiagonal k),
      ∑ x in filter (fun t => card t.1 = i.1) (MvPolynomial.NewtonIdentities.pairs σ k), f x
⊢ ∑ t in filter (fun t => card t.1 < k) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
    ∑ x in filter (fun a => a.1 < k) (antidiagonal k),
      ∑ t in filter (fun t => card t.1 = x.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t

Next tactic:
have disj_equiv : disjiUnion ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun a ↦ filter (fun t ↦ card t.fst = a.fst) (pairs σ k)) pdisj =
      filter (fun t ↦ card t.fst < k) (pairs σ k) := by
    ext a
    rw [mem_disjiUnion, mem_filter]
    refine' ⟨_, fun haf ↦ ⟨(card a.fst, k - card a.fst), _, _⟩⟩
    · rintro ⟨n, hnk, ha⟩
      have hnk' : n.fst ≤ k := by apply le_of_lt; aesop
      aesop
    · simp_all only [mem_antidiagonal, mem_filter, mem_pairs, disjiUnion_eq_biUnion,
        add_tsub_cancel_of_le, and_true]
    · simp_all only [mem_antidiagonal, mem_filter, mem_pairs, disjiUnion_eq_biUnion,
        implies_true, and_true]
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    intro x hx y hy xny s hs hs' a ha
    simp only [mem_univ, forall_true_left, Prod.forall] at hs hs'
    rw [ne_eq, antidiagonal_congr (mem_filter.mp hx).left (mem_filter.mp hy).left,
      ← (mem_filter.mp (hs ha)).right.right, ← (mem_filter.mp (hs' ha)).right.right] at xny
    exact (xny rfl).elim
  have hdisj := @sum_disjiUnion _ _ _ f _ ((antidiagonal k).filter (fun a ↦ a.fst < k))
    (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) pdisj
  have disj_equiv : disjiUnion ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun a ↦ filter (fun t ↦ card t.fst = a.fst) (pairs σ k)) pdisj =
      filter (fun t ↦ card t.fst < k) (pairs σ k) := by
    

Proof state:
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
pdisj :
  Set.PairwiseDisjoint ↑(filter (fun a => a.1 < k) (antidiagonal k)) fun a =>
    filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)
hdisj :
  ∑ x in
      disjiUnion (filter (fun a => a.1 < k) (antidiagonal k))
        (fun a => filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)) pdisj,
      f x =
    ∑ i in filter (fun a => a.1 < k) (antidiagonal k),
      ∑ x in filter (fun t => card t.1 = i.1) (MvPolynomial.NewtonIdentities.pairs σ k), f x
⊢ disjiUnion (filter (fun a => a.1 < k) (antidiagonal k))
      (fun a => filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)) pdisj =
    filter (fun t => card t.1 < k) (MvPolynomial.NewtonIdentities.pairs σ k)

Next tactic:
ext a
private theorem sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ)
    (f : Finset σ × σ → MvPolynomial σ R) :
    (∑ t in filter (fun t ↦ card t.fst < k) (pairs σ k), f t) =
    ∑ a in (antidiagonal k).filter (fun a ↦ a.fst < k),
    ∑ A in powersetCard a.fst univ, (∑ j, f (A, j)) := by
  have equiv_i (a : ℕ × ℕ) (ha : a ∈ (antidiagonal k).filter (fun a ↦ a.fst < k)) :=
    sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum σ R k a ha f
  simp only [← sum_congr rfl equiv_i]
  have pdisj : Set.PairwiseDisjoint ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) := by
    simp only [Set.PairwiseDisjoint, Disjoint, pairs, filter_filter, ne_eq, le_eq_subset,
      bot_eq_empty]
    intro x hx y hy xny s hs hs' a ha
    simp only [mem_univ, forall_true_left, Prod.forall] at hs hs'
    rw [ne_eq, antidiagonal_congr (mem_filter.mp hx).left (mem_filter.mp hy).left,
      ← (mem_filter.mp (hs ha)).right.right, ← (mem_filter.mp (hs' ha)).right.right] at xny
    exact (xny rfl).elim
  have hdisj := @sum_disjiUnion _ _ _ f _ ((antidiagonal k).filter (fun a ↦ a.fst < k))
    (fun (a : ℕ × ℕ) ↦ (filter (fun t ↦ card t.fst = a.fst) (pairs σ k))) pdisj
  have disj_equiv : disjiUnion ((antidiagonal k).filter (fun a ↦ a.fst < k))
      (fun a ↦ filter (fun t ↦ card t.fst = a.fst) (pairs σ k)) pdisj =
      filter (fun t ↦ card t.fst < k) (pairs σ k) := by
    ext a
    

Proof state:
case a
σ : Type u_1
inst✝² : Fintype σ
inst✝¹ : DecidableEq σ
R : Type u_2
inst✝ : CommRing R
k : ℕ
f : Finset σ × σ → MvPolynomial σ R
equiv_i :
  ∀ a ∈ filter (fun a => a.1 < k) (antidiagonal k),
    ∑ t in filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k), f t =
      ∑ A in powersetCard a.1 univ, ∑ j : σ, f (A, j)
pdisj :
  Set.PairwiseDisjoint ↑(filter (fun a => a.1 < k) (antidiagonal k)) fun a =>
    filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)
hdisj :
  ∑ x in
      disjiUnion (filter (fun a => a.1 < k) (antidiagonal k))
        (fun a => filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)) pdisj,
      f x =
    ∑ i in filter (fun a => a.1 < k) (antidiagonal k),
      ∑ x in filter (fun t => card t.1 = i.1) (MvPolynomial.NewtonIdentities.pairs σ k), f x
a : Finset σ × σ
⊢ a ∈
      disjiUnion (filter (fun a => a.1 < k) (antidiagonal k))
        (fun a => filter (fun t => card t.1 = a.1) (MvPolynomial.NewtonIdentities.pairs σ k)) pdisj ↔
    a ∈ filter (fun t => card t.1 < k) (MvPolynomial.NewtonIdentities.pairs σ k)

Next tactic:
rw [mem_disjiUnion, mem_filter]