l3lab/ntp-mathlib huggingface dataset:
theorem hasSum_sum {f : γ → β → α} {a : γ → α} {s : Finset γ} :
    (∀ i ∈ s, HasSum (f i) (a i)) → HasSum (fun b => ∑ i in s, f i b) (∑ i in s, a i) := by
  classical
  exact Finset.induction_on s (by simp only [hasSum_zero, sum_empty, forall_true_iff]) <| by
    -- Porting note: with some help, `simp` used to be able to close the goal
    simp (config := { contextual := true }) only [mem_insert, forall_eq_or_imp, not_false_iff,
      sum_insert, and_imp]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f✝ g : β → α
a✝ b : α
s✝ : Finset β
inst✝ : ContinuousAdd α
f : γ → β → α
a : γ → α
s : Finset γ
⊢ ∀ ⦃a_1 : γ⦄ {s : Finset γ},
    a_1 ∉ s →
      ((∀ i ∈ s, HasSum (f i) (a i)) → HasSum (fun b => ∑ i in s, f i b) (∑ i in s, a i)) →
        HasSum (f a_1) (a a_1) →
          (∀ a_5 ∈ s, HasSum (f a_5) (a a_5)) → HasSum (fun b => f a_1 b + ∑ i in s, f i b) (a a_1 + ∑ i in s, a i)

Next tactic:
exact fun x s _ IH hx h ↦ hx.add (IH h)
theorem HasSum.add_disjoint {s t : Set β} (hs : Disjoint s t) (ha : HasSum (f ∘ (↑) : s → α) a)
    (hb : HasSum (f ∘ (↑) : t → α) b) : HasSum (f ∘ (↑) : (s ∪ t : Set β) → α) (a + b) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a b : α
s✝ : Finset β
inst✝ : ContinuousAdd α
s t : Set β
hs : Disjoint s t
ha : HasSum (f ∘ Subtype.val) a
hb : HasSum (f ∘ Subtype.val) b
⊢ HasSum (f ∘ Subtype.val) (a + b)

Next tactic:
rw [hasSum_subtype_iff_indicator] at *
theorem HasSum.add_disjoint {s t : Set β} (hs : Disjoint s t) (ha : HasSum (f ∘ (↑) : s → α) a)
    (hb : HasSum (f ∘ (↑) : t → α) b) : HasSum (f ∘ (↑) : (s ∪ t : Set β) → α) (a + b) := by
  rw [hasSum_subtype_iff_indicator] at *
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a b : α
s✝ : Finset β
inst✝ : ContinuousAdd α
s t : Set β
hs : Disjoint s t
ha : HasSum (Set.indicator s f) a
hb : HasSum (Set.indicator t f) b
⊢ HasSum (Set.indicator (s ∪ t) f) (a + b)

Next tactic:
rw [Set.indicator_union_of_disjoint hs]
theorem HasSum.add_disjoint {s t : Set β} (hs : Disjoint s t) (ha : HasSum (f ∘ (↑) : s → α) a)
    (hb : HasSum (f ∘ (↑) : t → α) b) : HasSum (f ∘ (↑) : (s ∪ t : Set β) → α) (a + b) := by
  rw [hasSum_subtype_iff_indicator] at *
  rw [Set.indicator_union_of_disjoint hs]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a b : α
s✝ : Finset β
inst✝ : ContinuousAdd α
s t : Set β
hs : Disjoint s t
ha : HasSum (Set.indicator s f) a
hb : HasSum (Set.indicator t f) b
⊢ HasSum (fun a => Set.indicator s f a + Set.indicator t f a) (a + b)

Next tactic:
exact ha.add hb
theorem hasSum_sum_disjoint {ι} (s : Finset ι) {t : ι → Set β} {a : ι → α}
    (hs : (s : Set ι).Pairwise (Disjoint on t)) (hf : ∀ i ∈ s, HasSum (f ∘ (↑) : t i → α) (a i)) :
    HasSum (f ∘ (↑) : (⋃ i ∈ s, t i) → α) (∑ i in s, a i) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ b : α
s✝ : Finset β
inst✝ : ContinuousAdd α
ι : Type u_5
s : Finset ι
t : ι → Set β
a : ι → α
hs : Set.Pairwise (↑s) (Disjoint on t)
hf : ∀ i ∈ s, HasSum (f ∘ Subtype.val) (a i)
⊢ HasSum (f ∘ Subtype.val) (∑ i in s, a i)

Next tactic:
simp_rw [hasSum_subtype_iff_indicator] at *
theorem hasSum_sum_disjoint {ι} (s : Finset ι) {t : ι → Set β} {a : ι → α}
    (hs : (s : Set ι).Pairwise (Disjoint on t)) (hf : ∀ i ∈ s, HasSum (f ∘ (↑) : t i → α) (a i)) :
    HasSum (f ∘ (↑) : (⋃ i ∈ s, t i) → α) (∑ i in s, a i) := by
  simp_rw [hasSum_subtype_iff_indicator] at *
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ b : α
s✝ : Finset β
inst✝ : ContinuousAdd α
ι : Type u_5
s : Finset ι
t : ι → Set β
a : ι → α
hs : Set.Pairwise (↑s) (Disjoint on t)
hf : ∀ i ∈ s, HasSum (Set.indicator (t i) f) (a i)
⊢ HasSum (Set.indicator (⋃ i ∈ s, t i) f) (∑ i in s, a i)

Next tactic:
rw [Finset.indicator_biUnion _ _ hs]
theorem hasSum_sum_disjoint {ι} (s : Finset ι) {t : ι → Set β} {a : ι → α}
    (hs : (s : Set ι).Pairwise (Disjoint on t)) (hf : ∀ i ∈ s, HasSum (f ∘ (↑) : t i → α) (a i)) :
    HasSum (f ∘ (↑) : (⋃ i ∈ s, t i) → α) (∑ i in s, a i) := by
  simp_rw [hasSum_subtype_iff_indicator] at *
  rw [Finset.indicator_biUnion _ _ hs]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a✝ b : α
s✝ : Finset β
inst✝ : ContinuousAdd α
ι : Type u_5
s : Finset ι
t : ι → Set β
a : ι → α
hs : Set.Pairwise (↑s) (Disjoint on t)
hf : ∀ i ∈ s, HasSum (Set.indicator (t i) f) (a i)
⊢ HasSum (fun a => ∑ i in s, Set.indicator (t i) f a) (∑ i in s, a i)

Next tactic:
exact hasSum_sum hf
theorem HasSum.add_isCompl {s t : Set β} (hs : IsCompl s t) (ha : HasSum (f ∘ (↑) : s → α) a)
    (hb : HasSum (f ∘ (↑) : t → α) b) : HasSum f (a + b) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f g : β → α
a b : α
s✝ : Finset β
inst✝ : ContinuousAdd α
s t : Set β
hs : IsCompl s t
ha : HasSum (f ∘ Subtype.val) a
hb : HasSum (f ∘ Subtype.val) b
⊢ HasSum f (a + b)

Next tactic:
simpa [← hs.compl_eq] using
    (hasSum_subtype_iff_indicator.1 ha).add (hasSum_subtype_iff_indicator.1 hb)
theorem HasSum.even_add_odd {f : ℕ → α} (he : HasSum (fun k => f (2 * k)) a)
    (ho : HasSum (fun k => f (2 * k + 1)) b) : HasSum f (a + b) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f✝ g : β → α
a b : α
s : Finset β
inst✝ : ContinuousAdd α
f : ℕ → α
he : HasSum (fun k => f (2 * k)) a
ho : HasSum (fun k => f (2 * k + 1)) b
⊢ HasSum f (a + b)

Next tactic:
have := mul_right_injective₀ (two_ne_zero' ℕ)
theorem HasSum.even_add_odd {f : ℕ → α} (he : HasSum (fun k => f (2 * k)) a)
    (ho : HasSum (fun k => f (2 * k + 1)) b) : HasSum f (a + b) := by
  have := mul_right_injective₀ (two_ne_zero' ℕ)
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f✝ g : β → α
a b : α
s : Finset β
inst✝ : ContinuousAdd α
f : ℕ → α
he : HasSum (fun k => f (2 * k)) a
ho : HasSum (fun k => f (2 * k + 1)) b
this : Injective fun x => 2 * x
⊢ HasSum f (a + b)

Next tactic:
replace he := this.hasSum_range_iff.2 he
theorem HasSum.even_add_odd {f : ℕ → α} (he : HasSum (fun k => f (2 * k)) a)
    (ho : HasSum (fun k => f (2 * k + 1)) b) : HasSum f (a + b) := by
  have := mul_right_injective₀ (two_ne_zero' ℕ)
  replace he := this.hasSum_range_iff.2 he
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f✝ g : β → α
a b : α
s : Finset β
inst✝ : ContinuousAdd α
f : ℕ → α
ho : HasSum (fun k => f (2 * k + 1)) b
this : Injective fun x => 2 * x
he : HasSum (fun x => f ↑x) a
⊢ HasSum f (a + b)

Next tactic:
replace ho := ((add_left_injective 1).comp this).hasSum_range_iff.2 ho
theorem HasSum.even_add_odd {f : ℕ → α} (he : HasSum (fun k => f (2 * k)) a)
    (ho : HasSum (fun k => f (2 * k + 1)) b) : HasSum f (a + b) := by
  have := mul_right_injective₀ (two_ne_zero' ℕ)
  replace he := this.hasSum_range_iff.2 he
  replace ho := ((add_left_injective 1).comp this).hasSum_range_iff.2 ho
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f✝ g : β → α
a b : α
s : Finset β
inst✝ : ContinuousAdd α
f : ℕ → α
this : Injective fun x => 2 * x
he : HasSum (fun x => f ↑x) a
ho : HasSum (fun x => f ↑x) b
⊢ HasSum f (a + b)

Next tactic:
refine' he.add_isCompl _ ho
theorem HasSum.even_add_odd {f : ℕ → α} (he : HasSum (fun k => f (2 * k)) a)
    (ho : HasSum (fun k => f (2 * k + 1)) b) : HasSum f (a + b) := by
  have := mul_right_injective₀ (two_ne_zero' ℕ)
  replace he := this.hasSum_range_iff.2 he
  replace ho := ((add_left_injective 1).comp this).hasSum_range_iff.2 ho
  refine' he.add_isCompl _ ho
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝² : AddCommMonoid α
inst✝¹ : TopologicalSpace α
f✝ g : β → α
a b : α
s : Finset β
inst✝ : ContinuousAdd α
f : ℕ → α
this : Injective fun x => 2 * x
he : HasSum (fun x => f ↑x) a
ho : HasSum (fun x => f ↑x) b
⊢ IsCompl (Set.range fun x => 2 * x) (Set.range ((fun x => x + 1) ∘ fun x => 2 * x))

Next tactic:
simpa [(· ∘ ·)] using Nat.isCompl_even_odd
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
⊢ HasSum g a

Next tactic:
classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  intro bs hbs
  simp only [Set.mem_preimage, ge_iff_le, Finset.le_iff_subset] at hu
  have : Tendsto (fun t : Finset (Σb, γ b) => ∑ p in t.filter fun p => p.1 ∈ bs, f p) atTop
      (𝓝 <| ∑ b in bs, g b) := by
    simp only [← sigma_preimage_mk, sum_sigma]
    refine' tendsto_finset_sum _ fun b _ => _
    change
      Tendsto (fun t => (fun t => ∑ s in t, f ⟨b, s⟩) (preimage t (Sigma.mk b) _)) atTop (𝓝 (g b))
    exact (hf b).comp (tendsto_finset_preimage_atTop_atTop (sigma_mk_injective))
  refine' hsc.mem_of_tendsto this (eventually_atTop.2 ⟨u, fun t ht => hu _ fun x hx => _⟩)
  exact mem_filter.2 ⟨ht hx, hbs <| mem_image_of_mem _ hx⟩
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  

Proof state:
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
⊢ HasSum g a

Next tactic:
refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  

Proof state:
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
⊢ ∀ (ib : Set α), ib ∈ 𝓝 a ∧ IsClosed ib → ∃ ia, True ∧ ∀ x ∈ Set.Ici ia, ∑ b in x, g b ∈ id ib

Next tactic:
rintro s ⟨hs, hsc⟩
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
⊢ ∃ ia, True ∧ ∀ x ∈ Set.Ici ia, ∑ b in x, g b ∈ id s

Next tactic:
rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
hu : ∀ b ≥ u, b ∈ (fun s => ∑ b in s, f b) ⁻¹' s
⊢ ∃ ia, True ∧ ∀ x ∈ Set.Ici ia, ∑ b in x, g b ∈ id s

Next tactic:
use u.image Sigma.fst, trivial
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  

Proof state:
case right
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
hu : ∀ b ≥ u, b ∈ (fun s => ∑ b in s, f b) ⁻¹' s
⊢ ∀ x ∈ Set.Ici (image Sigma.fst u), ∑ b in x, g b ∈ id s

Next tactic:
intro bs hbs
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  intro bs hbs
  

Proof state:
case right
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
hu : ∀ b ≥ u, b ∈ (fun s => ∑ b in s, f b) ⁻¹' s
bs : Finset β
hbs : bs ∈ Set.Ici (image Sigma.fst u)
⊢ ∑ b in bs, g b ∈ id s

Next tactic:
simp only [Set.mem_preimage, ge_iff_le, Finset.le_iff_subset] at hu
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  intro bs hbs
  simp only [Set.mem_preimage, ge_iff_le, Finset.le_iff_subset] at hu
  

Proof state:
case right
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
bs : Finset β
hbs : bs ∈ Set.Ici (image Sigma.fst u)
hu : ∀ (b : Finset ((b : β) × γ b)), u ⊆ b → ∑ b in b, f b ∈ s
⊢ ∑ b in bs, g b ∈ id s

Next tactic:
have : Tendsto (fun t : Finset (Σb, γ b) => ∑ p in t.filter fun p => p.1 ∈ bs, f p) atTop
      (𝓝 <| ∑ b in bs, g b) := by
    simp only [← sigma_preimage_mk, sum_sigma]
    refine' tendsto_finset_sum _ fun b _ => _
    change
      Tendsto (fun t => (fun t => ∑ s in t, f ⟨b, s⟩) (preimage t (Sigma.mk b) _)) atTop (𝓝 (g b))
    exact (hf b).comp (tendsto_finset_preimage_atTop_atTop (sigma_mk_injective))
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  intro bs hbs
  simp only [Set.mem_preimage, ge_iff_le, Finset.le_iff_subset] at hu
  have : Tendsto (fun t : Finset (Σb, γ b) => ∑ p in t.filter fun p => p.1 ∈ bs, f p) atTop
      (𝓝 <| ∑ b in bs, g b) := by
    

Proof state:
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
bs : Finset β
hbs : bs ∈ Set.Ici (image Sigma.fst u)
hu : ∀ (b : Finset ((b : β) × γ b)), u ⊆ b → ∑ b in b, f b ∈ s
⊢ Tendsto (fun t => ∑ p in filter (fun p => p.fst ∈ bs) t, f p) atTop (𝓝 (∑ b in bs, g b))

Next tactic:
simp only [← sigma_preimage_mk, sum_sigma]
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  intro bs hbs
  simp only [Set.mem_preimage, ge_iff_le, Finset.le_iff_subset] at hu
  have : Tendsto (fun t : Finset (Σb, γ b) => ∑ p in t.filter fun p => p.1 ∈ bs, f p) atTop
      (𝓝 <| ∑ b in bs, g b) := by
    simp only [← sigma_preimage_mk, sum_sigma]
    

Proof state:
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
bs : Finset β
hbs : bs ∈ Set.Ici (image Sigma.fst u)
hu : ∀ (b : Finset ((b : β) × γ b)), u ⊆ b → ∑ b in b, f b ∈ s
⊢ Tendsto
    (fun t =>
      ∑ a in bs,
        ∑ s in preimage t (Sigma.mk a) (_ : Set.InjOn (Sigma.mk a) (Sigma.mk a ⁻¹' ↑t)), f { fst := a, snd := s })
    atTop (𝓝 (∑ b in bs, g b))

Next tactic:
refine' tendsto_finset_sum _ fun b _ => _
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  intro bs hbs
  simp only [Set.mem_preimage, ge_iff_le, Finset.le_iff_subset] at hu
  have : Tendsto (fun t : Finset (Σb, γ b) => ∑ p in t.filter fun p => p.1 ∈ bs, f p) atTop
      (𝓝 <| ∑ b in bs, g b) := by
    simp only [← sigma_preimage_mk, sum_sigma]
    refine' tendsto_finset_sum _ fun b _ => _
    

Proof state:
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b✝ : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
bs : Finset β
hbs : bs ∈ Set.Ici (image Sigma.fst u)
hu : ∀ (b : Finset ((b : β) × γ b)), u ⊆ b → ∑ b in b, f b ∈ s
b : β
x✝ : b ∈ bs
⊢ Tendsto
    (fun t => ∑ s in preimage t (Sigma.mk b) (_ : Set.InjOn (Sigma.mk b) (Sigma.mk b ⁻¹' ↑t)), f { fst := b, snd := s })
    atTop (𝓝 (g b))

Next tactic:
change
      Tendsto (fun t => (fun t => ∑ s in t, f ⟨b, s⟩) (preimage t (Sigma.mk b) _)) atTop (𝓝 (g b))
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  intro bs hbs
  simp only [Set.mem_preimage, ge_iff_le, Finset.le_iff_subset] at hu
  have : Tendsto (fun t : Finset (Σb, γ b) => ∑ p in t.filter fun p => p.1 ∈ bs, f p) atTop
      (𝓝 <| ∑ b in bs, g b) := by
    simp only [← sigma_preimage_mk, sum_sigma]
    refine' tendsto_finset_sum _ fun b _ => _
    change
      Tendsto (fun t => (fun t => ∑ s in t, f ⟨b, s⟩) (preimage t (Sigma.mk b) _)) atTop (𝓝 (g b))
    

Proof state:
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b✝ : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
bs : Finset β
hbs : bs ∈ Set.Ici (image Sigma.fst u)
hu : ∀ (b : Finset ((b : β) × γ b)), u ⊆ b → ∑ b in b, f b ∈ s
b : β
x✝ : b ∈ bs
⊢ Tendsto
    (fun t =>
      (fun t => ∑ s in t, f { fst := b, snd := s })
        (preimage t (Sigma.mk b) (_ : Set.InjOn (Sigma.mk b) (Sigma.mk b ⁻¹' ↑t))))
    atTop (𝓝 (g b))

Next tactic:
exact (hf b).comp (tendsto_finset_preimage_atTop_atTop (sigma_mk_injective))
theorem HasSum.sigma [RegularSpace α] {γ : β → Type*} {f : (Σ b : β, γ b) → α} {g : β → α} {a : α}
    (ha : HasSum f a) (hf : ∀ b, HasSum (fun c => f ⟨b, c⟩) (g b)) : HasSum g a := by
  classical
  refine' (atTop_basis.tendsto_iff (closed_nhds_basis a)).mpr _
  rintro s ⟨hs, hsc⟩
  rcases mem_atTop_sets.mp (ha hs) with ⟨u, hu⟩
  use u.image Sigma.fst, trivial
  intro bs hbs
  simp only [Set.mem_preimage, ge_iff_le, Finset.le_iff_subset] at hu
  have : Tendsto (fun t : Finset (Σb, γ b) => ∑ p in t.filter fun p => p.1 ∈ bs, f p) atTop
      (𝓝 <| ∑ b in bs, g b) := by
    simp only [← sigma_preimage_mk, sum_sigma]
    refine' tendsto_finset_sum _ fun b _ => _
    change
      Tendsto (fun t => (fun t => ∑ s in t, f ⟨b, s⟩) (preimage t (Sigma.mk b) _)) atTop (𝓝 (g b))
    exact (hf b).comp (tendsto_finset_preimage_atTop_atTop (sigma_mk_injective))
  

Proof state:
case right
α : Type u_1
β : Type u_2
γ✝ : Type u_3
δ : Type u_4
inst✝³ : AddCommMonoid α
inst✝² : TopologicalSpace α
f✝ g✝ : β → α
a✝ b : α
s✝ : Finset β
inst✝¹ : ContinuousAdd α
inst✝ : RegularSpace α
γ : β → Type u_5
f : (b : β) × γ b → α
g : β → α
a : α
ha : HasSum f a
hf : ∀ (b : β), HasSum (fun c => f { fst := b, snd := c }) (g b)
s : Set α
hs : s ∈ 𝓝 a
hsc : IsClosed s
u : Finset ((b : β) × γ b)
bs : Finset β
hbs : bs ∈ Set.Ici (image Sigma.fst u)
hu : ∀ (b : Finset ((b : β) × γ b)), u ⊆ b → ∑ b in b, f b ∈ s
this : Tendsto (fun t => ∑ p in filter (fun p => p.fst ∈ bs) t, f p) atTop (𝓝 (∑ b in bs, g b))
⊢ ∑ b in bs, g b ∈ id s

Next tactic:
refine' hsc.mem_of_tendsto this (eventually_atTop.2 ⟨u, fun t ht => hu _ fun x hx => _⟩)