defweightedEvaluation {κ : Type*} (c g : κ →ℝ) : ℝ[X] →ₗ[ℝ] (κ →ℝ) where
body · 3
lines
toFun p k := g k * p.eval (c k)
map_add' p q :=by ext k; simp [Polynomial.eval_add, mul_add]
map_smul' a p :=by ext k; simp [Polynomial.eval_smul]; ring
theoremblock_span_eq_krylov {d q : ℕ} (hd : 0 < d) (x : Fin d →Fin (q+1) →ℝ) :
Submodule.span ℝ (Set.range (blockMatrix x).col) = krylovSpace x :=by
proof · 42
lines
havehsqrt : Real.sqrt (d : ℝ) ≠0:=by positivity
have heq (i : Fin (q+1)) := spectral_power_span_eq_cosine_span
(funk : Fin d => theta d k) (fun k => x k i) q
apply le_antisymm
· apply Submodule.span_le.mpr
rintro v ⟨⟨i,j⟩,rfl⟩
havehcos : (funk : Fin d => x k i * Real.cos ((j : ℝ) * theta d k)) ∈Submodule.span ℝ {v : Fin d →ℝ | ∃ l ≤ q,
v = fun k => x k i * Real.cos ((l : ℝ) * theta d k)} :=Submodule.subset_span ⟨j,by omega,rfl⟩
rw [← heq i] at hcos
havehle : Submodule.span ℝ {v : Fin d →ℝ | ∃ l ≤ q,
v = fun k => x k i * ((3 + Real.cos (theta d k))/2)^l} ≤ krylovSpace x :=by
apply Submodule.span_le.mpr
rintro v ⟨l,hl,rfl⟩
exact Submodule.subset_span ⟨i,l,hl,rfl⟩
have h := (krylovSpace x).smul_mem (cosineAmplitude j / Real.sqrt d) (hle hcos)
convert! h using1
ext k
simp only [Matrix.col, Matrix.transpose_apply, blockMatrix, cosineColumn, Pi.smul_apply, smul_eq_mul]
ring
· apply Submodule.span_le.mpr
rintro v ⟨i,j,hj,rfl⟩
havehpow : (funk : Fin d => x k i * eigenvalue d k ^ j) ∈Submodule.span ℝ {v : Fin d →ℝ | ∃ l ≤ q,
v = fun k => x k i * ((3 + Real.cos (theta d k))/2)^l} :=Submodule.subset_span ⟨j,hj,rfl⟩
rw [heq i] at hpow
havehle : Submodule.span ℝ {v : Fin d →ℝ | ∃ l ≤ q,
v = fun k => x k i * Real.cos ((l : ℝ) * theta d k)} ≤Submodule.span ℝ (Set.range (blockMatrix x).col) :=by
apply Submodule.span_le.mpr
rintro v ⟨l,hl,rfl⟩
haveha : cosineAmplitude l ≠0:= (cosineAmplitude_pos l).ne'
have h := (Submodule.span ℝ (Set.range (blockMatrix x).col)).smul_mem
(Real.sqrt d / cosineAmplitude l)
(Submodule.subset_span (Set.mem_range_self (i, (⟨l,by omega⟩ : Fin (q+1)))))
convert! h using1
ext k
simp only [Matrix.col, Matrix.transpose_apply, blockMatrix, cosineColumn, Pi.smul_apply, smul_eq_mul]
field_simp
exact hle hpow
theoremlower_span_statistic {d q : ℕ} (hqd : 4*q+1 < 2*d)
(hτ : blockTolerance d q ≤1/2) :
∃G : Set (Fin d →Fin (q+1) →ℝ), MeasurableSetG∧
(99 : ℝ)/100≤ (gaussianRows d (q+1)).real G∧∀ x ∈G, ∀ u ∈ krylovSpace x,
|dotProduct u (Matrix.diagonal (funk : Fin d => weight d (2*q+1) k) *ᵥ u)| ≤2 * blockTolerance d q * dotProduct u u :=by
proof · 6
lines
obtain ⟨G,hG,hm,hu⟩ := block_good_event hqd hτ
refine ⟨G,hG,hm,?_⟩
intro x hx u hu'
apply hu x hx u
rw [block_span_eq_krylov (by omega)]
exact hu'
theoremreciprocal_spectrum_statistic_series {d n : ℕ} (hn : 0 < n) (hnd : n < d) :
(∑ k ∈Finset.range d, weight d n k / eigenvalue d k) =
Real.sqrt 2 * ∑' j : ℕ, (-spectralDecay) ^ j * cosineCorrelation d n j :=by
proof · 42
lines
haveht : |-spectralDecay| < 1:=by
rw [abs_neg, abs_of_pos spectralDecay_pos]
exact spectralDecay_lt_one
havehswap : (∑' j : ℕ, (-spectralDecay) ^ j * cosineCorrelation d n j) =
∑ k ∈Finset.range d, Real.cos ((n : ℝ) * theta d k) *
∑' j : ℕ, (-spectralDecay) ^ j * Real.cos ((j : ℝ) * theta d k) :=by
simp only [cosineCorrelation, Finset.mul_sum]
have hs :=Summable.tsum_finsetSum (s :=Finset.range d)
(f :=fun k (j : ℕ) =>Real.cos ((n : ℝ) * theta d k) *
((-spectralDecay) ^ j * Real.cos ((j : ℝ) * theta d k)))
(fun k _ => (hasSum_geometric_cos ht (theta d k)).summable.mul_left _)
simp_rw [← mul_assoc] at hs
convert! hs using1
· congr 1
ext j
apply Finset.sum_congr rfl
intro k _
ring
· simp_rw [mul_assoc, tsum_mul_left]
rw [hswap]
havehsqrt : Real.sqrt 2 ^ 2 = 2:=Real.sq_sqrt (by norm_num)
havehsqrt_pos : 0 < Real.sqrt 2:=Real.sqrt_pos.mpr (by norm_num)
havehpoint : ∀k : ℕ, weight d n k / eigenvalue d k =
Real.sqrt 2 * (Real.cos ((n : ℝ) * theta d k) *
∑' j : ℕ, (-spectralDecay) ^ j * Real.cos ((j : ℝ) * theta d k)) -
(1 / Real.sqrt 2) * Real.cos ((n : ℝ) * theta d k) :=by
intro k
havehden : 0 < 3 + Real.cos (theta d k) :=by linarith [Real.neg_one_le_cos (theta d k)]
have h := reciprocal_spectrum_fourier (theta d k)
unfold weight eigenvalue
rw [div_div_eq_mul_div, mul_div_assoc, h]
havehrel : 2 / Real.sqrt 2 = Real.sqrt 2:=by
apply (div_eq_iff hsqrt_pos.ne').mpr
nlinarith
calc
_ = (2 / Real.sqrt 2) * (Real.cos ((n : ℝ) * theta d k) *
∑' j : ℕ, (-spectralDecay) ^ j * Real.cos ((j : ℝ) * theta d k)) -
(1 / Real.sqrt 2) * Real.cos ((n : ℝ) * theta d k) :=by ring
_ = _ :=by rw [hrel]
simp_rw [hpoint]
rw [Finset.sum_sub_distrib, ←Finset.mul_sum, ←Finset.mul_sum,
sum_half_grid_cos_eq_zero hn (by omega), mul_zero, sub_zero]
theoremtargetGaussian_statistic_variance {d : ℕ} (c : Fin d →ℝ) :
Var[diagonalStatistic c; targetGaussian d] =
∑ k, (c k)^2 * (2 * ((targetVariance d k : ℝ)^2)) :=by
proof · 11
lines
have h := variance_sum_pi (μ :=funk : Fin d => gaussianReal 0 (targetVariance d k))
(X:=fun k (y : ℝ) => c k * y^2)
(fun k => (gaussian_sq_memLp (HasLaw.id (μ := gaussianReal 0 (targetVariance d k)))).const_mul (c k))
have hvar (k : Fin d) : Var[funy : ℝ=> y^2; gaussianReal 0 (targetVariance d k)] =
2 * (targetVariance d k : ℝ)^2:=
gaussian_sq_variance (X:=funy : ℝ=> y) HasLaw.id
simp only [variance_const_mul, hvar] at h
convert! h using1
congr 1
ext u
simp [diagonalStatistic]
theoremtargetGaussian_norm_mean_le (d : ℕ) :
∫ u, diagonalStatistic (fun_ : Fin d =>1) u ∂targetGaussian d ≤ d :=by
proof · 9
lines
rw [targetGaussian_statistic_mean]
calc
_ ≤∑_ : Fin d, (1 : ℝ) :=by
apply Finset.sum_le_sum
intro k _
have h := targetVariance_le_one d k
change (eigenvalue d k)⁻¹≤1 at h
simpa only [one_div] using h
_ = _ :=by simp
theoremlower_target_statistic {d q : ℕ} (hn : 2*q+1 < d) :
|(∫ u, diagonalStatistic (funk : Fin d => weight d (2*q+1) k) u ∂targetGaussian d) -
(d : ℝ) / Real.sqrt 2 * (-spectralDecay)^(2*q+1)| ≤Real.sqrt 2 * d * spectralDecay^(2*d-(2*q+1)) / (1-spectralDecay) ∧Var[diagonalStatistic (funk : Fin d => weight d (2*q+1) k); targetGaussian d] ≤2*d ∧
(∫ u, diagonalStatistic (fun_ : Fin d =>1) u ∂targetGaussian d) ≤ d ∧Var[diagonalStatistic (fun_ : Fin d =>1); targetGaussian d] ≤2*d :=by
proof · 5
lines
refine ⟨?_, targetGaussian_statistic_variance_le _ (fun _ =>Real.abs_cos_le_one _),
targetGaussian_norm_mean_le d, targetGaussian_statistic_variance_le _ (by simp)⟩
rw [targetGaussian_statistic_mean,
Fin.sum_univ_eq_sum_range (fun k => weight d (2*q+1) k / eigenvalue d k) d]
exact reciprocal_spectrum_statistic_remainder (by omega) hn
have h :=ENNReal.toReal_mono (ENNReal.ofReal_ne_top)
(meas_ge_le_variance_div_sq hX hc)
change (μ {ω | c ≤ |X ω - ∫ z, X z ∂μ|}).toReal ≤ _
simpa only [ENNReal.toReal_ofReal (div_nonneg (variance_nonneg _ _) (sq_nonneg _))] using h
theoremtarget_separation_tail {d q : ℕ} (hd : 0 < d)
(hsep : separationThreshold d q <
|∫ u, diagonalStatistic (funk : Fin d => weight d (2*q+1) k) u ∂targetGaussian d|) :
(targetGaussian d).real (separationEvent d q)ᶜ ≤2/(d : ℝ) +
2*d / (|∫ u, diagonalStatistic (funk : Fin d => weight d (2*q+1) k) u ∂targetGaussian d| -
separationThreshold d q)^2:=by
proof · 44
lines
letN : (Fin d →ℝ) →ℝ:= diagonalStatistic (fun_ : Fin d =>1)
letS : (Fin d →ℝ) →ℝ:= diagonalStatistic (funk : Fin d => weight d (2*q+1) k)
let m :=∫ u, S u ∂targetGaussian d
let a :=∫ u, N u ∂targetGaussian d
havehdr : (0 : ℝ) < d :=by exact_mod_cast hd
haveha : a ≤ d := targetGaussian_norm_mean_le d
havehS : Var[S;targetGaussian d] ≤2*d :=
targetGaussian_statistic_variance_le _ (fun _ =>Real.abs_cos_le_one _)
havehN : Var[N;targetGaussian d] ≤2*d :=
targetGaussian_statistic_variance_le _ (by simp)
havehrad : 0 < |m| - separationThreshold d q := sub_pos.mpr hsep
have h₁ := real_chebyshev (diagonalStatistic_memLp (fun_ : Fin d =>1)) hdr
have h₂ := real_chebyshev
(diagonalStatistic_memLp (funk : Fin d => weight d (2*q+1) k)) hrad
havehsub : (separationEvent d q)ᶜ ⊆
{u | (d : ℝ) ≤ |N u - a|} ∪ {u | |m| - separationThreshold d q ≤ |S u - m|} :=by
intro u hu
change ¬ (N u ≤2*d ∧ separationThreshold d q < |S u|) at hu
by_cases hnu : N u ≤2*d
· right
havehsu : |S u| ≤ separationThreshold d q := le_of_not_gt (fun h => hu ⟨hnu,h⟩)
have habs := abs_sub_abs_le_abs_sub m (S u)
rw [abs_sub_comm m (S u)] at habs
change |m| - separationThreshold d q ≤ |S u-m|
linarith only [habs,hsu]
· left
have habs := le_abs_self (N u-a)
have hnu' := lt_of_not_ge hnu
change (d : ℝ) ≤ |N u - a|
linarith only [habs,hnu',ha]
calc
_ ≤ (targetGaussian d).real ({u | (d : ℝ) ≤ |N u-a|} ∪
{u | |m|-separationThreshold d q ≤ |S u-m|}) := measureReal_mono hsub
_ ≤ (targetGaussian d).real {u | (d : ℝ) ≤ |N u-a|} +
(targetGaussian d).real {u | |m|-separationThreshold d q ≤ |S u-m|} :=
measureReal_union_le _ _
_ ≤Var[N;targetGaussian d]/(d : ℝ)^2 +
Var[S;targetGaussian d]/(|m|-separationThreshold d q)^2:= add_le_add h₁ h₂
_ ≤2*d/(d : ℝ)^2 + 2*d/(|m|-separationThreshold d q)^2:=by
exact add_le_add (div_le_div_of_nonneg_right hN (sq_nonneg _))
(div_le_div_of_nonneg_right hS (sq_nonneg _))
_ = _ :=by
congr 1
field_simp