cfahlgren1's picture
download
raw
4.08 kB
import Mathlib
import OAI.Geometry.Borsuk.SphereGeometry.SphereMeasure
namespace OAI
namespace BorsukNine
open scoped RealInnerProductSpace ContDiff
open scoped Manifold
open MeasureTheory Set Metric
open scoped ENNReal Pointwise Matrix
section SphereMoments
variable {ι : Type*} [Fintype ι] [Nonempty ι]
local notation "E" => EuclideanSpace ℝ ι
lemma sphere_coord_integrable (i j : ι) :
Integrable (fun x : UnitSphere E => (x : E) i * (x : E) j) (sphereProbability E) := by
apply Continuous.integrable_of_hasCompactSupport
· exact ((PiLp.continuous_apply 2 _ i).comp continuous_subtype_val).mul
((PiLp.continuous_apply 2 _ j).comp continuous_subtype_val)
· exact HasCompactSupport.of_compactSpace _
omit [Nonempty ι] in
lemma sphere_coord_cross {i j : ι} (hij : i ≠ j) :
(∫ x : UnitSphere E, (x : E) i * (x : E) j ∂sphereProbability E) = 0 := by
classical
let e : E ≃ₗᵢ[ℝ] E := LinearIsometryEquiv.piLpCongrRight 2
(fun k => if k = i then LinearIsometryEquiv.neg ℝ else LinearIsometryEquiv.refl ℝ ℝ)
have hi := integral_sphere_rotation e (fun x : UnitSphere E => (x : E) i * (x : E) j)
have he : (fun x : UnitSphere E => (sphereRotation e x : E) i * (sphereRotation e x : E) j) =
fun x : UnitSphere E => -((x : E) i * (x : E) j) := by
funext x
simp [sphereRotation, e, hij.symm]
rw [he, integral_neg] at hi
linarith
omit [Nonempty ι] in
lemma sphere_coord_diag_eq (i j : ι) :
(∫ x : UnitSphere E, (x : E) i * (x : E) i ∂sphereProbability E) =
∫ x : UnitSphere E, (x : E) j * (x : E) j ∂sphereProbability E := by
classical
let e : E ≃ₗᵢ[ℝ] E := LinearIsometryEquiv.piLpCongrLeft 2 ℝ ℝ (Equiv.swap i j)
have hi := integral_sphere_rotation e (fun x : UnitSphere E => (x : E) j * (x : E) j)
convert hi using 1
congr 1
ext x
simp [sphereRotation, e, Equiv.piCongrLeft']
lemma sphere_coord_diag (i : ι) :
(∫ x : UnitSphere E, (x : E) i * (x : E) i ∂sphereProbability E) =
(Fintype.card ι : ℝ)⁻¹ := by
classical
have hs : (∑ j, ∫ x : UnitSphere E, (x : E) j * (x : E) j ∂sphereProbability E) = 1 := by
rw [← integral_finsetSum _ (fun j _ => sphere_coord_integrable j j)]
have he : (fun x : UnitSphere E => ∑ j, (x : E) j * (x : E) j) = fun _ => (1 : ℝ) := by
funext x
have hn : ‖(x : E)‖ = 1 := mem_sphere_zero_iff_norm.mp x.property
have hh := EuclideanSpace.real_norm_sq_eq (x : E)
rw [hn] at hh
simpa only [one_pow, pow_two, one_mul] using hh.symm
rw [he]
simp
have hval : (Fintype.card ι : ℝ) *
(∫ x : UnitSphere E, (x : E) i * (x : E) i ∂sphereProbability E) = 1 := by
rw [← hs]
rw [Finset.sum_congr rfl (fun j _ => sphere_coord_diag_eq j i)]
simp
exact eq_inv_of_mul_eq_one_right hval
lemma sphere_quadratic_integral (A : Matrix ι ι ℝ) :
(∫ x : UnitSphere E, (x : E).ofLp ⬝ᵥ A *ᵥ (x : E).ofLp ∂sphereProbability E) =
Matrix.trace A * (Fintype.card ι : ℝ)⁻¹ := by
classical
have hc (i j : ι) : Integrable (fun x : UnitSphere E =>
A i j * ((x : E) i * (x : E) j)) (sphereProbability E) :=
(sphere_coord_integrable i j).const_mul _
have he : (fun x : UnitSphere E => (x : E).ofLp ⬝ᵥ A *ᵥ (x : E).ofLp) =
fun x : UnitSphere E => ∑ i, ∑ j, A i j * ((x : E) i * (x : E) j) := by
funext x
simp only [dotProduct, Matrix.mulVec, Finset.mul_sum]
apply Finset.sum_congr rfl
intro i _
apply Finset.sum_congr rfl
intro j _
ring
rw [he, integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun j _ => hc i j))]
simp_rw [integral_finsetSum _ (fun j _ => hc _ j), integral_const_mul]
calc
_ = ∑ i, A i i * (Fintype.card ι : ℝ)⁻¹ := by
apply Finset.sum_congr rfl
intro i _
rw [Finset.sum_eq_single i]
· rw [sphere_coord_diag]
· intro j _ hji
rw [sphere_coord_cross hji.symm, mul_zero]
· simp
_ = _ := by rw [← Finset.sum_mul]; rfl
end SphereMoments
end BorsukNine
end OAI

Xet Storage Details

Size:
4.08 kB
·
Xet hash:
f76da19b339532a1663d135c561ee7987d33cfe35c756b5d819c438b13d60e2a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.