-
Notifications
You must be signed in to change notification settings - Fork 76
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
Cauchy sequences in metric spaces #1347
Cauchy sequences in metric spaces #1347
Conversation
…imation' into cauchy-sequence-to-cauchy-approximation
Co-authored-by: Fredrik Bakke <[email protected]>
src/metric-spaces/cauchy-sequences-complete-metric-spaces.lagda.md
Outdated
Show resolved
Hide resolved
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'm not a fan of the prevalent use of let
bindings here. One thing is to use them for the monad syntax we have been discussing, but here you're using them to formalize lemmas and to create aliases.
I guess my understanding of the objective of the stylistic practice here is to encourage pulling out reusable lemmas and functions rather than reinventing logic repeatedly. I see and buy that, though as I work in this project I am becoming less convinced over time that that scales all that well. Many individual steps to proving theorems feel so narrow and specific that generating even a name for them as a lemma feels oppressively difficult. You can try to make them more general and get a better name as a result, but the work to apply the general case to the specific need often feels like as least as much work as the effort to prove the specific case from scratch without the lemma. But separately, many of the the aliases in this PR give an easier-to-follow, shorter name to what would otherwise be a long function call -- I can find more steps to combine into more general lemmas and functions, and I see some examples in this PR where that shouldn't be too difficult. Combining |
I understand your sentiment, and I have seen from working with students that sensibly breaking down code into reusable lemmas is one of the hardest things for newcomers to learn. On the other hand, it is a skill that is possible to learn, and I don't really believe in your scaling argument. In fact, I think the opposite is true. There are parts of the library that have been coded in less refactorable style, and in practice it has just been about impossible to do anything with it. Refactoring that code is an insurmountable task, probably worse that just formalizing it from scratch all anew. As a results, these parts of the code have been sitting in the library with low maintenance. Furthermore, these are often the parts of the library that take up the most time of the type checker. So I am a firm believer in breaking down everything into small, sensible, reusable lemmas. On the other hand, if you have the sense that it hampers your progress, I'd rather have that you formalize in your preferred style. According to the rising sea model, eventually the code written in small reusable lemmas will catch up and these parts of the library will also be nicely refactored. |
I am willing to go ahead and trust that experience for the lemmas aspect; that comment has successfully moved me there. |
I think it is fine. I use I also thought that I should add that I don't mean to say that the code you write, or any code from anyone that gets rewritten including my own, is bad code. It's normal that things get rewritten, and it's normal that after having formalized something once, later a better/new interesting approach comes along. We're not setting our formalization in stone, it changes all the time. |
Co-authored-by: Fredrik Bakke <[email protected]>
It seems that a conclusion was reached on the use of |
I believe I've eliminated all the |
Gives us the ability to go back and forth between Cauchy sequences and Cauchy approximations, and their limits.
Naturally, this is going to be necessary for a lot of analysis built on series and sequences.
Depends on #1345.