File size: 20,922 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | import OAI.Probability.PosteriorReplicas.Regression.Fubini
namespace OAI
open MeasureTheory ProbabilityTheory Set Filter
open scoped ENNReal NNReal RealInnerProductSpace
noncomputable section
universe u
namespace PosteriorRegression
open scoped Topology
open InnerProductSpace
open scoped Pointwise
section Block
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace β E]
[FiniteDimensional β E] [MeasurableSpace E] [BorelSpace E]
def PolynomialMass (Ξ½ : Measure E) (a : β) (C : ββ₯0β) : Prop :=
β z : E, β r : β, 0 < r β Ξ½ (Metric.closedBall z r) β€ C * ENNReal.ofReal (r^a)
def localNormalize (Ξ½ : Measure E) (a : β) (C : ββ₯0β) (z : E) (r : β) : Measure E :=
(C * ENNReal.ofReal (r^a))β»ΒΉ β’ (Ξ½.restrict (Metric.closedBall z r)).map (fun x => rβ»ΒΉ β’ (x-z))
omit [FiniteDimensional β E] in
lemma localNormalize_univ {Ξ½ : Measure E} {a : β} {C : ββ₯0β}
(hΞ½ : PolynomialMass Ξ½ a C) (hC : C β 0) (hCt : C β β) (z : E) {r : β} (hr : 0 < r) :
localNormalize Ξ½ a C z r univ β€ 1 := by
have hc0 : C * ENNReal.ofReal (r^a) β 0 := mul_ne_zero hC (by positivity)
have hct : C * ENNReal.ofReal (r^a) β β := ENNReal.mul_ne_top hCt ENNReal.ofReal_ne_top
simp only [localNormalize, Measure.smul_apply, smul_eq_mul, Measure.map_apply (by fun_prop : Measurable (fun x : E => rβ»ΒΉ β’ (x-z))) MeasurableSet.univ,
Set.preimage_univ, Measure.restrict_apply MeasurableSet.univ, Set.univ_inter]
exact (mul_le_mul' le_rfl (hΞ½ z r hr)).trans_eq (ENNReal.inv_mul_cancel hc0 hct)
omit [FiniteDimensional β E] in
lemma localNormalize_finite {Ξ½ : Measure E} {a : β} {C : ββ₯0β}
(hΞ½ : PolynomialMass Ξ½ a C) (hC : C β 0) (hCt : C β β) (z : E) {r : β} (hr : 0 < r) :
IsFiniteMeasure (localNormalize Ξ½ a C z r) :=
β¨(localNormalize_univ hΞ½ hC hCt z hr).trans_lt (by simp)β©
omit [FiniteDimensional β E] in
lemma localNormalize_support (Ξ½ : Measure E) (a : β) (C : ββ₯0β) (z : E) {r : β} (hr : 0 < r) :
(localNormalize Ξ½ a C z r).support β Metric.closedBall 0 1 := by
apply Measure.support_subset_of_isClosed Metric.isClosed_closedBall
rw [mem_ae_iff, localNormalize, Measure.smul_apply, Measure.map_apply (by fun_prop)
Metric.isClosed_closedBall.measurableSet.compl,
Measure.restrict_apply ((by fun_prop : Measurable (fun x : E => rβ»ΒΉ β’ (x-z)))
Metric.isClosed_closedBall.measurableSet.compl)]
have he : (fun x : E => rβ»ΒΉ β’ (x-z)) β»ΒΉ' (Metric.closedBall 0 1)αΆ β© Metric.closedBall z r = β
:= by
apply Set.eq_empty_iff_forall_notMem.mpr
intro x β¨hx,hbβ©
apply hx
rw [Metric.mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hr)]
exact (inv_mul_le_iffβ hr).2 (by simpa [dist_eq_norm] using hb)
rw [he, measure_empty, smul_zero]
omit [FiniteDimensional β E] in
lemma localNormalize_local {Ξ½ : Measure E} {a : β} {C : ββ₯0β}
(hΞ½ : PolynomialMass Ξ½ a C) (hC : C β 0) (hCt : C β β) (z : E) {r : β} (hr : 0 < r) :
HasLocalMassBound (localNormalize Ξ½ a C z r) (a : β) := by
have hc0 : C * ENNReal.ofReal (r^a) β 0 := mul_ne_zero hC (by positivity)
have hct : C * ENNReal.ofReal (r^a) β β := ENNReal.mul_ne_top hCt ENNReal.ofReal_ne_top
intro t _ Ο hΟ
rw [localNormalize, Measure.smul_apply, smul_eq_mul,
Measure.map_apply (by fun_prop) Metric.isClosed_closedBall.measurableSet]
have hsub : (fun x : E => rβ»ΒΉ β’ (x-z)) β»ΒΉ' Metric.closedBall t Ο β
Metric.closedBall (z + r β’ t) (r*Ο) := by
intro x hx
have he : x - (z+r β’ t) = r β’ (rβ»ΒΉ β’ (x-z) - t) := by
rw [smul_sub, smul_smul, mul_inv_cancelβ hr.ne', one_smul]
abel
rw [Metric.mem_closedBall, dist_eq_norm, he, norm_smul, Real.norm_eq_abs, abs_of_pos hr]
exact mul_le_mul_of_nonneg_left (by simpa only [Set.mem_preimage, Metric.mem_closedBall, dist_eq_norm] using hx) hr.le
calc
_ β€ (C * ENNReal.ofReal (r^a))β»ΒΉ * Ξ½ (Metric.closedBall (z+r β’ t) (r*Ο)) :=
mul_le_mul' le_rfl ((Measure.restrict_le_self _).trans (measure_mono hsub))
_ β€ (C * ENNReal.ofReal (r^a))β»ΒΉ * (C * ENNReal.ofReal ((r*Ο)^a)) :=
mul_le_mul' le_rfl (hΞ½ _ _ (mul_pos hr hΟ))
_ = ENNReal.ofReal (Ο^(a : β)) := by
rw [mul_pow, ENNReal.ofReal_mul (pow_nonneg hr.le a), β mul_assoc C,
β mul_assoc, ENNReal.inv_mul_cancel hc0 hct, one_mul, Real.rpow_natCast]
omit [FiniteDimensional β E] [BorelSpace E] in
lemma replicaConstant_le {Ξ½ : Measure E} (hΞ½ : Ξ½ univ β€ 1) {a m : β}
(hd : 1 β€ Module.finrank β E) (ha : a β€ Module.finrank β E) (hm : m β€ Module.finrank β E) :
replicaConstant Ξ½ (a : β) m β€ (128 : ββ₯0β) ^ Module.finrank β E := by
let d := Module.finrank β E
have h2 : (2 : ββ₯0β) β€ 2^d := by simpa using pow_le_pow_rightβ (by norm_num : (1 : ββ₯0β) β€ 2) hd
have hp : (2 : ββ₯0β)^(m+1) β€ 4^d := by
rw [pow_succ]
calc
_ β€ (2 : ββ₯0β)^d * 2^d := mul_le_mul' (pow_le_pow_rightβ (by norm_num) hm) h2
_ = _ := by rw [β mul_pow]; norm_num
calc
replicaConstant Ξ½ (a : β) m β€ 1 + (4 : ββ₯0β)^d * 4^d * 4^d := by
unfold replicaConstant
rw [Real.rpow_natCast, ENNReal.ofReal_mul (by positivity), ENNReal.ofReal_pow (by norm_num),
ENNReal.ofReal_pow (by norm_num)]
norm_num only [ENNReal.ofReal_ofNat]
gcongr <;> norm_num
_ = 1 + (64 : ββ₯0β)^d := by rw [mul_assoc, β mul_pow, β mul_pow]; norm_num
_ β€ (2 : ββ₯0β) * 64^d := by
rw [two_mul]
exact add_le_add (one_le_powβ (by norm_num)) le_rfl
_ β€ (2 : ββ₯0β)^d * 64^d := mul_le_mul' h2 le_rfl
_ = _ := by rw [β mul_pow]; norm_num; rfl
lemma projectionLaw_uniform_set_bound {Ξ½ : Measure E} [IsFiniteMeasure Ξ½]
{a m n : β} (hΞ½ : HasLocalMassBound Ξ½ (a : β)) (hΞ½1 : Ξ½ univ β€ 1)
(hsupport : Ξ½.support β Metric.closedBall 0 1)
(hd : 1 β€ Module.finrank β E) (ha : a β€ Module.finrank β E) (hm : m β€ Module.finrank β E)
(hn : 1 β€ n) (hmargin : n+m β€ a) (S : Set ((Fin m β E) Γ (Fin m β β))) :
projectionLaw Ξ½ m S β€ (128 : ββ₯0β) ^ Module.finrank β E *
(matrixLabelReference (E := E) m S)^(1 - 1 / ((n : β)+1)) := by
apply (projectionLaw_set_bound hΞ½ hsupport m n hn (by exact_mod_cast hmargin) S).trans
apply mul_le_mul' _ le_rfl
have hn0 : (0 : β) < n+1 := by positivity
calc
_ β€ (((128 : ββ₯0β)^Module.finrank β E) ^ n)^(1 / ((n : β)+1)) := by
apply ENNReal.rpow_le_rpow _ (by positivity)
simpa only [one_mul] using mul_le_mul' hΞ½1 (pow_le_pow_left' (replicaConstant_le hΞ½1 hd ha hm) n)
_ = ((128 : ββ₯0β)^Module.finrank β E)^((n : β)/(n+1)) := by
rw [β ENNReal.rpow_natCast, β ENNReal.rpow_mul]
congr 1
rw [mul_one_div]
_ β€ ((128 : ββ₯0β)^Module.finrank β E)^(1 : β) :=
ENNReal.rpow_le_rpow_of_exponent_le (one_le_powβ (by norm_num))
((div_le_one hn0).2 (by linarith))
_ = _ := ENNReal.rpow_one _
lemma finite_rpow_holder {J : Type*} [Fintype J] (a : J β ββ₯0β) {q : β} (hq : 1 < q) :
(β j, a j ^ (1 - 1/q)) β€
(Fintype.card J : ββ₯0β)^(1/q) * (β j, a j)^(1-1/q) := by
have hh := Real.HolderConjugate.conjExponent hq
have hq' : q.conjExponent β 0 := ne_of_gt hh.symm.pos
have hex : 1 - 1/q = q.conjExponentβ»ΒΉ := by simpa only [one_div] using hh.one_sub_inv
rw [hex]
simpa only [one_mul, one_div, ENNReal.one_rpow, ENNReal.rpow_inv_rpow hq',
Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one] using
ENNReal.inner_le_Lp_mul_Lq Finset.univ (fun _ : J => (1 : ββ₯0β))
(fun j => a j ^ q.conjExponentβ»ΒΉ) hh
lemma normalized_routing_bound {J : Type*} [Fintype J] [MeasurableSpace J]
[MeasurableSingletonClass J] (Ξ½ : J β Measure E) [β j, IsFiniteMeasure (Ξ½ j)]
{a m n : β} (hΞ½ : β j, HasLocalMassBound (Ξ½ j) (a : β))
(hΞ½1 : β j, Ξ½ j univ β€ 1) (hsupport : β j, (Ξ½ j).support β Metric.closedBall 0 1)
(hd : 1 β€ Module.finrank β E) (ha : a β€ Module.finrank β E)
(hm : m β€ Module.finrank β E) (hn : 1 β€ n) (hmargin : n+m β€ a)
(Ο : ((Fin m β E) Γ (Fin m β β)) β J) (hΟ : Measurable Ο) :
(β j, projectionLaw (Ξ½ j) m {x | Ο x = j}) β€
(32768 : ββ₯0β)^Module.finrank β E * (Fintype.card J : ββ₯0β)^(1/((n : β)+1)) := by
classical
obtain β¨D, hD, hDs, hDVβ© := exists_projection_support (E := E) m hm
let S : J β Set ((Fin m β E) Γ (Fin m β β)) := fun j => D β© {x | Ο x = j}
have hS (j : J) : MeasurableSet (S j) := hD.inter (hΟ (measurableSet_singleton j))
have hSD (j : J) : projectionLaw (Ξ½ j) m (S j) = projectionLaw (Ξ½ j) m {x | Ο x = j} := by
apply Measure.measure_inter_eq_of_ae
unfold projectionLaw
apply (ae_map_iff (by fun_prop) hD).2
filter_upwards [Measure.quasiMeasurePreserving_snd.ae (Ξ½ j).support_mem_ae] with x hx
exact hDs x.1 x.2 (by simpa using hsupport j hx)
have hdis : Pairwise (Function.onFun Disjoint S) := by
intro i j hij
apply Set.disjoint_left.mpr
intro x hi hj
exact hij (hi.2.symm.trans hj.2)
have hUnion : (β j, S j) = D := by
ext x
simp only [S, Set.mem_iUnion, Set.mem_inter_iff, Set.mem_ofPred_eq]
exact β¨fun β¨_,h,_β© => h, fun h => β¨Ο x,h,rflβ©β©
have hsum : β j, matrixLabelReference (E := E) m (S j) = matrixLabelReference (E := E) m D := by
simpa only [hUnion, tsum_fintype] using (measure_iUnion (ΞΌ := matrixLabelReference (E := E) m) hdis hS).symm
have hΞ± : 0 β€ 1 - 1/((n : β)+1) := by
have : (1 : β) β€ n := by exact_mod_cast hn
nlinarith [one_div_le_one_div_of_le (by norm_num : (0 : β) < 1) (by linarith : (1 : β) β€ n+1)]
have hV : (matrixLabelReference (E := E) m D)^(1-1/((n : β)+1)) β€
(256 : ββ₯0β)^Module.finrank β E := by
calc
_ β€ ((256 : ββ₯0β)^Module.finrank β E)^(1-1/((n : β)+1)) :=
ENNReal.rpow_le_rpow (hDV.trans (pow_le_pow_left' (by norm_num) _)) hΞ±
_ β€ ((256 : ββ₯0β)^Module.finrank β E)^ (1 : β) :=
ENNReal.rpow_le_rpow_of_exponent_le (one_le_powβ (by norm_num)) (sub_le_self _ (by positivity))
_ = _ := ENNReal.rpow_one _
calc
_ = β j, projectionLaw (Ξ½ j) m (S j) := by simp_rw [hSD]
_ β€ β j, (128 : ββ₯0β)^Module.finrank β E *
(matrixLabelReference (E := E) m (S j))^(1-1/((n : β)+1)) :=
Finset.sum_le_sum fun j _ => projectionLaw_uniform_set_bound
(hΞ½ j) (hΞ½1 j) (hsupport j) hd ha hm hn hmargin (S j)
_ = (128 : ββ₯0β)^Module.finrank β E *
β j, (matrixLabelReference (E := E) m (S j))^(1-1/((n : β)+1)) := by rw [Finset.mul_sum]
_ β€ (128 : ββ₯0β)^Module.finrank β E *
((Fintype.card J : ββ₯0β)^(1/((n : β)+1)) *
(β j, matrixLabelReference (E := E) m (S j))^(1-1/((n : β)+1))) :=
mul_le_mul' le_rfl (finite_rpow_holder _ (by exact_mod_cast Nat.lt_add_one_of_le hn))
_ β€ (128 : ββ₯0β)^Module.finrank β E *
((Fintype.card J : ββ₯0β)^(1/((n : β)+1)) * (256 : ββ₯0β)^Module.finrank β E) := by
rw [hsum]
exact mul_le_mul' le_rfl (mul_le_mul' le_rfl hV)
_ = _ := by rw [mul_left_comm, β mul_pow]; norm_num; rw [mul_comm]
omit [FiniteDimensional β E] in
lemma localNormalize_reconstruct (Ξ½ : Measure E) (a : β) {C : ββ₯0β}
(hC : C β 0) (hCt : C β β) (z : E) {r : β} (hr : 0 < r) :
(C * ENNReal.ofReal (r^a)) β’ (localNormalize Ξ½ a C z r).map (fun t => z+r β’ t) =
Ξ½.restrict (Metric.closedBall z r) := by
have hc0 : C * ENNReal.ofReal (r^a) β 0 := mul_ne_zero hC (by positivity)
have hct : C * ENNReal.ofReal (r^a) β β := ENNReal.mul_ne_top hCt ENNReal.ofReal_ne_top
rw [localNormalize, Measure.map_smul _ (by fun_prop), smul_smul, ENNReal.mul_inv_cancel hc0 hct,
one_smul, Measure.map_map (by fun_prop) (by fun_prop)]
have he : (fun t : E => z+r β’ t) β (fun x => rβ»ΒΉ β’ (x-z)) = id := by
ext x
simp [smul_smul, hr.ne']
rw [he, Measure.map_id]
lemma projectionLaw_smul (Ξ½ : Measure E) [SFinite Ξ½] (m : β) (c : ββ₯0β) :
projectionLaw (c β’ Ξ½) m = c β’ projectionLaw Ξ½ m := by
rw [projectionLaw, Measure.prod_smul_right, Measure.map_smul _ (by fun_prop)]
rfl
lemma projectionLaw_affine (Ξ½ : Measure E) [SFinite Ξ½] (m : β) (z : E) (r : β) :
projectionLaw (Ξ½.map (fun t => z + r β’ t)) m =
(projectionLaw Ξ½ m).map (fun x => (x.1, fun j => βͺz,x.1 jβ« + r * x.2 j)) := by
unfold projectionLaw
rw [β Measure.map_id (ΞΌ := Measure.pi (fun _ : Fin m => stdGaussian E)),
Measure.map_prod_map _ _ measurable_id (by fun_prop), Measure.map_map (by fun_prop) (by fun_prop),
Measure.map_id, Measure.map_map (by fun_prop) (by fun_prop)]
congr 1
ext x <;> simp [inner_add_left, real_inner_smul_left]
lemma localized_routing_bound {J : Type*} [Fintype J] [MeasurableSpace J]
[MeasurableSingletonClass J] (Ξ½ : J β Measure E) [β j, IsFiniteMeasure (Ξ½ j)]
{a m n : β} {C : ββ₯0β} (hΞ½ : β j, PolynomialMass (Ξ½ j) a C)
(hC : C β 0) (hCt : C β β)
(hd : 1 β€ Module.finrank β E) (ha : a β€ Module.finrank β E)
(hm : m β€ Module.finrank β E) (hn : 1 β€ n) (hmargin : n+m β€ a)
(Ο : ((Fin m β E) Γ (Fin m β β)) β J) (hΟ : Measurable Ο)
(z : E) {r : β} (hr : 0 < r) :
(β j, projectionLaw ((Ξ½ j).restrict (Metric.closedBall z r)) m {x | Ο x = j}) β€
(32768 : ββ₯0β)^Module.finrank β E * (Fintype.card J : ββ₯0β)^(1/((n : β)+1)) *
C * ENNReal.ofReal (r^a) := by
let Ο (j : J) := localNormalize (Ξ½ j) a C z r
let F : ((Fin m β E) Γ (Fin m β β)) β ((Fin m β E) Γ (Fin m β β)) :=
fun x => (x.1, fun i => βͺz,x.1 iβ« + r * x.2 i)
have hF : Measurable F := by fun_prop
let (j : J) : IsFiniteMeasure (Ο j) := localNormalize_finite (hΞ½ j) hC hCt z hr
have hb := normalized_routing_bound Ο
(fun j => localNormalize_local (hΞ½ j) hC hCt z hr)
(fun j => localNormalize_univ (hΞ½ j) hC hCt z hr)
(fun j => localNormalize_support (Ξ½ j) a C z hr) hd ha hm hn hmargin (Ο β F) (hΟ.comp hF)
have he (j : J) : projectionLaw ((Ξ½ j).restrict (Metric.closedBall z r)) m {x | Ο x = j} =
(C * ENNReal.ofReal (r^a)) * projectionLaw (Ο j) m {x | Ο (F x) = j} := by
rw [β localNormalize_reconstruct (Ξ½ j) a hC hCt z hr, projectionLaw_smul,
projectionLaw_affine, Measure.smul_apply, smul_eq_mul, Measure.map_apply hF
(measurableSet_eq_fun hΟ measurable_const)]
rfl
simp_rw [he]
rw [β Finset.mul_sum]
exact (mul_le_mul' le_rfl hb).trans_eq (by ring)
lemma projectionLaw_withDensity_apply (ΞΌ : Measure E) [SFinite ΞΌ] {h : E β ββ₯0β}
(hh : Measurable h) [SFinite (ΞΌ.withDensity h)] (m : β)
{S : Set ((Fin m β E) Γ (Fin m β β))} (hS : MeasurableSet S) :
projectionLaw (ΞΌ.withDensity h) m S =
β«β» s, h s * (β«β» A, S.indicator (fun _ => (1 : ββ₯0β)) (A, fun j => βͺs,A jβ«)
βMeasure.pi (fun _ : Fin m => stdGaussian E)) βΞΌ := by
have hobs : Measurable (fun x : (Fin m β E) Γ E => (x.1, fun j => βͺx.2,x.1 jβ«)) := by fun_prop
have hi : Measurable (fun x : (Fin m β E) Γ E => S.indicator (fun _ => (1 : ββ₯0β))
(x.1, fun j => βͺx.2,x.1 jβ«)) :=
((measurable_const : Measurable (fun _ => (1 : ββ₯0β))).indicator hS).comp hobs
rw [projectionLaw, Measure.map_apply hobs hS]
rw [β one_mul (((Measure.pi (fun _ : Fin m => stdGaussian E)).prod (ΞΌ.withDensity h)) _),
β lintegral_indicator_const (hobs hS) 1]
change (β«β» x : (Fin m β E) Γ E, S.indicator (fun _ => (1 : ββ₯0β))
(x.1, fun j => βͺx.2,x.1 jβ«) β(Measure.pi (fun _ : Fin m => stdGaussian E)).prod (ΞΌ.withDensity h)) = _
rw [lintegral_prod_symm _ hi.aemeasurable,
lintegral_withDensity_eq_lintegral_mul ΞΌ hh hi.lintegral_prod_left]
rfl
def blockValue {J : Type*} [Fintype J] {m : β} (h : J β E β ββ₯0β)
(Ο : ((Fin m β E) Γ (Fin m β β)) β J) (s : E) : ββ₯0β :=
β«β» A, h (Ο (A, fun j => βͺs,A jβ«)) s βMeasure.pi (fun _ : Fin m => stdGaussian E)
lemma measurable_finite_select {X J : Type*} [MeasurableSpace X] [Fintype J]
[MeasurableSpace J] [MeasurableSingletonClass J]
{h : J β X β ββ₯0β} (hh : β j, Measurable (h j)) {Ο : X β J} (hΟ : Measurable Ο) :
Measurable (fun x => h (Ο x) x) := by
classical
have he (x : X) : h (Ο x) x = β j : J, if Ο x = j then h j x else 0 := by simp
simp_rw [he]
exact Finset.measurable_sum _ fun j _ => Measurable.ite
(measurableSet_eq_fun hΟ measurable_const) (hh j) measurable_const
lemma measurable_blockValue {J : Type*} [Fintype J] [MeasurableSpace J]
[MeasurableSingletonClass J] {m : β} {h : J β E β ββ₯0β}
(hh : β j, Measurable (h j)) {Ο : ((Fin m β E) Γ (Fin m β β)) β J}
(hΟ : Measurable Ο) : Measurable (blockValue h Ο) := by
apply Measurable.lintegral_prod_left
exact measurable_finite_select (fun j => (hh j).comp measurable_snd)
(hΟ.comp (by fun_prop))
omit [BorelSpace E] in
lemma blockValue_le_one {J : Type*} [Fintype J] {m : β} {h : J β E β ββ₯0β}
(hh : β j s, h j s β€ 1) (Ο : ((Fin m β E) Γ (Fin m β β)) β J) (s : E) :
blockValue h Ο s β€ 1 := by
exact (lintegral_mono (fun A => hh _ s)).trans_eq (by simp)
lemma blockValue_mass_identity (ΞΌ : Measure E) [IsFiniteMeasure ΞΌ]
{J : Type*} [Fintype J] [MeasurableSpace J] [MeasurableSingletonClass J]
{m : β} {h : J β E β ββ₯0β} (hh : β j, Measurable (h j))
(hh1 : β j s, h j s β€ 1)
{Ο : ((Fin m β E) Γ (Fin m β β)) β J} (hΟ : Measurable Ο)
{S : Set E} (hS : MeasurableSet S) :
(ΞΌ.withDensity (blockValue h Ο)) S =
β j, projectionLaw ((ΞΌ.withDensity (h j)).restrict S) m {x | Ο x = j} := by
classical
let g (j : J) (s : E) (A : Fin m β E) : ββ₯0β :=
if Ο (A, fun k => βͺs,A kβ«) = j then h j s else 0
have hg (j : J) : Measurable (Function.uncurry (g j)) := by
exact Measurable.ite (measurableSet_eq_fun (hΟ.comp (by fun_prop)) measurable_const)
((hh j).comp measurable_fst) measurable_const
have hselect (s : E) (A : Fin m β E) : h (Ο (A, fun k => βͺs,A kβ«)) s = β j, g j s A := by
simp [g]
have he (j : J) : projectionLaw ((ΞΌ.withDensity (h j)).restrict S) m {x | Ο x = j} =
β«β» s in S, β«β» A, g j s A βMeasure.pi (fun _ : Fin m => stdGaussian E) βΞΌ := by
rw [restrict_withDensity hS]
let : IsFiniteMeasure ((ΞΌ.restrict S).withDensity (h j)) :=
isFiniteMeasure_withDensity (ne_of_lt ((lintegral_mono (hh1 j)).trans_lt (by simp)))
rw [projectionLaw_withDensity_apply _ (hh j) _ (measurableSet_eq_fun hΟ measurable_const)]
apply lintegral_congr
intro s
rw [β lintegral_const_mul' _ _ (ne_of_lt ((hh1 j s).trans_lt (by simp)))]
apply lintegral_congr
intro A
by_cases hx : Ο (A, fun k => βͺs,A kβ«) = j <;> simp [g, hx]
rw [withDensity_apply _ hS]
calc
_ = β«β» s in S, β j, β«β» A, g j s A βMeasure.pi (fun _ : Fin m => stdGaussian E) βΞΌ := by
apply lintegral_congr
intro s
unfold blockValue
simp_rw [hselect]
exact lintegral_finsetSum _ (fun j _ => (hg j).comp (measurable_const.prodMk measurable_id))
_ = _ := by
rw [lintegral_finsetSum _ (fun j _ => (hg j).lintegral_prod_right)]
simp_rw [he]
lemma blockValue_mass_bound (ΞΌ : Measure E) [IsFiniteMeasure ΞΌ]
{J : Type*} [Fintype J] [MeasurableSpace J] [MeasurableSingletonClass J]
{a m n : β} {C : ββ₯0β} {h : J β E β ββ₯0β}
(hh : β j, Measurable (h j)) (hh1 : β j s, h j s β€ 1)
(hlocal : β j, PolynomialMass (ΞΌ.withDensity (h j)) a C)
(hC : C β 0) (hCt : C β β)
(hd : 1 β€ Module.finrank β E) (ha : a β€ Module.finrank β E)
(hm : m β€ Module.finrank β E) (hn : 1 β€ n) (hmargin : n+m β€ a)
{Ο : ((Fin m β E) Γ (Fin m β β)) β J} (hΟ : Measurable Ο) :
PolynomialMass (ΞΌ.withDensity (blockValue h Ο)) a
((32768 : ββ₯0β)^Module.finrank β E * (Fintype.card J : ββ₯0β)^(1/((n : β)+1)) * C) := by
let (j : J) : IsFiniteMeasure (ΞΌ.withDensity (h j)) :=
isFiniteMeasure_withDensity (ne_of_lt ((lintegral_mono (hh1 j)).trans_lt (by simp)))
intro z r hr
rw [blockValue_mass_identity ΞΌ hh hh1 hΟ Metric.isClosed_closedBall.measurableSet]
exact localized_routing_bound (fun j => ΞΌ.withDensity (h j)) hlocal hC hCt hd ha hm hn hmargin Ο hΟ z hr
end Block
end PosteriorRegression
end
end OAI
|