Lean library · module TopologyByExample.Spaces.BoxRealEventualBoxes

Eventual boxes

Source file

Requiring coordinate membership only from some index onwards gives sets invariant under finite changes. Open coordinate sets give open eventual boxes; closed coordinate sets give closed eventual boxes.

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 eventualBox

TopologyByExample.BoxRealPower.eventualBox

Membership in the prescribed coordinate sets from some index onwards.

def eventualBox (U : ℕ → Set ℝ) : Set Space
:=
  {x | ∃ N : ℕ, ∀ n, N ≤ n → x.coord n ∈ U n}

theorem box_subset_eventualBox

TopologyByExample.BoxRealPower.box_subset_eventualBox

An ordinary box is contained in its eventual box.

theorem box_subset_eventualBox (U : ℕ → Set ℝ) : box U ⊆ eventualBox U
Proof
:=
  fun _ hx ↦ ⟨0, fun n _ ↦ hx n⟩

theorem eventualBox_mono

TopologyByExample.BoxRealPower.eventualBox_mono

Coordinatewise inclusion preserves eventual boxes.

theorem eventualBox_mono {U V : ℕ → Set ℝ} (h : ∀ n, U n ⊆ V n) :
    eventualBox U ⊆ eventualBox V
Proof
:= by
  rintro x ⟨N, hN⟩
  exact ⟨N, fun n hn ↦ h n (hN n hn)⟩

theorem eventualBox_invariant

TopologyByExample.BoxRealPower.eventualBox_invariant

Eventual boxes are invariant under finite coordinate changes.

theorem eventualBox_invariant (U : ℕ → Set ℝ) : FiniteChangeInvariant (eventualBox U)
Proof
:= by
  rintro x y ⟨N, hN⟩ ⟨M, hM⟩
  refine ⟨max N M, fun n hn ↦ ?_⟩
  rw [← hN n (le_trans (le_max_left _ _) hn)]
  exact hM n (le_trans (le_max_right _ _) hn)

theorem isOpen_eventualBox

TopologyByExample.BoxRealPower.isOpen_eventualBox

Eventual boxes with open coordinate sets are open.

theorem isOpen_eventualBox {U : ℕ → Set ℝ} (hU : ∀ n, IsOpen (U n)) :
    IsOpen (eventualBox U)
Proof
:= by
  apply isOpen_iff_mem_nhds.mpr
  rintro x ⟨N, hN⟩
  let V : ℕ → Set ℝ := fun n ↦ if N ≤ n then U n else univ
  have hV : IsOpen (box V) := by
    apply isOpen_box
    intro n
    dsimp [V]
    split_ifs
    · exact hU n
    · exact isOpen_univ
  have hxV : x ∈ box V := by
    intro n
    dsimp [V]
    split_ifs with hn
    · exact hN n hn
    · trivial
  apply Filter.mem_of_superset (hV.mem_nhds hxV)
  intro y hy
  exact ⟨N, fun n hn ↦ by simpa [V, hn] using hy n⟩

theorem isClosed_eventualBox

TopologyByExample.BoxRealPower.isClosed_eventualBox

Eventual boxes with closed coordinate sets are closed.

theorem isClosed_eventualBox {U : ℕ → Set ℝ} (hU : ∀ n, IsClosed (U n)) :
    IsClosed (eventualBox U)
Proof
:= by
  classical
  rw [← isOpen_compl_iff]
  apply isOpen_iff_mem_nhds.mpr
  intro x hx
  let V : ℕ → Set ℝ := fun n ↦ if x.coord n ∈ U n then univ else (U n)ᶜ
  have hV : IsOpen (box V) := by
    apply isOpen_box
    intro n
    dsimp [V]
    split_ifs
    · exact isOpen_univ
    · exact (hU n).isOpen_compl
  have hxV : x ∈ box V := by
    intro n
    dsimp [V]
    split_ifs with hn
    · trivial
    · exact hn
  apply Filter.mem_of_superset (hV.mem_nhds hxV)
  rintro y hy ⟨N, hN⟩
  apply hx
  refine ⟨N, fun n hn ↦ ?_⟩
  by_contra hnot
  have hyNot : y.coord n ∉ U n := by simpa [V, hnot] using hy n
  exact hyNot (hN n hn)

theorem eventualBox_subset_of_invariant

TopologyByExample.BoxRealPower.eventualBox_subset_of_invariant

A saturated set containing a box contains its eventual box, when the box is nonempty.

theorem eventualBox_subset_of_invariant {S : Set Space} (hS : FiniteChangeInvariant S)
    {U : ℕ → Set ℝ} {x : Space} (hx : x ∈ box U) (hsub : box U ⊆ S) :
    eventualBox U ⊆ S
Proof
:= by
  rintro y ⟨N, hN⟩
  let z : Space := ⟨fun n ↦ if n < N then x.coord n else y.coord n⟩
  have hz : z ∈ box U := by
    intro n
    change (if n < N then x.coord n else y.coord n) ∈ U n
    split_ifs with hn
    · exact hx n
    · exact hN n (Nat.le_of_not_gt hn)
  apply hS z y ?_ (hsub hz)
  exact ⟨N, fun n hn ↦ by simp [z, Nat.not_lt.mpr hn]⟩

theorem preimage_image_toNabla

TopologyByExample.BoxRealPower.preimage_image_toNabla

Taking the quotient image of an invariant set introduces no new preimage points.

theorem preimage_image_toNabla {S : Set Space} (hS : FiniteChangeInvariant S) :
    toNabla ⁻¹' (toNabla '' S) = S
Proof
:= by
  ext x
  constructor
  · rintro ⟨y, hy, he⟩
    exact hS y x (Quotient.exact he) hy
  · intro hx
    exact ⟨x, hx, rfl⟩

theorem preimage_toNabla_invariant

TopologyByExample.BoxRealPower.preimage_toNabla_invariant

Preimages of quotient subsets are invariant under finite changes.

theorem preimage_toNabla_invariant (S : Set Nabla) :
    FiniteChangeInvariant (toNabla ⁻¹' S)
Proof
:= by
  intro x y hxy hx
  change toNabla y ∈ S
  rw [← (show toNabla x = toNabla y from Quotient.sound hxy)]
  exact hx

theorem isOpen_image_toNabla

TopologyByExample.BoxRealPower.isOpen_image_toNabla

Open invariant sets have open images in the quotient.

theorem isOpen_image_toNabla {S : Set Space} (hS : FiniteChangeInvariant S)
    (ho : IsOpen S) : IsOpen (toNabla '' S)
Proof
:= by
  apply isQuotientMap_toNabla.isOpen_preimage.mp
  rwa [preimage_image_toNabla hS]

theorem isClosed_image_toNabla

TopologyByExample.BoxRealPower.isClosed_image_toNabla

Closed invariant sets have closed images in the quotient.

theorem isClosed_image_toNabla {S : Set Space} (hS : FiniteChangeInvariant S)
    (hc : IsClosed S) : IsClosed (toNabla '' S)
Proof
:= by
  apply isQuotientMap_toNabla.isClosed_preimage.mp
  rwa [preimage_image_toNabla hS]

instance

instance : RegularSpace Nabla
Proof
:= by
  apply RegularSpace.of_exists_mem_nhds_isClosed_subset
  intro q S hS
  obtain ⟨W, hWS, hW, hqW⟩ := mem_nhds_iff.mp hS
  obtain ⟨x, rfl⟩ := isQuotientMap_toNabla.surjective q
  obtain ⟨b, hx, hb⟩ := exists_block_mem
    (hW.preimage isQuotientMap_toNabla.continuous) hqW
  let O : ℕ → Set ℝ := fun n ↦ Ioo (b.lower n) (b.upper n)
  let C : ℕ → Set ℝ := fun n ↦ Icc (b.lower n) (b.upper n)
  have hOC : ∀ n, O n ⊆ C n := fun _ ↦ Ioo_subset_Icc_self
  have hxO : x ∈ box O := hx
  have hCW : box C ⊆ toNabla ⁻¹' W := by
    intro y hy
    exact hb (fun n _ ↦ hy n)
  have hEW : eventualBox C ⊆ toNabla ⁻¹' W :=
    eventualBox_subset_of_invariant (preimage_toNabla_invariant W)
      (fun n ↦ hOC n (hxO n)) hCW
  refine ⟨toNabla '' eventualBox C, ?_,
    isClosed_image_toNabla (eventualBox_invariant C)
      (isClosed_eventualBox fun _ ↦ isClosed_Icc), ?_⟩
  · apply Filter.mem_of_superset
      ((isOpen_image_toNabla (eventualBox_invariant O)
        (isOpen_eventualBox fun _ ↦ isOpen_Ioo)).mem_nhds
          ⟨x, box_subset_eventualBox O hxO, rfl⟩)
    exact image_mono (eventualBox_mono hOC)
  · rintro _ ⟨y, hy, rfl⟩
    exact hWS (hEW hy)

theorem nabla_exists_isClopen_mem

TopologyByExample.BoxRealPower.nabla_exists_isClopen_mem

Every open neighbourhood in the nabla quotient contains a clopen neighbourhood.

theorem nabla_exists_isClopen_mem {q : Nabla} {W : Set Nabla} (hW : IsOpen W)
    (hq : q ∈ W) : ∃ C, IsClopen C ∧ q ∈ C ∧ C ⊆ W
Proof
:= by
  let A := {C : Set Nabla // C ∈ nhds q ∧ IsClosed C}
  have hstep : ∀ C : A, ∃ D : A, (D : Set Nabla) ⊆ interior (C : Set Nabla) := by
    intro C
    obtain ⟨D, hD, hDc, hsub⟩ :=
      exists_mem_nhds_isClosed_subset (interior_mem_nhds.mpr C.property.1)
    exact ⟨⟨D, hD, hDc⟩, hsub⟩
  choose step hstep using hstep
  obtain ⟨C, hC, hCc, hCW⟩ := exists_mem_nhds_isClosed_subset (hW.mem_nhds hq)
  let seq : ℕ → A := fun n ↦ (step^[n]) ⟨C, hC, hCc⟩
  have hnext (n : ℕ) : (seq (n + 1) : Set Nabla) ⊆ interior (seq n : Set Nabla) := by
    simpa only [seq, Function.iterate_succ_apply'] using hstep (seq n)
  have he : (⋂ n, (seq n : Set Nabla)) = ⋂ n, interior (seq n : Set Nabla) := by
    apply Subset.antisymm
    · intro y hy
      exact mem_iInter.mpr fun n ↦ hnext n (mem_iInter.mp hy (n + 1))
    · intro y hy
      exact mem_iInter.mpr fun n ↦ interior_subset (mem_iInter.mp hy n)
  refine ⟨⋂ n, (seq n : Set Nabla), ⟨isClosed_iInter fun n ↦ (seq n).property.2, ?_⟩,
    mem_iInter.mpr (fun n ↦ mem_of_mem_nhds (seq n).property.1), ?_⟩
  · rw [he]
    exact nabla_isOpen_iInter _ fun _ ↦ isOpen_interior
  · exact (iInter_subset _ 0).trans hCW

instance

instance : ZeroDimensionalSpace Nabla
Proof
:= by
  rw [zeroDimensionalSpace_iff_isTopologicalBasis_isClopen]
  apply isTopologicalBasis_of_isOpen_of_nhds (fun (s : Set Nabla) (h : IsClopen s) ↦ h.isOpen)
  intro q W hq hW
  exact nabla_exists_isClopen_mem hW hq