@@ -343,22 +343,22 @@ version for real-valued nonnegative functions. -/
343343theorem harm_mean_le_geom_mean_weighted (w z : ι → ℝ) (hs : s.Nonempty) (hw : ∀ i ∈ s, 0 < w i)
344344 (hw' : ∑ i ∈ s, w i = 1 ) (hz : ∀ i ∈ s, 0 < z i) :
345345 (∑ i ∈ s, w i / z i)⁻¹ ≤ ∏ i ∈ s, z i ^ w i := by
346- have : ∏ i ∈ s, (1 / z) i ^ w i ≤ ∑ i ∈ s, w i * (1 / z) i :=
347- geom_mean_le_arith_mean_weighted s w (1 / z) (fun i hi ↦ le_of_lt (hw i hi)) hw'
348- (fun i hi ↦ one_div_nonneg.2 (le_of_lt (hz i hi)))
349- have p_pos : 0 < ∏ i ∈ s, (z i)⁻¹ ^ w i :=
350- prod_pos fun i hi => rpow_pos_of_pos (inv_pos.2 (hz i hi)) _
351- have s_pos : 0 < ∑ i ∈ s, w i * (z i)⁻¹ :=
352- sum_pos (fun i hi => mul_pos (hw i hi) (inv_pos.2 (hz i hi))) hs
353- norm_num at this
354- rw [← inv_le_inv₀ s_pos p_pos] at this
355- apply le_trans this
356- have p_pos₂ : 0 < (∏ i ∈ s, (z i) ^ w i)⁻¹ :=
357- inv_pos.2 (prod_pos fun i hi => rpow_pos_of_pos ((hz i hi)) _)
358- rw [← inv_inv (∏ i ∈ s, z i ^ w i), inv_le_inv₀ p_pos p_pos₂, ← Finset.prod_inv_distrib]
359- gcongr
360- · exact fun i hi ↦ inv_nonneg.mpr (Real.rpow_nonneg (le_of_lt (hz i hi)) _)
361- · rw [Real.inv_rpow]; apply fun i hi ↦ le_of_lt (hz i hi); assumption
346+ have : ∏ i ∈ s, (1 / z) i ^ w i ≤ ∑ i ∈ s, w i * (1 / z) i :=
347+ geom_mean_le_arith_mean_weighted s w (1 / z) (fun i hi ↦ le_of_lt (hw i hi)) hw'
348+ (fun i hi ↦ one_div_nonneg.2 (le_of_lt (hz i hi)))
349+ have p_pos : 0 < ∏ i ∈ s, (z i)⁻¹ ^ w i :=
350+ prod_pos fun i hi => rpow_pos_of_pos (inv_pos.2 (hz i hi)) _
351+ have s_pos : 0 < ∑ i ∈ s, w i * (z i)⁻¹ :=
352+ sum_pos (fun i hi => mul_pos (hw i hi) (inv_pos.2 (hz i hi))) hs
353+ norm_num at this
354+ rw [← inv_le_inv₀ s_pos p_pos] at this
355+ apply le_trans this
356+ have p_pos₂ : 0 < (∏ i ∈ s, (z i) ^ w i)⁻¹ :=
357+ inv_pos.2 (prod_pos fun i hi => rpow_pos_of_pos ((hz i hi)) _)
358+ rw [← inv_inv (∏ i ∈ s, z i ^ w i), inv_le_inv₀ p_pos p_pos₂, ← Finset.prod_inv_distrib]
359+ gcongr
360+ · exact fun i hi ↦ inv_nonneg.mpr (Real.rpow_nonneg (le_of_lt (hz i hi)) _)
361+ · rw [Real.inv_rpow]; apply fun i hi ↦ le_of_lt (hz i hi); assumption
362362
363363
364364/-- **HM-GM inequality** : The **harmonic mean is less than or equal to the geometric mean. -/
0 commit comments