l3lab/ntp-mathlib huggingface dataset:
/-- Given measures `μ` and `ν`, if `s` is a measure mutually singular to `ν` and `f` is a
measurable function such that `μ = s + fν`, then `s = μ.singularPart μ`.

This theorem provides the uniqueness of the `singularPart` in the Lebesgue decomposition theorem,
while `MeasureTheory.Measure.eq_rnDeriv` provides the uniqueness of the
`rnDeriv`. -/
theorem eq_singularPart {s : Measure α} {f : α → ℝ≥0∞} (hf : Measurable f) (hs : s ⟂ₘ ν)
    (hadd : μ = s + ν.withDensity f) : s = μ.singularPart ν := by
  haveI : HaveLebesgueDecomposition μ ν := ⟨⟨⟨s, f⟩, hf, hs, hadd⟩⟩
  obtain ⟨hmeas, hsing, hadd'⟩ := haveLebesgueDecomposition_spec μ ν
  obtain ⟨⟨S, hS₁, hS₂, hS₃⟩, ⟨T, hT₁, hT₂, hT₃⟩⟩ := hs, hsing
  rw [hadd'] at hadd
  have hνinter : ν (S ∩ T)ᶜ = 0 := by
    rw [compl_inter]
    refine' nonpos_iff_eq_zero.1 (le_trans (measure_union_le _ _) _)
    rw [hT₃, hS₃, add_zero]
  have heq : s.restrict (S ∩ T)ᶜ = (μ.singularPart ν).restrict (S ∩ T)ᶜ := by
    ext1 A hA
    have hf : ν.withDensity f (A ∩ (S ∩ T)ᶜ) = 0 := by
      refine' withDensity_absolutelyContinuous ν _ _
      rw [← nonpos_iff_eq_zero]
      exact hνinter ▸ measure_mono (inter_subset_right _ _)
    have hrn : ν.withDensity (μ.rnDeriv ν) (A ∩ (S ∩ T)ᶜ) = 0 := by
      refine' withDensity_absolutelyContinuous ν _ _
      rw [← nonpos_iff_eq_zero]
      exact hνinter ▸ measure_mono (inter_subset_right _ _)
    rw [restrict_apply hA, restrict_apply hA, ← add_zero (s (A ∩ (S ∩ T)ᶜ)), ← hf, ← add_apply, ←
      hadd, add_apply, hrn, add_zero]
  have heq' : ∀ A : Set α, MeasurableSet A → s A = s.restrict (S ∩ T)ᶜ A := by
    intro A hA
    have hsinter : s (A ∩ (S ∩ T)) = 0 := by
      rw [← nonpos_iff_eq_zero]
      exact hS₂ ▸ measure_mono ((inter_subset_right _ _).trans (inter_subset_left _ _))
    rw [restrict_apply hA, ← diff_eq, AEDisjoint.measure_diff_left hsinter]
  ext1 A hA
  have hμinter : μ.singularPart ν (A ∩ (S ∩ T)) = 0 := by
    rw [← nonpos_iff_eq_zero]
    exact hT₂ ▸ measure_mono ((inter_subset_right _ _).trans (inter_subset_right _ _))
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ ν s : Measure α
f : α → ℝ≥0∞
hf : Measurable f
hadd : singularPart μ ν + withDensity ν (rnDeriv μ ν) = s + withDensity ν f
this : HaveLebesgueDecomposition μ ν
hmeas : Measurable (rnDeriv μ ν)
hadd' : μ = singularPart μ ν + withDensity ν (rnDeriv μ ν)
S : Set α
hS₁ : MeasurableSet S
hS₂ : ↑↑s S = 0
hS₃ : ↑↑ν Sᶜ = 0
T : Set α
hT₁ : MeasurableSet T
hT₂ : ↑↑(singularPart μ ν) T = 0
hT₃ : ↑↑ν Tᶜ = 0
hνinter : ↑↑ν (S ∩ T)ᶜ = 0
heq : restrict s (S ∩ T)ᶜ = restrict (singularPart μ ν) (S ∩ T)ᶜ
heq' : ∀ (A : Set α), MeasurableSet A → ↑↑s A = ↑↑(restrict s (S ∩ T)ᶜ) A
A : Set α
hA : MeasurableSet A
hμinter : ↑↑(singularPart μ ν) (A ∩ (S ∩ T)) = 0
⊢ ↑↑s A = ↑↑(singularPart μ ν) A

Next tactic:
rw [heq' A hA, heq, restrict_apply hA, ← diff_eq, AEDisjoint.measure_diff_left hμinter]
theorem singularPart_zero (ν : Measure α) : (0 : Measure α).singularPart ν = 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ ν✝ ν : Measure α
⊢ singularPart 0 ν = 0

Next tactic:
refine' (eq_singularPart measurable_zero MutuallySingular.zero_left _).symm
theorem singularPart_zero (ν : Measure α) : (0 : Measure α).singularPart ν = 0 := by
  refine' (eq_singularPart measurable_zero MutuallySingular.zero_left _).symm
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ ν✝ ν : Measure α
⊢ 0 = 0 + withDensity ν 0

Next tactic:
rw [zero_add, withDensity_zero]
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
⊢ singularPart (r • μ) ν = r • singularPart μ ν

Next tactic:
by_cases hr : r = 0
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  by_cases hr : r = 0
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r = 0
⊢ singularPart (r • μ) ν = r • singularPart μ ν

Next tactic:
rw [hr, zero_smul, zero_smul, singularPart_zero]
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  by_cases hr : r = 0
  · rw [hr, zero_smul, zero_smul, singularPart_zero]
  

Proof state:
case neg
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : ¬r = 0
⊢ singularPart (r • μ) ν = r • singularPart μ ν

Next tactic:
by_cases hl : HaveLebesgueDecomposition μ ν
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  by_cases hr : r = 0
  · rw [hr, zero_smul, zero_smul, singularPart_zero]
  by_cases hl : HaveLebesgueDecomposition μ ν
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : ¬r = 0
hl : HaveLebesgueDecomposition μ ν
⊢ singularPart (r • μ) ν = r • singularPart μ ν

Next tactic:
refine'
      (eq_singularPart ((measurable_rnDeriv μ ν).const_smul (r : ℝ≥0∞))
          (MutuallySingular.smul r (haveLebesgueDecomposition_spec _ _).2.1) _).symm
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  by_cases hr : r = 0
  · rw [hr, zero_smul, zero_smul, singularPart_zero]
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine'
      (eq_singularPart ((measurable_rnDeriv μ ν).const_smul (r : ℝ≥0∞))
          (MutuallySingular.smul r (haveLebesgueDecomposition_spec _ _).2.1) _).symm
    

Proof state:
case pos
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : ¬r = 0
hl : HaveLebesgueDecomposition μ ν
⊢ r • μ = ↑r • singularPart μ ν + withDensity ν (↑r • rnDeriv μ ν)

Next tactic:
rw [withDensity_smul _ (measurable_rnDeriv _ _), ← smul_add,
      ← haveLebesgueDecomposition_add μ ν, ENNReal.smul_def]
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  by_cases hr : r = 0
  · rw [hr, zero_smul, zero_smul, singularPart_zero]
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine'
      (eq_singularPart ((measurable_rnDeriv μ ν).const_smul (r : ℝ≥0∞))
          (MutuallySingular.smul r (haveLebesgueDecomposition_spec _ _).2.1) _).symm
    rw [withDensity_smul _ (measurable_rnDeriv _ _), ← smul_add,
      ← haveLebesgueDecomposition_add μ ν, ENNReal.smul_def]
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : ¬r = 0
hl : ¬HaveLebesgueDecomposition μ ν
⊢ singularPart (r • μ) ν = r • singularPart μ ν

Next tactic:
rw [singularPart, singularPart, dif_neg hl, dif_neg, smul_zero]
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  by_cases hr : r = 0
  · rw [hr, zero_smul, zero_smul, singularPart_zero]
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine'
      (eq_singularPart ((measurable_rnDeriv μ ν).const_smul (r : ℝ≥0∞))
          (MutuallySingular.smul r (haveLebesgueDecomposition_spec _ _).2.1) _).symm
    rw [withDensity_smul _ (measurable_rnDeriv _ _), ← smul_add,
      ← haveLebesgueDecomposition_add μ ν, ENNReal.smul_def]
  · rw [singularPart, singularPart, dif_neg hl, dif_neg, smul_zero]
    

Proof state:
case neg.hnc
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : ¬r = 0
hl : ¬HaveLebesgueDecomposition μ ν
⊢ ¬HaveLebesgueDecomposition (r • μ) ν

Next tactic:
refine' fun hl' => hl _
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  by_cases hr : r = 0
  · rw [hr, zero_smul, zero_smul, singularPart_zero]
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine'
      (eq_singularPart ((measurable_rnDeriv μ ν).const_smul (r : ℝ≥0∞))
          (MutuallySingular.smul r (haveLebesgueDecomposition_spec _ _).2.1) _).symm
    rw [withDensity_smul _ (measurable_rnDeriv _ _), ← smul_add,
      ← haveLebesgueDecomposition_add μ ν, ENNReal.smul_def]
  · rw [singularPart, singularPart, dif_neg hl, dif_neg, smul_zero]
    refine' fun hl' => hl _
    

Proof state:
case neg.hnc
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : ¬r = 0
hl : ¬HaveLebesgueDecomposition μ ν
hl' : HaveLebesgueDecomposition (r • μ) ν
⊢ HaveLebesgueDecomposition μ ν

Next tactic:
rw [← inv_smul_smul₀ hr μ]
theorem singularPart_smul (μ ν : Measure α) (r : ℝ≥0) :
    (r • μ).singularPart ν = r • μ.singularPart ν := by
  by_cases hr : r = 0
  · rw [hr, zero_smul, zero_smul, singularPart_zero]
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine'
      (eq_singularPart ((measurable_rnDeriv μ ν).const_smul (r : ℝ≥0∞))
          (MutuallySingular.smul r (haveLebesgueDecomposition_spec _ _).2.1) _).symm
    rw [withDensity_smul _ (measurable_rnDeriv _ _), ← smul_add,
      ← haveLebesgueDecomposition_add μ ν, ENNReal.smul_def]
  · rw [singularPart, singularPart, dif_neg hl, dif_neg, smul_zero]
    refine' fun hl' => hl _
    rw [← inv_smul_smul₀ hr μ]
    

Proof state:
case neg.hnc
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : ¬r = 0
hl : ¬HaveLebesgueDecomposition μ ν
hl' : HaveLebesgueDecomposition (r • μ) ν
⊢ HaveLebesgueDecomposition (r⁻¹ • r • μ) ν

Next tactic:
exact @Measure.haveLebesgueDecomposition_smul _ _ _ _ hl' _
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
⊢ singularPart μ (r • ν) = singularPart μ ν

Next tactic:
by_cases hl : HaveLebesgueDecomposition μ ν
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
⊢ singularPart μ (r • ν) = singularPart μ ν

Next tactic:
refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · 

Proof state:
case pos.refine_1
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
⊢ singularPart μ ν ⟂ₘ r • ν

Next tactic:
exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · 

Proof state:
case pos.refine_2
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
⊢ μ = singularPart μ ν + withDensity (r • ν) (r⁻¹ • rnDeriv μ ν)

Next tactic:
rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      

Proof state:
case pos.refine_2
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
⊢ μ = singularPart μ ν + withDensity ν (↑r • r⁻¹ • rnDeriv μ ν)
case pos.refine_2.hf
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
⊢ Measurable (r⁻¹ • rnDeriv μ ν)

Next tactic:
swap
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · 

Proof state:
case pos.refine_2.hf
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
⊢ Measurable (r⁻¹ • rnDeriv μ ν)

Next tactic:
exact (measurable_rnDeriv _ _).const_smul _
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · exact (measurable_rnDeriv _ _).const_smul _
      

Proof state:
case pos.refine_2
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
⊢ μ = singularPart μ ν + withDensity ν (↑r • r⁻¹ • rnDeriv μ ν)

Next tactic:
convert haveLebesgueDecomposition_add μ ν
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · exact (measurable_rnDeriv _ _).const_smul _
      convert haveLebesgueDecomposition_add μ ν
      

Proof state:
case h.e'_3.h.e'_6.h.e'_4
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
⊢ ↑r • r⁻¹ • rnDeriv μ ν = rnDeriv μ ν

Next tactic:
ext x
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · exact (measurable_rnDeriv _ _).const_smul _
      convert haveLebesgueDecomposition_add μ ν
      ext x
      

Proof state:
case h.e'_3.h.e'_6.h.e'_4.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
x : α
⊢ (↑r • r⁻¹ • rnDeriv μ ν) x = rnDeriv μ ν x

Next tactic:
simp only [Pi.smul_apply, ne_eq]
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · exact (measurable_rnDeriv _ _).const_smul _
      convert haveLebesgueDecomposition_add μ ν
      ext x
      simp only [Pi.smul_apply, ne_eq]
      

Proof state:
case h.e'_3.h.e'_6.h.e'_4.h
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : HaveLebesgueDecomposition μ ν
x : α
⊢ ↑r • r⁻¹ • rnDeriv μ ν x = rnDeriv μ ν x

Next tactic:
rw [← ENNReal.smul_def, ← smul_assoc, smul_eq_mul, mul_inv_cancel hr, one_smul]
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · exact (measurable_rnDeriv _ _).const_smul _
      convert haveLebesgueDecomposition_add μ ν
      ext x
      simp only [Pi.smul_apply, ne_eq]
      rw [← ENNReal.smul_def, ← smul_assoc, smul_eq_mul, mul_inv_cancel hr, one_smul]
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : ¬HaveLebesgueDecomposition μ ν
⊢ singularPart μ (r • ν) = singularPart μ ν

Next tactic:
rw [singularPart, singularPart, dif_neg hl, dif_neg]
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · exact (measurable_rnDeriv _ _).const_smul _
      convert haveLebesgueDecomposition_add μ ν
      ext x
      simp only [Pi.smul_apply, ne_eq]
      rw [← ENNReal.smul_def, ← smul_assoc, smul_eq_mul, mul_inv_cancel hr, one_smul]
  · rw [singularPart, singularPart, dif_neg hl, dif_neg]
    

Proof state:
case neg.hnc
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : ¬HaveLebesgueDecomposition μ ν
⊢ ¬HaveLebesgueDecomposition μ (r • ν)

Next tactic:
refine fun hl' => hl ?_
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · exact (measurable_rnDeriv _ _).const_smul _
      convert haveLebesgueDecomposition_add μ ν
      ext x
      simp only [Pi.smul_apply, ne_eq]
      rw [← ENNReal.smul_def, ← smul_assoc, smul_eq_mul, mul_inv_cancel hr, one_smul]
  · rw [singularPart, singularPart, dif_neg hl, dif_neg]
    refine fun hl' => hl ?_
    

Proof state:
case neg.hnc
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : ¬HaveLebesgueDecomposition μ ν
hl' : HaveLebesgueDecomposition μ (r • ν)
⊢ HaveLebesgueDecomposition μ ν

Next tactic:
rw [← inv_smul_smul₀ hr ν]
theorem singularPart_smul_right (μ ν : Measure α) (r : ℝ≥0) (hr : r ≠ 0) :
    μ.singularPart (r • ν) = μ.singularPart ν := by
  by_cases hl : HaveLebesgueDecomposition μ ν
  · refine (eq_singularPart ((measurable_rnDeriv μ ν).const_smul r⁻¹) ?_ ?_).symm
    · exact (mutuallySingular_singularPart μ ν).mono_ac AbsolutelyContinuous.rfl
        smul_absolutelyContinuous
    · rw [ENNReal.smul_def r, withDensity_smul_measure, ← withDensity_smul]
      swap; · exact (measurable_rnDeriv _ _).const_smul _
      convert haveLebesgueDecomposition_add μ ν
      ext x
      simp only [Pi.smul_apply, ne_eq]
      rw [← ENNReal.smul_def, ← smul_assoc, smul_eq_mul, mul_inv_cancel hr, one_smul]
  · rw [singularPart, singularPart, dif_neg hl, dif_neg]
    refine fun hl' => hl ?_
    rw [← inv_smul_smul₀ hr ν]
    

Proof state:
case neg.hnc
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
r : ℝ≥0
hr : r ≠ 0
hl : ¬HaveLebesgueDecomposition μ ν
hl' : HaveLebesgueDecomposition μ (r • ν)
⊢ HaveLebesgueDecomposition μ (r⁻¹ • r • ν)

Next tactic:
infer_instance
theorem singularPart_add (μ₁ μ₂ ν : Measure α) [HaveLebesgueDecomposition μ₁ ν]
    [HaveLebesgueDecomposition μ₂ ν] :
    (μ₁ + μ₂).singularPart ν = μ₁.singularPart ν + μ₂.singularPart ν := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ ν✝ μ₁ μ₂ ν : Measure α
inst✝¹ : HaveLebesgueDecomposition μ₁ ν
inst✝ : HaveLebesgueDecomposition μ₂ ν
⊢ singularPart (μ₁ + μ₂) ν = singularPart μ₁ ν + singularPart μ₂ ν

Next tactic:
refine'
    (eq_singularPart ((measurable_rnDeriv μ₁ ν).add (measurable_rnDeriv μ₂ ν))
        ((haveLebesgueDecomposition_spec _ _).2.1.add_left
          (haveLebesgueDecomposition_spec _ _).2.1)
        _).symm
theorem singularPart_add (μ₁ μ₂ ν : Measure α) [HaveLebesgueDecomposition μ₁ ν]
    [HaveLebesgueDecomposition μ₂ ν] :
    (μ₁ + μ₂).singularPart ν = μ₁.singularPart ν + μ₂.singularPart ν := by
  refine'
    (eq_singularPart ((measurable_rnDeriv μ₁ ν).add (measurable_rnDeriv μ₂ ν))
        ((haveLebesgueDecomposition_spec _ _).2.1.add_left
          (haveLebesgueDecomposition_spec _ _).2.1)
        _).symm
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ ν✝ μ₁ μ₂ ν : Measure α
inst✝¹ : HaveLebesgueDecomposition μ₁ ν
inst✝ : HaveLebesgueDecomposition μ₂ ν
⊢ μ₁ + μ₂ = singularPart μ₁ ν + singularPart μ₂ ν + withDensity ν fun a => rnDeriv μ₁ ν a + rnDeriv μ₂ ν a

Next tactic:
erw [withDensity_add_left (measurable_rnDeriv μ₁ ν)]
theorem singularPart_add (μ₁ μ₂ ν : Measure α) [HaveLebesgueDecomposition μ₁ ν]
    [HaveLebesgueDecomposition μ₂ ν] :
    (μ₁ + μ₂).singularPart ν = μ₁.singularPart ν + μ₂.singularPart ν := by
  refine'
    (eq_singularPart ((measurable_rnDeriv μ₁ ν).add (measurable_rnDeriv μ₂ ν))
        ((haveLebesgueDecomposition_spec _ _).2.1.add_left
          (haveLebesgueDecomposition_spec _ _).2.1)
        _).symm
  erw [withDensity_add_left (measurable_rnDeriv μ₁ ν)]
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ ν✝ μ₁ μ₂ ν : Measure α
inst✝¹ : HaveLebesgueDecomposition μ₁ ν
inst✝ : HaveLebesgueDecomposition μ₂ ν
⊢ μ₁ + μ₂ =
    singularPart μ₁ ν + singularPart μ₂ ν + (withDensity ν (rnDeriv μ₁ ν) + withDensity ν fun a => rnDeriv μ₂ ν a)

Next tactic:
conv_rhs => rw [add_assoc, add_comm (μ₂.singularPart ν), ← add_assoc, ← add_assoc]
theorem singularPart_add (μ₁ μ₂ ν : Measure α) [HaveLebesgueDecomposition μ₁ ν]
    [HaveLebesgueDecomposition μ₂ ν] :
    (μ₁ + μ₂).singularPart ν = μ₁.singularPart ν + μ₂.singularPart ν := by
  refine'
    (eq_singularPart ((measurable_rnDeriv μ₁ ν).add (measurable_rnDeriv μ₂ ν))
        ((haveLebesgueDecomposition_spec _ _).2.1.add_left
          (haveLebesgueDecomposition_spec _ _).2.1)
        _).symm
  erw [withDensity_add_left (measurable_rnDeriv μ₁ ν)]
  conv_rhs => 

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ ν✝ μ₁ μ₂ ν : Measure α
inst✝¹ : HaveLebesgueDecomposition μ₁ ν
inst✝ : HaveLebesgueDecomposition μ₂ ν
| singularPart μ₁ ν + singularPart μ₂ ν + (withDensity ν (rnDeriv μ₁ ν) + withDensity ν fun a => rnDeriv μ₂ ν a)

Next tactic:
rw [add_assoc, add_comm (μ₂.singularPart ν), ← add_assoc, ← add_assoc]