l3lab/ntp-mathlib huggingface dataset:
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    

Proof state:
case refine_2.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
⊢ ∫⁻ (a : α) in s, f a ∂μ = ∫⁻ (a : α) in s, f a * rnDeriv μ ν a ∂ν

Next tactic:
conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    conv_lhs => 

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
| ∫⁻ (a : α) in s, f a ∂μ

Next tactic:
rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
    

Proof state:
case refine_2.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
⊢ ∫⁻ (a : α) in s, f a ∂withDensity ν (rnDeriv μ ν) = ∫⁻ (a : α) in s, f a * rnDeriv μ ν a ∂ν

Next tactic:
rw [set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀ _ _ _ hs]
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
    rw [set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀ _ _ _ hs]
    · 

Proof state:
case refine_2.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
⊢ ∫⁻ (a : α) in s, (rnDeriv μ ν * fun a => f a) a ∂ν = ∫⁻ (a : α) in s, f a * rnDeriv μ ν a ∂ν

Next tactic:
congr with x
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
    rw [set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀ _ _ _ hs]
    · congr with x
      

Proof state:
case refine_2.h.e_f.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
x : α
⊢ (rnDeriv μ ν * fun a => f a) x = f x * rnDeriv μ ν x

Next tactic:
rw [mul_comm]
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
    rw [set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀ _ _ _ hs]
    · congr with x
      rw [mul_comm]
      

Proof state:
case refine_2.h.e_f.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
x : α
⊢ ((fun a => f a) * rnDeriv μ ν) x = f x * rnDeriv μ ν x

Next tactic:
simp only [Pi.mul_apply]
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
    rw [set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀ _ _ _ hs]
    · congr with x
      rw [mul_comm]
      simp only [Pi.mul_apply]
    · 

Proof state:
case refine_2.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
⊢ ∀ᵐ (x : α) ∂restrict ν s, rnDeriv μ ν x < ⊤

Next tactic:
refine ae_restrict_of_ae ?_
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
    rw [set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀ _ _ _ hs]
    · congr with x
      rw [mul_comm]
      simp only [Pi.mul_apply]
    · refine ae_restrict_of_ae ?_
      

Proof state:
case refine_2.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
⊢ ∀ᵐ (x : α) ∂ν, rnDeriv μ ν x < ⊤

Next tactic:
exact Measure.rnDeriv_lt_top _ _
lemma rnDeriv_withDensity_left_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  refine (Measure.eq_rnDeriv₀ ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact hf.mul (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    rw [zero_add, withDensity_apply _ hs, withDensity_apply _ hs]
    conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
    rw [set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀ _ _ _ hs]
    · congr with x
      rw [mul_comm]
      simp only [Pi.mul_apply]
    · refine ae_restrict_of_ae ?_
      exact Measure.rnDeriv_lt_top _ _
    · 

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
s : Set α
hs : MeasurableSet s
⊢ AEMeasurable (rnDeriv μ ν)

Next tactic:
exact (Measure.measurable_rnDeriv _ _).aemeasurable
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
    (hfμ : AEMeasurable f μ) (hfν : AEMeasurable f ν)
    (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝¹ ν✝¹ μ✝ ν✝ : Measure α
f : α → ℝ≥0∞
μ ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hfμ : AEMeasurable f
hfν : AEMeasurable f
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
⊢ rnDeriv (withDensity μ f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ ν x

Next tactic:
let μ' := ν.withDensity (μ.rnDeriv ν)
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
    (hfμ : AEMeasurable f μ) (hfν : AEMeasurable f ν)
    (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  let μ' := ν.withDensity (μ.rnDeriv ν)
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝¹ ν✝¹ μ✝ ν✝ : Measure α
f : α → ℝ≥0∞
μ ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hfμ : AEMeasurable f
hfν : AEMeasurable f
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
μ' : Measure α := withDensity ν (rnDeriv μ ν)
⊢ rnDeriv (withDensity μ f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ ν x

Next tactic:
have hμ'ν : μ' ≪ ν := withDensity_absolutelyContinuous _ _
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
    (hfμ : AEMeasurable f μ) (hfν : AEMeasurable f ν)
    (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  let μ' := ν.withDensity (μ.rnDeriv ν)
  have hμ'ν : μ' ≪ ν := withDensity_absolutelyContinuous _ _
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝¹ ν✝¹ μ✝ ν✝ : Measure α
f : α → ℝ≥0∞
μ ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hfμ : AEMeasurable f
hfν : AEMeasurable f
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
μ' : Measure α := withDensity ν (rnDeriv μ ν)
hμ'ν : μ' ≪ ν
⊢ rnDeriv (withDensity μ f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ ν x

Next tactic:
have h := rnDeriv_withDensity_left_of_absolutelyContinuous hμ'ν hfν
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
    (hfμ : AEMeasurable f μ) (hfν : AEMeasurable f ν)
    (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  let μ' := ν.withDensity (μ.rnDeriv ν)
  have hμ'ν : μ' ≪ ν := withDensity_absolutelyContinuous _ _
  have h := rnDeriv_withDensity_left_of_absolutelyContinuous hμ'ν hfν
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝¹ ν✝¹ μ✝ ν✝ : Measure α
f : α → ℝ≥0∞
μ ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hfμ : AEMeasurable f
hfν : AEMeasurable f
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
μ' : Measure α := withDensity ν (rnDeriv μ ν)
hμ'ν : μ' ≪ ν
h : rnDeriv (withDensity μ' f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ' ν x
⊢ rnDeriv (withDensity μ f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ ν x

Next tactic:
have h1 : μ'.rnDeriv ν =ᵐ[ν] μ.rnDeriv ν :=
    Measure.rnDeriv_withDensity _ (Measure.measurable_rnDeriv _ _)
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
    (hfμ : AEMeasurable f μ) (hfν : AEMeasurable f ν)
    (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  let μ' := ν.withDensity (μ.rnDeriv ν)
  have hμ'ν : μ' ≪ ν := withDensity_absolutelyContinuous _ _
  have h := rnDeriv_withDensity_left_of_absolutelyContinuous hμ'ν hfν
  have h1 : μ'.rnDeriv ν =ᵐ[ν] μ.rnDeriv ν :=
    Measure.rnDeriv_withDensity _ (Measure.measurable_rnDeriv _ _)
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝¹ ν✝¹ μ✝ ν✝ : Measure α
f : α → ℝ≥0∞
μ ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hfμ : AEMeasurable f
hfν : AEMeasurable f
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
μ' : Measure α := withDensity ν (rnDeriv μ ν)
hμ'ν : μ' ≪ ν
h : rnDeriv (withDensity μ' f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ' ν x
h1 : rnDeriv μ' ν =ᶠ[ae ν] rnDeriv μ ν
⊢ rnDeriv (withDensity μ f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ ν x

Next tactic:
have h2 : (μ'.withDensity f).rnDeriv ν =ᵐ[ν] (μ.withDensity f).rnDeriv ν := by
    exact rnDeriv_withDensity_withDensity_rnDeriv_left μ ν hfμ hf_ne_top
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
    (hfμ : AEMeasurable f μ) (hfν : AEMeasurable f ν)
    (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  let μ' := ν.withDensity (μ.rnDeriv ν)
  have hμ'ν : μ' ≪ ν := withDensity_absolutelyContinuous _ _
  have h := rnDeriv_withDensity_left_of_absolutelyContinuous hμ'ν hfν
  have h1 : μ'.rnDeriv ν =ᵐ[ν] μ.rnDeriv ν :=
    Measure.rnDeriv_withDensity _ (Measure.measurable_rnDeriv _ _)
  have h2 : (μ'.withDensity f).rnDeriv ν =ᵐ[ν] (μ.withDensity f).rnDeriv ν := by
    

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝¹ ν✝¹ μ✝ ν✝ : Measure α
f : α → ℝ≥0∞
μ ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hfμ : AEMeasurable f
hfν : AEMeasurable f
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
μ' : Measure α := withDensity ν (rnDeriv μ ν)
hμ'ν : μ' ≪ ν
h : rnDeriv (withDensity μ' f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ' ν x
h1 : rnDeriv μ' ν =ᶠ[ae ν] rnDeriv μ ν
⊢ rnDeriv (withDensity μ' f) ν =ᶠ[ae ν] rnDeriv (withDensity μ f) ν

Next tactic:
exact rnDeriv_withDensity_withDensity_rnDeriv_left μ ν hfμ hf_ne_top
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
    (hfμ : AEMeasurable f μ) (hfν : AEMeasurable f ν)
    (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  let μ' := ν.withDensity (μ.rnDeriv ν)
  have hμ'ν : μ' ≪ ν := withDensity_absolutelyContinuous _ _
  have h := rnDeriv_withDensity_left_of_absolutelyContinuous hμ'ν hfν
  have h1 : μ'.rnDeriv ν =ᵐ[ν] μ.rnDeriv ν :=
    Measure.rnDeriv_withDensity _ (Measure.measurable_rnDeriv _ _)
  have h2 : (μ'.withDensity f).rnDeriv ν =ᵐ[ν] (μ.withDensity f).rnDeriv ν := by
    exact rnDeriv_withDensity_withDensity_rnDeriv_left μ ν hfμ hf_ne_top
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝¹ ν✝¹ μ✝ ν✝ : Measure α
f : α → ℝ≥0∞
μ ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hfμ : AEMeasurable f
hfν : AEMeasurable f
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
μ' : Measure α := withDensity ν (rnDeriv μ ν)
hμ'ν : μ' ≪ ν
h : rnDeriv (withDensity μ' f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ' ν x
h1 : rnDeriv μ' ν =ᶠ[ae ν] rnDeriv μ ν
h2 : rnDeriv (withDensity μ' f) ν =ᶠ[ae ν] rnDeriv (withDensity μ f) ν
⊢ rnDeriv (withDensity μ f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ ν x

Next tactic:
filter_upwards [h, h1, h2] with x hx hx1 hx2
lemma rnDeriv_withDensity_left {μ ν : Measure α} [SigmaFinite μ] [SigmaFinite ν]
    (hfμ : AEMeasurable f μ) (hfν : AEMeasurable f ν)
    (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).rnDeriv ν =ᵐ[ν] fun x ↦ f x * μ.rnDeriv ν x := by
  let μ' := ν.withDensity (μ.rnDeriv ν)
  have hμ'ν : μ' ≪ ν := withDensity_absolutelyContinuous _ _
  have h := rnDeriv_withDensity_left_of_absolutelyContinuous hμ'ν hfν
  have h1 : μ'.rnDeriv ν =ᵐ[ν] μ.rnDeriv ν :=
    Measure.rnDeriv_withDensity _ (Measure.measurable_rnDeriv _ _)
  have h2 : (μ'.withDensity f).rnDeriv ν =ᵐ[ν] (μ.withDensity f).rnDeriv ν := by
    exact rnDeriv_withDensity_withDensity_rnDeriv_left μ ν hfμ hf_ne_top
  filter_upwards [h, h1, h2] with x hx hx1 hx2
  

Proof state:
case h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝¹ ν✝¹ μ✝ ν✝ : Measure α
f : α → ℝ≥0∞
μ ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hfμ : AEMeasurable f
hfν : AEMeasurable f
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
μ' : Measure α := withDensity ν (rnDeriv μ ν)
hμ'ν : μ' ≪ ν
h : rnDeriv (withDensity μ' f) ν =ᶠ[ae ν] fun x => f x * rnDeriv μ' ν x
h1 : rnDeriv μ' ν =ᶠ[ae ν] rnDeriv μ ν
h2 : rnDeriv (withDensity μ' f) ν =ᶠ[ae ν] rnDeriv (withDensity μ f) ν
x : α
hx : rnDeriv (withDensity μ' f) ν x = f x * rnDeriv μ' ν x
hx1 : rnDeriv μ' ν x = rnDeriv μ ν x
hx2 : rnDeriv (withDensity μ' f) ν x = rnDeriv (withDensity μ f) ν x
⊢ rnDeriv (withDensity μ f) ν x = f x * rnDeriv μ ν x

Next tactic:
rw [← hx2, hx, hx1]
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_right_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν)
    (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
    μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂ν, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂ν, f x ≠ ⊤
⊢ rnDeriv μ (withDensity ν f) =ᶠ[ae ν] fun x => (f x)⁻¹ * rnDeriv μ ν x

Next tactic:
have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf hf_ne_top
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_right_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν)
    (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
    μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
  have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf hf_ne_top
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂ν, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂ν, f x ≠ ⊤
this : SigmaFinite (withDensity ν f)
⊢ rnDeriv μ (withDensity ν f) =ᶠ[ae ν] fun x => (f x)⁻¹ * rnDeriv μ ν x

Next tactic:
refine (withDensity_absolutelyContinuous' hf hf_ne_zero hf_ne_top).ae_eq ?_
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_right_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν)
    (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
    μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
  have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf hf_ne_top
  refine (withDensity_absolutelyContinuous' hf hf_ne_zero hf_ne_top).ae_eq ?_
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂ν, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂ν, f x ≠ ⊤
this : SigmaFinite (withDensity ν f)
⊢ rnDeriv μ (withDensity ν f) =ᶠ[ae (withDensity ν f)] fun x => (f x)⁻¹ * rnDeriv μ ν x

Next tactic:
refine (Measure.eq_rnDeriv₀ (ν := ν.withDensity f) ?_ Measure.MutuallySingular.zero_left ?_).symm
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_right_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν)
    (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
    μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
  have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf hf_ne_top
  refine (withDensity_absolutelyContinuous' hf hf_ne_zero hf_ne_top).ae_eq ?_
  refine (Measure.eq_rnDeriv₀ (ν := ν.withDensity f) ?_ Measure.MutuallySingular.zero_left ?_).symm
  · 

Proof state:
case refine_1
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂ν, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂ν, f x ≠ ⊤
this : SigmaFinite (withDensity ν f)
⊢ AEMeasurable fun x => (f x)⁻¹ * rnDeriv μ ν x

Next tactic:
exact (hf.inv.mono_ac (withDensity_absolutelyContinuous _ _)).mul
      (Measure.measurable_rnDeriv _ _).aemeasurable
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_right_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν)
    (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
    μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
  have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf hf_ne_top
  refine (withDensity_absolutelyContinuous' hf hf_ne_zero hf_ne_top).ae_eq ?_
  refine (Measure.eq_rnDeriv₀ (ν := ν.withDensity f) ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact (hf.inv.mono_ac (withDensity_absolutelyContinuous _ _)).mul
      (Measure.measurable_rnDeriv _ _).aemeasurable
  · 

Proof state:
case refine_2
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂ν, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂ν, f x ≠ ⊤
this : SigmaFinite (withDensity ν f)
⊢ μ = 0 + withDensity (withDensity ν f) fun x => (f x)⁻¹ * rnDeriv μ ν x

Next tactic:
ext1 s hs
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_right_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν)
    (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
    μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
  have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf hf_ne_top
  refine (withDensity_absolutelyContinuous' hf hf_ne_zero hf_ne_top).ae_eq ?_
  refine (Measure.eq_rnDeriv₀ (ν := ν.withDensity f) ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact (hf.inv.mono_ac (withDensity_absolutelyContinuous _ _)).mul
      (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    

Proof state:
case refine_2.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂ν, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂ν, f x ≠ ⊤
this : SigmaFinite (withDensity ν f)
s : Set α
hs : MeasurableSet s
⊢ ↑↑μ s = ↑↑(0 + withDensity (withDensity ν f) fun x => (f x)⁻¹ * rnDeriv μ ν x) s

Next tactic:
conv_lhs => rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]
/-- Auxiliary lemma for `rnDeriv_withDensity_right`. -/
lemma rnDeriv_withDensity_right_of_absolutelyContinuous {ν : Measure α} [SigmaFinite μ]
    [SigmaFinite ν] (hμν : μ ≪ ν) (hf : AEMeasurable f ν)
    (hf_ne_zero : ∀ᵐ x ∂ν, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂ν, f x ≠ ∞) :
    μ.rnDeriv (ν.withDensity f) =ᵐ[ν] fun x ↦ (f x)⁻¹ * μ.rnDeriv ν x := by
  have : SigmaFinite (ν.withDensity f) := SigmaFinite.withDensity_of_ne_top hf hf_ne_top
  refine (withDensity_absolutelyContinuous' hf hf_ne_zero hf_ne_top).ae_eq ?_
  refine (Measure.eq_rnDeriv₀ (ν := ν.withDensity f) ?_ Measure.MutuallySingular.zero_left ?_).symm
  · exact (hf.inv.mono_ac (withDensity_absolutelyContinuous _ _)).mul
      (Measure.measurable_rnDeriv _ _).aemeasurable
  · ext1 s hs
    conv_lhs => 

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝¹ μ ν✝ : Measure α
f : α → ℝ≥0∞
ν : Measure α
inst✝¹ : SigmaFinite μ
inst✝ : SigmaFinite ν
hμν : μ ≪ ν
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂ν, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂ν, f x ≠ ⊤
this : SigmaFinite (withDensity ν f)
s : Set α
hs : MeasurableSet s
| ↑↑μ s

Next tactic:
rw [← Measure.withDensity_rnDeriv_eq _ _ hμν]