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

tactic: have h : (fun x ↦ (f x : ℝ≥0∞)) =ᵐ[μ] fun x ↦ ((hf.mk f x : ℝ≥0) : ℝ≥0∞) := by
  filter_upwards [hf.ae_eq_mk] with x hx using by rw [hx]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
⊢ SigmaFinite (μ.withDensity fun x => ↑(f x))
state_after: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
⊢ SigmaFinite (μ.withDensity fun x => ↑(f x))

tactic: rw [withDensity_congr_ae h]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
⊢ SigmaFinite (μ.withDensity fun x => ↑(f x))
state_after: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
⊢ SigmaFinite (μ.withDensity fun x => ↑(AEMeasurable.mk f hf x))

tactic: obtain ⟨s, hs, h⟩ := exists_spanning_measurableSet_le
  hf.measurable_mk μ
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
⊢ SigmaFinite (μ.withDensity fun x => ↑(AEMeasurable.mk f hf x))
state_after: case intro.intro
α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
⊢ SigmaFinite (μ.withDensity fun x => ↑(AEMeasurable.mk f hf x))

tactic: constructor
state_before: case intro.intro
α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
⊢ SigmaFinite (μ.withDensity fun x => ↑(AEMeasurable.mk f hf x))
state_after: case intro.intro.out'
α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
⊢ Nonempty ((μ.withDensity fun x => ↑(AEMeasurable.mk f hf x)).FiniteSpanningSetsIn univ)

tactic: refine ⟨s, by simp, fun i ↦ ?_, h⟩
state_before: case intro.intro.out'
α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
⊢ Nonempty ((μ.withDensity fun x => ↑(AEMeasurable.mk f hf x)).FiniteSpanningSetsIn univ)
state_after: case intro.intro.out'
α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
⊢ (μ.withDensity fun x => ↑(AEMeasurable.mk f hf x)) (s i) < ⊤

tactic: rw [withDensity_apply _ (hs i).1]
state_before: case intro.intro.out'
α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
⊢ (μ.withDensity fun x => ↑(AEMeasurable.mk f hf x)) (s i) < ⊤
state_after: case intro.intro.out'
α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
⊢ ∫⁻ (a : α) in s i, ↑(AEMeasurable.mk f hf a) ∂μ < ⊤

tactic: calc ∫⁻ a in s i, ((hf.mk f a : ℝ≥0) : ℝ≥0∞) ∂μ
  ≤ ∫⁻ _ in s i, i ∂μ := by
      refine setLIntegral_mono hf.measurable_mk.coe_nnreal_ennreal
        measurable_const (fun x hxs ↦ ?_)
      norm_cast
      exact (hs i).2.2 x hxs
_ = i * μ (s i) := by rw [setLIntegral_const]
_ < ∞ := ENNReal.mul_lt_top (by simp) (hs i).2.1.ne
state_before: case intro.intro.out'
α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
⊢ ∫⁻ (a : α) in s i, ↑(AEMeasurable.mk f hf a) ∂μ < ⊤
state_after: no goals

tactic: filter_upwards [hf.ae_eq_mk] with x hx using by rw [hx]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
⊢ (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
state_after: no goals

tactic: rw [hx]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
x : α
hx : f x = AEMeasurable.mk f hf x
⊢ ↑(f x) = ↑(AEMeasurable.mk f hf x)
state_after: no goals

tactic: simp
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
⊢ ∀ (i : ℕ), s i ∈ univ
state_after: no goals

tactic: refine setLIntegral_mono hf.measurable_mk.coe_nnreal_ennreal
  measurable_const (fun x hxs ↦ ?_)
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
⊢ ∫⁻ (a : α) in s i, ↑(AEMeasurable.mk f hf a) ∂μ ≤ ∫⁻ (x : α) in s i, ↑i ∂μ
state_after: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
x : α
hxs : x ∈ s i
⊢ ↑(AEMeasurable.mk f hf x) ≤ ↑i

tactic: norm_cast
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
x : α
hxs : x ∈ s i
⊢ ↑(AEMeasurable.mk f hf x) ≤ ↑i
state_after: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
x : α
hxs : x ∈ s i
⊢ AEMeasurable.mk f hf x ≤ ↑i

tactic: exact (hs i).2.2 x hxs
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
x : α
hxs : x ∈ s i
⊢ AEMeasurable.mk f hf x ≤ ↑i
state_after: no goals

tactic: rw [setLIntegral_const]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
⊢ ∫⁻ (x : α) in s i, ↑i ∂μ = ↑i * μ (s i)
state_after: no goals

tactic: simp
state_before: α : Type u_1
m0 : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0
hf : AEMeasurable f μ
h✝ : (fun x => ↑(f x)) =ᶠ[ae μ] fun x => ↑(AEMeasurable.mk f hf x)
s : ℕ → Set α
hs : ∀ (n : ℕ), MeasurableSet (s n) ∧ μ (s n) < ⊤ ∧ ∀ x ∈ s n, AEMeasurable.mk f hf x ≤ ↑n
h : ⋃ i, s i = univ
i : ℕ
⊢ ↑i ≠ ⊤
state_after: no goals