l3lab/ntp-mathlib huggingface dataset:
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · 

Proof state:
case neg.inr.left
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
⊢ ∫⁻ (x : α) in s, ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p ∂μ < ⊤

Next tactic:
have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
⊢ ∀ᵐ (x : α) ∂μ, x ∈ s → ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p = ↑‖f x‖₊ ^ ENNReal.toReal p

Next tactic:
refine ae_of_all _ (fun a ha ↦ ?_)
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
a : α
ha : a ∈ s
⊢ ↑‖Set.piecewise s f g a‖₊ ^ ENNReal.toReal p = ↑‖f a‖₊ ^ ENNReal.toReal p

Next tactic:
simp [ha]
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
    

Proof state:
case neg.inr.left
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
h : ∀ᵐ (x : α) ∂μ, x ∈ s → ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p = ↑‖f x‖₊ ^ ENNReal.toReal p
⊢ ∫⁻ (x : α) in s, ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p ∂μ < ⊤

Next tactic:
rw [set_lintegral_congr_fun hs h]
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
    rw [set_lintegral_congr_fun hs h]
    

Proof state:
case neg.inr.left
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
h : ∀ᵐ (x : α) ∂μ, x ∈ s → ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p = ↑‖f x‖₊ ^ ENNReal.toReal p
⊢ ∫⁻ (x : α) in s, ↑‖f x‖₊ ^ ENNReal.toReal p ∂μ < ⊤

Next tactic:
exact lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_top hf.2
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
    rw [set_lintegral_congr_fun hs h]
    exact lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_top hf.2
  · 

Proof state:
case neg.inr.right
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
⊢ ∫⁻ (x : α) in sᶜ, ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p ∂μ < ⊤

Next tactic:
have h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖g x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      have ha' : a ∉ s := ha
      simp [ha']
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
    rw [set_lintegral_congr_fun hs h]
    exact lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_top hf.2
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖g x‖₊ : ℝ≥0∞) ^ p.toReal := by
      

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
⊢ ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p = ↑‖g x‖₊ ^ ENNReal.toReal p

Next tactic:
refine ae_of_all _ (fun a ha ↦ ?_)
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
    rw [set_lintegral_congr_fun hs h]
    exact lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_top hf.2
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖g x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
a : α
ha : a ∈ sᶜ
⊢ ↑‖Set.piecewise s f g a‖₊ ^ ENNReal.toReal p = ↑‖g a‖₊ ^ ENNReal.toReal p

Next tactic:
have ha' : a ∉ s := ha
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
    rw [set_lintegral_congr_fun hs h]
    exact lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_top hf.2
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖g x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      have ha' : a ∉ s := ha
      

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
a : α
ha : a ∈ sᶜ
ha' : a ∉ s
⊢ ↑‖Set.piecewise s f g a‖₊ ^ ENNReal.toReal p = ↑‖g a‖₊ ^ ENNReal.toReal p

Next tactic:
simp [ha']
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
    rw [set_lintegral_congr_fun hs h]
    exact lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_top hf.2
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖g x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      have ha' : a ∉ s := ha
      simp [ha']
    

Proof state:
case neg.inr.right
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p = ↑‖g x‖₊ ^ ENNReal.toReal p
⊢ ∫⁻ (x : α) in sᶜ, ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p ∂μ < ⊤

Next tactic:
rw [set_lintegral_congr_fun hs.compl h]
lemma Memℒp.piecewise [DecidablePred (· ∈ s)]
    (hs : MeasurableSet s) (hf : Memℒp f p (μ.restrict s)) (hg : Memℒp g p (μ.restrict sᶜ)) :
    Memℒp (s.piecewise f g) p μ := by
  by_cases hp_zero : p = 0
  · simp only [hp_zero, memℒp_zero_iff_aestronglyMeasurable]
    exact AEStronglyMeasurable.piecewise hs hf.1 hg.1
  refine ⟨AEStronglyMeasurable.piecewise hs hf.1 hg.1, ?_⟩
  rcases eq_or_ne p ∞ with rfl | hp_top
  · rw [snorm_top_piecewise f g hs]
    exact max_lt hf.2 hg.2
  rw [snorm_lt_top_iff_lintegral_rpow_nnnorm_lt_top hp_zero hp_top, ← lintegral_add_compl _ hs,
    ENNReal.add_lt_top]
  constructor
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ s →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖f x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      simp [ha]
    rw [set_lintegral_congr_fun hs h]
    exact lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_top hf.2
  · have h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ →
        (‖Set.piecewise s f g x‖₊ : ℝ≥0∞) ^ p.toReal = (‖g x‖₊ : ℝ≥0∞) ^ p.toReal := by
      refine ae_of_all _ (fun a ha ↦ ?_)
      have ha' : a ∉ s := ha
      simp [ha']
    rw [set_lintegral_congr_fun hs.compl h]
    

Proof state:
case neg.inr.right
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
c : E
f : α → E
hf✝ : AEStronglyMeasurable f μ
s : Set α
g : α → E
inst✝ : DecidablePred fun x => x ∈ s
hs : MeasurableSet s
hf : Memℒp f p
hg : Memℒp g p
hp_zero : ¬p = 0
hp_top : p ≠ ⊤
h : ∀ᵐ (x : α) ∂μ, x ∈ sᶜ → ↑‖Set.piecewise s f g x‖₊ ^ ENNReal.toReal p = ↑‖g x‖₊ ^ ENNReal.toReal p
⊢ ∫⁻ (x : α) in sᶜ, ↑‖g x‖₊ ^ ENNReal.toReal p ∂μ < ⊤

Next tactic:
exact lintegral_rpow_nnnorm_lt_top_of_snorm_lt_top hp_zero hp_top hg.2
theorem norm_indicatorConstLp (hp_ne_zero : p ≠ 0) (hp_ne_top : p ≠ ∞) :
    ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
hp_ne_zero : p ≠ 0
hp_ne_top : p ≠ ⊤
⊢ ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p)

Next tactic:
rw [Lp.norm_def, snorm_congr_ae indicatorConstLp_coeFn,
    snorm_indicator_const hs hp_ne_zero hp_ne_top, ENNReal.toReal_mul, ENNReal.toReal_rpow,
    ENNReal.coe_toReal, coe_nnnorm]
theorem norm_indicatorConstLp_top (hμs_ne_zero : μ s ≠ 0) :
    ‖indicatorConstLp ∞ hs hμs c‖ = ‖c‖ := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
hμs_ne_zero : ↑↑μ s ≠ 0
⊢ ‖indicatorConstLp ⊤ hs hμs c‖ = ‖c‖

Next tactic:
rw [Lp.norm_def, snorm_congr_ae indicatorConstLp_coeFn,
    snorm_indicator_const' hs hμs_ne_zero ENNReal.top_ne_zero, ENNReal.top_toReal, _root_.div_zero,
    ENNReal.rpow_zero, mul_one, ENNReal.coe_toReal, coe_nnnorm]
theorem norm_indicatorConstLp' (hp_pos : p ≠ 0) (hμs_pos : μ s ≠ 0) :
    ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
hp_pos : p ≠ 0
hμs_pos : ↑↑μ s ≠ 0
⊢ ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p)

Next tactic:
by_cases hp_top : p = ∞
theorem norm_indicatorConstLp' (hp_pos : p ≠ 0) (hμs_pos : μ s ≠ 0) :
    ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  by_cases hp_top : p = ∞
  · 

Proof state:
case pos
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
hp_pos : p ≠ 0
hμs_pos : ↑↑μ s ≠ 0
hp_top : p = ⊤
⊢ ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p)

Next tactic:
rw [hp_top, ENNReal.top_toReal, _root_.div_zero, Real.rpow_zero, mul_one]
theorem norm_indicatorConstLp' (hp_pos : p ≠ 0) (hμs_pos : μ s ≠ 0) :
    ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  by_cases hp_top : p = ∞
  · rw [hp_top, ENNReal.top_toReal, _root_.div_zero, Real.rpow_zero, mul_one]
    

Proof state:
case pos
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
hp_pos : p ≠ 0
hμs_pos : ↑↑μ s ≠ 0
hp_top : p = ⊤
⊢ ‖indicatorConstLp ⊤ hs hμs c‖ = ‖c‖

Next tactic:
exact norm_indicatorConstLp_top hμs_pos
theorem norm_indicatorConstLp' (hp_pos : p ≠ 0) (hμs_pos : μ s ≠ 0) :
    ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  by_cases hp_top : p = ∞
  · rw [hp_top, ENNReal.top_toReal, _root_.div_zero, Real.rpow_zero, mul_one]
    exact norm_indicatorConstLp_top hμs_pos
  · 

Proof state:
case neg
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
hp_pos : p ≠ 0
hμs_pos : ↑↑μ s ≠ 0
hp_top : ¬p = ⊤
⊢ ‖indicatorConstLp p hs hμs c‖ = ‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p)

Next tactic:
exact norm_indicatorConstLp hp_pos hp_top
theorem norm_indicatorConstLp_le :
    ‖indicatorConstLp p hs hμs c‖ ≤ ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
⊢ ‖indicatorConstLp p hs hμs c‖ ≤ ‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p)

Next tactic:
rw [indicatorConstLp, Lp.norm_toLp]
theorem norm_indicatorConstLp_le :
    ‖indicatorConstLp p hs hμs c‖ ≤ ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  rw [indicatorConstLp, Lp.norm_toLp]
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
⊢ ENNReal.toReal (snorm (indicator s fun x => c) p μ) ≤ ‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p)

Next tactic:
refine ENNReal.toReal_le_of_le_ofReal (by positivity) ?_
theorem norm_indicatorConstLp_le :
    ‖indicatorConstLp p hs hμs c‖ ≤ ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  rw [indicatorConstLp, Lp.norm_toLp]
  refine ENNReal.toReal_le_of_le_ofReal (by 

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
⊢ 0 ≤ ‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p)

Next tactic:
positivity
theorem norm_indicatorConstLp_le :
    ‖indicatorConstLp p hs hμs c‖ ≤ ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  rw [indicatorConstLp, Lp.norm_toLp]
  refine ENNReal.toReal_le_of_le_ofReal (by positivity) ?_
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
⊢ snorm (indicator s fun x => c) p μ ≤ ENNReal.ofReal (‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p))

Next tactic:
refine (snorm_indicator_const_le _ _).trans_eq ?_
theorem norm_indicatorConstLp_le :
    ‖indicatorConstLp p hs hμs c‖ ≤ ‖c‖ * (μ s).toReal ^ (1 / p.toReal) := by
  rw [indicatorConstLp, Lp.norm_toLp]
  refine ENNReal.toReal_le_of_le_ofReal (by positivity) ?_
  refine (snorm_indicator_const_le _ _).trans_eq ?_
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
s : Set α
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
c : E
⊢ ↑‖c‖₊ * ↑↑μ s ^ (1 / ENNReal.toReal p) = ENNReal.ofReal (‖c‖ * ENNReal.toReal (↑↑μ s) ^ (1 / ENNReal.toReal p))

Next tactic:
rw [← coe_nnnorm, ENNReal.ofReal_mul (NNReal.coe_nonneg _), ENNReal.ofReal_coe_nnreal,
    ENNReal.toReal_rpow, ENNReal.ofReal_toReal]