Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/Mathlib/MeasureTheory/Function/LpSeminorm/     Datei vom 15.10.2026 mit Größe 56 kB image not shown  

Quelle  Basic.lean   Sprache: Lean

 

/-
Copyright (c) 2020 Rémy Degenne. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Rémy Degenne, Sébastien Gouëzel
-/

module

public import Mathlib.MeasureTheory.Function.AEEqFun
public import Mathlib.MeasureTheory.Function.LpSeminorm.Defs
public import Mathlib.MeasureTheory.Function.SpecialFunctions.Basic

import Mathlib.Analysis.MeanInequalitiesPow
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Data.Fintype.Order
import Mathlib.MeasureTheory.Function.StronglyMeasurable.Lemmas

/-!
# Basic theorems about ℒp space
-/


public section

open TopologicalSpace MeasureTheory Filter

open scoped NNReal ENNReal Topology ComplexConjugate

variable {α ε ε' ε'' E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α}
  [NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G] [ENorm ε]
  [TopologicalSpace ε] [ENorm ε'] [ENorm ε'']

namespace MeasureTheory

section Lp

section Top

theorem MemLp.eLpNorm_lt_top {f : α → ε} (hfp : MemLp f p μ) :
    eLpNorm f p μ < ∞ :=
  hfp

@[aesop (rule_sets := [finiteness]) unsafe 95% apply]
theorem MemLp.eLpNorm_ne_top {f : α → ε} (hfp : MemLp f p μ) :
    eLpNorm f p μ ≠ ∞ :=
  hfp.ne

theorem lintegral_rpow_eNorm_lt_top_of_eLpNorm'_lt_top {f : α → ε'} (hq0_lt : 0 < q)
    (hfq : eLpNorm' f q μ < ∞) : ∫⁻ a, ‖f a‖ₑ ^ q ∂μ < ∞ := by
  rw [lintegral_rpow_eNorm_eq_rpow_eLpNorm' hq0_lt]
  exact ENNReal.rpow_lt_top_of_nonneg (le_of_lt hq0_lt) (ne_of_lt hfq)

@[deprecated (since := "2026-11-06")]
alias lintegral_rpow_enorm_lt_top_of_eLpNorm'_lt_top :=
  lintegral_rpow_eNorm_lt_top_of_eLpNorm'_lt_top

theorem lintegral_rpow_eNorm_lt_top_of_eLpNorm_lt_top
    {f : α → ε} (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞)
    (hfp : eLpNorm f p μ < ∞) :
    ∫⁻ a, ‖f a‖ₑ ^ p.toReal ∂μ < ∞ := by
  apply lintegral_rpow_eNorm_lt_top_of_eLpNorm'_lt_top
  · exact ENNReal.toReal_pos hp_ne_zero hp_ne_top
  · simpa [eLpNorm_eq_eLpNorm' hp_ne_zero hp_ne_top (aestronglyMeasurable_of_eLpNorm_ne_top hfp.ne)]
      using hfp

@[deprecated (since := "2026-11-06")]
alias lintegral_rpow_enorm_lt_top_of_eLpNorm_lt_top := lintegral_rpow_eNorm_lt_top_of_eLpNorm_lt_top

theorem eLpNorm_lt_top_iff_lintegral_rpow_eNorm_lt_top
    {f : α → ε} (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) (hf : AEStronglyMeasurable f μ) :
    eLpNorm f p μ < ∞ ↔ ∫⁻ a, ‖f a‖ₑ ^ p.toReal ∂μ < ∞ :=
  ⟨lintegral_rpow_eNorm_lt_top_of_eLpNorm_lt_top hp_ne_zero hp_ne_top, by
    intro h
    have hp' := ENNReal.toReal_pos hp_ne_zero hp_ne_top
    have : 0 < 1 / p.toReal := div_pos zero_lt_one hp'
    simpa [eLpNorm_eq_lintegral_rpow_eNorm_toReal hp_ne_zero hp_ne_top hf] using
      ENNReal.rpow_lt_top_of_nonneg (le_of_lt this) (ne_of_lt h)⟩

@[deprecated (since := "2026-11-06")]
alias eLpNorm_lt_top_iff_lintegral_rpow_enorm_lt_top :=
  eLpNorm_lt_top_iff_lintegral_rpow_eNorm_lt_top

end Top

section Zero

@[simp]
theorem eLpNorm'_exponent_zero {f : α → ε'} : eLpNorm' f 0 μ = 1 := by
  rw [eLpNorm', div_zero, ENNReal.rpow_zero]

@[simp]
theorem eLpNorm_exponent_zero {f : α → ε} (hf : AEStronglyMeasurable f μ) :
    eLpNorm f 0 μ = 0 := by
  simp [eLpNorm, hf]

@[simp]
theorem memLp_zero_iff_aestronglyMeasurable {f : α → ε} :
    MemLp f 0 μ ↔ AEStronglyMeasurable f μ :=
  ⟨fun h ↦ MemLp.aestronglyMeasurable h, fun hf ↦ by simp [memLp_iff, eLpNorm, hf]⟩

section ESeminormedAddMonoid

variable {ε : Type*} [TopologicalSpace ε] [ESeminormedAddMonoid ε]

@[simp]
theorem eLpNorm'_zero (hp0_lt : 0 < q) : eLpNorm' (0 : α → ε) q μ = 0 := by
  simp [eLpNorm'_eq_lintegral_eNorm, hp0_lt]

@[simp]
theorem eLpNorm'_zero' (hq0_ne : q ≠ 0) (hμ : μ ≠ 0) : eLpNorm' (0 : α → ε) q μ = 0 := by
  rcases le_or_gt 0 q with hq0 | hq_neg
  · exact eLpNorm'_zero (lt_of_le_of_ne hq0 hq0_ne.symm)
  · simp [eLpNorm'_eq_lintegral_eNorm, hμ, hq_neg]

@[simp]
theorem eLpNormEssSup_zero : eLpNormEssSup (0 : α → ε) μ = 0 := by
  simp [eLpNormEssSup, ← bot_eq_zero', essSup_const_bot]

@[to_fun (attr := simp) eLpNorm_fun_zero]
theorem eLpNorm_zero : eLpNorm (0 : α → ε) p μ = 0 := by
  by_cases h0 : p = 0
  · simp [h0, aestronglyMeasurable_zero]
  by_cases h_top : p = ∞
  · simp only [h_top, eLpNorm_exponent_top aestronglyMeasurable_zero, eLpNormEssSup_zero]
  rw [← Ne] at h0
  simp [eLpNorm_eq_eLpNorm' h0 h_top aestronglyMeasurable_zero,
    ENNReal.toReal_pos h0 h_top]

@[deprecated (since := "2026-09-08")] alias eLpNorm_zero' := eLpNorm_fun_zero

@[simp] lemma MemLp.zero : MemLp (0 : α → ε) p μ := by
  rw [MemLp, eLpNorm_zero]
  exact ENNReal.coe_lt_top

@[simp] lemma MemLp.zero' : MemLp (fun _ : α => (0 : ε)) p μ := MemLp.zero

variable [MeasurableSpace α]

theorem eLpNorm'_measure_zero_of_pos {f : α → ε} (hq_pos : 0 < q) :
    eLpNorm' f q (0 : Measure α) = 0 := by simp [eLpNorm', hq_pos]

theorem eLpNorm'_measure_zero_of_exponent_zero {f : α → ε} : eLpNorm' f 0 (0 : Measure α) = 1 := by
  simp [eLpNorm']

theorem eLpNorm'_measure_zero_of_neg {f : α → ε} (hq_neg : q < 0) :
    eLpNorm' f q (0 : Measure α) = ∞ := by simp [eLpNorm', hq_neg]

end ESeminormedAddMonoid

@[simp]
theorem eLpNormEssSup_measure_zero {f : α → ε'} : eLpNormEssSup f (0 : Measure α) = 0 := by
  simp [eLpNormEssSup]

@[simp]
theorem eLpNorm_measure_zero {f : α → ε} :
    eLpNorm f p (0 : Measure α) = 0 := by
  by_cases h0 : p = 0
  · simp [h0]
  by_cases h_top : p = ∞
  · simp [h_top]
  rw [← Ne] at h0
  simp [eLpNorm_eq_eLpNorm' h0 h_top, eLpNorm', ENNReal.toReal_pos h0 h_top]

@[simp] lemma memLp_measure_zero {f : α → ε} : MemLp f p (0 : Measure α) := by
  simp [MemLp]

@[simp]
lemma memLp_dirac [MeasurableSingletonClass α] {a : α} {f : α → ε} (hf : ‖f a‖ₑ < ∞) :
    MemLp f p (Measure.dirac a) := by
  rw [MemLp, eLpNorm, ite_eq_left aestronglyMeasurable_dirac]
  split_ifs with hq hq'
  · simp
  · simpa
  · simp [eLpNorm']
    finiteness

end Zero

section Neg

@[simp]
theorem eLpNorm'_neg (f : α → F) (q : ℝ) (μ : Measure α) : eLpNorm' (-f) q μ = eLpNorm' f q μ := by
  simp [eLpNorm'_eq_lintegral_eNorm]

@[simp]
theorem eLpNorm_neg (f : α → F) (p : ℝ≥0∞) (μ : Measure α) : eLpNorm (-f) p μ = eLpNorm f p μ := by
  by_cases! hf : ¬ AEStronglyMeasurable f μ
  · have : ¬AEStronglyMeasurable (-f) μ := by
      contrapose hf
      rw [← neg_neg f]
      exact hf.neg
    rw [eLpNorm_of_not_aestronglyMeasurable this, eLpNorm_of_not_aestronglyMeasurable hf]
  by_cases h0 : p = 0
  · simp [h0, hf, hf.neg]
  by_cases h_top : p = ∞
  · simp [h_top, eLpNormEssSup_eq_essSup_eNorm, hf, hf.neg]
  simp [eLpNorm_eq_eLpNorm' h0 h_top hf.neg, eLpNorm_eq_eLpNorm' h0 h_top hf]

lemma eLpNorm_sub_comm (f g : α → E) (p : ℝ≥0∞) (μ : Measure α) :
    eLpNorm (f - g) p μ = eLpNorm (g - f) p μ := by
  simp [← eLpNorm_neg (f - g)]

theorem MemLp.neg {f : α → E} (hf : MemLp f p μ) : MemLp (-f) p μ := by
  simpa [MemLp, eLpNorm_neg]

theorem memLp_neg_iff {f : α → E} : MemLp (-f) p μ ↔ MemLp f p μ :=
  ⟨fun h => neg_neg f ▸ h.neg, MemLp.neg⟩

end Neg

section Const

theorem eLpNorm'_const (c : ε') (hq_pos : 0 < q) :
    eLpNorm' (fun _ : α => c) q μ = ‖c‖ₑ * μ Set.univ ^ (1 / q) := by
  rw [eLpNorm'_eq_lintegral_eNorm, lintegral_const,
    ENNReal.mul_rpow_of_nonneg _ _ (by simp [hq_pos.le] : 0 ≤ 1 / q)]
  congr
  rw [← ENNReal.rpow_mul]
  suffices hq_cancel : q * (1 / q) = 1 by rw [hq_cancel, ENNReal.rpow_one]
  rw [one_div, mul_inv_cancel₀ (ne_of_lt hq_pos).symm]

-- Generalising this to ESeminormedAddMonoid requires a case analysis whether ‖c‖ₑ = ⊤,
-- and will happen in a future PR.
theorem eLpNorm'_const' [IsFiniteMeasure μ] (c : F) (hc_ne_zero : c ≠ 0) (hq_ne_zero : q ≠ 0) :
    eLpNorm' (fun _ : α => c) q μ = ‖c‖ₑ * μ Set.univ ^ (1 / q) := by
  rw [eLpNorm'_eq_lintegral_eNorm, lintegral_const,
    ENNReal.mul_rpow_of_ne_top _ (by finiteness)]
  · congr
    rw [← ENNReal.rpow_mul]
    suffices hp_cancel : q * (1 / q) = 1 by rw [hp_cancel, ENNReal.rpow_one]
    rw [one_div, mul_inv_cancel₀ hq_ne_zero]
  · finiteness [show ‖c‖ₑ ≠ 0 by simp [hc_ne_zero]]

theorem eLpNormEssSup_const (c : ε') (hμ : μ ≠ 0) : eLpNormEssSup (fun _ : α => c) μ = ‖c‖ₑ := by
  rw [eLpNormEssSup_eq_essSup_eNorm, essSup_const _ hμ]

theorem eLpNorm'_const_of_isProbabilityMeasure (c : ε') (hq_pos : 0 < q) [IsProbabilityMeasure μ] :
    eLpNorm' (fun _ : α => c) q μ = ‖c‖ₑ := by simp [eLpNorm'_const c hq_pos, measure_univ]

theorem eLpNorm_const (c : ε) (h0 : p ≠ 0) (hμ : μ ≠ 0) :
    eLpNorm (fun _ : α => c) p μ = ‖c‖ₑ * μ Set.univ ^ (1 / ENNReal.toReal p) := by
  by_cases h_top : p = ∞
  · simp [h_top, eLpNormEssSup_const c hμ, aestronglyMeasurable_const]
  simp [eLpNorm_eq_eLpNorm' h0 h_top aestronglyMeasurable_const, eLpNorm'_const,
    ENNReal.toReal_pos h0 h_top]

theorem eLpNorm_const' (c : ε) (h0 : p ≠ 0) (h_top : p ≠ ∞) :
    eLpNorm (fun _ : α => c) p μ = ‖c‖ₑ * μ Set.univ ^ (1 / ENNReal.toReal p) := by
  simp [eLpNorm_eq_eLpNorm' h0 h_top aestronglyMeasurable_const,
    eLpNorm'_const, ENNReal.toReal_pos h0 h_top]

-- NB. If ‖c‖ₑ = ∞ and μ is finite, this claim is false: the right has side is true,
-- but the left-hand side is false (as the norm is infinite).
theorem eLpNorm_const_lt_top_iff_eNorm {c : ε} (hc' : ‖c‖ₑ ≠ ∞)
    {p : ℝ≥0∞} (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) :
    eLpNorm (fun _ : α ↦ c) p μ < ∞ ↔ ‖c‖ₑ = 0 ∨ μ Set.univ < ∞ := by
  have hp : 0 < p.toReal := ENNReal.toReal_pos hp_ne_zero hp_ne_top
  by_cases hμ : μ = 0
  · simp [hμ]
  by_cases hc : ‖c‖ₑ = 0
  · rw [eLpNorm_lt_top_iff_lintegral_rpow_eNorm_lt_top hp_ne_zero hp_ne_top
      aestronglyMeasurable_const]
    simp [hc, ENNReal.zero_rpow_of_pos hp]
  rw [eLpNorm_const' c hp_ne_zero hp_ne_top]
  obtain hμ_top | hμ_ne_top := eq_or_ne (μ .univ) ∞
  · simp [hc, hμ_top, hp]
  rw [ENNReal.mul_lt_top_iff]
  simp [hμ, hc, hμ_ne_top, hμ_ne_top.lt_top, hc'.lt_top]
  finiteness

@[deprecated (since := "2026-11-06")]
alias eLpNorm_const_lt_top_iff_enorm := eLpNorm_const_lt_top_iff_eNorm

theorem eLpNorm_const_lt_top_iff {p : ℝ≥0∞} {c : F} (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) :
    eLpNorm (fun _ : α => c) p μ < ∞ ↔ c = 0 ∨ μ Set.univ < ∞ := by
  rw [eLpNorm_const_lt_top_iff_eNorm eNorm_ne_top hp_ne_zero hp_ne_top]
  simp

theorem memLp_const_eNorm {c : ε} (hc : ‖c‖ₑ ≠ ⊤) [IsFiniteMeasure μ] :
    MemLp (fun _ : α ↦ c) p μ := by
  rw [memLp_iff]
  by_cases h0 : p = 0
  · simp [h0, aestronglyMeasurable_const]
  by_cases hμ : μ = 0
  · simp [hμ]
  rw [eLpNorm_const c h0 hμ]
  finiteness

@[deprecated (since := "2026-11-06")] alias memLp_const_enorm := memLp_const_eNorm

theorem memLp_const (c : E) [IsFiniteMeasure μ] : MemLp (fun _ : α => c) p μ :=
  memLp_const_eNorm eNorm_ne_top

theorem memLp_top_const_eNorm {c : ε} (hc : ‖c‖ₑ ≠ ⊤) :
    MemLp (fun _ : α ↦ c) ∞ μ := by
  by_cases h : μ = 0 <;> simp [memLp_iff, eLpNorm_const, h, hc.lt_top]

@[deprecated (since := "2026-11-06")] alias memLp_top_const_enorm := memLp_top_const_eNorm

theorem memLp_top_const (c : E) : MemLp (fun _ : α => c) ∞ μ :=
  memLp_top_const_eNorm eNorm_ne_top

theorem memLp_const_iff_eNorm
    {p : ℝ≥0∞} {c : ε} (hc : ‖c‖ₑ ≠ ⊤) (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) :
    MemLp (fun _ : α ↦ c) p μ ↔ ‖c‖ₑ = 0 ∨ μ Set.univ < ∞ := by
  simp_all [MemLp, eLpNorm_const_lt_top_iff_eNorm hc hp_ne_zero hp_ne_top]

@[deprecated (since := "2026-11-06")] alias memLp_const_iff_enorm := memLp_const_iff_eNorm

theorem memLp_const_iff {p : ℝ≥0∞} {c : E} (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) :
    MemLp (fun _ : α => c) p μ ↔ c = 0 ∨ μ Set.univ < ∞ := by
  rw [memLp_const_iff_eNorm eNorm_ne_top hp_ne_zero hp_ne_top]; simp

end Const

variable {f : α → F}

lemma eLpNorm'_mono_eNorm_ae {f : α → ε'} {g : α → ε''}
    (hq : 0 ≤ q) (h : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖g x‖ₑ) :
    eLpNorm' f q μ ≤ eLpNorm' g q μ := by
  simp only [eLpNorm'_eq_lintegral_eNorm]
  gcongr ?_ ^ (1 / q)
  refine lintegral_mono_ae (h.mono fun x hx => ?_)
  gcongr

@[deprecated (since := "2026-11-06")] alias eLpNorm'_mono_enorm_ae := eLpNorm'_mono_eNorm_ae

lemma eLpNorm'_mono_nnNorm_ae {f : α → F} {g : α → G} (hq : 0 ≤ q) (h : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ ‖g x‖₊) :
    eLpNorm' f q μ ≤ eLpNorm' g q μ :=
  eLpNorm'_mono_eNorm_ae hq <| h.mono fun _ hx => ENNReal.coe_le_coe.mpr hx

@[deprecated (since := "2026-10-31")] alias eLpNorm'_mono_nnnorm_ae := eLpNorm'_mono_nnNorm_ae

theorem eLpNorm'_mono_ae {f : α → F} {g : α → G} (hq : 0 ≤ q) (h : ∀ᵐ x ∂μ, ‖f x‖ ≤ ‖g x‖) :
    eLpNorm' f q μ ≤ eLpNorm' g q μ :=
  eLpNorm'_mono_eNorm_ae hq (by simpa only [eNorm_le_iff_norm_le] using h)

theorem eLpNorm'_congr_eNorm_ae {f : α → ε'} {g : α → ε''} (hfg : ∀ᵐ x ∂μ, ‖f x‖ₑ = ‖g x‖ₑ) :
    eLpNorm' f q μ = eLpNorm' g q μ := by
  have : (‖f ·‖ₑ ^ q) =ᵐ[μ] (‖g ·‖ₑ ^ q) := hfg.mono fun x hx ↦ by simp [hx]
  simp only [eLpNorm'_eq_lintegral_eNorm, lintegral_congr_ae this]

@[deprecated (since := "2026-11-06")] alias eLpNorm'_congr_enorm_ae := eLpNorm'_congr_eNorm_ae

theorem eLpNorm'_congr_nnNorm_ae {f : α → F} {g : α → G} (hfg : ∀ᵐ x ∂μ, ‖f x‖₊ = ‖g x‖₊) :
    eLpNorm' f q μ = eLpNorm' g q μ := by
  have : (‖f ·‖ₑ ^ q) =ᵐ[μ] (‖g ·‖ₑ ^ q) := hfg.mono fun x hx ↦ by simp [eNorm, hx]
  simp only [eLpNorm'_eq_lintegral_eNorm, lintegral_congr_ae this]

@[deprecated (since := "2026-10-31")] alias eLpNorm'_congr_nnnorm_ae := eLpNorm'_congr_nnNorm_ae

theorem eLpNorm'_congr_norm_ae {f : α → F} {g : α → G} (hfg : ∀ᵐ x ∂μ, ‖f x‖ = ‖g x‖) :
    eLpNorm' f q μ = eLpNorm' g q μ :=
  eLpNorm'_congr_nnNorm_ae <| hfg.mono fun _x hx => NNReal.eq hx

theorem eLpNorm'_congr_ae {f g : α → ε'} (hfg : f =ᵐ[μ] g) : eLpNorm' f q μ = eLpNorm' g q μ :=
  eLpNorm'_congr_eNorm_ae (hfg.fun_comp _)

theorem eLpNormEssSup_congr_ae {f g : α → ε'} (hfg : f =ᵐ[μ] g) :
    eLpNormEssSup f μ = eLpNormEssSup g μ :=
  essSup_congr_ae (hfg.fun_comp eNorm)

theorem eLpNormEssSup_mono_eNorm_ae {f : α → ε'} {g : α → ε''} (hfg : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖g x‖ₑ) :
    eLpNormEssSup f μ ≤ eLpNormEssSup g μ :=
  essSup_mono_ae hfg

@[deprecated (since := "2026-11-06")]
alias eLpNormEssSup_mono_enorm_ae := eLpNormEssSup_mono_eNorm_ae

theorem eLpNormEssSup_mono_nnNorm_ae {f : α → F} {g : α → G} (hfg : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ ‖g x‖₊) :
    eLpNormEssSup f μ ≤ eLpNormEssSup g μ :=
  essSup_mono_ae <| hfg.mono fun _x hx => ENNReal.coe_le_coe.mpr hx

@[deprecated (since := "2026-10-31")]
alias eLpNormEssSup_mono_nnnorm_ae := eLpNormEssSup_mono_nnNorm_ae

theorem eLpNorm_mono_eNorm_ae [TopologicalSpace ε']
    {f : α → ε} {g : α → ε'} (hf : AEStronglyMeasurable f μ)
    (h : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖g x‖ₑ) :
    eLpNorm f p μ ≤ eLpNorm g p μ := by
  rw [eLpNorm, ite_eq_left hf]
  by_cases hg : AEStronglyMeasurable g μ
  · rw [eLpNorm, ite_eq_left hg]
    split_ifs
    · exact le_rfl
    · exact eLpNormEssSup_mono_eNorm_ae h
    · exact eLpNorm'_mono_eNorm_ae ENNReal.toReal_nonneg h
  · rw [eLpNorm, ite_eq_right hg]
    exact le_top

@[deprecated (since := "2026-11-06")] alias eLpNorm_mono_enorm_ae := eLpNorm_mono_eNorm_ae

theorem eLpNorm_mono_nnNorm_ae {f : α → F} {g : α → G} (hf : AEStronglyMeasurable f μ)
    (h : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ ‖g x‖₊) :
    eLpNorm f p μ ≤ eLpNorm g p μ :=
  eLpNorm_mono_eNorm_ae hf <| h.mono fun _ hx => ENNReal.coe_le_coe.mpr hx

@[deprecated (since := "2026-10-31")] alias eLpNorm_mono_nnnorm_ae := eLpNorm_mono_nnNorm_ae

theorem eLpNorm_mono_ae {f : α → F} {g : α → G} (hf : AEStronglyMeasurable f μ)
    (h : ∀ᵐ x ∂μ, ‖f x‖ ≤ ‖g x‖) :
    eLpNorm f p μ ≤ eLpNorm g p μ :=
  eLpNorm_mono_eNorm_ae hf (by simpa only [eNorm_le_iff_norm_le] using h)

@[deprecated (since := "2026-06-24")] alias eLpNorm_mono_ae' := eLpNorm_mono_eNorm_ae

theorem eLpNorm_mono_ae_real {f : α → F} {g : α → ℝ} (hf : AEStronglyMeasurable f μ)
    (h : ∀ᵐ x ∂μ, ‖f x‖ ≤ g x) :
    eLpNorm f p μ ≤ eLpNorm g p μ :=
  eLpNorm_mono_ae hf <| h.mono fun _x hx =>
    hx.trans ((le_abs_self _).trans (Real.norm_eq_abs _).symm.le)

theorem eLpNorm_mono_eNorm [TopologicalSpace ε'] {f : α → ε} {g : α → ε'}
    (hf : AEStronglyMeasurable f μ) (h : ∀ x, ‖f x‖ₑ ≤ ‖g x‖ₑ) :
    eLpNorm f p μ ≤ eLpNorm g p μ :=
  eLpNorm_mono_eNorm_ae hf (Eventually.of_forall h)

@[deprecated (since := "2026-11-06")] alias eLpNorm_mono_enorm := eLpNorm_mono_eNorm

theorem eLpNorm_mono_nnNorm {f : α → F} {g : α → G} (hf : AEStronglyMeasurable f μ)
    (h : ∀ x, ‖f x‖₊ ≤ ‖g x‖₊) :
    eLpNorm f p μ ≤ eLpNorm g p μ :=
  eLpNorm_mono_nnNorm_ae hf (Eventually.of_forall h)

@[deprecated (since := "2026-10-31")] alias eLpNorm_mono_nnnorm := eLpNorm_mono_nnNorm

theorem eLpNorm_mono {f : α → F} {g : α → G} (hf : AEStronglyMeasurable f μ)
    (h : ∀ x, ‖f x‖ ≤ ‖g x‖) :
    eLpNorm f p μ ≤ eLpNorm g p μ :=
  eLpNorm_mono_ae hf (Eventually.of_forall h)

theorem eLpNorm_mono_real {f : α → F} {g : α → ℝ} (hf : AEStronglyMeasurable f μ)
    (h : ∀ x, ‖f x‖ ≤ g x) :
    eLpNorm f p μ ≤ eLpNorm g p μ :=
  eLpNorm_mono_ae_real hf (Eventually.of_forall h)

theorem eLpNormEssSup_le_of_ae_eNorm_bound {f : α → ε'} {C : ℝ≥0∞} (hfC : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ C) :
    eLpNormEssSup f μ ≤ C :=
  essSup_le_of_ae_le C hfC

@[deprecated (since := "2026-11-06")]
alias eLpNormEssSup_le_of_ae_enorm_bound := eLpNormEssSup_le_of_ae_eNorm_bound

theorem eLpNormEssSup_le_of_ae_nnNorm_bound {f : α → F} {C : ℝ≥0} (hfC : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ C) :
    eLpNormEssSup f μ ≤ C :=
  essSup_le_of_ae_le (C : ℝ≥0∞) <| hfC.mono fun _x hx => ENNReal.coe_le_coe.mpr hx

@[deprecated (since := "2026-10-31")]
alias eLpNormEssSup_le_of_ae_nnnorm_bound := eLpNormEssSup_le_of_ae_nnNorm_bound

theorem eLpNormEssSup_le_of_ae_bound {f : α → F} {C : ℝ} (hfC : ∀ᵐ x ∂μ, ‖f x‖ ≤ C) :
    eLpNormEssSup f μ ≤ ENNReal.ofReal C :=
  eLpNormEssSup_le_of_ae_nnNorm_bound <| hfC.mono fun _x hx => hx.trans C.le_coe_toNNReal

theorem eLpNormEssSup_lt_top_of_ae_eNorm_bound {f : α → ε'} {C : ℝ≥0} (hfC : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ C) :
    eLpNormEssSup f μ < ∞ :=
  (eLpNormEssSup_le_of_ae_eNorm_bound hfC).trans_lt ENNReal.coe_lt_top

@[deprecated (since := "2026-11-06")]
alias eLpNormEssSup_lt_top_of_ae_enorm_bound := eLpNormEssSup_lt_top_of_ae_eNorm_bound

theorem eLpNormEssSup_lt_top_of_ae_nnNorm_bound {f : α → F} {C : ℝ≥0} (hfC : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ C) :
    eLpNormEssSup f μ < ∞ :=
  (eLpNormEssSup_le_of_ae_nnNorm_bound hfC).trans_lt ENNReal.coe_lt_top

@[deprecated (since := "2026-10-31")]
alias eLpNormEssSup_lt_top_of_ae_nnnorm_bound := eLpNormEssSup_lt_top_of_ae_nnNorm_bound

theorem eLpNormEssSup_lt_top_of_ae_bound {f : α → F} {C : ℝ} (hfC : ∀ᵐ x ∂μ, ‖f x‖ ≤ C) :
    eLpNormEssSup f μ < ∞ :=
  (eLpNormEssSup_le_of_ae_bound hfC).trans_lt ENNReal.ofReal_lt_top

theorem eLpNorm_le_of_ae_eNorm_bound
    {f : α → ε} {C : ℝ≥0∞} (hf : AEStronglyMeasurable f μ) (hfC : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ C) :
    eLpNorm f p μ ≤ C • μ Set.univ ^ p.toReal⁻¹ := by
  rcases eq_zero_or_neZero μ with rfl | hμ
  · simp
  by_cases hp : p = 0
  · simp [hp, hf]
  have : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖C‖ₑ := hfC.mono fun x hx ↦ hx.trans (le_refl C)
  refine (eLpNorm_mono_eNorm_ae hf this).trans_eq ?_
  rw [eLpNorm_const _ hp (NeZero.ne μ), one_div, eNorm_eq_self, smul_eq_mul]

@[deprecated (since := "2026-11-06")]
alias eLpNorm_le_of_ae_enorm_bound := eLpNorm_le_of_ae_eNorm_bound

theorem eLpNorm_le_of_ae_nnNorm_bound {f : α → F} {C : ℝ≥0}
    (hf : AEStronglyMeasurable f μ) (hfC : ∀ᵐ x ∂μ, ‖f x‖₊ ≤ C) :
    eLpNorm f p μ ≤ C • μ Set.univ ^ p.toReal⁻¹ := by
  simpa [C.eNorm_eq, ENNReal.smul_def, smul_eq_mul] using
    (eLpNorm_le_of_ae_eNorm_bound (f := f) (C := (C : ℝ≥0∞)) hf
      (hfC.mono fun _ hx => by simpa using hx))

@[deprecated (since := "2026-10-31")]
alias eLpNorm_le_of_ae_nnnorm_bound := eLpNorm_le_of_ae_nnNorm_bound

theorem eLpNorm_le_of_ae_bound {f : α → F} {C : ℝ} (hf : AEStronglyMeasurable f μ)
    (hfC : ∀ᵐ x ∂μ, ‖f x‖ ≤ C) :
    eLpNorm f p μ ≤ μ Set.univ ^ p.toReal⁻¹ * ENNReal.ofReal C := by
  rw [← mul_comm]
  exact eLpNorm_le_of_ae_nnNorm_bound hf (hfC.mono fun x hx => hx.trans C.le_coe_toNNReal)

theorem eLpNorm_congr_eNorm_ae [TopologicalSpace ε']
    {f : α → ε} {g : α → ε'} (hf : AEStronglyMeasurable f μ)
    (hg : AEStronglyMeasurable g μ) (hfg : ∀ᵐ x ∂μ, ‖f x‖ₑ = ‖g x‖ₑ) :
    eLpNorm f p μ = eLpNorm g p μ :=
  le_antisymm (eLpNorm_mono_eNorm_ae hf <| EventuallyEq.le hfg)
    (eLpNorm_mono_eNorm_ae hg (EventuallyEq.symm hfg).le)

@[deprecated (since := "2026-11-06")] alias eLpNorm_congr_enorm_ae := eLpNorm_congr_eNorm_ae

/-- See also `eLpNorm_zero_of_ae_eNorm_zero` dropping the measurability assumption
but assuming that the space is an enormed monoid. -/

theorem eLpNorm_zero_of_ae_eNorm_zero'
    {f : α → ε} (hf : AEStronglyMeasurable f μ) (hfC : ∀ᵐ x ∂μ, ‖f x‖ₑ = 0) :
    eLpNorm f p μ = 0 := by
  have := eLpNorm_congr_eNorm_ae hf (g := fun _ ↦ (0 : ℝ)) (p := p) aestronglyMeasurable_const
  simp only [eNorm_zero, eLpNorm_fun_zero] at this
  exact this hfC

@[deprecated (since := "2026-11-06")]
alias eLpNorm_zero_of_ae_enorm_zero' := eLpNorm_zero_of_ae_eNorm_zero'

theorem eLpNorm_congr_nnNorm_ae {f : α → F} {g : α → G} (hf : AEStronglyMeasurable f μ)
    (hg : AEStronglyMeasurable g μ) (hfg : ∀ᵐ x ∂μ, ‖f x‖₊ = ‖g x‖₊) :
    eLpNorm f p μ = eLpNorm g p μ :=
  le_antisymm (eLpNorm_mono_nnNorm_ae hf <| EventuallyEq.le hfg)
    (eLpNorm_mono_nnNorm_ae hg (EventuallyEq.symm hfg).le)

@[deprecated (since := "2026-10-31")] alias eLpNorm_congr_nnnorm_ae := eLpNorm_congr_nnNorm_ae

theorem eLpNorm_congr_norm_ae {f : α → F} {g : α → G}
    (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (hfg : ∀ᵐ x ∂μ, ‖f x‖ = ‖g x‖) :
    eLpNorm f p μ = eLpNorm g p μ :=
  eLpNorm_congr_nnNorm_ae hf hg <| hfg.mono fun _x hx => NNReal.eq hx

open scoped symmDiff in
theorem eLpNorm_indicator_sub_indicator {s t : Set α} (f : α → E)
    (hs : NullMeasurableSet s μ) (ht : NullMeasurableSet t μ) :
    eLpNorm (s.indicator f - t.indicator f) p μ = eLpNorm ((s ∆ t).indicator f) p μ := by
  by_cases hf : AEStronglyMeasurable (s.indicator f - t.indicator f) μ
  · have : AEStronglyMeasurable ((s ∆ t).indicator f) μ := by
      convert (hf.indicator₀ (hs.diff ht)).sub (hf.indicator₀ (ht.diff hs))
      ext x
      simp only [Set.indicator, Pi.sub_apply]
      grind
    exact eLpNorm_congr_norm_ae hf this <| ae_of_all _ fun x ↦ by
      simp [Set.apply_indicator_symmDiff norm_neg]
  · have : ¬ (AEStronglyMeasurable ((s ∆ t).indicator f) μ) := by
      contrapose hf
      convert (hf.indicator₀ (hs.diff ht)).sub (hf.indicator₀ (ht.diff hs)) using 1
      ext x
      simp only [Set.indicator, Pi.sub_apply]
      grind
    simp [eLpNorm_of_not_aestronglyMeasurable, hf, this]

@[simp]
theorem eLpNorm'_norm {f : α → F} : eLpNorm' (fun a => ‖f a‖) q μ = eLpNorm' f q μ := by
  simp [eLpNorm'_eq_lintegral_eNorm]

@[simp]
theorem eLpNorm'_eNorm {f : α → ε'} : eLpNorm' (fun a => ‖f a‖ₑ) q μ = eLpNorm' f q μ := by
  simp [eLpNorm'_eq_lintegral_eNorm]

@[deprecated (since := "2026-11-06")] alias eLpNorm'_enorm := eLpNorm'_eNorm

@[simp]
theorem eLpNorm_norm (f : α → F) (hf : AEStronglyMeasurable f μ) :
    eLpNorm (fun x => ‖f x‖) p μ = eLpNorm f p μ :=
  eLpNorm_congr_norm_ae hf.norm hf <| Eventually.of_forall fun _ => norm_norm _

@[simp]
theorem eLpNorm_eNorm {ε : Type*} [TopologicalSpace ε] [ContinuousENorm ε]
    (f : α → ε) (hf : AEStronglyMeasurable f μ) :
    eLpNorm (fun x ↦ ‖f x‖ₑ) p μ = eLpNorm f p μ :=
  eLpNorm_congr_eNorm_ae hf.eNorm.aestronglyMeasurable hf <| .of_forall fun _ => eNorm_eNorm _

@[deprecated (since := "2026-11-06")] alias eLpNorm_enorm := eLpNorm_eNorm

theorem eLpNorm'_eNorm_rpow (f : α → ε') (p q : ℝ) (hq_pos : 0 < q) :
    eLpNorm' (‖f ·‖ₑ ^ q) p μ = eLpNorm' f (p * q) μ ^ q := by
  simp_rw [eLpNorm', ← ENNReal.rpow_mul, ← one_div_mul_one_div, one_div,
    mul_assoc, inv_mul_cancel₀ hq_pos.ne.symm, mul_one, eNorm_eq_self, ← ENNReal.rpow_mul, mul_comm]

@[deprecated (since := "2026-11-06")] alias eLpNorm'_enorm_rpow := eLpNorm'_eNorm_rpow

/-- `f : α → ℝ` and `ENNReal.ofReal ∘ f : α → ℝ≥0∞` have the same `eLpNorm`.
Usually, you should not use this lemma (but use enorms everywhere.) -/

lemma eLpNorm_ofReal (f : α → ℝ) (hf : ∀ᵐ x ∂μ, 0 ≤ f x) :
    eLpNorm (ENNReal.ofReal ∘ f) p μ = eLpNorm f p μ := by
  by_cases hfm : AEStronglyMeasurable f μ
  · exact eLpNorm_congr_eNorm_ae (ENNReal.continuous_ofReal.comp_aestronglyMeasurable hfm) hfm <|
      hf.mono fun _x hx ↦ Real.eNorm_ofReal_of_nonneg hx
  rw [eLpNorm_of_not_aestronglyMeasurable hfm, eLpNorm_of_not_aestronglyMeasurable]
  contrapose hfm
  apply hfm.aemeasurable.ennreal_toReal.aestronglyMeasurable.congr
  filter_upwards [hf] with x hx
  simpa

theorem eLpNorm'_norm_rpow (f : α → F) (p q : ℝ) (hq_pos : 0 < q) :
    eLpNorm' (fun x => ‖f x‖ ^ q) p μ = eLpNorm' f (p * q) μ ^ q := by
  simp_rw [eLpNorm', ← ENNReal.rpow_mul, ← one_div_mul_one_div, one_div,
    mul_assoc, inv_mul_cancel₀ hq_pos.ne.symm, mul_one, ← ofReal_norm,
    Real.norm_eq_abs, abs_eq_self.mpr (Real.rpow_nonneg (norm_nonneg _) _), mul_comm p,
    ← ENNReal.ofReal_rpow_of_nonneg (norm_nonneg _) hq_pos.le, ENNReal.rpow_mul]

theorem eLpNorm_eNorm_rpow {ε : Type*} [TopologicalSpace ε] [ContinuousENorm ε] (f : α → ε)
    (hf : AEStronglyMeasurable f μ) (hq_pos : 0 < q) :
    eLpNorm (‖f ·‖ₑ ^ q) p μ = eLpNorm f (p * ENNReal.ofReal q) μ ^ q := by
  have hfrpow : AEStronglyMeasurable (‖f ·‖ₑ ^ q) μ := by fun_prop
  by_cases h0 : p = 0
  · simp [h0, hf, hfrpow, ENNReal.zero_rpow_of_pos hq_pos]
  by_cases hp_top : p = ∞
  · simp only [hp_top, eLpNorm_exponent_top hfrpow, ENNReal.top_mul', hq_pos.not_ge,
      ENNReal.ofReal_eq_zero, ite_false, eLpNorm_exponent_top hf,
      eLpNormEssSup_eq_essSup_eNorm]
    have h_rpow : essSup (‖‖f ·‖ₑ ^ q‖ₑ) μ = essSup (‖f ·‖ₑ ^ q) μ := by congr
    rw [h_rpow]
    have h_rpow_mono := ENNReal.strictMono_rpow_of_pos hq_pos
    have h_rpow_surj := (ENNReal.rpow_left_bijective hq_pos.ne.symm).2
    let iso := h_rpow_mono.orderIsoOfSurjective _ h_rpow_surj
    exact (iso.essSup_apply (fun x => ‖f x‖ₑ) μ).symm
  rw [eLpNorm_eq_eLpNorm' h0 hp_top hfrpow, eLpNorm_eq_eLpNorm' _ (by finiteness) hf]
  swap
  · refine mul_ne_zero h0 ?_
    rwa [Ne, ENNReal.ofReal_eq_zero, not_le]
  rw [ENNReal.toReal_mul, ENNReal.toReal_ofReal hq_pos.le]
  exact eLpNorm'_eNorm_rpow f p.toReal q hq_pos

@[deprecated (since := "2026-11-06")] alias eLpNorm_enorm_rpow := eLpNorm_eNorm_rpow

theorem eLpNorm_norm_rpow (f : α → F) (hf : AEStronglyMeasurable f μ) (hq_pos : 0 < q) :
    eLpNorm (fun x => ‖f x‖ ^ q) p μ = eLpNorm f (p * ENNReal.ofReal q) μ ^ q := by
  rw [← eLpNorm_eNorm_rpow f hf hq_pos]
  symm
  convert! eLpNorm_ofReal (fun x ↦ ‖f x‖ ^ q) (by filter_upwards with x using by positivity)
  rw [Function.comp_apply, ← ofReal_norm]
  exact ENNReal.ofReal_rpow_of_nonneg (by positivity) (by positivity)

theorem eLpNorm_congr_ae {f g : α → ε} (hfg : f =ᵐ[μ] g) :
    eLpNorm f p μ = eLpNorm g p μ := by
  by_cases hf : AEStronglyMeasurable f μ
  · exact eLpNorm_congr_eNorm_ae hf (hf.congr hfg) <| hfg.mono fun _x hx => hx ▸ rfl
  rw [eLpNorm_of_not_aestronglyMeasurable hf, eLpNorm_of_not_aestronglyMeasurable]
  contrapose hf
  exact hf.congr (EventuallyEq.symm hfg)

theorem memLp_congr_ae {f g : α → ε} (hfg : f =ᵐ[μ] g) :
    MemLp f p μ ↔ MemLp g p μ := by
  refine ⟨fun hf ↦ ?_, fun hg ↦ ?_⟩
  · rwa [memLp_iff, ← eLpNorm_congr_ae hfg]
  · rwa [memLp_iff, eLpNorm_congr_ae hfg]

theorem MemLp.ae_eq {f g : α → ε} (hfg : f =ᵐ[μ] g) (hf_Lp : MemLp f p μ) :
    MemLp g p μ :=
  (memLp_congr_ae hfg).1 hf_Lp

theorem MemLp.of_le_eNorm [TopologicalSpace ε'] {f : α → ε} {g : α → ε'} (hg : MemLp g p μ)
    (hf : AEStronglyMeasurable f μ) (hfg : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ ‖g x‖ₑ) : MemLp f p μ :=
  (eLpNorm_mono_eNorm_ae hf hfg).trans_lt hg

@[deprecated (since := "2026-11-06")] alias MemLp.of_le_enorm := MemLp.of_le_eNorm

theorem MemLp.of_le {f : α → E} {g : α → F} (hg : MemLp g p μ) (hf : AEStronglyMeasurable f μ)
    (hfg : ∀ᵐ x ∂μ, ‖f x‖ ≤ ‖g x‖) : MemLp f p μ :=
  (eLpNorm_mono_ae hf hfg).trans_lt hg

alias MemLp.mono := MemLp.of_le

theorem MemLp.mono'_eNorm {f : α → ε} {g : α → ℝ≥0∞}
    (hg : MemLp g p μ) (hf : AEStronglyMeasurable f μ) (h : ∀ᵐ a ∂μ, ‖f a‖ₑ ≤ g a) : MemLp f p μ :=
  MemLp.of_le_eNorm hg hf <| h.mono fun _x hx ↦ le_trans hx le_rfl

@[deprecated (since := "2026-11-06")] alias MemLp.mono'_enorm := MemLp.mono'_eNorm

theorem MemLp.mono' {f : α → E} {g : α → ℝ} (hg : MemLp g p μ) (hf : AEStronglyMeasurable f μ)
    (h : ∀ᵐ a ∂μ, ‖f a‖ ≤ g a) : MemLp f p μ :=
  hg.of_le hf <| h.mono fun _x hx => le_trans hx (le_abs_self _)

theorem MemLp.congr_eNorm [TopologicalSpace ε'] {f : α → ε} {g : α → ε'} (hf : MemLp f p μ)
    (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ a ∂μ, ‖f a‖ₑ = ‖g a‖ₑ) : MemLp g p μ :=
  hf.of_le_eNorm hg <| EventuallyEq.le <| EventuallyEq.symm h

@[deprecated (since := "2026-11-06")] alias MemLp.congr_enorm := MemLp.congr_eNorm

theorem MemLp.congr_norm {f : α → E} {g : α → F} (hf : MemLp f p μ) (hg : AEStronglyMeasurable g μ)
    (h : ∀ᵐ a ∂μ, ‖f a‖ = ‖g a‖) : MemLp g p μ :=
  hf.mono hg <| EventuallyEq.le <| EventuallyEq.symm h

theorem memLp_congr_eNorm [TopologicalSpace ε'] {f : α → ε} {g : α → ε'}
    (hf : AEStronglyMeasurable f μ) (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ a ∂μ, ‖f a‖ₑ = ‖g a‖ₑ) :
    MemLp f p μ ↔ MemLp g p μ :=
  ⟨fun h2f => h2f.congr_eNorm hg h, fun h2g => h2g.congr_eNorm hf <| EventuallyEq.symm h⟩

@[deprecated (since := "2026-11-06")] alias memLp_congr_enorm := memLp_congr_eNorm

theorem memLp_congr_norm {f : α → E} {g : α → F} (hf : AEStronglyMeasurable f μ)
    (hg : AEStronglyMeasurable g μ) (h : ∀ᵐ a ∂μ, ‖f a‖ = ‖g a‖) : MemLp f p μ ↔ MemLp g p μ :=
  ⟨fun h2f => h2f.congr_norm hg h, fun h2g => h2g.congr_norm hf <| EventuallyEq.symm h⟩

theorem memLp_top_of_bound_eNorm {f : α → ε} (hf : AEStronglyMeasurable f μ) (C : ℝ≥0)
    (hfC : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ C) : MemLp f ∞ μ := by
  rw [memLp_iff, eLpNorm_exponent_top hf]
  exact eLpNormEssSup_lt_top_of_ae_eNorm_bound hfC

@[deprecated (since := "2026-11-06")] alias memLp_top_of_bound_enorm := memLp_top_of_bound_eNorm

theorem memLp_top_of_bound {f : α → E} (hf : AEStronglyMeasurable f μ) (C : ℝ)
    (hfC : ∀ᵐ x ∂μ, ‖f x‖ ≤ C) : MemLp f ∞ μ := by
  rw [memLp_iff, eLpNorm_exponent_top hf]
  exact eLpNormEssSup_lt_top_of_ae_bound hfC

theorem MemLp.of_eNorm_bound [IsFiniteMeasure μ] {f : α → ε} (hf : AEStronglyMeasurable f μ)
    {C : ℝ≥0∞} (hC : C ≠ ∞) (hfC : ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ C) : MemLp f p μ := by
  apply (memLp_const_eNorm hC).of_le_eNorm (ε' := ℝ≥0∞) hf <| hfC.mono fun _x hx ↦ ?_
  rw [eNorm_eq_self]; exact hx

@[deprecated (since := "2026-11-06")] alias MemLp.of_enorm_bound := MemLp.of_eNorm_bound

theorem MemLp.of_bound [IsFiniteMeasure μ] {f : α → E} (hf : AEStronglyMeasurable f μ) (C : ℝ)
    (hfC : ∀ᵐ x ∂μ, ‖f x‖ ≤ C) : MemLp f p μ :=
  (memLp_const C).of_le hf (hfC.mono fun _x hx => le_trans hx (le_abs_self _))

theorem memLp_of_bounded [IsFiniteMeasure μ]
    {a b : ℝ} {f : α → ℝ} (h : ∀ᵐ x ∂μ, f x ∈ Set.Icc a b)
    (hX : AEStronglyMeasurable f μ) (p : ENNReal) : MemLp f p μ :=
  have ha : ∀ᵐ x ∂μ, a ≤ f x := h.mono fun ω h => h.1
  have hb : ∀ᵐ x ∂μ, f x ≤ b := h.mono fun ω h => h.2
  (memLp_const (max |a| |b|)).mono' hX (by filter_upwards [ha, hb] with x using abs_le_max_abs_abs)

@[gcongr, mono]
theorem eLpNorm'_mono_measure (f : α → ε') (hμν : ν ≤ μ) (hq : 0 ≤ q) :
    eLpNorm' f q ν ≤ eLpNorm' f q μ := by
  simp_rw [eLpNorm']
  gcongr

@[gcongr, mono]
theorem eLpNormEssSup_mono_measure (f : α → ε') (hμν : ν ≪ μ) :
    eLpNormEssSup f ν ≤ eLpNormEssSup f μ := by
  simp_rw [eLpNormEssSup]
  exact essSup_mono_measure hμν

@[gcongr, mono]
theorem eLpNorm_mono_measure (f : α → ε) (hμν : ν ≤ μ) :
    eLpNorm f p ν ≤ eLpNorm f p μ := by
  by_cases! hf : ¬ AEStronglyMeasurable f μ
  · rw [eLpNorm_of_not_aestronglyMeasurable hf]
    exact le_top
  have hfν : AEStronglyMeasurable f ν := AEStronglyMeasurable.mono_measure hf hμν
  by_cases hp0 : p = 0
  · simp [hp0, hf, hfν]
  by_cases hp_top : p = ∞
  · simp [hp_top, hf, hfν,
      eLpNormEssSup_mono_measure f (Measure.absolutelyContinuous_of_le hμν)]
  rw [eLpNorm_eq_eLpNorm' hp0 hp_top hfν, eLpNorm_eq_eLpNorm' hp0 hp_top hf]
  exact eLpNorm'_mono_measure f hμν ENNReal.toReal_nonneg

theorem MemLp.mono_measure {f : α → ε} (hμν : ν ≤ μ) (hf : MemLp f p μ) :
    MemLp f p ν :=
  (eLpNorm_mono_measure f hμν).trans_lt hf

section ENormedAddMonoid

variable {ε : Type*} [TopologicalSpace ε] [ENormedAddMonoid ε]

theorem eLpNorm_zero_of_ae_eNorm_zero {f : α → ε} (hfC : ∀ᵐ x ∂μ, ‖f x‖ₑ = 0) :
    eLpNorm f p μ = 0 := by
  have : ∀ᵐ x ∂μ, f x = 0 := by
    filter_upwards [hfC] with x hx using (ENormedAddMonoid.eNorm_eq_zero (f x)).mp hx
  rw [eLpNorm_congr_ae this, eLpNorm_fun_zero]

@[deprecated (since := "2026-11-06")]
alias eLpNorm_zero_of_ae_enorm_zero := eLpNorm_zero_of_ae_eNorm_zero

/-- For a function `f` with support in `s`, the Lᵖ norms of `f` with respect to `μ` and
`μ.restrict s` are the same. -/

-- one could also give a version where `s` is null-measurable, without assuming that `f`
-- is AEStronglyMeasurable
theorem eLpNorm_restrict_eq_of_support_subset {s : Set α} {f : α → ε}
    (hf : AEStronglyMeasurable f μ) (hsf : f.support ⊆ s) :
    eLpNorm f p (μ.restrict s) = eLpNorm f p μ := by
  by_cases hp0 : p = 0
  · simp [hp0, hf, hf.restrict]
  by_cases hp_top : p = ∞
  · simp only [hp_top, eLpNorm_exponent_top hf.restrict, eLpNorm_exponent_top hf,
      eLpNormEssSup_eq_essSup_eNorm]
    exact ENNReal.essSup_restrict_eq_of_support_subset fun x hx ↦ hsf <| eNorm_ne_zero.1 hx
  · rw [eLpNorm_eq_eLpNorm' hp0 hp_top hf.restrict, eLpNorm_eq_eLpNorm' hp0 hp_top hf]
    simp_rw [eLpNorm'_eq_lintegral_eNorm]
    congr 1
    apply setLIntegral_eq_of_support_subset
    have : ¬(p.toReal ≤ 0) := by simpa only [not_le] using ENNReal.toReal_pos hp0 hp_top
    simpa [this] using hsf

end ENormedAddMonoid

theorem MemLp.restrict (s : Set α) {f : α → ε} (hf : MemLp f p μ) :
    MemLp f p (μ.restrict s) :=
  hf.mono_measure Measure.restrict_le_self

theorem eLpNorm'_smul_measure {p : ℝ} (hp : 0 ≤ p) {f : α → ε'} (c : ℝ≥0∞) :
    eLpNorm' f p (c • μ) = c ^ (1 / p) * eLpNorm' f p μ := by
  simp [eLpNorm', ENNReal.mul_rpow_of_nonneg, hp]

section SMul
variable {R : Type*} [Semiring R] [IsDomain R] [Module R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
  [Module.IsTorsionFree R ℝ≥0∞] {c : R}

@[simp] lemma eLpNormEssSup_smul_measure (hc : c ≠ 0) (f : α → ε') :
    eLpNormEssSup f (c • μ) = eLpNormEssSup f μ := by
  simp_rw [eLpNormEssSup]
  exact essSup_smul_measure hc _

end SMul

@[simp] lemma eLpNormEssSup_ennreal_smul_measure {c : ℝ≥0∞} (hc : c ≠ 0) (f : α → ε') :
    eLpNormEssSup f (c • μ) = eLpNormEssSup f μ := by
  simp_rw [eLpNormEssSup]; exact essSup_ennreal_smul_measure hc _

theorem eLpNorm_smul_measure_of_ne_zero_of_ne_top {p : ℝ≥0∞} (hp_ne_zero : p ≠ 0)
    (hp_ne_top : p ≠ ∞) {f : α → ε} (c : ℝ≥0∞) :
    eLpNorm f p (c • μ) = c ^ (1 / p).toReal • eLpNorm f p μ := by
  by_cases hf : AEStronglyMeasurable f μ
  · rw [eLpNorm_eq_eLpNorm' hp_ne_zero hp_ne_top (hf.smul_measure c),
      eLpNorm_eq_eLpNorm' hp_ne_zero hp_ne_top hf,
      eLpNorm'_smul_measure ENNReal.toReal_nonneg]
    congr
    simp_rw [one_div]
    rw [ENNReal.toReal_inv]
  have hp' : 0 < p.toReal := ENNReal.toReal_pos hp_ne_zero hp_ne_top
  rcases eq_zero_or_pos c with rfl | hc
  · simp [hp']
  · have : ¬AEStronglyMeasurable f (c • μ) := by
      contrapose hf
      exact AEStronglyMeasurable.mono_ac (Measure.AbsolutelyContinuous.smul_right .rfl hc.ne') hf
    simp only [this, not_false_eq_true, eLpNorm_of_not_aestronglyMeasurable, one_div,
      ENNReal.toReal_inv, hf, smul_eq_mul]
    rw [ENNReal.mul_top]
    simp [hc.ne']

/-- See `eLpNorm_smul_measure_of_ne_zero'` for a version with scalar multiplication by `ℝ≥0`. -/
theorem eLpNorm_smul_measure_of_ne_zero {c : ℝ≥0∞} (hc : c ≠ 0) (f : α → ε) (p : ℝ≥0∞)
    (μ : Measure α) :
    eLpNorm f p (c • μ) = c ^ (1 / p).toReal • eLpNorm f p μ := by
  by_cases hf : AEStronglyMeasurable f μ
  · by_cases hp0 : p = 0
    · simp [hp0, hf.smul_measure c, hf]
    by_cases hp_top : p = ∞
    · simp [*, eLpNorm_exponent_top (hf.smul_measure c), eLpNorm_exponent_top hf]
    apply eLpNorm_smul_measure_of_ne_zero_of_ne_top hp0 hp_top
  · have : ¬AEStronglyMeasurable f (c • μ) := by
      contrapose hf
      exact AEStronglyMeasurable.mono_ac (Measure.AbsolutelyContinuous.smul_right .rfl hc) hf
    simp only [this, not_false_eq_true, eLpNorm_of_not_aestronglyMeasurable, one_div,
      ENNReal.toReal_inv, hf, smul_eq_mul]
    rw [ENNReal.mul_top]
    simp [hc]

theorem eLpNorm_smul_measure_le (c : ℝ≥0∞) (f : α → ε) (p : ℝ≥0∞) (μ : Measure α) :
    eLpNorm f p (c • μ) ≤ c ^ (1 / p).toReal • eLpNorm f p μ := by
  rcases eq_or_ne c 0 with rfl | hc
  · simp
  · exact (eLpNorm_smul_measure_of_ne_zero hc f p μ).le

/-- See `eLpNorm_smul_measure_of_ne_zero` for a version with scalar multiplication by `ℝ≥0∞`. -/
lemma eLpNorm_smul_measure_of_ne_zero' {c : ℝ≥0} (hc : c ≠ 0) (f : α → ε) (p : ℝ≥0∞)
    (μ : Measure α) : eLpNorm f p (c • μ) = c ^ p.toReal⁻¹ • eLpNorm f p μ :=
  (eLpNorm_smul_measure_of_ne_zero (ENNReal.coe_ne_zero.2 hc) f p μ).trans
      (by simp; norm_cast)

/-- See `eLpNorm_smul_measure_of_ne_top'` for a version with scalar multiplication by `ℝ≥0`. -/
theorem eLpNorm_smul_measure_of_ne_top {p : ℝ≥0∞} (hp_ne_top : p ≠ ∞) (f : α → ε)
    (c : ℝ≥0∞) (hf : AEStronglyMeasurable f μ) :
    eLpNorm f p (c • μ) = c ^ (1 / p).toReal • eLpNorm f p μ := by
  by_cases hp0 : p = 0
  · simp [hp0, hf.smul_measure c, hf]
  · apply eLpNorm_smul_measure_of_ne_zero_of_ne_top hp0 hp_ne_top

/-- See `eLpNorm_smul_measure_of_ne_top'` for a version with scalar multiplication by `ℝ≥0∞`. -/
lemma eLpNorm_smul_measure_of_ne_top' (hp : p ≠ ∞) (c : ℝ≥0) (f : α → ε)
    (hf : AEStronglyMeasurable f μ) :
    eLpNorm f p (c • μ) = c ^ p.toReal⁻¹ • eLpNorm f p μ := by
  have : 0 ≤ p.toReal⁻¹ := by positivity
  refine (eLpNorm_smul_measure_of_ne_top hp f c hf).trans ?_
  simp [ENNReal.smul_def, ENNReal.coe_rpow_of_nonneg, this]

theorem eLpNorm_one_smul_measure {f : α → ε} (c : ℝ≥0∞) :
    eLpNorm f 1 (c • μ) = c * eLpNorm f 1 μ := by
  rw [eLpNorm_smul_measure_of_ne_zero_of_ne_top one_ne_zero ENNReal.one_ne_top c]
  simp

theorem eLpNorm_le_of_measure_le_smul {c : ℝ≥0∞} {μ μ' : Measure α} (h : μ' ≤ c • μ) {f : α → ε}
    {p : ℝ≥0∞} :
    eLpNorm f p μ' ≤ c ^ (1 / p).toReal • eLpNorm f p μ := by
  grw [eLpNorm_mono_measure f h, eLpNorm_smul_measure_le c f p μ]

theorem MemLp.of_measure_le_smul {μ' : Measure α} {c : ℝ≥0∞} (hc : c ≠ ∞)
    (hμ'_le : μ' ≤ c • μ) {f : α → ε} (hf : MemLp f p μ) : MemLp f p μ' := by
  grw [memLp_iff, eLpNorm_le_of_measure_le_smul hμ'_le]
  exact ENNReal.mul_lt_top (Ne.lt_top (by simp [hc])) hf

theorem MemLp.smul_measure {f : α → ε} {c : ℝ≥0∞} (hf : MemLp f p μ) (hc : c ≠ ∞) :
    MemLp f p (c • μ) :=
  hf.of_measure_le_smul hc le_rfl

theorem MemLp.smul_measure_nnreal {f : α → ε} {c : ℝ≥0} (hf : MemLp f p μ) :
    MemLp f p (c • μ) :=
  hf.of_measure_le_smul (by simp) le_rfl

variable {ε : Type*} [TopologicalSpace ε] [ENorm ε] [PseudoMetrizableSpace ε] in
theorem eLpNorm_one_add_measure (f : α → ε) (μ ν : Measure α) :
    eLpNorm f 1 (μ + ν) = eLpNorm f 1 μ + eLpNorm f 1 ν := by
  by_cases hadd : AEStronglyMeasurable f (μ + ν)
  · have hfμ : AEStronglyMeasurable f μ :=
      hadd.mono_measure (Measure.le_add_right le_rfl)
    have hfν : AEStronglyMeasurable f ν :=
      hadd.mono_measure (Measure.le_add_left le_rfl)
    rw [eLpNorm_one_eq_lintegral_eNorm hadd, eLpNorm_one_eq_lintegral_eNorm hfμ,
      eLpNorm_one_eq_lintegral_eNorm hfν, lintegral_add_measure _ μ ν]
  · by_cases hfμ : AEStronglyMeasurable f μ
    · have : ¬ (AEStronglyMeasurable f ν) := by
        contrapose hadd
        apply hfμ.add_measure hadd
      simp [eLpNorm_of_not_aestronglyMeasurable, hadd, this]
    · simp [eLpNorm_of_not_aestronglyMeasurable, hadd, hfμ]

theorem eLpNorm_le_add_measure_right (f : α → ε) (μ ν : Measure α) {p : ℝ≥0∞} :
    eLpNorm f p μ ≤ eLpNorm f p (μ + ν) := by
  grw [← Measure.le_add_right le_rfl]

theorem eLpNorm_le_add_measure_left (f : α → ε) (μ ν : Measure α) {p : ℝ≥0∞} :
    eLpNorm f p ν ≤ eLpNorm f p (μ + ν) := by
  grw [← Measure.le_add_left le_rfl]

variable {ε : Type*} [ENorm ε] in
lemma eLpNormEssSup_eq_iSup (hμ : ∀ a, μ {a} ≠ 0) (f : α → ε) : eLpNormEssSup f μ = ⨆ a, ‖f a‖ₑ :=
  essSup_eq_iSup hμ _

variable {ε : Type*} [ENorm ε] in
@[simp] lemma eLpNormEssSup_count (f : α → ε) :
    eLpNormEssSup f .count = ⨆ a, ‖f a‖ₑ := essSup_count _

theorem MemLp.left_of_add_measure {f : α → ε} (h : MemLp f p (μ + ν)) :
    MemLp f p μ :=
  h.mono_measure <| Measure.le_add_right <| le_refl _

theorem MemLp.right_of_add_measure {f : α → ε} (h : MemLp f p (μ + ν)) :
    MemLp f p ν :=
  h.mono_measure <| Measure.le_add_left <| le_refl _

theorem MemLp.eNorm {ε : Type*} [TopologicalSpace ε] [ContinuousENorm ε]
    {f : α → ε} (h : MemLp f p μ) : MemLp (‖f ·‖ₑ) p μ := by
  rw [memLp_iff, MeasureTheory.eLpNorm_eNorm _ h.aestronglyMeasurable]
  exact h

@[deprecated (since := "2026-11-06")] alias MemLp.enorm := MemLp.eNorm

theorem MemLp.norm {f : α → E} (h : MemLp f p μ) : MemLp (fun x => ‖f x‖) p μ :=
  h.of_le h.aestronglyMeasurable.norm (Eventually.of_forall fun x => by simp)

theorem memLp_eNorm_iff {ε : Type*} [TopologicalSpace ε] [ContinuousENorm ε]
    {f : α → ε} (hf : AEStronglyMeasurable f μ) :
    MemLp (‖f ·‖ₑ) p μ ↔ MemLp f p μ :=
  ⟨fun h ↦ by rw [memLp_iff, ← eLpNorm_eNorm _ hf]; exact h, fun h ↦ h.eNorm⟩

@[deprecated (since := "2026-11-06")] alias memLp_enorm_iff := memLp_eNorm_iff

theorem memLp_norm_iff {f : α → E} (hf : AEStronglyMeasurable f μ) :
    MemLp (fun x => ‖f x‖) p μ ↔ MemLp f p μ :=
  ⟨fun h ↦ by rw [memLp_iff, ← eLpNorm_norm _ hf]; exact h, fun h ↦ h.norm⟩

section ESeminormedAddMonoid

variable {ε : Type*} [TopologicalSpace ε] [ESeminormedAddMonoid ε]

theorem eLpNorm'_eq_zero_of_ae_zero {f : α → ε} (hq0_lt : 0 < q) (hf_zero : f =ᵐ[μ] 0) :
    eLpNorm' f q μ = 0 := by rw [eLpNorm'_congr_ae hf_zero, eLpNorm'_zero hq0_lt]

theorem eLpNorm'_eq_zero_of_ae_zero' (hq0_ne : q ≠ 0) (hμ : μ ≠ 0) {f : α → ε}
    (hf_zero : f =ᵐ[μ] 0) :
    eLpNorm' f q μ = 0 := by rw [eLpNorm'_congr_ae hf_zero, eLpNorm'_zero' hq0_ne hμ]

theorem eLpNorm_eq_zero_of_ae_zero {f : α → ε} (hf : f =ᵐ[μ] 0) : eLpNorm f p μ = 0 := by
  rw [← eLpNorm_zero (p := p) (μ := μ) (α := α) (ε := ε)]
  exact eLpNorm_congr_ae hf

theorem eLpNorm'_eq_zero_of_ae_eq_zero {f : α → ε} {p : ℝ} (hp : 0 < p)
    (hf : ∀ᵐ (x : α) ∂μ, ‖f x‖ₑ = 0) : eLpNorm' f p μ = 0 := by
  rw [← eLpNorm'_zero hp (μ := μ) (ε := ε)]
  exact eLpNorm'_congr_eNorm_ae (by simp [hf])

variable {ε : Type*} [ENorm ε] in
theorem ae_le_eLpNormEssSup {f : α → ε} : ∀ᵐ y ∂μ, ‖f y‖ₑ ≤ eLpNormEssSup f μ :=
  ae_le_essSup

-- NB. Changing this lemma to use ‖‖ₑ makes it false (only => still holds);
-- unlike a nnNorm, the eNorm can be ∞.
lemma eLpNormEssSup_lt_top_iff_isBoundedUnder :
    eLpNormEssSup f μ < ⊤ ↔ IsBoundedUnder (· ≤ ·) (ae μ) fun x ↦ ‖f x‖₊ where
  mp h := ⟨(eLpNormEssSup f μ).toNNReal, by
    simp_rw [← ENNReal.coe_le_coe, ENNReal.coe_toNNReal h.ne]; exact ae_le_eLpNormEssSup (f := f)⟩
  mpr := by rintro ⟨C, hC⟩; exact eLpNormEssSup_lt_top_of_ae_nnNorm_bound (C := C) hC

variable {ε : Type*} [ENorm ε] in
theorem meas_eLpNormEssSup_lt {f : α → ε} : μ { y | eLpNormEssSup f μ < ‖f y‖ₑ } = 0 :=
  meas_essSup_lt

lemma eLpNorm_lt_top_of_finite [Finite α] [IsFiniteMeasure μ] (hf : AEStronglyMeasurable f μ) :
    eLpNorm f p μ < ∞ := by
  obtain rfl | hp₀ := eq_or_ne p 0
  · simp [hf]
  obtain rfl | hp := eq_or_ne p ∞
  · simp only [eLpNorm_exponent_top hf, eLpNormEssSup_lt_top_iff_isBoundedUnder]
    exact .le_of_finite
  rw [eLpNorm_lt_top_iff_lintegral_rpow_eNorm_lt_top hp₀ hp hf]
  refine IsFiniteMeasure.lintegral_lt_top_of_bounded_to_ennreal μ ?_
  simp_rw [eNorm, ← ENNReal.coe_rpow_of_nonneg _ ENNReal.toReal_nonneg]
  norm_cast
  exact Finite.exists_le _

@[simp] lemma MemLp.of_discrete [DiscreteMeasurableSpace α] [Finite α] [IsFiniteMeasure μ] :
    MemLp f p μ :=
  let ⟨C, hC⟩ := Finite.exists_le (‖f ·‖₊); .of_bound .of_discrete C <| .of_forall hC

@[simp] lemma eLpNorm_of_isEmpty [IsEmpty α] (f : α → ε) (p : ℝ≥0∞) : eLpNorm f p μ = 0 := by
  simp [Subsingleton.elim f 0]

end ESeminormedAddMonoid

section ENormedAddMonoid

variable {ε : Type*} [TopologicalSpace ε] [ENormedAddMonoid ε]

theorem ae_eq_zero_of_eLpNorm'_eq_zero {f : α → ε} (hq0 : 0 ≤ q) (hf : AEStronglyMeasurable f μ)
    (h : eLpNorm' f q μ = 0) : f =ᵐ[μ] 0 := by
  simp only [eLpNorm'_eq_lintegral_eNorm, lintegral_eq_zero_iff' (hf.eNorm.pow_const q), one_div,
    ENNReal.rpow_eq_zero_iff, inv_pos, inv_neg'', hq0.not_gt, and_false, or_false] at h
  refine h.left.mono fun x hx ↦ ?_
  simp only [Pi.ofNat_apply, ENNReal.rpow_eq_zero_iff, eNorm_eq_zero, h.2.not_gt, and_false,
    or_false] at hx
  simp [hx.1]

theorem eLpNorm'_eq_zero_iff (hq0_lt : 0 < q) {f : α → ε} (hf : AEStronglyMeasurable f μ) :
    eLpNorm' f q μ = 0 ↔ f =ᵐ[μ] 0 :=
  ⟨ae_eq_zero_of_eLpNorm'_eq_zero (le_of_lt hq0_lt) hf, eLpNorm'_eq_zero_of_ae_zero hq0_lt⟩

variable {ε : Type*} [ENorm ε] in
theorem eNorm_ae_le_eLpNormEssSup {_ : MeasurableSpace α} (f : α → ε) (μ : Measure α) :
    ∀ᵐ x ∂μ, ‖f x‖ₑ ≤ eLpNormEssSup f μ :=
  ENNReal.ae_le_essSup fun x => ‖f x‖ₑ

@[deprecated (since := "2026-11-06")] alias enorm_ae_le_eLpNormEssSup := eNorm_ae_le_eLpNormEssSup

@[simp]
theorem eLpNormEssSup_eq_zero_iff {f : α → ε} : eLpNormEssSup f μ = 0 ↔ f =ᵐ[μ] 0 := by
  simp [EventuallyEq, eLpNormEssSup_eq_essSup_eNorm]

theorem eLpNorm_eq_zero_iff {f : α → ε} (h0 : p ≠ 0) :
    eLpNorm f p μ = 0 ↔ f =ᵐ[μ] 0 := by
  by_cases! hf : ¬ AEStronglyMeasurable f μ
  · rw [eLpNorm_of_not_aestronglyMeasurable hf]
    simp only [ENNReal.top_ne_zero, false_iff]
    contrapose hf
    exact ⟨0, stronglyMeasurable_zero, hf⟩
  by_cases h_top : p = ∞
  · rw [h_top, eLpNorm_exponent_top hf, eLpNormEssSup_eq_zero_iff]
  rw [eLpNorm_eq_eLpNorm' h0 h_top hf]
  exact eLpNorm'_eq_zero_iff (ENNReal.toReal_pos h0 h_top) hf

lemma eLpNormEssSup_add_measure {ε : Type*} [TopologicalSpace ε] [ContinuousENorm ε] {f : α → ε} :
    eLpNormEssSup f (μ + ν) = max (eLpNormEssSup f μ) (eLpNormEssSup f ν) := by
  refine le_antisymm (eLpNormEssSup_le_of_ae_eNorm_bound ?_) ?_
  · rw [ae_add_measure_iff]
    constructor
    · filter_upwards [eNorm_ae_le_eLpNormEssSup f μ] with x hx
      grw [hx, ← le_max_left]
    · filter_upwards [eNorm_ae_le_eLpNormEssSup f ν] with x hx
      grw [hx, ← le_max_right]
  · exact max_le_iff.2 ⟨eLpNormEssSup_mono_measure _ (.add_right .rfl _),
      eLpNormEssSup_mono_measure _ (.add_right' .rfl _)⟩

lemma MemLp.add_measure (h1 : MemLp f p μ) (h2 : MemLp f p ν) : MemLp f p (μ + ν) := by
  rw [MemLp, eLpNorm, ite_eq_left]
  swap; · exact h1.aestronglyMeasurable.add_measure h2.aestronglyMeasurable
  split_ifs with hp hp'
  · simp
  · rw [hp'] at h1 h2
    grw [eLpNormEssSup_add_measure, max_le_add_of_nonneg (by simp) (by simp),
      ← eLpNorm_exponent_top h1.aestronglyMeasurable,
      ← eLpNorm_exponent_top h2.aestronglyMeasurable, h1.eLpNorm_lt_top, top_add]
    exact h2.eLpNorm_ne_top
  · grw [eLpNorm', lintegral_add_measure, ENNReal.rpow_add_le_mul_rpow_add_rpow' _ _ (by simp),
      ← eLpNorm', ← eLpNorm', ← eLpNorm_eq_eLpNorm' hp hp' h1.aestronglyMeasurable,
      ← eLpNorm_eq_eLpNorm' hp hp' h2.aestronglyMeasurable, h1.eLpNorm_lt_top]
    · simp
    · exact h2.eLpNorm_ne_top
    · exact ENNReal.LpAddConst_ne_zero _
    · exact (ENNReal.LpAddConst_lt_top _).ne

lemma memLp_add_measure : MemLp f p (μ + ν) ↔ MemLp f p μ ∧ MemLp f p ν where
  mp h := ⟨h.left_of_add_measure, h.right_of_add_measure⟩
  mpr h := h.1.add_measure h.2

end ENormedAddMonoid

section MapMeasure

variable {ε : Type*} [TopologicalSpace ε] [ContinuousENorm ε]
  {β : Type*} {mβ : MeasurableSpace β} {f : α → β} {g : β → ε}

theorem eLpNormEssSup_map_measure (hg : AEStronglyMeasurable g (Measure.map f μ))
    (hf : AEMeasurable f μ) : eLpNormEssSup g (Measure.map f μ) = eLpNormEssSup (g ∘ f) μ :=
  essSup_map_measure hg.eNorm hf

theorem eLpNorm_map_measure (hg : AEStronglyMeasurable g (Measure.map f μ))
    (hf : AEMeasurable f μ) : eLpNorm g p (Measure.map f μ) = eLpNorm (g ∘ f) p μ := by
  have hgf := hg.comp_aemeasurable hf
  by_cases hp_zero : p = 0
  · simp only [hp_zero, eLpNorm_exponent_zero hg, eLpNorm_exponent_zero hgf]
  by_cases hp_top : p = ∞
  · rw [hp_top, eLpNorm_exponent_top hg, eLpNorm_exponent_top hgf]
    exact eLpNormEssSup_map_measure hg hf
  rw [eLpNorm_eq_lintegral_rpow_eNorm_toReal hp_zero hp_top hg,
    eLpNorm_eq_lintegral_rpow_eNorm_toReal hp_zero hp_top hgf]
  congr 1
  rw [lintegral_map' (hg.eNorm.pow_const p.toReal) hf]
  rfl

theorem memLp_map_measure_iff (hg : AEStronglyMeasurable g (Measure.map f μ))
    (hf : AEMeasurable f μ) : MemLp g p (Measure.map f μ) ↔ MemLp (g ∘ f) p μ := by
  simp [MemLp, eLpNorm_map_measure hg hf]

theorem MemLp.comp_of_map (hg : MemLp g p (Measure.map f μ)) (hf : AEMeasurable f μ) :
    MemLp (g ∘ f) p μ :=
  (memLp_map_measure_iff hg.aestronglyMeasurable hf).1 hg

theorem eLpNorm_comp_measurePreserving {ν : MeasureTheory.Measure β} (hg : AEStronglyMeasurable g ν)
    (hf : MeasurePreserving f μ ν) : eLpNorm (g ∘ f) p μ = eLpNorm g p ν :=
  Eq.symm <| hf.map_eq ▸ eLpNorm_map_measure (hf.map_eq ▸ hg) hf.aemeasurable

theorem AEEqFun.eLpNorm_compMeasurePreserving {ν : MeasureTheory.Measure β} (g : β →ₘ[ν] E)
    (hf : MeasurePreserving f μ ν) :
    eLpNorm (g.compMeasurePreserving f hf) p μ = eLpNorm g p ν := by
  rw [eLpNorm_congr_ae (g.coeFn_compMeasurePreserving _)]
  exact eLpNorm_comp_measurePreserving g.aestronglyMeasurable hf

theorem MemLp.comp_measurePreserving {ν : MeasureTheory.Measure β} (hg : MemLp g p ν)
    (hf : MeasurePreserving f μ ν) : MemLp (g ∘ f) p μ :=
  .comp_of_map (hf.map_eq.symm ▸ hg) hf.aemeasurable

theorem _root_.MeasurableEmbedding.eLpNormEssSup_map_measure (hf : MeasurableEmbedding f) :
    eLpNormEssSup g (Measure.map f μ) = eLpNormEssSup (g ∘ f) μ :=
  hf.essSup_map_measure

theorem _root_.MeasurableEmbedding.eLpNorm_map_measure (hf : MeasurableEmbedding f) :
    eLpNorm g p (Measure.map f μ) = eLpNorm (g ∘ f) p μ := by
  by_cases hg : AEStronglyMeasurable g (Measure.map f μ)
  · by_cases hp_zero : p = 0
    · simp only [hp_zero, eLpNorm_exponent_zero hg,
        eLpNorm_exponent_zero ((hf.aestronglyMeasurable_map_iff).1 hg)]
    by_cases hp : p = ∞
    · rw [hp, eLpNorm_exponent_top hg,
        eLpNorm_exponent_top ((hf.aestronglyMeasurable_map_iff).1 hg)]
      exact hf.essSup_map_measure
    · simp [eLpNorm_eq_lintegral_rpow_eNorm_toReal hp_zero hp hg,
        eLpNorm_eq_lintegral_rpow_eNorm_toReal hp_zero hp
          ((hf.aestronglyMeasurable_map_iff).1 hg), hf.lintegral_map]
  · rw [eLpNorm_of_not_aestronglyMeasurable hg, eLpNorm_of_not_aestronglyMeasurable]
    simp [← hf.aestronglyMeasurable_map_iff, hg]

theorem _root_.MeasurableEmbedding.memLp_map_measure_iff (hf : MeasurableEmbedding f) :
    MemLp g p (Measure.map f μ) ↔ MemLp (g ∘ f) p μ := by
  simp [memLp_iff, hf.eLpNorm_map_measure]

theorem _root_.MeasurableEquiv.memLp_map_measure_iff (f : α ≃ᵐ β) :
    MemLp g p (Measure.map f μ) ↔ MemLp (g ∘ f) p μ :=
  f.measurableEmbedding.memLp_map_measure_iff

end MapMeasure

section Liminf

theorem ae_bdd_liminf_atTop_rpow_of_eLpNorm_bdd {f : ℕ → α → E}
    (hbdd : ⨆ n, eLpNorm (f n) p μ < ∞) :
    ∀ᵐ x ∂μ, liminf (fun n ↦ (‖f n x‖ₑ ^ p.toReal : ℝ≥0∞)) atTop < ∞ := by
  have hfae n : AEStronglyMeasurable (f n) μ :=
    aestronglyMeasurable_of_eLpNorm_ne_top ((le_iSup _ n).trans_lt hbdd).ne
  by_cases hp0 : p.toReal = 0
  · simp [hp0]
  have hp : p ≠ 0 := fun h => by simp [h] at hp0
  have hp' : p ≠ ∞ := fun h => by simp [h] at hp0
  refine ae_lt_top' ?_ (LT.lt.ne ?_)
  · exact .liminf fun n ↦ (hfae n).nnNorm.aemeasurable.coe_nnreal_ennreal.pow_const p.toReal
  apply (lintegral_liminf_le' fun n ↦ (hfae n).nnNorm.aemeasurable.coe_nnreal_ennreal.pow_const
    p.toReal).trans_lt
  apply lt_of_le_of_lt (b := (⨆ n, eLpNorm (f n) p μ) ^ p.toReal) ?_ (by finiteness)
  simp_rw [eLpNorm_eq_lintegral_rpow_eNorm_toReal hp hp' (hfae _), one_div] at hbdd
  simp_rw [liminf_eq, eventually_atTop]
  refine sSup_le fun b ⟨a, ha⟩ ↦ (ha a le_rfl).trans ?_
  apply (ENNReal.rpow_inv_le_iff (ENNReal.toReal_pos hp hp')).1
  simp only [← eNorm_eq_nnNorm, ← one_div, ← eLpNorm_eq_lintegral_rpow_eNorm_toReal hp hp' (hfae _)]
  exact le_iSup (fun b ↦ eLpNorm (f b) p μ) a

theorem ae_bdd_liminf_atTop_of_eLpNorm_bdd (hp : p ≠ 0) {f : ℕ → α → E}
    (hbdd : ⨆ n, eLpNorm (f n) p μ < ∞) :
    ∀ᵐ x ∂μ, liminf (fun n => (‖f n x‖ₑ)) atTop < ∞ := by
  have hfae n : AEStronglyMeasurable (f n) μ :=
    aestronglyMeasurable_of_eLpNorm_ne_top ((le_iSup _ n).trans_lt hbdd).ne
  rcases eq_top_or_lt_top p with rfl | hp'
  · have : ∀ n, ∀ᵐ x ∂μ, ‖f n x‖ₑ < (⨆ n, eLpNorm (f n) ∞ μ) + 1 := by
      refine fun n ↦ ae_lt_of_essSup_lt ?_
      apply (ENNReal.lt_add_right hbdd.ne one_ne_zero).trans_le'
      simp only [eLpNorm_exponent_top (hfae _), eLpNormEssSup]
      exact le_iSup (fun k ↦ essSup (fun x ↦ ‖f k x‖ₑ) μ) n
    rw [← ae_all_iff] at this
    filter_upwards [this] with x hx using lt_of_le_of_lt
      (liminf_le_of_frequently_le' <| Frequently.of_forall fun n => (hx n).le)
      (ENNReal.add_lt_top.2 ⟨hbdd.lt_top, ENNReal.one_lt_top⟩)
  filter_upwards [ae_bdd_liminf_atTop_rpow_of_eLpNorm_bdd hbdd] with x hx
  have hppos : 0 < p.toReal := ENNReal.toReal_pos hp hp'.ne
  have :
    liminf (fun n => (‖f n x‖ₑ) ^ p.toReal) atTop =
      liminf (fun n => (‖f n x‖ₑ)) atTop ^ p.toReal := by
    change
      liminf (fun n => ENNReal.orderIsoRpow p.toReal hppos (‖f n x‖ₑ)) atTop =
        ENNReal.orderIsoRpow p.toReal hppos (liminf (fun n => (‖f n x‖ₑ)) atTop)
    refine (OrderIso.liminf_apply (ENNReal.orderIsoRpow p.toReal _) ?_ ?_ ?_ ?_).symm <;>
      isBoundedDefault
  rw [this] at hx
  rw [← ENNReal.rpow_one (liminf (‖f · x‖ₑ) atTop), ← mul_inv_cancel₀ hppos.ne.symm,
    ENNReal.rpow_mul]
  exact ENNReal.rpow_lt_top_of_nonneg (inv_nonneg.2 hppos.le) hx.ne

end Liminf

/-- A continuous function with compact support belongs to `L^∞`.
See `Continuous.memLp_of_hasCompactSupport` for a version for `L^p`. -/

theorem _root_.Continuous.memLp_top_of_hasCompactSupport
    {X : Type*} [TopologicalSpace X] [MeasurableSpace X] [OpensMeasurableSpace X]
    {f : X → E} (hf : Continuous f) (h'f : HasCompactSupport f) (μ : Measure X) : MemLp f ∞ μ := by
  rcases hf.bounded_above_of_compact_support h'f with ⟨C, hC⟩
  apply memLp_top_of_bound ?_ C (Filter.Eventually.of_forall hC)
  exact (hf.stronglyMeasurable_of_hasCompactSupport h'f).aestronglyMeasurable

end Lp
end MeasureTheory

Messung
CHZG
9010010096

¤ Dauer der Verarbeitung: 0.46 Sekunden  ¤

*© Formatika GbR, Deutschland