math / data /lean /OAI /Probability /DilutedSpin /CompoundPhysicalMean.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
7.28 kB
import OAI.Probability.DilutedSpin.CompoundRate
import OAI.Probability.DilutedSpin.RandomInsertion
namespace OAI
section
namespace DilutedSpinGlass.PhysicalRoot
open _root_.MeasureTheory _root_.OAI.MeasureTheory ProbabilityTheory HeterogeneousMarks KernelTower
open scoped NNReal ENNReal BigOperators
variable {X Y I : Type} [MeasurableSpace X] [MeasurableSpace Y]
[MeasurableSpace I] [Countable I] [MeasurableSingletonClass I]
{A : I β†’ Type} [βˆ€ i,Fintype (A i)] {N L : β„•}
noncomputable def energyRoot (Q : (i : I) β†’ Fin (L+1) β†’ FiniteLaw (A i))
(m : Fin (L+1) β†’ ℝ) (field : Y β†’ ℝ)
(factor : (i : I) β†’ FinitePath (Fin N β†’ Spin) (L+1) β†’ FinitePath (A i) (L+1) β†’ ℝ)
(h : RootPath Y N) (a : Sigma (RootPath I)) (E : (Fin N β†’ Spin) β†’ ℝ) : ℝ :=
root (terminalTower (fun _ : Fin N => false) FiniteLaw.uniform L) Q m
(fun y => E (terminalState L y)+βˆ‘ i,field (rootArray N h i)*spin (terminalState L y i))
(rootArray a.1 a.2) factor
omit [MeasurableSpace Y] [MeasurableSpace I] [Countable I] [MeasurableSingletonClass I] in
lemma energyRoot_lipschitz (Q : (i : I) β†’ Fin (L+1) β†’ FiniteLaw (A i))
(m : Fin (L+1) β†’ ℝ) (hm : βˆ€ i,0 < m i) (field : Y β†’ ℝ)
(factor : (i : I) β†’ FinitePath (Fin N β†’ Spin) (L+1) β†’ FinitePath (A i) (L+1) β†’ ℝ)
(h : RootPath Y N) (a : Sigma (RootPath I)) :
LipschitzWith 1 (energyRoot Q m field factor h a) := by
apply LipschitzWith.of_dist_le_mul
intro E F
simp only [NNReal.coe_one,one_mul,dist_eq_norm,Real.norm_eq_abs]
apply root_base_stability _ Q m hm
intro y
simp only [add_sub_add_right_eq_sub]
simpa only [Pi.sub_apply,Real.norm_eq_abs] using norm_le_pi_norm (E-F) (terminalState L y)
noncomputable def rootSample (V : X β†’ (Fin N β†’ Spin) β†’ ℝ) (field : Y β†’ ℝ)
(Q : (i : I) β†’ Fin (L+1) β†’ FiniteLaw (A i)) (m : Fin (L+1) β†’ ℝ)
(factor : (i : I) β†’ FinitePath (Fin N β†’ Spin) (L+1) β†’ FinitePath (A i) (L+1) β†’ ℝ)
(h : RootPath Y N) (k : β„•) (x : RootPath X k) (n : β„•) (a : RootPath I n) : ℝ :=
root (terminalTower (fun _ : Fin N => false) FiniteLaw.uniform L) Q m
(fun y => energy V field h k x (terminalState L y)) (rootArray n a) factor
omit [MeasurableSpace I] [Countable I] [MeasurableSingletonClass I] in
lemma measurable_rootSample_fixed
(V : X β†’ (Fin N β†’ Spin) β†’ ℝ) (field : Y β†’ ℝ)
(hV : Measurable V) (hh : Measurable field)
(Q : (i : I) β†’ Fin (L+1) β†’ FiniteLaw (A i)) (m : Fin (L+1) β†’ ℝ)
(factor : (i : I) β†’ FinitePath (Fin N β†’ Spin) (L+1) β†’ FinitePath (A i) (L+1) β†’ ℝ)
(k n : β„•) (a : RootPath I n) :
Measurable (fun z : RootPath Y N Γ— RootPath X k =>
rootSample V field Q m factor z.1 k z.2 n a) := by
let b := fun z : RootPath Y N Γ— RootPath X k =>
fun y : FinitePath (Fin N β†’ Spin) (L+1) => energy V field z.1 k z.2 (terminalState L y)
have hb : βˆ€ y,Measurable (fun z => b z y) := fun y =>
measurable_energy V field (fun Οƒ => (measurable_pi_apply Οƒ).comp hV) hh k _
exact measurable_root (terminalTower (fun _ : Fin N => false) FiniteLaw.uniform L) Q m b
(rootArray n a) (fun _ => factor) hb (fun _ _ _ => measurable_const)
lemma measurable_rootSample
(V : X β†’ (Fin N β†’ Spin) β†’ ℝ) (field : Y β†’ ℝ)
(hV : Measurable V) (hh : Measurable field)
(Q : (i : I) β†’ Fin (L+1) β†’ FiniteLaw (A i)) (m : Fin (L+1) β†’ ℝ)
(factor : (i : I) β†’ FinitePath (Fin N β†’ Spin) (L+1) β†’ FinitePath (A i) (L+1) β†’ ℝ)
(k n : β„•) :
Measurable (fun z : (RootPath Y N Γ— RootPath X k) Γ— RootPath I n =>
rootSample V field Q m factor z.1.1 k z.1.2 n z.2) := by
apply measurable_from_prod_countable_left
intro a
exact measurable_rootSample_fixed V field hV hh Q m factor k n a
omit [MeasurableSpace X] [MeasurableSpace Y] [MeasurableSpace I] [Countable I]
[MeasurableSingletonClass I] in
lemma rootSample_bound (V : X β†’ (Fin N β†’ Spin) β†’ ℝ) (field : Y β†’ ℝ)
(Q : (i : I) β†’ Fin (L+1) β†’ FiniteLaw (A i)) (m : Fin (L+1) β†’ ℝ) (hm : βˆ€ i,0 < m i)
(factor : (i : I) β†’ FinitePath (Fin N β†’ Spin) (L+1) β†’ FinitePath (A i) (L+1) β†’ ℝ)
{C H D : ℝ} (hVb : βˆ€ x Οƒ,|V x Οƒ|≀C) (hhb : βˆ€ y,|field y|≀H)
(hfb : βˆ€ i y a,|Real.log (factor i y a)|≀D)
(h : RootPath Y N) (k : β„•) (x : RootPath X k) (n : β„•) (a : RootPath I n) :
|rootSample V field Q m factor h k x n a|≀H*N+C*k+D*n := by
exact root_uniform_bound _ Q m hm _ _ factor
(fun y => energy_bound V field hVb hhb h k x _) hfb
omit [MeasurableSpace Y] [MeasurableSpace I] [Countable I] [MeasurableSingletonClass I] in
lemma integral_compound_energyRoot (ΞΌ : Measure X) [IsProbabilityMeasure ΞΌ] (r : ℝβ‰₯0)
(V : X β†’ (Fin N β†’ Spin) β†’ ℝ) (field : Y β†’ ℝ) (hV : Measurable V)
(Q : (i : I) β†’ Fin (L+1) β†’ FiniteLaw (A i)) (m : Fin (L+1) β†’ ℝ) (hm : βˆ€ i,0 < m i)
(factor : (i : I) β†’ FinitePath (Fin N β†’ Spin) (L+1) β†’ FinitePath (A i) (L+1) β†’ ℝ)
(h : RootPath Y N) (a : Sigma (RootPath I)) :
(∫ z : Sigma (RootPath X),rootSample V field Q m factor h z.1 z.2 a.1 a.2 βˆ‚compoundRootLaw ΞΌ r)=
∫ E,energyRoot Q m field factor h a E βˆ‚compoundPoisson r (Measure.map V ΞΌ) := by
have he : Measurable (fun z : Sigma (RootPath X) => βˆ‘ i,V (rootArray z.1 z.2 i)) := by
apply measurable_sigmaUncurry (f := fun n (x : RootPath X n) => βˆ‘ i,V (rootArray n x i))
intro k
simpa only [rootArrayEquiv_apply] using
(show Measurable (fun x : RootPath X k => βˆ‘ i,V (rootArrayEquiv (X := X) k x i)) by fun_prop)
rw [← map_compoundRoot_energy ΞΌ V hV r,
integral_map he.aemeasurable (energyRoot_lipschitz Q m hm field factor h a).continuous.aestronglyMeasurable]
apply integral_congr_ae
filter_upwards [] with z
simp only [rootSample,energyRoot,energy,Finset.sum_apply]
lemma fullRoot_energy_integral
(ΞΎ : Measure Y) [IsProbabilityMeasure ΞΎ] (ΞΌ : Measure X) [IsProbabilityMeasure ΞΌ]
(Ξ½ : Measure I) [IsProbabilityMeasure Ξ½] (r s : ℝβ‰₯0)
(V : X β†’ (Fin N β†’ Spin) β†’ ℝ) (field : Y β†’ ℝ)
(hV : Measurable V) (hh : Measurable field)
(Q : (i : I) β†’ Fin (L+1) β†’ FiniteLaw (A i)) (m : Fin (L+1) β†’ ℝ) (hm : βˆ€ i,0 < m i)
(factor : (i : I) β†’ FinitePath (Fin N β†’ Spin) (L+1) β†’ FinitePath (A i) (L+1) β†’ ℝ)
{C H D : ℝ} (hC : 0≀C) (hD : 0≀D)
(hVb : βˆ€ x Οƒ,|V x Οƒ|≀C) (hhb : βˆ€ y,|field y|≀H)
(hfb : βˆ€ i y a,|Real.log (factor i y a)|≀D) :
(∫ z,packRoot (rootSample V field Q m factor) z βˆ‚fullRootLaw (fun _ => ΞΎ) ΞΌ Ξ½ r s) =
∫ h,∫ a,∫ E,energyRoot Q m field factor h a E
βˆ‚compoundPoisson r (Measure.map V ΞΌ) βˆ‚compoundRootLaw Ξ½ s βˆ‚rootLaw N (fun _ => ΞΎ) := by
rw [integral_fullRootLaw_reordered (fun _ => ΞΎ) ΞΌ Ξ½ r s
(measurable_rootSample V field hV hh Q m factor)
(fun h k x n a => (rootSample_bound V field Q m hm factor hVb hhb hfb h k x n a).trans
(count_linear_le_quadratic hC hD k n))]
apply integral_congr_ae
filter_upwards [] with h
apply integral_congr_ae
filter_upwards [] with a
exact integral_compound_energyRoot ΞΌ r V field hV Q m hm factor h a
end DilutedSpinGlass.PhysicalRoot
end
end OAI