Skip to content

Commit d698adf

Browse files
committed
feat(Order/Filter/AtTopBot/Finset): relate atTop on Finset with Finset.card (#39560)
1 parent afd4bc9 commit d698adf

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

Mathlib/Order/Filter/AtTopBot/Finset.lean

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Johannes Hölzl, Jeremy Avigad, Yury Kudryashov, Patrick Massot
66
module
77

88
public import Mathlib.Data.Finset.Order
9+
public import Mathlib.Data.Fintype.EquivFin
910
public import Mathlib.Order.Filter.AtTopBot.Basic
1011
public import Mathlib.Order.Filter.Finite
1112
public import Mathlib.Order.Interval.Finset.Defs
@@ -89,4 +90,56 @@ theorem tendsto_finset_Ici_atBot_atTop [Preorder α] [LocallyFiniteOrderTop α]
8990
Tendsto (Finset.Ici (α := α)) atBot atTop :=
9091
tendsto_finset_Iic_atTop_atTop (α := αᵒᵈ)
9192

93+
section Card
94+
95+
/-- Every finset is eventually a subset of `s` along `atTop`. -/
96+
lemma eventually_finset_atTop_subset (i : Finset α) : ∀ᶠ s : Finset α in atTop, i ⊆ s :=
97+
eventually_ge_atTop _
98+
99+
/-- Every element of `α` is eventually a member of `s` along `atTop` on `Finset α`. -/
100+
lemma eventually_finset_mem_atTop (i : α) : ∀ᶠ s : Finset α in atTop, i ∈ s := by
101+
simpa using eventually_finset_atTop_subset {i}
102+
103+
/-- The pushforward of `atTop` on `Finset α` along `Finset.card` is `atTop` on `ℕ`, when `α` is
104+
infinite. -/
105+
lemma map_card_atTop [Infinite α] :
106+
map (Finset.card (α := α)) atTop = atTop := by
107+
rw [map_atTop_eq, atTop]
108+
refine Function.Surjective.iInf_congr Finset.card Finset.exists_card_eq fun s ↦ congr(𝓟 $(?_))
109+
ext
110+
refine ⟨Infinite.exists_superset_card_eq _ _, ?_⟩
111+
aesop (add safe apply Finset.card_le_card)
112+
113+
/-- The pushforward of `atTop` on `Finset α` along `Finset.card` is `pure (Fintype.card α)`, when
114+
`α` is finite. -/
115+
lemma map_card_atTop_of_fintype [Fintype α] :
116+
map (Finset.card : Finset α → ℕ) atTop = pure (Fintype.card α) := by
117+
simp [OrderTop.atTop_eq]
118+
119+
/-- `Finset.card` tends to `atTop` along `atTop` on `Finset α`, when `α` is infinite. -/
120+
lemma tendsto_card_atTop_atTop [Infinite α] :
121+
Tendsto (Finset.card (α := α)) atTop atTop := by
122+
rw [Tendsto, map_card_atTop]
123+
124+
/-- `Finset.card` tends to `pure (Fintype.card α)`, when `α` is finite. -/
125+
lemma tendsto_card_atTop_pure_of_fintype [Fintype α] :
126+
Tendsto (Finset.card : Finset α → ℕ) atTop (pure (Fintype.card α)) := by
127+
rw [Tendsto, map_card_atTop_of_fintype]
128+
129+
/-- `Tendsto` along `atTop` for a function precomposed with `Finset.card` reduces to `Tendsto` along
130+
`atTop` on `ℕ`, when `α` is infinite. -/
131+
lemma tendsto_comp_card_atTop_iff [Infinite α] {f : ℕ → β} {l : Filter β} :
132+
Tendsto (fun s : Finset α ↦ f s.card) atTop l ↔ Tendsto f atTop l := by
133+
rw [← map_card_atTop (α := α), tendsto_map'_iff]
134+
rfl
135+
136+
/-- `Tendsto` along `atTop` for a function precomposed with `Finset.card` reduces to `Tendsto` along
137+
`pure (Fintype.card α)`, when `α` is finite. -/
138+
lemma tendsto_comp_card_atTop_iff_of_fintype [Fintype α] {f : ℕ → β} {l : Filter β} :
139+
Tendsto (fun s : Finset α ↦ f s.card) atTop l ↔ Tendsto f (pure (Fintype.card α)) l := by
140+
rw [← map_card_atTop_of_fintype, tendsto_map'_iff]
141+
rfl
142+
143+
end Card
144+
92145
end Filter

0 commit comments

Comments
 (0)