l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem integral_piecewise_zero {m : MeasurableSpace α} (f : α →ₛ F) (μ : Measure α) {s : Set α}
    (hs : MeasurableSet s) : (piecewise s hs f 0).integral μ = f.integral (μ.restrict s) := by
  classical
  refine' (integral_eq_sum_of_subset _).trans
      ((sum_congr rfl fun y hy => _).trans (integral_eq_sum_filter _ _).symm)
  · intro y hy
    simp only [mem_filter, mem_range, coe_piecewise, coe_zero, piecewise_eq_indicator,
      mem_range_indicator] at *
    rcases hy with ⟨⟨rfl, -⟩ | ⟨x, -, rfl⟩, h₀⟩
    exacts [(h₀ rfl).elim, ⟨Set.mem_range_self _, h₀⟩]
  · dsimp
    

Proof state:
case refine'_2
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m✝ : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
f : α →ₛ F
μ : Measure α
s : Set α
hs : MeasurableSet s
y : F
hy : y ∈ filter (fun x => x ≠ 0) (SimpleFunc.range f)
⊢ ENNReal.toReal (↑↑μ (Set.piecewise s (↑f) 0 ⁻¹' {y})) • y = ENNReal.toReal (↑↑(Measure.restrict μ s) (↑f ⁻¹' {y})) • y

Next tactic:
rw [Set.piecewise_eq_indicator, indicator_preimage_of_not_mem,
      Measure.restrict_apply (f.measurableSet_preimage _)]
@[simp]
theorem integral_piecewise_zero {m : MeasurableSpace α} (f : α →ₛ F) (μ : Measure α) {s : Set α}
    (hs : MeasurableSet s) : (piecewise s hs f 0).integral μ = f.integral (μ.restrict s) := by
  classical
  refine' (integral_eq_sum_of_subset _).trans
      ((sum_congr rfl fun y hy => _).trans (integral_eq_sum_filter _ _).symm)
  · intro y hy
    simp only [mem_filter, mem_range, coe_piecewise, coe_zero, piecewise_eq_indicator,
      mem_range_indicator] at *
    rcases hy with ⟨⟨rfl, -⟩ | ⟨x, -, rfl⟩, h₀⟩
    exacts [(h₀ rfl).elim, ⟨Set.mem_range_self _, h₀⟩]
  · dsimp
    rw [Set.piecewise_eq_indicator, indicator_preimage_of_not_mem,
      Measure.restrict_apply (f.measurableSet_preimage _)]
    

Proof state:
case refine'_2.ht
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m✝ : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
f : α →ₛ F
μ : Measure α
s : Set α
hs : MeasurableSet s
y : F
hy : y ∈ filter (fun x => x ≠ 0) (SimpleFunc.range f)
⊢ 0 ∉ {y}

Next tactic:
exact fun h₀ => (mem_filter.1 hy).2 (Eq.symm h₀)
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
⊢ integral μ (map (ENNReal.toReal ∘ g) f) = ENNReal.toReal (∫⁻ (a : α), g (↑f a) ∂μ)

Next tactic:
have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
⊢ integral μ (map (ENNReal.toReal ∘ g) f) = ENNReal.toReal (∫⁻ (a : α), g (↑f a) ∂μ)

Next tactic:
simp only [← map_apply g f, lintegral_eq_lintegral]
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
⊢ integral μ (map (ENNReal.toReal ∘ g) f) = ENNReal.toReal (lintegral (map g f) μ)

Next tactic:
rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
  · 

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
⊢ ∑ x in SimpleFunc.range f, ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • (ENNReal.toReal ∘ g) x =
    ∑ a in SimpleFunc.range f, ENNReal.toReal (g a * ↑↑μ (↑f ⁻¹' {a}))

Next tactic:
refine' Finset.sum_congr rfl fun b _ => _
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
  · refine' Finset.sum_congr rfl fun b _ => _
    -- Porting note: added `Function.comp_apply`
    

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
b : E
x✝ : b ∈ SimpleFunc.range f
⊢ ENNReal.toReal (↑↑μ (↑f ⁻¹' {b})) • (ENNReal.toReal ∘ g) b = ENNReal.toReal (g b * ↑↑μ (↑f ⁻¹' {b}))

Next tactic:
rw [smul_eq_mul, toReal_mul, mul_comm, Function.comp_apply]
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
  · refine' Finset.sum_congr rfl fun b _ => _
    -- Porting note: added `Function.comp_apply`
    rw [smul_eq_mul, toReal_mul, mul_comm, Function.comp_apply]
  · 

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
⊢ ∀ a ∈ SimpleFunc.range f, g a * ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
rintro a -
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
  · refine' Finset.sum_congr rfl fun b _ => _
    -- Porting note: added `Function.comp_apply`
    rw [smul_eq_mul, toReal_mul, mul_comm, Function.comp_apply]
  · rintro a -
    

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
a : E
⊢ g a * ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
by_cases a0 : a = 0
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
  · refine' Finset.sum_congr rfl fun b _ => _
    -- Porting note: added `Function.comp_apply`
    rw [smul_eq_mul, toReal_mul, mul_comm, Function.comp_apply]
  · rintro a -
    by_cases a0 : a = 0
    · 

Proof state:
case pos
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
a : E
a0 : a = 0
⊢ g a * ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
rw [a0, hg0, zero_mul]
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
  · refine' Finset.sum_congr rfl fun b _ => _
    -- Porting note: added `Function.comp_apply`
    rw [smul_eq_mul, toReal_mul, mul_comm, Function.comp_apply]
  · rintro a -
    by_cases a0 : a = 0
    · rw [a0, hg0, zero_mul]; 

Proof state:
case pos
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
a : E
a0 : a = 0
⊢ 0 ≠ ⊤

Next tactic:
exact WithTop.zero_ne_top
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
  · refine' Finset.sum_congr rfl fun b _ => _
    -- Porting note: added `Function.comp_apply`
    rw [smul_eq_mul, toReal_mul, mul_comm, Function.comp_apply]
  · rintro a -
    by_cases a0 : a = 0
    · rw [a0, hg0, zero_mul]; exact WithTop.zero_ne_top
    · 

Proof state:
case neg
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
a : E
a0 : ¬a = 0
⊢ g a * ↑↑μ (↑f ⁻¹' {a}) ≠ ⊤

Next tactic:
apply mul_ne_top (ht a) (hf'.meas_preimage_singleton_ne_zero a0).ne
/-- `SimpleFunc.integral` and `SimpleFunc.lintegral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion.
    See `integral_eq_lintegral` for a simpler version. -/
theorem integral_eq_lintegral' {f : α →ₛ E} {g : E → ℝ≥0∞} (hf : Integrable f μ) (hg0 : g 0 = 0)
    (ht : ∀ b, g b ≠ ∞) :
    (f.map (ENNReal.toReal ∘ g)).integral μ = ENNReal.toReal (∫⁻ a, g (f a) ∂μ) := by
  have hf' : f.FinMeasSupp μ := integrable_iff_finMeasSupp.1 hf
  simp only [← map_apply g f, lintegral_eq_lintegral]
  rw [map_integral f _ hf, map_lintegral, ENNReal.toReal_sum]
  · refine' Finset.sum_congr rfl fun b _ => _
    -- Porting note: added `Function.comp_apply`
    rw [smul_eq_mul, toReal_mul, mul_comm, Function.comp_apply]
  · rintro a -
    by_cases a0 : a = 0
    · rw [a0, hg0, zero_mul]; exact WithTop.zero_ne_top
    · apply mul_ne_top (ht a) (hf'.meas_preimage_singleton_ne_zero a0).ne
  · 

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedAddCommGroup F'
inst✝ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
f : α →ₛ E
g : E → ℝ≥0∞
hf : Integrable ↑f
hg0 : g 0 = 0
ht : ∀ (b : E), g b ≠ ⊤
hf' : SimpleFunc.FinMeasSupp f μ
⊢ (ENNReal.toReal ∘ g) 0 = 0

Next tactic:
simp [hg0]
/-- `SimpleFunc.bintegral` and `SimpleFunc.integral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion. -/
theorem integral_eq_lintegral {f : α →ₛ ℝ} (hf : Integrable f μ) (h_pos : 0 ≤ᵐ[μ] f) :
    f.integral μ = ENNReal.toReal (∫⁻ a, ENNReal.ofReal (f a) ∂μ) := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedAddCommGroup F'
inst✝⁴ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
inst✝³ : NormedField 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : SMulCommClass ℝ 𝕜 E
f : α →ₛ ℝ
hf : Integrable ↑f
h_pos : 0 ≤ᵐ[μ] ↑f
⊢ integral μ f = ENNReal.toReal (∫⁻ (a : α), ENNReal.ofReal (↑f a) ∂μ)

Next tactic:
have : f =ᵐ[μ] f.map (ENNReal.toReal ∘ ENNReal.ofReal) :=
    h_pos.mono fun a h => (ENNReal.toReal_ofReal h).symm
/-- `SimpleFunc.bintegral` and `SimpleFunc.integral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion. -/
theorem integral_eq_lintegral {f : α →ₛ ℝ} (hf : Integrable f μ) (h_pos : 0 ≤ᵐ[μ] f) :
    f.integral μ = ENNReal.toReal (∫⁻ a, ENNReal.ofReal (f a) ∂μ) := by
  have : f =ᵐ[μ] f.map (ENNReal.toReal ∘ ENNReal.ofReal) :=
    h_pos.mono fun a h => (ENNReal.toReal_ofReal h).symm
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedAddCommGroup F'
inst✝⁴ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
inst✝³ : NormedField 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : SMulCommClass ℝ 𝕜 E
f : α →ₛ ℝ
hf : Integrable ↑f
h_pos : 0 ≤ᵐ[μ] ↑f
this : ↑f =ᵐ[μ] ↑(map (ENNReal.toReal ∘ ENNReal.ofReal) f)
⊢ integral μ f = ENNReal.toReal (∫⁻ (a : α), ENNReal.ofReal (↑f a) ∂μ)

Next tactic:
rw [← integral_eq_lintegral' hf]
/-- `SimpleFunc.bintegral` and `SimpleFunc.integral` agree when the integrand has type
    `α →ₛ ℝ≥0∞`. But since `ℝ≥0∞` is not a `NormedSpace`, we need some form of coercion. -/
theorem integral_eq_lintegral {f : α →ₛ ℝ} (hf : Integrable f μ) (h_pos : 0 ≤ᵐ[μ] f) :
    f.integral μ = ENNReal.toReal (∫⁻ a, ENNReal.ofReal (f a) ∂μ) := by
  have : f =ᵐ[μ] f.map (ENNReal.toReal ∘ ENNReal.ofReal) :=
    h_pos.mono fun a h => (ENNReal.toReal_ofReal h).symm
  rw [← integral_eq_lintegral' hf]
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedAddCommGroup F'
inst✝⁴ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
inst✝³ : NormedField 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : SMulCommClass ℝ 𝕜 E
f : α →ₛ ℝ
hf : Integrable ↑f
h_pos : 0 ≤ᵐ[μ] ↑f
this : ↑f =ᵐ[μ] ↑(map (ENNReal.toReal ∘ ENNReal.ofReal) f)
⊢ integral μ f = integral μ (map (ENNReal.toReal ∘ ENNReal.ofReal) f)
case hg0
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedAddCommGroup F'
inst✝⁴ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
inst✝³ : NormedField 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : SMulCommClass ℝ 𝕜 E
f : α →ₛ ℝ
hf : Integrable ↑f
h_pos : 0 ≤ᵐ[μ] ↑f
this : ↑f =ᵐ[μ] ↑(map (ENNReal.toReal ∘ ENNReal.ofReal) f)
⊢ ENNReal.ofReal 0 = 0
case ht
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedAddCommGroup F'
inst✝⁴ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
inst✝³ : NormedField 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : SMulCommClass ℝ 𝕜 E
f : α →ₛ ℝ
hf : Integrable ↑f
h_pos : 0 ≤ᵐ[μ] ↑f
this : ↑f =ᵐ[μ] ↑(map (ENNReal.toReal ∘ ENNReal.ofReal) f)
⊢ ∀ (b : ℝ), ENNReal.ofReal b ≠ ⊤

Next tactic:
exacts [integral_congr hf this, ENNReal.ofReal_zero, fun b => ENNReal.ofReal_ne_top]
theorem norm_setToSimpleFunc_le_integral_norm (T : Set α → E →L[ℝ] F) {C : ℝ}
    (hT_norm : ∀ s, MeasurableSet s → μ s < ∞ → ‖T s‖ ≤ C * (μ s).toReal) {f : α →ₛ E}
    (hf : Integrable f μ) : ‖f.setToSimpleFunc T‖ ≤ C * (f.map norm).integral μ :=
  calc
    ‖f.setToSimpleFunc T‖ ≤ C * ∑ x in f.range, ENNReal.toReal (μ (f ⁻¹' {x})) * ‖x‖ :=
      norm_setToSimpleFunc_le_sum_mul_norm_of_integrable T hT_norm f hf
    _ = C * (f.map norm).integral μ := by
      

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedAddCommGroup F'
inst✝⁴ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
inst✝³ : NormedField 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : SMulCommClass ℝ 𝕜 E
T : Set α → E →L[ℝ] F
C : ℝ
hT_norm : ∀ (s : Set α), MeasurableSet s → ↑↑μ s < ⊤ → ‖T s‖ ≤ C * ENNReal.toReal (↑↑μ s)
f : α →ₛ E
hf : Integrable ↑f
⊢ C * ∑ x in SimpleFunc.range f, ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) * ‖x‖ = C * integral μ (map norm f)

Next tactic:
rw [map_integral f norm hf norm_zero]
theorem norm_setToSimpleFunc_le_integral_norm (T : Set α → E →L[ℝ] F) {C : ℝ}
    (hT_norm : ∀ s, MeasurableSet s → μ s < ∞ → ‖T s‖ ≤ C * (μ s).toReal) {f : α →ₛ E}
    (hf : Integrable f μ) : ‖f.setToSimpleFunc T‖ ≤ C * (f.map norm).integral μ :=
  calc
    ‖f.setToSimpleFunc T‖ ≤ C * ∑ x in f.range, ENNReal.toReal (μ (f ⁻¹' {x})) * ‖x‖ :=
      norm_setToSimpleFunc_le_sum_mul_norm_of_integrable T hT_norm f hf
    _ = C * (f.map norm).integral μ := by
      rw [map_integral f norm hf norm_zero]; 

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedAddCommGroup F'
inst✝⁴ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
inst✝³ : NormedField 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : SMulCommClass ℝ 𝕜 E
T : Set α → E →L[ℝ] F
C : ℝ
hT_norm : ∀ (s : Set α), MeasurableSet s → ↑↑μ s < ⊤ → ‖T s‖ ≤ C * ENNReal.toReal (↑↑μ s)
f : α →ₛ E
hf : Integrable ↑f
⊢ C * ∑ x in SimpleFunc.range f, ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) * ‖x‖ =
    C * ∑ x in SimpleFunc.range f, ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • ‖x‖

Next tactic:
simp_rw [smul_eq_mul]
theorem norm_integral_le_integral_norm (f : α →ₛ E) (hf : Integrable f μ) :
    ‖f.integral μ‖ ≤ (f.map norm).integral μ := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
𝕜 : Type u_4
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
p : ℝ≥0∞
G : Type u_5
F' : Type u_6
inst✝⁶ : NormedAddCommGroup G
inst✝⁵ : NormedAddCommGroup F'
inst✝⁴ : NormedSpace ℝ F'
m : MeasurableSpace α
μ : Measure α
inst✝³ : NormedField 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : NormedSpace ℝ E
inst✝ : SMulCommClass ℝ 𝕜 E
f : α →ₛ E
hf : Integrable ↑f
⊢ ‖integral μ f‖ ≤ integral μ (map norm f)

Next tactic:
refine' (norm_setToSimpleFunc_le_integral_norm _ (fun s _ _ => _) hf).trans (one_mul _).le