Offline · exact source
Exact Lean source

PCTCountAffinity

formalization/Cloning/PCTCountAffinity.lean

Source hash: b4ae8611ea7e2f37c690b8ce3a1e2b8ef8a6024ac4ff4a67bfea4e6690ef0bce

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.PCTCountGaussian
2import Cloning.YoungPhysicalRoundingAnalysis
3 
4/-! Actual smoothed PCT count affinity tends to the Gaussian classical cost with inflation `1+2v`. -/
5noncomputable section
6open scoped BigOperators Topology Classical InnerProductSpace NNReal
7open Filter MeasureTheory
8namespace Cloning.PCTCount
9open Cloning.PCT Cloning.PCTReducedGaussian Cloning.PCTPhysicalState
10open Cloning.PCTJointGaussianWhitening Cloning.YoungGeneral Cloning.YoungHyperplane
11open Cloning.TensorLAN Cloning.GaussianAffinity
12set_option backward.isDefEq.respectTransparency false
13set_option maxHeartbeats 250000
14variable {d s : ℕ}
15 
16private theorem flat_pos (i : Fin (d+1)) : 0<flatSpectrum (d+1) i := by
17  unfold flatSpectrum
18  positivity
19 
20def flatCountDensity (d L : ℕ) : rootSpace d → ℝ :=
21  CountMultinomial.density d L (flatSpectrum (d+1)) (fun _ ↦ (flat_pos _).le)
22    (flatSpectrum_sum _ (by omega))
23 
24theorem whiteningDensity_affinity (W : rootSpace d ≃L[ℝ] (Fin d → ℝ))
25    (f g : rootSpace d → ℝ) :
26    (∫ y, Real.sqrt (whiteningDensity W f y)*Real.sqrt (whiteningDensity W g y))=
27      ∫ x, Real.sqrt (f x)*Real.sqrt (g x) := by
28  have hJ := (NNReal.coe_nonneg (whiteningJacobian W))
29  have he y : Real.sqrt (whiteningDensity W f y)*Real.sqrt (whiteningDensity W g y)=
30      whiteningDensity W (fun x ↦ Real.sqrt (f x)*Real.sqrt (g x)) y := by
31    simp only [whiteningDensity, Real.sqrt_mul hJ]
32    calc
33      _ = (Real.sqrt (whiteningJacobian W : ℝ))^2 *
34          (Real.sqrt (f (W.symm y))*Real.sqrt (g (W.symm y))) := by ring
35      _ = _ := by rw [Real.sq_sqrt hJ]
36  simp_rw [he]
37  exact whiteningDensity_integral W _
38 
39theorem flatCountDensity_l1_tendsto (d : ℕ) (n : ℕ → ℕ) (hn : Tendsto n atTop atTop) :
40    Tendsto (fun k ↦ ∫ x, |flatCountDensity d (n k) x-CountMultinomial.shiftedGaussian d 0 x|)
41      atTop (𝓝 0) := by
42  apply CountMultinomial.density_l1_tendsto d n hn
43  · exact fun i ↦ tendsto_const_nhds
44  · intro i
45    simpa using (tendsto_const_nhds : Tendsto (fun _ : ℕ ↦ (0:ℝ)) atTop (𝓝 0))
46 
47theorem countAffinity_tendsto_of_pos
48    (u : OrthonormalBasis (Fin (s+1)) ℂ (Register (Fin (d+1) × Fin (d+1))))
49    (hu : u 0=coefficientVector (schmidtCoefficients (flatSpectrum (d+1))))
50    (v : ℝ) (hv : 0<v) (n : ℕ → ℕ) (hn : Tendsto n atTop atTop) (hn0 : ∀ k, 0<n k) :
51    Tendsto (fun k ↦ ∫ x, Real.sqrt (countMixtureDensity u v (n k) x)*
52      Real.sqrt (flatCountDensity d (n k) x)) atTop (𝓝 (Cloning.classicalValue (1+2*v) (d+1))) := by
53  obtain ⟨b,hb⟩ := exists_whitening_frame (by simp : Fintype.card (Fin (d+1))=d+1)
54    (flatSpectrum (d+1)) (fun _ ↦ (flat_pos _).le) (flatSpectrum_sum _ (by omega))
55  let W := rootWhitening (flatSpectrum (d+1)) flat_pos b hb
56  let f k := whiteningDensity W (countMixtureDensity u v (n k))
57  let g k := whiteningDensity W (flatCountDensity d (n k))
58  let f₀ := productDensity (fun _ : Fin d ↦ 1/(2*(1+2*v)))
59  let g₀ := productDensity (fun _ : Fin d ↦ (1/2:ℝ))
60  have hflim : Tendsto (fun k ↦ ∫ y, |f k y-f₀ y|) atTop (𝓝 0) :=
61    whitening_countMixtureDensity_l1_tendsto u hu v hv b hb n hn
62  have hglim : Tendsto (fun k ↦ ∫ y, |g k y-g₀ y|) atTop (𝓝 0) := by
63    have he y : whiteningDensity W (CountMultinomial.shiftedGaussian d 0) y=g₀ y := by
64      have ht := whiteningDensity_translated_covarianceGaussian (flatSpectrum (d+1)) flat_pos
65        (flatSpectrum_sum _ (by omega)) b hb (0 : rootSpace d) y
66      rw [map_zero, sub_zero] at ht
67      exact ht
68    have hh := flatCountDensity_l1_tendsto d n hn
69    have heq k : (∫ y, |g k y-g₀ y|)=
70        ∫ x, |flatCountDensity d (n k) x-CountMultinomial.shiftedGaussian d 0 x| := by
71      rw [← whiteningDensity_l1 W]
72      simp_rw [he]
73      rfl
74    simpa only [heq] using hh
75  have hh := density_affinity_tendsto volume f g f₀ g₀
76    (fun k ↦ whiteningDensity_integrable W _ (integrable_countMixtureDensity u v hv (n k) (hn0 k)))
77    (fun k ↦ whiteningDensity_integrable W _ (CountMultinomial.integrable_density d (n k) (hn0 k) _ _ _))
78    (GaussianAffinity.integrable_productDensity _ (fun _ ↦ by positivity))
79    (GaussianAffinity.integrable_productDensity _ (fun _ ↦ by norm_num))
80    (fun k y ↦ mul_nonneg (NNReal.coe_nonneg _) (countMixtureDensity_nonneg u v (n k) _))
81    (fun k y ↦ mul_nonneg (NNReal.coe_nonneg _) (CountMultinomial.density_nonneg d (n k) _ _ _ _))
82    (productDensity_nonneg _) (productDensity_nonneg _)
83    (integral_productDensity _ (fun _ ↦ by positivity))
84    (fun k ↦ by rw [whiteningDensity_integral]; exact CountMultinomial.integral_density d (n k) (hn0 k) _ _ _)
85    hflim hglim
86  have ha : (∫ y, Real.sqrt (f₀ y)*Real.sqrt (g₀ y))=Cloning.classicalValue (1+2*v) (d+1) := by
87    have he : (fun _ : Fin d ↦ 1/(2*(1+2*v)))=(fun _ : Fin d ↦ (1/2:ℝ)/(1+2*v)) := by
88      funext i
89      rw [div_div]
90    dsimp only [f₀,g₀]
91    rw [he]
92    simp_rw [mul_comm (Real.sqrt (productDensity (fun _ : Fin d ↦ (1/2:ℝ)/(1+2*v)) _))]
93    simpa using integral_product_dilation_eq_classicalValue (d := d+1) (by omega)
94      (fun _ ↦ (1/2:ℝ)) (fun _ ↦ by norm_num) (by positivity : 0<1+2*v)
95  rw [ha] at hh
96  convert hh using 1
97  funext k
98  exact (whiteningDensity_affinity W _ _).symm
99 
100theorem countAffinity_tendsto
101    (u : OrthonormalBasis (Fin (s+1)) ℂ (Register (Fin (d+1) × Fin (d+1))))
102    (hu : u 0=coefficientVector (schmidtCoefficients (flatSpectrum (d+1))))
103    (v : ℝ) (hv : 0<v) (n : ℕ → ℕ) (hn : Tendsto n atTop atTop) :
104    Tendsto (fun k ↦ ∫ x, Real.sqrt (countMixtureDensity u v (n k) x)*
105      Real.sqrt (flatCountDensity d (n k) x)) atTop (𝓝 (Cloning.classicalValue (1+2*v) (d+1))) := by
106  obtain ⟨K,hK⟩ := eventually_atTop.mp (hn.eventually (eventually_gt_atTop 0))
107  have hk : Tendsto (fun j : ℕ ↦ j+K) atTop atTop :=
108    tendsto_atTop_mono (fun j ↦ Nat.le_add_right j K) tendsto_id
109  apply (tendsto_add_atTop_iff_nat K).mp
110  exact countAffinity_tendsto_of_pos u hu v hv (fun j ↦ n (j+K)) (hn.comp hk)
111    (fun j ↦ hK (j+K) (by omega))
112 
113end Cloning.PCTCount