Exact Lean source
TensorLANEmbeddingWhiteningGaussian
formalization/Cloning/TensorLANEmbeddingWhiteningGaussian.lean
Source hash: 73e4b891193d1467d39bcfb7dfd1fd251345b553caa6c03093ff9a9888b379b0
Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.
The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.
Declarations in this module
1import Cloning.TensorLANEmbeddingWhitening
2
3/-! Whitening sends the actual normalized root covariance Gaussian to the
4literal standard Gaussian used in physical mixed LAN. -/
5noncomputable section
6open scoped BigOperators Topology Classical InnerProductSpace NNReal ENNReal
7open MeasureTheory Filter
8namespace Cloning.TensorLAN
9open Cloning.YoungHyperplane Cloning.PCTJointGaussianWhitening
10set_option backward.isDefEq.respectTransparency false
11set_option maxHeartbeats 1200000
12variable {d : ℕ}
13
14private theorem standardGaussian_profile (y : Fin d → ℝ) :
15 GaussianAffinity.productDensity (fun _ : Fin d => (1/2 : ℝ)) y =
16 GaussianAffinity.productDensity (fun _ : Fin d => (1/2 : ℝ)) 0 *
17 Real.exp (-(1/2 : ℝ) * ∑ i, (y i)^2) := by
18 simp only [GaussianAffinity.productDensity, GaussianAffinity.density, Pi.zero_apply,
19 zero_pow (by norm_num : (2 : ℕ) ≠ 0), mul_zero, Real.exp_zero, mul_one]
20 rw [Finset.prod_mul_distrib, ← Real.exp_sum, ← Finset.mul_sum]
21
22private theorem covarianceGaussian_profile (p : Fin (d+1) → ℝ)
23 (hp : ∀ a, 0 < p a) (hs : ∑ a, p a = 1)
24 (b : OrthonormalBasis (Fin (d+1)) ℝ (EuclideanSpace ℝ (Fin (d+1))))
25 (hb : b 0 = sqrtSpectrum p) (x : rootSpace d) :
26 covarianceGaussian d p hs x = covarianceGaussian d p hs 0 *
27 Real.exp (-(1/2 : ℝ) * ∑ i, (rootWhitening p hp b hb x i)^2) := by
28 rw [rootWhitening_norm_sq, covarianceGaussian_eq_exp d p hs hp x,
29 covarianceGaussian_eq_exp d p hs hp 0, ← Real.exp_add]
30 simp only [Submodule.coe_zero, PiLp.zero_apply, zero_pow (by norm_num : (2 : ℕ) ≠ 0),
31 zero_div, Finset.sum_const_zero, mul_zero, sub_zero]
32 congr 1
33 ring
34
35/-- Exact density equality with every allowed whitening frame. The scalar
36Jacobian is fixed by the already proved normalization of both actual densities. -/
37theorem whiteningDensity_covarianceGaussian (p : Fin (d+1) → ℝ)
38 (hp : ∀ a, 0 < p a) (hs : ∑ a, p a = 1)
39 (b : OrthonormalBasis (Fin (d+1)) ℝ (EuclideanSpace ℝ (Fin (d+1))))
40 (hb : b 0 = sqrtSpectrum p) (y : Fin d → ℝ) :
41 whiteningDensity (rootWhitening p hp b hb) (covarianceGaussian d p hs) y =
42 GaussianAffinity.productDensity (fun _ : Fin d => (1/2 : ℝ)) y := by
43 let W := rootWhitening p hp b hb
44 let g := GaussianAffinity.productDensity (fun _ : Fin d => (1/2 : ℝ))
45 have hg0 : 0 < g 0 := by
46 unfold g GaussianAffinity.productDensity GaussianAffinity.density
47 positivity
48 let c : ℝ := (whiteningJacobian W : ℝ) * covarianceGaussian d p hs 0 / g 0
49 have he (z : Fin d → ℝ) :
50 whiteningDensity W (covarianceGaussian d p hs) z = c * g z := by
51 unfold whiteningDensity
52 rw [covarianceGaussian_profile p hp hs b hb (W.symm z)]
53 change (whiteningJacobian W : ℝ) *
54 (covarianceGaussian d p hs 0 * Real.exp (-(1/2 : ℝ) * ∑ i, (W (W.symm z) i)^2)) = _
55 rw [ContinuousLinearEquiv.apply_symm_apply]
56 dsimp only [c, g]
57 rw [standardGaussian_profile z]
58 change (whiteningJacobian W : ℝ) *
59 (covarianceGaussian d p hs 0 * Real.exp (-(1/2 : ℝ) * ∑ i, (z i)^2)) =
60 ((whiteningJacobian W : ℝ) * covarianceGaussian d p hs 0 / g 0) *
61 (g 0 * Real.exp (-(1/2 : ℝ) * ∑ i, (z i)^2))
62 field_simp [hg0.ne']
63 have hint := whiteningDensity_integral W (covarianceGaussian d p hs)
64 simp_rw [he] at hint
65 rw [integral_const_mul, integral_covarianceGaussian d p hs hp] at hint
66 have hgint : (∫ z, g z) = 1 := GaussianAffinity.integral_productDensity _ (fun _ => by norm_num)
67 rw [hgint, mul_one] at hint
68 simpa only [hint, one_mul] using he y
69
70/-- The exact classical LAN Gaussian translation in the final whitening
71coordinates, with no additional rescaling. -/
72theorem whiteningDensity_translated_covarianceGaussian (p : Fin (d+1) → ℝ)
73 (hp : ∀ a, 0 < p a) (hs : ∑ a, p a = 1)
74 (b : OrthonormalBasis (Fin (d+1)) ℝ (EuclideanSpace ℝ (Fin (d+1))))
75 (hb : b 0 = sqrtSpectrum p) (h : rootSpace d) (y : Fin d → ℝ) :
76 whiteningDensity (rootWhitening p hp b hb)
77 (fun x => covarianceGaussian d p hs (x - h)) y =
78 GaussianAffinity.productDensity (fun _ : Fin d => (1/2 : ℝ))
79 (y - rootWhitening p hp b hb h) := by
80 have he := whiteningDensity_covarianceGaussian p hp hs b hb
81 (y - rootWhitening p hp b hb h)
82 simpa only [whiteningDensity, map_sub, ContinuousLinearEquiv.symm_apply_apply] using he
83
84end Cloning.TensorLAN