-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add more detailed instructions on how to write predicates #121
Comments
Concrete suggestions (even sketchy ones) would be very very welcome -- we are revamping the tutorial right now, and this is exactly the sort of deeper explanation we'd like to offer. |
Perhaps the linked example of the cluster is an OK starting point? I was thinking that you could structure it in terms of "if you want to X, you write Y" so "if you want to free, you need an Alloc token", or "if you want to do pointer arithmetic, you need allocs bounds" (I'm happy to help out with alloc* and pointer related things because that's all memory model things I need to write that at some point anyways). |
Yes, this might be a good starting point / case study. I guess it belongs
in the section on arrays. (I need to do some more work on understanding
it!)
|
How about starting with the structure of a predicate like in tutorials developers are used to, like: https://www.geeksforgeeks.org/python-functions/ So using the predicate example from the tutorial, predicate { u32 P, u32 Q } BothOwned (pointer p, pointer q), seems you start with the 'predicate' keyword, and then return type is ??? and parameters are ??, with the function name in the middle. And then for the body, why don't you need requires/ensures, while still using take? And then some info on where can you call predicates? Only in requires/ensures/loop invariants? |
Also, more examples for tricky cases would be appreciated. Especially for being able to declare variable-length arrays, which I know is possible with predicates but I can't get working. Thanks! |
@lwli11 says
rems-project/cerberus#848 (comment)
The text was updated successfully, but these errors were encountered: