Lean library · module TopologyByExample.Spaces.GolombSpace

The Golomb space

Source file

The Golomb space (the relatively prime integer topology) is the set of positive integers with the topology whose basic open sets are the progressions {y | y ≡ b [MOD a]} with a positive and coprime to b. It is TopologyByExample.ArithProgSpace for the moduli golombModuli, all positive integers; so it is countable, second countable, Hausdorff, preconnected and not Urysohn, and has no isolated point (TopologyByExample.Spaces.ArithmeticProgression).

Main statements

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 golombModuli

TopologyByExample.golombModuli

The moduli of the Golomb space: all positive integers.

def golombModuli : ModulusSet
Definition
where
  Mem a := 0 < a
  pos h := h
  one_mem := one_pos
  lcm_mem ha hb := Nat.lcm_pos ha hb
  prime_mem hp := hp.pos

definition GolombSpace

TopologyByExample.GolombSpace

The Golomb space: the positive integers, with the progressions {y | y ≡ b [MOD a]}, a positive and coprime to b, as a base.

abbrev GolombSpace : Type
:= ArithProgSpace golombModuli

On this site: Space: Golomb space

theorem mem_closure_prog_of_dvd

TopologyByExample.GolombSpace.mem_closure_prog_of_dvd

The closure of a basic progression of modulus a contains every multiple of a.

theorem mem_closure_prog_of_dvd {a : ℕ} (ha : 0 < a) (b : GolombSpace) {x : GolombSpace}
    (hx : a ∣ x.val) : x ∈ closure (prog a b)
Proof
:=
  ArithProgSpace.mem_closure_prog_of_dvd ha b hx

On this site: Golomb space: The closure of a progression contains the multiples of its modulus

theorem closure_inter_closure_nonempty

TopologyByExample.GolombSpace.closure_inter_closure_nonempty

The closures of any two nonempty open sets meet.

theorem closure_inter_closure_nonempty (U V : Set GolombSpace) (hU : IsOpen U) (hV : IsOpen V)
    (hU' : U.Nonempty) (hV' : V.Nonempty) : (closure U ∩ closure V).Nonempty
Proof
:=
  ArithProgSpace.closure_inter_closure_nonempty U V hU hV hU' hV'

On this site: Golomb space: The closures of any two nonempty open sets meet

theorem not_t25Space

TopologyByExample.GolombSpace.not_t25Space

The space is not Urysohn.

theorem not_t25Space : ¬T25Space GolombSpace
Proof
:= ArithProgSpace.not_t25Space

On this site: The Golomb space is not Urysohn

theorem not_hasIsolatedPoint

TopologyByExample.GolombSpace.not_hasIsolatedPoint

No point is isolated.

theorem not_hasIsolatedPoint : ¬HasIsolatedPoint GolombSpace
Proof
:=
  ArithProgSpace.not_hasIsolatedPoint

On this site: The Golomb space has no isolated point

Semiregularity

theorem exists_dvd_of_prime_dvd

TopologyByExample.GolombSpace.exists_dvd_of_prime_dvd

If a prime p divides both a and x, then a has a divisor q ≥ 3 coprime to every number coprime to x, provided a is not 2 modulo 4: namely p if p is odd, and 4 if p = 2.

theorem exists_dvd_of_prime_dvd {a x p : ℕ} (h4 : a % 4 ≠ 2) (hp : p.Prime) (hpa : p ∣ a)
    (hpx : p ∣ x) : ∃ q, 3 ≤ q ∧ q ∣ a ∧ ∀ c, Nat.Coprime c x → Nat.Coprime c q
Proof
:= by
  have hcp : ∀ c, Nat.Coprime c x → Nat.Coprime c p := fun c hc ↦
    Nat.Coprime.coprime_dvd_right hpx hc
  by_cases h2 : p = 2
  · subst h2
    refine ⟨4, le_refl _ |>.trans' (by norm_num), ?_, fun c hc ↦ ?_⟩
    · obtain ⟨k, rfl⟩ := hpa
      have : k % 2 = 0 := by omega
      obtain ⟨j, rfl⟩ := Nat.dvd_of_mod_eq_zero this
      exact ⟨j, by ring⟩
    · simpa using (hcp c hc).pow_right 2
  · exact ⟨p, by have := hp.two_le; omega, hpa, hcp⟩

theorem isRegularOpen_prog

TopologyByExample.GolombSpace.isRegularOpen_prog

A basic progression whose modulus a is not 2 modulo 4 is regular open.

theorem isRegularOpen_prog {a : ℕ} (ha : 0 < a) {b : GolombSpace} (hb : Nat.Coprime a b.val)
    (h4 : a % 4 ≠ 2) : IsRegularOpen (prog a b)
Proof
:= by
  have hopen : IsOpen (prog a b) := isOpen_prog (M := golombModuli) ha hb
  refine (interior_maximal subset_closure hopen).antisymm' fun x hx ↦ ?_
  obtain ⟨c, ⟨hc, hcx⟩, hcs⟩ := (hasBasis_nhds x).mem_iff.1 (mem_interior_iff_mem_nhds.1 hx)
  -- First, `x` is coprime to `a`.
  have hax : Nat.Coprime a x.val := by
    by_contra hnot
    obtain ⟨p, hp, hpa, hpx⟩ := Nat.Prime.not_coprime_iff_dvd.1 hnot
    obtain ⟨q, hq3, hqa, hq⟩ := exists_dvd_of_prime_dvd h4 hp hpa hpx
    have hcq := hq c hcx
    -- A residue modulo `q` coprime to `q` and different from that of `b`.
    obtain ⟨r, hrq, hrb⟩ : ∃ r, Nat.Coprime q r ∧ ¬r ≡ b.val [MOD q] := by
      by_cases h1 : 1 ≡ b.val [MOD q]
      · refine ⟨q - 1, ?_, fun h ↦ ?_⟩
        · exact (Nat.coprime_self_sub_right (by omega)).2 (Nat.coprime_one_right _)
        · have h' := h.trans h1.symm
          rw [Nat.ModEq, Nat.mod_eq_of_lt (by omega), Nat.mod_eq_of_lt (by omega)] at h'
          omega
      · exact ⟨1, Nat.coprime_one_right _, h1⟩
    obtain ⟨z, hz, hzc, hzq⟩ := exists_pos_modEq_modEq (u := x.val) (v := r) hc
      (by omega : 0 < q) (by rw [hcq.gcd_eq_one]; exact Nat.modEq_one)
    have hzcl : mk z hz ∈ closure (prog a b) := hcs hzc
    have hqz : Nat.Coprime q z := (coprime_iff_of_modEq hzq).2 hrq
    obtain ⟨w, hwq, hwa⟩ := (mem_closure_iff_nhds_basis' (hasBasis_nhds _)).1 hzcl q
      ⟨(by omega : 0 < q), hqz⟩
    exact hrb ((Nat.ModEq.symm hzq).trans (hwq.symm.trans (hwa.of_dvd hqa)))
  -- Then the neighbourhood `prog a x` meets `prog a b`, so `x ≡ b [MOD a]`.
  obtain ⟨w, hwx, hwb⟩ := (mem_closure_iff_nhds_basis' (hasBasis_nhds _)).1
    (interior_subset hx) a ⟨ha, hax⟩
  exact (Nat.ModEq.symm hwx).trans hwb

On this site: Golomb space: Basic progressions whose modulus is not \(2\) modulo \(4\) are regular open

instance instSemiregularSpace

TopologyByExample.GolombSpace.instSemiregularSpace

The Golomb space is semiregular: every basic progression contains one with the same point whose modulus is not 2 modulo 4, and such progressions are regular open.

instance instSemiregularSpace : SemiregularSpace GolombSpace
Proof
:= by
  rw [semiregularSpace_iff_isRegularOpen]
  refine isTopologicalBasis_of_isOpen_of_nhds (fun _ hs ↦ IsRegularOpen.isOpen hs) ?_
  intro x u hxu hu
  obtain ⟨a, ⟨ha, hax⟩, hau⟩ := (hasBasis_nhds x).mem_iff.1 (hu.mem_nhds hxu)
  by_cases h4 : a % 4 = 2
  · have h2a : 2 ∣ a := by omega
    have h2x : Nat.Coprime 2 x.val := Nat.Coprime.coprime_dvd_left h2a hax
    have ha' : 0 < 2 * a := by have : 0 < a := ha; omega
    exact ⟨prog (2 * a) x, isRegularOpen_prog ha' (Nat.Coprime.mul_left h2x hax) (by omega),
      mem_prog_self _ _, (prog_subset_prog (dvd_mul_left a 2) x).trans hau⟩
  · exact ⟨prog a x, isRegularOpen_prog ha hax h4, mem_prog_self _ _, hau⟩

On this site: The Golomb space is semiregular

Local connectedness

definition one

TopologyByExample.GolombSpace.one

The point 1.

def one : GolombSpace
:= mk 1 one_pos

definition odds

TopologyByExample.GolombSpace.odds

The odd numbers, the basic progression {y | y ≡ 1 [MOD 2]}.

def odds : Set GolombSpace
:= prog 2 one

theorem mem_odds

TopologyByExample.GolombSpace.mem_odds

theorem mem_odds {y : GolombSpace} : y ∈ odds ↔ y.val % 2 = 1
Proof
:= by
  simp [odds, one, Nat.ModEq]

theorem isOpen_odds

TopologyByExample.GolombSpace.isOpen_odds

theorem isOpen_odds : IsOpen odds
Proof
:=
  isOpen_prog (M := golombModuli) two_pos (Nat.coprime_one_right _)

theorem coprime_two_pow_of_mem_odds

TopologyByExample.GolombSpace.coprime_two_pow_of_mem_odds

An odd number is coprime to every power of 2.

theorem coprime_two_pow_of_mem_odds {y : GolombSpace} (hy : y ∈ odds) (k : ℕ) :
    Nat.Coprime (2 ^ k) y.val
Proof
:=
  Nat.Coprime.pow_left k ((Nat.Prime.coprime_iff_not_dvd Nat.prime_two).2 (by
    rw [mem_odds] at hy; omega))

theorem subset_prog_two_pow

TopologyByExample.GolombSpace.subset_prog_two_pow

A preconnected set of odd numbers containing x lies in each residue class of x modulo a power of 2.

theorem subset_prog_two_pow {s : Set GolombSpace} (hs : IsPreconnected s) (hso : s ⊆ odds)
    {x : GolombSpace} (hx : x ∈ s) (k : ℕ) : s ⊆ prog (2 ^ k) x
Proof
:= by
  have hxo := hso hx
  refine hs.subset_left_of_subset_union (v := odds \ prog (2 ^ k) x)
    (isOpen_prog (M := golombModuli) (Nat.two_pow_pos k) (coprime_two_pow_of_mem_odds hxo k)) ?_
    disjoint_sdiff_right ?_ ⟨x, hx, mem_prog_self _ _⟩
  · intro y ⟨hyo, hyx⟩
    refine ⟨2 ^ (k + 1), Nat.two_pow_pos _, coprime_two_pow_of_mem_odds hyo _, fun z hz ↦ ⟨?_, ?_⟩⟩
    · have hz2 : z.val ≡ y.val [MOD 2] := hz.of_dvd (dvd_pow_self 2 (by omega))
      rw [mem_odds] at hyo ⊢
      rw [Nat.ModEq] at hz2
      omega
    · exact fun hzx ↦ hyx ((hz.of_dvd (pow_dvd_pow 2 (Nat.le_succ k))).symm.trans hzx)
  · intro y hy
    by_cases hyx : y ∈ prog (2 ^ k) x
    · exact Or.inl hyx
    · exact Or.inr ⟨hso hy, hyx⟩

theorem subsingleton_of_isPreconnected

TopologyByExample.GolombSpace.subsingleton_of_isPreconnected

A preconnected set of odd numbers has at most one point: two odd numbers in it are congruent modulo every power of 2.

theorem subsingleton_of_isPreconnected {s : Set GolombSpace} (hs : IsPreconnected s)
    (hso : s ⊆ odds) : s.Subsingleton
Proof
:= by
  intro x hx y hy
  rw [← val_inj]
  have h := subset_prog_two_pow hs hso hx (x.val + y.val) hy
  rw [mem_prog, Nat.ModEq] at h
  have hx' : x.val < 2 ^ (x.val + y.val) :=
    (Nat.lt_two_pow_self).trans_le (Nat.pow_le_pow_right two_pos (by omega))
  have hy' : y.val < 2 ^ (x.val + y.val) :=
    (Nat.lt_two_pow_self).trans_le (Nat.pow_le_pow_right two_pos (by omega))
  rw [Nat.mod_eq_of_lt hx', Nat.mod_eq_of_lt hy'] at h
  exact h.symm

On this site: Golomb space: Every connected set of odd numbers has at most one point

theorem not_locallyConnectedSpace

TopologyByExample.GolombSpace.not_locallyConnectedSpace

The Golomb space is not locally connected: the open set of odd numbers contains no connected open neighbourhood of 1, since such a neighbourhood would have at least two points.

theorem not_locallyConnectedSpace : ¬LocallyConnectedSpace GolombSpace
Proof
:= by
  intro h
  obtain ⟨V, hVo, hV, h1V, hVc⟩ :=
    (locallyConnectedSpace_iff_subsets_isOpen_isConnected.1 h) one odds
      (isOpen_odds.mem_nhds (mem_prog_self _ _))
  obtain ⟨a, ⟨ha, -⟩, haV⟩ := (hasBasis_nhds one).mem_iff.1 (hV.mem_nhds h1V)
  obtain ⟨y, hy, hy1⟩ := exists_ne_mem_prog (M := golombModuli) ha one
  exact hy1 (subsingleton_of_isPreconnected hVc.isPreconnected hVo (haV hy) h1V)

On this site: The Golomb space is not locally connected