File size: 3,310 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import OAI.Analysis.Calculus.Current.RegularizedSmooth
import Mathlib.Analysis.SpecialFunctions.JapaneseBracket

/-! The normalized Japanese-bracket kernel used for spatial regularization. -/

noncomputable section
namespace OAI.Analysis.Calculus.Current

open _root_.MeasureTheory
open scoped ContDiff

abbrev SpatialSpace (d : β„•) := EuclideanSpace ℝ (Option (Fin d))

def kernelProfile (d : β„•) (x : SpatialSpace d) : ℝ :=
  (1 + β€–xβ€– ^ 2) ^ (-(2 * ((d : ℝ) + 1) + 4) / 2)

theorem kernelProfile_pos (d : β„•) (x : SpatialSpace d) : 0 < kernelProfile d x := by
  apply Real.rpow_pos_of_pos
  positivity

theorem continuous_kernelProfile (d : β„•) : Continuous (kernelProfile d) := by
  unfold kernelProfile
  have hc : Continuous (fun x : SpatialSpace d => (1 : ℝ) + β€–xβ€– ^ 2) := by fun_prop
  exact hc.rpow_const (fun x => Or.inl (ne_of_gt (by positivity)))

theorem integrable_kernelProfile (d : β„•) : Integrable (kernelProfile d) := by
  apply integrable_rpow_neg_one_add_norm_sq
  simp only [SpatialSpace, finrank_euclideanSpace, Fintype.card_option, Fintype.card_fin,
    Nat.cast_add, Nat.cast_one]
  have hd : (0 : ℝ) ≀ d := Nat.cast_nonneg d
  linarith

theorem integral_kernelProfile_pos (d : β„•) : 0 < ∫ x, kernelProfile d x :=
  integral_pos_of_integrable_nonneg_nonzero (continuous_kernelProfile d)
    (integrable_kernelProfile d) (fun x => (kernelProfile_pos d x).le)
    (ne_of_gt (kernelProfile_pos d 0))

def kernelConstant (d : β„•) : ℝ := (∫ x, kernelProfile d x)⁻¹

theorem kernelConstant_pos (d : β„•) : 0 < kernelConstant d :=
  inv_pos.mpr (integral_kernelProfile_pos d)

/-- `C_n h⁻ⁿ ⟨x/h⟩⁻²ⁿ⁻⁴`, with `n=d+1`. -/
def smoothingKernel (d : β„•) (h : ℝ) (x : SpatialSpace d) : ℝ :=
  kernelConstant d * (h ^ (d + 1))⁻¹ * kernelProfile d (h⁻¹ β€’ x)

theorem smoothingKernel_pos (d : β„•) (h : ℝ) (hh : 0 < h) (x : SpatialSpace d) :
    0 < smoothingKernel d h x := by
  exact mul_pos (mul_pos (kernelConstant_pos d) (inv_pos.mpr (pow_pos hh _)))
    (kernelProfile_pos d _)

theorem integrable_smoothingKernel (d : β„•) (h : ℝ) (hh : h β‰  0) :
    Integrable (smoothingKernel d h) :=
  ((integrable_kernelProfile d).comp_smul (inv_ne_zero hh)).const_mul _

theorem integral_smoothingKernel (d : β„•) (h : ℝ) (hh : 0 < h) :
    ∫ x, smoothingKernel d h x = 1 := by
  simp only [smoothingKernel, integral_const_mul]
  rw [Measure.integral_comp_inv_smul_of_nonneg volume (kernelProfile d) hh.le]
  simp only [SpatialSpace, finrank_euclideanSpace, Fintype.card_option, Fintype.card_fin,
    smul_eq_mul, kernelConstant]
  field_simp [ne_of_gt hh, ne_of_gt (integral_kernelProfile_pos d)]

def sourceKernelMeasure (d : β„•) (h : ℝ) : Measure (SpatialSpace d) :=
  volume.withDensity (fun x => ENNReal.ofReal (smoothingKernel d h x))

theorem sourceKernelMeasure_isProbability (d : β„•) (h : ℝ) (hh : 0 < h) :
    IsProbabilityMeasure (sourceKernelMeasure d h) := by
  constructor
  rw [sourceKernelMeasure, withDensity_apply _ MeasurableSet.univ,
    Measure.restrict_univ]
  rw [← ofReal_integral_eq_lintegral_ofReal (integrable_smoothingKernel d h hh.ne')
    (Filter.Eventually.of_forall fun x => (smoothingKernel_pos d h hh x).le)]
  rw [integral_smoothingKernel d h hh]
  simp

end OAI.Analysis.Calculus.Current