-
Notifications
You must be signed in to change notification settings - Fork 13
completed programs roughly from 70 to 80 #11
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: main
Are you sure you want to change the base?
Conversation
also remove the palindrome helper lemmas, they were automatically deduced
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.
Thanks for making so much progress on so many tasks! This is great to see.
As a minor suggestion, inside the Verus code base, we typically topologically sort our files, so that the leaf functions are at the top, and the entrypoint is at the bottom. Doing that here might make things a bit easier to review in some cases (like for Task 70).
|
||
// TODO: Put your solution (the specification, implementation, and proof) to the task here | ||
fn filter_by_substring<'a>(strings: &Vec<&'a str>, substring: &str) -> (res: Vec<&'a str>) | ||
ensures |
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 spec says that anything that we return contains the substring and was in the original strings
list. To match the English description's intention, I think it might need to be strengthened to say that if there is a string in strings
that contains the substring, then it will appear in res
.
I wonder if this spec might be expressed using a filter, e.g., res@ == [email protected](|s| s.has_substring(substring)
, for a suitable definition of has_substring
.
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've rewritten the the spec to capture the prompt
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 this version captures the property I mentioned above, but I think it might have lost the property your previous version included. In other words, I think your current spec would allow the function to return the entire input list.
Perhaps you could show that combining your two versions of the spec imply the filter
-based spec above.
tasks/human_eval_077.rs
Outdated
x != i32::MIN, // avoid overflow: -(i32::MIN) == (i32::MAX) + 1 | ||
|
||
ensures | ||
ret <==> exists|i: int| 0 <= i && abs(x as int) == #[trigger] (i * i * i), |
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.
Is it possible to show that this is equivalent to this?
ret <==> exists|i: int| x == #[trigger] (i * i * i),
That's what I was initially expecting to see, given the English prompt.
|
Co-authored-by: Bryan Parno <[email protected]>
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 added a few responses to the latest edits. It looks like you also added some new files? If so, I haven't looked at them yet; I wasn't sure if they were ready for review. It might be easier to do them in a separate PR (or at least do any new tasks on a separate PR).
|
||
// TODO: Put your solution (the specification, implementation, and proof) to the task here | ||
fn filter_by_substring<'a>(strings: &Vec<&'a str>, substring: &str) -> (res: Vec<&'a str>) | ||
ensures |
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 this version captures the property I mentioned above, but I think it might have lost the property your previous version included. In other words, I think your current spec would allow the function to return the entire input list.
Perhaps you could show that combining your two versions of the spec imply the filter
-based spec above.
Hi sorry for the prolonged silence. I intend to complete these programs slowly over weekends now that term has started for me. Thanks as always for the feedback |
No problem -- we totally understand you have other demands on your time! |
Just wanted to check in on the status of this PR. If it seems unlikely you'll be able to work on them, could we split off the completed tasks into a separate PR, so that we can merge them into |
see original commits at secure-foundations#11 coauthored by @WeetHet
see original commits at secure-foundations#11 coauthored by @WeetHet
see original commits at secure-foundations#11 coauthored by @WeetHet
see original commits at secure-foundations#11 coauthored by @WeetHet
No description provided.