l3lab/ntp-mathlib huggingface dataset:
/-- If `s` is closed, being locally integrable on `s` wrt `μ` is equivalent to being locally
integrable with respect to `μ.restrict s`. For the one-way implication without assuming `s` closed,
see `locallyIntegrableOn_of_locallyIntegrable_restrict`. -/
theorem locallyIntegrableOn_iff_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hs : IsClosed s) : LocallyIntegrableOn f s μ ↔ LocallyIntegrable f (μ.restrict s) := by
  refine' ⟨fun hf x => _, locallyIntegrableOn_of_locallyIntegrable_restrict⟩
  by_cases h : x ∈ s
  · obtain ⟨t, ht_nhds, ht_int⟩ := hf x h
    obtain ⟨u, hu_o, hu_x, hu_sub⟩ := mem_nhdsWithin.mp ht_nhds
    refine' ⟨u, hu_o.mem_nhds hu_x, _⟩
    rw [IntegrableOn, restrict_restrict hu_o.measurableSet]
    exact ht_int.mono_set hu_sub
  · 

Proof state:
case neg
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : OpensMeasurableSpace X
hs : IsClosed s
hf : LocallyIntegrableOn f s
x : X
h : x ∉ s
⊢ IntegrableAtFilter f (𝓝 x)

Next tactic:
rw [← isOpen_compl_iff] at hs
/-- If `s` is closed, being locally integrable on `s` wrt `μ` is equivalent to being locally
integrable with respect to `μ.restrict s`. For the one-way implication without assuming `s` closed,
see `locallyIntegrableOn_of_locallyIntegrable_restrict`. -/
theorem locallyIntegrableOn_iff_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hs : IsClosed s) : LocallyIntegrableOn f s μ ↔ LocallyIntegrable f (μ.restrict s) := by
  refine' ⟨fun hf x => _, locallyIntegrableOn_of_locallyIntegrable_restrict⟩
  by_cases h : x ∈ s
  · obtain ⟨t, ht_nhds, ht_int⟩ := hf x h
    obtain ⟨u, hu_o, hu_x, hu_sub⟩ := mem_nhdsWithin.mp ht_nhds
    refine' ⟨u, hu_o.mem_nhds hu_x, _⟩
    rw [IntegrableOn, restrict_restrict hu_o.measurableSet]
    exact ht_int.mono_set hu_sub
  · rw [← isOpen_compl_iff] at hs
    

Proof state:
case neg
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : OpensMeasurableSpace X
hs : IsOpen sᶜ
hf : LocallyIntegrableOn f s
x : X
h : x ∉ s
⊢ IntegrableAtFilter f (𝓝 x)

Next tactic:
refine' ⟨sᶜ, hs.mem_nhds h, _⟩
/-- If `s` is closed, being locally integrable on `s` wrt `μ` is equivalent to being locally
integrable with respect to `μ.restrict s`. For the one-way implication without assuming `s` closed,
see `locallyIntegrableOn_of_locallyIntegrable_restrict`. -/
theorem locallyIntegrableOn_iff_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hs : IsClosed s) : LocallyIntegrableOn f s μ ↔ LocallyIntegrable f (μ.restrict s) := by
  refine' ⟨fun hf x => _, locallyIntegrableOn_of_locallyIntegrable_restrict⟩
  by_cases h : x ∈ s
  · obtain ⟨t, ht_nhds, ht_int⟩ := hf x h
    obtain ⟨u, hu_o, hu_x, hu_sub⟩ := mem_nhdsWithin.mp ht_nhds
    refine' ⟨u, hu_o.mem_nhds hu_x, _⟩
    rw [IntegrableOn, restrict_restrict hu_o.measurableSet]
    exact ht_int.mono_set hu_sub
  · rw [← isOpen_compl_iff] at hs
    refine' ⟨sᶜ, hs.mem_nhds h, _⟩
    

Proof state:
case neg
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : OpensMeasurableSpace X
hs : IsOpen sᶜ
hf : LocallyIntegrableOn f s
x : X
h : x ∉ s
⊢ IntegrableOn f sᶜ

Next tactic:
rw [IntegrableOn, restrict_restrict, inter_comm, inter_compl_self, ← IntegrableOn]
/-- If `s` is closed, being locally integrable on `s` wrt `μ` is equivalent to being locally
integrable with respect to `μ.restrict s`. For the one-way implication without assuming `s` closed,
see `locallyIntegrableOn_of_locallyIntegrable_restrict`. -/
theorem locallyIntegrableOn_iff_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hs : IsClosed s) : LocallyIntegrableOn f s μ ↔ LocallyIntegrable f (μ.restrict s) := by
  refine' ⟨fun hf x => _, locallyIntegrableOn_of_locallyIntegrable_restrict⟩
  by_cases h : x ∈ s
  · obtain ⟨t, ht_nhds, ht_int⟩ := hf x h
    obtain ⟨u, hu_o, hu_x, hu_sub⟩ := mem_nhdsWithin.mp ht_nhds
    refine' ⟨u, hu_o.mem_nhds hu_x, _⟩
    rw [IntegrableOn, restrict_restrict hu_o.measurableSet]
    exact ht_int.mono_set hu_sub
  · rw [← isOpen_compl_iff] at hs
    refine' ⟨sᶜ, hs.mem_nhds h, _⟩
    rw [IntegrableOn, restrict_restrict, inter_comm, inter_compl_self, ← IntegrableOn]
    

Proof state:
case neg
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : OpensMeasurableSpace X
hs : IsOpen sᶜ
hf : LocallyIntegrableOn f s
x : X
h : x ∉ s
⊢ IntegrableOn f ∅
case neg
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : OpensMeasurableSpace X
hs : IsOpen sᶜ
hf : LocallyIntegrableOn f s
x : X
h : x ∉ s
⊢ MeasurableSet sᶜ

Next tactic:
exacts [integrableOn_empty, hs.measurableSet]
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  

Proof state:
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
⊢ ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u

Next tactic:
refine' IsCompact.induction_on hk _ _ _ _
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · 

Proof state:
case refine'_1
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
⊢ ∃ u, IsOpen u ∧ ∅ ⊆ u ∧ IntegrableOn f u

Next tactic:
refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
  · 

Proof state:
case refine'_2
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
⊢ ∀ ⦃s t : Set X⦄, s ⊆ t → (∃ u, IsOpen u ∧ t ⊆ u ∧ IntegrableOn f u) → ∃ u, IsOpen u ∧ s ⊆ u ∧ IntegrableOn f u

Next tactic:
rintro s t hst ⟨u, u_open, tu, hu⟩
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
  · rintro s t hst ⟨u, u_open, tu, hu⟩
    

Proof state:
case refine'_2.intro.intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s✝ : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
s t : Set X
hst : s ⊆ t
u : Set X
u_open : IsOpen u
tu : t ⊆ u
hu : IntegrableOn f u
⊢ ∃ u, IsOpen u ∧ s ⊆ u ∧ IntegrableOn f u

Next tactic:
exact ⟨u, u_open, hst.trans tu, hu⟩
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
  · rintro s t hst ⟨u, u_open, tu, hu⟩
    exact ⟨u, u_open, hst.trans tu, hu⟩
  · 

Proof state:
case refine'_3
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
⊢ ∀ ⦃s t : Set X⦄,
    (∃ u, IsOpen u ∧ s ⊆ u ∧ IntegrableOn f u) →
      (∃ u, IsOpen u ∧ t ⊆ u ∧ IntegrableOn f u) → ∃ u, IsOpen u ∧ s ∪ t ⊆ u ∧ IntegrableOn f u

Next tactic:
rintro s t ⟨u, u_open, su, hu⟩ ⟨v, v_open, tv, hv⟩
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
  · rintro s t hst ⟨u, u_open, tu, hu⟩
    exact ⟨u, u_open, hst.trans tu, hu⟩
  · rintro s t ⟨u, u_open, su, hu⟩ ⟨v, v_open, tv, hv⟩
    

Proof state:
case refine'_3.intro.intro.intro.intro.intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s✝ : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
s t u : Set X
u_open : IsOpen u
su : s ⊆ u
hu : IntegrableOn f u
v : Set X
v_open : IsOpen v
tv : t ⊆ v
hv : IntegrableOn f v
⊢ ∃ u, IsOpen u ∧ s ∪ t ⊆ u ∧ IntegrableOn f u

Next tactic:
exact ⟨u ∪ v, u_open.union v_open, union_subset_union su tv, hu.union hv⟩
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
  · rintro s t hst ⟨u, u_open, tu, hu⟩
    exact ⟨u, u_open, hst.trans tu, hu⟩
  · rintro s t ⟨u, u_open, su, hu⟩ ⟨v, v_open, tv, hv⟩
    exact ⟨u ∪ v, u_open.union v_open, union_subset_union su tv, hu.union hv⟩
  · 

Proof state:
case refine'_4
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
⊢ ∀ x ∈ k, ∃ t ∈ 𝓝[k] x, ∃ u, IsOpen u ∧ t ⊆ u ∧ IntegrableOn f u

Next tactic:
intro x _
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
  · rintro s t hst ⟨u, u_open, tu, hu⟩
    exact ⟨u, u_open, hst.trans tu, hu⟩
  · rintro s t ⟨u, u_open, su, hu⟩ ⟨v, v_open, tv, hv⟩
    exact ⟨u ∪ v, u_open.union v_open, union_subset_union su tv, hu.union hv⟩
  · intro x _
    

Proof state:
case refine'_4
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
x : X
a✝ : x ∈ k
⊢ ∃ t ∈ 𝓝[k] x, ∃ u, IsOpen u ∧ t ⊆ u ∧ IntegrableOn f u

Next tactic:
rcases hf x with ⟨u, ux, hu⟩
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
  · rintro s t hst ⟨u, u_open, tu, hu⟩
    exact ⟨u, u_open, hst.trans tu, hu⟩
  · rintro s t ⟨u, u_open, su, hu⟩ ⟨v, v_open, tv, hv⟩
    exact ⟨u ∪ v, u_open.union v_open, union_subset_union su tv, hu.union hv⟩
  · intro x _
    rcases hf x with ⟨u, ux, hu⟩
    

Proof state:
case refine'_4.intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
x : X
a✝ : x ∈ k
u : Set X
ux : u ∈ 𝓝 x
hu : IntegrableOn f u
⊢ ∃ t ∈ 𝓝[k] x, ∃ u, IsOpen u ∧ t ⊆ u ∧ IntegrableOn f u

Next tactic:
rcases mem_nhds_iff.1 ux with ⟨v, vu, v_open, xv⟩
/-- If a function is locally integrable, then it is integrable on an open neighborhood of any
compact set. -/
theorem LocallyIntegrable.integrableOn_nhds_isCompact (hf : LocallyIntegrable f μ) {k : Set X}
    (hk : IsCompact k) : ∃ u, IsOpen u ∧ k ⊆ u ∧ IntegrableOn f u μ := by
  refine' IsCompact.induction_on hk _ _ _ _
  · refine' ⟨∅, isOpen_empty, Subset.rfl, integrableOn_empty⟩
  · rintro s t hst ⟨u, u_open, tu, hu⟩
    exact ⟨u, u_open, hst.trans tu, hu⟩
  · rintro s t ⟨u, u_open, su, hu⟩ ⟨v, v_open, tv, hv⟩
    exact ⟨u ∪ v, u_open.union v_open, union_subset_union su tv, hu.union hv⟩
  · intro x _
    rcases hf x with ⟨u, ux, hu⟩
    rcases mem_nhds_iff.1 ux with ⟨v, vu, v_open, xv⟩
    

Proof state:
case refine'_4.intro.intro.intro.intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁵ : MeasurableSpace X
inst✝⁴ : TopologicalSpace X
inst✝³ : MeasurableSpace Y
inst✝² : TopologicalSpace Y
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
hf : LocallyIntegrable f
k : Set X
hk : IsCompact k
x : X
a✝ : x ∈ k
u : Set X
ux : u ∈ 𝓝 x
hu : IntegrableOn f u
v : Set X
vu : v ⊆ u
v_open : IsOpen v
xv : x ∈ v
⊢ ∃ t ∈ 𝓝[k] x, ∃ u, IsOpen u ∧ t ⊆ u ∧ IntegrableOn f u

Next tactic:
exact ⟨v, nhdsWithin_le_nhds (v_open.mem_nhds xv), v, v_open, Subset.rfl, hu.mono_set vu⟩
theorem LocallyIntegrable.aestronglyMeasurable [SecondCountableTopology X]
    (hf : LocallyIntegrable f μ) : AEStronglyMeasurable f μ := by
  

Proof state:
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : SecondCountableTopology X
hf : LocallyIntegrable f
⊢ AEStronglyMeasurable f μ

Next tactic:
simpa only [restrict_univ] using (locallyIntegrableOn_univ.mpr hf).aestronglyMeasurable
/-- If a function is locally integrable in a second countable topological space,
then there exists a sequence of open sets covering the space on which it is integrable. -/
theorem LocallyIntegrable.exists_nat_integrableOn [SecondCountableTopology X]
    (hf : LocallyIntegrable f μ) : ∃ u : ℕ → Set X,
    (∀ n, IsOpen (u n)) ∧ ((⋃ n, u n) = univ) ∧ (∀ n, IntegrableOn f (u n) μ) := by
  

Proof state:
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : SecondCountableTopology X
hf : LocallyIntegrable f
⊢ ∃ u, (∀ (n : ℕ), IsOpen (u n)) ∧ ⋃ n, u n = univ ∧ ∀ (n : ℕ), IntegrableOn f (u n)

Next tactic:
rcases (hf.locallyIntegrableOn univ).exists_nat_integrableOn with ⟨u, u_open, u_union, hu⟩
/-- If a function is locally integrable in a second countable topological space,
then there exists a sequence of open sets covering the space on which it is integrable. -/
theorem LocallyIntegrable.exists_nat_integrableOn [SecondCountableTopology X]
    (hf : LocallyIntegrable f μ) : ∃ u : ℕ → Set X,
    (∀ n, IsOpen (u n)) ∧ ((⋃ n, u n) = univ) ∧ (∀ n, IntegrableOn f (u n) μ) := by
  rcases (hf.locallyIntegrableOn univ).exists_nat_integrableOn with ⟨u, u_open, u_union, hu⟩
  

Proof state:
case intro.intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : SecondCountableTopology X
hf : LocallyIntegrable f
u : ℕ → Set X
u_open : ∀ (n : ℕ), IsOpen (u n)
u_union : univ ⊆ ⋃ n, u n
hu : ∀ (n : ℕ), IntegrableOn f (u n ∩ univ)
⊢ ∃ u, (∀ (n : ℕ), IsOpen (u n)) ∧ ⋃ n, u n = univ ∧ ∀ (n : ℕ), IntegrableOn f (u n)

Next tactic:
refine' ⟨u, u_open, eq_univ_of_univ_subset u_union, fun n ↦ _⟩
/-- If a function is locally integrable in a second countable topological space,
then there exists a sequence of open sets covering the space on which it is integrable. -/
theorem LocallyIntegrable.exists_nat_integrableOn [SecondCountableTopology X]
    (hf : LocallyIntegrable f μ) : ∃ u : ℕ → Set X,
    (∀ n, IsOpen (u n)) ∧ ((⋃ n, u n) = univ) ∧ (∀ n, IntegrableOn f (u n) μ) := by
  rcases (hf.locallyIntegrableOn univ).exists_nat_integrableOn with ⟨u, u_open, u_union, hu⟩
  refine' ⟨u, u_open, eq_univ_of_univ_subset u_union, fun n ↦ _⟩
  

Proof state:
case intro.intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f g : X → E
μ : Measure X
s : Set X
inst✝ : SecondCountableTopology X
hf : LocallyIntegrable f
u : ℕ → Set X
u_open : ∀ (n : ℕ), IsOpen (u n)
u_union : univ ⊆ ⋃ n, u n
hu : ∀ (n : ℕ), IntegrableOn f (u n ∩ univ)
n : ℕ
⊢ IntegrableOn f (u n)

Next tactic:
simpa only [inter_univ] using hu n
theorem Memℒp.locallyIntegrable [IsLocallyFiniteMeasure μ] {f : X → E} {p : ℝ≥0∞}
    (hf : Memℒp f p μ) (hp : 1 ≤ p) : LocallyIntegrable f μ := by
  

Proof state:
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f✝ g : X → E
μ : Measure X
s : Set X
inst✝ : IsLocallyFiniteMeasure μ
f : X → E
p : ℝ≥0∞
hf : Memℒp f p
hp : 1 ≤ p
⊢ LocallyIntegrable f

Next tactic:
intro x
theorem Memℒp.locallyIntegrable [IsLocallyFiniteMeasure μ] {f : X → E} {p : ℝ≥0∞}
    (hf : Memℒp f p μ) (hp : 1 ≤ p) : LocallyIntegrable f μ := by
  intro x
  

Proof state:
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f✝ g : X → E
μ : Measure X
s : Set X
inst✝ : IsLocallyFiniteMeasure μ
f : X → E
p : ℝ≥0∞
hf : Memℒp f p
hp : 1 ≤ p
x : X
⊢ IntegrableAtFilter f (𝓝 x)

Next tactic:
rcases μ.finiteAt_nhds x with ⟨U, hU, h'U⟩
theorem Memℒp.locallyIntegrable [IsLocallyFiniteMeasure μ] {f : X → E} {p : ℝ≥0∞}
    (hf : Memℒp f p μ) (hp : 1 ≤ p) : LocallyIntegrable f μ := by
  intro x
  rcases μ.finiteAt_nhds x with ⟨U, hU, h'U⟩
  

Proof state:
case intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f✝ g : X → E
μ : Measure X
s : Set X
inst✝ : IsLocallyFiniteMeasure μ
f : X → E
p : ℝ≥0∞
hf : Memℒp f p
hp : 1 ≤ p
x : X
U : Set X
hU : U ∈ 𝓝 x
h'U : ↑↑μ U < ⊤
⊢ IntegrableAtFilter f (𝓝 x)

Next tactic:
have : Fact (μ U < ⊤) := ⟨h'U⟩
theorem Memℒp.locallyIntegrable [IsLocallyFiniteMeasure μ] {f : X → E} {p : ℝ≥0∞}
    (hf : Memℒp f p μ) (hp : 1 ≤ p) : LocallyIntegrable f μ := by
  intro x
  rcases μ.finiteAt_nhds x with ⟨U, hU, h'U⟩
  have : Fact (μ U < ⊤) := ⟨h'U⟩
  

Proof state:
case intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f✝ g : X → E
μ : Measure X
s : Set X
inst✝ : IsLocallyFiniteMeasure μ
f : X → E
p : ℝ≥0∞
hf : Memℒp f p
hp : 1 ≤ p
x : X
U : Set X
hU : U ∈ 𝓝 x
h'U : ↑↑μ U < ⊤
this : Fact (↑↑μ U < ⊤)
⊢ IntegrableAtFilter f (𝓝 x)

Next tactic:
refine' ⟨U, hU, _⟩
theorem Memℒp.locallyIntegrable [IsLocallyFiniteMeasure μ] {f : X → E} {p : ℝ≥0∞}
    (hf : Memℒp f p μ) (hp : 1 ≤ p) : LocallyIntegrable f μ := by
  intro x
  rcases μ.finiteAt_nhds x with ⟨U, hU, h'U⟩
  have : Fact (μ U < ⊤) := ⟨h'U⟩
  refine' ⟨U, hU, _⟩
  

Proof state:
case intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f✝ g : X → E
μ : Measure X
s : Set X
inst✝ : IsLocallyFiniteMeasure μ
f : X → E
p : ℝ≥0∞
hf : Memℒp f p
hp : 1 ≤ p
x : X
U : Set X
hU : U ∈ 𝓝 x
h'U : ↑↑μ U < ⊤
this : Fact (↑↑μ U < ⊤)
⊢ IntegrableOn f U

Next tactic:
rw [IntegrableOn, ← memℒp_one_iff_integrable]
theorem Memℒp.locallyIntegrable [IsLocallyFiniteMeasure μ] {f : X → E} {p : ℝ≥0∞}
    (hf : Memℒp f p μ) (hp : 1 ≤ p) : LocallyIntegrable f μ := by
  intro x
  rcases μ.finiteAt_nhds x with ⟨U, hU, h'U⟩
  have : Fact (μ U < ⊤) := ⟨h'U⟩
  refine' ⟨U, hU, _⟩
  rw [IntegrableOn, ← memℒp_one_iff_integrable]
  

Proof state:
case intro.intro
X : Type u_1
Y : Type u_2
E : Type u_3
F : Type u_4
R : Type u_5
inst✝⁶ : MeasurableSpace X
inst✝⁵ : TopologicalSpace X
inst✝⁴ : MeasurableSpace Y
inst✝³ : TopologicalSpace Y
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
f✝ g : X → E
μ : Measure X
s : Set X
inst✝ : IsLocallyFiniteMeasure μ
f : X → E
p : ℝ≥0∞
hf : Memℒp f p
hp : 1 ≤ p
x : X
U : Set X
hU : U ∈ 𝓝 x
h'U : ↑↑μ U < ⊤
this : Fact (↑↑μ U < ⊤)
⊢ Memℒp f 1

Next tactic:
apply (hf.restrict U).memℒp_of_exponent_le hp