Lean library · module TopologyByExample.Spaces.KirchSpace
The Kirch space
The Kirch space (the prime integer topology) is the set of positive integers with the topology
generated by the progressions {y | y ≡ b [MOD p]} with p prime not dividing b. Its basic open
sets are the progressions {y | y ≡ b [MOD a]} with a squarefree and coprime to b. It is
TopologyByExample.ArithProgSpace for the moduli kirchModuli, the squarefree positive integers;
so it is countable, second countable, Hausdorff, preconnected and not Urysohn, and has no isolated
point (TopologyByExample.Spaces.ArithmeticProgression).
Main statements
TopologyByExample.KirchSpace.topology_eq_generateFrom: the topology is generated by the progressions modulo primes.TopologyByExample.KirchSpace.isPreconnected_prog: every progression with a squarefree modulus, in particular every basic one, is preconnected (Kirch's theorem).TopologyByExample.KirchSpace.instLocallyConnectedSpace: the space is locally connected.TopologyByExample.KirchSpace.not_semiregularSpace: the space is not semiregular.
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.
theorem squarefree_lcm
TopologyByExample.squarefree_lcm
The least common multiple of two squarefree numbers is squarefree.
theorem squarefree_lcm {a b : ℕ} (ha : Squarefree a) (hb : Squarefree b) :
Squarefree (Nat.lcm a b)
Proof
:= by
rw [Nat.squarefree_iff_factorization_le_one (Nat.lcm_ne_zero ha.ne_zero hb.ne_zero),
Nat.factorization_lcm ha.ne_zero hb.ne_zero]
intro p
simp only [Finsupp.sup_apply, sup_le_iff]
exact ⟨(Nat.squarefree_iff_factorization_le_one ha.ne_zero).1 ha p,
(Nat.squarefree_iff_factorization_le_one hb.ne_zero).1 hb p⟩
theorem coprime_div_gcd_of_squarefree
TopologyByExample.coprime_div_gcd_of_squarefree
For squarefree m, the part m / gcd m a of m is coprime to a.
theorem coprime_div_gcd_of_squarefree {m : ℕ} (hm : Squarefree m) (a : ℕ) :
Nat.Coprime (m / Nat.gcd m a) a
Proof
:= by
refine Nat.coprime_of_dvd fun p hp hpc hpa ↦ ?_
have hg : Nat.gcd m a ∣ m := Nat.gcd_dvd_left m a
have hpm : p ∣ m := hpc.trans (Nat.div_dvd_of_dvd hg)
have hpg : p ∣ Nat.gcd m a := Nat.dvd_gcd hpm hpa
have : p * p ∣ m := by
have h := Nat.mul_dvd_mul hpg hpc
rwa [Nat.mul_div_cancel' hg] at h
exact (Nat.squarefree_iff_prime_squarefree.1 hm p hp) this
definition kirchModuli
TopologyByExample.kirchModuli
The moduli of the Kirch space: the squarefree positive integers.
def kirchModuli : ModulusSet
Definition
where
Mem := Squarefree
pos h := Nat.pos_of_ne_zero h.ne_zero
one_mem := squarefree_one
lcm_mem := squarefree_lcm
prime_mem hp := hp.prime.squarefree
definition KirchSpace
TopologyByExample.KirchSpace
The Kirch space: the positive integers, with the progressions {y | y ≡ b [MOD a]}, a
squarefree and coprime to b, as a base.
abbrev KirchSpace : Type
:= ArithProgSpace kirchModuli
On this site: Space: Kirch space
theorem mem_closure_prog_of_dvd
TopologyByExample.KirchSpace.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 : KirchSpace) {x : KirchSpace}
(hx : a ∣ x.val) : x ∈ closure (prog a b)
Proof
:=
ArithProgSpace.mem_closure_prog_of_dvd ha b hx
On this site: Kirch space: The closure of a progression contains the multiples of its modulus
theorem closure_inter_closure_nonempty
TopologyByExample.KirchSpace.closure_inter_closure_nonempty
The closures of any two nonempty open sets meet.
theorem closure_inter_closure_nonempty (U V : Set KirchSpace) (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: Kirch space: The closures of any two nonempty open sets meet
theorem not_t25Space
TopologyByExample.KirchSpace.not_t25Space
The space is not Urysohn.
theorem not_t25Space : ¬T25Space KirchSpace
Proof
:= ArithProgSpace.not_t25Space
On this site: The Kirch space is not Urysohn
theorem not_hasIsolatedPoint
TopologyByExample.KirchSpace.not_hasIsolatedPoint
No point is isolated.
theorem not_hasIsolatedPoint : ¬HasIsolatedPoint KirchSpace
Proof
:=
ArithProgSpace.not_hasIsolatedPoint
On this site: The Kirch space has no isolated point
The prime subbasis
theorem modEq_iff_forall_primeFactors
TopologyByExample.KirchSpace.modEq_iff_forall_primeFactors
For squarefree a, two numbers are congruent modulo a if and only if they are congruent
modulo every prime factor of a.
theorem modEq_iff_forall_primeFactors {a y x : ℕ} (ha : Squarefree a) :
y ≡ x [MOD a] ↔ ∀ p ∈ a.primeFactors, y ≡ x [MOD p]
Proof
:= by
refine ⟨fun h p hp ↦ h.of_dvd (Nat.dvd_of_mem_primeFactors hp), fun h ↦ ?_⟩
simp only [Nat.modEq_iff_dvd] at h ⊢
have hprod : ((∏ p ∈ a.primeFactors, p : ℕ) : ℤ) ∣ (x : ℤ) - y := by
push_cast
refine Finset.prod_dvd_of_coprime (fun p hp q hq hpq ↦ ?_) h
exact Nat.isCoprime_iff_coprime.2 ((Nat.coprime_primes (Nat.prime_of_mem_primeFactors hp)
(Nat.prime_of_mem_primeFactors hq)).2 hpq)
rwa [Nat.prod_primeFactors_of_squarefree ha] at hprod
theorem prog_eq_biInter
TopologyByExample.KirchSpace.prog_eq_biInter
A basic progression is the intersection of the progressions modulo the prime factors of its modulus.
theorem prog_eq_biInter {a : ℕ} (ha : Squarefree a) (x : KirchSpace) :
prog a x = ⋂ p ∈ a.primeFactors, prog p x
Proof
:= by
ext y
simp only [mem_prog, mem_iInter]
exact modEq_iff_forall_primeFactors ha
theorem topology_eq_generateFrom
TopologyByExample.KirchSpace.topology_eq_generateFrom
The topology of the Kirch space is generated by the progressions prog p b with p a prime
not dividing b.
theorem topology_eq_generateFrom :
(inferInstance : TopologicalSpace KirchSpace) =
generateFrom {s | ∃ p, ∃ b : KirchSpace, p.Prime ∧ ¬p ∣ b.val ∧ s = prog p b}
Proof
:= by
refine le_antisymm (le_generateFrom ?_) ?_
· rintro _ ⟨p, b, hp, hpb, rfl⟩
exact isOpen_prog (M := kirchModuli) hp.prime.squarefree
((Nat.Prime.coprime_iff_not_dvd hp).2 hpb)
· rw [TopologicalSpace.le_def]
intro U hU
obtain hU : ∀ x ∈ U, ∃ a, Squarefree a ∧ Nat.Coprime a x.val ∧ prog a x ⊆ U := hU
let _ : TopologicalSpace KirchSpace :=
generateFrom {s | ∃ p, ∃ b : KirchSpace, p.Prime ∧ ¬p ∣ b.val ∧ s = prog p b}
refine isOpen_iff_forall_mem_open.2 fun x hx ↦ ?_
obtain ⟨a, ha, hax, haU⟩ := hU x hx
refine ⟨prog a x, haU, ?_, mem_prog_self _ _⟩
rw [prog_eq_biInter ha]
refine isOpen_biInter_finset fun p hp ↦ isOpen_generateFrom_of_mem
⟨p, x, Nat.prime_of_mem_primeFactors hp, ?_, rfl⟩
exact (Nat.Prime.coprime_iff_not_dvd (Nat.prime_of_mem_primeFactors hp)).1
(hax.coprime_dvd_left (Nat.dvd_of_mem_primeFactors hp))
On this site: Kirch space: The progressions modulo primes generate the topology
Local connectedness
theorem prog_inter_nonempty
TopologyByExample.KirchSpace.prog_inter_nonempty
The key step of Kirch's theorem. Let s' be a point of the progression prog a b with a
neighbourhood prog n s' ⊆ v, and let r be a point of prog a b lying in an open set u and
divisible by n / gcd n a. Then prog a b meets u ∩ v.
theorem prog_inter_nonempty {a : ℕ} (ha : Squarefree a) {b : KirchSpace} {u v : Set KirchSpace}
(hu : IsOpen u) {s' r : KirchSpace} {n : ℕ} (hn : Squarefree n) (hs' : s' ∈ prog a b)
(hnv : prog n s' ⊆ v) (hr : r ∈ prog a b) (hru : r ∈ u) (hdr : n / Nat.gcd n a ∣ r.val) :
(prog a b ∩ (u ∩ v)).Nonempty
Proof
:= by
obtain ⟨k, hk, hkr, hku⟩ := hu r hru
set d := n / Nat.gcd n a
have hlcm : Nat.lcm a n = a * d := by
rw [Nat.lcm, Nat.mul_div_assoc a (Nat.gcd_dvd_right a n), Nat.gcd_comm]
have hdk : Nat.Coprime d k := (Nat.Coprime.coprime_dvd_right hdr hkr).symm
have hgcd : Nat.gcd (Nat.lcm a n) k = Nat.gcd a k := by
rw [hlcm]
exact Nat.Coprime.gcd_mul_right_cancel a hdk
have hpos : 0 < Nat.lcm a n := Nat.lcm_pos (kirchModuli.pos ha) (kirchModuli.pos hn)
obtain ⟨z, hz, hzl, hzk⟩ := exists_pos_modEq_modEq (u := s'.val) (v := r.val) hpos
(kirchModuli.pos hk) (by
rw [hgcd]
exact (hs'.trans hr.symm).of_dvd (Nat.gcd_dvd_left a k))
have hza : z ≡ s'.val [MOD a] := hzl.of_dvd (Nat.dvd_lcm_left a n)
have hzn : z ≡ s'.val [MOD n] := hzl.of_dvd (Nat.dvd_lcm_right a n)
exact ⟨mk z hz, hza.trans hs', hku hzk, hnv hzn⟩
theorem isPreconnected_prog
TopologyByExample.KirchSpace.isPreconnected_prog
Kirch's theorem. Every progression prog a b with a squarefree is preconnected; in
particular every basic progression of the Kirch space is preconnected.
theorem isPreconnected_prog {a : ℕ} (ha : Squarefree a) (b : KirchSpace) :
IsPreconnected (prog a b)
Proof
:= by
intro u v hu hv hsub ⟨t, hts, htu⟩ ⟨s', hss, hsv⟩
obtain ⟨m, hm, -, hmu⟩ := hu t htu
obtain ⟨n, hn, -, hnv⟩ := hv s' hsv
set c := m / Nat.gcd m a
set d := n / Nat.gcd n a
have hca : Nat.Coprime (c * d) a :=
Nat.Coprime.mul_left (coprime_div_gcd_of_squarefree hm a) (coprime_div_gcd_of_squarefree hn a)
have hcpos : 0 < c :=
Nat.div_pos (Nat.gcd_le_left a (kirchModuli.pos hm)) (Nat.gcd_pos_of_pos_left a
(kirchModuli.pos hm))
have hdpos : 0 < d :=
Nat.div_pos (Nat.gcd_le_left a (kirchModuli.pos hn)) (Nat.gcd_pos_of_pos_left a
(kirchModuli.pos hn))
obtain ⟨r, hr, hrcd, hra⟩ := exists_pos_modEq_modEq (u := 0) (v := b.val)
(Nat.mul_pos hcpos hdpos) (kirchModuli.pos ha) (by rw [hca.gcd_eq_one]; exact Nat.modEq_one)
have hcd : c * d ∣ r := (Nat.modEq_zero_iff_dvd.1 hrcd)
set R : KirchSpace := mk r hr
have hR : R ∈ prog a b := hra
rcases hsub hR with hRu | hRv
· exact prog_inter_nonempty ha hu hn hss hnv hR hRu ((dvd_mul_left d c).trans hcd)
· obtain ⟨w, hw, hwv, hwu⟩ :=
prog_inter_nonempty ha hv hm hts hmu hR hRv ((dvd_mul_right c d).trans hcd)
exact ⟨w, hw, hwu, hwv⟩
On this site: Kirch space: Every progression with a squarefree modulus is connected
instance instLocallyConnectedSpace
TopologyByExample.KirchSpace.instLocallyConnectedSpace
The Kirch space is locally connected: its basic progressions are connected.
instance instLocallyConnectedSpace : LocallyConnectedSpace KirchSpace
Proof
:=
locallyConnectedSpace_of_connected_bases (fun x a ↦ prog a x)
(fun x a ↦ Squarefree a ∧ Nat.Coprime a x.val) hasBasis_nhds
fun x _ h ↦ isPreconnected_prog h.1 x
On this site: The Kirch space is locally connected
Semiregularity
definition one
TopologyByExample.KirchSpace.one
The point 1.
def one : KirchSpace
:= mk 1 one_pos
theorem prog_subset_closure_prog_two_mul
TopologyByExample.KirchSpace.prog_subset_closure_prog_two_mul
If t is odd, every point of prog t 1 lies in the closure of prog (2 * t) 1.
theorem prog_subset_closure_prog_two_mul {t : ℕ} (ht : 0 < t) (hodd : Nat.Coprime t 2) :
prog t one ⊆ closure (prog (2 * t) one)
Proof
:= by
intro y hy
refine (mem_closure_iff_nhds_basis' (hasBasis_nhds y)).2 fun k ⟨hk, hky⟩ ↦ ?_
have hcompat : y.val ≡ 1 [MOD Nat.gcd k (2 * t)] := by
by_cases hy2 : y.val % 2 = 1
· have h2t : y.val ≡ 1 [MOD 2 * t] :=
(Nat.modEq_and_modEq_iff_modEq_mul hodd.symm).1 ⟨hy2, hy⟩
exact h2t.of_dvd (Nat.gcd_dvd_right _ _)
· have hk2 : Nat.Coprime k 2 :=
(Nat.Coprime.coprime_dvd_right (Nat.dvd_of_mod_eq_zero (by omega)) hky)
rw [Nat.Coprime.gcd_mul_left_cancel_right t hk2.symm]
exact hy.of_dvd (Nat.gcd_dvd_right _ _)
obtain ⟨z, hz, hzk, hzt⟩ := exists_pos_modEq_modEq (u := y.val) (v := 1) (kirchModuli.pos hk)
(by omega) hcompat
exact ⟨mk z hz, hzk, hzt⟩
theorem not_semiregularSpace
TopologyByExample.KirchSpace.not_semiregularSpace
The Kirch space is not semiregular: no regular open set V satisfies
1 ∈ V ⊆ prog 2 1. Such a V contains some prog (2 * t) 1 with t odd, so the interior of
its closure contains the open set prog t 1, which has an even point 1 + t.
theorem not_semiregularSpace : ¬SemiregularSpace KirchSpace
Proof
:= by
intro h
rw [semiregularSpace_iff_isRegularOpen] at h
obtain ⟨V, hV, h1V, hV2⟩ := h.exists_subset_of_mem_open (mem_prog_self 2 one)
(isOpen_prog (M := kirchModuli) (Nat.prime_two.prime.squarefree) (Nat.coprime_one_right _))
obtain ⟨s, ⟨hs, -⟩, hsV⟩ := (hasBasis_nhds one).mem_iff.1 (hV.isOpen.mem_nhds h1V)
set t := s / Nat.gcd s 2
have hodd : Nat.Coprime t 2 := coprime_div_gcd_of_squarefree hs 2
have htpos : 0 < t := Nat.div_pos (Nat.gcd_le_left 2 (kirchModuli.pos hs))
(Nat.gcd_pos_of_pos_left 2 (kirchModuli.pos hs))
have hst : s ∣ 2 * t := by
have h' : s = Nat.gcd s 2 * t := (Nat.mul_div_cancel' (Nat.gcd_dvd_left s 2)).symm
rw [h']
exact Nat.mul_dvd_mul_right (Nat.gcd_dvd_right s 2) t
have htsq : Squarefree t := hs.squarefree_of_dvd (Nat.div_dvd_of_dvd (Nat.gcd_dvd_left s 2))
have hsub : prog t one ⊆ V := by
rw [← isRegularOpen_iff.1 hV]
refine interior_maximal ?_ (isOpen_prog (M := kirchModuli) htsq (Nat.coprime_one_right _))
exact (prog_subset_closure_prog_two_mul htpos hodd).trans
(closure_mono ((prog_subset_prog hst one).trans hsV))
have hmem : (mk (1 + t) (by omega) : KirchSpace) ∈ prog t one := by
simp [one, Nat.ModEq]
have h2 := hV2 (hsub hmem)
have ht2 : t % 2 = 1 := Nat.odd_iff.1 (Nat.coprime_two_right.1 hodd)
simp [one, Nat.ModEq] at h2
omega
On this site: The Kirch space is not semiregular