Lean library · module TopologyByExample.Spaces.PostOfficeMetric
The post office metric
The plane, here the complex numbers, with the metric d(x, y) = ‖x‖ + ‖y‖ for x ≠ y (and
d(x, x) = 0): every journey goes through the origin. Every point other than the origin is
isolated, and the neighbourhoods of the origin are the sets containing a Euclidean disc about it.
Main definitions
TopologyByExample.PostOfficeMetric: the space, with its metric.TopologyByExample.PostOfficeMetric.toPO: the identification ofℂwith the space.
Main statements
TopologyByExample.PostOfficeMetric.instAlmostDiscreteSpace: the origin is the only point that is not isolated.TopologyByExample.PostOfficeMetric.zeroDimensionalSpace: every ball is clopen.TopologyByExample.PostOfficeMetric.exists_closed_discrete_continuum_le: a closed discrete set of cardinality𝔠.TopologyByExample.PostOfficeMetric.not_weaklyLocallyCompactSpace: the origin has no compact neighbourhood.
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 PostOfficeMetric
TopologyByExample.PostOfficeMetric
The post office metric space: the plane ℂ, with distance ‖x‖ + ‖y‖ between distinct
points.
def PostOfficeMetric : Type
:= ℂ
On this site: Space: Post office metric
definition toPO
TopologyByExample.PostOfficeMetric.toPO
The identification of the plane with the post office metric space.
def toPO : ℂ ≃ PostOfficeMetric
:= Equiv.refl ℂ
instance
The space is nonempty.
instance : Nonempty PostOfficeMetric
Proof
:= ⟨toPO 0⟩
definition podist
TopologyByExample.PostOfficeMetric.podist
The post office distance on the plane.
noncomputable def podist (x y : ℂ) : ℝ
:= if x = y then 0 else ‖x‖ + ‖y‖
theorem podist_of_ne
TopologyByExample.PostOfficeMetric.podist_of_ne
theorem podist_of_ne {x y : ℂ} (h : x ≠ y) : podist x y = ‖x‖ + ‖y‖
Proof
:= by simp [podist, h]
theorem podist_le
TopologyByExample.PostOfficeMetric.podist_le
theorem podist_le (x y : ℂ) : podist x y ≤ ‖x‖ + ‖y‖
Proof
:= by
unfold podist
split_ifs
· positivity
· exact le_rfl
instance
The post office metric.
noncomputable instance : MetricSpace PostOfficeMetric
Proof
where
dist x y := podist (toPO.symm x) (toPO.symm y)
dist_self x := by simp [podist]
dist_comm x y := by
simp only [podist, eq_comm (a := toPO.symm x)]
split_ifs <;> ring
dist_triangle x y z := by
set a := toPO.symm x
set b := toPO.symm y
set c := toPO.symm z
by_cases hac : a = c
· rw [hac]
have : podist c c = 0 := by simp [podist]
rw [this]
unfold podist
split_ifs <;> positivity
· rw [podist_of_ne hac]
by_cases hab : a = b
· rw [← hab, podist_of_ne hac]
simp [podist]
· by_cases hbc : b = c
· rw [hbc, podist_of_ne hac]
simp [podist]
· rw [podist_of_ne hab, podist_of_ne hbc]
linarith [norm_nonneg b]
eq_of_dist_eq_zero {x y} h := by
change podist _ _ = 0 at h
set a := toPO.symm x
set b := toPO.symm y
by_contra hxy
have hne : a ≠ b := fun h' ↦ hxy (toPO.symm.injective h')
rw [podist_of_ne hne] at h
have ha := norm_nonneg a
have hb := norm_nonneg b
have hx : ‖a‖ = 0 := by linarith
have hy : ‖b‖ = 0 := by linarith
exact hne ((norm_eq_zero.1 hx).trans (norm_eq_zero.1 hy).symm)
theorem dist_eq
TopologyByExample.PostOfficeMetric.dist_eq
theorem dist_eq (x y : ℂ) : dist (toPO x) (toPO y) = podist x y
Proof
:= rfl
theorem dist_zero
TopologyByExample.PostOfficeMetric.dist_zero
theorem dist_zero (x : ℂ) : dist (toPO x) (toPO 0) = ‖x‖
theorem isOpen_singleton
TopologyByExample.PostOfficeMetric.isOpen_singleton
A point other than the origin is isolated.
theorem isOpen_singleton {x : ℂ} (hx : x ≠ 0) : IsOpen ({toPO x} : Set PostOfficeMetric)
Proof
:= by
refine Metric.isOpen_singleton_iff.2 ⟨‖x‖, norm_pos_iff.2 hx, fun y hy ↦ ?_⟩
by_contra hne
obtain ⟨y, rfl⟩ := toPO.surjective y
rw [dist_eq, podist_of_ne fun h ↦ hne (congrArg toPO h)] at hy
linarith [norm_nonneg y]
theorem isOpen_of_zero_notMem
TopologyByExample.PostOfficeMetric.isOpen_of_zero_notMem
A set not containing the origin is open.
theorem isOpen_of_zero_notMem {s : Set PostOfficeMetric} (hs : toPO 0 ∉ s) : IsOpen s
Proof
:= by
rw [← biUnion_of_singleton s]
refine isOpen_biUnion fun x hx ↦ ?_
obtain ⟨x, rfl⟩ := toPO.surjective x
exact isOpen_singleton fun h ↦ hs (h ▸ hx)
instance instAlmostDiscreteSpace
TopologyByExample.PostOfficeMetric.instAlmostDiscreteSpace
The origin is the only point that is not isolated.
instance instAlmostDiscreteSpace : AlmostDiscreteSpace PostOfficeMetric
Proof
:= by
refine ⟨⟨toPO 0, fun h ↦ ?_, fun x hx ↦ ?_⟩⟩
· obtain ⟨ε, hε, hball⟩ := Metric.isOpen_singleton_iff.1 h
have hne : ((ε / 2 : ℝ) : ℂ) ≠ 0 := by exact_mod_cast (half_pos hε).ne'
have := hball (toPO ((ε / 2 : ℝ) : ℂ)) (by
rw [dist_zero, norm_real, Real.norm_eq_abs, abs_of_pos (half_pos hε)]
linarith)
exact hne (toPO.injective this)
· obtain ⟨x, rfl⟩ := toPO.surjective x
exact isOpen_singleton fun h ↦ hx (h ▸ rfl)
On this site: The post office metric space is almost discrete
theorem isClopen_ball
TopologyByExample.PostOfficeMetric.isClopen_ball
Every ball is clopen.
theorem isClopen_ball (x : PostOfficeMetric) (r : ℝ) : IsClopen (Metric.ball x r)
Proof
:= by
refine ⟨?_, Metric.isOpen_ball⟩
by_cases h0 : toPO 0 ∈ Metric.ball x r
· exact isOpen_compl_iff.1 (isOpen_of_zero_notMem fun h ↦ h h0)
· have : Metric.ball x r ⊆ {x} := by
intro y hy
by_contra hne
obtain ⟨x', rfl⟩ := toPO.surjective x
obtain ⟨y', rfl⟩ := toPO.surjective y
rw [Metric.mem_ball, dist_eq, podist_of_ne fun h ↦ hne (congrArg toPO h)] at hy
rw [Metric.mem_ball, dist_comm, dist_zero] at h0
linarith [norm_nonneg y']
rcases subset_singleton_iff_eq.1 this with h | h <;> rw [h]
exacts [isClosed_empty, isClosed_singleton]
theorem zeroDimensionalSpace
TopologyByExample.PostOfficeMetric.zeroDimensionalSpace
The space is zero-dimensional: the balls form a base of clopen sets.
theorem zeroDimensionalSpace : ZeroDimensionalSpace PostOfficeMetric
Proof
:=
ZeroDimensionalSpace.of_hasBasis fun x ↦
⟨ℝ, fun r ↦ 0 < r, Metric.ball x, fun r _ ↦ isClopen_ball x r, Metric.nhds_basis_ball⟩
On this site: The post office metric space is zero-dimensional
theorem two_le_dist_line
TopologyByExample.PostOfficeMetric.two_le_dist_line
The points 1 + t i, for real t, are at distance at least 2 from each other.
theorem two_le_dist_line {s t : ℝ} (h : s ≠ t) :
2 ≤ dist (toPO (1 + s * I)) (toPO (1 + t * I))
Proof
:= by
have hne : (1 + s * I : ℂ) ≠ 1 + t * I := fun h' ↦ h (by
have := congrArg Complex.im h'
simpa using this)
rw [dist_eq, podist_of_ne hne]
have h1 : ∀ u : ℝ, 1 ≤ ‖(1 + u * I : ℂ)‖ := fun u ↦ by
have := Complex.abs_re_le_norm (1 + u * I)
simpa using this
linarith [h1 s, h1 t]
theorem exists_closed_discrete_continuum_le
TopologyByExample.PostOfficeMetric.exists_closed_discrete_continuum_le
The vertical line through 1 is a closed discrete set of cardinality 𝔠.
theorem exists_closed_discrete_continuum_le :
∃ s : Set PostOfficeMetric, IsClosed s ∧ IsDiscrete s ∧ 𝔠 ≤ #s
Proof
:=
exists_closed_discrete_continuum_le_of_pairwise_le_dist two_pos
(f := fun t : ℝ ↦ toPO (1 + t * I))
(fun s t h ↦ by
have := congrArg Complex.im (toPO.injective h)
simpa using this)
fun _ _ h ↦ two_le_dist_line h
On this site: The post office metric space has a closed discrete subset of cardinality \(\mathfrak{c}\)
theorem not_weaklyLocallyCompactSpace
TopologyByExample.PostOfficeMetric.not_weaklyLocallyCompactSpace
The origin has no compact neighbourhood.
theorem not_weaklyLocallyCompactSpace : ¬WeaklyLocallyCompactSpace PostOfficeMetric
Proof
:= by
intro h
obtain ⟨K, hK, hK0⟩ := h.exists_compact_mem_nhds (toPO 0)
obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hK0
set c : ℝ := ε / 4 with hcε
have hc : 0 < c := by positivity
let f : ℕ → PostOfficeMetric := fun n ↦ toPO ((c : ℂ) + (c / (n + 1) : ℝ) * I)
have hf : Function.Injective f := toPO.injective.comp (injective_seq hc)
refine not_subset_isCompact_of_pairwise_le_dist (s := range f) (ε := 2 * c) (by positivity)
?_ (infinite_range_of_injective hf) hK ?_
· rintro _ ⟨m, rfl⟩ _ ⟨n, rfl⟩ hmn
have hne : ((c : ℂ) + (c / (m + 1) : ℝ) * I) ≠ (c : ℂ) + (c / (n + 1) : ℝ) * I :=
fun h ↦ hmn (congrArg toPO h)
change 2 * c ≤ dist (toPO ((c : ℂ) + (c / (m + 1) : ℝ) * I))
(toPO ((c : ℂ) + (c / (n + 1) : ℝ) * I))
rw [dist_eq, podist_of_ne hne]
linarith [(norm_bounds_seq hc m).1, (norm_bounds_seq hc n).1]
· rintro _ ⟨n, rfl⟩
refine hball ?_
rw [Metric.mem_ball, dist_zero]
linarith [(norm_bounds_seq hc n).2]
On this site: The post office metric space is not weakly locally compact