Lean library Β· module TopologyByExample.Theorems.ReciprocalMetricExamples
Accumulation and metric incompleteness of the reciprocal sequence
These statements distinguish the topology of a reciprocal subspace from the completeness of its inherited real metric.
This file was written by Codex (OpenAI's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.
Imports
theorem tendsto_reciprocal
TopologyByExample.BookReciprocals.tendsto_reciprocal
The reciprocal sequence converges to zero in the ambient real line.
theorem tendsto_reciprocal : Tendsto reciprocal atTop (π 0)
Proof
:=
tendsto_one_div_add_atTop_nhds_zero_nat (π := β)
theorem reciprocal_pos
TopologyByExample.BookReciprocals.reciprocal_pos
Every term is strictly positive.
theorem reciprocal_pos (n : β) : 0 < reciprocal n
Proof
:= by unfold reciprocal; positivity
theorem zero_not_mem_reciprocal
TopologyByExample.BookReciprocals.zero_not_mem_reciprocal
Zero is not a point of the reciprocal subspace.
theorem zero_not_mem_reciprocal : (0 : β) β reciprocalSet
Proof
:= by
rintro β¨n, hnβ©
exact (ne_of_gt (reciprocal_pos n)) hn
theorem infinite_reciprocals_in_nhds
TopologyByExample.BookReciprocals.infinite_reciprocals_in_nhds
Each neighbourhood of zero contains infinitely many positive reciprocals.
theorem infinite_reciprocals_in_nhds {U : Set β} (hU : U β π 0) :
(U β© reciprocalSet).Infinite
Proof
:= by
obtain β¨N, hNβ© := eventually_atTop.mp (tendsto_reciprocal hU)
have hi : Function.Injective (fun n : β β¦ reciprocal (n + N)) := by
intro n m h
exact Nat.add_right_cancel (isEmbedding_reciprocal.injective h)
apply (Set.infinite_range_of_injective hi).mono
rintro _ β¨n, rflβ©
exact β¨hN _ (by omega), mem_range_self _β©
theorem accPt_intervalUnion
TopologyByExample.BookReciprocals.accPt_intervalUnion
Zero is an accumulation point of the sequence together with the distant interval.
theorem accPt_intervalUnion : AccPt (0 : β) (π intervalUnion)
Proof
:= by
apply accPt_iff_nhds.mpr
intro U hU
obtain β¨x, hxU, hxβ© := (infinite_reciprocals_in_nhds hU).nonempty
refine β¨x, β¨hxU, Or.inl hxβ©, ?_β©
rintro rfl
exact zero_not_mem_reciprocal hx
theorem infinite_intervalUnion_in_nhds
TopologyByExample.BookReciprocals.infinite_intervalUnion_in_nhds
In fact every neighbourhood meets that union in infinitely many points.
theorem infinite_intervalUnion_in_nhds {U : Set β} (hU : U β π 0) :
(U β© intervalUnion).Infinite
Proof
:=
(infinite_reciprocals_in_nhds hU).mono (inter_subset_inter_right _ subset_union_left)
theorem countable_intervalUnion_in_some_nhds
TopologyByExample.BookReciprocals.countable_intervalUnion_in_some_nhds
A neighbourhood of zero has only countably many points of the union.
theorem countable_intervalUnion_in_some_nhds :
β U β π (0 : β), (U β© intervalUnion).Countable
Proof
:= by
refine β¨Iio 2, Iio_mem_nhds (by norm_num), (countable_range reciprocal).mono ?_β©
rintro x β¨hx, hxA | hxIβ©
Β· exact hxA
Β· exact False.elim (not_lt_of_ge hxI.1 hx)
definition sequence
TopologyByExample.BookReciprocals.sequence
The same sequence, with codomain its positive reciprocal subspace.
def sequence (n : β) : reciprocalSet
:= β¨reciprocal n, mem_range_self nβ©
theorem cauchySeq_sequence
TopologyByExample.BookReciprocals.cauchySeq_sequence
The inherited metric makes this sequence Cauchy.
theorem cauchySeq_sequence : CauchySeq sequence
Proof
:= by
rw [Metric.cauchySeq_iff]
have hc := Metric.cauchySeq_iff.mp tendsto_reciprocal.cauchySeq
simpa only [sequence, Subtype.dist_eq] using hc
theorem not_tendsto_sequence
TopologyByExample.BookReciprocals.not_tendsto_sequence
It converges to no point of the reciprocal subspace.
theorem not_tendsto_sequence (x : reciprocalSet) : Β¬Tendsto sequence atTop (π x)
Proof
:= by
intro h
have hx : x.val = 0 := tendsto_nhds_unique (continuous_subtypeVal.tendsto x |>.comp h)
tendsto_reciprocal
exact zero_not_mem_reciprocal (hx βΈ x.property)
theorem not_mapClusterPt_sequence
TopologyByExample.BookReciprocals.not_mapClusterPt_sequence
It has no subsequential accumulation point in that subspace either.
theorem not_mapClusterPt_sequence (x : reciprocalSet) : Β¬MapClusterPt x atTop sequence
Proof
:= by
intro h
exact not_tendsto_sequence x (le_nhds_of_cauchy_adhp cauchySeq_sequence h)
theorem not_completeSpace_reciprocal
TopologyByExample.BookReciprocals.not_completeSpace_reciprocal
The inherited metric is incomplete, despite the discrete topology.
theorem not_completeSpace_reciprocal : Β¬CompleteSpace reciprocalSet
Proof
:= by
intro h
obtain β¨x, hxβ© := cauchySeq_tendsto_of_complete cauchySeq_sequence
exact not_tendsto_sequence x hx
definition reciprocalMetric
TopologyByExample.BookReciprocals.reciprocalMetric
A metric on the positive integers, indexed by n + 1, obtained from reciprocals.
@[instance_reducible]
def reciprocalMetric : MetricSpace β
:=
(MetricSpace.induced reciprocal isEmbedding_reciprocal.injective inferInstance).replaceTopology
isEmbedding_reciprocal.isInducing.eq_induced
theorem reciprocalMetric_dist
TopologyByExample.BookReciprocals.reciprocalMetric_dist
The reciprocal metric has the displayed quotient formula.
theorem reciprocalMetric_dist (n m : β) :
reciprocalMetric.dist n m = |(n : β) - m| / (((n : β) + 1) * ((m : β) + 1))
Proof
:= by
change |reciprocal n - reciprocal m| = _
have hn : (n : β) + 1 β 0 := by positivity
have hm : (m : β) + 1 β 0 := by positivity
have he : reciprocal n - reciprocal m =
((m : β) - n) / (((n : β) + 1) * ((m : β) + 1)) := by
unfold reciprocal
field_simp
ring
rw [he, abs_div, abs_of_pos (by positivity : 0 < ((n : β) + 1) * ((m : β) + 1)),
abs_sub_comm]
theorem reciprocalMetric_topology
TopologyByExample.BookReciprocals.reciprocalMetric_topology
Its topology is exactly the usual discrete topology on the integers.
theorem reciprocalMetric_topology : reciprocalMetric.toUniformSpace.toTopologicalSpace =
(inferInstance : TopologicalSpace β)
Proof
:= rfl
theorem reciprocalMetric_isometry
TopologyByExample.BookReciprocals.reciprocalMetric_isometry
Reciprocation is an isometry for the new metric.
theorem reciprocalMetric_isometry :
@Isometry β β reciprocalMetric.toPseudoMetricSpace.toPseudoEMetricSpace
inferInstance reciprocal
Proof
:= by
apply (@isometry_iff_dist_eq β β reciprocalMetric.toPseudoMetricSpace
inferInstance reciprocal).mpr
intro n m
rfl
theorem reciprocalMetric_not_complete
TopologyByExample.BookReciprocals.reciprocalMetric_not_complete
This compatible metric on the positive integers is incomplete.
theorem reciprocalMetric_not_complete : Β¬@CompleteSpace β reciprocalMetric.toUniformSpace
Proof
:= by
intro h
have hc : IsClosed reciprocalSet :=
(@Isometry.isClosedEmbedding β β (letI := reciprocalMetric; inferInstance) h
inferInstance reciprocal reciprocalMetric_isometry).isClosed_range
have hz : (0 : β) β closure reciprocalSet := by
rw [ClosureComplementSubsets.closure_reciprocalSet]
exact mem_insert 0 reciprocalSet
exact zero_not_mem_reciprocal (hc.closure_eq βΈ hz)
theorem ordinaryMetric_complete
TopologyByExample.BookReciprocals.ordinaryMetric_complete
The same topology has its ordinary complete metric.
theorem ordinaryMetric_complete : CompleteSpace β
Proof
:= inferInstance
definition alternating
TopologyByExample.BookReciprocals.alternating
The alternating enumeration 1, 2, 1/2, 3/2, ....
def alternating (n : β) : β
:=
if n % 2 = 0 then reciprocal (n / 2) else 1 + reciprocal (n / 2)
theorem alternating_even
TopologyByExample.BookReciprocals.alternating_even
Even terms give the reciprocal sequence.
@[simp] theorem alternating_even (n : β) : alternating (2 * n) = reciprocal n
Proof
:= by
simp [alternating]
theorem alternating_odd
TopologyByExample.BookReciprocals.alternating_odd
Odd terms give its translate by one.
@[simp] theorem alternating_odd (n : β) : alternating (2 * n + 1) = 1 + reciprocal n
Proof
:= by
simp [alternating, Nat.mul_add_div]
theorem range_alternating
TopologyByExample.BookReciprocals.range_alternating
The range is exactly the alternating reciprocal subset.
theorem range_alternating : range alternating = AlternatingReciprocals.subset
Proof
:= by
ext x
constructor
Β· rintro β¨n, rflβ©
by_cases h : n % 2 = 0
Β· exact Or.inl β¨n / 2, by simp [alternating, h]β©
Β· exact Or.inr β¨n / 2, by simp [alternating, h]β©
Β· rintro (β¨n, rflβ© | β¨n, rflβ©)
Β· exact β¨2 * n, alternating_even nβ©
Β· exact β¨2 * n + 1, alternating_odd nβ©
theorem infinite_alternating_in_nhds
TopologyByExample.BookReciprocals.infinite_alternating_in_nhds
Every neighbourhood of zero meets the alternating range infinitely often.
theorem infinite_alternating_in_nhds {U : Set β} (hU : U β π 0) :
(U β© range alternating).Infinite
Proof
:= by
rw [range_alternating]
exact (infinite_reciprocals_in_nhds hU).mono
(inter_subset_inter_right _ subset_union_left)
theorem accPt_alternating_range
TopologyByExample.BookReciprocals.accPt_alternating_range
Zero is an accumulation point of the range as a subset of the real line.
theorem accPt_alternating_range : AccPt (0 : β) (π (range alternating))
Proof
:= by
apply accPt_iff_nhds.mpr
intro U hU
obtain β¨x, hxU, hxβ© := (infinite_reciprocals_in_nhds hU).nonempty
refine β¨x, β¨hxU, ?_β©, ?_β©
Β· rw [range_alternating]
exact Or.inl hx
Β· rintro rfl
exact zero_not_mem_reciprocal hx
theorem alternating_cluster_zero
TopologyByExample.BookReciprocals.alternating_cluster_zero
Zero is a cluster point of the alternating sequence.
theorem alternating_cluster_zero : MapClusterPt (0 : β) atTop alternating
Proof
:= by
have ht : Tendsto (fun n : β β¦ 2 * n) atTop atTop := by
apply tendsto_atTop_atTop.mpr
intro b
exact β¨b, fun a ha β¦ by omegaβ©
apply MapClusterPt.of_comp ht
simpa only [Function.comp_def, alternating_even] using tendsto_reciprocal.mapClusterPt
theorem alternating_not_tendsto_zero
TopologyByExample.BookReciprocals.alternating_not_tendsto_zero
The alternating sequence does not converge to zero.
theorem alternating_not_tendsto_zero : Β¬Tendsto alternating atTop (π (0 : β))
Proof
:= by
intro h
have ht : Tendsto (fun n : β β¦ 2 * n + 1) atTop atTop := by
apply tendsto_atTop_atTop.mpr
intro b
exact β¨b, fun a ha β¦ by omegaβ©
have hz : Tendsto (fun n β¦ 1 + reciprocal n) atTop (π (0 : β)) := by
simpa only [Function.comp_def, alternating_odd] using h.comp ht
have ho : Tendsto (fun n β¦ 1 + reciprocal n) atTop (π (1 : β)) := by
simpa using tendsto_const_nhds.add tendsto_reciprocal
have := tendsto_nhds_unique hz ho
norm_num at this
theorem ordinary_cauchy_eventually_constant
TopologyByExample.BookReciprocals.ordinary_cauchy_eventually_constant
A usual-metric Cauchy sequence of integers is eventually constant.
theorem ordinary_cauchy_eventually_constant {u : β β β} (hu : CauchySeq u) :
β N, β n β₯ N, u n = u N
Proof
:= by
obtain β¨N, hNβ© := Metric.cauchySeq_iff.mp hu 1 (by norm_num)
refine β¨N, fun n hn β¦ ?_β©
by_contra hne
exact not_lt_of_ge (Nat.pairwise_one_le_dist hne) (hN n hn N le_rfl)
theorem reciprocalMetric_cauchy
TopologyByExample.BookReciprocals.reciprocalMetric_cauchy
The increasing integer enumeration is Cauchy for the reciprocal metric.
theorem reciprocalMetric_cauchy :
@CauchySeq β β reciprocalMetric.toUniformSpace inferInstance (fun n β¦ n)
Proof
:= by
apply (@Metric.cauchySeq_iff β β reciprocalMetric.toPseudoMetricSpace
inferInstance inferInstance (fun n β¦ n)).mpr
exact Metric.cauchySeq_iff.mp tendsto_reciprocal.cauchySeq
theorem reciprocalMetric_enumeration_not_tendsto
TopologyByExample.BookReciprocals.reciprocalMetric_enumeration_not_tendsto
That enumeration converges to no integer for the reciprocal metric.
theorem reciprocalMetric_enumeration_not_tendsto (k : β) :
letI := reciprocalMetric
Β¬Tendsto (fun n : β β¦ n) atTop (π k)
Proof
:= by
let : MetricSpace β := reciprocalMetric
intro h
have hr : Tendsto reciprocal atTop (π (reciprocal k)) :=
reciprocalMetric_isometry.continuous.tendsto k |>.comp h
exact (ne_of_gt (reciprocal_pos k)) (tendsto_nhds_unique hr tendsto_reciprocal)