math / data /lean /OAI /Probability /IsingPerceptron /VarianceOfConditionalCenterBound.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
35.9 kB
import Mathlib
import OAI.Probability.IsingPerceptron.MemLpOfAbsBound
namespace OAI
/-! Variance Of Conditional Center Bound. -/
noncomputable section
open MeasureTheory ProbabilityTheory Filter Set
open scoped BigOperators Topology ENNReal NNReal BoundedContinuousFunction
namespace IsingPerceptron
theorem variance_of_conditional_center_bound {A B : Type*} [MeasurableSpace A] [MeasurableSpace B]
(ΞΌ : Measure A) (Ξ½ : Measure B) [IsProbabilityMeasure ΞΌ] [IsProbabilityMeasure Ξ½]
{F : A Γ— B β†’ ℝ} {X : A β†’ ℝ} (hF : Measurable F) (hX : MemLp X 2 ΞΌ)
(hi : βˆ€ a, Integrable (fun b => (F (a,b)-X a)^2) Ξ½)
(hc : βˆ€ a, ∫ b, F (a,b) βˆ‚Ξ½ = X a) {C : A β†’ ℝ} (hC : Integrable C ΞΌ)
(hb : βˆ€ a, (∫ b, (F (a,b)-X a)^2 βˆ‚Ξ½) ≀ C a) :
MemLp F 2 (ΞΌ.prod Ξ½) ∧ Var[F; ΞΌ.prod Ξ½] ≀ (∫ a, C a βˆ‚ΞΌ)+Var[X; ΞΌ] := by
let D : A Γ— B β†’ ℝ := fun p => F p-X p.1
have hd : AEStronglyMeasurable D (ΞΌ.prod Ξ½) :=
hF.aestronglyMeasurable.sub (hX.aestronglyMeasurable.comp_measurePreserving
(measurePreserving_fst (ΞΌ := ΞΌ) (Ξ½ := Ξ½)))
have hdi : Integrable (fun p => (D p)^2) (ΞΌ.prod Ξ½) := by
apply (integrable_prod_iff (hd.pow 2)).mpr
refine ⟨ae_of_all _ hi, ?_⟩
have hnorm : (fun a => ∫ b, β€–(D (a,b))^2β€– βˆ‚Ξ½) =
fun a => ∫ b, (D (a,b))^2 βˆ‚Ξ½ := by
ext a
apply integral_congr_ae
apply ae_of_all
intro b
exact Real.norm_of_nonneg (sq_nonneg _)
change Integrable (fun a => ∫ b, β€–(D (a,b))^2β€– βˆ‚Ξ½) ΞΌ
rw [hnorm]
apply hC.mono' (hd.pow 2).integral_prod_right'
apply ae_of_all
intro a
change β€–βˆ« b, (D (a,b))^2 βˆ‚Ξ½β€– ≀ C a
rw [Real.norm_of_nonneg (integral_nonneg (fun b => sq_nonneg (D (a,b))))]
exact hb a
have hDLp : MemLp D 2 (ΞΌ.prod Ξ½) := (memLp_two_iff_integrable_sq hd).mpr hdi
have hfLp : MemLp F 2 (ΞΌ.prod Ξ½) := by
convert hDLp.add (hX.comp_measurePreserving (measurePreserving_fst (ΞΌ := ΞΌ) (Ξ½ := Ξ½))) using 1
ext p
simp [D]
refine ⟨hfLp, ?_⟩
have hsecLp (a : A) : MemLp (fun b => F (a,b)) 2 Ξ½ := by
have hdm : Measurable (fun b => F (a,b)-X a) :=
(hF.comp (measurable_const.prodMk measurable_id)).sub measurable_const
have hL := (memLp_two_iff_integrable_sq hdm.aestronglyMeasurable).mpr (hi a)
convert hL.add (memLp_const (X a)) using 1
ext b
simp
have hsec (a : A) : (∫ b, F (a,b)^2 βˆ‚Ξ½) ≀ C a+(X a)^2 := by
have hv := hb a
have he := variance_eq_integral (hsecLp a).aemeasurable
rw [hc a] at he
rw [← he, variance_eq_sub (hsecLp a)] at hv
simp only [Pi.pow_apply,hc a] at hv
linarith
have hh := integral_mono hfLp.integrable_sq.integral_prod_left
(hC.add hX.integrable_sq) hsec
simp only [Pi.add_apply] at hh
rw [integral_add hC hX.integrable_sq] at hh
rw [variance_eq_sub hfLp,variance_eq_sub hX]
simp only [Pi.pow_apply]
rw [integral_prod _ hfLp.integrable_sq,
integral_prod _ (hfLp.integrable (by norm_num))]
simp_rw [hc]
linarith
theorem poisson_count_variance {Ξ© : Type*} [MeasurableSpace Ξ©] (Q : Measure Ξ©)
[IsProbabilityMeasure Q] (r : ℝβ‰₯0) {F : β„• Γ— Ξ© β†’ ℝ} (hF : Measurable F)
(hL : βˆ€ m, MemLp (fun Ο‰ => F (m,Ο‰)) 2 Q) {C D K : ℝ} (hK : 0 ≀ K)
(hv : βˆ€ m, Var[(fun Ο‰ => F (m,Ο‰)); Q] ≀ C+D*m)
(hs : βˆ€ m, |(∫ Ο‰, F (m+1,Ο‰) βˆ‚Q)-(∫ Ο‰, F (m,Ο‰) βˆ‚Q)| ≀ K) :
MemLp F 2 ((poissonMeasure r).prod Q) ∧
Var[F; (poissonMeasure r).prod Q] ≀ C+D*r+K^2*r := by
let X := fun m => ∫ Ο‰, F (m,Ο‰) βˆ‚Q
have hx : MemLp X 2 (poissonMeasure r) := nat_step_memLp (poisson_cast_memLp r) hs
have hc : Integrable (fun m : β„• => C+D*m) (poissonMeasure r) :=
(integrable_const C).add (((poisson_cast_memLp r).integrable (by norm_num)).const_mul D)
have hh := variance_of_conditional_center_bound (poissonMeasure r) Q hF hx
(fun m => ((hL m).sub (memLp_const (X m))).integrable_sq) (fun _ => rfl) hc
(fun m => by
rw [← variance_eq_integral (hL m).aemeasurable]
exact hv m)
refine ⟨hh.1, ?_⟩
have hhx := variance_of_distance_bound (poissonMeasure r) hx (poisson_cast_memLp r) hK
(nat_abs_step_bound hs)
rw [poisson_cast_variance] at hhx
have hmean : (∫ m : β„•, C+D*m βˆ‚poissonMeasure r) = C+D*r := by
rw [integral_add (integrable_const C)
(((poisson_cast_memLp r).integrable (by norm_num)).const_mul D),
integral_const,probReal_univ,one_smul,integral_const_mul,poisson_cast_mean]
rw [hmean] at hh
linarith [hh.2]
lemma infinite_prefix_preserving {A : Type*} [MeasurableSpace A] (P : Measure A)
[IsProbabilityMeasure P] (M : β„•) :
MeasurePreserving (fun y : β„• β†’ A => fun i : Fin M => y i)
(Measure.infinitePi (fun _ : β„• => P)) (Measure.pi (fun _ : Fin M => P)) := by
refine ⟨Measurable.of_eval (fun index => measurable_pi_apply (index : β„•)), ?_⟩
rw [Measure.map_infinitePi_infinitePi_of_inj Fin.val_injective,Measure.infinitePi_eq_pi]
abbrev InfiniteRootData (m : β„•) (A : Type*) := (Fin m β†’ ℝ) Γ— (β„• β†’ A)
def rootPrefix {m : β„•} {A : Type*} (M : β„•) (p : InfiniteRootData m A) :
(Fin m β†’ ℝ) Γ— (Fin M β†’ A) := (p.1,fun i => p.2 i)
lemma rootPrefix_preserving {m : β„•} {A : Type*} [MeasurableSpace A] (P : Measure A)
[IsProbabilityMeasure P] (M : β„•) :
MeasurePreserving (rootPrefix (m := m) (A := A) M)
((Measure.pi (fun _ : Fin m => gaussianReal 0 1)).prod (Measure.infinitePi (fun _ : β„• => P)))
((Measure.pi (fun _ : Fin m => gaussianReal 0 1)).prod (Measure.pi (fun _ : Fin M => P))) :=
(MeasurePreserving.id _).prod (infinite_prefix_preserving P M)
lemma patternBase_prefix_succ {I A : Type*} [Fintype I] (Ο† : A β†’ I β†’ ℝ)
(y : β„• β†’ A) (M : β„•) :
patternBase Ο† (fun i : Fin (M+1) => y i) = patternBase Ο† (fun i : Fin M => y i)+Ο† (y M) := by
ext x
simp only [patternBase,Fin.sum_univ_castSucc,Fin.val_castSucc,Fin.val_last,Pi.add_apply]
lemma rootEnergy_prefix_step {I A : Type*} [Fintype I] [MeasurableSpace I]
[MeasurableSingletonClass I] (n : β„•) (b : β„• β†’ ℝ)
(ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ)) (Ξ½ : Measure I) [IsProbabilityMeasure Ξ½]
(hΞΌ : βˆ€ i < n, ExponentialNormMoments (ΞΌ i : Measure (I β†’ ℝ))) (hb : βˆ€ i < n, 0 < b i)
{m : β„•} (a : I β†’ Fin m β†’ ℝ) {Ο† : A β†’ I β†’ ℝ} {K : ℝ} (hK : 0 ≀ K)
(hΟ† : βˆ€ y x, |Ο† y x| ≀ K) (p : InfiniteRootData m A) (M : β„•) :
|rootEnergy n b ΞΌ Ξ½ (patternBase Ο† (fun i : Fin (M+1) => p.2 i)) a p.1-
rootEnergy n b ΞΌ Ξ½ (patternBase Ο† (fun i : Fin M => p.2 i)) a p.1| ≀ K := by
apply (rootEnergy_base_lipschitz n b ΞΌ Ξ½ hΞΌ hb _ _ a p.1).trans
rw [patternBase_prefix_succ,add_sub_cancel_left]
exact (pi_norm_le_iff_of_nonneg hK).mpr (fun x => by simpa only [Real.norm_eq_abs] using hφ (p.2 M) x)
lemma integral_difference_bound {Ξ© : Type*} [MeasurableSpace Ξ©] (P : Measure Ξ©)
[IsProbabilityMeasure P] {X Y : Ξ© β†’ ℝ} (hX : Integrable X P) (hY : Integrable Y P)
{K : ℝ} (h : βˆ€ Ο‰, |X Ο‰-Y Ο‰| ≀ K) : |(∫ Ο‰, X Ο‰ βˆ‚P)-(∫ Ο‰, Y Ο‰ βˆ‚P)| ≀ K := by
rw [← integral_sub hX hY,← Real.norm_eq_abs]
simpa only [probReal_univ,mul_one] using norm_integral_le_of_norm_le_const (ΞΌ := P) (f := fun Ο‰ => X Ο‰-Y Ο‰) (C := K)
(ae_of_all _ (fun Ο‰ => by simpa only [Real.norm_eq_abs] using h Ο‰))
lemma cascadeEnergyLog_total_mean {Ξ© : Type*} {I : Type} [MeasurableSpace Ξ©] [Fintype I]
[MeasurableSpace I] [MeasurableSingletonClass I] (P : Measure Ξ©) [IsProbabilityMeasure P]
(n : β„•) (b : β„• β†’ ℝ) (hb : CascadeExponents n b)
(ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ)) (Ξ½ : Measure I) [IsProbabilityMeasure Ξ½]
(hΞΌ : βˆ€ i < n, ExponentialNormMoments (ΞΌ i : Measure (I β†’ ℝ)))
{H : Ξ© β†’ I β†’ ℝ} (hH : Measurable H) (hL : MemLp (fun Ο‰ => energyRecursion n b ΞΌ Ξ½ (H Ο‰)) 2 P) :
(∫ p : Ξ© Γ— NoiseTree (I β†’ ℝ) n, cascadeEnergyLog n b ΞΌ Ξ½ (H p.1) p.2
βˆ‚P.prod (noiseCascadeLaw (I β†’ ℝ) n b ΞΌ : Measure (NoiseTree (I β†’ ℝ) n))) =
∫ Ο‰, energyRecursion n b ΞΌ Ξ½ (H Ο‰) βˆ‚P := by
have hi := (cascadeEnergyLog_variance P n b hb ΞΌ Ξ½ hΞΌ hH hL).1.integrable (by norm_num)
rw [integral_prod _ hi]
apply integral_congr_ae
exact ae_of_all _ (fun Ο‰ => (cascadeEnergyLog_conditional n b hb ΞΌ Ξ½ hΞΌ (H Ο‰)).2.1)
variable {I A : Type*} [Fintype I] [MeasurableSpace I] [MeasurableSingletonClass I]
variable [MeasurableSpace A]
def infinitePatternRoot (n : β„•) (b : β„• β†’ ℝ) (ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ))
(Ξ½ : Measure I) {m : β„•} (a : I β†’ Fin m β†’ ℝ) (Ο† : A β†’ I β†’ ℝ)
(p : β„• Γ— InfiniteRootData m A) : ℝ :=
rootEnergy n b ΞΌ Ξ½ (patternBase Ο† (fun i : Fin p.1 => p.2.2 i)) a p.2.1
lemma measurable_infinitePatternRoot (n : β„•) (b : β„• β†’ ℝ) (ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ))
(Ξ½ : Measure I) {m : β„•} (a : I β†’ Fin m β†’ ℝ) {Ο† : A β†’ I β†’ ℝ} (hm : Measurable Ο†) :
Measurable (infinitePatternRoot n b ΞΌ Ξ½ a Ο†) := by
apply measurable_from_prod_countable_right
intro M
apply (measurable_energyRecursion n b ΞΌ Ξ½).comp
apply Measurable.of_eval
intro x
exact (Finset.measurable_sum Finset.univ (fun i (_ : i ∈ (Finset.univ : Finset (Fin M))) =>
((measurable_pi_apply x).comp hm).comp
((measurable_pi_apply (i : β„•)).comp measurable_snd))).add
(by fun_prop : Measurable (fun p : InfiniteRootData m A => βˆ‘ j, a x j*p.1 j))
lemma infinitePatternRoot_fixed_variance (n : β„•) (b : β„• β†’ ℝ)
(ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ)) (Ξ½ : Measure I) [IsProbabilityMeasure Ξ½]
(hΞΌ : βˆ€ i < n, ExponentialNormMoments (ΞΌ i : Measure (I β†’ ℝ))) (hb : βˆ€ i < n, 0 < b i)
{m : β„•} (a : I β†’ Fin m β†’ ℝ) (c : Fin m β†’ ℝ) (hc : βˆ€ j, 0 ≀ c j)
(ha : βˆ€ x j, |a x j| ≀ c j) (P : Measure A) [IsProbabilityMeasure P]
{Ο† : A β†’ I β†’ ℝ} (hm : Measurable Ο†) {K : ℝ} (hK : 0 ≀ K) (hΟ† : βˆ€ y x, |Ο† y x| ≀ K)
(M : β„•) :
let Q := (Measure.pi (fun _ : Fin m => gaussianReal 0 1)).prod (Measure.infinitePi (fun _ : β„• => P))
MemLp (fun p => infinitePatternRoot n b ΞΌ Ξ½ a Ο† (M,p)) 2 Q ∧
Var[(fun p => infinitePatternRoot n b ΞΌ Ξ½ a Ο† (M,p));Q] ≀ (βˆ‘ j, (c j)^2)+M*(2*K)^2 := by
have hL := pattern_root_energy_memLp n b μ ν hμ hb a c hc ha P hm hK hφ (M := M)
have hv := pattern_root_energy_variance n b μ ν hμ hb a c hc ha P hm hK hφ (M := M)
have hp := rootPrefix_preserving (m := m) P M
constructor
Β· simpa only [infinitePatternRoot, Function.comp_def, rootPrefix] using
hL.comp_measurePreserving hp
Β· simpa only [infinitePatternRoot, Function.comp_def, rootPrefix] using
(hp.variance_fun_comp hL.aemeasurable).le.trans hv
theorem infinitePatternRoot_poisson_variance (n : β„•) (b : β„• β†’ ℝ)
(ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ)) (Ξ½ : Measure I) [IsProbabilityMeasure Ξ½]
(hΞΌ : βˆ€ i < n, ExponentialNormMoments (ΞΌ i : Measure (I β†’ ℝ))) (hb : βˆ€ i < n, 0 < b i)
{m : β„•} (a : I β†’ Fin m β†’ ℝ) (c : Fin m β†’ ℝ) (hc : βˆ€ j, 0 ≀ c j)
(ha : βˆ€ x j, |a x j| ≀ c j) (P : Measure A) [IsProbabilityMeasure P]
{Ο† : A β†’ I β†’ ℝ} (hm : Measurable Ο†) {K : ℝ} (hK : 0 ≀ K) (hΟ† : βˆ€ y x, |Ο† y x| ≀ K)
(r : ℝβ‰₯0) :
let Q := (poissonMeasure r).prod ((Measure.pi (fun _ : Fin m => gaussianReal 0 1)).prod
(Measure.infinitePi (fun _ : β„• => P)))
MemLp (infinitePatternRoot n b ΞΌ Ξ½ a Ο†) 2 Q ∧
Var[infinitePatternRoot n b ΞΌ Ξ½ a Ο†;Q] ≀ (βˆ‘ j, (c j)^2)+(2*K)^2*r+K^2*r := by
have hh := infinitePatternRoot_fixed_variance n b μ ν hμ hb a c hc ha P hm hK hφ
apply poisson_count_variance _ r (measurable_infinitePatternRoot n b ΞΌ Ξ½ a hm)
(fun M => (hh M).1) hK
Β· intro M
simpa only [mul_comm (M : ℝ)] using (hh M).2
Β· intro M
apply integral_difference_bound _ ((hh (M+1)).1.integrable (by norm_num))
((hh M).1.integrable (by norm_num))
exact fun p => rootEnergy_prefix_step n b μ ν hμ hb a hK hφ p M
end IsingPerceptron
namespace IsingPerceptron
lemma enriched_poisson_root_variance {N : β„•} (hN : 0 < N) (n : β„•) (b : β„• β†’ ℝ)
(hb : βˆ€ i < n, 0 < b i) {h : β„• β†’ ℝ} (hh : Monotone h) (h0 : 0 ≀ h 0)
(u : Fin N β†’ ℝ) (hu : βˆ€ j, |u j| ≀ 2)
(Ξ½ : Measure (Spin N)) [IsProbabilityMeasure Ξ½]
{A : Type*} [MeasurableSpace A] (P : Measure A) [IsProbabilityMeasure P]
{Ο† : A β†’ Spin N β†’ ℝ} (hm : Measurable Ο†) {K : ℝ} (hK : 0 ≀ K)
(hΟ† : βˆ€ y x, |Ο† y x| ≀ K) (r : ℝβ‰₯0) :
let ΞΌ := fun i => enrichedIncrementLaw N n h u (i+1)
let Q := (poissonMeasure r).prod ((Measure.pi (fun _ : Fin (EnrichedRootSize N) => gaussianReal 0 1)).prod
(Measure.infinitePi (fun _ : β„• => P)))
let X := infinitePatternRoot n b ΞΌ Ξ½ (enrichedCoefficientsFin N n h u 0) Ο†
MemLp X 2 Q ∧ Var[X;Q] ≀ N*h 0+4*N*(perturbationScale N)^2+5*K^2*r := by
let xβ‚€ : Spin N := fun _ => 0
let c := fun j => |enrichedCoefficientsFin N n h u 0 xβ‚€ j|
have H := infinitePatternRoot_poisson_variance n b
(fun i => enrichedIncrementLaw N n h u (i+1)) Ξ½
(fun i _ => enrichedIncrementLaw_moments N n h u (i+1)) hb
(enrichedCoefficientsFin N n h u 0) c (fun _ => abs_nonneg _)
(fun x j => (enrichedLevelCoefficient_abs n h u 0 x x₀ _).le) P hm hK hφ r
have hc : (βˆ‘ j, (c j)^2) ≀ N*h 0+4*N*(perturbationScale N)^2 := by
have he := (Fintype.equivFin (EnrichedBlock N)).symm.sum_comp
(fun j => |enrichedLevelCoefficient n h u 0 xβ‚€ j|^2)
change (βˆ‘ j, |enrichedLevelCoefficient n h u 0 xβ‚€ ((Fintype.equivFin _).symm j)|^2) ≀ _
rw [he]
exact enrichedRoot_envelope_sq hN n hh h0 u hu xβ‚€
refine ⟨H.1, ?_⟩
linarith [H.2]
abbrev EnrichedPoissonRoot (N : β„•) (A : Type*) := β„• Γ— InfiniteRootData (EnrichedRootSize N) A
def enrichedPoissonBase {N : β„•} {A : Type*} (n : β„•) (h : β„• β†’ ℝ) (u : Fin N β†’ ℝ)
(Ο† : A β†’ Spin N β†’ ℝ) (p : EnrichedPoissonRoot N A) : Spin N β†’ ℝ :=
enrichedBaseEnergy n h u Ο† (rootPrefix p.1 p.2)
lemma measurable_enrichedPoissonBase {N : β„•} {A : Type*} [MeasurableSpace A]
(n : β„•) (h : β„• β†’ ℝ) (u : Fin N β†’ ℝ) {Ο† : A β†’ Spin N β†’ ℝ} (hm : Measurable Ο†) :
Measurable (enrichedPoissonBase n h u Ο†) := by
apply measurable_from_prod_countable_right
intro M
exact (measurable_enrichedBaseEnergy n h u hm).comp
(measurable_fst.prodMk (Measurable.of_eval (fun index : Fin M =>
(measurable_pi_apply (index : β„•)).comp measurable_snd)))
def enrichedPoissonLog {N : β„•} {A : Type*} (n : β„•) (b h : β„• β†’ ℝ) (u : Fin N β†’ ℝ)
(Ξ½ : Measure (Spin N)) (Ο† : A β†’ Spin N β†’ ℝ)
(p : EnrichedPoissonRoot N A Γ— NoiseTree (Spin N β†’ ℝ) n) : ℝ :=
cascadeEnergyLog n b (fun i => enrichedIncrementLaw N n h u (i+1)) Ξ½
(enrichedPoissonBase n h u Ο† p.1) p.2 - N*h n/2
lemma enriched_poisson_unshifted {N : β„•} (hN : 0 < N) (n : β„•) (b : β„• β†’ ℝ)
(hb : CascadeExponents n b) {h : β„• β†’ ℝ} (hh : Monotone h) (h0 : 0 ≀ h 0)
(u : Fin N β†’ ℝ) (hu : βˆ€ j, |u j| ≀ 2)
(Ξ½ : Measure (Spin N)) [IsProbabilityMeasure Ξ½]
{A : Type*} [MeasurableSpace A] (P : Measure A) [IsProbabilityMeasure P]
{Ο† : A β†’ Spin N β†’ ℝ} (hm : Measurable Ο†) {K : ℝ} (hK : 0 ≀ K)
(hΟ† : βˆ€ y x, |Ο† y x| ≀ K) (r : ℝβ‰₯0) :
let ΞΌ := fun i => enrichedIncrementLaw N n h u (i+1)
let Q := ((poissonMeasure r).prod ((Measure.pi (fun _ : Fin (EnrichedRootSize N) => gaussianReal 0 1)).prod
(Measure.infinitePi (fun _ : β„• => P)))).prod
(noiseCascadeLaw (Spin N β†’ ℝ) n b ΞΌ : Measure (NoiseTree (Spin N β†’ ℝ) n))
let X := fun p : EnrichedPoissonRoot N A Γ— NoiseTree (Spin N β†’ ℝ) n =>
cascadeEnergyLog n b ΞΌ Ξ½ (enrichedPoissonBase n h u Ο† p.1) p.2
MemLp X 2 Q ∧ Var[X;Q] ≀
4*∫ T, (Real.log (rawTreeTotal n T).toReal)^2 βˆ‚(rawCascadeLaw n b : Measure (RawTree n))
+N*h 0+4*N*(perturbationScale N)^2+5*K^2*r := by
have hr := enriched_poisson_root_variance hN n b (fun i hi => (hb.1 i hi).1) hh h0 u hu ν P hm hK hφ r
have hv := cascadeEnergyLog_variance _ n b hb
(fun i => enrichedIncrementLaw N n h u (i+1)) Ξ½
(fun i _ => enrichedIncrementLaw_moments N n h u (i+1))
(measurable_enrichedPoissonBase n h u hm) hr.1
refine ⟨hv.1, ?_⟩
have hrv : Var[(fun p => energyRecursion n b (fun i => enrichedIncrementLaw N n h u (i+1)) Ξ½
(enrichedPoissonBase n h u Ο† p)); _] ≀ N*h 0+4*N*(perturbationScale N)^2+5*K^2*r := hr.2
linarith [hv.2,hrv]
theorem enriched_poisson_variance {N : β„•} (hN : 0 < N) (n : β„•) (b : β„• β†’ ℝ)
(hb : CascadeExponents n b) {h : β„• β†’ ℝ} (hh : Monotone h) (h0 : 0 ≀ h 0)
(u : Fin N β†’ ℝ) (hu : βˆ€ j, |u j| ≀ 2)
(Ξ½ : Measure (Spin N)) [IsProbabilityMeasure Ξ½]
{A : Type*} [MeasurableSpace A] (P : Measure A) [IsProbabilityMeasure P]
{Ο† : A β†’ Spin N β†’ ℝ} (hm : Measurable Ο†) {K : ℝ} (hK : 0 ≀ K)
(hΟ† : βˆ€ y x, |Ο† y x| ≀ K) (r : ℝβ‰₯0) :
let ΞΌ := fun i => enrichedIncrementLaw N n h u (i+1)
let Q := ((poissonMeasure r).prod ((Measure.pi (fun _ : Fin (EnrichedRootSize N) => gaussianReal 0 1)).prod
(Measure.infinitePi (fun _ : β„• => P)))).prod
(noiseCascadeLaw (Spin N β†’ ℝ) n b ΞΌ : Measure (NoiseTree (Spin N β†’ ℝ) n))
MemLp (enrichedPoissonLog n b h u Ξ½ Ο†) 2 Q ∧ Var[enrichedPoissonLog n b h u Ξ½ Ο†;Q] ≀
4*∫ T, (Real.log (rawTreeTotal n T).toReal)^2 βˆ‚(rawCascadeLaw n b : Measure (RawTree n))
+N*h 0+4*N*(perturbationScale N)^2+5*K^2*r := by
exact memLp_variance_shift _
(enriched_poisson_unshifted hN n b hb hh h0 u hu ν P hm hK hφ r) (N*h n/2)
lemma perturbationScale_le_one {N : β„•} (hN : 0 < N) : perturbationScale N ≀ 1 := by
apply Real.rpow_le_one_of_one_le_of_nonpos
Β· exact_mod_cast hN
Β· norm_num
lemma perturbationScale_nonneg (N : β„•) : 0 ≀ perturbationScale N :=
Real.rpow_nonneg (Nat.cast_nonneg _) _
lemma field_cap_arithmetic {N : β„•} (hN : 0 < N) {C H hβ‚€ e K r Ξ± : ℝ}
(hC : 0 ≀ C) (he : 0 ≀ e) (he1 : e ≀ 1) (hh : hβ‚€ ≀ H)
(hr : r ≀ Ξ±*N) :
(C+N*hβ‚€+4*N*e^2+5*K^2*r) / (N:ℝ)^2 ≀ (C+H+4+5*K^2*Ξ±)/N := by
have hn : (0:ℝ) < N := by exact_mod_cast hN
have hn1 : (1:ℝ) ≀ N := by exact_mod_cast hN
have hc : C ≀ N*C := by nlinarith
have hh' := mul_le_mul_of_nonneg_left hh hn.le
have he' : 4*N*e^2 ≀ 4*N := by
have : e^2 ≀ 1 := by nlinarith
nlinarith
have hr' := mul_le_mul_of_nonneg_left hr (show 0 ≀ 5*K^2 by positivity)
apply (div_le_iffβ‚€ (sq_pos_of_pos hn)).2
have hid : (C+H+4+5*K^2*Ξ±)/N*(N:ℝ)^2 = (C+H+4+5*K^2*Ξ±)*N := by
field_simp
rw [hid]
nlinarith
lemma l1_center_le_sqrt_variance {Ξ© : Type*} [MeasurableSpace Ξ©]
{P : Measure Ξ©} [IsProbabilityMeasure P] {X : Ξ© β†’ ℝ} (hX : MemLp X 2 P) :
(∫ Ο‰, |X Ο‰-∫ t, X t βˆ‚P| βˆ‚P) ≀ Real.sqrt (Var[X;P]) := by
have hL := (hX.sub (memLp_const (∫ t, X t βˆ‚P))).norm
have hv := variance_nonneg (fun Ο‰ => |X Ο‰-∫ t, X t βˆ‚P|) P
rw [variance_eq_sub (by simpa only [Real.norm_eq_abs, Pi.sub_apply] using hL)] at hv
have he : (∫ Ο‰, |X Ο‰-∫ t, X t βˆ‚P|^2 βˆ‚P) = Var[X;P] := by
rw [variance_eq_integral hX.aemeasurable]
simp only [sq_abs]
simp only [Pi.pow_apply] at hv
rw [he] at hv
exact (Real.le_sqrt (integral_nonneg (fun _ => abs_nonneg _)) (variance_nonneg X P)).2
(by linarith)
theorem enriched_field_cap_variance {N : β„•} (hN : 0 < N) (n : β„•) (b : β„• β†’ ℝ)
(hb : CascadeExponents n b) {h : β„• β†’ ℝ} (hh : Monotone h) (h0 : 0 ≀ h 0)
{H : ℝ} (hH : h n ≀ H) (u : Fin N β†’ ℝ) (hu : βˆ€ j, |u j| ≀ 2)
(Ξ½ : Measure (Spin N)) [IsProbabilityMeasure Ξ½]
{A : Type*} [MeasurableSpace A] (P : Measure A) [IsProbabilityMeasure P]
{Ο† : A β†’ Spin N β†’ ℝ} (hm : Measurable Ο†) {K : ℝ} (hK : 0 ≀ K)
(hΟ† : βˆ€ y x, |Ο† y x| ≀ K) (r : ℝβ‰₯0) {Ξ± : ℝ} (hr : (r:ℝ) ≀ Ξ±*N) :
let ΞΌ := fun i => enrichedIncrementLaw N n h u (i+1)
let Q := ((poissonMeasure r).prod ((Measure.pi (fun _ : Fin (EnrichedRootSize N) => gaussianReal 0 1)).prod
(Measure.infinitePi (fun _ : β„• => P)))).prod
(noiseCascadeLaw (Spin N β†’ ℝ) n b ΞΌ : Measure (NoiseTree (Spin N β†’ ℝ) n))
let C := 4*∫ T, (Real.log (rawTreeTotal n T).toReal)^2 βˆ‚(rawCascadeLaw n b : Measure (RawTree n))
let X := fun p => enrichedPoissonLog n b h u Ξ½ Ο† p / N
MemLp X 2 Q ∧ Var[X;Q] ≀ (C+H+4+5*K^2*Ξ±)/N := by
have hv := enriched_poisson_variance hN n b hb hh h0 u hu ν P hm hK hφ r
refine ⟨by simpa only [div_eq_mul_inv] using hv.1.mul_const ((N:ℝ)⁻¹), ?_⟩
simp only [div_eq_mul_inv, variance_mul_const]
have hh' : h 0 ≀ H := (hh (Nat.zero_le n)).trans hH
have hc : 0 ≀ 4*∫ T, (Real.log (rawTreeTotal n T).toReal)^2 βˆ‚(rawCascadeLaw n b : Measure (RawTree n)) := by
positivity
have ha := field_cap_arithmetic hN hc (perturbationScale_nonneg N)
(perturbationScale_le_one hN) hh' hr (K := K)
have ha' : (4*∫ T, (Real.log (rawTreeTotal n T).toReal)^2 βˆ‚(rawCascadeLaw n b : Measure (RawTree n))
+N*h 0+4*N*(perturbationScale N)^2+5*K^2*r)*(N:ℝ)⁻¹^2 ≀
(4*∫ T, (Real.log (rawTreeTotal n T).toReal)^2 βˆ‚(rawCascadeLaw n b : Measure (RawTree n))
+H+4+5*K^2*Ξ±)*(N:ℝ)⁻¹ := by
simpa only [div_eq_mul_inv, inv_pow] using ha
exact (mul_le_mul_of_nonneg_right hv.2 (sq_nonneg _)).trans ha'
end IsingPerceptron
open MeasureTheory ProbabilityTheory Filter Set
open scoped BigOperators Topology ENNReal NNReal
namespace IsingPerceptron
variable {I : Type} [Fintype I] [MeasurableSpace I] [MeasurableSingletonClass I]
variable {A S : Type} [MeasurableSpace A] [MeasurableSpace S] [Nonempty A]
lemma labeled_terminal_integral (n : β„•) (Ο‰ : LabeledTree n) (z : MarkForest A n)
(hgood : GoodNoiseTree A n (labeledNoiseJoin A n (Ο‰,z)))
(ht : 0 < noiseTreeTotal A n (labeledNoiseJoin A n (Ο‰,z)) ∧
noiseTreeTotal A n (labeledNoiseJoin A n (Ο‰,z)) < ∞)
{X : β„• β†’ S β†’ ℝ} {u : β„• β†’ S Γ— A β†’ S}
(hX : βˆ€ i, Measurable (X i)) (hu : βˆ€ i, Measurable (u i)) (s : S) :
(∫ Ξ³, Real.exp (noiseLeafTerminal n X u s (labeledNoiseLeaf A n (Ο‰,z) Ξ³))
βˆ‚labeledLeafLaw n Ο‰) =
∫ v, Real.exp (noiseLeafTerminal n X u s v)
βˆ‚noiseLeafKernel A n (labeledNoiseJoin A n (Ο‰,z)) := by
rw [← labeledLeafLaw_noiseMap A n Ο‰ z hgood ht]
exact (integral_map (measurable_of_countable _).aemeasurable
(((measurable_noiseLeafTerminal n hX hu).comp
(measurable_const.prodMk measurable_id)).exp.aestronglyMeasurable)).symm
lemma cascadeEnergyLog_eq_leaf_integral (n : β„•) (b : β„• β†’ ℝ)
(hb : CascadeExponents n b) (ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ))
(Ξ½ : Measure I) (H : I β†’ ℝ) :
βˆ€α΅ T βˆ‚(noiseCascadeLaw (I β†’ ℝ) n b ΞΌ : Measure (NoiseTree (I β†’ ℝ) n)),
cascadeEnergyLog n b ΞΌ Ξ½ H T =
Real.log (∫ v, Real.exp (noiseLeafTerminal n (fun _ => finiteLogIntegral ν)
(fun _ p => p.1 + p.2) H v) βˆ‚noiseLeafKernel (I β†’ ℝ) n T) := by
have hfac := noiseTreeFactor_leafIntegral n b hb ΞΌ
(X := fun _ => finiteLogIntegral Ξ½) (u := fun _ p => p.1+p.2)
(fun _ => measurable_finiteLogIntegral Ξ½) (fun _ => measurable_fst.add measurable_snd) H
have htot : βˆ€α΅ T βˆ‚(noiseCascadeLaw (I β†’ ℝ) n b ΞΌ : Measure (NoiseTree (I β†’ ℝ) n)),
0 < noiseTreeTotal (I β†’ ℝ) n T ∧ noiseTreeTotal (I β†’ ℝ) n T < ∞ := by
apply ae_of_ae_map (p := fun T : RawTree n => 0 < rawTreeTotal n T ∧ rawTreeTotal n T < ∞)
(measurable_noiseTreeForget (I β†’ ℝ) n).aemeasurable
rw [noiseCascadeLaw_forget]
exact (rawCascade_total_moments n b hb).1
filter_upwards [hfac,htot] with T hfac ht
simp only [noiseTreeFactor_terminal] at hfac
unfold cascadeEnergyLog
rw [hfac, ENNReal.toReal_mul]
have ht0 : (noiseTreeTotal (I β†’ ℝ) n T).toReal β‰  0 :=
(ENNReal.toReal_pos ht.1.ne' ht.2.ne).ne'
rw [mul_div_cancel_leftβ‚€ _ ht0]
congr 1
exact (integral_eq_lintegral_of_nonneg_ae (ae_of_all _ (fun v => (Real.exp_pos _).le))
(((measurable_noiseLeafTerminal n (fun _ => measurable_finiteLogIntegral Ξ½)
(fun _ => measurable_fst.add measurable_snd)).comp
(measurable_const.prodMk measurable_id)).exp.aestronglyMeasurable)).symm
def labeledEnergy : (n : β„•) β†’ MarkForest (I β†’ ℝ) n β†’ LabeledLeaf n β†’ (I β†’ ℝ) β†’ (I β†’ ℝ)
| 0, _, _, H => H
| n+1, z, Ξ³, H => labeledEnergy n (z Ξ³.1.1 Ξ³.1.2).2 Ξ³.2 (H + (z Ξ³.1.1 Ξ³.1.2).1)
omit [Fintype I] [MeasurableSpace I] [MeasurableSingletonClass I] in
lemma labeledEnergy_terminal (n : β„•) (Ο‰ : LabeledTree n) (z : MarkForest (I β†’ ℝ) n)
(Ξ³ : LabeledLeaf n) (F : (I β†’ ℝ) β†’ ℝ) (H : I β†’ ℝ) :
noiseLeafTerminal n (fun _ => F) (fun _ p => p.1 + p.2) H
(labeledNoiseLeaf (I β†’ ℝ) n (Ο‰,z) Ξ³) = F (labeledEnergy n z Ξ³ H) := by
induction n generalizing H with
| zero => rfl
| succ n ih => exact ih _ _ _ _
def labeledSpinReference (n : β„•) (Ξ½ : Measure I) (Ο‰ : LabeledTree n) :
Measure (I Γ— LabeledLeaf n) := Ξ½.prod (labeledLeafLaw n Ο‰)
instance labeledSpinReference_probability (n : β„•) (Ξ½ : Measure I) [IsProbabilityMeasure Ξ½]
(Ο‰ : LabeledTree n) : IsProbabilityMeasure (labeledSpinReference n Ξ½ Ο‰) := by
unfold labeledSpinReference
infer_instance
def labeledEnergyLog (n : β„•) (Ξ½ : Measure I) (H : I β†’ ℝ)
(p : LabeledTree n Γ— MarkForest (I β†’ ℝ) n) : ℝ :=
Real.log (∫ s, Real.exp (labeledEnergy n p.2 s.2 H s.1)
βˆ‚labeledSpinReference n Ξ½ p.1)
lemma labeledEnergyLog_eq_leaf (n : β„•) (Ξ½ : Measure I) [IsProbabilityMeasure Ξ½]
(H : I β†’ ℝ) (p : LabeledTree n Γ— MarkForest (I β†’ ℝ) n) :
labeledEnergyLog n ν H p = Real.log (∫ γ,
Real.exp (finiteLogIntegral Ξ½ (labeledEnergy n p.2 Ξ³ H)) βˆ‚labeledLeafLaw n p.1) := by
have hE : Measurable (fun s : I Γ— LabeledLeaf n => Real.exp (labeledEnergy n p.2 s.2 H s.1)) :=
measurable_of_countable _
have hF : Measurable (fun Ξ³ : LabeledLeaf n => Real.exp (finiteLogIntegral Ξ½ (labeledEnergy n p.2 Ξ³ H))) :=
measurable_of_countable _
unfold labeledEnergyLog labeledSpinReference
congr 1
rw [integral_eq_lintegral_of_nonneg_ae (ae_of_all _ (fun _ => (Real.exp_pos _).le)) hE.aestronglyMeasurable,
integral_eq_lintegral_of_nonneg_ae (ae_of_all _ (fun _ => (Real.exp_pos _).le)) hF.aestronglyMeasurable]
congr 1
rw [lintegral_prod _ hE.ennreal_ofReal.aemeasurable,
lintegral_lintegral_swap hE.ennreal_ofReal.aemeasurable]
apply lintegral_congr
intro Ξ³
rw [finiteLogIntegral, Real.exp_log (MeasureTheory.integral_exp_pos Integrable.of_finite)]
exact (ofReal_integral_eq_lintegral_ofReal Integrable.of_finite (ae_of_all _ (fun _ => (Real.exp_pos _).le))).symm
theorem labeledEnergyLog_eq_cascade (n : β„•) (b : β„• β†’ ℝ)
(hb : CascadeExponents n b) (ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ))
(Ξ½ : Measure I) [IsProbabilityMeasure Ξ½] (H : I β†’ ℝ) :
βˆ€α΅ p βˆ‚((labeledCascadeLaw n b : Measure (LabeledTree n)).prod (markForestLaw (I β†’ ℝ) n ΞΌ)),
labeledEnergyLog n Ξ½ H p =
cascadeEnergyLog n b ΞΌ Ξ½ H (labeledNoiseJoin (I β†’ ℝ) n p) := by
have hgood : βˆ€α΅ p βˆ‚((labeledCascadeLaw n b : Measure (LabeledTree n)).prod
(markForestLaw (I β†’ ℝ) n ΞΌ)), GoodNoiseTree (I β†’ ℝ) n (labeledNoiseJoin (I β†’ ℝ) n p) := by
apply ae_of_ae_map (measurable_labeledNoiseJoin (I β†’ ℝ) n).aemeasurable
rw [labeledNoiseJoin_law]
exact noiseCascade_good (I β†’ ℝ) n b hb ΞΌ
have htot : βˆ€α΅ p βˆ‚((labeledCascadeLaw n b : Measure (LabeledTree n)).prod
(markForestLaw (I β†’ ℝ) n ΞΌ)),
0 < noiseTreeTotal (I β†’ ℝ) n (labeledNoiseJoin (I β†’ ℝ) n p) ∧
noiseTreeTotal (I β†’ ℝ) n (labeledNoiseJoin (I β†’ ℝ) n p) < ∞ := by
apply ae_of_ae_map (p := fun T : NoiseTree (I β†’ ℝ) n =>
0 < noiseTreeTotal (I β†’ ℝ) n T ∧ noiseTreeTotal (I β†’ ℝ) n T < ∞)
(measurable_labeledNoiseJoin (I β†’ ℝ) n).aemeasurable
rw [labeledNoiseJoin_law]
apply ae_of_ae_map (p := fun T : RawTree n => 0 < rawTreeTotal n T ∧ rawTreeTotal n T < ∞)
(measurable_noiseTreeForget (I β†’ ℝ) n).aemeasurable
rw [noiseCascadeLaw_forget]
exact (rawCascade_total_moments n b hb).1
have he : βˆ€α΅ p βˆ‚((labeledCascadeLaw n b : Measure (LabeledTree n)).prod
(markForestLaw (I β†’ ℝ) n ΞΌ)),
cascadeEnergyLog n b ΞΌ Ξ½ H (labeledNoiseJoin (I β†’ ℝ) n p) =
Real.log (∫ v, Real.exp (noiseLeafTerminal n (fun _ => finiteLogIntegral ν)
(fun _ p => p.1+p.2) H v) βˆ‚noiseLeafKernel (I β†’ ℝ) n (labeledNoiseJoin (I β†’ ℝ) n p)) := by
apply ae_of_ae_map (p := fun T : NoiseTree (I β†’ ℝ) n =>
cascadeEnergyLog n b μ ν H T = Real.log (∫ v, Real.exp (noiseLeafTerminal n
(fun _ => finiteLogIntegral Ξ½) (fun _ p => p.1+p.2) H v) βˆ‚noiseLeafKernel (I β†’ ℝ) n T))
(measurable_labeledNoiseJoin (I β†’ ℝ) n).aemeasurable
rw [labeledNoiseJoin_law]
exact cascadeEnergyLog_eq_leaf_integral n b hb ΞΌ Ξ½ H
filter_upwards [hgood,htot,he] with p hg ht he
rw [he,labeledEnergyLog_eq_leaf]
congr 1
have hm := labeled_terminal_integral n p.1 p.2 hg ht
(X := fun _ => finiteLogIntegral Ξ½) (u := fun _ p => p.1+p.2)
(fun _ => measurable_finiteLogIntegral Ξ½) (fun _ => measurable_fst.add measurable_snd) H
simpa only [labeledEnergy_terminal] using hm
end IsingPerceptron
namespace IsingPerceptron
def enrichedForestCoordinates (N n : β„•) : Measure (ForestVertex n β†’ Fin (EnrichedRootSize N) β†’ ℝ) :=
Measure.infinitePi (fun _ : ForestVertex n =>
Measure.pi (fun _ : Fin (EnrichedRootSize N) => gaussianReal 0 1))
instance enrichedForestCoordinates_probability (N n : β„•) :
IsProbabilityMeasure (enrichedForestCoordinates N n) := by
unfold enrichedForestCoordinates
infer_instance
def enrichedForest (N n : β„•) (h : β„• β†’ ℝ) (u : Fin N β†’ ℝ)
(g : ForestVertex n β†’ Fin (EnrichedRootSize N) β†’ ℝ) : MarkForest (Spin N β†’ ℝ) n :=
markForestOfCoords (Spin N β†’ ℝ) n
(fun v => enrichedIncrement N n h u (forestVertexDepth n v+1) (g v))
lemma measurable_enrichedForest (N n : β„•) (h : β„• β†’ ℝ) (u : Fin N β†’ ℝ) :
Measurable (enrichedForest N n h u) := by
apply (measurable_markForestOfCoords (Spin N β†’ ℝ) n).comp
exact Measurable.of_eval (fun vertex =>
(measurable_enrichedIncrement N n h u (forestVertexDepth n vertex+1)).comp (measurable_pi_apply vertex))
theorem enrichedForest_law (N n : β„•) (h : β„• β†’ ℝ) (u : Fin N β†’ ℝ) :
(enrichedForestCoordinates N n).map (enrichedForest N n h u) =
markForestLaw (Spin N β†’ ℝ) n (fun i => enrichedIncrementLaw N n h u (i+1)) := by
change (enrichedForestCoordinates N n).map
((markForestOfCoords (Spin N β†’ ℝ) n) ∘
(fun g v => enrichedIncrement N n h u (forestVertexDepth n v+1) (g v))) = _
have hm : Measurable (fun g : ForestVertex n β†’ Fin (EnrichedRootSize N) β†’ ℝ =>
fun v => enrichedIncrement N n h u (forestVertexDepth n v+1) (g v)) := by
exact Measurable.of_eval (fun vertex =>
(measurable_enrichedIncrement N n h u (forestVertexDepth n vertex+1)).comp (measurable_pi_apply vertex))
rw [← Measure.map_map (measurable_markForestOfCoords (Spin N β†’ ℝ) n) hm]
unfold enrichedForestCoordinates
rw [Measure.infinitePi_map_pi _ (fun v => measurable_enrichedIncrement N n h u (forestVertexDepth n v+1))]
exact markForestOfCoords_law (Spin N β†’ ℝ) n (fun i => enrichedIncrementLaw N n h u (i+1))
theorem labeledEnrichedCoordinates_law (N n : β„•) (b h : β„• β†’ ℝ) (u : Fin N β†’ ℝ) :
((labeledCascadeLaw n b : Measure (LabeledTree n)).prod
(enrichedForestCoordinates N n)).map
(fun p => labeledNoiseJoin (Spin N β†’ ℝ) n (p.1,enrichedForest N n h u p.2)) =
noiseCascadeLaw (Spin N β†’ ℝ) n b (fun i => enrichedIncrementLaw N n h u (i+1)) := by
have hp := (MeasurePreserving.id (labeledCascadeLaw n b : Measure (LabeledTree n))).prod
(show MeasurePreserving (enrichedForest N n h u) (enrichedForestCoordinates N n)
(markForestLaw (Spin N β†’ ℝ) n (fun i => enrichedIncrementLaw N n h u (i+1))) from
⟨measurable_enrichedForest N n h u, enrichedForest_law N n h u⟩)
change _ = _
rw [show (fun p => labeledNoiseJoin (Spin N β†’ ℝ) n (p.1,enrichedForest N n h u p.2)) =
(labeledNoiseJoin (Spin N β†’ ℝ) n) ∘ Prod.map id (enrichedForest N n h u) from rfl,
← Measure.map_map (measurable_labeledNoiseJoin (Spin N β†’ ℝ) n) hp.measurable,
hp.map_eq, labeledNoiseJoin_law]
variable {I : Type} [Fintype I] [MeasurableSpace I] [MeasurableSingletonClass I]
omit [Fintype I] [MeasurableSpace I] [MeasurableSingletonClass I] in
lemma measurable_labeledEnergy (n : β„•) (Ξ³ : LabeledLeaf n) :
Measurable (fun p : MarkForest (I β†’ ℝ) n Γ— (I β†’ ℝ) => labeledEnergy n p.1 Ξ³ p.2) := by
induction n with
| zero => exact measurable_snd
| succ n ih =>
exact (ih Ξ³.2).comp (show Measurable (fun p : MarkForest (I β†’ ℝ) (n+1) Γ— (I β†’ ℝ) =>
((p.1 Ξ³.1.1 Ξ³.1.2).2,p.2+(p.1 Ξ³.1.1 Ξ³.1.2).1)) from by fun_prop)
lemma measurable_labeledEnergyLog (n : β„•) (Ξ½ : Measure I) [IsProbabilityMeasure Ξ½] :
Measurable (fun p : (I β†’ ℝ) Γ— (LabeledTree n Γ— MarkForest (I β†’ ℝ) n) =>
labeledEnergyLog n Ξ½ p.1 p.2) := by
let ΞΊ : Kernel ((I β†’ ℝ) Γ— (LabeledTree n Γ— MarkForest (I β†’ ℝ) n)) (LabeledLeaf n) :=
⟨fun p => labeledLeafLaw n p.2.1,(measurable_labeledLeafLaw n).comp (by fun_prop)⟩
have : IsMarkovKernel κ := ⟨fun _ => labeledLeafLaw_probability _ _⟩
have hm : Measurable (fun p : ((I β†’ ℝ) Γ— (LabeledTree n Γ— MarkForest (I β†’ ℝ) n)) Γ— LabeledLeaf n =>
Real.exp (finiteLogIntegral Ξ½ (labeledEnergy n p.1.2.2 p.2 p.1.1))) := by
apply measurable_swap_iff.mp
apply measurable_from_prod_countable_right
intro Ξ³
exact ((measurable_finiteLogIntegral Ξ½).comp
((measurable_labeledEnergy n Ξ³).comp
(show Measurable (fun p : (I β†’ ℝ) Γ— (LabeledTree n Γ— MarkForest (I β†’ ℝ) n) =>
(p.2.2,p.1)) from by fun_prop))).exp
simpa only [labeledEnergyLog_eq_leaf, ΞΊ, Kernel.coe_mk] using
(hm.stronglyMeasurable.integral_kernel_prod_right' (ΞΊ := ΞΊ)).measurable.log
theorem labeledEnergyLog_eq_cascade_random {Ξ© : Type*} [MeasurableSpace Ξ©]
(P : Measure Ξ©) (n : β„•) (b : β„• β†’ ℝ) (hb : CascadeExponents n b)
(ΞΌ : β„• β†’ ProbabilityMeasure (I β†’ ℝ)) (Ξ½ : Measure I) [IsProbabilityMeasure Ξ½]
{H : Ξ© β†’ I β†’ ℝ} (hmH : Measurable H) :
βˆ€α΅ p βˆ‚P.prod ((labeledCascadeLaw n b : Measure (LabeledTree n)).prod
(markForestLaw (I β†’ ℝ) n ΞΌ)),
labeledEnergyLog n Ξ½ (H p.1) p.2 =
cascadeEnergyLog n b ΞΌ Ξ½ (H p.1) (labeledNoiseJoin (I β†’ ℝ) n p.2) := by
have hbase : Measurable (fun p : Ξ© Γ— (LabeledTree n Γ— MarkForest (I β†’ ℝ) n) =>
(H p.1,p.2)) := (hmH.comp measurable_fst).prodMk measurable_snd
have hjoin : Measurable (fun p : Ξ© Γ— (LabeledTree n Γ— MarkForest (I β†’ ℝ) n) =>
(H p.1,labeledNoiseJoin (I β†’ ℝ) n p.2)) :=
(hmH.comp measurable_fst).prodMk ((measurable_labeledNoiseJoin (I β†’ ℝ) n).comp measurable_snd)
have hl := (measurable_labeledEnergyLog n Ξ½).comp hbase
have hr := (measurable_cascadeEnergyLog n b ΞΌ Ξ½).comp hjoin
exact (Measure.ae_prod_iff_ae_ae (measurableSet_eq_fun hl hr)).mpr
(ae_of_all _ (fun Ο‰ => labeledEnergyLog_eq_cascade n b hb ΞΌ Ξ½ (H Ο‰)))
end IsingPerceptron
end
end OAI