l3lab/ntp-mathlib huggingface dataset:
/-- A regular topological space with second countable topology is a normal space. -/
instance (priority := 100) NormalSpace.of_regularSpace_secondCountableTopology
    [RegularSpace X] [SecondCountableTopology X] : NormalSpace X := by
  have key : ∀ {s t : Set X}, IsClosed t → Disjoint s t →
    ∃ U : Set (countableBasis X), (s ⊆ ⋃ u ∈ U, ↑u) ∧ (∀ u ∈ U, Disjoint (closure ↑u) t) ∧
      ∀ n : ℕ, IsClosed (⋃ (u ∈ U) (_ : Encodable.encode u ≤ n), closure (u : Set X)) := by
    intro s t hc hd
    rw [disjoint_left] at hd
    have : ∀ x ∈ s, ∃ U ∈ countableBasis X, x ∈ U ∧ Disjoint (closure U) t := by
      intro x hx
      rcases (isBasis_countableBasis X).exists_closure_subset (hc.compl_mem_nhds (hd hx))
        with ⟨u, hu, hxu, hut⟩
      exact ⟨u, hu, hxu, disjoint_left.2 hut⟩
    choose! U hu hxu hd using this
    set V : s → countableBasis X := MapsTo.restrict _ _ _ hu
    refine' ⟨range V, _, forall_range_iff.2 <| Subtype.forall.2 hd, fun n => _⟩
    · rw [biUnion_range]
      exact fun x hx => mem_iUnion.2 ⟨⟨x, hx⟩, hxu x hx⟩
    · simp only [← iSup_eq_iUnion, iSup_and']
      exact (((finite_le_nat n).preimage_embedding (Encodable.encode' _)).subset <|
        inter_subset_right _ _).isClosed_biUnion fun u _ => isClosed_closure
  refine' { normal := fun s t hs ht hd => _ }
  rcases key ht hd with ⟨U, hsU, hUd, hUc⟩
  rcases key hs hd.symm with ⟨V, htV, hVd, hVc⟩
  refine ⟨⋃ u ∈ U, ↑u \ ⋃ (v ∈ V) (_ : Encodable.encode v ≤ Encodable.encode u), closure ↑v,
    ⋃ v ∈ V, ↑v \ ⋃ (u ∈ U) (_ : Encodable.encode u ≤ Encodable.encode v), closure ↑u,
    isOpen_biUnion fun u _ => (isOpen_of_mem_countableBasis u.2).sdiff (hVc _),
    isOpen_biUnion fun v _ => (isOpen_of_mem_countableBasis v.2).sdiff (hUc _),
    fun x hx => ?_, fun x hx => ?_, ?_⟩
  · rcases mem_iUnion₂.1 (hsU hx) with ⟨u, huU, hxu⟩
    refine' mem_biUnion huU ⟨hxu, _⟩
    simp only [mem_iUnion]
    rintro ⟨v, hvV, -, hxv⟩
    exact (hVd v hvV).le_bot ⟨hxv, hx⟩
  · rcases mem_iUnion₂.1 (htV hx) with ⟨v, hvV, hxv⟩
    refine' mem_biUnion hvV ⟨hxv, _⟩
    

Proof state:
case intro.intro.intro.intro.intro.intro.refine_2.intro.intro
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : RegularSpace X
inst✝ : SecondCountableTopology X
key :
  ∀ {s t : Set X},
    IsClosed t →
      Disjoint s t →
        ∃ U,
          s ⊆ ⋃ u ∈ U, ↑u ∧
            (∀ u ∈ U, Disjoint (closure ↑u) t) ∧
              ∀ (n : ℕ), IsClosed (⋃ u ∈ U, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
s t : Set X
hs : IsClosed s
ht : IsClosed t
hd : Disjoint s t
U : Set ↑(countableBasis X)
hsU : s ⊆ ⋃ u ∈ U, ↑u
hUd : ∀ u ∈ U, Disjoint (closure ↑u) t
hUc : ∀ (n : ℕ), IsClosed (⋃ u ∈ U, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
V : Set ↑(countableBasis X)
htV : t ⊆ ⋃ u ∈ V, ↑u
hVd : ∀ u ∈ V, Disjoint (closure ↑u) s
hVc : ∀ (n : ℕ), IsClosed (⋃ u ∈ V, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
x : X
hx : x ∈ t
v : ↑(countableBasis X)
hvV : v ∈ V
hxv : x ∈ ↑v
⊢ x ∉ ⋃ u ∈ U, ⋃ (_ : Encodable.encode u ≤ Encodable.encode v), closure ↑u

Next tactic:
simp only [mem_iUnion]
/-- A regular topological space with second countable topology is a normal space. -/
instance (priority := 100) NormalSpace.of_regularSpace_secondCountableTopology
    [RegularSpace X] [SecondCountableTopology X] : NormalSpace X := by
  have key : ∀ {s t : Set X}, IsClosed t → Disjoint s t →
    ∃ U : Set (countableBasis X), (s ⊆ ⋃ u ∈ U, ↑u) ∧ (∀ u ∈ U, Disjoint (closure ↑u) t) ∧
      ∀ n : ℕ, IsClosed (⋃ (u ∈ U) (_ : Encodable.encode u ≤ n), closure (u : Set X)) := by
    intro s t hc hd
    rw [disjoint_left] at hd
    have : ∀ x ∈ s, ∃ U ∈ countableBasis X, x ∈ U ∧ Disjoint (closure U) t := by
      intro x hx
      rcases (isBasis_countableBasis X).exists_closure_subset (hc.compl_mem_nhds (hd hx))
        with ⟨u, hu, hxu, hut⟩
      exact ⟨u, hu, hxu, disjoint_left.2 hut⟩
    choose! U hu hxu hd using this
    set V : s → countableBasis X := MapsTo.restrict _ _ _ hu
    refine' ⟨range V, _, forall_range_iff.2 <| Subtype.forall.2 hd, fun n => _⟩
    · rw [biUnion_range]
      exact fun x hx => mem_iUnion.2 ⟨⟨x, hx⟩, hxu x hx⟩
    · simp only [← iSup_eq_iUnion, iSup_and']
      exact (((finite_le_nat n).preimage_embedding (Encodable.encode' _)).subset <|
        inter_subset_right _ _).isClosed_biUnion fun u _ => isClosed_closure
  refine' { normal := fun s t hs ht hd => _ }
  rcases key ht hd with ⟨U, hsU, hUd, hUc⟩
  rcases key hs hd.symm with ⟨V, htV, hVd, hVc⟩
  refine ⟨⋃ u ∈ U, ↑u \ ⋃ (v ∈ V) (_ : Encodable.encode v ≤ Encodable.encode u), closure ↑v,
    ⋃ v ∈ V, ↑v \ ⋃ (u ∈ U) (_ : Encodable.encode u ≤ Encodable.encode v), closure ↑u,
    isOpen_biUnion fun u _ => (isOpen_of_mem_countableBasis u.2).sdiff (hVc _),
    isOpen_biUnion fun v _ => (isOpen_of_mem_countableBasis v.2).sdiff (hUc _),
    fun x hx => ?_, fun x hx => ?_, ?_⟩
  · rcases mem_iUnion₂.1 (hsU hx) with ⟨u, huU, hxu⟩
    refine' mem_biUnion huU ⟨hxu, _⟩
    simp only [mem_iUnion]
    rintro ⟨v, hvV, -, hxv⟩
    exact (hVd v hvV).le_bot ⟨hxv, hx⟩
  · rcases mem_iUnion₂.1 (htV hx) with ⟨v, hvV, hxv⟩
    refine' mem_biUnion hvV ⟨hxv, _⟩
    simp only [mem_iUnion]
    

Proof state:
case intro.intro.intro.intro.intro.intro.refine_2.intro.intro
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : RegularSpace X
inst✝ : SecondCountableTopology X
key :
  ∀ {s t : Set X},
    IsClosed t →
      Disjoint s t →
        ∃ U,
          s ⊆ ⋃ u ∈ U, ↑u ∧
            (∀ u ∈ U, Disjoint (closure ↑u) t) ∧
              ∀ (n : ℕ), IsClosed (⋃ u ∈ U, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
s t : Set X
hs : IsClosed s
ht : IsClosed t
hd : Disjoint s t
U : Set ↑(countableBasis X)
hsU : s ⊆ ⋃ u ∈ U, ↑u
hUd : ∀ u ∈ U, Disjoint (closure ↑u) t
hUc : ∀ (n : ℕ), IsClosed (⋃ u ∈ U, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
V : Set ↑(countableBasis X)
htV : t ⊆ ⋃ u ∈ V, ↑u
hVd : ∀ u ∈ V, Disjoint (closure ↑u) s
hVc : ∀ (n : ℕ), IsClosed (⋃ u ∈ V, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
x : X
hx : x ∈ t
v : ↑(countableBasis X)
hvV : v ∈ V
hxv : x ∈ ↑v
⊢ ¬∃ i, ∃ (_ : i ∈ U) (_ : Encodable.encode i ≤ Encodable.encode v), x ∈ closure ↑i

Next tactic:
rintro ⟨u, huU, -, hxu⟩
/-- A regular topological space with second countable topology is a normal space. -/
instance (priority := 100) NormalSpace.of_regularSpace_secondCountableTopology
    [RegularSpace X] [SecondCountableTopology X] : NormalSpace X := by
  have key : ∀ {s t : Set X}, IsClosed t → Disjoint s t →
    ∃ U : Set (countableBasis X), (s ⊆ ⋃ u ∈ U, ↑u) ∧ (∀ u ∈ U, Disjoint (closure ↑u) t) ∧
      ∀ n : ℕ, IsClosed (⋃ (u ∈ U) (_ : Encodable.encode u ≤ n), closure (u : Set X)) := by
    intro s t hc hd
    rw [disjoint_left] at hd
    have : ∀ x ∈ s, ∃ U ∈ countableBasis X, x ∈ U ∧ Disjoint (closure U) t := by
      intro x hx
      rcases (isBasis_countableBasis X).exists_closure_subset (hc.compl_mem_nhds (hd hx))
        with ⟨u, hu, hxu, hut⟩
      exact ⟨u, hu, hxu, disjoint_left.2 hut⟩
    choose! U hu hxu hd using this
    set V : s → countableBasis X := MapsTo.restrict _ _ _ hu
    refine' ⟨range V, _, forall_range_iff.2 <| Subtype.forall.2 hd, fun n => _⟩
    · rw [biUnion_range]
      exact fun x hx => mem_iUnion.2 ⟨⟨x, hx⟩, hxu x hx⟩
    · simp only [← iSup_eq_iUnion, iSup_and']
      exact (((finite_le_nat n).preimage_embedding (Encodable.encode' _)).subset <|
        inter_subset_right _ _).isClosed_biUnion fun u _ => isClosed_closure
  refine' { normal := fun s t hs ht hd => _ }
  rcases key ht hd with ⟨U, hsU, hUd, hUc⟩
  rcases key hs hd.symm with ⟨V, htV, hVd, hVc⟩
  refine ⟨⋃ u ∈ U, ↑u \ ⋃ (v ∈ V) (_ : Encodable.encode v ≤ Encodable.encode u), closure ↑v,
    ⋃ v ∈ V, ↑v \ ⋃ (u ∈ U) (_ : Encodable.encode u ≤ Encodable.encode v), closure ↑u,
    isOpen_biUnion fun u _ => (isOpen_of_mem_countableBasis u.2).sdiff (hVc _),
    isOpen_biUnion fun v _ => (isOpen_of_mem_countableBasis v.2).sdiff (hUc _),
    fun x hx => ?_, fun x hx => ?_, ?_⟩
  · rcases mem_iUnion₂.1 (hsU hx) with ⟨u, huU, hxu⟩
    refine' mem_biUnion huU ⟨hxu, _⟩
    simp only [mem_iUnion]
    rintro ⟨v, hvV, -, hxv⟩
    exact (hVd v hvV).le_bot ⟨hxv, hx⟩
  · rcases mem_iUnion₂.1 (htV hx) with ⟨v, hvV, hxv⟩
    refine' mem_biUnion hvV ⟨hxv, _⟩
    simp only [mem_iUnion]
    rintro ⟨u, huU, -, hxu⟩
    

Proof state:
case intro.intro.intro.intro.intro.intro.refine_2.intro.intro.intro.intro.intro
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : RegularSpace X
inst✝ : SecondCountableTopology X
key :
  ∀ {s t : Set X},
    IsClosed t →
      Disjoint s t →
        ∃ U,
          s ⊆ ⋃ u ∈ U, ↑u ∧
            (∀ u ∈ U, Disjoint (closure ↑u) t) ∧
              ∀ (n : ℕ), IsClosed (⋃ u ∈ U, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
s t : Set X
hs : IsClosed s
ht : IsClosed t
hd : Disjoint s t
U : Set ↑(countableBasis X)
hsU : s ⊆ ⋃ u ∈ U, ↑u
hUd : ∀ u ∈ U, Disjoint (closure ↑u) t
hUc : ∀ (n : ℕ), IsClosed (⋃ u ∈ U, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
V : Set ↑(countableBasis X)
htV : t ⊆ ⋃ u ∈ V, ↑u
hVd : ∀ u ∈ V, Disjoint (closure ↑u) s
hVc : ∀ (n : ℕ), IsClosed (⋃ u ∈ V, ⋃ (_ : Encodable.encode u ≤ n), closure ↑u)
x : X
hx : x ∈ t
v : ↑(countableBasis X)
hvV : v ∈ V
hxv : x ∈ ↑v
u : ↑(countableBasis X)
huU : u ∈ U
hxu : x ∈ closure ↑u
⊢ False

Next tactic:
exact (hUd u huU).le_bot ⟨hxu, hx⟩
instance (priority := 100) T4Space.t3Space [T4Space X] : T3Space X where
  regular hs hxs := by 

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T4Space X
s✝ : Set X
a✝ : X
hs : IsClosed s✝
hxs : a✝ ∉ s✝
⊢ Disjoint (𝓝ˢ s✝) (𝓝 a✝)

Next tactic:
simpa only [nhdsSet_singleton] using (normal_separation hs isClosed_singleton
    (disjoint_singleton_right.mpr hxs)).disjoint_nhdsSet
/-- The `SeparationQuotient` of a normal space is a normal space. -/
instance [NormalSpace X] : NormalSpace (SeparationQuotient X) where
  normal s t hs ht hd := separatedNhds_iff_disjoint.2 <| by
    

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
s t : Set (SeparationQuotient X)
hs : IsClosed s
ht : IsClosed t
hd : Disjoint s t
⊢ Disjoint (𝓝ˢ s) (𝓝ˢ t)

Next tactic:
rw [← disjoint_comap_iff surjective_mk, comap_mk_nhdsSet, comap_mk_nhdsSet]
/-- The `SeparationQuotient` of a normal space is a normal space. -/
instance [NormalSpace X] : NormalSpace (SeparationQuotient X) where
  normal s t hs ht hd := separatedNhds_iff_disjoint.2 <| by
    rw [← disjoint_comap_iff surjective_mk, comap_mk_nhdsSet, comap_mk_nhdsSet]
    

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
s t : Set (SeparationQuotient X)
hs : IsClosed s
ht : IsClosed t
hd : Disjoint s t
⊢ Disjoint (𝓝ˢ (mk ⁻¹' s)) (𝓝ˢ (mk ⁻¹' t))

Next tactic:
exact disjoint_nhdsSet_nhdsSet (hs.preimage continuous_mk) (ht.preimage continuous_mk)
      (hd.preimage mk)
theorem Embedding.t5Space [TopologicalSpace Y] [T5Space Y] {e : X → Y} (he : Embedding e) :
    T5Space X := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : T5Space Y
e : X → Y
he : _root_.Embedding e
⊢ T5Space X

Next tactic:
haveI := he.t1Space
theorem Embedding.t5Space [TopologicalSpace Y] [T5Space Y] {e : X → Y} (he : Embedding e) :
    T5Space X := by
  haveI := he.t1Space
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : T5Space Y
e : X → Y
he : _root_.Embedding e
this : T1Space X
⊢ T5Space X

Next tactic:
refine' ⟨fun s t hd₁ hd₂ => _⟩
theorem Embedding.t5Space [TopologicalSpace Y] [T5Space Y] {e : X → Y} (he : Embedding e) :
    T5Space X := by
  haveI := he.t1Space
  refine' ⟨fun s t hd₁ hd₂ => _⟩
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : T5Space Y
e : X → Y
he : _root_.Embedding e
this : T1Space X
s t : Set X
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (𝓝ˢ s) (𝓝ˢ t)

Next tactic:
simp only [he.toInducing.nhdsSet_eq_comap]
theorem Embedding.t5Space [TopologicalSpace Y] [T5Space Y] {e : X → Y} (he : Embedding e) :
    T5Space X := by
  haveI := he.t1Space
  refine' ⟨fun s t hd₁ hd₂ => _⟩
  simp only [he.toInducing.nhdsSet_eq_comap]
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : T5Space Y
e : X → Y
he : _root_.Embedding e
this : T1Space X
s t : Set X
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (comap e (𝓝ˢ (e '' s))) (comap e (𝓝ˢ (e '' t)))

Next tactic:
refine disjoint_comap (completely_normal ?_ ?_)
theorem Embedding.t5Space [TopologicalSpace Y] [T5Space Y] {e : X → Y} (he : Embedding e) :
    T5Space X := by
  haveI := he.t1Space
  refine' ⟨fun s t hd₁ hd₂ => _⟩
  simp only [he.toInducing.nhdsSet_eq_comap]
  refine disjoint_comap (completely_normal ?_ ?_)
  · 

Proof state:
case refine_1
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : T5Space Y
e : X → Y
he : _root_.Embedding e
this : T1Space X
s t : Set X
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (closure (e '' s)) (e '' t)

Next tactic:
rwa [← subset_compl_iff_disjoint_left, image_subset_iff, preimage_compl,
      ← he.closure_eq_preimage_closure_image, subset_compl_iff_disjoint_left]
theorem Embedding.t5Space [TopologicalSpace Y] [T5Space Y] {e : X → Y} (he : Embedding e) :
    T5Space X := by
  haveI := he.t1Space
  refine' ⟨fun s t hd₁ hd₂ => _⟩
  simp only [he.toInducing.nhdsSet_eq_comap]
  refine disjoint_comap (completely_normal ?_ ?_)
  · rwa [← subset_compl_iff_disjoint_left, image_subset_iff, preimage_compl,
      ← he.closure_eq_preimage_closure_image, subset_compl_iff_disjoint_left]
  · 

Proof state:
case refine_2
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
inst✝ : T5Space Y
e : X → Y
he : _root_.Embedding e
this : T1Space X
s t : Set X
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (e '' s) (closure (e '' t))

Next tactic:
rwa [← subset_compl_iff_disjoint_right, image_subset_iff, preimage_compl,
      ← he.closure_eq_preimage_closure_image, subset_compl_iff_disjoint_right]
/-- A `T₅` space is a `T₄` space. -/
instance (priority := 100) T5Space.toT4Space [T5Space X] : T4Space X where
  normal s t hs ht hd := separatedNhds_iff_disjoint.2 <|
    completely_normal (by 

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T5Space X
s t : Set X
hs : IsClosed s
ht : IsClosed t
hd : Disjoint s t
⊢ Disjoint (closure s) t

Next tactic:
rwa [hs.closure_eq]
/-- A `T₅` space is a `T₄` space. -/
instance (priority := 100) T5Space.toT4Space [T5Space X] : T4Space X where
  normal s t hs ht hd := separatedNhds_iff_disjoint.2 <|
    completely_normal (by rwa [hs.closure_eq]) (by 

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T5Space X
s t : Set X
hs : IsClosed s
ht : IsClosed t
hd : Disjoint s t
⊢ Disjoint s (closure t)

Next tactic:
rwa [ht.closure_eq]
/-- The `SeparationQuotient` of a completely normal R₀ space is a T₅ space.
We don't have typeclasses for completely normal spaces (without T₁ assumption) and R₀ spaces,
so we use `T5Space` for assumption and for conclusion.

One can prove this using a homeomorphism between `X` and `SeparationQuotient X`.
We give an alternative proof of the `completely_normal` axiom
that works without assuming that `X` is a T₁ space. -/
instance [T5Space X] : T5Space (SeparationQuotient X) where
  completely_normal s t hd₁ hd₂ := by
    

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T5Space X
s t : Set (SeparationQuotient X)
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (𝓝ˢ s) (𝓝ˢ t)

Next tactic:
rw [← disjoint_comap_iff surjective_mk, comap_mk_nhdsSet, comap_mk_nhdsSet]
/-- The `SeparationQuotient` of a completely normal R₀ space is a T₅ space.
We don't have typeclasses for completely normal spaces (without T₁ assumption) and R₀ spaces,
so we use `T5Space` for assumption and for conclusion.

One can prove this using a homeomorphism between `X` and `SeparationQuotient X`.
We give an alternative proof of the `completely_normal` axiom
that works without assuming that `X` is a T₁ space. -/
instance [T5Space X] : T5Space (SeparationQuotient X) where
  completely_normal s t hd₁ hd₂ := by
    rw [← disjoint_comap_iff surjective_mk, comap_mk_nhdsSet, comap_mk_nhdsSet]
    

Proof state:
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T5Space X
s t : Set (SeparationQuotient X)
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (𝓝ˢ (SeparationQuotient.mk ⁻¹' s)) (𝓝ˢ (SeparationQuotient.mk ⁻¹' t))

Next tactic:
apply T5Space.completely_normal
/-- The `SeparationQuotient` of a completely normal R₀ space is a T₅ space.
We don't have typeclasses for completely normal spaces (without T₁ assumption) and R₀ spaces,
so we use `T5Space` for assumption and for conclusion.

One can prove this using a homeomorphism between `X` and `SeparationQuotient X`.
We give an alternative proof of the `completely_normal` axiom
that works without assuming that `X` is a T₁ space. -/
instance [T5Space X] : T5Space (SeparationQuotient X) where
  completely_normal s t hd₁ hd₂ := by
    rw [← disjoint_comap_iff surjective_mk, comap_mk_nhdsSet, comap_mk_nhdsSet]
    apply T5Space.completely_normal <;> 

Proof state:
case a
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T5Space X
s t : Set (SeparationQuotient X)
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (closure (SeparationQuotient.mk ⁻¹' s)) (SeparationQuotient.mk ⁻¹' t)

Next tactic:
rw [← preimage_mk_closure]
/-- The `SeparationQuotient` of a completely normal R₀ space is a T₅ space.
We don't have typeclasses for completely normal spaces (without T₁ assumption) and R₀ spaces,
so we use `T5Space` for assumption and for conclusion.

One can prove this using a homeomorphism between `X` and `SeparationQuotient X`.
We give an alternative proof of the `completely_normal` axiom
that works without assuming that `X` is a T₁ space. -/
instance [T5Space X] : T5Space (SeparationQuotient X) where
  completely_normal s t hd₁ hd₂ := by
    rw [← disjoint_comap_iff surjective_mk, comap_mk_nhdsSet, comap_mk_nhdsSet]
    apply T5Space.completely_normal <;> 

Proof state:
case a
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T5Space X
s t : Set (SeparationQuotient X)
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (SeparationQuotient.mk ⁻¹' s) (closure (SeparationQuotient.mk ⁻¹' t))

Next tactic:
rw [← preimage_mk_closure]
/-- The `SeparationQuotient` of a completely normal R₀ space is a T₅ space.
We don't have typeclasses for completely normal spaces (without T₁ assumption) and R₀ spaces,
so we use `T5Space` for assumption and for conclusion.

One can prove this using a homeomorphism between `X` and `SeparationQuotient X`.
We give an alternative proof of the `completely_normal` axiom
that works without assuming that `X` is a T₁ space. -/
instance [T5Space X] : T5Space (SeparationQuotient X) where
  completely_normal s t hd₁ hd₂ := by
    rw [← disjoint_comap_iff surjective_mk, comap_mk_nhdsSet, comap_mk_nhdsSet]
    apply T5Space.completely_normal <;> rw [← preimage_mk_closure]
    

Proof state:
case a
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T5Space X
s t : Set (SeparationQuotient X)
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (SeparationQuotient.mk ⁻¹' closure s) (SeparationQuotient.mk ⁻¹' t)
case a
X : Type u_1
Y : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : T5Space X
s t : Set (SeparationQuotient X)
hd₁ : Disjoint (closure s) t
hd₂ : Disjoint s (closure t)
⊢ Disjoint (SeparationQuotient.mk ⁻¹' s) (SeparationQuotient.mk ⁻¹' closure t)

Next tactic:
exacts [hd₁.preimage mk, hd₂.preimage mk]
/-- In a compact T₂ space, the connected component of a point equals the intersection of all
its clopen neighbourhoods. -/
theorem connectedComponent_eq_iInter_isClopen [T2Space X] [CompactSpace X] (x : X) :
    connectedComponent x = ⋂ s : { s : Set X // IsClopen s ∧ x ∈ s }, s := by
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : T2Space X
inst✝ : CompactSpace X
x : X
⊢ connectedComponent x = ⋂ s, ↑s

Next tactic:
apply Subset.antisymm connectedComponent_subset_iInter_isClopen
/-- In a compact T₂ space, the connected component of a point equals the intersection of all
its clopen neighbourhoods. -/
theorem connectedComponent_eq_iInter_isClopen [T2Space X] [CompactSpace X] (x : X) :
    connectedComponent x = ⋂ s : { s : Set X // IsClopen s ∧ x ∈ s }, s := by
  apply Subset.antisymm connectedComponent_subset_iInter_isClopen
  -- Reduce to showing that the clopen intersection is connected.
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : T2Space X
inst✝ : CompactSpace X
x : X
⊢ ⋂ Z, ↑Z ⊆ connectedComponent x

Next tactic:
refine' IsPreconnected.subset_connectedComponent _ (mem_iInter.2 fun s => s.2.2)
/-- In a compact T₂ space, the connected component of a point equals the intersection of all
its clopen neighbourhoods. -/
theorem connectedComponent_eq_iInter_isClopen [T2Space X] [CompactSpace X] (x : X) :
    connectedComponent x = ⋂ s : { s : Set X // IsClopen s ∧ x ∈ s }, s := by
  apply Subset.antisymm connectedComponent_subset_iInter_isClopen
  -- Reduce to showing that the clopen intersection is connected.
  refine' IsPreconnected.subset_connectedComponent _ (mem_iInter.2 fun s => s.2.2)
  -- We do this by showing that any disjoint cover by two closed sets implies
  -- that one of these closed sets must contain our whole thing.
  -- To reduce to the case where the cover is disjoint on all of `X` we need that `s` is closed
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : T2Space X
inst✝ : CompactSpace X
x : X
⊢ IsPreconnected (⋂ Z, ↑Z)

Next tactic:
have hs : @IsClosed X _ (⋂ s : { s : Set X // IsClopen s ∧ x ∈ s }, s) :=
    isClosed_iInter fun s => s.2.1.2
/-- In a compact T₂ space, the connected component of a point equals the intersection of all
its clopen neighbourhoods. -/
theorem connectedComponent_eq_iInter_isClopen [T2Space X] [CompactSpace X] (x : X) :
    connectedComponent x = ⋂ s : { s : Set X // IsClopen s ∧ x ∈ s }, s := by
  apply Subset.antisymm connectedComponent_subset_iInter_isClopen
  -- Reduce to showing that the clopen intersection is connected.
  refine' IsPreconnected.subset_connectedComponent _ (mem_iInter.2 fun s => s.2.2)
  -- We do this by showing that any disjoint cover by two closed sets implies
  -- that one of these closed sets must contain our whole thing.
  -- To reduce to the case where the cover is disjoint on all of `X` we need that `s` is closed
  have hs : @IsClosed X _ (⋂ s : { s : Set X // IsClopen s ∧ x ∈ s }, s) :=
    isClosed_iInter fun s => s.2.1.2
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : T2Space X
inst✝ : CompactSpace X
x : X
hs : IsClosed (⋂ s, ↑s)
⊢ IsPreconnected (⋂ Z, ↑Z)

Next tactic:
rw [isPreconnected_iff_subset_of_fully_disjoint_closed hs]
/-- In a compact T₂ space, the connected component of a point equals the intersection of all
its clopen neighbourhoods. -/
theorem connectedComponent_eq_iInter_isClopen [T2Space X] [CompactSpace X] (x : X) :
    connectedComponent x = ⋂ s : { s : Set X // IsClopen s ∧ x ∈ s }, s := by
  apply Subset.antisymm connectedComponent_subset_iInter_isClopen
  -- Reduce to showing that the clopen intersection is connected.
  refine' IsPreconnected.subset_connectedComponent _ (mem_iInter.2 fun s => s.2.2)
  -- We do this by showing that any disjoint cover by two closed sets implies
  -- that one of these closed sets must contain our whole thing.
  -- To reduce to the case where the cover is disjoint on all of `X` we need that `s` is closed
  have hs : @IsClosed X _ (⋂ s : { s : Set X // IsClopen s ∧ x ∈ s }, s) :=
    isClosed_iInter fun s => s.2.1.2
  rw [isPreconnected_iff_subset_of_fully_disjoint_closed hs]
  

Proof state:
X : Type u_1
Y : Type u_2
inst✝² : TopologicalSpace X
inst✝¹ : T2Space X
inst✝ : CompactSpace X
x : X
hs : IsClosed (⋂ s, ↑s)
⊢ ∀ (u v : Set X), IsClosed u → IsClosed v → ⋂ s, ↑s ⊆ u ∪ v → Disjoint u v → ⋂ s, ↑s ⊆ u ∨ ⋂ s, ↑s ⊆ v

Next tactic:
intro a b ha hb hab ab_disj