cfahlgren1/math / lean /OAI /Probability /MemoryPrecision /PointwiseDensity.lean
cfahlgren1's picture
download
raw
3.49 kB
18
def PointwiseDensity {d : ℕ} (μ : Measure (Space d)) (m : ℕ)
    (x : (Fin m → Space d) × (Fin m → ℝ)) : ℝ := by
body · 3 lines
  classical
  exact if h : ∃ l : ℝ, Tendsto (fun i : ℕ => GaussianRegularization μ m (1/(i:ℝ)) x)
      atTop (𝓝 l) then Classical.choose h else 0
24
lemma measurable_GaussianRegularization {d : ℕ} (μ : Measure (Space d)) [IsFiniteMeasure μ]
    (m : ℕ) (δ : ℝ) : Measurable (GaussianRegularization μ m δ) := by
proof · 5 lines
  have he : GaussianRegularization μ m δ = fun x =>
      (projectionSmoothing μ (gaussianPDF 0 ⟨δ^2,sq_nonneg δ⟩) m x).toReal :=
    funext (GaussianRegularization_eq_toReal μ m δ)
  rw [he]
  exact (measurable_projectionSmoothing μ _ (measurable_gaussianPDF _ _) m).ennreal_toReal
32
lemma PointwiseDensity_eq_of_tendsto {d m : ℕ} (μ : Measure (Space d))
    (x : (Fin m → Space d) × (Fin m → ℝ)) {l : ℝ}
    (h : Tendsto (fun i : ℕ => GaussianRegularization μ m (1/(i:ℝ)) x) atTop (𝓝 l)) :
    PointwiseDensity μ m x = l := by
proof · 5 lines
  classical
  unfold PointwiseDensity
  rw [dite_eq_left ⟨l,h⟩]
  exact tendsto_nhds_unique (Classical.choose_spec (show ∃ l : ℝ,
    Tendsto (fun i : ℕ => GaussianRegularization μ m (1/(i:ℝ)) x) atTop (𝓝 l) from ⟨l,h⟩)) h
42
lemma measurable_PointwiseDensity {d : ℕ} (μ : Measure (Space d)) [IsFiniteMeasure μ]
    (m : ℕ) : Measurable (PointwiseDensity μ m) := by
proof · 20 lines
  classical
  let S := {x : (Fin m → Space d) × (Fin m → ℝ) | ∃ l : ℝ,
    Tendsto (fun i : ℕ => GaussianRegularization μ m (1/(i:ℝ)) x) atTop (𝓝 l)}
  have hS : MeasurableSet S :=
    measurableSet_exists_tendsto (fun i => measurable_GaussianRegularization μ m _)
  apply measurable_of_tendsto_metrizable
    (f := fun i => S.indicator (GaussianRegularization μ m (1/(i:ℝ))))
    (fun i => (measurable_GaussianRegularization μ m _).indicator hS)
  apply tendsto_pi_nhds.mpr
  intro x
  by_cases hx : x ∈ S
  · rcases hx with ⟨l,hl⟩
    rw [PointwiseDensity_eq_of_tendsto μ x hl]
    simpa only [Set.indicator_of_mem (show x ∈ S from ⟨l,hl⟩)] using hl
  · have he : PointwiseDensity μ m x = 0 := by
      unfold PointwiseDensity
      exact dite_eq_right hx
    rw [he]
    simpa only [Set.indicator_of_notMem hx] using
      (tendsto_const_nhds : Tendsto (fun _ : ℕ => (0:ℝ)) atTop (𝓝 0))
65
lemma GaussianRegularization_nonneg {d : ℕ} (μ : Measure (Space d)) (m : ℕ) (δ : ℝ)
    (x : (Fin m → Space d) × (Fin m → ℝ)) : 0 ≤ GaussianRegularization μ m δ x :=
proof · 1 line
  integral_nonneg (fun _ => Finset.prod_nonneg (fun _ _ => gaussianPDFReal_nonneg _ _ _))
69
lemma PointwiseDensity_nonneg {d : ℕ} (μ : Measure (Space d)) (m : ℕ)
    (x : (Fin m → Space d) × (Fin m → ℝ)) : 0 ≤ PointwiseDensity μ m x := by
proof · 6 lines
  classical
  unfold PointwiseDensity
  split_ifs with h
  · exact ge_of_tendsto (Classical.choose_spec h)
      (Eventually.of_forall (fun i => GaussianRegularization_nonneg μ m _ x))
  · exact le_rfl

Xet Storage Details

Size:
3.49 kB
·
Xet hash:
bbd076c053c22208081f80d9eb3419ef5e8b5fbf5aeedfd6ec5e656d896d5c8f

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.