Lean library · module TopologyByExample.Spaces.TwoLimitSequence

A convergent sequence with two limits

Source file

In this file we define TopologyByExample.TwoLimitSequence, the natural numbers together with two extra points lim false and lim true. Each natural number is isolated, and a basic neighbourhood of lim i is lim i together with all natural numbers from some point on. So the sequence of natural numbers converges to both extra points, and any two neighbourhoods of the two limits meet: the space is not Hausdorff, and every continuous map to a Hausdorff space identifies the two limits. It is the one-point compactification of a countable discrete space with its point at infinity doubled.

Points are closed, so the space is T₁. Each natural number is a clopen singleton, and the two limits can be separated by open sets inside the set of limits; so a connected subset has at most one point, and the space is totally disconnected. It is compact (the union of the sequence and one limit is compact, and one point remains) and countable, with countable neighbourhood bases, so it is second countable.

Main definitions

Main statements

Tags

convergent sequence, two limits, T₁, not Hausdorff, totally disconnected, 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

inductive type TwoLimitSequence

TopologyByExample.TwoLimitSequence

The points of a convergent sequence with two limits: the natural numbers and two limits.

inductive TwoLimitSequence : Type
  /-- The terms of the sequence. -/
  | nat (n : ℕ)
  /-- The two limits. -/
  | lim (i : Bool)
  deriving DecidableEq

On this site: Space: Convergent sequence with two limits

definition encode

TopologyByExample.TwoLimitSequence.encode

An encoding of the points, used to show that there are countably many.

def encode : TwoLimitSequence → ℕ ⊕ Bool
  | nat n => .inl n
  | lim i => .inr i

theorem encode_injective

TopologyByExample.TwoLimitSequence.encode_injective

The encoding of the points is injective.

theorem encode_injective : Function.Injective encode
Proof
:= by
  rintro (_ | _) (_ | _) h <;> simp_all [encode]

instance instCountable

TopologyByExample.TwoLimitSequence.instCountable

The space is countable.

instance instCountable : Countable TwoLimitSequence
Proof
:= encode_injective.countable

theorem nat_ne_lim

TopologyByExample.TwoLimitSequence.nat_ne_lim

No term of the sequence is a limit.

@[simp] theorem nat_ne_lim (n : ℕ) (i : Bool) : nat n ≠ lim i
Proof
:= nofun

theorem nat_injective

TopologyByExample.TwoLimitSequence.nat_injective

The terms of the sequence are distinct.

theorem nat_injective : Function.Injective nat
Proof
:= fun _ _ h ↦ nat.inj h

instance instTopologicalSpace

TopologyByExample.TwoLimitSequence.instTopologicalSpace

A set is open if, whenever it contains a limit, it contains all large natural numbers.

instance instTopologicalSpace : TopologicalSpace TwoLimitSequence
Proof
where
  IsOpen U := ∀ i, lim i ∈ U → ∀ᶠ n in atTop, nat n ∈ U
  isOpen_univ := by simp
  isOpen_inter s t hs ht i hi := (hs i hi.1).and (ht i hi.2)
  isOpen_sUnion S hS i := fun ⟨t, ht, hi⟩ ↦ ((hS t ht) i hi).mono fun _ h ↦ ⟨t, ht, h⟩

theorem isOpen_iff

TopologyByExample.TwoLimitSequence.isOpen_iff

The open sets of the space, by definition.

theorem isOpen_iff {U : Set TwoLimitSequence} :
    IsOpen U ↔ ∀ i, lim i ∈ U → ∀ᶠ n in atTop, nat n ∈ U
Proof
:=
  Iff.rfl

definition limNhd

TopologyByExample.TwoLimitSequence.limNhd

The basic neighbourhood of lim i: the limit together with all nat n with N ≤ n.

def limNhd (i : Bool) (N : ℕ) : Set TwoLimitSequence
Definition
:=
  {x | match x with
    | nat n => N ≤ n
    | lim j => j = i}

theorem nat_mem_limNhd

TopologyByExample.TwoLimitSequence.nat_mem_limNhd

The terms of the sequence in limNhd i N are those from N on.

@[simp] theorem nat_mem_limNhd {i : Bool} {N n : ℕ} : nat n ∈ limNhd i N ↔ N ≤ n
Proof
:= Iff.rfl

theorem lim_mem_limNhd

TopologyByExample.TwoLimitSequence.lim_mem_limNhd

The only limit in limNhd i N is lim i.

@[simp] theorem lim_mem_limNhd {i j : Bool} {N : ℕ} : lim j ∈ limNhd i N ↔ j = i
Proof
:= Iff.rfl

theorem isOpen_limNhd

TopologyByExample.TwoLimitSequence.isOpen_limNhd

The basic neighbourhoods of the limits are open.

theorem isOpen_limNhd (i : Bool) (N : ℕ) : IsOpen (limNhd i N)
Proof
:= fun _ _ ↦
  eventually_ge_atTop N

theorem hasBasis_nhds_lim

TopologyByExample.TwoLimitSequence.hasBasis_nhds_lim

The basic neighbourhoods of lim i form a base of its neighbourhoods.

theorem hasBasis_nhds_lim (i : Bool) : (𝓝 (lim i)).HasBasis (fun _ ↦ True) (limNhd i)
Proof
:= by
  refine ⟨fun t ↦ ⟨fun ht ↦ ?_, fun ⟨N, _, hN⟩ ↦
    mem_of_superset ((isOpen_limNhd i N).mem_nhds rfl) hN⟩⟩
  obtain ⟨U, hUt, hU, hiU⟩ := mem_nhds_iff.1 ht
  obtain ⟨N, hN⟩ := eventually_atTop.1 (hU i hiU)
  refine ⟨N, trivial, fun x hx ↦ hUt ?_⟩
  cases x with
  | nat n => exact hN n hx
  | lim j => exact (show j = i from hx) ▸ hiU

theorem isOpen_singleton_nat

TopologyByExample.TwoLimitSequence.isOpen_singleton_nat

The terms of the sequence are isolated.

theorem isOpen_singleton_nat (n : ℕ) : IsOpen ({nat n} : Set TwoLimitSequence)
Proof
:= by
  rintro i ⟨⟩

theorem nhds_nat

TopologyByExample.TwoLimitSequence.nhds_nat

The neighbourhoods of a term of the sequence are the sets containing it.

theorem nhds_nat (n : ℕ) : 𝓝 (nat n) = pure (nat n)
Proof
:=
  isOpen_singleton_iff_nhds_eq_pure _ |>.1 (isOpen_singleton_nat n)

theorem tendsto_nat

TopologyByExample.TwoLimitSequence.tendsto_nat

The sequence converges to both limits.

theorem tendsto_nat (i : Bool) : Tendsto nat atTop (𝓝 (lim i))
Proof
:=
  (hasBasis_nhds_lim i).tendsto_right_iff.2 fun N _ ↦ eventually_ge_atTop N

On this site: Convergent sequence with two limits: The sequence converges to both limits

instance instFirstCountableTopology

TopologyByExample.TwoLimitSequence.instFirstCountableTopology

The space is first countable.

instance instFirstCountableTopology : FirstCountableTopology TwoLimitSequence
Proof
where
  nhds_generated_countable
    | nat n => by rw [nhds_nat]; infer_instance
    | lim i => (hasBasis_nhds_lim i).isCountablyGenerated

theorem secondCountableTopology

TopologyByExample.TwoLimitSequence.secondCountableTopology

The space is second countable: it is countable and first countable.

theorem secondCountableTopology : SecondCountableTopology TwoLimitSequence
Proof
:= inferInstance

On this site: The convergent sequence with two limits is second countable

instance instT1Space

TopologyByExample.TwoLimitSequence.instT1Space

Points are closed: the space is T₁.

instance instT1Space : T1Space TwoLimitSequence
Proof
where
  t1 x := by
    rw [← isOpen_compl_iff]
    intro i _
    cases x with
    | nat k => exact (eventually_ne_atTop k).mono fun n hn h ↦ hn (nat.inj h)
    | lim j => exact Eventually.of_forall fun n h ↦ nat_ne_lim n j h

On this site: The convergent sequence with two limits is T₁

instance instCompactSpace

TopologyByExample.TwoLimitSequence.instCompactSpace

The space is compact: the sequence with one limit is compact, and one point remains.

instance instCompactSpace : CompactSpace TwoLimitSequence
Proof
where
  isCompact_univ := by
    have : (univ : Set TwoLimitSequence) = insert (lim false) (range nat) ∪ {lim true} := by
      ext (_ | (_ | _)) <;> simp
    rw [this]
    exact (tendsto_nat false).isCompact_insert_range.union isCompact_singleton

On this site: The convergent sequence with two limits is compact

theorem isClopen_singleton_nat

TopologyByExample.TwoLimitSequence.isClopen_singleton_nat

The terms of the sequence are clopen singletons.

theorem isClopen_singleton_nat (n : ℕ) : IsClopen ({nat n} : Set TwoLimitSequence)
Proof
:=
  ⟨isClosed_singleton, isOpen_singleton_nat n⟩

theorem subset_singleton_of_isPreconnected

TopologyByExample.TwoLimitSequence.subset_singleton_of_isPreconnected

A preconnected set containing a term of the sequence contains nothing else.

theorem subset_singleton_of_isPreconnected {t : Set TwoLimitSequence} (ht : IsPreconnected t)
    {n : ℕ} (hn : nat n ∈ t) : t ⊆ {nat n}
Proof
:=
  ht.subset_isClopen (isClopen_singleton_nat n) ⟨nat n, hn, rfl⟩

instance instTotallyDisconnectedSpace

TopologyByExample.TwoLimitSequence.instTotallyDisconnectedSpace

The space is totally disconnected.

instance instTotallyDisconnectedSpace : TotallyDisconnectedSpace TwoLimitSequence
Proof
where
  isTotallyDisconnected_univ t _ ht := by
    intro x hx y hy
    cases x with
    | nat n => exact (subset_singleton_of_isPreconnected ht hx hy).symm
    | lim i =>
      cases y with
      | nat n => exact subset_singleton_of_isPreconnected ht hy hx
      | lim j =>
        by_contra hij
        have hij : i ≠ j := fun h ↦ hij (h ▸ rfl)
        obtain ⟨z, hzt, hzi, hzj⟩ := ht (limNhd i 0) (limNhd j 0) (isOpen_limNhd i 0)
          (isOpen_limNhd j 0)
          (fun z _ ↦ by
            cases z with
            | nat n => simp
            | lim k =>
              simp only [mem_union, lim_mem_limNhd]
              cases i <;> cases j <;> cases k <;> simp_all)
          ⟨lim i, hx, rfl⟩ ⟨lim j, hy, rfl⟩
        cases z with
        | nat n => exact nat_ne_lim n i (subset_singleton_of_isPreconnected ht hzt hx).symm
        | lim k => exact hij ((show k = i from hzi).symm.trans hzj)

On this site: The convergent sequence with two limits is totally disconnected

theorem nonempty_inter

TopologyByExample.TwoLimitSequence.nonempty_inter

Two neighbourhoods of the two limits meet.

theorem nonempty_inter {U V : Set TwoLimitSequence} (hU : U ∈ 𝓝 (lim false))
    (hV : V ∈ 𝓝 (lim true)) : (U ∩ V).Nonempty
Proof
:=
  let ⟨n, h⟩ :=
    (((tendsto_nat false).eventually_mem hU).and ((tendsto_nat true).eventually_mem hV)).exists
  ⟨nat n, h⟩

On this site: Convergent sequence with two limits: Neighbourhoods of the two limits meet

theorem not_t2Space

TopologyByExample.TwoLimitSequence.not_t2Space

The space is not Hausdorff: the two limits cannot be separated.

theorem not_t2Space : ¬T2Space TwoLimitSequence
Proof
:= fun _ ↦ by
  obtain ⟨U, V, hU, hV, hfU, htV, hUV⟩ := t2_separation (x := lim false) (y := lim true) (by simp)
  exact (nonempty_inter (hU.mem_nhds hfU) (hV.mem_nhds htV)).ne_empty hUV.inter_eq

On this site: The convergent sequence with two limits is not Hausdorff

theorem eq_of_continuous

TopologyByExample.TwoLimitSequence.eq_of_continuous

Every continuous map from the space to a Hausdorff space takes the same value at the two limits.

theorem eq_of_continuous {Y : Type*} [TopologicalSpace Y] [T2Space Y] {f : TwoLimitSequence → Y}
    (hf : Continuous f) : f (lim false) = f (lim true)
Proof
:=
  tendsto_nhds_unique ((hf.tendsto _).comp (tendsto_nat false))
    ((hf.tendsto _).comp (tendsto_nat true))

On this site: Convergent sequence with two limits: Continuous maps to Hausdorff spaces identify the limits

The convergent sequence with two limits

theorem nat_mem_of_mem_closure

TopologyByExample.TwoLimitSequence.nat_mem_of_mem_closure

A term of the sequence in the closure of a set lies in the set.

theorem nat_mem_of_mem_closure {s : Set TwoLimitSequence} {n : ℕ} (h : nat n ∈ closure s) :
    nat n ∈ s
Proof
:= by
  obtain ⟨_, rfl, hx⟩ := mem_closure_iff.1 h _ (isOpen_singleton_nat n) rfl
  exact hx

theorem lim_mem_closure

TopologyByExample.TwoLimitSequence.lim_mem_closure

An open set containing all large terms of the sequence has both limits in its closure.

theorem lim_mem_closure {s : Set TwoLimitSequence} (h : ∀ᶠ n in atTop, nat n ∈ s) (i : Bool) :
    lim i ∈ closure s
Proof
:=
  mem_closure_of_tendsto (tendsto_nat i) h

theorem not_semiregularSpace

TopologyByExample.TwoLimitSequence.not_semiregularSpace

The convergent sequence with two limits is not semiregular: a regular open set containing one limit contains all large terms, so its closure contains a neighbourhood of the other limit.

theorem not_semiregularSpace : ¬SemiregularSpace TwoLimitSequence
Proof
:= by
  intro h
  rw [semiregularSpace_iff_isRegularOpen] at h
  obtain ⟨V, hV, hfV, hVU⟩ := h.isOpen_iff.1 (isOpen_limNhd false 0) (lim false) rfl
  obtain ⟨N, hN⟩ := eventually_atTop.1 (hV.isOpen false hfV)
  have hsub : limNhd true N ⊆ closure V := by
    rintro (n | j) hx
    · exact subset_closure (hN n hx)
    · rw [show j = true from hx]
      exact lim_mem_closure (eventually_atTop.2 ⟨N, hN⟩) true
  have hmem : lim true ∈ V := by
    rw [← hV]
    exact interior_maximal hsub (isOpen_limNhd true N) rfl
  exact absurd (hVU hmem) (by simp)

On this site: The convergent sequence with two limits is not semiregular

theorem not_extremallyDisconnected

TopologyByExample.TwoLimitSequence.not_extremallyDisconnected

The convergent sequence with two limits is not extremally disconnected: the closure of the open set of even terms contains the limits but no odd term, so it is not open.

theorem not_extremallyDisconnected : ¬ExtremallyDisconnected TwoLimitSequence
Proof
:= by
  intro h
  set E : Set TwoLimitSequence := range fun n ↦ nat (2 * n)
  have hE : IsOpen E := isOpen_iff.2 fun i ⟨n, hn⟩ ↦ by cases hn
  have hlim : lim false ∈ closure E :=
    (mem_closure_iff_nhds_basis (hasBasis_nhds_lim false)).2 fun N _ ↦
      ⟨nat (2 * N), ⟨N, rfl⟩, by simp; omega⟩
  obtain ⟨N, hN⟩ := eventually_atTop.1 ((h.open_closure E hE) false hlim)
  obtain ⟨n, hn⟩ := nat_mem_of_mem_closure (hN (2 * N + 1) (by omega))
  have := nat.inj hn
  omega

On this site: The convergent sequence with two limits is not extremally disconnected

instance instScatteredSpace

TopologyByExample.TwoLimitSequence.instScatteredSpace

The convergent sequence with two limits is scattered: a nonempty set contains an isolated term of the sequence, or else a limit, isolated in it by limNhd i 0.

instance instScatteredSpace : ScatteredSpace TwoLimitSequence
Proof
:= by
  refine scatteredSpace_iff_exists_isolated.2 fun s hs ↦ ?_
  by_cases hnat : ∃ n, nat n ∈ s
  · obtain ⟨n, h⟩ := hnat
    exact ⟨_, h, _, (isOpen_singleton_nat n).mem_nhds rfl, inter_subset_left⟩
  push Not at hnat
  obtain ⟨x, hx⟩ := hs
  rcases x with n | i
  · exact absurd hx (hnat n)
  · refine ⟨_, hx, _, (isOpen_limNhd i 0).mem_nhds rfl, ?_⟩
    rintro (n | j) ⟨hy, hy'⟩
    · exact absurd hy' (hnat n)
    · rw [show j = i from hy]
      rfl

On this site: The convergent sequence with two limits is scattered