-- Mathlib/Analysis/MeanInequalitiesPow.lean
theorem rpow_arith_mean_le_arith_mean_rpow (w z : ι → ℝ≥0∞) (hw' : ∑ i ∈ s, w i = 1) {p : ℝ}
    (hp : 1 ≤ p) : (∑ i ∈ s, w i * z i) ^ p ≤ ∑ i ∈ s, w i * z i ^ p

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
⊢ ∑ i ∈ s, w i * z i ≠ ⊤

Tactic:
intro h

Result:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h : ∑ i ∈ s, w i * z i = ⊤
⊢ False

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h_top : ∀ a ∈ s, w a * z a ≠ ⊤
i : ι
hi : i ∈ s
⊢ w i * z i ^ p ≠ ⊤

Tactic:
specialize h_top i hi

Result:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
i : ι
hi : i ∈ s
h_top : w i * z i ≠ ⊤
⊢ w i * z i ^ p ≠ ⊤

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
⊢ ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤

Tactic:
simp [ENNReal.mul_eq_top, hp_pos, hp_nonneg, hp_not_neg]

Result:
no goals

Proof state:
case right
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h : (∃ a ∈ s, w a * z a = ⊤) ∧ 0 < p
a : ι
H : a ∈ s
ha : w a * z a = ⊤
⊢ w a * z a ^ p = ⊤

Tactic:
rwa [← h_top_iff_rpow_top a H]

Result:
no goals

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
⊢ ¬p < 0

Tactic:
simp [hp_nonneg]

Result:
no goals

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h_top : ∀ a ∈ s, w a * z a ≠ ⊤
h_top_rpow : ∀ a ∈ s, w a * z a ^ p ≠ ⊤
⊢ ∑ i ∈ s, w i = ↑(∑ i ∈ s, (w i).toNNReal)

Tactic:
rw [coe_finset_sum]

Result:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h_top : ∀ a ∈ s, w a * z a ≠ ⊤
h_top_rpow : ∀ a ∈ s, w a * z a ^ p ≠ ⊤
⊢ ∑ i ∈ s, w i = ∑ a ∈ s, ↑(w a).toNNReal

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
⊢ (∑ i ∈ s, w i * z i) ^ p ≤ ∑ i ∈ s, w i * z i ^ p

Tactic:
have hp_nonneg : 0 ≤ p := by positivity

Result:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
⊢ (∑ i ∈ s, w i * z i) ^ p ≤ ∑ i ∈ s, w i * z i ^ p

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
⊢ (∑ i ∈ s, w i * z i) ^ p ≤ ∑ i ∈ s, w i * z i ^ p

Tactic:
have hp_not_neg : ¬p < 0 := by simp [hp_nonneg]

Result:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
⊢ (∑ i ∈ s, w i * z i) ^ p ≤ ∑ i ∈ s, w i * z i ^ p

Proof state:
case refine_2
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h_top : ∀ a ∈ s, w a * z a ≠ ⊤
h_top_rpow : ∀ a ∈ s, w a * z a ^ p ≠ ⊤
h_sum_nnreal : ∑ i ∈ s, w i = ↑(∑ i ∈ s, (w i).toNNReal)
⊢ ∑ i ∈ s, (fun i => (w i).toNNReal) i = 1

Tactic:
rwa [← coe_inj, ← h_sum_nnreal]

Result:
no goals

Proof state:
case refine_1
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
⊢ (∑ i ∈ s, w i * z i) ^ p = ⊤ → ∑ i ∈ s, w i * z i ^ p = ⊤

Tactic:
rw [rpow_eq_top_iff, sum_eq_top, sum_eq_top]

Result:
case refine_1
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
⊢ ∑ i ∈ s, w i * z i = 0 ∧ p < 0 ∨ (∃ a ∈ s, w a * z a = ⊤) ∧ 0 < p → ∃ a ∈ s, w a * z a ^ p = ⊤

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h_top : ∀ a ∈ s, w a * z a ≠ ⊤
h_top_rpow : ∀ a ∈ s, w a * z a ^ p ≠ ⊤
i : ι
hi : i ∈ s
⊢ ∑ x ∈ s, w x ≠ ⊤

Tactic:
exact hw'.symm ▸ ENNReal.one_ne_top

Result:
no goals

Proof state:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
⊢ (∑ i ∈ s, w i * z i) ^ p ≤ ∑ i ∈ s, w i * z i ^ p

Tactic:
have h_top_iff_rpow_top : ∀ (i : ι), i ∈ s → (w i * z i = ⊤ ↔ w i * z i ^ p = ⊤) := by
  simp [ENNReal.mul_eq_top, hp_pos, hp_nonneg, hp_not_neg]

Result:
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
⊢ (∑ i ∈ s, w i * z i) ^ p ≤ ∑ i ∈ s, w i * z i ^ p

Proof state:
case refine_2
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h_top : ∀ a ∈ s, w a * z a ≠ ⊤
⊢ ((∑ i ∈ s, w i * z i) ^ p).toNNReal ≤ (∑ i ∈ s, w i * z i ^ p).toNNReal

Tactic:
have h_top_rpow : ∀ a : ι, a ∈ s → w a * z a ^ p ≠ ⊤ := by
  intro i hi
  specialize h_top i hi
  rwa [Ne, ← h_top_iff_rpow_top i hi]

Result:
case refine_2
ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
hp_nonneg : 0 ≤ p
hp_not_neg : ¬p < 0
h_top_iff_rpow_top : ∀ i ∈ s, w i * z i = ⊤ ↔ w i * z i ^ p = ⊤
h_top_rpow_sum : (∑ i ∈ s, w i * z i) ^ p ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h_top : ∀ a ∈ s, w a * z a ≠ ⊤
h_top_rpow : ∀ a ∈ s, w a * z a ^ p ≠ ⊤
⊢ ((∑ i ∈ s, w i * z i) ^ p).toNNReal ≤ (∑ i ∈ s, w i * z i ^ p).toNNReal