File size: 7,425 Bytes
dd14c26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import Mathlib
import OAI.Probability.LogConcave.LowerBounds.WeightedEvaluation

namespace OAI

section
section
noncomputable section
open MeasureTheory Filter
open scoped ENNReal NNReal Topology

section LowerProof
open Matrix Topology TopologicalSpace ProbabilityTheory Classical WithLp
open scoped Matrix.Norms.Elementwise
open WithLp
open MeasureTheory ProbabilityTheory
open scoped ENNReal NNReal
open Matrix
open Polynomial
open scoped BigOperators

namespace LogConcaveSampling.LowerBound

theorem diagonalStatistic_eq_dotProduct {d : ℕ} (c u : Fin d → ℝ) :
    diagonalStatistic c u = dotProduct u (Matrix.diagonal c *ᵥ u) := by
  simp only [diagonalStatistic, Matrix.mulVec_diagonal, dotProduct]
  apply Finset.sum_congr rfl
  intro k _
  ring

theorem normStatistic_eq_dotProduct {d : ℕ} (u : Fin d → ℝ) :
    diagonalStatistic (fun _ => 1) u = dotProduct u u := by
  simp [diagonalStatistic, dotProduct, pow_two]

theorem separationThreshold_eq {d q : ℕ} (hd : 0 < d) :
    2 * blockTolerance d q * (2*d) = separationThreshold d q := by
  have hdr : (0 : ℝ) < d := by exact_mod_cast hd
  have hs := Real.sq_sqrt hdr.le
  have hsn : Real.sqrt (d : ℝ) ≠ 0 := by positivity
  unfold blockTolerance separationThreshold
  field_simp
  nlinarith

theorem algorithm_span_separation_bound {Ω : Type*} [MeasurableSpace Ω]
    {P : Measure Ω} [IsProbabilityMeasure P] {d q : ℕ}
    (hqd : 4*q+1 < 2*d) (ht : blockTolerance d q ≤ 1/2)
    {rows : Ω → Fin d → Fin (q+1) → ℝ}
    (hrows : HasLaw rows (gaussianRows d (q+1)) P) (U : Ω → Fin d → ℝ)
    (hU : ∀ᵐ ω ∂P, U ω ∈ krylovSpace (rows ω)) :
    P.real {ω | U ω ∈ separationEvent d q} ≤ 1/100 := by
  obtain ⟨G,hG,hm,hgood⟩ := lower_span_statistic hqd ht
  have hsub : {ω | U ω ∈ separationEvent d q} ≤ᵐ[P] {ω | rows ω ∈ Gᶜ} := by
    filter_upwards [hU] with ω hu
    intro hsep
    change rows ω ∉ G
    intro hg
    have hstat := hgood (rows ω) hg (U ω) hu
    rw [← diagonalStatistic_eq_dotProduct, ← normStatistic_eq_dotProduct] at hstat
    have hn := hsep.1
    have hs := hsep.2
    have hbound : 2 * blockTolerance d q * diagonalStatistic (fun _ => 1) (U ω) ≤
        separationThreshold d q := by
      rw [← separationThreshold_eq (by omega : 0 < d)]
      exact mul_le_mul_of_nonneg_left hn (mul_nonneg (by norm_num) (blockTolerance_pos (q := q) (by omega : 0 < d)).le)
    exact (not_lt_of_ge (hstat.trans hbound)) hs
  have hmono := ENNReal.toReal_mono (measure_ne_top P {ω | rows ω ∈ Gᶜ})
    (measure_mono_ae hsub)
  change P.real {ω | U ω ∈ separationEvent d q} ≤ P.real {ω | rows ω ∈ Gᶜ} at hmono
  have hlaw : P.real {ω | rows ω ∈ Gᶜ} = (gaussianRows d (q+1)).real Gᶜ :=
    hrows.measureReal_eq hG.compl
  rw [hlaw, measureReal_compl hG, probReal_univ] at hmono
  linarith

end LogConcaveSampling.LowerBound

namespace LogConcaveSampling.LowerBound
open scoped RealInnerProductSpace
open Matrix WithLp

def spectrumOperator (d : ℕ) : Point d →L[ℝ] Point d :=
  Matrix.toEuclideanCLM (n := Fin d) (𝕜 := ℝ) (Matrix.diagonal (fun k : Fin d => eigenvalue d k))

@[simp] theorem spectrumOperator_apply {d : ℕ} (x : Point d) (k : Fin d) :
    spectrumOperator d x k = eigenvalue d k * x k := by
  change (Matrix.diagonal (fun k : Fin d => eigenvalue d k) *ᵥ ofLp x) k = _
  exact Matrix.mulVec_diagonal _ _ _

def quadraticOperator {d : ℕ} (O : Rotations d) : Point d →L[ℝ] Point d :=
  (rotationIsometry O).toContinuousLinearEquiv.toContinuousLinearMap.comp
    ((spectrumOperator d).comp (rotationIsometry O).symm.toContinuousLinearEquiv.toContinuousLinearMap)

def quadraticPotential {d : ℕ} (O : Rotations d) (x : Point d) : ℝ :=
  inner ℝ x (quadraticOperator O x) / 2

lemma spectrumOperator_symmetric (d : ℕ) :
    (spectrumOperator d).toLinearMap.IsSymmetric := by
  intro x y
  change inner ℝ (spectrumOperator d x) y = inner ℝ x (spectrumOperator d y)
  simp only [PiLp.inner_apply, Real.inner_apply, spectrumOperator_apply]
  apply Finset.sum_congr rfl
  intro k _
  ring

lemma quadraticOperator_symmetric {d : ℕ} (O : Rotations d) :
    (quadraticOperator O).toLinearMap.IsSymmetric := by
  intro x y
  change inner ℝ ((rotationIsometry O) (spectrumOperator d ((rotationIsometry O).symm x))) y =
    inner ℝ x ((rotationIsometry O) (spectrumOperator d ((rotationIsometry O).symm y)))
  rw [← (rotationIsometry O).apply_symm_apply y, ← (rotationIsometry O).apply_symm_apply x]
  simp only [LinearIsometryEquiv.symm_apply_apply, LinearIsometryEquiv.inner_map_map]
  exact spectrumOperator_symmetric d _ _

lemma quadraticOperator_bounds {d : ℕ} (O : Rotations d) (x : Point d) :
    ‖x‖^2 ≤ inner ℝ x (quadraticOperator O x) ∧
      inner ℝ x (quadraticOperator O x) ≤ 2 * ‖x‖^2 := by
  let y := (rotationIsometry O).symm x
  have hinner : inner ℝ x (quadraticOperator O x) =
      ∑ k : Fin d, eigenvalue d k * (y k)^2 := by
    change inner ℝ x ((rotationIsometry O) (spectrumOperator d y)) = _
    rw [← (rotationIsometry O).apply_symm_apply x]
    simp only [LinearIsometryEquiv.inner_map_map, PiLp.inner_apply, Real.inner_apply,
      spectrumOperator_apply]
    apply Finset.sum_congr rfl
    intro k _
    dsimp [y]
    ring
  have hnorm : ‖x‖^2 = ∑ k : Fin d, (y k)^2 := by
    rw [← (rotationIsometry O).symm.norm_map x, EuclideanSpace.norm_sq_eq]
    simp only [Real.norm_eq_abs, sq_abs]
    rfl
  rw [hinner, hnorm, Finset.mul_sum]
  constructor
  · apply Finset.sum_le_sum
    intro k _
    have hb := (eigenvalue_bounds d k).1
    nlinarith [sq_nonneg (y k)]
  · apply Finset.sum_le_sum
    intro k _
    exact mul_le_mul_of_nonneg_right (eigenvalue_bounds d k).2 (sq_nonneg _)

lemma quadraticPotential_hasGradientAt {d : ℕ} (O : Rotations d) (x : Point d) :
    HasGradientAt (quadraticPotential O) (quadraticOperator O x) x := by
  apply hasGradientAt_iff_hasFDerivAt.mpr
  have hd := ((hasFDerivAt_id x).inner ℝ (quadraticOperator O).hasFDerivAt).const_smul (1 / 2 : ℝ)
  convert! hd using 1
  · ext y
    simp only [quadraticPotential, Pi.smul_apply, smul_eq_mul, id_eq]
    ring
  ext y
  have hs := quadraticOperator_symmetric O x y
  change inner ℝ (quadraticOperator O x) y = inner ℝ x (quadraticOperator O y) at hs
  change inner ℝ (quadraticOperator O x) y =
    (1 / 2 : ℝ) * (inner ℝ x (quadraticOperator O y) + inner ℝ y (quadraticOperator O x))
  rw [← hs, real_inner_comm y (quadraticOperator O x)]
  ring

@[simp] theorem quadraticPotential_gradient {d : ℕ} (O : Rotations d) :
    gradient (quadraticPotential O) = quadraticOperator O :=
  gradient_eq (quadraticPotential_hasGradientAt O)

theorem quadraticPotential_admissible {d : ℕ} (O : Rotations d) :
    Admissible (quadraticPotential O) := by
  refine ⟨?_, ?_, ?_, ?_⟩
  · exact (contDiff_id.inner ℝ (quadraticOperator O).contDiff).div_const 2
  · simp [quadraticPotential]
  · simp
  · intro x v
    rw [quadraticPotential_gradient, (quadraticOperator O).fderiv]
    exact quadraticOperator_bounds O v

theorem quadratic_firstOrderReply {d : ℕ} (O : Rotations d) (x : Point d) :
    firstOrderReply (quadraticPotential O) x =
      (inner ℝ x (quadraticOperator O x) / 2, quadraticOperator O x) := by
  simp [firstOrderReply, quadraticPotential]

end LogConcaveSampling.LowerBound

end LowerProof
end
end
end

end OAI