l3lab/ntp-mathlib huggingface dataset:
/-- If `s` is either open, or closed, then `f` is locally integrable on `s` iff it is integrable on
every compact subset contained in `s`. -/
theorem locallyIntegrableOn_iff [LocallyCompactSpace X] [T2Space X] (hs : IsClosed s ∨ IsOpen s) :
    LocallyIntegrableOn f s μ ↔ ∀ (k : Set X), k ⊆ s → (IsCompact k → IntegrableOn f k μ) := by
  -- The correct condition is that `s` be *locally closed*, i.e. for every `x ∈ s` there is some
  -- `U ∈ 𝓝 x` such that `U ∩ s` is closed. But mathlib doesn't have locally closed sets yet.
  refine' ⟨fun hf k hk => hf.integrableOn_compact_subset hk, fun hf x hx => _⟩
  cases hs with
  | inl hs =>
    

Proof state:
case inl
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✝¹ : LocallyCompactSpace X
inst✝ : T2Space X
hf : ∀ k ⊆ s, IsCompact k → IntegrableOn f k
x : X
hx : x ∈ s
hs : IsClosed s
⊢ IntegrableAtFilter f (𝓝[s] x)

Next tactic:
exact
      let ⟨K, hK, h2K⟩ := exists_compact_mem_nhds x
      ⟨_, inter_mem_nhdsWithin s h2K,
        hf _ (inter_subset_left _ _)
          (hK.of_isClosed_subset (hs.inter hK.isClosed) (inter_subset_right _ _))⟩
/-- If `s` is either open, or closed, then `f` is locally integrable on `s` iff it is integrable on
every compact subset contained in `s`. -/
theorem locallyIntegrableOn_iff [LocallyCompactSpace X] [T2Space X] (hs : IsClosed s ∨ IsOpen s) :
    LocallyIntegrableOn f s μ ↔ ∀ (k : Set X), k ⊆ s → (IsCompact k → IntegrableOn f k μ) := by
  -- The correct condition is that `s` be *locally closed*, i.e. for every `x ∈ s` there is some
  -- `U ∈ 𝓝 x` such that `U ∩ s` is closed. But mathlib doesn't have locally closed sets yet.
  refine' ⟨fun hf k hk => hf.integrableOn_compact_subset hk, fun hf x hx => _⟩
  cases hs with
  | inl hs =>
    exact
      let ⟨K, hK, h2K⟩ := exists_compact_mem_nhds x
      ⟨_, inter_mem_nhdsWithin s h2K,
        hf _ (inter_subset_left _ _)
          (hK.of_isClosed_subset (hs.inter hK.isClosed) (inter_subset_right _ _))⟩
  

Proof state:
case inr
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✝¹ : LocallyCompactSpace X
inst✝ : T2Space X
hf : ∀ k ⊆ s, IsCompact k → IntegrableOn f k
x : X
hx : x ∈ s
hs : IsOpen s
⊢ IntegrableAtFilter f (𝓝[s] x)

Next tactic:
| inr hs =>
    obtain ⟨K, hK, h2K, h3K⟩ := exists_compact_subset hs hx
    refine' ⟨K, _, hf K h3K hK⟩
    simpa only [IsOpen.nhdsWithin_eq hs hx, interior_eq_nhds'] using h2K
/-- If `s` is either open, or closed, then `f` is locally integrable on `s` iff it is integrable on
every compact subset contained in `s`. -/
theorem locallyIntegrableOn_iff [LocallyCompactSpace X] [T2Space X] (hs : IsClosed s ∨ IsOpen s) :
    LocallyIntegrableOn f s μ ↔ ∀ (k : Set X), k ⊆ s → (IsCompact k → IntegrableOn f k μ) := by
  -- The correct condition is that `s` be *locally closed*, i.e. for every `x ∈ s` there is some
  -- `U ∈ 𝓝 x` such that `U ∩ s` is closed. But mathlib doesn't have locally closed sets yet.
  refine' ⟨fun hf k hk => hf.integrableOn_compact_subset hk, fun hf x hx => _⟩
  cases hs with
  | inl hs =>
    exact
      let ⟨K, hK, h2K⟩ := exists_compact_mem_nhds x
      ⟨_, inter_mem_nhdsWithin s h2K,
        hf _ (inter_subset_left _ _)
          (hK.of_isClosed_subset (hs.inter hK.isClosed) (inter_subset_right _ _))⟩
  | inr hs =>
    

Proof state:
case inr
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✝¹ : LocallyCompactSpace X
inst✝ : T2Space X
hf : ∀ k ⊆ s, IsCompact k → IntegrableOn f k
x : X
hx : x ∈ s
hs : IsOpen s
⊢ IntegrableAtFilter f (𝓝[s] x)

Next tactic:
obtain ⟨K, hK, h2K, h3K⟩ := exists_compact_subset hs hx
/-- If `s` is either open, or closed, then `f` is locally integrable on `s` iff it is integrable on
every compact subset contained in `s`. -/
theorem locallyIntegrableOn_iff [LocallyCompactSpace X] [T2Space X] (hs : IsClosed s ∨ IsOpen s) :
    LocallyIntegrableOn f s μ ↔ ∀ (k : Set X), k ⊆ s → (IsCompact k → IntegrableOn f k μ) := by
  -- The correct condition is that `s` be *locally closed*, i.e. for every `x ∈ s` there is some
  -- `U ∈ 𝓝 x` such that `U ∩ s` is closed. But mathlib doesn't have locally closed sets yet.
  refine' ⟨fun hf k hk => hf.integrableOn_compact_subset hk, fun hf x hx => _⟩
  cases hs with
  | inl hs =>
    exact
      let ⟨K, hK, h2K⟩ := exists_compact_mem_nhds x
      ⟨_, inter_mem_nhdsWithin s h2K,
        hf _ (inter_subset_left _ _)
          (hK.of_isClosed_subset (hs.inter hK.isClosed) (inter_subset_right _ _))⟩
  | inr hs =>
    obtain ⟨K, hK, h2K, h3K⟩ := exists_compact_subset hs hx
    

Proof state:
case inr.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✝¹ : LocallyCompactSpace X
inst✝ : T2Space X
hf : ∀ k ⊆ s, IsCompact k → IntegrableOn f k
x : X
hx : x ∈ s
hs : IsOpen s
K : Set X
hK : IsCompact K
h2K : x ∈ interior K
h3K : K ⊆ s
⊢ IntegrableAtFilter f (𝓝[s] x)

Next tactic:
refine' ⟨K, _, hf K h3K hK⟩
/-- If `s` is either open, or closed, then `f` is locally integrable on `s` iff it is integrable on
every compact subset contained in `s`. -/
theorem locallyIntegrableOn_iff [LocallyCompactSpace X] [T2Space X] (hs : IsClosed s ∨ IsOpen s) :
    LocallyIntegrableOn f s μ ↔ ∀ (k : Set X), k ⊆ s → (IsCompact k → IntegrableOn f k μ) := by
  -- The correct condition is that `s` be *locally closed*, i.e. for every `x ∈ s` there is some
  -- `U ∈ 𝓝 x` such that `U ∩ s` is closed. But mathlib doesn't have locally closed sets yet.
  refine' ⟨fun hf k hk => hf.integrableOn_compact_subset hk, fun hf x hx => _⟩
  cases hs with
  | inl hs =>
    exact
      let ⟨K, hK, h2K⟩ := exists_compact_mem_nhds x
      ⟨_, inter_mem_nhdsWithin s h2K,
        hf _ (inter_subset_left _ _)
          (hK.of_isClosed_subset (hs.inter hK.isClosed) (inter_subset_right _ _))⟩
  | inr hs =>
    obtain ⟨K, hK, h2K, h3K⟩ := exists_compact_subset hs hx
    refine' ⟨K, _, hf K h3K hK⟩
    

Proof state:
case inr.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✝¹ : LocallyCompactSpace X
inst✝ : T2Space X
hf : ∀ k ⊆ s, IsCompact k → IntegrableOn f k
x : X
hx : x ∈ s
hs : IsOpen s
K : Set X
hK : IsCompact K
h2K : x ∈ interior K
h3K : K ⊆ s
⊢ K ∈ 𝓝[s] x

Next tactic:
simpa only [IsOpen.nhdsWithin_eq hs hx, interior_eq_nhds'] using h2K
theorem locallyIntegrable_comap (hs : MeasurableSet s) :
    LocallyIntegrable (fun x : s ↦ f x) (μ.comap Subtype.val) ↔ LocallyIntegrableOn f s μ := 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
hs : MeasurableSet s
⊢ (LocallyIntegrable fun x => f ↑x) ↔ LocallyIntegrableOn f s

Next tactic:
simp_rw [LocallyIntegrableOn, Subtype.forall', ← map_nhds_subtype_val]
theorem locallyIntegrable_comap (hs : MeasurableSet s) :
    LocallyIntegrable (fun x : s ↦ f x) (μ.comap Subtype.val) ↔ LocallyIntegrableOn f s μ := by
  simp_rw [LocallyIntegrableOn, Subtype.forall', ← map_nhds_subtype_val]
  

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
hs : MeasurableSet s
⊢ (LocallyIntegrable fun x => f ↑x) ↔ ∀ (x : { a // a ∈ s }), IntegrableAtFilter f (Filter.map Subtype.val (𝓝 x))

Next tactic:
exact forall_congr' fun _ ↦ (MeasurableEmbedding.subtype_coe hs).integrableAtFilter_iff_comap.symm
theorem locallyIntegrableOn_univ : LocallyIntegrableOn f univ μ ↔ 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
⊢ LocallyIntegrableOn f univ ↔ LocallyIntegrable f

Next tactic:
simp only [LocallyIntegrableOn, nhdsWithin_univ, mem_univ, true_imp_iff]
theorem locallyIntegrableOn_univ : LocallyIntegrableOn f univ μ ↔ LocallyIntegrable f μ := by
  simp only [LocallyIntegrableOn, nhdsWithin_univ, mem_univ, true_imp_iff]; 

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
⊢ (∀ (x : X), IntegrableAtFilter f (𝓝 x)) ↔ LocallyIntegrable f

Next tactic:
rfl
theorem LocallyIntegrable.mono (hf : LocallyIntegrable f μ) {g : X → F}
    (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ x ∂μ, ‖g x‖ ≤ ‖f x‖) :
    LocallyIntegrable g μ := 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
g : X → F
hg : AEStronglyMeasurable g μ
h : ∀ᵐ (x : X) ∂μ, ‖g x‖ ≤ ‖f x‖
⊢ LocallyIntegrable g

Next tactic:
rw [← locallyIntegrableOn_univ] at hf ⊢
theorem LocallyIntegrable.mono (hf : LocallyIntegrable f μ) {g : X → F}
    (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ x ∂μ, ‖g x‖ ≤ ‖f x‖) :
    LocallyIntegrable g μ := by
  rw [← locallyIntegrableOn_univ] at hf ⊢
  

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 : LocallyIntegrableOn f univ
g : X → F
hg : AEStronglyMeasurable g μ
h : ∀ᵐ (x : X) ∂μ, ‖g x‖ ≤ ‖f x‖
⊢ LocallyIntegrableOn g univ

Next tactic:
exact hf.mono hg h
/-- If `f` is locally integrable with respect to `μ.restrict s`, it is locally integrable on `s`.
(See `locallyIntegrableOn_iff_locallyIntegrable_restrict` for an iff statement when `s` is
closed.) -/
theorem locallyIntegrableOn_of_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hf : LocallyIntegrable f (μ.restrict s)) : LocallyIntegrableOn f s μ := 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✝ : OpensMeasurableSpace X
hf : LocallyIntegrable f
⊢ LocallyIntegrableOn f s

Next tactic:
intro x _
/-- If `f` is locally integrable with respect to `μ.restrict s`, it is locally integrable on `s`.
(See `locallyIntegrableOn_iff_locallyIntegrable_restrict` for an iff statement when `s` is
closed.) -/
theorem locallyIntegrableOn_of_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hf : LocallyIntegrable f (μ.restrict s)) : LocallyIntegrableOn f s μ := 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✝ : OpensMeasurableSpace X
hf : LocallyIntegrable f
x : X
a✝ : x ∈ s
⊢ IntegrableAtFilter f (𝓝[s] x)

Next tactic:
obtain ⟨t, ht_mem, ht_int⟩ := hf x
/-- If `f` is locally integrable with respect to `μ.restrict s`, it is locally integrable on `s`.
(See `locallyIntegrableOn_iff_locallyIntegrable_restrict` for an iff statement when `s` is
closed.) -/
theorem locallyIntegrableOn_of_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hf : LocallyIntegrable f (μ.restrict s)) : LocallyIntegrableOn f s μ := by
  intro x _
  obtain ⟨t, ht_mem, ht_int⟩ := hf x
  

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✝ : OpensMeasurableSpace X
hf : LocallyIntegrable f
x : X
a✝ : x ∈ s
t : Set X
ht_mem : t ∈ 𝓝 x
ht_int : IntegrableOn f t
⊢ IntegrableAtFilter f (𝓝[s] x)

Next tactic:
obtain ⟨u, hu_sub, hu_o, hu_mem⟩ := mem_nhds_iff.mp ht_mem
/-- If `f` is locally integrable with respect to `μ.restrict s`, it is locally integrable on `s`.
(See `locallyIntegrableOn_iff_locallyIntegrable_restrict` for an iff statement when `s` is
closed.) -/
theorem locallyIntegrableOn_of_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hf : LocallyIntegrable f (μ.restrict s)) : LocallyIntegrableOn f s μ := by
  intro x _
  obtain ⟨t, ht_mem, ht_int⟩ := hf x
  obtain ⟨u, hu_sub, hu_o, hu_mem⟩ := mem_nhds_iff.mp ht_mem
  

Proof state:
case 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
inst✝ : OpensMeasurableSpace X
hf : LocallyIntegrable f
x : X
a✝ : x ∈ s
t : Set X
ht_mem : t ∈ 𝓝 x
ht_int : IntegrableOn f t
u : Set X
hu_sub : u ⊆ t
hu_o : IsOpen u
hu_mem : x ∈ u
⊢ IntegrableAtFilter f (𝓝[s] x)

Next tactic:
refine' ⟨_, inter_mem_nhdsWithin s (hu_o.mem_nhds hu_mem), _⟩
/-- If `f` is locally integrable with respect to `μ.restrict s`, it is locally integrable on `s`.
(See `locallyIntegrableOn_iff_locallyIntegrable_restrict` for an iff statement when `s` is
closed.) -/
theorem locallyIntegrableOn_of_locallyIntegrable_restrict [OpensMeasurableSpace X]
    (hf : LocallyIntegrable f (μ.restrict s)) : LocallyIntegrableOn f s μ := by
  intro x _
  obtain ⟨t, ht_mem, ht_int⟩ := hf x
  obtain ⟨u, hu_sub, hu_o, hu_mem⟩ := mem_nhds_iff.mp ht_mem
  refine' ⟨_, inter_mem_nhdsWithin s (hu_o.mem_nhds hu_mem), _⟩
  

Proof state:
case 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
inst✝ : OpensMeasurableSpace X
hf : LocallyIntegrable f
x : X
a✝ : x ∈ s
t : Set X
ht_mem : t ∈ 𝓝 x
ht_int : IntegrableOn f t
u : Set X
hu_sub : u ⊆ t
hu_o : IsOpen u
hu_mem : x ∈ u
⊢ IntegrableOn f (s ∩ u)

Next tactic:
simpa only [IntegrableOn, Measure.restrict_restrict hu_o.measurableSet, inter_comm] using
    ht_int.mono_set hu_sub
/-- 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
  

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✝ : OpensMeasurableSpace X
hs : IsClosed s
⊢ LocallyIntegrableOn f s ↔ LocallyIntegrable f

Next tactic:
refine' ⟨fun hf x => _, locallyIntegrableOn_of_locallyIntegrable_restrict⟩
/-- 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⟩
  

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✝ : OpensMeasurableSpace X
hs : IsClosed s
hf : LocallyIntegrableOn f s
x : X
⊢ IntegrableAtFilter f (𝓝 x)

Next tactic:
by_cases h : x ∈ s
/-- 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
  · 

Proof state:
case pos
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:
obtain ⟨t, ht_nhds, ht_int⟩ := hf x 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
    

Proof state:
case pos.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✝ : OpensMeasurableSpace X
hs : IsClosed s
hf : LocallyIntegrableOn f s
x : X
h : x ∈ s
t : Set X
ht_nhds : t ∈ 𝓝[s] x
ht_int : IntegrableOn f t
⊢ IntegrableAtFilter f (𝓝 x)

Next tactic:
obtain ⟨u, hu_o, hu_x, hu_sub⟩ := mem_nhdsWithin.mp ht_nhds
/-- 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
    

Proof state:
case pos.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
inst✝ : OpensMeasurableSpace X
hs : IsClosed s
hf : LocallyIntegrableOn f s
x : X
h : x ∈ s
t : Set X
ht_nhds : t ∈ 𝓝[s] x
ht_int : IntegrableOn f t
u : Set X
hu_o : IsOpen u
hu_x : x ∈ u
hu_sub : u ∩ s ⊆ t
⊢ IntegrableAtFilter f (𝓝 x)

Next tactic:
refine' ⟨u, hu_o.mem_nhds hu_x, _⟩
/-- 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, _⟩
    

Proof state:
case pos.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
inst✝ : OpensMeasurableSpace X
hs : IsClosed s
hf : LocallyIntegrableOn f s
x : X
h : x ∈ s
t : Set X
ht_nhds : t ∈ 𝓝[s] x
ht_int : IntegrableOn f t
u : Set X
hu_o : IsOpen u
hu_x : x ∈ u
hu_sub : u ∩ s ⊆ t
⊢ IntegrableOn f u

Next tactic:
rw [IntegrableOn, restrict_restrict hu_o.measurableSet]
/-- 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]
    

Proof state:
case pos.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
inst✝ : OpensMeasurableSpace X
hs : IsClosed s
hf : LocallyIntegrableOn f s
x : X
h : x ∈ s
t : Set X
ht_nhds : t ∈ 𝓝[s] x
ht_int : IntegrableOn f t
u : Set X
hu_o : IsOpen u
hu_x : x ∈ u
hu_sub : u ∩ s ⊆ t
⊢ Integrable f

Next tactic:
exact ht_int.mono_set hu_sub