l3lab/ntp-mathlib huggingface dataset:
/-- Radon-Nikodym derivative with respect to the scalar multiple of a measure.
See also `rnDeriv_smul_right_of_ne_top'`, which requires sigma-finite `ν` and `μ`. -/
theorem rnDeriv_smul_right_of_ne_top (ν μ : Measure α) [IsFiniteMeasure ν]
    [ν.HaveLebesgueDecomposition μ] {r : ℝ≥0∞} (hr : r ≠ 0) (hr_ne_top : r ≠ ∞) :
    ν.rnDeriv (r • μ) =ᵐ[μ] r⁻¹ • ν.rnDeriv μ := by
  have h : ν.rnDeriv (r.toNNReal • μ) =ᵐ[μ] r.toNNReal⁻¹ • ν.rnDeriv μ := by
    refine rnDeriv_smul_right ν μ ?_
    rw [ne_eq, ENNReal.toNNReal_eq_zero_iff]
    simp [hr, hr_ne_top]
  have : (r.toNNReal)⁻¹ • rnDeriv ν μ = r⁻¹ • rnDeriv ν μ := by
    ext x
    simp only [Pi.smul_apply, ENNReal.smul_def, ne_eq, smul_eq_mul]
    rw [ENNReal.coe_inv, ENNReal.coe_toNNReal hr_ne_top]
    rw [ne_eq, ENNReal.toNNReal_eq_zero_iff]
    simp [hr, hr_ne_top]
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ ν μ : Measure α
inst✝¹ : IsFiniteMeasure ν
inst✝ : HaveLebesgueDecomposition ν μ
r : ℝ≥0∞
hr : r ≠ 0
hr_ne_top : r ≠ ⊤
h : rnDeriv ν (ENNReal.toNNReal r • μ) =ᶠ[ae μ] (ENNReal.toNNReal r)⁻¹ • rnDeriv ν μ
this : (ENNReal.toNNReal r)⁻¹ • rnDeriv ν μ = r⁻¹ • rnDeriv ν μ
⊢ rnDeriv ν (r • μ) =ᶠ[ae μ] r⁻¹ • rnDeriv ν μ

Next tactic:
simp_rw [this, ENNReal.smul_def, ENNReal.coe_toNNReal hr_ne_top] at h
/-- Radon-Nikodym derivative with respect to the scalar multiple of a measure.
See also `rnDeriv_smul_right_of_ne_top'`, which requires sigma-finite `ν` and `μ`. -/
theorem rnDeriv_smul_right_of_ne_top (ν μ : Measure α) [IsFiniteMeasure ν]
    [ν.HaveLebesgueDecomposition μ] {r : ℝ≥0∞} (hr : r ≠ 0) (hr_ne_top : r ≠ ∞) :
    ν.rnDeriv (r • μ) =ᵐ[μ] r⁻¹ • ν.rnDeriv μ := by
  have h : ν.rnDeriv (r.toNNReal • μ) =ᵐ[μ] r.toNNReal⁻¹ • ν.rnDeriv μ := by
    refine rnDeriv_smul_right ν μ ?_
    rw [ne_eq, ENNReal.toNNReal_eq_zero_iff]
    simp [hr, hr_ne_top]
  have : (r.toNNReal)⁻¹ • rnDeriv ν μ = r⁻¹ • rnDeriv ν μ := by
    ext x
    simp only [Pi.smul_apply, ENNReal.smul_def, ne_eq, smul_eq_mul]
    rw [ENNReal.coe_inv, ENNReal.coe_toNNReal hr_ne_top]
    rw [ne_eq, ENNReal.toNNReal_eq_zero_iff]
    simp [hr, hr_ne_top]
  simp_rw [this, ENNReal.smul_def, ENNReal.coe_toNNReal hr_ne_top] at h
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ ν μ : Measure α
inst✝¹ : IsFiniteMeasure ν
inst✝ : HaveLebesgueDecomposition ν μ
r : ℝ≥0∞
hr : r ≠ 0
hr_ne_top : r ≠ ⊤
this : (ENNReal.toNNReal r)⁻¹ • rnDeriv ν μ = r⁻¹ • rnDeriv ν μ
h : rnDeriv ν (r • μ) =ᶠ[ae μ] r⁻¹ • rnDeriv ν μ
⊢ rnDeriv ν (r • μ) =ᶠ[ae μ] r⁻¹ • rnDeriv ν μ

Next tactic:
exact h
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add'`, which requires sigma-finite `ν₁`, `ν₂` and `μ`. -/
lemma rnDeriv_add (ν₁ ν₂ μ : Measure α) [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
    [ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
    [(ν₁ + ν₂).HaveLebesgueDecomposition μ] :
    (ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν ν₁ ν₂ μ : Measure α
inst✝⁴ : IsFiniteMeasure ν₁
inst✝³ : IsFiniteMeasure ν₂
inst✝² : HaveLebesgueDecomposition ν₁ μ
inst✝¹ : HaveLebesgueDecomposition ν₂ μ
inst✝ : HaveLebesgueDecomposition (ν₁ + ν₂) μ
⊢ rnDeriv (ν₁ + ν₂) μ =ᶠ[ae μ] rnDeriv ν₁ μ + rnDeriv ν₂ μ

Next tactic:
rw [← withDensity_eq_iff]
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add'`, which requires sigma-finite `ν₁`, `ν₂` and `μ`. -/
lemma rnDeriv_add (ν₁ ν₂ μ : Measure α) [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
    [ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
    [(ν₁ + ν₂).HaveLebesgueDecomposition μ] :
    (ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
  rw [← withDensity_eq_iff]
  · 

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν ν₁ ν₂ μ : Measure α
inst✝⁴ : IsFiniteMeasure ν₁
inst✝³ : IsFiniteMeasure ν₂
inst✝² : HaveLebesgueDecomposition ν₁ μ
inst✝¹ : HaveLebesgueDecomposition ν₂ μ
inst✝ : HaveLebesgueDecomposition (ν₁ + ν₂) μ
⊢ withDensity μ (rnDeriv (ν₁ + ν₂) μ) = withDensity μ (rnDeriv ν₁ μ + rnDeriv ν₂ μ)

Next tactic:
suffices (ν₁ + ν₂).singularPart μ + μ.withDensity ((ν₁ + ν₂).rnDeriv μ)
        = (ν₁ + ν₂).singularPart μ + μ.withDensity (ν₁.rnDeriv μ + ν₂.rnDeriv μ) by
      rwa [add_right_inj] at this
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add'`, which requires sigma-finite `ν₁`, `ν₂` and `μ`. -/
lemma rnDeriv_add (ν₁ ν₂ μ : Measure α) [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
    [ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
    [(ν₁ + ν₂).HaveLebesgueDecomposition μ] :
    (ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
  rw [← withDensity_eq_iff]
  · suffices (ν₁ + ν₂).singularPart μ + μ.withDensity ((ν₁ + ν₂).rnDeriv μ)
        = (ν₁ + ν₂).singularPart μ + μ.withDensity (ν₁.rnDeriv μ + ν₂.rnDeriv μ) by
      

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν ν₁ ν₂ μ : Measure α
inst✝⁴ : IsFiniteMeasure ν₁
inst✝³ : IsFiniteMeasure ν₂
inst✝² : HaveLebesgueDecomposition ν₁ μ
inst✝¹ : HaveLebesgueDecomposition ν₂ μ
inst✝ : HaveLebesgueDecomposition (ν₁ + ν₂) μ
this :
  singularPart (ν₁ + ν₂) μ + withDensity μ (rnDeriv (ν₁ + ν₂) μ) =
    singularPart (ν₁ + ν₂) μ + withDensity μ (rnDeriv ν₁ μ + rnDeriv ν₂ μ)
⊢ withDensity μ (rnDeriv (ν₁ + ν₂) μ) = withDensity μ (rnDeriv ν₁ μ + rnDeriv ν₂ μ)

Next tactic:
rwa [add_right_inj] at this
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add'`, which requires sigma-finite `ν₁`, `ν₂` and `μ`. -/
lemma rnDeriv_add (ν₁ ν₂ μ : Measure α) [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
    [ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
    [(ν₁ + ν₂).HaveLebesgueDecomposition μ] :
    (ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
  rw [← withDensity_eq_iff]
  · suffices (ν₁ + ν₂).singularPart μ + μ.withDensity ((ν₁ + ν₂).rnDeriv μ)
        = (ν₁ + ν₂).singularPart μ + μ.withDensity (ν₁.rnDeriv μ + ν₂.rnDeriv μ) by
      rwa [add_right_inj] at this
    

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

Next tactic:
rw [← (ν₁ + ν₂).haveLebesgueDecomposition_add μ, singularPart_add,
      withDensity_add_left (measurable_rnDeriv _ _), add_assoc,
      add_comm (ν₂.singularPart μ), add_assoc, add_comm _ (ν₂.singularPart μ),
      ← ν₂.haveLebesgueDecomposition_add μ, ← add_assoc, ← ν₁.haveLebesgueDecomposition_add μ]
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add'`, which requires sigma-finite `ν₁`, `ν₂` and `μ`. -/
lemma rnDeriv_add (ν₁ ν₂ μ : Measure α) [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
    [ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
    [(ν₁ + ν₂).HaveLebesgueDecomposition μ] :
    (ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
  rw [← withDensity_eq_iff]
  · suffices (ν₁ + ν₂).singularPart μ + μ.withDensity ((ν₁ + ν₂).rnDeriv μ)
        = (ν₁ + ν₂).singularPart μ + μ.withDensity (ν₁.rnDeriv μ + ν₂.rnDeriv μ) by
      rwa [add_right_inj] at this
    rw [← (ν₁ + ν₂).haveLebesgueDecomposition_add μ, singularPart_add,
      withDensity_add_left (measurable_rnDeriv _ _), add_assoc,
      add_comm (ν₂.singularPart μ), add_assoc, add_comm _ (ν₂.singularPart μ),
      ← ν₂.haveLebesgueDecomposition_add μ, ← add_assoc, ← ν₁.haveLebesgueDecomposition_add μ]
  · 

Proof state:
case hf
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν ν₁ ν₂ μ : Measure α
inst✝⁴ : IsFiniteMeasure ν₁
inst✝³ : IsFiniteMeasure ν₂
inst✝² : HaveLebesgueDecomposition ν₁ μ
inst✝¹ : HaveLebesgueDecomposition ν₂ μ
inst✝ : HaveLebesgueDecomposition (ν₁ + ν₂) μ
⊢ AEMeasurable (rnDeriv (ν₁ + ν₂) μ)

Next tactic:
exact (measurable_rnDeriv _ _).aemeasurable
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add'`, which requires sigma-finite `ν₁`, `ν₂` and `μ`. -/
lemma rnDeriv_add (ν₁ ν₂ μ : Measure α) [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
    [ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
    [(ν₁ + ν₂).HaveLebesgueDecomposition μ] :
    (ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
  rw [← withDensity_eq_iff]
  · suffices (ν₁ + ν₂).singularPart μ + μ.withDensity ((ν₁ + ν₂).rnDeriv μ)
        = (ν₁ + ν₂).singularPart μ + μ.withDensity (ν₁.rnDeriv μ + ν₂.rnDeriv μ) by
      rwa [add_right_inj] at this
    rw [← (ν₁ + ν₂).haveLebesgueDecomposition_add μ, singularPart_add,
      withDensity_add_left (measurable_rnDeriv _ _), add_assoc,
      add_comm (ν₂.singularPart μ), add_assoc, add_comm _ (ν₂.singularPart μ),
      ← ν₂.haveLebesgueDecomposition_add μ, ← add_assoc, ← ν₁.haveLebesgueDecomposition_add μ]
  · exact (measurable_rnDeriv _ _).aemeasurable
  · 

Proof state:
case hg
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν ν₁ ν₂ μ : Measure α
inst✝⁴ : IsFiniteMeasure ν₁
inst✝³ : IsFiniteMeasure ν₂
inst✝² : HaveLebesgueDecomposition ν₁ μ
inst✝¹ : HaveLebesgueDecomposition ν₂ μ
inst✝ : HaveLebesgueDecomposition (ν₁ + ν₂) μ
⊢ AEMeasurable (rnDeriv ν₁ μ + rnDeriv ν₂ μ)

Next tactic:
exact ((measurable_rnDeriv _ _).add (measurable_rnDeriv _ _)).aemeasurable
/-- Radon-Nikodym derivative of a sum of two measures.
See also `rnDeriv_add'`, which requires sigma-finite `ν₁`, `ν₂` and `μ`. -/
lemma rnDeriv_add (ν₁ ν₂ μ : Measure α) [IsFiniteMeasure ν₁] [IsFiniteMeasure ν₂]
    [ν₁.HaveLebesgueDecomposition μ] [ν₂.HaveLebesgueDecomposition μ]
    [(ν₁ + ν₂).HaveLebesgueDecomposition μ] :
    (ν₁ + ν₂).rnDeriv μ =ᵐ[μ] ν₁.rnDeriv μ + ν₂.rnDeriv μ := by
  rw [← withDensity_eq_iff]
  · suffices (ν₁ + ν₂).singularPart μ + μ.withDensity ((ν₁ + ν₂).rnDeriv μ)
        = (ν₁ + ν₂).singularPart μ + μ.withDensity (ν₁.rnDeriv μ + ν₂.rnDeriv μ) by
      rwa [add_right_inj] at this
    rw [← (ν₁ + ν₂).haveLebesgueDecomposition_add μ, singularPart_add,
      withDensity_add_left (measurable_rnDeriv _ _), add_assoc,
      add_comm (ν₂.singularPart μ), add_assoc, add_comm _ (ν₂.singularPart μ),
      ← ν₂.haveLebesgueDecomposition_add μ, ← add_assoc, ← ν₁.haveLebesgueDecomposition_add μ]
  · exact (measurable_rnDeriv _ _).aemeasurable
  · exact ((measurable_rnDeriv _ _).add (measurable_rnDeriv _ _)).aemeasurable
  · 

Proof state:
case hfi
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν ν₁ ν₂ μ : Measure α
inst✝⁴ : IsFiniteMeasure ν₁
inst✝³ : IsFiniteMeasure ν₂
inst✝² : HaveLebesgueDecomposition ν₁ μ
inst✝¹ : HaveLebesgueDecomposition ν₂ μ
inst✝ : HaveLebesgueDecomposition (ν₁ + ν₂) μ
⊢ ∫⁻ (x : α), rnDeriv (ν₁ + ν₂) μ x ∂μ ≠ ⊤

Next tactic:
exact (lintegral_rnDeriv_lt_top (ν₁ + ν₂) μ).ne
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.

This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
    [IsFiniteMeasure ν] (h : ¬μ ⟂ₘ ν) :
    ∃ ε : ℝ≥0, 0 < ε ∧
      ∃ E : Set α,
        MeasurableSet E ∧ 0 < ν E ∧ 0 ≤[E] μ.toSignedMeasure - (ε • ν).toSignedMeasure := by
  -- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
h : ¬μ ⟂ₘ ν
⊢ ∃ ε,
    0 < ε ∧
      ∃ E,
        MeasurableSet E ∧
          0 < ↑↑ν E ∧
            VectorMeasure.restrict 0 E ≤ VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure (ε • ν)) E

Next tactic:
have :
    ∀ n : ℕ, ∃ i : Set α,
      MeasurableSet i ∧
        0 ≤[i] μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ∧
          μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[iᶜ] 0 := by
    intro; exact exists_compl_positive_negative _
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.

This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
    [IsFiniteMeasure ν] (h : ¬μ ⟂ₘ ν) :
    ∃ ε : ℝ≥0, 0 < ε ∧
      ∃ E : Set α,
        MeasurableSet E ∧ 0 < ν E ∧ 0 ≤[E] μ.toSignedMeasure - (ε • ν).toSignedMeasure := by
  -- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
  have :
    ∀ n : ℕ, ∃ i : Set α,
      MeasurableSet i ∧
        0 ≤[i] μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ∧
          μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[iᶜ] 0 := by
    

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
h : ¬μ ⟂ₘ ν
⊢ ∀ (n : ℕ),
    ∃ i,
      MeasurableSet i ∧
        VectorMeasure.restrict 0 i ≤
            VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) i ∧
          VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) iᶜ ≤
            VectorMeasure.restrict 0 iᶜ

Next tactic:
intro
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.

This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
    [IsFiniteMeasure ν] (h : ¬μ ⟂ₘ ν) :
    ∃ ε : ℝ≥0, 0 < ε ∧
      ∃ E : Set α,
        MeasurableSet E ∧ 0 < ν E ∧ 0 ≤[E] μ.toSignedMeasure - (ε • ν).toSignedMeasure := by
  -- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
  have :
    ∀ n : ℕ, ∃ i : Set α,
      MeasurableSet i ∧
        0 ≤[i] μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ∧
          μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[iᶜ] 0 := by
    intro; 

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
h : ¬μ ⟂ₘ ν
n✝ : ℕ
⊢ ∃ i,
    MeasurableSet i ∧
      VectorMeasure.restrict 0 i ≤
          VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n✝ + 1)) • ν)) i ∧
        VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n✝ + 1)) • ν)) iᶜ ≤
          VectorMeasure.restrict 0 iᶜ

Next tactic:
exact exists_compl_positive_negative _
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.

This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
    [IsFiniteMeasure ν] (h : ¬μ ⟂ₘ ν) :
    ∃ ε : ℝ≥0, 0 < ε ∧
      ∃ E : Set α,
        MeasurableSet E ∧ 0 < ν E ∧ 0 ≤[E] μ.toSignedMeasure - (ε • ν).toSignedMeasure := by
  -- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
  have :
    ∀ n : ℕ, ∃ i : Set α,
      MeasurableSet i ∧
        0 ≤[i] μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ∧
          μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[iᶜ] 0 := by
    intro; exact exists_compl_positive_negative _
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
h : ¬μ ⟂ₘ ν
this :
  ∀ (n : ℕ),
    ∃ i,
      MeasurableSet i ∧
        VectorMeasure.restrict 0 i ≤
            VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) i ∧
          VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) iᶜ ≤
            VectorMeasure.restrict 0 iᶜ
⊢ ∃ ε,
    0 < ε ∧
      ∃ E,
        MeasurableSet E ∧
          0 < ↑↑ν E ∧
            VectorMeasure.restrict 0 E ≤ VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure (ε • ν)) E

Next tactic:
choose f hf₁ hf₂ hf₃ using this
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.

This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
    [IsFiniteMeasure ν] (h : ¬μ ⟂ₘ ν) :
    ∃ ε : ℝ≥0, 0 < ε ∧
      ∃ E : Set α,
        MeasurableSet E ∧ 0 < ν E ∧ 0 ≤[E] μ.toSignedMeasure - (ε • ν).toSignedMeasure := by
  -- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
  have :
    ∀ n : ℕ, ∃ i : Set α,
      MeasurableSet i ∧
        0 ≤[i] μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ∧
          μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[iᶜ] 0 := by
    intro; exact exists_compl_positive_negative _
  choose f hf₁ hf₂ hf₃ using this
  -- set `A` to be the intersection of all the negative parts of obtained Hahn decompositions
  -- and we show that `μ A = 0`
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
h : ¬μ ⟂ₘ ν
f : ℕ → Set α
hf₁ : ∀ (n : ℕ), MeasurableSet (f n)
hf₂ :
  ∀ (n : ℕ),
    VectorMeasure.restrict 0 (f n) ≤
      VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) (f n)
hf₃ :
  ∀ (n : ℕ),
    VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) (f n)ᶜ ≤
      VectorMeasure.restrict 0 (f n)ᶜ
⊢ ∃ ε,
    0 < ε ∧
      ∃ E,
        MeasurableSet E ∧
          0 < ↑↑ν E ∧
            VectorMeasure.restrict 0 E ≤ VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure (ε • ν)) E

Next tactic:
set A := ⋂ n, (f n)ᶜ with hA₁
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.

This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
    [IsFiniteMeasure ν] (h : ¬μ ⟂ₘ ν) :
    ∃ ε : ℝ≥0, 0 < ε ∧
      ∃ E : Set α,
        MeasurableSet E ∧ 0 < ν E ∧ 0 ≤[E] μ.toSignedMeasure - (ε • ν).toSignedMeasure := by
  -- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
  have :
    ∀ n : ℕ, ∃ i : Set α,
      MeasurableSet i ∧
        0 ≤[i] μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ∧
          μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[iᶜ] 0 := by
    intro; exact exists_compl_positive_negative _
  choose f hf₁ hf₂ hf₃ using this
  -- set `A` to be the intersection of all the negative parts of obtained Hahn decompositions
  -- and we show that `μ A = 0`
  set A := ⋂ n, (f n)ᶜ with hA₁
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
h : ¬μ ⟂ₘ ν
f : ℕ → Set α
hf₁ : ∀ (n : ℕ), MeasurableSet (f n)
hf₂ :
  ∀ (n : ℕ),
    VectorMeasure.restrict 0 (f n) ≤
      VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) (f n)
hf₃ :
  ∀ (n : ℕ),
    VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) (f n)ᶜ ≤
      VectorMeasure.restrict 0 (f n)ᶜ
A : Set α := ⋂ n, (f n)ᶜ
hA₁ : A = ⋂ n, (f n)ᶜ
⊢ ∃ ε,
    0 < ε ∧
      ∃ E,
        MeasurableSet E ∧
          0 < ↑↑ν E ∧
            VectorMeasure.restrict 0 E ≤ VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure (ε • ν)) E

Next tactic:
have hAmeas : MeasurableSet A := MeasurableSet.iInter fun n => (hf₁ n).compl
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.

This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
    [IsFiniteMeasure ν] (h : ¬μ ⟂ₘ ν) :
    ∃ ε : ℝ≥0, 0 < ε ∧
      ∃ E : Set α,
        MeasurableSet E ∧ 0 < ν E ∧ 0 ≤[E] μ.toSignedMeasure - (ε • ν).toSignedMeasure := by
  -- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
  have :
    ∀ n : ℕ, ∃ i : Set α,
      MeasurableSet i ∧
        0 ≤[i] μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ∧
          μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[iᶜ] 0 := by
    intro; exact exists_compl_positive_negative _
  choose f hf₁ hf₂ hf₃ using this
  -- set `A` to be the intersection of all the negative parts of obtained Hahn decompositions
  -- and we show that `μ A = 0`
  set A := ⋂ n, (f n)ᶜ with hA₁
  have hAmeas : MeasurableSet A := MeasurableSet.iInter fun n => (hf₁ n).compl
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
h : ¬μ ⟂ₘ ν
f : ℕ → Set α
hf₁ : ∀ (n : ℕ), MeasurableSet (f n)
hf₂ :
  ∀ (n : ℕ),
    VectorMeasure.restrict 0 (f n) ≤
      VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) (f n)
hf₃ :
  ∀ (n : ℕ),
    VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) (f n)ᶜ ≤
      VectorMeasure.restrict 0 (f n)ᶜ
A : Set α := ⋂ n, (f n)ᶜ
hA₁ : A = ⋂ n, (f n)ᶜ
hAmeas : MeasurableSet A
⊢ ∃ ε,
    0 < ε ∧
      ∃ E,
        MeasurableSet E ∧
          0 < ↑↑ν E ∧
            VectorMeasure.restrict 0 E ≤ VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure (ε • ν)) E

Next tactic:
have hA₂ : ∀ n : ℕ, μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[A] 0 := by
    intro n; exact restrict_le_restrict_subset _ _ (hf₁ n).compl (hf₃ n) (iInter_subset _ _)
/-- If two finite measures `μ` and `ν` are not mutually singular, there exists some `ε > 0` and
a measurable set `E`, such that `ν(E) > 0` and `E` is positive with respect to `μ - εν`.

This lemma is useful for the Lebesgue decomposition theorem. -/
theorem exists_positive_of_not_mutuallySingular (μ ν : Measure α) [IsFiniteMeasure μ]
    [IsFiniteMeasure ν] (h : ¬μ ⟂ₘ ν) :
    ∃ ε : ℝ≥0, 0 < ε ∧
      ∃ E : Set α,
        MeasurableSet E ∧ 0 < ν E ∧ 0 ≤[E] μ.toSignedMeasure - (ε • ν).toSignedMeasure := by
  -- for all `n : ℕ`, obtain the Hahn decomposition for `μ - (1 / n) ν`
  have :
    ∀ n : ℕ, ∃ i : Set α,
      MeasurableSet i ∧
        0 ≤[i] μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ∧
          μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[iᶜ] 0 := by
    intro; exact exists_compl_positive_negative _
  choose f hf₁ hf₂ hf₃ using this
  -- set `A` to be the intersection of all the negative parts of obtained Hahn decompositions
  -- and we show that `μ A = 0`
  set A := ⋂ n, (f n)ᶜ with hA₁
  have hAmeas : MeasurableSet A := MeasurableSet.iInter fun n => (hf₁ n).compl
  have hA₂ : ∀ n : ℕ, μ.toSignedMeasure - ((1 / (n + 1) : ℝ≥0) • ν).toSignedMeasure ≤[A] 0 := by
    

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
μ✝ ν✝ μ ν : Measure α
inst✝¹ : IsFiniteMeasure μ
inst✝ : IsFiniteMeasure ν
h : ¬μ ⟂ₘ ν
f : ℕ → Set α
hf₁ : ∀ (n : ℕ), MeasurableSet (f n)
hf₂ :
  ∀ (n : ℕ),
    VectorMeasure.restrict 0 (f n) ≤
      VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) (f n)
hf₃ :
  ∀ (n : ℕ),
    VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) (f n)ᶜ ≤
      VectorMeasure.restrict 0 (f n)ᶜ
A : Set α := ⋂ n, (f n)ᶜ
hA₁ : A = ⋂ n, (f n)ᶜ
hAmeas : MeasurableSet A
⊢ ∀ (n : ℕ),
    VectorMeasure.restrict (toSignedMeasure μ - toSignedMeasure ((1 / (↑n + 1)) • ν)) A ≤ VectorMeasure.restrict 0 A

Next tactic:
intro n