Theorem: MeasureTheory.SigmaFinite.withDensity_of_ne_top
File: Mathlib/MeasureTheory/Measure/WithDensity.lean

tactic: let f' := fun x ↦ if f x = ∞ then 0 else f x
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
⊢ SigmaFinite (μ.withDensity f)
state_after: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
⊢ SigmaFinite (μ.withDensity f)

tactic: have hff' : f =ᵐ[μ] f' := by filter_upwards [hf_ne_top] with x hx using by simp [f', hx]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
⊢ SigmaFinite (μ.withDensity f)
state_after: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
hff' : f =ᶠ[ae μ] f'
⊢ SigmaFinite (μ.withDensity f)

tactic: have hf'_ne_top : ∀ x, f' x ≠ ∞ := fun x ↦ by by_cases hfx : f x = ∞ <;> simp [f', hfx]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
hff' : f =ᶠ[ae μ] f'
⊢ SigmaFinite (μ.withDensity f)
state_after: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
hff' : f =ᶠ[ae μ] f'
hf'_ne_top : ∀ (x : α), f' x ≠ ⊤
⊢ SigmaFinite (μ.withDensity f)

tactic: rw [withDensity_congr_ae hff']
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
hff' : f =ᶠ[ae μ] f'
hf'_ne_top : ∀ (x : α), f' x ≠ ⊤
⊢ SigmaFinite (μ.withDensity f)
state_after: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
hff' : f =ᶠ[ae μ] f'
hf'_ne_top : ∀ (x : α), f' x ≠ ⊤
⊢ SigmaFinite (μ.withDensity f')

tactic: exact SigmaFinite.withDensity_of_ne_top' (hf.congr hff') hf'_ne_top
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
hff' : f =ᶠ[ae μ] f'
hf'_ne_top : ∀ (x : α), f' x ≠ ⊤
⊢ SigmaFinite (μ.withDensity f')
state_after: no goals

tactic: filter_upwards [hf_ne_top] with x hx using by simp [f', hx]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
⊢ f =ᶠ[ae μ] f'
state_after: no goals

tactic: simp [f', hx]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
x : α
hx : f x ≠ ⊤
⊢ f x = f' x
state_after: no goals

tactic: by_cases hfx : f x = ∞ <;> simp [f', hfx]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : AEMeasurable f μ
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
f' : α → ℝ≥0∞ := fun x => if f x = ⊤ then 0 else f x
hff' : f =ᶠ[ae μ] f'
x : α
⊢ f' x ≠ ⊤
state_after: no goals