Theorem: ENNReal.rpow_arith_mean_le_arith_mean_rpow
File: Mathlib/Analysis/MeanInequalitiesPow.lean

tactic: have hp_pos : 0 < p := by positivity
state_before: ι : Type u
s : Finset ι
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
state_after: ι : 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
state_before: ι : 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
state_after: ι : 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]
state_before: ι : 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
state_after: ι : 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]
state_before: ι : 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
state_after: ι : 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: refine le_of_top_imp_top_of_toNNReal_le ?_ ?_
state_before: ι : 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
state_after: 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 = ⊤

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 = ⊤
⊢ (∑ i ∈ s, w i * z i) ^ p ≠ ⊤ →
    ∑ i ∈ s, w i * z i ^ p ≠ ⊤ → ((∑ i ∈ s, w i * z i) ^ p).toNNReal ≤ (∑ i ∈ s, w i * z i ^ p).toNNReal

tactic: positivity
state_before: ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
⊢ 0 < p
state_after: no goals

tactic: positivity
state_before: ι : Type u
s : Finset ι
w z : ι → ℝ≥0∞
hw' : ∑ i ∈ s, w i = 1
p : ℝ
hp : 1 ≤ p
hp_pos : 0 < p
⊢ 0 ≤ p
state_after: no goals

tactic: simp [hp_nonneg]
state_before: ι : 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
state_after: no goals

tactic: simp [ENNReal.mul_eq_top, hp_pos, hp_nonneg, hp_not_neg]
state_before: ι : 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 = ⊤
state_after: no goals

tactic: rw [rpow_eq_top_iff, sum_eq_top_iff, sum_eq_top_iff]
state_before: 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 = ⊤
state_after: 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 = ⊤

tactic: intro h
state_before: 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 = ⊤
state_after: 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 = ⊤
h : ∑ i ∈ s, w i * z i = 0 ∧ p < 0 ∨ (∃ a ∈ s, w a * z a = ⊤) ∧ 0 < p
⊢ ∃ a ∈ s, w a * z a ^ p = ⊤

tactic: simp only [and_false_iff, hp_not_neg, false_or_iff] at h
state_before: 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 = ⊤
h : ∑ i ∈ s, w i * z i = 0 ∧ p < 0 ∨ (∃ a ∈ s, w a * z a = ⊤) ∧ 0 < p
⊢ ∃ a ∈ s, w a * z a ^ p = ⊤
state_after: 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 = ⊤
h : (∃ a ∈ s, w a * z a = ⊤) ∧ 0 < p
⊢ ∃ a ∈ s, w a * z a ^ p = ⊤

tactic: rcases h.left with ⟨a, H, ha⟩
state_before: 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 = ⊤
h : (∃ a ∈ s, w a * z a = ⊤) ∧ 0 < p
⊢ ∃ a ∈ s, w a * z a ^ p = ⊤
state_after: case refine_1.intro.intro
ι : 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 = ⊤
⊢ ∃ a ∈ s, w a * z a ^ p = ⊤

tactic: use a, H
state_before: case refine_1.intro.intro
ι : 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 = ⊤
⊢ ∃ a ∈ s, w a * z a ^ p = ⊤
state_after: 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]
state_before: 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 = ⊤
state_after: no goals

tactic: intro h_top_rpow_sum _
state_before: 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 = ⊤
⊢ (∑ i ∈ s, w i * z i) ^ p ≠ ⊤ →
    ∑ i ∈ s, w i * z i ^ p ≠ ⊤ → ((∑ i ∈ s, w i * z i) ^ p).toNNReal ≤ (∑ i ∈ s, w i * z i ^ p).toNNReal
state_after: 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 ≠ ⊤
⊢ ((∑ i ∈ s, w i * z i) ^ p).toNNReal ≤ (∑ i ∈ s, w i * z i ^ p).toNNReal

tactic: have h_top : ∀ a : ι, a ∈ s → w a * z a ≠ ⊤ :=
  haveI h_top_sum : ∑ i ∈ s, w i * z i ≠ ⊤ := by
    intro h
    rw [h, top_rpow_of_pos hp_pos] at h_top_rpow_sum
    exact h_top_rpow_sum rfl
  fun a ha => (lt_top_of_sum_ne_top h_top_sum ha).ne
state_before: 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 ≠ ⊤
⊢ ((∑ i ∈ s, w i * z i) ^ p).toNNReal ≤ (∑ i ∈ s, w i * z i ^ p).toNNReal
state_after: 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]
state_before: 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
state_after: 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

tactic: simp_rw [toNNReal_sum h_top_rpow, ← toNNReal_rpow, toNNReal_sum h_top, toNNReal_mul, ←
  toNNReal_rpow]
state_before: 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
state_after: 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 ≠ ⊤
⊢ (∑ x ∈ s, (w x).toNNReal * (z x).toNNReal) ^ p ≤ ∑ x ∈ s, (w x).toNNReal * (z x).toNNReal ^ p

tactic: refine
  NNReal.rpow_arith_mean_le_arith_mean_rpow s (fun i => (w i).toNNReal)
    (fun i => (z i).toNNReal) ?_ hp
state_before: 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 ≠ ⊤
⊢ (∑ x ∈ s, (w x).toNNReal * (z x).toNNReal) ^ p ≤ ∑ x ∈ s, (w x).toNNReal * (z x).toNNReal ^ p
state_after: 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, (fun i => (w i).toNNReal) i = 1

tactic: have h_sum_nnreal : ∑ i ∈ s, w i = ↑(∑ i ∈ s, (w i).toNNReal) := by
  rw [coe_finset_sum]
  refine sum_congr rfl fun i hi => (coe_toNNReal ?_).symm
  refine (lt_top_of_sum_ne_top ?_ hi).ne
  exact hw'.symm ▸ ENNReal.one_ne_top
state_before: 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, (fun i => (w i).toNNReal) i = 1
state_after: 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]
state_before: 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
state_after: no goals

tactic: intro h
state_before: ι : 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 ≠ ⊤
state_after: ι : 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

tactic: rw [h, top_rpow_of_pos hp_pos] at h_top_rpow_sum
state_before: ι : 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
state_after: ι : 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 : ⊤ ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h : ∑ i ∈ s, w i * z i = ⊤
⊢ False

tactic: exact h_top_rpow_sum rfl
state_before: ι : 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 : ⊤ ≠ ⊤
a✝ : ∑ i ∈ s, w i * z i ^ p ≠ ⊤
h : ∑ i ∈ s, w i * z i = ⊤
⊢ False
state_after: no goals

tactic: intro i hi
state_before: ι : 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 ≠ ⊤
⊢ ∀ a ∈ s, w a * z a ^ p ≠ ⊤
state_after: ι : 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
state_before: ι : 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 ≠ ⊤
state_after: ι : 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 ≠ ⊤

tactic: rwa [Ne, ← h_top_iff_rpow_top i hi]
state_before: ι : 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 ≠ ⊤
state_after: no goals

tactic: rw [coe_finset_sum]
state_before: ι : 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)
state_after: ι : 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

tactic: refine sum_congr rfl fun i hi => (coe_toNNReal ?_).symm
state_before: ι : 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
state_after: ι : 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
⊢ w i ≠ ⊤

tactic: refine (lt_top_of_sum_ne_top ?_ hi).ne
state_before: ι : 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
⊢ w i ≠ ⊤
state_after: ι : 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
state_before: ι : 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 ≠ ⊤
state_after: no goals