forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPigeonhole.lean
More file actions
126 lines (107 loc) · 5.53 KB
/
Pigeonhole.lean
File metadata and controls
126 lines (107 loc) · 5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/-
Copyright (c) 2017 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Floris van Doorn
-/
module
public import Mathlib.Data.Set.Finite.Lattice
public import Mathlib.SetTheory.Cardinal.Regular
/-!
# Infinite pigeonhole principle
This file proves variants of the infinite pigeonhole principle.
## TODO
Generalize universes of results.
-/
public section
open Order Ordinal Set
universe u
namespace Cardinal
/-- 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_mk_mul_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⟩
/-- 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
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'
/-- A function whose domain's cardinality is infinite and strictly greater than its codomain's
has a fiber with cardinality strictly great than the codomain. -/
theorem infinite_pigeonhole_card_lt {β α : Type u} (f : β → α) (h : #α < #β) (hβ : ℵ₀ ≤ #β) :
∃ a : α, #α < #(f ⁻¹' {a}) := by
simp_rw [← succ_le_iff]
rcases lt_or_ge #α ℵ₀ with hα | hα
· obtain ⟨a, ha⟩ := infinite_pigeonhole_card f ℵ₀ hβ le_rfl (by rwa [isRegular_aleph0.cof_eq])
exact ⟨a, ha.trans' (succ_le_of_lt hα)⟩
· exact infinite_pigeonhole_card f (succ #α) (succ_le_of_lt h) (hα.trans (le_succ _))
((lt_succ _).trans_le (isRegular_succ hα).2.ge)
/-- A function whose domain's cardinality is infinite and strictly greater than its codomain's
has an infinite fiber. -/
theorem exists_infinite_fiber {β α : Type u} (f : β → α) (h : #α < #β) [Infinite β] :
∃ a : α, Infinite (f ⁻¹' {a}) := by
simp_rw [Cardinal.infinite_iff]
rcases lt_or_ge #α ℵ₀ with hα | hα
· exact infinite_pigeonhole_card f ℵ₀ (aleph0_le_mk β) le_rfl (by rwa [isRegular_aleph0.cof_eq])
· obtain ⟨a, ha⟩ := infinite_pigeonhole_card_lt f h (aleph0_le_mk β)
exact ⟨a, hα.trans ha.le⟩
/-- A weaker version of `exists_infinite_fiber` that requires codomain to be infinite. -/
theorem exists_infinite_fiber' {β α : Type u} (f : β → α) (h : #α < #β) [Infinite α] :
∃ a : α, Infinite (f ⁻¹' {a}) := by
suffices Infinite β from exists_infinite_fiber f h
exact .of_cardinalMk_le h.le
/-- A function whose domain's cardinality is uncountable and strictly greater than its codomain's
has an uncountable fiber. -/
theorem exists_uncountable_fiber {β α : Type u} (f : β → α) (h : #α < #β) [Uncountable β] :
∃ a : α, Uncountable (f ⁻¹' {a}) := by
simp_rw [← Cardinal.aleph1_le_mk_iff]
rcases lt_or_ge #α ℵ₀ with hα | hα
· exact infinite_pigeonhole_card f ℵ₁ (aleph1_le_mk β) aleph0_lt_aleph_one.le
(by rw [isRegular_aleph_one.cof_eq]; exact hα.trans aleph0_lt_aleph_one)
· obtain ⟨a, ha⟩ := infinite_pigeonhole_card_lt f h (aleph0_le_mk β)
rw [← Order.succ_le_succ_iff, succ_aleph0] at hα
exact ⟨a, hα.trans (succ_le_of_lt ha)⟩
/-- 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 `β`. -/
theorem le_range_of_union_finset_eq_univ {α β : Type*} [Infinite β] (f : α → Finset β)
(w : ⋃ a, (f a : Set β) = Set.univ) : #β ≤ #(range f) := by
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
have m : f (u p).choose = f a := by simpa [u'] using m
rw [← m]
apply fun b => (u b).choose_spec
obtain ⟨⟨-, ⟨a, rfl⟩⟩, p⟩ := exists_infinite_fiber u' h
exact (@Infinite.of_injective _ _ p (inclusion (v' a)) (inclusion_injective _)).false
@[deprecated (since := "2026-01-17")] alias le_range_of_union_finset_eq_top :=
le_range_of_union_finset_eq_univ
end Cardinal