-
Notifications
You must be signed in to change notification settings - Fork 26
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
Keyval find specs #85
base: master
Are you sure you want to change the base?
Conversation
ivy/include/1.8/collections.ivy
Outdated
i := i.next; | ||
} | ||
assert end <= i | repr(s).value(i).p_key = k; |
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 line isn't required. We might choose to delete it.
This might be better:
The first is equivalent to yours but a little shorter, while the second one is more precise than yours.
No, Ivy understands that only |
For the first one I had simplified it to For the second I struggled to simplify it. Thanks for your suggestion! |
Pushed the rewrite of the invariant & implementation of find that we paired on. |
Added specs for
find
to state that the return valuei
either refers to the correct index for the given keyk
, or refers to a value outside of the assigned indexes.Test file
test.ivy
:Test command:
Review request: @nano-o
I've written the postcondition for
find
using implications to separate the two cases. I'm not sure if that's the right approach.Should I include assertions in the postcondition that the keyval structure is not changed? is
assert s = old s
enough, or do I need all of