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

tactic: by_cases A : ∃ i ∈ s, z i = 0 ∧ w i ≠ 0
state_before: ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
⊢ ∏ i in s, z i ^ w i ≤ ∑ i in s, w i * z i

tactic: rcases A with ⟨i, his, hzi, hwi⟩
state_before: case pos
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∃ i, i ∈ s ∧ z i = 0 ∧ w i ≠ 0
⊢ ∏ i in s, z i ^ w i ≤ ∑ i in s, w i * z i

tactic: rw [prod_eq_zero his]
state_before: case pos.intro.intro.intro
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
i : ι
his : i ∈ s
hzi : z i = 0
hwi : w i ≠ 0
⊢ ∏ i in s, z i ^ w i ≤ ∑ i in s, w i * z i

tactic: exact sum_nonneg fun j hj => mul_nonneg (hw j hj) (hz j hj)
state_before: case pos.intro.intro.intro
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
i : ι
his : i ∈ s
hzi : z i = 0
hwi : w i ≠ 0
⊢ 0 ≤ ∑ i in s, w i * z i

tactic: rw [hzi]
state_before: case pos.intro.intro.intro
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
i : ι
his : i ∈ s
hzi : z i = 0
hwi : w i ≠ 0
⊢ z i ^ w i = 0

tactic: exact zero_rpow hwi
state_before: case pos.intro.intro.intro
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
i : ι
his : i ∈ s
hzi : z i = 0
hwi : w i ≠ 0
⊢ 0 ^ w i = 0

tactic: simp only [not_exists, not_and, Ne.def, Classical.not_not] at A
state_before: case neg
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ¬∃ i, i ∈ s ∧ z i = 0 ∧ w i ≠ 0
⊢ ∏ i in s, z i ^ w i ≤ ∑ i in s, w i * z i

tactic: have := convexOn_exp.map_sum_le hw hw' fun i _ => Set.mem_univ <| log (z i)
state_before: case neg
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∀ (x : ι), x ∈ s → z x = 0 → w x = 0
⊢ ∏ i in s, z i ^ w i ≤ ∑ i in s, w i * z i

tactic: convert this using 1 <;> [apply prod_congr rfl;apply sum_congr rfl] <;> intro i hi
state_before: case neg
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∀ (x : ι), x ∈ s → z x = 0 → w x = 0
this : ∏ x in s, exp (log (z x) * w x) ≤ ∑ x in s, w x * exp (log (z x))
⊢ ∏ i in s, z i ^ w i ≤ ∑ i in s, w i * z i

tactic: cases' eq_or_lt_of_le (hz i hi) with hz hz
state_before: case h.e'_3
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∀ (x : ι), x ∈ s → z x = 0 → w x = 0
this : ∏ x in s, exp (log (z x) * w x) ≤ ∑ x in s, w x * exp (log (z x))
i : ι
hi : i ∈ s
⊢ z i ^ w i = exp (log (z i) * w i)

tactic: simp [A i hi hz.symm]
state_before: case h.e'_3.inl
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz✝ : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∀ (x : ι), x ∈ s → z x = 0 → w x = 0
this : ∏ x in s, exp (log (z x) * w x) ≤ ∑ x in s, w x * exp (log (z x))
i : ι
hi : i ∈ s
hz : 0 = z i
⊢ z i ^ w i = exp (log (z i) * w i)

tactic: exact rpow_def_of_pos hz _
state_before: case h.e'_3.inr
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz✝ : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∀ (x : ι), x ∈ s → z x = 0 → w x = 0
this : ∏ x in s, exp (log (z x) * w x) ≤ ∑ x in s, w x * exp (log (z x))
i : ι
hi : i ∈ s
hz : 0 < z i
⊢ z i ^ w i = exp (log (z i) * w i)

tactic: cases' eq_or_lt_of_le (hz i hi) with hz hz
state_before: case h.e'_4
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∀ (x : ι), x ∈ s → z x = 0 → w x = 0
this : ∏ x in s, exp (log (z x) * w x) ≤ ∑ x in s, w x * exp (log (z x))
i : ι
hi : i ∈ s
⊢ w i * z i = w i * exp (log (z i))

tactic: simp [A i hi hz.symm]
state_before: case h.e'_4.inl
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz✝ : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∀ (x : ι), x ∈ s → z x = 0 → w x = 0
this : ∏ x in s, exp (log (z x) * w x) ≤ ∑ x in s, w x * exp (log (z x))
i : ι
hi : i ∈ s
hz : 0 = z i
⊢ w i * z i = w i * exp (log (z i))

tactic: rw [exp_log hz]
state_before: case h.e'_4.inr
ι : Type u
s : Finset ι
w z : ι → ℝ
hw : ∀ (i : ι), i ∈ s → 0 ≤ w i
hw' : ∑ i in s, w i = 1
hz✝ : ∀ (i : ι), i ∈ s → 0 ≤ z i
A : ∀ (x : ι), x ∈ s → z x = 0 → w x = 0
this : ∏ x in s, exp (log (z x) * w x) ≤ ∑ x in s, w x * exp (log (z x))
i : ι
hi : i ∈ s
hz : 0 < z i
⊢ w i * z i = w i * exp (log (z i))