l3lab/ntp-mathlib huggingface dataset:
theorem lintegral_withDensity_eq_lintegral_mul_non_measurable₀ (μ : Measure α) {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (h'f : ∀ᵐ x ∂μ, f x < ∞) (g : α → ℝ≥0∞) :
    ∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, (f * g) a ∂μ := by
  let f' := hf.mk f
  calc
    ∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, g a ∂μ.withDensity f' := by
      rw [withDensity_congr_ae hf.ae_eq_mk]
    _ = ∫⁻ a, (f' * g) a ∂μ := by
      apply lintegral_withDensity_eq_lintegral_mul_non_measurable _ hf.measurable_mk
      filter_upwards [h'f, hf.ae_eq_mk]
      intro x hx h'x
      rwa [← h'x]
    _ = ∫⁻ a, (f * g) a ∂μ := by
      apply lintegral_congr_ae
      filter_upwards [hf.ae_eq_mk]
      

Proof state:
case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
h'f : ∀ᵐ (x : α) ∂μ, f x < ⊤
g : α → ℝ≥0∞
f' : α → ℝ≥0∞ := AEMeasurable.mk f hf
⊢ ∀ (a : α), f a = AEMeasurable.mk f hf a → (f' * g) a = (f * g) a

Next tactic:
intro x hx
theorem lintegral_withDensity_eq_lintegral_mul_non_measurable₀ (μ : Measure α) {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (h'f : ∀ᵐ x ∂μ, f x < ∞) (g : α → ℝ≥0∞) :
    ∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, (f * g) a ∂μ := by
  let f' := hf.mk f
  calc
    ∫⁻ a, g a ∂μ.withDensity f = ∫⁻ a, g a ∂μ.withDensity f' := by
      rw [withDensity_congr_ae hf.ae_eq_mk]
    _ = ∫⁻ a, (f' * g) a ∂μ := by
      apply lintegral_withDensity_eq_lintegral_mul_non_measurable _ hf.measurable_mk
      filter_upwards [h'f, hf.ae_eq_mk]
      intro x hx h'x
      rwa [← h'x]
    _ = ∫⁻ a, (f * g) a ∂μ := by
      apply lintegral_congr_ae
      filter_upwards [hf.ae_eq_mk]
      intro x hx
      

Proof state:
case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
h'f : ∀ᵐ (x : α) ∂μ, f x < ⊤
g : α → ℝ≥0∞
f' : α → ℝ≥0∞ := AEMeasurable.mk f hf
x : α
hx : f x = AEMeasurable.mk f hf x
⊢ (f' * g) x = (f * g) x

Next tactic:
simp only [hx, Pi.mul_apply]
theorem set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀ (μ : Measure α)
    {f : α → ℝ≥0∞} {s : Set α} (hf : AEMeasurable f (μ.restrict s)) (g : α → ℝ≥0∞)
    (hs : MeasurableSet s) (h'f : ∀ᵐ x ∂μ.restrict s, f x < ∞) :
    ∫⁻ a in s, g a ∂μ.withDensity f = ∫⁻ a in s, (f * g) a ∂μ := by
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
s : Set α
hf : AEMeasurable f
g : α → ℝ≥0∞
hs : MeasurableSet s
h'f : ∀ᵐ (x : α) ∂Measure.restrict μ s, f x < ⊤
⊢ ∫⁻ (a : α) in s, g a ∂withDensity μ f = ∫⁻ (a : α) in s, (f * g) a ∂μ

Next tactic:
rw [restrict_withDensity hs, lintegral_withDensity_eq_lintegral_mul_non_measurable₀ _ hf h'f]
theorem set_lintegral_withDensity_eq_set_lintegral_mul_non_measurable₀' (μ : Measure α) [SFinite μ]
    {f : α → ℝ≥0∞} (s : Set α) (hf : AEMeasurable f (μ.restrict s)) (g : α → ℝ≥0∞)
    (h'f : ∀ᵐ x ∂μ.restrict s, f x < ∞) :
    ∫⁻ a in s, g a ∂μ.withDensity f = ∫⁻ a in s, (f * g) a ∂μ := by
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
inst✝ : SFinite μ
f : α → ℝ≥0∞
s : Set α
hf : AEMeasurable f
g : α → ℝ≥0∞
h'f : ∀ᵐ (x : α) ∂Measure.restrict μ s, f x < ⊤
⊢ ∫⁻ (a : α) in s, g a ∂withDensity μ f = ∫⁻ (a : α) in s, (f * g) a ∂μ

Next tactic:
rw [restrict_withDensity' s, lintegral_withDensity_eq_lintegral_mul_non_measurable₀ _ hf h'f]
theorem withDensity_mul₀ {μ : Measure α} {f g : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    μ.withDensity (f * g) = (μ.withDensity f).withDensity g := by
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f g : α → ℝ≥0∞
hf : AEMeasurable f
hg : AEMeasurable g
⊢ withDensity μ (f * g) = withDensity (withDensity μ f) g

Next tactic:
ext1 s hs
theorem withDensity_mul₀ {μ : Measure α} {f g : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    μ.withDensity (f * g) = (μ.withDensity f).withDensity g := by
  ext1 s hs
  

Proof state:
case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f g : α → ℝ≥0∞
hf : AEMeasurable f
hg : AEMeasurable g
s : Set α
hs : MeasurableSet s
⊢ ↑↑(withDensity μ (f * g)) s = ↑↑(withDensity (withDensity μ f) g) s

Next tactic:
rw [withDensity_apply _ hs, withDensity_apply _ hs, restrict_withDensity hs,
    lintegral_withDensity_eq_lintegral_mul₀ hf.restrict hg.restrict]
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
⊢ withDensity (withDensity μ f) f⁻¹ ≤ μ

Next tactic:
change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
⊢ (withDensity (withDensity μ f) fun x => (f x)⁻¹) ≤ μ

Next tactic:
rw [← withDensity_mul₀ hf hf.inv]
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
⊢ withDensity μ (f * fun x => (f x)⁻¹) ≤ μ

Next tactic:
suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    rw [withDensity_one]
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
this : (f * fun x => (f x)⁻¹) ≤ᶠ[ae μ] 1
⊢ withDensity μ (f * fun x => (f x)⁻¹) ≤ μ

Next tactic:
refine (withDensity_mono this).trans ?_
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
this : (f * fun x => (f x)⁻¹) ≤ᶠ[ae μ] 1
⊢ withDensity μ 1 ≤ μ

Next tactic:
rw [withDensity_one]
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    rw [withDensity_one]
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
⊢ (f * fun x => (f x)⁻¹) ≤ᶠ[ae μ] 1

Next tactic:
refine ae_of_all _ (fun x ↦ ?_)
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    rw [withDensity_one]
  refine ae_of_all _ (fun x ↦ ?_)
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
x : α
⊢ (f * fun x => (f x)⁻¹) x ≤ OfNat.ofNat 1 x

Next tactic:
simp only [Pi.mul_apply, Pi.one_apply]
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    rw [withDensity_one]
  refine ae_of_all _ (fun x ↦ ?_)
  simp only [Pi.mul_apply, Pi.one_apply]
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
x : α
⊢ f x * (f x)⁻¹ ≤ 1

Next tactic:
by_cases hx_top : f x = ∞
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    rw [withDensity_one]
  refine ae_of_all _ (fun x ↦ ?_)
  simp only [Pi.mul_apply, Pi.one_apply]
  by_cases hx_top : f x = ∞
  · 

Proof state:
case pos
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
x : α
hx_top : f x = ⊤
⊢ f x * (f x)⁻¹ ≤ 1

Next tactic:
simp only [hx_top, ENNReal.inv_top, mul_zero, zero_le]
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    rw [withDensity_one]
  refine ae_of_all _ (fun x ↦ ?_)
  simp only [Pi.mul_apply, Pi.one_apply]
  by_cases hx_top : f x = ∞
  · simp only [hx_top, ENNReal.inv_top, mul_zero, zero_le]
  

Proof state:
case neg
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
x : α
hx_top : ¬f x = ⊤
⊢ f x * (f x)⁻¹ ≤ 1

Next tactic:
by_cases hx_zero : f x = 0
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    rw [withDensity_one]
  refine ae_of_all _ (fun x ↦ ?_)
  simp only [Pi.mul_apply, Pi.one_apply]
  by_cases hx_top : f x = ∞
  · simp only [hx_top, ENNReal.inv_top, mul_zero, zero_le]
  by_cases hx_zero : f x = 0
  · 

Proof state:
case pos
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
x : α
hx_top : ¬f x = ⊤
hx_zero : f x = 0
⊢ f x * (f x)⁻¹ ≤ 1

Next tactic:
simp only [hx_zero, ENNReal.inv_zero, zero_mul, zero_le]
lemma withDensity_inv_same_le {μ : Measure α} {f : α → ℝ≥0∞} (hf : AEMeasurable f μ) :
    (μ.withDensity f).withDensity f⁻¹ ≤ μ := by
  change (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≤ μ
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) ≤ᵐ[μ] 1 by
    refine (withDensity_mono this).trans ?_
    rw [withDensity_one]
  refine ae_of_all _ (fun x ↦ ?_)
  simp only [Pi.mul_apply, Pi.one_apply]
  by_cases hx_top : f x = ∞
  · simp only [hx_top, ENNReal.inv_top, mul_zero, zero_le]
  by_cases hx_zero : f x = 0
  · simp only [hx_zero, ENNReal.inv_zero, zero_mul, zero_le]
  

Proof state:
case neg
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
x : α
hx_top : ¬f x = ⊤
hx_zero : ¬f x = 0
⊢ f x * (f x)⁻¹ ≤ 1

Next tactic:
rw [ENNReal.mul_inv_cancel hx_zero hx_top]
lemma withDensity_inv_same₀ {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) = μ := by
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
⊢ (withDensity (withDensity μ f) fun x => (f x)⁻¹) = μ

Next tactic:
rw [← withDensity_mul₀ hf hf.inv]
lemma withDensity_inv_same₀ {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) = μ := by
  rw [← withDensity_mul₀ hf hf.inv]
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
⊢ withDensity μ (f * fun x => (f x)⁻¹) = μ

Next tactic:
suffices (f * fun x ↦ (f x)⁻¹) =ᵐ[μ] 1 by
    rw [withDensity_congr_ae this, withDensity_one]
lemma withDensity_inv_same₀ {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) = μ := by
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) =ᵐ[μ] 1 by
    

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
this : (f * fun x => (f x)⁻¹) =ᶠ[ae μ] 1
⊢ withDensity μ (f * fun x => (f x)⁻¹) = μ

Next tactic:
rw [withDensity_congr_ae this, withDensity_one]
lemma withDensity_inv_same₀ {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) = μ := by
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) =ᵐ[μ] 1 by
    rw [withDensity_congr_ae this, withDensity_one]
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
⊢ (f * fun x => (f x)⁻¹) =ᶠ[ae μ] 1

Next tactic:
filter_upwards [hf_ne_zero, hf_ne_top] with x hf_ne_zero hf_ne_top
lemma withDensity_inv_same₀ {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) = μ := by
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) =ᵐ[μ] 1 by
    rw [withDensity_congr_ae this, withDensity_one]
  filter_upwards [hf_ne_zero, hf_ne_top] with x hf_ne_zero hf_ne_top
  

Proof state:
case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero✝ : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top✝ : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
x : α
hf_ne_zero : f x ≠ 0
hf_ne_top : f x ≠ ⊤
⊢ (f * fun x => (f x)⁻¹) x = OfNat.ofNat 1 x

Next tactic:
simp only [Pi.mul_apply]
lemma withDensity_inv_same₀ {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) = μ := by
  rw [← withDensity_mul₀ hf hf.inv]
  suffices (f * fun x ↦ (f x)⁻¹) =ᵐ[μ] 1 by
    rw [withDensity_congr_ae this, withDensity_one]
  filter_upwards [hf_ne_zero, hf_ne_top] with x hf_ne_zero hf_ne_top
  simp only [Pi.mul_apply]
  

Proof state:
case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero✝ : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top✝ : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
x : α
hf_ne_zero : f x ≠ 0
hf_ne_top : f x ≠ ⊤
⊢ f x * (f x)⁻¹ = OfNat.ofNat 1 x

Next tactic:
rw [ENNReal.mul_inv_cancel hf_ne_zero hf_ne_top, Pi.one_apply]
/-- If `f` is almost everywhere positive and finite, then `μ ≪ μ.withDensity f`. See also
`withDensity_absolutelyContinuous` for the reverse direction, which always holds. -/
lemma withDensity_absolutelyContinuous' {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    μ ≪ μ.withDensity f := by
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
⊢ μ ≪ withDensity μ f

Next tactic:
suffices (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≪ μ.withDensity f by
    rwa [withDensity_inv_same₀ hf hf_ne_zero hf_ne_top] at this
/-- If `f` is almost everywhere positive and finite, then `μ ≪ μ.withDensity f`. See also
`withDensity_absolutelyContinuous` for the reverse direction, which always holds. -/
lemma withDensity_absolutelyContinuous' {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    μ ≪ μ.withDensity f := by
  suffices (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≪ μ.withDensity f by
    

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
this : (withDensity (withDensity μ f) fun x => (f x)⁻¹) ≪ withDensity μ f
⊢ μ ≪ withDensity μ f

Next tactic:
rwa [withDensity_inv_same₀ hf hf_ne_zero hf_ne_top] at this
/-- If `f` is almost everywhere positive and finite, then `μ ≪ μ.withDensity f`. See also
`withDensity_absolutelyContinuous` for the reverse direction, which always holds. -/
lemma withDensity_absolutelyContinuous' {μ : Measure α} {f : α → ℝ≥0∞}
    (hf : AEMeasurable f μ) (hf_ne_zero : ∀ᵐ x ∂μ, f x ≠ 0) (hf_ne_top : ∀ᵐ x ∂μ, f x ≠ ∞) :
    μ ≪ μ.withDensity f := by
  suffices (μ.withDensity f).withDensity (fun x ↦ (f x)⁻¹) ≪ μ.withDensity f by
    rwa [withDensity_inv_same₀ hf hf_ne_zero hf_ne_top] at this
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ μ : Measure α
f : α → ℝ≥0∞
hf : AEMeasurable f
hf_ne_zero : ∀ᵐ (x : α) ∂μ, f x ≠ 0
hf_ne_top : ∀ᵐ (x : α) ∂μ, f x ≠ ⊤
⊢ (withDensity (withDensity μ f) fun x => (f x)⁻¹) ≪ withDensity μ f

Next tactic:
exact withDensity_absolutelyContinuous _ _
/-- A sigma-finite measure is absolutely continuous with respect to some finite measure. -/
theorem exists_absolutelyContinuous_isFiniteMeasure {m : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] : ∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν := by
  

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
⊢ ∃ ν, IsFiniteMeasure ν ∧ μ ≪ ν

Next tactic:
obtain ⟨g, gpos, gmeas, hg⟩ :
    ∃ g : α → ℝ≥0, (∀ x : α, 0 < g x) ∧ Measurable g ∧ ∫⁻ x : α, ↑(g x) ∂μ < 1 :=
    exists_pos_lintegral_lt_of_sigmaFinite μ one_ne_zero
/-- A sigma-finite measure is absolutely continuous with respect to some finite measure. -/
theorem exists_absolutelyContinuous_isFiniteMeasure {m : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] : ∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν := by
  obtain ⟨g, gpos, gmeas, hg⟩ :
    ∃ g : α → ℝ≥0, (∀ x : α, 0 < g x) ∧ Measurable g ∧ ∫⁻ x : α, ↑(g x) ∂μ < 1 :=
    exists_pos_lintegral_lt_of_sigmaFinite μ one_ne_zero
  

Proof state:
case intro.intro.intro
α : Type u_1
m0 : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
g : α → ℝ≥0
gpos : ∀ (x : α), 0 < g x
gmeas : Measurable g
hg : ∫⁻ (x : α), ↑(g x) ∂μ < 1
⊢ ∃ ν, IsFiniteMeasure ν ∧ μ ≪ ν

Next tactic:
refine' ⟨μ.withDensity fun x => g x, isFiniteMeasure_withDensity hg.ne_top, _⟩
/-- A sigma-finite measure is absolutely continuous with respect to some finite measure. -/
theorem exists_absolutelyContinuous_isFiniteMeasure {m : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] : ∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν := by
  obtain ⟨g, gpos, gmeas, hg⟩ :
    ∃ g : α → ℝ≥0, (∀ x : α, 0 < g x) ∧ Measurable g ∧ ∫⁻ x : α, ↑(g x) ∂μ < 1 :=
    exists_pos_lintegral_lt_of_sigmaFinite μ one_ne_zero
  refine' ⟨μ.withDensity fun x => g x, isFiniteMeasure_withDensity hg.ne_top, _⟩
  

Proof state:
case intro.intro.intro
α : Type u_1
m0 : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
g : α → ℝ≥0
gpos : ∀ (x : α), 0 < g x
gmeas : Measurable g
hg : ∫⁻ (x : α), ↑(g x) ∂μ < 1
⊢ μ ≪ withDensity μ fun x => ↑(g x)

Next tactic:
have : μ = (μ.withDensity fun x => g x).withDensity fun x => (g x)⁻¹ := by
    have A : ((fun x : α => (g x : ℝ≥0∞)) * fun x : α => (g x : ℝ≥0∞)⁻¹) = 1 := by
      ext1 x
      exact ENNReal.mul_inv_cancel (ENNReal.coe_ne_zero.2 (gpos x).ne') ENNReal.coe_ne_top
    rw [← withDensity_mul _ gmeas.coe_nnreal_ennreal gmeas.coe_nnreal_ennreal.inv, A,
      withDensity_one]
/-- A sigma-finite measure is absolutely continuous with respect to some finite measure. -/
theorem exists_absolutelyContinuous_isFiniteMeasure {m : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] : ∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν := by
  obtain ⟨g, gpos, gmeas, hg⟩ :
    ∃ g : α → ℝ≥0, (∀ x : α, 0 < g x) ∧ Measurable g ∧ ∫⁻ x : α, ↑(g x) ∂μ < 1 :=
    exists_pos_lintegral_lt_of_sigmaFinite μ one_ne_zero
  refine' ⟨μ.withDensity fun x => g x, isFiniteMeasure_withDensity hg.ne_top, _⟩
  have : μ = (μ.withDensity fun x => g x).withDensity fun x => (g x)⁻¹ := by
    

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
g : α → ℝ≥0
gpos : ∀ (x : α), 0 < g x
gmeas : Measurable g
hg : ∫⁻ (x : α), ↑(g x) ∂μ < 1
⊢ μ = withDensity (withDensity μ fun x => ↑(g x)) fun x => (↑(g x))⁻¹

Next tactic:
have A : ((fun x : α => (g x : ℝ≥0∞)) * fun x : α => (g x : ℝ≥0∞)⁻¹) = 1 := by
      ext1 x
      exact ENNReal.mul_inv_cancel (ENNReal.coe_ne_zero.2 (gpos x).ne') ENNReal.coe_ne_top
/-- A sigma-finite measure is absolutely continuous with respect to some finite measure. -/
theorem exists_absolutelyContinuous_isFiniteMeasure {m : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] : ∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν := by
  obtain ⟨g, gpos, gmeas, hg⟩ :
    ∃ g : α → ℝ≥0, (∀ x : α, 0 < g x) ∧ Measurable g ∧ ∫⁻ x : α, ↑(g x) ∂μ < 1 :=
    exists_pos_lintegral_lt_of_sigmaFinite μ one_ne_zero
  refine' ⟨μ.withDensity fun x => g x, isFiniteMeasure_withDensity hg.ne_top, _⟩
  have : μ = (μ.withDensity fun x => g x).withDensity fun x => (g x)⁻¹ := by
    have A : ((fun x : α => (g x : ℝ≥0∞)) * fun x : α => (g x : ℝ≥0∞)⁻¹) = 1 := by
      

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
g : α → ℝ≥0
gpos : ∀ (x : α), 0 < g x
gmeas : Measurable g
hg : ∫⁻ (x : α), ↑(g x) ∂μ < 1
⊢ ((fun x => ↑(g x)) * fun x => (↑(g x))⁻¹) = 1

Next tactic:
ext1 x
/-- A sigma-finite measure is absolutely continuous with respect to some finite measure. -/
theorem exists_absolutelyContinuous_isFiniteMeasure {m : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] : ∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν := by
  obtain ⟨g, gpos, gmeas, hg⟩ :
    ∃ g : α → ℝ≥0, (∀ x : α, 0 < g x) ∧ Measurable g ∧ ∫⁻ x : α, ↑(g x) ∂μ < 1 :=
    exists_pos_lintegral_lt_of_sigmaFinite μ one_ne_zero
  refine' ⟨μ.withDensity fun x => g x, isFiniteMeasure_withDensity hg.ne_top, _⟩
  have : μ = (μ.withDensity fun x => g x).withDensity fun x => (g x)⁻¹ := by
    have A : ((fun x : α => (g x : ℝ≥0∞)) * fun x : α => (g x : ℝ≥0∞)⁻¹) = 1 := by
      ext1 x
      

Proof state:
case h
α : Type u_1
m0 : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
g : α → ℝ≥0
gpos : ∀ (x : α), 0 < g x
gmeas : Measurable g
hg : ∫⁻ (x : α), ↑(g x) ∂μ < 1
x : α
⊢ ((fun x => ↑(g x)) * fun x => (↑(g x))⁻¹) x = OfNat.ofNat 1 x

Next tactic:
exact ENNReal.mul_inv_cancel (ENNReal.coe_ne_zero.2 (gpos x).ne') ENNReal.coe_ne_top
/-- A sigma-finite measure is absolutely continuous with respect to some finite measure. -/
theorem exists_absolutelyContinuous_isFiniteMeasure {m : MeasurableSpace α} (μ : Measure α)
    [SigmaFinite μ] : ∃ ν : Measure α, IsFiniteMeasure ν ∧ μ ≪ ν := by
  obtain ⟨g, gpos, gmeas, hg⟩ :
    ∃ g : α → ℝ≥0, (∀ x : α, 0 < g x) ∧ Measurable g ∧ ∫⁻ x : α, ↑(g x) ∂μ < 1 :=
    exists_pos_lintegral_lt_of_sigmaFinite μ one_ne_zero
  refine' ⟨μ.withDensity fun x => g x, isFiniteMeasure_withDensity hg.ne_top, _⟩
  have : μ = (μ.withDensity fun x => g x).withDensity fun x => (g x)⁻¹ := by
    have A : ((fun x : α => (g x : ℝ≥0∞)) * fun x : α => (g x : ℝ≥0∞)⁻¹) = 1 := by
      ext1 x
      exact ENNReal.mul_inv_cancel (ENNReal.coe_ne_zero.2 (gpos x).ne') ENNReal.coe_ne_top
    

Proof state:
α : Type u_1
m0 : MeasurableSpace α
μ✝ : Measure α
m : MeasurableSpace α
μ : Measure α
inst✝ : SigmaFinite μ
g : α → ℝ≥0
gpos : ∀ (x : α), 0 < g x
gmeas : Measurable g
hg : ∫⁻ (x : α), ↑(g x) ∂μ < 1
A : ((fun x => ↑(g x)) * fun x => (↑(g x))⁻¹) = 1
⊢ μ = withDensity (withDensity μ fun x => ↑(g x)) fun x => (↑(g x))⁻¹

Next tactic:
rw [← withDensity_mul _ gmeas.coe_nnreal_ennreal gmeas.coe_nnreal_ennreal.inv, A,
      withDensity_one]