Lean library · module TopologyByExample.Spaces.CompactComplement

The compact complement topology

Source file

The compact complement topology on ℝ has as open sets ∅ and the complements of the sets that are compact in the Euclidean topology. Its closed sets are ℝ and the Euclidean compact sets. It is coarser than the Euclidean topology.

A filter on which the real coordinate tends to infinity (leaves every Euclidean compact set) converges to every point. This makes every nonempty open set U path connected: a point x ∈ U is joined to a large real number N by the path that is x at time 0 and N - 1 + 1 / t at times t > 0; all these numbers lie outside the bounded complement of U.

Main definitions

Main statements

Tags

compact complement topology, hyperconnected, T₁, counterexample

This file was written by Claude (Anthropic's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.

Imports

definition CompactComplement

TopologyByExample.CompactComplement

The real line with the compact complement topology, whose open sets are ∅ and the complements of the Euclidean compact sets.

def CompactComplement : Type
:= ℝ

On this site: Space: Compact complement topology

definition toReal

TopologyByExample.CompactComplement.toReal

The identity map from the compact complement topology to ℝ.

def toReal : CompactComplement ≃ ℝ
:= Equiv.refl ℝ

definition ofReal

TopologyByExample.CompactComplement.ofReal

The point of the compact complement topology with real coordinate r.

def ofReal (r : ℝ) : CompactComplement
:= toReal.symm r

theorem toReal_ofReal

TopologyByExample.CompactComplement.toReal_ofReal

The real coordinate of ofReal r is r.

@[simp] theorem toReal_ofReal (r : ℝ) : toReal (ofReal r) = r
Proof
:= rfl

theorem ofReal_toReal

TopologyByExample.CompactComplement.ofReal_toReal

The point with the real coordinate of x is x.

@[simp] theorem ofReal_toReal (x : CompactComplement) : ofReal (toReal x) = x
Proof
:= rfl

theorem ofReal_surjective

TopologyByExample.CompactComplement.ofReal_surjective

Every point has a real coordinate.

theorem ofReal_surjective : Function.Surjective ofReal
Proof
:= fun x ↦ ⟨toReal x, rfl⟩

instance

The compact complement topology is nonempty.

instance : Nonempty CompactComplement
Proof
:= ⟨ofReal 0⟩

instance

The compact complement topology: a set is open if it is empty or its complement is compact in the Euclidean topology.

instance : TopologicalSpace CompactComplement
Proof
where
  IsOpen s := s = ∅ ∨ IsCompact (ofReal ⁻¹' sᶜ)
  isOpen_univ := Or.inr (by simp)
  isOpen_inter s t hs ht := by
    rcases hs with rfl | hs
    · exact Or.inl (empty_inter t)
    rcases ht with rfl | ht
    · exact Or.inl (inter_empty s)
    refine Or.inr ?_
    rw [compl_inter, preimage_union]
    exact hs.union ht
  isOpen_sUnion S hS := by
    by_cases h : ∀ s ∈ S, s = ∅
    · exact Or.inl (sUnion_eq_empty.2 h)
    obtain ⟨s, hsS, hs⟩ := not_forall₂.1 h
    refine Or.inr ?_
    have hsc : IsCompact (ofReal ⁻¹' sᶜ) := (hS s hsS).resolve_left hs
    refine hsc.of_isClosed_subset ?_
      (preimage_mono (compl_subset_compl.2 (subset_sUnion_of_mem hsS)))
    rw [preimage_compl, isClosed_compl_iff, preimage_sUnion]
    refine isOpen_biUnion fun t ht ↦ ?_
    rcases hS t ht with rfl | htc
    · simp
    · have := htc.isClosed.isOpen_compl
      rwa [← preimage_compl, compl_compl] at this

theorem isOpen_iff

TopologyByExample.CompactComplement.isOpen_iff

A set is open in the compact complement topology if and only if it is empty or its complement is compact in the Euclidean topology.

theorem isOpen_iff {s : Set CompactComplement} : IsOpen s ↔ s = ∅ ∨ IsCompact (ofReal ⁻¹' sᶜ)
Proof
:=
  Iff.rfl

theorem isClosed_iff

TopologyByExample.CompactComplement.isClosed_iff

A set is closed in the compact complement topology if and only if it is the whole space or it is compact in the Euclidean topology.

theorem isClosed_iff {s : Set CompactComplement} :
    IsClosed s ↔ s = univ ∨ IsCompact (ofReal ⁻¹' s)
Proof
:= by
  rw [← isOpen_compl_iff, isOpen_iff, compl_compl, compl_empty_iff]

On this site: Compact complement topology: The closed sets

theorem continuous_ofReal

TopologyByExample.CompactComplement.continuous_ofReal

The compact complement topology is coarser than the Euclidean topology.

theorem continuous_ofReal : Continuous ofReal
Proof
:= by
  refine continuous_def.2 fun s hs ↦ ?_
  rcases isOpen_iff.1 hs with rfl | hs
  · simp
  · have := hs.isClosed.isOpen_compl
    rwa [← preimage_compl, compl_compl] at this

theorem isCompact_compl_of_isOpen

TopologyByExample.CompactComplement.isCompact_compl_of_isOpen

The complement of a nonempty open set is compact in the Euclidean topology.

theorem isCompact_compl_of_isOpen {s : Set CompactComplement} (hs : IsOpen s) (hne : s.Nonempty) :
    IsCompact (ofReal ⁻¹' sᶜ)
Proof
:=
  (isOpen_iff.1 hs).resolve_left hne.ne_empty

instance instT1Space

TopologyByExample.CompactComplement.instT1Space

The compact complement topology is T₁: a point is compact in the Euclidean topology.

instance instT1Space : T1Space CompactComplement
Proof
:=
  ⟨fun x ↦ isClosed_iff.2 (Or.inr (show IsCompact ({toReal x} : Set ℝ) from isCompact_singleton))⟩

On this site: The compact complement topology is T₁

instance instCompactSpace

TopologyByExample.CompactComplement.instCompactSpace

The compact complement topology is compact: the member of an open cover containing 0 misses only a Euclidean compact set, which is compact in the coarser topology too, so finitely many members cover it.

instance instCompactSpace : CompactSpace CompactComplement
Proof
:= by
  classical
  refine ⟨isCompact_of_finite_subcover fun U hU hcover ↦ ?_⟩
  obtain ⟨i, hi⟩ := mem_iUnion.1 (hcover (mem_univ (ofReal 0)))
  have hK : IsCompact (U i)ᶜ := by
    have := (isCompact_compl_of_isOpen (hU i) ⟨_, hi⟩).image continuous_ofReal
    rwa [image_preimage_eq _ ofReal_surjective] at this
  obtain ⟨t, ht⟩ := hK.elim_finite_subcover U hU fun x _ ↦ hcover (mem_univ x)
  refine ⟨insert i t, fun x _ ↦ ?_⟩
  by_cases hx : x ∈ U i
  · exact mem_iUnion₂.2 ⟨i, Finset.mem_insert_self i t, hx⟩
  · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.1 (ht hx)
    exact mem_iUnion₂.2 ⟨j, Finset.mem_insert_of_mem hj, hxj⟩

On this site: The compact complement topology is compact

instance instPreirreducibleSpace

TopologyByExample.CompactComplement.instPreirreducibleSpace

The compact complement topology is hyperconnected: the complements of two nonempty open sets are Euclidean compact, so their union is not all of ℝ.

instance instPreirreducibleSpace : PreirreducibleSpace CompactComplement
Proof
:=
  ⟨fun u v hu hv ⟨x, _, hxu⟩ ⟨y, _, hyv⟩ ↦ by
    have hK := (isCompact_compl_of_isOpen hu ⟨x, hxu⟩).union
      (isCompact_compl_of_isOpen hv ⟨y, hyv⟩)
    obtain ⟨r, hr⟩ := (ne_univ_iff_exists_notMem _).1 hK.ne_univ
    simp only [mem_union, mem_preimage, mem_compl_iff, not_or, not_not] at hr
    exact ⟨ofReal r, trivial, hr.1, hr.2⟩⟩

On this site: The compact complement topology is hyperconnected

definition basicSet

TopologyByExample.CompactComplement.basicSet

The basic open set ℝ \ ([-n, p] ∪ [q, n]).

def basicSet (p q : ℚ) (n : ℕ) : Set CompactComplement
:=
  {x | toReal x ∉ Icc (-n : ℝ) p ∪ Icc (q : ℝ) n}

theorem isOpen_basicSet

TopologyByExample.CompactComplement.isOpen_basicSet

The basic sets are open: their complements are compact intervals.

theorem isOpen_basicSet (p q : ℚ) (n : ℕ) : IsOpen (basicSet p q n)
Proof
:= by
  refine isOpen_iff.2 (Or.inr ?_)
  have : ofReal ⁻¹' (basicSet p q n)ᶜ = Icc (-n : ℝ) p ∪ Icc (q : ℝ) n := by
    ext r
    simp only [basicSet, mem_preimage, mem_compl_iff, mem_ofPred_eq, not_not, toReal_ofReal]
  rw [this]
  exact isCompact_Icc.union isCompact_Icc

theorem isTopologicalBasis_basicSet

TopologyByExample.CompactComplement.isTopologicalBasis_basicSet

The sets ℝ \ ([-n, p] ∪ [q, n]), with p and q rational, form a base of the compact complement topology.

theorem isTopologicalBasis_basicSet :
    IsTopologicalBasis (range fun a : ℚ × ℚ × ℕ ↦ basicSet a.1 a.2.1 a.2.2)
Proof
:= by
  refine isTopologicalBasis_of_isOpen_of_nhds ?_ fun x u hxu hu ↦ ?_
  · rintro _ ⟨a, rfl⟩
    exact isOpen_basicSet _ _ _
  set K := ofReal ⁻¹' uᶜ with hKdef
  have hK : IsCompact K := isCompact_compl_of_isOpen hu ⟨x, hxu⟩
  have hxK : toReal x ∈ Kᶜ := by simpa [hKdef] using hxu
  obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.1 hK.isClosed.isOpen_compl (toReal x) hxK
  obtain ⟨lo, hlo⟩ := hK.bddBelow
  obtain ⟨hi, hhi⟩ := hK.bddAbove
  obtain ⟨n, hn⟩ := exists_nat_ge (max (-lo) hi)
  obtain ⟨p, hp₁, hp₂⟩ := exists_rat_btwn (show toReal x - ε < toReal x by linarith)
  obtain ⟨q, hq₁, hq₂⟩ := exists_rat_btwn (show toReal x < toReal x + ε by linarith)
  refine ⟨basicSet p q n, ⟨(p, q, n), rfl⟩, ?_, fun y hy ↦ ?_⟩
  · simp only [basicSet, mem_ofPred_eq, mem_union, mem_Icc, not_or, not_and, not_le]
    exact ⟨fun _ ↦ hp₂, fun h ↦ absurd h (not_le.2 hq₁)⟩
  · by_contra hyu
    have hyK : toReal y ∈ K := by simpa [hKdef] using hyu
    have hyb : toReal y ∉ Metric.ball (toReal x) ε := fun h ↦ hball h hyK
    rw [Metric.mem_ball, Real.dist_eq, not_lt] at hyb
    have h₁ := hlo hyK
    have h₂ := hhi hyK
    have hn₁ : -lo ≤ n := (le_max_left _ _).trans hn
    have hn₂ : hi ≤ n := (le_max_right _ _).trans hn
    apply hy
    rcases le_or_gt (toReal y) (toReal x) with h | h
    · rw [abs_of_nonpos (by linarith)] at hyb
      exact Or.inl ⟨by linarith, by linarith⟩
    · rw [abs_of_pos (by linarith)] at hyb
      exact Or.inr ⟨by linarith, by linarith⟩

instance instSecondCountableTopology

TopologyByExample.CompactComplement.instSecondCountableTopology

The compact complement topology is second countable.

instance instSecondCountableTopology : SecondCountableTopology CompactComplement
Proof
:=
  isTopologicalBasis_basicSet.secondCountableTopology (countable_range _)

On this site: The compact complement topology is second countable

theorem tendsto_nhds_of_tendsto_cocompact

TopologyByExample.CompactComplement.tendsto_nhds_of_tendsto_cocompact

In the compact complement topology, a filter along which the real coordinate leaves every Euclidean compact set converges to every point.

theorem tendsto_nhds_of_tendsto_cocompact {α : Type*} {l : Filter α} {f : α → CompactComplement}
    (h : Tendsto (fun a ↦ toReal (f a)) l (cocompact ℝ)) (x : CompactComplement) :
    Tendsto f l (𝓝 x)
Proof
:= by
  refine tendsto_nhds.2 fun s hs hxs ↦ ?_
  filter_upwards [h (isCompact_compl_of_isOpen hs ⟨x, hxs⟩).compl_mem_cocompact] with a ha
  simpa using ha

theorem tendsto_atTop_nhds_of_tendsto_cocompact

TopologyByExample.CompactComplement.tendsto_atTop_nhds_of_tendsto_cocompact

In the compact complement topology, a sequence that eventually leaves every Euclidean compact set converges to every point.

theorem tendsto_atTop_nhds_of_tendsto_cocompact {u : ℕ → CompactComplement}
    (h : Tendsto (fun n ↦ toReal (u n)) atTop (cocompact ℝ)) (x : CompactComplement) :
    Tendsto u atTop (𝓝 x)
Proof
:=
  tendsto_nhds_of_tendsto_cocompact h x

On this site: Compact complement topology: Sequences that go off to infinity converge to every point

theorem joinedIn_of_forall_ge

TopologyByExample.CompactComplement.joinedIn_of_forall_ge

In the compact complement topology, a point x of a set U containing every real number r ≥ N is joined to N by a path in U: the path is x at time 0 and N - 1 + 1 / t at times t > 0.

theorem joinedIn_of_forall_ge {U : Set CompactComplement} {x : CompactComplement} (hx : x ∈ U)
    {N : ℝ} (hN : ∀ r, N ≤ r → ofReal r ∈ U) : JoinedIn U x (ofReal N)
Proof
:= by
  let g : ℝ → CompactComplement := fun s ↦ if s ≤ 0 then x else ofReal (N - 1 + s⁻¹)
  have hg : Continuous g := by
    refine continuous_iff_continuousAt.2 fun s ↦ ?_
    rcases lt_trichotomy s 0 with hs | rfl | hs
    · have : g =ᶠ[𝓝 s] fun _ ↦ x := by
        filter_upwards [Iio_mem_nhds hs] with r hr
        simp [g, (mem_Iio.1 hr).le]
      exact continuousAt_const.congr this.symm
    · change Tendsto g (𝓝 0) (𝓝 (g 0))
      rw [← nhdsLE_sup_nhdsGT, tendsto_sup]
      have hg0 : g 0 = x := by simp [g]
      rw [hg0]
      constructor
      · have : g =ᶠ[𝓝[≤] 0] fun _ ↦ x := by
          filter_upwards [self_mem_nhdsWithin] with r hr
          simp [g, mem_Iic.1 hr]
        exact tendsto_const_nhds.congr' this.symm
      · refine tendsto_nhds_of_tendsto_cocompact ?_ x
        refine Tendsto.mono_right ?_ atTop_le_cocompact
        refine (tendsto_atTop_add_const_left _ (N - 1) tendsto_inv_nhdsGT_zero).congr' ?_
        filter_upwards [self_mem_nhdsWithin] with r hr
        simp [g, not_le.2 (mem_Ioi.1 hr)]
    · have : (fun r ↦ ofReal (N - 1 + r⁻¹)) =ᶠ[𝓝 s] g := by
        filter_upwards [Ioi_mem_nhds hs] with r hr
        simp [g, not_le.2 (mem_Ioi.1 hr)]
      refine ContinuousAt.congr ?_ this
      exact continuous_ofReal.continuousAt.comp
        (continuousAt_const.add (continuousAt_inv₀ hs.ne'))
  refine ⟨⟨⟨fun t ↦ g t, hg.comp continuous_subtypeVal⟩, by simp [g], by simp [g]⟩,
    fun t ↦ ?_⟩
  change g t ∈ U
  by_cases ht : (t : ℝ) ≤ 0
  · simpa [g, ht] using hx
  · have hgt : g t = ofReal (N - 1 + (t : ℝ)⁻¹) := by simp [g, ht]
    rw [hgt]
    refine hN _ ?_
    have : 1 ≤ (t : ℝ)⁻¹ := (one_le_inv₀ (lt_of_not_ge ht)).2 t.property.2
    linarith

theorem isPathConnected_of_isOpen

TopologyByExample.CompactComplement.isPathConnected_of_isOpen

In the compact complement topology every nonempty open set is path connected: its points are all joined to a large real number.

theorem isPathConnected_of_isOpen {U : Set CompactComplement} (hU : IsOpen U) (hne : U.Nonempty) :
    IsPathConnected U
Proof
:= by
  obtain ⟨b, hb⟩ := (isCompact_compl_of_isOpen hU hne).bddAbove
  have hN (r : ℝ) (hr : b + 1 ≤ r) : ofReal r ∈ U := by
    by_contra h
    have := hb (show r ∈ ofReal ⁻¹' Uᶜ from h)
    linarith
  exact ⟨ofReal (b + 1), hN _ le_rfl, fun {_} hy ↦ (joinedIn_of_forall_ge hy hN).symm⟩

On this site: Compact complement topology: Every nonempty open set is path connected

instance instLocallyPathConnectedSpace

TopologyByExample.CompactComplement.instLocallyPathConnectedSpace

The compact complement topology is locally path connected: its open sets are path connected.

instance instLocallyPathConnectedSpace : LocallyPathConnectedSpace CompactComplement
Proof
:=
  .of_bases (fun x ↦ nhds_basis_opens x) fun _ _ h ↦ isPathConnected_of_isOpen h.2 ⟨_, h.1⟩

theorem not_ultraconnectedSpace

TopologyByExample.CompactComplement.not_ultraconnectedSpace

The compact complement topology is not ultraconnected: the closures of the points 0 and 1 are the singletons themselves.

theorem not_ultraconnectedSpace : ¬UltraconnectedSpace CompactComplement
Proof
:= fun h ↦ by
  obtain ⟨z, hz₀, hz₁⟩ := h.closure_inter_closure_nonempty (ofReal 0) (ofReal 1)
  rw [closure_singleton, mem_singleton_iff] at hz₀ hz₁
  have := congrArg toReal (hz₀.symm.trans hz₁)
  simp at this

On this site: The compact complement topology is not ultraconnected

theorem isMeagre_univ

TopologyByExample.CompactComplement.isMeagre_univ

The compact complement topology is meagre in itself: it is the union of the closed sets [-n, n], which have empty interior since a nonempty open set contains all large numbers.

theorem isMeagre_univ : IsMeagre (univ : Set CompactComplement)
Proof
:= by
  have hcover : (univ : Set CompactComplement) ⊆ ⋃ n : ℕ, toReal ⁻¹' Icc (-n : ℝ) n := by
    intro x _
    obtain ⟨n, hn⟩ := exists_nat_ge |toReal x|
    exact mem_iUnion.2 ⟨n, abs_le.1 hn⟩
  refine (isMeagre_iUnion fun n ↦ ?_).mono hcover
  refine IsNowhereDense.isMeagre ?_
  have hC : IsClosed (toReal ⁻¹' Icc (-n : ℝ) n) :=
    isClosed_iff.2 (Or.inr (show IsCompact (Icc (-n : ℝ) n) from isCompact_Icc))
  rw [hC.isNowhereDense_iff]
  refine eq_empty_of_forall_notMem fun x hx ↦ ?_
  obtain ⟨b, hb⟩ := (isCompact_compl_of_isOpen isOpen_interior ⟨x, hx⟩).bddAbove
  have hr : ofReal (max b n + 1) ∉ interior (toReal ⁻¹' Icc (-n : ℝ) n) := fun h ↦ by
    have := (interior_subset h).2
    simp only [toReal_ofReal] at this
    linarith [le_max_right b (n : ℝ)]
  have := hb (show max b n + 1 ∈ ofReal ⁻¹' (interior (toReal ⁻¹' Icc (-n : ℝ) n))ᶜ from hr)
  linarith [le_max_left b (n : ℝ)]

theorem not_not_isMeagre_univ

TopologyByExample.CompactComplement.not_not_isMeagre_univ

The compact complement topology is not of second category.

theorem not_not_isMeagre_univ : ¬¬IsMeagre (univ : Set CompactComplement)
Proof
:=
  fun h ↦ h isMeagre_univ

On this site: The compact complement topology is not of second category