l3lab/ntp-mathlib huggingface dataset:
private theorem inner_le_Lp_mul_Lp_of_norm_le_one (f g : ι → ℝ≥0) {p q : ℝ}
    (hpq : p.IsConjugateExponent q) (hf : ∑ i in s, f i ^ p ≤ 1) (hg : ∑ i in s, g i ^ q ≤ 1) :
    ∑ i in s, f i * g i ≤ 1 := by
  have hp_ne_zero : Real.toNNReal p ≠ 0 := (zero_lt_one.trans hpq.one_lt_nnreal).ne.symm
  have hq_ne_zero : Real.toNNReal q ≠ 0 := (zero_lt_one.trans hpq.symm.one_lt_nnreal).ne.symm
  calc
    ∑ i in s, f i * g i ≤ ∑ i in s, (f i ^ p / Real.toNNReal p + g i ^ q / Real.toNNReal q) :=
      Finset.sum_le_sum fun i _ => young_inequality_real (f i) (g i) hpq
    _ = (∑ i in s, f i ^ p) / Real.toNNReal p + (∑ i in s, g i ^ q) / Real.toNNReal q := by
      rw [sum_add_distrib, sum_div, sum_div]
    _ ≤ 1 / Real.toNNReal p + 1 / Real.toNNReal q := by
      refine' add_le_add _ _
      · 

Proof state:
case refine'_1
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hf : ∑ i in s, f i ^ p ≤ 1
hg : ∑ i in s, g i ^ q ≤ 1
hp_ne_zero : Real.toNNReal p ≠ 0
hq_ne_zero : Real.toNNReal q ≠ 0
⊢ (∑ i in s, f i ^ p) / Real.toNNReal p ≤ 1 / Real.toNNReal p

Next tactic:
rwa [div_le_iff hp_ne_zero, div_mul_cancel _ hp_ne_zero]
private theorem inner_le_Lp_mul_Lp_of_norm_le_one (f g : ι → ℝ≥0) {p q : ℝ}
    (hpq : p.IsConjugateExponent q) (hf : ∑ i in s, f i ^ p ≤ 1) (hg : ∑ i in s, g i ^ q ≤ 1) :
    ∑ i in s, f i * g i ≤ 1 := by
  have hp_ne_zero : Real.toNNReal p ≠ 0 := (zero_lt_one.trans hpq.one_lt_nnreal).ne.symm
  have hq_ne_zero : Real.toNNReal q ≠ 0 := (zero_lt_one.trans hpq.symm.one_lt_nnreal).ne.symm
  calc
    ∑ i in s, f i * g i ≤ ∑ i in s, (f i ^ p / Real.toNNReal p + g i ^ q / Real.toNNReal q) :=
      Finset.sum_le_sum fun i _ => young_inequality_real (f i) (g i) hpq
    _ = (∑ i in s, f i ^ p) / Real.toNNReal p + (∑ i in s, g i ^ q) / Real.toNNReal q := by
      rw [sum_add_distrib, sum_div, sum_div]
    _ ≤ 1 / Real.toNNReal p + 1 / Real.toNNReal q := by
      refine' add_le_add _ _
      · rwa [div_le_iff hp_ne_zero, div_mul_cancel _ hp_ne_zero]
      · 

Proof state:
case refine'_2
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hf : ∑ i in s, f i ^ p ≤ 1
hg : ∑ i in s, g i ^ q ≤ 1
hp_ne_zero : Real.toNNReal p ≠ 0
hq_ne_zero : Real.toNNReal q ≠ 0
⊢ (∑ i in s, g i ^ q) / Real.toNNReal q ≤ 1 / Real.toNNReal q

Next tactic:
rwa [div_le_iff hq_ne_zero, div_mul_cancel _ hq_ne_zero]
private theorem inner_le_Lp_mul_Lp_of_norm_eq_zero (f g : ι → ℝ≥0) {p q : ℝ}
    (hpq : p.IsConjugateExponent q) (hf : ∑ i in s, f i ^ p = 0) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hf : ∑ i in s, f i ^ p = 0
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
simp only [hf, hpq.ne_zero, one_div, sum_eq_zero_iff, zero_rpow, zero_mul,
    inv_eq_zero, Ne.def, not_false_iff, le_zero_iff, mul_eq_zero]
private theorem inner_le_Lp_mul_Lp_of_norm_eq_zero (f g : ι → ℝ≥0) {p q : ℝ}
    (hpq : p.IsConjugateExponent q) (hf : ∑ i in s, f i ^ p = 0) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  simp only [hf, hpq.ne_zero, one_div, sum_eq_zero_iff, zero_rpow, zero_mul,
    inv_eq_zero, Ne.def, not_false_iff, le_zero_iff, mul_eq_zero]
  

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hf : ∑ i in s, f i ^ p = 0
⊢ ∀ x ∈ s, f x = 0 ∨ g x = 0

Next tactic:
intro i his
private theorem inner_le_Lp_mul_Lp_of_norm_eq_zero (f g : ι → ℝ≥0) {p q : ℝ}
    (hpq : p.IsConjugateExponent q) (hf : ∑ i in s, f i ^ p = 0) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  simp only [hf, hpq.ne_zero, one_div, sum_eq_zero_iff, zero_rpow, zero_mul,
    inv_eq_zero, Ne.def, not_false_iff, le_zero_iff, mul_eq_zero]
  intro i his
  

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hf : ∑ i in s, f i ^ p = 0
i : ι
his : i ∈ s
⊢ f i = 0 ∨ g i = 0

Next tactic:
left
private theorem inner_le_Lp_mul_Lp_of_norm_eq_zero (f g : ι → ℝ≥0) {p q : ℝ}
    (hpq : p.IsConjugateExponent q) (hf : ∑ i in s, f i ^ p = 0) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  simp only [hf, hpq.ne_zero, one_div, sum_eq_zero_iff, zero_rpow, zero_mul,
    inv_eq_zero, Ne.def, not_false_iff, le_zero_iff, mul_eq_zero]
  intro i his
  left
  

Proof state:
case h
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hf : ∑ i in s, f i ^ p = 0
i : ι
his : i ∈ s
⊢ f i = 0

Next tactic:
rw [sum_eq_zero_iff] at hf
private theorem inner_le_Lp_mul_Lp_of_norm_eq_zero (f g : ι → ℝ≥0) {p q : ℝ}
    (hpq : p.IsConjugateExponent q) (hf : ∑ i in s, f i ^ p = 0) :
    ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := by
  simp only [hf, hpq.ne_zero, one_div, sum_eq_zero_iff, zero_rpow, zero_mul,
    inv_eq_zero, Ne.def, not_false_iff, le_zero_iff, mul_eq_zero]
  intro i his
  left
  rw [sum_eq_zero_iff] at hf
  

Proof state:
case h
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hf : ∀ x ∈ s, f x ^ p = 0
i : ι
his : i ∈ s
⊢ f i = 0

Next tactic:
exact (rpow_eq_zero_iff.mp (hf i his)).left
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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
  

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
by_cases hF_zero : ∑ i in s, f i ^ p = 0
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · 

Proof state:
case pos
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ∑ i in s, f i ^ p = 0
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  

Proof state:
case neg
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
by_cases hG_zero : ∑ i in s, g i ^ q = 0
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · 

Proof state:
case pos
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ∑ i in s, g i ^ q = 0
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ∑ i in s, g i ^ q = 0
⊢ ∑ i in s, f i * g i = ∑ i in s, g i * f i

Next tactic:
congr with i
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        

Proof state:
case e_f.h.a
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ∑ i in s, g i ^ q = 0
i : ι
⊢ ↑(f i * g i) = ↑(g i * f i)

Next tactic:
rw [mul_comm]
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  

Proof state:
case neg
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
  

Proof state:
case neg
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
f' : ι → ℝ≥0 := fun i => f i / (∑ i in s, f i ^ p) ^ (1 / p)
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
let g' i := g i / (∑ i in s, g i ^ q) ^ (1 / q)
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
  let g' i := g i / (∑ i in s, g i ^ q) ^ (1 / q)
  

Proof state:
case neg
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
f' : ι → ℝ≥0 := fun i => f i / (∑ i in s, f i ^ p) ^ (1 / p)
g' : ι → ℝ≥0 := fun i => g i / (∑ i in s, g i ^ q) ^ (1 / q)
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
suffices (∑ i in s, f' i * g' i) ≤ 1 by
    simp_rw [div_mul_div_comm, ← sum_div] at this
    rwa [div_le_iff, one_mul] at this
    refine' mul_ne_zero _ _
    · rw [Ne.def, rpow_eq_zero_iff, not_and_or]
      exact Or.inl hF_zero
    · rw [Ne.def, rpow_eq_zero_iff, not_and_or]
      exact Or.inl hG_zero
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
  let g' i := g i / (∑ i in s, g i ^ q) ^ (1 / q)
  suffices (∑ i in s, f' i * g' i) ≤ 1 by
    

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
f' : ι → ℝ≥0 := fun i => f i / (∑ i in s, f i ^ p) ^ (1 / p)
g' : ι → ℝ≥0 := fun i => g i / (∑ i in s, g i ^ q) ^ (1 / q)
this : ∑ i in s, f' i * g' i ≤ 1
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
simp_rw [div_mul_div_comm, ← sum_div] at this
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
  let g' i := g i / (∑ i in s, g i ^ q) ^ (1 / q)
  suffices (∑ i in s, f' i * g' i) ≤ 1 by
    simp_rw [div_mul_div_comm, ← sum_div] at this
    

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
f' : ι → ℝ≥0 := fun i => f i / (∑ i in s, f i ^ p) ^ (1 / p)
g' : ι → ℝ≥0 := fun i => g i / (∑ i in s, g i ^ q) ^ (1 / q)
this : (∑ i in s, f i * g i) / ((∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)) ≤ 1
⊢ ∑ i in s, f i * g i ≤ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)

Next tactic:
rwa [div_le_iff, one_mul] at this
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
  let g' i := g i / (∑ i in s, g i ^ q) ^ (1 / q)
  suffices (∑ i in s, f' i * g' i) ≤ 1 by
    simp_rw [div_mul_div_comm, ← sum_div] at this
    rwa [div_le_iff, one_mul] at this
    

Proof state:
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
f' : ι → ℝ≥0 := fun i => f i / (∑ i in s, f i ^ p) ^ (1 / p)
g' : ι → ℝ≥0 := fun i => g i / (∑ i in s, g i ^ q) ^ (1 / q)
this : (∑ i in s, f i * g i) / ((∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)) ≤ 1
⊢ (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) ≠ 0

Next tactic:
refine' mul_ne_zero _ _
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
  let g' i := g i / (∑ i in s, g i ^ q) ^ (1 / q)
  suffices (∑ i in s, f' i * g' i) ≤ 1 by
    simp_rw [div_mul_div_comm, ← sum_div] at this
    rwa [div_le_iff, one_mul] at this
    refine' mul_ne_zero _ _
    · 

Proof state:
case refine'_1
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
f' : ι → ℝ≥0 := fun i => f i / (∑ i in s, f i ^ p) ^ (1 / p)
g' : ι → ℝ≥0 := fun i => g i / (∑ i in s, g i ^ q) ^ (1 / q)
this : (∑ i in s, f i * g i) / ((∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)) ≤ 1
⊢ (∑ i in s, f i ^ p) ^ (1 / p) ≠ 0

Next tactic:
rw [Ne.def, rpow_eq_zero_iff, not_and_or]
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
  let g' i := g i / (∑ i in s, g i ^ q) ^ (1 / q)
  suffices (∑ i in s, f' i * g' i) ≤ 1 by
    simp_rw [div_mul_div_comm, ← sum_div] at this
    rwa [div_le_iff, one_mul] at this
    refine' mul_ne_zero _ _
    · rw [Ne.def, rpow_eq_zero_iff, not_and_or]
      

Proof state:
case refine'_1
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
f' : ι → ℝ≥0 := fun i => f i / (∑ i in s, f i ^ p) ^ (1 / p)
g' : ι → ℝ≥0 := fun i => g i / (∑ i in s, g i ^ q) ^ (1 / q)
this : (∑ i in s, f i * g i) / ((∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)) ≤ 1
⊢ ¬∑ i in s, f i ^ p = 0 ∨ ¬1 / p ≠ 0

Next tactic:
exact Or.inl hF_zero
/-- 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 (f g : ι → ℝ≥0) {p q : ℝ} (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 hF_zero : ∑ i in s, f i ^ p = 0
  · exact inner_le_Lp_mul_Lp_of_norm_eq_zero s f g hpq hF_zero
  by_cases hG_zero : ∑ i in s, g i ^ q = 0
  · calc
      ∑ i in s, f i * g i = ∑ i in s, g i * f i := by
        congr with i
        rw [mul_comm]
      _ ≤ (∑ i in s, g i ^ q) ^ (1 / q) * (∑ i in s, f i ^ p) ^ (1 / p) :=
        (inner_le_Lp_mul_Lp_of_norm_eq_zero s g f hpq.symm hG_zero)
      _ = (∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q) := mul_comm _ _
  let f' i := f i / (∑ i in s, f i ^ p) ^ (1 / p)
  let g' i := g i / (∑ i in s, g i ^ q) ^ (1 / q)
  suffices (∑ i in s, f' i * g' i) ≤ 1 by
    simp_rw [div_mul_div_comm, ← sum_div] at this
    rwa [div_le_iff, one_mul] at this
    refine' mul_ne_zero _ _
    · rw [Ne.def, rpow_eq_zero_iff, not_and_or]
      exact Or.inl hF_zero
    · 

Proof state:
case refine'_2
ι : Type u
s : Finset ι
f g : ι → ℝ≥0
p q : ℝ
hpq : Real.IsConjugateExponent p q
hF_zero : ¬∑ i in s, f i ^ p = 0
hG_zero : ¬∑ i in s, g i ^ q = 0
f' : ι → ℝ≥0 := fun i => f i / (∑ i in s, f i ^ p) ^ (1 / p)
g' : ι → ℝ≥0 := fun i => g i / (∑ i in s, g i ^ q) ^ (1 / q)
this : (∑ i in s, f i * g i) / ((∑ i in s, f i ^ p) ^ (1 / p) * (∑ i in s, g i ^ q) ^ (1 / q)) ≤ 1
⊢ (∑ i in s, g i ^ q) ^ (1 / q) ≠ 0

Next tactic:
rw [Ne.def, rpow_eq_zero_iff, not_and_or]