cfahlgren1's picture
download
raw
8.11 kB
import Mathlib
import OAI.Probability.SphericalField.Poisson.CountableLaw
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 expNegENNReal_injective : Function.Injective expNegENNReal := by
intro u v huv
have hfinite (w : ℝ≥0∞) : EReal.exp (-(w : EReal)) ≠ ⊤ :=
ne_of_lt (lt_of_le_of_lt (EReal.exp_le_one_iff.mpr
(EReal.neg_le_zero.mpr (EReal.coe_ennreal_nonneg w))) ENNReal.one_lt_top)
have he := (ENNReal.toReal_eq_toReal_iff' (hfinite u) (hfinite v)).mp huv
have hn := EReal.expOrderIso.injective he
exact EReal.coe_ennreal_injective (by simpa using congrArg Neg.neg hn)
def laplaceTest {ι : Type*} [Fintype ι] (a : ι → ℝ≥0) : (ι → ℝ≥0∞) →ᵇ ℝ :=
BoundedContinuousFunction.mkOfCompact
⟨fun x => expNegENNReal (∑ i, (a i : ℝ≥0∞) * x i), by
apply expNegENNReal_continuous.comp
exact continuous_finsetSum _ fun i _ =>
(ENNReal.continuous_const_mul ENNReal.coe_ne_top).comp (continuous_apply i)⟩
@[simp] lemma laplaceTest_zero {ι : Type*} [Fintype ι] :
laplaceTest (0 : ι → ℝ≥0) = 1 := by
ext x
simp [laplaceTest]
lemma laplaceTest_add {ι : Type*} [Fintype ι] (a b : ι → ℝ≥0) :
laplaceTest (a+b) = laplaceTest a * laplaceTest b := by
ext x
simp only [laplaceTest,BoundedContinuousFunction.mkOfCompact_apply,
ContinuousMap.coe_mk,Pi.add_apply,ENNReal.coe_add,add_mul,
Finset.sum_add_distrib,expNegENNReal_add,BoundedContinuousFunction.mul_apply]
lemma laplaceTest_separates {ι : Type*} [Fintype ι] (x y : ι → ℝ≥0∞) (hxy : x ≠ y) :
∃ a : ι → ℝ≥0, laplaceTest a x ≠ laplaceTest a y := by
classical
obtain ⟨i,hi⟩ : ∃ i, x i ≠ y i := by
by_contra! h
exact hxy (funext h)
refine ⟨Pi.single i 1,?_⟩
simpa [laplaceTest,Pi.single_apply,apply_ite,ite_mul] using expNegENNReal_injective.ne hi
lemma measure_eq_of_laplace_tests {ι : Type*} [Fintype ι]
(P Q : Measure (ι → ℝ≥0∞)) [IsFiniteMeasure P] [IsFiniteMeasure Q]
(heq : ∀ a : ι → ℝ≥0, ∫ x, laplaceTest a x ∂P = ∫ x, laplaceTest a x ∂Q) : P = Q :=
measure_eq_of_additive_test_family laplaceTest laplaceTest_zero laplaceTest_add
laplaceTest_separates P Q heq
lemma measure_eq_of_map_eq_comap {X Y : Type*} [mX : MeasurableSpace X]
[mY : MeasurableSpace Y] (f : X → Y) (h : mX = mY.comap f)
(P Q : Measure X) (heq : P.map f = Q.map f) : P = Q := by
have hf : Measurable f := Measurable.of_comap_le h.ge
ext s hs
rw [h] at hs
obtain ⟨t,ht,rfl⟩ := MeasurableSpace.measurableSet_comap.mp hs
rw [← Measure.map_apply hf ht,← Measure.map_apply hf ht,heq]
lemma measureLaw_eval_comap {S : Type*} [MeasurableSpace S] :
(inferInstance : MeasurableSpace (Measure S)) = MeasurableSpace.comap
(fun η : Measure S => fun s : {s : Set S // MeasurableSet s} => η s.val)
inferInstance := by
apply le_antisymm
· change (⨆ (s : Set S) (hs : MeasurableSet s),
MeasurableSpace.comap (fun η : Measure S => η s) (borel ℝ≥0∞)) ≤ _
apply iSup₂_le
intro s hs
exact MeasurableSpace.comap_le_comap_pi (g := fun t : {s : Set S // MeasurableSet s} =>
fun η : Measure S => η t.val) ⟨s,hs⟩
· apply Measurable.comap_le
apply Measurable.of_eval
intro s
exact Measure.measurable_coe s.property
lemma laplaceTest_eval_eq {S ι : Type*} [MeasurableSpace S] [Fintype ι]
(s : ι → Set S) (hs : ∀ i, MeasurableSet (s i)) (a : ι → ℝ≥0) (η : Measure S) :
laplaceTest a (fun i => η (s i)) =
poissonLaplace (fun x => ∑ i, (s i).indicator (fun _ => (a i : ℝ)) x) η := by
classical
have h0 (i : ι) (x : S) : 0 ≤ (s i).indicator (fun _ => (a i : ℝ)) x :=
Set.indicator_nonneg (fun _ _ => (a i).coe_nonneg) x
have he (x : S) : ENNReal.ofReal (∑ i, (s i).indicator (fun _ => (a i : ℝ)) x) =
∑ i, (s i).indicator (fun _ => (a i : ℝ≥0∞)) x := by
rw [ENNReal.ofReal_sum_of_nonneg (fun i _ => h0 i x)]
apply Finset.sum_congr rfl
intro i _
by_cases hx : x ∈ s i <;> simp [hx]
change expNegENNReal (∑ i, (a i : ℝ≥0∞) * η (s i)) = _
simp only [poissonLaplace,he]
rw [lintegral_finsetSum _ (fun i _ => measurable_const.indicator (hs i))]
simp_rw [lintegral_indicator (hs _),setLIntegral_const]
lemma measureLaw_eq_of_laplace {S : Type*} [MeasurableSpace S]
(P Q : Measure (Measure S)) [IsFiniteMeasure P] [IsFiniteMeasure Q]
(heq : ∀ f : S → ℝ, Measurable f → (∀ x, 0 ≤ f x) →
∫ η, poissonLaplace f η ∂P = ∫ η, poissonLaplace f η ∂Q) : P = Q := by
classical
let J := {s : Set S // MeasurableSet s}
let E (η : Measure S) (s : J) : ℝ≥0∞ := η s.val
have hE : Measurable E := Measurable.of_eval fun measurableSet =>
Measure.measurable_coe measurableSet.property
apply measure_eq_of_map_eq_comap E measureLaw_eval_comap
apply IsProjectiveLimit.unique (P := fun I : Finset J => (Q.map E).map I.restrict)
(hν := fun _ => rfl)
intro I
have hI : Measurable (I.restrict (π := fun _ => ℝ≥0∞)) :=
Measurable.of_eval fun index => measurable_pi_apply index.val
change (P.map E).map I.restrict = (Q.map E).map I.restrict
rw [Measure.map_map hI hE,Measure.map_map hI hE]
apply measure_eq_of_laplace_tests
intro a
have hm : Measurable (I.restrict ∘ E) := hI.comp hE
rw [integral_map hm.aemeasurable (laplaceTest a).continuous.measurable.aestronglyMeasurable,
integral_map hm.aemeasurable (laplaceTest a).continuous.measurable.aestronglyMeasurable]
have hid (η : Measure S) : laplaceTest a ((I.restrict ∘ E) η) =
poissonLaplace (fun x => ∑ i : I, i.val.val.indicator (fun _ => (a i : ℝ)) x) η :=
laplaceTest_eval_eq (fun i : I => i.val.val) (fun i => i.val.property) a η
simp_rw [hid]
apply heq
· exact Finset.measurable_sum _ fun i _ => measurable_const.indicator i.val.property
· intro x
exact Finset.sum_nonneg fun i _ => Set.indicator_nonneg (fun _ _ => (a i).coe_nonneg) x
def countablePoissonIntensity {S : Type*} [MeasurableSpace S]
(r : ℕ → ℝ≥0) (ν : ℕ → Measure S) : Measure S :=
Measure.sum fun i => (r i : ℝ≥0∞) • ν i
lemma countablePoissonLaw_laplace_intensity {S : Type*} [MeasurableSpace S]
(r : ℕ → ℝ≥0) (ν : ℕ → Measure S) [∀ i, IsProbabilityMeasure (ν i)]
{f : S → ℝ} (hf : Measurable f) (hf0 : ∀ x, 0 ≤ f x) :
∫ η, poissonLaplace f η ∂countablePoissonLaw r ν =
expNegENNReal (∫⁻ x, ENNReal.ofReal (1 - Real.exp (-f x)) ∂countablePoissonIntensity r ν) := by
rw [countablePoissonLaw_laplace r ν hf hf0]
congr 1
rw [countablePoissonIntensity,lintegral_sum_measure]
apply tsum_congr
intro i
rw [lintegral_smul_measure,ENNReal.ofReal_mul (r i).coe_nonneg,ENNReal.ofReal_coe_nnreal]
congr 1
apply ofReal_integral_eq_lintegral_ofReal
· apply Integrable.of_bound (measurable_const.sub hf.neg.exp).aestronglyMeasurable 1
exact ae_of_all _ fun x => by
have h0 := Real.exp_pos (-f x)
have h1 := Real.exp_le_one_iff.mpr (neg_nonpos.mpr (hf0 x))
change |1 - Real.exp (-f x)| ≤ 1
rw [abs_of_nonneg (sub_nonneg.mpr h1)]
linarith
· exact ae_of_all _ fun x => sub_nonneg.mpr
(Real.exp_le_one_iff.mpr (neg_nonpos.mpr (hf0 x)))
lemma finiteIntensityMarks_smul {S : Type*} [MeasurableSpace S] [Nonempty S]
(κ : Measure S) [IsFiniteMeasure κ] :
((κ univ).toNNReal : ℝ≥0∞) • finiteIntensityMarks κ = κ := by
rw [ENNReal.coe_toNNReal (measure_ne_top _ _)]
by_cases hκ : κ univ = 0
· have he : κ = 0 := Measure.measure_univ_eq_zero.mp hκ
simp [he]
· rw [finiteIntensityMarks,ite_eq_right hκ,smul_smul,ENNReal.mul_inv_cancel hκ (measure_ne_top _ _),one_smul]
end SphericalPerceptron
end
end
end OAI

Xet Storage Details

Size:
8.11 kB
·
Xet hash:
d4d208eab34792ea11990f1fdbd25c1e39e492dde953269207b960e7f358aa82

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