l3lab/ntp-mathlib huggingface dataset:
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; 

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type ?u.141860
f : β → α
h : Monotone m ∨ Surjective f
⊢ m ∅ = 0

Next tactic:
simp [m_empty]
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
h : Monotone m ∨ Surjective f
⊢ (comap f) (OuterMeasure.ofFunction m m_empty) =
    OuterMeasure.ofFunction (fun s => m (f '' s)) (_ : (fun s => m (f '' s)) ∅ = 0)

Next tactic:
refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · 

Proof state:
case refine'_1
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
h : Monotone m ∨ Surjective f
s : Set β
⊢ ↑((comap f) (OuterMeasure.ofFunction m m_empty)) s ≤ m (f '' s)

Next tactic:
rw [comap_apply]
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · rw [comap_apply]
    

Proof state:
case refine'_1
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
h : Monotone m ∨ Surjective f
s : Set β
⊢ ↑(OuterMeasure.ofFunction m m_empty) (f '' s) ≤ m (f '' s)

Next tactic:
apply ofFunction_le
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · rw [comap_apply]
    apply ofFunction_le
  · 

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

Next tactic:
rw [comap_apply, ofFunction_apply, ofFunction_apply]
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · rw [comap_apply]
    apply ofFunction_le
  · rw [comap_apply, ofFunction_apply, ofFunction_apply]
    

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
h : Monotone m ∨ Surjective f
s : Set β
⊢ ⨅ t, ⨅ (_ : s ⊆ iUnion t), ∑' (n : ℕ), m (f '' t n) ≤ ⨅ t, ⨅ (_ : f '' s ⊆ iUnion t), ∑' (n : ℕ), m (t n)

Next tactic:
refine' iInf_mono' fun t => ⟨fun k => f ⁻¹' t k, _⟩
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · rw [comap_apply]
    apply ofFunction_le
  · rw [comap_apply, ofFunction_apply, ofFunction_apply]
    refine' iInf_mono' fun t => ⟨fun k => f ⁻¹' t k, _⟩
    

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
h : Monotone m ∨ Surjective f
s : Set β
t : ℕ → Set α
⊢ ⨅ (_ : s ⊆ ⋃ k, f ⁻¹' t k), ∑' (n : ℕ), m (f '' (fun k => f ⁻¹' t k) n) ≤
    ⨅ (_ : f '' s ⊆ iUnion t), ∑' (n : ℕ), m (t n)

Next tactic:
refine' iInf_mono' fun ht => _
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · rw [comap_apply]
    apply ofFunction_le
  · rw [comap_apply, ofFunction_apply, ofFunction_apply]
    refine' iInf_mono' fun t => ⟨fun k => f ⁻¹' t k, _⟩
    refine' iInf_mono' fun ht => _
    

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
h : Monotone m ∨ Surjective f
s : Set β
t : ℕ → Set α
ht : f '' s ⊆ iUnion t
⊢ ∃ (_ : s ⊆ ⋃ k, f ⁻¹' t k), ∑' (n : ℕ), m (f '' (fun k => f ⁻¹' t k) n) ≤ ∑' (n : ℕ), m (t n)

Next tactic:
rw [Set.image_subset_iff, preimage_iUnion] at ht
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · rw [comap_apply]
    apply ofFunction_le
  · rw [comap_apply, ofFunction_apply, ofFunction_apply]
    refine' iInf_mono' fun t => ⟨fun k => f ⁻¹' t k, _⟩
    refine' iInf_mono' fun ht => _
    rw [Set.image_subset_iff, preimage_iUnion] at ht
    

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
h : Monotone m ∨ Surjective f
s : Set β
t : ℕ → Set α
ht : s ⊆ ⋃ i, f ⁻¹' t i
⊢ ∃ (_ : s ⊆ ⋃ k, f ⁻¹' t k), ∑' (n : ℕ), m (f '' (fun k => f ⁻¹' t k) n) ≤ ∑' (n : ℕ), m (t n)

Next tactic:
refine' ⟨ht, ENNReal.tsum_le_tsum fun n => _⟩
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · rw [comap_apply]
    apply ofFunction_le
  · rw [comap_apply, ofFunction_apply, ofFunction_apply]
    refine' iInf_mono' fun t => ⟨fun k => f ⁻¹' t k, _⟩
    refine' iInf_mono' fun ht => _
    rw [Set.image_subset_iff, preimage_iUnion] at ht
    refine' ⟨ht, ENNReal.tsum_le_tsum fun n => _⟩
    

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
h : Monotone m ∨ Surjective f
s : Set β
t : ℕ → Set α
ht : s ⊆ ⋃ i, f ⁻¹' t i
n : ℕ
⊢ m (f '' (fun k => f ⁻¹' t k) n) ≤ m (t n)

Next tactic:
cases' h with hl hr
theorem comap_ofFunction {β} (f : β → α) (h : Monotone m ∨ Surjective f) :
    comap f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f '' s)) (by simp; simp [m_empty]) := by
  refine' le_antisymm (le_ofFunction.2 fun s => _) fun s => _
  · rw [comap_apply]
    apply ofFunction_le
  · rw [comap_apply, ofFunction_apply, ofFunction_apply]
    refine' iInf_mono' fun t => ⟨fun k => f ⁻¹' t k, _⟩
    refine' iInf_mono' fun ht => _
    rw [Set.image_subset_iff, preimage_iUnion] at ht
    refine' ⟨ht, ENNReal.tsum_le_tsum fun n => _⟩
    cases' h with hl hr
    

Proof state:
case refine'_2.inl
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
s : Set β
t : ℕ → Set α
ht : s ⊆ ⋃ i, f ⁻¹' t i
n : ℕ
hl : Monotone m
⊢ m (f '' (fun k => f ⁻¹' t k) n) ≤ m (t n)
case refine'_2.inr
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : β → α
s : Set β
t : ℕ → Set α
ht : s ⊆ ⋃ i, f ⁻¹' t i
n : ℕ
hr : Surjective f
⊢ m (f '' (fun k => f ⁻¹' t k) n) ≤ m (t n)

Next tactic:
exacts [hl (image_preimage_subset _ _), (congr_arg m (hr.image_preimage (t n))).le]
theorem map_ofFunction_le {β} (f : α → β) :
    map f (OuterMeasure.ofFunction m m_empty) ≤
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty :=
  le_ofFunction.2 fun s => by
    

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
s : Set β
⊢ ↑((map f) (OuterMeasure.ofFunction m m_empty)) s ≤ m (f ⁻¹' s)

Next tactic:
rw [map_apply]
theorem map_ofFunction_le {β} (f : α → β) :
    map f (OuterMeasure.ofFunction m m_empty) ≤
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty :=
  le_ofFunction.2 fun s => by
    rw [map_apply]
    

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
s : Set β
⊢ ↑(OuterMeasure.ofFunction m m_empty) (f ⁻¹' s) ≤ m (f ⁻¹' s)

Next tactic:
apply ofFunction_le
theorem map_ofFunction {β} {f : α → β} (hf : Injective f) :
    map f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
hf : Injective f
⊢ (map f) (OuterMeasure.ofFunction m m_empty) = OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty

Next tactic:
refine' (map_ofFunction_le _).antisymm fun s => _
theorem map_ofFunction {β} {f : α → β} (hf : Injective f) :
    map f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty := by
  refine' (map_ofFunction_le _).antisymm fun s => _
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
hf : Injective f
s : Set β
⊢ ↑(OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty) s ≤ ↑((map f) (OuterMeasure.ofFunction m m_empty)) s

Next tactic:
simp only [ofFunction_apply, map_apply, le_iInf_iff]
theorem map_ofFunction {β} {f : α → β} (hf : Injective f) :
    map f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty := by
  refine' (map_ofFunction_le _).antisymm fun s => _
  simp only [ofFunction_apply, map_apply, le_iInf_iff]
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
hf : Injective f
s : Set β
⊢ ∀ (i : ℕ → Set α), f ⁻¹' s ⊆ iUnion i → ⨅ t, ⨅ (_ : s ⊆ iUnion t), ∑' (n : ℕ), m (f ⁻¹' t n) ≤ ∑' (n : ℕ), m (i n)

Next tactic:
intro t ht
theorem map_ofFunction {β} {f : α → β} (hf : Injective f) :
    map f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty := by
  refine' (map_ofFunction_le _).antisymm fun s => _
  simp only [ofFunction_apply, map_apply, le_iInf_iff]
  intro t ht
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
hf : Injective f
s : Set β
t : ℕ → Set α
ht : f ⁻¹' s ⊆ iUnion t
⊢ ⨅ t, ⨅ (_ : s ⊆ iUnion t), ∑' (n : ℕ), m (f ⁻¹' t n) ≤ ∑' (n : ℕ), m (t n)

Next tactic:
refine' iInf_le_of_le (fun n => (range f)ᶜ ∪ f '' t n) (iInf_le_of_le _ _)
theorem map_ofFunction {β} {f : α → β} (hf : Injective f) :
    map f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty := by
  refine' (map_ofFunction_le _).antisymm fun s => _
  simp only [ofFunction_apply, map_apply, le_iInf_iff]
  intro t ht
  refine' iInf_le_of_le (fun n => (range f)ᶜ ∪ f '' t n) (iInf_le_of_le _ _)
  · 

Proof state:
case refine'_1
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
hf : Injective f
s : Set β
t : ℕ → Set α
ht : f ⁻¹' s ⊆ iUnion t
⊢ s ⊆ ⋃ n, (range f)ᶜ ∪ f '' t n

Next tactic:
rw [← union_iUnion, ← inter_subset, ← image_preimage_eq_inter_range, ← image_iUnion]
theorem map_ofFunction {β} {f : α → β} (hf : Injective f) :
    map f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty := by
  refine' (map_ofFunction_le _).antisymm fun s => _
  simp only [ofFunction_apply, map_apply, le_iInf_iff]
  intro t ht
  refine' iInf_le_of_le (fun n => (range f)ᶜ ∪ f '' t n) (iInf_le_of_le _ _)
  · rw [← union_iUnion, ← inter_subset, ← image_preimage_eq_inter_range, ← image_iUnion]
    

Proof state:
case refine'_1
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
hf : Injective f
s : Set β
t : ℕ → Set α
ht : f ⁻¹' s ⊆ iUnion t
⊢ f '' (f ⁻¹' s) ⊆ f '' ⋃ i, t i

Next tactic:
exact image_subset _ ht
theorem map_ofFunction {β} {f : α → β} (hf : Injective f) :
    map f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty := by
  refine' (map_ofFunction_le _).antisymm fun s => _
  simp only [ofFunction_apply, map_apply, le_iInf_iff]
  intro t ht
  refine' iInf_le_of_le (fun n => (range f)ᶜ ∪ f '' t n) (iInf_le_of_le _ _)
  · rw [← union_iUnion, ← inter_subset, ← image_preimage_eq_inter_range, ← image_iUnion]
    exact image_subset _ ht
  · 

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
hf : Injective f
s : Set β
t : ℕ → Set α
ht : f ⁻¹' s ⊆ iUnion t
⊢ ∑' (n : ℕ), m (f ⁻¹' (fun n => (range f)ᶜ ∪ f '' t n) n) ≤ ∑' (n : ℕ), m (t n)

Next tactic:
refine' ENNReal.tsum_le_tsum fun n => le_of_eq _
theorem map_ofFunction {β} {f : α → β} (hf : Injective f) :
    map f (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun s => m (f ⁻¹' s)) m_empty := by
  refine' (map_ofFunction_le _).antisymm fun s => _
  simp only [ofFunction_apply, map_apply, le_iInf_iff]
  intro t ht
  refine' iInf_le_of_le (fun n => (range f)ᶜ ∪ f '' t n) (iInf_le_of_le _ _)
  · rw [← union_iUnion, ← inter_subset, ← image_preimage_eq_inter_range, ← image_iUnion]
    exact image_subset _ ht
  · refine' ENNReal.tsum_le_tsum fun n => le_of_eq _
    

Proof state:
case refine'_2
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
β : Type u_2
f : α → β
hf : Injective f
s : Set β
t : ℕ → Set α
ht : f ⁻¹' s ⊆ iUnion t
n : ℕ
⊢ m (f ⁻¹' (fun n => (range f)ᶜ ∪ f '' t n) n) = m (t n)

Next tactic:
simp [hf.preimage_image]
theorem restrict_ofFunction (s : Set α) (hm : Monotone m) :
    restrict s (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun t => m (t ∩ s)) (by 

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
hm : Monotone m
⊢ (fun t => m (t ∩ s)) ∅ = 0

Next tactic:
simp
theorem restrict_ofFunction (s : Set α) (hm : Monotone m) :
    restrict s (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun t => m (t ∩ s)) (by simp; 

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
hm : Monotone m
⊢ m ∅ = 0

Next tactic:
simp [m_empty]
theorem restrict_ofFunction (s : Set α) (hm : Monotone m) :
    restrict s (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun t => m (t ∩ s)) (by simp; simp [m_empty]) := by
      

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
hm : Monotone m
⊢ (restrict s) (OuterMeasure.ofFunction m m_empty) =
    OuterMeasure.ofFunction (fun t => m (t ∩ s)) (_ : (fun t => m (t ∩ s)) ∅ = 0)

Next tactic:
rw [restrict]
theorem restrict_ofFunction (s : Set α) (hm : Monotone m) :
    restrict s (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun t => m (t ∩ s)) (by simp; simp [m_empty]) := by
      rw [restrict]
      

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
hm : Monotone m
⊢ (LinearMap.comp (map Subtype.val) (comap Subtype.val)) (OuterMeasure.ofFunction m m_empty) =
    OuterMeasure.ofFunction (fun t => m (t ∩ s)) (_ : (fun t => m (t ∩ s)) ∅ = 0)

Next tactic:
simp only [LinearMap.comp_apply]
theorem restrict_ofFunction (s : Set α) (hm : Monotone m) :
    restrict s (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun t => m (t ∩ s)) (by simp; simp [m_empty]) := by
      rw [restrict]
      simp only [LinearMap.comp_apply]
      

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
hm : Monotone m
⊢ (map Subtype.val) ((comap Subtype.val) (OuterMeasure.ofFunction m m_empty)) =
    OuterMeasure.ofFunction (fun t => m (t ∩ s)) (_ : (fun t => m (t ∩ s)) ∅ = 0)

Next tactic:
rw [comap_ofFunction _ (Or.inl hm)]
theorem restrict_ofFunction (s : Set α) (hm : Monotone m) :
    restrict s (OuterMeasure.ofFunction m m_empty) =
      OuterMeasure.ofFunction (fun t => m (t ∩ s)) (by simp; simp [m_empty]) := by
      rw [restrict]
      simp only [LinearMap.comp_apply]
      rw [comap_ofFunction _ (Or.inl hm)]
      

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
hm : Monotone m
⊢ (map Subtype.val)
      (OuterMeasure.ofFunction (fun s_1 => m (Subtype.val '' s_1)) (_ : (fun s_1 => m (Subtype.val '' s_1)) ∅ = 0)) =
    OuterMeasure.ofFunction (fun t => m (t ∩ s)) (_ : (fun t => m (t ∩ s)) ∅ = 0)

Next tactic:
simp only [map_ofFunction Subtype.coe_injective, Subtype.image_preimage_coe]
theorem smul_ofFunction {c : ℝ≥0∞} (hc : c ≠ ∞) : c • OuterMeasure.ofFunction m m_empty =
    OuterMeasure.ofFunction (c • m) (by 

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

Next tactic:
simp [m_empty]
theorem smul_ofFunction {c : ℝ≥0∞} (hc : c ≠ ∞) : c • OuterMeasure.ofFunction m m_empty =
    OuterMeasure.ofFunction (c • m) (by simp [m_empty]) := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
c : ℝ≥0∞
hc : c ≠ ⊤
⊢ c • OuterMeasure.ofFunction m m_empty = OuterMeasure.ofFunction (c • m) (_ : c • m ∅ = 0)

Next tactic:
ext1 s
theorem smul_ofFunction {c : ℝ≥0∞} (hc : c ≠ ∞) : c • OuterMeasure.ofFunction m m_empty =
    OuterMeasure.ofFunction (c • m) (by simp [m_empty]) := by
  ext1 s
  

Proof state:
case h
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
c : ℝ≥0∞
hc : c ≠ ⊤
s : Set α
⊢ ↑(c • OuterMeasure.ofFunction m m_empty) s = ↑(OuterMeasure.ofFunction (c • m) (_ : c • m ∅ = 0)) s

Next tactic:
haveI : Nonempty { t : ℕ → Set α // s ⊆ ⋃ i, t i } := ⟨⟨fun _ => s, subset_iUnion (fun _ => s) 0⟩⟩
theorem smul_ofFunction {c : ℝ≥0∞} (hc : c ≠ ∞) : c • OuterMeasure.ofFunction m m_empty =
    OuterMeasure.ofFunction (c • m) (by simp [m_empty]) := by
  ext1 s
  haveI : Nonempty { t : ℕ → Set α // s ⊆ ⋃ i, t i } := ⟨⟨fun _ => s, subset_iUnion (fun _ => s) 0⟩⟩
  

Proof state:
case h
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
c : ℝ≥0∞
hc : c ≠ ⊤
s : Set α
this : Nonempty { t // s ⊆ ⋃ i, t i }
⊢ ↑(c • OuterMeasure.ofFunction m m_empty) s = ↑(OuterMeasure.ofFunction (c • m) (_ : c • m ∅ = 0)) s

Next tactic:
simp only [smul_apply, ofFunction_apply, ENNReal.tsum_mul_left, Pi.smul_apply, smul_eq_mul,
  iInf_subtype']
theorem smul_ofFunction {c : ℝ≥0∞} (hc : c ≠ ∞) : c • OuterMeasure.ofFunction m m_empty =
    OuterMeasure.ofFunction (c • m) (by simp [m_empty]) := by
  ext1 s
  haveI : Nonempty { t : ℕ → Set α // s ⊆ ⋃ i, t i } := ⟨⟨fun _ => s, subset_iUnion (fun _ => s) 0⟩⟩
  simp only [smul_apply, ofFunction_apply, ENNReal.tsum_mul_left, Pi.smul_apply, smul_eq_mul,
  iInf_subtype']
  

Proof state:
case h
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
c : ℝ≥0∞
hc : c ≠ ⊤
s : Set α
this : Nonempty { t // s ⊆ ⋃ i, t i }
⊢ c * ⨅ x, ∑' (n : ℕ), m (↑x n) = ⨅ x, c * ∑' (i : ℕ), m (↑x i)

Next tactic:
rw [ENNReal.iInf_mul_left fun h => (hc h).elim]
/-- Given any function `m` assigning measures to sets, there is a unique maximal outer measure `μ`
  satisfying `μ s ≤ m s` for all `s : Set α`. This is the same as `OuterMeasure.ofFunction`,
  except that it doesn't require `m ∅ = 0`. -/
def boundedBy : OuterMeasure α :=
  OuterMeasure.ofFunction (fun s => ⨆ _ : s.Nonempty, m s) (by 

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
⊢ (fun s => ⨆ (_ : Set.Nonempty s), m s) ∅ = 0

Next tactic:
simp [Set.not_nonempty_empty]
theorem boundedBy_eq_ofFunction (m_empty : m ∅ = 0) (s : Set α) :
    boundedBy m s = OuterMeasure.ofFunction m m_empty s := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
⊢ ↑(boundedBy m) s = ↑(OuterMeasure.ofFunction m m_empty) s

Next tactic:
have : (fun s : Set α => ⨆ _ : s.Nonempty, m s) = m := by
    ext1 t
    rcases t.eq_empty_or_nonempty with h | h <;> simp [h, Set.not_nonempty_empty, m_empty]
theorem boundedBy_eq_ofFunction (m_empty : m ∅ = 0) (s : Set α) :
    boundedBy m s = OuterMeasure.ofFunction m m_empty s := by
  have : (fun s : Set α => ⨆ _ : s.Nonempty, m s) = m := by
    

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
⊢ (fun s => ⨆ (_ : Set.Nonempty s), m s) = m

Next tactic:
ext1 t
theorem boundedBy_eq_ofFunction (m_empty : m ∅ = 0) (s : Set α) :
    boundedBy m s = OuterMeasure.ofFunction m m_empty s := by
  have : (fun s : Set α => ⨆ _ : s.Nonempty, m s) = m := by
    ext1 t
    

Proof state:
case h
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s t : Set α
⊢ ⨆ (_ : Set.Nonempty t), m t = m t

Next tactic:
rcases t.eq_empty_or_nonempty with h | h
theorem boundedBy_eq_ofFunction (m_empty : m ∅ = 0) (s : Set α) :
    boundedBy m s = OuterMeasure.ofFunction m m_empty s := by
  have : (fun s : Set α => ⨆ _ : s.Nonempty, m s) = m := by
    ext1 t
    rcases t.eq_empty_or_nonempty with h | h <;> 

Proof state:
case h.inl
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s t : Set α
h : t = ∅
⊢ ⨆ (_ : Set.Nonempty t), m t = m t

Next tactic:
simp [h, Set.not_nonempty_empty, m_empty]
theorem boundedBy_eq_ofFunction (m_empty : m ∅ = 0) (s : Set α) :
    boundedBy m s = OuterMeasure.ofFunction m m_empty s := by
  have : (fun s : Set α => ⨆ _ : s.Nonempty, m s) = m := by
    ext1 t
    rcases t.eq_empty_or_nonempty with h | h <;> 

Proof state:
case h.inr
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s t : Set α
h : Set.Nonempty t
⊢ ⨆ (_ : Set.Nonempty t), m t = m t

Next tactic:
simp [h, Set.not_nonempty_empty, m_empty]
theorem boundedBy_eq_ofFunction (m_empty : m ∅ = 0) (s : Set α) :
    boundedBy m s = OuterMeasure.ofFunction m m_empty s := by
  have : (fun s : Set α => ⨆ _ : s.Nonempty, m s) = m := by
    ext1 t
    rcases t.eq_empty_or_nonempty with h | h <;> simp [h, Set.not_nonempty_empty, m_empty]
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
m_empty : m ∅ = 0
s : Set α
this : (fun s => ⨆ (_ : Set.Nonempty s), m s) = m
⊢ ↑(boundedBy m) s = ↑(OuterMeasure.ofFunction m m_empty) s

Next tactic:
simp [boundedBy, this]
theorem boundedBy_apply (s : Set α) :
    boundedBy m s = ⨅ (t : ℕ → Set α) (_ : s ⊆ iUnion t),
                      ∑' n, ⨆ _ : (t n).Nonempty, m (t n) := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
s : Set α
⊢ ↑(boundedBy m) s = ⨅ t, ⨅ (_ : s ⊆ iUnion t), ∑' (n : ℕ), ⨆ (_ : Set.Nonempty (t n)), m (t n)

Next tactic:
simp [boundedBy, ofFunction_apply]
theorem boundedBy_eq (s : Set α) (m_empty : m ∅ = 0) (m_mono : ∀ ⦃t : Set α⦄, s ⊆ t → m s ≤ m t)
    (m_subadd : ∀ s : ℕ → Set α, m (⋃ i, s i) ≤ ∑' i, m (s i)) : boundedBy m s = m s := by
  

Proof state:
α : Type u_1
m : Set α → ℝ≥0∞
s : Set α
m_empty : m ∅ = 0
m_mono : ∀ ⦃t : Set α⦄, s ⊆ t → m s ≤ m t
m_subadd : ∀ (s : ℕ → Set α), m (⋃ i, s i) ≤ ∑' (i : ℕ), m (s i)
⊢ ↑(boundedBy m) s = m s

Next tactic:
rw [boundedBy_eq_ofFunction m_empty, ofFunction_eq s m_mono m_subadd]
theorem le_boundedBy {μ : OuterMeasure α} : μ ≤ boundedBy m ↔ ∀ s, μ s ≤ m s := by
  

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

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

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

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

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

Next tactic:
rcases s.eq_empty_or_nonempty with h | h
theorem le_boundedBy {μ : OuterMeasure α} : μ ≤ boundedBy m ↔ ∀ s, μ s ≤ m s := by
  rw [boundedBy , le_ofFunction, 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 ≤ ⨆ (_ : Set.Nonempty s), m s ↔ ↑μ s ≤ m s

Next tactic:
simp [h, Set.not_nonempty_empty]
theorem le_boundedBy {μ : OuterMeasure α} : μ ≤ boundedBy m ↔ ∀ s, μ s ≤ m s := by
  rw [boundedBy , le_ofFunction, 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 ≤ ⨆ (_ : Set.Nonempty s), m s ↔ ↑μ s ≤ m s

Next tactic:
simp [h, Set.not_nonempty_empty]