Theorem: MeasureTheory.sFinite_withDensity_of_sigmaFinite_of_measurable
File: Mathlib/MeasureTheory/Measure/WithDensity.lean

tactic: let s := {x | f x = ∞}
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
⊢ SFinite (μ.withDensity f)
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
⊢ SFinite (μ.withDensity f)

tactic: have hs : MeasurableSet s := hf (measurableSet_singleton _)
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
⊢ SFinite (μ.withDensity f)
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
⊢ SFinite (μ.withDensity f)

tactic: rw [← restrict_add_restrict_compl (μ := μ.withDensity f) hs, restrict_withDensity hs,
  restrict_withDensity hs.compl, ← withDensity_indicator hs, ← withDensity_indicator hs.compl]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
⊢ SFinite (μ.withDensity f)
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
⊢ SFinite (μ.withDensity (s.indicator f) + μ.withDensity (sᶜ.indicator f))

tactic: have h2 : SigmaFinite (μ.withDensity (sᶜ.indicator f)) := by
  refine SigmaFinite.withDensity_of_ne_top' (hf.indicator hs.compl).aemeasurable (fun x ↦ ?_)
  simp only [Set.indicator_apply, Set.mem_compl_iff, Set.mem_setOf_eq, ite_not, ne_eq, s]
  split_ifs with h <;> simp [h]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h1 : SFinite (μ.withDensity (s.indicator f))
⊢ SFinite (μ.withDensity (s.indicator f) + μ.withDensity (sᶜ.indicator f))
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h1 : SFinite (μ.withDensity (s.indicator f))
h2 : SigmaFinite (μ.withDensity (sᶜ.indicator f))
⊢ SFinite (μ.withDensity (s.indicator f) + μ.withDensity (sᶜ.indicator f))

tactic: infer_instance
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h1 : SFinite (μ.withDensity (s.indicator f))
h2 : SigmaFinite (μ.withDensity (sᶜ.indicator f))
⊢ SFinite (μ.withDensity (s.indicator f) + μ.withDensity (sᶜ.indicator f))
state_after: no goals

tactic: rw [h_eq_sum, withDensity_tsum (fun _ ↦ measurable_one.indicator hs)]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
⊢ SFinite (μ.withDensity (s.indicator f))
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
⊢ SFinite (sum fun n => μ.withDensity (s.indicator 1))

tactic: have : SigmaFinite (μ.withDensity (s.indicator 1)) := by
  refine SigmaFinite.withDensity_of_ne_top' (measurable_one.indicator hs).aemeasurable
    (fun x ↦ ?_)
  simp only [Set.indicator_apply, Pi.one_apply, ne_eq]
  split_ifs with h <;> simp [h]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
⊢ SFinite (sum fun n => μ.withDensity (s.indicator 1))
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
this : SigmaFinite (μ.withDensity (s.indicator 1))
⊢ SFinite (sum fun n => μ.withDensity (s.indicator 1))

tactic: infer_instance
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
this : SigmaFinite (μ.withDensity (s.indicator 1))
⊢ SFinite (sum fun n => μ.withDensity (s.indicator 1))
state_after: no goals

tactic: ext x
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
⊢ s.indicator f = ∑' (n : ℕ), s.indicator 1
state_after: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ s.indicator f x = tsum (fun n => s.indicator 1) x

tactic: rw [tsum_apply]
state_before: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ s.indicator f x = tsum (fun n => s.indicator 1) x
state_after: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ s.indicator f x = ∑' (i : ℕ), s.indicator 1 x

case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ Summable fun n => s.indicator 1

tactic: swap
state_before: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ s.indicator f x = ∑' (i : ℕ), s.indicator 1 x

case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ Summable fun n => s.indicator 1
state_after: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ Summable fun n => s.indicator 1

case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ s.indicator f x = ∑' (i : ℕ), s.indicator 1 x

tactic: simp_rw [Set.indicator_apply]
state_before: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ s.indicator f x = ∑' (i : ℕ), s.indicator 1 x
state_after: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ (if x ∈ s then f x else 0) = ∑' (i : ℕ), if x ∈ s then 1 x else 0

tactic: split_ifs with hx
state_before: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ (if x ∈ s then f x else 0) = ∑' (i : ℕ), if x ∈ s then 1 x else 0
state_after: case pos
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
hx : x ∈ s
⊢ f x = ∑' (i : ℕ), 1 x

case neg
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
hx : x ∉ s
⊢ 0 = ∑' (i : ℕ), 0

tactic: rw [Pi.summable]
state_before: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ Summable fun n => s.indicator 1
state_after: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ ∀ (x : α), Summable fun i => s.indicator 1 x

tactic: exact fun _ ↦ ENNReal.summable
state_before: case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
⊢ ∀ (x : α), Summable fun i => s.indicator 1 x
state_after: no goals

tactic: simp only [Set.mem_setOf_eq, s] at hx
state_before: case pos
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
hx : x ∈ s
⊢ f x = ∑' (i : ℕ), 1 x
state_after: case pos
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
hx : f x = ⊤
⊢ f x = ∑' (i : ℕ), 1 x

tactic: simp [hx, ENNReal.tsum_const_eq_top_of_ne_zero]
state_before: case pos
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
hx : f x = ⊤
⊢ f x = ∑' (i : ℕ), 1 x
state_after: no goals

tactic: simp
state_before: case neg
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
x : α
hx : x ∉ s
⊢ 0 = ∑' (i : ℕ), 0
state_after: no goals

tactic: refine SigmaFinite.withDensity_of_ne_top' (measurable_one.indicator hs).aemeasurable
  (fun x ↦ ?_)
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
⊢ SigmaFinite (μ.withDensity (s.indicator 1))
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
x : α
⊢ s.indicator 1 x ≠ ⊤

tactic: simp only [Set.indicator_apply, Pi.one_apply, ne_eq]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
x : α
⊢ s.indicator 1 x ≠ ⊤
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
x : α
⊢ ¬(if x ∈ s then 1 else 0) = ⊤

tactic: split_ifs with h <;> simp [h]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h_eq_sum : s.indicator f = ∑' (n : ℕ), s.indicator 1
x : α
⊢ ¬(if x ∈ s then 1 else 0) = ⊤
state_after: no goals

tactic: refine SigmaFinite.withDensity_of_ne_top' (hf.indicator hs.compl).aemeasurable (fun x ↦ ?_)
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h1 : SFinite (μ.withDensity (s.indicator f))
⊢ SigmaFinite (μ.withDensity (sᶜ.indicator f))
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h1 : SFinite (μ.withDensity (s.indicator f))
x : α
⊢ sᶜ.indicator f x ≠ ⊤

tactic: simp only [Set.indicator_apply, Set.mem_compl_iff, Set.mem_setOf_eq, ite_not, ne_eq, s]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h1 : SFinite (μ.withDensity (s.indicator f))
x : α
⊢ sᶜ.indicator f x ≠ ⊤
state_after: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h1 : SFinite (μ.withDensity (s.indicator f))
x : α
⊢ ¬(if f x = ⊤ then 0 else f x) = ⊤

tactic: split_ifs with h <;> simp [h]
state_before: α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SigmaFinite μ
f : α → ℝ≥0∞
hf : Measurable f
s : Set α := {x | f x = ⊤}
hs : MeasurableSet s
h1 : SFinite (μ.withDensity (s.indicator f))
x : α
⊢ ¬(if f x = ⊤ then 0 else f x) = ⊤
state_after: no goals