Lean library · module TopologyByExample.Spaces.Helly

Helly space

Source file

The nondecreasing self-maps of the closed unit interval carry the topology of pointwise convergence.

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 Space

TopologyByExample.Helly.Space

The full subspace of nondecreasing functions in the continuum cube.

abbrev Space
:= {f : ContinuumCube // Monotone f}

On this site: Space: Helly space

theorem isClosed_monotone

TopologyByExample.Helly.isClosed_monotone

The pairwise inequalities defining monotonicity are closed.

theorem isClosed_monotone : IsClosed {f : ContinuumCube | Monotone f}
Proof
:= by
  change IsClosed {f : ContinuumCube | ∀ a b, a ≤ b → f a ≤ f b}
  simp only [ofPred_forall]
  exact isClosed_iInter fun a ↦ isClosed_iInter fun b ↦ isClosed_iInter fun _ ↦
    isClosed_le (continuous_apply a) (continuous_apply b)

instance

instance : CompactSpace Space
Proof
:= isCompact_iff_compactSpace.mp isClosed_monotone.isCompact

theorem fibre

TopologyByExample.Helly.fibre

At a continuity point, the value of a monotone function is forced by its values on a dense set on either side. Include the endpoints separately.

private theorem fibre {D : Set unitInterval} (hd : Dense D) (f : Space) :
    ∃ S : Set unitInterval, S = D ∪ {x | ¬ContinuousAt f.val x} ∪ {0, 1} ∧
      ∀ g : Space, EqOn f.val g.val S → f = g
Proof
:= by
  let S := D ∪ {x | ¬ContinuousAt f.val x} ∪ {0, 1}
  refine ⟨S, rfl, fun g h ↦ Subtype.ext (funext fun x ↦ ?_)⟩
  by_cases hx : x ∈ S
  · exact h hx
  have hc : ContinuousAt f.val x := by
    by_contra hh
    exact hx (Or.inl (Or.inr hh))
  have hbot : 0 < x := bot_lt_iff_ne_bot.mpr fun he ↦ hx (Or.inr (Or.inl he))
  have htop : x < 1 := lt_top_iff_ne_top.mpr fun he ↦ hx (Or.inr (Or.inr he))
  obtain ⟨u, _, hu, hux⟩ := hd.exists_seq_strictMono_tendsto_of_lt hbot
  obtain ⟨v, _, hv, hvx⟩ := hd.exists_seq_strictAnti_tendsto_of_lt htop
  apply le_antisymm
  · apply le_of_tendsto_of_tendsto' (hc.tendsto.comp hux) tendsto_const_nhds
    intro n
    rw [Function.comp_apply, h (Or.inl (Or.inl (hu n).2))]
    exact g.property (hu n).1.2.le
  · apply le_of_tendsto_of_tendsto' tendsto_const_nhds (hc.tendsto.comp hvx)
    intro n
    rw [Function.comp_apply, h (Or.inl (Or.inl (hv n).2))]
    exact g.property (hv n).1.1.le

instance

instance : FirstCountableTopology Space
Proof
:= by
  constructor
  intro f
  obtain ⟨D, hD, hd⟩ := exists_countable_dense unitInterval
  obtain ⟨S, he, hs⟩ := fibre hd f
  have hS : S.Countable := by
    rw [he]
    exact (hD.union f.property.countable_not_continuousAt).union (by simp)
  let _ := hS.to_subtype
  let p (g : Space) : S → unitInterval := fun t ↦ g.val t
  have hp : Continuous p :=
    continuous_pi fun t ↦ (continuous_apply t.val).comp continuous_subtypeVal
  have hf : p ⁻¹' {p f} = {f} := by
    ext g
    constructor
    · intro h
      exact (hs g (fun x hx ↦ (congrFun (show p g = p f from h) ⟨x, hx⟩).symm)).symm
    · rintro rfl
      rfl
  have heq := hp.isClosedMap.comap_nhds_eq hp (p f)
  rw [hf, nhdsSet_singleton] at heq
  rw [← heq]
  infer_instance

theorem cuts

TopologyByExample.Helly.cuts

A rational cut may be placed below each of finitely many sample points and above every earlier sample point.

private theorem cuts (s : Finset unitInterval) (a : s) :
    ∃ q : ℚ, (q : ℝ) ≤ a.val.val ∧ ∀ b ∈ s, b < a.val → b.val < q
Proof
:= by
  classical
  let l := s.filter (· < a.val)
  by_cases hl : l.Nonempty
  · have hm := Finset.mem_filter.mp (Finset.max'_mem l hl)
    obtain ⟨q, hq, hqa⟩ := exists_rat_btwn (show (l.max' hl).val < a.val.val from hm.2)
    refine ⟨q, hqa.le, fun b hb hba ↦ ?_⟩
    exact lt_of_le_of_lt (show b.val ≤ (l.max' hl).val from
      Finset.le_max' l b (Finset.mem_filter.mpr ⟨hb, hba⟩)) hq
  · exact ⟨-1, by push_cast; linarith [a.val.property.1], fun b hb hba ↦
      (hl ⟨b, Finset.mem_filter.mpr ⟨hb, hba⟩⟩).elim⟩

definition staircase

TopologyByExample.Helly.staircase

A finite monotone staircase with rational cut points and arbitrary interval heights.

noncomputable def staircase {n : ℕ} (q : Fin n → ℚ) (h : Fin n → unitInterval) : Space
Definition
:=
  ⟨fun x ↦ Finset.univ.sup fun i ↦ if (q i : ℝ) ≤ x.val then h i else 0, by
    intro a b hab
    apply Finset.sup_mono_fun
    intro i _
    split_ifs with ha hb hb
    · rfl
    · exact (hb (ha.trans hab)).elim
    · exact bot_le
    · rfl⟩

theorem continuous_staircase

TopologyByExample.Helly.continuous_staircase

private theorem continuous_staircase {n : ℕ} (q : Fin n → ℚ) : Continuous (staircase q)
Proof
:= by
  apply Continuous.subtype_mk
  apply continuous_pi
  intro t
  apply Continuous.finset_sup_apply
  intro i _
  by_cases h : (q i : ℝ) ≤ t.val
  · simpa [h] using (continuous_apply i : Continuous fun x : Fin n → unitInterval ↦ x i)
  · simp [h, continuous_const]

theorem staircase_interpolates

TopologyByExample.Helly.staircase_interpolates

private theorem staircase_interpolates (f : Space) (s : Finset unitInterval) :
    ∃ (n : ℕ) (q : Fin n → ℚ) (h : Fin n → unitInterval),
       ∀ t ∈ s, (staircase q h).val t = f.val t
Proof
:= by
  classical
  choose Q hQ hsep using cuts s
  let e := (Fintype.equivFin s).symm
  refine ⟨_, fun i ↦ Q (e i), fun i ↦ f.val (e i), fun t ht ↦ ?_⟩
  change (Finset.univ.sup fun j ↦ if (Q (e j) : ℝ) ≤ t.val then f.val (e j) else 0) = _
  apply le_antisymm
  · apply Finset.sup_le
    intro i _
    split_ifs with h
    · apply f.property
      by_contra! hn
      exact (hsep (e i) t ht hn).not_ge h
    · exact bot_le
  · let i := e.symm ⟨t, ht⟩
    have hi : e i = ⟨t, ht⟩ := e.apply_symm_apply _
    have hle := Finset.le_sup (s := Finset.univ)
      (f := fun j ↦ if (Q (e j) : ℝ) ≤ t.val then f.val (e j) else 0) (Finset.mem_univ i)
    simpa [hi, hQ ⟨t, ht⟩] using hle

instance

instance : SeparableSpace Space
Proof
:= by
  let A := ⋃ n : ℕ, ⋃ q : Fin n → ℚ, range (staircase q)
  have hA : IsSeparable A := isSeparable_iUnion.mpr fun _ ↦ isSeparable_iUnion.mpr fun q ↦
    isSeparable_range (continuous_staircase q)
  suffices hd : Dense A from hd.isSeparable_iff.mp hA
  apply dense_iff_inter_open.mpr
  intro U hU hne
  obtain ⟨f, hf⟩ := hne
  obtain ⟨O, hO, rfl⟩ := isOpen_induced_iff.mp hU
  obtain ⟨s, V, hV, hsub⟩ := isOpen_pi_iff.mp hO f.val hf
  obtain ⟨n, q, h, he⟩ := staircase_interpolates f s
  refine ⟨staircase q h, hsub (fun t ht ↦ ?_), mem_iUnion₂.mpr ⟨n, q, h, rfl⟩⟩
  rw [he t ht]
  exact (hV t ht).2

definition realMap

TopologyByExample.Helly.realMap

Real-valued coordinates embed the Helly space into a real topological vector space.

def realMap (f : Space) (t : unitInterval) : ℝ
:= (f.val t).val

theorem embedding_realMap

TopologyByExample.Helly.embedding_realMap

private theorem embedding_realMap : IsEmbedding realMap
Proof
:=
  (IsEmbedding.piMap fun _ : unitInterval ↦
    (IsEmbedding.subtypeVal (p := fun r : ℝ ↦ r ∈ unitInterval))).comp IsEmbedding.subtypeVal

theorem convex_range

TopologyByExample.Helly.convex_range

private theorem convex_range : Convex ℝ (range realMap)
Proof
:= by
  rintro _ ⟨f, rfl⟩ _ ⟨g, rfl⟩ a b ha hb hab
  let h (x : unitInterval) : unitInterval :=
    ⟨a * realMap f x + b * realMap g x,
      convex_Icc (0 : ℝ) 1 (f.val x).property (g.val x).property ha hb hab⟩
  have hm : Monotone h := fun _ _ hxy ↦
    add_le_add (mul_le_mul_of_nonneg_left (f.property hxy) ha)
      (mul_le_mul_of_nonneg_left (g.property hxy) hb)
  exact ⟨⟨h, hm⟩, rfl⟩

theorem arcConnectedSpace

TopologyByExample.Helly.arcConnectedSpace

Straight segments are arcs in the Helly space.

theorem arcConnectedSpace : ArcConnectedSpace Space
Proof
:=
  (Homeomorph.arcConnectedSpace_iff embedding_realMap.toHomeomorph).mpr
    (arcConnectedSpace_of_convex convex_range)

On this site: Helly space is arc connected

theorem locallyArcConnectedSpace

TopologyByExample.Helly.locallyArcConnectedSpace

Restricting an open convex neighbourhood in the pointwise function space gives an open arc-connected neighbourhood in the Helly space.

theorem locallyArcConnectedSpace : LocallyArcConnectedSpace Space
Proof
:= by
  refine ⟨fun f U hU hf ↦ ?_⟩
  obtain ⟨O, hO, rfl⟩ := embedding_realMap.isOpen_iff.mp hU
  obtain ⟨V, ⟨hV, hc⟩, hsub⟩ := (LocallyConvexSpace.convex_basis (𝕜 := ℝ) (realMap f)).mem_iff.mp
    (hO.mem_nhds hf)
  let W := realMap ⁻¹' interior V
  refine ⟨W, isOpen_interior.preimage embedding_realMap.continuous,
    mem_interior_iff_mem_nhds.mpr hV, preimage_mono (interior_subset.trans hsub), ?_⟩
  apply (Homeomorph.arcConnectedSpace_iff (embedding_realMap.homeomorphImage W)).mpr
  apply arcConnectedSpace_of_convex
  rw [show realMap '' W = interior V ∩ range realMap from image_preimage_eq_inter_range]
  exact hc.interior.inter convex_range

On this site: Helly space is locally arc connected

definition mid

TopologyByExample.Helly.mid

The value assigned at the moving jump.

noncomputable def mid : unitInterval
:= ⟨1/2, by constructor <;> norm_num⟩

definition jump

TopologyByExample.Helly.jump

The step at t takes the middle value at its jump.

noncomputable def jump (t : unitInterval) : Space
Definition
:=
  ⟨fun x ↦ if x < t then 0 else if x = t then mid else 1, by
    intro x y hxy
    dsimp only
    split_ifs <;>
      first | exact le_rfl | exact bot_le | exact le_top | order⟩

theorem jump_interior

TopologyByExample.Helly.jump_interior

private theorem jump_interior (t x : unitInterval) :
    (jump t).val x ∈ Ioo (0 : unitInterval) 1 ↔ x = t
Proof
:= by
  by_cases he : x = t
  · subst x
    simp only [jump, lt_irrefl, ↓reduceIte, mem_Ioo, iff_true]
    change (0 : ℝ) < 1/2 ∧ (1/2 : ℝ) < 1
    norm_num
  · rcases lt_or_gt_of_ne he with h | h
    · simp [jump, h, he]
    · simp [jump, h.not_gt, he]

theorem jump_injective

TopologyByExample.Helly.jump_injective

private theorem jump_injective : Function.Injective jump
Proof
:= by
  intro x y h
  apply (jump_interior y x).mp
  rw [← h]
  exact (jump_interior x x).mpr rfl

instance

instance : DiscreteTopology (range jump)
Proof
:= by
  apply discreteTopology_iff_isOpen_singleton.mpr
  rintro ⟨_, t, rfl⟩
  let v (f : range jump) := f.val.val t
  have hv : Continuous v :=
    ((continuous_apply t).comp continuous_subtypeVal).comp continuous_subtypeVal
  have he : {⟨jump t, mem_range_self t⟩} = v ⁻¹' Ioo 0 1 := by
    ext ⟨_, s, rfl⟩
    change (⟨jump s, mem_range_self s⟩ : range jump) = ⟨jump t, mem_range_self t⟩ ↔
      (jump s).val t ∈ Ioo 0 1
    rw [Subtype.mk.injEq, jump_injective.eq_iff, jump_interior, eq_comm]
  rw [he]
  exact isOpen_Ioo.preimage hv

theorem discrete_jumps

TopologyByExample.Helly.discrete_jumps

The single-jump functions give a discrete subspace of cardinality continuum.

theorem discrete_jumps : IsDiscrete (range jump) ∧ #(range jump) = 𝔠
Proof
:=
  ⟨⟨inferInstance⟩, (mk_range_eq _ jump_injective).trans mk_unitInterval⟩

On this site: Helly space: A discrete subspace of single-jump functions

theorem not_completelyNormalSpace

TopologyByExample.Helly.not_completelyNormalSpace

The large discrete subspace is incompatible with complete normality and separability.

theorem not_completelyNormalSpace : ¬CompletelyNormalSpace Space
Proof
:=
  not_completelyNormalSpace_of_continuum_le_mk discrete_jumps.2.ge

On this site: Helly space is not completely normal

theorem not_hereditarilyLindelofSpace

TopologyByExample.Helly.not_hereditarilyLindelofSpace

The large discrete subspace is not Lindelöf.

theorem not_hereditarilyLindelofSpace : ¬HereditarilyLindelofSpace Space
Proof
:= by
  intro _
  have hc := (HereditarilyLindelofSpace.isLindelof (range jump)).countable_of_isDiscrete
    discrete_jumps.1
  exact aleph0_lt_continuum.not_ge (discrete_jumps.2 ▸ hc.le_aleph0)

theorem cardinalityContinuum

TopologyByExample.Helly.cardinalityContinuum

The Helly space has continuum cardinality.

theorem cardinalityContinuum : CardinalityContinuum Space
Proof
:= by
  classical
  change #Space = 𝔠
  obtain ⟨D, hc, hd⟩ := exists_countable_dense Space
  have hseq (f : Space) : ∃ u : ℕ → D, Tendsto (fun n ↦ (u n).val) atTop (𝓝 f) := by
    obtain ⟨u, hu, hf⟩ := mem_closure_iff_seq_limit.mp (hd f)
    exact ⟨fun n ↦ ⟨u n, hu n⟩, hf⟩
  choose u hu using hseq
  have hi : Function.Injective u := fun f g he ↦ tendsto_nhds_unique (hu f) (he ▸ hu g)
  apply le_antisymm
  · calc
      #Space ≤ #(ℕ → D) := mk_le_of_injective hi
      _ = #D ^ ℵ₀ := by simp only [mk_arrow, mk_nat, lift_uzero]
      _ ≤ 𝔠 ^ ℵ₀ := power_le_power_right (hc.le_aleph0.trans aleph0_le_continuum)
      _ = 𝔠 := continuum_power_aleph0
  · exact discrete_jumps.2 ▸ mk_set_le (range jump)

On this site: Helly space has cardinality equal to \(\mathfrak{c}\)

instance

instance : Nontrivial Space
Proof
:=
  one_lt_iff_nontrivial.mp ((show #Space = 𝔠 from cardinalityContinuum) ▸
    one_lt_aleph0.trans aleph0_lt_continuum)