l3lab/ntp-mathlib huggingface dataset:
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      

Proof state:
case neg.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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
vu : ⋃ i ∈ v, {b | ↑i < b} = ⋃ i, {b | ↑i < b}
hv : Encodable ↑v
⊢ MeasurableSet (Ioi a)

Next tactic:
simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        

Proof state:
case neg.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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
vu : ⋃ i ∈ v, {b | ↑i < b} = ⋃ i, {b | ↑i < b}
hv : Encodable ↑v
⊢ MeasurableSet (Ioi a)

Next tactic:
simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      

Proof state:
case neg.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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
⊢ MeasurableSet (Ioi a)

Next tactic:
have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
        rcases (vu x).2 (by
          refine' not_imp_comm.1 (fun h => _) h
          exact ⟨x, fun b =>
            ⟨fun ab => le_of_not_lt fun h' => h ⟨b, ab, h'⟩, lt_of_lt_of_le ax⟩⟩) with ⟨a', h₁, h₂⟩
        · exact ⟨a', h₁, le_of_lt h₂⟩
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        

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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
⊢ Ioi a = ⋃ x, (Iio ↑↑x)ᶜ

Next tactic:
simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        

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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
⊢ ∀ (x : α), a < x ↔ ∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 ≤ x

Next tactic:
refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
        

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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
x : α
ax : a < x
⊢ ∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 ≤ x

Next tactic:
rcases (vu x).2 (by
          refine' not_imp_comm.1 (fun h => _) h
          exact ⟨x, fun b =>
            ⟨fun ab => le_of_not_lt fun h' => h ⟨b, ab, h'⟩, lt_of_lt_of_le ax⟩⟩) with ⟨a', h₁, h₂⟩
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
        rcases (vu x).2 (by
          

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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
x : α
ax : a < x
⊢ ∃ a_1, a < a_1 ∧ a_1 < x

Next tactic:
refine' not_imp_comm.1 (fun h => _) h
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
        rcases (vu x).2 (by
          refine' not_imp_comm.1 (fun h => _) h
          

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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h✝ : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
x : α
ax : a < x
h : ¬∃ a_1, a < a_1 ∧ a_1 < x
⊢ ∃ a', ∀ (b : α), a < b ↔ a' ≤ b

Next tactic:
exact ⟨x, fun b =>
            ⟨fun ab => le_of_not_lt fun h' => h ⟨b, ab, h'⟩, lt_of_lt_of_le ax⟩⟩
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
        rcases (vu x).2 (by
          refine' not_imp_comm.1 (fun h => _) h
          exact ⟨x, fun b =>
            ⟨fun ab => le_of_not_lt fun h' => h ⟨b, ab, h'⟩, lt_of_lt_of_le ax⟩⟩) with ⟨a', h₁, h₂⟩
        · 

Proof state:
case 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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
x : α
ax : a < x
a' : α
h₁ : ∃ (x : a < a'), { val := a', property := (_ : a < a') } ∈ v
h₂ : a' < x
⊢ ∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 ≤ x

Next tactic:
exact ⟨a', h₁, le_of_lt h₂⟩
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
        rcases (vu x).2 (by
          refine' not_imp_comm.1 (fun h => _) h
          exact ⟨x, fun b =>
            ⟨fun ab => le_of_not_lt fun h' => h ⟨b, ab, h'⟩, lt_of_lt_of_le ax⟩⟩) with ⟨a', h₁, h₂⟩
        · exact ⟨a', h₁, le_of_lt h₂⟩
      

Proof state:
case neg.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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this✝ : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
this : Ioi a = ⋃ x, (Iio ↑↑x)ᶜ
⊢ MeasurableSet (Ioi a)

Next tactic:
rw [this]
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
        rcases (vu x).2 (by
          refine' not_imp_comm.1 (fun h => _) h
          exact ⟨x, fun b =>
            ⟨fun ab => le_of_not_lt fun h' => h ⟨b, ab, h'⟩, lt_of_lt_of_le ax⟩⟩) with ⟨a', h₁, h₂⟩
        · exact ⟨a', h₁, le_of_lt h₂⟩
      rw [this]
      

Proof state:
case neg.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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this✝ : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
this : Ioi a = ⋃ x, (Iio ↑↑x)ᶜ
⊢ MeasurableSet (⋃ x, (Iio ↑↑x)ᶜ)

Next tactic:
apply MeasurableSet.iUnion
theorem borel_eq_generateFrom_Iio : borel α = .generateFrom (range Iio) := by
  refine' le_antisymm _ (generateFrom_le _)
  · rw [borel_eq_generateFrom_of_subbasis (@OrderTopology.topology_eq_generate_intervals α _ _ _)]
    letI : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
    have H : ∀ a : α, MeasurableSet (Iio a) := fun a => GenerateMeasurable.basic _ ⟨_, rfl⟩
    refine' generateFrom_le _
    rintro _ ⟨a, rfl | rfl⟩
    swap
    · apply H
    by_cases h : ∃ a', ∀ b, a < b ↔ a' ≤ b
    · rcases h with ⟨a', ha'⟩
      rw [(_ : Ioi a = (Iio a')ᶜ)]
      · exact (H _).compl
      simp [Set.ext_iff, ha']
    · rcases isOpen_iUnion_countable (fun a' : { a' : α // a < a' } => { b | a'.1 < b }) fun a' =>
          isOpen_lt' _ with ⟨v, ⟨hv⟩, vu⟩
      simp? [Set.ext_iff] at vu says
        simp only [Set.ext_iff, mem_iUnion, mem_setOf_eq, exists_prop, Subtype.exists,
          exists_and_right] at vu
      have : Ioi a = ⋃ x : v, (Iio x.1.1)ᶜ := by
        simp only [compl_Iio, iUnion_coe_set, Set.ext_iff, mem_Ioi, mem_iUnion, mem_Ici,
          exists_prop, Subtype.exists, exists_and_right]
        refine' fun x => ⟨fun ax => _, fun ⟨a', ⟨h, _⟩, ax⟩ => lt_of_lt_of_le h ax⟩
        rcases (vu x).2 (by
          refine' not_imp_comm.1 (fun h => _) h
          exact ⟨x, fun b =>
            ⟨fun ab => le_of_not_lt fun h' => h ⟨b, ab, h'⟩, lt_of_lt_of_le ax⟩⟩) with ⟨a', h₁, h₂⟩
        · exact ⟨a', h₁, le_of_lt h₂⟩
      rw [this]
      apply MeasurableSet.iUnion
      

Proof state:
case neg.intro.intro.intro.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✝² : SecondCountableTopology α
inst✝¹ : LinearOrder α
inst✝ : OrderTopology α
this✝ : MeasurableSpace α := MeasurableSpace.generateFrom (range Iio)
H : ∀ (a : α), MeasurableSet (Iio a)
a : α
h : ¬∃ a', ∀ (b : α), a < b ↔ a' ≤ b
v : Set { a' // a < a' }
hv : Encodable ↑v
vu :
  ∀ (x : α),
    (∃ a_1, (∃ (x : a < a_1), { val := a_1, property := (_ : a < a_1) } ∈ v) ∧ a_1 < x) ↔ ∃ a_1, a < a_1 ∧ a_1 < x
this : Ioi a = ⋃ x, (Iio ↑↑x)ᶜ
⊢ ∀ (b : ↑v), MeasurableSet (Iio ↑↑b)ᶜ

Next tactic:
exact fun _ => (H _).compl