cfahlgren1's picture
download
raw
7.21 kB
import Mathlib
import OAI.Probability.SphericalField.Poisson.Laplace
namespace OAI
section
noncomputable section
open MeasureTheory ProbabilityTheory Filter Set
open scoped ENNReal NNReal Topology BigOperators BoundedContinuousFunction
namespace SphericalPerceptron
open Matrix
open scoped InnerProductSpace
variable {H : Type*} [SeminormedAddCommGroup H] [InnerProductSpace ℝ H]
lemma poissonRandomMeasureLaw_laplace {S : Type*} [MeasurableSpace S] [Nonempty S]
(κ : Measure S) [SFinite κ] {f : S → ℝ} (hf : Measurable f) (hf0 : ∀ x, 0 ≤ f x) :
∫ η, poissonLaplace f η ∂poissonRandomMeasureLaw κ =
expNegENNReal (∫⁻ x, ENNReal.ofReal (1 - Real.exp (-f x)) ∂κ) := by
rw [poissonRandomMeasureLaw,countablePoissonLaw_laplace_intensity _ _ hf hf0]
congr 2
simp only [countablePoissonIntensity,finiteIntensityMarks_smul,sum_sfiniteSeq]
lemma poissonLaplace_map {S T : Type*} [MeasurableSpace S] [MeasurableSpace T]
{g : S → T} (hg : Measurable g) {f : T → ℝ} (hf : Measurable f) (η : Measure S) :
poissonLaplace f (η.map g) = poissonLaplace (f ∘ g) η := by
rw [poissonLaplace,lintegral_map hf.ennreal_ofReal hg]
rfl
lemma poissonRandomMeasureLaw_map {S T : Type*} [MeasurableSpace S] [MeasurableSpace T]
[Nonempty S] [Nonempty T] (κ : Measure S) [SFinite κ]
{g : S → T} (hg : Measurable g) :
(poissonRandomMeasureLaw κ).map (Measure.map g) = poissonRandomMeasureLaw (κ.map g) := by
apply measureLaw_eq_of_laplace
intro f hf hf0
rw [integral_map (Measure.measurable_map g hg).aemeasurable
(poissonLaplace_measurable hf).aestronglyMeasurable]
simp_rw [poissonLaplace_map hg hf]
rw [poissonRandomMeasureLaw_laplace _ (hf.comp hg) (fun x => hf0 (g x)),
poissonRandomMeasureLaw_laplace _ hf hf0,
lintegral_map (show Measurable (fun x : T => ENNReal.ofReal (1 - Real.exp (-f x))) from
(measurable_const.sub hf.neg.exp).ennreal_ofReal) hg]
rfl
lemma stableLogDensity_translate {b : ℝ} (_hb : 0 ≤ b) (c x : ℝ) :
ENNReal.ofReal (b * Real.exp (-b*x)) =
ENNReal.ofReal (Real.exp (b*c)) * ENNReal.ofReal (b * Real.exp (-b*(x+c))) := by
rw [← ENNReal.ofReal_mul (Real.exp_pos _).le]
congr 1
rw [mul_left_comm,← Real.exp_add]
congr 2
ring
lemma stableLogIntensity_lintegral_translate {b : ℝ} (hb : 0 ≤ b)
(c : ℝ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) :
∫⁻ x, f (x+c) ∂stableLogIntensity b =
ENNReal.ofReal (Real.exp (b*c)) * ∫⁻ x, f x ∂stableLogIntensity b := by
unfold stableLogIntensity
rw [lintegral_withDensity_eq_lintegral_mul volume (by fun_prop) (show Measurable (fun x : ℝ => f (x+c)) from hf.comp (measurable_id.add_const c)),
lintegral_withDensity_eq_lintegral_mul volume (by fun_prop) hf]
change (∫⁻ x, ENNReal.ofReal (b * Real.exp (-b*x)) * f (x+c)) = _
calc
(∫⁻ x, ENNReal.ofReal (b * Real.exp (-b*x)) * f (x+c)) =
∫⁻ x, ENNReal.ofReal (Real.exp (b*c)) *
(ENNReal.ofReal (b * Real.exp (-b*(x+c))) * f (x+c)) := by
apply lintegral_congr
intro x
rw [stableLogDensity_translate hb c x,mul_assoc]
_ = ENNReal.ofReal (Real.exp (b*c)) *
∫⁻ x, ENNReal.ofReal (b * Real.exp (-b*(x+c))) * f (x+c) :=
lintegral_const_mul' _ _ ENNReal.ofReal_ne_top
_ = _ := by
congr 1
exact lintegral_add_right_eq_self
(fun x => ENNReal.ofReal (b * Real.exp (-b*x)) * f x) c
lemma stableLogIntensity_translate {b : ℝ} (hb : 0 ≤ b) (c : ℝ) :
(stableLogIntensity b).map (fun x => x+c) =
ENNReal.ofReal (Real.exp (b*c)) • stableLogIntensity b := by
apply Measure.ext_of_lintegral
intro f hf
rw [lintegral_map hf (show Measurable (fun x : ℝ => x+c) from measurable_id.add_const c),lintegral_smul_measure]
exact stableLogIntensity_lintegral_translate hb c hf
def logMarkShift {S : Type*} (F : S → ℝ) (p : ℝ × S) : ℝ × S :=
(p.1 + F p.2,p.2)
lemma logMarkShift_measurable {S : Type*} [MeasurableSpace S]
{F : S → ℝ} (hF : Measurable F) : Measurable (logMarkShift F) :=
(measurable_fst.add (hF.comp measurable_snd)).prodMk measurable_snd
lemma stableLogIntensity_mark_shift {S : Type*} [MeasurableSpace S]
(ν : Measure S) [SFinite ν] {b : ℝ} (hb : 0 ≤ b)
{F : S → ℝ} (hF : Measurable F) :
((stableLogIntensity b).prod ν).map (logMarkShift F) =
(stableLogIntensity b).prod (ν.withDensity (fun s => ENNReal.ofReal (Real.exp (b * F s)))) := by
apply Measure.ext_of_lintegral
intro f hf
rw [lintegral_map hf (logMarkShift_measurable hF)]
rw [lintegral_prod_symm (fun p : ℝ × S => f (logMarkShift F p))
(show AEMeasurable (fun p : ℝ × S => f (logMarkShift F p)) _ from
(hf.comp (logMarkShift_measurable hF)).aemeasurable),
lintegral_prod_symm _ hf.aemeasurable]
rw [lintegral_withDensity_eq_lintegral_mul ν (by fun_prop)
(Measurable.lintegral_prod_left' hf)]
apply lintegral_congr
intro s
exact stableLogIntensity_lintegral_translate hb (F s) (hf.comp (measurable_id.prodMk measurable_const))
lemma stablePoisson_mark_shift {S : Type*} [MeasurableSpace S] [Nonempty S]
(ν : Measure S) [SFinite ν] {b : ℝ} (hb : 0 ≤ b)
{F : S → ℝ} (hF : Measurable F) :
(poissonRandomMeasureLaw ((stableLogIntensity b).prod ν)).map (Measure.map (logMarkShift F)) =
poissonRandomMeasureLaw ((stableLogIntensity b).prod
(ν.withDensity (fun s => ENNReal.ofReal (Real.exp (b * F s))))) := by
rw [poissonRandomMeasureLaw_map _ (logMarkShift_measurable hF)]
congr 1
exact stableLogIntensity_mark_shift ν hb hF
lemma poissonMeasure_atom_succ (r : ℝ≥0) (n : ℕ) :
poissonMeasure r {n+1} * (n+1 : ℝ≥0∞) = (r : ℝ≥0∞) * poissonMeasure r {n} := by
have he : Real.exp (-(r : ℝ)) * (r : ℝ)^(n+1) / (n+1).factorial * (n+1 : ℝ) =
(r : ℝ) * (Real.exp (-(r : ℝ)) * (r : ℝ)^n / n.factorial) := by
rw [Nat.factorial_succ,Nat.cast_mul,Nat.cast_add,Nat.cast_one,pow_succ]
have hn : (n : ℝ) + 1 ≠ 0 := by positivity
have hf : (n.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero n
field_simp
have he' := congrArg ENNReal.ofReal he
have hcast : ENNReal.ofReal ((n : ℝ)+1) = (n : ℝ≥0∞)+1 := by
rw [ENNReal.ofReal_add (by positivity) (by positivity),ENNReal.ofReal_natCast,ENNReal.ofReal_one]
simpa only [ENNReal.ofReal_mul (by positivity : 0 ≤ Real.exp (-(r : ℝ)) * (r : ℝ)^(n+1) / (n+1).factorial),
ENNReal.ofReal_mul r.coe_nonneg,ENNReal.ofReal_coe_nnreal,hcast,poissonMeasure_singleton] using he'
lemma poissonMeasure_mean (r : ℝ≥0) :
∑' n : ℕ, poissonMeasure r {n} * (n : ℝ≥0∞) = r := by
rw [tsum_eq_zero_add' ENNReal.summable]
simp only [Nat.cast_zero,mul_zero,zero_add,Nat.cast_add,Nat.cast_one]
simp_rw [poissonMeasure_atom_succ]
rw [ENNReal.tsum_mul_left]
have hmass : ∑' n : ℕ, poissonMeasure r {n} = 1 := by
simp_rw [poissonMeasure_singleton]
rw [← ENNReal.ofReal_tsum_of_nonneg (fun _ => by positivity)
(hasSum_one_poissonMeasure r).summable,(hasSum_one_poissonMeasure r).tsum_eq]
norm_num
rw [hmass,mul_one]
end SphericalPerceptron
end
end
end OAI

Xet Storage Details

Size:
7.21 kB
·
Xet hash:
99978f984a7070a22c69018b21655280230715baa382c172872ab14525632444

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