Lean library · module TopologyByExample.Theorems.PathParameter

Real parameters for paths with interval fibres

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 {L : Type*} [LinearOrder L] [TopologicalSpace L] [OrderTopology L]
  [CompactSpace L]

definition runningMax

TopologyByExample.PathLoopErasure.runningMax

The maximum of a real-valued function up to a specified point.

noncomputable def runningMax (f : L → ℝ) (t : L) : ℝ
:= sSup (f '' Iic t)

theorem runningMax_attained

TopologyByExample.PathLoopErasure.runningMax_attained

A continuous running maximum is attained.

theorem runningMax_attained {f : L → ℝ} (hf : Continuous f) (t : L) :
    ∃ u ≤ t, runningMax f t = f u
Proof
:=
  isClosed_Iic.isCompact.exists_sSup_image_eq ⟨t, le_rfl⟩ hf.continuousOn

theorem le_runningMax

TopologyByExample.PathLoopErasure.le_runningMax

The running maximum dominates each previous value.

theorem le_runningMax {f : L → ℝ} (hf : Continuous f) {s t : L} (hst : s ≤ t) :
    f s ≤ runningMax f t
Proof
:=
  le_csSup (isClosed_Iic.isCompact.image hf).bddAbove ⟨s, hst, rfl⟩

theorem monotone_runningMax

TopologyByExample.PathLoopErasure.monotone_runningMax

Running maxima are nondecreasing.

theorem monotone_runningMax {f : L → ℝ} (hf : Continuous f) : Monotone (runningMax f)
Proof
:= by
  intro s t hst
  obtain ⟨u, hus, hu⟩ := runningMax_attained hf s
  rw [hu]
  exact le_runningMax hf (le_trans hus hst)

theorem continuous_runningMax

TopologyByExample.PathLoopErasure.continuous_runningMax

Running maxima of continuous functions on compact ordered spaces are continuous.

theorem continuous_runningMax {f : L → ℝ} (hf : Continuous f) :
    Continuous (runningMax f)
Proof
:= by
  have he (t : L) : f '' Iic t = (fun u ↦ f (min u t)) '' univ := by
    ext x
    constructor
    · rintro ⟨u, hu, rfl⟩
      exact ⟨u, mem_univ u, by dsimp; rw [min_eq_left hu]⟩
    · rintro ⟨u, _, rfl⟩
      exact ⟨min u t, min_le_right _ _, rfl⟩
  change Continuous (fun t ↦ sSup (f '' Iic t))
  simp_rw [he]
  exact isCompact_univ.continuous_sSup (hf.comp (continuous_snd.min continuous_fst))

theorem runningMax_eq_of_constant

TopologyByExample.PathLoopErasure.runningMax_eq_of_constant

A constant interval of a function remains constant under taking running maxima.

theorem runningMax_eq_of_constant {f : L → ℝ} (hf : Continuous f) {s t : L}
    (hst : s ≤ t) (hconst : ∀ u, s ≤ u → u ≤ t → f u = f s) :
    runningMax f s = runningMax f t
Proof
:= by
  apply le_antisymm (monotone_runningMax hf hst)
  obtain ⟨u, hut, hu⟩ := runningMax_attained hf t
  rw [hu]
  rcases le_total u s with hus | hsu
  · exact le_runningMax hf hus
  · rw [hconst u hsu hut]
    exact le_runningMax hf le_rfl

theorem dense_family_runningMax_separates

TopologyByExample.PathLoopErasure.dense_family_runningMax_separates

A dense family of interval-valued functions separates distinct path fibres by running maxima.

theorem dense_family_runningMax_separates {Y : Type*} [TopologicalSpace Y]
    [CompactSpace Y] [T2Space Y] {q : L → Y} (hq : Continuous q)
    (hinterval : ∀ s r t, s ≤ r → r ≤ t → q s = q t → q r = q s)
    {D : ℕ → C(Y, unitInterval)} (hD : DenseRange D)
    {s t : L} (hst : s ≤ t) (hne : q s ≠ q t) :
    ∃ n, runningMax (fun u ↦ (D n (q u) : ℝ)) s <
      runningMax (fun u ↦ (D n (q u) : ℝ)) t
Proof
:= by
  have hmiss : q t ∉ q '' Iic s := by
    rintro ⟨u, hus, hut⟩
    exact hne ((hinterval u s t hus hst hut).trans hut)
  obtain ⟨f, hf0, hf1, hfb⟩ := exists_continuous_zero_one_of_isClosed
    (isClosed_Iic.isCompact.image hq).isClosed isClosed_singleton
    (disjoint_singleton_right.mpr hmiss)
  let F : C(Y, unitInterval) :=
    ⟨fun y ↦ ⟨f y, hfb y⟩, f.continuous.subtype_mk hfb⟩
  obtain ⟨n, hn⟩ := hD.exists_dist_lt F (show (0 : ℝ) < 1 / 4 by norm_num)
  rw [dist_comm] at hn
  have happrox (y : Y) : |(D n y : ℝ) - f y| < 1 / 4 := by
    have h := lt_of_le_of_lt (ContinuousMap.dist_apply_le_dist (f := D n) (g := F) y) hn
    simpa only [Subtype.dist_eq, Real.dist_eq, F, ContinuousMap.coe_mk] using h
  have hcont : Continuous (fun u ↦ (D n (q u) : ℝ)) :=
    continuous_subtypeVal.comp ((D n).continuous.comp hq)
  obtain ⟨u, hus, hu⟩ := runningMax_attained hcont s
  have hu0 : f (q u) = 0 := hf0 ⟨u, hus, rfl⟩
  have ht1 : f (q t) = 1 := hf1 (mem_singleton _)
  have hsmall : (D n (q u) : ℝ) < 1 / 4 := by
    have h := (abs_lt.mp (happrox (q u))).2
    linarith
  have hlarge : 3 / 4 < (D n (q t) : ℝ) := by
    have h := (abs_lt.mp (happrox (q t))).1
    linarith
  refine ⟨n, ?_⟩
  rw [hu]
  exact lt_of_lt_of_le (by linarith) (le_runningMax hcont le_rfl)

theorem exists_monotone_separating_family

TopologyByExample.PathLoopErasure.exists_monotone_separating_family

A compact second-countable Hausdorff path image admits countably many continuous, nondecreasing interval-valued functions which distinguish exactly its fibres.

theorem exists_monotone_separating_family {Y : Type*} [TopologicalSpace Y]
    [CompactSpace Y] [T2Space Y] [SecondCountableTopology Y]
    {q : L → Y} (hq : Continuous q)
    (hinterval : ∀ s r t, s ≤ r → r ≤ t → q s = q t → q r = q s) :
    ∃ R : ℕ → L → ℝ,
      (∀ n, Continuous (R n) ∧ Monotone (R n) ∧ ∀ t, R n t ∈ Icc (0 : ℝ) 1) ∧
      ∀ s t, q s = q t ↔ ∀ n, R n s = R n t
Proof
:= by
  let D := TopologicalSpace.denseSeq C(Y, unitInterval)
  have hD : DenseRange D := TopologicalSpace.denseRange_denseSeq _
  let R : ℕ → L → ℝ := fun n ↦ runningMax (fun u ↦ (D n (q u) : ℝ))
  have hc (n) : Continuous (fun u ↦ (D n (q u) : ℝ)) :=
    continuous_subtypeVal.comp ((D n).continuous.comp hq)
  refine ⟨R, ?_, ?_⟩
  · intro n
    refine ⟨continuous_runningMax (hc n), monotone_runningMax (hc n), ?_⟩
    intro t
    obtain ⟨u, _, hu⟩ := runningMax_attained (hc n) t
    change runningMax _ t ∈ Icc (0 : ℝ) 1
    rw [hu]
    exact (D n (q u)).property
  · intro s t
    constructor
    · intro he n
      rcases le_total s t with hst | hts
      · exact runningMax_eq_of_constant (hc n) hst
          (fun u hsu hut ↦ congrArg (fun y ↦ (D n y : ℝ)) (hinterval s u t hsu hut he))
      · exact (runningMax_eq_of_constant (hc n) hts
          (fun u htu hus ↦ congrArg (fun y ↦ (D n y : ℝ))
            (hinterval t u s htu hus he.symm))).symm
    · intro he
      by_contra hne
      rcases le_total s t with hst | hts
      · obtain ⟨n, hn⟩ := dense_family_runningMax_separates hq hinterval hD hst hne
        exact (ne_of_lt hn) (he n)
      · obtain ⟨n, hn⟩ := dense_family_runningMax_separates hq hinterval hD hts (fun h ↦ hne h.symm)
        exact (ne_of_lt hn) (he n).symm
omit [OrderTopology L] [CompactSpace L] in

theorem combine_monotone_family

TopologyByExample.PathLoopErasure.combine_monotone_family

A countable family of bounded nondecreasing functions combines into one continuous nondecreasing function with exactly the same common fibres.

theorem combine_monotone_family {R : ℕ → L → ℝ}
    (hR : ∀ n, Continuous (R n) ∧ Monotone (R n) ∧ ∀ t, R n t ∈ Icc (0 : ℝ) 1) :
    ∃ h : L → ℝ, Continuous h ∧ Monotone h ∧
      ∀ s t, h s = h t ↔ ∀ n, R n s = R n t
Proof
:= by
  let w : ℕ → ℝ := fun n ↦ (1 / 2) ^ n
  have hw (n) : 0 < w n := pow_pos (by norm_num) n
  have hws : Summable w := summable_geometric_of_lt_one (by norm_num) (by norm_num)
  have hb (n) (t : L) : ‖w n * R n t‖ ≤ w n := by
    rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (hw n).le ((hR n).2.2 t).1)]
    exact mul_le_of_le_one_right (hw n).le ((hR n).2.2 t).2
  have hs (t : L) : Summable (fun n ↦ w n * R n t) :=
    hws.of_norm_bounded (fun n ↦ hb n t)
  let h : L → ℝ := fun t ↦ ∑' n, w n * R n t
  have hle {s t : L} (hst : s ≤ t) (n) : w n * R n s ≤ w n * R n t :=
    mul_le_mul_of_nonneg_left ((hR n).2.1 hst) (hw n).le
  have hm : Monotone h := fun s t hst ↦ (hs s).tsum_le_tsum (hle hst) (hs t)
  have hstrict {s t : L} (hst : s ≤ t) {n : ℕ} (hn : R n s ≠ R n t) : h s < h t :=
    Summable.tsum_lt_tsum (hle hst)
      (mul_lt_mul_of_pos_left (lt_of_le_of_ne ((hR n).2.1 hst) hn) (hw n)) (hs s) (hs t)
  refine ⟨h, continuous_tsum (fun n ↦ continuous_const.mul (hR n).1) hws hb, hm, ?_⟩
  intro s t
  constructor
  · intro he n
    by_contra hn
    rcases le_total s t with hst | hts
    · exact (ne_of_lt (hstrict hst hn)) he
    · exact (ne_of_lt (hstrict hts (fun hh ↦ hn hh.symm))) he.symm
  · intro he
    exact tsum_congr (fun n ↦ congrArg (fun z ↦ w n * z) (he n))

theorem path_monotone_parameter

TopologyByExample.PathLoopErasure.path_monotone_parameter

An interval-fibre path in a Hausdorff space has a continuous nondecreasing real parameter with exactly the same fibres.

theorem path_monotone_parameter {X : Type*} [TopologicalSpace X] [T2Space X]
    {x y : X} (p : Path x y)
    (hinterval : ∀ s r t : unitInterval, s ≤ r → r ≤ t → p s = p t → p r = p s) :
    ∃ h : unitInterval → ℝ, Continuous h ∧ Monotone h ∧
      ∀ s t, h s = h t ↔ p s = p t
Proof
:= by
  let : CompactSpace (range p) := Path.compactSpace_range p
  let : SecondCountableTopology (range p) := Path.secondCountableTopology_range p
  let q := rangeFactorization p
  have hq : Continuous q := p.continuous.subtype_mk (fun t ↦ mem_range_self t)
  have hi : ∀ s r t : unitInterval, s ≤ r → r ≤ t → q s = q t → q r = q s := by
    intro s r t hsr hrt he
    exact Subtype.ext (hinterval s r t hsr hrt (congrArg Subtype.val he))
  obtain ⟨R, hR, hRf⟩ := exists_monotone_separating_family hq hi
  obtain ⟨h, hc, hm, hh⟩ := combine_monotone_family hR
  refine ⟨h, hc, hm, fun s t ↦ ?_⟩
  exact (hh s t).trans ((hRf s t).symm.trans Subtype.ext_iff)