Lean library · module TopologyByExample.Theorems.CofiniteTopology

The cofinite topology

Source file

Mathlib's CofiniteTopology X is the type X with the cofinite topology: a set is open if it is empty or its complement is finite. Its closed sets are the finite sets and the whole space. Mathlib provides that it is T₁ and compact (indeed Noetherian). This file adds:

  • A map into it is continuous as soon as each of its fibres is closed; so every injective map from a T₁ space, such as [0, 1], is continuous.
  • If X has at least the cardinality of the continuum, then any two points of a set with finite complement are joined by a path inside the set: a path is any injection of [0, 1] into the set with the right endpoints. So the space is path connected and locally path connected (each open neighbourhood of a point is path connected).
  • A sequence each of whose values is taken only finitely often converges to every point. A sequence either takes some value infinitely often, and then has a constant subsequence, or is of that kind; so the space is sequentially compact.
  • Every infinite subset is dense, so the space is separable (if X is finite, the space is countable). If X is finite the space is discrete. If X is infinite, any two nonempty open sets meet, so the space is not Hausdorff, and it is connected and locally connected (a discrete space is locally connected too). If X is uncountable, the space is not first countable: the complements of countably many neighbourhoods of a point are countably many finite sets, which cannot cover the other points.

Main statements

Tags

cofinite topology, finite complement topology, path connected, T₁, not Hausdorff

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
variable {X : Type*}

theorem continuous_of_isClosed_preimage_singleton

TopologyByExample.CofiniteTopology.continuous_of_isClosed_preimage_singleton

A map into a cofinite topology is continuous if the preimage of every point is closed.

theorem continuous_of_isClosed_preimage_singleton {Y : Type*} [TopologicalSpace Y]
    {f : Y → _root_.CofiniteTopology X} (hf : ∀ x, IsClosed (f ⁻¹' {x})) : Continuous f
Proof
:= by
  refine continuous_iff_isClosed.2 fun s hs ↦ ?_
  rcases _root_.CofiniteTopology.isClosed_iff.1 hs with rfl | hfin
  · simp
  · have : f ⁻¹' s = ⋃ x ∈ s, f ⁻¹' {x} := by ext; simp
    rw [this]
    exact hfin.isClosed_biUnion fun x _ ↦ hf x

theorem continuous_of_injective

TopologyByExample.CofiniteTopology.continuous_of_injective

Every injective map from a T₁ space into a cofinite topology is continuous.

theorem continuous_of_injective {Y : Type*} [TopologicalSpace Y] [T1Space Y]
    {f : Y → _root_.CofiniteTopology X} (hf : Function.Injective f) : Continuous f
Proof
:=
  continuous_of_isClosed_preimage_singleton fun _ ↦
    Set.Subsingleton.isClosed fun _ ha _ hb ↦ hf (ha.trans hb.symm)

On this site: Cofinite topologies: Injective maps from T₁ spaces are continuous

theorem joinedIn_of_finite_compl

TopologyByExample.CofiniteTopology.joinedIn_of_finite_compl

If X has at least the cardinality of the continuum, then in the cofinite topology on X, two points of a set U with finite complement are joined by a path inside U.

theorem joinedIn_of_finite_compl (hX : 𝔠 ≤ #X) {U : Set (_root_.CofiniteTopology X)}
    (hU : Uᶜ.Finite) {x y : _root_.CofiniteTopology X} (hx : x ∈ U) (hy : y ∈ U) :
    JoinedIn U x y
Proof
:= by
  rcases eq_or_ne x y with rfl | hxy
  · exact JoinedIn.refl hx
  replace hX : 𝔠 ≤ #(_root_.CofiniteTopology X) :=
    hX.trans (mk_congr (_root_.CofiniteTopology.of (X := X))).le
  have : Infinite (_root_.CofiniteTopology X) := infinite_iff.2 (aleph0_le_continuum.trans hX)
  set G : Set (_root_.CofiniteTopology X) := Uᶜ ∪ {x, y}
  have hG : G.Finite := hU.union (toFinite _)
  have hmk : #(Gᶜ : Set (_root_.CofiniteTopology X)) = #(_root_.CofiniteTopology X) :=
    mk_compl_of_infinite G (hG.lt_aleph0.trans_le (aleph0_le_continuum.trans hX))
  obtain ⟨e⟩ : Nonempty (I ↪ (Gᶜ : Set (_root_.CofiniteTopology X))) := by
    rw [← lift_mk_le', mk_unitInterval, lift_continuum, hmk, lift_uzero]; exact hX
  have he (t : I) : (e t : _root_.CofiniteTopology X) ∈ U ∧ (e t : _root_.CofiniteTopology X) ≠ x ∧
      (e t : _root_.CofiniteTopology X) ≠ y := by
    have := (e t).property
    simp only [G, mem_compl_iff, mem_union, mem_insert_iff, mem_singleton_iff, not_or,
      not_not] at this
    exact this
  let g : I → _root_.CofiniteTopology X := fun t ↦ if t = 0 then x else if t = 1 then y else e t
  have hg : Function.Injective g := by
    intro s t hst
    simp only [g] at hst
    split_ifs at hst with h1 h2 h3 h4 h5 h6 h7 <;> grind [e.injective, Subtype.val_injective]
  refine ⟨⟨⟨g, continuous_of_injective hg⟩, by simp [g], by simp [g]⟩, fun t ↦ ?_⟩
  change g t ∈ U
  simp only [g]
  split_ifs
  exacts [hx, hy, (he t).1]

theorem isPathConnected_of_finite_compl

TopologyByExample.CofiniteTopology.isPathConnected_of_finite_compl

If X has at least the cardinality of the continuum, then in the cofinite topology on X, every nonempty set with finite complement is path connected.

theorem isPathConnected_of_finite_compl (hX : 𝔠 ≤ #X) {U : Set (_root_.CofiniteTopology X)}
    (hU : Uᶜ.Finite) (hU' : U.Nonempty) : IsPathConnected U
Proof
:=
  ⟨hU'.some, hU'.some_mem, fun _ hy ↦ joinedIn_of_finite_compl hX hU hU'.some_mem hy⟩

theorem joined

TopologyByExample.CofiniteTopology.joined

If X has at least the cardinality of the continuum, then any two points of the cofinite topology on X are joined by a path.

theorem joined (hX : 𝔠 ≤ #X) (x y : _root_.CofiniteTopology X) : Joined x y
Proof
:=
  (joinedIn_of_finite_compl hX (U := univ) (by simp) (mem_univ x) (mem_univ y)).joined

theorem locallyPathConnectedSpace

TopologyByExample.CofiniteTopology.locallyPathConnectedSpace

If X has at least the cardinality of the continuum, then the cofinite topology on X is locally path connected: every open neighbourhood of a point is path connected.

theorem locallyPathConnectedSpace (hX : 𝔠 ≤ #X) :
    LocallyPathConnectedSpace (_root_.CofiniteTopology X)
Proof
:=
  .of_bases (fun x ↦ nhds_basis_opens x) fun x _ ⟨hxU, hU⟩ ↦
    isPathConnected_of_finite_compl hX (_root_.CofiniteTopology.isOpen_iff.1 hU ⟨x, hxU⟩)
      ⟨x, hxU⟩

theorem tendsto_of_finite_preimage_singleton

TopologyByExample.CofiniteTopology.tendsto_of_finite_preimage_singleton

In a cofinite topology, a sequence taking each value only finitely often converges to every point.

theorem tendsto_of_finite_preimage_singleton {u : ℕ → _root_.CofiniteTopology X}
    (hu : ∀ a, (u ⁻¹' {a}).Finite) (x : _root_.CofiniteTopology X) :
    Tendsto u atTop (𝓝 x)
Proof
:= by
  rw [_root_.CofiniteTopology.nhds_eq]
  refine le_sup_of_le_right fun s hs ↦ ?_
  have hev : ∀ᶠ n in atTop, ∀ a ∈ sᶜ, u n ≠ a :=
    (eventually_all_finite (mem_cofinite.1 hs)).2 fun a _ ↦ by
      rw [← Nat.cofinite_eq_atTop]
      exact (hu a).compl_mem_cofinite
  exact hev.mono fun n hn ↦ not_notMem.1 fun h ↦ hn _ h rfl

On this site: Cofinite topologies: A sequence taking each value finitely often converges to every point

theorem tendsto_of_injective

TopologyByExample.CofiniteTopology.tendsto_of_injective

In a cofinite topology, an injective sequence converges to every point.

theorem tendsto_of_injective {u : ℕ → _root_.CofiniteTopology X} (hu : Function.Injective u)
    (x : _root_.CofiniteTopology X) : Tendsto u atTop (𝓝 x)
Proof
:=
  tendsto_of_finite_preimage_singleton (fun _ ↦ (subsingleton_singleton.preimage hu).finite) x

On this site: Cofinite topologies: An injective sequence converges to every point

theorem seqCompactSpace

TopologyByExample.CofiniteTopology.seqCompactSpace

Every cofinite topology is sequentially compact.

theorem seqCompactSpace : SeqCompactSpace (_root_.CofiniteTopology X)
Proof
where
  isSeqCompact_univ u _ := by
    by_cases h : ∃ a, ∃ᶠ n in atTop, u n = a
    · obtain ⟨a, ha⟩ := h
      obtain ⟨φ, hφ, hφa⟩ := extraction_of_frequently_atTop ha
      refine ⟨a, mem_univ _, φ, hφ, ?_⟩
      rw [show u ∘ φ = fun _ ↦ a from funext hφa]
      exact tendsto_const_nhds
    · push Not at h
      refine ⟨u 0, mem_univ _, id, strictMono_id, tendsto_of_finite_preimage_singleton
        (fun a ↦ ?_) _⟩
      rw [← Nat.cofinite_eq_atTop] at h
      have := mem_cofinite.1 (h a)
      convert this using 1
      ext
      simp

On this site: Cofinite topologies: the space is sequentially compact

theorem dense_of_infinite

TopologyByExample.CofiniteTopology.dense_of_infinite

In the cofinite topology on an infinite type, every infinite subset is dense.

theorem dense_of_infinite {s : Set (_root_.CofiniteTopology X)} (hs : s.Infinite) : Dense s
Proof
:= by
  refine dense_iff_inter_open.2 fun U hU hU' ↦ ?_
  have hfin : Uᶜ.Finite := _root_.CofiniteTopology.isOpen_iff.1 hU hU'
  obtain ⟨x, hxs, hxU⟩ := (hs.sdiff hfin).nonempty
  exact ⟨x, by simpa using hxU, hxs⟩

On this site: Cofinite topologies: Every infinite subset is dense

theorem separableSpace

TopologyByExample.CofiniteTopology.separableSpace

A cofinite topology is separable: on a finite type the whole space is a countable dense set, and on an infinite type so is any countably infinite subset.

theorem separableSpace : SeparableSpace (_root_.CofiniteTopology X)
Proof
:= by
  rcases finite_or_infinite X with hX | hX
  · have : Finite (_root_.CofiniteTopology X) :=
      .of_injective _ _root_.CofiniteTopology.of.symm.injective
    exact ⟨⟨univ, (toFinite _).countable, dense_univ⟩⟩
  · have : Infinite (_root_.CofiniteTopology X) :=
      .of_injective _ (_root_.CofiniteTopology.of (X := X)).injective
    exact ⟨⟨range (Infinite.natEmbedding (_root_.CofiniteTopology X)), countable_range _,
      dense_of_infinite (infinite_range_of_injective
        (Infinite.natEmbedding (_root_.CofiniteTopology X)).injective)⟩⟩

On this site: Cofinite topologies: the space is separable

theorem nonempty_inter

TopologyByExample.CofiniteTopology.nonempty_inter

In the cofinite topology on an infinite type, two nonempty open sets meet.

theorem nonempty_inter [Infinite X] {U V : Set (_root_.CofiniteTopology X)} (hU : IsOpen U)
    (hV : IsOpen V) (hU' : U.Nonempty) (hV' : V.Nonempty) : (U ∩ V).Nonempty
Proof
:=
  nonempty_preirreducible_inter hU hV hU' hV'

On this site: Cofinite topologies: Any two nonempty open sets meet

theorem not_t2Space

TopologyByExample.CofiniteTopology.not_t2Space

The cofinite topology on an infinite type is not Hausdorff.

theorem not_t2Space [Infinite X] : ¬T2Space (_root_.CofiniteTopology X)
Proof
:= fun _ ↦ by
  obtain ⟨a, b, hab⟩ := exists_pair_ne X
  obtain ⟨U, V, hU, hV, haU, hbV, hUV⟩ :=
    t2_separation (_root_.CofiniteTopology.of.injective.ne hab)
  exact (nonempty_inter hU hV ⟨_, haU⟩ ⟨_, hbV⟩).ne_empty hUV.inter_eq

On this site: Cofinite topologies: the space is not Hausdorff when \(X\) is infinite

theorem not_firstCountableTopology

TopologyByExample.CofiniteTopology.not_firstCountableTopology

The cofinite topology on an uncountable type is not first countable: the complements of countably many neighbourhoods of a point are finite, so cannot cover the other points.

theorem not_firstCountableTopology [Uncountable X] :
    ¬FirstCountableTopology (_root_.CofiniteTopology X)
Proof
:= fun _ ↦ by
  obtain ⟨x⟩ : Nonempty X := inferInstance
  let x' := _root_.CofiniteTopology.of x
  obtain ⟨s, hs⟩ := (𝓝 x').exists_antitone_basis
  have hfin (n : ℕ) : (s n)ᶜ.Finite := by
    have := hs.mem n
    rw [_root_.CofiniteTopology.nhds_eq] at this
    exact mem_cofinite.1 this.2
  have hsub : ({x'}ᶜ : Set (_root_.CofiniteTopology X)) ⊆ ⋃ n, (s n)ᶜ := fun y hy ↦ by
    obtain ⟨n, -, hn⟩ :=
      hs.toHasBasis.mem_iff.1 (isOpen_compl_singleton.mem_nhds (Ne.symm hy))
    exact mem_iUnion.2 ⟨n, fun h ↦ hn h rfl⟩
  have : Uncountable (_root_.CofiniteTopology X) :=
    _root_.CofiniteTopology.of.injective.uncountable
  refine not_countable_univ (α := _root_.CofiniteTopology X) ?_
  rw [← union_compl_self {x'}]
  exact (countable_singleton _).union ((countable_iUnion fun n ↦ (hfin n).countable).mono hsub)

On this site: Cofinite topologies: the space is not first countable when \(X\) is uncountable

theorem isCompact

TopologyByExample.CofiniteTopology.isCompact

In a cofinite topology, every subset is compact (the space is Noetherian).

theorem isCompact (s : Set (_root_.CofiniteTopology X)) : IsCompact s
Proof
:=
  NoetherianSpace.isCompact s

On this site: Cofinite topologies: Every subset is compact

theorem firstCountableTopology

TopologyByExample.CofiniteTopology.firstCountableTopology

The cofinite topology on a countable type is first countable: the neighbourhood filter of a point is generated by the countably many cofinite sets containing it.

theorem firstCountableTopology [Countable X] :
    FirstCountableTopology (_root_.CofiniteTopology X)
Proof
where
  nhds_generated_countable x := by
    rw [_root_.CofiniteTopology.nhds_eq]
    have : (cofinite : Filter (_root_.CofiniteTopology X)).IsCountablyGenerated :=
      HasCountableBasis.isCountablyGenerated ⟨hasBasis_cofinite, Countable.ofPred_finite⟩
    infer_instance

theorem secondCountableTopology

TopologyByExample.CofiniteTopology.secondCountableTopology

The cofinite topology on a countable type is second countable: it is countable and first countable.

theorem secondCountableTopology [Countable X] :
    SecondCountableTopology (_root_.CofiniteTopology X)
Proof
:=
  have := firstCountableTopology (X := X)
  inferInstance

On this site: Cofinite topologies: the space is second countable when \(X\) is countable

theorem connectedSpace

TopologyByExample.CofiniteTopology.connectedSpace

The cofinite topology on an infinite type is connected (indeed irreducible).

theorem connectedSpace [Infinite X] : ConnectedSpace (_root_.CofiniteTopology X)
Proof
:= inferInstance

theorem discreteTopology_of_finite

TopologyByExample.CofiniteTopology.discreteTopology_of_finite

The cofinite topology on a finite type is discrete: every set has finite complement.

theorem discreteTopology_of_finite [Finite X] : DiscreteTopology (_root_.CofiniteTopology X)
Proof
:=
  ⟨eq_bot_of_singletons_open fun _ ↦ _root_.CofiniteTopology.isOpen_iff.2 fun _ ↦ toFinite _⟩

theorem locallyConnectedSpace

TopologyByExample.CofiniteTopology.locallyConnectedSpace

A cofinite topology is locally connected: on a finite type it is discrete, and on an infinite type any two nonempty open sets meet, so every open set is connected.

theorem locallyConnectedSpace : LocallyConnectedSpace (_root_.CofiniteTopology X)
Proof
:= by
  rcases finite_or_infinite X with hX | hX
  · have := discreteTopology_of_finite (X := X)
    infer_instance
  · exact locallyConnectedSpace_of_preirreducibleSpace

On this site: Cofinite topologies: the space is locally connected

theorem eq_of_continuous

TopologyByExample.CofiniteTopology.eq_of_continuous

Every continuous map from the cofinite topology on an infinite type to a Hausdorff space is constant.

theorem eq_of_continuous [Infinite X] {Y : Type*} [TopologicalSpace Y] [T2Space Y]
    {f : _root_.CofiniteTopology X → Y} (hf : Continuous f) (x y : _root_.CofiniteTopology X) :
    f x = f y
Proof
:= by
  by_contra hne
  obtain ⟨U, V, hU, hV, hxU, hyV, hUV⟩ := t2_separation hne
  obtain ⟨z, hzU, hzV⟩ :=
    nonempty_inter (hU.preimage hf) (hV.preimage hf) ⟨x, hxU⟩ ⟨y, hyV⟩
  exact hUV.le_bot ⟨hzU, hzV⟩

On this site: Cofinite topologies: Continuous maps to Hausdorff spaces are constant

theorem not_forall_joined

TopologyByExample.CofiniteTopology.not_forall_joined

In the cofinite topology on a countable infinite type, not every two points are joined by a path: a countable T₁ space has only constant paths (Sierpiński's theorem).

theorem not_forall_joined [Countable X] [Infinite X] :
    ¬∀ x y : _root_.CofiniteTopology X, Joined x y
Proof
:= fun h ↦ by
  obtain ⟨a, b, hab⟩ := exists_pair_ne X
  exact hab (_root_.CofiniteTopology.of.injective
    (h (_root_.CofiniteTopology.of a) (_root_.CofiniteTopology.of b)).eq_of_countable)

On this site: Cofinite topologies: the space is not path connected when \(X\) is countably infinite

theorem pathComponent_eq_singleton

TopologyByExample.CofiniteTopology.pathComponent_eq_singleton

In the cofinite topology on a countable type, the path component of a point is that point alone.

theorem pathComponent_eq_singleton [Countable X] (x : _root_.CofiniteTopology X) :
    pathComponent x = {x}
Proof
:=
  pathComponent_eq_singleton_of_countable x

On this site: Cofinite topologies: Path components are single points

theorem isPathConnected_of_isOpen

TopologyByExample.CofiniteTopology.isPathConnected_of_isOpen

If X has at least the cardinality of the continuum, then in the cofinite topology on X every nonempty open set is path connected.

theorem isPathConnected_of_isOpen (hX : 𝔠 ≤ #X) {U : Set (_root_.CofiniteTopology X)}
    (hU : IsOpen U) (hne : U.Nonempty) : IsPathConnected U
Proof
:=
  isPathConnected_of_finite_compl hX (_root_.CofiniteTopology.isOpen_iff.1 hU hne) hne

On this site: Cofinite topologies: Nonempty open sets are path connected

theorem uncountable_of_continuum_le

TopologyByExample.CofiniteTopology.uncountable_of_continuum_le

A type of at least the cardinality of the continuum is uncountable.

theorem uncountable_of_continuum_le (hX : 𝔠 ≤ #X) : Uncountable X
Proof
:=
  Cardinal.aleph0_lt_mk_iff.mp (Cardinal.aleph0_lt_continuum.trans_le hX)

Hyperconnectedness, countability, isolated points and category

Each holds for the cofinite topology on every type satisfying the stated condition.

variable {X : Type*}

theorem preirreducibleSpace

TopologyByExample.CofiniteTopology.preirreducibleSpace

The cofinite topology on an infinite type is hyperconnected: two nonempty open sets have finite complements, so they meet.

theorem preirreducibleSpace [Infinite X] : PreirreducibleSpace (_root_.CofiniteTopology X)
Proof
:=
  inferInstance

On this site: Cofinite topologies: the space is hyperconnected when \(X\) is infinite

theorem countable

TopologyByExample.CofiniteTopology.countable

The cofinite topology on a countable type is a countable space.

theorem countable [Countable X] : Countable (_root_.CofiniteTopology X)
Proof
:=
  .of_equiv X _root_.CofiniteTopology.of

On this site: Cofinite topologies: the space is countable: the condition that \(X\) is countable

theorem not_hasIsolatedPoint

TopologyByExample.CofiniteTopology.not_hasIsolatedPoint

The cofinite topology on an infinite type has no isolated point: an open singleton would have a finite complement.

theorem not_hasIsolatedPoint [Infinite X] : ¬HasIsolatedPoint (_root_.CofiniteTopology X)
Proof
:=
  fun ⟨x, hx⟩ ↦ by
    have : Infinite (_root_.CofiniteTopology X) :=
      .of_injective _ (_root_.CofiniteTopology.of (X := X)).injective
    have hfin := _root_.CofiniteTopology.isOpen_iff.1 hx ⟨x, rfl⟩
    exact infinite_univ (by rw [← compl_union_self {x}]; exact hfin.union (finite_singleton x))

On this site: Cofinite topologies: the space has no isolated point when \(X\) is infinite

theorem not_isMeagre_univ

TopologyByExample.CofiniteTopology.not_isMeagre_univ

The cofinite topology on an uncountable type is of second category: a nowhere dense set has a closure other than the whole space, so it is finite, and countably many finite sets do not cover an uncountable set.

theorem not_isMeagre_univ [Uncountable X] :
    ¬IsMeagre (univ : Set (_root_.CofiniteTopology X))
Proof
:= by
  intro h
  have : Uncountable (_root_.CofiniteTopology X) :=
    _root_.CofiniteTopology.of.injective.uncountable
  obtain ⟨S, hSn, hSc, hS⟩ := isMeagre_iff_countable_union_isNowhereDense.1 h
  have hfin (t : Set (_root_.CofiniteTopology X)) (ht : t ∈ S) : t.Finite := by
    rcases _root_.CofiniteTopology.isClosed_iff.1 (isClosed_closure (s := t)) with h1 | h1
    · have hnd := hSn t ht
      rw [IsNowhereDense, h1, interior_univ] at hnd
      obtain ⟨x⟩ : Nonempty (_root_.CofiniteTopology X) := inferInstance
      exact absurd (hnd ▸ mem_univ x) (notMem_empty x)
    · exact h1.subset subset_closure
  exact not_countable_univ ((hSc.sUnion fun t ht ↦ (hfin t ht).countable).mono hS)

On this site: Cofinite topologies: the space is of second category when \(X\) is uncountable

On this site: Family: Cofinite topologies