Lean library · module TopologyByExample.Theorems.ArithmeticProgressionBiconnected

Connected partitions of arithmetic progression spaces

Source file

This file was written by Codex (OpenAI's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.

Imports
variable {M : ModulusSet}

theorem isPreconnected_of_meets_progressions

TopologyByExample.ArithProgSpace.isPreconnected_of_meets_progressions

Every set meeting every residue class for every positive modulus is preconnected.

theorem isPreconnected_of_meets_progressions {s : Set (ArithProgSpace M)}
    (hs : ∀ a : ℕ, 0 < a → ∀ b : ArithProgSpace M, (prog a b ∩ s).Nonempty) :
    IsPreconnected s
Proof
:= by
  have hd : Dense s := dense_iff_inter_open.mpr fun U hU ⟨x, hx⟩ ↦ by
    obtain ⟨a, ha, -, has⟩ := hU x hx
    exact (hs a (M.pos ha) x).mono (inter_subset_inter_left _ has)
  have hcl {U : Set (ArithProgSpace M)} (hU : IsOpen U) :
      closure U ⊆ closure (U ∩ s) := by
    apply closure_minimal _ isClosed_closure
    intro x hx
    exact hU.inter_closure ⟨hx, hd x⟩
  apply isPreconnected_iff_preconnectedSpace.mpr
  apply preconnectedSpace_of_closure_inter_closure
  intro u v hu hv ⟨x, hx⟩ ⟨y, hy⟩
  obtain ⟨U, hU, rfl⟩ := isOpen_induced_iff.mp hu
  obtain ⟨V, hV, rfl⟩ := isOpen_induced_iff.mp hv
  obtain ⟨a, ha, -, haU⟩ := hU x.val hx
  obtain ⟨b, hb, -, hbV⟩ := hV y.val hy
  have hab := Nat.mul_pos (M.pos ha) (M.pos hb)
  obtain ⟨z, hz, hzs⟩ := hs (a * b) hab (mk _ hab)
  have hz₀ : a * b ∣ z.val := by
    simpa [mem_prog, Nat.ModEq, Nat.dvd_iff_mod_eq_zero] using hz
  refine ⟨⟨z, hzs⟩, ?_⟩
  have hr : range (Subtype.val : s → ArithProgSpace M) = s := Subtype.range_coe
  simp only [mem_inter_iff, closure_subtype, image_preimage_eq_inter_range, hr]
  exact ⟨hcl hU (closure_mono haU (mem_closure_prog_of_dvd (M.pos ha) _
    ((dvd_mul_right a b).trans hz₀))), hcl hV (closure_mono hbV (mem_closure_prog_of_dvd
      (M.pos hb) _ ((dvd_mul_left b a).trans hz₀)))⟩

On this site: Golomb space: A set meeting every residue class is connected

definition squareBlocks

TopologyByExample.ArithProgSpace.squareBlocks

The initial portion of each block between consecutive squares.

def squareBlocks (M : ModulusSet) : Set (ArithProgSpace M)
:=
  {x | ∃ n : ℕ, n ^ 2 ≤ x.val ∧ x.val < n ^ 2 + n}

theorem meets_squareBlocks_and_compl

TopologyByExample.ArithProgSpace.meets_squareBlocks_and_compl

private theorem meets_squareBlocks_and_compl (a : ℕ) (ha : 0 < a) (b : ArithProgSpace M) :
    (prog a b ∩ squareBlocks M).Nonempty ∧ (prog a b ∩ (squareBlocks M)ᶜ).Nonempty
Proof
:= by
  let n := a * (b.val + 1)
  have hbn : b.val < n := by
    have h := Nat.le_mul_of_pos_left (b.val + 1) ha
    omega
  have hb := b.val_pos
  have hn : n ≡ 0 [MOD a] := by simp [n, Nat.ModEq]
  have hn₂ : n ^ 2 ≡ 0 [MOD a] := by simpa using hn.pow 2
  refine ⟨⟨mk (n ^ 2 + b.val) (by positivity), ?_, n, by simp, ?_⟩,
    ⟨mk (n ^ 2 + n + b.val) (by positivity), ?_, ?_⟩⟩
  · simpa using hn₂.add_right b.val
  · simpa using hbn
  · simpa using (hn₂.add hn).add_right b.val
  · rintro ⟨m, h₁, h₂⟩
    simp only [val_mk] at h₁ h₂
    rcases le_or_gt m n with hm | hm
    · have : m ^ 2 + m ≤ n ^ 2 + n := by gcongr
      omega
    · have : (n + 1) ^ 2 ≤ m ^ 2 := by gcongr; omega
      nlinarith

theorem not_subsingleton_of_meets_progressions

TopologyByExample.ArithProgSpace.not_subsingleton_of_meets_progressions

private theorem not_subsingleton_of_meets_progressions {s : Set (ArithProgSpace M)}
    (hs : ∀ a : ℕ, 0 < a → ∀ b : ArithProgSpace M, (prog a b ∩ s).Nonempty) :
    ¬ s.Subsingleton
Proof
:= by
  obtain ⟨x, hx, hxs⟩ := hs 2 two_pos (mk 1 one_pos)
  obtain ⟨y, hy, hys⟩ := hs 2 two_pos (mk 2 two_pos)
  intro h
  rw [h hxs hys] at hx
  have := (Nat.ModEq.symm hx).trans hy
  norm_num [Nat.ModEq] at this

theorem not_biconnected

TopologyByExample.ArithProgSpace.not_biconnected

Splitting each block between consecutive squares gives a partition into two nondegenerate connected sets.

theorem not_biconnected (M : ModulusSet) : ¬ BiconnectedSpace (ArithProgSpace M)
Proof
:= by
  intro _
  have h₁ := fun a ha (b : ArithProgSpace M) ↦ (meets_squareBlocks_and_compl a ha b).1
  have h₂ := fun a ha (b : ArithProgSpace M) ↦ (meets_squareBlocks_and_compl a ha b).2
  exact (BiconnectedSpace.subsingleton_or_subsingleton (isPreconnected_of_meets_progressions h₁)
    (isPreconnected_of_meets_progressions h₂) disjoint_compl_right).elim
    (not_subsingleton_of_meets_progressions h₁) (not_subsingleton_of_meets_progressions h₂)

theorem TopologyByExample.GolombSpace.not_biconnected

The Golomb space is not biconnected.

theorem TopologyByExample.GolombSpace.not_biconnected : ¬ BiconnectedSpace GolombSpace
Proof
:=
  ArithProgSpace.not_biconnected golombModuli

On this site: The Golomb space is not biconnected