Lean library · module TopologyByExample.Spaces.CombSpace

The comb space

Source file

The comb space is the subset of the plane made of the base [0, 1] × {0}, the teeth {1 / (n + 1)} × [0, 1] for n : ℕ, and the limit tooth {0} × [0, 1], with the subspace topology. It is compact (closed and bounded) and metrizable.

Every point is joined to the origin by going down its tooth and along the base, so the comb is path connected. It is not locally connected at the points of the limit tooth above the base: near (0, 1) the comb consists of pieces of infinitely many teeth, and a connected set near (0, 1) cannot leave the limit tooth, because its projection to the first coordinate is a connected subset of the countable set {0} ∪ {1 / (n + 1)} and hence a point. So it is not locally path connected either, and being connected with more than one point it is not totally disconnected, not totally separated and not zero-dimensional. It is contractible: push everything down the teeth, then slide the base to the origin.

The deleted comb keeps only the point (0, 1) of the limit tooth (and the origin, which lies on the base). It is connected, being squeezed between the path connected union of the base and the teeth {1 / (n + 1)} × [0, 1] and its closure, but not path connected: the same projection argument shows that the set of times a path spends at (0, 1) is open as well as closed.

Main definitions

Main statements

Tags

comb space, deleted comb, path connected, locally connected, contractible

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 teeth

TopologyByExample.CombSpace.teeth

The abscissae of the teeth of the comb: 0 and the numbers 1 / (n + 1) for n : ℕ.

noncomputable def teeth : Set ℝ
:= insert 0 (range fun n : ℕ ↦ 1 / ((n : ℝ) + 1))

definition combOf

TopologyByExample.CombSpace.combOf

The comb with teeth over a set T of abscissae: the base [0, 1] × {0} together with the teeth {a} × [0, 1] for a ∈ T.

def combOf (T : Set ℝ) : Set (ℝ × ℝ)
:= Icc (0 : ℝ) 1 ×ˢ ({0} : Set ℝ) ∪ T ×ˢ Icc (0 : ℝ) 1

definition comb

TopologyByExample.CombSpace.comb

The comb: the base [0, 1] × {0} together with the teeth {a} × [0, 1] for a ∈ teeth.

noncomputable def comb : Set (ℝ × ℝ)
:= combOf teeth

theorem one_div_succ_mem_Icc

TopologyByExample.CombSpace.one_div_succ_mem_Icc

The abscissa 1 / (n + 1) lies in [0, 1].

theorem one_div_succ_mem_Icc (n : ℕ) : 1 / ((n : ℝ) + 1) ∈ Icc (0 : ℝ) 1
Proof
:=
  ⟨by positivity, (div_le_one (by positivity)).2 (by linarith [(n.cast_nonneg : (0 : ℝ) ≤ n)])⟩

theorem one_div_succ_ne_zero

TopologyByExample.CombSpace.one_div_succ_ne_zero

The abscissa 1 / (n + 1) is nonzero.

theorem one_div_succ_ne_zero (n : ℕ) : 1 / ((n : ℝ) + 1) ≠ 0
Proof
:= by positivity

theorem teeth_subset_Icc

TopologyByExample.CombSpace.teeth_subset_Icc

The teeth lie over [0, 1].

theorem teeth_subset_Icc : teeth ⊆ Icc 0 1
Proof
:= by
  rintro _ (rfl | ⟨n, rfl⟩)
  · exact ⟨le_rfl, zero_le_one⟩
  · exact one_div_succ_mem_Icc n

theorem zero_mem_teeth

TopologyByExample.CombSpace.zero_mem_teeth

The limit tooth lies over 0.

theorem zero_mem_teeth : (0 : ℝ) ∈ teeth
Proof
:= mem_insert _ _

theorem one_div_succ_mem_teeth

TopologyByExample.CombSpace.one_div_succ_mem_teeth

There is a tooth over 1 / (n + 1).

theorem one_div_succ_mem_teeth (n : ℕ) : 1 / ((n : ℝ) + 1) ∈ teeth
Proof
:=
  mem_insert_of_mem _ (mem_range_self n)

theorem countable_teeth

TopologyByExample.CombSpace.countable_teeth

There are countably many teeth.

theorem countable_teeth : teeth.Countable
Proof
:= (countable_range _).insert 0

theorem isCompact_teeth

TopologyByExample.CombSpace.isCompact_teeth

The set of teeth is compact: it is a convergent sequence together with its limit.

theorem isCompact_teeth : IsCompact teeth
Proof
:=
  tendsto_one_div_add_atTop_nhds_zero_nat.isCompact_insert_range

theorem isCompact_comb

TopologyByExample.CombSpace.isCompact_comb

The comb is a compact subset of the plane.

theorem isCompact_comb : IsCompact comb
Proof
:=
  (isCompact_Icc.prod isCompact_singleton).union (isCompact_teeth.prod isCompact_Icc)

theorem isClosed_comb

TopologyByExample.CombSpace.isClosed_comb

The comb is a closed subset of the plane.

theorem isClosed_comb : IsClosed comb
Proof
:= isCompact_comb.isClosed

theorem isPathConnected_combOf

TopologyByExample.CombSpace.isPathConnected_combOf

A comb with an arbitrary set T ⊆ [0, 1] of teeth is path connected.

theorem isPathConnected_combOf {T : Set ℝ} (hT : T ⊆ Icc 0 1) : IsPathConnected (combOf T)
Proof
:= by
  set s := combOf T
  have hbase : Convex ℝ (Icc (0 : ℝ) 1 ×ˢ ({0} : Set ℝ)) :=
    (convex_Icc 0 1).prod (convex_singleton 0)
  have h0 : ((0 : ℝ), (0 : ℝ)) ∈ Icc (0 : ℝ) 1 ×ˢ ({0} : Set ℝ) := ⟨⟨le_rfl, zero_le_one⟩, rfl⟩
  have key : ∀ p ∈ s, JoinedIn s p (0, 0) := by
    rintro p (hp | ⟨hp1, hp2⟩)
    · exact joinedIn_of_convex hbase subset_union_left hp h0
    · have hfoot : (p.1, (0 : ℝ)) ∈ Icc (0 : ℝ) 1 ×ˢ ({0} : Set ℝ) := ⟨hT hp1, rfl⟩
      refine JoinedIn.trans ?_ (joinedIn_of_convex hbase subset_union_left hfoot h0)
      refine joinedIn_of_convex (E := ℝ × ℝ) ((convex_singleton p.1).prod (convex_Icc 0 1)) ?_
        (x := p) ⟨rfl, hp2⟩ ⟨rfl, ⟨le_rfl, zero_le_one⟩⟩
      rintro q ⟨hq1, hq2⟩
      exact Or.inr ⟨(mem_singleton_iff.1 hq1) ▸ hp1, hq2⟩
  exact isPathConnected_iff.2 ⟨⟨_, Or.inl h0⟩, fun x hx y hy ↦ (key x hx).trans (key y hy).symm⟩

theorem isPathConnected_comb

TopologyByExample.CombSpace.isPathConnected_comb

The comb is a path connected subset of the plane.

theorem isPathConnected_comb : IsPathConnected comb
Proof
:=
  isPathConnected_combOf teeth_subset_Icc

theorem fst_eq_of_isPreconnected

TopologyByExample.CombSpace.fst_eq_of_isPreconnected

A preconnected subset of the comb lying strictly above the base is contained in a single tooth: its projection to the first coordinate is a preconnected subset of the countable set of teeth.

theorem fst_eq_of_isPreconnected {s : Set (ℝ × ℝ)} (hs : IsPreconnected s) (hsc : s ⊆ comb)
    (hpos : ∀ p ∈ s, 0 < p.2) {p q : ℝ × ℝ} (hp : p ∈ s) (hq : q ∈ s) : p.1 = q.1
Proof
:= by
  have himg : Prod.fst '' s ⊆ teeth := by
    rintro _ ⟨r, hr, rfl⟩
    rcases hsc hr with ⟨-, h0⟩ | ⟨ht, -⟩
    · exact absurd (mem_singleton_iff.1 h0) (hpos r hr).ne'
    · exact ht
  exact countable_teeth.isTotallyDisconnected _ himg (hs.image _ continuous_fst.continuousOn)
    (mem_image_of_mem _ hp) (mem_image_of_mem _ hq)

On this site: Comb space: A connected set above the base lies in a single tooth

theorem tendsto_tips

TopologyByExample.CombSpace.tendsto_tips

The tips (1 / (n + 1), 1) of the teeth converge to (0, 1).

theorem tendsto_tips :
    Tendsto (fun n : ℕ ↦ ((1 / ((n : ℝ) + 1), (1 : ℝ)) : ℝ × ℝ)) atTop (𝓝 (0, 1))
Proof
:=
  tendsto_one_div_add_atTop_nhds_zero_nat.prodMk_nhds tendsto_const_nhds

definition CombSpace

TopologyByExample.CombSpace

The comb space: the subspace comb of the plane.

abbrev CombSpace : Type
:= CombSpace.comb

On this site: Space: Comb space

definition origin

TopologyByExample.CombSpace.origin

The origin, as a point of the comb.

def origin : CombSpace
:= ⟨(0, 0), Or.inl ⟨⟨le_rfl, zero_le_one⟩, rfl⟩⟩

definition top

TopologyByExample.CombSpace.top

The top (0, 1) of the limit tooth, as a point of the comb.

def top : CombSpace
:= ⟨(0, 1), Or.inr ⟨zero_mem_teeth, ⟨zero_le_one, le_rfl⟩⟩⟩

definition tip

TopologyByExample.CombSpace.tip

The tip (1 / (n + 1), 1) of the n-th tooth, as a point of the comb.

noncomputable def tip (n : ℕ) : CombSpace
:=
  ⟨(1 / ((n : ℝ) + 1), 1), Or.inr ⟨one_div_succ_mem_teeth n, ⟨zero_le_one, le_rfl⟩⟩⟩

theorem origin_ne_top

TopologyByExample.CombSpace.origin_ne_top

The origin and (0, 1) are distinct points of the comb.

theorem origin_ne_top : origin ≠ top
Proof
:= by
  simp [origin, top, Subtype.ext_iff]

instance

The comb has two distinct points.

instance : Nontrivial CombSpace
Proof
:= ⟨⟨origin, top, origin_ne_top⟩⟩

instance instCompactSpace

TopologyByExample.CombSpace.instCompactSpace

The comb is compact.

instance instCompactSpace : CompactSpace CombSpace
Proof
:=
  isCompact_iff_compactSpace.1 isCompact_comb

On this site: The comb space is compact

theorem metrizableSpace

TopologyByExample.CombSpace.metrizableSpace

The comb is metrizable.

theorem metrizableSpace : MetrizableSpace CombSpace
Proof
:= inferInstance

On this site: The comb space is metrizable

instance instPathConnectedSpace

TopologyByExample.CombSpace.instPathConnectedSpace

The comb is path connected (in Mathlib's sense, which includes nonemptiness).

instance instPathConnectedSpace : PathConnectedSpace CombSpace
Proof
:=
  isPathConnected_iff_pathConnectedSpace.1 isPathConnected_comb

theorem joined

TopologyByExample.CombSpace.joined

Any two points of the comb are joined by a path.

theorem joined (x y : CombSpace) : Joined x y
Proof
:= PathConnectedSpace.joined x y

theorem connectedSpace

TopologyByExample.CombSpace.connectedSpace

The comb is connected.

theorem connectedSpace : ConnectedSpace CombSpace
Proof
:= inferInstance

theorem preconnectedSpace

TopologyByExample.CombSpace.preconnectedSpace

The comb is preconnected (the study's statement of connectedness).

theorem preconnectedSpace : PreconnectedSpace CombSpace
Proof
:= inferInstance

theorem not_locallyConnectedSpace

TopologyByExample.CombSpace.not_locallyConnectedSpace

The comb is not locally connected: the point (0, 1) has no preconnected neighbourhood inside the open set of points above height 1 / 2.

theorem not_locallyConnectedSpace : ¬LocallyConnectedSpace CombSpace
Proof
:= by
  intro h
  have hU : {p : CombSpace | 1 / 2 < (p : ℝ × ℝ).2} ∈ 𝓝 top :=
    (isOpen_lt continuous_const (continuous_snd.comp continuous_subtypeVal)).mem_nhds
      (by norm_num [top])
  obtain ⟨V, hV, hVc, hVU⟩ := locallyConnectedSpace_iff_connected_subsets.1 h top _ hU
  have hq : Tendsto tip atTop (𝓝 top) := tendsto_subtype_rng.2 tendsto_tips
  obtain ⟨n, hn⟩ := (hq.eventually hV).exists
  have := fst_eq_of_isPreconnected (hVc.image _ continuous_subtypeVal.continuousOn)
    (image_subset_iff.2 fun p _ ↦ p.property)
    (by rintro _ ⟨p, hp, rfl⟩; exact (one_half_pos).trans (hVU hp))
    (mem_image_of_mem _ hn) (mem_image_of_mem _ (mem_of_mem_nhds hV))
  exact one_div_succ_ne_zero n this

On this site: The comb space is not locally connected

theorem not_locallyPathConnectedSpace

TopologyByExample.CombSpace.not_locallyPathConnectedSpace

The comb is not locally path connected, since it is not locally connected.

theorem not_locallyPathConnectedSpace : ¬LocallyPathConnectedSpace CombSpace
Proof
:= fun _ ↦
  not_locallyConnectedSpace inferInstance

theorem not_totallyDisconnectedSpace

TopologyByExample.CombSpace.not_totallyDisconnectedSpace

The comb is not totally disconnected: it is connected and has two points.

theorem not_totallyDisconnectedSpace : ¬TotallyDisconnectedSpace CombSpace
Proof
:= fun _ ↦
  not_subsingleton CombSpace subsingleton_of_preconnected_totallyDisconnected

theorem not_totallySeparatedSpace

TopologyByExample.CombSpace.not_totallySeparatedSpace

The comb is not totally separated, since it is not totally disconnected.

theorem not_totallySeparatedSpace : ¬TotallySeparatedSpace CombSpace
Proof
:= fun _ ↦
  not_totallyDisconnectedSpace inferInstance

theorem not_zeroDimensionalSpace

TopologyByExample.CombSpace.not_zeroDimensionalSpace

The comb is not zero-dimensional: a zero-dimensional T₀ space is totally separated.

theorem not_zeroDimensionalSpace : ¬ZeroDimensionalSpace CombSpace
Proof
:= fun _ ↦
  not_totallySeparatedSpace inferInstance

definition deform

TopologyByExample.CombSpace.deform

The deformation of the plane used to contract the comb: at time s ≤ 1 / 2 it shrinks the teeth towards the base, and at time s ≥ 1 / 2 it slides the base towards the origin.

noncomputable def deform (s : ℝ) (p : ℝ × ℝ) : ℝ × ℝ
:=
  (p.1 * min 1 (2 - 2 * s), p.2 * max 0 (1 - 2 * s))

theorem continuous_deform

TopologyByExample.CombSpace.continuous_deform

The deformation is jointly continuous in time and place.

theorem continuous_deform : Continuous fun x : ℝ × (ℝ × ℝ) ↦ deform x.1 x.2
Proof
:= by
  unfold deform
  fun_prop

theorem deform_mem_comb

TopologyByExample.CombSpace.deform_mem_comb

At every time in [0, 1] the deformation maps the comb into itself.

theorem deform_mem_comb {s : ℝ} (hs : s ∈ Icc (0 : ℝ) 1) {p : ℝ × ℝ} (hp : p ∈ comb) :
    deform s p ∈ comb
Proof
:= by
  obtain ⟨hs0, hs1⟩ := hs
  have hmin : min 1 (2 - 2 * s) ∈ Icc (0 : ℝ) 1 :=
    ⟨le_min zero_le_one (by linarith), min_le_left _ _⟩
  rcases hp with ⟨⟨hp0, hp1⟩, hp2⟩ | ⟨hp1, hp2⟩
  · rw [mem_singleton_iff] at hp2
    refine Or.inl ⟨unitInterval.mul_mem ⟨hp0, hp1⟩ hmin, ?_⟩
    simp [deform, hp2]
  · obtain ⟨ha0, ha1⟩ := teeth_subset_Icc hp1
    rcases le_total s (1 / 2) with h | h
    · have h1 : min 1 (2 - 2 * s) = 1 := min_eq_left (by linarith)
      have h2 : max 0 (1 - 2 * s) = 1 - 2 * s := max_eq_right (by linarith)
      refine Or.inr ⟨by simpa [deform, h1] using hp1, ?_⟩
      simp only [deform, h2]
      exact unitInterval.mul_mem hp2 ⟨by linarith, by linarith⟩
    · have h2 : max 0 (1 - 2 * s) = 0 := max_eq_left (by linarith)
      refine Or.inl ⟨unitInterval.mul_mem ⟨ha0, ha1⟩ hmin, ?_⟩
      simp [deform, h2]

instance instContractibleSpace

TopologyByExample.CombSpace.instContractibleSpace

The comb is contractible: the identity is homotopic to the constant map at the origin, by pushing the teeth down to the base and then sliding the base to the origin.

instance instContractibleSpace : ContractibleSpace CombSpace
Proof
:= by
  rw [contractible_iff_id_nullhomotopic]
  refine ⟨origin, ⟨{ toFun := fun x ↦ ⟨deform x.1 x.2, deform_mem_comb x.1.property x.2.property⟩
                     continuous_toFun := ?_
                     map_zero_left := ?_
                     map_one_left := ?_ }⟩⟩
  · exact (continuous_deform.comp ((continuous_subtypeVal.comp continuous_fst).prodMk
      (continuous_subtypeVal.comp continuous_snd))).subtype_mk _
  · intro p
    ext <;> norm_num [deform]
  · intro p
    ext <;> norm_num [deform, origin]

On this site: Comb space: The comb is contractible

definition deletedComb

TopologyByExample.CombSpace.deletedComb

The deleted comb: the base, the teeth {1 / (n + 1)} × [0, 1], and the single point (0, 1) of the limit tooth.

noncomputable def deletedComb : Set (ℝ × ℝ)
:=
  insert (0, 1) (combOf (range fun n : ℕ ↦ 1 / ((n : ℝ) + 1)))

theorem combOf_range_subset_comb

TopologyByExample.CombSpace.combOf_range_subset_comb

The comb without its limit tooth is contained in the comb.

theorem combOf_range_subset_comb : combOf (range fun n : ℕ ↦ 1 / ((n : ℝ) + 1)) ⊆ comb
Proof
:=
  union_subset_union_right _ (prod_mono (subset_insert _ _) le_rfl)

theorem deletedComb_subset_comb

TopologyByExample.CombSpace.deletedComb_subset_comb

The deleted comb is contained in the comb.

theorem deletedComb_subset_comb : deletedComb ⊆ comb
Proof
:=
  insert_subset (Or.inr ⟨zero_mem_teeth, ⟨zero_le_one, le_rfl⟩⟩) combOf_range_subset_comb

theorem eq_of_mem_deletedComb

TopologyByExample.CombSpace.eq_of_mem_deletedComb

The only point of the deleted comb on the vertical axis strictly above the base is (0, 1).

theorem eq_of_mem_deletedComb {p : ℝ × ℝ} (hp : p ∈ deletedComb) (h1 : p.1 = 0) (h2 : 0 < p.2) :
    p = (0, 1)
Proof
:= by
  rcases hp with hp | ⟨-, hp⟩ | ⟨⟨n, hn⟩, -⟩
  · exact hp
  · exact absurd (mem_singleton_iff.1 hp) h2.ne'
  · exact absurd (hn.trans h1) (one_div_succ_ne_zero n)

theorem isConnected_deletedComb

TopologyByExample.CombSpace.isConnected_deletedComb

The deleted comb is connected: it lies between the path connected union of the base and the teeth {1 / (n + 1)} × [0, 1] and the closure of that union.

theorem isConnected_deletedComb : IsConnected deletedComb
Proof
:= by
  have h := (isPathConnected_combOf (T := range fun n : ℕ ↦ 1 / ((n : ℝ) + 1))
    (range_subset_iff.2 one_div_succ_mem_Icc)).isConnected
  refine ⟨h.nonempty.mono (subset_insert _ _), h.isPreconnected.subset_closure (subset_insert _ _)
    (insert_subset ?_ subset_closure)⟩
  exact mem_closure_of_tendsto tendsto_tips (Eventually.of_forall fun n ↦
    Or.inr ⟨mem_range_self n, ⟨zero_le_one, le_rfl⟩⟩)

On this site: Comb space: The deleted comb is connected

definition DeletedCombSpace

TopologyByExample.DeletedCombSpace

The deleted comb space: the subspace deletedComb of the plane.

abbrev DeletedCombSpace : Type
:= CombSpace.deletedComb

definition top

TopologyByExample.DeletedCombSpace.top

The point (0, 1), as a point of the deleted comb.

def top : DeletedCombSpace
:= ⟨(0, 1), mem_insert _ _⟩

definition origin

TopologyByExample.DeletedCombSpace.origin

The origin, as a point of the deleted comb.

def origin : DeletedCombSpace
:= ⟨(0, 0), Or.inr (Or.inl ⟨⟨le_rfl, zero_le_one⟩, rfl⟩)⟩

instance instConnectedSpace

TopologyByExample.DeletedCombSpace.instConnectedSpace

The deleted comb is connected.

instance instConnectedSpace : ConnectedSpace DeletedCombSpace
Proof
:=
  isConnected_iff_connectedSpace.1 CombSpace.isConnected_deletedComb

theorem not_joined_top_origin

TopologyByExample.DeletedCombSpace.not_joined_top_origin

In the deleted comb, (0, 1) is not joined to the origin by a path. Along a path starting at (0, 1), the set of times at which it is at (0, 1) is closed, and also open: near such a time the path stays above height 1 / 2, where a connected set cannot leave the vertical axis.

theorem not_joined_top_origin : ¬Joined top origin
Proof
:= by
  rintro ⟨γ⟩
  set g : ℝ → ℝ × ℝ := fun t ↦ (γ.extend t : ℝ × ℝ) with hg_def
  have hg : Continuous g := continuous_subtypeVal.comp γ.continuous_extend
  have hclosed : IsClosed {t | g t = (0, 1)} := isClosed_eq hg continuous_const
  have hopen : IsOpen {t | g t = (0, 1)} := by
    rw [Metric.isOpen_iff]
    intro t ht
    have ht' : g t = (0, 1) := ht
    have hU : g ⁻¹' {p | 1 / 2 < p.2} ∈ 𝓝 t :=
      hg.continuousAt.preimage_mem_nhds
        ((isOpen_lt continuous_const continuous_snd).mem_nhds (by simp only [ht']; norm_num))
    obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hU
    refine ⟨ε, hε, fun s hs ↦ ?_⟩
    have hpos : ∀ p ∈ g '' Metric.ball t ε, 0 < p.2 := by
      rintro _ ⟨r, hr, rfl⟩
      exact one_half_pos.trans (hball hr)
    have hfst := CombSpace.fst_eq_of_isPreconnected
      ((Real.ball_eq_Ioo t ε ▸ isPreconnected_Ioo).image g hg.continuousOn)
      (by rintro _ ⟨r, -, rfl⟩; exact CombSpace.deletedComb_subset_comb (γ.extend r).property)
      hpos (mem_image_of_mem g hs) (mem_image_of_mem g (Metric.mem_ball_self hε))
    rw [ht'] at hfst
    exact CombSpace.eq_of_mem_deletedComb (γ.extend s).property hfst
      (hpos _ (mem_image_of_mem g hs))
  have huniv := IsClopen.eq_univ ⟨hclosed, hopen⟩
    ⟨0, show g 0 = (0, 1) by simp only [hg_def, Path.extend_zero]; rfl⟩
  have h1 : g 1 = (0, 1) := (huniv.symm ▸ mem_univ (1 : ℝ) :)
  simp only [hg_def, Path.extend_one] at h1
  simp [origin] at h1

On this site: Comb space: The deleted comb is not path connected

theorem not_forall_joined

TopologyByExample.DeletedCombSpace.not_forall_joined

The deleted comb is not path connected.

theorem not_forall_joined : ¬∀ x y : DeletedCombSpace, Joined x y
Proof
:= fun h ↦
  not_joined_top_origin (h top origin)