File size: 5,967 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
import Mathlib
import OAI.Computability.VertexCover.Fourier.SourceOccurrences
import OAI.Computability.VertexCover.Analysis.PoincareOne

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.Product
open MeasureTheory ProbabilityTheory
open scoped ENNReal

variable {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y]
variable (μ : Measure X) (ν : Measure Y) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν]

theorem bounded_memLp (f : X → ℝ) (hf : Measurable f) {C : ℝ}
    (hb : ∀ x, ‖f x‖ ≤ C) : MemLp f 2 μ :=
  MemLp.of_bound hf.aestronglyMeasurable C (Filter.Eventually.of_forall hb)

theorem bounded_integral_norm (f : X → ℝ) {C : ℝ} (hb : ∀ x, ‖f x‖ ≤ C) :
    ‖∫ x, f x ∂μ‖ ≤ C := by
  simpa only [probReal_univ, mul_one] using
    norm_integral_le_of_norm_le_const (μ := μ) (Filter.Eventually.of_forall hb)

theorem mean_measurable (f : X → Y → ℝ) (hf : Measurable (Function.uncurry f)) :
    Measurable (fun x => ∫ y, f x y ∂ν) :=
  hf.stronglyMeasurable.integral_prod_right.measurable

theorem mean_memLp (f : X → Y → ℝ) (hf : Measurable (Function.uncurry f)) {C : ℝ}
    (hb : ∀ x y, ‖f x y‖ ≤ C) : MemLp (fun x => ∫ y, f x y ∂ν) 2 μ :=
  bounded_memLp μ _ (mean_measurable ν f hf) (fun x => bounded_integral_norm ν _ (hb x))

theorem variance_product (f : X → Y → ℝ) (hf : Measurable (Function.uncurry f)) {C : ℝ}
    (hb : ∀ x y, ‖f x y‖ ≤ C) :
    variance (Function.uncurry f) (μ.prod ν) =
      (∫ x, variance (f x) ν ∂μ) + variance (fun x => ∫ y, f x y ∂ν) μ := by
  have hp := bounded_memLp (μ.prod ν) _ hf (fun p => hb p.1 p.2)
  have hs : ∀ x, MemLp (f x) 2 ν := fun x =>
    bounded_memLp ν _ (hf.comp (measurable_const.prodMk measurable_id)) (hb x)
  have hm := mean_memLp μ ν f hf hb
  simp_rw [variance_eq_sub (hs _)]
  rw [variance_eq_sub hp, variance_eq_sub hm]
  simp only [Pi.pow_apply]
  dsimp only [Function.uncurry] at hp ⊢
  have hi : Integrable (fun x => ∫ y, (f x y)^2 ∂ν) μ := hp.integrable_sq.integral_prod_left
  have he2 : (∫ p : X × Y, (f p.1 p.2)^2 ∂μ.prod ν) =
      ∫ x, ∫ y, (f x y)^2 ∂ν ∂μ := integral_prod _ hp.integrable_sq
  have he1 : (∫ p : X × Y, f p.1 p.2 ∂μ.prod ν) =
      ∫ x, ∫ y, f x y ∂ν ∂μ := integral_prod _ (hp.integrable (by norm_num))
  rw [integral_sub hi hm.integrable_sq, he2, he1]
  ring

theorem section_variance_integrable (f : X → Y → ℝ)
    (hf : Measurable (Function.uncurry f)) {C : ℝ} (hb : ∀ x y, ‖f x y‖ ≤ C) :
    Integrable (fun x => variance (f x) ν) μ := by
  have hp := bounded_memLp (μ.prod ν) _ hf (fun p => hb p.1 p.2)
  have hs : ∀ x, MemLp (f x) 2 ν := fun x =>
    bounded_memLp ν _ (hf.comp (measurable_const.prodMk measurable_id)) (hb x)
  have hm := mean_memLp μ ν f hf hb
  simp_rw [variance_eq_sub (hs _)]
  exact hp.integrable_sq.integral_prod_left.sub hm.integrable_sq

theorem variance_mean_le (f : X → Y → ℝ) (hf : Measurable (Function.uncurry f)) {C : ℝ}
    (hb : ∀ x y, ‖f x y‖ ≤ C) :
    variance (fun x => ∫ y, f x y ∂ν) μ ≤ ∫ y, variance (fun x => f x y) μ ∂ν := by
  let g : Y → ℝ := fun y => ∫ x, f x y ∂μ
  let D : X → Y → ℝ := fun x y => f x y - g y
  have hg : Measurable g := mean_measurable μ (fun y x => f x y) (hf.comp measurable_swap)
  have hgb : ∀ y, ‖g y‖ ≤ C := fun y => bounded_integral_norm μ _ (fun x => hb x y)
  have hd : Measurable (Function.uncurry D) := hf.sub (hg.comp measurable_snd)
  have hdb : ∀ x y, ‖D x y‖ ≤ 2*C := fun x y => by
    exact (norm_sub_le _ _).trans (by linarith [hb x y, hgb y])
  have hp := bounded_memLp (μ.prod ν) _ hd (fun p => hdb p.1 p.2)
  have hs : ∀ x, MemLp (D x) 2 ν := fun x =>
    bounded_memLp ν _ (hd.comp (measurable_const.prodMk measurable_id)) (hdb x)
  have hm := mean_memLp μ ν f hf hb
  have hfp := bounded_memLp (μ.prod ν) _ hf (fun p => hb p.1 p.2)
  have hfx : ∀ x, Integrable (f x) ν := fun x =>
    (bounded_memLp ν _ (hf.comp (measurable_const.prodMk measurable_id)) (hb x)).integrable (by norm_num)
  have hgi := (bounded_memLp ν g hg hgb).integrable (by norm_num : (1 : ENNReal) ≤ 2)
  have hei : ∫ y, g y ∂ν = ∫ x, ∫ y, f x y ∂ν ∂μ := by
    exact (integral_integral_swap (hfp.integrable (by norm_num))).symm
  have he : ∀ x, (∫ y, f x y ∂ν) - ∫ x, ∫ y, f x y ∂ν ∂μ = ∫ y, D x y ∂ν := by
    intro x
    dsimp only [D]
    rw [integral_sub (hfx x) hgi, hei]
  rw [variance_eq_integral hm.aemeasurable]
  simp_rw [he]
  calc
    _ ≤ ∫ x, ∫ y, (D x y)^2 ∂ν ∂μ := by
      apply integral_mono
      · exact (mean_memLp μ ν D hd hdb).integrable_sq
      · exact hp.integrable_sq.integral_prod_left
      · intro x
        simpa only [probReal_univ, one_mul] using Cube.sq_integral_le_measure_mul ν (hs x)
    _ = ∫ y, ∫ x, (D x y)^2 ∂μ ∂ν := integral_integral_swap hp.integrable_sq
    _ = _ := by
      apply integral_congr_ae
      exact Filter.Eventually.of_forall (fun y =>
        (variance_eq_integral (hf.comp (measurable_id.prodMk measurable_const)).aemeasurable).symm)

theorem variance_product_le (f : X → Y → ℝ) (hf : Measurable (Function.uncurry f)) {C : ℝ}
    (hb : ∀ x y, ‖f x y‖ ≤ C) :
    variance (Function.uncurry f) (μ.prod ν) ≤
      (∫ x, variance (f x) ν ∂μ) + ∫ y, variance (fun x => f x y) μ ∂ν := by
  rw [variance_product μ ν f hf hb]
  exact add_le_add le_rfl (variance_mean_le μ ν f hf hb)

end VertexCover.Product


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