Module docstring
{"# Infinite pigeonhole principle
This file proves variants of the infinite pigeonhole principle.
TODO
Generalize universes of results. "}
{"# Infinite pigeonhole principle
This file proves variants of the infinite pigeonhole principle.
Generalize universes of results. "}
Cardinal.infinite_pigeonhole
theorem
{β α : Type u} (f : β → α) (h₁ : ℵ₀ ≤ #β) (h₂ : #α < (#β).ord.cof) : ∃ a : α, #(f ⁻¹' { a }) = #β
/-- 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⟩
Cardinal.infinite_pigeonhole_card
theorem
{β α : Type u} (f : β → α) (θ : Cardinal) (hθ : θ ≤ #β) (h₁ : ℵ₀ ≤ θ) (h₂ : #α < θ.ord.cof) :
∃ a : α, θ ≤ #(f ⁻¹' { a })
/-- 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
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
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'
Cardinal.infinite_pigeonhole_card_lt
theorem
{β α : Type u} (f : β → α) (w : #α < #β) (w' : ℵ₀ ≤ #α) : ∃ a : α, #α < #(f ⁻¹' { a })
/-- 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)
Cardinal.exists_infinite_fiber
theorem
{β α : Type u} (f : β → α) (w : #α < #β) (w' : Infinite α) : ∃ a : α, Infinite (f ⁻¹' { a })
/-- 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⟩
Cardinal.le_range_of_union_finset_eq_top
theorem
{α β : Type*} [Infinite β] (f : α → Finset β) (w : ⋃ a, (f a : Set β) = ⊤) : #β ≤ #(range f)
/-- 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