l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem tsum_ite_eq (b : β) [DecidablePred (· = b)] (a : α) :
    ∑' b', (if b' = b then a else 0) = a := by
  rw [tsum_eq_single b]
  · simp
  · 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ a₁ a₂ : α
b : β
inst✝ : DecidablePred fun x => x = b
a : α
⊢ ∀ (b' : β), b' ≠ b → (if b' = b then a else 0) = 0

Next tactic:
intro b' hb'
@[simp]
theorem tsum_ite_eq (b : β) [DecidablePred (· = b)] (a : α) :
    ∑' b', (if b' = b then a else 0) = a := by
  rw [tsum_eq_single b]
  · simp
  · intro b' hb'; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ a₁ a₂ : α
b : β
inst✝ : DecidablePred fun x => x = b
a : α
b' : β
hb' : b' ≠ b
⊢ (if b' = b then a else 0) = 0

Next tactic:
simp [hb']
@[simp]
theorem tsum_pi_single [DecidableEq β] (b : β) (a : α) : ∑' b', Pi.single b a b' = a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ a₁ a₂ : α
inst✝ : DecidableEq β
b : β
a : α
⊢ ∑' (b' : β), Pi.single b a b' = a

Next tactic:
rw [tsum_eq_single b]
@[simp]
theorem tsum_pi_single [DecidableEq β] (b : β) (a : α) : ∑' b', Pi.single b a b' = a := by
  rw [tsum_eq_single b]
  · 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ a₁ a₂ : α
inst✝ : DecidableEq β
b : β
a : α
⊢ Pi.single b a b = a

Next tactic:
simp
@[simp]
theorem tsum_pi_single [DecidableEq β] (b : β) (a : α) : ∑' b', Pi.single b a b' = a := by
  rw [tsum_eq_single b]
  · simp
  · 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ a₁ a₂ : α
inst✝ : DecidableEq β
b : β
a : α
⊢ ∀ (b' : β), b' ≠ b → Pi.single b a b' = 0

Next tactic:
intro b' hb'
@[simp]
theorem tsum_pi_single [DecidableEq β] (b : β) (a : α) : ∑' b', Pi.single b a b' = a := by
  rw [tsum_eq_single b]
  · simp
  · intro b' hb'; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ a₁ a₂ : α
inst✝ : DecidableEq β
b : β
a : α
b' : β
hb' : b' ≠ b
⊢ Pi.single b a b' = 0

Next tactic:
simp [hb']
@[simp, nolint simpNF]
theorem Finset.tsum_subtype (s : Finset β) (f : β → α) :
    ∑' x : { x // x ∈ s }, f x = ∑ x in s, f x := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝¹ : AddCommMonoid α
inst✝ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
s : Finset β
f : β → α
⊢ ∑' (x : { x // x ∈ s }), f ↑x = ∑ x in s, f x

Next tactic:
rw [← sum_attach]
@[simp, nolint simpNF]
theorem Finset.tsum_subtype (s : Finset β) (f : β → α) :
    ∑' x : { x // x ∈ s }, f x = ∑ x in s, f x := by
  rw [← sum_attach]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝¹ : AddCommMonoid α
inst✝ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
s : Finset β
f : β → α
⊢ ∑' (x : { x // x ∈ s }), f ↑x = ∑ x in attach s, f ↑x

Next tactic:
exact tsum_fintype _
theorem Finset.tsum_subtype' (s : Finset β) (f : β → α) :
    ∑' x : (s : Set β), f x = ∑ x in s, f x := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝¹ : AddCommMonoid α
inst✝ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
s : Finset β
f : β → α
⊢ ∑' (x : ↑↑s), f ↑x = ∑ x in s, f x

Next tactic:
simp
@[simp, nolint simpNF]
theorem tsum_singleton (b : β) (f : β → α) : ∑' x : ({b} : Set β), f x = f b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝¹ : AddCommMonoid α
inst✝ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
b : β
f : β → α
⊢ ∑' (x : ↑{b}), f ↑x = f b

Next tactic:
rw [← coe_singleton, Finset.tsum_subtype', sum_singleton]
theorem tsum_dite_right (P : Prop) [Decidable P] (x : β → ¬P → α) :
    ∑' b : β, (if h : P then (0 : α) else x b h) = if h : P then (0 : α) else ∑' b : β, x b h := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝¹ : T2Space α
P : Prop
inst✝ : Decidable P
x : β → ¬P → α
⊢ (∑' (b : β), if h : P then 0 else x b h) = if h : P then 0 else ∑' (b : β), x b h

Next tactic:
by_cases hP : P
theorem tsum_dite_right (P : Prop) [Decidable P] (x : β → ¬P → α) :
    ∑' b : β, (if h : P then (0 : α) else x b h) = if h : P then (0 : α) else ∑' b : β, x b h := by
  by_cases hP : P <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝¹ : T2Space α
P : Prop
inst✝ : Decidable P
x : β → ¬P → α
hP : P
⊢ (∑' (b : β), if h : P then 0 else x b h) = if h : P then 0 else ∑' (b : β), x b h

Next tactic:
simp [hP]
theorem tsum_dite_right (P : Prop) [Decidable P] (x : β → ¬P → α) :
    ∑' b : β, (if h : P then (0 : α) else x b h) = if h : P then (0 : α) else ∑' b : β, x b h := by
  by_cases hP : P <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝¹ : T2Space α
P : Prop
inst✝ : Decidable P
x : β → ¬P → α
hP : ¬P
⊢ (∑' (b : β), if h : P then 0 else x b h) = if h : P then 0 else ∑' (b : β), x b h

Next tactic:
simp [hP]
theorem tsum_dite_left (P : Prop) [Decidable P] (x : β → P → α) :
    ∑' b : β, (if h : P then x b h else 0) = if h : P then ∑' b : β, x b h else 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝¹ : T2Space α
P : Prop
inst✝ : Decidable P
x : β → P → α
⊢ (∑' (b : β), if h : P then x b h else 0) = if h : P then ∑' (b : β), x b h else 0

Next tactic:
by_cases hP : P
theorem tsum_dite_left (P : Prop) [Decidable P] (x : β → P → α) :
    ∑' b : β, (if h : P then x b h else 0) = if h : P then ∑' b : β, x b h else 0 := by
  by_cases hP : P <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝¹ : T2Space α
P : Prop
inst✝ : Decidable P
x : β → P → α
hP : P
⊢ (∑' (b : β), if h : P then x b h else 0) = if h : P then ∑' (b : β), x b h else 0

Next tactic:
simp [hP]
theorem tsum_dite_left (P : Prop) [Decidable P] (x : β → P → α) :
    ∑' b : β, (if h : P then x b h else 0) = if h : P then ∑' b : β, x b h else 0 := by
  by_cases hP : P <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝¹ : T2Space α
P : Prop
inst✝ : Decidable P
x : β → P → α
hP : ¬P
⊢ (∑' (b : β), if h : P then x b h else 0) = if h : P then ∑' (b : β), x b h else 0

Next tactic:
simp [hP]
theorem Function.Surjective.tsum_eq_tsum_of_hasSum_iff_hasSum {α' : Type*} [AddCommMonoid α']
    [TopologicalSpace α'] {e : α' → α} (hes : Function.Surjective e) (h0 : e 0 = 0) {f : β → α}
    {g : γ → α'} (h : ∀ {a}, HasSum f (e a) ↔ HasSum g a) : ∑' b, f b = e (∑' c, g c) :=
  _root_.by_cases (fun x => (h.mpr x.hasSum).tsum_eq) fun hg : ¬Summable g => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f✝ g✝ : β → α
a a₁ a₂ : α
inst✝² : T2Space α
α' : Type u_5
inst✝¹ : AddCommMonoid α'
inst✝ : TopologicalSpace α'
e : α' → α
hes : Surjective e
h0 : e 0 = 0
f : β → α
g : γ → α'
h : ∀ {a : α'}, HasSum f (e a) ↔ HasSum g a
hg : ¬Summable g
⊢ ∑' (b : β), f b = e (∑' (c : γ), g c)

Next tactic:
have hf : ¬Summable f := mt (hes.summable_iff_of_hasSum_iff @h).1 hg
theorem Function.Surjective.tsum_eq_tsum_of_hasSum_iff_hasSum {α' : Type*} [AddCommMonoid α']
    [TopologicalSpace α'] {e : α' → α} (hes : Function.Surjective e) (h0 : e 0 = 0) {f : β → α}
    {g : γ → α'} (h : ∀ {a}, HasSum f (e a) ↔ HasSum g a) : ∑' b, f b = e (∑' c, g c) :=
  _root_.by_cases (fun x => (h.mpr x.hasSum).tsum_eq) fun hg : ¬Summable g => by
    have hf : ¬Summable f := mt (hes.summable_iff_of_hasSum_iff @h).1 hg
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f✝ g✝ : β → α
a a₁ a₂ : α
inst✝² : T2Space α
α' : Type u_5
inst✝¹ : AddCommMonoid α'
inst✝ : TopologicalSpace α'
e : α' → α
hes : Surjective e
h0 : e 0 = 0
f : β → α
g : γ → α'
h : ∀ {a : α'}, HasSum f (e a) ↔ HasSum g a
hg : ¬Summable g
hf : ¬Summable f
⊢ ∑' (b : β), f b = e (∑' (c : γ), g c)

Next tactic:
simp [tsum_def, hf, hg, h0]
theorem tsum_range {g : γ → β} (f : β → α) (hg : Injective g) :
    ∑' x : Set.range g, f x = ∑' x, f (g x) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f✝ g✝ : β → α
a a₁ a₂ : α
inst✝ : T2Space α
g : γ → β
f : β → α
hg : Injective g
⊢ ∑' (x : ↑(Set.range g)), f ↑x = ∑' (x : γ), f (g x)

Next tactic:
rw [← Set.image_univ, tsum_image f (hg.injOn _)]
theorem tsum_range {g : γ → β} (f : β → α) (hg : Injective g) :
    ∑' x : Set.range g, f x = ∑' x, f (g x) := by
  rw [← Set.image_univ, tsum_image f (hg.injOn _)]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f✝ g✝ : β → α
a a₁ a₂ : α
inst✝ : T2Space α
g : γ → β
f : β → α
hg : Injective g
⊢ ∑' (x : ↑Set.univ), f (g ↑x) = ∑' (x : γ), f (g x)

Next tactic:
simp_rw [← comp_apply (g := g), tsum_univ (f ∘ g)]
/-- If `f b = 0` for all `b ∈ t`, then the sum over `f a` with `a ∈ s` is the same as the
sum over `f a` with `a ∈ s ∖ t`. -/
lemma tsum_setElem_eq_tsum_setElem_diff [T2Space α] {f : β → α} (s t : Set β)
    (hf₀ : ∀ b ∈ t, f b = 0) :
    ∑' a : s, f a = ∑' a : (s \ t : Set β), f a :=
  tsum_eq_tsum_of_hasSum_iff_hasSum fun {a} ↦ Iff.symm <|
    (Set.inclusion_injective <| s.diff_subset t).hasSum_iff
      (f := fun b : s ↦ f b) fun b hb ↦ hf₀ b <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g : β → α
a✝ a₁ a₂ : α
inst✝¹ inst✝ : T2Space α
f : β → α
s t : Set β
hf₀ : ∀ b ∈ t, f b = 0
a : α
b : ↑s
hb : b ∉ Set.range (Set.inclusion (_ : s \ t ⊆ s))
⊢ ↑b ∈ t

Next tactic:
simpa using hb
/-- Version of `tsum_eq_add_tsum_ite` for `AddCommMonoid` rather than `AddCommGroup`.
Requires a different convergence assumption involving `Function.update`. -/
theorem tsum_eq_add_tsum_ite' [DecidableEq β] {f : β → α} (b : β) (hf : Summable (update f b 0)) :
    ∑' x, f x = f b + ∑' x, ite (x = b) 0 (f x) :=
  calc
    ∑' x, f x = ∑' x, (ite (x = b) (f x) 0 + update f b 0 x) :=
      tsum_congr fun n => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : ContinuousAdd α
inst✝ : DecidableEq β
f : β → α
b : β
hf : Summable (update f b 0)
n : β
⊢ f n = (if n = b then f n else 0) + update f b 0 n

Next tactic:
split_ifs with h
/-- Version of `tsum_eq_add_tsum_ite` for `AddCommMonoid` rather than `AddCommGroup`.
Requires a different convergence assumption involving `Function.update`. -/
theorem tsum_eq_add_tsum_ite' [DecidableEq β] {f : β → α} (b : β) (hf : Summable (update f b 0)) :
    ∑' x, f x = f b + ∑' x, ite (x = b) 0 (f x) :=
  calc
    ∑' x, f x = ∑' x, (ite (x = b) (f x) 0 + update f b 0 x) :=
      tsum_congr fun n => by split_ifs with h <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : ContinuousAdd α
inst✝ : DecidableEq β
f : β → α
b : β
hf : Summable (update f b 0)
n : β
h : n = b
⊢ f n = f n + update f b 0 n

Next tactic:
simp [update_apply, h]
/-- Version of `tsum_eq_add_tsum_ite` for `AddCommMonoid` rather than `AddCommGroup`.
Requires a different convergence assumption involving `Function.update`. -/
theorem tsum_eq_add_tsum_ite' [DecidableEq β] {f : β → α} (b : β) (hf : Summable (update f b 0)) :
    ∑' x, f x = f b + ∑' x, ite (x = b) 0 (f x) :=
  calc
    ∑' x, f x = ∑' x, (ite (x = b) (f x) 0 + update f b 0 x) :=
      tsum_congr fun n => by split_ifs with h <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : ContinuousAdd α
inst✝ : DecidableEq β
f : β → α
b : β
hf : Summable (update f b 0)
n : β
h : ¬n = b
⊢ f n = 0 + update f b 0 n

Next tactic:
simp [update_apply, h]
/-- Version of `tsum_eq_add_tsum_ite` for `AddCommMonoid` rather than `AddCommGroup`.
Requires a different convergence assumption involving `Function.update`. -/
theorem tsum_eq_add_tsum_ite' [DecidableEq β] {f : β → α} (b : β) (hf : Summable (update f b 0)) :
    ∑' x, f x = f b + ∑' x, ite (x = b) 0 (f x) :=
  calc
    ∑' x, f x = ∑' x, (ite (x = b) (f x) 0 + update f b 0 x) :=
      tsum_congr fun n => by split_ifs with h <;> simp [update_apply, h]
    _ = ∑' x, ite (x = b) (f x) 0 + ∑' x, update f b 0 x :=
      tsum_add ⟨ite (b = b) (f b) 0, hasSum_single b fun b hb => if_neg hb⟩ hf
    _ = ite (b = b) (f b) 0 + ∑' x, update f b 0 x := by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : ContinuousAdd α
inst✝ : DecidableEq β
f : β → α
b : β
hf : Summable (update f b 0)
⊢ (∑' (x : β), if x = b then f x else 0) + ∑' (x : β), update f b 0 x =
    (if b = b then f b else 0) + ∑' (x : β), update f b 0 x

Next tactic:
congr
/-- Version of `tsum_eq_add_tsum_ite` for `AddCommMonoid` rather than `AddCommGroup`.
Requires a different convergence assumption involving `Function.update`. -/
theorem tsum_eq_add_tsum_ite' [DecidableEq β] {f : β → α} (b : β) (hf : Summable (update f b 0)) :
    ∑' x, f x = f b + ∑' x, ite (x = b) 0 (f x) :=
  calc
    ∑' x, f x = ∑' x, (ite (x = b) (f x) 0 + update f b 0 x) :=
      tsum_congr fun n => by split_ifs with h <;> simp [update_apply, h]
    _ = ∑' x, ite (x = b) (f x) 0 + ∑' x, update f b 0 x :=
      tsum_add ⟨ite (b = b) (f b) 0, hasSum_single b fun b hb => if_neg hb⟩ hf
    _ = ite (b = b) (f b) 0 + ∑' x, update f b 0 x := by
      congr
      

Proof state:
case e_a
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : ContinuousAdd α
inst✝ : DecidableEq β
f : β → α
b : β
hf : Summable (update f b 0)
⊢ (∑' (x : β), if x = b then f x else 0) = if b = b then f b else 0

Next tactic:
exact tsum_eq_single b fun b' hb' => if_neg hb'
/-- Version of `tsum_eq_add_tsum_ite` for `AddCommMonoid` rather than `AddCommGroup`.
Requires a different convergence assumption involving `Function.update`. -/
theorem tsum_eq_add_tsum_ite' [DecidableEq β] {f : β → α} (b : β) (hf : Summable (update f b 0)) :
    ∑' x, f x = f b + ∑' x, ite (x = b) 0 (f x) :=
  calc
    ∑' x, f x = ∑' x, (ite (x = b) (f x) 0 + update f b 0 x) :=
      tsum_congr fun n => by split_ifs with h <;> simp [update_apply, h]
    _ = ∑' x, ite (x = b) (f x) 0 + ∑' x, update f b 0 x :=
      tsum_add ⟨ite (b = b) (f b) 0, hasSum_single b fun b hb => if_neg hb⟩ hf
    _ = ite (b = b) (f b) 0 + ∑' x, update f b 0 x := by
      congr
      exact tsum_eq_single b fun b' hb' => if_neg hb'
    _ = f b + ∑' x, ite (x = b) 0 (f x) := by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : ContinuousAdd α
inst✝ : DecidableEq β
f : β → α
b : β
hf : Summable (update f b 0)
⊢ (if b = b then f b else 0) + ∑' (x : β), update f b 0 x = f b + ∑' (x : β), if x = b then 0 else f x

Next tactic:
simp only [update, eq_self_iff_true, if_true, eq_rec_constant, dite_eq_ite]
theorem tsum_comm' {f : β → γ → δ} (h : Summable (Function.uncurry f)) (h₁ : ∀ b, Summable (f b))
    (h₂ : ∀ c, Summable fun b => f b c) : ∑' (c) (b), f b c = ∑' (b) (c), f b c := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁷ : AddCommMonoid α
inst✝⁶ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
inst✝⁵ : T2Space α
inst✝⁴ : ContinuousAdd α
inst✝³ : AddCommMonoid δ
inst✝² : TopologicalSpace δ
inst✝¹ : T3Space δ
inst✝ : ContinuousAdd δ
f : β → γ → δ
h : Summable (uncurry f)
h₁ : ∀ (b : β), Summable (f b)
h₂ : ∀ (c : γ), Summable fun b => f b c
⊢ ∑' (c : γ) (b : β), f b c = ∑' (b : β) (c : γ), f b c

Next tactic:
erw [← tsum_prod' h h₁, ← tsum_prod' h.prod_symm h₂, ← (Equiv.prodComm γ β).tsum_eq (uncurry f)]
theorem tsum_comm' {f : β → γ → δ} (h : Summable (Function.uncurry f)) (h₁ : ∀ b, Summable (f b))
    (h₂ : ∀ c, Summable fun b => f b c) : ∑' (c) (b), f b c = ∑' (b) (c), f b c := by
  erw [← tsum_prod' h h₁, ← tsum_prod' h.prod_symm h₂, ← (Equiv.prodComm γ β).tsum_eq (uncurry f)]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁷ : AddCommMonoid α
inst✝⁶ : TopologicalSpace α
f✝ g : β → α
a a₁ a₂ : α
inst✝⁵ : T2Space α
inst✝⁴ : ContinuousAdd α
inst✝³ : AddCommMonoid δ
inst✝² : TopologicalSpace δ
inst✝¹ : T3Space δ
inst✝ : ContinuousAdd δ
f : β → γ → δ
h : Summable (uncurry f)
h₁ : ∀ (b : β), Summable (f b)
h₂ : ∀ (c : γ), Summable fun b => f b c
⊢ ∑' (p : γ × β), uncurry f (Prod.swap p) = ∑' (c : γ × β), uncurry f ((Equiv.prodComm γ β) c)

Next tactic:
rfl
/-- You can compute a sum over an encodably type by summing over the natural numbers and
  taking a supremum. This is useful for outer measures. -/
theorem tsum_iSup_decode₂ [CompleteLattice β] (m : β → α) (m0 : m ⊥ = 0) (s : γ → β) :
    ∑' i : ℕ, m (⨆ b ∈ decode₂ γ i, s b) = ∑' b : γ, m (s b) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : Encodable γ
inst✝ : CompleteLattice β
m : β → α
m0 : m ⊥ = 0
s : γ → β
⊢ ∑' (i : ℕ), m (⨆ b ∈ decode₂ γ i, s b) = ∑' (b : γ), m (s b)

Next tactic:
have H : ∀ n, m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → (decode₂ γ n).isSome := by
    intro n h
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · refine' (h <| by simp [m0]).elim
    · exact rfl
/-- You can compute a sum over an encodably type by summing over the natural numbers and
  taking a supremum. This is useful for outer measures. -/
theorem tsum_iSup_decode₂ [CompleteLattice β] (m : β → α) (m0 : m ⊥ = 0) (s : γ → β) :
    ∑' i : ℕ, m (⨆ b ∈ decode₂ γ i, s b) = ∑' b : γ, m (s b) := by
  have H : ∀ n, m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → (decode₂ γ n).isSome := by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : Encodable γ
inst✝ : CompleteLattice β
m : β → α
m0 : m ⊥ = 0
s : γ → β
⊢ ∀ (n : ℕ), m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → Option.isSome (decode₂ γ n) = true

Next tactic:
intro n h
/-- You can compute a sum over an encodably type by summing over the natural numbers and
  taking a supremum. This is useful for outer measures. -/
theorem tsum_iSup_decode₂ [CompleteLattice β] (m : β → α) (m0 : m ⊥ = 0) (s : γ → β) :
    ∑' i : ℕ, m (⨆ b ∈ decode₂ γ i, s b) = ∑' b : γ, m (s b) := by
  have H : ∀ n, m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → (decode₂ γ n).isSome := by
    intro n h
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : Encodable γ
inst✝ : CompleteLattice β
m : β → α
m0 : m ⊥ = 0
s : γ → β
n : ℕ
h : m (⨆ b ∈ decode₂ γ n, s b) ≠ 0
⊢ Option.isSome (decode₂ γ n) = true

Next tactic:
generalize decode₂ γ n = foo at *
/-- You can compute a sum over an encodably type by summing over the natural numbers and
  taking a supremum. This is useful for outer measures. -/
theorem tsum_iSup_decode₂ [CompleteLattice β] (m : β → α) (m0 : m ⊥ = 0) (s : γ → β) :
    ∑' i : ℕ, m (⨆ b ∈ decode₂ γ i, s b) = ∑' b : γ, m (s b) := by
  have H : ∀ n, m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → (decode₂ γ n).isSome := by
    intro n h
    generalize decode₂ γ n = foo at *
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : Encodable γ
inst✝ : CompleteLattice β
m : β → α
m0 : m ⊥ = 0
s : γ → β
n : ℕ
foo : Option γ
h : m (⨆ b ∈ foo, s b) ≠ 0
⊢ Option.isSome foo = true

Next tactic:
cases' foo with b
/-- You can compute a sum over an encodably type by summing over the natural numbers and
  taking a supremum. This is useful for outer measures. -/
theorem tsum_iSup_decode₂ [CompleteLattice β] (m : β → α) (m0 : m ⊥ = 0) (s : γ → β) :
    ∑' i : ℕ, m (⨆ b ∈ decode₂ γ i, s b) = ∑' b : γ, m (s b) := by
  have H : ∀ n, m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → (decode₂ γ n).isSome := by
    intro n h
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · 

Proof state:
case none
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : Encodable γ
inst✝ : CompleteLattice β
m : β → α
m0 : m ⊥ = 0
s : γ → β
n : ℕ
h : m (⨆ b ∈ none, s b) ≠ 0
⊢ Option.isSome none = true

Next tactic:
refine' (h <| by simp [m0]).elim
/-- You can compute a sum over an encodably type by summing over the natural numbers and
  taking a supremum. This is useful for outer measures. -/
theorem tsum_iSup_decode₂ [CompleteLattice β] (m : β → α) (m0 : m ⊥ = 0) (s : γ → β) :
    ∑' i : ℕ, m (⨆ b ∈ decode₂ γ i, s b) = ∑' b : γ, m (s b) := by
  have H : ∀ n, m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → (decode₂ γ n).isSome := by
    intro n h
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · refine' (h <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : Encodable γ
inst✝ : CompleteLattice β
m : β → α
m0 : m ⊥ = 0
s : γ → β
n : ℕ
h : m (⨆ b ∈ none, s b) ≠ 0
⊢ m (⨆ b ∈ none, s b) = 0

Next tactic:
simp [m0]
/-- You can compute a sum over an encodably type by summing over the natural numbers and
  taking a supremum. This is useful for outer measures. -/
theorem tsum_iSup_decode₂ [CompleteLattice β] (m : β → α) (m0 : m ⊥ = 0) (s : γ → β) :
    ∑' i : ℕ, m (⨆ b ∈ decode₂ γ i, s b) = ∑' b : γ, m (s b) := by
  have H : ∀ n, m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → (decode₂ γ n).isSome := by
    intro n h
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · refine' (h <| by simp [m0]).elim
    · 

Proof state:
case some
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : Encodable γ
inst✝ : CompleteLattice β
m : β → α
m0 : m ⊥ = 0
s : γ → β
n : ℕ
b : γ
h : m (⨆ b_1 ∈ some b, s b_1) ≠ 0
⊢ Option.isSome (some b) = true

Next tactic:
exact rfl
/-- You can compute a sum over an encodably type by summing over the natural numbers and
  taking a supremum. This is useful for outer measures. -/
theorem tsum_iSup_decode₂ [CompleteLattice β] (m : β → α) (m0 : m ⊥ = 0) (s : γ → β) :
    ∑' i : ℕ, m (⨆ b ∈ decode₂ γ i, s b) = ∑' b : γ, m (s b) := by
  have H : ∀ n, m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → (decode₂ γ n).isSome := by
    intro n h
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · refine' (h <| by simp [m0]).elim
    · exact rfl
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝⁴ : AddCommMonoid α
inst✝³ : TopologicalSpace α
f g : β → α
a a₁ a₂ : α
inst✝² : T2Space α
inst✝¹ : Encodable γ
inst✝ : CompleteLattice β
m : β → α
m0 : m ⊥ = 0
s : γ → β
H : ∀ (n : ℕ), m (⨆ b ∈ decode₂ γ n, s b) ≠ 0 → Option.isSome (decode₂ γ n) = true
⊢ ∑' (i : ℕ), m (⨆ b ∈ decode₂ γ i, s b) = ∑' (b : γ), m (s b)

Next tactic:
symm