Theorem: ae_restrict_of_ae_restrict_inter_Ioo
File: Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean

tactic: let T : s × s → Set ℝ := fun p => Ioo p.1 p.2
state_before: μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ s, p x

tactic: let u := ⋃ i : ↥s × ↥s, T i
state_before: μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ s, p x

tactic: have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo'
state_before: μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ s, p x

tactic: obtain ⟨A, A_count, hA⟩ :
  ∃ A : Set (↥s × ↥s), A.Countable ∧ (⋃ i ∈ A, T i) = ⋃ i : ↥s × ↥s, T i :=
  isOpen_iUnion_countable _ fun p => isOpen_Ioo
state_before: μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ s, p x

tactic: apply ae_restrict_of_ae_restrict_of_subset this
state_before: case intro.intro
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ s, p x

tactic: rw [ae_restrict_union_iff, ae_restrict_biUnion_iff _ A_count]
state_before: case intro.intro
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p), p x

tactic: constructor
state_before: case intro.intro
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
⊢ (∀ᵐ (x : ℝ) ∂Measure.restrict μ (s \ u), p x) ∧ ∀ (i : ↑s × ↑s), i ∈ A → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ T i), p x

tactic: intro x hx
state_before: μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
⊢ s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p

tactic: by_cases h'x : x ∈ ⋃ i : ↥s × ↥s, T i
state_before: μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
x : ℝ
hx : x ∈ s
⊢ x ∈ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p

tactic: rw [← hA] at h'x
state_before: case pos
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
x : ℝ
hx : x ∈ s
h'x : x ∈ ⋃ (i : ↑s × ↑s), T i
⊢ x ∈ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p

tactic: obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by
  simpa only [mem_iUnion, exists_prop, SetCoe.exists, exists_and_right] using h'x
state_before: case pos
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
x : ℝ
hx : x ∈ s
h'x : x ∈ ⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i
⊢ x ∈ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p

tactic: right
state_before: case pos.intro.intro
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p✝ : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p✝ x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
x : ℝ
hx : x ∈ s
h'x : x ∈ ⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i
p : ↑s × ↑s
pA : p ∈ A
xp : x ∈ T p
⊢ x ∈ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p

tactic: exact mem_biUnion pA ⟨hx, xp⟩
state_before: case pos.intro.intro.h
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p✝ : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p✝ x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
x : ℝ
hx : x ∈ s
h'x : x ∈ ⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i
p : ↑s × ↑s
pA : p ∈ A
xp : x ∈ T p
⊢ x ∈ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p

tactic: simpa only [mem_iUnion, exists_prop, SetCoe.exists, exists_and_right] using h'x
state_before: μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
x : ℝ
hx : x ∈ s
h'x : x ∈ ⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i
⊢ ∃ p, p ∈ A ∧ x ∈ T p

tactic: exact Or.inl ⟨hx, h'x⟩
state_before: case neg
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
x : ℝ
hx : x ∈ s
h'x : ¬x ∈ ⋃ (i : ↑s × ↑s), T i
⊢ x ∈ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p

tactic: have : μ.restrict (s \ u) = 0 := by simp only [restrict_eq_zero, hfinite.measure_zero]
state_before: case intro.intro.left
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s \ u), p x

tactic: simp only [this, ae_zero, eventually_bot]
state_before: case intro.intro.left
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this✝ : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
this : Measure.restrict μ (s \ u) = 0
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s \ u), p x

tactic: simp only [restrict_eq_zero, hfinite.measure_zero]
state_before: μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
⊢ Measure.restrict μ (s \ u) = 0

tactic: rintro ⟨⟨a, as⟩, ⟨b, bs⟩⟩ -
state_before: case intro.intro.right
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
⊢ ∀ (i : ↑s × ↑s), i ∈ A → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ T i), p x

tactic: dsimp
state_before: case intro.intro.right.mk.mk.mk
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
a : ℝ
as : a ∈ s
b : ℝ
bs : b ∈ s
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ T ({ val := a, property := as }, { val := b, property := bs })), p x

tactic: rcases le_or_lt b a with (hba | hab)
state_before: case intro.intro.right.mk.mk.mk
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
a : ℝ
as : a ∈ s
b : ℝ
bs : b ∈ s
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x

tactic: simp only [Ioo_eq_empty_of_le hba, inter_empty, restrict_empty, ae_zero, eventually_bot]
state_before: case intro.intro.right.mk.mk.mk.inl
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
a : ℝ
as : a ∈ s
b : ℝ
bs : b ∈ s
hba : b ≤ a
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x

tactic: exact h a b as bs hab
state_before: case intro.intro.right.mk.mk.mk.inr
μ : MeasureTheory.Measure ℝ
inst✝ : NoAtoms μ
s : Set ℝ
p : ℝ → Prop
h : ∀ (a b : ℝ), a ∈ s → b ∈ s → a < b → ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x
T : ↑s × ↑s → Set ℝ := fun p => Ioo ↑p.fst ↑p.snd
u : Set ℝ := ⋃ (i : ↑s × ↑s), T i
hfinite : Set.Finite (s \ u)
A : Set (↑s × ↑s)
A_count : Set.Countable A
hA : (⋃ (i : ↑s × ↑s) (_ : i ∈ A), T i) = ⋃ (i : ↑s × ↑s), T i
this : s ⊆ s \ u ∪ ⋃ (p : ↑s × ↑s) (_ : p ∈ A), s ∩ T p
a : ℝ
as : a ∈ s
b : ℝ
bs : b ∈ s
hab : a < b
⊢ ∀ᵐ (x : ℝ) ∂Measure.restrict μ (s ∩ Ioo a b), p x