l3lab/ntp-mathlib huggingface dataset:
/-- Hölder inequality: the scalar product of two functions is bounded by the product of their
`L^p` and `L^q` norms when `p` and `q` are conjugate exponents. Version for sums over finite sets,
with `ℝ≥0∞`-valued functions. -/
theorem inner_le_Lp_mul_Lq (hpq : p.IsConjugateExponent q) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  by_cases H : (∑ i in s, f i ^ p) ^ (1 / p) = 0 ∨ (∑ i in s, g i ^ q) ^ (1 / q) = 0
  · replace H : (∀ i ∈ s, f i = 0) ∨ ∀ i ∈ s, g i = 0
    · simpa [ENNReal.rpow_eq_zero_iff, hpq.pos, hpq.symm.pos, asymm hpq.pos, asymm hpq.symm.pos,
        sum_eq_zero_iff_of_nonneg] using H
    have : ∀ i ∈ s, f i * g i = 0 := fun i hi => by cases' H with H H <;> simp [H i hi]
    have : ∑ i in s, f i * g i = ∑ i in s, 0 := sum_congr rfl this
    simp [this]
  push_neg at H
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ q) ^ (1 / q) = ⊤
  · cases' H' with H' H' <;> simp [H', -one_div, -sum_eq_zero_iff, -rpow_eq_zero_iff, H]
  replace H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
  · simpa [ENNReal.rpow_eq_top_iff, asymm hpq.pos, asymm hpq.symm.pos, hpq.pos, hpq.symm.pos,
      ENNReal.sum_eq_top_iff, not_or] using H'
  have :=
    ENNReal.coe_le_coe.2
      (@NNReal.inner_le_Lp_mul_Lq _ s (fun i => ENNReal.toNNReal (f i))
        (fun i => ENNReal.toNNReal (g i)) _ _ hpq)
  simp [← ENNReal.coe_rpow_of_nonneg, le_of_lt hpq.pos, le_of_lt hpq.one_div_pos,
    le_of_lt hpq.symm.pos, le_of_lt hpq.symm.one_div_pos] at this
  convert this using 1 <;> [skip; congr 2] <;> [skip; skip; simp; skip; simp] <;>
    · 

Proof state:
case h.e'_3
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hpq : Real.IsConjugateExponent p q
H : (∑ i in s, f i ^ p) ^ (1 / p) ≠ 0 ∧ (∑ i in s, g i ^ q) ^ (1 / q) ≠ 0
H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
this :
  ∑ x in s, ↑(ENNReal.toNNReal (f x)) * ↑(ENNReal.toNNReal (g x)) ≤
    (∑ x in s, ↑(ENNReal.toNNReal (f x)) ^ p) ^ p⁻¹ * (∑ x in s, ↑(ENNReal.toNNReal (g x)) ^ q) ^ q⁻¹
⊢ ∑ i in s, f i * g i = ∑ x in s, ↑(ENNReal.toNNReal (f x)) * ↑(ENNReal.toNNReal (g x))

Next tactic:
refine Finset.sum_congr rfl fun i hi => ?_
/-- Hölder inequality: the scalar product of two functions is bounded by the product of their
`L^p` and `L^q` norms when `p` and `q` are conjugate exponents. Version for sums over finite sets,
with `ℝ≥0∞`-valued functions. -/
theorem inner_le_Lp_mul_Lq (hpq : p.IsConjugateExponent q) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  by_cases H : (∑ i in s, f i ^ p) ^ (1 / p) = 0 ∨ (∑ i in s, g i ^ q) ^ (1 / q) = 0
  · replace H : (∀ i ∈ s, f i = 0) ∨ ∀ i ∈ s, g i = 0
    · simpa [ENNReal.rpow_eq_zero_iff, hpq.pos, hpq.symm.pos, asymm hpq.pos, asymm hpq.symm.pos,
        sum_eq_zero_iff_of_nonneg] using H
    have : ∀ i ∈ s, f i * g i = 0 := fun i hi => by cases' H with H H <;> simp [H i hi]
    have : ∑ i in s, f i * g i = ∑ i in s, 0 := sum_congr rfl this
    simp [this]
  push_neg at H
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ q) ^ (1 / q) = ⊤
  · cases' H' with H' H' <;> simp [H', -one_div, -sum_eq_zero_iff, -rpow_eq_zero_iff, H]
  replace H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
  · simpa [ENNReal.rpow_eq_top_iff, asymm hpq.pos, asymm hpq.symm.pos, hpq.pos, hpq.symm.pos,
      ENNReal.sum_eq_top_iff, not_or] using H'
  have :=
    ENNReal.coe_le_coe.2
      (@NNReal.inner_le_Lp_mul_Lq _ s (fun i => ENNReal.toNNReal (f i))
        (fun i => ENNReal.toNNReal (g i)) _ _ hpq)
  simp [← ENNReal.coe_rpow_of_nonneg, le_of_lt hpq.pos, le_of_lt hpq.one_div_pos,
    le_of_lt hpq.symm.pos, le_of_lt hpq.symm.one_div_pos] at this
  convert this using 1 <;> [skip; congr 2] <;> [skip; skip; simp; skip; simp] <;>
    · refine Finset.sum_congr rfl fun i hi => ?_
      

Proof state:
case h.e'_3
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hpq : Real.IsConjugateExponent p q
H : (∑ i in s, f i ^ p) ^ (1 / p) ≠ 0 ∧ (∑ i in s, g i ^ q) ^ (1 / q) ≠ 0
H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
this :
  ∑ x in s, ↑(ENNReal.toNNReal (f x)) * ↑(ENNReal.toNNReal (g x)) ≤
    (∑ x in s, ↑(ENNReal.toNNReal (f x)) ^ p) ^ p⁻¹ * (∑ x in s, ↑(ENNReal.toNNReal (g x)) ^ q) ^ q⁻¹
i : ι
hi : i ∈ s
⊢ f i * g i = ↑(ENNReal.toNNReal (f i)) * ↑(ENNReal.toNNReal (g i))

Next tactic:
simp [H'.1 i hi, H'.2 i hi, -WithZero.coe_mul, WithTop.coe_mul.symm]
/-- Hölder inequality: the scalar product of two functions is bounded by the product of their
`L^p` and `L^q` norms when `p` and `q` are conjugate exponents. Version for sums over finite sets,
with `ℝ≥0∞`-valued functions. -/
theorem inner_le_Lp_mul_Lq (hpq : p.IsConjugateExponent q) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  by_cases H : (∑ i in s, f i ^ p) ^ (1 / p) = 0 ∨ (∑ i in s, g i ^ q) ^ (1 / q) = 0
  · replace H : (∀ i ∈ s, f i = 0) ∨ ∀ i ∈ s, g i = 0
    · simpa [ENNReal.rpow_eq_zero_iff, hpq.pos, hpq.symm.pos, asymm hpq.pos, asymm hpq.symm.pos,
        sum_eq_zero_iff_of_nonneg] using H
    have : ∀ i ∈ s, f i * g i = 0 := fun i hi => by cases' H with H H <;> simp [H i hi]
    have : ∑ i in s, f i * g i = ∑ i in s, 0 := sum_congr rfl this
    simp [this]
  push_neg at H
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ q) ^ (1 / q) = ⊤
  · cases' H' with H' H' <;> simp [H', -one_div, -sum_eq_zero_iff, -rpow_eq_zero_iff, H]
  replace H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
  · simpa [ENNReal.rpow_eq_top_iff, asymm hpq.pos, asymm hpq.symm.pos, hpq.pos, hpq.symm.pos,
      ENNReal.sum_eq_top_iff, not_or] using H'
  have :=
    ENNReal.coe_le_coe.2
      (@NNReal.inner_le_Lp_mul_Lq _ s (fun i => ENNReal.toNNReal (f i))
        (fun i => ENNReal.toNNReal (g i)) _ _ hpq)
  simp [← ENNReal.coe_rpow_of_nonneg, le_of_lt hpq.pos, le_of_lt hpq.one_div_pos,
    le_of_lt hpq.symm.pos, le_of_lt hpq.symm.one_div_pos] at this
  convert this using 1 <;> [skip; congr 2] <;> [skip; skip; simp; skip; simp] <;>
    · 

Proof state:
case h.e'_4.e_a.e_a
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hpq : Real.IsConjugateExponent p q
H : (∑ i in s, f i ^ p) ^ (1 / p) ≠ 0 ∧ (∑ i in s, g i ^ q) ^ (1 / q) ≠ 0
H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
this :
  ∑ x in s, ↑(ENNReal.toNNReal (f x)) * ↑(ENNReal.toNNReal (g x)) ≤
    (∑ x in s, ↑(ENNReal.toNNReal (f x)) ^ p) ^ p⁻¹ * (∑ x in s, ↑(ENNReal.toNNReal (g x)) ^ q) ^ q⁻¹
⊢ ∑ i in s, f i ^ p = ∑ x in s, ↑(ENNReal.toNNReal (f x)) ^ p

Next tactic:
refine Finset.sum_congr rfl fun i hi => ?_
/-- Hölder inequality: the scalar product of two functions is bounded by the product of their
`L^p` and `L^q` norms when `p` and `q` are conjugate exponents. Version for sums over finite sets,
with `ℝ≥0∞`-valued functions. -/
theorem inner_le_Lp_mul_Lq (hpq : p.IsConjugateExponent q) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  by_cases H : (∑ i in s, f i ^ p) ^ (1 / p) = 0 ∨ (∑ i in s, g i ^ q) ^ (1 / q) = 0
  · replace H : (∀ i ∈ s, f i = 0) ∨ ∀ i ∈ s, g i = 0
    · simpa [ENNReal.rpow_eq_zero_iff, hpq.pos, hpq.symm.pos, asymm hpq.pos, asymm hpq.symm.pos,
        sum_eq_zero_iff_of_nonneg] using H
    have : ∀ i ∈ s, f i * g i = 0 := fun i hi => by cases' H with H H <;> simp [H i hi]
    have : ∑ i in s, f i * g i = ∑ i in s, 0 := sum_congr rfl this
    simp [this]
  push_neg at H
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ q) ^ (1 / q) = ⊤
  · cases' H' with H' H' <;> simp [H', -one_div, -sum_eq_zero_iff, -rpow_eq_zero_iff, H]
  replace H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
  · simpa [ENNReal.rpow_eq_top_iff, asymm hpq.pos, asymm hpq.symm.pos, hpq.pos, hpq.symm.pos,
      ENNReal.sum_eq_top_iff, not_or] using H'
  have :=
    ENNReal.coe_le_coe.2
      (@NNReal.inner_le_Lp_mul_Lq _ s (fun i => ENNReal.toNNReal (f i))
        (fun i => ENNReal.toNNReal (g i)) _ _ hpq)
  simp [← ENNReal.coe_rpow_of_nonneg, le_of_lt hpq.pos, le_of_lt hpq.one_div_pos,
    le_of_lt hpq.symm.pos, le_of_lt hpq.symm.one_div_pos] at this
  convert this using 1 <;> [skip; congr 2] <;> [skip; skip; simp; skip; simp] <;>
    · refine Finset.sum_congr rfl fun i hi => ?_
      

Proof state:
case h.e'_4.e_a.e_a
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hpq : Real.IsConjugateExponent p q
H : (∑ i in s, f i ^ p) ^ (1 / p) ≠ 0 ∧ (∑ i in s, g i ^ q) ^ (1 / q) ≠ 0
H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
this :
  ∑ x in s, ↑(ENNReal.toNNReal (f x)) * ↑(ENNReal.toNNReal (g x)) ≤
    (∑ x in s, ↑(ENNReal.toNNReal (f x)) ^ p) ^ p⁻¹ * (∑ x in s, ↑(ENNReal.toNNReal (g x)) ^ q) ^ q⁻¹
i : ι
hi : i ∈ s
⊢ f i ^ p = ↑(ENNReal.toNNReal (f i)) ^ p

Next tactic:
simp [H'.1 i hi, H'.2 i hi, -WithZero.coe_mul, WithTop.coe_mul.symm]
/-- Hölder inequality: the scalar product of two functions is bounded by the product of their
`L^p` and `L^q` norms when `p` and `q` are conjugate exponents. Version for sums over finite sets,
with `ℝ≥0∞`-valued functions. -/
theorem inner_le_Lp_mul_Lq (hpq : p.IsConjugateExponent q) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  by_cases H : (∑ i in s, f i ^ p) ^ (1 / p) = 0 ∨ (∑ i in s, g i ^ q) ^ (1 / q) = 0
  · replace H : (∀ i ∈ s, f i = 0) ∨ ∀ i ∈ s, g i = 0
    · simpa [ENNReal.rpow_eq_zero_iff, hpq.pos, hpq.symm.pos, asymm hpq.pos, asymm hpq.symm.pos,
        sum_eq_zero_iff_of_nonneg] using H
    have : ∀ i ∈ s, f i * g i = 0 := fun i hi => by cases' H with H H <;> simp [H i hi]
    have : ∑ i in s, f i * g i = ∑ i in s, 0 := sum_congr rfl this
    simp [this]
  push_neg at H
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ q) ^ (1 / q) = ⊤
  · cases' H' with H' H' <;> simp [H', -one_div, -sum_eq_zero_iff, -rpow_eq_zero_iff, H]
  replace H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
  · simpa [ENNReal.rpow_eq_top_iff, asymm hpq.pos, asymm hpq.symm.pos, hpq.pos, hpq.symm.pos,
      ENNReal.sum_eq_top_iff, not_or] using H'
  have :=
    ENNReal.coe_le_coe.2
      (@NNReal.inner_le_Lp_mul_Lq _ s (fun i => ENNReal.toNNReal (f i))
        (fun i => ENNReal.toNNReal (g i)) _ _ hpq)
  simp [← ENNReal.coe_rpow_of_nonneg, le_of_lt hpq.pos, le_of_lt hpq.one_div_pos,
    le_of_lt hpq.symm.pos, le_of_lt hpq.symm.one_div_pos] at this
  convert this using 1 <;> [skip; congr 2] <;> [skip; skip; simp; skip; simp] <;>
    · 

Proof state:
case h.e'_4.e_a.e_a
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hpq : Real.IsConjugateExponent p q
H : (∑ i in s, f i ^ p) ^ (1 / p) ≠ 0 ∧ (∑ i in s, g i ^ q) ^ (1 / q) ≠ 0
H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
this :
  ∑ x in s, ↑(ENNReal.toNNReal (f x)) * ↑(ENNReal.toNNReal (g x)) ≤
    (∑ x in s, ↑(ENNReal.toNNReal (f x)) ^ p) ^ p⁻¹ * (∑ x in s, ↑(ENNReal.toNNReal (g x)) ^ q) ^ q⁻¹
⊢ ∑ i in s, g i ^ q = ∑ x in s, ↑(ENNReal.toNNReal (g x)) ^ q

Next tactic:
refine Finset.sum_congr rfl fun i hi => ?_
/-- Hölder inequality: the scalar product of two functions is bounded by the product of their
`L^p` and `L^q` norms when `p` and `q` are conjugate exponents. Version for sums over finite sets,
with `ℝ≥0∞`-valued functions. -/
theorem inner_le_Lp_mul_Lq (hpq : p.IsConjugateExponent q) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  by_cases H : (∑ i in s, f i ^ p) ^ (1 / p) = 0 ∨ (∑ i in s, g i ^ q) ^ (1 / q) = 0
  · replace H : (∀ i ∈ s, f i = 0) ∨ ∀ i ∈ s, g i = 0
    · simpa [ENNReal.rpow_eq_zero_iff, hpq.pos, hpq.symm.pos, asymm hpq.pos, asymm hpq.symm.pos,
        sum_eq_zero_iff_of_nonneg] using H
    have : ∀ i ∈ s, f i * g i = 0 := fun i hi => by cases' H with H H <;> simp [H i hi]
    have : ∑ i in s, f i * g i = ∑ i in s, 0 := sum_congr rfl this
    simp [this]
  push_neg at H
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ q) ^ (1 / q) = ⊤
  · cases' H' with H' H' <;> simp [H', -one_div, -sum_eq_zero_iff, -rpow_eq_zero_iff, H]
  replace H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
  · simpa [ENNReal.rpow_eq_top_iff, asymm hpq.pos, asymm hpq.symm.pos, hpq.pos, hpq.symm.pos,
      ENNReal.sum_eq_top_iff, not_or] using H'
  have :=
    ENNReal.coe_le_coe.2
      (@NNReal.inner_le_Lp_mul_Lq _ s (fun i => ENNReal.toNNReal (f i))
        (fun i => ENNReal.toNNReal (g i)) _ _ hpq)
  simp [← ENNReal.coe_rpow_of_nonneg, le_of_lt hpq.pos, le_of_lt hpq.one_div_pos,
    le_of_lt hpq.symm.pos, le_of_lt hpq.symm.one_div_pos] at this
  convert this using 1 <;> [skip; congr 2] <;> [skip; skip; simp; skip; simp] <;>
    · refine Finset.sum_congr rfl fun i hi => ?_
      

Proof state:
case h.e'_4.e_a.e_a
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hpq : Real.IsConjugateExponent p q
H : (∑ i in s, f i ^ p) ^ (1 / p) ≠ 0 ∧ (∑ i in s, g i ^ q) ^ (1 / q) ≠ 0
H' : (∀ i ∈ s, f i ≠ ⊤) ∧ ∀ i ∈ s, g i ≠ ⊤
this :
  ∑ x in s, ↑(ENNReal.toNNReal (f x)) * ↑(ENNReal.toNNReal (g x)) ≤
    (∑ x in s, ↑(ENNReal.toNNReal (f x)) ^ p) ^ p⁻¹ * (∑ x in s, ↑(ENNReal.toNNReal (g x)) ^ q) ^ q⁻¹
i : ι
hi : i ∈ s
⊢ g i ^ q = ↑(ENNReal.toNNReal (g i)) ^ q

Next tactic:
simp [H'.1 i hi, H'.2 i hi, -WithZero.coe_mul, WithTop.coe_mul.symm]
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hp : 1 ≤ p
⊢ (∑ i in s, f i) ^ p ≤ ↑(card s) ^ (p - 1) * ∑ i in s, f i ^ p

Next tactic:
cases' eq_or_lt_of_le hp with hp hp
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · 

Proof state:
case inl
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hp✝ : 1 ≤ p
hp : 1 = p
⊢ (∑ i in s, f i) ^ p ≤ ↑(card s) ^ (p - 1) * ∑ i in s, f i ^ p

Next tactic:
simp [← hp]
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · simp [← hp]
  

Proof state:
case inr
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hp✝ : 1 ≤ p
hp : 1 < p
⊢ (∑ i in s, f i) ^ p ≤ ↑(card s) ^ (p - 1) * ∑ i in s, f i ^ p

Next tactic:
let q : ℝ := p / (p - 1)
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · simp [← hp]
  let q : ℝ := p / (p - 1)
  

Proof state:
case inr
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q✝ : ℝ
hp✝ : 1 ≤ p
hp : 1 < p
q : ℝ := p / (p - 1)
⊢ (∑ i in s, f i) ^ p ≤ ↑(card s) ^ (p - 1) * ∑ i in s, f i ^ p

Next tactic:
have hpq : p.IsConjugateExponent q := by rw [Real.isConjugateExponent_iff hp]
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · simp [← hp]
  let q : ℝ := p / (p - 1)
  have hpq : p.IsConjugateExponent q := by 

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q✝ : ℝ
hp✝ : 1 ≤ p
hp : 1 < p
q : ℝ := p / (p - 1)
⊢ Real.IsConjugateExponent p q

Next tactic:
rw [Real.isConjugateExponent_iff hp]
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · simp [← hp]
  let q : ℝ := p / (p - 1)
  have hpq : p.IsConjugateExponent q := by rw [Real.isConjugateExponent_iff hp]
  

Proof state:
case inr
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q✝ : ℝ
hp✝ : 1 ≤ p
hp : 1 < p
q : ℝ := p / (p - 1)
hpq : Real.IsConjugateExponent p q
⊢ (∑ i in s, f i) ^ p ≤ ↑(card s) ^ (p - 1) * ∑ i in s, f i ^ p

Next tactic:
have hp₁ : 1 / p * p = 1 := one_div_mul_cancel hpq.ne_zero
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · simp [← hp]
  let q : ℝ := p / (p - 1)
  have hpq : p.IsConjugateExponent q := by rw [Real.isConjugateExponent_iff hp]
  have hp₁ : 1 / p * p = 1 := one_div_mul_cancel hpq.ne_zero
  

Proof state:
case inr
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q✝ : ℝ
hp✝ : 1 ≤ p
hp : 1 < p
q : ℝ := p / (p - 1)
hpq : Real.IsConjugateExponent p q
hp₁ : 1 / p * p = 1
⊢ (∑ i in s, f i) ^ p ≤ ↑(card s) ^ (p - 1) * ∑ i in s, f i ^ p

Next tactic:
have hq : 1 / q * p = p - 1 := by
    rw [← hpq.div_conj_eq_sub_one]
    ring
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · simp [← hp]
  let q : ℝ := p / (p - 1)
  have hpq : p.IsConjugateExponent q := by rw [Real.isConjugateExponent_iff hp]
  have hp₁ : 1 / p * p = 1 := one_div_mul_cancel hpq.ne_zero
  have hq : 1 / q * p = p - 1 := by
    

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q✝ : ℝ
hp✝ : 1 ≤ p
hp : 1 < p
q : ℝ := p / (p - 1)
hpq : Real.IsConjugateExponent p q
hp₁ : 1 / p * p = 1
⊢ 1 / q * p = p - 1

Next tactic:
rw [← hpq.div_conj_eq_sub_one]
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · simp [← hp]
  let q : ℝ := p / (p - 1)
  have hpq : p.IsConjugateExponent q := by rw [Real.isConjugateExponent_iff hp]
  have hp₁ : 1 / p * p = 1 := one_div_mul_cancel hpq.ne_zero
  have hq : 1 / q * p = p - 1 := by
    rw [← hpq.div_conj_eq_sub_one]
    

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q✝ : ℝ
hp✝ : 1 ≤ p
hp : 1 < p
q : ℝ := p / (p - 1)
hpq : Real.IsConjugateExponent p q
hp₁ : 1 / p * p = 1
⊢ 1 / q * p = p / q

Next tactic:
ring
/-- For `1 ≤ p`, the `p`-th power of the sum of `f i` is bounded above by a constant times the
sum of the `p`-th powers of `f i`. Version for sums over finite sets, with `ℝ≥0∞`-valued functions.
-/
theorem rpow_sum_le_const_mul_sum_rpow (hp : 1 ≤ p) :
    (∑ i in s, f i) ^ p ≤ (card s : ℝ≥0∞) ^ (p - 1) * ∑ i in s, f i ^ p := by
  cases' eq_or_lt_of_le hp with hp hp
  · simp [← hp]
  let q : ℝ := p / (p - 1)
  have hpq : p.IsConjugateExponent q := by rw [Real.isConjugateExponent_iff hp]
  have hp₁ : 1 / p * p = 1 := one_div_mul_cancel hpq.ne_zero
  have hq : 1 / q * p = p - 1 := by
    rw [← hpq.div_conj_eq_sub_one]
    ring
  

Proof state:
case inr
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q✝ : ℝ
hp✝ : 1 ≤ p
hp : 1 < p
q : ℝ := p / (p - 1)
hpq : Real.IsConjugateExponent p q
hp₁ : 1 / p * p = 1
hq : 1 / q * p = p - 1
⊢ (∑ i in s, f i) ^ p ≤ ↑(card s) ^ (p - 1) * ∑ i in s, f i ^ p

Next tactic:
simpa only [ENNReal.mul_rpow_of_nonneg _ _ hpq.nonneg, ← ENNReal.rpow_mul, hp₁, hq, coe_one,
    one_mul, one_rpow, rpow_one, Pi.one_apply, sum_const, Nat.smul_one_eq_coe] using
    ENNReal.rpow_le_rpow (inner_le_Lp_mul_Lq s 1 f hpq.symm) hpq.nonneg
/-- Minkowski inequality: the `L_p` seminorm of the sum of two vectors is less than or equal
to the sum of the `L_p`-seminorms of the summands. A version for `ℝ≥0∞` valued nonnegative
functions. -/
theorem Lp_add_le (hp : 1 ≤ p) :
    (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤
      (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p) := by
  

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hp : 1 ≤ p
⊢ (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤ (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p)

Next tactic:
by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ p) ^ (1 / p) = ⊤
/-- Minkowski inequality: the `L_p` seminorm of the sum of two vectors is less than or equal
to the sum of the `L_p`-seminorms of the summands. A version for `ℝ≥0∞` valued nonnegative
functions. -/
theorem Lp_add_le (hp : 1 ≤ p) :
    (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤
      (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p) := by
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ p) ^ (1 / p) = ⊤
  · 

Proof state:
case pos
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hp : 1 ≤ p
H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ p) ^ (1 / p) = ⊤
⊢ (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤ (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p)

Next tactic:
cases' H' with H' H'
/-- Minkowski inequality: the `L_p` seminorm of the sum of two vectors is less than or equal
to the sum of the `L_p`-seminorms of the summands. A version for `ℝ≥0∞` valued nonnegative
functions. -/
theorem Lp_add_le (hp : 1 ≤ p) :
    (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤
      (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p) := by
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ p) ^ (1 / p) = ⊤
  · cases' H' with H' H' <;> 

Proof state:
case pos.inl
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hp : 1 ≤ p
H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤
⊢ (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤ (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p)

Next tactic:
simp [H', -one_div]
/-- Minkowski inequality: the `L_p` seminorm of the sum of two vectors is less than or equal
to the sum of the `L_p`-seminorms of the summands. A version for `ℝ≥0∞` valued nonnegative
functions. -/
theorem Lp_add_le (hp : 1 ≤ p) :
    (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤
      (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p) := by
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ p) ^ (1 / p) = ⊤
  · cases' H' with H' H' <;> 

Proof state:
case pos.inr
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hp : 1 ≤ p
H' : (∑ i in s, g i ^ p) ^ (1 / p) = ⊤
⊢ (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤ (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p)

Next tactic:
simp [H', -one_div]
/-- Minkowski inequality: the `L_p` seminorm of the sum of two vectors is less than or equal
to the sum of the `L_p`-seminorms of the summands. A version for `ℝ≥0∞` valued nonnegative
functions. -/
theorem Lp_add_le (hp : 1 ≤ p) :
    (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤
      (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p) := by
  by_cases H' : (∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ p) ^ (1 / p) = ⊤
  · cases' H' with H' H' <;> simp [H', -one_div]
  

Proof state:
case neg
ι : Type u
s : Finset ι
f g : ι → ℝ≥0∞
p q : ℝ
hp : 1 ≤ p
H' : ¬((∑ i in s, f i ^ p) ^ (1 / p) = ⊤ ∨ (∑ i in s, g i ^ p) ^ (1 / p) = ⊤)
⊢ (∑ i in s, (f i + g i) ^ p) ^ (1 / p) ≤ (∑ i in s, f i ^ p) ^ (1 / p) + (∑ i in s, g i ^ p) ^ (1 / p)

Next tactic:
have pos : 0 < p := lt_of_lt_of_le zero_lt_one hp