Lean library · module TopologyByExample.Theorems.BoundedMetricExamples

Total boundedness and balls for bounded metrics

Source file

The compressed real metric need not be totally bounded. For the capped metric, the closure of a unit open ball need not be the corresponding closed ball.

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 real_fraction_not_totallyBounded

TopologyByExample.BoundedMetrics.real_fraction_not_totallyBounded

The bounded fractional metric on the real line is not totally bounded.

theorem real_fraction_not_totallyBounded :
    ¬ @TotallyBounded ℝ (fractionMetric ℝ).toUniformSpace univ
Proof
:= by
  intro h
  obtain ⟨t, ht, hcover⟩ :=
    (@Metric.totallyBounded_iff ℝ (fractionMetric ℝ).toPseudoMetricSpace univ).mp h
      (1 / 2) (by norm_num)
  obtain ⟨M, hM⟩ := ht.bddAbove
  obtain ⟨y, hy, hball⟩ := mem_iUnion₂.mp (hcover (mem_univ (M + 2)))
  change fraction (dist (M + 2) y) < 1 / 2 at hball
  have hsmall : dist (M + 2) y < 1 :=
    (fraction_lt_fraction dist_nonneg zero_le_one).mp (by
      norm_num [fraction] at hball ⊢
      exact hball)
  rw [Real.dist_eq] at hsmall
  have habs := (abs_lt.mp hsmall).2
  have hle := hM hy
  linarith

On this site: Real line: A bounded metric that is not totally bounded

theorem real_capped_unit_ball

TopologyByExample.BoundedMetrics.real_capped_unit_ball

The capped unit open ball about zero is the usual open interval.

theorem real_capped_unit_ball :
    @Metric.ball ℝ (cappedMetric ℝ).toPseudoMetricSpace 0 1 = Ioo (-1) 1
Proof
:= by
  ext x
  change min (dist x 0) 1 < 1 ↔ -1 < x ∧ x < 1
  simp [Real.dist_eq, min_lt_iff, abs_lt]

theorem real_closure_capped_unit_ball

TopologyByExample.BoundedMetrics.real_closure_capped_unit_ball

Its closure, in the same topology, is the usual closed interval.

theorem real_closure_capped_unit_ball :
    closure (@Metric.ball ℝ (cappedMetric ℝ).toPseudoMetricSpace 0 1) = Icc (-1) 1
Proof
:= by
  rw [real_capped_unit_ball, closure_Ioo (by norm_num : (-1 : ℝ) ≠ 1)]

theorem real_capped_unit_closedBall

TopologyByExample.BoundedMetrics.real_capped_unit_closedBall

The corresponding capped closed ball contains every real number.

theorem real_capped_unit_closedBall :
    @Metric.closedBall ℝ (cappedMetric ℝ).toPseudoMetricSpace 0 1 = univ
Proof
:= by
  ext x
  change min (dist x 0) 1 ≤ 1 ↔ True
  exact iff_true_intro (min_le_right _ _)

theorem real_capped_ball_closure_ne_closedBall

TopologyByExample.BoundedMetrics.real_capped_ball_closure_ne_closedBall

The open-ball closure is strictly smaller than the closed ball.

theorem real_capped_ball_closure_ne_closedBall :
    closure (@Metric.ball ℝ (cappedMetric ℝ).toPseudoMetricSpace 0 1) ≠
      @Metric.closedBall ℝ (cappedMetric ℝ).toPseudoMetricSpace 0 1
Proof
:= by
  rw [real_closure_capped_unit_ball, real_capped_unit_closedBall]
  intro h
  have hx : (2 : ℝ) ∈ Icc (-1) 1 := h.symm ▸ mem_univ 2
  norm_num at hx
variable (X : Type*) [MetricSpace X]

definition iteratedMetric

TopologyByExample.BoundedMetrics.iteratedMetric

Repeated fractional compression, starting at the original metric.

@[instance_reducible]
def iteratedMetric : ℕ → MetricSpace X
  | 0 => inferInstance
  | n + 1 => @fractionMetric X (iteratedMetric n)

theorem iteratedMetric_topology

TopologyByExample.BoundedMetrics.iteratedMetric_topology

Every iteration preserves the original topology.

theorem iteratedMetric_topology (n : ℕ) :
    (iteratedMetric X n).toUniformSpace.toTopologicalSpace =
      (inferInstance : TopologicalSpace X)
Proof
:= by
  induction n with
  | zero => rfl
  | succ n ih => exact ih

theorem iteratedMetric_dist_lt_one

TopologyByExample.BoundedMetrics.iteratedMetric_dist_lt_one

Every positive iterate is bounded by one.

theorem iteratedMetric_dist_lt_one (n : ℕ) (x y : X) :
    (iteratedMetric X (n + 1)).dist x y < 1
Proof
:=
  @fractionMetric_dist_lt_one X (iteratedMetric X n) x y

theorem iteratedMetric_dist

TopologyByExample.BoundedMetrics.iteratedMetric_dist

The exact distance after n fractional compressions.

theorem iteratedMetric_dist (n : ℕ) (x y : X) :
    (iteratedMetric X n).dist x y = dist x y / (1 + (n : ℝ) * dist x y)
Proof
:= by
  induction n with
  | zero => simp
  | succ n ih =>
    change fraction ((iteratedMetric X n).dist x y) = _
    rw [ih]
    unfold fraction
    push_cast
    have h : 0 < 1 + (n : ℝ) * dist x y := by positivity
    have h' : 0 < 1 + ((n : ℝ) + 1) * dist x y := by positivity
    field_simp
    ring