l3lab/ntp-mathlib huggingface dataset:
theorem ae_of_ae_restrict_of_ae_restrict_compl (t : Set α) {p : α → Prop}
    (ht : ∀ᵐ x ∂μ.restrict t, p x) (htc : ∀ᵐ x ∂μ.restrict tᶜ, p x) : ∀ᵐ x ∂μ, p x :=
  nonpos_iff_eq_zero.1 <|
    calc
      μ { x | ¬p x } = μ ({ x | ¬p x } ∩ t ∪ { x | ¬p x } ∩ tᶜ) := by
        

Proof state:
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t✝ t : Set α
p : α → Prop
ht : ∀ᵐ (x : α) ∂Measure.restrict μ t, p x
htc : ∀ᵐ (x : α) ∂Measure.restrict μ tᶜ, p x
⊢ ↑↑μ {x | ¬p x} = ↑↑μ ({x | ¬p x} ∩ t ∪ {x | ¬p x} ∩ tᶜ)

Next tactic:
rw [← inter_union_distrib_left, union_compl_self, inter_univ]
theorem ae_of_ae_restrict_of_ae_restrict_compl (t : Set α) {p : α → Prop}
    (ht : ∀ᵐ x ∂μ.restrict t, p x) (htc : ∀ᵐ x ∂μ.restrict tᶜ, p x) : ∀ᵐ x ∂μ, p x :=
  nonpos_iff_eq_zero.1 <|
    calc
      μ { x | ¬p x } = μ ({ x | ¬p x } ∩ t ∪ { x | ¬p x } ∩ tᶜ) := by
        rw [← inter_union_distrib_left, union_compl_self, inter_univ]
      _ ≤ μ ({ x | ¬p x } ∩ t) + μ ({ x | ¬p x } ∩ tᶜ) := (measure_union_le _ _)
      _ ≤ μ.restrict t { x | ¬p x } + μ.restrict tᶜ { x | ¬p x } :=
        (add_le_add (le_restrict_apply _ _) (le_restrict_apply _ _))
      _ = 0 := by 

Proof state:
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t✝ t : Set α
p : α → Prop
ht : ∀ᵐ (x : α) ∂Measure.restrict μ t, p x
htc : ∀ᵐ (x : α) ∂Measure.restrict μ tᶜ, p x
⊢ ↑↑(Measure.restrict μ t) {x | ¬p x} + ↑↑(Measure.restrict μ tᶜ) {x | ¬p x} = 0

Next tactic:
rw [ae_iff.1 ht, ae_iff.1 htc, zero_add]
theorem mem_map_restrict_ae_iff {β} {s : Set α} {t : Set β} {f : α → β} (hs : MeasurableSet s) :
    t ∈ Filter.map f (μ.restrict s).ae ↔ μ ((f ⁻¹' t)ᶜ ∩ s) = 0 := by
  

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β✝
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
s : Set α
t : Set β
f : α → β
hs : MeasurableSet s
⊢ t ∈ Filter.map f (ae (Measure.restrict μ s)) ↔ ↑↑μ ((f ⁻¹' t)ᶜ ∩ s) = 0

Next tactic:
rw [mem_map, mem_ae_iff, Measure.restrict_apply' hs]
theorem ae_smul_measure {p : α → Prop} [Monoid R] [DistribMulAction R ℝ≥0∞]
    [IsScalarTower R ℝ≥0∞ ℝ≥0∞] (h : ∀ᵐ x ∂μ, p x) (c : R) : ∀ᵐ x ∂c • μ, p x :=
  ae_iff.2 <| by 

Proof state:
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝⁴ : MeasurableSpace β
inst✝³ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t : Set α
p : α → Prop
inst✝² : Monoid R
inst✝¹ : DistribMulAction R ℝ≥0∞
inst✝ : IsScalarTower R ℝ≥0∞ ℝ≥0∞
h : ∀ᵐ (x : α) ∂μ, p x
c : R
⊢ ↑↑(c • μ) {a | ¬p a} = 0

Next tactic:
rw [smul_apply, ae_iff.1 h, smul_zero]
theorem sub_ae_eq_zero {β} [AddGroup β] (f g : α → β) : f - g =ᵐ[μ] 0 ↔ f =ᵐ[μ] g := by
  

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t : Set α
β : Type u_7
inst✝ : AddGroup β
f g : α → β
⊢ f - g =ᶠ[ae μ] 0 ↔ f =ᶠ[ae μ] g

Next tactic:
refine' ⟨fun h => h.mono fun x hx => _, fun h => h.mono fun x hx => _⟩
theorem sub_ae_eq_zero {β} [AddGroup β] (f g : α → β) : f - g =ᵐ[μ] 0 ↔ f =ᵐ[μ] g := by
  refine' ⟨fun h => h.mono fun x hx => _, fun h => h.mono fun x hx => _⟩
  · 

Proof state:
case refine'_1
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t : Set α
β : Type u_7
inst✝ : AddGroup β
f g : α → β
h : f - g =ᶠ[ae μ] 0
x : α
hx : (f - g) x = OfNat.ofNat 0 x
⊢ f x = g x

Next tactic:
rwa [Pi.sub_apply, Pi.zero_apply, sub_eq_zero] at hx
theorem sub_ae_eq_zero {β} [AddGroup β] (f g : α → β) : f - g =ᵐ[μ] 0 ↔ f =ᵐ[μ] g := by
  refine' ⟨fun h => h.mono fun x hx => _, fun h => h.mono fun x hx => _⟩
  · rwa [Pi.sub_apply, Pi.zero_apply, sub_eq_zero] at hx
  · 

Proof state:
case refine'_2
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t : Set α
β : Type u_7
inst✝ : AddGroup β
f g : α → β
h : f =ᶠ[ae μ] g
x : α
hx : f x = g x
⊢ (f - g) x = OfNat.ofNat 0 x

Next tactic:
rwa [Pi.sub_apply, Pi.zero_apply, sub_eq_zero]
@[simp]
theorem ae_restrict_eq (hs : MeasurableSet s) : (μ.restrict s).ae = μ.ae ⊓ 𝓟 s := by
  

Proof state:
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t : Set α
hs : MeasurableSet s
⊢ ae (Measure.restrict μ s) = ae μ ⊓ 𝓟 s

Next tactic:
ext t
@[simp]
theorem ae_restrict_eq (hs : MeasurableSet s) : (μ.restrict s).ae = μ.ae ⊓ 𝓟 s := by
  ext t
  

Proof state:
case a
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t✝ : Set α
hs : MeasurableSet s
t : Set α
⊢ t ∈ ae (Measure.restrict μ s) ↔ t ∈ ae μ ⊓ 𝓟 s

Next tactic:
simp only [mem_inf_principal, mem_ae_iff, restrict_apply_eq_zero' hs, compl_setOf, not_imp,
    fun a => and_comm (a := a ∈ s) (b := ¬a ∈ t)]
@[simp]
theorem ae_restrict_eq (hs : MeasurableSet s) : (μ.restrict s).ae = μ.ae ⊓ 𝓟 s := by
  ext t
  simp only [mem_inf_principal, mem_ae_iff, restrict_apply_eq_zero' hs, compl_setOf, not_imp,
    fun a => and_comm (a := a ∈ s) (b := ¬a ∈ t)]
  

Proof state:
case a
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t✝ : Set α
hs : MeasurableSet s
t : Set α
⊢ ↑↑μ (tᶜ ∩ s) = 0 ↔ ↑↑μ {a | a ∉ t ∧ a ∈ s} = 0

Next tactic:
rfl
theorem self_mem_ae_restrict {s} (hs : MeasurableSet s) : s ∈ (μ.restrict s).ae := by
  

Proof state:
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t s : Set α
hs : MeasurableSet s
⊢ s ∈ ae (Measure.restrict μ s)

Next tactic:
simp only [ae_restrict_eq hs, exists_prop, mem_principal, mem_inf_iff]
theorem self_mem_ae_restrict {s} (hs : MeasurableSet s) : s ∈ (μ.restrict s).ae := by
  simp only [ae_restrict_eq hs, exists_prop, mem_principal, mem_inf_iff]
  

Proof state:
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t s : Set α
hs : MeasurableSet s
⊢ ∃ t₁ ∈ ae μ, ∃ t₂, s ⊆ t₂ ∧ s = t₁ ∩ t₂

Next tactic:
exact ⟨_, univ_mem, s, Subset.rfl, (univ_inter s).symm⟩
/-- If two measurable sets are ae_eq then any proposition that is almost everywhere true on one
is almost everywhere true on the other -/
theorem ae_restrict_of_ae_eq_of_ae_restrict {s t} (hst : s =ᵐ[μ] t) {p : α → Prop} :
    (∀ᵐ x ∂μ.restrict s, p x) → ∀ᵐ x ∂μ.restrict t, p x := by 

Proof state:
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
s t : α → Prop
hst : s =ᶠ[ae μ] t
p : α → Prop
⊢ (∀ᵐ (x : α) ∂Measure.restrict μ s, p x) → ∀ᵐ (x : α) ∂Measure.restrict μ t, p x

Next tactic:
simp [Measure.restrict_congr_set hst]
/-- A version of the **Borel-Cantelli lemma**: if `pᵢ` is a sequence of predicates such that
`∑ μ {x | pᵢ x}` is finite, then the measure of `x` such that `pᵢ x` holds frequently as `i → ∞` (or
equivalently, `pᵢ x` holds for infinitely many `i`) is equal to zero. -/
theorem measure_setOf_frequently_eq_zero {p : ℕ → α → Prop} (hp : ∑' i, μ { x | p i x } ≠ ∞) :
    μ { x | ∃ᶠ n in atTop, p n x } = 0 := by
  

Proof state:
R : Type u_1
α : Type u_2
β : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s s' t : Set α
p : ℕ → α → Prop
hp : ∑' (i : ℕ), ↑↑μ {x | p i x} ≠ ⊤
⊢ ↑↑μ {x | ∃ᶠ (n : ℕ) in atTop, p n x} = 0

Next tactic:
simpa only [limsup_eq_iInf_iSup_of_nat, frequently_atTop, ← bex_def, setOf_forall,
    setOf_exists] using measure_limsup_eq_zero hp
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
hs : f =ᶠ[ae (Measure.restrict μ sᶜ)] fun x => b
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
⊢ ↑↑μ (f ⁻¹' t) = ↑↑(Measure.restrict μ s) (f ⁻¹' t)

Next tactic:
rw [Measure.restrict_apply₀ (f_mble t_mble)]
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
hs : f =ᶠ[ae (Measure.restrict μ sᶜ)] fun x => b
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
⊢ ↑↑μ (f ⁻¹' t) = ↑↑μ (f ⁻¹' t ∩ s)

Next tactic:
simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑(Measure.restrict μ sᶜ) {x | f x = b}ᶜ = 0
⊢ ↑↑μ (f ⁻¹' t) = ↑↑μ (f ⁻¹' t ∩ s)

Next tactic:
rw [Measure.restrict_apply₀] at hs
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · 

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
⊢ ↑↑μ (f ⁻¹' t) = ↑↑μ (f ⁻¹' t ∩ s)

Next tactic:
apply le_antisymm _ (measure_mono (inter_subset_left _ _))
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · apply le_antisymm _ (measure_mono (inter_subset_left _ _))
    

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
⊢ ↑↑μ (f ⁻¹' t) ≤ ↑↑μ (f ⁻¹' t ∩ s)

Next tactic:
apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · apply le_antisymm _ (measure_mono (inter_subset_left _ _))
    apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
    

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
⊢ ↑↑μ (f ⁻¹' t ∩ s ∪ f ⁻¹' t ∩ sᶜ) ≤ ↑↑μ (f ⁻¹' t ∩ s)

Next tactic:
apply (measure_union_le _ _).trans
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · apply le_antisymm _ (measure_mono (inter_subset_left _ _))
    apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
    apply (measure_union_le _ _).trans
    

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
⊢ ↑↑μ (f ⁻¹' t ∩ s) + ↑↑μ (f ⁻¹' t ∩ sᶜ) ≤ ↑↑μ (f ⁻¹' t ∩ s)

Next tactic:
have obs : μ ((f ⁻¹' t) ∩ sᶜ) = 0 := by
      apply le_antisymm _ (zero_le _)
      rw [← hs]
      apply measure_mono (inter_subset_inter_left _ _)
      intro x hx hfx
      simp only [mem_preimage, mem_setOf_eq] at hx hfx
      exact ht (hfx ▸ hx)
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · apply le_antisymm _ (measure_mono (inter_subset_left _ _))
    apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
    apply (measure_union_le _ _).trans
    have obs : μ ((f ⁻¹' t) ∩ sᶜ) = 0 := by
      

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
⊢ ↑↑μ (f ⁻¹' t ∩ sᶜ) = 0

Next tactic:
apply le_antisymm _ (zero_le _)
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · apply le_antisymm _ (measure_mono (inter_subset_left _ _))
    apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
    apply (measure_union_le _ _).trans
    have obs : μ ((f ⁻¹' t) ∩ sᶜ) = 0 := by
      apply le_antisymm _ (zero_le _)
      

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
⊢ ↑↑μ (f ⁻¹' t ∩ sᶜ) ≤ 0

Next tactic:
rw [← hs]
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · apply le_antisymm _ (measure_mono (inter_subset_left _ _))
    apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
    apply (measure_union_le _ _).trans
    have obs : μ ((f ⁻¹' t) ∩ sᶜ) = 0 := by
      apply le_antisymm _ (zero_le _)
      rw [← hs]
      

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
⊢ ↑↑μ (f ⁻¹' t ∩ sᶜ) ≤ ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ)

Next tactic:
apply measure_mono (inter_subset_inter_left _ _)
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · apply le_antisymm _ (measure_mono (inter_subset_left _ _))
    apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
    apply (measure_union_le _ _).trans
    have obs : μ ((f ⁻¹' t) ∩ sᶜ) = 0 := by
      apply le_antisymm _ (zero_le _)
      rw [← hs]
      apply measure_mono (inter_subset_inter_left _ _)
      

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
⊢ f ⁻¹' t ⊆ {x | f x = b}ᶜ

Next tactic:
intro x hx hfx
lemma NullMeasurable.measure_preimage_eq_measure_restrict_preimage_of_ae_compl_eq_const
    {β : Type*} [MeasurableSpace β] {b : β} {f : α → β} {s : Set α}
    (f_mble : NullMeasurable f (μ.restrict s)) (hs : f =ᵐ[Measure.restrict μ sᶜ] (fun _ ↦ b))
    {t : Set β} (t_mble : MeasurableSet t) (ht : b ∉ t) :
    μ (f ⁻¹' t) = μ.restrict s (f ⁻¹' t) := by
  rw [Measure.restrict_apply₀ (f_mble t_mble)]
  simp only [EventuallyEq, Filter.Eventually, Pi.zero_apply, Measure.ae,
             MeasurableSet.compl_iff, Filter.mem_mk, mem_setOf_eq] at hs
  rw [Measure.restrict_apply₀] at hs
  · apply le_antisymm _ (measure_mono (inter_subset_left _ _))
    apply (measure_mono (Eq.symm (inter_union_compl (f ⁻¹' t) s)).le).trans
    apply (measure_union_le _ _).trans
    have obs : μ ((f ⁻¹' t) ∩ sᶜ) = 0 := by
      apply le_antisymm _ (zero_le _)
      rw [← hs]
      apply measure_mono (inter_subset_inter_left _ _)
      intro x hx hfx
      

Proof state:
R : Type u_1
α : Type u_2
β✝ : Type u_3
δ : Type u_4
γ : Type u_5
ι : Type u_6
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β✝
inst✝¹ : MeasurableSpace γ
μ μ₁ μ₂ μ₃ ν ν' ν₁ ν₂ : Measure α
s✝ s' t✝ : Set α
β : Type u_7
inst✝ : MeasurableSpace β
b : β
f : α → β
s : Set α
f_mble : NullMeasurable f
t : Set β
t_mble : MeasurableSet t
ht : b ∉ t
hs : ↑↑μ ({x | f x = b}ᶜ ∩ sᶜ) = 0
x : α
hx : x ∈ f ⁻¹' t
hfx : x ∈ {x | f x = b}
⊢ False

Next tactic:
simp only [mem_preimage, mem_setOf_eq] at hx hfx