l3lab/ntp-mathlib huggingface dataset:
/-- 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
  symm
  

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
⊢ ∑' (b : γ), m (s b) = ∑' (i : ℕ), m (⨆ b ∈ decode₂ γ i, s b)

Next tactic:
refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · 

Proof state:
case refine'_1
α : 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
⊢ ∀ ⦃x y : ↑(support fun i => m (⨆ b ∈ decode₂ γ i, s b))⦄,
    (fun a => Option.get (decode₂ γ ↑a) (_ : Option.isSome (decode₂ γ ↑a) = true)) x =
        (fun a => Option.get (decode₂ γ ↑a) (_ : Option.isSome (decode₂ γ ↑a) = true)) y →
      ↑x = ↑y

Next tactic:
dsimp only []
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    

Proof state:
case refine'_1
α : 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
⊢ ∀ ⦃x y : ↑(support fun i => m (⨆ b ∈ decode₂ γ i, s b))⦄,
    Option.get (decode₂ γ ↑x) (_ : Option.isSome (decode₂ γ ↑x) = true) =
        Option.get (decode₂ γ ↑y) (_ : Option.isSome (decode₂ γ ↑y) = true) →
      ↑x = ↑y

Next tactic:
rintro ⟨m, hm⟩ ⟨n, hn⟩ e
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    

Proof state:
case refine'_1.mk.mk
α : 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
m : ℕ
hm : m ∈ support fun i => m✝ (⨆ b ∈ decode₂ γ i, s b)
n : ℕ
hn : n ∈ support fun i => m✝ (⨆ b ∈ decode₂ γ i, s b)
e :
  Option.get (decode₂ γ ↑{ val := m, property := hm })
      (_ : Option.isSome (decode₂ γ ↑{ val := m, property := hm }) = true) =
    Option.get (decode₂ γ ↑{ val := n, property := hn })
      (_ : Option.isSome (decode₂ γ ↑{ val := n, property := hn }) = true)
⊢ ↑{ val := m, property := hm } = ↑{ val := n, property := hn }

Next tactic:
have := mem_decode₂.1 (Option.get_mem (H n hn))
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    

Proof state:
case refine'_1.mk.mk
α : 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
m : ℕ
hm : m ∈ support fun i => m✝ (⨆ b ∈ decode₂ γ i, s b)
n : ℕ
hn : n ∈ support fun i => m✝ (⨆ b ∈ decode₂ γ i, s b)
e :
  Option.get (decode₂ γ ↑{ val := m, property := hm })
      (_ : Option.isSome (decode₂ γ ↑{ val := m, property := hm }) = true) =
    Option.get (decode₂ γ ↑{ val := n, property := hn })
      (_ : Option.isSome (decode₂ γ ↑{ val := n, property := hn }) = true)
this : encode (Option.get (decode₂ γ n) (_ : Option.isSome (decode₂ γ n) = true)) = n
⊢ ↑{ val := m, property := hm } = ↑{ val := n, property := hn }

Next tactic:
rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · 

Proof state:
case refine'_2
α : 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
⊢ (support fun b => m (s b)) ⊆ Set.range fun a => Option.get (decode₂ γ ↑a) (_ : Option.isSome (decode₂ γ ↑a) = true)

Next tactic:
intro b 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
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · refine' (h <| by simp [m0]).elim
    · exact rfl
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    

Proof state:
case refine'_2
α : 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
b : γ
h : b ∈ support fun b => m (s b)
⊢ b ∈ Set.range fun a => Option.get (decode₂ γ ↑a) (_ : Option.isSome (decode₂ γ ↑a) = true)

Next tactic:
refine' ⟨⟨encode 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
    · refine' (h <| by simp [m0]).elim
    · exact rfl
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · 

Proof state:
case refine'_2.refine'_1
α : 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
b : γ
h : b ∈ support fun b => m (s b)
⊢ encode b ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)

Next tactic:
simp only [mem_support, encodek₂] at 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
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · refine' (h <| by simp [m0]).elim
    · exact rfl
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · simp only [mem_support, encodek₂] at h ⊢
      

Proof state:
case refine'_2.refine'_1
α : 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
b : γ
h : m (s b) ≠ 0
⊢ m (⨆ b_1 ∈ some b, s b_1) ≠ 0

Next tactic:
convert 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
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · refine' (h <| by simp [m0]).elim
    · exact rfl
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · simp only [mem_support, encodek₂] at h ⊢
      convert h
      

Proof state:
case h.e'_2.h.e'_1
α : 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
b : γ
h : m (s b) ≠ 0
⊢ ⨆ b_1 ∈ some b, s b_1 = s b

Next tactic:
simp [Set.ext_iff, encodek₂]
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · simp only [mem_support, encodek₂] at h ⊢
      convert h
      simp [Set.ext_iff, encodek₂]
    · 

Proof state:
case refine'_2.refine'_2
α : 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
b : γ
h : b ∈ support fun b => m (s b)
⊢ (fun a => Option.get (decode₂ γ ↑a) (_ : Option.isSome (decode₂ γ ↑a) = true))
      { val := encode b, property := (_ : encode b ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)) } =
    b

Next tactic:
exact Option.get_of_mem _ (encodek₂ _)
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · simp only [mem_support, encodek₂] at h ⊢
      convert h
      simp [Set.ext_iff, encodek₂]
    · exact Option.get_of_mem _ (encodek₂ _)
  · 

Proof state:
case refine'_3
α : 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
⊢ ∀ (x : ↑(support fun i => m (⨆ b ∈ decode₂ γ i, s b))),
    m (s ((fun a => Option.get (decode₂ γ ↑a) (_ : Option.isSome (decode₂ γ ↑a) = true)) x)) =
      m (⨆ b ∈ decode₂ γ ↑x, s b)

Next tactic:
rintro ⟨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
    generalize decode₂ γ n = foo at *
    cases' foo with b
    · refine' (h <| by simp [m0]).elim
    · exact rfl
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · simp only [mem_support, encodek₂] at h ⊢
      convert h
      simp [Set.ext_iff, encodek₂]
    · exact Option.get_of_mem _ (encodek₂ _)
  · rintro ⟨n, h⟩
    

Proof state:
case refine'_3.mk
α : 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
n : ℕ
h : n ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)
⊢ m (s ((fun a => Option.get (decode₂ γ ↑a) (_ : Option.isSome (decode₂ γ ↑a) = true)) { val := n, property := h })) =
    m (⨆ b ∈ decode₂ γ ↑{ val := n, property := h }, s b)

Next tactic:
dsimp only [Subtype.coe_mk]
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · simp only [mem_support, encodek₂] at h ⊢
      convert h
      simp [Set.ext_iff, encodek₂]
    · exact Option.get_of_mem _ (encodek₂ _)
  · rintro ⟨n, h⟩
    dsimp only [Subtype.coe_mk]
    

Proof state:
case refine'_3.mk
α : 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
n : ℕ
h : n ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)
⊢ m (s (Option.get (decode₂ γ n) (_ : Option.isSome (decode₂ γ n) = true))) = m (⨆ b ∈ decode₂ γ n, s b)

Next tactic:
trans
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · simp only [mem_support, encodek₂] at h ⊢
      convert h
      simp [Set.ext_iff, encodek₂]
    · exact Option.get_of_mem _ (encodek₂ _)
  · rintro ⟨n, h⟩
    dsimp only [Subtype.coe_mk]
    trans
    

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
n : ℕ
h : n ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)
⊢ m (s (Option.get (decode₂ γ n) (_ : Option.isSome (decode₂ γ n) = true))) = ?m.389533
α : 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
n : ℕ
h : n ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)
⊢ ?m.389533 = m (⨆ b ∈ decode₂ γ n, s b)
α : 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
n : ℕ
h : n ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)
⊢ α

Next tactic:
swap
/-- 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
  symm
  refine' tsum_eq_tsum_of_ne_zero_bij (fun a => Option.get _ (H a.1 a.2)) _ _ _
  · dsimp only []
    rintro ⟨m, hm⟩ ⟨n, hn⟩ e
    have := mem_decode₂.1 (Option.get_mem (H n hn))
    rwa [← e, mem_decode₂.1 (Option.get_mem (H m hm))] at this
  · intro b h
    refine' ⟨⟨encode b, _⟩, _⟩
    · simp only [mem_support, encodek₂] at h ⊢
      convert h
      simp [Set.ext_iff, encodek₂]
    · exact Option.get_of_mem _ (encodek₂ _)
  · rintro ⟨n, h⟩
    dsimp only [Subtype.coe_mk]
    trans
    swap
    

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
n : ℕ
h : n ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)
⊢ ?m.389533 = m (⨆ b ∈ decode₂ γ n, s b)
α : 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
n : ℕ
h : n ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)
⊢ m (s (Option.get (decode₂ γ n) (_ : Option.isSome (decode₂ γ n) = true))) = ?m.389533
α : 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
n : ℕ
h : n ∈ support fun i => m (⨆ b ∈ decode₂ γ i, s b)
⊢ α

Next tactic:
rw [show decode₂ γ n = _ from Option.get_mem (H n h)]