Lean library · module TopologyByExample.Spaces.TwoLimitLattice

A lattice with two limit points

Source file

In this file we define TopologyByExample.TwoLimitLattice: the lattice points pt m n, m n : ℕ, together with two further points, the column limit lim false and the row limit lim true. Every lattice point is isolated; a neighbourhood of the column limit contains every lattice point of all columns from some index on, and a neighbourhood of the row limit every lattice point of all rows from some index on.

The space is countable, with countable neighbourhood bases, so it is second countable. Points are closed, so it is T₁. It is compact: the lattice points on or below the diagonal converge to the column limit, those above it to the row limit. The two limits are closed points with no disjoint neighbourhoods (a tail of columns meets a tail of rows), so the space is not normal, and the diagonal pt n n converges to both limits. It is scattered, and semiregular: the basic neighbourhood of a limit made of the columns (or rows) from index N + 1 on is regular open.

Main definitions

Main statements

Tags

lattice, two limits, T₁, not Hausdorff, not normal, compact, 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 TwoLimitLattice

TopologyByExample.TwoLimitLattice

The points of the lattice with two limit points: the lattice points and two limits.

inductive TwoLimitLattice : Type
  /-- The lattice point in column `m` and row `n`. -/
  | pt (m n : ℕ)
  /-- The two limits: `lim false` for the columns, `lim true` for the rows. -/
  | lim (i : Bool)
  deriving DecidableEq

On this site: Space: Lattice with two limit points

definition encode

TopologyByExample.TwoLimitLattice.encode

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

def encode : TwoLimitLattice → (ℕ × ℕ) ⊕ Bool
  | pt m n => .inl (m, n)
  | lim i => .inr i

theorem encode_injective

TopologyByExample.TwoLimitLattice.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.TwoLimitLattice.instCountable

The space is countable.

instance instCountable : Countable TwoLimitLattice
Proof
:= encode_injective.countable

instance

The space has a point.

instance : Inhabited TwoLimitLattice
Proof
:= ⟨lim false⟩

theorem pt_ne_lim

TopologyByExample.TwoLimitLattice.pt_ne_lim

No lattice point is a limit.

@[simp] theorem pt_ne_lim (m n : ℕ) (i : Bool) : pt m n ≠ lim i
Proof
:= nofun

theorem lim_ne_pt

TopologyByExample.TwoLimitLattice.lim_ne_pt

No limit is a lattice point.

@[simp] theorem lim_ne_pt (m n : ℕ) (i : Bool) : lim i ≠ pt m n
Proof
:= nofun

definition coord

TopologyByExample.TwoLimitLattice.coord

The index of a lattice point that the limit lim i looks at: its column for i = false, its row for i = true.

def coord : Bool → ℕ → ℕ → ℕ
  | false, m, _ => m
  | true, _, n => n

theorem coord_false

TopologyByExample.TwoLimitLattice.coord_false

The coordinate for the column limit is the column.

@[simp] theorem coord_false (m n : ℕ) : coord false m n = m
Proof
:= rfl

theorem coord_true

TopologyByExample.TwoLimitLattice.coord_true

The coordinate for the row limit is the row.

@[simp] theorem coord_true (m n : ℕ) : coord true m n = n
Proof
:= rfl

instance instTopologicalSpace

TopologyByExample.TwoLimitLattice.instTopologicalSpace

A set is open if, whenever it contains a limit, it contains every lattice point whose coordinate for that limit is large.

instance instTopologicalSpace : TopologicalSpace TwoLimitLattice
Proof
where
  IsOpen U := ∀ i, lim i ∈ U → ∃ N, ∀ m n, N ≤ coord i m n → pt m n ∈ U
  isOpen_univ := by simp
  isOpen_inter s t hs ht i hi := by
    obtain ⟨N, hN⟩ := hs i hi.1
    obtain ⟨M, hM⟩ := ht i hi.2
    exact ⟨max N M, fun m n h ↦ ⟨hN m n (le_of_max_le_left h), hM m n (le_of_max_le_right h)⟩⟩
  isOpen_sUnion S hS i := fun ⟨t, ht, hi⟩ ↦
    let ⟨N, hN⟩ := hS t ht i hi
    ⟨N, fun m n h ↦ ⟨t, ht, hN m n h⟩⟩

theorem isOpen_iff

TopologyByExample.TwoLimitLattice.isOpen_iff

The open sets of the space, by definition.

theorem isOpen_iff {U : Set TwoLimitLattice} :
    IsOpen U ↔ ∀ i, lim i ∈ U → ∃ N, ∀ m n, N ≤ coord i m n → pt m n ∈ U
Proof
:=
  Iff.rfl

definition limNhd

TopologyByExample.TwoLimitLattice.limNhd

The basic neighbourhood of lim i: the limit together with the lattice points whose coordinate for i is at least N.

def limNhd (i : Bool) (N : ℕ) : Set TwoLimitLattice
Definition
:=
  {x | match x with
    | pt m n => N ≤ coord i m n
    | lim j => j = i}

theorem pt_mem_limNhd

TopologyByExample.TwoLimitLattice.pt_mem_limNhd

The lattice points in limNhd i N are those whose coordinate for i is at least N.

@[simp] theorem pt_mem_limNhd {i : Bool} {N m n : ℕ} : pt m n ∈ limNhd i N ↔ N ≤ coord i m n
Proof
:=
  Iff.rfl

theorem lim_mem_limNhd

TopologyByExample.TwoLimitLattice.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.TwoLimitLattice.isOpen_limNhd

The basic neighbourhoods of the limits are open.

theorem isOpen_limNhd (i : Bool) (N : ℕ) : IsOpen (limNhd i N)
Proof
:= by
  intro j hj
  rw [lim_mem_limNhd] at hj
  subst hj
  exact ⟨N, fun _ _ h ↦ h⟩

theorem hasBasis_nhds_lim

TopologyByExample.TwoLimitLattice.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⟩ := hU i hiU
  refine ⟨N, trivial, fun x hx ↦ hUt ?_⟩
  cases x with
  | pt m n => exact hN m n hx
  | lim j => exact (show j = i from hx) ▸ hiU

theorem isOpen_singleton_pt

TopologyByExample.TwoLimitLattice.isOpen_singleton_pt

The lattice points are isolated.

theorem isOpen_singleton_pt (m n : ℕ) : IsOpen ({pt m n} : Set TwoLimitLattice)
Proof
:= by
  rintro i ⟨⟩

theorem nhds_pt

TopologyByExample.TwoLimitLattice.nhds_pt

The neighbourhoods of a lattice point are the sets containing it.

theorem nhds_pt (m n : ℕ) : 𝓝 (pt m n) = pure (pt m n)
Proof
:=
  isOpen_singleton_iff_nhds_eq_pure _ |>.1 (isOpen_singleton_pt m n)

instance instFirstCountableTopology

TopologyByExample.TwoLimitLattice.instFirstCountableTopology

The space is first countable.

instance instFirstCountableTopology : FirstCountableTopology TwoLimitLattice
Proof
where
  nhds_generated_countable
    | pt m n => by rw [nhds_pt]; infer_instance
    | lim i => (hasBasis_nhds_lim i).isCountablyGenerated

theorem secondCountableTopology

TopologyByExample.TwoLimitLattice.secondCountableTopology

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

theorem secondCountableTopology : SecondCountableTopology TwoLimitLattice
Proof
:= inferInstance

On this site: Lattice with two limit points is second countable

instance t1Space

TopologyByExample.TwoLimitLattice.t1Space

Points are closed: the space is T₁.

instance t1Space : T1Space TwoLimitLattice
Proof
where
  t1 x := by
    rw [← isOpen_compl_iff]
    intro i _
    cases x with
    | pt k l =>
      refine ⟨coord i k l + 1, fun m n h hmn ↦ ?_⟩
      obtain ⟨rfl, rfl⟩ := pt.inj (mem_singleton_iff.1 hmn)
      omega
    | lim j => exact ⟨0, fun m n _ h ↦ pt_ne_lim m n j h⟩

On this site: Lattice with two limit points is T₁

theorem isClopen_singleton_pt

TopologyByExample.TwoLimitLattice.isClopen_singleton_pt

A lattice point is a clopen singleton.

theorem isClopen_singleton_pt (m n : ℕ) : IsClopen ({pt m n} : Set TwoLimitLattice)
Proof
:=
  ⟨isClosed_singleton, isOpen_singleton_pt m n⟩

theorem tendsto_pt_of_tendsto_coord

TopologyByExample.TwoLimitLattice.tendsto_pt_of_tendsto_coord

A lattice point lies in the basic neighbourhood limNhd i N once its coordinate for i is at least N; so the lattice points with coord i tending to infinity converge to lim i.

theorem tendsto_pt_of_tendsto_coord {ι : Type*} {l : Filter ι} {i : Bool} {f : ι → ℕ × ℕ}
    (hf : Tendsto (fun k ↦ coord i (f k).1 (f k).2) l atTop) :
    Tendsto (fun k ↦ pt (f k).1 (f k).2) l (𝓝 (lim i))
Proof
:=
  (hasBasis_nhds_lim i).tendsto_right_iff.2 fun N _ ↦ (tendsto_atTop.1 hf N).mono fun _ h ↦ h

theorem tendsto_diag

TopologyByExample.TwoLimitLattice.tendsto_diag

The diagonal pt n n converges to both limits.

theorem tendsto_diag (i : Bool) : Tendsto (fun n ↦ pt n n) atTop (𝓝 (lim i))
Proof
:=
  tendsto_pt_of_tendsto_coord (f := fun n ↦ (n, n)) (by cases i <;> exact tendsto_id)

On this site: Lattice with two limit points: The diagonal converges to both limits

instance compactSpace

TopologyByExample.TwoLimitLattice.compactSpace

The space is compact: the lattice points on or below the diagonal converge to the column limit along the cofinite filter, and those above it to the row limit.

instance compactSpace : CompactSpace TwoLimitLattice
Proof
where
  isCompact_univ := by
    set A : Set (ℕ × ℕ) := {p | p.2 ≤ p.1}
    set B : Set (ℕ × ℕ) := {p | p.1 < p.2}
    have hA : Tendsto (fun p : A ↦ pt p.val.1 p.val.2) cofinite (𝓝 (lim false)) := by
      refine tendsto_pt_of_tendsto_coord (f := fun p : A ↦ p.val) (i := false) ?_
      refine tendsto_atTop.2 fun N ↦ ?_
      have : {p : A | ¬N ≤ p.val.1} ⊆ ((↑) : A → ℕ × ℕ) ⁻¹' (Iio N ×ˢ Iio N) := by
        rintro ⟨⟨m, n⟩, hmn⟩ h
        simp only [mem_ofPred_eq, not_le, A] at h hmn
        exact ⟨h, lt_of_le_of_lt hmn h⟩
      exact ((((finite_Iio N).prod (finite_Iio N)).preimage
        Subtype.val_injective.injOn).subset this)
    have hB : Tendsto (fun p : B ↦ pt p.val.1 p.val.2) cofinite (𝓝 (lim true)) := by
      refine tendsto_pt_of_tendsto_coord (f := fun p : B ↦ p.val) (i := true) ?_
      refine tendsto_atTop.2 fun N ↦ ?_
      have : {p : B | ¬N ≤ p.val.2} ⊆ ((↑) : B → ℕ × ℕ) ⁻¹' (Iio N ×ˢ Iio N) := by
        rintro ⟨⟨m, n⟩, hmn⟩ h
        simp only [mem_ofPred_eq, not_le, B] at h hmn
        exact ⟨lt_trans hmn h, h⟩
      exact ((((finite_Iio N).prod (finite_Iio N)).preimage
        Subtype.val_injective.injOn).subset this)
    have : (univ : Set TwoLimitLattice) =
        insert (lim false) (range fun p : A ↦ pt p.val.1 p.val.2) ∪
          insert (lim true) (range fun p : B ↦ pt p.val.1 p.val.2) := by
      ext x
      simp only [mem_univ, mem_union, mem_insert_iff, mem_range, true_iff]
      cases x with
      | pt m n =>
        rcases le_or_gt n m with h | h
        · exact Or.inl (Or.inr ⟨⟨(m, n), h⟩, rfl⟩)
        · exact Or.inr (Or.inr ⟨⟨(m, n), h⟩, rfl⟩)
      | lim i => cases i <;> simp
    rw [this]
    exact hA.isCompact_insert_range_of_cofinite.union hB.isCompact_insert_range_of_cofinite

On this site: Lattice with two limit points is compact

theorem nonempty_inter

TopologyByExample.TwoLimitLattice.nonempty_inter

Any neighbourhood of the column limit meets any neighbourhood of the row limit.

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

On this site: Lattice with two limit points: Neighbourhoods of the two limits meet

theorem not_normalSpace

TopologyByExample.TwoLimitLattice.not_normalSpace

The space is not normal: the two limits are closed points with no disjoint neighbourhoods.

theorem not_normalSpace : ¬NormalSpace TwoLimitLattice
Proof
:= fun _ ↦ by
  obtain ⟨U, V, hU, hV, hfU, htV, hUV⟩ := normal_separation (isClosed_singleton (x := lim false))
    (isClosed_singleton (x := lim true)) (by simp)
  exact (nonempty_inter (hU.mem_nhds (hfU rfl)) (hV.mem_nhds (htV rfl))).ne_empty hUV.inter_eq

On this site: Lattice with two limit points is not normal

theorem scatteredSpace

TopologyByExample.TwoLimitLattice.scatteredSpace

The space is scattered: a nonempty set contains an isolated lattice point, or else a limit, isolated in it by limNhd i 0.

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

On this site: Lattice with two limit points is scattered

theorem isRegularOpen_limNhd

TopologyByExample.TwoLimitLattice.isRegularOpen_limNhd

For N ≥ 1 the basic neighbourhood limNhd i N is regular open: it lies in the closed set obtained by adding the other limit, whose interior does not contain the other limit.

theorem isRegularOpen_limNhd (i : Bool) {N : ℕ} (hN : 1 ≤ N) : IsRegularOpen (limNhd i N)
Proof
:= by
  refine OpcSequentialFan.interior_closure_eq_of_subset (C := limNhd i N ∪ {lim (!i)})
    (isOpen_limNhd i N) ?_ subset_union_left ?_
  · rw [← isOpen_compl_iff]
    intro j hj
    refine absurd hj fun h ↦ h ?_
    cases i <;> cases j <;> simp
  · intro x hx
    obtain ⟨O, hOC, hO, hxO⟩ := mem_interior.1 hx
    cases x with
    | pt m n =>
      rcases hOC hxO with h | h
      · exact h
      · cases h
    | lim j =>
      by_cases hji : j = i
      · exact hji
      · exfalso
        obtain ⟨M, hM⟩ := hO j hxO
        -- the lattice point with coordinate `0` for `i` and `M` for `j`
        have hj : j = !i := by cases i <;> cases j <;> simp_all
        subst hj
        have key : pt (coord i 0 M) (coord i M 0) ∈ O :=
          hM _ _ (by cases i <;> simp)
        rcases hOC key with h | h
        · cases i <;> simp at h <;> omega
        · cases h

theorem semiregularSpace

TopologyByExample.TwoLimitLattice.semiregularSpace

The space is semiregular: lattice points are clopen, and each limit has a base of regular open basic neighbourhoods.

theorem semiregularSpace : SemiregularSpace TwoLimitLattice
Proof
:= by
  rw [semiregularSpace_iff_isRegularOpen]
  refine isTopologicalBasis_of_isOpen_of_nhds (fun s hs ↦ hs.isOpen) ?_
  intro a u ha hu
  cases a with
  | pt m n =>
    exact ⟨{pt m n}, IsClopen.isRegularOpen (isClopen_singleton_pt m n), rfl,
      singleton_subset_iff.2 ha⟩
  | lim i =>
    obtain ⟨N, -, hN⟩ := (hasBasis_nhds_lim i).mem_iff.1 (hu.mem_nhds ha)
    refine ⟨limNhd i (N + 1), isRegularOpen_limNhd i (by omega), rfl, fun x hx ↦ hN ?_⟩
    cases x with
    | pt m n => exact le_trans (Nat.le_succ N) hx
    | lim j => exact hx

On this site: Lattice with two limit points is semiregular