Lean library · module TopologyByExample.Theorems.ProductRealBaire

Baire property of products of real lines

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 {ι : Type*}

structure Box

TopologyByExample.ProductRealBaire.Box

A cylinder with compact coordinate restrictions of nonempty interior.

structure Box (ι : Type*) where
  /-- Coordinates on which the cylinder imposes a restriction. -/
  support : Finset ι
  /-- Compact sets with nonempty interior supplying the coordinate restrictions. -/
  compact : ι → PositiveCompacts ℝ

definition coord

TopologyByExample.ProductRealBaire.Box.coord

The allowed values of a coordinate.

def Box.coord (B : Box ι) (i : ι) : Set ℝ
Definition
:=
  by
    classical
    exact if i ∈ B.support then B.compact i else univ

definition carrier

TopologyByExample.ProductRealBaire.Box.carrier

The closed cylinder.

def Box.carrier (B : Box ι) : Set (ι → ℝ)
:= {x | ∀ i, x i ∈ B.coord i}

definition core

TopologyByExample.ProductRealBaire.Box.core

The open cylinder obtained by taking coordinate interiors.

def Box.core (B : Box ι) : Set (ι → ℝ)
:=
  {x | ∀ i ∈ B.support, x i ∈ interior (B.compact i : Set ℝ)}

theorem isOpen_core

TopologyByExample.ProductRealBaire.Box.isOpen_core

The core is open.

theorem Box.isOpen_core (B : Box ι) : IsOpen B.core
Proof
:= by
  classical
  have h := isOpen_biInter_finset (s := B.support)
    (f := fun i ↦ (fun x : ι → ℝ ↦ x i) ⁻¹' interior (B.compact i : Set ℝ))
    (fun i _ ↦ isOpen_interior.preimage (continuous_apply (A := fun _ : ι ↦ ℝ) i))
  convert h using 1
  ext x
  simp [Box.core]

theorem core_nonempty

TopologyByExample.ProductRealBaire.Box.core_nonempty

The core is nonempty.

theorem Box.core_nonempty (B : Box ι) : B.core.Nonempty
Proof
:= by
  choose x hx using fun i ↦ (B.compact i).interior_nonempty
  exact ⟨x, fun i _ ↦ hx i⟩

theorem core_subset

TopologyByExample.ProductRealBaire.Box.core_subset

The core lies in the closed cylinder.

theorem Box.core_subset (B : Box ι) : B.core ⊆ B.carrier
Proof
:= by
  classical
  intro x hx i
  by_cases hi : i ∈ B.support
  · simpa [Box.coord, hi] using interior_subset (hx i hi)
  · simp [Box.coord, hi]

theorem exists_box

TopologyByExample.ProductRealBaire.exists_box

Every nonempty open set contains such a cylinder.

theorem exists_box {U : Set (ι → ℝ)} (hU : IsOpen U) (hne : U.Nonempty) :
    ∃ B : Box ι, B.carrier ⊆ U
Proof
:= by
  classical
  obtain ⟨x, hx⟩ := hne
  obtain ⟨F, A, hA, hAU⟩ := isOpen_pi_iff.mp hU x hx
  have hK (i : ι) : ∃ K : PositiveCompacts ℝ, i ∈ F → (K : Set ℝ) ⊆ A i := by
    by_cases hi : i ∈ F
    · obtain ⟨K, hK⟩ := (hA i hi).1.exists_positiveCompacts_closure_subset ⟨x i, (hA i hi).2⟩
      exact ⟨K, fun _ ↦ subset_closure.trans hK⟩
    · obtain ⟨K, _⟩ := (isOpen_univ : IsOpen (univ : Set ℝ)).exists_positiveCompacts_closure_subset
        ⟨0, mem_univ _⟩
      exact ⟨K, fun h ↦ (hi h).elim⟩
  choose K hK using hK
  refine ⟨⟨F, K⟩, fun y hy ↦ hAU fun i hi ↦ hK i hi ?_⟩
  have hyi : y i ∈ (if i ∈ F then (K i : Set ℝ) else univ) := hy i
  split_ifs at hyi with h
  · exact hyi
  · exact (h hi).elim

theorem isClosed_coord

TopologyByExample.ProductRealBaire.Box.isClosed_coord

Each coordinate restriction is closed.

theorem Box.isClosed_coord (B : Box ι) (i : ι) : IsClosed (B.coord i)
Proof
:= by
  classical
  unfold Box.coord
  split_ifs
  · exact (B.compact i).isCompact.isClosed
  · exact isClosed_univ

theorem coord_mono

TopologyByExample.ProductRealBaire.Box.coord_mono

Inclusion of cylinders entails inclusion of each coordinate restriction.

theorem Box.coord_mono {A B : Box ι} (h : A.carrier ⊆ B.carrier) (i : ι) :
    A.coord i ⊆ B.coord i
Proof
:= by
  classical
  obtain ⟨x, hx⟩ := A.core_nonempty.mono A.core_subset
  intro t ht
  have hy : Function.update x i t ∈ A.carrier := by
    intro j
    by_cases hj : j = i
    · subst j
      simpa using ht
    · simpa [Function.update_of_ne hj] using hx j
  simpa using h hy i

theorem nonempty_iInter

TopologyByExample.ProductRealBaire.nonempty_iInter

A decreasing sequence of compact-coordinate cylinders has a point in common.

theorem nonempty_iInter (B : ℕ → Box ι) (h : Antitone (fun n ↦ (B n).carrier)) :
    (⋂ n, (B n).carrier).Nonempty
Proof
:= by
  classical
  have hcoord (i : ι) : (⋂ n, (B n).coord i).Nonempty := by
    have ha : Antitone (fun n ↦ (B n).coord i) := fun n m hnm ↦ Box.coord_mono (h hnm) i
    by_cases hi : ∃ m, i ∈ (B m).support
    · obtain ⟨m, hm⟩ := hi
      have hc : IsCompact ((B m).coord i) := by
        simpa [Box.coord, hm] using ((B m).compact i).isCompact
      obtain ⟨x, hx⟩ := IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed
        (fun n ↦ (B (n + m)).coord i)
        (fun n ↦ ha (by omega))
        (fun n ↦ by
          obtain ⟨y, hy⟩ := (B (n + m)).core_nonempty.mono (B (n + m)).core_subset
          exact ⟨y i, hy i⟩)
        (by simpa using hc) (fun n ↦ (B (n + m)).isClosed_coord i)
      refine ⟨x, mem_iInter.mpr fun n ↦ ha (Nat.le_add_right n m) ?_⟩
      exact mem_iInter.mp hx n
    · refine ⟨0, mem_iInter.mpr fun n ↦ ?_⟩
      simp [Box.coord, show i ∉ (B n).support from fun hn ↦ hi ⟨n, hn⟩]
  choose x hx using hcoord
  exact ⟨x, mem_iInter.mpr fun n i ↦ mem_iInter.mp (hx i) n⟩

theorem baireSpace

TopologyByExample.ProductRealBaire.baireSpace

An arbitrary product of real lines is a Baire space.

theorem baireSpace : BaireSpace (ι → ℝ)
Proof
:= by
  classical
  constructor
  intro U ho hd
  apply dense_iff_inter_open.mpr
  intro O hO hOne
  obtain ⟨B₀, hB₀⟩ := exists_box hO hOne
  have step (n : ℕ) (B : Box ι) : ∃ C : Box ι, C.carrier ⊆ B.core ∩ U n :=
    exists_box (B.isOpen_core.inter (ho n))
      ((hd n).inter_open_nonempty _ B.isOpen_core B.core_nonempty)
  choose next hnext using step
  let B : ℕ → Box ι := Nat.rec B₀ next
  have hs (n : ℕ) : (B (n + 1)).carrier ⊆ (B n).core ∩ U n := hnext n (B n)
  have ha : Antitone (fun n ↦ (B n).carrier) := antitone_nat_of_succ_le
    fun n ↦ (hs n).trans (inter_subset_left.trans (B n).core_subset)
  obtain ⟨x, hx⟩ := nonempty_iInter B ha
  exact ⟨x, hB₀ (mem_iInter.mp hx 0), mem_iInter.mpr fun n ↦ (hs n (mem_iInter.mp hx (n+1))).2⟩