l3lab/ntp-mathlib huggingface dataset:
theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by
  constructor
  · rintro rfl _ _
    rfl
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
⊢ (∀ (i : Set α), MeasurableSet i → ↑v i = ↑w i) → v = w

Next tactic:
rw [ext_iff']
theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by
  constructor
  · rintro rfl _ _
    rfl
  · rw [ext_iff']
    

Proof state:
case mpr
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
⊢ (∀ (i : Set α), MeasurableSet i → ↑v i = ↑w i) → ∀ (i : Set α), ↑v i = ↑w i

Next tactic:
intro h i
theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by
  constructor
  · rintro rfl _ _
    rfl
  · rw [ext_iff']
    intro h i
    

Proof state:
case mpr
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
h : ∀ (i : Set α), MeasurableSet i → ↑v i = ↑w i
i : Set α
⊢ ↑v i = ↑w i

Next tactic:
by_cases hi : MeasurableSet i
theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by
  constructor
  · rintro rfl _ _
    rfl
  · rw [ext_iff']
    intro h i
    by_cases hi : MeasurableSet i
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
h : ∀ (i : Set α), MeasurableSet i → ↑v i = ↑w i
i : Set α
hi : MeasurableSet i
⊢ ↑v i = ↑w i

Next tactic:
exact h i hi
theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by
  constructor
  · rintro rfl _ _
    rfl
  · rw [ext_iff']
    intro h i
    by_cases hi : MeasurableSet i
    · exact h i hi
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
h : ∀ (i : Set α), MeasurableSet i → ↑v i = ↑w i
i : Set α
hi : ¬MeasurableSet i
⊢ ↑v i = ↑w i

Next tactic:
simp_rw [not_measurable _ hi]
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
⊢ HasSum (fun i => ↑v (f i)) (↑v (⋃ i, f i))

Next tactic:
cases nonempty_encodable β
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  

Proof state:
case intro
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
⊢ HasSum (fun i => ↑v (f i)) (↑v (⋃ i, f i))

Next tactic:
set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  

Proof state:
case intro
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
⊢ HasSum (fun i => ↑v (f i)) (↑v (⋃ i, f i))

Next tactic:
have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  

Proof state:
case intro
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
⊢ HasSum (fun i => ↑v (f i)) (↑v (⋃ i, f i))

Next tactic:
have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  

Proof state:
case intro
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
⊢ HasSum (fun i => ↑v (f i)) (↑v (⋃ i, f i))

Next tactic:
have := v.of_disjoint_iUnion_nat hg₁ hg₂
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  

Proof state:
case intro
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ i, g i) = ∑' (i : ℕ), ↑v (g i)
⊢ HasSum (fun i => ↑v (f i)) (↑v (⋃ i, f i))

Next tactic:
rw [hg, Encodable.iUnion_decode₂] at this
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  

Proof state:
case intro
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
⊢ HasSum (fun i => ↑v (f i)) (↑v (⋃ i, f i))

Next tactic:
have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    simp only
    congr
    ext y
    simp only [exists_prop, Set.mem_iUnion, Option.mem_def]
    constructor
    · intro hy
      refine' ⟨x, (Encodable.decode₂_is_partial_inv _ _).2 rfl, hy⟩
    · rintro ⟨b, hb₁, hb₂⟩
      rw [Encodable.decode₂_is_partial_inv _ _] at hb₁
      rwa [← Encodable.encode_injective hb₁]
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
⊢ (fun i => ↑v (f i)) = fun i => ↑v (g (Encodable.encode i))

Next tactic:
ext x
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    

Proof state:
case h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
⊢ ↑v (f x) = ↑v (g (Encodable.encode x))

Next tactic:
rw [hg]
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    

Proof state:
case h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
⊢ ↑v (f x) = ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) (Encodable.encode x))

Next tactic:
simp only
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    simp only
    

Proof state:
case h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
⊢ ↑v (f x) = ↑v (⋃ b ∈ Encodable.decode₂ β (Encodable.encode x), f b)

Next tactic:
congr
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    simp only
    congr
    

Proof state:
case h.e_a
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
⊢ f x = ⋃ b ∈ Encodable.decode₂ β (Encodable.encode x), f b

Next tactic:
ext y
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    simp only
    congr
    ext y
    

Proof state:
case h.e_a.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
y : α
⊢ y ∈ f x ↔ y ∈ ⋃ b ∈ Encodable.decode₂ β (Encodable.encode x), f b

Next tactic:
simp only [exists_prop, Set.mem_iUnion, Option.mem_def]
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    simp only
    congr
    ext y
    simp only [exists_prop, Set.mem_iUnion, Option.mem_def]
    

Proof state:
case h.e_a.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
y : α
⊢ y ∈ f x ↔ ∃ i, Encodable.decode₂ β (Encodable.encode x) = some i ∧ y ∈ f i

Next tactic:
constructor
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    simp only
    congr
    ext y
    simp only [exists_prop, Set.mem_iUnion, Option.mem_def]
    constructor
    · 

Proof state:
case h.e_a.h.mp
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
y : α
⊢ y ∈ f x → ∃ i, Encodable.decode₂ β (Encodable.encode x) = some i ∧ y ∈ f i

Next tactic:
intro hy
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    simp only
    congr
    ext y
    simp only [exists_prop, Set.mem_iUnion, Option.mem_def]
    constructor
    · intro hy
      

Proof state:
case h.e_a.h.mp
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
y : α
hy : y ∈ f x
⊢ ∃ i, Encodable.decode₂ β (Encodable.encode x) = some i ∧ y ∈ f i

Next tactic:
refine' ⟨x, (Encodable.decode₂_is_partial_inv _ _).2 rfl, hy⟩
theorem hasSum_of_disjoint_iUnion [Countable β] {f : β → Set α} (hf₁ : ∀ i, MeasurableSet (f i))
    (hf₂ : Pairwise (Disjoint on f)) : HasSum (fun i => v (f i)) (v (⋃ i, f i)) := by
  cases nonempty_encodable β
  set g := fun i : ℕ => ⋃ (b : β) (_ : b ∈ Encodable.decode₂ β i), f b with hg
  have hg₁ : ∀ i, MeasurableSet (g i) :=
    fun _ => MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => hf₁ b
  have hg₂ : Pairwise (Disjoint on g) := Encodable.iUnion_decode₂_disjoint_on hf₂
  have := v.of_disjoint_iUnion_nat hg₁ hg₂
  rw [hg, Encodable.iUnion_decode₂] at this
  have hg₃ : (fun i : β => v (f i)) = fun i => v (g (Encodable.encode i)) := by
    ext x
    rw [hg]
    simp only
    congr
    ext y
    simp only [exists_prop, Set.mem_iUnion, Option.mem_def]
    constructor
    · intro hy
      refine' ⟨x, (Encodable.decode₂_is_partial_inv _ _).2 rfl, hy⟩
    · 

Proof state:
case h.e_a.h.mpr
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝³ : AddCommMonoid M
inst✝² : TopologicalSpace M
inst✝¹ : T2Space M
v : VectorMeasure α M
f✝ : ℕ → Set α
inst✝ : Countable β
f : β → Set α
hf₁ : ∀ (i : β), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
val✝ : Encodable β
g : ℕ → Set α := fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg : g = fun i => ⋃ b ∈ Encodable.decode₂ β i, f b
hg₁ : ∀ (i : ℕ), MeasurableSet (g i)
hg₂ : Pairwise (Disjoint on g)
this : ↑v (⋃ b, f b) = ∑' (i : ℕ), ↑v ((fun i => ⋃ b ∈ Encodable.decode₂ β i, f b) i)
x : β
y : α
⊢ (∃ i, Encodable.decode₂ β (Encodable.encode x) = some i ∧ y ∈ f i) → y ∈ f x

Next tactic:
rintro ⟨b, hb₁, hb₂⟩