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

tactic: have h₁ :
  (fun y => ENNReal.ofReal ((g - f) y)) =ᵐ[μ.restrict s] fun y =>
    ENNReal.ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y) :=
  (hg.ae_eq_mk.sub hf.ae_eq_mk).fun_comp ENNReal.ofReal
state_before: α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
⊢ ↑↑(Measure.prod μ volume) (regionBetween f g s) = ∫⁻ (y : α) in s, ofReal ((g - f) y) ∂μ

tactic: have h₂ :
  (μ.restrict s).prod volume (regionBetween f g s) =
    (μ.restrict s).prod volume
      (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s) := by
  apply measure_congr
  apply EventuallyEq.rfl.inter
  exact
    ((quasiMeasurePreserving_fst.ae_eq_comp hf.ae_eq_mk).comp₂ _ EventuallyEq.rfl).inter
      (EventuallyEq.rfl.comp₂ _ <| quasiMeasurePreserving_fst.ae_eq_comp hg.ae_eq_mk)
state_before: α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
⊢ ↑↑(Measure.prod μ volume) (regionBetween f g s) = ∫⁻ (y : α) in s, ofReal ((g - f) y) ∂μ

tactic: rw [lintegral_congr_ae h₁, ←
  volume_regionBetween_eq_lintegral' hf.measurable_mk hg.measurable_mk hs]
state_before: α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
h₂ :
  ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween f g s) =
    ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)
⊢ ↑↑(Measure.prod μ volume) (regionBetween f g s) = ∫⁻ (y : α) in s, ofReal ((g - f) y) ∂μ

tactic: convert h₂ using 1
state_before: α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
h₂ :
  ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween f g s) =
    ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)
⊢ ↑↑(Measure.prod μ volume) (regionBetween f g s) =
    ↑↑(Measure.prod μ volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)

tactic: apply measure_congr
state_before: α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
⊢ ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween f g s) =
    ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)

tactic: apply EventuallyEq.rfl.inter
state_before: case H
α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
⊢ regionBetween f g s =ᶠ[ae (Measure.prod (Measure.restrict μ s) volume)]
    regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s

tactic: exact
  ((quasiMeasurePreserving_fst.ae_eq_comp hf.ae_eq_mk).comp₂ _ EventuallyEq.rfl).inter
    (EventuallyEq.rfl.comp₂ _ <| quasiMeasurePreserving_fst.ae_eq_comp hg.ae_eq_mk)
state_before: case H
α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
⊢ (fun p => Ioo (f p.fst) (g p.fst) p.snd) =ᶠ[ae (Measure.prod (Measure.restrict μ s) volume)] fun p =>
    Ioo (AEMeasurable.mk f hf p.fst) (AEMeasurable.mk g hg p.fst) p.snd

tactic: rw [Measure.restrict_prod_eq_prod_univ]
state_before: case h.e'_2
α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
h₂ :
  ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween f g s) =
    ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)
⊢ ↑↑(Measure.prod μ volume) (regionBetween f g s) = ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween f g s)

tactic: exact (Measure.restrict_eq_self _ (regionBetween_subset f g s)).symm
state_before: case h.e'_2
α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
h₂ :
  ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween f g s) =
    ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)
⊢ ↑↑(Measure.prod μ volume) (regionBetween f g s) =
    ↑↑(Measure.restrict (Measure.prod μ volume) (s ×ˢ univ)) (regionBetween f g s)

tactic: rw [Measure.restrict_prod_eq_prod_univ]
state_before: case h.e'_3
α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
h₂ :
  ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween f g s) =
    ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)
⊢ ↑↑(Measure.prod μ volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s) =
    ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)

tactic: exact
  (Measure.restrict_eq_self _
      (regionBetween_subset (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)).symm
state_before: case h.e'_3
α : Type u_1
inst✝¹ : MeasurableSpace α
μ : MeasureTheory.Measure α
f g : α → ℝ
s : Set α
inst✝ : SigmaFinite μ
hf : AEMeasurable f
hg : AEMeasurable g
hs : MeasurableSet s
h₁ :
  (fun y => ofReal ((g - f) y)) =ᶠ[ae (Measure.restrict μ s)] fun y =>
    ofReal ((AEMeasurable.mk g hg - AEMeasurable.mk f hf) y)
h₂ :
  ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween f g s) =
    ↑↑(Measure.prod (Measure.restrict μ s) volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)
⊢ ↑↑(Measure.prod μ volume) (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s) =
    ↑↑(Measure.restrict (Measure.prod μ volume) (s ×ˢ univ))
      (regionBetween (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)