-
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
refactor(*): saturating fin addition #6149
Conversation
…into fin-saturate-dev
… fin-saturate-dev
…dd-monoid' into fin-saturate-dev
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.
Since this is still a WIP/RFC, I'll just quickly note that I approve of the idea of saturating addition on fin
. I will take a closer look at the code when the dependencies and holes are 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 also happy with changing the defn of addition on fin
.
Since you're the point person for the |
I'm almost finished with some other work, then I'll take a look. |
The On the other hand, the notation there seems appropriate in any case where |
There should be no problem with indexing your matrix over |
I think the consensus on Zulip was that there should be no arithmetic done on |
OK, I worked on the notation for a bit, but it's not as simple as fixing a few lemmas: |
Sorry, I'm not really feeling ready for a lot of thinking tonight. In about 12 hours I'll be back again, feel free to attempt the fix before then. |
🎉 Great news! Looks like all the dependencies have been resolved:
💡 To add or remove a dependency please update this issue/PR description. Brought to you by Dependent Issues (:robot: ). Happy coding! |
Can you link to the Zulip discussion about saturating addition on fin? I searched for To be honest, I think that this change is a bad idea. Or at the very least insufficiently motivated. What concrete problem does saturating addition solve? Or does it at least have nicer properties than modular arithmetic? Does the definition of addition even matter if we want to avoid arithmetic on I find saturating arithmetic to be extremely surprising in mathematics. Also in indices, since you often have periodic extensions.
Both are equally counterintuitive if you expect an error instead. I don't see how saturating addition improves anything here. |
Some discussions are at I understand the concern that this isn't strongly motivated. Do we want to be able to provide numerical syntax for The saturating addition, in my mind, is a rephrasing of the complete total order that is on Differentiating |
A coercion from |
I don't have a very strong opinion. As long as |
The
fin
ops will be removed from core in leanprover-community/lean#527. This allows for redefiningfin
addition as saturating, as well as removing the extra unwanted operations.To do so, some small changes are needed scattered around the library. The most dependent files:
data/matrix/notation.lean
anddata/zmod/basic.lean
, andtactic/norm_fin.lean
required larger refactoring.Once this is merged, further improvement of the
fin
API is possible.To test this branch, I built the lean#527 branch locally and overrode the toolchain with the newly built dev lean.
The only files which currently have wrong proofs are
data/matrix/notation.lean
anddata/zmod/basic.lean
, with about 4 lemmas each. In general, some refactoring is needed for the notationsimp
lemmas that deal with numerals.This PR is likely to bitrot quickly if not kept up with master.