Theorem: volume_regionBetween_eq_lintegral'
File: Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean

tactic: rw [Measure.prod_apply]
state_before: α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
⊢ ↑↑(Measure.prod μ volume) (regionBetween f g s) = ∫⁻ (y : α) in s, ofReal ((g - f) y) ∂μ

tactic: dsimp only [regionBetween, preimage_setOf_eq]
state_before: α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
h : (fun x => ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)}) = indicator s fun x => ofReal (g x - f x)
⊢ (∫⁻ (x : α), ↑↑volume (Prod.mk x ⁻¹' regionBetween f g s) ∂μ) = ∫⁻ (y : α) in s, ofReal ((g - f) y) ∂μ

tactic: rw [h, lintegral_indicator] <;> simp only [hs, Pi.sub_apply]
state_before: α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
h : (fun x => ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)}) = indicator s fun x => ofReal (g x - f x)
⊢ (∫⁻ (x : α), ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} ∂μ) = ∫⁻ (y : α) in s, ofReal ((g - f) y) ∂μ

tactic: funext x
state_before: α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
⊢ (fun x => ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)}) = indicator s fun x => ofReal (g x - f x)

tactic: rw [indicator_apply]
state_before: case h
α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
x : α
⊢ ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = indicator s (fun x => ofReal (g x - f x)) x

tactic: split_ifs with h
state_before: case h
α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
x : α
⊢ ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = if x ∈ s then ofReal (g x - f x) else 0

tactic: have hx : { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) } = Ioo (f x) (g x) := by simp [h, Ioo]
state_before: case h.inl
α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
x : α
h : x ∈ s
⊢ ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = ofReal (g x - f x)

tactic: simp only [hx, Real.volume_Ioo, sub_zero]
state_before: case h.inl
α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
x : α
h : x ∈ s
hx : {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = Ioo (f x) (g x)
⊢ ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = ofReal (g x - f x)

tactic: simp [h, Ioo]
state_before: α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
x : α
h : x ∈ s
⊢ {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = Ioo (f x) (g x)

tactic: have hx : { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) } = ∅ := by simp [h]
state_before: case h.inr
α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
x : α
h : ¬x ∈ s
⊢ ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = 0

tactic: simp only [hx, measure_empty]
state_before: case h.inr
α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
x : α
h : ¬x ∈ s
hx : {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = ∅
⊢ ↑↑volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = 0

tactic: simp [h]
state_before: α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
x : α
h : ¬x ∈ s
⊢ {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = ∅

tactic: exact measurableSet_regionBetween hf hg hs
state_before: α : Type u_1
inst✝ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
hf : Measurable f
hg : Measurable g
hs : MeasurableSet s
⊢ MeasurableSet (regionBetween f g s)