l3lab/ntp-mathlib huggingface dataset:
@[instance]
theorem Measure.isFiniteMeasure_map {m : MeasurableSpace α} (μ : Measure α) [IsFiniteMeasure μ]
    (f : α → β) : IsFiniteMeasure (μ.map f) := by
  by_cases hf : AEMeasurable f μ
  · constructor
    rw [map_apply_of_aemeasurable hf MeasurableSet.univ]
    

Proof state:
case pos.measure_univ_lt_top
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
m : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
f : α → β
hf : AEMeasurable f
⊢ ↑↑μ (f ⁻¹' univ) < ⊤

Next tactic:
exact measure_lt_top μ _
@[instance]
theorem Measure.isFiniteMeasure_map {m : MeasurableSpace α} (μ : Measure α) [IsFiniteMeasure μ]
    (f : α → β) : IsFiniteMeasure (μ.map f) := by
  by_cases hf : AEMeasurable f μ
  · constructor
    rw [map_apply_of_aemeasurable hf MeasurableSet.univ]
    exact measure_lt_top μ _
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
m : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
f : α → β
hf : ¬AEMeasurable f
⊢ IsFiniteMeasure (map f μ)

Next tactic:
rw [map_of_not_aemeasurable hf]
@[instance]
theorem Measure.isFiniteMeasure_map {m : MeasurableSpace α} (μ : Measure α) [IsFiniteMeasure μ]
    (f : α → β) : IsFiniteMeasure (μ.map f) := by
  by_cases hf : AEMeasurable f μ
  · constructor
    rw [map_apply_of_aemeasurable hf MeasurableSet.univ]
    exact measure_lt_top μ _
  · rw [map_of_not_aemeasurable hf]
    

Proof state:
case neg
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
m : MeasurableSpace α
μ : Measure α
inst✝ : IsFiniteMeasure μ
f : α → β
hf : ¬AEMeasurable f
⊢ IsFiniteMeasure 0

Next tactic:
exact MeasureTheory.isFiniteMeasureZero
@[simp]
theorem measureUnivNNReal_eq_zero [IsFiniteMeasure μ] : measureUnivNNReal μ = 0 ↔ μ = 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsFiniteMeasure μ
⊢ measureUnivNNReal μ = 0 ↔ μ = 0

Next tactic:
rw [← MeasureTheory.Measure.measure_univ_eq_zero, ← coe_measureUnivNNReal]
@[simp]
theorem measureUnivNNReal_eq_zero [IsFiniteMeasure μ] : measureUnivNNReal μ = 0 ↔ μ = 0 := by
  rw [← MeasureTheory.Measure.measure_univ_eq_zero, ← coe_measureUnivNNReal]
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsFiniteMeasure μ
⊢ measureUnivNNReal μ = 0 ↔ ↑(measureUnivNNReal μ) = 0

Next tactic:
norm_cast
theorem measureUnivNNReal_pos [IsFiniteMeasure μ] (hμ : μ ≠ 0) : 0 < measureUnivNNReal μ := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsFiniteMeasure μ
hμ : μ ≠ 0
⊢ 0 < measureUnivNNReal μ

Next tactic:
contrapose! hμ
theorem measureUnivNNReal_pos [IsFiniteMeasure μ] (hμ : μ ≠ 0) : 0 < measureUnivNNReal μ := by
  contrapose! hμ
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsFiniteMeasure μ
hμ : measureUnivNNReal μ ≤ 0
⊢ μ = 0

Next tactic:
simpa [measureUnivNNReal_eq_zero, le_zero_iff] using hμ
theorem summable_measure_toReal [hμ : IsFiniteMeasure μ] {f : ℕ → Set α}
    (hf₁ : ∀ i : ℕ, MeasurableSet (f i)) (hf₂ : Pairwise (Disjoint on f)) :
    Summable fun x => (μ (f x)).toReal := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hμ : IsFiniteMeasure μ
f : ℕ → Set α
hf₁ : ∀ (i : ℕ), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
⊢ Summable fun x => ENNReal.toReal (↑↑μ (f x))

Next tactic:
apply ENNReal.summable_toReal
theorem summable_measure_toReal [hμ : IsFiniteMeasure μ] {f : ℕ → Set α}
    (hf₁ : ∀ i : ℕ, MeasurableSet (f i)) (hf₂ : Pairwise (Disjoint on f)) :
    Summable fun x => (μ (f x)).toReal := by
  apply ENNReal.summable_toReal
  

Proof state:
case hsum
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hμ : IsFiniteMeasure μ
f : ℕ → Set α
hf₁ : ∀ (i : ℕ), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
⊢ ∑' (x : ℕ), ↑↑μ (f x) ≠ ⊤

Next tactic:
rw [← MeasureTheory.measure_iUnion hf₂ hf₁]
theorem summable_measure_toReal [hμ : IsFiniteMeasure μ] {f : ℕ → Set α}
    (hf₁ : ∀ i : ℕ, MeasurableSet (f i)) (hf₂ : Pairwise (Disjoint on f)) :
    Summable fun x => (μ (f x)).toReal := by
  apply ENNReal.summable_toReal
  rw [← MeasureTheory.measure_iUnion hf₂ hf₁]
  

Proof state:
case hsum
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hμ : IsFiniteMeasure μ
f : ℕ → Set α
hf₁ : ∀ (i : ℕ), MeasurableSet (f i)
hf₂ : Pairwise (Disjoint on f)
⊢ ↑↑μ (⋃ i, f i) ≠ ⊤

Next tactic:
exact ne_of_lt (measure_lt_top _ _)
theorem ae_eq_univ_iff_measure_eq [IsFiniteMeasure μ] (hs : NullMeasurableSet s μ) :
    s =ᵐ[μ] univ ↔ μ s = μ univ := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsFiniteMeasure μ
hs : NullMeasurableSet s
⊢ s =ᶠ[ae μ] univ ↔ ↑↑μ s = ↑↑μ univ

Next tactic:
refine' ⟨measure_congr, fun h => _⟩
theorem ae_eq_univ_iff_measure_eq [IsFiniteMeasure μ] (hs : NullMeasurableSet s μ) :
    s =ᵐ[μ] univ ↔ μ s = μ univ := by
  refine' ⟨measure_congr, fun h => _⟩
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsFiniteMeasure μ
hs : NullMeasurableSet s
h : ↑↑μ s = ↑↑μ univ
⊢ s =ᶠ[ae μ] univ

Next tactic:
obtain ⟨t, -, ht₁, ht₂⟩ := hs.exists_measurable_subset_ae_eq
theorem ae_eq_univ_iff_measure_eq [IsFiniteMeasure μ] (hs : NullMeasurableSet s μ) :
    s =ᵐ[μ] univ ↔ μ s = μ univ := by
  refine' ⟨measure_congr, fun h => _⟩
  obtain ⟨t, -, ht₁, ht₂⟩ := hs.exists_measurable_subset_ae_eq
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t✝ : Set α
inst✝ : IsFiniteMeasure μ
hs : NullMeasurableSet s
h : ↑↑μ s = ↑↑μ univ
t : Set α
ht₁ : MeasurableSet t
ht₂ : t =ᶠ[ae μ] s
⊢ s =ᶠ[ae μ] univ

Next tactic:
exact
    ht₂.symm.trans
      (ae_eq_of_subset_of_measure_ge (subset_univ t) (Eq.le ((measure_congr ht₂).trans h).symm) ht₁
        (measure_ne_top μ univ))
theorem ae_iff_measure_eq [IsFiniteMeasure μ] {p : α → Prop}
    (hp : NullMeasurableSet { a | p a } μ) : (∀ᵐ a ∂μ, p a) ↔ μ { a | p a } = μ univ := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsFiniteMeasure μ
p : α → Prop
hp : NullMeasurableSet {a | p a}
⊢ (∀ᵐ (a : α) ∂μ, p a) ↔ ↑↑μ {a | p a} = ↑↑μ univ

Next tactic:
rw [← ae_eq_univ_iff_measure_eq hp, eventuallyEq_univ, eventually_iff]
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
⊢ |ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t)| ≤ ENNReal.toReal (↑↑μ (s ∆ t))

Next tactic:
have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
hst : ↑↑μ (s \ t) ≠ ⊤
⊢ |ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t)| ≤ ENNReal.toReal (↑↑μ (s ∆ t))

Next tactic:
have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset (diff_subset t s) ht').ne
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
  have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset (diff_subset t s) ht').ne
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
hst : ↑↑μ (s \ t) ≠ ⊤
hts : ↑↑μ (t \ s) ≠ ⊤
⊢ |ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t)| ≤ ENNReal.toReal (↑↑μ (s ∆ t))

Next tactic:
suffices : (μ s).toReal - (μ t).toReal = (μ (s \ t)).toReal - (μ (t \ s)).toReal
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
  have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset (diff_subset t s) ht').ne
  suffices : (μ s).toReal - (μ t).toReal = (μ (s \ t)).toReal - (μ (t \ s)).toReal
  · 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
hst : ↑↑μ (s \ t) ≠ ⊤
hts : ↑↑μ (t \ s) ≠ ⊤
this : ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t) = ENNReal.toReal (↑↑μ (s \ t)) - ENNReal.toReal (↑↑μ (t \ s))
⊢ |ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t)| ≤ ENNReal.toReal (↑↑μ (s ∆ t))

Next tactic:
rw [this, measure_symmDiff_eq hs ht, ENNReal.toReal_add hst hts]
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
  have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset (diff_subset t s) ht').ne
  suffices : (μ s).toReal - (μ t).toReal = (μ (s \ t)).toReal - (μ (t \ s)).toReal
  · rw [this, measure_symmDiff_eq hs ht, ENNReal.toReal_add hst hts]
    

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
hst : ↑↑μ (s \ t) ≠ ⊤
hts : ↑↑μ (t \ s) ≠ ⊤
this : ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t) = ENNReal.toReal (↑↑μ (s \ t)) - ENNReal.toReal (↑↑μ (t \ s))
⊢ |ENNReal.toReal (↑↑μ (s \ t)) - ENNReal.toReal (↑↑μ (t \ s))| ≤
    ENNReal.toReal (↑↑μ (s \ t)) + ENNReal.toReal (↑↑μ (t \ s))

Next tactic:
convert abs_sub (μ (s \ t)).toReal (μ (t \ s)).toReal
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
  have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset (diff_subset t s) ht').ne
  suffices : (μ s).toReal - (μ t).toReal = (μ (s \ t)).toReal - (μ (t \ s)).toReal
  · rw [this, measure_symmDiff_eq hs ht, ENNReal.toReal_add hst hts]
    convert abs_sub (μ (s \ t)).toReal (μ (t \ s)).toReal <;> 

Proof state:
case h.e'_4.h.e'_5
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
hst : ↑↑μ (s \ t) ≠ ⊤
hts : ↑↑μ (t \ s) ≠ ⊤
this : ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t) = ENNReal.toReal (↑↑μ (s \ t)) - ENNReal.toReal (↑↑μ (t \ s))
⊢ ENNReal.toReal (↑↑μ (s \ t)) = |ENNReal.toReal (↑↑μ (s \ t))|

Next tactic:
simp
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
  have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset (diff_subset t s) ht').ne
  suffices : (μ s).toReal - (μ t).toReal = (μ (s \ t)).toReal - (μ (t \ s)).toReal
  · rw [this, measure_symmDiff_eq hs ht, ENNReal.toReal_add hst hts]
    convert abs_sub (μ (s \ t)).toReal (μ (t \ s)).toReal <;> 

Proof state:
case h.e'_4.h.e'_6
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
hst : ↑↑μ (s \ t) ≠ ⊤
hts : ↑↑μ (t \ s) ≠ ⊤
this : ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t) = ENNReal.toReal (↑↑μ (s \ t)) - ENNReal.toReal (↑↑μ (t \ s))
⊢ ENNReal.toReal (↑↑μ (t \ s)) = |ENNReal.toReal (↑↑μ (t \ s))|

Next tactic:
simp
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
  have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset (diff_subset t s) ht').ne
  suffices : (μ s).toReal - (μ t).toReal = (μ (s \ t)).toReal - (μ (t \ s)).toReal
  · rw [this, measure_symmDiff_eq hs ht, ENNReal.toReal_add hst hts]
    convert abs_sub (μ (s \ t)).toReal (μ (t \ s)).toReal <;> simp
  

Proof state:
case this
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
hst : ↑↑μ (s \ t) ≠ ⊤
hts : ↑↑μ (t \ s) ≠ ⊤
⊢ ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t) = ENNReal.toReal (↑↑μ (s \ t)) - ENNReal.toReal (↑↑μ (t \ s))

Next tactic:
rw [measure_diff' s ht ht', measure_diff' t hs hs',
    ENNReal.toReal_sub_of_le measure_le_measure_union_right (measure_union_ne_top hs' ht'),
    ENNReal.toReal_sub_of_le measure_le_measure_union_right (measure_union_ne_top ht' hs'),
    union_comm t s]
theorem abs_toReal_measure_sub_le_measure_symmDiff'
    (hs : MeasurableSet s) (ht : MeasurableSet t) (hs' : μ s ≠ ∞) (ht' : μ t ≠ ∞) :
    |(μ s).toReal - (μ t).toReal| ≤ (μ (s ∆ t)).toReal := by
  have hst : μ (s \ t) ≠ ∞ := (measure_lt_top_of_subset (diff_subset s t) hs').ne
  have hts : μ (t \ s) ≠ ∞ := (measure_lt_top_of_subset (diff_subset t s) ht').ne
  suffices : (μ s).toReal - (μ t).toReal = (μ (s \ t)).toReal - (μ (t \ s)).toReal
  · rw [this, measure_symmDiff_eq hs ht, ENNReal.toReal_add hst hts]
    convert abs_sub (μ (s \ t)).toReal (μ (t \ s)).toReal <;> simp
  rw [measure_diff' s ht ht', measure_diff' t hs hs',
    ENNReal.toReal_sub_of_le measure_le_measure_union_right (measure_union_ne_top hs' ht'),
    ENNReal.toReal_sub_of_le measure_le_measure_union_right (measure_union_ne_top ht' hs'),
    union_comm t s]
  

Proof state:
case this
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
hs : MeasurableSet s
ht : MeasurableSet t
hs' : ↑↑μ s ≠ ⊤
ht' : ↑↑μ t ≠ ⊤
hst : ↑↑μ (s \ t) ≠ ⊤
hts : ↑↑μ (t \ s) ≠ ⊤
⊢ ENNReal.toReal (↑↑μ s) - ENNReal.toReal (↑↑μ t) =
    ENNReal.toReal (↑↑μ (s ∪ t)) - ENNReal.toReal (↑↑μ t) - (ENNReal.toReal (↑↑μ (s ∪ t)) - ENNReal.toReal (↑↑μ s))

Next tactic:
abel
instance (priority := 100) IsProbabilityMeasure.toIsFiniteMeasure (μ : Measure α)
    [IsProbabilityMeasure μ] : IsFiniteMeasure μ :=
  ⟨by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
μ : Measure α
inst✝ : IsProbabilityMeasure μ
⊢ ↑↑μ univ < ⊤

Next tactic:
simp only [measure_univ, ENNReal.one_lt_top]
theorem IsProbabilityMeasure.ne_zero (μ : Measure α) [IsProbabilityMeasure μ] : μ ≠ 0 :=
  mt measure_univ_eq_zero.2 <| by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
μ : Measure α
inst✝ : IsProbabilityMeasure μ
⊢ ¬↑↑μ univ = 0

Next tactic:
simp [measure_univ]
theorem isProbabilityMeasure_map [IsProbabilityMeasure μ] {f : α → β} (hf : AEMeasurable f μ) :
    IsProbabilityMeasure (map f μ) :=
  ⟨by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsProbabilityMeasure μ
f : α → β
hf : AEMeasurable f
⊢ ↑↑(Measure.map f μ) univ = 1

Next tactic:
simp [map_apply_of_aemeasurable, hf]
/-- Note that this is not quite as useful as it looks because the measure takes values in `ℝ≥0∞`.
Thus the subtraction appearing is the truncated subtraction of `ℝ≥0∞`, rather than the
better-behaved subtraction of `ℝ`. -/
theorem prob_compl_eq_one_sub [IsProbabilityMeasure μ] (hs : MeasurableSet s) : μ sᶜ = 1 - μ s :=
  by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsProbabilityMeasure μ
hs : MeasurableSet s
⊢ ↑↑μ sᶜ = 1 - ↑↑μ s

Next tactic:
simpa only [measure_univ] using measure_compl hs (measure_lt_top μ s).ne
@[simp]
theorem prob_compl_eq_zero_iff [IsProbabilityMeasure μ] (hs : MeasurableSet s) :
    μ sᶜ = 0 ↔ μ s = 1 := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsProbabilityMeasure μ
hs : MeasurableSet s
⊢ ↑↑μ sᶜ = 0 ↔ ↑↑μ s = 1

Next tactic:
rw [prob_compl_eq_one_sub hs, tsub_eq_zero_iff_le, one_le_prob_iff]
@[simp]
theorem prob_compl_eq_one_iff [IsProbabilityMeasure μ] (hs : MeasurableSet s) :
    μ sᶜ = 1 ↔ μ s = 0 := by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsProbabilityMeasure μ
hs : MeasurableSet s
⊢ ↑↑μ sᶜ = 1 ↔ ↑↑μ s = 0

Next tactic:
rw [← prob_compl_eq_zero_iff hs.compl, compl_compl]
lemma isProbabilityMeasure_comap (hf : Injective f) (hf' : ∀ᵐ a ∂μ, a ∈ range f)
    (hf'' : ∀ s, MeasurableSet s → MeasurableSet (f '' s)) :
    IsProbabilityMeasure (μ.comap f) where
  measure_univ := by
    

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsProbabilityMeasure μ
p : α → Prop
f : β → α
hf : Injective f
hf' : ∀ᵐ (a : α) ∂μ, a ∈ range f
hf'' : ∀ (s : Set β), MeasurableSet s → MeasurableSet (f '' s)
⊢ ↑↑(Measure.comap f μ) univ = 1

Next tactic:
rw [comap_apply _ hf hf'' _ MeasurableSet.univ,
      ← mem_ae_iff_prob_eq_one (hf'' _ MeasurableSet.univ)]
lemma isProbabilityMeasure_comap (hf : Injective f) (hf' : ∀ᵐ a ∂μ, a ∈ range f)
    (hf'' : ∀ s, MeasurableSet s → MeasurableSet (f '' s)) :
    IsProbabilityMeasure (μ.comap f) where
  measure_univ := by
    rw [comap_apply _ hf hf'' _ MeasurableSet.univ,
      ← mem_ae_iff_prob_eq_one (hf'' _ MeasurableSet.univ)]
    

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : IsProbabilityMeasure μ
p : α → Prop
f : β → α
hf : Injective f
hf' : ∀ᵐ (a : α) ∂μ, a ∈ range f
hf'' : ∀ (s : Set β), MeasurableSet s → MeasurableSet (f '' s)
⊢ f '' univ ∈ ae μ

Next tactic:
simpa
theorem Measure.restrict_singleton' {a : α} : μ.restrict {a} = 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : NoAtoms μ
a : α
⊢ restrict μ {a} = 0

Next tactic:
simp only [measure_singleton, Measure.restrict_eq_zero]
instance Measure.restrict.instNoAtoms (s : Set α) : NoAtoms (μ.restrict s) := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
inst✝ : NoAtoms μ
s : Set α
⊢ NoAtoms (restrict μ s)

Next tactic:
refine' ⟨fun x => _⟩
instance Measure.restrict.instNoAtoms (s : Set α) : NoAtoms (μ.restrict s) := by
  refine' ⟨fun x => _⟩
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
inst✝ : NoAtoms μ
s : Set α
x : α
⊢ ↑↑(restrict μ s) {x} = 0

Next tactic:
obtain ⟨t, hxt, ht1, ht2⟩ := exists_measurable_superset_of_null (measure_singleton x : μ {x} = 0)
instance Measure.restrict.instNoAtoms (s : Set α) : NoAtoms (μ.restrict s) := by
  refine' ⟨fun x => _⟩
  obtain ⟨t, hxt, ht1, ht2⟩ := exists_measurable_superset_of_null (measure_singleton x : μ {x} = 0)
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t✝ : Set α
inst✝ : NoAtoms μ
s : Set α
x : α
t : Set α
hxt : {x} ⊆ t
ht1 : MeasurableSet t
ht2 : ↑↑μ t = 0
⊢ ↑↑(restrict μ s) {x} = 0

Next tactic:
apply measure_mono_null hxt
instance Measure.restrict.instNoAtoms (s : Set α) : NoAtoms (μ.restrict s) := by
  refine' ⟨fun x => _⟩
  obtain ⟨t, hxt, ht1, ht2⟩ := exists_measurable_superset_of_null (measure_singleton x : μ {x} = 0)
  apply measure_mono_null hxt
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t✝ : Set α
inst✝ : NoAtoms μ
s : Set α
x : α
t : Set α
hxt : {x} ⊆ t
ht1 : MeasurableSet t
ht2 : ↑↑μ t = 0
⊢ ↑↑(restrict μ s) t = 0

Next tactic:
rw [Measure.restrict_apply ht1]
instance Measure.restrict.instNoAtoms (s : Set α) : NoAtoms (μ.restrict s) := by
  refine' ⟨fun x => _⟩
  obtain ⟨t, hxt, ht1, ht2⟩ := exists_measurable_superset_of_null (measure_singleton x : μ {x} = 0)
  apply measure_mono_null hxt
  rw [Measure.restrict_apply ht1]
  

Proof state:
case intro.intro.intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t✝ : Set α
inst✝ : NoAtoms μ
s : Set α
x : α
t : Set α
hxt : {x} ⊆ t
ht1 : MeasurableSet t
ht2 : ↑↑μ t = 0
⊢ ↑↑μ (t ∩ s) = 0

Next tactic:
apply measure_mono_null (inter_subset_left t s) ht2
theorem _root_.Set.Countable.measure_zero (h : s.Countable) (μ : Measure α) [NoAtoms μ] :
    μ s = 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝¹ : NoAtoms μ✝
h : Set.Countable s
μ : Measure α
inst✝ : NoAtoms μ
⊢ ↑↑μ s = 0

Next tactic:
rw [← biUnion_of_singleton s, ← nonpos_iff_eq_zero]
theorem _root_.Set.Countable.measure_zero (h : s.Countable) (μ : Measure α) [NoAtoms μ] :
    μ s = 0 := by
  rw [← biUnion_of_singleton s, ← nonpos_iff_eq_zero]
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝¹ : NoAtoms μ✝
h : Set.Countable s
μ : Measure α
inst✝ : NoAtoms μ
⊢ ↑↑μ (⋃ x ∈ s, {x}) ≤ 0

Next tactic:
refine' le_trans (measure_biUnion_le h _) _
theorem _root_.Set.Countable.measure_zero (h : s.Countable) (μ : Measure α) [NoAtoms μ] :
    μ s = 0 := by
  rw [← biUnion_of_singleton s, ← nonpos_iff_eq_zero]
  refine' le_trans (measure_biUnion_le h _) _
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝¹ : NoAtoms μ✝
h : Set.Countable s
μ : Measure α
inst✝ : NoAtoms μ
⊢ ∑' (p : ↑s), ↑↑μ {↑p} ≤ 0

Next tactic:
simp