l3lab/ntp-mathlib huggingface dataset:
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
⊢ MeasurableSet (Iio a)

Next tactic:
rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  

Proof state:
case intro.intro.intro.intro.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
⊢ MeasurableSet (Iio a)

Next tactic:
by_cases ha : ∀ b < a, (Ioo b a).Nonempty
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · 

Proof state:
case pos
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
⊢ MeasurableSet (Iio a)

Next tactic:
convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
    · 

Proof state:
case h.e'_3
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
⊢ Iio a = ⋃ l ∈ t, ⋃ u ∈ t, ⋃ (_ : l < u), ⋃ (_ : u ≤ a), Ico l u

Next tactic:
ext y
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
    · ext y
      

Proof state:
case h.e'_3.h
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
y : α
⊢ y ∈ Iio a ↔ y ∈ ⋃ l ∈ t, ⋃ u ∈ t, ⋃ (_ : l < u), ⋃ (_ : u ≤ a), Ico l u

Next tactic:
simp only [mem_iUnion, mem_Iio, mem_Ico]
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
    · ext y
      simp only [mem_iUnion, mem_Iio, mem_Ico]
      

Proof state:
case h.e'_3.h
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
y : α
⊢ y < a ↔ ∃ i, ∃ (_ : i ∈ t), ∃ i_1, ∃ (_ : i_1 ∈ t) (_ : i < i_1) (_ : i_1 ≤ a), i ≤ y ∧ y < i_1

Next tactic:
constructor
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
    · ext y
      simp only [mem_iUnion, mem_Iio, mem_Ico]
      constructor
      · 

Proof state:
case h.e'_3.h.mp
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
y : α
⊢ y < a → ∃ i, ∃ (_ : i ∈ t), ∃ i_1, ∃ (_ : i_1 ∈ t) (_ : i < i_1) (_ : i_1 ≤ a), i ≤ y ∧ y < i_1

Next tactic:
intro hy
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
    · ext y
      simp only [mem_iUnion, mem_Iio, mem_Ico]
      constructor
      · intro hy
        

Proof state:
case h.e'_3.h.mp
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
y : α
hy : y < a
⊢ ∃ i, ∃ (_ : i ∈ t), ∃ i_1, ∃ (_ : i_1 ∈ t) (_ : i < i_1) (_ : i_1 ≤ a), i ≤ y ∧ y < i_1

Next tactic:
rcases htd.exists_le' (fun b hb => htb _ hb (hbot b hb)) y with ⟨l, hlt, hly⟩
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
    · ext y
      simp only [mem_iUnion, mem_Iio, mem_Ico]
      constructor
      · intro hy
        rcases htd.exists_le' (fun b hb => htb _ hb (hbot b hb)) y with ⟨l, hlt, hly⟩
        

Proof state:
case h.e'_3.h.mp.intro.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
y : α
hy : y < a
l : α
hlt : l ∈ t
hly : l ≤ y
⊢ ∃ i, ∃ (_ : i ∈ t), ∃ i_1, ∃ (_ : i_1 ∈ t) (_ : i < i_1) (_ : i_1 ≤ a), i ≤ y ∧ y < i_1

Next tactic:
rcases htd.exists_mem_open isOpen_Ioo (ha y hy) with ⟨u, hut, hyu, hua⟩
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
    · ext y
      simp only [mem_iUnion, mem_Iio, mem_Ico]
      constructor
      · intro hy
        rcases htd.exists_le' (fun b hb => htb _ hb (hbot b hb)) y with ⟨l, hlt, hly⟩
        rcases htd.exists_mem_open isOpen_Ioo (ha y hy) with ⟨u, hut, hyu, hua⟩
        

Proof state:
case h.e'_3.h.mp.intro.intro.intro.intro.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u✝ : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
y : α
hy : y < a
l : α
hlt : l ∈ t
hly : l ≤ y
u : α
hut : u ∈ t
hyu : y < u
hua : u < a
⊢ ∃ i, ∃ (_ : i ∈ t), ∃ i_1, ∃ (_ : i_1 ∈ t) (_ : i < i_1) (_ : i_1 ≤ a), i ≤ y ∧ y < i_1

Next tactic:
exact ⟨l, hlt, u, hut, hly.trans_lt hyu, hua.le, hly, hyu⟩
theorem Dense.borel_eq_generateFrom_Ico_mem_aux {α : Type*} [TopologicalSpace α] [LinearOrder α]
    [OrderTopology α] [SecondCountableTopology α] {s : Set α} (hd : Dense s)
    (hbot : ∀ x, IsBot x → x ∈ s) (hIoo : ∀ x y : α, x < y → Ioo x y = ∅ → y ∈ s) :
    borel α = .generateFrom { S : Set α | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S } := by
  set S : Set (Set α) := { S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S }
  refine' le_antisymm _ (generateFrom_Ico_mem_le_borel _ _)
  letI : MeasurableSpace α := generateFrom S
  rw [borel_eq_generateFrom_Iio]
  refine' generateFrom_le (forall_range_iff.2 fun a => _)
  rcases hd.exists_countable_dense_subset_bot_top with ⟨t, hts, hc, htd, htb, -⟩
  by_cases ha : ∀ b < a, (Ioo b a).Nonempty
  · convert_to MeasurableSet (⋃ (l ∈ t) (u ∈ t) (_ : l < u) (_ : u ≤ a), Ico l u)
    · ext y
      simp only [mem_iUnion, mem_Iio, mem_Ico]
      constructor
      · intro hy
        rcases htd.exists_le' (fun b hb => htb _ hb (hbot b hb)) y with ⟨l, hlt, hly⟩
        rcases htd.exists_mem_open isOpen_Ioo (ha y hy) with ⟨u, hut, hyu, hua⟩
        exact ⟨l, hlt, u, hut, hly.trans_lt hyu, hua.le, hly, hyu⟩
      · 

Proof state:
case h.e'_3.h.mpr
α✝ : Type u_1
β : Type u_2
γ : Type u_3
γ₂ : Type u_4
δ : Type u_5
ι : Sort y
s✝ t✝ u : Set α✝
inst✝²⁰ : TopologicalSpace α✝
inst✝¹⁹ : MeasurableSpace α✝
inst✝¹⁸ : OpensMeasurableSpace α✝
inst✝¹⁷ : TopologicalSpace β
inst✝¹⁶ : MeasurableSpace β
inst✝¹⁵ : OpensMeasurableSpace β
inst✝¹⁴ : TopologicalSpace γ
inst✝¹³ : MeasurableSpace γ
inst✝¹² : BorelSpace γ
inst✝¹¹ : TopologicalSpace γ₂
inst✝¹⁰ : MeasurableSpace γ₂
inst✝⁹ : BorelSpace γ₂
inst✝⁸ : MeasurableSpace δ
α' : Type u_6
inst✝⁷ : TopologicalSpace α'
inst✝⁶ : MeasurableSpace α'
inst✝⁵ : LinearOrder α✝
inst✝⁴ : OrderClosedTopology α✝
a✝ b x : α✝
α : Type u_7
inst✝³ : TopologicalSpace α
inst✝² : LinearOrder α
inst✝¹ : OrderTopology α
inst✝ : SecondCountableTopology α
s : Set α
hd : Dense s
hbot : ∀ (x : α), IsBot x → x ∈ s
hIoo : ∀ (x y : α), x < y → Ioo x y = ∅ → y ∈ s
S : Set (Set α) := {S | ∃ l ∈ s, ∃ u ∈ s, l < u ∧ Ico l u = S}
this : MeasurableSpace α := MeasurableSpace.generateFrom S
a : α
t : Set α
hts : t ⊆ s
hc : Set.Countable t
htd : Dense t
htb : ∀ (x : α), IsBot x → x ∈ s → x ∈ t
ha : ∀ b < a, Set.Nonempty (Ioo b a)
y : α
⊢ (∃ i, ∃ (_ : i ∈ t), ∃ i_1, ∃ (_ : i_1 ∈ t) (_ : i < i_1) (_ : i_1 ≤ a), i ≤ y ∧ y < i_1) → y < a

Next tactic:
rintro ⟨l, -, u, -, -, hua, -, hyu⟩