Skip to content

Commit 787d627

Browse files
committed
generalize oscillation
1 parent 35a3c23 commit 787d627

1 file changed

Lines changed: 109 additions & 37 deletions

File tree

Mathlib/Analysis/Oscillation.lean

Lines changed: 109 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
/-
22
Copyright (c) 2024 James Sundstrom. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: James Sundstrom
4+
Authors: James Sundstrom, Lua Viana Reis
55
-/
66
module
77

88
public import Mathlib.Data.ENNReal.Real
99
public import Mathlib.Order.WellFoundedSet
1010
public import Mathlib.Topology.EMetricSpace.Diam
11+
public import Mathlib.Topology.UniformSpace.Cauchy
1112

1213
/-!
1314
# Oscillation
1415
15-
In this file we define the oscillation of a function `f: E → F` at a point `x` of `E`. (`E` is
16-
required to be a TopologicalSpace and `F` a PseudoEMetricSpace.) The oscillation of `f` at `x` is
17-
defined to be the infimum of `diam f '' N` for all neighborhoods `N` of `x`. We also define
18-
`oscillationWithin f D x`, which is the oscillation at `x` of `f` restricted to `D`.
16+
In this file we define the oscillation of a function `f: E → F` along a filter `l` of `E`. (`F` is
17+
required to be a PseudoEMetricSpace.) The oscillation of `f` at `l` is
18+
defined to be the infimum of `diam f '' N` for all sets `N` in `l`. We also define
19+
`oscillationWithin f D l`, which is the oscillation at `l` of `f` restricted to `D`.
1920
2021
We also prove some simple facts about oscillation, most notably that the oscillation of `f`
2122
at `x` is 0 if and only if `f` is continuous at `x`, with versions for both `oscillation` and
@@ -28,35 +29,39 @@ oscillation, oscillationWithin
2829

2930
@[expose] public section
3031

31-
open Topology Metric Set ENNReal
32+
open Topology Metric Set ENNReal Filter
3233

3334
universe u v
3435

3536
variable {E : Type u} {F : Type v} [PseudoEMetricSpace F]
3637

38+
/-- The oscillation of `f : E → F` along `l`. -/
39+
noncomputable def oscillation (f : E → F) (l : Filter E) : ENNReal :=
40+
⨅ S ∈ l.map f, ediam S
41+
3742
/-- The oscillation of `f : E → F` at `x`. -/
38-
noncomputable def oscillation [TopologicalSpace E] (f : E → F) (x : E) : ENNReal :=
39-
⨅ S ∈ (𝓝 x).map f, ediam S
43+
noncomputable abbrev oscillationAt [TopologicalSpace E] (f : E → F) (x : E) : ENNReal :=
44+
oscillation f (𝓝 x)
4045

4146
/-- The oscillation of `f : E → F` within `D` at `x`. -/
42-
noncomputable def oscillationWithin [TopologicalSpace E] (f : E → F) (D : Set E) (x : E) :
47+
noncomputable def oscillationWithinAt [TopologicalSpace E] (f : E → F) (D : Set E) (x : E) :
4348
ENNReal :=
44-
⨅ S ∈ (𝓝[D] x).map f, ediam S
49+
oscillation f (𝓝[D] x)
4550

4651
/-- The oscillation of `f` at `x` within a neighborhood `D` of `x` is equal to `oscillation f x` -/
47-
theorem oscillationWithin_nhds_eq_oscillation [TopologicalSpace E] (f : E → F) (D : Set E) (x : E)
48-
(hD : D ∈ 𝓝 x) : oscillationWithin f D x = oscillation f x := by
49-
rw [oscillation, oscillationWithin, nhdsWithin_eq_nhds.2 hD]
52+
theorem oscillationWithinAt_nhds_eq_oscillationAt [TopologicalSpace E] (f : E → F) (D : Set E)
53+
(x : E) (hD : D ∈ 𝓝 x) : oscillationWithinAt f D x = oscillationAt f x := by
54+
rw [oscillationAt, oscillationWithinAt, nhdsWithin_eq_nhds.2 hD]
5055

5156
/-- The oscillation of `f` at `x` within `univ` is equal to `oscillation f x` -/
52-
theorem oscillationWithin_univ_eq_oscillation [TopologicalSpace E] (f : E → F) (x : E) :
53-
oscillationWithin f univ x = oscillation f x :=
54-
oscillationWithin_nhds_eq_oscillation f univ x Filter.univ_mem
57+
theorem oscillationWithinAt_univ_eq_oscillationAt [TopologicalSpace E] (f : E → F) (x : E) :
58+
oscillationWithinAt f univ x = oscillationAt f x :=
59+
oscillationWithinAt_nhds_eq_oscillationAt f univ x Filter.univ_mem
5560

5661
namespace ContinuousWithinAt
5762

58-
theorem oscillationWithin_eq_zero [TopologicalSpace E] {f : E → F} {D : Set E}
59-
{x : E} (hf : ContinuousWithinAt f D x) : oscillationWithin f D x = 0 := by
63+
theorem oscillationWithinAt_eq_zero [TopologicalSpace E] {f : E → F} {D : Set E}
64+
{x : E} (hf : ContinuousWithinAt f D x) : oscillationWithinAt f D x = 0 := by
6065
rw [← nonpos_iff_eq_zero]
6166
refine _root_.le_of_forall_pos_le_add fun ε hε ↦ ?_
6267
rw [zero_add]
@@ -69,35 +74,36 @@ end ContinuousWithinAt
6974

7075
namespace ContinuousAt
7176

72-
theorem oscillation_eq_zero [TopologicalSpace E] {f : E → F} {x : E} (hf : ContinuousAt f x) :
73-
oscillation f x = 0 := by
77+
theorem oscillationAt_eq_zero [TopologicalSpace E] {f : E → F} {x : E} (hf : ContinuousAt f x) :
78+
oscillationAt f x = 0 := by
7479
rw [← continuousWithinAt_univ f x] at hf
75-
exact oscillationWithin_univ_eq_oscillation f x ▸ hf.oscillationWithin_eq_zero
80+
exact oscillationWithinAt_univ_eq_oscillationAt f x ▸ hf.oscillationWithinAt_eq_zero
7681

7782
end ContinuousAt
7883

79-
namespace OscillationWithin
84+
namespace OscillationWithinAt
8085

8186
/-- The oscillation within `D` of `f` at `x ∈ D` is 0 if and only if `ContinuousWithinAt f D x`. -/
8287
theorem eq_zero_iff_continuousWithinAt [TopologicalSpace E] (f : E → F) {D : Set E}
83-
{x : E} (xD : x ∈ D) : oscillationWithin f D x = 0 ↔ ContinuousWithinAt f D x := by
84-
refine ⟨fun hf ↦ EMetric.tendsto_nhds.mpr (fun ε ε0 ↦ ?_), fun hf ↦ hf.oscillationWithin_eq_zero⟩
85-
simp_rw [← hf, oscillationWithin, iInf_lt_iff] at ε0
88+
{x : E} (xD : x ∈ D) : oscillationWithinAt f D x = 0 ↔ ContinuousWithinAt f D x := by
89+
refine ⟨fun hf ↦ EMetric.tendsto_nhds.mpr (fun ε ε0 ↦ ?_),
90+
fun hf ↦ hf.oscillationWithinAt_eq_zero⟩
91+
simp_rw [← hf, oscillationWithinAt, oscillation, iInf_lt_iff] at ε0
8692
obtain ⟨S, hS, Sε⟩ := ε0
8793
refine Filter.mem_of_superset hS (fun y hy ↦ lt_of_le_of_lt ?_ Sε)
8894
exact edist_le_ediam_of_mem (mem_preimage.1 hy) <| mem_preimage.1 (mem_of_mem_nhdsWithin xD hS)
8995

90-
end OscillationWithin
96+
end OscillationWithinAt
9197

92-
namespace Oscillation
98+
namespace OscillationAt
9399

94100
/-- The oscillation of `f` at `x` is 0 if and only if `f` is continuous at `x`. -/
95101
theorem eq_zero_iff_continuousAt [TopologicalSpace E] (f : E → F) (x : E) :
96-
oscillation f x = 0 ↔ ContinuousAt f x := by
97-
rw [← oscillationWithin_univ_eq_oscillation, ← continuousWithinAt_univ f x]
98-
exact OscillationWithin.eq_zero_iff_continuousWithinAt f (mem_univ x)
102+
oscillationAt f x = 0 ↔ ContinuousAt f x := by
103+
rw [← oscillationWithinAt_univ_eq_oscillationAt, ← continuousWithinAt_univ f x]
104+
exact OscillationWithinAt.eq_zero_iff_continuousWithinAt f (mem_univ x)
99105

100-
end Oscillation
106+
end OscillationAt
101107

102108
namespace IsCompact
103109

@@ -106,7 +112,7 @@ variable {f : E → F} {D : Set E} {ε : ENNReal}
106112

107113
/-- If `oscillationWithin f D x < ε` at every `x` in a compact set `K`, then there exists `δ > 0`
108114
such that the oscillation of `f` on `ball x δ ∩ D` is less than `ε` for every `x` in `K`. -/
109-
theorem uniform_oscillationWithin (comp : IsCompact K) (hK : ∀ x ∈ K, oscillationWithin f D x < ε) :
115+
theorem uniform_oscillationWithinAt (comp : IsCompact K) (hK : ∀ x ∈ K, oscillationWithinAt f D x < ε) :
110116
∃ δ > 0, ∀ x ∈ K, ediam (f '' (eball x (ENNReal.ofReal δ) ∩ D)) ≤ ε := by
111117
let S := fun r ↦
112118
{x : E | ∃ (a : ℝ), (a > r ∧ ediam (f '' (eball x (ENNReal.ofReal a) ∩ D)) ≤ ε)}
@@ -120,8 +126,8 @@ theorem uniform_oscillationWithin (comp : IsCompact K) (hK : ∀ x ∈ K, oscill
120126
rw [← ofReal_add (by linarith) (by linarith), sub_add_cancel]
121127
have S_cover : K ⊆ ⋃ r > 0, S r := by
122128
intro x hx
123-
have : oscillationWithin f D x < ε := hK x hx
124-
simp only [oscillationWithin, Filter.mem_map, iInf_lt_iff] at this
129+
have : oscillationWithinAt f D x < ε := hK x hx
130+
simp only [oscillationWithinAt, oscillation, Filter.mem_map, iInf_lt_iff] at this
125131
obtain ⟨n, hn₁, hn₂⟩ := this
126132
obtain ⟨r, r0, hr⟩ := EMetric.mem_nhdsWithin_iff.1 hn₁
127133
simp only [gt_iff_lt, mem_iUnion, exists_prop]
@@ -154,10 +160,76 @@ theorem uniform_oscillationWithin (comp : IsCompact K) (hK : ∀ x ∈ K, oscill
154160
/-- If `oscillation f x < ε` at every `x` in a compact set `K`, then there exists `δ > 0` such
155161
that the oscillation of `f` on `ball x δ` is less than `ε` for every `x` in `K`. -/
156162
theorem uniform_oscillation {K : Set E} (comp : IsCompact K)
157-
{f : E → F} {ε : ENNReal} (hK : ∀ x ∈ K, oscillation f x < ε) :
163+
{f : E → F} {ε : ENNReal} (hK : ∀ x ∈ K, oscillationAt f x < ε) :
158164
∃ δ > 0, ∀ x ∈ K, ediam (f '' (eball x (ENNReal.ofReal δ))) ≤ ε := by
159-
simp only [← oscillationWithin_univ_eq_oscillation] at hK
160-
convert ← comp.uniform_oscillationWithin hK
165+
simp only [← oscillationWithinAt_univ_eq_oscillationAt] at hK
166+
convert ← comp.uniform_oscillationWithinAt hK
161167
exact inter_univ _
162168

163169
end IsCompact
170+
171+
section MoveMe
172+
173+
variable {ι : Sort*} {κ : ι → Sort*} {α : Type*} {f : (i : ι) → κ i → α}
174+
175+
@[to_dual iInf₂_le_iff]
176+
theorem le_iSup₂_iff [CompleteSemilatticeSup α] {a : α} :
177+
a ≤ ⨆ (i) (j), f i j ↔ ∀ b, (∀ i j, f i j ≤ b) → a ≤ b := by
178+
simp [iSup, le_sSup_iff, upperBounds]
179+
180+
@[to_dual iInf₂_lt_iff]
181+
theorem lt_iSup₂_iff [CompleteLinearOrder α] {a : α} :
182+
a < ⨆ (i) (j), f i j ↔ ∃ i j, a < f i j := by
183+
have := lt_iSup_iff (f := fun (ij : PSigma κ) ↦ f ij.1 ij.2) (a := a)
184+
simp_rw [PSigma.exists, iSup_psigma] at this
185+
exact this
186+
187+
@[to_dual iInf₂_le_iff_forall_lt]
188+
theorem le_iSup₂_iff_forall_lt [CompleteLinearOrder α] {l : α} :
189+
l ≤ ⨆ (i) (j), f i j ↔ ∀ b < l, ∃ i j, b < f i j := by
190+
have := le_iSup_iff_forall_lt (f := fun (ij : PSigma κ) ↦ f ij.1 ij.2) (l := l)
191+
simp_rw [PSigma.exists, iSup_psigma] at this
192+
exact this
193+
194+
@[to_dual lt_iInf₂_iff]
195+
theorem iSup₂_lt_iff [CompleteLattice α] {l : α} :
196+
⨆ (i) (j), f i j < l ↔ ∃ b < l, ∀ i j, f i j ≤ b := by
197+
have := iSup_lt_iff (f := fun (ij : PSigma κ) ↦ f ij.1 ij.2) (l := l)
198+
simp_rw [PSigma.forall, iSup_psigma] at this
199+
exact this
200+
201+
end MoveMe
202+
203+
section Cauchy
204+
205+
variable {f : E → F}
206+
207+
theorem EMetric.cauchy_iff_iInf_ediam_eq_zero (l : Filter F) [NeBot l] :
208+
Cauchy l ↔ 0 = ⨅ s ∈ l, ediam s := by
209+
rw [EMetric.cauchy_iff, eq_comm, ←nonpos_iff_eq_zero, iInf₂_le_iff_forall_lt]
210+
constructor
211+
· intro h ε hε
212+
rcases exists_between hε with ⟨η, hη⟩
213+
rcases h.right η hη.1 with ⟨s, hs₁, hs₂⟩
214+
use s, hs₁
215+
apply iSup₂_lt_iff.mpr
216+
use η, hη.2
217+
intro i hi
218+
apply iSup₂_le_iff.mpr
219+
intro j hj
220+
exact hs₂ i hi j hj |>.le
221+
· intro h
222+
use NeBot.ne'
223+
intro ε hε
224+
rcases h ε hε with ⟨s, hs₁, hs₂⟩
225+
use s, hs₁
226+
intro i hi j hj
227+
rcases iSup₂_lt_iff.mp hs₂ with ⟨l, hl, hs₃⟩
228+
specialize hs₃ i hi
229+
exact iSup₂_le_iff.mp hs₃ j hj |>.trans_lt hl
230+
231+
theorem cauchy_iff_oscillation_eq_zero (l : Filter E) [NeBot l] :
232+
Cauchy (l.map f) ↔ 0 = oscillation f l :=
233+
EMetric.cauchy_iff_iInf_ediam_eq_zero _
234+
235+
end Cauchy

0 commit comments

Comments
 (0)