introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
5.38 kB
import OAI.Probability.PosteriorReplicas.Regression.StreamIntegrals
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 StreamCaps
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
[FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] [Nontrivial E]
variable {J : Type*} [Fintype J] [MeasurableSpace J] [MeasurableSingletonClass J] [Nonempty J]
def capWeight (y : E) (Ξ΅ : ℝ) : E β†’ ℝβ‰₯0∞ :=
(Metric.closedBall y Ξ΅).indicator (fun _ => 1)
omit [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] [Nontrivial E] in
lemma measurable_capWeight (y : E) (Ξ΅ : ℝ) : Measurable (capWeight y Ξ΅) :=
measurable_const.indicator Metric.isClosed_closedBall.measurableSet
omit [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] [Nontrivial E] in
lemma capWeight_le_one (y s : E) (Ξ΅ : ℝ) : capWeight y Ξ΅ s ≀ 1 := by
classical
simp only [capWeight, Set.indicator_apply]
split <;> simp
lemma capWeight_mass (y : E) {Ξ΅ : ℝ} (hΞ΅ : 0 < Ξ΅) (a : β„•)
(ha : 2*a ≀ Module.finrank ℝ E - 1) :
PolynomialMass ((ambientSphereLaw (E := E)).withDensity (capWeight y Ξ΅)) a
(ENNReal.ofReal ((3 : ℝ)*4^Module.finrank ℝ E) * ENNReal.ofReal (Ξ΅^a)) := by
change PolynomialMass ((ambientSphereLaw (E := E)).withDensity ((Metric.closedBall y Ξ΅).indicator 1)) a _
rw [withDensity_indicator_one Metric.isClosed_closedBall.measurableSet]
exact fun z r hr => terminal_cap_mass y z hΞ΅ hr a ha
lemma ambient_mass_bound {f : E β†’ ℝβ‰₯0∞} {a : β„•} {C : ℝβ‰₯0∞}
(h : PolynomialMass ((ambientSphereLaw (E := E)).withDensity f) a C) :
(∫⁻ s, f s βˆ‚ambientSphereLaw) ≀ C := by
rw [← setLIntegral_univ, ← withDensity_apply _ MeasurableSet.univ]
apply (measure_mono_ae ?_).trans (by simpa using h 0 1 zero_lt_one)
filter_upwards [(withDensity_absolutelyContinuous (ambientSphereLaw (E := E)) f).ae_le
(ambientSphereLaw_ae_norm (E := E))] with s hs
intro _
change dist s 0 ≀ 1
simp [dist_zero_right, hs]
lemma continuation_cap_integral_bound {Ξ΄ : β„• β†’ J β†’ (E Γ— ℝ) β†’ J}
(hΞ΄ : βˆ€ n j, Measurable (Ξ΄ n j)) (y : β„• β†’ J β†’ E)
{Ξ΅ : ℝ} (hΞ΅ : 0 < Ξ΅) {a q : β„•} (ha : 2*a ≀ Module.finrank ℝ E - 1)
(hq : 2 ≀ q) (hqa : 2*q ≀ a) (n k : β„•) (j : J) :
(∫⁻ s, continuation Ξ΄ (fun n j => capWeight (y n j) Ξ΅) n k j s βˆ‚ambientSphereLaw) ≀
(ENNReal.ofReal ((3 : ℝ)*4^Module.finrank ℝ E) * ENNReal.ofReal (Ξ΅^a)) *
streamFactor (E := E) (J := J) q ^ (k/q+1) := by
apply ambient_mass_bound
apply continuation_mass_bound _ hΞ΄ (fun n j => measurable_capWeight _ _)
(fun n j s => capWeight_le_one _ _ _)
(mul_ne_zero (by positivity) (by positivity)) (ENNReal.mul_ne_top ENNReal.ofReal_ne_top ENNReal.ofReal_ne_top)
(fun n j => capWeight_mass (y n j) hΞ΅ a ha)
(Module.finrank_pos (R := ℝ) (M := E)) (by omega) hq hqa
lemma route_cap_bound {Ξ΄ : β„• β†’ J β†’ (E Γ— ℝ) β†’ J}
(hΞ΄ : βˆ€ n j, Measurable (Ξ΄ n j)) (y : J β†’ E)
{Ξ΅ : ℝ} (hΞ΅ : 0 < Ξ΅) {a q : β„•} (ha : 2*a ≀ Module.finrank ℝ E - 1)
(hq : 2 ≀ q) (hqa : 2*q ≀ a) (k : β„•) (j : J) :
((sphereLaw (E := E)).prod (Measure.pi (fun _ : Fin k => stdGaussian E)))
{z | dist z.1.val (y (streamRoute Ξ΄ 0 k j (z.2,fun i => βŸͺz.1.val,z.2 i⟫))) ≀ Ξ΅} ≀
(ENNReal.ofReal ((3 : ℝ)*4^Module.finrank ℝ E) * ENNReal.ofReal (Ξ΅^a)) *
streamFactor (E := E) (J := J) q ^ (k/q+1) := by
let w : β„• β†’ J β†’ E β†’ ℝβ‰₯0∞ := fun _ j => capWeight (y j) Ξ΅
have hV := measurable_continuation (w := w) hΞ΄ (fun _ j => measurable_capWeight (y j) Ξ΅) 0 k j
have he (s : E) : continuation Ξ΄ w 0 k j s =
∫⁻ A : Fin k β†’ E, capWeight (y (streamRoute Ξ΄ 0 k j (A,fun i => βŸͺs,A i⟫))) Ξ΅ s
βˆ‚Measure.pi (fun _ => stdGaussian E) := by
simpa [w, blockValue, continuation] using continuation_unroll (w := w) hΞ΄ 0 k 0 j s
let S : Set ((Metric.sphere (0 : E) 1) Γ— (Fin k β†’ E)) :=
{z | dist z.1.val (y (streamRoute Ξ΄ 0 k j (z.2,fun i => βŸͺz.1.val,z.2 i⟫))) ≀ Ξ΅}
have hS : MeasurableSet S := by
apply measurableSet_le _ measurable_const
exact measurable_subtype_coe.comp measurable_fst |>.dist
((measurable_of_finite y).comp ((measurable_streamRoute hΞ΄ 0 k j).comp (by fun_prop)))
change ((sphereLaw (E := E)).prod _) S ≀ _
rw [← one_mul (((sphereLaw (E := E)).prod _) S), ← lintegral_indicator_const hS 1,
lintegral_prod _ (measurable_const.indicator hS).aemeasurable]
have hf : βˆ€ s : Metric.sphere (0 : E) 1,
(∫⁻ A, S.indicator (fun _ => (1 : ℝβ‰₯0∞)) (s,A) βˆ‚Measure.pi (fun _ => stdGaussian E)) =
continuation Ξ΄ w 0 k j s.val := by
intro s
rw [he]
apply lintegral_congr
intro A
classical
change (if dist s.val (y (streamRoute Ξ΄ 0 k j (A,fun i => βŸͺs.val,A i⟫))) ≀ Ξ΅ then 1 else 0) = _
unfold capWeight
rw [Set.indicator_apply]
rfl
simp_rw [hf]
rw [← lintegral_map hV measurable_subtype_coe]
exact continuation_cap_integral_bound hΞ΄ (fun _ => y) hΞ΅ ha hq hqa 0 k j
end StreamCaps
end PosteriorRegression
end
end OAI