Skip to content

Commit 10214d2

Browse files
committed
feat(Order/Filter/AtTopBot/Tendsto): use to_dual (#36823)
This PR uses `to_dual` on some theorems about `atTop` and `atBot`
1 parent 57c0c3e commit 10214d2

File tree

2 files changed

+32
-90
lines changed

2 files changed

+32
-90
lines changed

Mathlib/Order/Filter/AtTopBot/Tendsto.lean

Lines changed: 31 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ open Set
2525

2626
namespace Filter
2727

28+
@[to_dual]
2829
theorem not_tendsto_const_atTop [Preorder α] [NoTopOrder α] (x : α) (l : Filter β) [l.NeBot] :
2930
¬Tendsto (fun _ => x) l atTop :=
3031
tendsto_const_pure.not_tendsto (disjoint_pure_atTop x)
3132

32-
theorem not_tendsto_const_atBot [Preorder α] [NoBotOrder α] (x : α) (l : Filter β) [l.NeBot] :
33-
¬Tendsto (fun _ => x) l atBot :=
34-
tendsto_const_pure.not_tendsto (disjoint_pure_atBot x)
35-
33+
@[to_dual eventually_lt_atBot]
3634
protected theorem Tendsto.eventually_gt_atTop [Preorder β] [NoTopOrder β] {f : α → β} {l : Filter α}
3735
(hf : Tendsto f l atTop) (c : β) : ∀ᶠ x in l, c < f x :=
3836
hf.eventually (eventually_gt_atTop c)
3937

38+
@[to_dual eventually_le_atBot]
4039
protected theorem Tendsto.eventually_ge_atTop [Preorder β] {f : α → β} {l : Filter α}
4140
(hf : Tendsto f l atTop) (c : β) : ∀ᶠ x in l, c ≤ f x :=
4241
hf.eventually (eventually_ge_atTop c)
4342

43+
@[to_dual]
4444
protected theorem Tendsto.eventually_ne_atTop [Preorder β] [NoTopOrder β] {f : α → β} {l : Filter α}
4545
(hf : Tendsto f l atTop) (c : β) : ∀ᶠ x in l, f x ≠ c :=
4646
hf.eventually (eventually_ne_atTop c)
@@ -49,56 +49,30 @@ protected theorem Tendsto.eventually_ne_atTop' [Preorder β] [NoTopOrder β] {f
4949
{l : Filter α} (hf : Tendsto f l atTop) (c : α) : ∀ᶠ x in l, x ≠ c :=
5050
(hf.eventually_ne_atTop (f c)).mono fun _ => ne_of_apply_ne f
5151

52-
protected theorem Tendsto.eventually_lt_atBot [Preorder β] [NoBotOrder β] {f : α → β} {l : Filter α}
53-
(hf : Tendsto f l atBot) (c : β) : ∀ᶠ x in l, f x < c :=
54-
hf.eventually (eventually_lt_atBot c)
55-
56-
protected theorem Tendsto.eventually_le_atBot [Preorder β] {f : α → β} {l : Filter α}
57-
(hf : Tendsto f l atBot) (c : β) : ∀ᶠ x in l, f x ≤ c :=
58-
hf.eventually (eventually_le_atBot c)
59-
60-
protected theorem Tendsto.eventually_ne_atBot [Preorder β] [NoBotOrder β] {f : α → β} {l : Filter α}
61-
(hf : Tendsto f l atBot) (c : β) : ∀ᶠ x in l, f x ≠ c :=
62-
hf.eventually (eventually_ne_atBot c)
63-
52+
@[to_dual OrderBot.atBot_eq]
6453
theorem OrderTop.atTop_eq (α) [PartialOrder α] [OrderTop α] : (atTop : Filter α) = pure ⊤ := by
6554
rw [isTop_top.atTop_eq, Ici_top, principal_singleton]
6655

67-
theorem OrderBot.atBot_eq (α) [PartialOrder α] [OrderBot α] : (atBot : Filter α) = pure ⊥ :=
68-
@OrderTop.atTop_eq αᵒᵈ _ _
69-
56+
@[to_dual]
7057
theorem tendsto_atTop_pure [PartialOrder α] [OrderTop α] (f : α → β) :
7158
Tendsto f atTop (pure <| f ⊤) :=
7259
(OrderTop.atTop_eq α).symm ▸ tendsto_pure_pure _ _
7360

74-
theorem tendsto_atBot_pure [PartialOrder α] [OrderBot α] (f : α → β) :
75-
Tendsto f atBot (pure <| f ⊥) :=
76-
@tendsto_atTop_pure αᵒᵈ _ _ _ _
77-
61+
@[to_dual]
7862
theorem tendsto_atTop [Preorder β] {m : α → β} {f : Filter α} :
7963
Tendsto m f atTop ↔ ∀ b, ∀ᶠ a in f, b ≤ m a := by
8064
simp only [atTop, tendsto_iInf, tendsto_principal, mem_Ici]
8165

82-
theorem tendsto_atBot [Preorder β] {m : α → β} {f : Filter α} :
83-
Tendsto m f atBot ↔ ∀ b, ∀ᶠ a in f, m a ≤ b :=
84-
@tendsto_atTop α βᵒᵈ _ m f
85-
66+
@[to_dual]
8667
theorem tendsto_atTop_mono' [Preorder β] (l : Filter α) ⦃f₁ f₂ : α → β⦄ (h : f₁ ≤ᶠ[l] f₂)
8768
(h₁ : Tendsto f₁ l atTop) : Tendsto f₂ l atTop :=
8869
tendsto_atTop.2 fun b => by filter_upwards [tendsto_atTop.1 h₁ b, h] with x using le_trans
8970

90-
theorem tendsto_atBot_mono' [Preorder β] (l : Filter α) ⦃f₁ f₂ : α → β⦄ (h : f₁ ≤ᶠ[l] f₂) :
91-
Tendsto f₂ l atBot → Tendsto f₁ l atBot :=
92-
@tendsto_atTop_mono' _ βᵒᵈ _ _ _ _ h
93-
71+
@[to_dual]
9472
theorem tendsto_atTop_mono [Preorder β] {l : Filter α} {f g : α → β} (h : ∀ n, f n ≤ g n) :
9573
Tendsto f l atTop → Tendsto g l atTop :=
9674
tendsto_atTop_mono' l <| Eventually.of_forall h
9775

98-
theorem tendsto_atBot_mono [Preorder β] {l : Filter α} {f g : α → β} (h : ∀ n, f n ≤ g n) :
99-
Tendsto g l atBot → Tendsto f l atBot :=
100-
@tendsto_atTop_mono _ βᵒᵈ _ _ _ _ h
101-
10276
end Filter
10377

10478
namespace Filter
@@ -118,6 +92,10 @@ This lemma together with `exists_seq_monotone_tendsto_atTop_atTop` below
11892
is useful to reduce a statement
11993
about a monotone family indexed by a type with countably generated `atTop` (e.g., `ℝ`)
12094
to the case of a family indexed by natural numbers. -/
95+
@[to_dual
96+
/-- If `f` is a monotone function and `g` tends to `atBot` along a nontrivial filter.
97+
then the lower bounds of the range of `f ∘ g`
98+
are the same as the lower bounds of the range of `f`. -/]
12199
theorem _root_.Monotone.upperBounds_range_comp_tendsto_atTop [Preorder β] [Preorder γ]
122100
{l : Filter α} [l.NeBot] {f : β → γ} (hf : Monotone f) {g : α → β} (hg : Tendsto g l atTop) :
123101
upperBounds (range (f ∘ g)) = upperBounds (range f) := by
@@ -126,112 +104,75 @@ theorem _root_.Monotone.upperBounds_range_comp_tendsto_atTop [Preorder β] [Preo
126104
obtain ⟨a, ha⟩ : ∃ a, b ≤ g a := (hg.eventually_ge_atTop b).exists
127105
exact (hf ha).trans <| hc <| mem_range_self _
128106

129-
/-- If `f` is a monotone function and `g` tends to `atBot` along a nontrivial filter.
130-
then the lower bounds of the range of `f ∘ g`
131-
are the same as the lower bounds of the range of `f`. -/
132-
theorem _root_.Monotone.lowerBounds_range_comp_tendsto_atBot [Preorder β] [Preorder γ]
133-
{l : Filter α} [l.NeBot] {f : β → γ} (hf : Monotone f) {g : α → β} (hg : Tendsto g l atBot) :
134-
lowerBounds (range (f ∘ g)) = lowerBounds (range f) :=
135-
hf.dual.upperBounds_range_comp_tendsto_atTop hg
136-
137107
/-- If `f` is an antitone function and `g` tends to `atTop` along a nontrivial filter.
138108
then the upper bounds of the range of `f ∘ g`
139109
are the same as the upper bounds of the range of `f`. -/
110+
@[to_dual
111+
/-- If `f` is an antitone function and `g` tends to `atBot` along a nontrivial filter.
112+
then the upper bounds of the range of `f ∘ g`
113+
are the same as the upper bounds of the range of `f`. -/]
140114
theorem _root_.Antitone.lowerBounds_range_comp_tendsto_atTop [Preorder β] [Preorder γ]
141115
{l : Filter α} [l.NeBot] {f : β → γ} (hf : Antitone f) {g : α → β} (hg : Tendsto g l atTop) :
142116
lowerBounds (range (f ∘ g)) = lowerBounds (range f) :=
143117
hf.dual_left.lowerBounds_range_comp_tendsto_atBot hg
144118

145-
/-- If `f` is an antitone function and `g` tends to `atBot` along a nontrivial filter.
146-
then the upper bounds of the range of `f ∘ g`
147-
are the same as the upper bounds of the range of `f`. -/
148-
theorem _root_.Antitone.upperBounds_range_comp_tendsto_atBot [Preorder β] [Preorder γ]
149-
{l : Filter α} [l.NeBot] {f : β → γ} (hf : Antitone f) {g : α → β} (hg : Tendsto g l atBot) :
150-
upperBounds (range (f ∘ g)) = upperBounds (range f) :=
151-
hf.dual.lowerBounds_range_comp_tendsto_atTop hg
152-
119+
@[to_dual]
153120
theorem tendsto_atTop_atTop_of_monotone [Preorder α] [Preorder β] {f : α → β} (hf : Monotone f)
154121
(h : ∀ b, ∃ a, b ≤ f a) : Tendsto f atTop atTop :=
155122
tendsto_iInf.2 fun b =>
156123
tendsto_principal.2 <|
157124
let ⟨a, ha⟩ := h b
158125
mem_of_superset (mem_atTop a) fun _a' ha' => le_trans ha (hf ha')
159126

127+
@[to_dual]
160128
theorem tendsto_atTop_atBot_of_antitone [Preorder α] [Preorder β] {f : α → β} (hf : Antitone f)
161129
(h : ∀ b, ∃ a, f a ≤ b) : Tendsto f atTop atBot :=
162130
@tendsto_atTop_atTop_of_monotone _ βᵒᵈ _ _ _ hf h
163131

164-
theorem tendsto_atBot_atBot_of_monotone [Preorder α] [Preorder β] {f : α → β} (hf : Monotone f)
165-
(h : ∀ b, ∃ a, f a ≤ b) : Tendsto f atBot atBot :=
166-
tendsto_iInf.2 fun b => tendsto_principal.2 <|
167-
let ⟨a, ha⟩ := h b; mem_of_superset (mem_atBot a) fun _a' ha' => le_trans (hf ha') ha
168-
169-
theorem tendsto_atBot_atTop_of_antitone [Preorder α] [Preorder β] {f : α → β} (hf : Antitone f)
170-
(h : ∀ b, ∃ a, b ≤ f a) : Tendsto f atBot atTop :=
171-
@tendsto_atBot_atBot_of_monotone _ βᵒᵈ _ _ _ hf h
172-
132+
@[to_dual]
173133
alias _root_.Monotone.tendsto_atTop_atTop := tendsto_atTop_atTop_of_monotone
174134

175-
alias _root_.Monotone.tendsto_atBot_atBot := tendsto_atBot_atBot_of_monotone
176-
135+
@[to_dual]
177136
theorem comap_embedding_atTop [Preorder β] [Preorder γ] {e : β → γ}
178137
(hm : ∀ b₁ b₂, e b₁ ≤ e b₂ ↔ b₁ ≤ b₂) (hu : ∀ c, ∃ b, c ≤ e b) : comap e atTop = atTop :=
179138
le_antisymm
180139
(le_iInf fun b =>
181140
le_principal_iff.2 <| mem_comap.2 ⟨Ici (e b), mem_atTop _, fun _ => (hm _ _).1⟩)
182141
(tendsto_atTop_atTop_of_monotone (fun _ _ => (hm _ _).2) hu).le_comap
183142

184-
theorem comap_embedding_atBot [Preorder β] [Preorder γ] {e : β → γ}
185-
(hm : ∀ b₁ b₂, e b₁ ≤ e b₂ ↔ b₁ ≤ b₂) (hu : ∀ c, ∃ b, e b ≤ c) : comap e atBot = atBot :=
186-
@comap_embedding_atTop βᵒᵈ γᵒᵈ _ _ e (Function.swap hm) hu
187-
143+
/-- A function `f` goes to `∞` independent of an order-preserving embedding `e`. -/
144+
@[to_dual (reorder := hm (b₁ b₂))
145+
/-- A function `f` goes to `-∞` independent of an order-preserving embedding `e`. -/]
188146
theorem tendsto_atTop_embedding [Preorder β] [Preorder γ] {f : α → β} {e : β → γ} {l : Filter α}
189147
(hm : ∀ b₁ b₂, e b₁ ≤ e b₂ ↔ b₁ ≤ b₂) (hu : ∀ c, ∃ b, c ≤ e b) :
190148
Tendsto (e ∘ f) l atTop ↔ Tendsto f l atTop := by
191149
rw [← comap_embedding_atTop hm hu, tendsto_comap_iff]
192150

193-
/-- A function `f` goes to `-∞` independent of an order-preserving embedding `e`. -/
194-
theorem tendsto_atBot_embedding [Preorder β] [Preorder γ] {f : α → β} {e : β → γ} {l : Filter α}
195-
(hm : ∀ b₁ b₂, e b₁ ≤ e b₂ ↔ b₁ ≤ b₂) (hu : ∀ c, ∃ b, e b ≤ c) :
196-
Tendsto (e ∘ f) l atBot ↔ Tendsto f l atBot :=
197-
@tendsto_atTop_embedding α βᵒᵈ γᵒᵈ _ _ f e l (Function.swap hm) hu
198-
199151
/-- If `u` is a monotone function with linear ordered codomain and the range of `u` is not bounded
200152
above, then `Tendsto u atTop atTop`. -/
153+
@[to_dual
154+
/-- If `u` is a monotone function with linear ordered codomain and the range of `u` is not bounded
155+
below, then `Tendsto u atBot atBot`. -/]
201156
theorem tendsto_atTop_atTop_of_monotone' [Preorder ι] [LinearOrder α] {u : ι → α} (h : Monotone u)
202157
(H : ¬BddAbove (range u)) : Tendsto u atTop atTop := by
203158
apply h.tendsto_atTop_atTop
204159
intro b
205160
rcases not_bddAbove_iff.1 H b with ⟨_, ⟨N, rfl⟩, hN⟩
206161
exact ⟨N, le_of_lt hN⟩
207162

208-
/-- If `u` is a monotone function with linear ordered codomain and the range of `u` is not bounded
209-
below, then `Tendsto u atBot atBot`. -/
210-
theorem tendsto_atBot_atBot_of_monotone' [Preorder ι] [LinearOrder α] {u : ι → α} (h : Monotone u)
211-
(H : ¬BddBelow (range u)) : Tendsto u atBot atBot :=
212-
@tendsto_atTop_atTop_of_monotone' ιᵒᵈ αᵒᵈ _ _ _ h.dual H
213-
214163
/-- If a monotone function `u : ι → α` tends to `atTop` along *some* non-trivial filter `l`, then
215164
it tends to `atTop` along `atTop`. -/
165+
@[to_dual
166+
/-- If a monotone function `u : ι → α` tends to `atBot` along *some* non-trivial filter `l`, then
167+
it tends to `atBot` along `atBot`. -/]
216168
theorem tendsto_atTop_of_monotone_of_filter [Preorder ι] [Preorder α] {l : Filter ι} {u : ι → α}
217169
(h : Monotone u) [NeBot l] (hu : Tendsto u l atTop) : Tendsto u atTop atTop :=
218170
h.tendsto_atTop_atTop fun b => (hu.eventually (mem_atTop b)).exists
219171

220-
set_option backward.isDefEq.respectTransparency false in
221-
/-- If a monotone function `u : ι → α` tends to `atBot` along *some* non-trivial filter `l`, then
222-
it tends to `atBot` along `atBot`. -/
223-
theorem tendsto_atBot_of_monotone_of_filter [Preorder ι] [Preorder α] {l : Filter ι} {u : ι → α}
224-
(h : Monotone u) [NeBot l] (hu : Tendsto u l atBot) : Tendsto u atBot atBot :=
225-
@tendsto_atTop_of_monotone_of_filter ιᵒᵈ αᵒᵈ _ _ _ _ h.dual _ hu
226-
172+
@[to_dual]
227173
theorem tendsto_atTop_of_monotone_of_subseq [Preorder ι] [Preorder α] {u : ι → α} {φ : ι' → ι}
228174
(h : Monotone u) {l : Filter ι'} [NeBot l] (H : Tendsto (u ∘ φ) l atTop) :
229175
Tendsto u atTop atTop :=
230176
tendsto_atTop_of_monotone_of_filter h (tendsto_map' H)
231177

232-
theorem tendsto_atBot_of_monotone_of_subseq [Preorder ι] [Preorder α] {u : ι → α} {φ : ι' → ι}
233-
(h : Monotone u) {l : Filter ι'} [NeBot l] (H : Tendsto (u ∘ φ) l atBot) :
234-
Tendsto u atBot atBot :=
235-
tendsto_atBot_of_monotone_of_filter h (tendsto_map' H)
236-
237178
end Filter

Mathlib/Order/Filter/Defs.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def EventuallyEq (l : Filter α) (f g : α → β) : Prop :=
301301
notation:50 f " =ᶠ[" l:50 "] " g:50 => EventuallyEq l f g
302302

303303
/-- A function `f` is eventually less than or equal to a function `g` at a filter `l`. -/
304+
@[to_dual self (reorder := f g)]
304305
def EventuallyLE [LE β] (l : Filter α) (f g : α → β) : Prop :=
305306
∀ᶠ x in l, f x ≤ g x
306307

0 commit comments

Comments
 (0)