Lean library · module TopologyByExample.Spaces.KhalimskyLine

The Khalimsky line

Source file

The Khalimsky line (or digital line) is the set of integers ℤ with the topology generated by the singletons {2i + 1} of the odd integers and the triples {2i - 1, 2i, 2i + 1} around the even ones. It is the upper set topology of the "zigzag" partial order on ℤ in which each even integer lies below its two neighbours and there are no other relations: the smallest neighbourhood of an odd integer is itself, and that of an even integer n is {n - 1, n, n + 1}.

Choice of type

TopologyByExample.KhalimskyLine is a structure wrapping an integer toInt, so that the usual order of ℤ does not leak in. It carries the zigzag order (TopologyByExample.KhalimskyLine.le_def) and the topology Topology.upperSet, with the instance Topology.IsUpperSet.

The values

  • instAlexandrovDiscrete (by instance), instCountable;
  • preconnectedSpace: a clopen set is both an upper and a lower set, so it contains the neighbours of each of its points;
  • scatteredSpace: the order has no chain of more than two points;
  • semiregularSpace: every smallest neighbourhood is regular open;
  • paracompactSpace: the smallest neighbourhoods form a locally finite open cover;
  • locallyRelativelyCompactSpace: smallest neighbourhoods are finite, and so are their closures;
  • not_limitPointCompact: the even integers form an infinite set with no accumulation point.

Results

References

The space is π-Base's S000051 (CC BY 4.0).

Tags

Khalimsky line, digital line, Alexandrov topology, upper set topology

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

structure KhalimskyLine

TopologyByExample.KhalimskyLine

The Khalimsky line: the integers with the upper set topology of the zigzag order, in which each even integer lies below its two neighbours.

@[ext]
structure KhalimskyLine : Type where
  /-- The integer. -/
  toInt : ℤ

On this site: Space: Khalimsky line

theorem toInt_injective

TopologyByExample.KhalimskyLine.toInt_injective

A point is determined by its integer.

theorem toInt_injective : Function.Injective toInt
Proof
:= fun _ _ ↦ KhalimskyLine.ext

instance

The zigzag order: a ≤ b iff a = b, or a is even and b is one of its neighbours.

instance : PartialOrder KhalimskyLine
Proof
where
  le a b := a.toInt = b.toInt ∨
    (a.toInt % 2 = 0 ∧ (b.toInt = a.toInt + 1 ∨ b.toInt = a.toInt - 1))
  le_refl _ := Or.inl rfl
  le_trans _ _ _ := by omega
  le_antisymm a b h h' := KhalimskyLine.ext (by omega)

theorem le_def

TopologyByExample.KhalimskyLine.le_def

The zigzag order, unfolded.

theorem le_def {a b : KhalimskyLine} : a ≤ b ↔ (a.toInt = b.toInt ∨
    (a.toInt % 2 = 0 ∧ (b.toInt = a.toInt + 1 ∨ b.toInt = a.toInt - 1)))
Proof
:= Iff.rfl

theorem lt_def

TopologyByExample.KhalimskyLine.lt_def

In the zigzag order, a < b iff a is even and b is one of its neighbours.

theorem lt_def {a b : KhalimskyLine} : a < b ↔
    (a.toInt % 2 = 0 ∧ (b.toInt = a.toInt + 1 ∨ b.toInt = a.toInt - 1))
Proof
:= by
  rw [lt_iff_le_and_ne, le_def, Ne, KhalimskyLine.ext_iff]
  omega

instance

The topology whose open sets are the upper sets of the zigzag order.

instance : TopologicalSpace KhalimskyLine
Proof
:= Topology.upperSet KhalimskyLine

instance

The topology is the upper set topology of the zigzag order.

instance : Topology.IsUpperSet KhalimskyLine
Proof
:= ⟨rfl⟩

instance

The Khalimsky line is nonempty.

instance : Nonempty KhalimskyLine
Proof
:= ⟨⟨0⟩⟩

instance instCountable

TopologyByExample.KhalimskyLine.instCountable

The Khalimsky line is countable.

instance instCountable : Countable KhalimskyLine
Proof
:= toInt_injective.countable

instance instAlexandrovDiscrete

TopologyByExample.KhalimskyLine.instAlexandrovDiscrete

The Khalimsky line is Alexandrov: its open sets are the upper sets.

instance instAlexandrovDiscrete : AlexandrovDiscrete KhalimskyLine
Proof
:= inferInstance

theorem mem_Ici

TopologyByExample.KhalimskyLine.mem_Ici

The smallest neighbourhood Ici a of a: a itself, and its neighbours if a is even.

theorem mem_Ici {a b : KhalimskyLine} : b ∈ Ici a ↔ (a.toInt = b.toInt ∨
    (a.toInt % 2 = 0 ∧ (b.toInt = a.toInt + 1 ∨ b.toInt = a.toInt - 1)))
Proof
:= Iff.rfl

theorem isOpen_Ici

TopologyByExample.KhalimskyLine.isOpen_Ici

The smallest neighbourhood Ici a of a point is open.

theorem isOpen_Ici (a : KhalimskyLine) : IsOpen (Ici a)
Proof
:=
  Topology.IsUpperSet.isOpen_iff_isUpperSet.2 (IsUpperSet.Ici a)

theorem toInt_sub_le_of_mem_Ici

TopologyByExample.KhalimskyLine.toInt_sub_le_of_mem_Ici

The smallest neighbourhood of a point lies within distance one of it.

theorem toInt_sub_le_of_mem_Ici {a b : KhalimskyLine} (h : b ∈ Ici a) :
Proof
    |b.toInt - a.toInt| ≤ 1 := by
  rw [mem_Ici] at h
  rw [abs_le]
  omega

theorem finite_Ici

TopologyByExample.KhalimskyLine.finite_Ici

The smallest neighbourhood of a point is finite.

theorem finite_Ici (a : KhalimskyLine) : (Ici a).Finite
Proof
:=
  ((Set.finite_Icc (a.toInt - 1) (a.toInt + 1)).preimage toInt_injective.injOn).subset
    fun b hb ↦ by
      have := toInt_sub_le_of_mem_Ici hb
      rw [abs_le] at this
      exact ⟨by omega, by omega⟩

theorem add_one_mem_and_sub_one_mem

TopologyByExample.KhalimskyLine.add_one_mem_and_sub_one_mem

A set that is both open and closed contains the two neighbours of each of its points.

theorem add_one_mem_and_sub_one_mem {s : Set KhalimskyLine} (hs : IsClopen s) {a : KhalimskyLine}
    (ha : a ∈ s) : (⟨a.toInt + 1⟩ : KhalimskyLine) ∈ s ∧ (⟨a.toInt - 1⟩ : KhalimskyLine) ∈ s
Proof
:= by
  have hu := Topology.IsUpperSet.isOpen_iff_isUpperSet.1 hs.isOpen
  have hl := Topology.IsUpperSet.isClosed_iff_isLower.1 hs.isClosed
  rcases Int.emod_two_eq_zero_or_one a.toInt with h | h
  · exact ⟨hu (le_def.2 (Or.inr ⟨h, Or.inl rfl⟩)) ha, hu (le_def.2 (Or.inr ⟨h, Or.inr rfl⟩)) ha⟩
  · exact ⟨hl (le_def.2 (Or.inr ⟨by simp; omega, Or.inr (by simp)⟩)) ha,
      hl (le_def.2 (Or.inr ⟨by simp; omega, Or.inl (by simp)⟩)) ha⟩

theorem preconnectedSpace

TopologyByExample.KhalimskyLine.preconnectedSpace

The Khalimsky line is connected: a nonempty clopen set contains the neighbours of each of its points, so it is everything.

theorem preconnectedSpace : PreconnectedSpace KhalimskyLine
Proof
:= by
  refine preconnectedSpace_iff_clopen.2 fun s hs ↦ ?_
  rcases s.eq_empty_or_nonempty with h | ⟨a, ha⟩
  · exact Or.inl h
  refine Or.inr (eq_univ_of_forall fun b ↦ ?_)
  have key : ∀ n : ℕ,
      (⟨a.toInt + n⟩ : KhalimskyLine) ∈ s ∧ (⟨a.toInt - n⟩ : KhalimskyLine) ∈ s := by
    intro n
    induction n with
    | zero => simpa using ha
    | succ n ih =>
      refine ⟨?_, ?_⟩
      · have := (add_one_mem_and_sub_one_mem hs ih.1).1
        simpa [add_assoc] using this
      · have := (add_one_mem_and_sub_one_mem hs ih.2).2
        simpa [sub_sub] using this
  rcases le_total a.toInt b.toInt with h | h
  · have := (key (b.toInt - a.toInt).toNat).1
    rwa [Int.toNat_of_nonneg (by omega), add_sub_cancel] at this
  · have := (key (a.toInt - b.toInt).toNat).2
    rwa [Int.toNat_of_nonneg (by omega), sub_sub_cancel] at this

On this site: The Khalimsky line is connected

instance

The zigzag order has no strictly increasing sequence of more than two points.

instance : WellFoundedGT KhalimskyLine
Proof
:=
  ⟨fun a ↦ Acc.intro a fun b hab ↦ Acc.intro b fun c hbc ↦ by
    have h1 := lt_def.1 hab
    have h2 := lt_def.1 hbc
    exfalso
    omega⟩

theorem scatteredSpace

TopologyByExample.KhalimskyLine.scatteredSpace

The Khalimsky line is scattered: a maximal element of a nonempty set is isolated in it.

theorem scatteredSpace : ScatteredSpace KhalimskyLine
Proof
:= Topology.IsUpperSet.scatteredSpace

On this site: The Khalimsky line is scattered

theorem interior_closure_Ici

TopologyByExample.KhalimskyLine.interior_closure_Ici

The smallest neighbourhood of every point is regular open: the interior of its closure is itself.

theorem interior_closure_Ici (a : KhalimskyLine) : interior (closure (Ici a)) = Ici a
Proof
:= by
  refine Subset.antisymm (fun x hx ↦ ?_) (interior_maximal subset_closure (isOpen_Ici a))
  rw [mem_interior_iff_mem_nhds, Topology.IsUpperSet.nhds_eq_principal_Ici, mem_principal,
    Topology.IsUpperSet.closure_eq_lowerClosure] at hx
  have hmem : ∀ y : KhalimskyLine, x ≤ y → ∃ w : KhalimskyLine, a ≤ w ∧ y ≤ w := fun y hy ↦ by
    obtain ⟨w, hw, hyw⟩ := mem_lowerClosure.1 (hx hy)
    exact ⟨w, hw, hyw⟩
  obtain ⟨w₀, ha₀, hx₀⟩ := hmem x le_rfl
  rw [le_def] at ha₀ hx₀
  rw [mem_Ici]
  rcases Int.emod_two_eq_zero_or_one x.toInt with hxe | hxo
  · obtain ⟨w₁, ha₁, hx₁⟩ := hmem ⟨x.toInt + 1⟩ (le_def.2 (Or.inr ⟨hxe, Or.inl rfl⟩))
    obtain ⟨w₂, ha₂, hx₂⟩ := hmem ⟨x.toInt - 1⟩ (le_def.2 (Or.inr ⟨hxe, Or.inr rfl⟩))
    rw [le_def] at ha₁ hx₁ ha₂ hx₂
    simp only at hx₁ hx₂
    omega
  · omega

theorem semiregularSpace

TopologyByExample.KhalimskyLine.semiregularSpace

The Khalimsky line is semiregular: the smallest neighbourhoods, which form a base, are regular open.

theorem semiregularSpace : SemiregularSpace KhalimskyLine
Proof
:= by
  refine ⟨TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds (fun s hs ↦ ?_) ?_⟩
  · exact (show interior (closure s) = s from hs) ▸ isOpen_interior
  · intro a u hau hu
    exact ⟨Ici a, interior_closure_Ici a, self_mem_Ici,
      fun b hb ↦ Topology.IsUpperSet.isOpen_iff_isUpperSet.1 hu hb hau⟩

On this site: The Khalimsky line is semiregular

theorem paracompactSpace

TopologyByExample.KhalimskyLine.paracompactSpace

The Khalimsky line is paracompact: the smallest neighbourhoods refine every open cover, and each of them meets the smallest neighbourhoods of at most five points.

theorem paracompactSpace : ParacompactSpace KhalimskyLine
Proof
:= by
  refine ⟨fun α s hso hsU ↦ ⟨KhalimskyLine, Ici, isOpen_Ici, ?_, fun x ↦ ?_, fun b ↦ ?_⟩⟩
  · exact eq_univ_of_forall fun x ↦ mem_iUnion.2 ⟨x, self_mem_Ici⟩
  · refine ⟨Ici x, (isOpen_Ici x).mem_nhds self_mem_Ici, ?_⟩
    refine ((Set.finite_Icc (x.toInt - 2) (x.toInt + 2)).preimage
      toInt_injective.injOn).subset ?_
    rintro b ⟨y, hyb, hyx⟩
    have h1 := toInt_sub_le_of_mem_Ici hyb
    have h2 := toInt_sub_le_of_mem_Ici hyx
    rw [abs_le] at h1 h2
    exact ⟨by omega, by omega⟩
  · obtain ⟨i, hi⟩ := mem_iUnion.1 (hsU ▸ mem_univ b)
    exact ⟨i, fun y hy ↦ Topology.IsUpperSet.isOpen_iff_isUpperSet.1 (hso i) hy hi⟩

On this site: The Khalimsky line is paracompact

theorem closure_Ici_subset

TopologyByExample.KhalimskyLine.closure_Ici_subset

The closure of the smallest neighbourhood of a point lies within distance two of it.

theorem closure_Ici_subset (a : KhalimskyLine) :
    closure (Ici a) ⊆ toInt ⁻¹' Icc (a.toInt - 2) (a.toInt + 2)
Proof
:= by
  rw [Topology.IsUpperSet.closure_eq_lowerClosure]
  intro b hb
  obtain ⟨w, hw, hbw⟩ := mem_lowerClosure.1 hb
  have h1 := toInt_sub_le_of_mem_Ici hw
  rw [abs_le] at h1
  rw [le_def] at hbw
  exact ⟨by omega, by omega⟩

theorem locallyRelativelyCompactSpace

TopologyByExample.KhalimskyLine.locallyRelativelyCompactSpace

The Khalimsky line is locally relatively compact: the smallest neighbourhood of a point has a finite closure.

theorem locallyRelativelyCompactSpace : LocallyRelativelyCompactSpace KhalimskyLine
Proof
:=
  ⟨fun a ↦ ⟨Ici a, isOpen_Ici a, self_mem_Ici,
    (((Set.finite_Icc (a.toInt - 2) (a.toInt + 2)).preimage toInt_injective.injOn).subset
      (closure_Ici_subset a)).isCompact⟩⟩

On this site: The Khalimsky line is locally relatively compact

theorem infinite_setOf_even

TopologyByExample.KhalimskyLine.infinite_setOf_even

The even integers form an infinite set.

theorem infinite_setOf_even : {a : KhalimskyLine | a.toInt % 2 = 0}.Infinite
Proof
:=
  infinite_of_injective_forall_mem (f := fun n : ℕ ↦ (⟨2 * (n : ℤ)⟩ : KhalimskyLine))
    (fun m n h ↦ by have := congrArg toInt h; simp at this; omega)
    fun n ↦ show 2 * (n : ℤ) % 2 = 0 by omega

theorem not_limitPointCompact

TopologyByExample.KhalimskyLine.not_limitPointCompact

The Khalimsky line is not limit point compact: the even integers form an infinite set with no accumulation point, since the smallest neighbourhood of any point contains at most one even integer.

theorem not_limitPointCompact :
    ¬∀ s : Set KhalimskyLine, s.Infinite → ∃ x, AccPt x (𝓟 s)
Proof
:= fun h ↦ by
  obtain ⟨x, hx⟩ := h _ infinite_setOf_even
  obtain ⟨y, ⟨hy, hye⟩, hyx⟩ := accPt_iff_nhds.1 hx (Ici x) ((isOpen_Ici x).mem_nhds self_mem_Ici)
  rw [mem_Ici] at hy
  simp only [mem_ofPred_eq] at hye
  exact hyx (KhalimskyLine.ext (by omega))

On this site: The Khalimsky line is not limit point compact

theorem not_isPreconnected_compl_singleton

TopologyByExample.KhalimskyLine.not_isPreconnected_compl_singleton

Every point of the Khalimsky line is a cut point: removing it leaves a space that is not connected.

theorem not_isPreconnected_compl_singleton (x : KhalimskyLine) :
    ¬IsPreconnected ({x}ᶜ : Set KhalimskyLine)
Proof
:= by
  intro h
  have hne : ∀ n : ℤ, n ≠ 0 → (⟨x.toInt + n⟩ : KhalimskyLine) ∈ ({x}ᶜ : Set KhalimskyLine) :=
    fun n hn he ↦ hn (by have := congrArg toInt he; simpa using this)
  obtain ⟨z, hz, hzu, hzv⟩ := h {a | a.toInt < x.toInt + x.toInt % 2}
    {a | x.toInt - x.toInt % 2 < a.toInt}
    (Topology.IsUpperSet.isOpen_iff_isUpperSet.2 fun a b hab ha ↦ by
      rw [le_def] at hab
      simp only [mem_ofPred_eq] at ha ⊢
      omega)
    (Topology.IsUpperSet.isOpen_iff_isUpperSet.2 fun a b hab ha ↦ by
      rw [le_def] at hab
      simp only [mem_ofPred_eq] at ha ⊢
      omega)
    (fun y hy ↦ by
      have : y.toInt ≠ x.toInt := fun he ↦ hy (KhalimskyLine.ext he)
      simp only [mem_union, mem_ofPred_eq]
      omega)
    ⟨_, hne (-1) (by norm_num), show x.toInt + -1 < x.toInt + x.toInt % 2 by omega⟩
    ⟨_, hne 1 (by norm_num), show x.toInt - x.toInt % 2 < x.toInt + 1 by omega⟩
  have : z.toInt ≠ x.toInt := fun he ↦ hz (KhalimskyLine.ext he)
  simp only [mem_ofPred_eq] at hzu hzv
  omega

On this site: Khalimsky line: Every point is a cut point