l3lab/ntp-mathlib huggingface dataset:
theorem le_boundedBy' {μ : OuterMeasure α} :
    μ ≤ boundedBy m ↔ ∀ s : Set α, s.Nonempty → μ s ≤ m s := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
μ : OuterMeasure α
⊢ μ ≤ boundedBy m ↔ ∀ (s : Set α), Set.Nonempty s → ↑μ s ≤ m s

Next tactic:
rw [le_boundedBy, forall_congr']
theorem le_boundedBy' {μ : OuterMeasure α} :
    μ ≤ boundedBy m ↔ ∀ s : Set α, s.Nonempty → μ s ≤ m s := by
  rw [le_boundedBy, forall_congr']
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
μ : OuterMeasure α
⊢ ∀ (a : Set α), ↑μ a ≤ m a ↔ Set.Nonempty a → ↑μ a ≤ m a

Next tactic:
intro s
theorem le_boundedBy' {μ : OuterMeasure α} :
    μ ≤ boundedBy m ↔ ∀ s : Set α, s.Nonempty → μ s ≤ m s := by
  rw [le_boundedBy, forall_congr']
  intro s
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
μ : OuterMeasure α
s : Set α
⊢ ↑μ s ≤ m s ↔ Set.Nonempty s → ↑μ s ≤ m s

Next tactic:
rcases s.eq_empty_or_nonempty with h | h
theorem le_boundedBy' {μ : OuterMeasure α} :
    μ ≤ boundedBy m ↔ ∀ s : Set α, s.Nonempty → μ s ≤ m s := by
  rw [le_boundedBy, forall_congr']
  intro s
  rcases s.eq_empty_or_nonempty with h | h <;> 

Proof state:
case inl
α : Type u_1
m : Set α → ℝ≥0∞
μ : OuterMeasure α
s : Set α
h : s = ∅
⊢ ↑μ s ≤ m s ↔ Set.Nonempty s → ↑μ s ≤ m s

Next tactic:
simp [h]
theorem le_boundedBy' {μ : OuterMeasure α} :
    μ ≤ boundedBy m ↔ ∀ s : Set α, s.Nonempty → μ s ≤ m s := by
  rw [le_boundedBy, forall_congr']
  intro s
  rcases s.eq_empty_or_nonempty with h | h <;> 

Proof state:
case inr
α : Type u_1
m : Set α → ℝ≥0∞
μ : OuterMeasure α
s : Set α
h : Set.Nonempty s
⊢ ↑μ s ≤ m s ↔ Set.Nonempty s → ↑μ s ≤ m s

Next tactic:
simp [h]
@[simp]
theorem boundedBy_top : boundedBy (⊤ : Set α → ℝ≥0∞) = ⊤ := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
⊢ boundedBy ⊤ = ⊤

Next tactic:
rw [eq_top_iff, le_boundedBy']
@[simp]
theorem boundedBy_top : boundedBy (⊤ : Set α → ℝ≥0∞) = ⊤ := by
  rw [eq_top_iff, le_boundedBy']
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
⊢ ∀ (s : Set α), Set.Nonempty s → ↑⊤ s ≤ ⊤ s

Next tactic:
intro s hs
@[simp]
theorem boundedBy_top : boundedBy (⊤ : Set α → ℝ≥0∞) = ⊤ := by
  rw [eq_top_iff, le_boundedBy']
  intro s hs
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
s : Set α
hs : Set.Nonempty s
⊢ ↑⊤ s ≤ ⊤ s

Next tactic:
rw [top_apply hs]
@[simp]
theorem boundedBy_top : boundedBy (⊤ : Set α → ℝ≥0∞) = ⊤ := by
  rw [eq_top_iff, le_boundedBy']
  intro s hs
  rw [top_apply hs]
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
s : Set α
hs : Set.Nonempty s
⊢ ⊤ ≤ ⊤ s

Next tactic:
exact le_rfl
@[simp]
theorem boundedBy_zero : boundedBy (0 : Set α → ℝ≥0∞) = 0 := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
⊢ boundedBy 0 = 0

Next tactic:
rw [← coe_bot, eq_bot_iff]
@[simp]
theorem boundedBy_zero : boundedBy (0 : Set α → ℝ≥0∞) = 0 := by
  rw [← coe_bot, eq_bot_iff]
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
⊢ boundedBy 0 ≤ ⊥

Next tactic:
apply boundedBy_le
theorem smul_boundedBy {c : ℝ≥0∞} (hc : c ≠ ∞) : c • boundedBy m = boundedBy (c • m) := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
c : ℝ≥0∞
hc : c ≠ ⊤
⊢ c • boundedBy m = boundedBy (c • m)

Next tactic:
simp only [boundedBy , smul_ofFunction hc]
theorem smul_boundedBy {c : ℝ≥0∞} (hc : c ≠ ∞) : c • boundedBy m = boundedBy (c • m) := by
  simp only [boundedBy , smul_ofFunction hc]
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
c : ℝ≥0∞
hc : c ≠ ⊤
⊢ OuterMeasure.ofFunction (c • fun s => ⨆ (_ : Set.Nonempty s), m s) (_ : c • ⨆ (_ : Set.Nonempty ∅), m ∅ = 0) =
    OuterMeasure.ofFunction (fun s => ⨆ (_ : Set.Nonempty s), (c • m) s) (_ : ⨆ (_ : Set.Nonempty ∅), (c • m) ∅ = 0)

Next tactic:
congr 1 with s : 1
theorem smul_boundedBy {c : ℝ≥0∞} (hc : c ≠ ∞) : c • boundedBy m = boundedBy (c • m) := by
  simp only [boundedBy , smul_ofFunction hc]
  congr 1 with s : 1
  

Proof state:
case e_m.h
α : Type u_1
m : Set α → ℝ≥0∞
c : ℝ≥0∞
hc : c ≠ ⊤
s : Set α
⊢ (c • fun s => ⨆ (_ : Set.Nonempty s), m s) s = ⨆ (_ : Set.Nonempty s), (c • m) s

Next tactic:
rcases s.eq_empty_or_nonempty with (rfl | hs)
theorem smul_boundedBy {c : ℝ≥0∞} (hc : c ≠ ∞) : c • boundedBy m = boundedBy (c • m) := by
  simp only [boundedBy , smul_ofFunction hc]
  congr 1 with s : 1
  rcases s.eq_empty_or_nonempty with (rfl | hs) <;> 

Proof state:
case e_m.h.inl
α : Type u_1
m : Set α → ℝ≥0∞
c : ℝ≥0∞
hc : c ≠ ⊤
⊢ (c • fun s => ⨆ (_ : Set.Nonempty s), m s) ∅ = ⨆ (_ : Set.Nonempty ∅), (c • m) ∅

Next tactic:
simp [*]
theorem smul_boundedBy {c : ℝ≥0∞} (hc : c ≠ ∞) : c • boundedBy m = boundedBy (c • m) := by
  simp only [boundedBy , smul_ofFunction hc]
  congr 1 with s : 1
  rcases s.eq_empty_or_nonempty with (rfl | hs) <;> 

Proof state:
case e_m.h.inr
α : Type u_1
m : Set α → ℝ≥0∞
c : ℝ≥0∞
hc : c ≠ ⊤
s : Set α
hs : Set.Nonempty s
⊢ (c • fun s => ⨆ (_ : Set.Nonempty s), m s) s = ⨆ (_ : Set.Nonempty s), (c • m) s

Next tactic:
simp [*]
theorem comap_boundedBy {β} (f : β → α)
    (h : (Monotone fun s : { s : Set α // s.Nonempty } => m s) ∨ Surjective f) :
    comap f (boundedBy m) = boundedBy fun s => m (f '' s) := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
β : Type u_2
f : β → α
h : (Monotone fun s => m ↑s) ∨ Surjective f
⊢ (comap f) (boundedBy m) = boundedBy fun s => m (f '' s)

Next tactic:
refine' (comap_ofFunction _ _).trans _
theorem comap_boundedBy {β} (f : β → α)
    (h : (Monotone fun s : { s : Set α // s.Nonempty } => m s) ∨ Surjective f) :
    comap f (boundedBy m) = boundedBy fun s => m (f '' s) := by
  refine' (comap_ofFunction _ _).trans _
  · 

Proof state:
case refine'_1
α : Type u_1
m : Set α → ℝ≥0∞
β : Type u_2
f : β → α
h : (Monotone fun s => m ↑s) ∨ Surjective f
⊢ (Monotone fun s => ⨆ (_ : Set.Nonempty s), m s) ∨ Surjective f

Next tactic:
refine' h.imp (fun H s t hst => iSup_le fun hs => _) id
theorem comap_boundedBy {β} (f : β → α)
    (h : (Monotone fun s : { s : Set α // s.Nonempty } => m s) ∨ Surjective f) :
    comap f (boundedBy m) = boundedBy fun s => m (f '' s) := by
  refine' (comap_ofFunction _ _).trans _
  · refine' h.imp (fun H s t hst => iSup_le fun hs => _) id
    

Proof state:
case refine'_1
α : Type u_1
m : Set α → ℝ≥0∞
β : Type u_2
f : β → α
h : (Monotone fun s => m ↑s) ∨ Surjective f
H : Monotone fun s => m ↑s
s t : Set α
hst : s ≤ t
hs : Set.Nonempty s
⊢ m s ≤ (fun s => ⨆ (_ : Set.Nonempty s), m s) t

Next tactic:
have ht : t.Nonempty := hs.mono hst
theorem comap_boundedBy {β} (f : β → α)
    (h : (Monotone fun s : { s : Set α // s.Nonempty } => m s) ∨ Surjective f) :
    comap f (boundedBy m) = boundedBy fun s => m (f '' s) := by
  refine' (comap_ofFunction _ _).trans _
  · refine' h.imp (fun H s t hst => iSup_le fun hs => _) id
    have ht : t.Nonempty := hs.mono hst
    

Proof state:
case refine'_1
α : Type u_1
m : Set α → ℝ≥0∞
β : Type u_2
f : β → α
h : (Monotone fun s => m ↑s) ∨ Surjective f
H : Monotone fun s => m ↑s
s t : Set α
hst : s ≤ t
hs : Set.Nonempty s
ht : Set.Nonempty t
⊢ m s ≤ (fun s => ⨆ (_ : Set.Nonempty s), m s) t

Next tactic:
exact (@H ⟨s, hs⟩ ⟨t, ht⟩ hst).trans (le_iSup (fun _ : t.Nonempty => m t) ht)
theorem comap_boundedBy {β} (f : β → α)
    (h : (Monotone fun s : { s : Set α // s.Nonempty } => m s) ∨ Surjective f) :
    comap f (boundedBy m) = boundedBy fun s => m (f '' s) := by
  refine' (comap_ofFunction _ _).trans _
  · refine' h.imp (fun H s t hst => iSup_le fun hs => _) id
    have ht : t.Nonempty := hs.mono hst
    exact (@H ⟨s, hs⟩ ⟨t, ht⟩ hst).trans (le_iSup (fun _ : t.Nonempty => m t) ht)
  · 

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
β : Type u_2
f : β → α
h : (Monotone fun s => m ↑s) ∨ Surjective f
⊢ OuterMeasure.ofFunction (fun s => ⨆ (_ : Set.Nonempty (f '' s)), m (f '' s))
      (_ : (fun s => ⨆ (_ : Set.Nonempty (f '' s)), m (f '' s)) ∅ = 0) =
    boundedBy fun s => m (f '' s)

Next tactic:
dsimp only [boundedBy]
theorem comap_boundedBy {β} (f : β → α)
    (h : (Monotone fun s : { s : Set α // s.Nonempty } => m s) ∨ Surjective f) :
    comap f (boundedBy m) = boundedBy fun s => m (f '' s) := by
  refine' (comap_ofFunction _ _).trans _
  · refine' h.imp (fun H s t hst => iSup_le fun hs => _) id
    have ht : t.Nonempty := hs.mono hst
    exact (@H ⟨s, hs⟩ ⟨t, ht⟩ hst).trans (le_iSup (fun _ : t.Nonempty => m t) ht)
  · dsimp only [boundedBy]
    

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
β : Type u_2
f : β → α
h : (Monotone fun s => m ↑s) ∨ Surjective f
⊢ OuterMeasure.ofFunction (fun s => ⨆ (_ : Set.Nonempty (f '' s)), m (f '' s))
      (_ : ⨆ (_ : Set.Nonempty (f '' ∅)), m (f '' ∅) = 0) =
    OuterMeasure.ofFunction (fun s => ⨆ (_ : Set.Nonempty s), m (f '' s)) (_ : ⨆ (_ : Set.Nonempty ∅), m (f '' ∅) = 0)

Next tactic:
congr with s : 1
theorem comap_boundedBy {β} (f : β → α)
    (h : (Monotone fun s : { s : Set α // s.Nonempty } => m s) ∨ Surjective f) :
    comap f (boundedBy m) = boundedBy fun s => m (f '' s) := by
  refine' (comap_ofFunction _ _).trans _
  · refine' h.imp (fun H s t hst => iSup_le fun hs => _) id
    have ht : t.Nonempty := hs.mono hst
    exact (@H ⟨s, hs⟩ ⟨t, ht⟩ hst).trans (le_iSup (fun _ : t.Nonempty => m t) ht)
  · dsimp only [boundedBy]
    congr with s : 1
    

Proof state:
case refine'_2.e_m.h
α : Type u_1
m : Set α → ℝ≥0∞
β : Type u_2
f : β → α
h : (Monotone fun s => m ↑s) ∨ Surjective f
s : Set β
⊢ ⨆ (_ : Set.Nonempty (f '' s)), m (f '' s) = ⨆ (_ : Set.Nonempty s), m (f '' s)

Next tactic:
rw [nonempty_image_iff]
@[simp]
theorem isCaratheodory_empty : IsCaratheodory m ∅ := by 

Proof state:
α : Type u
m : OuterMeasure α
s s₁ s₂ : Set α
⊢ IsCaratheodory m ∅

Next tactic:
simp [IsCaratheodory, m.empty, diff_empty]
theorem isCaratheodory_compl : IsCaratheodory m s₁ → IsCaratheodory m s₁ᶜ := by
  

Proof state:
α : Type u
m : OuterMeasure α
s s₁ s₂ : Set α
⊢ IsCaratheodory m s₁ → IsCaratheodory m s₁ᶜ

Next tactic:
simp [IsCaratheodory, diff_eq, add_comm]
@[simp]
theorem isCaratheodory_compl_iff : IsCaratheodory m sᶜ ↔ IsCaratheodory m s :=
  ⟨fun h => by 

Proof state:
α : Type u
m : OuterMeasure α
s s₁ s₂ : Set α
h : IsCaratheodory m sᶜ
⊢ IsCaratheodory m s

Next tactic:
simpa using isCaratheodory_compl m h
theorem isCaratheodory_union (h₁ : IsCaratheodory m s₁) (h₂ : IsCaratheodory m s₂) :
    IsCaratheodory m (s₁ ∪ s₂) := fun t => by
  

Proof state:
α : Type u
m : OuterMeasure α
s s₁ s₂ : Set α
h₁ : IsCaratheodory m s₁
h₂ : IsCaratheodory m s₂
t : Set α
⊢ ↑m t = ↑m (t ∩ (s₁ ∪ s₂)) + ↑m (t \ (s₁ ∪ s₂))

Next tactic:
rw [h₁ t, h₂ (t ∩ s₁), h₂ (t \ s₁), h₁ (t ∩ (s₁ ∪ s₂)), inter_diff_assoc _ _ s₁,
    Set.inter_assoc _ _ s₁, inter_eq_self_of_subset_right (Set.subset_union_left _ _),
    union_diff_left, h₂ (t ∩ s₁)]
theorem isCaratheodory_union (h₁ : IsCaratheodory m s₁) (h₂ : IsCaratheodory m s₂) :
    IsCaratheodory m (s₁ ∪ s₂) := fun t => by
  rw [h₁ t, h₂ (t ∩ s₁), h₂ (t \ s₁), h₁ (t ∩ (s₁ ∪ s₂)), inter_diff_assoc _ _ s₁,
    Set.inter_assoc _ _ s₁, inter_eq_self_of_subset_right (Set.subset_union_left _ _),
    union_diff_left, h₂ (t ∩ s₁)]
  

Proof state:
α : Type u
m : OuterMeasure α
s s₁ s₂ : Set α
h₁ : IsCaratheodory m s₁
h₂ : IsCaratheodory m s₂
t : Set α
⊢ ↑m (t ∩ s₁ ∩ s₂) + ↑m ((t ∩ s₁) \ s₂) + (↑m (t \ s₁ ∩ s₂) + ↑m ((t \ s₁) \ s₂)) =
    ↑m (t ∩ s₁ ∩ s₂) + ↑m ((t ∩ s₁) \ s₂) + ↑m (t ∩ (s₂ \ s₁)) + ↑m (t \ (s₁ ∪ s₂))

Next tactic:
simp [diff_eq, add_assoc]
theorem measure_inter_union (h : s₁ ∩ s₂ ⊆ ∅) (h₁ : IsCaratheodory m s₁) {t : Set α} :
    m (t ∩ (s₁ ∪ s₂)) = m (t ∩ s₁) + m (t ∩ s₂) := by
  

Proof state:
α : Type u
m : OuterMeasure α
s s₁ s₂ : Set α
h : s₁ ∩ s₂ ⊆ ∅
h₁ : IsCaratheodory m s₁
t : Set α
⊢ ↑m (t ∩ (s₁ ∪ s₂)) = ↑m (t ∩ s₁) + ↑m (t ∩ s₂)

Next tactic:
rw [h₁, Set.inter_assoc, Set.union_inter_cancel_left, inter_diff_assoc, union_diff_cancel_left h]
theorem isCaratheodory_iUnion_lt {s : ℕ → Set α} :
    ∀ {n : ℕ}, (∀ i < n, IsCaratheodory m (s i)) → IsCaratheodory m (⋃ i < n, s i)
  | 0, _ => by 

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
x✝ : ∀ i < 0, IsCaratheodory m (s i)
⊢ IsCaratheodory m (⋃ i, ⋃ (_ : i < 0), s i)

Next tactic:
simp [Nat.not_lt_zero]
theorem isCaratheodory_iUnion_lt {s : ℕ → Set α} :
    ∀ {n : ℕ}, (∀ i < n, IsCaratheodory m (s i)) → IsCaratheodory m (⋃ i < n, s i)
  | 0, _ => by simp [Nat.not_lt_zero]
  | n + 1, h => by
    

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
n : ℕ
h : ∀ i < n + 1, IsCaratheodory m (s i)
⊢ IsCaratheodory m (⋃ i, ⋃ (_ : i < n + 1), s i)

Next tactic:
rw [biUnion_lt_succ]
theorem isCaratheodory_iUnion_lt {s : ℕ → Set α} :
    ∀ {n : ℕ}, (∀ i < n, IsCaratheodory m (s i)) → IsCaratheodory m (⋃ i < n, s i)
  | 0, _ => by simp [Nat.not_lt_zero]
  | n + 1, h => by
    rw [biUnion_lt_succ]
    

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
n : ℕ
h : ∀ i < n + 1, IsCaratheodory m (s i)
⊢ IsCaratheodory m ((⋃ k, ⋃ (_ : k < n), s k) ∪ s n)

Next tactic:
exact isCaratheodory_union m
            (isCaratheodory_iUnion_lt fun i hi => h i <| lt_of_lt_of_le hi <| Nat.le_succ _)
            (h n (le_refl (n + 1)))
theorem isCaratheodory_inter (h₁ : IsCaratheodory m s₁) (h₂ : IsCaratheodory m s₂) :
    IsCaratheodory m (s₁ ∩ s₂) := by
  

Proof state:
α : Type u
m : OuterMeasure α
s s₁ s₂ : Set α
h₁ : IsCaratheodory m s₁
h₂ : IsCaratheodory m s₂
⊢ IsCaratheodory m (s₁ ∩ s₂)

Next tactic:
rw [← isCaratheodory_compl_iff, Set.compl_inter]
theorem isCaratheodory_inter (h₁ : IsCaratheodory m s₁) (h₂ : IsCaratheodory m s₂) :
    IsCaratheodory m (s₁ ∩ s₂) := by
  rw [← isCaratheodory_compl_iff, Set.compl_inter]
  

Proof state:
α : Type u
m : OuterMeasure α
s s₁ s₂ : Set α
h₁ : IsCaratheodory m s₁
h₂ : IsCaratheodory m s₂
⊢ IsCaratheodory m (s₁ᶜ ∪ s₂ᶜ)

Next tactic:
exact isCaratheodory_union _ (isCaratheodory_compl _ h₁) (isCaratheodory_compl _ h₂)
theorem isCaratheodory_sum {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) {t : Set α} :
    ∀ {n}, (∑ i in Finset.range n, m (t ∩ s i)) = m (t ∩ ⋃ i < n, s i)
  | 0 => by 

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
⊢ ∑ i in Finset.range 0, ↑m (t ∩ s i) = ↑m (t ∩ ⋃ i, ⋃ (_ : i < 0), s i)

Next tactic:
simp [Nat.not_lt_zero, m.empty]
theorem isCaratheodory_sum {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) {t : Set α} :
    ∀ {n}, (∑ i in Finset.range n, m (t ∩ s i)) = m (t ∩ ⋃ i < n, s i)
  | 0 => by simp [Nat.not_lt_zero, m.empty]
  | Nat.succ n => by
    

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
n : ℕ
⊢ ∑ i in Finset.range (Nat.succ n), ↑m (t ∩ s i) = ↑m (t ∩ ⋃ i, ⋃ (_ : i < Nat.succ n), s i)

Next tactic:
rw [biUnion_lt_succ, Finset.sum_range_succ, Set.union_comm, isCaratheodory_sum h hd,
      m.measure_inter_union _ (h n), add_comm]
theorem isCaratheodory_sum {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) {t : Set α} :
    ∀ {n}, (∑ i in Finset.range n, m (t ∩ s i)) = m (t ∩ ⋃ i < n, s i)
  | 0 => by simp [Nat.not_lt_zero, m.empty]
  | Nat.succ n => by
    rw [biUnion_lt_succ, Finset.sum_range_succ, Set.union_comm, isCaratheodory_sum h hd,
      m.measure_inter_union _ (h n), add_comm]
    

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
n : ℕ
⊢ s n ∩ ⋃ k, ⋃ (_ : k < n), s k ⊆ ∅

Next tactic:
intro a
theorem isCaratheodory_sum {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) {t : Set α} :
    ∀ {n}, (∑ i in Finset.range n, m (t ∩ s i)) = m (t ∩ ⋃ i < n, s i)
  | 0 => by simp [Nat.not_lt_zero, m.empty]
  | Nat.succ n => by
    rw [biUnion_lt_succ, Finset.sum_range_succ, Set.union_comm, isCaratheodory_sum h hd,
      m.measure_inter_union _ (h n), add_comm]
    intro a
    

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
n : ℕ
a : α
⊢ a ∈ s n ∩ ⋃ k, ⋃ (_ : k < n), s k → a ∈ ∅

Next tactic:
simpa using fun (h₁ : a ∈ s n) i (hi : i < n) h₂ => (hd (ne_of_gt hi)).le_bot ⟨h₁, h₂⟩
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
⊢ IsCaratheodory m (⋃ i, s i)

Next tactic:
apply (isCaratheodory_iff_le' m).mpr
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
⊢ ∀ (t : Set α), ↑m (t ∩ ⋃ i, s i) + ↑m (t \ ⋃ i, s i) ≤ ↑m t

Next tactic:
intro t
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
⊢ ↑m (t ∩ ⋃ i, s i) + ↑m (t \ ⋃ i, s i) ≤ ↑m t

Next tactic:
have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        convert m.iUnion fun i => t ∩ s i using 1
        · simp [inter_iUnion]
        · simp [ENNReal.tsum_eq_iSup_nat, isCaratheodory_sum m h hd]
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
⊢ ↑m (t ∩ ⋃ i, s i) ≤ ⨆ n, ↑m (t ∩ ⋃ i, ⋃ (_ : i < n), s i)

Next tactic:
convert m.iUnion fun i => t ∩ s i using 1
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        convert m.iUnion fun i => t ∩ s i using 1
        · 

Proof state:
case h.e'_3
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
⊢ ↑m (t ∩ ⋃ i, s i) = ↑m (⋃ i, t ∩ s i)

Next tactic:
simp [inter_iUnion]
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        convert m.iUnion fun i => t ∩ s i using 1
        · simp [inter_iUnion]
        · 

Proof state:
case h.e'_4
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
⊢ ⨆ n, ↑m (t ∩ ⋃ i, ⋃ (_ : i < n), s i) = ∑' (i : ℕ), ↑m (t ∩ s i)

Next tactic:
simp [ENNReal.tsum_eq_iSup_nat, isCaratheodory_sum m h hd]
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        convert m.iUnion fun i => t ∩ s i using 1
        · simp [inter_iUnion]
        · simp [ENNReal.tsum_eq_iSup_nat, isCaratheodory_sum m h hd]
      

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
hp : ↑m (t ∩ ⋃ i, s i) ≤ ⨆ n, ↑m (t ∩ ⋃ i, ⋃ (_ : i < n), s i)
⊢ ↑m (t ∩ ⋃ i, s i) + ↑m (t \ ⋃ i, s i) ≤ ↑m t

Next tactic:
refine' le_trans (add_le_add_right hp _) _
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        convert m.iUnion fun i => t ∩ s i using 1
        · simp [inter_iUnion]
        · simp [ENNReal.tsum_eq_iSup_nat, isCaratheodory_sum m h hd]
      refine' le_trans (add_le_add_right hp _) _
      

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
hp : ↑m (t ∩ ⋃ i, s i) ≤ ⨆ n, ↑m (t ∩ ⋃ i, ⋃ (_ : i < n), s i)
⊢ (⨆ n, ↑m (t ∩ ⋃ i, ⋃ (_ : i < n), s i)) + ↑m (t \ ⋃ i, s i) ≤ ↑m t

Next tactic:
rw [ENNReal.iSup_add]
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        convert m.iUnion fun i => t ∩ s i using 1
        · simp [inter_iUnion]
        · simp [ENNReal.tsum_eq_iSup_nat, isCaratheodory_sum m h hd]
      refine' le_trans (add_le_add_right hp _) _
      rw [ENNReal.iSup_add]
      

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
hp : ↑m (t ∩ ⋃ i, s i) ≤ ⨆ n, ↑m (t ∩ ⋃ i, ⋃ (_ : i < n), s i)
⊢ ⨆ b, ↑m (t ∩ ⋃ i, ⋃ (_ : i < b), s i) + ↑m (t \ ⋃ i, s i) ≤ ↑m t

Next tactic:
refine'
        iSup_le fun n =>
          le_trans (add_le_add_left _ _) (ge_of_eq (isCaratheodory_iUnion_lt m (fun i _ => h i) _))
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        convert m.iUnion fun i => t ∩ s i using 1
        · simp [inter_iUnion]
        · simp [ENNReal.tsum_eq_iSup_nat, isCaratheodory_sum m h hd]
      refine' le_trans (add_le_add_right hp _) _
      rw [ENNReal.iSup_add]
      refine'
        iSup_le fun n =>
          le_trans (add_le_add_left _ _) (ge_of_eq (isCaratheodory_iUnion_lt m (fun i _ => h i) _))
      

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
hp : ↑m (t ∩ ⋃ i, s i) ≤ ⨆ n, ↑m (t ∩ ⋃ i, ⋃ (_ : i < n), s i)
n : ℕ
⊢ ↑m (t \ ⋃ i, s i) ≤ ↑m (t \ ⋃ i, ⋃ (_ : i < n), s i)

Next tactic:
refine' m.mono (diff_subset_diff_right _)
theorem isCaratheodory_iUnion_nat {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i))
    (hd : Pairwise (Disjoint on s)) : IsCaratheodory m (⋃ i, s i) := by
      apply (isCaratheodory_iff_le' m).mpr
      intro t
      have hp : m (t ∩ ⋃ i, s i) ≤ ⨆ n, m (t ∩ ⋃ i < n, s i) := by
        convert m.iUnion fun i => t ∩ s i using 1
        · simp [inter_iUnion]
        · simp [ENNReal.tsum_eq_iSup_nat, isCaratheodory_sum m h hd]
      refine' le_trans (add_le_add_right hp _) _
      rw [ENNReal.iSup_add]
      refine'
        iSup_le fun n =>
          le_trans (add_le_add_left _ _) (ge_of_eq (isCaratheodory_iUnion_lt m (fun i _ => h i) _))
      refine' m.mono (diff_subset_diff_right _)
      

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
t : Set α
hp : ↑m (t ∩ ⋃ i, s i) ≤ ⨆ n, ↑m (t ∩ ⋃ i, ⋃ (_ : i < n), s i)
n : ℕ
⊢ ⋃ i, ⋃ (_ : i < n), s i ⊆ ⋃ i, s i

Next tactic:
exact iUnion₂_subset fun i _ => subset_iUnion _ i
theorem f_iUnion {s : ℕ → Set α} (h : ∀ i, IsCaratheodory m (s i)) (hd : Pairwise (Disjoint on s)) :
    m (⋃ i, s i) = ∑' i, m (s i) := by
  

Proof state:
α : Type u
m : OuterMeasure α
s✝ s₁ s₂ : Set α
s : ℕ → Set α
h : ∀ (i : ℕ), IsCaratheodory m (s i)
hd : Pairwise (Disjoint on s)
⊢ ↑m (⋃ i, s i) = ∑' (i : ℕ), ↑m (s i)

Next tactic:
refine' le_antisymm (m.iUnion_nat s) _