l3lab/ntp-mathlib huggingface dataset:
/-- The Scott-Hausdorff topology.

A set `u` is open in the Scott-Hausdorff topology iff when the least upper bound of a directed set
`d` lies in `u` then there is a tail of `d` which is a subset of `u`. -/
def scottHausdorff : TopologicalSpace α where
  IsOpen u := ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a : α⦄, IsLUB d a →
    a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u
  isOpen_univ := fun d ⟨b, hb⟩ _ _ _ _ ↦ ⟨b, hb, (Ici b ∩ d).subset_univ⟩
  isOpen_inter s t hs ht d hd₁ hd₂ a hd₃ ha := by
    obtain ⟨b₁, hb₁d, hb₁ds⟩ := hs hd₁ hd₂ hd₃ ha.1
    obtain ⟨b₂, hb₂d, hb₂dt⟩ := ht hd₁ hd₂ hd₃ ha.2
    obtain ⟨c, hcd, hc⟩ := hd₂ b₁ hb₁d b₂ hb₂d
    

Proof state:
case intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
inst✝ : Preorder α
s✝ s t : Set α
hs :
  (fun u =>
      ∀ ⦃d : Set α⦄,
        Set.Nonempty d → DirectedOn (fun x x_1 => x ≤ x_1) d → ∀ ⦃a : α⦄, IsLUB d a → a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u)
    s
ht :
  (fun u =>
      ∀ ⦃d : Set α⦄,
        Set.Nonempty d → DirectedOn (fun x x_1 => x ≤ x_1) d → ∀ ⦃a : α⦄, IsLUB d a → a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u)
    t
d : Set α
hd₁ : Set.Nonempty d
hd₂ : DirectedOn (fun x x_1 => x ≤ x_1) d
a : α
hd₃ : IsLUB d a
ha : a ∈ s ∩ t
b₁ : α
hb₁d : b₁ ∈ d
hb₁ds : Ici b₁ ∩ d ⊆ s
b₂ : α
hb₂d : b₂ ∈ d
hb₂dt : Ici b₂ ∩ d ⊆ t
c : α
hcd : c ∈ d
hc : (fun x x_1 => x ≤ x_1) b₁ c ∧ (fun x x_1 => x ≤ x_1) b₂ c
⊢ ∃ b ∈ d, Ici b ∩ d ⊆ s ∩ t

Next tactic:
exact ⟨c, hcd, fun e ⟨hce, hed⟩ ↦ ⟨hb₁ds ⟨hc.1.trans hce, hed⟩, hb₂dt ⟨hc.2.trans hce, hed⟩⟩⟩
/-- The Scott-Hausdorff topology.

A set `u` is open in the Scott-Hausdorff topology iff when the least upper bound of a directed set
`d` lies in `u` then there is a tail of `d` which is a subset of `u`. -/
def scottHausdorff : TopologicalSpace α where
  IsOpen u := ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a : α⦄, IsLUB d a →
    a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u
  isOpen_univ := fun d ⟨b, hb⟩ _ _ _ _ ↦ ⟨b, hb, (Ici b ∩ d).subset_univ⟩
  isOpen_inter s t hs ht d hd₁ hd₂ a hd₃ ha := by
    obtain ⟨b₁, hb₁d, hb₁ds⟩ := hs hd₁ hd₂ hd₃ ha.1
    obtain ⟨b₂, hb₂d, hb₂dt⟩ := ht hd₁ hd₂ hd₃ ha.2
    obtain ⟨c, hcd, hc⟩ := hd₂ b₁ hb₁d b₂ hb₂d
    exact ⟨c, hcd, fun e ⟨hce, hed⟩ ↦ ⟨hb₁ds ⟨hc.1.trans hce, hed⟩, hb₂dt ⟨hc.2.trans hce, hed⟩⟩⟩
  isOpen_sUnion := fun s h d hd₁ hd₂ a hd₃ ⟨s₀, hs₀s, has₀⟩ ↦ by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Preorder α
s✝ : Set α
s : Set (Set α)
h :
  ∀ t ∈ s,
    (fun u =>
        ∀ ⦃d : Set α⦄,
          Set.Nonempty d → DirectedOn (fun x x_1 => x ≤ x_1) d → ∀ ⦃a : α⦄, IsLUB d a → a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u)
      t
d : Set α
hd₁ : Set.Nonempty d
hd₂ : DirectedOn (fun x x_1 => x ≤ x_1) d
a : α
hd₃ : IsLUB d a
x✝ : a ∈ ⋃₀ s
s₀ : Set α
hs₀s : s₀ ∈ s
has₀ : a ∈ s₀
⊢ ∃ b ∈ d, Ici b ∩ d ⊆ ⋃₀ s

Next tactic:
obtain ⟨b, hbd, hbds₀⟩ := h s₀ hs₀s hd₁ hd₂ hd₃ has₀
/-- The Scott-Hausdorff topology.

A set `u` is open in the Scott-Hausdorff topology iff when the least upper bound of a directed set
`d` lies in `u` then there is a tail of `d` which is a subset of `u`. -/
def scottHausdorff : TopologicalSpace α where
  IsOpen u := ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a : α⦄, IsLUB d a →
    a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u
  isOpen_univ := fun d ⟨b, hb⟩ _ _ _ _ ↦ ⟨b, hb, (Ici b ∩ d).subset_univ⟩
  isOpen_inter s t hs ht d hd₁ hd₂ a hd₃ ha := by
    obtain ⟨b₁, hb₁d, hb₁ds⟩ := hs hd₁ hd₂ hd₃ ha.1
    obtain ⟨b₂, hb₂d, hb₂dt⟩ := ht hd₁ hd₂ hd₃ ha.2
    obtain ⟨c, hcd, hc⟩ := hd₂ b₁ hb₁d b₂ hb₂d
    exact ⟨c, hcd, fun e ⟨hce, hed⟩ ↦ ⟨hb₁ds ⟨hc.1.trans hce, hed⟩, hb₂dt ⟨hc.2.trans hce, hed⟩⟩⟩
  isOpen_sUnion := fun s h d hd₁ hd₂ a hd₃ ⟨s₀, hs₀s, has₀⟩ ↦ by
    obtain ⟨b, hbd, hbds₀⟩ := h s₀ hs₀s hd₁ hd₂ hd₃ has₀
    

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
inst✝ : Preorder α
s✝ : Set α
s : Set (Set α)
h :
  ∀ t ∈ s,
    (fun u =>
        ∀ ⦃d : Set α⦄,
          Set.Nonempty d → DirectedOn (fun x x_1 => x ≤ x_1) d → ∀ ⦃a : α⦄, IsLUB d a → a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u)
      t
d : Set α
hd₁ : Set.Nonempty d
hd₂ : DirectedOn (fun x x_1 => x ≤ x_1) d
a : α
hd₃ : IsLUB d a
x✝ : a ∈ ⋃₀ s
s₀ : Set α
hs₀s : s₀ ∈ s
has₀ : a ∈ s₀
b : α
hbd : b ∈ d
hbds₀ : Ici b ∩ d ⊆ s₀
⊢ ∃ b ∈ d, Ici b ∩ d ⊆ ⋃₀ s

Next tactic:
exact ⟨b, hbd, Set.subset_sUnion_of_subset s s₀ hbds₀ hs₀s⟩
lemma isOpen_iff :
    IsOpen s ↔ ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a : α⦄, IsLUB d a →
      a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
s✝ : Set α
inst✝¹ : TopologicalSpace α
inst✝ : IsScottHausdorff α
s : Set α
⊢ IsOpen s ↔
    ∀ ⦃d : Set α⦄,
      Set.Nonempty d → DirectedOn (fun x x_1 => x ≤ x_1) d → ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s

Next tactic:
erw [topology_eq_scottHausdorff (α := α)]
lemma isOpen_iff :
    IsOpen s ↔ ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a : α⦄, IsLUB d a →
      a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s := by erw [topology_eq_scottHausdorff (α := α)]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
s✝ : Set α
inst✝¹ : TopologicalSpace α
inst✝ : IsScottHausdorff α
s : Set α
⊢ IsOpen s ↔
    ∀ ⦃d : Set α⦄,
      Set.Nonempty d → DirectedOn (fun x x_1 => x ≤ x_1) d → ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s

Next tactic:
rfl
lemma dirSupInacc_of_isOpen (h : IsOpen s) : DirSupInacc s :=
  fun d hd₁ hd₂ a hda hd₃ ↦ by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
s✝ : Set α
inst✝¹ : TopologicalSpace α
inst✝ : IsScottHausdorff α
s : Set α
h : IsOpen s
d : Set α
hd₁ : Set.Nonempty d
hd₂ : DirectedOn (fun x x_1 => x ≤ x_1) d
a : α
hda : IsLUB d a
hd₃ : a ∈ s
⊢ Set.Nonempty (d ∩ s)

Next tactic:
obtain ⟨b, hbd, hb⟩ := isOpen_iff.1 h hd₁ hd₂ hda hd₃
lemma dirSupInacc_of_isOpen (h : IsOpen s) : DirSupInacc s :=
  fun d hd₁ hd₂ a hda hd₃ ↦ by
    obtain ⟨b, hbd, hb⟩ := isOpen_iff.1 h hd₁ hd₂ hda hd₃; 

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
inst✝² : Preorder α
s✝ : Set α
inst✝¹ : TopologicalSpace α
inst✝ : IsScottHausdorff α
s : Set α
h : IsOpen s
d : Set α
hd₁ : Set.Nonempty d
hd₂ : DirectedOn (fun x x_1 => x ≤ x_1) d
a : α
hda : IsLUB d a
hd₃ : a ∈ s
b : α
hbd : b ∈ d
hb : Ici b ∩ d ⊆ s
⊢ Set.Nonempty (d ∩ s)

Next tactic:
exact ⟨b, hbd, hb ⟨le_rfl, hbd⟩⟩
lemma isOpen_iff_isUpperSet_and_scottHausdorff_open :
    IsOpen s ↔ IsUpperSet s ∧ IsOpen[scottHausdorff] s := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ IsOpen s ↔ IsUpperSet s ∧ IsOpen s

Next tactic:
erw [topology_eq α]
lemma isOpen_iff_isUpperSet_and_scottHausdorff_open :
    IsOpen s ↔ IsUpperSet s ∧ IsOpen[scottHausdorff] s := by erw [topology_eq α]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ IsOpen s ↔ IsUpperSet s ∧ IsOpen s

Next tactic:
rfl
lemma isOpen_iff_isUpperSet_and_dirSupInacc : IsOpen s ↔ IsUpperSet s ∧ DirSupInacc s := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ IsOpen s ↔ IsUpperSet s ∧ DirSupInacc s

Next tactic:
rw [isOpen_iff_isUpperSet_and_scottHausdorff_open]
lemma isOpen_iff_isUpperSet_and_dirSupInacc : IsOpen s ↔ IsUpperSet s ∧ DirSupInacc s := by
  rw [isOpen_iff_isUpperSet_and_scottHausdorff_open]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ IsUpperSet s ∧ IsOpen s ↔ IsUpperSet s ∧ DirSupInacc s

Next tactic:
refine and_congr_right fun h ↦
    ⟨@IsScottHausdorff.dirSupInacc_of_isOpen _ _ scottHausdorff _ _, fun h' d d₁ d₂ _ d₃ ha ↦ ?_⟩
lemma isOpen_iff_isUpperSet_and_dirSupInacc : IsOpen s ↔ IsUpperSet s ∧ DirSupInacc s := by
  rw [isOpen_iff_isUpperSet_and_scottHausdorff_open]
  refine and_congr_right fun h ↦
    ⟨@IsScottHausdorff.dirSupInacc_of_isOpen _ _ scottHausdorff _ _, fun h' d d₁ d₂ _ d₃ ha ↦ ?_⟩
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
h : IsUpperSet s
h' : DirSupInacc s
d : Set α
d₁ : Set.Nonempty d
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) d
x✝ : α
d₃ : IsLUB d x✝
ha : x✝ ∈ s
⊢ ∃ b ∈ d, Ici b ∩ d ⊆ s

Next tactic:
obtain ⟨b, hbd, hbu⟩ := h' d₁ d₂ d₃ ha
lemma isOpen_iff_isUpperSet_and_dirSupInacc : IsOpen s ↔ IsUpperSet s ∧ DirSupInacc s := by
  rw [isOpen_iff_isUpperSet_and_scottHausdorff_open]
  refine and_congr_right fun h ↦
    ⟨@IsScottHausdorff.dirSupInacc_of_isOpen _ _ scottHausdorff _ _, fun h' d d₁ d₂ _ d₃ ha ↦ ?_⟩
  obtain ⟨b, hbd, hbu⟩ := h' d₁ d₂ d₃ ha
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
h : IsUpperSet s
h' : DirSupInacc s
d : Set α
d₁ : Set.Nonempty d
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) d
x✝ : α
d₃ : IsLUB d x✝
ha : x✝ ∈ s
b : α
hbd : b ∈ d
hbu : b ∈ s
⊢ ∃ b ∈ d, Ici b ∩ d ⊆ s

Next tactic:
exact ⟨b, hbd, Subset.trans (inter_subset_left (Ici b) d) (h.Ici_subset hbu)⟩
lemma isClosed_iff_isLowerSet_and_dirSupClosed : IsClosed s ↔ IsLowerSet s ∧ DirSupClosed s := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ IsClosed s ↔ IsLowerSet s ∧ DirSupClosed s

Next tactic:
rw [← isOpen_compl_iff, isOpen_iff_isUpperSet_and_dirSupInacc, isUpperSet_compl,
    dirSupInacc_compl]
lemma lowerClosure_subset_closure : ↑(lowerClosure s) ⊆ closure s := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ ↑(lowerClosure s) ⊆ closure s

Next tactic:
convert closure.mono (@upperSet_le_scott α _)
lemma lowerClosure_subset_closure : ↑(lowerClosure s) ⊆ closure s := by
  convert closure.mono (@upperSet_le_scott α _)
  

Proof state:
case h.e'_3
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ ↑(lowerClosure s) = closure s
case h.e'_4.h.e'_2
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ inst✝¹ = scott

Next tactic:
rw [@IsUpperSet.closure_eq_lowerClosure α _ (upperSet α) ?_ s]
lemma lowerClosure_subset_closure : ↑(lowerClosure s) ⊆ closure s := by
  convert closure.mono (@upperSet_le_scott α _)
  rw [@IsUpperSet.closure_eq_lowerClosure α _ (upperSet α) ?_ s]
  · 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ Topology.IsUpperSet α

Next tactic:
exact instIsUpperSetUpperSet
lemma lowerClosure_subset_closure : ↑(lowerClosure s) ⊆ closure s := by
  convert closure.mono (@upperSet_le_scott α _)
  rw [@IsUpperSet.closure_eq_lowerClosure α _ (upperSet α) ?_ s]
  · exact instIsUpperSetUpperSet
  · 

Proof state:
case h.e'_4.h.e'_2
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ inst✝¹ = scott

Next tactic:
exact topology_eq α
/--
The closure of a singleton `{a}` in the Scott topology is the right-closed left-infinite interval
`(-∞,a]`.
-/
@[simp] lemma closure_singleton : closure {a} = Iic a := le_antisymm
  (closure_minimal (by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ {a} ⊆ Iic a

Next tactic:
rw [singleton_subset_iff, mem_Iic]
/--
The closure of a singleton `{a}` in the Scott topology is the right-closed left-infinite interval
`(-∞,a]`.
-/
@[simp] lemma closure_singleton : closure {a} = Iic a := le_antisymm
  (closure_minimal (by rw [singleton_subset_iff, mem_Iic]) isClosed_Iic) $ by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ Iic a ≤ closure {a}

Next tactic:
rw [← LowerSet.coe_Iic, ← lowerClosure_singleton]
/--
The closure of a singleton `{a}` in the Scott topology is the right-closed left-infinite interval
`(-∞,a]`.
-/
@[simp] lemma closure_singleton : closure {a} = Iic a := le_antisymm
  (closure_minimal (by rw [singleton_subset_iff, mem_Iic]) isClosed_Iic) $ by
    rw [← LowerSet.coe_Iic, ← lowerClosure_singleton]
    

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
s : Set α
a : α
⊢ ↑(lowerClosure {a}) ≤ closure {a}

Next tactic:
apply lowerClosure_subset_closure
lemma monotone_of_continuous (hf : Continuous f) : Monotone f := fun _ b hab ↦ by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝ b : α
hab : x✝ ≤ b
⊢ f x✝ ≤ f b

Next tactic:
by_contra h
lemma monotone_of_continuous (hf : Continuous f) : Monotone f := fun _ b hab ↦ by
  by_contra h
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝ b : α
hab : x✝ ≤ b
h : ¬f x✝ ≤ f b
⊢ False

Next tactic:
simpa only [mem_compl_iff, mem_preimage, mem_Iic, le_refl, not_true]
    using isUpperSet_of_isOpen ((isOpen_compl_iff.2 isClosed_Iic).preimage hf) hab h
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
⊢ ScottContinuous f ↔ Continuous f

Next tactic:
refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · 

Proof state:
case refine_1
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
h : ScottContinuous f
u : Set β
hu : IsOpen u
⊢ IsOpen (f ⁻¹' u)

Next tactic:
rw [isOpen_iff_isUpperSet_and_dirSupInacc]
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    

Proof state:
case refine_1
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
h : ScottContinuous f
u : Set β
hu : IsOpen u
⊢ IsUpperSet (f ⁻¹' u) ∧ DirSupInacc (f ⁻¹' u)

Next tactic:
exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
  · 

Proof state:
case refine_2
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
⊢ Continuous f → ScottContinuous f

Next tactic:
refine fun hf _ d₁ d₂ _ d₃ ↦ ⟨(monotone_of_continuous hf).mem_upperBounds_image d₃.1,
      fun b hb ↦ ?_⟩
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
  · refine fun hf _ d₁ d₂ _ d₃ ↦ ⟨(monotone_of_continuous hf).mem_upperBounds_image d₃.1,
      fun b hb ↦ ?_⟩
    

Proof state:
case refine_2
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝¹ : Set α
d₁ : Set.Nonempty x✝¹
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) x✝¹
x✝ : α
d₃ : IsLUB x✝¹ x✝
b : β
hb : b ∈ upperBounds (f '' x✝¹)
⊢ f x✝ ≤ b

Next tactic:
by_contra h
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
  · refine fun hf _ d₁ d₂ _ d₃ ↦ ⟨(monotone_of_continuous hf).mem_upperBounds_image d₃.1,
      fun b hb ↦ ?_⟩
    by_contra h
    

Proof state:
case refine_2
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝¹ : Set α
d₁ : Set.Nonempty x✝¹
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) x✝¹
x✝ : α
d₃ : IsLUB x✝¹ x✝
b : β
hb : b ∈ upperBounds (f '' x✝¹)
h : ¬f x✝ ≤ b
⊢ False

Next tactic:
let u := (Iic b)ᶜ
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
  · refine fun hf _ d₁ d₂ _ d₃ ↦ ⟨(monotone_of_continuous hf).mem_upperBounds_image d₃.1,
      fun b hb ↦ ?_⟩
    by_contra h
    let u := (Iic b)ᶜ
    

Proof state:
case refine_2
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝¹ : Set α
d₁ : Set.Nonempty x✝¹
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) x✝¹
x✝ : α
d₃ : IsLUB x✝¹ x✝
b : β
hb : b ∈ upperBounds (f '' x✝¹)
h : ¬f x✝ ≤ b
u : Set β := (Iic b)ᶜ
⊢ False

Next tactic:
have hu : IsOpen (f ⁻¹' u) := (isOpen_compl_iff.2 isClosed_Iic).preimage hf
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
  · refine fun hf _ d₁ d₂ _ d₃ ↦ ⟨(monotone_of_continuous hf).mem_upperBounds_image d₃.1,
      fun b hb ↦ ?_⟩
    by_contra h
    let u := (Iic b)ᶜ
    have hu : IsOpen (f ⁻¹' u) := (isOpen_compl_iff.2 isClosed_Iic).preimage hf
    

Proof state:
case refine_2
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝¹ : Set α
d₁ : Set.Nonempty x✝¹
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) x✝¹
x✝ : α
d₃ : IsLUB x✝¹ x✝
b : β
hb : b ∈ upperBounds (f '' x✝¹)
h : ¬f x✝ ≤ b
u : Set β := (Iic b)ᶜ
hu : IsOpen (f ⁻¹' u)
⊢ False

Next tactic:
rw [isOpen_iff_isUpperSet_and_dirSupInacc] at hu
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
  · refine fun hf _ d₁ d₂ _ d₃ ↦ ⟨(monotone_of_continuous hf).mem_upperBounds_image d₃.1,
      fun b hb ↦ ?_⟩
    by_contra h
    let u := (Iic b)ᶜ
    have hu : IsOpen (f ⁻¹' u) := (isOpen_compl_iff.2 isClosed_Iic).preimage hf
    rw [isOpen_iff_isUpperSet_and_dirSupInacc] at hu
    

Proof state:
case refine_2
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝¹ : Set α
d₁ : Set.Nonempty x✝¹
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) x✝¹
x✝ : α
d₃ : IsLUB x✝¹ x✝
b : β
hb : b ∈ upperBounds (f '' x✝¹)
h : ¬f x✝ ≤ b
u : Set β := (Iic b)ᶜ
hu : IsUpperSet (f ⁻¹' u) ∧ DirSupInacc (f ⁻¹' u)
⊢ False

Next tactic:
obtain ⟨c, hcd, hfcb⟩ := hu.2 d₁ d₂ d₃ h
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
  · refine fun hf _ d₁ d₂ _ d₃ ↦ ⟨(monotone_of_continuous hf).mem_upperBounds_image d₃.1,
      fun b hb ↦ ?_⟩
    by_contra h
    let u := (Iic b)ᶜ
    have hu : IsOpen (f ⁻¹' u) := (isOpen_compl_iff.2 isClosed_Iic).preimage hf
    rw [isOpen_iff_isUpperSet_and_dirSupInacc] at hu
    obtain ⟨c, hcd, hfcb⟩ := hu.2 d₁ d₂ d₃ h
    

Proof state:
case refine_2.intro.intro
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝¹ : Set α
d₁ : Set.Nonempty x✝¹
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) x✝¹
x✝ : α
d₃ : IsLUB x✝¹ x✝
b : β
hb : b ∈ upperBounds (f '' x✝¹)
h : ¬f x✝ ≤ b
u : Set β := (Iic b)ᶜ
hu : IsUpperSet (f ⁻¹' u) ∧ DirSupInacc (f ⁻¹' u)
c : α
hcd : c ∈ x✝¹
hfcb : c ∈ f ⁻¹' u
⊢ False

Next tactic:
simp [upperBounds] at hb
@[simp] lemma scottContinuous_iff_continuous : ScottContinuous f ↔ Continuous f := by
  refine ⟨fun h ↦ continuous_def.2 fun u hu ↦ ?_, ?_⟩
  · rw [isOpen_iff_isUpperSet_and_dirSupInacc]
    exact ⟨(isUpperSet_of_isOpen hu).preimage h.monotone, fun _ hd₁ hd₂ _ hd₃ ha ↦
      image_inter_nonempty_iff.mp $ (isOpen_iff_isUpperSet_and_dirSupInacc.mp hu).2 (hd₁.image f)
        (directedOn_image.mpr (hd₂.mono @(h.monotone))) (h hd₁ hd₂ hd₃) ha⟩
  · refine fun hf _ d₁ d₂ _ d₃ ↦ ⟨(monotone_of_continuous hf).mem_upperBounds_image d₃.1,
      fun b hb ↦ ?_⟩
    by_contra h
    let u := (Iic b)ᶜ
    have hu : IsOpen (f ⁻¹' u) := (isOpen_compl_iff.2 isClosed_Iic).preimage hf
    rw [isOpen_iff_isUpperSet_and_dirSupInacc] at hu
    obtain ⟨c, hcd, hfcb⟩ := hu.2 d₁ d₂ d₃ h
    simp [upperBounds] at hb
    

Proof state:
case refine_2.intro.intro
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : TopologicalSpace α
inst✝³ : IsScott α
s : Set α
a : α
inst✝² : Preorder β
inst✝¹ : TopologicalSpace β
inst✝ : IsScott β
f : α → β
hf : Continuous f
x✝¹ : Set α
d₁ : Set.Nonempty x✝¹
d₂ : DirectedOn (fun x x_1 => x ≤ x_1) x✝¹
x✝ : α
d₃ : IsLUB x✝¹ x✝
b : β
h : ¬f x✝ ≤ b
u : Set β := (Iic b)ᶜ
hu : IsUpperSet (f ⁻¹' u) ∧ DirSupInacc (f ⁻¹' u)
c : α
hcd : c ∈ x✝¹
hfcb : c ∈ f ⁻¹' u
hb : ∀ a ∈ x✝¹, f a ≤ b
⊢ False

Next tactic:
exact hfcb $ hb _ hcd
/--
The Scott topology on a partial order is T₀.
-/
-- see Note [lower instance priority]
instance (priority := 90) : T0Space α :=
    (t0Space_iff_inseparable α).2 $ fun x y h ↦ Iic_injective $
  by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : TopologicalSpace α
inst✝ : IsScott α
x y : α
h : Inseparable x y
⊢ Iic x = Iic y

Next tactic:
simpa only [inseparable_iff_closure_eq, IsScott.closure_singleton] using h