@@ -232,7 +232,7 @@ end Centered
232232
233233section Covariance
234234
235- variable [NormedSpace ℝ E] [BorelSpace E] [IsFiniteMeasure μ]
235+ variable [NormedSpace ℝ E] [BorelSpace E]
236236
237237open Classical in
238238/-- Continuous bilinear form with value `∫ x, (L₁ x - μ[L₁]) * (L₂ x - μ[L₂]) ∂μ` on `(L₁, L₂)`
@@ -241,27 +241,80 @@ noncomputable
241241def covarianceBilinDual (μ : Measure E) : StrongDual ℝ E →L[ℝ] StrongDual ℝ E →L[ℝ] ℝ :=
242242 uncenteredCovarianceBilinDual (μ.map (fun x ↦ x - ∫ x, x ∂μ))
243243
244- @[simp]
245- lemma covarianceBilinDual_of_not_memLp (h : ¬ MemLp id 2 μ) (L₁ L₂ : StrongDual ℝ E) :
244+ omit [BorelSpace E] in
245+ lemma _root_.MeasureTheory.memLp_id_of_self_sub_integral {p : ℝ≥0 ∞}
246+ (h_Lp : MemLp (fun x ↦ x - ∫ y, y ∂μ) p μ) : MemLp id p μ := by
247+ have : (id : E → E) = fun x ↦ x - ∫ x, x ∂μ + ∫ x, x ∂μ := by ext; simp
248+ rw [this]
249+ apply h_Lp.add
250+ set c := ∫ x, x ∂μ
251+ /- We need to check that the constant `c = ∫ x, x ∂μ` is in `L^p`. Note that we don't assume
252+ that `μ` is finite, so this requires an argument. If the constant is zero, it's obvious.
253+ If it's nonzero, this means that `x` is integrable for `μ` (as otherwise the integral would be
254+ `0` by our choice of junk value), so `‖x‖ ^ (1/p)` is in `L^p`.
255+ The constant `c` is controlled by `2 ‖x - c‖` close to `0` (say when `‖x‖ ≤ ‖c‖ / 2`)
256+ and by a multiple of `‖x‖ ^ (1/p)` away from `0`. Those two functions
257+ are in `L^p` by assumptions, so the constant `c` also is. -/
258+ by_cases hx : c = 0
259+ · simp [hx]
260+ rcases eq_or_ne p 0 with rfl | hp0
261+ · simp [aestronglyMeasurable_const]
262+ rcases eq_or_ne p ∞ with rfl | hptop
263+ · exact memLp_top_const c
264+ apply (integrable_norm_rpow_iff (by fun_prop) hp0 hptop).1
265+ have I : Integrable (fun (x : E) ↦ ‖x‖) μ := by
266+ apply Integrable.norm
267+ contrapose! hx
268+ exact integral_undef hx
269+ have := (h_Lp.integrable_norm_rpow hp0 hptop).const_mul (2 ^ p.toReal)
270+ apply (((I.const_mul (2 * ‖c‖ ^ (p.toReal - 1 ))).add this)).mono' (by fun_prop)
271+ filter_upwards [] with y
272+ lift p to ℝ≥0 using hptop
273+ simp only [ENNReal.coe_toReal, Real.norm_eq_abs, Pi.add_apply]
274+ rw [abs_of_nonneg (by positivity)]
275+ rcases le_total ‖y‖ (‖c‖ / 2 )
276+ · have : ‖c‖ ≤ ‖y‖ + ‖y - c‖ := Eq.trans_le (by abel_nf) (norm_sub_le y (y - c))
277+ calc ‖c‖ ^ (p : ℝ)
278+ _ ≤ (2 * ‖y - c‖) ^ (p : ℝ) :=
279+ Real.rpow_le_rpow (by positivity) (by linarith) (by positivity)
280+ _ = 0 + 2 ^ (p : ℝ) * ‖y - c‖ ^ (p : ℝ) := by
281+ rw [Real.mul_rpow (by simp) (by positivity)]
282+ ring
283+ _ ≤ 2 * ‖c‖ ^ (p - 1 : ℝ) * ‖y‖ + 2 ^ (p : ℝ) * ‖y - c‖ ^ (p : ℝ) := by
284+ gcongr
285+ positivity
286+ · calc ‖c‖ ^ (p : ℝ )
287+ _ = ‖c‖ ^ ((p - 1 ) + 1 : ℝ) := by abel_nf
288+ _ = ‖c‖ ^ (p - 1 : ℝ) * ‖c‖ := by rw [Real.rpow_add (by positivity), Real.rpow_one]
289+ _ ≤ ‖c‖ ^ (p - 1 : ℝ) * (2 * ‖y‖) := by gcongr; linarith
290+ _ = 2 * ‖c‖ ^ (p - 1 : ℝ) * ‖y‖ + 0 := by ring
291+ _ ≤ 2 * ‖c‖ ^ (p - 1 : ℝ) * ‖y‖ + 2 ^ (p : ℝ) * ‖y - c‖ ^ (p : ℝ) := by gcongr; positivity
292+
293+ lemma covarianceBilinDual_of_not_memLp' (h : ¬ MemLp (fun x ↦ x - ∫ y, y ∂μ) 2 μ)
294+ (L₁ L₂ : StrongDual ℝ E) :
246295 covarianceBilinDual μ L₁ L₂ = 0 := by
247296 rw [covarianceBilinDual, uncenteredCovarianceBilinDual_of_not_memLp]
248297 rw [(measurableEmbedding_subRight _).memLp_map_measure_iff]
249- refine fun h_Lp ↦ h ?_
250- have : (id : E → E) = fun x ↦ x - ∫ x, x ∂μ + ∫ x, x ∂μ := by ext; simp
251- rw [this]
252- exact h_Lp.add (memLp_const _)
298+ exact h
299+
300+ @[simp]
301+ lemma covarianceBilinDual_of_not_memLp (h : ¬ MemLp id 2 μ) (L₁ L₂ : StrongDual ℝ E) :
302+ covarianceBilinDual μ L₁ L₂ = 0 := by
303+ apply covarianceBilinDual_of_not_memLp'
304+ contrapose! h
305+ exact memLp_id_of_self_sub_integral h
253306
254307@[simp]
255308lemma covarianceBilinDual_zero : covarianceBilinDual (0 : Measure E) = 0 := by
256309 rw [covarianceBilinDual, Measure.map_zero, uncenteredCovarianceBilinDual_zero]
257310
258311lemma covarianceBilinDual_comm (L₁ L₂ : StrongDual ℝ E) :
259312 covarianceBilinDual μ L₁ L₂ = covarianceBilinDual μ L₂ L₁ := by
260- by_cases h : MemLp id 2 μ
313+ by_cases h : MemLp ( fun x ↦ x - ∫ y, y ∂μ) 2 μ
261314 · have h' : MemLp id 2 (Measure.map (fun x ↦ x - ∫ (x : E), x ∂μ) μ) :=
262- (measurableEmbedding_subRight _).memLp_map_measure_iff.mpr <| h.sub (memLp_const _)
315+ (measurableEmbedding_subRight _).memLp_map_measure_iff.mpr <| h
263316 simp_rw [covarianceBilinDual, uncenteredCovarianceBilinDual_apply h', mul_comm (L₁ _)]
264- · simp [h]
317+ · simp [h, covarianceBilinDual_of_not_memLp' ]
265318
266319@[simp]
267320lemma covarianceBilinDual_self_nonneg (L : StrongDual ℝ E) : 0 ≤ covarianceBilinDual μ L L := by
@@ -271,7 +324,7 @@ lemma covarianceBilinDual_self_nonneg (L : StrongDual ℝ E) : 0 ≤ covarianceB
271324 exact real_inner_self_nonneg
272325 · simp [h]
273326
274- variable [CompleteSpace E]
327+ variable [CompleteSpace E] [IsFiniteMeasure μ]
275328
276329lemma covarianceBilinDual_apply (h : MemLp id 2 μ) (L₁ L₂ : StrongDual ℝ E) :
277330 covarianceBilinDual μ L₁ L₂ = ∫ x, (L₁ x - μ[L₁]) * (L₂ x - μ[L₂]) ∂μ := by
0 commit comments