Lean library · module TopologyByExample.Spaces.ComplementClosureIntervals

Open intervals complementary to the fourteen-set closure

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

definition gap

TopologyByExample.ComplementClosureIntervals.gap

Consecutive reciprocal points bound one component of the open complement.

def gap (n : ℕ) : Set ℝ
:= Ioo (reciprocal (n + 1)) (reciprocal n)

theorem reciprocal_strictAnti

TopologyByExample.ComplementClosureIntervals.reciprocal_strictAnti

Reciprocal points decrease strictly.

theorem reciprocal_strictAnti : StrictAnti reciprocal
Proof
:= by
  intro m n h
  unfold reciprocal
  apply one_div_lt_one_div_of_lt (by positivity)
  exact_mod_cast Nat.add_lt_add_right h 1

theorem exists_gap

TopologyByExample.ComplementClosureIntervals.exists_gap

A positive point below one, not on the reciprocal sequence, lies in a gap.

theorem exists_gap {x : ℝ} (hx : 0 < x) (h1 : x ≤ 1) (hn : x ∉ reciprocalSet) :
    ∃ n, x ∈ gap n
Proof
:= by
  have ht : Tendsto reciprocal atTop (𝓝 (0 : ℝ)) :=
    tendsto_one_div_add_atTop_nhds_zero_nat
  have he : ∃ n, reciprocal n < x := ((tendsto_order.mp ht).2 x hx).exists
  let k := Nat.find he
  have hk : reciprocal k < x := Nat.find_spec he
  have hk0 : k ≠ 0 := by
    intro h
    simp [h, reciprocal, not_lt_of_ge h1] at hk
  obtain ⟨n, hnEq⟩ := Nat.exists_eq_succ_of_ne_zero hk0
  refine ⟨n, ?_, lt_of_le_of_ne ?_ ?_⟩
  · simpa only [hnEq, Nat.succ_eq_add_one] using hk
  · exact le_of_not_gt (Nat.find_min he (by change n < k; rw [hnEq]; omega))
  · intro h
    exact hn ⟨n, h.symm⟩

definition outer

TopologyByExample.ComplementClosureIntervals.outer

The six components outside the reciprocal gaps.

def outer : Fin 6 → Set ℝ
Definition
  | 0 => Iio 0
  | 1 => Ioo 1 2
  | 2 => Ioo 4 (9 / 2)
  | 3 => Ioo (9 / 2) 5
  | 4 => Ioo 6 7
  | 5 => Ioi 8

definition component

TopologyByExample.ComplementClosureIntervals.component

The entire countable family of complementary components.

def component : ℕ ⊕ Fin 6 → Set ℝ
:= Sum.elim gap outer

theorem isOpen_component

TopologyByExample.ComplementClosureIntervals.isOpen_component

Every component is open in the real line.

theorem isOpen_component (i : ℕ ⊕ Fin 6) : IsOpen (component i)
Proof
:= by
  cases i with
  | inl n => exact isOpen_Ioo
  | inr i => fin_cases i <;> simp [component, outer, isOpen_Ioo, isOpen_Iio, isOpen_Ioi]

theorem gap_subset

TopologyByExample.ComplementClosureIntervals.gap_subset

The reciprocal gaps lie strictly between zero and one.

theorem gap_subset (n : ℕ) : gap n ⊆ Ioo (0 : ℝ) 1
Proof
:= by
  intro x hx
  exact ⟨(by have hp : 0 < reciprocal (n + 1) := by unfold reciprocal; positivity
             exact hp.trans hx.1), hx.2.trans_le (reciprocal_le_one n)⟩

theorem disjoint_gap

TopologyByExample.ComplementClosureIntervals.disjoint_gap

Distinct reciprocal gaps do not meet.

theorem disjoint_gap {m n : ℕ} (h : m ≠ n) : Disjoint (gap m) (gap n)
Proof
:= by
  wlog hmn : m < n generalizing m n
  · exact (this h.symm (lt_of_le_of_ne (le_of_not_gt hmn) h.symm)).symm
  apply Set.disjoint_left.mpr
  intro x hm hn
  have hh := reciprocal_strictAnti.antitone (Nat.succ_le_of_lt hmn)
  exact (not_lt_of_ge hh) (hm.1.trans hn.2)

theorem harmonic_bounds

TopologyByExample.ComplementClosureIntervals.harmonic_bounds

The harmonic sequence lies between zero and one.

theorem harmonic_bounds {x : ℝ} (hx : x ∈ FortSpaces.harmonicSet) : 0 ≤ x ∧ x ≤ 1
Proof
:= by
  rcases hx with hx | ⟨n, rfl⟩
  · have hx' : x = 0 := hx
    subst x
    norm_num
  · exact ⟨by positivity, reciprocal_le_one n⟩

theorem gap_avoids_harmonic

TopologyByExample.ComplementClosureIntervals.gap_avoids_harmonic

No reciprocal point belongs to a gap.

theorem gap_avoids_harmonic {n : ℕ} {x : ℝ} (hx : x ∈ gap n) :
    x ∉ FortSpaces.harmonicSet
Proof
:= by
  rintro (h0 | ⟨k, rfl⟩)
  · have h0' : x = 0 := h0
    have hp := (gap_subset n hx).1
    rw [h0'] at hp
    exact lt_irrefl _ hp
  · have h1 := reciprocal_strictAnti.lt_iff_gt.mp hx.1
    have h2 := reciprocal_strictAnti.lt_iff_gt.mp hx.2
    omega

theorem gap_subset_complement

TopologyByExample.ComplementClosureIntervals.gap_subset_complement

Each reciprocal gap avoids the entire closed set.

theorem gap_subset_complement (n : ℕ) : gap n ⊆ (closure original)ᶜ
Proof
:= by
  intro x hx hc
  rw [closure_original] at hc
  have hb := gap_subset n hx
  rcases hc with ((hh | hp) | h78) | (h24 | h56)
  · exact gap_avoids_harmonic hx hh
  · have hp' : x = 9 / 2 := hp
    linarith [hb.2]
  · linarith [hb.2, h78.1]
  · linarith [hb.2, h24.1]
  · linarith [hb.2, h56.1]

theorem outer_subset_complement

TopologyByExample.ComplementClosureIntervals.outer_subset_complement

Each of the six outer components avoids the entire closed set.

theorem outer_subset_complement (i : Fin 6) : outer i ⊆ (closure original)ᶜ
Proof
:= by
  intro x hx hc
  rw [closure_original] at hc
  rcases hc with ((hh | hp) | h78) | (h24 | h56)
  · have hb := harmonic_bounds hh
    fin_cases i <;> simp only [outer, mem_Iio, mem_Ioo, mem_Ioi] at hx <;>
      grind
  · have hp' : x = 9 / 2 := hp
    subst x
    fin_cases i <;> norm_num [outer] at hx
  · fin_cases i <;> simp only [outer, mem_Iio, mem_Ioo, mem_Ioi] at hx <;>
      grind
  · fin_cases i <;> simp only [outer, mem_Iio, mem_Ioo, mem_Ioi] at hx <;>
      grind
  · fin_cases i <;> simp only [outer, mem_Iio, mem_Ioo, mem_Ioi] at hx <;>
      grind

theorem union_components

TopologyByExample.ComplementClosureIntervals.union_components

The countable family covers exactly the complement of the closure.

theorem union_components : (⋃ i, component i) = (closure original)ᶜ
Proof
:= by
  apply subset_antisymm
  · rintro x ⟨s, ⟨i, rfl⟩, hx⟩
    cases i with
    | inl n => exact gap_subset_complement n hx
    | inr i => exact outer_subset_complement i hx
  · intro x hx
    have hn : x ∉ FortSpaces.harmonicSet := fun h ↦ hx (by
      rw [closure_original]; exact Or.inl (Or.inl (Or.inl h)))
    by_cases h0 : x < 0
    · exact mem_iUnion.mpr ⟨Sum.inr 0, h0⟩
    by_cases h1 : x ≤ 1
    · have hp : 0 < x := lt_of_le_of_ne (le_of_not_gt h0)
        (fun he ↦ hn (Or.inl he.symm))
      have hr : x ∉ reciprocalSet := fun h ↦ hn (Or.inr h)
      obtain ⟨n, hg⟩ := exists_gap hp h1 hr
      exact mem_iUnion.mpr ⟨Sum.inl n, hg⟩
    · have h24 : x ∉ Icc (2 : ℝ) 4 := fun h ↦ hx (by
        rw [closure_original]; exact Or.inr (Or.inl h))
      have h56 : x ∉ Icc (5 : ℝ) 6 := fun h ↦ hx (by
        rw [closure_original]; exact Or.inr (Or.inr h))
      have h78 : x ∉ Icc (7 : ℝ) 8 := fun h ↦ hx (by
        rw [closure_original]; exact Or.inl (Or.inr h))
      have h45 : x ≠ 9 / 2 := fun h ↦ hx (by
        rw [closure_original]; exact Or.inl (Or.inl (Or.inr h)))
      have he : x ∈ outer 1 ∨ x ∈ outer 2 ∨ x ∈ outer 3 ∨
          x ∈ outer 4 ∨ x ∈ outer 5 := by
        simp only [outer, mem_Ioo, mem_Ioi, mem_Icc] at *
        grind
      rcases he with h | h | h | h | h
      · exact mem_iUnion.mpr ⟨Sum.inr 1, h⟩
      · exact mem_iUnion.mpr ⟨Sum.inr 2, h⟩
      · exact mem_iUnion.mpr ⟨Sum.inr 3, h⟩
      · exact mem_iUnion.mpr ⟨Sum.inr 4, h⟩
      · exact mem_iUnion.mpr ⟨Sum.inr 5, h⟩

theorem disjoint_outer

TopologyByExample.ComplementClosureIntervals.disjoint_outer

Distinct outer intervals do not meet.

theorem disjoint_outer {i j : Fin 6} (h : i ≠ j) : Disjoint (outer i) (outer j)
Proof
:= by
  apply Set.disjoint_left.mpr
  intro x hx hy
  fin_cases i <;> fin_cases j <;>
    simp only [outer, mem_Iio, mem_Ioo, mem_Ioi] at * <;> grind

theorem disjoint_gap_outer

TopologyByExample.ComplementClosureIntervals.disjoint_gap_outer

A reciprocal gap does not meet an outer interval.

theorem disjoint_gap_outer (n : ℕ) (i : Fin 6) : Disjoint (gap n) (outer i)
Proof
:= by
  apply Set.disjoint_left.mpr
  intro x hx hy
  have hb := gap_subset n hx
  fin_cases i <;> simp only [outer, mem_Iio, mem_Ioo, mem_Ioi] at hy <;> grind

theorem pairwise_components

TopologyByExample.ComplementClosureIntervals.pairwise_components

The open components are pairwise disjoint.

theorem pairwise_components : Pairwise (fun i j ↦ Disjoint (component i) (component j))
Proof
:= by
  intro i j h
  cases i with
  | inl n =>
    cases j with
    | inl m => exact disjoint_gap (fun hn ↦ h (congrArg Sum.inl hn))
    | inr j => exact disjoint_gap_outer n j
  | inr i =>
    cases j with
    | inl n => exact (disjoint_gap_outer n i).symm
    | inr j => exact disjoint_outer (fun hi ↦ h (congrArg Sum.inr hi))

definition outerHomeomorph

TopologyByExample.ComplementClosureIntervals.outerHomeomorph

Each outer component is homeomorphic to the real line.

def outerHomeomorph : (i : Fin 6) → outer i ≃ₜ ℝ
Definition
  | 0 => RealRaySums.lowerReal 0
  | 1 => SeparatedRealSubsets.intervalReal 1 2 (by norm_num)
  | 2 => SeparatedRealSubsets.intervalReal 4 (9 / 2) (by norm_num)
  | 3 => SeparatedRealSubsets.intervalReal (9 / 2) 5 (by norm_num)
  | 4 => SeparatedRealSubsets.intervalReal 6 7 (by norm_num)
  | 5 => RealRaySums.upperReal 8

definition componentHomeomorph

TopologyByExample.ComplementClosureIntervals.componentHomeomorph

Each component is homeomorphic to the real line.

def componentHomeomorph (i : ℕ ⊕ Fin 6) : component i ≃ₜ ℝ
Definition
:= by
  cases i with
  | inl n => exact SeparatedRealSubsets.intervalReal _ _ (reciprocal_strictAnti (by omega))
  | inr i => exact outerHomeomorph i

definition complementSigma

TopologyByExample.ComplementClosureIntervals.complementSigma

The open complement is the topological sum of its explicit components.

def complementSigma : ↥((closure original)ᶜ) ≃ₜ Σ i, component i
Definition
:=
  (Homeomorph.setCongr union_components.symm).trans (Homeomorph.Set.iUnion
    (fun i ↦ ⟨component i, (isOpen_component i).mem_nhdsSet.mpr (subset_refl _),
      fun _ h ↦ pairwise_components h.symm⟩))

definition sigmaLines

TopologyByExample.ComplementClosureIntervals.sigmaLines

Componentwise interval homeomorphisms identify the sum with copies of the real line.

def sigmaLines : (Σ i, component i) ≃ₜ (Σ _ : ℕ ⊕ Fin 6, ℝ)
:=
  (IsHomeomorph.sigmaMap Function.bijective_id
    (fun i ↦ (componentHomeomorph i).isHomeomorph)).homeomorph _

definition sigmaProduct

TopologyByExample.ComplementClosureIntervals.sigmaProduct

A sum of copies of the real line over a discrete index is its product with that index.

def sigmaProduct {I : Type*} [TopologicalSpace I] [DiscreteTopology I] :
    (Σ _ : I, ℝ) ≃ₜ I × ℝ
Definition
:=
  (Equiv.sigmaEquivProd I ℝ).toHomeomorphOfContinuousOpen
    (continuous_sigma (fun _ ↦ continuous_const.prodMk continuous_id))
    (isOpenMap_sigma.mpr (fun i s hs ↦ by
      change IsOpen ((fun x : ℝ ↦ (i, x)) '' s)
      have he : (fun x : ℝ ↦ (i, x)) '' s = {i} ×ˢ s := by
        ext ⟨j, x⟩
        simp only [mem_image, Prod.mk.injEq, mem_prod, mem_singleton_iff]
        aesop
      rw [he]
      exact (isOpen_discrete _).prod hs))

definition complementHomeomorph

TopologyByExample.ComplementClosureIntervals.complementHomeomorph

The exact complement of the closure is a countable sum of real lines.

def complementHomeomorph : ↥((closure original)ᶜ) ≃ₜ ℝ × ℕ
Definition
:= by
  let e : (ℕ ⊕ Fin 6) ≃ ℕ := Classical.choice nonempty_equiv_of_countable
  exact complementSigma.trans (sigmaLines.trans (sigmaProduct.trans
    (((Homeomorph.ofDiscrete e).prodCongr (Homeomorph.refl ℝ)).trans
      (Homeomorph.prodComm _ _))))

On this site: Real line times the natural numbers: The complement of the fourteen-set closure is a countable sum of real lines