Lean library · module TopologyByExample.Theorems.SelectiveUltrafilters

Selective ultrafilters and finite partition properties

Source file

The function definition of selectivity and the diagonal selection property are kept explicit. Diagonal selection gives homogeneous members for every finite colouring of fixed-size finite subsets.

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 IsSelective

TopologyByExample.UltrafilterProperties.IsSelective

An ultrafilter is selective if every natural-valued function is constant or injective on one of its members. Nonprincipality is a separate hypothesis.

def IsSelective (U : Ultrafilter ℕ) : Prop
:=
  ∀ f : ℕ → ℕ, ∃ H ∈ U, (∃ k, ∀ n ∈ H, f n = k) ∨ Set.InjOn f H

definition HasDiagonalSelection

TopologyByExample.UltrafilterProperties.HasDiagonalSelection

The diagonal selection property for a sequence of ultrafilter members.

def HasDiagonalSelection (U : Ultrafilter ℕ) : Prop
:=
  ∀ A : ℕ → Set ℕ, (∀ n, A n ∈ U) → ∃ H ∈ U,
    ∀ n ∈ H, ∀ m ∈ H, n < m → m ∈ A n

definition HasFiniteRamseyProperty

TopologyByExample.UltrafilterProperties.HasFiniteRamseyProperty

Every finite colouring of the n-element subsets has a homogeneous ultrafilter member.

def HasFiniteRamseyProperty (U : Ultrafilter ℕ) : Prop
:=
  ∀ n r : ℕ, ∀ c : Finset ℕ → Fin r, ∃ H ∈ U, ∃ i : Fin r,
    ∀ s : Finset ℕ, (s : Set ℕ) ⊆ H → s.card = n → c s = i

theorem exists_constant_member

TopologyByExample.UltrafilterProperties.exists_constant_member

A finite-valued function is constant on some ultrafilter member.

theorem exists_constant_member {U : Ultrafilter ℕ} {Y : Type*} [Finite Y] (f : ℕ → Y) :
    ∃ i : Y, {n | f n = i} ∈ U
Proof
:=
  Ultrafilter.eventually_exists_iff.mp (Eventually.of_forall fun n ↦ ⟨f n, rfl⟩)

theorem finiteRamsey

TopologyByExample.UltrafilterProperties.HasDiagonalSelection.finiteRamsey

Diagonal selection yields homogeneous sets for every finite exponent and finite number of colours.

theorem HasDiagonalSelection.finiteRamsey {U : Ultrafilter ℕ} (hU : HasDiagonalSelection U) :
    HasFiniteRamseyProperty U
Proof
:= by
  intro n
  induction n with
  | zero =>
    intro r c
    refine ⟨univ, univ_mem, c ∅, fun s _ hs ↦ ?_⟩
    rw [Finset.card_eq_zero.mp hs]
  | succ n ih =>
    intro r c
    choose A hA i hi using fun a : ℕ ↦ ih r (fun s ↦ c (insert a s))
    obtain ⟨j, hj⟩ := exists_constant_member i
    obtain ⟨H, hH, hHA⟩ := hU A hA
    refine ⟨H ∩ {a | i a = j}, inter_mem hH hj, j, fun s hs hcard ↦ ?_⟩
    have hsne : s.Nonempty := Finset.card_pos.mp (hcard ▸ Nat.succ_pos n)
    let a := s.min' hsne
    have has : a ∈ s := Finset.min'_mem s hsne
    have haH : a ∈ H := (hs has).1
    have hai : i a = j := (hs has).2
    have hsub : (↑(s.erase a) : Set ℕ) ⊆ A a := by
      intro b hb
      have hbs := Finset.mem_erase.mp hb
      exact hHA a haH b (hs hbs.2).1
        (lt_of_le_of_ne (Finset.min'_le s b hbs.2) hbs.1.symm)
    have hc : (s.erase a).card = n := by
      rw [Finset.card_erase_of_mem has, hcard]
      omega
    have hh := hi a (s.erase a) hsub hc
    simpa only [Finset.insert_erase has, hai] using hh

theorem isSelective

TopologyByExample.UltrafilterProperties.HasFiniteRamseyProperty.isSelective

The finite partition property implies the constant-or-injective function characterization of selectivity.

theorem HasFiniteRamseyProperty.isSelective {U : Ultrafilter ℕ}
    (hU : HasFiniteRamseyProperty U) : IsSelective U
Proof
:= by
  classical
  intro f
  let c : Finset ℕ → Fin 2 := fun s ↦
    if ∀ a ∈ s, ∀ b ∈ s, f a = f b then 0 else 1
  obtain ⟨H, hH, i, hi⟩ := hU 2 2 c
  have hpair (a b : ℕ) : (∀ x ∈ ({a, b} : Finset ℕ),
      ∀ y ∈ ({a, b} : Finset ℕ), f x = f y) ↔ f a = f b := by
    simp only [Finset.mem_insert, Finset.mem_singleton]
    aesop
  have hc (a : ℕ) (ha : a ∈ H) (b : ℕ) (hb : b ∈ H) (hab : a ≠ b) :
      (if f a = f b then (0 : Fin 2) else 1) = i := by
    have hh := hi {a, b} (by simpa only [Finset.coe_insert, Finset.coe_singleton,
      insert_subset_iff, singleton_subset_iff] using And.intro ha hb)
      (Finset.card_pair hab)
    simpa only [c, hpair] using hh
  refine ⟨H, hH, ?_⟩
  by_cases hi0 : i = 0
  · left
    obtain ⟨a, ha⟩ := Ultrafilter.nonempty_of_mem hH
    refine ⟨f a, fun b hb ↦ ?_⟩
    by_cases hba : b = a
    · exact congrArg f hba
    · have hh := hc b hb a ha hba
      rw [hi0] at hh
      by_contra hne
      simp only [hne, ite_false] at hh
      exact (by decide : (1 : Fin 2) ≠ 0) hh
  · right
    intro a ha b hb he
    by_contra hab
    have hh := hc a ha b hb hab
    simp only [he, ite_true] at hh
    exact hi0 hh.symm