@@ -23,7 +23,7 @@ Define filters for other cardinalities of the complement.
23
23
open set function
24
24
open_locale classical
25
25
26
- variables {α : Type *}
26
+ variables {ι α β : Type *}
27
27
28
28
namespace filter
29
29
@@ -52,76 +52,67 @@ lemma frequently_cofinite_iff_infinite {p : α → Prop} :
52
52
by simp only [filter.frequently, filter.eventually, mem_cofinite, compl_set_of, not_not,
53
53
set.infinite]
54
54
55
- /-- The coproduct of the cofinite filters on two types is the cofinite filter on their product. -/
56
- lemma coprod_cofinite {β : Type *} :
57
- (cofinite : filter α).coprod (cofinite : filter β) = cofinite :=
58
- begin
59
- ext S,
60
- simp only [mem_coprod_iff, exists_prop, mem_comap, mem_cofinite],
61
- split,
62
- { rintro ⟨⟨A, hAf, hAS⟩, B, hBf, hBS⟩,
63
- rw [← compl_subset_compl, ← preimage_compl] at hAS hBS,
64
- exact (hAf.prod hBf).subset (subset_inter hAS hBS) },
65
- { intro hS,
66
- refine ⟨⟨(prod.fst '' Sᶜ)ᶜ, _, _⟩, ⟨(prod.snd '' Sᶜ)ᶜ, _, _⟩⟩,
67
- { simpa using hS.image prod.fst },
68
- { simpa [compl_subset_comm] using subset_preimage_image prod.fst Sᶜ },
69
- { simpa using hS.image prod.snd },
70
- { simpa [compl_subset_comm] using subset_preimage_image prod.snd Sᶜ } },
71
- end
72
-
73
- /-- Finite product of finite sets is finite -/
74
- lemma Coprod_cofinite {δ : Type *} {κ : δ → Type *} [fintype δ] :
75
- filter.Coprod (λ d, (cofinite : filter (κ d))) = cofinite :=
76
- begin
77
- ext S,
78
- rcases compl_surjective S with ⟨S, rfl⟩,
79
- simp_rw [compl_mem_Coprod_iff, mem_cofinite, compl_compl],
80
- split,
81
- { rintro ⟨t, htf, hsub⟩,
82
- exact (finite.pi htf).subset hsub },
83
- { exact λ hS, ⟨λ i, eval i '' S, λ i, hS.image _, subset_pi_eval_image _ _⟩ }
84
- end
85
-
86
- end filter
87
-
88
- open filter
89
-
90
- lemma set.finite.compl_mem_cofinite {s : set α} (hs : s.finite) : sᶜ ∈ (@cofinite α) :=
55
+ lemma _root_.set.finite.compl_mem_cofinite {s : set α} (hs : s.finite) : sᶜ ∈ (@cofinite α) :=
91
56
mem_cofinite.2 $ (compl_compl s).symm ▸ hs
92
57
93
- lemma set.finite.eventually_cofinite_nmem {s : set α} (hs : s.finite) : ∀ᶠ x in cofinite, x ∉ s :=
58
+ lemma _root_.set.finite.eventually_cofinite_nmem {s : set α} (hs : s.finite) :
59
+ ∀ᶠ x in cofinite, x ∉ s :=
94
60
hs.compl_mem_cofinite
95
61
96
- lemma finset.eventually_cofinite_nmem (s : finset α) : ∀ᶠ x in cofinite, x ∉ s :=
62
+ lemma _root_. finset.eventually_cofinite_nmem (s : finset α) : ∀ᶠ x in cofinite, x ∉ s :=
97
63
s.finite_to_set.eventually_cofinite_nmem
98
64
99
- lemma set.infinite_iff_frequently_cofinite {s : set α} :
65
+ lemma _root_. set.infinite_iff_frequently_cofinite {s : set α} :
100
66
set.infinite s ↔ (∃ᶠ x in cofinite, x ∈ s) :=
101
67
frequently_cofinite_iff_infinite.symm
102
68
103
- lemma filter. eventually_cofinite_ne (x : α) : ∀ᶠ a in cofinite, a ≠ x :=
69
+ lemma eventually_cofinite_ne (x : α) : ∀ᶠ a in cofinite, a ≠ x :=
104
70
(set.finite_singleton x).eventually_cofinite_nmem
105
71
106
- lemma filter. le_cofinite_iff_compl_singleton_mem {l : filter α} :
72
+ lemma le_cofinite_iff_compl_singleton_mem {l : filter α} :
107
73
l ≤ cofinite ↔ ∀ x, {x}ᶜ ∈ l :=
108
74
begin
109
75
refine ⟨λ h x, h (finite_singleton x).compl_mem_cofinite, λ h s (hs : sᶜ.finite), _⟩,
110
76
rw [← compl_compl s, ← bUnion_of_singleton sᶜ, compl_Union₂,filter.bInter_mem hs],
111
77
exact λ x _, h x
112
78
end
113
79
114
- /-- If `α` is a sup-semilattice with no maximal element, then `at_top ≤ cofinite`. -/
115
- lemma at_top_le_cofinite [semilattice_sup α] [no_max_order α] : (at_top : filter α) ≤ cofinite :=
80
+ lemma le_cofinite_iff_eventually_ne {l : filter α} :
81
+ l ≤ cofinite ↔ ∀ x, ∀ᶠ y in l, y ≠ x :=
82
+ le_cofinite_iff_compl_singleton_mem
83
+
84
+ /-- If `α` is a preorder with no maximal element, then `at_top ≤ cofinite`. -/
85
+ lemma at_top_le_cofinite [preorder α] [no_max_order α] : (at_top : filter α) ≤ cofinite :=
86
+ le_cofinite_iff_eventually_ne.mpr eventually_ne_at_top
87
+
88
+ lemma comap_cofinite_le (f : α → β) : comap f cofinite ≤ cofinite :=
89
+ le_cofinite_iff_eventually_ne.mpr $ λ x,
90
+ mem_comap.2 ⟨{f x}ᶜ, (finite_singleton _).compl_mem_cofinite, λ y, ne_of_apply_ne f⟩
91
+
92
+ /-- The coproduct of the cofinite filters on two types is the cofinite filter on their product. -/
93
+ lemma coprod_cofinite : (cofinite : filter α).coprod (cofinite : filter β) = cofinite :=
94
+ begin
95
+ refine le_antisymm (sup_le (comap_cofinite_le _) (comap_cofinite_le _)) (λ S, _),
96
+ simp only [mem_coprod_iff, exists_prop, mem_comap, mem_cofinite],
97
+ rintro ⟨⟨A, hAf, hAS⟩, B, hBf, hBS⟩,
98
+ rw [← compl_subset_compl, ← preimage_compl] at hAS hBS,
99
+ exact (hAf.prod hBf).subset (subset_inter hAS hBS)
100
+ end
101
+
102
+ /-- Finite product of finite sets is finite -/
103
+ lemma Coprod_cofinite {α : ι → Type *} [fintype ι] :
104
+ filter.Coprod (λ i, (cofinite : filter (α i))) = cofinite :=
116
105
begin
117
- refine compl_surjective.forall.2 (λ s hs, _),
118
- rcases eq_empty_or_nonempty s with rfl|hne, { simp only [compl_empty, univ_mem] },
119
- rw [mem_cofinite, compl_compl] at hs, lift s to finset α using hs,
120
- rcases exists_gt (s.sup' hne id) with ⟨y, hy⟩,
121
- filter_upwards [mem_at_top y] with x hx hxs,
122
- exact (finset.le_sup' id hxs).not_lt (hy.trans_le hx)
106
+ refine le_antisymm (supr_le $ λ i, comap_cofinite_le _) (compl_surjective.forall.2 $ λ S, _),
107
+ simp_rw [compl_mem_Coprod_iff, mem_cofinite, compl_compl],
108
+ rintro ⟨t, htf, hsub⟩,
109
+ exact (finite.pi htf).subset hsub
123
110
end
124
111
112
+ end filter
113
+
114
+ open filter
115
+
125
116
/-- For natural numbers the filters `cofinite` and `at_top` coincide. -/
126
117
lemma nat.cofinite_eq_at_top : @cofinite ℕ = at_top :=
127
118
begin
132
123
133
124
lemma nat.frequently_at_top_iff_infinite {p : ℕ → Prop } :
134
125
(∃ᶠ n in at_top, p n) ↔ set.infinite {n | p n} :=
135
- by simp only [← nat.cofinite_eq_at_top, frequently_cofinite_iff_infinite]
126
+ by rw [← nat.cofinite_eq_at_top, frequently_cofinite_iff_infinite]
136
127
137
128
lemma filter.tendsto.exists_within_forall_le {α β : Type *} [linear_order β] {s : set α}
138
129
(hs : s.nonempty)
@@ -153,27 +144,33 @@ begin
153
144
exact ⟨a₀, ha₀s, λ a ha, not_all_top a ha (f a₀)⟩ }
154
145
end
155
146
156
- lemma filter.tendsto.exists_forall_le {α β : Type *} [nonempty α] [linear_order β]
157
- {f : α → β} (hf : tendsto f cofinite at_top) :
147
+ lemma filter.tendsto.exists_forall_le [nonempty α] [linear_order β] {f : α → β}
148
+ (hf : tendsto f cofinite at_top) :
158
149
∃ a₀, ∀ a, f a₀ ≤ f a :=
159
150
let ⟨a₀, _, ha₀⟩ := hf.exists_within_forall_le univ_nonempty in ⟨a₀, λ a, ha₀ a (mem_univ _)⟩
160
151
161
- lemma filter.tendsto.exists_within_forall_ge {α β : Type *} [linear_order β] {s : set α}
162
- (hs : s.nonempty)
152
+ lemma filter.tendsto.exists_within_forall_ge [linear_order β] {s : set α} (hs : s.nonempty)
163
153
{f : α → β} (hf : filter.tendsto f filter.cofinite filter.at_bot) :
164
154
∃ a₀ ∈ s, ∀ a ∈ s, f a ≤ f a₀ :=
165
155
@filter.tendsto.exists_within_forall_le _ (order_dual β) _ _ hs _ hf
166
156
167
- lemma filter.tendsto.exists_forall_ge {α β : Type *} [nonempty α] [linear_order β]
168
- {f : α → β} (hf : tendsto f cofinite at_bot) :
157
+ lemma filter.tendsto.exists_forall_ge [nonempty α] [linear_order β] {f : α → β}
158
+ (hf : tendsto f cofinite at_bot) :
169
159
∃ a₀, ∀ a, f a ≤ f a₀ :=
170
160
@filter.tendsto.exists_forall_le _ (order_dual β) _ _ _ hf
171
161
172
- /-- For an injective function `f`, inverse images of finite sets are finite. -/
173
- lemma function.injective.tendsto_cofinite {α β : Type *} {f : α → β} (hf : injective f) :
162
+ /-- For an injective function `f`, inverse images of finite sets are finite. See also
163
+ `filter.comap_cofinite_le` and `function.injective.comap_cofinite_eq`. -/
164
+ lemma function.injective.tendsto_cofinite {f : α → β} (hf : injective f) :
174
165
tendsto f cofinite cofinite :=
175
166
λ s h, h.preimage (hf.inj_on _)
176
167
168
+ /-- The pullback of the `filter.cofinite` under an injective function is equal to `filter.cofinite`.
169
+ See also `filter.comap_cofinite_le` and `function.injective.tendsto_cofinite`. -/
170
+ lemma function.injective.comap_cofinite_eq {f : α → β} (hf : injective f) :
171
+ comap f cofinite = cofinite :=
172
+ (comap_cofinite_le f).antisymm hf.tendsto_cofinite.le_comap
173
+
177
174
/-- An injective sequence `f : ℕ → ℕ` tends to infinity at infinity. -/
178
175
lemma function.injective.nat_tendsto_at_top {f : ℕ → ℕ} (hf : injective f) :
179
176
tendsto f at_top at_top :=
0 commit comments