l3lab/ntp-mathlib huggingface dataset:
theorem _root_.Set.Countable.ae_not_mem (h : s.Countable) (μ : Measure α) [NoAtoms μ] :
    ∀ᵐ x ∂μ, x ∉ 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 μ✝
h : Set.Countable s
μ : Measure α
inst✝ : NoAtoms μ
⊢ ∀ᵐ (x : α) ∂μ, x ∉ s

Next tactic:
simpa only [ae_iff, Classical.not_not] using h.measure_zero μ
theorem ite_ae_eq_of_measure_zero {γ} (f : α → γ) (g : α → γ) (s : Set α) [DecidablePred (· ∈ s)]
    (hs_zero : μ s = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] g := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : ↑↑μ s = 0
⊢ (fun x => if x ∈ s then f x else g x) =ᶠ[ae μ] g

Next tactic:
have h_ss : sᶜ ⊆ { a : α | ite (a ∈ s) (f a) (g a) = g a } := fun x hx => by
    simp [(Set.mem_compl_iff _ _).mp hx]
theorem ite_ae_eq_of_measure_zero {γ} (f : α → γ) (g : α → γ) (s : Set α) [DecidablePred (· ∈ s)]
    (hs_zero : μ s = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] g := by
  have h_ss : sᶜ ⊆ { a : α | ite (a ∈ s) (f a) (g a) = g a } := fun x hx => by
    

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : ↑↑μ s = 0
x : α
hx : x ∈ sᶜ
⊢ x ∈ {a | (if a ∈ s then f a else g a) = g a}

Next tactic:
simp [(Set.mem_compl_iff _ _).mp hx]
theorem ite_ae_eq_of_measure_zero {γ} (f : α → γ) (g : α → γ) (s : Set α) [DecidablePred (· ∈ s)]
    (hs_zero : μ s = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] g := by
  have h_ss : sᶜ ⊆ { a : α | ite (a ∈ s) (f a) (g a) = g a } := fun x hx => by
    simp [(Set.mem_compl_iff _ _).mp hx]
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : ↑↑μ s = 0
h_ss : sᶜ ⊆ {a | (if a ∈ s then f a else g a) = g a}
⊢ (fun x => if x ∈ s then f x else g x) =ᶠ[ae μ] g

Next tactic:
refine' measure_mono_null _ hs_zero
theorem ite_ae_eq_of_measure_zero {γ} (f : α → γ) (g : α → γ) (s : Set α) [DecidablePred (· ∈ s)]
    (hs_zero : μ s = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] g := by
  have h_ss : sᶜ ⊆ { a : α | ite (a ∈ s) (f a) (g a) = g a } := fun x hx => by
    simp [(Set.mem_compl_iff _ _).mp hx]
  refine' measure_mono_null _ hs_zero
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : ↑↑μ s = 0
h_ss : sᶜ ⊆ {a | (if a ∈ s then f a else g a) = g a}
⊢ {x | (fun x => (fun x => if x ∈ s then f x else g x) x = g x) x}ᶜ ⊆ s

Next tactic:
conv_rhs => rw [← compl_compl s]
theorem ite_ae_eq_of_measure_zero {γ} (f : α → γ) (g : α → γ) (s : Set α) [DecidablePred (· ∈ s)]
    (hs_zero : μ s = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] g := by
  have h_ss : sᶜ ⊆ { a : α | ite (a ∈ s) (f a) (g a) = g a } := fun x hx => by
    simp [(Set.mem_compl_iff _ _).mp hx]
  refine' measure_mono_null _ hs_zero
  conv_rhs => 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : ↑↑μ s = 0
h_ss : sᶜ ⊆ {a | (if a ∈ s then f a else g a) = g a}
| s

Next tactic:
rw [← compl_compl s]
theorem ite_ae_eq_of_measure_zero {γ} (f : α → γ) (g : α → γ) (s : Set α) [DecidablePred (· ∈ s)]
    (hs_zero : μ s = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] g := by
  have h_ss : sᶜ ⊆ { a : α | ite (a ∈ s) (f a) (g a) = g a } := fun x hx => by
    simp [(Set.mem_compl_iff _ _).mp hx]
  refine' measure_mono_null _ hs_zero
  conv_rhs => rw [← compl_compl s]
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : ↑↑μ s = 0
h_ss : sᶜ ⊆ {a | (if a ∈ s then f a else g a) = g a}
⊢ {x | (fun x => (fun x => if x ∈ s then f x else g x) x = g x) x}ᶜ ⊆ sᶜᶜ

Next tactic:
rwa [Set.compl_subset_compl]
theorem ite_ae_eq_of_measure_compl_zero {γ} (f : α → γ) (g : α → γ)
    (s : Set α) [DecidablePred (· ∈ s)] (hs_zero : μ sᶜ = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] f := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : ↑↑μ sᶜ = 0
⊢ (fun x => if x ∈ s then f x else g x) =ᶠ[ae μ] f

Next tactic:
change s ∈ μ.ae at hs_zero
theorem ite_ae_eq_of_measure_compl_zero {γ} (f : α → γ) (g : α → γ)
    (s : Set α) [DecidablePred (· ∈ s)] (hs_zero : μ sᶜ = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] f := by
  change s ∈ μ.ae at hs_zero
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : s ∈ ae μ
⊢ (fun x => if x ∈ s then f x else g x) =ᶠ[ae μ] f

Next tactic:
filter_upwards [hs_zero]
theorem ite_ae_eq_of_measure_compl_zero {γ} (f : α → γ) (g : α → γ)
    (s : Set α) [DecidablePred (· ∈ s)] (hs_zero : μ sᶜ = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] f := by
  change s ∈ μ.ae at hs_zero
  filter_upwards [hs_zero]
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : s ∈ ae μ
⊢ ∀ a ∈ s, (if a ∈ s then f a else g a) = f a

Next tactic:
intros
theorem ite_ae_eq_of_measure_compl_zero {γ} (f : α → γ) (g : α → γ)
    (s : Set α) [DecidablePred (· ∈ s)] (hs_zero : μ sᶜ = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] f := by
  change s ∈ μ.ae at hs_zero
  filter_upwards [hs_zero]
  intros
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : s ∈ ae μ
a✝¹ : α
a✝ : a✝¹ ∈ s
⊢ (if a✝¹ ∈ s then f a✝¹ else g a✝¹) = f a✝¹

Next tactic:
split_ifs
theorem ite_ae_eq_of_measure_compl_zero {γ} (f : α → γ) (g : α → γ)
    (s : Set α) [DecidablePred (· ∈ s)] (hs_zero : μ sᶜ = 0) :
    (fun x => ite (x ∈ s) (f x) (g x)) =ᵐ[μ] f := by
  change s ∈ μ.ae at hs_zero
  filter_upwards [hs_zero]
  intros
  split_ifs
  

Proof state:
case h
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s✝ t : Set α
γ : Type u_5
f g : α → γ
s : Set α
inst✝ : DecidablePred fun x => x ∈ s
hs_zero : s ∈ ae μ
a✝¹ : α
a✝ : a✝¹ ∈ s
⊢ f a✝¹ = f a✝¹

Next tactic:
rfl
theorem finiteAtBot {m0 : MeasurableSpace α} (μ : Measure α) : μ.FiniteAtFilter ⊥ :=
  ⟨∅, mem_bot, by 

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

Next tactic:
simp only [OuterMeasure.empty', zero_lt_top]
/-- A countable sum of finite measures is s-finite.
This lemma is superseeded by the instance below. -/
lemma sfinite_sum_of_countable {ι : Type*} [Countable ι]
    (m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), IsFiniteMeasure (m n)
⊢ SFinite (sum m)

Next tactic:
classical
  obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
  refine ⟨_, fun n ↦ ?_, (sum_extend_zero hf m).symm⟩
  rcases em (n ∈ range f) with ⟨i, rfl⟩ | hn
  · rw [hf.extend_apply]
    infer_instance
  · rw [Function.extend_apply' _ _ _ hn, Pi.zero_apply]
    infer_instance
/-- A countable sum of finite measures is s-finite.
This lemma is superseeded by the instance below. -/
lemma sfinite_sum_of_countable {ι : Type*} [Countable ι]
    (m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
  classical
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), IsFiniteMeasure (m n)
⊢ SFinite (sum m)

Next tactic:
obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
/-- A countable sum of finite measures is s-finite.
This lemma is superseeded by the instance below. -/
lemma sfinite_sum_of_countable {ι : Type*} [Countable ι]
    (m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
  classical
  obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
  

Proof state:
case intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), IsFiniteMeasure (m n)
f : ι → ℕ
hf : Injective f
⊢ SFinite (sum m)

Next tactic:
refine ⟨_, fun n ↦ ?_, (sum_extend_zero hf m).symm⟩
/-- A countable sum of finite measures is s-finite.
This lemma is superseeded by the instance below. -/
lemma sfinite_sum_of_countable {ι : Type*} [Countable ι]
    (m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
  classical
  obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
  refine ⟨_, fun n ↦ ?_, (sum_extend_zero hf m).symm⟩
  

Proof state:
case intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), IsFiniteMeasure (m n)
f : ι → ℕ
hf : Injective f
n : ℕ
⊢ IsFiniteMeasure (Function.extend f m 0 n)

Next tactic:
rcases em (n ∈ range f) with ⟨i, rfl⟩ | hn
/-- A countable sum of finite measures is s-finite.
This lemma is superseeded by the instance below. -/
lemma sfinite_sum_of_countable {ι : Type*} [Countable ι]
    (m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
  classical
  obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
  refine ⟨_, fun n ↦ ?_, (sum_extend_zero hf m).symm⟩
  rcases em (n ∈ range f) with ⟨i, rfl⟩ | hn
  · 

Proof state:
case intro.inl.intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), IsFiniteMeasure (m n)
f : ι → ℕ
hf : Injective f
i : ι
⊢ IsFiniteMeasure (Function.extend f m 0 (f i))

Next tactic:
rw [hf.extend_apply]
/-- A countable sum of finite measures is s-finite.
This lemma is superseeded by the instance below. -/
lemma sfinite_sum_of_countable {ι : Type*} [Countable ι]
    (m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
  classical
  obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
  refine ⟨_, fun n ↦ ?_, (sum_extend_zero hf m).symm⟩
  rcases em (n ∈ range f) with ⟨i, rfl⟩ | hn
  · rw [hf.extend_apply]
    

Proof state:
case intro.inl.intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), IsFiniteMeasure (m n)
f : ι → ℕ
hf : Injective f
i : ι
⊢ IsFiniteMeasure (m i)

Next tactic:
infer_instance
/-- A countable sum of finite measures is s-finite.
This lemma is superseeded by the instance below. -/
lemma sfinite_sum_of_countable {ι : Type*} [Countable ι]
    (m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
  classical
  obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
  refine ⟨_, fun n ↦ ?_, (sum_extend_zero hf m).symm⟩
  rcases em (n ∈ range f) with ⟨i, rfl⟩ | hn
  · rw [hf.extend_apply]
    infer_instance
  · 

Proof state:
case intro.inr
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), IsFiniteMeasure (m n)
f : ι → ℕ
hf : Injective f
n : ℕ
hn : n ∉ range f
⊢ IsFiniteMeasure (Function.extend f m 0 n)

Next tactic:
rw [Function.extend_apply' _ _ _ hn, Pi.zero_apply]
/-- A countable sum of finite measures is s-finite.
This lemma is superseeded by the instance below. -/
lemma sfinite_sum_of_countable {ι : Type*} [Countable ι]
    (m : ι → Measure α) [∀ n, IsFiniteMeasure (m n)] : SFinite (Measure.sum m) := by
  classical
  obtain ⟨f, hf⟩ : ∃ f : ι → ℕ, Function.Injective f := Countable.exists_injective_nat ι
  refine ⟨_, fun n ↦ ?_, (sum_extend_zero hf m).symm⟩
  rcases em (n ∈ range f) with ⟨i, rfl⟩ | hn
  · rw [hf.extend_apply]
    infer_instance
  · rw [Function.extend_apply' _ _ _ hn, Pi.zero_apply]
    

Proof state:
case intro.inr
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), IsFiniteMeasure (m n)
f : ι → ℕ
hf : Injective f
n : ℕ
hn : n ∉ range f
⊢ IsFiniteMeasure 0

Next tactic:
infer_instance
instance {ι : Type*} [Countable ι] (m : ι → Measure α) [∀ n, SFinite (m n)] :
    SFinite (Measure.sum m) := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), SFinite (m n)
⊢ SFinite (sum m)

Next tactic:
change SFinite (Measure.sum (fun i ↦ m i))
instance {ι : Type*} [Countable ι] (m : ι → Measure α) [∀ n, SFinite (m n)] :
    SFinite (Measure.sum m) := by
  change SFinite (Measure.sum (fun i ↦ m i))
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), SFinite (m n)
⊢ SFinite (sum fun i => m i)

Next tactic:
simp_rw [← sum_sFiniteSeq (m _), Measure.sum_sum]
instance {ι : Type*} [Countable ι] (m : ι → Measure α) [∀ n, SFinite (m n)] :
    SFinite (Measure.sum m) := by
  change SFinite (Measure.sum (fun i ↦ m i))
  simp_rw [← sum_sFiniteSeq (m _), Measure.sum_sum]
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι✝ : Type u_4
m0 : MeasurableSpace α
inst✝² : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
ι : Type u_5
inst✝¹ : Countable ι
m : ι → Measure α
inst✝ : ∀ (n : ι), SFinite (m n)
⊢ SFinite (sum fun p => sFiniteSeq (m p.1) p.2)

Next tactic:
apply sfinite_sum_of_countable
/-- If `μ` is σ-finite it has finite spanning sets in the collection of all measurable sets. -/
def Measure.toFiniteSpanningSetsIn (μ : Measure α) [h : SigmaFinite μ] :
    μ.FiniteSpanningSetsIn { s | MeasurableSet s } where
  set n := toMeasurable μ (h.out.some.set n)
  set_mem n := measurableSet_toMeasurable _ _
  finite n := by
    

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
μ : Measure α
h : SigmaFinite μ
n : ℕ
⊢ ↑↑μ
      ((fun n =>
          toMeasurable μ (FiniteSpanningSetsIn.set (Nonempty.some (_ : Nonempty (FiniteSpanningSetsIn μ univ))) n))
        n) <
    ⊤

Next tactic:
rw [measure_toMeasurable]
/-- If `μ` is σ-finite it has finite spanning sets in the collection of all measurable sets. -/
def Measure.toFiniteSpanningSetsIn (μ : Measure α) [h : SigmaFinite μ] :
    μ.FiniteSpanningSetsIn { s | MeasurableSet s } where
  set n := toMeasurable μ (h.out.some.set n)
  set_mem n := measurableSet_toMeasurable _ _
  finite n := by
    rw [measure_toMeasurable]
    

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝ : MeasurableSpace β
μ✝ ν ν₁ ν₂ : Measure α
s t : Set α
μ : Measure α
h : SigmaFinite μ
n : ℕ
⊢ ↑↑μ (FiniteSpanningSetsIn.set (Nonempty.some (_ : Nonempty (FiniteSpanningSetsIn μ univ))) n) < ⊤

Next tactic:
exact h.out.some.finite n
theorem iUnion_spanningSets (μ : Measure α) [SigmaFinite μ] : ⋃ i : ℕ, spanningSets μ i = univ :=
  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✝ : SigmaFinite μ
⊢ ⋃ i, spanningSets μ i = univ

Next tactic:
simp_rw [spanningSets, iUnion_accumulate, μ.toFiniteSpanningSetsIn.spanning]
theorem spanningSetsIndex_eq_iff (μ : Measure α) [SigmaFinite μ] {x : α} {n : ℕ} :
    spanningSetsIndex μ x = n ↔ x ∈ disjointed (spanningSets μ) n := 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✝ : SigmaFinite μ
x : α
n : ℕ
⊢ spanningSetsIndex μ x = n ↔ x ∈ disjointed (spanningSets μ) n

Next tactic:
convert Set.ext_iff.1 (preimage_spanningSetsIndex_singleton μ n) x
theorem sum_restrict_disjointed_spanningSets (μ : Measure α) [SigmaFinite μ] :
    sum (fun n ↦ μ.restrict (disjointed (spanningSets μ) n)) = μ := 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✝ : SigmaFinite μ
⊢ (sum fun n => Measure.restrict μ (disjointed (spanningSets μ) n)) = μ

Next tactic:
rw [← restrict_iUnion (disjoint_disjointed _)
      (MeasurableSet.disjointed (measurable_spanningSets _)),
    iUnion_disjointed, iUnion_spanningSets, restrict_univ]
instance (priority := 100) [SigmaFinite μ] : SFinite μ := by
  

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

Next tactic:
have : ∀ n, Fact (μ (disjointed (spanningSets μ) n) < ∞) :=
    fun n ↦ ⟨(measure_mono (disjointed_subset _ _)).trans_lt (measure_spanningSets_lt_top μ n)⟩
instance (priority := 100) [SigmaFinite μ] : SFinite μ := by
  have : ∀ n, Fact (μ (disjointed (spanningSets μ) n) < ∞) :=
    fun n ↦ ⟨(measure_mono (disjointed_subset _ _)).trans_lt (measure_spanningSets_lt_top μ n)⟩
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : SigmaFinite μ
this : ∀ (n : ℕ), Fact (↑↑μ (disjointed (spanningSets μ) n) < ⊤)
⊢ SFinite μ

Next tactic:
exact ⟨⟨fun n ↦ μ.restrict (disjointed (spanningSets μ) n), fun n ↦ by infer_instance,
    (sum_restrict_disjointed_spanningSets μ).symm⟩⟩
instance (priority := 100) [SigmaFinite μ] : SFinite μ := by
  have : ∀ n, Fact (μ (disjointed (spanningSets μ) n) < ∞) :=
    fun n ↦ ⟨(measure_mono (disjointed_subset _ _)).trans_lt (measure_spanningSets_lt_top μ n)⟩
  exact ⟨⟨fun n ↦ μ.restrict (disjointed (spanningSets μ) n), fun n ↦ by 

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : SigmaFinite μ
this : ∀ (n : ℕ), Fact (↑↑μ (disjointed (spanningSets μ) n) < ⊤)
n : ℕ
⊢ IsFiniteMeasure ((fun n => Measure.restrict μ (disjointed (spanningSets μ) n)) n)

Next tactic:
infer_instance
theorem iSup_restrict_spanningSets [SigmaFinite μ] (hs : MeasurableSet s) :
    ⨆ i, μ.restrict (spanningSets μ i) s = μ s :=
  calc
    ⨆ i, μ.restrict (spanningSets μ i) s = μ.restrict (⋃ i, spanningSets μ i) s :=
      (restrict_iUnion_apply_eq_iSup (monotone_spanningSets μ).directed_le hs).symm
    _ = μ 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✝ : SigmaFinite μ
hs : MeasurableSet s
⊢ ↑↑(restrict μ (⋃ i, spanningSets μ i)) s = ↑↑μ s

Next tactic:
rw [iUnion_spanningSets, restrict_univ]
/-- In a σ-finite space, any measurable set of measure `> r` contains a measurable subset of
finite measure `> r`. -/
theorem exists_subset_measure_lt_top [SigmaFinite μ] {r : ℝ≥0∞} (hs : MeasurableSet s)
    (h's : r < μ s) : ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < μ t ∧ μ t < ∞ := by
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : SigmaFinite μ
r : ℝ≥0∞
hs : MeasurableSet s
h's : r < ↑↑μ s
⊢ ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < ↑↑μ t ∧ ↑↑μ t < ⊤

Next tactic:
rw [← iSup_restrict_spanningSets hs,
    @lt_iSup_iff _ _ _ r fun i : ℕ => μ.restrict (spanningSets μ i) s] at h's
/-- In a σ-finite space, any measurable set of measure `> r` contains a measurable subset of
finite measure `> r`. -/
theorem exists_subset_measure_lt_top [SigmaFinite μ] {r : ℝ≥0∞} (hs : MeasurableSet s)
    (h's : r < μ s) : ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < μ t ∧ μ t < ∞ := by
  rw [← iSup_restrict_spanningSets hs,
    @lt_iSup_iff _ _ _ r fun i : ℕ => μ.restrict (spanningSets μ i) s] at h's
  

Proof state:
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : SigmaFinite μ
r : ℝ≥0∞
hs : MeasurableSet s
h's : ∃ i, r < ↑↑(restrict μ (spanningSets μ i)) s
⊢ ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < ↑↑μ t ∧ ↑↑μ t < ⊤

Next tactic:
rcases h's with ⟨n, hn⟩
/-- In a σ-finite space, any measurable set of measure `> r` contains a measurable subset of
finite measure `> r`. -/
theorem exists_subset_measure_lt_top [SigmaFinite μ] {r : ℝ≥0∞} (hs : MeasurableSet s)
    (h's : r < μ s) : ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < μ t ∧ μ t < ∞ := by
  rw [← iSup_restrict_spanningSets hs,
    @lt_iSup_iff _ _ _ r fun i : ℕ => μ.restrict (spanningSets μ i) s] at h's
  rcases h's with ⟨n, hn⟩
  

Proof state:
case intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : SigmaFinite μ
r : ℝ≥0∞
hs : MeasurableSet s
n : ℕ
hn : r < ↑↑(restrict μ (spanningSets μ n)) s
⊢ ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < ↑↑μ t ∧ ↑↑μ t < ⊤

Next tactic:
simp only [restrict_apply hs] at hn
/-- In a σ-finite space, any measurable set of measure `> r` contains a measurable subset of
finite measure `> r`. -/
theorem exists_subset_measure_lt_top [SigmaFinite μ] {r : ℝ≥0∞} (hs : MeasurableSet s)
    (h's : r < μ s) : ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < μ t ∧ μ t < ∞ := by
  rw [← iSup_restrict_spanningSets hs,
    @lt_iSup_iff _ _ _ r fun i : ℕ => μ.restrict (spanningSets μ i) s] at h's
  rcases h's with ⟨n, hn⟩
  simp only [restrict_apply hs] at hn
  

Proof state:
case intro
α : Type u_1
β : Type u_2
δ : Type u_3
ι : Type u_4
m0 : MeasurableSpace α
inst✝¹ : MeasurableSpace β
μ ν ν₁ ν₂ : Measure α
s t : Set α
inst✝ : SigmaFinite μ
r : ℝ≥0∞
hs : MeasurableSet s
n : ℕ
hn : r < ↑↑μ (s ∩ spanningSets μ n)
⊢ ∃ t, MeasurableSet t ∧ t ⊆ s ∧ r < ↑↑μ t ∧ ↑↑μ t < ⊤

Next tactic:
refine'
    ⟨s ∩ spanningSets μ n, hs.inter (measurable_spanningSets _ _), inter_subset_left _ _, hn, _⟩