File size: 8,102 Bytes
92416a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import Mathlib
import OAI.Computability.VertexCover.Analysis.IntegralUpdate
import OAI.Computability.VertexCover.Analysis.Restriction

namespace OAI

section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
namespace VertexCover.Restriction
open MeasureTheory
open scoped BigOperators

namespace EnergyForm

section Integral
variable {X : Type*} [TopologicalSpace X] [CompactSpace X]
  [MeasurableSpace X] [BorelSpace X] (μ : Measure X) [IsFiniteMeasure μ]

theorem continuous_integrable (f : C(X, ℝ)) : Integrable f μ :=
  f.continuous.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)

theorem continuous_mul_integrable (f g : C(X, ℝ)) :
    Integrable (fun x => f x * g x) μ :=
  (f.continuous.mul g.continuous).integrable_of_hasCompactSupport
    (HasCompactSupport.of_compactSpace _)

noncomputable def integral : EnergyForm C(X, ℝ) where
  form :=
    { toFun := fun f =>
        { toFun := fun g => ∫ x, f x * g x ∂μ
          map_add' := fun g h => by
            simp only [ContinuousMap.add_apply, mul_add]
            exact integral_add (continuous_mul_integrable μ f g)
              (continuous_mul_integrable μ f h)
          map_smul' := fun a g => by
            simp only [ContinuousMap.smul_apply, smul_eq_mul]
            simp_rw [mul_left_comm (f _) a]
            exact integral_const_mul _ _ }
      map_add' := fun f g => by
        ext h
        simp only [LinearMap.add_apply, ContinuousMap.add_apply, add_mul]
        exact integral_add (continuous_mul_integrable μ f h)
          (continuous_mul_integrable μ g h)
      map_smul' := fun a f => by
        ext g
        simp only [LinearMap.smul_apply, ContinuousMap.smul_apply, smul_eq_mul]
        simp_rw [mul_assoc]
        exact integral_const_mul _ _ }
  symm f g := by
    change (∫ x, f x * g x ∂μ) = ∫ x, g x * f x ∂μ
    simp only [mul_comm]
  nonneg f := integral_nonneg (fun x => mul_self_nonneg (f x))

@[simp] theorem integral_form (f g : C(X, ℝ)) :
    (integral μ).form f g = ∫ x, f x * g x ∂μ := rfl

@[simp] theorem integral_energy (f : C(X, ℝ)) :
    (integral μ).energy f = ∫ x, (f x)^2 ∂μ := by
  simp only [energy, integral_form, pow_two]

end Integral

namespace Projection
section Averaging
variable {ι X : Type*} [Fintype ι] [DecidableEq ι]
  [TopologicalSpace X] [CompactSpace X] [SecondCountableTopology X]
  [MeasurableSpace X] [BorelSpace X]
  (μ : Measure X) [IsProbabilityMeasure μ]

noncomputable def updateFunction (i : ι) (f : C(ι → X, ℝ)) : C(X, C(ι → X, ℝ)) :=
  ContinuousMap.curry ⟨fun p : X × (ι → X) => f (Function.update p.2 i p.1),
    f.continuous.comp (continuous_snd.update i continuous_fst)⟩

omit [Fintype ι] [CompactSpace X] [SecondCountableTopology X] [MeasurableSpace X]
  [BorelSpace X] in
@[simp] theorem updateFunction_apply (i : ι) (f : C(ι → X, ℝ)) (x : X) (s : ι → X) :
    updateFunction i f x s = f (Function.update s i x) := rfl

omit [Fintype ι] [SecondCountableTopology X] in
theorem updateFunction_integrable (i : ι) (f : C(ι → X, ℝ)) :
    Integrable (updateFunction i f) μ :=
  (updateFunction i f).continuous.integrable_of_hasCompactSupport
    (HasCompactSupport.of_compactSpace _)

noncomputable def averageMap (i : ι) : C(ι → X, ℝ) →ₗ[ℝ] C(ι → X, ℝ) where
  toFun f := ∫ x, updateFunction i f x ∂μ
  map_add' f g := by
    have he : (fun x => updateFunction i (f + g) x) =
        (fun x => updateFunction i f x + updateFunction i g x) := by
      funext x
      ext s
      rfl
    rw [he, integral_add (updateFunction_integrable μ i f)
      (updateFunction_integrable μ i g)]
  map_smul' a f := by
    have he : (fun x => updateFunction i (a • f) x) =
        (fun x => a • updateFunction i f x) := by
      funext x
      ext s
      rfl
    rw [he, integral_smul]
    rfl

omit [Fintype ι] [SecondCountableTopology X] in
@[simp] theorem averageMap_apply (i : ι) (f : C(ι → X, ℝ)) (s : ι → X) :
    averageMap μ i f s = ∫ x, f (Function.update s i x) ∂μ :=
  ContinuousMap.integral_apply (updateFunction_integrable μ i f) s

omit [Fintype ι] [SecondCountableTopology X] in
theorem average_update (i : ι) (f : C(ι → X, ℝ)) (s : ι → X) (x : X) :
    averageMap μ i f (Function.update s i x) = averageMap μ i f s := by
  simp only [averageMap_apply, Function.update_idem]

omit [Fintype ι] [SecondCountableTopology X] in
theorem average_idem (i : ι) (f : C(ι → X, ℝ)) :
    averageMap μ i (averageMap μ i f) = averageMap μ i f := by
  ext s
  simp only [averageMap_apply, Function.update_idem]
  simp

theorem integral_average_mul_fixed (i : ι) (f g : C(ι → X, ℝ))
    (hg : ∀ s x, g (Function.update s i x) = g s) :
    (∫ s, averageMap μ i f s * g s ∂Measure.pi (fun _ : ι => μ)) =
      ∫ s, f s * g s ∂Measure.pi (fun _ : ι => μ) := by
  have hi : Integrable (fun p : (ι → X) × X =>
      f (Function.update p.1 i p.2) * g (Function.update p.1 i p.2))
      ((Measure.pi (fun _ : ι => μ)).prod μ) :=
    ((f.continuous.comp (continuous_fst.update i continuous_snd)).mul
      (g.continuous.comp (continuous_fst.update i continuous_snd))).integrable_of_hasCompactSupport
        (HasCompactSupport.of_compactSpace _)
  calc
    _ = ∫ s, ∫ x, f (Function.update s i x) * g (Function.update s i x)
        ∂μ ∂Measure.pi (fun _ : ι => μ) := by
      simp only [hg, integral_mul_const, averageMap_apply]
    _ = ∫ x, ∫ s, f (Function.update s i x) * g (Function.update s i x)
        ∂Measure.pi (fun _ : ι => μ) ∂μ := integral_integral_swap hi
    _ = _ := VertexCover.Product.integral_update μ i (continuous_mul_integrable _ f g)

noncomputable def average (i : ι) :
    (integral (Measure.pi (fun _ : ι => μ))).Projection where
  toLinearMap := averageMap μ i
  idem := average_idem μ i
  selfAdjoint f g := by
    change (∫ s, averageMap μ i f s * g s ∂Measure.pi (fun _ : ι => μ)) =
      ∫ s, f s * averageMap μ i g s ∂Measure.pi (fun _ : ι => μ)
    have h₁ := integral_average_mul_fixed μ i g (averageMap μ i f)
      (average_update μ i f)
    have h₂ := integral_average_mul_fixed μ i f (averageMap μ i g)
      (average_update μ i g)
    calc
      _ = ∫ s, g s * averageMap μ i f s ∂Measure.pi (fun _ : ι => μ) := by
        apply integral_congr_ae
        exact Filter.Eventually.of_forall (fun s => mul_comm _ _)
      _ = ∫ s, averageMap μ i g s * averageMap μ i f s
          ∂Measure.pi (fun _ : ι => μ) := h₁.symm
      _ = ∫ s, averageMap μ i f s * averageMap μ i g s
          ∂Measure.pi (fun _ : ι => μ) := by
        apply integral_congr_ae
        exact Filter.Eventually.of_forall (fun s => mul_comm _ _)
      _ = _ := h₂

@[simp] theorem average_apply (i : ι) (f : C(ι → X, ℝ)) (s : ι → X) :
    average μ i f s = ∫ x, f (Function.update s i x) ∂μ := averageMap_apply μ i f s

theorem average_invariant (i : ι) (f : C(ι → X, ℝ)) (s : ι → X) (x : X) :
    average μ i f (Function.update s i x) = average μ i f s := average_update μ i f s x

theorem average_commute (i j : ι) (f : C(ι → X, ℝ)) :
    average μ i (average μ j f) = average μ j (average μ i f) := by
  by_cases hij : i = j
  · subst j
    rfl
  ext s
  simp only [average_apply]
  have hi : Integrable (fun p : X × X =>
      f (Function.update (Function.update s i p.1) j p.2)) (μ.prod μ) :=
    (f.continuous.comp ((continuous_const.update i continuous_fst).update j
      continuous_snd)).integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace _)
  rw [integral_integral_swap hi]
  simp only [Function.update_comm hij]

end Averaging
end Projection
end EnergyForm
end VertexCover.Restriction


end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end

end OAI