completed programs roughly from 70 to 80#11
completed programs roughly from 70 to 80#11edwin1729 wants to merge 49 commits intosecure-foundations:mainfrom
Conversation
also remove the palindrome helper lemmas, they were automatically deduced
parno
left a comment
There was a problem hiding this comment.
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.
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@ == strings@.filter(|s| s.has_substring(substring), for a suitable definition of has_substring.
There was a problem hiding this comment.
I've rewritten the the spec to capture the prompt
There was a problem hiding this comment.
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.
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 <parno@cmu.edu>
parno
left a comment
There was a problem hiding this comment.
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.
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.