Lean library · module TopologyByExample.Spaces.RationalSequence

The rational sequence topology

Source file

In this file we define TopologyByExample.RationalSequence, the real line with the rational sequence topology. Each real number x is given a sequence of rationals converging to x in the usual sense (TopologyByExample.RationalSequence.approx): the dyadic approximations ⌊2 ^ k * x⌋ / 2 ^ k if x is irrational, and the constant sequence x if x is rational. A basic neighbourhood of x is x together with a tail of its sequence. So every rational is isolated, and a set is open if it contains a tail of the sequence of each irrational it contains.

The topology is finer than the usual one, so it is Hausdorff. It is first countable, and separable (the rationals are dense). Each basic neighbourhood is compact and open, so the space is locally compact, and the basic neighbourhoods, being compact in a Hausdorff space, are clopen. The irrationals form an uncountable closed discrete subset, so the space does not have countable extent: it is not Lindelöf, and not compact. Being separable with a closed discrete subset of size continuum, it is not normal (Jones's lemma).

A compact subset meets only finitely many irrationals, and is contained in finitely many basic neighbourhoods. Consequently a sequence that has only finitely many terms in each basic neighbourhood leaves every compact set. These facts are what is needed to study the one-point compactification of the space.

Main definitions

Main statements

References

  • L. A. Steen and J. A. Seebach, Counterexamples in Topology, Example 65.

Tags

rational sequence topology, counterexample, locally compact, separable, not normal, extent

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 RationalSequence

TopologyByExample.RationalSequence

The real line with the rational sequence topology: every rational is isolated, and a basic neighbourhood of an irrational x is x together with a tail of a fixed sequence of rationals converging to x in the usual sense.

def RationalSequence : Type
:= ℝ

On this site: Space: Rational sequence topology

definition toReal

TopologyByExample.RationalSequence.toReal

The identity equivalence between the rational sequence topology and the real line.

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

instance

The rational sequence topology has infinitely many points.

instance : Infinite RationalSequence
Proof
:= inferInstanceAs (Infinite ℝ)

The sequences

definition approx

TopologyByExample.RationalSequence.approx

The sequence of rationals assigned to a real number x: for irrational x, its dyadic approximations ⌊x * 2 ^ k⌋ / 2 ^ k; for rational x, the constant sequence x.

def approx (x : ℝ) (k : ℕ) : ℝ
:= if Irrational x then ⌊x * 2 ^ k⌋ / 2 ^ k else x

theorem approx_of_irrational

TopologyByExample.RationalSequence.approx_of_irrational

For irrational x, the k-th term of approx x is ⌊x * 2 ^ k⌋ / 2 ^ k.

theorem approx_of_irrational {x : ℝ} (hx : Irrational x) (k : ℕ) :
    approx x k = ⌊x * 2 ^ k⌋ / 2 ^ k
Proof
:= by
  simp only [approx, hx, ite_true]

theorem approx_of_not_irrational

TopologyByExample.RationalSequence.approx_of_not_irrational

For rational x, approx x is the constant sequence x.

theorem approx_of_not_irrational {x : ℝ} (hx : ¬Irrational x) (k : ℕ) : approx x k = x
Proof
:= by
  simp only [approx, hx, ite_false]

theorem not_irrational_approx

TopologyByExample.RationalSequence.not_irrational_approx

Every term of approx x is rational.

theorem not_irrational_approx (x : ℝ) (k : ℕ) : ¬Irrational (approx x k)
Proof
:= by
  by_cases hx : Irrational x
  · rw [approx_of_irrational hx]
    intro h
    exact h ⟨(⌊x * 2 ^ k⌋ : ℚ) / 2 ^ k, by push_cast; rfl⟩
  · rwa [approx_of_not_irrational hx]

theorem tendsto_approx

TopologyByExample.RationalSequence.tendsto_approx

The sequence approx x converges to x in the usual topology of ℝ.

theorem tendsto_approx (x : ℝ) : Tendsto (approx x) atTop (𝓝 x)
Proof
:= by
  by_cases hx : Irrational x
  · have hlo : Tendsto (fun k : ℕ ↦ x - (1 / 2 : ℝ) ^ k) atTop (𝓝 x) := by
      simpa using tendsto_const_nhds.sub
        (tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num))
    refine tendsto_of_tendsto_of_tendsto_of_le_of_le hlo tendsto_const_nhds (fun k ↦ ?_)
      (fun k ↦ ?_)
    · have h2 : (0 : ℝ) < 2 ^ k := by positivity
      have h1 : (1 / 2 : ℝ) ^ k * 2 ^ k = 1 := by rw [← mul_pow]; norm_num
      rw [approx_of_irrational hx, le_div_iff₀ h2, sub_mul, h1]
      exact (Int.sub_one_lt_floor _).le
    · rw [approx_of_irrational hx, div_le_iff₀ (by positivity)]
      exact Int.floor_le _
  · rw [show approx x = fun _ ↦ x from funext (approx_of_not_irrational hx)]
    exact tendsto_const_nhds

definition seq

TopologyByExample.RationalSequence.seq

The sequence of rationals assigned to a point of the space (see TopologyByExample.RationalSequence.approx).

def seq (x : RationalSequence) (k : ℕ) : RationalSequence
:= toReal.symm (approx (toReal x) k)

theorem toReal_seq

TopologyByExample.RationalSequence.toReal_seq

seq x is approx of the underlying real number.

theorem toReal_seq (x : RationalSequence) (k : ℕ) : toReal (seq x k) = approx (toReal x) k
Proof
:= rfl

theorem not_irrational_seq

TopologyByExample.RationalSequence.not_irrational_seq

Every term of seq x is a rational point.

theorem not_irrational_seq (x : RationalSequence) (k : ℕ) : ¬Irrational (toReal (seq x k))
Proof
:=
  not_irrational_approx (toReal x) k

theorem seq_of_not_irrational

TopologyByExample.RationalSequence.seq_of_not_irrational

The sequence of a rational point is constant.

theorem seq_of_not_irrational {x : RationalSequence} (hx : ¬Irrational (toReal x)) (k : ℕ) :
    seq x k = x
Proof
:=
  approx_of_not_irrational hx k

theorem seq_seq

TopologyByExample.RationalSequence.seq_seq

The sequence of a term of a sequence is constant, that term being rational.

theorem seq_seq (x : RationalSequence) (k j : ℕ) : seq (seq x k) j = seq x k
Proof
:=
  seq_of_not_irrational (not_irrational_seq x k) j

The topology

definition nhdsFilter

TopologyByExample.RationalSequence.nhdsFilter

The neighbourhood filter of x in the rational sequence topology: the sets containing x and a tail of seq x.

def nhdsFilter (x : RationalSequence) : Filter RationalSequence
:= pure x ⊔ map (seq x) atTop

theorem mem_nhdsFilter

TopologyByExample.RationalSequence.mem_nhdsFilter

Membership in nhdsFilter x.

theorem mem_nhdsFilter {x : RationalSequence} {s : Set RationalSequence} :
    s ∈ nhdsFilter x ↔ x ∈ s ∧ ∀ᶠ k in atTop, seq x k ∈ s
Proof
:=
  Iff.rfl

instance

The rational sequence topology, given by its neighbourhood filters.

instance : TopologicalSpace RationalSequence
Proof
:= .mkOfNhds nhdsFilter

theorem nhds_eq

TopologyByExample.RationalSequence.nhds_eq

The neighbourhoods of x are the sets containing x and a tail of seq x.

theorem nhds_eq (x : RationalSequence) : 𝓝 x = pure x ⊔ map (seq x) atTop
Proof
:= by
  refine TopologicalSpace.nhds_mkOfNhds _ _ (fun _ ↦ le_sup_left) fun a s hs ↦ ?_
  rw [mem_nhdsFilter] at hs
  refine ⟨hs, hs.2.mono fun k hk ↦ ?_⟩
  exact mem_nhdsFilter.2 ⟨hk, .of_forall fun j ↦ by rwa [seq_seq]⟩

theorem mem_nhds_iff'

TopologyByExample.RationalSequence.mem_nhds_iff'

A set is a neighbourhood of x if and only if it contains x and a tail of seq x.

theorem mem_nhds_iff' {x : RationalSequence} {s : Set RationalSequence} :
    s ∈ 𝓝 x ↔ x ∈ s ∧ ∀ᶠ k in atTop, seq x k ∈ s
Proof
:= by
  rw [nhds_eq]
  exact Iff.rfl

theorem isOpen_iff

TopologyByExample.RationalSequence.isOpen_iff

A set is open in the rational sequence topology if and only if it contains a tail of the sequence of each of its points.

theorem isOpen_iff {s : Set RationalSequence} :
    IsOpen s ↔ ∀ x ∈ s, ∀ᶠ k in atTop, seq x k ∈ s
Proof
:= by
  rw [isOpen_iff_mem_nhds]
  exact forall₂_congr fun x hx ↦ mem_nhds_iff'.trans (and_iff_right hx)

theorem nhds_of_not_irrational

TopologyByExample.RationalSequence.nhds_of_not_irrational

A rational point is isolated.

theorem nhds_of_not_irrational {x : RationalSequence} (hx : ¬Irrational (toReal x)) :
    𝓝 x = pure x
Proof
:= by
  rw [nhds_eq]
  rw [show seq x = fun _ ↦ x from funext (seq_of_not_irrational hx), Filter.map_const, sup_idem]

theorem isOpen_singleton_of_not_irrational

TopologyByExample.RationalSequence.isOpen_singleton_of_not_irrational

A rational point is isolated.

theorem isOpen_singleton_of_not_irrational {x : RationalSequence} (hx : ¬Irrational (toReal x)) :
    IsOpen {x}
Proof
:=
  isOpen_singleton_iff_nhds_eq_pure _ |>.2 (nhds_of_not_irrational hx)

theorem tendsto_seq

TopologyByExample.RationalSequence.tendsto_seq

seq x converges to x in the rational sequence topology.

theorem tendsto_seq (x : RationalSequence) : Tendsto (seq x) atTop (𝓝 x)
Proof
:= by
  rw [nhds_eq]
  exact le_sup_right

definition basicNhd

TopologyByExample.RationalSequence.basicNhd

The basic neighbourhood {x} ∪ {seq x k | n ≤ k} of x.

def basicNhd (x : RationalSequence) (n : ℕ) : Set RationalSequence
:= insert x (seq x '' Ici n)

theorem mem_basicNhd_self

TopologyByExample.RationalSequence.mem_basicNhd_self

x lies in each of its basic neighbourhoods.

theorem mem_basicNhd_self (x : RationalSequence) (n : ℕ) : x ∈ basicNhd x n
Proof
:= mem_insert _ _

theorem seq_mem_basicNhd

TopologyByExample.RationalSequence.seq_mem_basicNhd

The tail of seq x from n on lies in basicNhd x n.

theorem seq_mem_basicNhd {x : RationalSequence} {n k : ℕ} (hk : n ≤ k) :
    seq x k ∈ basicNhd x n
Proof
:=
  mem_insert_of_mem _ ⟨k, hk, rfl⟩

theorem basicNhd_of_not_irrational

TopologyByExample.RationalSequence.basicNhd_of_not_irrational

The basic neighbourhoods of a rational point are the singleton.

theorem basicNhd_of_not_irrational {x : RationalSequence} (hx : ¬Irrational (toReal x)) (n : ℕ) :
    basicNhd x n = {x}
Proof
:= by
  refine subset_antisymm ?_ (singleton_subset_iff.2 (mem_basicNhd_self x n))
  rintro y (rfl | ⟨k, -, rfl⟩)
  · rfl
  · exact seq_of_not_irrational hx k

theorem hasBasis_nhds

TopologyByExample.RationalSequence.hasBasis_nhds

The sets basicNhd x n form a basis of the neighbourhoods of x.

theorem hasBasis_nhds (x : RationalSequence) :
    (𝓝 x).HasBasis (fun _ : ℕ ↦ True) (basicNhd x)
Proof
:= by
  rw [nhds_eq, sup_comm]
  have := (atTop_basis.map (seq x)).sup_pure x
  simp only [union_singleton] at this
  exact this

theorem basicNhd_mem_nhds

TopologyByExample.RationalSequence.basicNhd_mem_nhds

A basic neighbourhood of x is a neighbourhood of x.

theorem basicNhd_mem_nhds (x : RationalSequence) (n : ℕ) : basicNhd x n ∈ 𝓝 x
Proof
:=
  (hasBasis_nhds x).mem_of_mem trivial

theorem isOpen_basicNhd

TopologyByExample.RationalSequence.isOpen_basicNhd

Each basic neighbourhood is open.

theorem isOpen_basicNhd (x : RationalSequence) (n : ℕ) : IsOpen (basicNhd x n)
Proof
:= by
  refine isOpen_iff.2 ?_
  rintro y (rfl | ⟨k, hk, rfl⟩)
  · exact (eventually_ge_atTop n).mono fun k hk ↦ seq_mem_basicNhd hk
  · exact .of_forall fun j ↦ by rw [seq_seq]; exact seq_mem_basicNhd hk

theorem isCompact_basicNhd

TopologyByExample.RationalSequence.isCompact_basicNhd

Each basic neighbourhood is compact: it is a convergent sequence together with its limit.

theorem isCompact_basicNhd (x : RationalSequence) (n : ℕ) : IsCompact (basicNhd x n)
Proof
:= by
  have : seq x '' Ici n = range fun k ↦ seq x (k + n) := by
    ext y
    constructor
    · rintro ⟨k, hk, rfl⟩
      exact ⟨k - n, by simp only [Nat.sub_add_cancel (mem_Ici.1 hk)]⟩
    · rintro ⟨k, rfl⟩
      exact ⟨k + n, mem_Ici.2 (Nat.le_add_left n k), rfl⟩
  rw [basicNhd, this]
  exact ((tendsto_seq x).comp (tendsto_add_atTop_nat n)).isCompact_insert_range

On this site: Rational sequence topology: Basic neighbourhoods are compact

Separation and countability

theorem continuous_toReal

TopologyByExample.RationalSequence.continuous_toReal

The rational sequence topology is finer than the usual topology of ℝ.

theorem continuous_toReal : Continuous toReal
Proof
:= by
  refine continuous_iff_continuousAt.2 fun x ↦ ?_
  rw [ContinuousAt, nhds_eq, tendsto_sup]
  exact ⟨tendsto_pure_nhds _ _, tendsto_map'_iff.2 (tendsto_approx (toReal x))⟩

On this site: Rational sequence topology: Finer than the Euclidean topology

instance instT2Space

TopologyByExample.RationalSequence.instT2Space

The rational sequence topology is Hausdorff, being finer than the usual topology.

instance instT2Space : T2Space RationalSequence
Proof
:=
  .of_injective_continuous toReal.injective continuous_toReal

On this site: The rational sequence topology is Hausdorff

instance instFirstCountableTopology

TopologyByExample.RationalSequence.instFirstCountableTopology

The rational sequence topology is first countable: the basic neighbourhoods basicNhd x n form a countable neighbourhood basis at x.

instance instFirstCountableTopology : FirstCountableTopology RationalSequence
Proof
:=
  ⟨fun x ↦ (hasBasis_nhds x).isCountablyGenerated⟩

On this site: The rational sequence topology is first countable

theorem exists_not_irrational_mem_of_isOpen

TopologyByExample.RationalSequence.exists_not_irrational_mem_of_isOpen

Every nonempty open set contains a rational point.

theorem exists_not_irrational_mem_of_isOpen {s : Set RationalSequence} (hs : IsOpen s)
    (hne : s.Nonempty) : ∃ x ∈ s, ¬Irrational (toReal x)
Proof
:= by
  obtain ⟨x, hx⟩ := hne
  obtain ⟨k, hk⟩ := (isOpen_iff.1 hs x hx).exists
  exact ⟨seq x k, hk, not_irrational_seq x k⟩

theorem dense_range_ratCast

TopologyByExample.RationalSequence.dense_range_ratCast

The rational points are dense.

theorem dense_range_ratCast : Dense (range fun q : ℚ ↦ toReal.symm q)
Proof
:= by
  refine dense_iff_inter_open.2 fun s hs hne ↦ ?_
  obtain ⟨x, hx, hxq⟩ := exists_not_irrational_mem_of_isOpen hs hne
  obtain ⟨q, hq⟩ := not_not.1 hxq
  exact ⟨x, hx, q, hq⟩

instance instSeparableSpace

TopologyByExample.RationalSequence.instSeparableSpace

The rational sequence topology is separable: the rationals are a countable dense set.

instance instSeparableSpace : TopologicalSpace.SeparableSpace RationalSequence
Proof
:=
  ⟨⟨_, countable_range _, dense_range_ratCast⟩⟩

On this site: The rational sequence topology is separable

instance instLocallyCompactSpace

TopologyByExample.RationalSequence.instLocallyCompactSpace

The rational sequence topology is locally compact: every point has a neighbourhood basis of compact sets, its basic neighbourhoods.

instance instLocallyCompactSpace : LocallyCompactSpace RationalSequence
Proof
:=
  .of_hasBasis hasBasis_nhds fun x n _ ↦ isCompact_basicNhd x n

On this site: Rational sequence topology: Locally compact

theorem isClopen_basicNhd

TopologyByExample.RationalSequence.isClopen_basicNhd

Each basic neighbourhood is clopen.

theorem isClopen_basicNhd (x : RationalSequence) (n : ℕ) : IsClopen (basicNhd x n)
Proof
:=
  ⟨(isCompact_basicNhd x n).isClosed, isOpen_basicNhd x n⟩

On this site: Rational sequence topology: Basic neighbourhoods are open and closed

The irrationals

definition irrationals

TopologyByExample.RationalSequence.irrationals

The set of irrational points.

def irrationals : Set RationalSequence
:= {x | Irrational (toReal x)}

theorem mem_irrationals

TopologyByExample.RationalSequence.mem_irrationals

Membership in irrationals.

theorem mem_irrationals {x : RationalSequence} : x ∈ irrationals ↔ Irrational (toReal x)
Proof
:=
  Iff.rfl

theorem basicNhd_inter_irrationals_subset

TopologyByExample.RationalSequence.basicNhd_inter_irrationals_subset

A basic neighbourhood of x contains no irrational point other than x.

theorem basicNhd_inter_irrationals_subset (x : RationalSequence) (n : ℕ) :
    basicNhd x n ∩ irrationals ⊆ {x}
Proof
:= by
  rintro y ⟨rfl | ⟨k, -, rfl⟩, hy⟩
  · rfl
  · exact absurd hy (not_irrational_seq x k)

theorem isOpen_compl_irrationals

TopologyByExample.RationalSequence.isOpen_compl_irrationals

The set of rational points is open.

theorem isOpen_compl_irrationals : IsOpen irrationalsᶜ
Proof
:=
  isOpen_iff.2 fun x hx ↦ .of_forall fun k ↦ by rwa [seq_of_not_irrational hx]

theorem isClosed_irrationals

TopologyByExample.RationalSequence.isClosed_irrationals

The irrationals form a closed set.

theorem isClosed_irrationals : IsClosed irrationals
Proof
:=
  isOpen_compl_iff.1 isOpen_compl_irrationals

theorem isDiscrete_irrationals

TopologyByExample.RationalSequence.isDiscrete_irrationals

The irrationals form a discrete subspace.

theorem isDiscrete_irrationals : IsDiscrete irrationals
Proof
:= by
  refine isDiscrete_iff_forall_mem_exists_isOpen.2 fun x hx ↦
    ⟨basicNhd x 0, isOpen_basicNhd x 0, ?_⟩
  exact subset_antisymm (basicNhd_inter_irrationals_subset x 0)
    (singleton_subset_iff.2 ⟨mem_basicNhd_self x 0, hx⟩)

instance

The irrationals, as a subspace, are discrete.

instance : DiscreteTopology irrationals
Proof
:= isDiscrete_irrationals.to_subtype

theorem isDiscrete_compl_irrationals

TopologyByExample.RationalSequence.isDiscrete_compl_irrationals

The rational points form a discrete subspace.

theorem isDiscrete_compl_irrationals : IsDiscrete irrationalsᶜ
Proof
:=
  isDiscrete_iff_forall_mem_exists_isOpen.2 fun x hx ↦
    ⟨{x}, isOpen_singleton_of_not_irrational hx, inter_eq_left.2 (singleton_subset_iff.2 hx)⟩

theorem countable_compl_irrationals

TopologyByExample.RationalSequence.countable_compl_irrationals

There are only countably many rational points.

theorem countable_compl_irrationals : irrationalsᶜ.Countable
Proof
:=
  (countable_range fun q : ℚ ↦ toReal.symm q).mono fun _ hx ↦ not_not.1 hx

theorem cardinal_irrationals

TopologyByExample.RationalSequence.cardinal_irrationals

There are continuum many irrationals.

theorem cardinal_irrationals : #irrationals = 𝔠
Proof
:= by
  have hc : #(irrationalsᶜ : Set RationalSequence) < #RationalSequence := by
    rw [show #RationalSequence = 𝔠 from (Cardinal.mk_congr toReal).trans Cardinal.mk_real]
    have := countable_compl_irrationals.to_subtype
    exact Cardinal.mk_le_aleph0.trans_lt Cardinal.aleph0_lt_continuum
  rw [← compl_compl irrationals, Cardinal.mk_compl_of_infinite _ hc,
    (Cardinal.mk_congr toReal).trans Cardinal.mk_real]

theorem not_countable_irrationals

TopologyByExample.RationalSequence.not_countable_irrationals

The irrationals are uncountable.

theorem not_countable_irrationals : ¬irrationals.Countable
Proof
:= by
  rw [← countable_coe_iff, ← Cardinal.mk_le_aleph0_iff, cardinal_irrationals, not_le]
  exact Cardinal.aleph0_lt_continuum

theorem isClosed_isDiscrete_cardinal_irrationals

TopologyByExample.RationalSequence.isClosed_isDiscrete_cardinal_irrationals

The irrationals form a closed discrete set of cardinality 𝔠.

theorem isClosed_isDiscrete_cardinal_irrationals :
    IsClosed irrationals ∧ IsDiscrete irrationals ∧ #irrationals = 𝔠
Proof
:=
  ⟨isClosed_irrationals, isDiscrete_irrationals, cardinal_irrationals⟩

On this site: Rational sequence topology: The irrationals form a closed discrete set of cardinality \(\mathfrak{c}\)

theorem exists_closed_discrete_continuum_le

TopologyByExample.RationalSequence.exists_closed_discrete_continuum_le

The rational sequence topology has a closed discrete subset of cardinality 𝔠: the irrationals.

theorem exists_closed_discrete_continuum_le :
    ∃ s : Set RationalSequence, IsClosed s ∧ IsDiscrete s ∧ 𝔠 ≤ #s
Proof
:=
  ⟨irrationals, isClosed_irrationals, isDiscrete_irrationals, cardinal_irrationals.ge⟩

On this site: The rational sequence topology has a closed discrete subset of cardinality \(\mathfrak{c}\)

theorem not_countableExtent

TopologyByExample.RationalSequence.not_countableExtent

The rational sequence topology does not have countable extent: the irrationals are an uncountable set with no accumulation point (they form a closed discrete set).

theorem not_countableExtent :
    ¬∀ s : Set RationalSequence, ¬s.Countable → ∃ x, AccPt x (𝓟 s)
Proof
:= fun h ↦
  not_countable_irrationals <|
    countableExtent_iff.1 h _ isClosed_irrationals isDiscrete_irrationals

theorem not_lindelofSpace

TopologyByExample.RationalSequence.not_lindelofSpace

The rational sequence topology is not Lindelöf.

theorem not_lindelofSpace : ¬LindelofSpace RationalSequence
Proof
:= fun _ ↦
  not_countableExtent countableExtent_of_lindelofSpace

theorem not_compactSpace

TopologyByExample.RationalSequence.not_compactSpace

The rational sequence topology is not compact.

theorem not_compactSpace : ¬CompactSpace RationalSequence
Proof
:= fun _ ↦
  not_lindelofSpace inferInstance

theorem not_countablyCompactSpace

TopologyByExample.RationalSequence.not_countablyCompactSpace

The rational sequence topology is not countably compact: a countably compact space has countable extent.

theorem not_countablyCompactSpace : ¬CountablyCompactSpace RationalSequence
Proof
:= fun _ ↦
  not_countableExtent <|
    countableExtent_of_limitPointCompact limitPointCompact_of_countablyCompactSpace

theorem not_normalSpace

TopologyByExample.RationalSequence.not_normalSpace

The rational sequence topology is not normal: it is separable and has a closed discrete subset of size continuum.

theorem not_normalSpace : ¬NormalSpace RationalSequence
Proof
:=
  isClosed_irrationals.not_normal_of_continuum_le_mk cardinal_irrationals.ge

instance instTotallySeparatedSpace

TopologyByExample.RationalSequence.instTotallySeparatedSpace

The rational sequence topology is totally separated (so totally disconnected): two distinct points are separated by a clopen set, a basic neighbourhood or a rational singleton.

instance instTotallySeparatedSpace : TotallySeparatedSpace RationalSequence
Proof
:= by
  refine totallySeparatedSpace_iff_exists_isClopen.2 fun x y hxy ↦ ?_
  by_cases hx : Irrational (toReal x)
  · by_cases hy : Irrational (toReal y)
    · refine ⟨basicNhd x 0, isClopen_basicNhd x 0, mem_basicNhd_self x 0, fun hy' ↦ hxy ?_⟩
      exact (basicNhd_inter_irrationals_subset x 0 ⟨hy', hy⟩).symm
    · exact ⟨{y}ᶜ, ⟨isOpen_singleton_of_not_irrational hy |>.isClosed_compl,
        isClosed_singleton.isOpen_compl⟩, hxy, by simp⟩
  · exact ⟨{x}, ⟨isClosed_singleton, isOpen_singleton_of_not_irrational hx⟩, rfl,
      fun h ↦ hxy h.symm⟩

On this site: The rational sequence topology is totally separated

Compact sets and convergence

theorem finite_inter_irrationals_of_isCompact

TopologyByExample.RationalSequence.finite_inter_irrationals_of_isCompact

A compact set contains only finitely many irrationals.

theorem finite_inter_irrationals_of_isCompact {K : Set RationalSequence} (hK : IsCompact K) :
    (K ∩ irrationals).Finite
Proof
:=
  (hK.inter_right isClosed_irrationals).finite (isDiscrete_irrationals.mono inter_subset_right)

On this site: Rational sequence topology: Compact sets contain finitely many irrationals

theorem exists_finite_subset_biUnion_basicNhd_of_isCompact

TopologyByExample.RationalSequence.exists_finite_subset_biUnion_basicNhd_of_isCompact

A compact set is contained in finitely many basic neighbourhoods basicNhd x 0.

theorem exists_finite_subset_biUnion_basicNhd_of_isCompact {K : Set RationalSequence}
    (hK : IsCompact K) : ∃ A : Set RationalSequence, A.Finite ∧ K ⊆ ⋃ x ∈ A, basicNhd x 0
Proof
:= by
  set U := ⋃ x ∈ K ∩ irrationals, basicNhd x 0
  have hU : IsOpen U := isOpen_biUnion fun x _ ↦ isOpen_basicNhd x 0
  have hKU : K \ U ⊆ irrationalsᶜ := fun x hx hxi ↦
    hx.2 (mem_biUnion ⟨hx.1, hxi⟩ (mem_basicNhd_self x 0))
  have hfin : (K \ U).Finite := (hK.diff hU).finite (isDiscrete_compl_irrationals.mono hKU)
  refine ⟨K ∩ irrationals ∪ K \ U, (finite_inter_irrationals_of_isCompact hK).union hfin,
    fun x hx ↦ ?_⟩
  by_cases hxU : x ∈ U
  · exact biUnion_mono subset_union_left (fun _ _ ↦ Subset.rfl) hxU
  · exact mem_biUnion (Or.inr ⟨hx, hxU⟩) (mem_basicNhd_self x 0)

On this site: Rational sequence topology: Compact sets lie in finitely many basic neighbourhoods

theorem tendsto_cocompact_of_finite

TopologyByExample.RationalSequence.tendsto_cocompact_of_finite

A sequence with only finitely many terms in each basic neighbourhood basicNhd x 0 leaves every compact set.

theorem tendsto_cocompact_of_finite {u : ℕ → RationalSequence}
    (hu : ∀ x, {k | u k ∈ basicNhd x 0}.Finite) : Tendsto u atTop (cocompact RationalSequence)
Proof
:= by
  refine hasBasis_cocompact.tendsto_right_iff.2 fun K hK ↦ ?_
  obtain ⟨A, hA, hKA⟩ := exists_finite_subset_biUnion_basicNhd_of_isCompact hK
  rw [← Nat.cofinite_eq_atTop, eventually_cofinite]
  refine (hA.biUnion fun x _ ↦ hu x).subset fun k hk ↦ ?_
  simpa using hKA (not_notMem.1 hk)

theorem tendsto_of_forall_mem_basicNhd

TopologyByExample.RationalSequence.tendsto_of_forall_mem_basicNhd

A sequence lying in basicNhd x 0, each of whose values is taken only finitely often, converges to x.

theorem tendsto_of_forall_mem_basicNhd {u : ℕ → RationalSequence} {x : RationalSequence}
    (hu : ∀ k, u k ∈ basicNhd x 0) (hfin : ∀ y, {k | u k = y}.Finite) :
    Tendsto u atTop (𝓝 x)
Proof
:= by
  refine (hasBasis_nhds x).tendsto_right_iff.2 fun n _ ↦ ?_
  rw [← Nat.cofinite_eq_atTop, eventually_cofinite]
  refine ((finite_Iio n).biUnion fun j _ ↦ hfin (seq x j)).subset fun k hk ↦ ?_
  rcases hu k with h | ⟨j, -, hj⟩
  · exact absurd (h ▸ mem_basicNhd_self x n) hk
  · refine mem_biUnion (x := j) (mem_Iio.2 (not_le.1 fun hj' ↦ hk ?_)) hj.symm
    exact hj ▸ seq_mem_basicNhd hj'

The rational sequence topology

theorem scatteredSpace

TopologyByExample.RationalSequence.scatteredSpace

The rational sequence topology is scattered. A nonempty set with a rational point has that point isolated in it; a nonempty set of irrational points has each of them isolated in it, since a basic neighbourhood of an irrational point contains no other irrational point.

theorem scatteredSpace : ScatteredSpace RationalSequence
Proof
:= by
  refine scatteredSpace_iff_exists_isolated.2 fun s ⟨x, hx⟩ ↦ ?_
  by_cases hq : ∃ y ∈ s, ¬Irrational (toReal y)
  · obtain ⟨y, hy, hyq⟩ := hq
    exact ⟨y, hy, {y}, (isOpen_singleton_of_not_irrational hyq).mem_nhds rfl,
      inter_subset_left⟩
  · push Not at hq
    exact ⟨x, hx, basicNhd x 0, basicNhd_mem_nhds x 0, fun y hy ↦
      basicNhd_inter_irrationals_subset x 0 ⟨hy.1, hq y hy.2⟩⟩

On this site: The rational sequence topology is scattered

theorem isClosed_preimage_range_intCast

TopologyByExample.RationalSequence.isClosed_preimage_range_intCast

The integers form a closed set of the rational sequence topology.

theorem isClosed_preimage_range_intCast :
    IsClosed (toReal ⁻¹' range ((↑) : ℤ → ℝ))
Proof
:=
  Int.isClosedEmbedding_coe_real.isClosed_range.preimage continuous_toReal

theorem not_pseudocompactSpace

TopologyByExample.RationalSequence.not_pseudocompactSpace

The rational sequence topology is not pseudocompact: the integers form an infinite closed set of isolated points.

theorem not_pseudocompactSpace : ¬PseudocompactSpace RationalSequence
Proof
:= by
  refine not_pseudocompactSpace_of_isClosed_of_isOpen_singleton ?_
    isClosed_preimage_range_intCast ?_
  · exact (infinite_range_of_injective Int.cast_injective).preimage
      (toReal.surjective.range_eq ▸ subset_univ _)
  · rintro x ⟨n, hn⟩
    exact isOpen_singleton_of_not_irrational (hn ▸ Int.not_irrational n)

On this site: The rational sequence topology is not pseudocompact

theorem not_countablyParacompactSpace

TopologyByExample.RationalSequence.not_countablyParacompactSpace

The rational sequence topology is not countably paracompact: it is separable, and the irrationals form a closed discrete subset of cardinality 𝔠.

theorem not_countablyParacompactSpace : ¬CountablyParacompactSpace RationalSequence
Proof
:=
  isClosed_irrationals.not_countablyParacompactSpace_of_continuum_le_mk cardinal_irrationals.ge