Lean library · module TopologyByExample.Theorems.GapExtension

Extending a map constantly across gaps

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 X : Type*} [LinearOrder L]

definition GapSpan

TopologyByExample.PathLoopErasure.GapSpan

The two domain points enclose no domain point strictly between them.

def GapSpan (K : Set L) (a b : L) : Prop
:=
  a ∈ K ∧ b ∈ K ∧ ∀ s ∈ K, s ≤ a ∨ b ≤ s

theorem exists_gapSpan

TopologyByExample.PathLoopErasure.exists_gapSpan

Every point is bracketed by consecutive points of a compact endpoint-retaining domain.

theorem exists_gapSpan [TopologicalSpace L] [OrderClosedTopology L]
    [OrderBot L] [OrderTop L] {K : Set L} (hK : IsCompact K)
    (hbot : ⊥ ∈ K) (htop : ⊤ ∈ K) (t : L) :
    ∃ a b, GapSpan K a b ∧ a ≤ t ∧ t ≤ b
Proof
:= by
  obtain ⟨a, ha⟩ := (hK.inter_right isClosed_Iic).exists_isGreatest
    (show (K ∩ Iic t).Nonempty from ⟨⊥, hbot, bot_le⟩)
  obtain ⟨b, hb⟩ := (hK.inter_right isClosed_Ici).exists_isLeast
    (show (K ∩ Ici t).Nonempty from ⟨⊤, htop, le_top⟩)
  refine ⟨a, b, ⟨ha.1.1, hb.1.1, ?_⟩, ha.1.2, hb.1.2⟩
  intro s hs
  rcases le_total s t with hst | hts
  · exact Or.inl (ha.2 ⟨hs, hst⟩)
  · exact Or.inr (hb.2 ⟨hs, hts⟩)

theorem eq_image

TopologyByExample.PathLoopErasure.GapSpan.eq_image

Gap spans have equal endpoint images under a gap-preserving map.

theorem GapSpan.eq_image {K : Set L} {f : L → X} (hf : EqualGapEnds f K)
    {a b : L} (h : GapSpan K a b) (hab : a ≤ b) : f a = f b
Proof
:= by
  apply hf a h.1 b h.2.1 hab
  intro s hs has hsb
  rcases h.2.2 s hs with hsa | hbs
  · exact not_lt_of_ge hsa has
  · exact not_lt_of_ge hbs hsb

theorem overlap

TopologyByExample.PathLoopErasure.GapSpan.overlap

Overlapping gap spans determine the same value.

theorem GapSpan.overlap {K : Set L} {f : L → X} (hf : EqualGapEnds f K)
    {a b c d t : L} (hab : GapSpan K a b) (hcd : GapSpan K c d)
    (hat : a ≤ t) (htb : t ≤ b) (hct : c ≤ t) (htd : t ≤ d) : f a = f c
Proof
:= by
  rcases le_total a c with hac | hca
  · rcases hab.2.2 c hcd.1 with hca | hbc
    · exact congrArg f (le_antisymm hac hca)
    · have hcb : c = b := le_antisymm (le_trans hct htb) hbc
      exact (hab.eq_image hf (le_trans hat htb)).trans (congrArg f hcb.symm)
  · rcases hcd.2.2 a hab.1 with hac | hda
    · exact congrArg f (le_antisymm hac hca)
    · have had : a = d := le_antisymm (le_trans hat htd) hda
      exact (congrArg f had).trans (hcd.eq_image hf (le_trans hct htd)).symm

definition gapTriples

TopologyByExample.PathLoopErasure.gapTriples

Triples consisting of gap endpoints and a point between them.

def gapTriples (K : Set L) : Set (L × L × L)
:=
  {z | GapSpan K z.1 z.2.1 ∧ z.1 ≤ z.2.2 ∧ z.2.2 ≤ z.2.1}

theorem isClosed_gapTriples

TopologyByExample.PathLoopErasure.isClosed_gapTriples

The gap triples of a closed domain form a closed set.

theorem isClosed_gapTriples [TopologicalSpace L] [OrderClosedTopology L]
    {K : Set L} (hK : IsClosed K) : IsClosed (gapTriples K)
Proof
:= by
  have hspan : IsClosed {z : L × L × L | GapSpan K z.1 z.2.1} := by
    unfold GapSpan
    simp only [ofPred_and, ofPred_forall]
    refine (hK.preimage continuous_fst).inter
      ((hK.preimage continuous_snd.fst).inter ?_)
    exact isClosed_biInter (fun s _ ↦
      (isClosed_le continuous_const continuous_fst).union
        (isClosed_le continuous_snd.fst continuous_const))
  exact hspan.inter ((isClosed_le continuous_fst continuous_snd.snd).inter
    (isClosed_le continuous_snd.snd continuous_snd.fst))

theorem exists_continuous_gap_extension

TopologyByExample.PathLoopErasure.exists_continuous_gap_extension

A continuous gap-preserving map extends constantly across every gap.

theorem exists_continuous_gap_extension [TopologicalSpace L] [OrderTopology L]
    [CompactSpace L] [OrderBot L] [OrderTop L] [TopologicalSpace X]
    {K : Set L} (hK : IsClosed K) (hbot : ⊥ ∈ K) (htop : ⊤ ∈ K)
    {f : L → X} (hf : Continuous f) (hgap : EqualGapEnds f K) :
    ∃ g : L → X, Continuous g ∧ (∀ t ∈ K, g t = f t) ∧
      range g ⊆ f '' K ∧
      ∀ a b t, GapSpan K a b → a ≤ t → t ≤ b → g t = f a
Proof
:= by
  classical
  choose a b hspan hat htb using exists_gapSpan hK.isCompact hbot htop
  let g : L → X := fun t ↦ f (a t)
  have hvalue (u v t : L) (huv : GapSpan K u v) (hut : u ≤ t) (htv : t ≤ v) :
      g t = f u := (hspan t).overlap hgap huv (hat t) (htb t) hut htv
  let D := gapTriples K
  let : CompactSpace D := isCompact_iff_compactSpace.mp (isClosed_gapTriples hK).isCompact
  let π : D → L := fun z ↦ z.val.2.2
  have hπ : Continuous π := continuous_subtypeVal.snd.snd
  have hsurj : Function.Surjective π := by
    intro t
    exact ⟨⟨(a t, b t, t), hspan t, hat t, htb t⟩, rfl⟩
  have hquot := IsQuotientMap.of_surjective_continuous hsurj hπ
  have hg : Continuous g := by
    apply hquot.continuous_iff.mpr
    have he : g ∘ π = fun z : D ↦ f z.val.1 := by
      funext z
      exact hvalue z.val.1 z.val.2.1 z.val.2.2 z.property.1
        z.property.2.1 z.property.2.2
    rw [he]
    exact hf.comp continuous_subtypeVal.fst
  refine ⟨g, hg, ?_, ?_, hvalue⟩
  · intro t ht
    exact hvalue t t t ⟨ht, ht, fun s _ ↦ le_total s t⟩ le_rfl le_rfl
  · rintro _ ⟨t, rfl⟩
    exact ⟨a t, (hspan t).1, rfl⟩

theorem gap_extension_interval_fibres

TopologyByExample.PathLoopErasure.gap_extension_interval_fibres

Extending a reduced domain across its gaps gives a map with interval fibres.

theorem gap_extension_interval_fibres [TopologicalSpace L] [OrderClosedTopology L]
    [OrderBot L] [OrderTop L] {K : Set L} (hK : IsCompact K)
    (hbot : ⊥ ∈ K) (htop : ⊤ ∈ K) {f g : L → X}
    (hred : ∀ a ∈ K, ∀ b ∈ K, a ≤ b → f a = f b →
      ∀ t ∈ K, a < t → t < b → False)
    (hvalue : ∀ a b t, GapSpan K a b → a ≤ t → t ≤ b → g t = f a)
    {s r t : L} (hsr : s ≤ r) (hrt : r ≤ t) (hst : g s = g t) : g r = g s
Proof
:= by
  obtain ⟨a, b, hab, has, hsb⟩ := exists_gapSpan hK hbot htop s
  obtain ⟨c, d, hcd, hct, htd⟩ := exists_gapSpan hK hbot htop t
  have hsa := hvalue a b s hab has hsb
  have htc := hvalue c d t hcd hct htd
  by_cases hrc : r ≤ c
  · have hac : a ≤ c := le_trans has (le_trans hsr hrc)
    have he : f a = f c := hsa.symm.trans (hst.trans htc)
    have hacgap : GapSpan K a c := by
      refine ⟨hab.1, hcd.1, ?_⟩
      intro z hz
      rcases le_or_gt z a with hza | haz
      · exact Or.inl hza
      · exact Or.inr (le_of_not_gt (fun hzc ↦ hred a hab.1 c hcd.1 hac he z hz haz hzc))
    exact (hvalue a c r hacgap (le_trans has hsr) hrc).trans hsa.symm
  · exact (hvalue c d r hcd (le_of_not_ge hrc) (le_trans hrt htd)).trans
      (htc.symm.trans hst.symm)

theorem path_with_interval_fibres

TopologyByExample.PathLoopErasure.path_with_interval_fibres

A path in a Hausdorff space can be replaced by a path with interval fibres, without changing its endpoints or leaving its image.

theorem path_with_interval_fibres [TopologicalSpace X] [T2Space X] {x y : X}
    (p : Path x y) :
    ∃ q : Path x y, range q ⊆ range p ∧
      ∀ s r t : unitInterval, s ≤ r → r ≤ t → q s = q t → q r = q s
Proof
:= by
  obtain ⟨K, hK, hbot, htop, hgap, hred⟩ := exists_reduced_domain p.continuous
  obtain ⟨g, hg, heq, hrange, hvalue⟩ :=
    exists_continuous_gap_extension hK hbot htop p.continuous hgap
  let q : Path x y :=
    { toFun := g
      continuous_toFun := hg
      source' := (heq 0 hbot).trans p.source
      target' := (heq 1 htop).trans p.target }
  refine ⟨q, hrange.trans (image_subset_range _ _), ?_⟩
  intro s r t hsr hrt hst
  exact gap_extension_interval_fibres hK.isCompact hbot htop hred hvalue hsr hrt hst