Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 4018daf

Browse files
jdsalchowrwbarton
authored andcommitted
feat(topology): sequences, sequential spaces, and sequential continuity (closes #440)
Co-Authored-By: Reid Barton <rwbarton@gmail.com>
1 parent c06fb67 commit 4018daf

File tree

1 file changed

+251
-0
lines changed

1 file changed

+251
-0
lines changed

src/topology/sequences.lean

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
/-
2+
Copyright (c) 2018 Jan-David Salchow. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Jan-David Salchow
5+
-/
6+
import topology.basic topology.continuity topology.metric_space.basic
7+
import data.real.cau_seq_filter
8+
9+
open filter
10+
11+
/- Sequences in topological spaces.
12+
-
13+
- In this file we define sequences in topological spaces and show how they are related to
14+
- filters and the topology. In particular, we
15+
-
16+
- (*) associate a filter with a sequence and prove equivalence of convergence of the two,
17+
- (*) define the sequential closure of a set and prove that it's contained in the closure,
18+
- (*) define a type class "sequential_space" in which closure and sequential closure agree,
19+
- (*) define sequential continuity and show that it coincides with continuity in sequential spaces,
20+
- (*) provide an instance that shows that every metric space is a sequential space.
21+
-
22+
- TODO: There should be an instance that associates a sequential space with a first countable
23+
- space.
24+
- TODO: Sequential compactness should be handled here.
25+
-/
26+
namespace sequence
27+
28+
universes u v
29+
variables {X : Type u} {Y : Type v}
30+
31+
local notation x `⟶` limit := tendsto x at_top (nhds limit)
32+
33+
/- Statements about sequences in general topological spaces. -/
34+
section topological_space
35+
variables [topological_space X] [topological_space Y]
36+
37+
38+
/-- A sequence converges in the sence of topological spaces iff the associated statement for filter holds. -/
39+
@[simp] lemma topological_space.seq_tendsto_iff [topological_space X] {x : ℕ → X} {limit : X} :
40+
tendsto x at_top (nhds limit) ↔ ∀ U : set X, limit ∈ U → is_open U → ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ U :=
41+
iff.intro
42+
(assume ttol : tendsto x at_top (nhds limit),
43+
show ∀ U : set X, limit ∈ U → is_open U → ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ U, from
44+
assume U limitInU isOpenU,
45+
have {n | (x n) ∈ U} ∈ at_top.sets, from mem_map.mp $ le_def.mp ttol U
46+
(mem_nhds_sets isOpenU limitInU),
47+
show ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ U, from mem_at_top_sets.mp this)
48+
(assume xtol : ∀ U : set X, limit ∈ U → is_open U → ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ U,
49+
suffices ∀ U, limit ∈ U → is_open U → x ⁻¹' U ∈ at_top.sets, from tendsto_nhds this,
50+
assume U limitInU isOpenU,
51+
suffices ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ U, by simp[this],
52+
xtol U limitInU isOpenU)
53+
54+
lemma const_seq_conv [topological_space X] (p : X) : (λ n : ℕ, p) ⟶ p :=
55+
suffices ∀ U : set X, p ∈ U → is_open U → ∃ n0 : ℕ, ∀ n ≥ n0, p ∈ U, by simp; exact this,
56+
assume U (_ : p ∈ U) (_ : is_open U), exists.intro 0 (assume n (_ : n ≥ 0), ‹p ∈ U›)
57+
58+
59+
/-- The sequential closure of a subset M ⊆ X of a topological space X is
60+
the set of all p ∈ X which arise as limit of sequences in M. -/
61+
def sequential_closure (M : set X) : set X :=
62+
{p | ∃ x : ℕ → X, (∀ n : ℕ, ((x n) ∈ M)) ∧ (x ⟶ p)}
63+
64+
65+
lemma subset_seq_closure (M : set X) : M ⊆ sequential_closure M :=
66+
assume p (_ : p ∈ M), show p ∈ sequential_closure M, from
67+
exists.intro (λ n, p) ⟨assume n, ‹p ∈ M›, const_seq_conv p⟩
68+
69+
def is_seq_closed (A : set X) : Prop := A = sequential_closure A
70+
71+
/-- A convenience lemma for showing that a set is sequentially closed. -/
72+
lemma is_seq_closed_of_def {A : set X} (h : ∀ (x : ℕ → X), (∀ n : ℕ, ((x n) ∈ A)) → ∀ p : X,
73+
(x ⟶ p) → p ∈ A) : is_seq_closed A :=
74+
show A = sequential_closure A, from set.subset.antisymm
75+
(subset_seq_closure A)
76+
(show ∀ p, (p ∈ sequential_closure A) → p ∈ A, from
77+
(assume p _,
78+
have ∃ x : ℕ → X, (∀ n : ℕ, ((x n) ∈ A)) ∧ (x ⟶ p), by assumption,
79+
let ⟨x, ⟨_, _⟩⟩ := this in
80+
show p ∈ A, from h x ‹∀ n : ℕ, ((x n) ∈ A)› p ‹(x ⟶ p)›))
81+
82+
/-- The sequential closure of a set is contained in the closure of that set. The converse is not true. -/
83+
lemma sequential_closure_subset_closure (M : set X) : sequential_closure M ⊆ closure M :=
84+
show ∀ p, p ∈ sequential_closure M → p ∈ closure M, from
85+
assume p,
86+
assume : ∃ x : ℕ → X, (∀ n : ℕ, ((x n) ∈ M)) ∧ (x ⟶ p),
87+
let ⟨x, ⟨_, _⟩⟩ := this in
88+
show p ∈ closure M, from
89+
-- we have to show that p is in the closure of M
90+
-- using mem_closure_iff, this is equivalent to proving that every open neighbourhood
91+
-- has nonempty intersection with M, but this is witnessed by our sequence x
92+
suffices ∀ O, is_open O → p ∈ O → O ∩ M ≠ ∅, from mem_closure_iff.mpr this,
93+
have ∀ (U : set X), p ∈ U → is_open U → (∃ n0, ∀ n, n ≥ n0 → x n ∈ U), by rwa[←topological_space.seq_tendsto_iff],
94+
assume O is_open_O p_in_O,
95+
let ⟨n0, _⟩ := this O ‹p ∈ O› ‹is_open O› in
96+
have (x n0) ∈ O, from ‹∀ n ≥ n0, x n ∈ O› n0 (show n0 ≥ n0, from le_refl n0),
97+
have (x n0) ∈ O ∩ M, fromthis, ‹∀n, x n ∈ M› n0⟩,
98+
set.ne_empty_of_mem this
99+
100+
/-- A set is sequentially closed if it is closed. -/
101+
lemma is_seq_closed_of_is_closed (M : set X) (_ : is_closed M) : is_seq_closed M :=
102+
suffices sequential_closure M ⊆ M,
103+
from set.eq_of_subset_of_subset (subset_seq_closure M) this,
104+
calc sequential_closure M ⊆ closure M : sequential_closure_subset_closure M
105+
... = M : closure_eq_of_is_closed ‹is_closed M›
106+
107+
/-- The limit of a convergent sequence in a sequentially closed set is in that set.-/
108+
lemma is_mem_of_conv_to_of_is_seq_closed {A : set X} (_ : is_seq_closed A) {x : ℕ → X}
109+
(_ : ∀ n, x n ∈ A) {limit : X} (_ : (x ⟶ limit)) : limit ∈ A :=
110+
have limit ∈ sequential_closure A, from
111+
show ∃ x : ℕ → X, (∀ n : ℕ, ((x n) ∈ A)) ∧ (x ⟶ limit), from
112+
exists.intro x ⟨‹∀ n, x n ∈ A›, ‹(x ⟶ limit)›⟩,
113+
eq.subst (eq.symm ‹is_seq_closed A›) ‹limit ∈ sequential_closure A›
114+
115+
/-- The limit of a convergent sequence in a closed set is in that set.-/
116+
lemma is_mem_of_is_closed_of_conv_to {A : set X} (_ : is_closed A) {x : ℕ → X}
117+
(_ : ∀ n, x n ∈ A) {limit : X} (_ : x ⟶ limit) : limit ∈ A :=
118+
is_mem_of_conv_to_of_is_seq_closed (is_seq_closed_of_is_closed A ‹is_closed A›)
119+
‹∀ n, x n ∈ A› ‹(x ⟶ limit)›
120+
121+
/-- A sequential space is a space in which 'sequences are enough to probe the topology'. This can be
122+
formalised by demanding that the sequential closure and the closure coincide. The following
123+
statements show that other topological properties can be deduced from sequences in sequential
124+
spaces. -/
125+
class sequential_space (X : Type u) [topological_space X] : Prop :=
126+
(sequential_closure_eq_closure : ∀ M : set X, sequential_closure M = closure M)
127+
128+
129+
/-- In a sequential space, a set is closed iff it's sequentially closed. -/
130+
lemma is_seq_closed_iff_is_closed [sequential_space X] : ∀ {M : set X},
131+
(is_seq_closed M ↔ is_closed M) :=
132+
assume M, iff.intro
133+
(assume _, closure_eq_iff_is_closed.mp (eq.symm
134+
(calc M = sequential_closure M : by assumption
135+
... = closure M : sequential_space.sequential_closure_eq_closure M)))
136+
(is_seq_closed_of_is_closed M)
137+
138+
/-- A function between topological spaces is sequentially continuous if it commutes with limit of
139+
convergent sequences. -/
140+
def sequentially_continuous (f : X → Y) : Prop :=
141+
∀ (x : ℕ → X), ∀ {limit : X}, (x ⟶ limit) → (f∘x ⟶ f limit)
142+
143+
/- A continuous function is sequentially continuous. -/
144+
lemma cont_to_seq_cont {f : X → Y} (_ : continuous f) : sequentially_continuous f :=
145+
assume x limit (_ : x ⟶ limit),
146+
have tendsto f (nhds limit) (nhds (f limit)), from continuous.tendsto ‹continuous f› limit,
147+
show (f ∘ x) ⟶ (f limit), from tendsto.comp ‹(x ⟶ limit)› this
148+
149+
/-- In a sequential space, continuity and sequential continuity coincide. -/
150+
lemma cont_iff_seq_cont {f : X → Y} [sequential_space X] :
151+
continuous f ↔ sequentially_continuous f :=
152+
iff.intro
153+
(assume _, cont_to_seq_cont ‹continuous f›)
154+
(assume : sequentially_continuous f, show continuous f, from
155+
suffices h : ∀ {A : set Y}, is_closed A → is_seq_closed (f ⁻¹' A), from
156+
continuous_iff_is_closed.mpr (assume A _,
157+
is_seq_closed_iff_is_closed.mp $ h ‹is_closed A›),
158+
assume A (_ : is_closed A),
159+
is_seq_closed_of_def $
160+
assume (x : ℕ → X),
161+
assume : ∀ n, (x n) ∈ (f ⁻¹' A),
162+
have ∀ n, f (x n) ∈ A, by assumption,
163+
assume p (_ : x ⟶ p),
164+
have (f ∘ x) ⟶ (f p), from ‹sequentially_continuous f› x ‹(x ⟶ p)›,
165+
show f p ∈ A, from is_mem_of_is_closed_of_conv_to ‹is_closed A› ‹∀ n, f (x n) ∈ A›
166+
‹((f∘x) ⟶ (f p))›)
167+
168+
169+
end topological_space
170+
171+
/- Statements about sequences in metric spaces -/
172+
section metric_space
173+
variable [metric_space X]
174+
variables {ε : ℝ}
175+
176+
open metric
177+
178+
/-- A sequence converges in the sence of metric spaces iff the associated statement about filters holds. -/
179+
@[simp] lemma metric_space.seq_tendsto_iff {x : ℕ → X} {limit : X} :
180+
(x ⟶ limit) ↔ ∀ ε > 0, ∃ n0 : ℕ, ∀ n ≥ n0, dist (x n) limit < ε :=
181+
iff.intro
182+
(assume tendsto,
183+
have convTo : ∀ (U : set X), limit ∈ U → is_open U → (∃ n0, ∀ n, n ≥ n0 → x n ∈ U),
184+
by rwa[←topological_space.seq_tendsto_iff],
185+
show ∀ ε > 0, ∃ n0, ∀ n ≥ n0, dist (x n) limit < ε, from
186+
assume ε _,
187+
have ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ (ball limit ε), from
188+
convTo (ball limit ε) (mem_ball_self ‹ε > 0›) is_open_ball,
189+
let ⟨n0, _⟩ := this in
190+
exists.intro n0
191+
(show ∀ n ≥ n0, dist (x n) limit < ε, from
192+
assume n _,
193+
‹∀ n ≥ n0, (x n) ∈ ball limit ε› n ‹n ≥ n0›))
194+
(assume metrConvTo,
195+
suffices ∀ U : set X, limit ∈ U → is_open U → ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ U, by simpa,
196+
assume U limitInU isOpenU,
197+
have ∃ ε > 0, ball limit ε ⊆ U, from is_open_iff.mp isOpenU limit limitInU,
198+
let ⟨ε, _, _⟩ := this in
199+
have ∃ n0, ∀ n ≥ n0, dist (x n) limit < ε, from metrConvTo ε ‹ε > 0›,
200+
let ⟨n0, _⟩ := this in
201+
show ∃ n0, ∀ n ≥ n0, (x n) ∈ U, from
202+
exists.intro n0 (assume n _,
203+
have (x n) ∈ ball limit ε, from ‹∀ n ≥ n0, dist (x n) limit < ε› _ ‹n ≥ n0›,
204+
show (x n) ∈ U, from set.mem_of_subset_of_mem ‹ball limit ε ⊆ U› ‹(x n) ∈ ball limit ε›))
205+
206+
-- necessary for the next instance
207+
set_option eqn_compiler.zeta true
208+
/-- Show that every metric space is sequential. -/
209+
instance metric_space.to_sequential_space : sequential_space X :=
210+
show ∀ M, sequential_closure M = closure M, from assume M,
211+
suffices closure M ⊆ sequential_closure M,
212+
from set.subset.antisymm (sequential_closure_subset_closure M) this,
213+
assume (p : X) (_ : p ∈ closure M),
214+
-- we construct a sequence in X, with values in M, that converges to p
215+
-- the first step is to use (p ∈ closure M) ↔ "all nhds of p contain elements of M" on metric
216+
-- balls
217+
have ∀ n : ℕ, ball p ((1:ℝ)/((n+1):ℝ)) ∩ M ≠ ∅, from
218+
assume n : ℕ, mem_closure_iff.mp ‹p ∈ (closure M)› (ball p ((1:ℝ)/((n+1):ℝ))) (is_open_ball)
219+
(mem_ball_self (show (1:ℝ)/(n+1) > 0, from one_div_succ_pos n)),
220+
221+
-- from this, construct a "sequence of hypothesis" h, (h n) := _ ∈ {x // x ∈ ball (1/n+1) p ∩ M}
222+
let h := λ n : ℕ, (classical.indefinite_description _ (set.exists_mem_of_ne_empty (this n))),
223+
-- and the actual sequence
224+
x := λ n : ℕ, (h n).val in
225+
226+
-- now we construct the promised sequence and show the claim
227+
show ∃ x : ℕ → X, (∀ n : ℕ, ((x n) ∈ M)) ∧ (x ⟶ p), from
228+
exists.intro x
229+
(and.intro
230+
(assume n, have (x n) ∈ ball p ((1:ℝ)/((n+1):ℝ)) ∩ M, from (h n).property, this.2)
231+
(suffices ∀ ε > 0, ∃ n0 : ℕ, ∀ n ≥ n0, dist (x n) p < ε, begin simpa only [metric_space.seq_tendsto_iff] end,
232+
assume ε _,
233+
-- we apply that 1/n converges to zero to the fact that (x n) ∈ ball p ε
234+
have ∀ ε > 0, ∃ n0 : ℕ, ∀ n ≥ n0, dist (1 / (↑n + 1)) (0:ℝ) < ε,
235+
from metric_space.seq_tendsto_iff.mp sequentially_complete.tendsto_div,
236+
let ⟨n0, hn0⟩ := this ε ‹ε > 0in
237+
show ∃ n0 : ℕ, ∀ n ≥ n0, dist (x n) p < ε, from
238+
(exists.intro n0 (assume n ngtn0,
239+
show dist (x n) p < ε, from
240+
calc dist (x n) p < (1:ℝ)/↑(n+1) : (h n).property.1
241+
... = abs ((1:ℝ)/↑(n+1)) : eq.symm
242+
(abs_of_pos (one_div_succ_pos n))
243+
... = abs ((1:ℝ)/↑(n+1) - 0) : by simp
244+
... = dist ((1:ℝ)/↑(n+1)) 0 : eq.symm $ real.dist_eq ((1:ℝ)/↑(n+1)) 0
245+
... < ε : hn0 n ‹n ≥ n0›))))⟩
246+
247+
set_option eqn_compiler.zeta false
248+
249+
end metric_space
250+
251+
end sequence

0 commit comments

Comments
 (0)