Lean library · module TopologyByExample.Theorems.NormInfinityEmbedding

A bounded embedding with a point at infinity

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
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]

definition height

TopologyByExample.NormInfinity.height

Height above the added point at infinity.

def height (x : E) : ℝ
:= (1 + ‖x‖)⁻¹

definition embed

TopologyByExample.NormInfinity.embed

The normalized graph embedding.

def embed (x : E) : E × ℝ
:= (height x ^ 2 • x, height x)

definition recover

TopologyByExample.NormInfinity.recover

Recover an original point from a graph point of nonzero height.

def recover (z : E × ℝ) : E
:= (z.2 ^ 2)⁻¹ • z.1
omit [NormedSpace ℝ E] in

theorem height_pos

TopologyByExample.NormInfinity.height_pos

Heights are strictly positive.

theorem height_pos (x : E) : 0 < height x
Proof
:= by
  unfold height
  positivity
omit [NormedSpace ℝ E] in

theorem height_le_one

TopologyByExample.NormInfinity.height_le_one

Heights do not exceed one.

theorem height_le_one (x : E) : height x ≤ 1
Proof
:= by
  unfold height
  exact inv_le_one_of_one_le₀ (by linarith [norm_nonneg x])
omit [NormedSpace ℝ E] in

theorem continuous_height

TopologyByExample.NormInfinity.continuous_height

The height varies continuously.

theorem continuous_height : Continuous (height : E → ℝ)
Proof
:= by
  apply Continuous.inv₀ (continuous_const.add continuous_norm)
  intro x
  change 1 + ‖x‖ ≠ 0
  positivity

theorem continuous_embed

TopologyByExample.NormInfinity.continuous_embed

The graph embedding is continuous.

theorem continuous_embed : Continuous (embed : E → E × ℝ)
Proof
:=
  ((continuous_height.pow 2).smul continuous_id).prodMk continuous_height

theorem recover_embed

TopologyByExample.NormInfinity.recover_embed

The inverse formula recovers every embedded point.

theorem recover_embed (x : E) : recover (embed x) = x
Proof
:= by
  simp [recover, embed, smul_smul, ne_of_gt (height_pos x)]

theorem embed_injective

TopologyByExample.NormInfinity.embed_injective

The graph embedding is injective.

theorem embed_injective : Function.Injective (embed : E → E × ℝ)
Proof
:=
  Function.LeftInverse.injective recover_embed

theorem embed_ne_zero

TopologyByExample.NormInfinity.embed_ne_zero

The added zero point is not in the image.

theorem embed_ne_zero (x : E) : embed x ≠ 0
Proof
:= by
  intro h
  have hh := congrArg Prod.snd h
  exact (ne_of_gt (height_pos x)) hh

theorem norm_embed_fst

TopologyByExample.NormInfinity.norm_embed_fst

The first-coordinate norm is determined by the height.

theorem norm_embed_fst (x : E) : ‖(embed x).1‖ = height x - height x ^ 2
Proof
:= by
  rw [embed, norm_smul, Real.norm_of_nonneg (sq_nonneg _)]
  have hn : 1 + ‖x‖ ≠ 0 := by positivity
  unfold height
  field_simp
  ring

theorem norm_embed

TopologyByExample.NormInfinity.norm_embed

Distance from the added point is exactly the height.

theorem norm_embed (x : E) : ‖embed x‖ = height x
Proof
:= by
  rw [Prod.norm_def, norm_embed_fst]
  change max (height x - height x ^ 2) ‖height x‖ = height x
  rw [Real.norm_of_nonneg (height_pos x).le]
  exact max_eq_right (by nlinarith [sq_nonneg (height x)])

theorem continuousAt_recover

TopologyByExample.NormInfinity.continuousAt_recover

The inverse formula is continuous away from height zero.

theorem continuousAt_recover {z : E × ℝ} (hz : z.2 ≠ 0) : ContinuousAt recover z
Proof
:=
  ((continuous_snd.pow 2).continuousAt.inv₀ (pow_ne_zero _ hz)).smul continuous_fst.continuousAt

theorem embed_recover

TopologyByExample.NormInfinity.embed_recover

A nonzero-height point on the graph's norm surface is recovered by the inverse.

theorem embed_recover {z : E × ℝ} (hz : z.2 ≠ 0)
    (hs : ‖z.1‖ = z.2 - z.2 ^ 2) : embed (recover z) = z
Proof
:= by
  have ht : 0 < z.2 := by
    have hn := norm_nonneg z.1
    have hsq := sq_nonneg z.2
    rcases lt_trichotomy z.2 0 with h | h | h
    · nlinarith
    · exact (hz h).elim
    · exact h
  have hn : ‖recover z‖ = (z.2 ^ 2)⁻¹ * (z.2 - z.2 ^ 2) := by
    rw [recover, norm_smul, Real.norm_of_nonneg (inv_nonneg.mpr (sq_nonneg _)), hs]
  have hh : height (recover z) = z.2 := by
    rw [height, hn]
    field_simp
    ring
  apply Prod.ext
  · change height (recover z) ^ 2 • ((z.2 ^ 2)⁻¹ • z.1) = z.1
    rw [hh, smul_smul, mul_inv_cancel₀ (pow_ne_zero _ hz), one_smul]
  · exact hh

definition extension

TopologyByExample.NormInfinity.extension

The embedded set together with its point at infinity.

def extension (s : Set E) : Set (E × ℝ)
:= insert 0 (embed '' s)

theorem norm_eq_of_mem_extension

TopologyByExample.NormInfinity.norm_eq_of_mem_extension

Every point of the extension satisfies the same norm equation.

theorem norm_eq_of_mem_extension {s : Set E} {z : E × ℝ} (hz : z ∈ extension s) :
    ‖z.1‖ = z.2 - z.2 ^ 2
Proof
:= by
  rcases hz with rfl | ⟨x, _, rfl⟩
  · simp
  · exact norm_embed_fst x

theorem isClosed_extension

TopologyByExample.NormInfinity.isClosed_extension

Adjoining infinity to the normalized image of a closed set gives a closed set.

theorem isClosed_extension {s : Set E} (hs : IsClosed s) : IsClosed (extension s)
Proof
:= by
  apply IsSeqClosed.isClosed
  intro f z hf hz
  have hsurface : IsClosed {w : E × ℝ | ‖w.1‖ = w.2 - w.2 ^ 2} :=
    isClosed_eq (continuous_norm.comp continuous_fst) (continuous_snd.sub (continuous_snd.pow 2))
  have he : ‖z.1‖ = z.2 - z.2 ^ 2 :=
    hsurface.mem_of_tendsto hz (Eventually.of_forall fun n ↦ norm_eq_of_mem_extension (hf n))
  by_cases ht : z.2 = 0
  · have hu : z.1 = 0 := norm_eq_zero.mp (by simpa [ht] using he)
    have hz0 : z = 0 := Prod.ext hu ht
    exact Or.inl hz0
  · have hne : ∀ᶠ n in atTop, (f n).2 ≠ 0 :=
      ((continuous_snd.tendsto z).comp hz).eventually (isOpen_ne.mem_nhds ht)
    have hmem : ∀ᶠ n in atTop, recover (f n) ∈ s := by
      filter_upwards [hne] with n hn
      rcases hf n with hzero | ⟨x, hx, heq⟩
      · exact (hn (by simp [hzero])).elim
      · rw [← heq, recover_embed]
        exact hx
    have hr : recover z ∈ s := hs.mem_of_tendsto ((continuousAt_recover ht).tendsto.comp hz) hmem
    exact Or.inr ⟨recover z, hr, embed_recover ht he⟩