Buckets:
| import Mathlib | |
| namespace OAI | |
| open MeasureTheory Set Matrix InnerProductSpace Metric | |
| open scoped ENNReal NNReal RealInnerProductSpace Topology | |
| noncomputable section | |
| namespace PosteriorReplicas | |
| section Determinant | |
| variable {E : Type*} [AddCommGroup E] [Module ℝ E] [FiniteDimensional ℝ E] | |
| lemma det_id_add_smulRight (φ : E →ₗ[ℝ] ℝ) (v : E) : | |
| (LinearMap.id + φ.smulRight v).det = 1 + φ v := by | |
| classical | |
| let b := Module.finBasis ℝ E | |
| rw [← LinearMap.det_toMatrix b, map_add, LinearMap.toMatrix_id, LinearMap.toMatrix_smulRight] | |
| have he : Matrix.vecMulVec (fun i => b.repr v i) (fun i => φ (b i)) = | |
| Matrix.replicateCol Unit (fun i => b.repr v i) * | |
| Matrix.replicateRow Unit (fun i => φ (b i)) := by | |
| ext i j | |
| simp [Matrix.mul_apply, Matrix.vecMulVec] | |
| change (1 + Matrix.vecMulVec (fun i => b.repr v i) (fun i => φ (b i))).det = _ | |
| rw [he, Matrix.det_one_add_replicateCol_mul_replicateRow] | |
| congr 1 | |
| have hφ := congrArg φ (b.sum_repr v) | |
| simpa only [dotProduct, map_sum, map_smul, smul_eq_mul, mul_comm] using hφ | |
| end Determinant | |
| section Ball | |
| variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] | |
| [FiniteDimensional ℝ E] | |
| def ballStretch (x : E) : E := (1 - ‖x‖^2) ^ (-(1 : ℝ) / 2) • x | |
| def ballStretchDeriv (x : E) : E →L[ℝ] E := | |
| (1 - ‖x‖^2) ^ (-(1 : ℝ) / 2) • | |
| (ContinuousLinearMap.id ℝ E + | |
| (1 - ‖x‖^2)⁻¹ • ((innerSL ℝ x).smulRight x)) | |
| omit [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] in | |
| lemma one_sub_norm_sq_pos {x : E} (hx : x ∈ ball (0 : E) 1) : 0 < 1 - ‖x‖^2 := by | |
| have h := mem_ball_zero_iff.mp hx | |
| nlinarith [norm_nonneg x] | |
| omit [FiniteDimensional ℝ E] in | |
| lemma ballStretch_eq : EqOn (ballStretch : E → E) | |
| OpenPartialHomeomorph.univUnitBall.symm (ball 0 1) := by | |
| intro x hx | |
| rw [ballStretch, OpenPartialHomeomorph.univUnitBall_symm_apply, | |
| neg_div, Real.rpow_neg (one_sub_norm_sq_pos hx).le, Real.sqrt_eq_rpow] | |
| omit [FiniteDimensional ℝ E] in | |
| lemma hasFDerivAt_ballStretch {x : E} (hx : x ∈ ball (0 : E) 1) : | |
| HasFDerivAt ballStretch (ballStretchDeriv x) x := by | |
| have hb := one_sub_norm_sq_pos hx | |
| have h := (((hasFDerivAt_id x).norm_sq.const_sub 1).rpow_const | |
| (p := -(1 : ℝ) / 2) (Or.inl hb.ne')).smul (hasFDerivAt_id x) | |
| apply h.congr_fderiv | |
| ext y | |
| simp only [ballStretchDeriv, _root_.smul_apply, _root_.add_apply, | |
| ContinuousLinearMap.id_apply, ContinuousLinearMap.smulRight_apply, | |
| _root_.neg_apply, ContinuousLinearMap.comp_apply, innerSL_apply_apply, id_eq] | |
| rw [Real.rpow_sub hb, Real.rpow_one] | |
| module | |
| lemma det_ballStretchDeriv {x : E} (hx : x ∈ ball (0 : E) 1) : | |
| (ballStretchDeriv x).det = | |
| (1 - ‖x‖^2) ^ (-((Module.finrank ℝ E : ℕ) : ℝ) / 2 - 1) := by | |
| have hb := one_sub_norm_sq_pos hx | |
| change ((ballStretchDeriv x).toLinearMap).det = _ | |
| have he : (ballStretchDeriv x).toLinearMap = | |
| (1 - ‖x‖^2) ^ (-(1 : ℝ) / 2) • (LinearMap.id + | |
| (((1 - ‖x‖^2)⁻¹ • innerSL ℝ x).toLinearMap).smulRight x) := by | |
| ext y | |
| simp [ballStretchDeriv, smul_smul, mul_assoc] | |
| rw [he, LinearMap.det_smul, det_id_add_smulRight] | |
| have hi : 1 + (((1 - ‖x‖^2)⁻¹ • innerSL ℝ x).toLinearMap) x = (1 - ‖x‖^2)⁻¹ := by | |
| simp only [ContinuousLinearMap.coe_coe, _root_.smul_apply, | |
| innerSL_apply_apply, real_inner_self_eq_norm_sq, smul_eq_mul] | |
| field_simp | |
| ring | |
| rw [hi, ← Real.rpow_natCast, ← Real.rpow_mul hb.le, | |
| ← Real.rpow_neg_one, ← Real.rpow_add hb] | |
| congr 1 | |
| ring | |
| @[fun_prop] lemma measurable_ballStretch [MeasurableSpace E] [BorelSpace E] : | |
| Measurable (ballStretch : E → E) := by | |
| unfold ballStretch | |
| fun_prop | |
| omit [FiniteDimensional ℝ E] in | |
| lemma ballStretch_eq_inv_sqrt {x : E} (hx : x ∈ ball (0 : E) 1) : | |
| ballStretch x = (Real.sqrt (1 - ‖x‖^2))⁻¹ • x := by | |
| rw [ballStretch, neg_div, Real.rpow_neg (one_sub_norm_sq_pos hx).le, Real.sqrt_eq_rpow] | |
| omit [FiniteDimensional ℝ E] in | |
| lemma one_add_norm_ballStretch_sq {x : E} (hx : x ∈ ball (0 : E) 1) : | |
| 1 + ‖ballStretch x‖^2 = (1 - ‖x‖^2)⁻¹ := by | |
| have hb := one_sub_norm_sq_pos hx | |
| rw [ballStretch_eq_inv_sqrt hx, norm_smul, Real.norm_eq_abs, | |
| abs_of_pos (inv_pos.mpr (Real.sqrt_pos.mpr hb)), mul_pow, inv_pow, Real.sq_sqrt hb.le] | |
| field_simp | |
| ring | |
| omit [FiniteDimensional ℝ E] in | |
| lemma ballStretch_weight {x : E} (hx : x ∈ ball (0 : E) 1) (q : ℕ) : | |
| ENNReal.ofReal ((1 - ‖x‖^2) ^ (-((Module.finrank ℝ E : ℕ) : ℝ) / 2 - 1)) * | |
| ENNReal.ofReal ((1 + ‖ballStretch x‖^2) ^ | |
| (-((Module.finrank ℝ E + q : ℕ) : ℝ) / 2)) = | |
| ENNReal.ofReal ((1 - ‖x‖^2) ^ (((q : ℝ) - 2) / 2)) := by | |
| have hb := one_sub_norm_sq_pos hx | |
| rw [← ENNReal.ofReal_mul (by positivity), one_add_norm_ballStretch_sq hx, | |
| Real.inv_rpow hb.le, ← Real.rpow_neg hb.le, ← Real.rpow_add hb] | |
| congr 2 | |
| push_cast | |
| ring | |
| lemma lintegral_ballStretch [MeasurableSpace E] [BorelSpace E] (g : E → ℝ≥0∞) : | |
| ∫⁻ x, g x = ∫⁻ y in ball (0 : E) 1, | |
| ENNReal.ofReal ((1 - ‖y‖^2) ^ (-((Module.finrank ℝ E : ℕ) : ℝ) / 2 - 1)) * | |
| g (ballStretch y) := by | |
| have hi : InjOn (ballStretch : E → E) (ball 0 1) := by | |
| exact OpenPartialHomeomorph.univUnitBall.symm.injOn.congr ballStretch_eq.symm | |
| have he : (ballStretch : E → E) '' ball 0 1 = univ := by | |
| rw [ballStretch_eq.image_eq] | |
| exact OpenPartialHomeomorph.univUnitBall.symm.image_source_eq_target | |
| conv_lhs => rw [← Measure.restrict_univ (μ := (volume : Measure E)), ← he] | |
| rw [lintegral_image_eq_lintegral_abs_det_fderiv_mul volume measurableSet_ball | |
| (fun x hx => (hasFDerivAt_ballStretch hx).hasFDerivWithinAt) hi g] | |
| apply setLIntegral_congr_fun measurableSet_ball | |
| intro x hx | |
| dsimp only | |
| rw [det_ballStretchDeriv hx, abs_of_pos (Real.rpow_pos_of_pos (one_sub_norm_sq_pos hx) _)] | |
| end Ball | |
| end PosteriorReplicas | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 5.95 kB
- Xet hash:
- 8257c1c99d8c713481c880ea3612c2ff70777c5ef53aba7e4f28f61b42a90d7a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.