Lean library · module TopologyByExample.Theorems.AlternatingReciprocals

The alternating reciprocal subset

Source file

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

definition subset

TopologyByExample.AlternatingReciprocals.subset

The exact range of the alternating sequence in Example 32, item 3.

def subset : Set ℝ
:= reciprocalSet ∪ range (fun n ↦ 1 + reciprocal n)

definition tail

TopologyByExample.AlternatingReciprocals.tail

The lower reciprocal tail, which omits the point one.

def tail (n : ℕ) : ℝ
:= reciprocal (n + 1)

definition translated

TopologyByExample.AlternatingReciprocals.translated

The upper convergent sequence, including its limit one.

def translated (p : OnePoint ℕ) : ℝ
:= 1 + (FortSpaces.harmonicMap p).val

theorem isEmbedding_tail

TopologyByExample.AlternatingReciprocals.isEmbedding_tail

The lower tail is an embedded discrete sequence.

theorem isEmbedding_tail : IsEmbedding tail
Proof
:=
  isEmbedding_reciprocal.comp
    (IsOpenEmbedding.of_continuous_injective_isOpenMap continuous_of_discreteTopology
      Nat.succ_injective (fun _ _ ↦ isOpen_discrete _)).isEmbedding

theorem isEmbedding_translated

TopologyByExample.AlternatingReciprocals.isEmbedding_translated

The upper sequence has exactly the convergent-sequence topology.

theorem isEmbedding_translated : IsEmbedding translated
Proof
:=
  (Homeomorph.addLeft (1 : ℝ)).isEmbedding.comp
    (IsEmbedding.subtypeVal.comp harmonicHomeomorph.isEmbedding)

theorem subset_eq

TopologyByExample.AlternatingReciprocals.subset_eq

Reassigning the shared point one gives the disjoint lower and upper pieces.

theorem subset_eq : subset = range tail ∪ range translated
Proof
:= by
  ext x
  constructor
  · rintro (⟨n, rfl⟩ | ⟨n, rfl⟩)
    · cases n with
      | zero => exact Or.inr ⟨∞, by norm_num [translated, FortSpaces.harmonicMap, reciprocal]⟩
      | succ n => exact Or.inl ⟨n, rfl⟩
    · exact Or.inr ⟨n, rfl⟩
  · rintro (⟨n, rfl⟩ | ⟨p, rfl⟩)
    · exact Or.inl ⟨n + 1, rfl⟩
    · cases p with
      | infty => exact Or.inl ⟨0, by norm_num [translated, FortSpaces.harmonicMap, reciprocal]⟩
      | coe n => exact Or.inr ⟨n, rfl⟩

theorem tail_le_half

TopologyByExample.AlternatingReciprocals.tail_le_half

Every lower point is at most one half.

theorem tail_le_half (n : ℕ) : tail n ≤ 1 / 2
Proof
:= by
  unfold tail reciprocal
  rw [div_le_iff₀ (by positivity)]
  have h : (0 : ℝ) ≤ n := Nat.cast_nonneg n
  push_cast
  linarith

theorem one_le_translated

TopologyByExample.AlternatingReciprocals.one_le_translated

Every upper point is at least one.

theorem one_le_translated (p : OnePoint ℕ) : 1 ≤ translated p
Proof
:= by
  cases p with
  | infty => simp [translated, FortSpaces.harmonicMap]
  | coe n =>
    change 1 ≤ 1 + 1 / ((n : ℝ) + 1)
    exact le_add_of_nonneg_right (by positivity)

definition homeomorph

TopologyByExample.AlternatingReciprocals.homeomorph

The alternating reciprocal subset is a discrete sequence plus a convergent sequence.

def homeomorph : subset ≃ₜ ℕ ⊕ OnePoint ℕ
Definition
:=
  (Homeomorph.setCongr subset_eq).trans
    ((SeparatedRealSubsets.cutHomeomorph (range tail) (range translated) (3 / 4)
      (by
        rintro _ ⟨n, rfl⟩
        change tail n < (3 : ℝ) / 4
        have h := tail_le_half n
        linarith)
      (by
        rintro _ ⟨p, rfl⟩
        change (3 : ℝ) / 4 < translated p
        have h := one_le_translated p
        linarith)).trans
      (isEmbedding_tail.toHomeomorph.symm.sumCongr isEmbedding_translated.toHomeomorph.symm))