Theorem: Real.geom_mean_le_arith_mean
File: Mathlib/Analysis/MeanInequalities.lean

tactic: convert geom_mean_le_arith_mean_weighted s (fun i => (w i) / ∑ i ∈ s, w i) z ?_ ?_ hz using 2
state_before: ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ (∏ i ∈ s, z i ^ w i) ^ (∑ i ∈ s, w i)⁻¹ ≤ (∑ i ∈ s, w i * z i) / ∑ i ∈ s, w i
state_after: case h.e'_3
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ (∏ i ∈ s, z i ^ w i) ^ (∑ i ∈ s, w i)⁻¹ = ∏ i ∈ s, z i ^ (w i / ∑ i ∈ s, w i)

case h.e'_4
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ (∑ i ∈ s, w i * z i) / ∑ i ∈ s, w i = ∑ i ∈ s, (w i / ∑ i ∈ s, w i) * z i

case convert_1
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ ∀ i ∈ s, 0 ≤ (fun i => w i / ∑ i ∈ s, w i) i

case convert_2
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ ∑ i ∈ s, (fun i => w i / ∑ i ∈ s, w i) i = 1

tactic: rw [← finset_prod_rpow _ _ (fun i hi => rpow_nonneg (hz _ hi) _) _]
state_before: case h.e'_3
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ (∏ i ∈ s, z i ^ w i) ^ (∑ i ∈ s, w i)⁻¹ = ∏ i ∈ s, z i ^ (w i / ∑ i ∈ s, w i)
state_after: case h.e'_3
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ ∏ i ∈ s, (z i ^ w i) ^ (∑ i ∈ s, w i)⁻¹ = ∏ i ∈ s, z i ^ (w i / ∑ i ∈ s, w i)

tactic: refine Finset.prod_congr rfl (fun _ ih => ?_)
state_before: case h.e'_3
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ ∏ i ∈ s, (z i ^ w i) ^ (∑ i ∈ s, w i)⁻¹ = ∏ i ∈ s, z i ^ (w i / ∑ i ∈ s, w i)
state_after: case h.e'_3
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
x✝ : ι
ih : x✝ ∈ s
⊢ (z x✝ ^ w x✝) ^ (∑ i ∈ s, w i)⁻¹ = z x✝ ^ (w x✝ / ∑ i ∈ s, w i)

tactic: rw [div_eq_mul_inv, rpow_mul (hz _ ih)]
state_before: case h.e'_3
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
x✝ : ι
ih : x✝ ∈ s
⊢ (z x✝ ^ w x✝) ^ (∑ i ∈ s, w i)⁻¹ = z x✝ ^ (w x✝ / ∑ i ∈ s, w i)
state_after: no goals

tactic: simp_rw [div_eq_mul_inv, mul_assoc, mul_comm, ← mul_assoc, ← Finset.sum_mul, mul_comm]
state_before: case h.e'_4
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ (∑ i ∈ s, w i * z i) / ∑ i ∈ s, w i = ∑ i ∈ s, (w i / ∑ i ∈ s, w i) * z i
state_after: no goals

tactic: exact fun _ hi => div_nonneg (hw _ hi) (le_of_lt hw')
state_before: case convert_1
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ ∀ i ∈ s, 0 ≤ (fun i => w i / ∑ i ∈ s, w i) i
state_after: no goals

tactic: simp_rw [div_eq_mul_inv, ← Finset.sum_mul]
state_before: case convert_2
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ ∑ i ∈ s, (fun i => w i / ∑ i ∈ s, w i) i = 1
state_after: case convert_2
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ (∑ i ∈ s, w i) * (∑ i ∈ s, w i)⁻¹ = 1

tactic: exact mul_inv_cancel (by linarith)
state_before: case convert_2
ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ (∑ i ∈ s, w i) * (∑ i ∈ s, w i)⁻¹ = 1
state_after: no goals

tactic: linarith
state_before: ι✝ : Type u
s✝ : Finset ι✝
ι : Type u_1
s : Finset ι
w z : ι → ℝ
hw : ∀ i ∈ s, 0 ≤ w i
hw' : 0 < ∑ i ∈ s, w i
hz : ∀ i ∈ s, 0 ≤ z i
⊢ ∑ i ∈ s, w i ≠ 0
state_after: no goals