-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat (analysis/topology): implement sequential spaces and sequential continuity, show metric spaces are sequential #440
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very clean! The ‹ ›
notation isn't used so much in mathlib, and this is certainly verbose, but that's not necessarily bad. This is very legible to me.
Here are some quick stylistic comments. Many of them apply to multiple places in the file, you should be able to find where pretty quickly. I'm also trying out Github's suggestion feature, which I've never used...
analysis/topology/sequences.lean
Outdated
metrically_converges_to_iff_converges_to | ||
... ↔ tendsto x at_top (nhds limit) : converges_to_iff_tendsto | ||
|
||
private lemma one_div_succ_pos (n : ℕ) : 1 / ((n : ℝ) + 1) > 0 := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I did this originally, but this should probably be moved somewhere more general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it's a copy of your private lemma from the Cauchy sequence filter file. Any suggestions as to where a non private version of this can go? I was tempted to put it into real.lean, but the statement is true in a more general context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
algebra/ordered_field.lean
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems wrong as it would imply importing the reals in ordered field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work more generally for some ordered fields
analysis/topology/sequences.lean
Outdated
-- from this, construct a "sequence of hypothesis" h, (h n) := _ ∈ {x // x ∈ ball (1/n+1) p ∩ M} | ||
let h := λ n : ℕ, (classical.indefinite_description _ (set.exists_mem_of_ne_empty (this n))) in | ||
-- an actual sequence | ||
let x := λ n : ℕ, (h n).val in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can combine two lets into one:
let h := _,
x := _ in
analysis/topology/sequences.lean
Outdated
-- necessary for the next instance | ||
set_option eqn_compiler.zeta true | ||
/- Show that every metric space is sequential. -/ | ||
instance metric_space.to_sequential_space: sequential_space X := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space before colon (otherwise the VS Code highlighting is off)
instance metric_space.to_sequential_space: sequential_space X := | |
instance metric_space.to_sequential_space : sequential_space X := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robertylewis Thanks for the bug report! It's fixed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, I guess I could have made this bug report easier to find.... Thanks!
This certainly looks very readable! I should learn to write term-mode proofs like this! |
analysis/topology/sequences.lean
Outdated
- (*) define the sequential closure of a set and prove that it's contained in the closure, | ||
- (*) define a type class "sequential_space" in which closure and sequential closure agree, | ||
- (*) define sequential continuity and show that it coincides with continuity in sequential spaces, | ||
- (*) provide and instance that shows that every metric space is a sequential space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- (*) provide and instance that shows that every metric space is a sequential space. | |
- (*) provide an instance that shows that every metric space is a sequential space. |
analysis/topology/sequences.lean
Outdated
|
||
/- The notion of convergence of sequences in topological spaces. -/ | ||
def converges_to (x : ℕ → X) (limit : X) : Prop := | ||
∀ U : set X, limit ∈ U → is_open U → ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ U |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I would personally swap the order of the hypotheses: first assume that U
is open, and then assume that the limit
is in U
. But that is certainly a matter of taste.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much of a preference either way.
analysis/topology/sequences.lean
Outdated
let ⟨x, ⟨_, _⟩⟩ := this in | ||
show p ∈ A, from h x ‹∀ n : ℕ, ((x n) ∈ A)› p ‹converges_to x p›)) | ||
|
||
/- The sequential closure of a set is containt in the closure of that set. The converse is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/- The sequential closure of a set is containt in the closure of that set. The converse is not | |
/- The sequential closure of a set is contained in the closure of that set. The converse is not |
Is there anything wrong with this PR? |
I hope to find some in one or two weeks. I'm a little bit occupied with preparing a lecture and reviews. |
What's the state of this? |
analysis/topology/sequences.lean
Outdated
show p ∈ closure M, from | ||
-- we have to show that p is in the closure of M | ||
-- using mem_closure_iff, this is equivalent to proving that every open neighbourhood | ||
-- has nonempty intersection with A, but this is witnessed by our sequence x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
M
turned into A
in the comment. Might be worth going through and changing all the A
s to M
or vice versa.
analysis/topology/sequences.lean
Outdated
-- using mem_closure_iff, this is equivalent to proving that every open neighbourhood | ||
-- has nonempty intersection with A, but this is witnessed by our sequence x | ||
suffices ∀ O, is_open O → p ∈ O → O ∩ M ≠ ∅, from mem_closure_iff.mpr this, | ||
assume O is_open_O O_cap_M_neq_empty, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assume O is_open_O O_cap_M_neq_empty, | |
assume O is_open_O p_in_O, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be misleading, in general p is only in the sequential closure of M, not in M.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O_cap_M_neq_empty
sounds like the type is O ∩ M ≠ ∅
, but it is p ∈ O
analysis/topology/sequences.lean
Outdated
metrically_converges_to_iff_converges_to | ||
... ↔ tendsto x at_top (nhds limit) : converges_to_iff_tendsto | ||
|
||
private lemma one_div_succ_pos (n : ℕ) : 1 / ((n : ℝ) + 1) > 0 := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
algebra/ordered_field.lean
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdsalchow sorry for the long delay. Generally we try to use tendsto
and not introduce too much additional constants.
analysis/topology/sequences.lean
Outdated
-- using mem_closure_iff, this is equivalent to proving that every open neighbourhood | ||
-- has nonempty intersection with A, but this is witnessed by our sequence x | ||
suffices ∀ O, is_open O → p ∈ O → O ∩ M ≠ ∅, from mem_closure_iff.mpr this, | ||
assume O is_open_O O_cap_M_neq_empty, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O_cap_M_neq_empty
sounds like the type is O ∩ M ≠ ∅
, but it is p ∈ O
analysis/topology/sequences.lean
Outdated
universes u v | ||
variables {X : Type u} {Y : Type v} | ||
|
||
def to_filter (x : ℕ → X) : filter X := filter.map x at_top |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is never used
analysis/topology/sequences.lean
Outdated
variables [topological_space X] [topological_space Y] | ||
|
||
/-- The notion of convergence of sequences in topological spaces. -/ | ||
def converges_to (x : ℕ → X) (limit : X) : Prop := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition is not necessary. It would be nice to have a notation for this, and prove converges_to_iff_tendsto
in the other way round.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by 'the other way around'? Just the symmetric statement i.e. converges_to_iff_tendsto?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to avoid introducing too many new concepts for slight variations of the same notion. It makes the library confusing; for example, converges_to
might mean any of a number of things. You should use tendsto x at_top (nhds limit)
directly rather than the new concept, converges_to
. The lemma should then assert that tendsto x at_top (nhds limit)
is equivalent to the current definition of converges_to
.
Also, doesn't the equivalence hold for an arbitrary preorder, not just nat?
analysis/topology/sequences.lean
Outdated
(mem_nhds_sets isOpenU limitInU), | ||
show ∃ n0 : ℕ, ∀ n ≥ n0, (x n) ∈ U, from mem_at_top_sets.mp this) | ||
|
||
/-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the -
in the next two lines. They occur in the tooltip, i.e, the tooltip is now - The sequential closure of a subset M ⊆ X of a topological space X is - the set of all p ∈ X which arise as limit of sequences in M.
analysis/topology/sequences.lean
Outdated
show p ∈ A, from h x ‹∀ n : ℕ, ((x n) ∈ A)› p ‹converges_to x p›)) | ||
|
||
/-- | ||
- The sequential closure of a set is contained in the closure of that set. The converse is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto for -
analysis/topology/sequences.lean
Outdated
is_mem_of_conv_to_of_is_seq_closed (is_seq_closed_of_is_closed A ‹is_closed A›) | ||
‹∀ n, x n ∈ A› ‹converges_to x limit› | ||
|
||
/-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto for -
analysis/topology/sequences.lean
Outdated
|
||
/-- The usual notion of convergence of sequences in metric spaces. -/ | ||
def metrically_converges_to (x : ℕ → X) (limit : X) : Prop := | ||
∀ ε > 0, ∃ n0 : ℕ, ∀ n ≥ n0, dist (x n) limit < ε |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as converges_to
, i.e. remove this definition
analysis/topology/sequences.lean
Outdated
metrically_converges_to_iff_converges_to | ||
... ↔ tendsto x at_top (nhds limit) : converges_to_iff_tendsto | ||
|
||
private lemma one_div_succ_pos (n : ℕ) : 1 / ((n : ℝ) + 1) > 0 := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work more generally for some ordered fields
b787b7c
to
f07478c
Compare
@jdsalchow Thank you for these theorems and definitions. They look very good to me, but there is one thing that should be improved. I just confirmed that two of the main lemmas, variables {γ : Type*} [semilattice_sup γ] [inhabited γ] and replace I would recommend naming them (If you are feeling energetic, it would be nice to have the corresponding theorems for |
Co-Authored-By: jdsalchow <jdsalchow@gmail.com>
Co-Authored-By: jdsalchow <jdsalchow@gmail.com>
Co-Authored-By: jdsalchow <jdsalchow@gmail.com>
Co-Authored-By: jdsalchow <jdsalchow@gmail.com>
Co-Authored-By: jdsalchow <jdsalchow@gmail.com>
@avigad If I do that, the two lemmas would have to move out of the file about sequences, and be put into a logical context that fits such a general lemma. Then those two lemmas would need to be restated as a corollary of the general thing. I'm happy to do that, if there is a place in which the more general statements would fit. Otherwise, I suggest to put a comment there, indicating that the proofs generalise. Then the first person who needs it can do this (trivial) generalisation. |
Is this failing because of some olean caching issue? It builds fine locally ... |
some files got moved around - |
…ty (closes #440) Co-Authored-By: Reid Barton <rwbarton@gmail.com>
feat (analysis/topology): implement sequential spaces and sequential continuity, show metric spaces are sequential
TO CONTRIBUTORS:
Make sure you have:
For reviewers: code review check list