Lean library · module TopologyByExample.Spaces.BoxRealNabla

Finite changes in the real box product

Source file

Countable intersections of open sets invariant under finite coordinate changes are open. This is the diagonal neighbourhood argument underlying the P-space property of the quotient by eventual equality.

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 EventuallyEqual

TopologyByExample.BoxRealPower.EventuallyEqual

Two sequences agree from some coordinate onwards.

def EventuallyEqual (x y : Space) : Prop
:=
  ∃ N : ℕ, ∀ n, N ≤ n → x.coord n = y.coord n

definition FiniteChangeInvariant

TopologyByExample.BoxRealPower.FiniteChangeInvariant

Membership is unchanged by altering finitely many coordinates.

def FiniteChangeInvariant (U : Set Space) : Prop
:=
  ∀ x y, EventuallyEqual x y → x ∈ U → y ∈ U

definition eventualSetoid

TopologyByExample.BoxRealPower.eventualSetoid

Eventual equality is the equivalence relation for the nabla quotient.

def eventualSetoid : Setoid Space
Definition
where
  r := EventuallyEqual
  iseqv := ⟨fun _ ↦ ⟨0, fun _ _ ↦ rfl⟩, by
    rintro x y ⟨N, hN⟩
    exact ⟨N, fun n hn ↦ (hN n hn).symm⟩, by
    rintro x y z ⟨N, hN⟩ ⟨M, hM⟩
    exact ⟨max N M, fun n hn ↦ (hN n (le_trans (le_max_left _ _) hn)).trans
      (hM n (le_trans (le_max_right _ _) hn))⟩⟩

definition Nabla

TopologyByExample.BoxRealPower.Nabla

Real sequences modulo finite coordinate changes, with the quotient topology.

def Nabla
:= Quotient eventualSetoid

instance

instance : TopologicalSpace Nabla
Proof
:= inferInstanceAs (TopologicalSpace (Quotient eventualSetoid))

definition toNabla

TopologyByExample.BoxRealPower.toNabla

The projection to eventual-equality classes.

def toNabla : Space → Nabla
:= Quotient.mk eventualSetoid

theorem isQuotientMap_toNabla

TopologyByExample.BoxRealPower.isQuotientMap_toNabla

The nabla topology is the quotient of the box topology.

theorem isQuotientMap_toNabla : IsQuotientMap toNabla
Proof
:= isQuotientMap_quotient_mk'

theorem isClosed_eventualClass

TopologyByExample.BoxRealPower.isClosed_eventualClass

Every eventual-equality class is closed in the box topology.

theorem isClosed_eventualClass (x : Space) : IsClosed {y | EventuallyEqual x y}
Proof
:= by
  rw [← isOpen_compl_iff]
  apply isOpen_iff_mem_nhds.mpr
  intro y hy
  let V : ℕ → Set ℝ := fun n ↦ if y.coord n = x.coord n then univ else {x.coord n}ᶜ
  have hV : IsOpen (box V) := by
    apply isOpen_box
    intro n
    dsimp [V]
    split_ifs
    · exact isOpen_univ
    · exact isClosed_singleton.isOpen_compl
  have hyV : y ∈ box V := by
    intro n
    dsimp [V]
    split_ifs with hn
    · trivial
    · exact hn
  apply Filter.mem_of_superset (hV.mem_nhds hyV)
  intro z hz hzClass
  obtain ⟨N, hN⟩ := hzClass
  apply hy
  refine ⟨N, fun n hn ↦ ?_⟩
  by_contra hne
  have hzn : z.coord n ≠ x.coord n := by
    simpa [V, Ne.symm hne] using hz n
  exact hzn (hN n hn).symm

instance

instance : T1Space Nabla
Proof
where
  t1 q := by
    obtain ⟨x, rfl⟩ := isQuotientMap_toNabla.surjective q
    apply isQuotientMap_toNabla.isClosed_preimage.mp
    have he : toNabla ⁻¹' {toNabla x} = {y | EventuallyEqual x y} := by
      ext y
      change toNabla y = toNabla x ↔ EventuallyEqual x y
      rw [eq_comm]
      exact Quotient.eq
    rw [he]
    exact isClosed_eventualClass x

theorem isOpen_iInter_of_finiteChangeInvariant

TopologyByExample.BoxRealPower.isOpen_iInter_of_finiteChangeInvariant

A countable intersection of invariant open sets is open in the box topology.

theorem isOpen_iInter_of_finiteChangeInvariant (U : ℕ → Set Space)
    (hU : ∀ k, IsOpen (U k)) (hInv : ∀ k, FiniteChangeInvariant (U k)) :
    IsOpen (⋂ k, U k)
Proof
:= by
  apply isOpen_iff_mem_nhds.mpr
  intro x hx
  have hboxes : ∀ k, ∃ V : ℕ → Set ℝ,
      (∀ n, IsOpen (V n)) ∧ x ∈ box V ∧ box V ⊆ U k := by
    intro k
    obtain ⟨B, hB, hxB, hsub⟩ :=
      basis.exists_subset_of_mem_open (mem_iInter.mp hx k) (hU k)
    obtain ⟨V, hV, rfl⟩ := hB
    exact ⟨V, hV, hxB, hsub⟩
  choose V hV hxV hsub using hboxes
  let W : ℕ → Set ℝ := fun n ↦ ⋂ k : Fin (n + 1), V k n
  have hW : IsOpen (box W) := isOpen_box fun n ↦
    isOpen_iInter_of_finite fun k ↦ hV k n
  have hxW : x ∈ box W := by
    intro n
    exact mem_iInter.mpr fun k ↦ hxV k n
  apply Filter.mem_of_superset (hW.mem_nhds hxW)
  intro y hy
  apply mem_iInter.mpr
  intro k
  let z : Space := ⟨fun n ↦ if n < k then x.coord n else y.coord n⟩
  have hz : z ∈ box (V k) := by
    intro n
    change (if n < k then x.coord n else y.coord n) ∈ V k n
    split_ifs with hn
    · exact hxV k n
    · exact mem_iInter.mp (hy n) ⟨k, by omega⟩
  apply hInv k z y ?_ (hsub k hz)
  refine ⟨k, fun n hn ↦ ?_⟩
  simp [z, Nat.not_lt.mpr hn]

theorem nabla_isOpen_iInter

TopologyByExample.BoxRealPower.nabla_isOpen_iInter

Countable intersections of open subsets of the nabla quotient are open.

theorem nabla_isOpen_iInter (U : ℕ → Set Nabla) (hU : ∀ k, IsOpen (U k)) :
    IsOpen (⋂ k, U k)
Proof
:= by
  apply isQuotientMap_toNabla.isOpen_preimage.mp
  rw [preimage_iInter]
  apply isOpen_iInter_of_finiteChangeInvariant
  · intro k
    exact (hU k).preimage isQuotientMap_toNabla.continuous
  · intro k x y hxy hx
    change toNabla y ∈ U k
    have he : toNabla x = toNabla y := Quotient.sound hxy
    rw [← he]
    exact hx

theorem nabla_isClosed_range

TopologyByExample.BoxRealPower.nabla_isClosed_range

Every enumerated subset of the nabla quotient is closed.

theorem nabla_isClosed_range (f : ℕ → Nabla) : IsClosed (range f)
Proof
:= by
  rw [← isOpen_compl_iff]
  have he : (range f)ᶜ = ⋂ n, ({f n} : Set Nabla)ᶜ := by
    ext x
    simp [eq_comm]
  rw [he]
  exact nabla_isOpen_iInter _ fun _ ↦ isClosed_singleton.isOpen_compl

theorem nabla_isOpen_iInter_countable

TopologyByExample.BoxRealPower.nabla_isOpen_iInter_countable

The intersection assertion holds for every countable index type.

theorem nabla_isOpen_iInter_countable {ι : Type*} [Countable ι]
    (U : ι → Set Nabla) (hU : ∀ i, IsOpen (U i)) : IsOpen (⋂ i, U i)
Proof
:= by
  cases isEmpty_or_nonempty ι with
  | inl h => simp
  | inr h =>
    obtain ⟨f, hf⟩ := exists_surjective_nat ι
    rw [← hf.iInter_comp U]
    exact nabla_isOpen_iInter _ fun n ↦ hU (f n)

theorem nabla_isClopen_iUnion

TopologyByExample.BoxRealPower.nabla_isClopen_iUnion

Countable unions of clopen subsets of the quotient are clopen.

theorem nabla_isClopen_iUnion {ι : Type*} [Countable ι]
    (U : ι → Set Nabla) (hU : ∀ i, IsClopen (U i)) : IsClopen (⋃ i, U i)
Proof
:= by
  refine ⟨?_, isOpen_iUnion fun i ↦ (hU i).isOpen⟩
  rw [← isOpen_compl_iff, compl_iUnion]
  exact nabla_isOpen_iInter_countable _ fun i ↦ (hU i).isClosed.isOpen_compl