-
Notifications
You must be signed in to change notification settings - Fork 52
theory of pointers is inconsistent #39
Comments
thanks for the report! tl;dr: "theory != something" is confusing, dont use it. instead remove state by not putting it into the model unfortunately type state is difficult to understand because the implementation is not good. in your case
is because the model of close is !is_open(), which conflicts with its previous state of is_open. type state is lost after each mutable self call, because transferring it implicitly would be messy.
|
Ah I understand now, thanks. I assumed that once I'll keep plugging away then 😄 |
Hmm, I'm still not sure about this. I removed the
This would indicate that after calling close, the compiler still considers |
that sounds like a bug |
well technically its sort of a bug, but unfortunately not one that i can fix quickly because its an effect of how pointers are treated as values. the pointer never changes, so its temporal doesnt change, so the state effects never apply. however you can easily just ignore the whole problem by not using pointers in theories
|
I tried something like that (but without the extra
|
So that works (including compiling as expected when the order of read and close) 👍 |
@aep is this issue valid or a bug or? |
I'd say it's a documentation issue. Type state can get confusing quickly, so it needs to be more clear what the limits are. |
I tried to build an example program with the snippet from README.md which uses
theory
for typestate enumeration / sequencing. However, I ran into syntax errors immediately, indicating that the syntax oftheory
has changed a bit recently.So I looked at a working example in the
typestate_wrong_order
test, which compiles fine. I tried to simplify it to be more like the README example, using a straightint
instead of astruct Socket { int fd }
.However, I've gotten stuck at either
expected int* got int
orstatic_attest leads to conflicting constraints
.Here's what I have right now:
I was also unable to compile the
new+
example of creating a string with a tail object.To be honest, I only ever learned enough C to be extremely dangerous, and am quite unfamiliar with theorem provers (outside of a little excursion into Idris which was interesting but impractical).
It might be a good time to refresh the docs to make it easier for people to get started playing with zz? I'd love to help, but I'm still struggling with the basics 😓
The text was updated successfully, but these errors were encountered: