File size: 12,863 Bytes
f1f7953 | 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 | import OAI.Analysis.IrrationalRotation.Sampling.FourierSampling
namespace OAI
noncomputable section
open MeasureTheory
open scoped BigOperators
namespace Invariant233.CircleKernelConvolution
local instance : IsProbabilityMeasure (volume : Measure UnitAddCircle) := by
rw [AddCircle.volume_eq_smul_haarAddCircle]
norm_num
infer_instance
def convolution (k : C(UnitAddCircle, ℝ)) (f : UnitAddCircle → ℝ)
(x : UnitAddCircle) : ℝ := ∫ y, k (x - y) * f y
theorem integrable_unit_bounded {f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) : Integrable f volume := by
apply Integrable.of_bound hf.aestronglyMeasurable 1
exact Filter.Eventually.of_forall fun x => by simpa [Real.norm_eq_abs, abs_of_nonneg (hf0 x)] using hf1 x
theorem integrable_kernel (k : C(UnitAddCircle, ℝ)) : Integrable k volume := by
apply Integrable.of_bound k.measurable.aestronglyMeasurable ‖k‖
exact Filter.Eventually.of_forall k.norm_coe_le_norm
theorem integrable_convolution_integrand (k : C(UnitAddCircle, ℝ))
{f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) (x : UnitAddCircle) :
Integrable (fun y => k (x - y) * f y) volume := by
apply Integrable.of_bound
((k.measurable.comp (measurable_const.sub measurable_id)).mul hf).aestronglyMeasurable ‖k‖
filter_upwards with y
change ‖k (x - y) * f y‖ ≤ ‖k‖
rw [norm_mul, Real.norm_eq_abs (f y), abs_of_nonneg (hf0 y)]
calc
‖k (x - y)‖ * f y ≤ ‖k (x - y)‖ * 1 :=
mul_le_mul_of_nonneg_left (hf1 y) (norm_nonneg _)
_ ≤ ‖k‖ := by simpa using k.norm_coe_le_norm (x - y)
theorem convolution_bounds (k : C(UnitAddCircle, ℝ))
(hk0 : ∀ x, 0 ≤ k x) (hkmass : ∫ x, k x = 1)
{f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) (x : UnitAddCircle) :
0 ≤ convolution k f x ∧ convolution k f x ≤ 1 := by
constructor
· exact integral_nonneg fun y => mul_nonneg (hk0 _) (hf0 _)
· have hki : Integrable (fun y => k (x - y)) volume := by
apply Integrable.of_bound
(k.measurable.comp (measurable_const.sub measurable_id)).aestronglyMeasurable ‖k‖
exact Filter.Eventually.of_forall fun y => k.norm_coe_le_norm _
calc
convolution k f x ≤ ∫ y, k (x - y) := by
apply integral_mono (integrable_convolution_integrand k hf hf0 hf1 x) hki
intro y
exact mul_le_of_le_one_right (hk0 _) (hf1 _)
_ = ∫ y, k y := integral_sub_left_eq_self k volume x
_ = 1 := hkmass
theorem integrable_joint (k : C(UnitAddCircle, ℝ))
{f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) :
Integrable (fun p : UnitAddCircle × UnitAddCircle => k (p.1 - p.2) * f p.2)
(volume.prod volume) := by
apply Integrable.of_bound
((k.measurable.comp (measurable_fst.sub measurable_snd)).mul
(hf.comp measurable_snd)).aestronglyMeasurable ‖k‖
filter_upwards with p
change ‖k (p.1 - p.2) * f p.2‖ ≤ ‖k‖
rw [norm_mul, Real.norm_eq_abs (f p.2), abs_of_nonneg (hf0 p.2)]
calc
‖k (p.1 - p.2)‖ * f p.2 ≤ ‖k (p.1 - p.2)‖ * 1 :=
mul_le_mul_of_nonneg_left (hf1 _) (norm_nonneg _)
_ ≤ ‖k‖ := by simpa using k.norm_coe_le_norm _
theorem integral_convolution (k : C(UnitAddCircle, ℝ))
(hkmass : ∫ x, k x = 1) {f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) :
(∫ x, convolution k f x) = ∫ x, f x := by
unfold convolution
rw [integral_integral_swap (integrable_joint k hf hf0 hf1)]
simp_rw [integral_mul_const]
simp_rw [integral_sub_right_eq_self k, hkmass, one_mul]
theorem fourier_sub_argument (v : ℤ) (x y : UnitAddCircle) :
fourier v (x - y) = fourier v x * fourier (-v) y := by
simp [fourier_apply, sub_eq_add_neg, AddCircle.toCircle_add]
def testCoefficient (f : UnitAddCircle → ℝ) (v : ℤ) : ℂ :=
∫ y, fourier (-v) y * (f y : ℂ)
theorem integrable_test_character {f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) (v : ℤ) :
Integrable (fun y => fourier v y * (f y : ℂ)) volume := by
apply Integrable.of_bound
((fourier v).measurable.mul (Complex.measurable_ofReal.comp hf)).aestronglyMeasurable 1
filter_upwards with y
have hv : ‖fourier v y‖ = 1 := by simp [fourier_apply]
change ‖fourier v y * (f y : ℂ)‖ ≤ 1
rw [norm_mul, hv, one_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hf0 y)]
exact hf1 y
theorem norm_testCoefficient_le_one {f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) (v : ℤ) :
‖testCoefficient f v‖ ≤ 1 := by
apply (norm_integral_le_integral_norm _).trans
have h := integral_mono (integrable_test_character hf hf0 hf1 (-v)).norm
(integrable_const (1 : ℝ)) (fun y => ?_)
· simpa using h
· have hv : ‖fourier (-v) y‖ = 1 := by simp [fourier_apply]
rw [norm_mul, hv, one_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hf0 y)]
exact hf1 y
@[simp] theorem testCoefficient_zero (f : UnitAddCircle → ℝ) :
testCoefficient f 0 = (∫ y, f y : ℝ) := by
simp [testCoefficient, integral_complex_ofReal]
theorem convolution_eq_polynomial (k : C(UnitAddCircle, ℝ))
(s : Finset ℤ) (c : ℤ → ℂ)
(hk : ∀ x, (k x : ℂ) = FourierSampling.polynomial s c x)
{f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) (x : UnitAddCircle) :
(convolution k f x : ℂ) = FourierSampling.polynomial s
(fun v => c v * testCoefficient f v) x := by
rw [convolution, ← integral_complex_ofReal]
simp_rw [Complex.ofReal_mul, hk, FourierSampling.polynomial, Finset.sum_mul]
have hterm : ∀ v, Integrable (fun y => c v * fourier v (x - y) * (f y : ℂ)) volume := by
intro v
have he : (fun y => c v * fourier v (x - y) * (f y : ℂ)) =
(fun y => (c v * fourier v x) * (fourier (-v) y * (f y : ℂ))) := by
funext y
rw [fourier_sub_argument]
ring
rw [he]
exact (integrable_test_character hf hf0 hf1 (-v)).const_mul _
rw [integral_finsetSum s (fun v hv => hterm v)]
apply Finset.sum_congr rfl
intro v hv
simp_rw [fourier_sub_argument]
have he : (fun y => c v * (fourier v x * fourier (-v) y) * (f y : ℂ)) =
(fun y => (c v * fourier v x) * (fourier (-v) y * (f y : ℂ))) := by
funext y
ring
rw [he, integral_const_mul]
unfold testCoefficient
ring
def translationError (f : UnitAddCircle → ℝ) (t : UnitAddCircle) : ℝ :=
∫ x, |f (x - t) - f x|
theorem translationError_nonneg (f : UnitAddCircle → ℝ) (t : UnitAddCircle) :
0 ≤ translationError f t := integral_nonneg fun _ => abs_nonneg _
theorem translationError_le_one {f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) (t : UnitAddCircle) :
translationError f t ≤ 1 := by
have hb : ∀ x, |f (x - t) - f x| ≤ 1 := by
intro x
rw [abs_sub_le_iff]
constructor <;> linarith [hf0 x, hf0 (x - t), hf1 x, hf1 (x - t)]
have hi : Integrable (fun x => |f (x - t) - f x|) volume := by
apply Integrable.of_bound
(((hf.comp (measurable_id.sub measurable_const)).sub hf).abs).aestronglyMeasurable 1
exact Filter.Eventually.of_forall fun x => by simpa [Real.norm_eq_abs] using hb x
have h := integral_mono hi (integrable_const (1 : ℝ)) hb
simpa [translationError] using h
theorem convolution_eq_shift (k : C(UnitAddCircle, ℝ)) (f : UnitAddCircle → ℝ)
(x : UnitAddCircle) : convolution k f x = ∫ t, k t * f (x - t) := by
have h := integral_sub_left_eq_self (fun y => k (x - y) * f y) volume x
simpa [convolution, sub_sub_cancel] using h.symm
theorem convolution_error_pointwise_le (k : C(UnitAddCircle, ℝ))
(hk0 : ∀ t, 0 ≤ k t) (hkmass : ∫ t, k t = 1)
{f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) (x : UnitAddCircle) :
|convolution k f x - f x| ≤ ∫ t, k t * |f (x - t) - f x| := by
have hi : Integrable (fun t => k t * f (x - t)) volume := by
apply Integrable.of_bound
(k.measurable.mul (hf.comp (measurable_const.sub measurable_id))).aestronglyMeasurable ‖k‖
filter_upwards with t
change ‖k t * f (x - t)‖ ≤ ‖k‖
rw [norm_mul, Real.norm_eq_abs (f (x - t)), abs_of_nonneg (hf0 _)]
calc
‖k t‖ * f (x - t) ≤ ‖k t‖ * 1 := mul_le_mul_of_nonneg_left (hf1 _) (norm_nonneg _)
_ ≤ ‖k‖ := by simpa using k.norm_coe_le_norm t
have he : convolution k f x - f x = ∫ t, k t * (f (x - t) - f x) := by
rw [convolution_eq_shift]
have hc : (∫ t, k t * f x) = f x := by rw [integral_mul_const, hkmass, one_mul]
calc
(∫ t, k t * f (x - t)) - f x =
(∫ t, k t * f (x - t)) - ∫ t, k t * f x := by rw [hc]
_ = ∫ t, k t * f (x - t) - k t * f x :=
(integral_sub hi ((integrable_kernel k).mul_const _)).symm
_ = _ := by congr 1; funext t; ring
rw [he]
have h := norm_integral_le_integral_norm (μ := (volume : Measure UnitAddCircle)) (fun t => k t * (f (x - t) - f x))
simpa only [Real.norm_eq_abs, abs_mul, abs_of_nonneg (hk0 _)] using h
theorem integrable_joint_error (k : C(UnitAddCircle, ℝ))
{f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) :
Integrable (fun p : UnitAddCircle × UnitAddCircle =>
k p.2 * |f (p.1 - p.2) - f p.1|) (volume.prod volume) := by
apply Integrable.of_bound ((k.measurable.comp measurable_snd).mul
(((hf.comp (measurable_fst.sub measurable_snd)).sub (hf.comp measurable_fst)).abs)).aestronglyMeasurable ‖k‖
filter_upwards with p
change ‖k p.2 * |f (p.1 - p.2) - f p.1|‖ ≤ ‖k‖
have hb : |f (p.1 - p.2) - f p.1| ≤ 1 := by
rw [abs_sub_le_iff]
constructor <;> linarith [hf0 p.1, hf0 (p.1 - p.2), hf1 p.1, hf1 (p.1 - p.2)]
simp only [norm_mul, Real.norm_eq_abs, abs_abs]
calc
‖k p.2‖ * |f (p.1 - p.2) - f p.1| ≤ ‖k p.2‖ * 1 :=
mul_le_mul_of_nonneg_left hb (norm_nonneg _)
_ ≤ ‖k‖ := by simpa using k.norm_coe_le_norm p.2
theorem l1_error_le_translation_average (k : C(UnitAddCircle, ℝ))
(hk0 : ∀ t, 0 ≤ k t) (hkmass : ∫ t, k t = 1)
{f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) :
(∫ x, |convolution k f x - f x|) ≤ ∫ t, k t * translationError f t := by
calc
_ ≤ ∫ x, ∫ t, k t * |f (x - t) - f x| := by
apply integral_mono_of_nonneg (Filter.Eventually.of_forall fun x => abs_nonneg _)
(integrable_joint_error k hf hf0 hf1).integral_prod_left
exact Filter.Eventually.of_forall (convolution_error_pointwise_le k hk0 hkmass hf hf0 hf1)
_ = ∫ t, ∫ x, k t * |f (x - t) - f x| :=
integral_integral_swap (integrable_joint_error k hf hf0 hf1)
_ = _ := by simp_rw [integral_const_mul, translationError]
theorem l1_error_le_small_translation_and_tail (k : C(UnitAddCircle, ℝ))
(hk0 : ∀ t, 0 ≤ k t) (hkmass : ∫ t, k t = 1)
{f : UnitAddCircle → ℝ} (hf : Measurable f)
(hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1)
{B : Set UnitAddCircle} (hB : MeasurableSet B) {δ ε : ℝ} (hδ : 0 ≤ δ)
(hsmall : ∀ t ∈ B, translationError f t ≤ δ)
(htail : (∫ t in Bᶜ, k t) ≤ ε) :
(∫ x, |convolution k f x - f x|) ≤ δ + ε := by
apply (l1_error_le_translation_average k hk0 hkmass hf hf0 hf1).trans
calc
(∫ t, k t * translationError f t) ≤ ∫ t, δ * k t + Bᶜ.indicator k t := by
apply integral_mono_of_nonneg
(Filter.Eventually.of_forall fun t => mul_nonneg (hk0 t) (translationError_nonneg f t))
(((integrable_kernel k).const_mul δ).add ((integrable_kernel k).indicator hB.compl))
filter_upwards with t
change k t * translationError f t ≤ δ * k t + Bᶜ.indicator k t
by_cases ht : t ∈ B
· rw [Set.indicator_of_notMem (show t ∉ Bᶜ from fun h => h ht), add_zero]
simpa [mul_comm] using mul_le_mul_of_nonneg_left (hsmall t ht) (hk0 t)
· rw [Set.indicator_of_mem (Set.mem_compl ht)]
have h₁ := mul_le_mul_of_nonneg_left (translationError_le_one hf hf0 hf1 t) (hk0 t)
have h₂ := mul_nonneg hδ (hk0 t)
nlinarith
_ = δ + ∫ t in Bᶜ, k t := by
rw [integral_add ((integrable_kernel k).const_mul δ)
((integrable_kernel k).indicator hB.compl), integral_const_mul,
hkmass, mul_one, integral_indicator hB.compl]
_ ≤ δ + ε := add_le_add le_rfl htail
end Invariant233.CircleKernelConvolution
end
end OAI
|