Buckets:
| import OAI.Probability.PosteriorReplicas.Gaussian.GaussianPolar | |
| namespace OAI | |
| open MeasureTheory ProbabilityTheory Set Matrix InnerProductSpace Metric | |
| open scoped ENNReal NNReal RealInnerProductSpace Topology | |
| noncomputable section | |
| namespace PosteriorReplicas | |
| lemma lintegral_pos_smul {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] | |
| [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] | |
| {r : ℝ} (hr : 0 < r) {f : E → ℝ≥0∞} (hf : Measurable f) : | |
| ∫⁻ x, f x = ENNReal.ofReal (r ^ Module.finrank ℝ E) * ∫⁻ x, f (r • x) := by | |
| have hm : ENNReal.ofReal (r ^ Module.finrank ℝ E) • | |
| (volume : Measure E).map (fun x => r • x) = volume := by | |
| rw [Measure.map_addHaar_smul _ hr.ne', smul_smul, | |
| abs_of_pos (inv_pos.mpr (pow_pos hr _)), ← ENNReal.ofReal_mul (by positivity), | |
| mul_inv_cancel₀ (pow_ne_zero _ hr.ne'), ENNReal.ofReal_one, one_smul] | |
| conv_lhs => rw [← hm] | |
| rw [lintegral_smul_measure, lintegral_map hf (by fun_prop)] | |
| rfl | |
| lemma lintegral_Ioi_pos_mul {r : ℝ} (hr : 0 < r) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : | |
| ∫⁻ x in Ioi (0 : ℝ), f x = ENNReal.ofReal r * ∫⁻ x in Ioi (0 : ℝ), f (r * x) := by | |
| have hp : (fun x : ℝ => r * x) ⁻¹' Ioi 0 = Ioi 0 := by | |
| ext x | |
| simp only [mem_preimage, mem_Ioi, mul_pos_iff_of_pos_left hr] | |
| have hm : ENNReal.ofReal r • | |
| ((volume : Measure ℝ).restrict (Ioi 0)).map (fun x => r * x) = volume.restrict (Ioi 0) := by | |
| rw [← hp, ← Measure.restrict_map (by fun_prop) measurableSet_Ioi, | |
| Real.map_volume_mul_left hr.ne', Measure.restrict_smul, smul_smul, | |
| abs_of_pos (inv_pos.mpr hr), ← ENNReal.ofReal_mul hr.le, | |
| mul_inv_cancel₀ hr.ne', ENNReal.ofReal_one, one_smul] | |
| rw [hp] | |
| conv_lhs => rw [← hm] | |
| rw [lintegral_smul_measure, lintegral_map hf (by fun_prop)] | |
| rfl | |
| lemma radial_lintegral_scale (n : ℕ) {c : ℝ} (hc : 0 < c) {f : ℝ → ℝ≥0∞} | |
| (hf : Measurable f) : | |
| ∫⁻ r in Ioi (0 : ℝ), ENNReal.ofReal (r ^ n) * f (c * r) = | |
| ENNReal.ofReal ((c⁻¹) ^ (n + 1)) * | |
| ∫⁻ r in Ioi (0 : ℝ), ENNReal.ofReal (r ^ n) * f r := by | |
| rw [lintegral_Ioi_pos_mul (inv_pos.mpr hc) (by fun_prop)] | |
| have he (r : ℝ) : ENNReal.ofReal ((c⁻¹ * r)^n) * f (c * (c⁻¹ * r)) = | |
| ENNReal.ofReal ((c⁻¹)^n) * (ENNReal.ofReal (r^n) * f r) := by | |
| rw [mul_pow, ENNReal.ofReal_mul (by positivity), ← mul_assoc, mul_inv_cancel₀ hc.ne', one_mul, | |
| mul_assoc] | |
| simp_rw [he] | |
| rw [lintegral_const_mul _ (by fun_prop), ← mul_assoc, | |
| ← ENNReal.ofReal_mul (by positivity)] | |
| congr 2 | |
| rw [pow_succ'] | |
| variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] | |
| [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] | |
| omit [MeasurableSpace E] [BorelSpace E] in | |
| lemma gaussianPolarRadius_mass_integral [MeasurableSpace E] [BorelSpace E] : | |
| gaussianPolarRadius E univ = | |
| ∫⁻ r in Ioi (0 : ℝ), ENNReal.ofReal (r ^ (Module.finrank ℝ E - 1)) * | |
| gaussianRadialDensity (Module.finrank ℝ E) r := by | |
| rw [gaussianPolarRadius, withDensity_apply _ MeasurableSet.univ, | |
| Measure.restrict_univ, Measure.volumeIoiPow] | |
| rw [lintegral_withDensity_eq_lintegral_mul _ | |
| (show Measurable (fun r : Ioi (0 : ℝ) => ENNReal.ofReal (r.1 ^ (Module.finrank ℝ E - 1))) by fun_prop) | |
| (show Measurable (fun r : Ioi (0 : ℝ) => gaussianRadialDensity (Module.finrank ℝ E) r.1) by fun_prop)] | |
| exact lintegral_subtype_comap (measurableSet_Ioi (a := (0 : ℝ))) | |
| (fun r : ℝ => ENNReal.ofReal (r ^ (Module.finrank ℝ E - 1)) * | |
| gaussianRadialDensity (Module.finrank ℝ E) r) | |
| omit [MeasurableSpace E] [BorelSpace E] in | |
| lemma lintegral_gaussianPolarRadius [MeasurableSpace E] [BorelSpace E] | |
| {g : ℝ → ℝ≥0∞} (hg : Measurable g) : | |
| ∫⁻ r : Ioi (0 : ℝ), g r.1 ∂gaussianPolarRadius E = | |
| ∫⁻ r in Ioi (0 : ℝ), | |
| ENNReal.ofReal (r ^ (Module.finrank ℝ E - 1)) * | |
| gaussianRadialDensity (Module.finrank ℝ E) r * g r := by | |
| rw [gaussianPolarRadius, lintegral_withDensity_eq_lintegral_mul _ (by fun_prop) (by fun_prop), | |
| Measure.volumeIoiPow, lintegral_withDensity_eq_lintegral_mul _ (by fun_prop) (by fun_prop)] | |
| simpa only [Pi.mul_apply, mul_assoc] using | |
| lintegral_subtype_comap (μ := (volume : Measure ℝ)) (measurableSet_Ioi (a := (0 : ℝ))) | |
| (fun r : ℝ => ENNReal.ofReal (r ^ (Module.finrank ℝ E - 1)) * | |
| gaussianRadialDensity (Module.finrank ℝ E) r * g r) | |
| lemma gaussianRadialDensity_mul (n q : ℕ) (r s : ℝ) : | |
| gaussianRadialDensity q r * gaussianRadialDensity n (r * s) = | |
| ENNReal.ofReal ((2 * Real.pi) ^ (-((n + q : ℕ) : ℝ) / 2) * | |
| Real.exp (-(1 + s^2) * r^2 / 2)) := by | |
| unfold gaussianRadialDensity | |
| rw [← ENNReal.ofReal_mul (by positivity)] | |
| congr 1 | |
| rw [mul_mul_mul_comm, ← Real.rpow_add (by positivity), ← Real.exp_add] | |
| congr 1 <;> congr 1 <;> push_cast <;> ring | |
| lemma radial_power_gaussian_product {n q d : ℕ} (hq : 1 ≤ q) (hd : n + q = d) | |
| {r : ℝ} (hr : 0 ≤ r) (s : ℝ) : | |
| ENNReal.ofReal (r ^ (q - 1)) * gaussianRadialDensity q r * | |
| (ENNReal.ofReal (r ^ n) * gaussianRadialDensity n (r * s)) = | |
| ENNReal.ofReal (r ^ (d - 1)) * | |
| ENNReal.ofReal ((2 * Real.pi) ^ (-(d : ℝ) / 2) * | |
| Real.exp (-(1 + s^2) * r^2 / 2)) := by | |
| rw [mul_mul_mul_comm, ← ENNReal.ofReal_mul (by positivity), ← pow_add, | |
| gaussianRadialDensity_mul, hd] | |
| have hn : q - 1 + n = d - 1 := by omega | |
| rw [hn] | |
| lemma radial_gaussian_integral [Nontrivial E] {a : ℝ} (ha : 0 < a) : | |
| ∫⁻ r in Ioi (0 : ℝ), ENNReal.ofReal (r ^ (Module.finrank ℝ E - 1)) * | |
| ENNReal.ofReal ((2 * Real.pi) ^ (-((Module.finrank ℝ E : ℕ) : ℝ) / 2) * | |
| Real.exp (-a * r^2 / 2)) = | |
| ENNReal.ofReal (a ^ (-((Module.finrank ℝ E : ℕ) : ℝ) / 2)) * | |
| ((volume : Measure E).toSphere univ)⁻¹ := by | |
| have he (r : ℝ) : ENNReal.ofReal ((2 * Real.pi) ^ (-((Module.finrank ℝ E : ℕ) : ℝ) / 2) * | |
| Real.exp (-a * r^2 / 2)) = gaussianRadialDensity (Module.finrank ℝ E) (Real.sqrt a * r) := by | |
| unfold gaussianRadialDensity | |
| rw [mul_pow, Real.sq_sqrt ha.le] | |
| ring_nf | |
| simp_rw [he] | |
| rw [radial_lintegral_scale _ (Real.sqrt_pos.mpr ha) (by fun_prop), | |
| ← gaussianPolarRadius_mass_integral, gaussianPolarRadius_mass] | |
| congr 2 | |
| rw [Nat.sub_add_cancel Module.finrank_pos, Real.sqrt_eq_rpow, | |
| ← Real.rpow_neg ha.le, ← Real.rpow_natCast, | |
| ← Real.rpow_mul ha.le] | |
| congr 1 | |
| ring | |
| lemma sphere_area [Nontrivial E] : (volume : Measure E).toSphere univ = | |
| ENNReal.ofReal (2 * Real.pi ^ (((Module.finrank ℝ E : ℕ) : ℝ) / 2) / | |
| Real.Gamma (((Module.finrank ℝ E : ℕ) : ℝ) / 2)) := by | |
| have hd : 0 < ((Module.finrank ℝ E : ℕ) : ℝ) := Nat.cast_pos.mpr Module.finrank_pos | |
| have hp : Real.sqrt Real.pi ^ Module.finrank ℝ E = | |
| Real.pi ^ (((Module.finrank ℝ E : ℕ) : ℝ) / 2) := by | |
| rw [Real.sqrt_eq_rpow, ← Real.rpow_natCast, ← Real.rpow_mul Real.pi_pos.le] | |
| congr 1 | |
| ring | |
| rw [Measure.toSphere_apply_univ, InnerProductSpace.volume_ball, ENNReal.ofReal_one, | |
| one_pow, one_mul, ← ENNReal.ofReal_natCast, | |
| ← ENNReal.ofReal_mul (by positivity), hp, Real.Gamma_add_one (by positivity)] | |
| congr 1 | |
| field_simp | |
| end PosteriorReplicas | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 7.34 kB
- Xet hash:
- 38a87efaee1bf1debd115b988dd185d8aa9ac27133a1bdd52296b404736fe565
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.