Lean library · module TopologyByExample.Spaces.MetricFan

The metric fan

Source file

In this file we define TopologyByExample.MetricFan, the metric fan: the subspace of ℝ × ℝ consisting of the origin (the vertex) and the points (1 / (m + 1), 1 / ((m + 1) (n + 1))) for m n : ℕ (MetricFan.pt m n, the n-th point of the m-th spine). Every point other than the vertex is isolated. The m-th spine converges in the plane to (1 / (m + 1), 0), which is not in the fan, while the spines themselves approach the vertex as m grows.

Main definitions

Main results

References

  • G. Gruenhage and B. Hughes, Completeness properties in the compact-open topology on fans

Tags

metric fan, counterexample, locally compact

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 fanPoint

TopologyByExample.MetricFan.fanPoint

The point (1 / (m + 1), 1 / ((m + 1) (n + 1))) of the plane, the n-th point of the m-th spine of the metric fan.

noncomputable def fanPoint (m n : ℕ) : ℝ × ℝ
:=
  (((m : ℝ) + 1)⁻¹, (((m : ℝ) + 1) * ((n : ℝ) + 1))⁻¹)

definition carrier

TopologyByExample.MetricFan.carrier

The metric fan as a subset of the plane: the origin together with the points fanPoint m n.

noncomputable def carrier : Set (ℝ × ℝ)
:= insert 0 (range fun p : ℕ × ℕ ↦ fanPoint p.1 p.2)

definition MetricFan

TopologyByExample.MetricFan

The metric fan: the subspace of the plane consisting of the origin and the points (1 / (m + 1), 1 / ((m + 1) (n + 1))) for m n : ℕ.

abbrev MetricFan : Type
:= MetricFan.carrier

On this site: Space: Metric fan

definition vertex

TopologyByExample.MetricFan.vertex

The vertex of the metric fan, the origin.

def vertex : MetricFan
:= ⟨0, mem_insert _ _⟩

instance

The vertex is the default point of the metric fan.

instance : Inhabited MetricFan
Proof
:= ⟨vertex⟩

definition pt

TopologyByExample.MetricFan.pt

The n-th point of the m-th spine of the metric fan.

noncomputable def pt (m n : ℕ) : MetricFan
:= ⟨fanPoint m n, mem_insert_of_mem _ ⟨(m, n), rfl⟩⟩

instance

The metric fan is countable.

instance : Countable MetricFan
Proof
:=
  ((countable_range _).insert 0).to_subtype

theorem eq_vertex_or_exists_pt

TopologyByExample.MetricFan.eq_vertex_or_exists_pt

Every point of the metric fan is the vertex or a point of a spine.

theorem eq_vertex_or_exists_pt (x : MetricFan) : x = vertex ∨ ∃ m n, x = pt m n
Proof
:= by
  obtain ⟨x, hx | ⟨⟨m, n⟩, rfl⟩⟩ := x
  · exact Or.inl (Subtype.ext hx)
  · exact Or.inr ⟨m, n, rfl⟩

theorem fanPoint_fst

TopologyByExample.MetricFan.fanPoint_fst

The first coordinate of fanPoint m n.

theorem fanPoint_fst (m n : ℕ) : (fanPoint m n).1 = ((m : ℝ) + 1)⁻¹
Proof
:= rfl

theorem fanPoint_snd

TopologyByExample.MetricFan.fanPoint_snd

The second coordinate of fanPoint m n.

theorem fanPoint_snd (m n : ℕ) : (fanPoint m n).2 = (((m : ℝ) + 1) * ((n : ℝ) + 1))⁻¹
Proof
:= rfl

theorem fanPoint_fst_pos

TopologyByExample.MetricFan.fanPoint_fst_pos

The first coordinate of fanPoint m n is positive.

theorem fanPoint_fst_pos (m n : ℕ) : 0 < (fanPoint m n).1
Proof
:= by
  rw [fanPoint_fst]
  positivity

theorem fanPoint_snd_pos

TopologyByExample.MetricFan.fanPoint_snd_pos

The second coordinate of fanPoint m n is positive.

theorem fanPoint_snd_pos (m n : ℕ) : 0 < (fanPoint m n).2
Proof
:= by
  rw [fanPoint_snd]
  positivity

theorem pt_ne_vertex

TopologyByExample.MetricFan.pt_ne_vertex

A point of a spine is not the vertex.

theorem pt_ne_vertex (m n : ℕ) : pt m n ≠ vertex
Proof
:= fun h ↦
  (fanPoint_fst_pos m n).ne' (congrArg (fun x : MetricFan ↦ (x : ℝ × ℝ).1) h)

theorem inv_le_abs_sub_inv

TopologyByExample.MetricFan.inv_le_abs_sub_inv

Distinct reciprocals 1 / (a + 1) and 1 / (b + 1) are at least 1 / ((a + 1) (a + 2)) apart.

theorem inv_le_abs_sub_inv {a b : ℕ} (h : a ≠ b) :
    (((a : ℝ) + 1) * ((a : ℝ) + 2))⁻¹ ≤ |((b : ℝ) + 1)⁻¹ - ((a : ℝ) + 1)⁻¹|
Proof
:= by
  have ha : (0 : ℝ) ≤ a := a.cast_nonneg
  have hb : (0 : ℝ) ≤ b := b.cast_nonneg
  rcases h.lt_or_gt with hab | hab
  · have hab' : (a : ℝ) + 1 ≤ b := by exact_mod_cast hab
    rw [abs_sub_comm, abs_of_nonneg (sub_nonneg.2 (inv_anti₀ (by positivity) (by linarith)))]
    rw [inv_sub_inv (by positivity) (by positivity), inv_eq_one_div,
      div_le_div_iff₀ (by positivity) (by positivity)]
    nlinarith [mul_nonneg (sub_nonneg.2 hab') (mul_self_nonneg ((a : ℝ) + 1))]
  · have hab' : (b : ℝ) + 1 ≤ a := by exact_mod_cast hab
    rw [abs_of_nonneg (sub_nonneg.2 (inv_anti₀ (by positivity) (by linarith)))]
    rw [inv_sub_inv (by positivity) (by positivity), inv_eq_one_div,
      div_le_div_iff₀ (by positivity) (by positivity)]
    nlinarith [mul_nonneg (sub_nonneg.2 hab')
        (by positivity : (0 : ℝ) ≤ ((a : ℝ) + 1) * ((a : ℝ) + 2)),
      mul_nonneg (by positivity : (0 : ℝ) ≤ (a : ℝ) + 1) (by linarith : (0 : ℝ) ≤ (a : ℝ) - b + 1)]

theorem isOpen_singleton_pt

TopologyByExample.MetricFan.isOpen_singleton_pt

Every point of a spine is isolated in the metric fan.

theorem isOpen_singleton_pt (m n : ℕ) : IsOpen {pt m n}
Proof
:= by
  set ε : ℝ := (((m : ℝ) + 1) * ((m : ℝ) + 2) * (((n : ℝ) + 1) * ((n : ℝ) + 2)))⁻¹
  have hm : (0 : ℝ) ≤ m := m.cast_nonneg
  have hn : (0 : ℝ) ≤ n := n.cast_nonneg
  have hA : (1 : ℝ) ≤ (m : ℝ) + 2 := by linarith
  have hB : (1 : ℝ) ≤ ((n : ℝ) + 1) * ((n : ℝ) + 2) :=
    one_le_mul_of_one_le_of_one_le (by linarith) (by linarith)
  have h2 : ε ≤ (((m : ℝ) + 1) * ((m : ℝ) + 2))⁻¹ :=
    inv_anti₀ (by positivity) (le_mul_of_one_le_right (by positivity) hB)
  have h1 : ε ≤ ((m : ℝ) + 1)⁻¹ :=
    h2.trans (inv_anti₀ (by positivity) (le_mul_of_one_le_right (by positivity) hA))
  have h3 : ε ≤ ((m : ℝ) + 1)⁻¹ * (((n : ℝ) + 1) * ((n : ℝ) + 2))⁻¹ := by
    rw [← mul_inv]
    exact inv_anti₀ (by positivity) (mul_le_mul_of_nonneg_right
      (le_mul_of_one_le_right (by positivity) hA) (by positivity))
  refine Metric.isOpen_singleton_iff.2 ⟨ε, by positivity, fun y hy ↦ ?_⟩
  by_contra hne
  refine hy.not_ge ?_
  rw [Subtype.dist_eq, Prod.dist_eq, Real.dist_eq, Real.dist_eq]
  rcases eq_vertex_or_exists_pt y with rfl | ⟨m', n', rfl⟩
  · refine le_max_of_le_left (h1.trans_eq ?_)
    simp only [vertex, Prod.fst_zero, pt, fanPoint_fst, zero_sub, abs_neg, abs_inv, inv_inj]
    exact (abs_of_pos (by positivity)).symm
  · by_cases hmm : m' = m
    · subst hmm
      have hnn : n ≠ n' := fun h ↦ hne (h ▸ rfl)
      refine le_max_of_le_right (h3.trans ?_)
      simp only [pt, fanPoint_snd]
      rw [mul_inv ((m' : ℝ) + 1) ((n' : ℝ) + 1), mul_inv ((m' : ℝ) + 1) ((n : ℝ) + 1), ← mul_sub,
        abs_mul, abs_of_pos (by positivity : (0 : ℝ) < ((m' : ℝ) + 1)⁻¹)]
      gcongr
      exact inv_le_abs_sub_inv hnn
    · refine le_max_of_le_left (h2.trans ?_)
      exact inv_le_abs_sub_inv (Ne.symm hmm)

theorem tendsto_pt_vertex

TopologyByExample.MetricFan.tendsto_pt_vertex

The points pt m 0 converge to the vertex.

theorem tendsto_pt_vertex : Tendsto (fun m ↦ pt m 0) atTop (𝓝 vertex)
Proof
:= by
  have h : Tendsto (fun m : ℕ ↦ ((m : ℝ) + 1)⁻¹) atTop (𝓝 0) :=
    tendsto_inv_atTop_zero.comp (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds)
  refine tendsto_subtype_rng.2 ?_
  refine (h.prodMk_nhds (by simpa using h)).congr fun m ↦ ?_
  simp [pt, fanPoint]

theorem not_isOpen_singleton_vertex

TopologyByExample.MetricFan.not_isOpen_singleton_vertex

The vertex of the metric fan is not isolated.

theorem not_isOpen_singleton_vertex : ¬IsOpen ({vertex} : Set MetricFan)
Proof
:= by
  intro h
  obtain ⟨m, hm⟩ := (tendsto_pt_vertex.eventually (h.mem_nhds rfl)).exists
  exact pt_ne_vertex m 0 hm

instance instAlmostDiscreteSpace

TopologyByExample.MetricFan.instAlmostDiscreteSpace

The metric fan is almost discrete: the vertex is its only non-isolated point.

instance instAlmostDiscreteSpace : AlmostDiscreteSpace MetricFan
Proof
:= by
  refine ⟨⟨vertex, not_isOpen_singleton_vertex, fun x hx ↦ ?_⟩⟩
  obtain ⟨m, n, rfl⟩ := (eq_vertex_or_exists_pt x).resolve_left hx
  exact isOpen_singleton_pt m n

On this site: The metric fan is almost discrete

theorem not_weaklyLocallyCompactSpace

TopologyByExample.MetricFan.not_weaklyLocallyCompactSpace

The vertex of the metric fan has no compact neighbourhood, so the metric fan is not weakly locally compact. A neighbourhood of the vertex contains a whole spine, whose points converge in the plane to a point outside the fan.

theorem not_weaklyLocallyCompactSpace : ¬WeaklyLocallyCompactSpace MetricFan
Proof
:= by
  intro _
  obtain ⟨K, hK, hKn⟩ := exists_compact_mem_nhds vertex
  obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hKn
  obtain ⟨m, hm⟩ := exists_nat_one_div_lt hε
  have hpt (n : ℕ) : pt m n ∈ K := by
    refine hball ?_
    rw [mem_ball, Subtype.dist_eq, Prod.dist_eq, Real.dist_eq, Real.dist_eq]
    simp only [pt, vertex, Prod.fst_zero, Prod.snd_zero, sub_zero, fanPoint_fst, fanPoint_snd]
    rw [abs_of_pos (by positivity), abs_of_pos (by positivity), max_lt_iff, ← one_div]
    refine ⟨hm, lt_of_le_of_lt ?_ hm⟩
    rw [one_div]
    exact inv_anti₀ (by positivity) (le_mul_of_one_le_right (by positivity) (by
      have : (0 : ℝ) ≤ n := n.cast_nonneg
      linarith))
  have hc : IsClosed ((↑) '' K : Set (ℝ × ℝ)) := (hK.image continuous_subtypeVal).isClosed
  have hlim : Tendsto (fun n ↦ fanPoint m n) atTop (𝓝 ((((m : ℝ) + 1)⁻¹, 0) : ℝ × ℝ)) := by
    refine tendsto_const_nhds.prodMk_nhds (tendsto_inv_atTop_zero.comp ?_)
    exact (tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds).const_mul_atTop
      (by positivity)
  obtain ⟨y, -, hy⟩ := hc.mem_of_tendsto hlim (.of_forall fun n ↦ ⟨pt m n, hpt n, rfl⟩)
  obtain ⟨y, hy' | ⟨⟨m', n'⟩, rfl⟩⟩ := y
  · have := congrArg Prod.fst (hy.symm.trans hy')
    simp only [Prod.fst_zero] at this
    exact (inv_pos.2 (by positivity : (0 : ℝ) < (m : ℝ) + 1)).ne' this
  · exact (fanPoint_snd_pos m' n').ne' (congrArg Prod.snd hy)

On this site: The metric fan is not weakly locally compact

The open and the compact sets

theorem pt_inj

TopologyByExample.MetricFan.pt_inj

Two points of the spines are equal exactly when their indices are.

theorem pt_inj {m n m' n' : ℕ} : pt m n = pt m' n' ↔ m = m' ∧ n = n'
Proof
:= by
  refine ⟨fun h ↦ ?_, fun ⟨h1, h2⟩ ↦ h1 ▸ h2 ▸ rfl⟩
  have h1 := congrArg (fun x : MetricFan ↦ (x : ℝ × ℝ).1) h
  have h2 := congrArg (fun x : MetricFan ↦ (x : ℝ × ℝ).2) h
  simp only [pt, fanPoint_fst, fanPoint_snd, inv_inj, add_left_inj, Nat.cast_inj] at h1 h2
  subst h1
  refine ⟨rfl, ?_⟩
  have := mul_left_cancel₀ (by positivity : (m : ℝ) + 1 ≠ 0) h2
  exact_mod_cast add_right_cancel this

theorem dist_pt_vertex

TopologyByExample.MetricFan.dist_pt_vertex

The distance from the n-th point of the m-th spine to the vertex is 1 / (m + 1).

theorem dist_pt_vertex (m n : ℕ) : dist (pt m n) vertex = ((m : ℝ) + 1)⁻¹
Proof
:= by
  have hn : (0 : ℝ) ≤ n := n.cast_nonneg
  rw [Subtype.dist_eq, Prod.dist_eq, Real.dist_eq, Real.dist_eq]
  simp only [pt, vertex, Prod.fst_zero, Prod.snd_zero, sub_zero, fanPoint_fst, fanPoint_snd]
  rw [abs_of_pos (by positivity), abs_of_pos (by positivity), max_eq_left]
  exact inv_anti₀ (by positivity) (le_mul_of_one_le_right (by positivity) (by linarith))

theorem mem_nhds_vertex_iff

TopologyByExample.MetricFan.mem_nhds_vertex_iff

A set is a neighbourhood of the vertex if and only if it contains the vertex and every point of the spines from some index on.

theorem mem_nhds_vertex_iff {s : Set MetricFan} :
    s ∈ 𝓝 vertex ↔ vertex ∈ s ∧ ∃ N, ∀ m n, N ≤ m → pt m n ∈ s
Proof
:= by
  constructor
  · intro hs
    obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hs
    obtain ⟨N, hN⟩ := exists_nat_one_div_lt hε
    refine ⟨mem_of_mem_nhds hs, N, fun m n hm ↦ hball ?_⟩
    rw [mem_ball, dist_pt_vertex]
    refine lt_of_le_of_lt ?_ (one_div (N + 1 : ℝ) ▸ hN)
    exact inv_anti₀ (by positivity) (by exact_mod_cast Nat.add_le_add_right hm 1)
  · rintro ⟨hv, N, hN⟩
    refine Metric.mem_nhds_iff.2 ⟨((N : ℝ) + 1)⁻¹, by positivity, fun y hy ↦ ?_⟩
    rcases eq_vertex_or_exists_pt y with rfl | ⟨m, n, rfl⟩
    · exact hv
    · rw [mem_ball, dist_pt_vertex] at hy
      refine hN m n ?_
      have := (inv_lt_inv₀ (by positivity) (by positivity)).1 hy
      exact_mod_cast (by linarith : (N : ℝ) ≤ m)

theorem isOpen_iff

TopologyByExample.MetricFan.isOpen_iff

A set is open in the metric fan if and only if, when it contains the vertex, it contains every point of the spines from some index on.

theorem isOpen_iff {s : Set MetricFan} :
    IsOpen s ↔ (vertex ∈ s → ∃ N, ∀ m n, N ≤ m → pt m n ∈ s)
Proof
:= by
  refine isOpen_iff_mem_nhds.trans ⟨fun h hv ↦ (mem_nhds_vertex_iff.1 (h _ hv)).2,
    fun h x hx ↦ ?_⟩
  rcases eq_vertex_or_exists_pt x with rfl | ⟨m, n, rfl⟩
  · exact mem_nhds_vertex_iff.2 ⟨hx, h hx⟩
  · exact mem_of_superset ((isOpen_singleton_pt m n).mem_nhds rfl) (singleton_subset_iff.2 hx)

On this site: Metric fan: The neighbourhoods of the vertex

theorem isClosed_spine

TopologyByExample.MetricFan.isClosed_spine

Each spine is closed in the metric fan.

theorem isClosed_spine (m : ℕ) : IsClosed {x | ∃ n, x = pt m n}
Proof
:= by
  refine isOpen_compl_iff.1 (isOpen_iff.2 fun _ ↦ ⟨m + 1, fun k n hk ⟨n', h⟩ ↦ ?_⟩)
  have := (pt_inj.1 h).1
  omega

theorem finite_spine_of_isCompact

TopologyByExample.MetricFan.finite_spine_of_isCompact

A compact subset of the metric fan meets each spine in a finite set.

theorem finite_spine_of_isCompact {K : Set MetricFan} (hK : IsCompact K) (m : ℕ) :
    {n | pt m n ∈ K}.Finite
Proof
:= by
  have hD : (K ∩ {x | ∃ n, x = pt m n}).Finite := by
    refine (hK.inter_right (isClosed_spine m)).finite ?_
    refine isDiscrete_iff_forall_mem_exists_isOpen.2 fun y ⟨hyK, n, hy⟩ ↦ ?_
    subst hy
    exact ⟨{pt m n}, isOpen_singleton_pt m n,
      inter_eq_left.2 (singleton_subset_iff.2 ⟨hyK, n, rfl⟩)⟩
  refine (hD.preimage (f := pt m) (fun a _ b _ h ↦ (pt_inj.1 h).2)).subset fun n hn ↦ ?_
  exact ⟨hn, n, rfl⟩

theorem isCompact_of_isClosed

TopologyByExample.MetricFan.isCompact_of_isClosed

A closed subset of the metric fan meeting each spine in a finite set is compact: it lies in the vertex together with a sequence converging to the vertex.

theorem isCompact_of_isClosed {C : Set MetricFan} (hC : IsClosed C)
    (hfin : ∀ m, {n | pt m n ∈ C}.Finite) : IsCompact C
Proof
:= by
  set P := {p : ℕ × ℕ | pt p.1 p.2 ∈ C}
  let u : P → MetricFan := fun p ↦ pt p.val.1 p.val.2
  have hu : Tendsto u cofinite (𝓝 vertex) := by
    intro s hs
    obtain ⟨-, N, hN⟩ := mem_nhds_vertex_iff.1 hs
    refine mem_cofinite.2 ?_
    have : ((⋃ m ∈ Finset.range N, Prod.mk m '' {n | pt m n ∈ C}) : Set (ℕ × ℕ)).Finite :=
      (Finset.range N).finite_toSet.biUnion fun m _ ↦ (hfin m).image _
    refine (this.preimage Subtype.val_injective.injOn).subset fun p hp ↦ ?_
    simp only [mem_compl_iff, mem_preimage] at hp
    refine mem_iUnion₂.2 ⟨p.val.1, Finset.mem_range.2 ?_, p.val.2, p.property, rfl⟩
    by_contra h
    exact hp (hN _ _ (not_lt.1 h))
  refine (hu.isCompact_insert_range_of_cofinite).of_isClosed_subset hC fun x hx ↦ ?_
  rcases eq_vertex_or_exists_pt x with rfl | ⟨m, n, rfl⟩
  · exact mem_insert _ _
  · exact mem_insert_of_mem _ ⟨⟨(m, n), hx⟩, rfl⟩

theorem isCompact_iff

TopologyByExample.MetricFan.isCompact_iff

A subset of the metric fan is compact if and only if it is closed and meets each spine in a finite set.

theorem isCompact_iff {K : Set MetricFan} :
    IsCompact K ↔ IsClosed K ∧ ∀ m, {n | pt m n ∈ K}.Finite
Proof
:=
  ⟨fun hK ↦ ⟨hK.isClosed, finite_spine_of_isCompact hK⟩, fun h ↦ isCompact_of_isClosed h.1 h.2⟩

On this site: Metric fan: Compact subsets are the closed sets meeting each spine finitely