l3lab/ntp-mathlib huggingface dataset:
/-- This application lemma only works in special circumstances. Given knowledge of
when `μ ≤ ν` and `ν ≤ μ`, a more general application lemma can be written. -/
theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ μ) :
    (μ - ν) s = μ s - ν s := by
  -- We begin by defining `measure_sub`, which will be equal to `(μ - ν)`.
  let measure_sub : Measure α := MeasureTheory.Measure.ofMeasurable
    (fun (t : Set α) (_ : MeasurableSet t) => μ t - ν t) (by simp)
    (by
      intro g h_meas h_disj; simp only; rw [ENNReal.tsum_sub]
      repeat' rw [← MeasureTheory.measure_iUnion h_disj h_meas]
      exacts [MeasureTheory.measure_ne_top _ _, fun i => h₂ _ (h_meas _)])
  -- Now, we demonstrate `μ - ν = measure_sub`, and apply it.
  have h_measure_sub_add : ν + measure_sub = μ := by
    ext1 t h_t_measurable_set
    simp only [Pi.add_apply, coe_add]
    rw [MeasureTheory.Measure.ofMeasurable_apply _ h_t_measurable_set, add_comm,
      tsub_add_cancel_of_le (h₂ t h_t_measurable_set)]
  have h_measure_sub_eq : μ - ν = measure_sub := by
    rw [MeasureTheory.Measure.sub_def]
    apply le_antisymm
    · apply sInf_le
      simp [le_refl, add_comm, h_measure_sub_add]
    apply le_sInf
    intro d h_d
    

Proof state:
case a.a
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
inst✝ : IsFiniteMeasure ν
h₁ : MeasurableSet s
h₂ : ν ≤ μ
measure_sub : Measure α :=
  ofMeasurable (fun t x => ↑↑μ t - ↑↑ν t) (_ : ↑↑μ ∅ - ↑↑ν ∅ = 0)
    (_ :
      ∀ ⦃g : ℕ → Set α⦄ (h_meas : ∀ (i : ℕ), MeasurableSet (g i)),
        Pairwise (Disjoint on g) →
          (fun t x => ↑↑μ t - ↑↑ν t) (⋃ i, g i) (_ : MeasurableSet (⋃ b, g b)) =
            ∑' (i : ℕ), (fun t x => ↑↑μ t - ↑↑ν t) (g i) (_ : MeasurableSet (g i)))
h_measure_sub_add : ν + measure_sub = μ
d : Measure α
h_d : d ∈ {d | μ ≤ d + ν}
⊢ measure_sub ≤ d

Next tactic:
rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d
/-- This application lemma only works in special circumstances. Given knowledge of
when `μ ≤ ν` and `ν ≤ μ`, a more general application lemma can be written. -/
theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ μ) :
    (μ - ν) s = μ s - ν s := by
  -- We begin by defining `measure_sub`, which will be equal to `(μ - ν)`.
  let measure_sub : Measure α := MeasureTheory.Measure.ofMeasurable
    (fun (t : Set α) (_ : MeasurableSet t) => μ t - ν t) (by simp)
    (by
      intro g h_meas h_disj; simp only; rw [ENNReal.tsum_sub]
      repeat' rw [← MeasureTheory.measure_iUnion h_disj h_meas]
      exacts [MeasureTheory.measure_ne_top _ _, fun i => h₂ _ (h_meas _)])
  -- Now, we demonstrate `μ - ν = measure_sub`, and apply it.
  have h_measure_sub_add : ν + measure_sub = μ := by
    ext1 t h_t_measurable_set
    simp only [Pi.add_apply, coe_add]
    rw [MeasureTheory.Measure.ofMeasurable_apply _ h_t_measurable_set, add_comm,
      tsub_add_cancel_of_le (h₂ t h_t_measurable_set)]
  have h_measure_sub_eq : μ - ν = measure_sub := by
    rw [MeasureTheory.Measure.sub_def]
    apply le_antisymm
    · apply sInf_le
      simp [le_refl, add_comm, h_measure_sub_add]
    apply le_sInf
    intro d h_d
    rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d
    

Proof state:
case a.a
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
inst✝ : IsFiniteMeasure ν
h₁ : MeasurableSet s
h₂ : ν ≤ μ
measure_sub : Measure α :=
  ofMeasurable (fun t x => ↑↑μ t - ↑↑ν t) (_ : ↑↑μ ∅ - ↑↑ν ∅ = 0)
    (_ :
      ∀ ⦃g : ℕ → Set α⦄ (h_meas : ∀ (i : ℕ), MeasurableSet (g i)),
        Pairwise (Disjoint on g) →
          (fun t x => ↑↑μ t - ↑↑ν t) (⋃ i, g i) (_ : MeasurableSet (⋃ b, g b)) =
            ∑' (i : ℕ), (fun t x => ↑↑μ t - ↑↑ν t) (g i) (_ : MeasurableSet (g i)))
h_measure_sub_add : ν + measure_sub = μ
d : Measure α
h_d : ν + measure_sub ≤ ν + d
⊢ measure_sub ≤ d

Next tactic:
apply Measure.le_of_add_le_add_left h_d
/-- This application lemma only works in special circumstances. Given knowledge of
when `μ ≤ ν` and `ν ≤ μ`, a more general application lemma can be written. -/
theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ μ) :
    (μ - ν) s = μ s - ν s := by
  -- We begin by defining `measure_sub`, which will be equal to `(μ - ν)`.
  let measure_sub : Measure α := MeasureTheory.Measure.ofMeasurable
    (fun (t : Set α) (_ : MeasurableSet t) => μ t - ν t) (by simp)
    (by
      intro g h_meas h_disj; simp only; rw [ENNReal.tsum_sub]
      repeat' rw [← MeasureTheory.measure_iUnion h_disj h_meas]
      exacts [MeasureTheory.measure_ne_top _ _, fun i => h₂ _ (h_meas _)])
  -- Now, we demonstrate `μ - ν = measure_sub`, and apply it.
  have h_measure_sub_add : ν + measure_sub = μ := by
    ext1 t h_t_measurable_set
    simp only [Pi.add_apply, coe_add]
    rw [MeasureTheory.Measure.ofMeasurable_apply _ h_t_measurable_set, add_comm,
      tsub_add_cancel_of_le (h₂ t h_t_measurable_set)]
  have h_measure_sub_eq : μ - ν = measure_sub := by
    rw [MeasureTheory.Measure.sub_def]
    apply le_antisymm
    · apply sInf_le
      simp [le_refl, add_comm, h_measure_sub_add]
    apply le_sInf
    intro d h_d
    rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d
    apply Measure.le_of_add_le_add_left h_d
  

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
inst✝ : IsFiniteMeasure ν
h₁ : MeasurableSet s
h₂ : ν ≤ μ
measure_sub : Measure α :=
  ofMeasurable (fun t x => ↑↑μ t - ↑↑ν t) (_ : ↑↑μ ∅ - ↑↑ν ∅ = 0)
    (_ :
      ∀ ⦃g : ℕ → Set α⦄ (h_meas : ∀ (i : ℕ), MeasurableSet (g i)),
        Pairwise (Disjoint on g) →
          (fun t x => ↑↑μ t - ↑↑ν t) (⋃ i, g i) (_ : MeasurableSet (⋃ b, g b)) =
            ∑' (i : ℕ), (fun t x => ↑↑μ t - ↑↑ν t) (g i) (_ : MeasurableSet (g i)))
h_measure_sub_add : ν + measure_sub = μ
h_measure_sub_eq : μ - ν = measure_sub
⊢ ↑↑(μ - ν) s = ↑↑μ s - ↑↑ν s

Next tactic:
rw [h_measure_sub_eq]
/-- This application lemma only works in special circumstances. Given knowledge of
when `μ ≤ ν` and `ν ≤ μ`, a more general application lemma can be written. -/
theorem sub_apply [IsFiniteMeasure ν] (h₁ : MeasurableSet s) (h₂ : ν ≤ μ) :
    (μ - ν) s = μ s - ν s := by
  -- We begin by defining `measure_sub`, which will be equal to `(μ - ν)`.
  let measure_sub : Measure α := MeasureTheory.Measure.ofMeasurable
    (fun (t : Set α) (_ : MeasurableSet t) => μ t - ν t) (by simp)
    (by
      intro g h_meas h_disj; simp only; rw [ENNReal.tsum_sub]
      repeat' rw [← MeasureTheory.measure_iUnion h_disj h_meas]
      exacts [MeasureTheory.measure_ne_top _ _, fun i => h₂ _ (h_meas _)])
  -- Now, we demonstrate `μ - ν = measure_sub`, and apply it.
  have h_measure_sub_add : ν + measure_sub = μ := by
    ext1 t h_t_measurable_set
    simp only [Pi.add_apply, coe_add]
    rw [MeasureTheory.Measure.ofMeasurable_apply _ h_t_measurable_set, add_comm,
      tsub_add_cancel_of_le (h₂ t h_t_measurable_set)]
  have h_measure_sub_eq : μ - ν = measure_sub := by
    rw [MeasureTheory.Measure.sub_def]
    apply le_antisymm
    · apply sInf_le
      simp [le_refl, add_comm, h_measure_sub_add]
    apply le_sInf
    intro d h_d
    rw [← h_measure_sub_add, mem_setOf_eq, add_comm d] at h_d
    apply Measure.le_of_add_le_add_left h_d
  rw [h_measure_sub_eq]
  

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
inst✝ : IsFiniteMeasure ν
h₁ : MeasurableSet s
h₂ : ν ≤ μ
measure_sub : Measure α :=
  ofMeasurable (fun t x => ↑↑μ t - ↑↑ν t) (_ : ↑↑μ ∅ - ↑↑ν ∅ = 0)
    (_ :
      ∀ ⦃g : ℕ → Set α⦄ (h_meas : ∀ (i : ℕ), MeasurableSet (g i)),
        Pairwise (Disjoint on g) →
          (fun t x => ↑↑μ t - ↑↑ν t) (⋃ i, g i) (_ : MeasurableSet (⋃ b, g b)) =
            ∑' (i : ℕ), (fun t x => ↑↑μ t - ↑↑ν t) (g i) (_ : MeasurableSet (g i)))
h_measure_sub_add : ν + measure_sub = μ
h_measure_sub_eq : μ - ν = measure_sub
⊢ ↑↑measure_sub s = ↑↑μ s - ↑↑ν s

Next tactic:
apply Measure.ofMeasurable_apply _ h₁
theorem sub_add_cancel_of_le [IsFiniteMeasure ν] (h₁ : ν ≤ μ) : μ - ν + ν = μ := by
  

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
inst✝ : IsFiniteMeasure ν
h₁ : ν ≤ μ
⊢ μ - ν + ν = μ

Next tactic:
ext1 s h_s_meas
theorem sub_add_cancel_of_le [IsFiniteMeasure ν] (h₁ : ν ≤ μ) : μ - ν + ν = μ := by
  ext1 s h_s_meas
  

Proof state:
case h
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s✝ : Set α
inst✝ : IsFiniteMeasure ν
h₁ : ν ≤ μ
s : Set α
h_s_meas : MeasurableSet s
⊢ ↑↑(μ - ν + ν) s = ↑↑μ s

Next tactic:
rw [add_apply, sub_apply h_s_meas h₁, tsub_add_cancel_of_le (h₁ s h_s_meas)]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
⊢ restrict (μ - ν) s = restrict μ s - restrict ν s

Next tactic:
repeat' rw [sub_def]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' 

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
⊢ restrict (μ - ν) s = restrict μ s - restrict ν s

Next tactic:
rw [sub_def]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' 

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
⊢ restrict (sInf {d | μ ≤ d + ν}) s = restrict μ s - restrict ν s

Next tactic:
rw [sub_def]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' 

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
⊢ restrict (sInf {d | μ ≤ d + ν}) s = sInf {d | restrict μ s ≤ d + restrict ν s}

Next tactic:
rw [sub_def]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
⊢ restrict (sInf {d | μ ≤ d + ν}) s = sInf {d | restrict μ s ≤ d + restrict ν s}

Next tactic:
have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
⊢ restrict (sInf {d | μ ≤ d + ν}) s = sInf {d | restrict μ s ≤ d + restrict ν s}

Next tactic:
rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  

Proof state:
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
⊢ sInf ((fun μ => restrict μ s) '' {d | μ ≤ d + ν}) = sInf {d | restrict μ s ≤ d + restrict ν s}

Next tactic:
apply le_antisymm
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · 

Proof state:
case a
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
⊢ sInf ((fun μ => restrict μ s) '' {d | μ ≤ d + ν}) ≤ sInf {d | restrict μ s ≤ d + restrict ν s}

Next tactic:
refine' sInf_le_sInf_of_forall_exists_le _
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    

Proof state:
case a
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
⊢ ∀ x ∈ {d | restrict μ s ≤ d + restrict ν s}, ∃ y ∈ (fun μ => restrict μ s) '' {d | μ ≤ d + ν}, y ≤ x

Next tactic:
intro ν' h_ν'_in
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    

Proof state:
case a
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : ν' ∈ {d | restrict μ s ≤ d + restrict ν s}
⊢ ∃ y ∈ (fun μ => restrict μ s) '' {d | μ ≤ d + ν}, y ≤ ν'

Next tactic:
rw [mem_setOf_eq] at h_ν'_in
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    

Proof state:
case a
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
⊢ ∃ y ∈ (fun μ => restrict μ s) '' {d | μ ≤ d + ν}, y ≤ ν'

Next tactic:
refine' ⟨ν'.restrict s, _, restrict_le_self⟩
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    

Proof state:
case a
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
⊢ restrict ν' s ∈ (fun μ => restrict μ s) '' {d | μ ≤ d + ν}

Next tactic:
refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · 

Proof state:
case a.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
⊢ ν' + restrict ⊤ sᶜ ∈ {d | μ ≤ d + ν}

Next tactic:
rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
      

Proof state:
case a.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
⊢ ∀ (s_1 : Set α), MeasurableSet s_1 → ↑↑μ s_1 ≤ ↑↑(ν' + ν + restrict ⊤ sᶜ) s_1

Next tactic:
intro t h_meas_t
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
      intro t h_meas_t
      

Proof state:
case a.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
t : Set α
h_meas_t : MeasurableSet t
⊢ ↑↑μ t ≤ ↑↑(ν' + ν + restrict ⊤ sᶜ) t

Next tactic:
repeat' rw [← measure_inter_add_diff t h_meas_s]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
      intro t h_meas_t
      repeat' 

Proof state:
case a.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
t : Set α
h_meas_t : MeasurableSet t
⊢ ↑↑μ t ≤ ↑↑(ν' + ν + restrict ⊤ sᶜ) t

Next tactic:
rw [← measure_inter_add_diff t h_meas_s]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
      intro t h_meas_t
      repeat' 

Proof state:
case a.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
t : Set α
h_meas_t : MeasurableSet t
⊢ ↑↑μ (t ∩ s) + ↑↑μ (t \ s) ≤ ↑↑(ν' + ν + restrict ⊤ sᶜ) t

Next tactic:
rw [← measure_inter_add_diff t h_meas_s]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
      intro t h_meas_t
      repeat' 

Proof state:
case a.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
t : Set α
h_meas_t : MeasurableSet t
⊢ ↑↑μ (t ∩ s) + ↑↑μ (t \ s) ≤ ↑↑(ν' + ν + restrict ⊤ sᶜ) (t ∩ s) + ↑↑(ν' + ν + restrict ⊤ sᶜ) (t \ s)

Next tactic:
rw [← measure_inter_add_diff t h_meas_s]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
      intro t h_meas_t
      repeat' rw [← measure_inter_add_diff t h_meas_s]
      

Proof state:
case a.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
t : Set α
h_meas_t : MeasurableSet t
⊢ ↑↑μ (t ∩ s) + ↑↑μ (t \ s) ≤ ↑↑(ν' + ν + restrict ⊤ sᶜ) (t ∩ s) + ↑↑(ν' + ν + restrict ⊤ sᶜ) (t \ s)

Next tactic:
refine' add_le_add _ _
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
      intro t h_meas_t
      repeat' rw [← measure_inter_add_diff t h_meas_s]
      refine' add_le_add _ _
      · 

Proof state:
case a.refine'_1.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
t : Set α
h_meas_t : MeasurableSet t
⊢ ↑↑μ (t ∩ s) ≤ ↑↑(ν' + ν + restrict ⊤ sᶜ) (t ∩ s)

Next tactic:
rw [add_apply, add_apply]
theorem restrict_sub_eq_restrict_sub_restrict (h_meas_s : MeasurableSet s) :
    (μ - ν).restrict s = μ.restrict s - ν.restrict s := by
  repeat' rw [sub_def]
  have h_nonempty : { d | μ ≤ d + ν }.Nonempty := ⟨μ, Measure.le_add_right le_rfl⟩
  rw [restrict_sInf_eq_sInf_restrict h_nonempty h_meas_s]
  apply le_antisymm
  · refine' sInf_le_sInf_of_forall_exists_le _
    intro ν' h_ν'_in
    rw [mem_setOf_eq] at h_ν'_in
    refine' ⟨ν'.restrict s, _, restrict_le_self⟩
    refine' ⟨ν' + (⊤ : Measure α).restrict sᶜ, _, _⟩
    · rw [mem_setOf_eq, add_right_comm, Measure.le_iff]
      intro t h_meas_t
      repeat' rw [← measure_inter_add_diff t h_meas_s]
      refine' add_le_add _ _
      · rw [add_apply, add_apply]
        

Proof state:
case a.refine'_1.refine'_1
α : Type u_1
m : MeasurableSpace α
μ ν : Measure α
s : Set α
h_meas_s : MeasurableSet s
h_nonempty : Set.Nonempty {d | μ ≤ d + ν}
ν' : Measure α
h_ν'_in : restrict μ s ≤ ν' + restrict ν s
t : Set α
h_meas_t : MeasurableSet t
⊢ ↑↑μ (t ∩ s) ≤ ↑↑ν' (t ∩ s) + ↑↑ν (t ∩ s) + ↑↑(restrict ⊤ sᶜ) (t ∩ s)

Next tactic:
apply le_add_right _