l3lab/ntp-mathlib huggingface dataset:
/-- The **measurable Schröder-Bernstein Theorem**: given measurable embeddings
`α → β` and `β → α`, we can find a measurable equivalence `α ≃ᵐ β`.-/
noncomputable def schroederBernstein {f : α → β} {g : β → α} (hf : MeasurableEmbedding f)
    (hg : MeasurableEmbedding g) : α ≃ᵐ β := by
  let F : Set α → Set α := fun A => (g '' (f '' A)ᶜ)ᶜ
  -- We follow the proof of the usual SB theorem in mathlib,
  -- the crux of which is finding a fixed point of this F.
  -- However, we must find this fixed point manually instead of invoking Knaster-Tarski
  -- in order to make sure it is measurable.
  suffices Σ'A : Set α, MeasurableSet A ∧ F A = A by
    rcases this with ⟨A, Ameas, Afp⟩
    let B := f '' A
    have Bmeas : MeasurableSet B := hf.measurableSet_image' Ameas
    refine'
      (MeasurableEquiv.sumCompl Ameas).symm.trans
        (MeasurableEquiv.trans _ (MeasurableEquiv.sumCompl Bmeas))
    apply MeasurableEquiv.sumCongr (hf.equivImage _)
    have : Aᶜ = g '' Bᶜ := by
      apply compl_injective
      rw [← Afp]
      simp
    rw [this]
    exact (hg.equivImage _).symm
  have Fmono : ∀ {A B}, A ⊆ B → F A ⊆ F B := fun h =>
    compl_subset_compl.mpr <| Set.image_subset _ <| compl_subset_compl.mpr <| Set.image_subset _ h
  let X : ℕ → Set α := fun n => F^[n] univ
  refine' ⟨iInter X, _, _⟩
  · apply MeasurableSet.iInter
    intro n
    induction' n with n ih
    · exact MeasurableSet.univ
    rw [Function.iterate_succ', Function.comp_apply]
    exact (hg.measurableSet_image' (hf.measurableSet_image' ih).compl).compl
  apply subset_antisymm
  · apply subset_iInter
    intro n
    cases n
    · exact subset_univ _
    rw [Function.iterate_succ', Function.comp_apply]
    exact Fmono (iInter_subset _ _)
  rintro x hx ⟨y, hy, rfl⟩
  rw [mem_iInter] at hx
  apply hy
  rw [(injOn_of_injective hf.injective _).image_iInter_eq]
  rw [mem_iInter]
  intro n
  specialize hx n.succ
  rw [Function.iterate_succ', Function.comp_apply] at hx
  by_contra h
  apply hx
  

Proof state:
case refine'_2.a.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝² : MeasurableSpace α
inst✝¹ : MeasurableSpace β
inst✝ : MeasurableSpace γ
f✝ : α → β
g✝ : β → α
f : α → β
g : β → α
hf : MeasurableEmbedding f
hg : MeasurableEmbedding g
F : Set α → Set α := fun A => (g '' (f '' A)ᶜ)ᶜ
Fmono : ∀ {A B : Set α}, A ⊆ B → F A ⊆ F B
X : ℕ → Set α := fun n => F^[n] univ
y : β
hy : y ∈ (f '' iInter X)ᶜ
n : ℕ
hx : g y ∈ F (F^[n] univ)
h : y ∉ f '' F^[n] univ
⊢ g y ∈ g '' (f '' F^[n] univ)ᶜ

Next tactic:
exact ⟨y, h, rfl⟩
theorem MeasurableSpace.comap_compl {m' : MeasurableSpace β} [BooleanAlgebra β]
    (h : Measurable (compl : β → β)) (f : α → β) :
    MeasurableSpace.comap (fun a => (f a)ᶜ) inferInstance =
      MeasurableSpace.comap f inferInstance := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
m' : MeasurableSpace β
inst✝ : BooleanAlgebra β
h : Measurable compl
f : α → β
⊢ MeasurableSpace.comap (fun a => (f a)ᶜ) inferInstance = MeasurableSpace.comap f inferInstance

Next tactic:
rw [← Function.comp_def, ← MeasurableSpace.comap_comp]
theorem MeasurableSpace.comap_compl {m' : MeasurableSpace β} [BooleanAlgebra β]
    (h : Measurable (compl : β → β)) (f : α → β) :
    MeasurableSpace.comap (fun a => (f a)ᶜ) inferInstance =
      MeasurableSpace.comap f inferInstance := by
  rw [← Function.comp_def, ← MeasurableSpace.comap_comp]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
m' : MeasurableSpace β
inst✝ : BooleanAlgebra β
h : Measurable compl
f : α → β
⊢ MeasurableSpace.comap (fun a => f a) (MeasurableSpace.comap compl inferInstance) =
    MeasurableSpace.comap f inferInstance

Next tactic:
congr
theorem MeasurableSpace.comap_compl {m' : MeasurableSpace β} [BooleanAlgebra β]
    (h : Measurable (compl : β → β)) (f : α → β) :
    MeasurableSpace.comap (fun a => (f a)ᶜ) inferInstance =
      MeasurableSpace.comap f inferInstance := by
  rw [← Function.comp_def, ← MeasurableSpace.comap_comp]
  congr
  

Proof state:
case e_m
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
m' : MeasurableSpace β
inst✝ : BooleanAlgebra β
h : Measurable compl
f : α → β
⊢ MeasurableSpace.comap compl inferInstance = inferInstance

Next tactic:
exact (MeasurableEquiv.ofInvolutive _ compl_involutive h).measurableEmbedding.comap_eq
theorem CountablyGenerated.comap [m : MeasurableSpace β] [h : CountablyGenerated β] (f : α → β) :
    @CountablyGenerated α (.comap f m) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
m : MeasurableSpace β
h : CountablyGenerated β
f : α → β
⊢ CountablyGenerated α

Next tactic:
rcases h with ⟨⟨b, hbc, rfl⟩⟩
theorem CountablyGenerated.comap [m : MeasurableSpace β] [h : CountablyGenerated β] (f : α → β) :
    @CountablyGenerated α (.comap f m) := by
  rcases h with ⟨⟨b, hbc, rfl⟩⟩
  

Proof state:
case mk.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
f : α → β
b : Set (Set β)
hbc : Set.Countable b
⊢ CountablyGenerated α

Next tactic:
rw [comap_generateFrom]
theorem CountablyGenerated.comap [m : MeasurableSpace β] [h : CountablyGenerated β] (f : α → β) :
    @CountablyGenerated α (.comap f m) := by
  rcases h with ⟨⟨b, hbc, rfl⟩⟩
  rw [comap_generateFrom]
  

Proof state:
case mk.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
f : α → β
b : Set (Set β)
hbc : Set.Countable b
⊢ CountablyGenerated α

Next tactic:
letI := generateFrom (preimage f '' b)
theorem CountablyGenerated.comap [m : MeasurableSpace β] [h : CountablyGenerated β] (f : α → β) :
    @CountablyGenerated α (.comap f m) := by
  rcases h with ⟨⟨b, hbc, rfl⟩⟩
  rw [comap_generateFrom]
  letI := generateFrom (preimage f '' b)
  

Proof state:
case mk.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
f : α → β
b : Set (Set β)
hbc : Set.Countable b
this : MeasurableSpace α := generateFrom (preimage f '' b)
⊢ CountablyGenerated α

Next tactic:
exact ⟨_, hbc.image _, rfl⟩
theorem CountablyGenerated.sup {m₁ m₂ : MeasurableSpace β} (h₁ : @CountablyGenerated β m₁)
    (h₂ : @CountablyGenerated β m₂) : @CountablyGenerated β (m₁ ⊔ m₂) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
m₁ m₂ : MeasurableSpace β
h₁ : CountablyGenerated β
h₂ : CountablyGenerated β
⊢ CountablyGenerated β

Next tactic:
rcases h₁ with ⟨⟨b₁, hb₁c, rfl⟩⟩
theorem CountablyGenerated.sup {m₁ m₂ : MeasurableSpace β} (h₁ : @CountablyGenerated β m₁)
    (h₂ : @CountablyGenerated β m₂) : @CountablyGenerated β (m₁ ⊔ m₂) := by
  rcases h₁ with ⟨⟨b₁, hb₁c, rfl⟩⟩
  

Proof state:
case mk.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
m₂ : MeasurableSpace β
h₂ : CountablyGenerated β
b₁ : Set (Set β)
hb₁c : Set.Countable b₁
⊢ CountablyGenerated β

Next tactic:
rcases h₂ with ⟨⟨b₂, hb₂c, rfl⟩⟩
theorem CountablyGenerated.sup {m₁ m₂ : MeasurableSpace β} (h₁ : @CountablyGenerated β m₁)
    (h₂ : @CountablyGenerated β m₂) : @CountablyGenerated β (m₁ ⊔ m₂) := by
  rcases h₁ with ⟨⟨b₁, hb₁c, rfl⟩⟩
  rcases h₂ with ⟨⟨b₂, hb₂c, rfl⟩⟩
  

Proof state:
case mk.intro.intro.mk.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
b₁ : Set (Set β)
hb₁c : Set.Countable b₁
b₂ : Set (Set β)
hb₂c : Set.Countable b₂
⊢ CountablyGenerated β

Next tactic:
exact @mk _ (_ ⊔ _) ⟨_, hb₁c.union hb₂c, generateFrom_sup_generateFrom⟩
instance [MeasurableSpace α] {s : Set α} [h : CountablyGenerated s] [MeasurableSingletonClass s] :
    HasCountableSeparatingOn α MeasurableSet s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t u : Set α
inst✝¹ : MeasurableSpace α
s : Set α
h : CountablyGenerated ↑s
inst✝ : MeasurableSingletonClass ↑s
⊢ HasCountableSeparatingOn α MeasurableSet s

Next tactic:
suffices HasCountableSeparatingOn s MeasurableSet univ from this.of_subtype fun _ ↦ id
instance [MeasurableSpace α] {s : Set α} [h : CountablyGenerated s] [MeasurableSingletonClass s] :
    HasCountableSeparatingOn α MeasurableSet s := by
  suffices HasCountableSeparatingOn s MeasurableSet univ from this.of_subtype fun _ ↦ id
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t u : Set α
inst✝¹ : MeasurableSpace α
s : Set α
h : CountablyGenerated ↑s
inst✝ : MeasurableSingletonClass ↑s
⊢ HasCountableSeparatingOn (↑s) MeasurableSet univ

Next tactic:
rcases h.1 with ⟨b, hbc, hb⟩
instance [MeasurableSpace α] {s : Set α} [h : CountablyGenerated s] [MeasurableSingletonClass s] :
    HasCountableSeparatingOn α MeasurableSet s := by
  suffices HasCountableSeparatingOn s MeasurableSet univ from this.of_subtype fun _ ↦ id
  rcases h.1 with ⟨b, hbc, hb⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t u : Set α
inst✝¹ : MeasurableSpace α
s : Set α
h : CountablyGenerated ↑s
inst✝ : MeasurableSingletonClass ↑s
b : Set (Set ↑s)
hbc : Set.Countable b
hb : Subtype.instMeasurableSpace = generateFrom b
⊢ HasCountableSeparatingOn (↑s) MeasurableSet univ

Next tactic:
refine ⟨⟨b, hbc, fun t ht ↦ hb.symm ▸ .basic t ht, fun x _ y _ h ↦ ?_⟩⟩
instance [MeasurableSpace α] {s : Set α} [h : CountablyGenerated s] [MeasurableSingletonClass s] :
    HasCountableSeparatingOn α MeasurableSet s := by
  suffices HasCountableSeparatingOn s MeasurableSet univ from this.of_subtype fun _ ↦ id
  rcases h.1 with ⟨b, hbc, hb⟩
  refine ⟨⟨b, hbc, fun t ht ↦ hb.symm ▸ .basic t ht, fun x _ y _ h ↦ ?_⟩⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t u : Set α
inst✝¹ : MeasurableSpace α
s : Set α
h✝ : CountablyGenerated ↑s
inst✝ : MeasurableSingletonClass ↑s
b : Set (Set ↑s)
hbc : Set.Countable b
hb : Subtype.instMeasurableSpace = generateFrom b
x : ↑s
x✝¹ : x ∈ univ
y : ↑s
x✝ : y ∈ univ
h : ∀ s_1 ∈ b, x ∈ s_1 ↔ y ∈ s_1
⊢ x = y

Next tactic:
rw [← forall_generateFrom_mem_iff_mem_iff, ← hb] at h
instance [MeasurableSpace α] {s : Set α} [h : CountablyGenerated s] [MeasurableSingletonClass s] :
    HasCountableSeparatingOn α MeasurableSet s := by
  suffices HasCountableSeparatingOn s MeasurableSet univ from this.of_subtype fun _ ↦ id
  rcases h.1 with ⟨b, hbc, hb⟩
  refine ⟨⟨b, hbc, fun t ht ↦ hb.symm ▸ .basic t ht, fun x _ y _ h ↦ ?_⟩⟩
  rw [← forall_generateFrom_mem_iff_mem_iff, ← hb] at h
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t u : Set α
inst✝¹ : MeasurableSpace α
s : Set α
h✝ : CountablyGenerated ↑s
inst✝ : MeasurableSingletonClass ↑s
b : Set (Set ↑s)
hbc : Set.Countable b
hb : Subtype.instMeasurableSpace = generateFrom b
x : ↑s
x✝¹ : x ∈ univ
y : ↑s
x✝ : y ∈ univ
h : ∀ (s_1 : Set ↑s), MeasurableSet s_1 → (x ∈ s_1 ↔ y ∈ s_1)
⊢ x = y

Next tactic:
simpa using h {y}
/-- If a measurable space is countably generated and separates points, it admits a measurable
injection into the Cantor space `ℕ → Bool` (equipped with the product sigma algebra). -/
theorem measurable_injection_nat_bool_of_countablyGenerated [MeasurableSpace α]
    [HasCountableSeparatingOn α MeasurableSet univ] :
    ∃ f : α → ℕ → Bool, Measurable f ∧ Function.Injective f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝¹ : MeasurableSpace α
inst✝ : HasCountableSeparatingOn α MeasurableSet univ
⊢ ∃ f, Measurable f ∧ Injective f

Next tactic:
rcases exists_seq_separating α MeasurableSet.empty univ with ⟨e, hem, he⟩
/-- If a measurable space is countably generated and separates points, it admits a measurable
injection into the Cantor space `ℕ → Bool` (equipped with the product sigma algebra). -/
theorem measurable_injection_nat_bool_of_countablyGenerated [MeasurableSpace α]
    [HasCountableSeparatingOn α MeasurableSet univ] :
    ∃ f : α → ℕ → Bool, Measurable f ∧ Function.Injective f := by
  rcases exists_seq_separating α MeasurableSet.empty univ with ⟨e, hem, he⟩
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝¹ : MeasurableSpace α
inst✝ : HasCountableSeparatingOn α MeasurableSet univ
e : ℕ → Set α
hem : ∀ (n : ℕ), MeasurableSet (e n)
he : ∀ x ∈ univ, ∀ y ∈ univ, (∀ (n : ℕ), x ∈ e n ↔ y ∈ e n) → x = y
⊢ ∃ f, Measurable f ∧ Injective f

Next tactic:
refine ⟨(· ∈ e ·), ?_, ?_⟩
/-- If a measurable space is countably generated and separates points, it admits a measurable
injection into the Cantor space `ℕ → Bool` (equipped with the product sigma algebra). -/
theorem measurable_injection_nat_bool_of_countablyGenerated [MeasurableSpace α]
    [HasCountableSeparatingOn α MeasurableSet univ] :
    ∃ f : α → ℕ → Bool, Measurable f ∧ Function.Injective f := by
  rcases exists_seq_separating α MeasurableSet.empty univ with ⟨e, hem, he⟩
  refine ⟨(· ∈ e ·), ?_, ?_⟩
  · 

Proof state:
case intro.intro.refine_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝¹ : MeasurableSpace α
inst✝ : HasCountableSeparatingOn α MeasurableSet univ
e : ℕ → Set α
hem : ∀ (n : ℕ), MeasurableSet (e n)
he : ∀ x ∈ univ, ∀ y ∈ univ, (∀ (n : ℕ), x ∈ e n ↔ y ∈ e n) → x = y
⊢ Measurable fun x x_1 => decide (x ∈ e x_1)

Next tactic:
rw [measurable_pi_iff]
/-- If a measurable space is countably generated and separates points, it admits a measurable
injection into the Cantor space `ℕ → Bool` (equipped with the product sigma algebra). -/
theorem measurable_injection_nat_bool_of_countablyGenerated [MeasurableSpace α]
    [HasCountableSeparatingOn α MeasurableSet univ] :
    ∃ f : α → ℕ → Bool, Measurable f ∧ Function.Injective f := by
  rcases exists_seq_separating α MeasurableSet.empty univ with ⟨e, hem, he⟩
  refine ⟨(· ∈ e ·), ?_, ?_⟩
  · rw [measurable_pi_iff]
    

Proof state:
case intro.intro.refine_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝¹ : MeasurableSpace α
inst✝ : HasCountableSeparatingOn α MeasurableSet univ
e : ℕ → Set α
hem : ∀ (n : ℕ), MeasurableSet (e n)
he : ∀ x ∈ univ, ∀ y ∈ univ, (∀ (n : ℕ), x ∈ e n ↔ y ∈ e n) → x = y
⊢ ∀ (a : ℕ), Measurable fun x => decide (x ∈ e a)

Next tactic:
refine fun n ↦ measurable_to_bool ?_
/-- If a measurable space is countably generated and separates points, it admits a measurable
injection into the Cantor space `ℕ → Bool` (equipped with the product sigma algebra). -/
theorem measurable_injection_nat_bool_of_countablyGenerated [MeasurableSpace α]
    [HasCountableSeparatingOn α MeasurableSet univ] :
    ∃ f : α → ℕ → Bool, Measurable f ∧ Function.Injective f := by
  rcases exists_seq_separating α MeasurableSet.empty univ with ⟨e, hem, he⟩
  refine ⟨(· ∈ e ·), ?_, ?_⟩
  · rw [measurable_pi_iff]
    refine fun n ↦ measurable_to_bool ?_
    

Proof state:
case intro.intro.refine_1
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝¹ : MeasurableSpace α
inst✝ : HasCountableSeparatingOn α MeasurableSet univ
e : ℕ → Set α
hem : ∀ (n : ℕ), MeasurableSet (e n)
he : ∀ x ∈ univ, ∀ y ∈ univ, (∀ (n : ℕ), x ∈ e n ↔ y ∈ e n) → x = y
n : ℕ
⊢ MeasurableSet ((fun x => decide (x ∈ e n)) ⁻¹' {true})

Next tactic:
simpa only [preimage, mem_singleton_iff, Bool.decide_iff, setOf_mem_eq] using hem n
/-- If a measurable space is countably generated and separates points, it admits a measurable
injection into the Cantor space `ℕ → Bool` (equipped with the product sigma algebra). -/
theorem measurable_injection_nat_bool_of_countablyGenerated [MeasurableSpace α]
    [HasCountableSeparatingOn α MeasurableSet univ] :
    ∃ f : α → ℕ → Bool, Measurable f ∧ Function.Injective f := by
  rcases exists_seq_separating α MeasurableSet.empty univ with ⟨e, hem, he⟩
  refine ⟨(· ∈ e ·), ?_, ?_⟩
  · rw [measurable_pi_iff]
    refine fun n ↦ measurable_to_bool ?_
    simpa only [preimage, mem_singleton_iff, Bool.decide_iff, setOf_mem_eq] using hem n
  · 

Proof state:
case intro.intro.refine_2
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝¹ : MeasurableSpace α
inst✝ : HasCountableSeparatingOn α MeasurableSet univ
e : ℕ → Set α
hem : ∀ (n : ℕ), MeasurableSet (e n)
he : ∀ x ∈ univ, ∀ y ∈ univ, (∀ (n : ℕ), x ∈ e n ↔ y ∈ e n) → x = y
⊢ Injective fun x x_1 => decide (x ∈ e x_1)

Next tactic:
exact fun x y h ↦ he x trivial y trivial fun n ↦ decide_eq_decide.1 <| congr_fun h _
instance inf_isMeasurablyGenerated (f g : Filter α) [IsMeasurablyGenerated f]
    [IsMeasurablyGenerated g] : IsMeasurablyGenerated (f ⊓ g) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝² : MeasurableSpace α
f g : Filter α
inst✝¹ : IsMeasurablyGenerated f
inst✝ : IsMeasurablyGenerated g
⊢ IsMeasurablyGenerated (f ⊓ g)

Next tactic:
constructor
instance inf_isMeasurablyGenerated (f g : Filter α) [IsMeasurablyGenerated f]
    [IsMeasurablyGenerated g] : IsMeasurablyGenerated (f ⊓ g) := by
  constructor
  

Proof state:
case exists_measurable_subset
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝² : MeasurableSpace α
f g : Filter α
inst✝¹ : IsMeasurablyGenerated f
inst✝ : IsMeasurablyGenerated g
⊢ ∀ ⦃s : Set α⦄, s ∈ f ⊓ g → ∃ t ∈ f ⊓ g, MeasurableSet t ∧ t ⊆ s

Next tactic:
rintro t ⟨sf, hsf, sg, hsg, rfl⟩
instance inf_isMeasurablyGenerated (f g : Filter α) [IsMeasurablyGenerated f]
    [IsMeasurablyGenerated g] : IsMeasurablyGenerated (f ⊓ g) := by
  constructor
  rintro t ⟨sf, hsf, sg, hsg, rfl⟩
  

Proof state:
case exists_measurable_subset.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝² : MeasurableSpace α
f g : Filter α
inst✝¹ : IsMeasurablyGenerated f
inst✝ : IsMeasurablyGenerated g
sf : Set α
hsf : sf ∈ f
sg : Set α
hsg : sg ∈ g
⊢ ∃ t ∈ f ⊓ g, MeasurableSet t ∧ t ⊆ sf ∩ sg

Next tactic:
rcases IsMeasurablyGenerated.exists_measurable_subset hsf with ⟨s'f, hs'f, hmf, hs'sf⟩
instance inf_isMeasurablyGenerated (f g : Filter α) [IsMeasurablyGenerated f]
    [IsMeasurablyGenerated g] : IsMeasurablyGenerated (f ⊓ g) := by
  constructor
  rintro t ⟨sf, hsf, sg, hsg, rfl⟩
  rcases IsMeasurablyGenerated.exists_measurable_subset hsf with ⟨s'f, hs'f, hmf, hs'sf⟩
  

Proof state:
case exists_measurable_subset.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝² : MeasurableSpace α
f g : Filter α
inst✝¹ : IsMeasurablyGenerated f
inst✝ : IsMeasurablyGenerated g
sf : Set α
hsf : sf ∈ f
sg : Set α
hsg : sg ∈ g
s'f : Set α
hs'f : s'f ∈ f
hmf : MeasurableSet s'f
hs'sf : s'f ⊆ sf
⊢ ∃ t ∈ f ⊓ g, MeasurableSet t ∧ t ⊆ sf ∩ sg

Next tactic:
rcases IsMeasurablyGenerated.exists_measurable_subset hsg with ⟨s'g, hs'g, hmg, hs'sg⟩
instance inf_isMeasurablyGenerated (f g : Filter α) [IsMeasurablyGenerated f]
    [IsMeasurablyGenerated g] : IsMeasurablyGenerated (f ⊓ g) := by
  constructor
  rintro t ⟨sf, hsf, sg, hsg, rfl⟩
  rcases IsMeasurablyGenerated.exists_measurable_subset hsf with ⟨s'f, hs'f, hmf, hs'sf⟩
  rcases IsMeasurablyGenerated.exists_measurable_subset hsg with ⟨s'g, hs'g, hmg, hs'sg⟩
  

Proof state:
case exists_measurable_subset.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝² : MeasurableSpace α
f g : Filter α
inst✝¹ : IsMeasurablyGenerated f
inst✝ : IsMeasurablyGenerated g
sf : Set α
hsf : sf ∈ f
sg : Set α
hsg : sg ∈ g
s'f : Set α
hs'f : s'f ∈ f
hmf : MeasurableSet s'f
hs'sf : s'f ⊆ sf
s'g : Set α
hs'g : s'g ∈ g
hmg : MeasurableSet s'g
hs'sg : s'g ⊆ sg
⊢ ∃ t ∈ f ⊓ g, MeasurableSet t ∧ t ⊆ sf ∩ sg

Next tactic:
refine' ⟨s'f ∩ s'g, inter_mem_inf hs'f hs'g, hmf.inter hmg, _⟩
instance inf_isMeasurablyGenerated (f g : Filter α) [IsMeasurablyGenerated f]
    [IsMeasurablyGenerated g] : IsMeasurablyGenerated (f ⊓ g) := by
  constructor
  rintro t ⟨sf, hsf, sg, hsg, rfl⟩
  rcases IsMeasurablyGenerated.exists_measurable_subset hsf with ⟨s'f, hs'f, hmf, hs'sf⟩
  rcases IsMeasurablyGenerated.exists_measurable_subset hsg with ⟨s'g, hs'g, hmg, hs'sg⟩
  refine' ⟨s'f ∩ s'g, inter_mem_inf hs'f hs'g, hmf.inter hmg, _⟩
  

Proof state:
case exists_measurable_subset.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝² : MeasurableSpace α
f g : Filter α
inst✝¹ : IsMeasurablyGenerated f
inst✝ : IsMeasurablyGenerated g
sf : Set α
hsf : sf ∈ f
sg : Set α
hsg : sg ∈ g
s'f : Set α
hs'f : s'f ∈ f
hmf : MeasurableSet s'f
hs'sf : s'f ⊆ sf
s'g : Set α
hs'g : s'g ∈ g
hmg : MeasurableSet s'g
hs'sg : s'g ⊆ sg
⊢ s'f ∩ s'g ⊆ sf ∩ sg

Next tactic:
exact inter_subset_inter hs'sf hs'sg
theorem principal_isMeasurablyGenerated_iff {s : Set α} :
    IsMeasurablyGenerated (𝓟 s) ↔ MeasurableSet s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t u : Set α
inst✝ : MeasurableSpace α
s : Set α
⊢ IsMeasurablyGenerated (𝓟 s) ↔ MeasurableSet s

Next tactic:
refine' ⟨_, fun hs => ⟨fun t ht => ⟨s, mem_principal_self s, hs, ht⟩⟩⟩
theorem principal_isMeasurablyGenerated_iff {s : Set α} :
    IsMeasurablyGenerated (𝓟 s) ↔ MeasurableSet s := by
  refine' ⟨_, fun hs => ⟨fun t ht => ⟨s, mem_principal_self s, hs, ht⟩⟩⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t u : Set α
inst✝ : MeasurableSpace α
s : Set α
⊢ IsMeasurablyGenerated (𝓟 s) → MeasurableSet s

Next tactic:
rintro ⟨hs⟩
theorem principal_isMeasurablyGenerated_iff {s : Set α} :
    IsMeasurablyGenerated (𝓟 s) ↔ MeasurableSet s := by
  refine' ⟨_, fun hs => ⟨fun t ht => ⟨s, mem_principal_self s, hs, ht⟩⟩⟩
  rintro ⟨hs⟩
  

Proof state:
case mk
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t u : Set α
inst✝ : MeasurableSpace α
s : Set α
hs : ∀ ⦃s_1 : Set α⦄, s_1 ∈ 𝓟 s → ∃ t ∈ 𝓟 s, MeasurableSet t ∧ t ⊆ s_1
⊢ MeasurableSet s

Next tactic:
rcases hs (mem_principal_self s) with ⟨t, ht, htm, hts⟩
theorem principal_isMeasurablyGenerated_iff {s : Set α} :
    IsMeasurablyGenerated (𝓟 s) ↔ MeasurableSet s := by
  refine' ⟨_, fun hs => ⟨fun t ht => ⟨s, mem_principal_self s, hs, ht⟩⟩⟩
  rintro ⟨hs⟩
  rcases hs (mem_principal_self s) with ⟨t, ht, htm, hts⟩
  

Proof state:
case mk.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t✝ u : Set α
inst✝ : MeasurableSpace α
s : Set α
hs : ∀ ⦃s_1 : Set α⦄, s_1 ∈ 𝓟 s → ∃ t ∈ 𝓟 s, MeasurableSet t ∧ t ⊆ s_1
t : Set α
ht : t ∈ 𝓟 s
htm : MeasurableSet t
hts : t ⊆ s
⊢ MeasurableSet s

Next tactic:
have : t = s := hts.antisymm ht
theorem principal_isMeasurablyGenerated_iff {s : Set α} :
    IsMeasurablyGenerated (𝓟 s) ↔ MeasurableSet s := by
  refine' ⟨_, fun hs => ⟨fun t ht => ⟨s, mem_principal_self s, hs, ht⟩⟩⟩
  rintro ⟨hs⟩
  rcases hs (mem_principal_self s) with ⟨t, ht, htm, hts⟩
  have : t = s := hts.antisymm ht
  

Proof state:
case mk.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s✝ t✝ u : Set α
inst✝ : MeasurableSpace α
s : Set α
hs : ∀ ⦃s_1 : Set α⦄, s_1 ∈ 𝓟 s → ∃ t ∈ 𝓟 s, MeasurableSet t ∧ t ⊆ s_1
t : Set α
ht : t ∈ 𝓟 s
htm : MeasurableSet t
hts : t ⊆ s
this : t = s
⊢ MeasurableSet s

Next tactic:
rwa [← this]
instance iInf_isMeasurablyGenerated {f : ι → Filter α} [∀ i, IsMeasurablyGenerated (f i)] :
    IsMeasurablyGenerated (⨅ i, f i) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
δ' : Type u_5
ι : Sort uι
s t u : Set α
inst✝¹ : MeasurableSpace α
f : ι → Filter α
inst✝ : ∀ (i : ι), IsMeasurablyGenerated (f i)
⊢ IsMeasurablyGenerated (⨅ i, f i)

Next tactic:
refine' ⟨fun s hs => _⟩