File size: 12,394 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
import Mathlib

namespace OAI

section
section
noncomputable section
namespace LogConcaveSampling.SeedAbsorption
open MeasureTheory ProbabilityTheory Function
open scoped InnerProductSpace

variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
  [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E]
  [NormedAddCommGroup F] [InnerProductSpace ℝ F]
  [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F]

omit [MeasurableSpace E] [BorelSpace E] [MeasurableSpace F] [BorelSpace F] in
lemma dual_comp_norm (A : F →L[ℝ] E) (L : StrongDual ℝ E) :
    ‖L.comp A‖=‖A.adjoint ((InnerProductSpace.toDual ℝ E).symm L)‖ := by
  have he : L.comp A=(InnerProductSpace.toDual ℝ F)
      (A.adjoint ((InnerProductSpace.toDual ℝ E).symm L)) := by
    ext x
    change L (A x)=inner ℝ (A.adjoint ((InnerProductSpace.toDual ℝ E).symm L)) x
    rw [A.adjoint_inner_left,InnerProductSpace.toDual_symm_apply]
  rw [he,LinearIsometryEquiv.norm_map]

theorem restore_gaussian (P : E →L[ℝ] E) (U : F →L[ℝ] E)
    (hcov : P.comp P.adjoint+U.comp U.adjoint=ContinuousLinearMap.id ℝ E) :
    ((stdGaussian E).prod (stdGaussian F)).map (fun z : E × F => P z.1-U z.2)=
      stdGaussian E := by
  let A : E × F →L[ℝ] E := P.comp (ContinuousLinearMap.fst ℝ E F)-
    U.comp (ContinuousLinearMap.snd ℝ E F)
  change ((stdGaussian E).prod (stdGaussian F)).map A=stdGaussian E
  apply Measure.ext_of_charFunDual
  ext L
  have h₁ : (L.comp A).comp (ContinuousLinearMap.inl ℝ E F)=L.comp P := by
    ext x; simp [A]
  have h₂ : (L.comp A).comp (ContinuousLinearMap.inr ℝ E F)=-(L.comp U) := by
    ext x; simp [A]
  have hn : ‖L.comp P‖^2+‖L.comp U‖^2=‖L‖^2 := by
    let x := (InnerProductSpace.toDual ℝ E).symm L
    have he := congrArg (fun B : E →L[ℝ] E => inner ℝ x (B x)) hcov
    simp only [add_apply,ContinuousLinearMap.comp_apply,
      ContinuousLinearMap.id_apply,inner_add_right] at he
    rw [← P.adjoint_inner_left,← U.adjoint_inner_left] at he
    rw [real_inner_self_eq_norm_sq,real_inner_self_eq_norm_sq,
      real_inner_self_eq_norm_sq] at he
    simpa only [x,dual_comp_norm,LinearIsometryEquiv.norm_map] using he
  rw [charFunDual_map,charFunDual_prod,h₁,h₂]
  simp only [charFunDual_stdGaussian,norm_neg]
  rw [← Complex.exp_add]
  congr 1
  norm_cast
  linarith

theorem absorb_center_noise {Y : Type*} [MeasurableSpace Y]
    (P : E →L[ℝ] E) (U : F →L[ℝ] E)
    (hcov : P.comp P.adjoint+U.comp U.adjoint=ContinuousLinearMap.id ℝ E)
    (M : F → E → Y) (hM : Measurable (uncurry M)) (x : F)
    (n : ℝ) (shift : F →L[ℝ] E)
    (hU : U=n • shift)
    (hshift : ∀x Δ g,M (x+Δ) g=M x (g-shift Δ)) :
    ((stdGaussian E).prod (stdGaussian F)).map
      (fun z : E × F => M (x+n • z.2) (P z.1))=
      (stdGaussian E).map (M x) := by
  have hm : Measurable (M x) := hM.comp (measurable_const.prodMk measurable_id)
  have he : (fun z : E × F => M (x+n • z.2) (P z.1))=
      M x ∘ (fun z : E × F => P z.1-U z.2) := by
    funext z
    rw [hshift,hU]
    simp only [smul_apply,map_smul,comp_apply]
  rw [he,← Measure.map_map hm (by fun_prop),restore_gaussian P U hcov]
end LogConcaveSampling.SeedAbsorption

end

end

section

noncomputable section
namespace LogConcaveSampling.SeedAbsorption
open MeasureTheory ProbabilityTheory Function
open scoped InnerProductSpace

variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
  [FiniteDimensional ℝ E]
  [NormedAddCommGroup F] [InnerProductSpace ℝ F]
  [FiniteDimensional ℝ F]

def dampingCoefficient (t : ℝ) : ℝ := (1+Real.sqrt (1-t))⁻¹

def seedDamping (U : F →L[ℝ] E) (t : ℝ) : E →L[ℝ] E :=
  ContinuousLinearMap.id ℝ E-dampingCoefficient t • U.comp U.adjoint

lemma dampingCoefficient_identity {t : ℝ} (ht : t≤1) :
    2*dampingCoefficient t-(dampingCoefficient t)^2*t=1 := by
  have hsq := Real.sq_sqrt (show 0≤1-t by linarith)
  have hp : 0<1+Real.sqrt (1-t) := by positivity
  dsimp [dampingCoefficient]
  field_simp
  nlinarith

lemma seedDamping_adjoint (U : F →L[ℝ] E) (t : ℝ) :
    (seedDamping U t).adjoint=seedDamping U t := by
  simp only [seedDamping,map_sub,map_smulₛₗ,ContinuousLinearMap.adjoint_id,
    ContinuousLinearMap.adjoint_comp,ContinuousLinearMap.adjoint_adjoint]
  rfl

lemma seedDamping_covariance (U : F →L[ℝ] E) {t : ℝ} (ht : t≤1)
    (hU : U.adjoint.comp U=t • ContinuousLinearMap.id ℝ F) :
    (seedDamping U t).comp (seedDamping U t).adjoint+U.comp U.adjoint=
      ContinuousLinearMap.id ℝ E := by
  rw [seedDamping_adjoint]
  ext x
  have he : U.adjoint (U (U.adjoint x))=t • U.adjoint x :=
    congrArg (fun L : F →L[ℝ] F => L (U.adjoint x)) hU
  have hα := dampingCoefficient_identity ht
  simp only [seedDamping,ContinuousLinearMap.comp_apply,sub_apply,smul_apply,
    ContinuousLinearMap.id_apply,add_apply,map_sub,map_smul,he]
  calc
    _ = x+(1-dampingCoefficient t*2+dampingCoefficient t^2*t) • U (U.adjoint x) := by module
    _ = x := by rw [show 1-dampingCoefficient t*2+dampingCoefficient t^2*t=0 by nlinarith [hα]]; simp

lemma seedDamping_positive (U : F →L[ℝ] E) {t : ℝ} (ht0 : 0≤t) (ht1 : t<1)
    (hUn : ∀x,‖U.adjoint x‖^2≤t*‖x‖^2) (x : E) :
    Real.sqrt (1-t)*‖x‖^2≤ inner ℝ x (seedDamping U t x) := by
  have hsq := Real.sq_sqrt (show 0≤1-t by linarith)
  have hp : 0<1+Real.sqrt (1-t) := by positivity
  have he : 1-dampingCoefficient t*t=Real.sqrt (1-t) := by
    dsimp [dampingCoefficient]
    field_simp
    nlinarith
  have hα : 0≤dampingCoefficient t := by dsimp [dampingCoefficient]; positivity
  simp only [seedDamping,sub_apply,smul_apply,ContinuousLinearMap.comp_apply,ContinuousLinearMap.id_apply,
    inner_sub_right,inner_smul_right,← U.adjoint_inner_left,real_inner_self_eq_norm_sq]
  have hh := mul_le_mul (hUn x) (le_refl (dampingCoefficient t)) hα
    (mul_nonneg ht0 (sq_nonneg ‖x‖))
  rw [← he]
  nlinarith

variable [MeasurableSpace E] [BorelSpace E] [MeasurableSpace F] [BorelSpace F]

theorem seedDamping_restore (U : F →L[ℝ] E) {t : ℝ} (ht : t≤1)
    (hU : U.adjoint.comp U=t • ContinuousLinearMap.id ℝ F) :
    ((stdGaussian E).prod (stdGaussian F)).map
      (fun z : E × F => seedDamping U t z.1-U z.2)=stdGaussian E :=
  restore_gaussian _ U (seedDamping_covariance U ht hU)
end LogConcaveSampling.SeedAbsorption

end

end

section

noncomputable section
namespace LogConcaveSampling.SeedAbsorption
open MeasureTheory ProbabilityTheory Function
open scoped InnerProductSpace

variable {E F A : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
  [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E]
  [NormedAddCommGroup F] [InnerProductSpace ℝ F]
  [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F]
  [MeasurableSpace A]

theorem restore_gaussian_with_anchor (μ : Measure A) [SFinite μ]
    (P : E →L[ℝ] E) (U : F →L[ℝ] E)
    (hcov : P.comp P.adjoint+U.comp U.adjoint=ContinuousLinearMap.id ℝ E) :
    (μ.prod ((stdGaussian E).prod (stdGaussian F))).map
      (fun z : A × (E × F) => (z.1,P z.2.1-U z.2.2))=μ.prod (stdGaussian E) := by
  have h := Measure.map_prod_map μ ((stdGaussian E).prod (stdGaussian F))
    (f:=id) (g:=fun z : E × F => P z.1-U z.2) measurable_id (by fun_prop)
  rw [Measure.map_id,restore_gaussian P U hcov] at h
  exact h.symm

theorem absorb_center_noise_with_anchor {Y : Type*} [MeasurableSpace Y]
    (μ : Measure A) [SFinite μ] (P : E →L[ℝ] E) (U : F →L[ℝ] E)
    (hcov : P.comp P.adjoint+U.comp U.adjoint=ContinuousLinearMap.id ℝ E)
    (M : F → E → Y) (hM : Measurable (uncurry M))
    (x : A → F) (hx : Measurable x) (n : ℝ) (shift : F →L[ℝ] E)
    (hU : U=n • shift)
    (hshift : ∀x Δ g,M (x+Δ) g=M x (g-shift Δ)) :
    (μ.prod ((stdGaussian E).prod (stdGaussian F))).map
      (fun z : A × (E × F) => (z.1,M (x z.1+n • z.2.2) (P z.2.1)))=
      (μ.prod (stdGaussian E)).map (fun z : A × E => (z.1,M (x z.1) z.2)) := by
  have he : (fun z : A × (E × F) => (z.1,M (x z.1+n • z.2.2) (P z.2.1)))=
      (fun z : A × E => (z.1,M (x z.1) z.2)) ∘
        (fun z : A × (E × F) => (z.1,P z.2.1-U z.2.2)) := by
    funext z
    rw [hshift,hU]
    simp only [smul_apply,map_smul,comp_apply]
  rw [he,← Measure.map_map]
  · rw [restore_gaussian_with_anchor μ P U hcov]
  · exact measurable_fst.prodMk (hM.comp ((hx.comp measurable_fst).prodMk measurable_snd))
  · fun_prop
end LogConcaveSampling.SeedAbsorption

end

end

section

noncomputable section
namespace LogConcaveSampling.SeedAbsorption
open MeasureTheory ProbabilityTheory Function
open scoped InnerProductSpace

variable {ι : Type*} [Fintype ι] {A F : Type*} [MeasurableSpace A]
  [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F]
  [MeasurableSpace F] [BorelSpace F]
  {E : ι → Type*} [∀i,NormedAddCommGroup (E i)] [∀i,InnerProductSpace ℝ (E i)]
  [∀i,FiniteDimensional ℝ (E i)] [∀i,MeasurableSpace (E i)] [∀i,BorelSpace (E i)]

theorem restore_gaussian_blocks (P : ∀i,E i →L[ℝ] E i) (U : ∀i,F →L[ℝ] E i)
    (hcov : ∀i,(P i).comp (P i).adjoint+(U i).comp (U i).adjoint=ContinuousLinearMap.id ℝ (E i)) :
    (Measure.pi (fun i => (stdGaussian (E i)).prod (stdGaussian F))).map
      (fun z i => P i (z i).1-U i (z i).2)=Measure.pi (fun i => stdGaussian (E i)) := by
  exact (measurePreserving_pi
    (fun i => (stdGaussian (E i)).prod (stdGaussian F)) (fun i => stdGaussian (E i))
    (fun i => ⟨by fun_prop,restore_gaussian (P i) (U i) (hcov i)⟩)).map_eq

theorem restore_gaussian_blocks_with_anchor (μ : Measure A) [SFinite μ]
    (P : ∀i,E i →L[ℝ] E i) (U : ∀i,F →L[ℝ] E i)
    (hcov : ∀i,(P i).comp (P i).adjoint+(U i).comp (U i).adjoint=ContinuousLinearMap.id ℝ (E i)) :
    (μ.prod (Measure.pi (fun i => (stdGaussian (E i)).prod (stdGaussian F)))).map
      (fun z : A × (∀i,E i × F) => (z.1,fun i => P i (z.2 i).1-U i (z.2 i).2))=
        μ.prod (Measure.pi (fun i => stdGaussian (E i))) := by
  have h := Measure.map_prod_map μ (Measure.pi (fun i => (stdGaussian (E i)).prod (stdGaussian F)))
    (f:=id) (g:=fun z i => P i (z i).1-U i (z i).2) measurable_id (by fun_prop)
  rw [Measure.map_id,restore_gaussian_blocks P U hcov] at h
  exact h.symm

theorem absorb_center_noise_blocks {Y : ι → Type*} [∀i,MeasurableSpace (Y i)]
    (μ : Measure A) [SFinite μ] (P : ∀i,E i →L[ℝ] E i) (U : ∀i,F →L[ℝ] E i)
    (hcov : ∀i,(P i).comp (P i).adjoint+(U i).comp (U i).adjoint=ContinuousLinearMap.id ℝ (E i))
    (M : ∀i,F → E i → Y i) (hM : ∀i,Measurable (uncurry (M i)))
    (x : ι → A → F) (hx : ∀i,Measurable (x i)) (n : ι → ℝ)
    (shift : ∀i,F →L[ℝ] E i) (hU : ∀i,U i=n i • shift i)
    (hshift : ∀i x Δ g,M i (x+Δ) g=M i x (g-shift i Δ)) :
    (μ.prod (Measure.pi (fun i => (stdGaussian (E i)).prod (stdGaussian F)))).map
      (fun z : A × (∀i,E i × F) =>
        (z.1,fun i => M i (x i z.1+n i • (z.2 i).2) (P i (z.2 i).1)))=
      (μ.prod (Measure.pi (fun i => stdGaussian (E i)))).map
        (fun z : A × (∀i,E i) => (z.1,fun i => M i (x i z.1) (z.2 i))) := by
  let R : (A × (∀i,E i × F)) → (A × (∀i,E i)) :=
    fun z => (z.1,fun i => P i (z.2 i).1-U i (z.2 i).2)
  let C : (A × (∀i,E i)) → (A × (∀i,Y i)) :=
    fun z => (z.1,fun i => M i (x i z.1) (z.2 i))
  have he : (fun z : A × (∀i,E i × F) =>
      (z.1,fun i => M i (x i z.1+n i • (z.2 i).2) (P i (z.2 i).1)))=C ∘ R := by
    funext z
    apply Prod.ext
    · rfl
    funext i
    change M i (x i z.1+n i • (z.2 i).2) (P i (z.2 i).1)=
      M i (x i z.1) (P i (z.2 i).1-U i (z.2 i).2)
    rw [hshift,hU]
    simp only [smul_apply,map_smul]
  have hc : Measurable C := measurable_fst.prodMk (Measurable.of_eval
    (fun i => (hM i).comp (((hx i).comp measurable_fst).prodMk ((measurable_pi_apply i).comp measurable_snd))))
  rw [he,←Measure.map_map hc (by dsimp [R]; fun_prop)]
  change ((μ.prod (Measure.pi (fun i => (stdGaussian (E i)).prod (stdGaussian F)))).map R).map C=_
  rw [show (μ.prod (Measure.pi (fun i => (stdGaussian (E i)).prod (stdGaussian F)))).map R=
    μ.prod (Measure.pi (fun i => stdGaussian (E i))) from restore_gaussian_blocks_with_anchor μ P U hcov]
end LogConcaveSampling.SeedAbsorption

end

end

end

end OAI