-
Notifications
You must be signed in to change notification settings - Fork 341
/
LiminfLimsup.lean
593 lines (496 loc) · 29.9 KB
/
LiminfLimsup.lean
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
/-
Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Mario Carneiro, Yury Kudryashov, Yaël Dillies
-/
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Order.Group.Indicator
import Mathlib.Order.LiminfLimsup
import Mathlib.Order.Filter.Archimedean
import Mathlib.Order.Filter.CountableInter
import Mathlib.Topology.Algebra.Group.Basic
import Mathlib.Data.Set.Lattice
import Mathlib.Topology.Order.Monotone
/-!
# Lemmas about liminf and limsup in an order topology.
## Main declarations
* `BoundedLENhdsClass`: Typeclass stating that neighborhoods are eventually bounded above.
* `BoundedGENhdsClass`: Typeclass stating that neighborhoods are eventually bounded below.
## Implementation notes
The same lemmas are true in `ℝ`, `ℝ × ℝ`, `ι → ℝ`, `EuclideanSpace ι ℝ`. To avoid code
duplication, we provide an ad hoc axiomatisation of the properties we need.
-/
open Filter TopologicalSpace
open scoped Topology Classical
universe u v
variable {ι α β R S : Type*} {π : ι → Type*}
/-- Ad hoc typeclass stating that neighborhoods are eventually bounded above. -/
class BoundedLENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where
isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·)
/-- Ad hoc typeclass stating that neighborhoods are eventually bounded below. -/
class BoundedGENhdsClass (α : Type*) [Preorder α] [TopologicalSpace α] : Prop where
isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·)
section Preorder
variable [Preorder α] [Preorder β] [TopologicalSpace α] [TopologicalSpace β]
section BoundedLENhdsClass
variable [BoundedLENhdsClass α] [BoundedLENhdsClass β] {f : Filter ι} {u : ι → α} {a : α}
theorem isBounded_le_nhds (a : α) : (𝓝 a).IsBounded (· ≤ ·) :=
BoundedLENhdsClass.isBounded_le_nhds _
theorem Filter.Tendsto.isBoundedUnder_le (h : Tendsto u f (𝓝 a)) : f.IsBoundedUnder (· ≤ ·) u :=
(isBounded_le_nhds a).mono h
theorem Filter.Tendsto.bddAbove_range_of_cofinite [IsDirected α (· ≤ ·)]
(h : Tendsto u cofinite (𝓝 a)) : BddAbove (Set.range u) :=
h.isBoundedUnder_le.bddAbove_range_of_cofinite
theorem Filter.Tendsto.bddAbove_range [IsDirected α (· ≤ ·)] {u : ℕ → α}
(h : Tendsto u atTop (𝓝 a)) : BddAbove (Set.range u) :=
h.isBoundedUnder_le.bddAbove_range
theorem isCobounded_ge_nhds (a : α) : (𝓝 a).IsCobounded (· ≥ ·) :=
(isBounded_le_nhds a).isCobounded_flip
theorem Filter.Tendsto.isCoboundedUnder_ge [NeBot f] (h : Tendsto u f (𝓝 a)) :
f.IsCoboundedUnder (· ≥ ·) u :=
h.isBoundedUnder_le.isCobounded_flip
instance : BoundedGENhdsClass αᵒᵈ := ⟨@isBounded_le_nhds α _ _ _⟩
instance Prod.instBoundedLENhdsClass : BoundedLENhdsClass (α × β) := by
refine ⟨fun x ↦ ?_⟩
obtain ⟨a, ha⟩ := isBounded_le_nhds x.1
obtain ⟨b, hb⟩ := isBounded_le_nhds x.2
rw [← @Prod.mk.eta _ _ x, nhds_prod_eq]
exact ⟨(a, b), ha.prod_mk hb⟩
instance Pi.instBoundedLENhdsClass [Finite ι] [∀ i, Preorder (π i)] [∀ i, TopologicalSpace (π i)]
[∀ i, BoundedLENhdsClass (π i)] : BoundedLENhdsClass (∀ i, π i) := by
refine ⟨fun x ↦ ?_⟩
rw [nhds_pi]
choose f hf using fun i ↦ isBounded_le_nhds (x i)
exact ⟨f, eventually_pi hf⟩
end BoundedLENhdsClass
section BoundedGENhdsClass
variable [BoundedGENhdsClass α] [BoundedGENhdsClass β] {f : Filter ι} {u : ι → α} {a : α}
theorem isBounded_ge_nhds (a : α) : (𝓝 a).IsBounded (· ≥ ·) :=
BoundedGENhdsClass.isBounded_ge_nhds _
theorem Filter.Tendsto.isBoundedUnder_ge (h : Tendsto u f (𝓝 a)) : f.IsBoundedUnder (· ≥ ·) u :=
(isBounded_ge_nhds a).mono h
theorem Filter.Tendsto.bddBelow_range_of_cofinite [IsDirected α (· ≥ ·)]
(h : Tendsto u cofinite (𝓝 a)) : BddBelow (Set.range u) :=
h.isBoundedUnder_ge.bddBelow_range_of_cofinite
theorem Filter.Tendsto.bddBelow_range [IsDirected α (· ≥ ·)] {u : ℕ → α}
(h : Tendsto u atTop (𝓝 a)) : BddBelow (Set.range u) :=
h.isBoundedUnder_ge.bddBelow_range
theorem isCobounded_le_nhds (a : α) : (𝓝 a).IsCobounded (· ≤ ·) :=
(isBounded_ge_nhds a).isCobounded_flip
theorem Filter.Tendsto.isCoboundedUnder_le [NeBot f] (h : Tendsto u f (𝓝 a)) :
f.IsCoboundedUnder (· ≤ ·) u :=
h.isBoundedUnder_ge.isCobounded_flip
instance : BoundedLENhdsClass αᵒᵈ := ⟨@isBounded_ge_nhds α _ _ _⟩
instance Prod.instBoundedGENhdsClass : BoundedGENhdsClass (α × β) :=
⟨(Prod.instBoundedLENhdsClass (α := αᵒᵈ) (β := βᵒᵈ)).isBounded_le_nhds⟩
instance Pi.instBoundedGENhdsClass [Finite ι] [∀ i, Preorder (π i)] [∀ i, TopologicalSpace (π i)]
[∀ i, BoundedGENhdsClass (π i)] : BoundedGENhdsClass (∀ i, π i) :=
⟨(Pi.instBoundedLENhdsClass (π := fun i ↦ (π i)ᵒᵈ)).isBounded_le_nhds⟩
end BoundedGENhdsClass
-- See note [lower instance priority]
instance (priority := 100) OrderTop.to_BoundedLENhdsClass [OrderTop α] : BoundedLENhdsClass α :=
⟨fun _a ↦ isBounded_le_of_top⟩
-- See note [lower instance priority]
instance (priority := 100) OrderBot.to_BoundedGENhdsClass [OrderBot α] : BoundedGENhdsClass α :=
⟨fun _a ↦ isBounded_ge_of_bot⟩
-- See note [lower instance priority]
instance (priority := 100) OrderTopology.to_BoundedLENhdsClass [IsDirected α (· ≤ ·)]
[OrderTopology α] : BoundedLENhdsClass α :=
⟨fun a ↦
((isTop_or_exists_gt a).elim fun h ↦ ⟨a, eventually_of_forall h⟩) <|
Exists.imp fun _b ↦ ge_mem_nhds⟩
-- See note [lower instance priority]
instance (priority := 100) OrderTopology.to_BoundedGENhdsClass [IsDirected α (· ≥ ·)]
[OrderTopology α] : BoundedGENhdsClass α :=
⟨fun a ↦ ((isBot_or_exists_lt a).elim fun h ↦ ⟨a, eventually_of_forall h⟩) <|
Exists.imp fun _b ↦ le_mem_nhds⟩
end Preorder
section LiminfLimsup
section ConditionallyCompleteLinearOrder
variable [ConditionallyCompleteLinearOrder α] [TopologicalSpace α] [OrderTopology α]
/-- If the liminf and the limsup of a filter coincide, then this filter converges to
their common value, at least if the filter is eventually bounded above and below. -/
theorem le_nhds_of_limsSup_eq_limsInf {f : Filter α} {a : α} (hl : f.IsBounded (· ≤ ·))
(hg : f.IsBounded (· ≥ ·)) (hs : f.limsSup = a) (hi : f.limsInf = a) : f ≤ 𝓝 a :=
tendsto_order.2 ⟨fun _ hb ↦ gt_mem_sets_of_limsInf_gt hg <| hi.symm ▸ hb,
fun _ hb ↦ lt_mem_sets_of_limsSup_lt hl <| hs.symm ▸ hb⟩
theorem limsSup_nhds (a : α) : limsSup (𝓝 a) = a :=
csInf_eq_of_forall_ge_of_forall_gt_exists_lt (isBounded_le_nhds a)
(fun a' (h : { n : α | n ≤ a' } ∈ 𝓝 a) ↦ show a ≤ a' from @mem_of_mem_nhds α a _ _ h)
fun b (hba : a < b) ↦
show ∃ c, { n : α | n ≤ c } ∈ 𝓝 a ∧ c < b from
match dense_or_discrete a b with
| Or.inl ⟨c, hac, hcb⟩ => ⟨c, ge_mem_nhds hac, hcb⟩
| Or.inr ⟨_, h⟩ => ⟨a, (𝓝 a).sets_of_superset (gt_mem_nhds hba) h, hba⟩
theorem limsInf_nhds : ∀ a : α, limsInf (𝓝 a) = a :=
limsSup_nhds (α := αᵒᵈ)
/-- If a filter is converging, its limsup coincides with its limit. -/
theorem limsInf_eq_of_le_nhds {f : Filter α} {a : α} [NeBot f] (h : f ≤ 𝓝 a) : f.limsInf = a :=
have hb_ge : IsBounded (· ≥ ·) f := (isBounded_ge_nhds a).mono h
have hb_le : IsBounded (· ≤ ·) f := (isBounded_le_nhds a).mono h
le_antisymm
(calc
f.limsInf ≤ f.limsSup := limsInf_le_limsSup hb_le hb_ge
_ ≤ (𝓝 a).limsSup := limsSup_le_limsSup_of_le h hb_ge.isCobounded_flip (isBounded_le_nhds a)
_ = a := limsSup_nhds a)
(calc
a = (𝓝 a).limsInf := (limsInf_nhds a).symm
_ ≤ f.limsInf := limsInf_le_limsInf_of_le h (isBounded_ge_nhds a) hb_le.isCobounded_flip)
/-- If a filter is converging, its liminf coincides with its limit. -/
theorem limsSup_eq_of_le_nhds : ∀ {f : Filter α} {a : α} [NeBot f], f ≤ 𝓝 a → f.limsSup = a :=
limsInf_eq_of_le_nhds (α := αᵒᵈ)
/-- If a function has a limit, then its limsup coincides with its limit. -/
theorem Filter.Tendsto.limsup_eq {f : Filter β} {u : β → α} {a : α} [NeBot f]
(h : Tendsto u f (𝓝 a)) : limsup u f = a :=
limsSup_eq_of_le_nhds h
/-- If a function has a limit, then its liminf coincides with its limit. -/
theorem Filter.Tendsto.liminf_eq {f : Filter β} {u : β → α} {a : α} [NeBot f]
(h : Tendsto u f (𝓝 a)) : liminf u f = a :=
limsInf_eq_of_le_nhds h
/-- If the liminf and the limsup of a function coincide, then the limit of the function
exists and has the same value. -/
theorem tendsto_of_liminf_eq_limsup {f : Filter β} {u : β → α} {a : α} (hinf : liminf u f = a)
(hsup : limsup u f = a) (h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault)
(h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) : Tendsto u f (𝓝 a) :=
le_nhds_of_limsSup_eq_limsInf h h' hsup hinf
/-- If a number `a` is less than or equal to the `liminf` of a function `f` at some filter
and is greater than or equal to the `limsup` of `f`, then `f` tends to `a` along this filter. -/
theorem tendsto_of_le_liminf_of_limsup_le {f : Filter β} {u : β → α} {a : α} (hinf : a ≤ liminf u f)
(hsup : limsup u f ≤ a) (h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault)
(h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) : Tendsto u f (𝓝 a) :=
if hf : f = ⊥ then hf.symm ▸ tendsto_bot
else
haveI : NeBot f := ⟨hf⟩
tendsto_of_liminf_eq_limsup (le_antisymm (le_trans (liminf_le_limsup h h') hsup) hinf)
(le_antisymm hsup (le_trans hinf (liminf_le_limsup h h'))) h h'
/-- Assume that, for any `a < b`, a sequence can not be infinitely many times below `a` and
above `b`. If it is also ultimately bounded above and below, then it has to converge. This even
works if `a` and `b` are restricted to a dense subset.
-/
theorem tendsto_of_no_upcrossings [DenselyOrdered α] {f : Filter β} {u : β → α} {s : Set α}
(hs : Dense s) (H : ∀ a ∈ s, ∀ b ∈ s, a < b → ¬((∃ᶠ n in f, u n < a) ∧ ∃ᶠ n in f, b < u n))
(h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault)
(h' : f.IsBoundedUnder (· ≥ ·) u := by isBoundedDefault) :
∃ c : α, Tendsto u f (𝓝 c) := by
rcases f.eq_or_neBot with rfl | hbot
· exact ⟨sInf ∅, tendsto_bot⟩
refine ⟨limsup u f, ?_⟩
apply tendsto_of_le_liminf_of_limsup_le _ le_rfl h h'
by_contra! hlt
obtain ⟨a, ⟨⟨la, au⟩, as⟩⟩ : ∃ a, (f.liminf u < a ∧ a < f.limsup u) ∧ a ∈ s :=
dense_iff_inter_open.1 hs (Set.Ioo (f.liminf u) (f.limsup u)) isOpen_Ioo
(Set.nonempty_Ioo.2 hlt)
obtain ⟨b, ⟨⟨ab, bu⟩, bs⟩⟩ : ∃ b, (a < b ∧ b < f.limsup u) ∧ b ∈ s :=
dense_iff_inter_open.1 hs (Set.Ioo a (f.limsup u)) isOpen_Ioo (Set.nonempty_Ioo.2 au)
have A : ∃ᶠ n in f, u n < a := frequently_lt_of_liminf_lt (IsBounded.isCobounded_ge h) la
have B : ∃ᶠ n in f, b < u n := frequently_lt_of_lt_limsup (IsBounded.isCobounded_le h') bu
exact H a as b bs ab ⟨A, B⟩
variable [FirstCountableTopology α] {f : Filter β} [CountableInterFilter f] {u : β → α}
theorem eventually_le_limsup (hf : IsBoundedUnder (· ≤ ·) f u := by isBoundedDefault) :
∀ᶠ b in f, u b ≤ f.limsup u := by
obtain ha | ha := isTop_or_exists_gt (f.limsup u)
· exact eventually_of_forall fun _ => ha _
by_cases H : IsGLB (Set.Ioi (f.limsup u)) (f.limsup u)
· obtain ⟨u, -, -, hua, hu⟩ := H.exists_seq_antitone_tendsto ha
have := fun n => eventually_lt_of_limsup_lt (hu n) hf
exact
(eventually_countable_forall.2 this).mono fun b hb =>
ge_of_tendsto hua <| eventually_of_forall fun n => (hb _).le
· obtain ⟨x, hx, xa⟩ : ∃ x, (∀ ⦃b⦄, f.limsup u < b → x ≤ b) ∧ f.limsup u < x := by
simp only [IsGLB, IsGreatest, lowerBounds, upperBounds, Set.mem_Ioi, Set.mem_setOf_eq,
not_and, not_forall, not_le, exists_prop] at H
exact H fun x => le_of_lt
filter_upwards [eventually_lt_of_limsup_lt xa hf] with y hy
contrapose! hy
exact hx hy
theorem eventually_liminf_le (hf : IsBoundedUnder (· ≥ ·) f u := by isBoundedDefault) :
∀ᶠ b in f, f.liminf u ≤ u b :=
eventually_le_limsup (α := αᵒᵈ) hf
end ConditionallyCompleteLinearOrder
section CompleteLinearOrder
variable [CompleteLinearOrder α] [TopologicalSpace α] [FirstCountableTopology α] [OrderTopology α]
{f : Filter β} [CountableInterFilter f] {u : β → α}
@[simp]
theorem limsup_eq_bot : f.limsup u = ⊥ ↔ u =ᶠ[f] ⊥ :=
⟨fun h =>
(EventuallyLE.trans eventually_le_limsup <| eventually_of_forall fun _ => h.le).mono fun x hx =>
le_antisymm hx bot_le,
fun h => by
rw [limsup_congr h]
exact limsup_const_bot⟩
@[simp]
theorem liminf_eq_top : f.liminf u = ⊤ ↔ u =ᶠ[f] ⊤ :=
limsup_eq_bot (α := αᵒᵈ)
end CompleteLinearOrder
end LiminfLimsup
section Monotone
variable {F : Filter ι} [NeBot F]
[ConditionallyCompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R]
[ConditionallyCompleteLinearOrder S] [TopologicalSpace S] [OrderTopology S]
/-- An antitone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsSup` to the `Filter.liminf` of the image if the function is continuous at the `limsSup`
(and the filter is bounded from above and frequently bounded from below). -/
theorem Antitone.map_limsSup_of_continuousAt {F : Filter R} [NeBot F] {f : R → S}
(f_decr : Antitone f) (f_cont : ContinuousAt f F.limsSup)
(bdd_above : F.IsBounded (· ≤ ·) := by isBoundedDefault)
(cobdd : F.IsCobounded (· ≤ ·) := by isBoundedDefault) :
f F.limsSup = F.liminf f := by
apply le_antisymm
· rw [limsSup, f_decr.map_sInf_of_continuousAt' f_cont bdd_above cobdd]
apply le_of_forall_lt
intro c hc
simp only [liminf, limsInf, eventually_map] at hc ⊢
obtain ⟨d, hd, h'd⟩ :=
exists_lt_of_lt_csSup (bdd_above.recOn fun x hx ↦ ⟨f x, Set.mem_image_of_mem f hx⟩) hc
apply lt_csSup_of_lt ?_ ?_ h'd
· simpa only [BddAbove, upperBounds]
using Antitone.isCoboundedUnder_ge_of_isCobounded f_decr cobdd
· rcases hd with ⟨e, ⟨he, fe_eq_d⟩⟩
filter_upwards [he] with x hx using (fe_eq_d.symm ▸ f_decr hx)
· by_cases h' : ∃ c, c < F.limsSup ∧ Set.Ioo c F.limsSup = ∅
· rcases h' with ⟨c, c_lt, hc⟩
have B : ∃ᶠ n in F, F.limsSup ≤ n := by
apply (frequently_lt_of_lt_limsSup cobdd c_lt).mono
intro x hx
by_contra!
have : (Set.Ioo c F.limsSup).Nonempty := ⟨x, ⟨hx, this⟩⟩
simp only [hc, Set.not_nonempty_empty] at this
apply liminf_le_of_frequently_le _ (bdd_above.isBoundedUnder f_decr)
exact B.mono fun x hx ↦ f_decr hx
push_neg at h'
by_contra! H
have not_bot : ¬ IsBot F.limsSup := fun maybe_bot ↦
lt_irrefl (F.liminf f) <| lt_of_le_of_lt
(liminf_le_of_frequently_le (frequently_of_forall (fun r ↦ f_decr (maybe_bot r)))
(bdd_above.isBoundedUnder f_decr)) H
obtain ⟨l, l_lt, h'l⟩ :
∃ l < F.limsSup, Set.Ioc l F.limsSup ⊆ { x : R | f x < F.liminf f } := by
apply exists_Ioc_subset_of_mem_nhds ((tendsto_order.1 f_cont.tendsto).2 _ H)
simpa [IsBot] using not_bot
obtain ⟨m, l_m, m_lt⟩ : (Set.Ioo l F.limsSup).Nonempty := by
contrapose! h'
exact ⟨l, l_lt, h'⟩
have B : F.liminf f ≤ f m := by
apply liminf_le_of_frequently_le _ _
· apply (frequently_lt_of_lt_limsSup cobdd m_lt).mono
exact fun x hx ↦ f_decr hx.le
· exact IsBounded.isBoundedUnder f_decr bdd_above
have I : f m < F.liminf f := h'l ⟨l_m, m_lt.le⟩
exact lt_irrefl _ (B.trans_lt I)
/-- A continuous antitone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsup` to the `Filter.liminf` of the images (if the filter is bounded from above and
frequently bounded from below). -/
theorem Antitone.map_limsup_of_continuousAt {f : R → S} (f_decr : Antitone f) (a : ι → R)
(f_cont : ContinuousAt f (F.limsup a))
(bdd_above : F.IsBoundedUnder (· ≤ ·) a := by isBoundedDefault)
(cobdd : F.IsCoboundedUnder (· ≤ ·) a := by isBoundedDefault) :
f (F.limsup a) = F.liminf (f ∘ a) :=
f_decr.map_limsSup_of_continuousAt f_cont bdd_above cobdd
/-- An antitone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsInf` to the `Filter.limsup` of the image if the function is continuous at the `limsInf`
(and the filter is bounded from below and frequently bounded from above). -/
theorem Antitone.map_limsInf_of_continuousAt {F : Filter R} [NeBot F] {f : R → S}
(f_decr : Antitone f) (f_cont : ContinuousAt f F.limsInf)
(cobdd : F.IsCobounded (· ≥ ·) := by isBoundedDefault)
(bdd_below : F.IsBounded (· ≥ ·) := by isBoundedDefault) : f F.limsInf = F.limsup f :=
Antitone.map_limsSup_of_continuousAt (R := Rᵒᵈ) (S := Sᵒᵈ) f_decr.dual f_cont bdd_below cobdd
/-- A continuous antitone function between (conditionally) complete linear ordered spaces sends a
`Filter.liminf` to the `Filter.limsup` of the images (if the filter is bounded from below and
frequently bounded from above). -/
theorem Antitone.map_liminf_of_continuousAt {f : R → S} (f_decr : Antitone f) (a : ι → R)
(f_cont : ContinuousAt f (F.liminf a))
(cobdd : F.IsCoboundedUnder (· ≥ ·) a := by isBoundedDefault)
(bdd_below : F.IsBoundedUnder (· ≥ ·) a := by isBoundedDefault) :
f (F.liminf a) = F.limsup (f ∘ a) :=
f_decr.map_limsInf_of_continuousAt f_cont cobdd bdd_below
/-- A monotone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsSup` to the `Filter.limsup` of the image if the function is continuous at the `limsSup`
(and the filter is bounded from above and frequently bounded from below). -/
theorem Monotone.map_limsSup_of_continuousAt {F : Filter R} [NeBot F] {f : R → S}
(f_incr : Monotone f) (f_cont : ContinuousAt f F.limsSup)
(bdd_above : F.IsBounded (· ≤ ·) := by isBoundedDefault)
(cobdd : F.IsCobounded (· ≤ ·) := by isBoundedDefault) : f F.limsSup = F.limsup f :=
Antitone.map_limsSup_of_continuousAt (S := Sᵒᵈ) f_incr f_cont bdd_above cobdd
/-- A continuous monotone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsup` to the `Filter.limsup` of the images (if the filter is bounded from above and
frequently bounded from below). -/
theorem Monotone.map_limsup_of_continuousAt {f : R → S} (f_incr : Monotone f) (a : ι → R)
(f_cont : ContinuousAt f (F.limsup a))
(bdd_above : F.IsBoundedUnder (· ≤ ·) a := by isBoundedDefault)
(cobdd : F.IsCoboundedUnder (· ≤ ·) a := by isBoundedDefault) :
f (F.limsup a) = F.limsup (f ∘ a) :=
f_incr.map_limsSup_of_continuousAt f_cont bdd_above cobdd
/-- A monotone function between (conditionally) complete linear ordered spaces sends a
`Filter.limsInf` to the `Filter.liminf` of the image if the function is continuous at the `limsInf`
(and the filter is bounded from below and frequently bounded from above). -/
theorem Monotone.map_limsInf_of_continuousAt {F : Filter R} [NeBot F] {f : R → S}
(f_incr : Monotone f) (f_cont : ContinuousAt f F.limsInf)
(cobdd : F.IsCobounded (· ≥ ·) := by isBoundedDefault)
(bdd_below : F.IsBounded (· ≥ ·) := by isBoundedDefault) : f F.limsInf = F.liminf f :=
Antitone.map_limsSup_of_continuousAt (R := Rᵒᵈ) f_incr.dual f_cont bdd_below cobdd
/-- A continuous monotone function between (conditionally) complete linear ordered spaces sends a
`Filter.liminf` to the `Filter.liminf` of the images (if the filter is bounded from below and
frequently bounded from above). -/
theorem Monotone.map_liminf_of_continuousAt {f : R → S} (f_incr : Monotone f) (a : ι → R)
(f_cont : ContinuousAt f (F.liminf a))
(cobdd : F.IsCoboundedUnder (· ≥ ·) a := by isBoundedDefault)
(bdd_below : F.IsBoundedUnder (· ≥ ·) a := by isBoundedDefault) :
f (F.liminf a) = F.liminf (f ∘ a) :=
f_incr.map_limsInf_of_continuousAt f_cont cobdd bdd_below
end Monotone
section InfiAndSupr
open Topology
open Filter Set
variable [CompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R]
theorem iInf_eq_of_forall_le_of_tendsto {x : R} {as : ι → R} (x_le : ∀ i, x ≤ as i) {F : Filter ι}
[Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⨅ i, as i = x := by
refine iInf_eq_of_forall_ge_of_forall_gt_exists_lt (fun i ↦ x_le i) ?_
apply fun w x_lt_w ↦ ‹Filter.NeBot F›.nonempty_of_mem (eventually_lt_of_tendsto_lt x_lt_w as_lim)
theorem iSup_eq_of_forall_le_of_tendsto {x : R} {as : ι → R} (le_x : ∀ i, as i ≤ x) {F : Filter ι}
[Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) : ⨆ i, as i = x :=
iInf_eq_of_forall_le_of_tendsto (R := Rᵒᵈ) le_x as_lim
theorem iUnion_Ici_eq_Ioi_of_lt_of_tendsto (x : R) {as : ι → R} (x_lt : ∀ i, x < as i)
{F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) :
⋃ i : ι, Ici (as i) = Ioi x := by
have obs : x ∉ range as := by
intro maybe_x_is
rcases mem_range.mp maybe_x_is with ⟨i, hi⟩
simpa only [hi, lt_self_iff_false] using x_lt i
-- Porting note: `rw at *` was too destructive. Let's only rewrite `obs` and the goal.
have := iInf_eq_of_forall_le_of_tendsto (fun i ↦ (x_lt i).le) as_lim
rw [← this] at obs
rw [← this]
exact iUnion_Ici_eq_Ioi_iInf obs
theorem iUnion_Iic_eq_Iio_of_lt_of_tendsto (x : R) {as : ι → R} (lt_x : ∀ i, as i < x)
{F : Filter ι} [Filter.NeBot F] (as_lim : Filter.Tendsto as F (𝓝 x)) :
⋃ i : ι, Iic (as i) = Iio x :=
iUnion_Ici_eq_Ioi_of_lt_of_tendsto (R := Rᵒᵈ) x lt_x as_lim
end InfiAndSupr
section Indicator
theorem limsup_eq_tendsto_sum_indicator_nat_atTop (s : ℕ → Set α) :
limsup s atTop = { ω | Tendsto
(fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω) atTop atTop } := by
ext ω
simp only [limsup_eq_iInf_iSup_of_nat, Set.iSup_eq_iUnion, Set.iInf_eq_iInter,
Set.mem_iInter, Set.mem_iUnion, exists_prop]
constructor
· intro hω
refine tendsto_atTop_atTop_of_monotone' (fun n m hnm ↦ Finset.sum_mono_set_of_nonneg
(fun i ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _) (Finset.range_mono hnm)) ?_
rintro ⟨i, h⟩
simp only [mem_upperBounds, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff] at h
induction' i with k hk
· obtain ⟨j, hj₁, hj₂⟩ := hω 1
refine not_lt.2 (h <| j + 1)
(lt_of_le_of_lt (Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.range (j + 1), 0).le ?_)
refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _)
⟨j - 1, Finset.mem_range.2 (lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self), ?_⟩
rw [Nat.sub_add_cancel hj₁, Set.indicator_of_mem hj₂]
exact zero_lt_one
· rw [imp_false] at hk
push_neg at hk
obtain ⟨i, hi⟩ := hk
obtain ⟨j, hj₁, hj₂⟩ := hω (i + 1)
replace hi : (∑ k ∈ Finset.range i, (s (k + 1)).indicator 1 ω) = k + 1 :=
le_antisymm (h i) hi
refine not_lt.2 (h <| j + 1) ?_
rw [← Finset.sum_range_add_sum_Ico _ (i.le_succ.trans (hj₁.trans j.le_succ)), hi]
refine lt_add_of_pos_right _ ?_
rw [(Finset.sum_const_zero.symm : 0 = ∑ k ∈ Finset.Ico i (j + 1), 0)]
refine Finset.sum_lt_sum (fun m _ ↦ Set.indicator_nonneg (fun _ _ ↦ zero_le_one) _)
⟨j - 1, Finset.mem_Ico.2 ⟨(Nat.le_sub_iff_add_le (le_trans ((le_add_iff_nonneg_left _).2
zero_le') hj₁)).2 hj₁, lt_of_le_of_lt (Nat.sub_le _ _) j.lt_succ_self⟩, ?_⟩
rw [Nat.sub_add_cancel (le_trans ((le_add_iff_nonneg_left _).2 zero_le') hj₁),
Set.indicator_of_mem hj₂]
exact zero_lt_one
· rintro hω i
rw [Set.mem_setOf_eq, tendsto_atTop_atTop] at hω
by_contra! hcon
obtain ⟨j, h⟩ := hω (i + 1)
have : (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by
have hle : ∀ j ≤ i, (∑ k ∈ Finset.range j, (s (k + 1)).indicator 1 ω) ≤ i := by
refine fun j hij ↦
(Finset.sum_le_card_nsmul _ _ _ ?_ : _ ≤ (Finset.range j).card • 1).trans ?_
· exact fun m _ ↦ Set.indicator_apply_le' (fun _ ↦ le_rfl) fun _ ↦ zero_le_one
· simpa only [Finset.card_range, smul_eq_mul, mul_one]
by_cases hij : j < i
· exact hle _ hij.le
· rw [← Finset.sum_range_add_sum_Ico _ (not_lt.1 hij)]
suffices (∑ k ∈ Finset.Ico i j, (s (k + 1)).indicator 1 ω) = 0 by
rw [this, add_zero]
exact hle _ le_rfl
refine Finset.sum_eq_zero fun m hm ↦ ?_
exact Set.indicator_of_not_mem (hcon _ <| (Finset.mem_Ico.1 hm).1.trans m.le_succ) _
exact not_le.2 (lt_of_lt_of_le i.lt_succ_self <| h _ le_rfl) this
theorem limsup_eq_tendsto_sum_indicator_atTop (R : Type*) [StrictOrderedSemiring R] [Archimedean R]
(s : ℕ → Set α) : limsup s atTop = { ω | Tendsto
(fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) atTop atTop } := by
rw [limsup_eq_tendsto_sum_indicator_nat_atTop s]
ext ω
simp only [Set.mem_setOf_eq]
rw [(_ : (fun n ↦ ∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → R) ω) = fun n ↦
↑(∑ k ∈ Finset.range n, (s (k + 1)).indicator (1 : α → ℕ) ω))]
· exact tendsto_natCast_atTop_iff.symm
· ext n
simp only [Set.indicator, Pi.one_apply, Finset.sum_boole, Nat.cast_id]
end Indicator
section LiminfLimsupAddSub
variable [ConditionallyCompleteLinearOrder R] [TopologicalSpace R] [OrderTopology R]
/-- `liminf (c + xᵢ) = c + liminf xᵢ`. -/
lemma limsup_const_add (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R]
[CovariantClass R R (fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R)
(bdd_above : F.IsBoundedUnder (· ≤ ·) f) (cobdd : F.IsCoboundedUnder (· ≤ ·) f) :
Filter.limsup (fun i ↦ c + f i) F = c + Filter.limsup f F :=
(Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ c + x)
(fun _ _ h ↦ add_le_add_left h c) (continuous_add_left c).continuousAt bdd_above cobdd).symm
/-- `limsup (xᵢ + c) = (limsup xᵢ) + c`. -/
lemma limsup_add_const (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R]
[CovariantClass R R (Function.swap fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R)
(bdd_above : F.IsBoundedUnder (· ≤ ·) f) (cobdd : F.IsCoboundedUnder (· ≤ ·) f) :
Filter.limsup (fun i ↦ f i + c) F = Filter.limsup f F + c :=
(Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x + c)
(fun _ _ h ↦ add_le_add_right h c) (continuous_add_right c).continuousAt bdd_above cobdd).symm
/-- `liminf (c + xᵢ) = c + limsup xᵢ`. -/
lemma liminf_const_add (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R]
[CovariantClass R R (fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R)
(cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) :
Filter.liminf (fun i ↦ c + f i) F = c + Filter.liminf f F :=
(Monotone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ c + x)
(fun _ _ h ↦ add_le_add_left h c) (continuous_add_left c).continuousAt cobdd bdd_below).symm
/-- `liminf (xᵢ + c) = (liminf xᵢ) + c`. -/
lemma liminf_add_const (F : Filter ι) [NeBot F] [Add R] [ContinuousAdd R]
[CovariantClass R R (Function.swap fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R)
(cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) :
Filter.liminf (fun i ↦ f i + c) F = Filter.liminf f F + c :=
(Monotone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x + c)
(fun _ _ h ↦ add_le_add_right h c) (continuous_add_right c).continuousAt cobdd bdd_below).symm
/-- `limsup (c - xᵢ) = c - liminf xᵢ`. -/
lemma limsup_const_sub (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R]
[OrderedSub R] [CovariantClass R R (fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R)
(cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) :
Filter.limsup (fun i ↦ c - f i) F = c - Filter.liminf f F :=
(Antitone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ c - x)
(fun _ _ h ↦ tsub_le_tsub_left h c) (continuous_sub_left c).continuousAt cobdd bdd_below).symm
/-- `limsup (xᵢ - c) = (limsup xᵢ) - c`. -/
lemma limsup_sub_const (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R]
[OrderedSub R] (f : ι → R) (c : R)
(bdd_above : F.IsBoundedUnder (· ≤ ·) f) (cobdd : F.IsCoboundedUnder (· ≤ ·) f) :
Filter.limsup (fun i ↦ f i - c) F = Filter.limsup f F - c :=
(Monotone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x - c)
(fun _ _ h ↦ tsub_le_tsub_right h c) (continuous_sub_right c).continuousAt bdd_above cobdd).symm
/-- `liminf (c - xᵢ) = c - limsup xᵢ`. -/
lemma liminf_const_sub (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R]
[OrderedSub R] [CovariantClass R R (fun x y ↦ x + y) fun x y ↦ x ≤ y] (f : ι → R) (c : R)
(bdd_above : F.IsBoundedUnder (· ≤ ·) f) (cobdd : F.IsCoboundedUnder (· ≤ ·) f) :
Filter.liminf (fun i ↦ c - f i) F = c - Filter.limsup f F :=
(Antitone.map_limsSup_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ c - x)
(fun _ _ h ↦ tsub_le_tsub_left h c) (continuous_sub_left c).continuousAt bdd_above cobdd).symm
/-- `liminf (xᵢ - c) = (liminf xᵢ) - c`. -/
lemma liminf_sub_const (F : Filter ι) [NeBot F] [AddCommSemigroup R] [Sub R] [ContinuousSub R]
[OrderedSub R] (f : ι → R) (c : R)
(cobdd : F.IsCoboundedUnder (· ≥ ·) f) (bdd_below : F.IsBoundedUnder (· ≥ ·) f) :
Filter.liminf (fun i ↦ f i - c) F = Filter.liminf f F - c :=
(Monotone.map_limsInf_of_continuousAt (F := F.map f) (f := fun (x : R) ↦ x - c)
(fun _ _ h ↦ tsub_le_tsub_right h c) (continuous_sub_right c).continuousAt cobdd bdd_below).symm
end LiminfLimsupAddSub -- section