-
Notifications
You must be signed in to change notification settings - Fork 156
Fix to the definitions of min and max
#1270
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
base: master
Are you sure you want to change the base?
Conversation
|
Why not just define min and max by recursion without any |
|
So having |
They made it like this in #1262 for efficiency, because the |
|
Also, I think this is precisely the advantage of using |
|
Ah right, I had forgotten about that. I wonder how much one should worry about efficiency for functions on unary nat though... If we want things to be fast we should at least have a binary representation? |
I don't know if that would help; It wouldn't be better in terms of storage at least, because Agda compiles Nat to built in arbitrary-precision binary integers, and idt it would speed up arithmetic because the builtin operations are O(1) while binary arithmetic is O(logN) |
|
@mortberg this is part of work to enable fast operations on Integers -> Rationals -> and finaly beeing able to quickly calculatate things like Nth digit of |
While working on a future PR, I noticed that when performing a "with-abstraction with
UsingEq" onn <ᵇ m, each case was not normalizing to the expected term.This issue is resolved by adding
UsingEqinto the definitions ofminandmax. Interestingly, all proofs that relied on "with-abstraction withotUsingEq" still works unchanged.I added a comment about this limitation above the definition of
UsingEq, but I'm not entirely sure how clear it is, so I also referenced its use inminandmaxover ℕ.Please let me know if there is a clearer way to explain this behavior.