l3lab/ntp-mathlib huggingface dataset:
theorem integral_eq {m : MeasurableSpace α} (μ : Measure α) (f : α →ₛ F) :
    f.integral μ = ∑ x in f.range, (μ (f ⁻¹' {x})).toReal • x := 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 α
m : MeasurableSpace α
μ : Measure α
f : α →ₛ F
⊢ integral μ f = ∑ x in SimpleFunc.range f, ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x

Next tactic:
simp [integral, setToSimpleFunc, weightedSMul_apply]
theorem integral_eq_sum_filter [DecidablePred fun x : F => x ≠ 0] {m : MeasurableSpace α}
    (f : α →ₛ F) (μ : Measure α) :
    f.integral μ = ∑ x in f.range.filter fun x => x ≠ 0, (μ (f ⁻¹' {x})).toReal • x := 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✝ : DecidablePred fun x => x ≠ 0
m : MeasurableSpace α
f : α →ₛ F
μ : Measure α
⊢ integral μ f = ∑ x in filter (fun x => x ≠ 0) (SimpleFunc.range f), ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x

Next tactic:
rw [integral_def, setToSimpleFunc_eq_sum_filter]
theorem integral_eq_sum_filter [DecidablePred fun x : F => x ≠ 0] {m : MeasurableSpace α}
    (f : α →ₛ F) (μ : Measure α) :
    f.integral μ = ∑ x in f.range.filter fun x => x ≠ 0, (μ (f ⁻¹' {x})).toReal • x := by
  rw [integral_def, setToSimpleFunc_eq_sum_filter]; 

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✝ : DecidablePred fun x => x ≠ 0
m : MeasurableSpace α
f : α →ₛ F
μ : Measure α
⊢ ∑ x in filter (fun x => x ≠ 0) (SimpleFunc.range f), (weightedSMul μ (↑f ⁻¹' {x})) x =
    ∑ x in filter (fun x => x ≠ 0) (SimpleFunc.range f), ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x

Next tactic:
simp_rw [weightedSMul_apply]
theorem integral_eq_sum_filter [DecidablePred fun x : F => x ≠ 0] {m : MeasurableSpace α}
    (f : α →ₛ F) (μ : Measure α) :
    f.integral μ = ∑ x in f.range.filter fun x => x ≠ 0, (μ (f ⁻¹' {x})).toReal • x := by
  rw [integral_def, setToSimpleFunc_eq_sum_filter]; simp_rw [weightedSMul_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 α
inst✝ : DecidablePred fun x => x ≠ 0
m : MeasurableSpace α
f : α →ₛ F
μ : Measure α
⊢ ∑ x in filter (fun x => x ≠ 0) (SimpleFunc.range f), ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x =
    ∑ x in filter (fun x => x ≠ 0) (SimpleFunc.range f), ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x

Next tactic:
congr
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := 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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
⊢ integral μ f = ∑ x in s, ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x

Next tactic:
rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  

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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
⊢ ∀ x ∈ s, x ∉ filter (fun x => x ≠ 0) (SimpleFunc.range f) → ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x = 0

Next tactic:
rintro x - hx
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  rintro x - hx; 

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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
x : F
hx : x ∉ filter (fun x => x ≠ 0) (SimpleFunc.range f)
⊢ ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x = 0

Next tactic:
rw [Finset.mem_filter, not_and_or, Ne.def, Classical.not_not] at hx
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  rintro x - hx; rw [Finset.mem_filter, not_and_or, Ne.def, Classical.not_not] at hx
  -- Porting note: reordered for clarity
  

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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
x : F
hx : x ∉ SimpleFunc.range f ∨ x = 0
⊢ ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x = 0

Next tactic:
rcases hx.symm with (rfl | hx)
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  rintro x - hx; rw [Finset.mem_filter, not_and_or, Ne.def, Classical.not_not] at hx
  -- Porting note: reordered for clarity
  rcases hx.symm with (rfl | hx)
  · 

Proof state:
case inl
α : 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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
hx : 0 ∉ SimpleFunc.range f ∨ 0 = 0
⊢ ENNReal.toReal (↑↑μ (↑f ⁻¹' {0})) • 0 = 0

Next tactic:
simp
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  rintro x - hx; rw [Finset.mem_filter, not_and_or, Ne.def, Classical.not_not] at hx
  -- Porting note: reordered for clarity
  rcases hx.symm with (rfl | hx)
  · simp
  

Proof state:
case inr
α : 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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
x : F
hx✝ : x ∉ SimpleFunc.range f ∨ x = 0
hx : x ∉ SimpleFunc.range f
⊢ ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x = 0

Next tactic:
rw [SimpleFunc.mem_range] at hx
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  rintro x - hx; rw [Finset.mem_filter, not_and_or, Ne.def, Classical.not_not] at hx
  -- Porting note: reordered for clarity
  rcases hx.symm with (rfl | hx)
  · simp
  rw [SimpleFunc.mem_range] at hx
  -- Porting note: added
  

Proof state:
case inr
α : 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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
x : F
hx✝ : x ∉ SimpleFunc.range f ∨ x = 0
hx : x ∉ Set.range ↑f
⊢ ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x = 0

Next tactic:
simp only [Set.mem_range, not_exists] at hx
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  rintro x - hx; rw [Finset.mem_filter, not_and_or, Ne.def, Classical.not_not] at hx
  -- Porting note: reordered for clarity
  rcases hx.symm with (rfl | hx)
  · simp
  rw [SimpleFunc.mem_range] at hx
  -- Porting note: added
  simp only [Set.mem_range, not_exists] at hx
  

Proof state:
case inr
α : 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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
x : F
hx✝ : x ∉ SimpleFunc.range f ∨ x = 0
hx : ∀ (x_1 : α), ¬↑f x_1 = x
⊢ ENNReal.toReal (↑↑μ (↑f ⁻¹' {x})) • x = 0

Next tactic:
rw [preimage_eq_empty]
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  rintro x - hx; rw [Finset.mem_filter, not_and_or, Ne.def, Classical.not_not] at hx
  -- Porting note: reordered for clarity
  rcases hx.symm with (rfl | hx)
  · simp
  rw [SimpleFunc.mem_range] at hx
  -- Porting note: added
  simp only [Set.mem_range, not_exists] at hx
  rw [preimage_eq_empty] <;> 

Proof state:
case inr
α : 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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
x : F
hx✝ : x ∉ SimpleFunc.range f ∨ x = 0
hx : ∀ (x_1 : α), ¬↑f x_1 = x
⊢ ENNReal.toReal (↑↑μ ∅) • x = 0

Next tactic:
simp [Set.disjoint_singleton_left, hx]
/-- The Bochner integral is equal to a sum over any set that includes `f.range` (except `0`). -/
theorem integral_eq_sum_of_subset [DecidablePred fun x : F => x ≠ 0] {f : α →ₛ F} {s : Finset F}
    (hs : (f.range.filter fun x => x ≠ 0) ⊆ s) :
    f.integral μ = ∑ x in s, (μ (f ⁻¹' {x})).toReal • x := by
  rw [SimpleFunc.integral_eq_sum_filter, Finset.sum_subset hs]
  rintro x - hx; rw [Finset.mem_filter, not_and_or, Ne.def, Classical.not_not] at hx
  -- Porting note: reordered for clarity
  rcases hx.symm with (rfl | hx)
  · simp
  rw [SimpleFunc.mem_range] at hx
  -- Porting note: added
  simp only [Set.mem_range, not_exists] at hx
  rw [preimage_eq_empty] <;> 

Proof state:
case inr
α : 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✝ : DecidablePred fun x => x ≠ 0
f : α →ₛ F
s : Finset F
hs : filter (fun x => x ≠ 0) (SimpleFunc.range f) ⊆ s
x : F
hx✝ : x ∉ SimpleFunc.range f ∨ x = 0
hx : ∀ (x_1 : α), ¬↑f x_1 = x
⊢ Disjoint {x} (Set.range ↑f)

Next tactic:
simp [Set.disjoint_singleton_left, hx]
@[simp]
theorem integral_const {m : MeasurableSpace α} (μ : Measure α) (y : F) :
    (const α y).integral μ = (μ univ).toReal • y := 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 α
m : MeasurableSpace α
μ : Measure α
y : F
⊢ integral μ (const α y) = ENNReal.toReal (↑↑μ Set.univ) • y

Next tactic:
classical
  calc
    (const α y).integral μ = ∑ z in {y}, (μ (const α y ⁻¹' {z})).toReal • z :=
      integral_eq_sum_of_subset <| (filter_subset _ _).trans (range_const_subset _ _)
    _ = (μ univ).toReal • y := by simp [Set.preimage]
@[simp]
theorem integral_const {m : MeasurableSpace α} (μ : Measure α) (y : F) :
    (const α y).integral μ = (μ univ).toReal • y := by
  classical
  

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 α
m : MeasurableSpace α
μ : Measure α
y : F
⊢ integral μ (const α y) = ENNReal.toReal (↑↑μ Set.univ) • y

Next tactic:
calc
    (const α y).integral μ = ∑ z in {y}, (μ (const α y ⁻¹' {z})).toReal • z :=
      integral_eq_sum_of_subset <| (filter_subset _ _).trans (range_const_subset _ _)
    _ = (μ univ).toReal • y := by simp [Set.preimage]
@[simp]
theorem integral_const {m : MeasurableSpace α} (μ : Measure α) (y : F) :
    (const α y).integral μ = (μ univ).toReal • y := by
  classical
  calc
    (const α y).integral μ = ∑ z in {y}, (μ (const α y ⁻¹' {z})).toReal • z :=
      integral_eq_sum_of_subset <| (filter_subset _ _).trans (range_const_subset _ _)
    _ = (μ univ).toReal • y := 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 α
m : MeasurableSpace α
μ : Measure α
y : F
⊢ ∑ z in {y}, ENNReal.toReal (↑↑μ (↑(const α y) ⁻¹' {z})) • z = ENNReal.toReal (↑↑μ Set.univ) • y

Next tactic:
simp [Set.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
  

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 α
m : MeasurableSpace α
f : α →ₛ F
μ : Measure α
s : Set α
hs : MeasurableSet s
⊢ integral μ (piecewise s hs f 0) = integral (Measure.restrict μ s) f

Next tactic:
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 _)]
    exact fun h₀ => (mem_filter.1 hy).2 (Eq.symm h₀)
@[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
  

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 α
m : MeasurableSpace α
f : α →ₛ F
μ : Measure α
s : Set α
hs : MeasurableSet s
⊢ integral μ (piecewise s hs f 0) = integral (Measure.restrict μ s) f

Next tactic:
refine' (integral_eq_sum_of_subset _).trans
      ((sum_congr rfl fun y hy => _).trans (integral_eq_sum_filter _ _).symm)
@[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)
  · 

Proof state:
case refine'_1
α : 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
⊢ filter (fun x => x ≠ 0) (SimpleFunc.range (piecewise s hs f 0)) ⊆ filter (fun x => x ≠ 0) (SimpleFunc.range f)

Next tactic:
intro y hy
@[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
    

Proof state:
case refine'_1
α : 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 (piecewise s hs f 0))
⊢ y ∈ filter (fun x => x ≠ 0) (SimpleFunc.range f)

Next tactic:
simp only [mem_filter, mem_range, coe_piecewise, coe_zero, piecewise_eq_indicator,
      mem_range_indicator] at *
@[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 *
    

Proof state:
case refine'_1
α : 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 = 0 ∧ s ≠ Set.univ ∨ y ∈ ↑f '' s) ∧ y ≠ 0
⊢ y ∈ Set.range ↑f ∧ y ≠ 0

Next tactic:
rcases hy with ⟨⟨rfl, -⟩ | ⟨x, -, rfl⟩, h₀⟩
@[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₀⟩
    

Proof state:
case refine'_1.intro.inl.intro
α : 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
h₀ : 0 ≠ 0
⊢ 0 ∈ Set.range ↑f ∧ 0 ≠ 0
case refine'_1.intro.inr.intro.intro
α : 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
x : α
h₀ : ↑f x ≠ 0
⊢ ↑f x ∈ Set.range ↑f ∧ ↑f x ≠ 0

Next tactic:
exacts [(h₀ rfl).elim, ⟨Set.mem_range_self _, h₀⟩]
@[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₀⟩]
  · 

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 (↑↑μ (↑(piecewise s hs f 0) ⁻¹' {y})) • y = ENNReal.toReal (↑↑(Measure.restrict μ s) (↑f ⁻¹' {y})) • y

Next tactic:
dsimp