cfahlgren1/math / lean /OAI /Analysis /CoulombRadii /RandomFields /ConditionalDensity.lean
cfahlgren1's picture
download
raw
17.3 kB
import Mathlib
import OAI.Analysis.CoulombRadii.Packets.PacketWidthScalar
namespace OAI
section
section
noncomputable section
open MeasureTheory Filter
open scoped Topology BigOperators ENNReal
namespace NeutralAtom
theorem continuous_packetKernel {g : Position → ℝ} (hg : Continuous g)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) :
Continuous (fun zy : Position × Position => packetKernel g c₁ r₀ s zy.1 zy.2) := by
have ht : Continuous (fun zy : Position × Position => packetWidth c₁ r₀ s zy.1) :=
(continuous_packetWidth c₁ r₀ s).comp continuous_fst
have htne : ∀ zy : Position × Position, packetWidth c₁ r₀ s zy.1 ≠ 0 :=
fun zy => (packetWidth_pos hc hr hs zy.1).ne'
unfold packetKernel
exact ((ht.pow 3).inv₀ (fun zy => pow_ne_zero _ (htne zy))).mul
((hg.comp ((ht.inv₀ htne).smul (continuous_snd.sub continuous_fst))).pow 2)
theorem measurable_packetMass {n : ℕ} {g : Position → ℝ} (hg : Continuous g)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(S : Set Position) : Measurable (packetMass (n := n) g c₁ r₀ s S) := by
have hjoint := (continuous_packetKernel hg hc hr hs).stronglyMeasurable
have hint : Measurable (fun z : Position => ∫ y in S, packetKernel g c₁ r₀ s z y) :=
(hjoint.integral_prod_right' (ν := volume.restrict S)).measurable
exact Finset.measurable_sum _ (fun i _ => hint.comp (measurable_pi_apply i))
theorem packetMass_le_number {n : ℕ} (g : Position → ℝ) (hg : (∫ y, g y^2) = 1)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(S : Set Position) (x : Configuration n) : packetMass g c₁ r₀ s S x ≤ n := by
exact (packetMass_le_rawCount g hg hc hr hs S Set.univ (by simp) x).trans
(rawCount_le_number Set.univ x)
theorem packetMass_memLp {n : ℕ} {g : Position → ℝ} (hg : Continuous g)
(hgnorm : (∫ y, g y^2) = 1) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (S : Set Position)
(μ : Measure (Configuration n)) [IsFiniteMeasure μ] :
MemLp (packetMass g c₁ r₀ s S) 2 μ := by
apply MemLp.of_bound (measurable_packetMass hg hc hr hs S).aestronglyMeasurable (n : ℝ)
filter_upwards [] with x
simpa only [Real.norm_eq_abs, abs_of_nonneg (packetMass_nonneg g hc hr hs S x)]
using packetMass_le_number g hgnorm hc hr hs S x
def rawPacketDensity {n : ℕ} (g : Position → ℝ) (c₁ r₀ s : ℝ)
(x : Configuration n) (y : Position) : ℝ :=
∑ i : Fin n, packetKernel g c₁ r₀ s (x i) y
theorem rawPacketDensity_nonneg {n : ℕ} (g : Position → ℝ) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (x : Configuration n) (y : Position) :
0 ≤ rawPacketDensity g c₁ r₀ s x y :=
Finset.sum_nonneg (fun i _ => packetKernel_nonneg g hc hr hs (x i) y)
theorem rawPacketDensity_integrable {n : ℕ} (g : Position → ℝ) (hgnorm : (∫ y, g y^2)=1)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (x : Configuration n) :
Integrable (rawPacketDensity g c₁ r₀ s x) :=
integrable_finsetSum _ (fun i _ => integrable_packetKernel g hgnorm hc hr hs (x i))
theorem rawPacketDensity_mass {n : ℕ} (g : Position → ℝ) (hgnorm : (∫ y, g y^2)=1)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (x : Configuration n) :
(∫ y, rawPacketDensity g c₁ r₀ s x y) = n := by
unfold rawPacketDensity
rw [integral_finsetSum _ (fun i _ => integrable_packetKernel g hgnorm hc hr hs (x i))]
simp only [integral_packetKernel g hgnorm hc hr hs, Finset.sum_const, Finset.card_univ,
Fintype.card_fin, nsmul_eq_mul, mul_one]
theorem continuous_rawPacketDensity {n : ℕ} {g : Position → ℝ} (hg : Continuous g)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) :
Continuous (fun xy : Configuration n × Position => rawPacketDensity g c₁ r₀ s xy.1 xy.2) := by
have hi : ∀ i : Fin n, Continuous (fun xy : Configuration n × Position =>
packetKernel g c₁ r₀ s (xy.1 i) xy.2) := by
intro i
have hh : Continuous (fun xy : Configuration n × Position => xy.1 i) :=
(continuous_apply i).comp continuous_fst
have hhpair : Continuous (fun xy : Configuration n × Position => (xy.1 i,xy.2)) :=
hh.prodMk continuous_snd
change Continuous ((fun zy : Position × Position => packetKernel g c₁ r₀ s zy.1 zy.2) ∘
(fun xy : Configuration n × Position => (xy.1 i,xy.2)))
exact (continuous_packetKernel hg hc hr hs).comp hhpair
exact continuous_finsetSum Finset.univ (fun i _ => hi i)
theorem rawPacketDensity_prod_integrable {n : ℕ} {g : Position → ℝ} (hg : Continuous g)
(hgnorm : (∫ y, g y^2)=1) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(ν : Measure (Configuration n)) [IsFiniteMeasure ν] :
Integrable (fun xy : Configuration n × Position => rawPacketDensity g c₁ r₀ s xy.1 xy.2)
(ν.prod volume) := by
apply (integrable_prod_iff (continuous_rawPacketDensity hg hc hr hs).aestronglyMeasurable).mpr
constructor
· exact Filter.Eventually.of_forall (rawPacketDensity_integrable g hgnorm hc hr hs)
· have he : (fun x : Configuration n => ∫ y, ‖rawPacketDensity g c₁ r₀ s x y‖) =
(fun _ => (n : ℝ)) := by
funext x
simp only [Real.norm_eq_abs, abs_of_nonneg (rawPacketDensity_nonneg g hc hr hs x _),
rawPacketDensity_mass g hgnorm hc hr hs]
rw [he]
exact integrable_const _
def mixturePacketDensity {n : ℕ} (ν : Measure (Configuration n))
(g : Position → ℝ) (c₁ r₀ s : ℝ) (y : Position) : ℝ :=
∫ x, rawPacketDensity g c₁ r₀ s x y ∂ν
theorem mixturePacketDensity_integrable {n : ℕ} {g : Position → ℝ} (hg : Continuous g)
(hgnorm : (∫ y, g y^2)=1) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(ν : Measure (Configuration n)) [IsFiniteMeasure ν] :
Integrable (mixturePacketDensity ν g c₁ r₀ s) :=
(rawPacketDensity_prod_integrable hg hgnorm hc hr hs ν).integral_prod_right
theorem mixturePacketDensity_nonneg {n : ℕ} (ν : Measure (Configuration n))
(g : Position → ℝ) {c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(y : Position) : 0 ≤ mixturePacketDensity ν g c₁ r₀ s y :=
integral_nonneg (fun x => rawPacketDensity_nonneg g hc hr hs x y)
theorem mixturePacketDensity_mass {n : ℕ} {g : Position → ℝ} (hg : Continuous g)
(hgnorm : (∫ y, g y^2)=1) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(ν : Measure (Configuration n)) [IsProbabilityMeasure ν] :
(∫ y, mixturePacketDensity ν g c₁ r₀ s y) = n := by
unfold mixturePacketDensity
have hi : Integrable (Function.uncurry (fun y x => rawPacketDensity g c₁ r₀ s x y))
(volume.prod ν) := (rawPacketDensity_prod_integrable hg hgnorm hc hr hs ν).swap
rw [integral_integral_swap hi]
simp only [rawPacketDensity_mass g hgnorm hc hr hs, integral_const, probReal_univ,
one_smul]
theorem packetWidth_lower {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (z : Position) :
c₁*r₀*(min r₀ s)^packetExponent ≤ packetWidth c₁ r₀ s z := by
unfold packetWidth
apply mul_le_mul
· exact mul_le_mul_of_nonneg_left (le_max_right _ _) hc.le
· exact Real.rpow_le_rpow (lt_min hr hs).le
(min_le_min (le_max_right _ _) le_rfl) (by norm_num [packetExponent])
· exact Real.rpow_nonneg (lt_min hr hs).le _
· exact mul_nonneg hc.le (hr.le.trans (le_max_right _ _))
theorem compact_packet_function_bound {g : Position → ℝ} (hg : Continuous g)
(hgs : HasCompactSupport g) : ∃ A : ℝ, 0 ≤ A ∧ ∀ x, g x^2 ≤ A := by
obtain ⟨A,hA⟩ := ((hgs.isCompact_range hg).image (continuous_id.pow 2)).bddAbove
refine ⟨A, (sq_nonneg (g 0)).trans (hA ⟨g 0, ⟨0,rfl⟩,rfl⟩), ?_⟩
intro x
exact hA ⟨g x,⟨x,rfl⟩,rfl⟩
theorem packetKernel_bound {g : Position → ℝ} {A c₁ r₀ s : ℝ}
(_hA : 0 ≤ A) (hg : ∀ x, g x^2 ≤ A)
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (z y : Position) :
packetKernel g c₁ r₀ s z y ≤ (c₁*r₀*(min r₀ s)^packetExponent)^(-3:ℤ)*A := by
have hp : 0 < c₁*r₀*(min r₀ s)^packetExponent := by positivity
have hh := packetWidth_lower hc hr hs z
have hinv := inv_anti₀ (pow_pos hp 3) (pow_le_pow_left₀ hp.le hh 3)
change (packetWidth c₁ r₀ s z^3)⁻¹*g _^2 ≤ _
rw [zpow_neg]
exact mul_le_mul hinv (hg _) (sq_nonneg _) (by positivity)
theorem rawPacketDensity_bound {n : ℕ} {g : Position → ℝ} {A c₁ r₀ s : ℝ}
(hA : 0 ≤ A) (hg : ∀ x, g x^2 ≤ A)
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (x : Configuration n) (y : Position) :
rawPacketDensity g c₁ r₀ s x y ≤
n*((c₁*r₀*(min r₀ s)^packetExponent)^(-3:ℤ)*A) := by
calc
_ ≤ ∑ _i : Fin n, (c₁*r₀*(min r₀ s)^packetExponent)^(-3:ℤ)*A :=
Finset.sum_le_sum (fun i _ => packetKernel_bound hA hg hc hr hs (x i) y)
_ = _ := by simp
theorem rawPacketDensity_integrable_configuration {n : ℕ} {g : Position → ℝ}
(hg : Continuous g) (hgs : HasCompactSupport g) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(ν : Measure (Configuration n)) [IsFiniteMeasure ν] (y : Position) :
Integrable (fun x => rawPacketDensity g c₁ r₀ s x y) ν := by
obtain ⟨A,hA,hAb⟩ := compact_packet_function_bound hg hgs
have hm : AEStronglyMeasurable (fun x => rawPacketDensity g c₁ r₀ s x y) ν :=
((continuous_rawPacketDensity hg hc hr hs).comp
(continuous_id.prodMk (continuous_const (y := y)))).aestronglyMeasurable
apply (integrable_const (n*((c₁*r₀*(min r₀ s)^packetExponent)^(-3:ℤ)*A))).mono' hm
filter_upwards [] with x
simpa only [Real.norm_eq_abs, abs_of_nonneg (rawPacketDensity_nonneg g hc hr hs x y)]
using rawPacketDensity_bound hA hAb hc hr hs x y
theorem mixturePacketDensity_bounded {n : ℕ} {g : Position → ℝ}
(hg : Continuous g) (hgs : HasCompactSupport g) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) :
∃ A : ℝ, 0 ≤ A ∧ ∀ (ν : Measure (Configuration n)) [IsProbabilityMeasure ν] y,
mixturePacketDensity ν g c₁ r₀ s y ≤ A := by
obtain ⟨A,hA,hAb⟩ := compact_packet_function_bound hg hgs
let C := n*((c₁*r₀*(min r₀ s)^packetExponent)^(-3:ℤ)*A)
have hw : 0 < c₁*r₀*(min r₀ s)^packetExponent := by positivity
refine ⟨C, by dsimp [C]; positivity, ?_⟩
intro ν hν y
have hh := integral_mono (rawPacketDensity_integrable_configuration hg hgs hc hr hs ν y)
(integrable_const C) (fun x => rawPacketDensity_bound hA hAb hc hr hs x y)
simpa only [mixturePacketDensity, integral_const, probReal_univ, one_smul] using hh
theorem rawPacketDensity_setIntegral {n : ℕ} (g : Position → ℝ)
(hgnorm : (∫ y, g y^2)=1) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(S : Set Position) (x : Configuration n) :
(∫ y in S, rawPacketDensity g c₁ r₀ s x y) = packetMass g c₁ r₀ s S x := by
unfold rawPacketDensity packetMass
exact integral_finsetSum _ (fun i _ => (integrable_packetKernel g hgnorm hc hr hs (x i)).integrableOn)
theorem rawPacketDensity_prod_restrict_integrable {n : ℕ} {g : Position → ℝ}
(hg : Continuous g) (hgnorm : (∫ y, g y^2)=1) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(ν : Measure (Configuration n)) [IsFiniteMeasure ν] (S : Set Position) :
Integrable (fun xy : Configuration n × Position => rawPacketDensity g c₁ r₀ s xy.1 xy.2)
(ν.prod (volume.restrict S)) := by
apply (integrable_prod_iff (continuous_rawPacketDensity hg hc hr hs).aestronglyMeasurable).mpr
constructor
· exact Filter.Eventually.of_forall (fun x => (rawPacketDensity_integrable g hgnorm hc hr hs x).integrableOn)
· have he : (fun x : Configuration n => ∫ y in S, ‖rawPacketDensity g c₁ r₀ s x y‖) =
packetMass g c₁ r₀ s S := by
funext x
simp only [Real.norm_eq_abs, abs_of_nonneg (rawPacketDensity_nonneg g hc hr hs x _),
rawPacketDensity_setIntegral g hgnorm hc hr hs]
rw [he]
exact (packetMass_memLp hg hgnorm hc hr hs S ν).integrable (by norm_num)
theorem mixturePacketDensity_setIntegral {n : ℕ} {g : Position → ℝ}
(hg : Continuous g) (hgnorm : (∫ y, g y^2)=1) {c₁ r₀ s : ℝ}
(hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(ν : Measure (Configuration n)) [IsFiniteMeasure ν] (S : Set Position) :
(∫ y in S, mixturePacketDensity ν g c₁ r₀ s y) =
∫ x, packetMass g c₁ r₀ s S x ∂ν := by
have hi : Integrable (Function.uncurry (fun y x => rawPacketDensity g c₁ r₀ s x y))
((volume.restrict S).prod ν) :=
(rawPacketDensity_prod_restrict_integrable hg hgnorm hc hr hs ν S).swap
unfold mixturePacketDensity
rw [integral_integral_swap hi]
simp_rw [rawPacketDensity_setIntegral g hgnorm hc hr hs]
def conditionalPacketDensity {Ω B : Type*} [MeasurableSpace Ω] [MeasurableSpace B]
{n : ℕ} (P : Measure Ω) [IsFiniteMeasure P]
(raw : Ω → Configuration n) (obs : Ω → B)
(g : Position → ℝ) (c₁ r₀ s : ℝ) (datum : B) (y : Position) : ℝ :=
mixturePacketDensity (ProbabilityTheory.condDistrib raw obs P datum) g c₁ r₀ s y
theorem conditionalPacketDensity_mass {Ω B : Type*} [MeasurableSpace Ω] [MeasurableSpace B]
{n : ℕ} (P : Measure Ω) [IsFiniteMeasure P]
(raw : Ω → Configuration n) (obs : Ω → B)
{g : Position → ℝ} (hg : Continuous g) (hgnorm : (∫ y, g y^2)=1)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (datum : B) :
(∫ y, conditionalPacketDensity P raw obs g c₁ r₀ s datum y) = n :=
mixturePacketDensity_mass hg hgnorm hc hr hs _
theorem conditionalPacketDensity_nonneg {Ω B : Type*} [MeasurableSpace Ω] [MeasurableSpace B]
{n : ℕ} (P : Measure Ω) [IsFiniteMeasure P]
(raw : Ω → Configuration n) (obs : Ω → B)
(g : Position → ℝ) {c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s)
(datum : B) (y : Position) : 0 ≤ conditionalPacketDensity P raw obs g c₁ r₀ s datum y :=
mixturePacketDensity_nonneg _ g hc hr hs y
theorem conditionalPacketDensity_bounded {Ω B : Type*} [MeasurableSpace Ω] [MeasurableSpace B]
{n : ℕ} (P : Measure Ω) [IsFiniteMeasure P]
(raw : Ω → Configuration n) (obs : Ω → B)
{g : Position → ℝ} (hg : Continuous g) (hgs : HasCompactSupport g)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) :
∃ A : ℝ, 0 ≤ A ∧ ∀ datum y, conditionalPacketDensity P raw obs g c₁ r₀ s datum y ≤ A := by
obtain ⟨A,hA,h⟩ := mixturePacketDensity_bounded (n := n) hg hgs hc hr hs
exact ⟨A,hA,fun datum y => h (ProbabilityTheory.condDistrib raw obs P datum) y⟩
theorem conditionalPacketDensity_eq_condExp {Ω B : Type*} [MeasurableSpace Ω] [MeasurableSpace B]
{n : ℕ} (P : Measure Ω) [IsFiniteMeasure P]
(ν : Measure (Configuration n)) [IsFiniteMeasure ν]
{raw : Ω → Configuration n} {obs : Ω → B}
(hraw : MeasurePreserving raw P ν) (hobs : Measurable obs)
{g : Position → ℝ} (hg : Continuous g) (hgs : HasCompactSupport g)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (y : Position) :
(fun sample => conditionalPacketDensity P raw obs g c₁ r₀ s (obs sample) y) =ᵐ[P]
P[fun sample => rawPacketDensity g c₁ r₀ s (raw sample) y |
MeasurableSpace.comap obs inferInstance] := by
have hf : StronglyMeasurable (fun x : Configuration n => rawPacketDensity g c₁ r₀ s x y) :=
((continuous_rawPacketDensity hg hc hr hs).comp
(continuous_id.prodMk (continuous_const (y := y)))).stronglyMeasurable
exact (ProbabilityTheory.condExp_ae_eq_integral_condDistrib hobs hraw.measurable.aemeasurable hf
(hraw.integrable_comp_of_integrable (rawPacketDensity_integrable_configuration hg hgs hc hr hs ν y))).symm
theorem conditionalPacketDensity_annulus_eq_condExp {Ω B : Type*}
[MeasurableSpace Ω] [MeasurableSpace B]
{n : ℕ} (P : Measure Ω) [IsFiniteMeasure P]
(ν : Measure (Configuration n)) [IsFiniteMeasure ν]
{raw : Ω → Configuration n} {obs : Ω → B}
(hraw : MeasurePreserving raw P ν) (hobs : Measurable obs)
{g : Position → ℝ} (hg : Continuous g) (hgnorm : (∫ y, g y^2)=1)
{c₁ r₀ s : ℝ} (hc : 0 < c₁) (hr : 0 < r₀) (hs : 0 < s) (S : Set Position) :
(fun sample => ∫ y in S, conditionalPacketDensity P raw obs g c₁ r₀ s (obs sample) y) =ᵐ[P]
P[fun sample => packetMass g c₁ r₀ s S (raw sample) |
MeasurableSpace.comap obs inferInstance] := by
have hf := (measurable_packetMass (n := n) hg hc hr hs S).stronglyMeasurable
have hi := (packetMass_memLp hg hgnorm hc hr hs S ν).integrable (by norm_num)
have he := ProbabilityTheory.condExp_ae_eq_integral_condDistrib hobs
hraw.measurable.aemeasurable hf (hraw.integrable_comp_of_integrable hi)
exact (he.trans (Filter.Eventually.of_forall (fun sample =>
(mixturePacketDensity_setIntegral hg hgnorm hc hr hs _ S).symm))).symm
end NeutralAtom
end
end
end
end OAI

Xet Storage Details

Size:
17.3 kB
·
Xet hash:
8928e9617d6cbd854de2b4a9ef2c5cd742783319e3f6c4fbfb508e45a6c24c13

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