doc-next-gen

Mathlib.SetTheory.Cardinal.Pigeonhole

Module docstring

{"# Infinite pigeonhole principle

This file proves variants of the infinite pigeonhole principle.

TODO

Generalize universes of results. "}

Cardinal.infinite_pigeonhole theorem
{β α : Type u} (f : β → α) (h₁ : ℵ₀ ≤ #β) (h₂ : #α < (#β).ord.cof) : ∃ a : α, #(f ⁻¹' { a }) = #β
Full source
/-- The infinite pigeonhole principle -/
theorem infinite_pigeonhole {β α : Type u} (f : β → α) (h₁ : ℵ₀) (h₂ :  < ().ord.cof) :
    ∃ a : α, #(f ⁻¹' {a}) = #β := by
  have : ∃ a, #β ≤ #(f ⁻¹' {a}) := by
    by_contra! h
    apply mk_univ.not_lt
    rw [← preimage_univ, ← iUnion_of_singleton, preimage_iUnion]
    exact
      mk_iUnion_le_sum_mk.trans_lt
        ((sum_le_iSup _).trans_lt <| mul_lt_of_lt h₁ (h₂.trans_le <| cof_ord_le _) (iSup_lt h₂ h))
  obtain ⟨x, h⟩ := this
  refine ⟨x, h.antisymm' ?_⟩
  rw [le_mk_iff_exists_set]
  exact ⟨_, rfl⟩
Infinite Pigeonhole Principle: Existence of a Fiber with Full Cardinality
Informal description
Let $\beta$ and $\alpha$ be types, and let $f \colon \beta \to \alpha$ be a function. If the cardinality of $\beta$ is at least $\aleph_0$ (i.e., $\beta$ is infinite) and the cardinality of $\alpha$ is less than the cofinality of the ordinal associated with the cardinality of $\beta$, then there exists an element $a \in \alpha$ such that the preimage $f^{-1}(\{a\})$ has the same cardinality as $\beta$.
Cardinal.infinite_pigeonhole_card theorem
{β α : Type u} (f : β → α) (θ : Cardinal) (hθ : θ ≤ #β) (h₁ : ℵ₀ ≤ θ) (h₂ : #α < θ.ord.cof) : ∃ a : α, θ ≤ #(f ⁻¹' { a })
Full source
/-- Pigeonhole principle for a cardinality below the cardinality of the domain -/
theorem infinite_pigeonhole_card {β α : Type u} (f : β → α) (θ : Cardinal) (hθ : θ ≤ )
    (h₁ : ℵ₀ ≤ θ) (h₂ :  < θ.ord.cof) : ∃ a : α, θ ≤ #(f ⁻¹' {a}) := by
  rcases le_mk_iff_exists_set.1 hθ with ⟨s, rfl⟩
  obtain ⟨a, ha⟩ := infinite_pigeonhole (f ∘ Subtype.val : s → α) h₁ h₂
  use a; rw [← ha, @preimage_comp _ _ _ Subtype.val f]
  exact mk_preimage_of_injective _ _ Subtype.val_injective
Infinite Pigeonhole Principle for Cardinality: $\theta \leq \#(f^{-1}\{a\})$ under cofinality condition
Informal description
Let $\beta$ and $\alpha$ be types, and let $f \colon \beta \to \alpha$ be a function. Given a cardinal number $\theta$ such that: 1. $\theta \leq \#\beta$ (the cardinality of $\beta$ is at least $\theta$), 2. $\aleph_0 \leq \theta$ ($\theta$ is infinite), 3. $\#\alpha < \mathrm{cof}(\theta.\mathrm{ord})$ (the cardinality of $\alpha$ is less than the cofinality of the ordinal associated with $\theta$), there exists an element $a \in \alpha$ such that the preimage $f^{-1}(\{a\})$ has cardinality at least $\theta$.
Cardinal.infinite_pigeonhole_set theorem
{β α : Type u} {s : Set β} (f : s → α) (θ : Cardinal) (hθ : θ ≤ #s) (h₁ : ℵ₀ ≤ θ) (h₂ : #α < θ.ord.cof) : ∃ (a : α) (t : Set β) (h : t ⊆ s), θ ≤ #t ∧ ∀ ⦃x⦄ (hx : x ∈ t), f ⟨x, h hx⟩ = a
Full source
theorem infinite_pigeonhole_set {β α : Type u} {s : Set β} (f : s → α) (θ : Cardinal)
    (hθ : θ ≤ #s) (h₁ : ℵ₀ ≤ θ) (h₂ :  < θ.ord.cof) :
    ∃ (a : α) (t : Set β) (h : t ⊆ s), θ ≤ #t ∧ ∀ ⦃x⦄ (hx : x ∈ t), f ⟨x, h hx⟩ = a := by
  obtain ⟨a, ha⟩ := infinite_pigeonhole_card f θ hθ h₁ h₂
  refine ⟨a, { x | ∃ h, f ⟨x, h⟩ = a }, ?_, ?_, ?_⟩
  · rintro x ⟨hx, _⟩
    exact hx
  · refine
      ha.trans
        (ge_of_eq <|
          Quotient.sound ⟨Equiv.trans ?_ (Equiv.subtypeSubtypeEquivSubtypeExists _ _).symm⟩)
    simp only [coe_eq_subtype, mem_singleton_iff, mem_preimage, mem_setOf_eq]
    rfl
  rintro x ⟨_, hx'⟩; exact hx'
Infinite Pigeonhole Principle for Subsets: Existence of a Large Monochromatic Subset under Cofinality Condition
Informal description
Let $\beta$ and $\alpha$ be types, $s \subseteq \beta$ a subset, and $f \colon s \to \alpha$ a function. Given a cardinal number $\theta$ such that: 1. $\theta \leq \#s$ (the cardinality of $s$ is at least $\theta$), 2. $\aleph_0 \leq \theta$ ($\theta$ is infinite), 3. $\#\alpha < \mathrm{cof}(\theta.\mathrm{ord})$ (the cardinality of $\alpha$ is less than the cofinality of the ordinal associated with $\theta$), there exists an element $a \in \alpha$ and a subset $t \subseteq s$ such that: 1. $\theta \leq \#t$ (the cardinality of $t$ is at least $\theta$), 2. For all $x \in t$, $f(x) = a$.
Cardinal.infinite_pigeonhole_card_lt theorem
{β α : Type u} (f : β → α) (w : #α < #β) (w' : ℵ₀ ≤ #α) : ∃ a : α, #α < #(f ⁻¹' { a })
Full source
/-- A function whose codomain's cardinality is infinite but strictly smaller than its domain's
has a fiber with cardinality strictly great than the codomain. -/
theorem infinite_pigeonhole_card_lt {β α : Type u} (f : β → α) (w :  < ) (w' : ℵ₀) :
    ∃ a : α, #α < #(f ⁻¹' {a}) := by
  simp_rw [← succ_le_iff]
  exact infinite_pigeonhole_card f (succ ) (succ_le_of_lt w) (w'.trans (lt_succ _).le)
    ((lt_succ _).trans_le (isRegular_succ w').2.ge)
Strong Infinite Pigeonhole Principle: $\#\alpha < \#(f^{-1}\{a\})$ when $\#\alpha < \#\beta$ and $\alpha$ is infinite
Informal description
Let $\beta$ and $\alpha$ be types, and let $f \colon \beta \to \alpha$ be a function. If the cardinality of $\alpha$ is strictly less than that of $\beta$ (i.e., $\#\alpha < \#\beta$) and $\alpha$ is infinite (i.e., $\aleph_0 \leq \#\alpha$), then there exists an element $a \in \alpha$ such that the preimage $f^{-1}(\{a\})$ has cardinality strictly greater than $\#\alpha$.
Cardinal.exists_infinite_fiber theorem
{β α : Type u} (f : β → α) (w : #α < #β) (w' : Infinite α) : ∃ a : α, Infinite (f ⁻¹' { a })
Full source
/-- A function whose codomain's cardinality is infinite but strictly smaller than its domain's
has an infinite fiber. -/
theorem exists_infinite_fiber {β α : Type u} (f : β → α) (w :  < ) (w' : Infinite α) :
    ∃ a : α, Infinite (f ⁻¹' {a}) := by
  simp_rw [Cardinal.infinite_iff] at w' ⊢
  obtain ⟨a, ha⟩ := infinite_pigeonhole_card_lt f w w'
  exact ⟨a, w'.trans ha.le⟩
Infinite Pigeonhole Principle: Existence of an Infinite Fiber
Informal description
Let $\beta$ and $\alpha$ be types, and let $f \colon \beta \to \alpha$ be a function. If the cardinality of $\alpha$ is strictly less than that of $\beta$ (i.e., $\#\alpha < \#\beta$) and $\alpha$ is infinite, then there exists an element $a \in \alpha$ such that the preimage $f^{-1}(\{a\})$ is infinite.
Cardinal.le_range_of_union_finset_eq_top theorem
{α β : Type*} [Infinite β] (f : α → Finset β) (w : ⋃ a, (f a : Set β) = ⊤) : #β ≤ #(range f)
Full source
/-- If an infinite type `β` can be expressed as a union of finite sets,
then the cardinality of the collection of those finite sets
must be at least the cardinality of `β`. -/
-- TODO: write `Set.univ` instead of `⊤` and rename the theorem accordingly.
theorem le_range_of_union_finset_eq_top {α β : Type*} [Infinite β] (f : α → Finset β)
    (w : ⋃ a, (f a : Set β) = ) : #(range f) := by
  have k : _root_.Infinite (range f) := by
    rw [infinite_coe_iff]
    apply mt (union_finset_finite_of_range_finite f)
    rw [w]
    exact infinite_univ
  by_contra h
  simp only [not_le] at h
  let u : ∀ b, ∃ a, b ∈ f a := fun b => by simpa using (w.ge :) (Set.mem_univ b)
  let u' : β → range f := fun b => ⟨f (u b).choose, by simp⟩
  have v' : ∀ a, u' ⁻¹' {⟨f a, by simp⟩} ≤ f a := by
    rintro a p m
    simp? [u']  at m says simp only [mem_preimage, mem_singleton_iff, Subtype.mk.injEq, u'] at m
    rw [← m]
    apply fun b => (u b).choose_spec
  obtain ⟨⟨-, ⟨a, rfl⟩⟩, p⟩ := exists_infinite_fiber u' h k
  exact (@Infinite.of_injective _ _ p (inclusion (v' a)) (inclusion_injective _)).false
Cardinality Bound for Covering an Infinite Set by Finite Sets
Informal description
Let $\alpha$ and $\beta$ be types with $\beta$ infinite. Given a function $f \colon \alpha \to \text{Finset} \beta$ such that the union of all finite sets $f(a)$ (viewed as subsets of $\beta$) covers $\beta$ (i.e., $\bigcup_{a \in \alpha} f(a) = \beta$), then the cardinality of $\beta$ is at most the cardinality of the range of $f$.