math / data /lean /OAI /Probability /GaussianReplacement /CriticalGeometry.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
21.8 kB
import OAI.Probability.GaussianReplacement.ConditionalInfo
namespace OAI
open MeasureTheory ProbabilityTheory Set Filter
open scoped ENNReal NNReal RealInnerProductSpace Topology
noncomputable section
namespace CurrentProjection
open InnerProductSpace
open InformationTheory
def CriticalComparisonMain : Prop :=
βˆƒ (K : ℝ) (dβ‚€ : β„•), 0 < K ∧ βˆ€ (d : β„•), dβ‚€ ≀ d β†’
βˆ€ (W : Type) [MeasurableSpace W] [Countable W] [MeasurableSingletonClass W],
βˆ€ (P : Measure ((Sphere dΓ—W)Γ—Rows (d/10) d)) [IsProbabilityMeasure P],
(P.map swapLast).fst = (uniformSphere d).prod (gaussianRows (d/10) d) β†’
shannonEntropy (P.map swapLast).snd ≀ ENNReal.ofReal ((d:ℝ)^2) β†’
exposedInformation (P.fst.prod (gaussianRows (d/10+(d/2-d/10)) d)) ≀
exposedInformation (alignedExperiment (r:=d/2-d/10) P) + ENNReal.ofReal (K*d)
def criticalRadius (j : β„•) : ℝ := 2 * (1/2:ℝ)^j
lemma criticalRadius_pos (j : β„•) : 0 < criticalRadius j := by
unfold criticalRadius
positivity
lemma criticalRadius_le_two (j : β„•) : criticalRadius j ≀ 2 := by
unfold criticalRadius
nlinarith [pow_le_oneβ‚€ (by norm_num : (0:ℝ) ≀ 1/2) (by norm_num : (1/2:ℝ) ≀ 1) (n:=j)]
lemma criticalRadius_tendsto : Tendsto criticalRadius atTop (𝓝 0) := by
change Tendsto (fun j => 2 * (1/2:ℝ)^j) atTop (𝓝 0)
simpa only [mul_zero] using (tendsto_pow_atTop_nhds_zero_of_lt_one
(by norm_num : (0:ℝ) ≀ 1/2) (by norm_num : (1/2:ℝ) < 1)).const_mul 2
def ballRatio {d : β„•} (F : Measure (Sphere d)) (β„“ : β„•) (s : Sphere d) (j : β„•) : ℝ :=
(F {x | dist (x:Vector d) (s:Vector d) ≀ criticalRadius j}).toReal / criticalRadius j ^ β„“
lemma sphere_dist_le_two {d : β„•} (s t : Sphere d) : dist (s:Vector d) (t:Vector d) ≀ 2 := by
have hs : β€–(s:Vector d)β€– = 1 := by simp
have ht : β€–(t:Vector d)β€– = 1 := by simp
calc
_ ≀ dist (s:Vector d) 0 + dist (0:Vector d) t := dist_triangle _ _ _
_ = 2 := by simp only [dist_zero_right,dist_zero_left,hs,ht]; norm_num
lemma ballRatio_zero {d : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(β„“ : β„•) (s : Sphere d) : ballRatio F β„“ s 0 = (2:ℝ)⁻¹ ^ β„“ := by
have he : {x : Sphere d | dist (x:Vector d) (s:Vector d) ≀ criticalRadius 0} = univ := by
ext x
simp [criticalRadius, sphere_dist_le_two x s]
unfold ballRatio
rw [he]
simp [criticalRadius,one_div]
lemma ballRatio_nonneg {d : β„•} (F : Measure (Sphere d)) (β„“ : β„•) (s : Sphere d) (j : β„•) :
0 ≀ ballRatio F β„“ s j := div_nonneg ENNReal.toReal_nonneg (pow_pos (criticalRadius_pos j) _).le
lemma measurable_ballRatio {d : β„•} (F : Measure (Sphere d)) [SFinite F] (β„“ j : β„•) :
Measurable (fun s => ballRatio F β„“ s j) := by
have hm : MeasurableSet {p : Sphere d Γ— Sphere d |
dist (p.2:Vector d) (p.1:Vector d) ≀ criticalRadius j} :=
measurableSet_le (by fun_prop) measurable_const
exact (measurable_measure_prodMk_left hm).ennreal_toReal.div_const _
lemma ballRatio_le_growth {d n β„“ : β„•} (F : Measure (Sphere d)) [IsFiniteMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ ≀ n)
(s : Sphere d) (j : β„•) : ballRatio F β„“ s j ≀ D * criticalRadius j^(n-β„“) := by
have hr := criticalRadius_pos j
have hb : (F {x | dist (x:Vector d) (s:Vector d) ≀ criticalRadius j}).toReal ≀
D * criticalRadius j^n := by
simpa only [ENNReal.toReal_ofReal (mul_nonneg hD (pow_nonneg hr.le _))] using
ENNReal.toReal_mono ENNReal.ofReal_ne_top (hF s (criticalRadius j) hr)
apply (div_le_iffβ‚€ (pow_pos hr β„“)).mpr
calc
_ ≀ D * criticalRadius j^n := hb
_ = _ := by rw [mul_assoc, ← pow_add, Nat.sub_add_cancel hβ„“]
lemma ballRatio_tendsto_zero {d n β„“ : β„•} (F : Measure (Sphere d)) [IsFiniteMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (s : Sphere d) :
Tendsto (ballRatio F β„“ s) atTop (𝓝 0) := by
have ht : Tendsto (fun j => D * criticalRadius j^(n-β„“)) atTop (𝓝 0) := by
simpa [Nat.ne_of_gt (Nat.sub_pos_of_lt hβ„“)] using (criticalRadius_tendsto.pow (n-β„“)).const_mul D
exact squeeze_zero (ballRatio_nonneg F β„“ s) (ballRatio_le_growth F D hD hF hβ„“.le s) ht
lemma exists_max_of_tendsto_zero (f : β„• β†’ ℝ) (hf : Tendsto f atTop (𝓝 0))
(h0 : 0 < f 0) : βˆƒ j, βˆ€ i, f i ≀ f j := by
obtain ⟨N,hN⟩ := eventually_atTop.mp (hf.eventually (gt_mem_nhds h0))
obtain ⟨j,hj,hmax⟩ := (Finset.range (N+1)).exists_max_image f (by simp)
refine ⟨j,fun i => ?_⟩
by_cases hi : i < N+1
Β· exact hmax _ (Finset.mem_range.mpr hi)
Β· exact (hN i (by omega)).le.trans (hmax 0 (by simp))
lemma ballRatio_has_max {d n β„“ : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (s : Sphere d) :
βˆƒ j, βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s j := by
apply exists_max_of_tendsto_zero _ (ballRatio_tendsto_zero F D hD hF hβ„“ s)
rw [ballRatio_zero]
positivity
def criticalIndex {d : β„•} (F : Measure (Sphere d)) (β„“ : β„•) (s : Sphere d) : β„• := by
classical
exact if h : βˆƒ j, βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s j then Nat.find h else 0
def criticalMass {d : β„•} (F : Measure (Sphere d)) (β„“ : β„•) (s : Sphere d) : ℝ :=
ballRatio F β„“ s (criticalIndex F β„“ s)
def criticalLevel {d : β„•} (F : Measure (Sphere d)) (β„“ : β„•) (s : Sphere d) : β„€ :=
⌈Real.log (criticalMass F β„“ s)βŒ‰
lemma criticalIndex_max {d n β„“ : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (s : Sphere d) (i : β„•) :
ballRatio F β„“ s i ≀ criticalMass F β„“ s := by
classical
have hm := ballRatio_has_max F D hD hF hβ„“ s
simp only [criticalMass,criticalIndex,dite_eq_left hm]
exact Nat.find_spec hm i
lemma criticalIndex_least {d n β„“ : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (s : Sphere d)
(j : β„•) (hj : βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s j) : criticalIndex F β„“ s ≀ j := by
classical
have hm := ballRatio_has_max F D hD hF hβ„“ s
simp only [criticalIndex,dite_eq_left hm]
exact Nat.find_min' hm hj
lemma measurable_criticalIndex {d : β„•} (F : Measure (Sphere d)) [SFinite F] (β„“ : β„•) :
Measurable (criticalIndex F β„“) := by
classical
have hp (j : β„•) : MeasurableSet {s | βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s j} := by
simp only [Set.ofPred_forall]
exact MeasurableSet.iInter (fun i => measurableSet_le (measurable_ballRatio F β„“ i) (measurable_ballRatio F β„“ j))
have he : MeasurableSet {s | βˆƒ j, βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s j} := by
simp only [Set.ofPred_exists]
exact MeasurableSet.iUnion hp
apply measurable_to_countable'
intro j
change MeasurableSet {s | criticalIndex F β„“ s = j}
by_cases hj : j = 0
Β· subst j
have hset : {s | criticalIndex F β„“ s = 0} =
{s | βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s 0} βˆͺ
{s | Β¬ βˆƒ j, βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s j} := by
ext s
simp only [criticalIndex,mem_ofPred_eq,mem_union]
split_ifs with h
Β· simp [Nat.find_eq_zero,h]
Β· simp [h]
rw [hset]
exact (hp 0).union he.compl
Β· have hset : {s | criticalIndex F β„“ s = j} =
{s | βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s j} ∩
β‹‚ k < j, {s | Β¬ βˆ€ i, ballRatio F β„“ s i ≀ ballRatio F β„“ s k} := by
ext s
simp only [criticalIndex,mem_ofPred_eq,mem_inter_iff,mem_iInter]
split_ifs with h
Β· exact Nat.find_eq_iff h
Β· simp only [eq_comm (a:=0),hj,false_iff,not_and]
intro hs
exact False.elim (h ⟨j,hs⟩)
rw [hset]
exact (hp j).inter (MeasurableSet.iInter (fun k => MeasurableSet.iInter (fun _ => (hp k).compl)))
lemma measurable_criticalMass {d : β„•} (F : Measure (Sphere d)) [SFinite F] (β„“ : β„•) :
Measurable (criticalMass F β„“) := by
have hm : Measurable (fun p : Sphere d Γ— β„• => ballRatio F β„“ p.1 p.2) :=
measurable_from_prod_countable_left (measurable_ballRatio F β„“)
have hpair : Measurable (fun s : Sphere d => (s,criticalIndex F β„“ s)) :=
measurable_id.prodMk (measurable_criticalIndex F β„“)
have hcomp := hm.comp hpair
change Measurable (fun s => ballRatio F β„“ s (criticalIndex F β„“ s))
exact hcomp
lemma measurable_criticalLevel {d : β„•} (F : Measure (Sphere d)) [SFinite F] (β„“ : β„•) :
Measurable (criticalLevel F β„“) := (measurable_criticalMass F β„“).log.ceil
lemma criticalMass_pos {d n β„“ : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (s : Sphere d) :
0 < criticalMass F β„“ s := by
have hm := criticalIndex_max F D hD hF hβ„“ s 0
rw [ballRatio_zero] at hm
exact lt_of_lt_of_le (by positivity) hm
lemma criticalMass_log_bounds {d n β„“ : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 < D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (s : Sphere d) :
-(β„“:ℝ)*Real.log 2 ≀ Real.log (criticalMass F β„“ s) ∧
Real.log (criticalMass F β„“ s) ≀ Real.log D + (n-β„“:β„•)*Real.log 2 := by
have hp := criticalMass_pos F D hD.le hF hβ„“ s
constructor
Β· have hm := criticalIndex_max F D hD.le hF hβ„“ s 0
rw [ballRatio_zero] at hm
have h := Real.log_le_log (by positivity : (0:ℝ)<(2:ℝ)⁻¹^β„“) hm
simpa only [Real.log_pow,Real.log_inv,mul_neg,neg_mul] using h
Β· have hg := ballRatio_le_growth F D hD.le hF hβ„“.le s (criticalIndex F β„“ s)
have hb : criticalMass F β„“ s ≀ D * 2^(n-β„“) := hg.trans
(mul_le_mul_of_nonneg_left (pow_le_pow_leftβ‚€ (criticalRadius_pos _).le (criticalRadius_le_two _) _) hD.le)
simpa only [Real.log_mul hD.ne' (by positivity : (2:ℝ)^(n-β„“) β‰  0),Real.log_pow] using Real.log_le_log hp hb
lemma criticalLevel_bounds {d n β„“ : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 1 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (s : Sphere d) :
-(β„“:ℝ) ≀ (criticalLevel F β„“ s : ℝ) ∧
(criticalLevel F β„“ s : ℝ) ≀ Real.log D + n + 1 := by
obtain ⟨hlo,hup⟩ := criticalMass_log_bounds F D (lt_of_lt_of_le zero_lt_one hD) hF hβ„“ s
have hc := Int.le_ceil (Real.log (criticalMass F β„“ s))
have hc' := Int.ceil_lt_add_one (Real.log (criticalMass F β„“ s))
have hl2 : Real.log 2 ≀ 1 := by linarith [Real.log_two_lt_d9]
have hn : ((n-β„“:β„•):ℝ) ≀ n := by exact_mod_cast Nat.sub_le n β„“
change -(β„“:ℝ) ≀ (⌈Real.log (criticalMass F β„“ s)βŒ‰:ℝ) ∧ _
constructor
Β· nlinarith [Nat.cast_nonneg (Ξ±:=ℝ) β„“]
Β· change (⌈Real.log (criticalMass F β„“ s)βŒ‰:ℝ) ≀ _
nlinarith [Nat.cast_nonneg (Ξ±:=ℝ) (n-β„“)]
lemma criticalIndex_bound {d n β„“ : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 1 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (s : Sphere d) :
(criticalIndex F β„“ s : ℝ) ≀ n + 1 + 2 * Real.log D := by
have hp := criticalMass_pos F D (by linarith) hF hβ„“ s
have hlo := (criticalMass_log_bounds F D (by linarith) hF hβ„“ s).1
have hg := ballRatio_le_growth F D (by linarith) hF hβ„“.le s (criticalIndex F β„“ s)
have hu := Real.log_le_log hp hg
have hd0 : D β‰  0 := by linarith
have hj := criticalRadius_pos (criticalIndex F β„“ s)
rw [Real.log_mul hd0 (pow_ne_zero _ hj.ne'),Real.log_pow] at hu
have hr : Real.log (criticalRadius (criticalIndex F β„“ s)) =
(1-(criticalIndex F β„“ s:ℝ))*Real.log 2 := by
rw [criticalRadius,Real.log_mul (by norm_num) (by positivity),Real.log_pow]
simp only [one_div, Real.log_inv]
ring
rw [hr] at hu
have hj0 : 0 ≀ (criticalIndex F β„“ s:ℝ) := Nat.cast_nonneg _
have hn1 : (1:ℝ) ≀ (n-β„“:β„•) := by exact_mod_cast (Nat.sub_pos_of_lt hβ„“)
have hn : ((n-β„“:β„•):ℝ) = n - β„“ := by exact_mod_cast (Nat.cast_sub hβ„“.le : ((n-β„“:β„•):ℝ) = n-β„“)
have hl2lo : (1/2:ℝ) ≀ Real.log 2 := by linarith [Real.log_two_gt_d9]
have hl2hi : Real.log 2 ≀ 1 := by linarith [Real.log_two_lt_d9]
have hlD := Real.log_nonneg hD
have hh : (criticalIndex F β„“ s:ℝ) * ((n-β„“:β„•):ℝ) * Real.log 2 ≀ Real.log D + n*Real.log 2 := by
nlinarith
have ha : (criticalIndex F β„“ s:ℝ) * Real.log 2 ≀
(criticalIndex F β„“ s:ℝ) * ((n-β„“:β„•):ℝ) * Real.log 2 := by
exact mul_le_mul_of_nonneg_right (by nlinarith) (by linarith)
by_cases hjn : (criticalIndex F β„“ s:ℝ) ≀ n
Β· linarith
Β· have ht := mul_nonneg (show 0 ≀ (criticalIndex F β„“ s:ℝ)-n by linarith)
(show 0 ≀ Real.log 2-1/2 by linarith)
nlinarith
def criticalClass {d : β„•} (F : Measure (Sphere d)) (β„“ j : β„•) (q : β„€) : Set (Sphere d) :=
{s | criticalIndex F β„“ s = j ∧ criticalLevel F β„“ s = q}
lemma measurableSet_criticalClass {d : β„•} (F : Measure (Sphere d)) [SFinite F]
(β„“ j : β„•) (q : β„€) : MeasurableSet (criticalClass F β„“ j q) :=
(measurableSet_eq_fun (measurable_criticalIndex F β„“) measurable_const).inter
(measurableSet_eq_fun (measurable_criticalLevel F β„“) measurable_const)
lemma criticalClass_mass_upper {d n β„“ j : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n)
{q : β„€} {s : Sphere d} (hs : s ∈ criticalClass F β„“ j q) (i : β„•) :
F {x | dist (x:Vector d) (s:Vector d) ≀ criticalRadius i} ≀
ENNReal.ofReal (Real.exp q * criticalRadius i^β„“) := by
have hp := criticalMass_pos F D hD hF hβ„“ s
have hq : Real.log (criticalMass F β„“ s) ≀ q := by
have hh := Int.le_ceil (Real.log (criticalMass F β„“ s))
change Real.log (criticalMass F β„“ s) ≀ (criticalLevel F β„“ s:ℝ) at hh
rwa [hs.2] at hh
have hb := (criticalIndex_max F D hD hF hβ„“ s i).trans ((Real.log_le_iff_le_exp hp).mp hq)
have hb' := (div_le_iffβ‚€ (pow_pos (criticalRadius_pos i) β„“)).mp hb
rw [← ENNReal.ofReal_toReal (measure_ne_top F _)]
exact ENNReal.ofReal_le_ofReal hb'
lemma criticalClass_mass_lower {d n β„“ j : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n)
{q : β„€} {s : Sphere d} (hs : s ∈ criticalClass F β„“ j q) :
ENNReal.ofReal (Real.exp ((q:ℝ)-1) * criticalRadius j^β„“) ≀
F {x | dist (x:Vector d) (s:Vector d) ≀ criticalRadius j} := by
have hp := criticalMass_pos F D hD hF hβ„“ s
have hq : (q:ℝ)-1 ≀ Real.log (criticalMass F β„“ s) := by
have hh := Int.ceil_lt_add_one (Real.log (criticalMass F β„“ s))
change (criticalLevel F β„“ s:ℝ) < _ at hh
rw [hs.2] at hh
linarith
have hb := (Real.le_log_iff_exp_le hp).mp hq
unfold criticalMass at hb
rw [hs.1] at hb
have hb' := (le_div_iffβ‚€ (pow_pos (criticalRadius_pos j) β„“)).mp hb
rw [← ENNReal.ofReal_toReal (measure_ne_top F _)]
exact ENNReal.ofReal_le_ofReal hb'
lemma exists_criticalRadius {t : ℝ} (ht : 0 < t) (ht1 : t ≀ 1) :
βˆƒ j, 2*t ≀ criticalRadius j ∧ criticalRadius j ≀ 4*t := by
obtain ⟨j,hlo,hhi⟩ := exists_nat_pow_near_of_lt_one ht ht1
(by norm_num : (0:ℝ) < 1/2) (by norm_num : (1/2:ℝ) < 1)
refine ⟨j,?_,?_⟩
Β· unfold criticalRadius
linarith
Β· rw [pow_succ] at hlo
unfold criticalRadius
linarith
lemma criticalClass_restrict_growth {d n β„“ j : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (q : β„€) :
LocalGrowth (F.restrict (criticalClass F β„“ j q)) β„“ ((4:ℝ)^β„“ * Real.exp q) := by
intro z t ht
let A := criticalClass F β„“ j q
let b := {x : Sphere d | dist (x:Vector d) z ≀ t}
have hB : MeasurableSet b := measurableSet_le (by fun_prop) measurable_const
by_cases hzero : (F.restrict A) b = 0
Β· change (F.restrict A) b ≀ _
simp [hzero]
have hm : F (b ∩ A) β‰  0 := by rwa [Measure.restrict_apply hB] at hzero
obtain ⟨s,hsb,hsA⟩ := nonempty_of_measure_ne_zero hm
obtain ⟨i,hiB,hiR⟩ : βˆƒ i, b βŠ† {x | dist (x:Vector d) (s:Vector d) ≀ criticalRadius i} ∧ criticalRadius i ≀ 4*t := by
by_cases ht1 : t ≀ 1
· obtain ⟨i,hlo,hhi⟩ := exists_criticalRadius ht ht1
refine ⟨i,?_,hhi⟩
intro x hx
calc
dist (x:Vector d) s ≀ dist (x:Vector d) z + dist z (s:Vector d) := dist_triangle _ _ _
_ ≀ t+t := add_le_add hx (by simpa only [b, Set.mem_ofPred_eq, dist_comm] using hsb)
_ ≀ criticalRadius i := by linarith
· refine ⟨0,fun x _ => ?_,?_⟩
Β· simpa [criticalRadius] using sphere_dist_le_two x s
Β· simp only [criticalRadius,pow_zero,mul_one]
linarith
calc
(F.restrict A) b ≀ F b := (Measure.restrict_le_self : F.restrict A ≀ F) b
_ ≀ F {x | dist (x:Vector d) (s:Vector d) ≀ criticalRadius i} := measure_mono hiB
_ ≀ ENNReal.ofReal (Real.exp q * criticalRadius i^β„“) :=
criticalClass_mass_upper F D hD hF hβ„“ hsA i
_ ≀ ENNReal.ofReal (((4:ℝ)^β„“ * Real.exp q) * t^β„“) := by
apply ENNReal.ofReal_le_ofReal
calc
_ ≀ Real.exp q * (4*t)^β„“ := mul_le_mul_of_nonneg_left
(pow_le_pow_leftβ‚€ (criticalRadius_pos i).le hiR β„“) (Real.exp_pos _).le
_ = _ := by rw [mul_pow]; ring
def criticalPosterior {d : β„•} (F : Measure (Sphere d)) (β„“ j : β„•) (q : β„€) : Measure (Sphere d) :=
(F (criticalClass F β„“ j q))⁻¹ β€’ F.restrict (criticalClass F β„“ j q)
lemma criticalPosterior_growth {d n β„“ j : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (q : β„€)
(hΞ· : 0 < F (criticalClass F β„“ j q)) :
LocalGrowth (criticalPosterior F β„“ j q) β„“
((4:ℝ)^β„“ * Real.exp q / (F (criticalClass F β„“ j q)).toReal) := by
have hΞ·t := measure_ne_top F (criticalClass F β„“ j q)
have hΞ·r : 0 < (F (criticalClass F β„“ j q)).toReal := ENNReal.toReal_pos hΞ·.ne' hΞ·t
intro z t ht
change (F (criticalClass F β„“ j q))⁻¹ * (F.restrict (criticalClass F β„“ j q)) _ ≀ _
apply (mul_le_mul' le_rfl (criticalClass_restrict_growth F D hD hF hβ„“ q z t ht)).trans_eq
have hei : (F (criticalClass F β„“ j q))⁻¹ =
ENNReal.ofReal (((F (criticalClass F β„“ j q)).toReal)⁻¹) := by
rw [ENNReal.ofReal_inv_of_pos hΞ·r, ENNReal.ofReal_toReal hΞ·t]
rw [hei, ← ENNReal.ofReal_mul (inv_nonneg.mpr hΞ·r.le)]
congr 1
ring
lemma criticalClass_packing {d n β„“ j : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (q : β„€)
(s : Finset (Sphere d)) (hs : βˆ€ x ∈ s, x ∈ criticalClass F β„“ j q)
(hsep : βˆ€ x ∈ s, βˆ€ y ∈ s, x β‰  y β†’ 2 * criticalRadius j < dist x y) :
(s.card:ℝ) ≀ Real.exp (1-(q:ℝ)) / criticalRadius j^β„“ := by
let a := Real.exp ((q:ℝ)-1) * criticalRadius j^β„“
have ha : 0 < a := mul_pos (Real.exp_pos _) (pow_pos (criticalRadius_pos j) _)
let b := fun x : Sphere d => {y : Sphere d | dist (y:Vector d) (x:Vector d) ≀ criticalRadius j}
have hm (x : Sphere d) : MeasurableSet (b x) := measurableSet_le (by fun_prop) measurable_const
have hd : (s:Set (Sphere d)).PairwiseDisjoint b := by
intro x hx y hy hxy
apply Set.disjoint_left.mpr
intro z hzx hzy
have hz : dist x y ≀ 2*criticalRadius j := by
change dist (x:Vector d) (y:Vector d) ≀ 2*criticalRadius j
calc
_ ≀ dist (x:Vector d) (z:Vector d) + dist (z:Vector d) (y:Vector d) := dist_triangle _ _ _
_ ≀ criticalRadius j + criticalRadius j := add_le_add
(by simpa only [b, Set.mem_ofPred_eq, dist_comm] using hzx) hzy
_ = _ := by ring
exact (hsep x hx y hy hxy).not_ge hz
have hb : (s.card:ℝβ‰₯0∞) * ENNReal.ofReal a ≀ 1 := by
calc
_ = βˆ‘ x ∈ s, ENNReal.ofReal a := by simp
_ ≀ βˆ‘ x ∈ s, F (b x) := Finset.sum_le_sum (fun x hx => criticalClass_mass_lower F D hD hF hβ„“ (hs x hx))
_ = F (⋃ x ∈ s, b x) := (measure_biUnion_finset hd (fun x _ => hm x)).symm
_ ≀ F Set.univ := measure_mono (Set.subset_univ _)
_ = 1 := measure_univ
have hr : (s.card:ℝ)*a ≀ 1 := by
have hb' : ((s.card:ℝβ‰₯0∞) * ENNReal.ofReal a).toReal ≀ 1 :=
ENNReal.toReal_le_of_le_ofReal (by norm_num : (0:ℝ) ≀ 1) (by simpa using hb)
simpa only [ENNReal.toReal_mul,ENNReal.toReal_natCast,ENNReal.toReal_ofReal ha.le] using hb'
have he : 1/a = Real.exp (1-(q:ℝ)) / criticalRadius j^β„“ := by
dsimp only [a]
rw [show (1-(q:ℝ)) = -((q:ℝ)-1) by ring, Real.exp_neg]
field_simp [ne_of_gt (Real.exp_pos ((q:ℝ)-1)),ne_of_gt (pow_pos (criticalRadius_pos j) β„“)]
exact ((le_div_iffβ‚€ ha).mpr hr).trans_eq he
lemma criticalClass_cover {d n β„“ j : β„•} (F : Measure (Sphere d)) [IsProbabilityMeasure F]
(D : ℝ) (hD : 0 ≀ D) (hF : LocalGrowth F n D) (hβ„“ : β„“ < n) (q : β„€) :
βˆƒ s : Finset (Sphere d), (βˆ€ x ∈ s, x ∈ criticalClass F β„“ j q) ∧
(s.card:ℝ) ≀ Real.exp (1-(q:ℝ)) / criticalRadius j^β„“ ∧
βˆ€ x ∈ criticalClass F β„“ j q, βˆƒ y ∈ s, dist x y ≀ 2*criticalRadius j := by
let N := ⌊Real.exp (1-(q:ℝ)) / criticalRadius j^β„“βŒ‹β‚Š
obtain ⟨s,hs,hsep,hcov⟩ := exists_net_of_finite_packing_bound (criticalClass F β„“ j q)
(mul_nonneg (by norm_num) (criticalRadius_pos j).le) N
(fun s hs hsep => Nat.le_floor (criticalClass_packing F D hD hF hβ„“ q s hs hsep))
exact ⟨s,hs,criticalClass_packing F D hD hF hβ„“ q s hs hsep,hcov⟩
end CurrentProjection
end
end OAI