Lean library · module TopologyByExample.Spaces.BoxRealBaire

The Baire property of the countable box product

Source file

Nested closed boxes are compact in the ordinary product topology. Their intersection supplies a point in each member of a countable family of dense box-open sets.

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

structure Block

TopologyByExample.BoxRealPower.Block

A box with finite, strictly separated endpoints in every coordinate.

structure Block where
  /-- Lower endpoints. -/
  lower : ℕ → ℝ
  /-- Upper endpoints. -/
  upper : ℕ → ℝ
  /-- Each coordinate interval has nonempty interior. -/
  lt : ∀ n, lower n < upper n

definition openSet

TopologyByExample.BoxRealPower.Block.openSet

The open box associated to a block.

def Block.openSet (b : Block) : Set Space
:= box (fun n ↦ Ioo (b.lower n) (b.upper n))

definition productSet

TopologyByExample.BoxRealPower.Block.productSet

The closed box, viewed in the ordinary product topology.

def Block.productSet (b : Block) : Set (ℕ → ℝ)
:=
  Set.pi univ (fun n ↦ Icc (b.lower n) (b.upper n))

definition closedSet

TopologyByExample.BoxRealPower.Block.closedSet

The same closed box in the wrapped carrier.

def Block.closedSet (b : Block) : Set Space
:= Space.coord ⁻¹' b.productSet

theorem isOpen

TopologyByExample.BoxRealPower.Block.isOpen

The open part of a block is open in the box topology.

theorem Block.isOpen (b : Block) : IsOpen b.openSet
Proof
:= isOpen_box (fun _ ↦ isOpen_Ioo)

theorem open_nonempty

TopologyByExample.BoxRealPower.Block.open_nonempty

Every block has a point in its open part.

theorem Block.open_nonempty (b : Block) : b.openSet.Nonempty
Proof
:= by
  refine ⟨⟨fun n ↦ (b.lower n + b.upper n) / 2⟩, ?_⟩
  intro n
  have := b.lt n
  constructor <;> linarith

theorem open_subset_closed

TopologyByExample.BoxRealPower.Block.open_subset_closed

The open part lies in the closed box.

theorem Block.open_subset_closed (b : Block) : b.openSet ⊆ b.closedSet
Proof
:= by
  intro x hx n _
  exact ⟨(hx n).1.le, (hx n).2.le⟩

theorem compact

TopologyByExample.BoxRealPower.Block.compact

A block is compact when viewed in the ordinary product topology.

theorem Block.compact (b : Block) : IsCompact b.productSet
Proof
:=
  isCompact_univ_pi (fun _ ↦ isCompact_Icc)

theorem product_nonempty

TopologyByExample.BoxRealPower.Block.product_nonempty

Its closed box is nonempty.

theorem Block.product_nonempty (b : Block) : b.productSet.Nonempty
Proof
:=
  ⟨b.lower, fun n _ ↦ ⟨le_rfl, (b.lt n).le⟩⟩

theorem exists_block_mem

TopologyByExample.BoxRealPower.exists_block_mem

Every open neighbourhood contains a closed block whose open part contains the point.

theorem exists_block_mem {W : Set Space} (hW : IsOpen W) {x : Space} (hx : x ∈ W) :
    ∃ b : Block, x ∈ b.openSet ∧ b.closedSet ⊆ W
Proof
:= by
  obtain ⟨B, hB, hxB, hBW⟩ := basis.exists_subset_of_mem_open hx hW
  obtain ⟨U, hU, rfl⟩ := hB
  have he : ∀ n, ∃ ε : ℝ, 0 < ε ∧ Metric.ball (x.coord n) ε ⊆ U n := by
    intro n
    exact Metric.mem_nhds_iff.mp ((hU n).mem_nhds (hxB n))
  choose ε hε hsub using he
  let b : Block := ⟨fun n ↦ x.coord n - ε n / 2,
    fun n ↦ x.coord n + ε n / 2, fun n ↦ by linarith [hε n]⟩
  refine ⟨b, ?_, fun y hy ↦ hBW ?_⟩
  · intro n
    change x.coord n - ε n / 2 < x.coord n ∧ x.coord n < x.coord n + ε n / 2
    constructor <;> linarith [hε n]
  intro n
  apply hsub n
  have hyl := (hy n (mem_univ n)).1
  have hyu := (hy n (mem_univ n)).2
  change x.coord n - ε n / 2 ≤ y.coord n at hyl
  change y.coord n ≤ x.coord n + ε n / 2 at hyu
  rw [Metric.mem_ball, Real.dist_eq, abs_lt]
  constructor <;> linarith [hε n]

theorem exists_block

TopologyByExample.BoxRealPower.exists_block

Every nonempty box-open set contains a closed block with nonempty open part.

theorem exists_block {W : Set Space} (hW : IsOpen W) (hne : W.Nonempty) :
    ∃ b : Block, b.closedSet ⊆ W
Proof
:= by
  obtain ⟨x, hx⟩ := hne
  obtain ⟨b, _, hb⟩ := exists_block_mem hW hx
  exact ⟨b, hb⟩

theorem baire

TopologyByExample.BoxRealPower.baire

Countable intersections of dense box-open sets are dense.

theorem baire : BaireSpace Space
Proof
:= by
  constructor
  intro G hGo hGd
  apply dense_iff_inter_open.mpr
  intro W hW hWne
  obtain ⟨b₀, hb₀⟩ := exists_block hW hWne
  have hnext : ∀ n (b : Block), ∃ c : Block, c.closedSet ⊆ b.openSet ∩ G n := by
    intro n b
    exact exists_block (b.isOpen.inter (hGo n))
      ((hGd n).inter_open_nonempty b.openSet b.isOpen b.open_nonempty)
  choose next hnext using hnext
  let b : ℕ → Block := fun n ↦ Nat.rec b₀ (fun n prev ↦ next n prev) n
  have hs (n : ℕ) : (b (n + 1)).closedSet ⊆ (b n).openSet ∩ G n := hnext n (b n)
  have hdesc : ∀ n, (b (n + 1)).productSet ⊆ (b n).productSet := by
    intro n x hx
    exact (b n).open_subset_closed (hs n hx).1
  obtain ⟨x, hx⟩ := IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed
    (fun n ↦ (b n).productSet) hdesc (fun n ↦ (b n).product_nonempty)
    (b 0).compact (fun n ↦ (b n).compact.isClosed)
  refine ⟨⟨x⟩, hb₀ (mem_iInter.mp hx 0), mem_iInter.mpr ?_⟩
  intro n
  exact (hs n (mem_iInter.mp hx (n + 1))).2

On this site: The countable box product of the reals is a Baire space