@@ -252,6 +252,75 @@ by exact_mod_cast real.arith_mean_le_rpow_mean s _ _ (λ i _, (w i).coe_nonneg)
252
252
253
253
end nnreal
254
254
255
+ namespace ennreal
256
+
257
+ /-- Weighted generalized mean inequality, version for sums over finite sets, with `ennreal`-valued
258
+ functions and real exponents. -/
259
+ theorem rpow_arith_mean_le_arith_mean_rpow (w z : ι → ennreal) (hw' : ∑ i in s, w i = 1 ) {p : ℝ}
260
+ (hp : 1 ≤ p) :
261
+ (∑ i in s, w i * z i) ^ p ≤ ∑ i in s, (w i * z i ^ p) :=
262
+ begin
263
+ have hp_pos : 0 < p, from lt_of_lt_of_le zero_lt_one hp,
264
+ have hp_nonneg : 0 ≤ p, from le_of_lt hp_pos,
265
+ have hp_not_nonpos : ¬ p ≤ 0 , by simp [hp_pos],
266
+ have hp_not_neg : ¬ p < 0 , by simp [hp_nonneg],
267
+ have h_top_iff_rpow_top : ∀ (i : ι) (hi : i ∈ s), w i * z i = ⊤ ↔ w i * (z i) ^ p = ⊤,
268
+ by simp [hp_pos, hp_nonneg, hp_not_nonpos, hp_not_neg],
269
+ refine le_of_top_imp_top_of_to_nnreal_le _ _,
270
+ { -- first, prove `(∑ i in s, w i * z i) ^ p = ⊤ → ∑ i in s, (w i * z i ^ p) = ⊤`
271
+ rw [rpow_eq_top_iff, sum_eq_top_iff, sum_eq_top_iff],
272
+ intro h,
273
+ simp only [and_false, hp_not_neg, false_or] at h,
274
+ rcases h.left with ⟨a, H, ha⟩,
275
+ use [a, H],
276
+ rwa ←h_top_iff_rpow_top a H, },
277
+ { -- second, suppose both `(∑ i in s, w i * z i) ^ p ≠ ⊤` and `∑ i in s, (w i * z i ^ p) ≠ ⊤`,
278
+ -- and prove `((∑ i in s, w i * z i) ^ p).to_nnreal ≤ (∑ i in s, (w i * z i ^ p)).to_nnreal`,
279
+ -- by using `nnreal.rpow_arith_mean_le_arith_mean_rpow`.
280
+ intros h_top_rpow_sum _,
281
+ -- show hypotheses needed to put the `.to_nnreal` inside the sums.
282
+ have h_top : ∀ (a : ι), a ∈ s → w a * z a < ⊤,
283
+ { have h_top_sum : ∑ (i : ι) in s, w i * z i < ⊤,
284
+ { by_contra h,
285
+ rw [lt_top_iff_ne_top, not_not] at h,
286
+ rw [h, top_rpow_of_pos hp_pos] at h_top_rpow_sum,
287
+ exact h_top_rpow_sum rfl, },
288
+ rwa sum_lt_top_iff at h_top_sum, },
289
+ have h_top_rpow : ∀ (a : ι), a ∈ s → w a * z a ^ p < ⊤,
290
+ { intros i hi,
291
+ specialize h_top i hi,
292
+ rw lt_top_iff_ne_top at h_top ⊢,
293
+ rwa [ne.def, ←h_top_iff_rpow_top i hi], },
294
+ -- put the `.to_nnreal` inside the sums.
295
+ simp_rw [to_nnreal_sum h_top_rpow, ←to_nnreal_rpow, to_nnreal_sum h_top, to_nnreal_mul,
296
+ ←to_nnreal_rpow],
297
+ -- use corresponding nnreal result
298
+ refine nnreal.rpow_arith_mean_le_arith_mean_rpow s (λ i, (w i).to_nnreal) (λ i, (z i).to_nnreal)
299
+ _ hp,
300
+ -- verify the hypothesis `∑ i in s, (w i).to_nnreal = 1`, using `∑ i in s, w i = 1` .
301
+ have h_sum_nnreal : (∑ i in s, w i) = ↑(∑ i in s, (w i).to_nnreal),
302
+ { have hw_top : ∑ i in s, w i < ⊤, by { rw hw', exact one_lt_top, },
303
+ rw ←to_nnreal_sum,
304
+ { rw coe_to_nnreal,
305
+ rwa ←lt_top_iff_ne_top, },
306
+ { rwa sum_lt_top_iff at hw_top, }, },
307
+ rwa [←coe_eq_coe, ←h_sum_nnreal], },
308
+ end
309
+
310
+ /-- Weighted generalized mean inequality, version for two elements of `ennreal` and real
311
+ exponents. -/
312
+ theorem rpow_arith_mean_le_arith_mean2_rpow (w₁ w₂ z₁ z₂ : ennreal) (hw' : w₁ + w₂ = 1 ) {p : ℝ}
313
+ (hp : 1 ≤ p) :
314
+ (w₁ * z₁ + w₂ * z₂) ^ p ≤ w₁ * z₁ ^ p + w₂ * z₂ ^ p :=
315
+ begin
316
+ have h := rpow_arith_mean_le_arith_mean_rpow (univ : finset (fin 2 ))
317
+ (fin.cons w₁ $ fin.cons w₂ fin_zero_elim) (fin.cons z₁ $ fin.cons z₂ $ fin_zero_elim) _ hp,
318
+ { simpa [fin.sum_univ_succ, fin.sum_univ_zero, fin.cons_succ, fin.cons_zero] using h, },
319
+ { simp [hw', fin.sum_univ_succ, fin.sum_univ_zero, fin.cons_succ, fin.cons_zero], },
320
+ end
321
+
322
+ end ennreal
323
+
255
324
namespace real
256
325
257
326
theorem geom_mean_le_arith_mean2_weighted {w₁ w₂ p₁ p₂ : ℝ} (hw₁ : 0 ≤ w₁) (hw₂ : 0 ≤ w₂)
0 commit comments