Theorem: MeasureTheory.SimpleFunc.map_lintegral
File: Mathlib/MeasureTheory/Function/SimpleFunc.lean

Proof steps:
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
⊢ (map g f).lintegral μ = ∑ x ∈ f.range, g x * μ (↑f ⁻¹' {x})
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
⊢ ∑ x ∈ Finset.image g f.range, x * μ (↑(map g f) ⁻¹' {x}) = ∑ x ∈ f.range, g x * μ (↑f ⁻¹' {x})
tactic: simp only [lintegral, range_map]
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
⊢ ∑ x ∈ Finset.image g f.range, x * μ (↑(map g f) ⁻¹' {x}) = ∑ x ∈ f.range, g x * μ (↑f ⁻¹' {x})
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
b : β
hb : b ∈ f.range
⊢ g b * μ (↑(map g f) ⁻¹' {g b}) = ∑ x ∈ Finset.filter (fun c' => g c' = g b) f.range, g x * μ (↑f ⁻¹' {x})
tactic: refine Finset.sum_image' _ fun b hb => ?_
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
b : β
hb : b ∈ f.range
⊢ g b * μ (↑(map g f) ⁻¹' {g b}) = ∑ x ∈ Finset.filter (fun c' => g c' = g b) f.range, g x * μ (↑f ⁻¹' {x})
state_after: case intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
a : α
hb : ↑f a ∈ f.range
⊢ g (↑f a) * μ (↑(map g f) ⁻¹' {g (↑f a)}) =
    ∑ x ∈ Finset.filter (fun c' => g c' = g (↑f a)) f.range, g x * μ (↑f ⁻¹' {x})
tactic: rcases mem_range.1 hb with ⟨a, rfl⟩
state_before: case intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
a : α
hb : ↑f a ∈ f.range
⊢ g (↑f a) * μ (↑(map g f) ⁻¹' {g (↑f a)}) =
    ∑ x ∈ Finset.filter (fun c' => g c' = g (↑f a)) f.range, g x * μ (↑f ⁻¹' {x})
state_after: case intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
a : α
hb : ↑f a ∈ f.range
⊢ ∑ i ∈ Finset.filter (fun b => g b = g (↑f a)) f.range, g (↑f a) * μ (↑f ⁻¹' {i}) =
    ∑ x ∈ Finset.filter (fun c' => g c' = g (↑f a)) f.range, g x * μ (↑f ⁻¹' {x})
tactic: rw [map_preimage_singleton, ← f.sum_measure_preimage_singleton, Finset.mul_sum]
state_before: case intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
a : α
hb : ↑f a ∈ f.range
⊢ ∑ i ∈ Finset.filter (fun b => g b = g (↑f a)) f.range, g (↑f a) * μ (↑f ⁻¹' {i}) =
    ∑ x ∈ Finset.filter (fun c' => g c' = g (↑f a)) f.range, g x * μ (↑f ⁻¹' {x})
state_after: case intro.refine_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
a : α
hb : ↑f a ∈ f.range
⊢ Finset.filter (fun b => g b = g (↑f a)) f.range = Finset.filter (fun c' => g c' = g (↑f a)) f.range

case intro.refine_2
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
m : MeasurableSpace α
μ ν : Measure α
g : β → ℝ≥0∞
f : α →ₛ β
a : α
hb : ↑f a ∈ f.range
⊢ ∀ x ∈ Finset.filter (fun c' => g c' = g (↑f a)) f.range, g (↑f a) * μ (↑f ⁻¹' {x}) = g x * μ (↑f ⁻¹' {x})
tactic: refine Finset.sum_congr ?_ ?_