Lean library · module TopologyByExample.Spaces.RadialMetric
The radial metric
The plane, here the complex numbers, with the radial metric: the distance between two points on a common line through the origin is their Euclidean distance, and between any other two points it is the sum of their distances from the origin. Every journey runs along lines through the origin.
Main definitions
TopologyByExample.RadialMetric.Coll: two points lie on a common line through the origin.TopologyByExample.RadialMetric: the space, with its metric.TopologyByExample.RadialMetric.toRad: the identification ofℂwith the space.
Main statements
TopologyByExample.RadialMetric.instCompleteSpace: the metric is complete.TopologyByExample.RadialMetric.isPathConnected_ball: every ball is path connected; so the space is path connected and locally path connected.TopologyByExample.RadialMetric.exists_closed_discrete_continuum_le: the vertical line through1is closed and discrete.TopologyByExample.RadialMetric.not_weaklyLocallyCompactSpace: the origin has no compact neighbourhood.TopologyByExample.RadialMetric.isometry_line: each line through the origin carries the Euclidean metric.
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 RadialMetric
TopologyByExample.RadialMetric
The radial metric space: the plane ℂ with the radial metric.
def RadialMetric : Type
:= ℂ
On this site: Space: Radial metric
definition toRad
TopologyByExample.RadialMetric.toRad
The identification of the plane with the radial metric space.
def toRad : ℂ ≃ RadialMetric
:= Equiv.refl ℂ
instance
The space is nonempty.
instance : Nonempty RadialMetric
Proof
:= ⟨toRad 0⟩
definition Coll
TopologyByExample.RadialMetric.Coll
The points x and y lie on a common line through the origin.
def Coll (x y : ℂ) : Prop
:= x.re * y.im = x.im * y.re
theorem coll_comm
TopologyByExample.RadialMetric.coll_comm
theorem coll_comm {x y : ℂ} : Coll x y ↔ Coll y x
Proof
:= by
unfold Coll
constructor <;> intro h <;> linarith
theorem coll_self
TopologyByExample.RadialMetric.coll_self
theorem coll_self (x : ℂ) : Coll x x
Proof
:= by
unfold Coll
ring
theorem coll_zero_right
TopologyByExample.RadialMetric.coll_zero_right
theorem coll_zero_right (x : ℂ) : Coll x 0
Proof
:= by simp [Coll]
theorem coll_zero_left
TopologyByExample.RadialMetric.coll_zero_left
theorem coll_zero_left (x : ℂ) : Coll 0 x
Proof
:= by simp [Coll]
theorem trans
TopologyByExample.RadialMetric.Coll.trans
Collinearity with the origin is transitive through a point other than the origin.
theorem Coll.trans {x y z : ℂ} (hxy : Coll x y) (hyz : Coll y z) (hy : y ≠ 0) : Coll x z
Proof
:= by
unfold Coll at *
have h1 : y.re * (x.re * z.im - x.im * z.re) = 0 := by
linear_combination x.re * hyz + z.re * hxy
have h2 : y.im * (x.re * z.im - x.im * z.re) = 0 := by
linear_combination z.im * hxy + x.im * hyz
by_cases hre : y.re = 0
· have him : y.im ≠ 0 := fun him ↦ hy (Complex.ext hre him)
have := (mul_eq_zero.1 h2).resolve_left him
linarith
· have := (mul_eq_zero.1 h1).resolve_left hre
linarith
theorem coll_segment
TopologyByExample.RadialMetric.coll_segment
The points of a segment between two points on a common line through the origin lie on that line.
theorem coll_segment {a b : ℂ} (h : Coll a b) (s t : ℝ) :
Coll (a + s * (b - a)) (a + t * (b - a))
Proof
:= by
unfold Coll at *
simp only [add_re, mul_re, ofReal_re, sub_re, ofReal_im, sub_im, zero_mul, sub_zero, add_im,
mul_im]
linear_combination (t - s) * h
definition rdist
TopologyByExample.RadialMetric.rdist
The radial distance on the plane.
noncomputable def rdist (x y : ℂ) : ℝ
:= by
classical exact if Coll x y then ‖x - y‖ else ‖x‖ + ‖y‖
theorem rdist_of_coll
TopologyByExample.RadialMetric.rdist_of_coll
theorem rdist_of_coll {x y : ℂ} (h : Coll x y) : rdist x y = ‖x - y‖
Proof
:= by simp [rdist, h]
theorem rdist_of_not_coll
TopologyByExample.RadialMetric.rdist_of_not_coll
theorem rdist_of_not_coll {x y : ℂ} (h : ¬Coll x y) : rdist x y = ‖x‖ + ‖y‖
Proof
:= by
simp [rdist, h]
theorem norm_sub_le_rdist
TopologyByExample.RadialMetric.norm_sub_le_rdist
theorem norm_sub_le_rdist (x y : ℂ) : ‖x - y‖ ≤ rdist x y
Proof
:= by
by_cases h : Coll x y
· rw [rdist_of_coll h]
· rw [rdist_of_not_coll h]
exact norm_sub_le x y
theorem rdist_le_norm_add
TopologyByExample.RadialMetric.rdist_le_norm_add
theorem rdist_le_norm_add (x y : ℂ) : rdist x y ≤ ‖x‖ + ‖y‖
Proof
:= by
by_cases h : Coll x y
· rw [rdist_of_coll h]
exact norm_sub_le x y
· rw [rdist_of_not_coll h]
theorem rdist_comm
TopologyByExample.RadialMetric.rdist_comm
theorem rdist_comm (x y : ℂ) : rdist x y = rdist y x
Proof
:= by
by_cases h : Coll x y
· rw [rdist_of_coll h, rdist_of_coll (coll_comm.1 h), norm_sub_rev]
· rw [rdist_of_not_coll h, rdist_of_not_coll (fun h' ↦ h (coll_comm.1 h')), add_comm]
theorem rdist_zero_right
TopologyByExample.RadialMetric.rdist_zero_right
theorem rdist_zero_right (x : ℂ) : rdist x 0 = ‖x‖
Proof
:= by
rw [rdist_of_coll (coll_zero_right x), sub_zero]
theorem rdist_triangle
TopologyByExample.RadialMetric.rdist_triangle
theorem rdist_triangle (x y z : ℂ) : rdist x z ≤ rdist x y + rdist y z
Proof
:= by
by_cases hxz : Coll x z
· rw [rdist_of_coll hxz]
calc ‖x - z‖ ≤ ‖x - y‖ + ‖y - z‖ := norm_sub_le_norm_sub_add_norm_sub x y z
_ ≤ rdist x y + rdist y z := add_le_add (norm_sub_le_rdist x y) (norm_sub_le_rdist y z)
· rw [rdist_of_not_coll hxz]
by_cases hxy : Coll x y
· by_cases hyz : Coll y z
· have hy : y = 0 := by
by_contra hy
exact hxz (hxy.trans hyz hy)
subst hy
rw [rdist_zero_right, rdist_comm, rdist_zero_right]
· rw [rdist_of_not_coll hyz]
have := norm_sub_le_rdist x y
have := norm_sub_norm_le x y
linarith [norm_sub_le_rdist x y, norm_nonneg y]
· rw [rdist_of_not_coll hxy]
have h1 := norm_sub_le_rdist y z
have h2 := norm_sub_norm_le z y
rw [norm_sub_rev] at h2
linarith
instance
The radial metric.
noncomputable instance : MetricSpace RadialMetric
Proof
where
dist x y := rdist (toRad.symm x) (toRad.symm y)
dist_self x := by simp [rdist_of_coll (coll_self _)]
dist_comm x y := rdist_comm _ _
dist_triangle x y z := rdist_triangle _ _ _
eq_of_dist_eq_zero {x y} h := by
have h' : ‖toRad.symm x - toRad.symm y‖ = 0 :=
le_antisymm ((norm_sub_le_rdist _ _).trans_eq h) (norm_nonneg _)
exact toRad.symm.injective (sub_eq_zero.1 (norm_eq_zero.1 h'))
theorem dist_eq
TopologyByExample.RadialMetric.dist_eq
theorem dist_eq (x y : ℂ) : dist (toRad x) (toRad y) = rdist x y
Proof
:= rfl
theorem dist_zero
TopologyByExample.RadialMetric.dist_zero
theorem dist_zero (x : ℂ) : dist (toRad x) (toRad 0) = ‖x‖
Proof
:= rdist_zero_right x
theorem continuous_symm_toRad
TopologyByExample.RadialMetric.continuous_symm_toRad
The identification with the Euclidean plane is continuous (indeed 1-Lipschitz).
theorem continuous_symm_toRad : Continuous toRad.symm
Proof
:=
LipschitzWith.continuous (K := 1) <| LipschitzWith.of_dist_le_mul fun x y ↦ by
simp only [NNReal.coe_one, one_mul, dist_eq_norm]
exact norm_sub_le_rdist (toRad.symm x) (toRad.symm y)
Completeness
instance instCompleteSpace
TopologyByExample.RadialMetric.instCompleteSpace
The radial metric is complete.
instance instCompleteSpace : CompleteSpace RadialMetric
Proof
:= by
refine Metric.complete_of_cauchySeq_tendsto fun u hu ↦ ?_
set v : ℕ → ℂ := fun n ↦ toRad.symm (u n)
have hv : CauchySeq v := by
refine Metric.cauchySeq_iff.2 fun ε hε ↦ ?_
obtain ⟨N, hN⟩ := Metric.cauchySeq_iff.1 hu ε hε
exact ⟨N, fun m hm n hn ↦ (dist_eq_norm _ _).trans_lt
((norm_sub_le_rdist _ _).trans_lt (hN m hm n hn))⟩
obtain ⟨a, ha⟩ := cauchySeq_tendsto_of_complete hv
refine ⟨toRad a, ?_⟩
by_cases ha0 : a = 0
· subst ha0
rw [tendsto_iff_dist_tendsto_zero]
have : (fun n ↦ dist (u n) (toRad 0)) = fun n ↦ ‖v n‖ := funext fun n ↦ dist_zero (v n)
rw [this]
simpa using ha.norm
· have hpos : 0 < ‖a‖ / 2 := by positivity
obtain ⟨N₁, hN₁⟩ := Metric.cauchySeq_iff.1 hu _ hpos
have hnorm : ∀ᶠ n in atTop, ‖a‖ / 2 < ‖v n‖ :=
(continuous_norm.tendsto a).comp ha |>.eventually (lt_mem_nhds (by linarith))
obtain ⟨N₂, hN₂⟩ := eventually_atTop.1 hnorm
set N := max N₁ N₂
have hcoll : ∀ n ≥ N, Coll (v N) (v n) := by
intro n hn
by_contra h
have := hN₁ N (le_max_left _ _) n (le_trans (le_max_left _ _) hn)
change rdist _ _ < _ at this
rw [rdist_of_not_coll h] at this
linarith [hN₂ N (le_max_right _ _), hN₂ n (le_trans (le_max_right _ _) hn)]
have hvN : v N ≠ 0 := by
intro h
have := hN₂ N (le_max_right _ _)
rw [h, norm_zero] at this
linarith
have haN : Coll (v N) a := by
have hclosed : IsClosed {z : ℂ | Coll (v N) z} :=
isClosed_eq (by fun_prop) (by fun_prop)
exact hclosed.mem_of_tendsto ha (eventually_atTop.2 ⟨N, hcoll⟩)
have hcoll' : ∀ n ≥ N, Coll (v n) a := fun n hn ↦
(coll_comm.1 (hcoll n hn)).trans haN hvN
rw [tendsto_iff_dist_tendsto_zero]
have hsub : Tendsto (fun n ↦ ‖v n - a‖) atTop (𝓝 0) := by
simpa using (ha.sub_const a).norm
refine hsub.congr' (eventually_atTop.2 ⟨N, fun n hn ↦ ?_⟩)
change ‖v n - a‖ = rdist (v n) a
rw [rdist_of_coll (hcoll' n hn)]
Segments and paths
definition seg
TopologyByExample.RadialMetric.seg
The point a + t (b - a) of the line through a and b.
def seg (a b : ℂ) (t : ℝ) : ℂ
:= a + t * (b - a)
theorem dist_seg
TopologyByExample.RadialMetric.dist_seg
theorem dist_seg {a b : ℂ} (h : Coll a b) (s t : ℝ) :
dist (toRad (seg a b s)) (toRad (seg a b t)) = |s - t| * ‖b - a‖
Proof
:= by
unfold seg
rw [dist_eq, rdist_of_coll (coll_segment h s t)]
rw [show a + s * (b - a) - (a + t * (b - a)) = ((s - t : ℝ) : ℂ) * (b - a) by push_cast; ring,
norm_mul, norm_real, Real.norm_eq_abs]
theorem continuous_seg
TopologyByExample.RadialMetric.continuous_seg
A segment between two points on a common line through the origin is continuous for the radial metric.
theorem continuous_seg {a b : ℂ} (h : Coll a b) : Continuous fun t ↦ toRad (seg a b t)
Proof
:=
LipschitzWith.continuous (K := ‖b - a‖₊) <| LipschitzWith.of_dist_le_mul fun s t ↦ by
rw [dist_seg h, Real.dist_eq, coe_nnNorm, mul_comm]
definition segPath
TopologyByExample.RadialMetric.segPath
The path along the segment from a to b, for points on a common line through the
origin.
noncomputable def segPath {a b : ℂ} (h : Coll a b) : Path (toRad a) (toRad b)
Definition
where
toFun t := toRad (seg a b t)
continuous_toFun := (continuous_seg h).comp continuous_subtypeVal
source' := by simp [seg]
target' := by simp [seg]
theorem segPath_apply
TopologyByExample.RadialMetric.segPath_apply
theorem segPath_apply {a b : ℂ} (h : Coll a b) (t : unitInterval) :
segPath h t = toRad (seg a b t)
Proof
:= rfl
theorem isPathConnected_ball
TopologyByExample.RadialMetric.isPathConnected_ball
Every ball is path connected: each of its points is joined to the centre inside it, directly or through the origin.
theorem isPathConnected_ball (x : RadialMetric) {r : ℝ} (hr : 0 < r) :
IsPathConnected (Metric.ball x r)
Proof
:= by
obtain ⟨c, rfl⟩ := toRad.surjective x
refine ⟨toRad c, Metric.mem_ball_self hr, fun {y} hy ↦ ?_⟩
obtain ⟨y, rfl⟩ := toRad.surjective y
rw [Metric.mem_ball, dist_comm, dist_eq] at hy
have hcy : ∀ t : unitInterval, (t : ℝ) * ‖y - c‖ ≤ ‖y - c‖ := fun t ↦
mul_le_of_le_one_left (norm_nonneg _) t.property.2
by_cases h : Coll c y
· refine ⟨segPath h, fun t ↦ ?_⟩
rw [segPath_apply, Metric.mem_ball, dist_comm, show toRad c = toRad (seg c y 0) by simp [seg],
dist_seg h, zero_sub, abs_neg, abs_of_nonneg t.property.1]
rw [rdist_of_coll h, norm_sub_rev] at hy
exact (hcy t).trans_lt hy
· rw [rdist_of_not_coll h] at hy
have h1 : JoinedIn (Metric.ball (toRad c) r) (toRad c) (toRad 0) := by
refine ⟨segPath (coll_zero_right c), fun t ↦ ?_⟩
rw [segPath_apply, Metric.mem_ball, dist_comm,
show toRad c = toRad (seg c 0 0) by simp [seg], dist_seg (coll_zero_right c), zero_sub,
abs_neg, abs_of_nonneg t.property.1, zero_sub, norm_neg]
have := mul_le_of_le_one_left (norm_nonneg c) t.property.2
linarith [norm_nonneg y]
have h2 : JoinedIn (Metric.ball (toRad c) r) (toRad 0) (toRad y) := by
refine ⟨segPath (coll_zero_left y), fun t ↦ ?_⟩
rw [segPath_apply, Metric.mem_ball, dist_comm, dist_eq]
refine (rdist_le_norm_add _ _).trans_lt ?_
rw [seg, zero_add, sub_zero, norm_mul, norm_real, Real.norm_eq_abs,
abs_of_nonneg t.property.1]
have := mul_le_of_le_one_left (norm_nonneg y) t.property.2
linarith
exact h1.trans h2
instance
The space is locally path connected.
instance : LocallyPathConnectedSpace RadialMetric
Proof
:=
LocallyPathConnectedSpace.of_bases (fun _ ↦ Metric.nhds_basis_ball)
fun x _ hr ↦ isPathConnected_ball x hr
instance
The space is path connected: every point is joined to the origin along a segment.
instance : PathPreconnectedSpace RadialMetric
Proof
:= by
have h : ∀ x : RadialMetric, Joined x (toRad 0) := fun x ↦ by
obtain ⟨x, rfl⟩ := toRad.surjective x
exact ⟨segPath (coll_zero_right x)⟩
exact ⟨fun x y ↦ (h x).trans (h y).symm⟩
Closed discrete sets and local compactness
theorem not_coll_line
TopologyByExample.RadialMetric.not_coll_line
The points 1 + s i and 1 + t i, for s ≠ t, are not on a common line through the
origin.
theorem not_coll_line {s t : ℝ} (h : s ≠ t) : ¬Coll (1 + s * I) (1 + t * I)
Proof
:= by
simp only [Coll, add_re, one_re, mul_re, ofReal_re, I_re, mul_zero, ofReal_im, I_im, mul_one,
sub_self, add_zero, add_im, one_im, mul_im, zero_add, one_mul]
intro h'
exact h h'.symm
theorem exists_closed_discrete_continuum_le
TopologyByExample.RadialMetric.exists_closed_discrete_continuum_le
The vertical line through 1 is a closed discrete set of cardinality 𝔠: its points are at
distance at least 2 from each other.
theorem exists_closed_discrete_continuum_le :
∃ s : Set RadialMetric, IsClosed s ∧ IsDiscrete s ∧ 𝔠 ≤ #s
Proof
:=
exists_closed_discrete_continuum_le_of_pairwise_le_dist two_pos
(f := fun t : ℝ ↦ toRad (1 + t * I)) (toRad.injective.comp injective_one_add_mul_I)
fun s t h ↦ by
rw [dist_eq, rdist_of_not_coll (not_coll_line h)]
linarith [one_le_norm_one_add_mul_I s, one_le_norm_one_add_mul_I t]
On this site: The radial metric space has a closed discrete subset of cardinality \(\mathfrak{c}\)
theorem not_weaklyLocallyCompactSpace
TopologyByExample.RadialMetric.not_weaklyLocallyCompactSpace
The origin has no compact neighbourhood.
theorem not_weaklyLocallyCompactSpace : ¬WeaklyLocallyCompactSpace RadialMetric
Proof
:= by
intro h
obtain ⟨K, hK, hK0⟩ := h.exists_compact_mem_nhds (toRad 0)
obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.1 hK0
set c : ℝ := ε / 4 with hcε
have hc : 0 < c := by positivity
let f : ℕ → RadialMetric := fun n ↦ toRad ((c : ℂ) + (c / (n + 1) : ℝ) * I)
have hf : Function.Injective f := toRad.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 : (m : ℝ) ≠ n := fun h ↦ hmn (by rw [Nat.cast_injective h])
have hnc : ¬Coll ((c : ℂ) + (c / (m + 1) : ℝ) * I) ((c : ℂ) + (c / (n + 1) : ℝ) * I) := by
simp only [Coll, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one,
sub_self, add_zero, add_im, mul_im, zero_add]
intro h'
have h'' : c * (c / (n + 1)) = c * (c / (m + 1)) := by linarith
have := mul_left_cancel₀ hc.ne' h''
rw [div_eq_div_iff (by positivity) (by positivity)] at this
have h3 : c * ((n : ℝ) + 1 - (m + 1)) = 0 := by linarith
rcases mul_eq_zero.1 h3 with h4 | h4
· exact hc.ne' h4
· exact hne (by linarith)
change 2 * c ≤ dist (toRad ((c : ℂ) + (c / (m + 1) : ℝ) * I))
(toRad ((c : ℂ) + (c / (n + 1) : ℝ) * I))
rw [dist_eq, rdist_of_not_coll hnc]
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 radial metric space is not weakly locally compact
Lines through the origin
theorem isometry_line
TopologyByExample.RadialMetric.isometry_line
Each line through the origin carries the Euclidean metric: for a unit vector u, the map
t ↦ t u from the real line is an isometry.
theorem isometry_line {u : ℂ} (hu : ‖u‖ = 1) : Isometry fun t : ℝ ↦ toRad (t * u)
Proof
:= by
refine Isometry.of_dist_eq fun s t ↦ ?_
have h := dist_seg (coll_zero_left u) s t
simp only [seg, zero_add, sub_zero, hu, mul_one] at h
rw [h, Real.dist_eq]
On this site: Radial metric: Each line through the origin carries the Euclidean metric