Lean library · module TopologyByExample.Theorems.MathiasAnalytic

Mathias's analytic partition theorem

Source file

For a selective free ultrafilter, every analytic or coanalytic family of infinite subsets of the naturals has a homogeneous member of the ultrafilter. Infinite subsets carry their usual topology as a subspace of the Cantor product.

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 encodeSet

TopologyByExample.Mathias.encodeSet

The Boolean characteristic function of a subset of the naturals.

def encodeSet (A : Set ℕ) : ℕ → Bool
:= by classical exact fun n ↦ decide (n ∈ A)

definition decodeSet

TopologyByExample.Mathias.decodeSet

The subset represented by a point of the Cantor product.

def decodeSet (x : ℕ → Bool) : Set ℕ
:= {n | x n = true}

theorem encode_decode

TopologyByExample.Mathias.encode_decode

Encoding a decoded Cantor point recovers that point.

theorem encode_decode (x : ℕ → Bool) : encodeSet (decodeSet x) = x
Proof
:= by
  funext n
  cases h : x n <;> simp [encodeSet, decodeSet, h]

theorem decode_encode

TopologyByExample.Mathias.decode_encode

Decoding a characteristic function recovers the original subset.

theorem decode_encode (A : Set ℕ) : decodeSet (encodeSet A) = A
Proof
:= by
  ext n
  simp [encodeSet, decodeSet]

definition InfiniteSubset

TopologyByExample.Mathias.InfiniteSubset

Infinite subsets with the usual Cantor-product subspace topology.

abbrev InfiniteSubset
:= {x : ℕ → Bool // (decodeSet x).Infinite}

theorem mem_iff_mem_stem

TopologyByExample.Mathias.mem_iff_mem_stem

A cone fixes membership of every coordinate below its stem cut.

theorem mem_iff_mem_stem {s : Finset ℕ} {A X : Set ℕ} (hX : X ∈ cone s A)
    {n : ℕ} (hn : n < cut s) : n ∈ X ↔ n ∈ s
Proof
:= by
  constructor
  · intro hx
    exact (hX.2.2 hx).resolve_right (fun h ↦ (not_le_of_gt hn) h.2)
  · exact fun hn ↦ hX.2.1 hn

theorem prefixOpen_preimage_of_isOpen

TopologyByExample.Mathias.prefixOpen_preimage_of_isOpen

A Cantor-open family induces a prefix-open family of infinite subsets.

theorem prefixOpen_preimage_of_isOpen {B : Set (ℕ → Bool)} (hB : IsOpen B) :
    PrefixOpen (encodeSet ⁻¹' B)
Proof
:= by
  classical
  intro X hXB hXi k
  obtain ⟨_, ⟨y, n, rfl⟩, hXc, hcB⟩ :=
    (PiNat.isTopologicalBasis_cylinders (fun _ ↦ Bool)).exists_subset_of_mem_open hXB hB
  have hc : PiNat.cylinder (encodeSet X) n ⊆ B := by
    rwa [← PiNat.mem_cylinder_iff_eq.mp hXc] at hcB
  have hbase : X ∈ cone ∅ univ := ⟨hXi, by simp, by
    intro m _
    exact Or.inr ⟨mem_univ _, Nat.zero_le _⟩⟩
  obtain ⟨t, _, hkt, htX⟩ := exists_long_extension hbase (max k n)
  have htX : X ∈ cone t univ := by simpa using htX
  refine ⟨t, htX, (le_max_left _ _).trans hkt.le, fun Y hY ↦ hc ?_⟩
  apply PiNat.mem_cylinder_iff.mpr
  intro m hm
  have hmt : m < cut t := hm.trans_le ((le_max_right _ _).trans hkt.le)
  have he : (m ∈ Y) = (m ∈ X) := propext
    ((mem_iff_mem_stem hY hmt).trans (mem_iff_mem_stem htX hmt).symm)
  simp only [encodeSet, he]

theorem completelyRamsey_preimage_of_isClosed

TopologyByExample.Mathias.completelyRamsey_preimage_of_isClosed

Pullbacks of Cantor-closed families are completely Ramsey.

theorem completelyRamsey_preimage_of_isClosed {U : Ultrafilter ℕ} (hU : IsSelective U)
    (hfree : (U : Filter ℕ) ≤ cofinite) {B : Set (ℕ → Bool)} (hB : IsClosed B) :
    CompletelyRamsey U (encodeSet ⁻¹' B)
Proof
:= by
  simpa only [preimage_compl, compl_compl] using
    ((prefixOpen_preimage_of_isOpen hB.isOpen_compl).completelyRamsey hU hfree).compl

definition listCylinder

TopologyByExample.Mathias.listCylinder

The Baire-space cylinder described by a finite reversed prefix.

def listCylinder (s : List ℕ) : Set (ℕ → ℕ)
:= {f | PiNat.res f s.length = s}

theorem listCylinder_eq_iUnion

TopologyByExample.Mathias.listCylinder_eq_iUnion

A finite-prefix cylinder is the union of its one-step extensions.

theorem listCylinder_eq_iUnion (s : List ℕ) :
    listCylinder s = ⋃ k : ℕ, listCylinder (k :: s)
Proof
:= by
  ext f
  simp only [listCylinder, mem_ofPred_eq, mem_iUnion, List.length_cons, PiNat.res_succ,
    List.cons.injEq]
  exact ⟨fun h ↦ ⟨f s.length, rfl, h⟩, fun ⟨_, _, h⟩ ↦ h⟩

theorem eq_of_mem_closure_images

TopologyByExample.Mathias.eq_of_mem_closure_images

The closures of continuous images of shrinking cylinders identify the image of their unique common branch.

theorem eq_of_mem_closure_images {g : (ℕ → ℕ) → (ℕ → Bool)} (hg : Continuous g)
    (f : ℕ → ℕ) {x : ℕ → Bool}
    (hx : ∀ n, x ∈ closure (g '' PiNat.cylinder f n)) : x = g f
Proof
:= by
  funext i
  have ho : IsOpen {a : ℕ → ℕ | g a i = g f i} :=
    (isOpen_discrete {g f i}).preimage ((continuous_apply i).comp hg)
  obtain ⟨_, ⟨a, n, rfl⟩, hf, hsub⟩ :=
    (PiNat.isTopologicalBasis_cylinders (fun _ ↦ ℕ)).exists_subset_of_mem_open
      (show f ∈ {a : ℕ → ℕ | g a i = g f i} from rfl) ho
  have hsub : PiNat.cylinder f n ⊆ {a : ℕ → ℕ | g a i = g f i} := by
    rwa [← PiNat.mem_cylinder_iff_eq.mp hf] at hsub
  have hc : IsClosed {z : ℕ → Bool | z i = g f i} :=
    isClosed_eq (continuous_apply i) continuous_const
  exact closure_minimal (image_subset_iff.mpr hsub) hc (hx n)

theorem completelyRamsey_preimage_of_analytic

TopologyByExample.Mathias.completelyRamsey_preimage_of_analytic

Analytic families in the Cantor product are completely Ramsey for a selective free ultrafilter.

theorem completelyRamsey_preimage_of_analytic {U : Ultrafilter ℕ} (hU : IsSelective U)
    (hfree : (U : Filter ℕ) ≤ cofinite) {D : Set (ℕ → Bool)} (hD : AnalyticSet D) :
    CompletelyRamsey U (encodeSet ⁻¹' D)
Proof
:= by
  classical
  have hrep : D = ∅ ∨ ∃ g : (ℕ → ℕ) → (ℕ → Bool), Continuous g ∧ range g = D := by
    obtain ⟨Y, _, _, g, hg, rfl⟩ := analyticSet_iff_exists_polishSpace_range.mp hD
    cases isEmpty_or_nonempty Y with
    | inl h => exact Or.inl (range_eq_empty g)
    | inr _ =>
      obtain ⟨f, hf, hsurj⟩ := PolishSpace.exists_nat_nat_continuous_surjective Y
      exact Or.inr ⟨g ∘ f, hg.comp hf, hsurj.range_comp g⟩
  rcases hrep with rfl | ⟨g, hg, rfl⟩
  · simpa only [preimage_empty] using (ramseyNull_empty U).completelyRamsey
  · let S (s : List ℕ) : Set (Set ℕ) := encodeSet ⁻¹' (g '' listCylinder s)
    let A (s : List ℕ) : Set (Set ℕ) := encodeSet ⁻¹' closure (g '' listCylinder s)
    have hroot : S [] = encodeSet ⁻¹' range g := by simp [S, listCylinder]
    rw [← hroot]
    apply completelyRamsey_of_tree hU hfree A S
    · exact fun s ↦ completelyRamsey_preimage_of_isClosed hU hfree isClosed_closure
    · exact fun s ↦ preimage_mono subset_closure
    · intro s
      simp only [S, listCylinder_eq_iUnion s, image_iUnion, preimage_iUnion]
    · intro f X hX
      have he : encodeSet X = g f := eq_of_mem_closure_images hg f (fun n ↦ by
        have hh := mem_iInter.mp hX n
        have hc : listCylinder (PiNat.res f n) = PiNat.cylinder f n := by
          simp only [listCylinder, PiNat.res_length, PiNat.cylinder_eq_res]
        simpa only [A, mem_preimage, hc] using hh)
      exact ⟨f, by simp [listCylinder], he.symm⟩

theorem analytic_homogeneous

TopologyByExample.Mathias.analytic_homogeneous

Mathias's theorem for an analytic family of infinite subsets of the naturals.

theorem analytic_homogeneous {U : Ultrafilter ℕ} (hU : IsSelective U)
    (hfree : (U : Filter ℕ) ≤ cofinite) {D : Set InfiniteSubset} (hD : AnalyticSet D) :
    ∃ H ∈ U, (∀ x : InfiniteSubset, decodeSet x.val ⊆ H → x ∈ D) ∨
      (∀ x : InfiniteSubset, decodeSet x.val ⊆ H → x ∉ D)
Proof
:= by
  have h := completelyRamsey_preimage_of_analytic hU hfree
    (hD.image_of_continuous continuous_subtypeVal)
  obtain ⟨H, hH, _, hp | hn⟩ := h ∅ univ univ_mem
  · refine ⟨H, hH, Or.inl fun x hx ↦ ?_⟩
    have hcone : decodeSet x.val ∈ cone ∅ H := ⟨x.property, by simp, fun n hn ↦
      Or.inr ⟨hx hn, Nat.zero_le _⟩⟩
    obtain ⟨y, hy, he⟩ := hp hcone
    rw [encode_decode] at he
    exact Subtype.val_injective he ▸ hy
  · refine ⟨H, hH, Or.inr fun x hx hxd ↦ ?_⟩
    have hcone : decodeSet x.val ∈ cone ∅ H := ⟨x.property, by simp, fun n hn ↦
      Or.inr ⟨hx hn, Nat.zero_le _⟩⟩
    exact hn hcone ⟨x, hxd, (encode_decode x.val).symm⟩

theorem analytic_or_coanalytic_homogeneous

TopologyByExample.Mathias.analytic_or_coanalytic_homogeneous

An analytic/coanalytic two-colouring of infinite subsets has a homogeneous member of every selective free ultrafilter.

theorem analytic_or_coanalytic_homogeneous {U : Ultrafilter ℕ} (hU : IsSelective U)
    (hfree : (U : Filter ℕ) ≤ cofinite) {D : Set InfiniteSubset}
    (hD : AnalyticSet D ∨ AnalyticSet Dᶜ) :
    ∃ H ∈ U, (∀ x : InfiniteSubset, decodeSet x.val ⊆ H → x ∈ D) ∨
      (∀ x : InfiniteSubset, decodeSet x.val ⊆ H → x ∉ D)
Proof
:= by
  rcases hD with hp | hn
  · exact analytic_homogeneous hU hfree hp
  · obtain ⟨H, hH, hh⟩ := analytic_homogeneous hU hfree hn
    exact ⟨H, hH, by simpa only [mem_compl_iff, not_not] using hh.symm⟩

On this site: Theorem: Mathias's analytic partition theorem