Lean library · module TopologyByExample.Spaces.EitherOr

The either–or topology

Source file

The either–or topology on the interval [-1, 1] declares a set open if it does not contain 0 or it contains the whole open interval (-1, 1).

The space appears in the grid as the disjoint sum of the excluded point topology on ℝ (the open extension of the discrete ℝ) and the two-point discrete space Bool. This file proves that the two are homeomorphic: {-1}, {1} and (-1, 1) are clopen, the points of (-1, 1) other than 0 are isolated, there are continuum many of them, and the only neighbourhood of 0 in (-1, 1) is the whole interval.

Main definitions

Main statements

Tags

either–or topology, excluded point topology, disjoint sum

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 eitherOrTopology

TopologyByExample.eitherOrTopology

The either–or topology on [-1, 1]: a set is open if, as soon as it contains 0, it contains every point of the open interval (-1, 1).

@[instance_reducible]
def eitherOrTopology : TopologicalSpace (Icc (-1 : ℝ) 1)
Definition
where
  IsOpen s := (∃ x ∈ s, x.val = 0) → ∀ x : Icc (-1 : ℝ) 1, x.val ∈ Ioo (-1 : ℝ) 1 → x ∈ s
  isOpen_univ _ x _ := mem_univ x
  isOpen_inter s t hs ht := by
    rintro ⟨x, ⟨hxs, hxt⟩, hx⟩ y hy
    exact ⟨hs ⟨x, hxs, hx⟩ y hy, ht ⟨x, hxt, hx⟩ y hy⟩
  isOpen_sUnion S hS := by
    rintro ⟨x, ⟨s, hs, hxs⟩, hx⟩ y hy
    exact ⟨s, hs, hS s hs ⟨x, hxs, hx⟩ y hy⟩

theorem isOpen_eitherOrTopology_iff

TopologyByExample.isOpen_eitherOrTopology_iff

A set is open in the either–or topology if and only if it does not contain 0 or it contains every point of (-1, 1).

theorem isOpen_eitherOrTopology_iff {s : Set (Icc (-1 : ℝ) 1)} :
    IsOpen[eitherOrTopology] s ↔
      (∀ x ∈ s, x.val ≠ 0) ∨ ∀ x : Icc (-1 : ℝ) 1, x.val ∈ Ioo (-1 : ℝ) 1 → x ∈ s
Proof
:= by
  change ((∃ x ∈ s, x.val = 0) → _) ↔ _
  by_cases h : ∃ x ∈ s, x.val = 0
  · obtain ⟨x, hxs, hx⟩ := h
    exact ⟨fun H ↦ .inr (H ⟨x, hxs, hx⟩),
      fun H _ ↦ H.resolve_left fun H' ↦ H' x hxs hx⟩
  · have h' : ∀ x ∈ s, x.val ≠ 0 := fun x hxs hx ↦ h ⟨x, hxs, hx⟩
    exact ⟨fun _ ↦ .inl h', fun _ H ↦ absurd H h⟩

definition Punctured

TopologyByExample.EitherOr.Punctured

The punctured interval (-1, 1) \ {0}, as a type.

abbrev Punctured : Type
:= {x : ℝ // x ∈ Ioo (-1 : ℝ) 1 ∧ x ≠ 0}

theorem mk_punctured

TopologyByExample.EitherOr.mk_punctured

The punctured interval (-1, 1) \ {0} has the cardinality of the continuum.

theorem mk_punctured : #Punctured = 𝔠
Proof
:= by
  refine le_antisymm ?_ ?_
  · exact mk_real ▸ mk_le_of_injective (f := fun x : Punctured ↦ x.val) Subtype.val_injective
  · rw [← mk_Ioo_real (show (0 : ℝ) < 1 by norm_num)]
    refine mk_le_of_injective (f := fun x : Ioo (0 : ℝ) 1 ↦
      (⟨x.val, ⟨by linarith [x.property.1], x.property.2⟩, x.property.1.ne'⟩ : Punctured)) ?_
    intro x y h
    exact Subtype.ext (congrArg (fun p : Punctured ↦ p.val) h)

theorem nonempty_equiv_punctured

TopologyByExample.EitherOr.nonempty_equiv_punctured

There is a bijection from ℝ onto the punctured interval (-1, 1) \ {0}.

theorem nonempty_equiv_punctured : Nonempty (ℝ ≃ Punctured)
Proof
:=
  Cardinal.eq.1 (mk_real.trans mk_punctured.symm)
variable (e : ℝ ≃ Punctured)

definition toIcc

TopologyByExample.EitherOr.toIcc

The map from the sum of the excluded point topology on ℝ and the two-point set onto [-1, 1]: the excluded point goes to 0, a real number r to e r, and the two points of the second summand to -1 and 1.

def toIcc : OpenExtension (WithDiscreteTopology ℝ) ⊕ Bool → Icc (-1 : ℝ) 1
Definition
  | .inl OpenExtension.point => ⟨0, by norm_num, by norm_num⟩
  | .inl (OpenExtension.some r) =>
      ⟨(e (WithTopology.ofTopology r)).val,
        Ioo_subset_Icc_self (e (WithTopology.ofTopology r)).property.1⟩
  | .inr false => ⟨-1, le_rfl, by norm_num⟩
  | .inr true => ⟨1, by norm_num, le_rfl⟩

definition ofIcc

TopologyByExample.EitherOr.ofIcc

The inverse of toIcc e.

noncomputable def ofIcc (x : Icc (-1 : ℝ) 1) : OpenExtension (WithDiscreteTopology ℝ) ⊕ Bool
Definition
:=
  if h0 : x.val = 0 then .inl OpenExtension.point
  else if h : x.val ∈ Ioo (-1 : ℝ) 1 then
    .inl (OpenExtension.some (WithTopology.toTopology ⊥ (e.symm ⟨x.val, h, h0⟩)))
  else .inr (decide (0 < x.val))

theorem eq_neg_one_or_eq_one_of_notMem

TopologyByExample.EitherOr.eq_neg_one_or_eq_one_of_notMem

A point of [-1, 1] outside (-1, 1) is -1 or 1.

theorem eq_neg_one_or_eq_one_of_notMem {x : ℝ} (hx : x ∈ Icc (-1 : ℝ) 1)
    (h : x ∉ Ioo (-1 : ℝ) 1) : x = -1 ∨ x = 1
Proof
:= by
  rw [mem_Ioo, not_and_or, not_lt, not_lt] at h
  rcases h with h | h
  · exact .inl (le_antisymm h hx.1)
  · exact .inr (le_antisymm hx.2 h)

definition equiv

TopologyByExample.EitherOr.equiv

The bijection between the sum of the excluded point topology on ℝ and the two-point set and [-1, 1].

noncomputable def equiv : OpenExtension (WithDiscreteTopology ℝ) ⊕ Bool ≃ Icc (-1 : ℝ) 1
Definition
where
  toFun := toIcc e
  invFun := ofIcc e
  left_inv z := by
    rcases z with (_ | r) | (_ | _)
    · simp [toIcc, ofIcc]
      rfl
    · have h := (e (WithTopology.ofTopology r)).property
      simp [toIcc, ofIcc, h.1, h.2]
      rfl
    · simp [toIcc, ofIcc]
    · simp [toIcc, ofIcc]
  right_inv x := by
    by_cases h0 : x.val = 0
    · have : ofIcc e x = .inl OpenExtension.point := by simp [ofIcc, h0]
      rw [this]
      exact Subtype.ext h0.symm
    by_cases h : x.val ∈ Ioo (-1 : ℝ) 1
    · have : ofIcc e x =
          .inl (OpenExtension.some (WithTopology.toTopology ⊥ (e.symm ⟨x.val, h, h0⟩))) := by
        simp [ofIcc, h0, h]
      rw [this]
      exact Subtype.ext (by simp [toIcc])
    · rcases eq_neg_one_or_eq_one_of_notMem x.property h with hx | hx
      · have : ofIcc e x = .inr false := by simp [ofIcc, hx]
        rw [this]
        exact Subtype.ext hx.symm
      · have : ofIcc e x = .inr true := by simp [ofIcc, hx]
        rw [this]
        exact Subtype.ext hx.symm

theorem isOpen_sum_iff'

TopologyByExample.EitherOr.isOpen_sum_iff'

A set of the sum of the excluded point topology on ℝ and the two-point discrete space is open if and only if, when it contains the excluded point, it contains every point of the first summand.

theorem isOpen_sum_iff' {s : Set (OpenExtension (WithDiscreteTopology ℝ) ⊕ Bool)} :
    IsOpen s ↔ (Sum.inl OpenExtension.point ∈ s →
      ∀ r : WithDiscreteTopology ℝ, Sum.inl (OpenExtension.some r) ∈ s)
Proof
:= by
  rw [isOpen_sum_iff, OpenExtension.isOpen_iff]
  simp only [isOpen_discrete, true_and, and_true, mem_preimage, eq_univ_iff_forall]
  refine ⟨fun H hp r ↦ H hp r, fun H hp z ↦ ?_⟩
  cases z with
  | point => exact hp
  | coe r => exact H hp r

theorem isOpen_preimage_equiv_iff

TopologyByExample.EitherOr.isOpen_preimage_equiv_iff

The bijection equiv e carries the open sets of the either–or topology exactly onto those of the sum.

theorem isOpen_preimage_equiv_iff (s : Set (Icc (-1 : ℝ) 1)) :
    IsOpen (equiv e ⁻¹' s) ↔ IsOpen[eitherOrTopology] s
Proof
:= by
  rw [isOpen_sum_iff']
  change (toIcc e (.inl OpenExtension.point) ∈ s →
    ∀ r, toIcc e (.inl (OpenExtension.some r)) ∈ s) ↔ _
  constructor
  · rintro H ⟨x, hxs, hx⟩ y hy
    have h0 : toIcc e (.inl OpenExtension.point) ∈ s := by
      convert hxs
      exact Subtype.ext hx.symm
    by_cases hy0 : y.val = 0
    · convert h0
      exact Subtype.ext hy0
    · convert H h0 (WithTopology.toTopology ⊥ (e.symm ⟨y.val, hy, hy0⟩))
      exact Subtype.ext (by simp [toIcc])
  · intro H h0 r
    exact H ⟨_, h0, rfl⟩ _ (e (WithTopology.ofTopology r)).property.1

definition homeomorph

TopologyByExample.EitherOr.homeomorph

Given a bijection from ℝ onto (-1, 1) \ {0}, the sum of the excluded point topology on ℝ and the two-point discrete space is homeomorphic to the either–or topology on [-1, 1].

noncomputable def homeomorph : OpenExtension (WithDiscreteTopology ℝ) ⊕ Bool ≃ₜ
    WithTopology (Icc (-1 : ℝ) 1) eitherOrTopology
Definition
:=
  ((equiv e).trans (WithTopology.equiv _ eitherOrTopology).symm).toHomeomorph fun s ↦ by
    rw [WithTopology.isOpen_iff, ← isOpen_preimage_equiv_iff e]
    rfl

theorem nonempty_homeomorph_eitherOrTopology

TopologyByExample.nonempty_homeomorph_eitherOrTopology

The either–or topology on [-1, 1] is homeomorphic to the disjoint sum of the excluded point topology on ℝ and the two-point discrete space.

theorem nonempty_homeomorph_eitherOrTopology :
    Nonempty (OpenExtension (WithDiscreteTopology ℝ) ⊕ Bool ≃ₜ
      WithTopology (Icc (-1 : ℝ) 1) eitherOrTopology)
Proof
:=
  EitherOr.nonempty_equiv_punctured.map EitherOr.homeomorph

On this site: Either–or topology: The either–or topology on \([-1, 1]\)

On this site: Space: Either–or topology