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
    

Proof state:
α : 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)ᶜ
⊢ ∀ (A : Set α), MeasurableSet A → ↑↑s A = ↑↑(restrict s (S ∩ T)ᶜ) A

Next tactic:
intro A hA
/-- 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
    

Proof state:
α : 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)ᶜ
A : Set α
hA : MeasurableSet A
⊢ ↑↑s A = ↑↑(restrict s (S ∩ T)ᶜ) A

Next tactic:
have hsinter : s (A ∩ (S ∩ T)) = 0 := by
      rw [← nonpos_iff_eq_zero]
      exact hS₂ ▸ measure_mono ((inter_subset_right _ _).trans (inter_subset_left _ _))
/-- 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
      

Proof state:
α : 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)ᶜ
A : Set α
hA : MeasurableSet A
⊢ ↑↑s (A ∩ (S ∩ T)) = 0

Next tactic:
rw [← nonpos_iff_eq_zero]
/-- 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]
      

Proof state:
α : 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)ᶜ
A : Set α
hA : MeasurableSet A
⊢ ↑↑s (A ∩ (S ∩ T)) ≤ 0

Next tactic:
exact hS₂ ▸ measure_mono ((inter_subset_right _ _).trans (inter_subset_left _ _))
/-- 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 _ _))
    

Proof state:
α : 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)ᶜ
A : Set α
hA : MeasurableSet A
hsinter : ↑↑s (A ∩ (S ∩ T)) = 0
⊢ ↑↑s A = ↑↑(restrict s (S ∩ T)ᶜ) A

Next tactic:
rw [restrict_apply hA, ← diff_eq, AEDisjoint.measure_diff_left hsinter]
/-- 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]
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro
α : 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
⊢ s = singularPart μ ν

Next tactic:
ext1 A hA
/-- 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
  

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
⊢ ↑↑s A = ↑↑(singularPart μ ν) A

Next tactic:
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 _ _))
/-- 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
    

Proof state:
α : 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
⊢ ↑↑(singularPart μ ν) (A ∩ (S ∩ T)) = 0

Next tactic:
rw [← nonpos_iff_eq_zero]
/-- 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]
    

Proof state:
α : 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
⊢ ↑↑(singularPart μ ν) (A ∩ (S ∩ T)) ≤ 0

Next tactic:
exact hT₂ ▸ measure_mono ((inter_subset_right _ _).trans (inter_subset_right _ _))