-
Notifications
You must be signed in to change notification settings - Fork 50
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
Self referential types and non-strictly-positive occurrences #1146
Comments
Hi! We'll take a look and see what we can come up with, this sounds familiar, but I'm not sure if we have a good solution, this sounds quite familiar to: https://gitlab.inria.fr/why3/why3/-/issues/710 |
Actually, in this case, we could plainly ignore recursion through |
What would you propose as the alternative encoding of this type? and the mechanism to achieve it? |
I guess we could include a |
All right, I was mistaken: we should not ignore recursion through And it seems like we indeed use Now let's come back to our problem here: in order to accept this definition, we would need to annotate parameters of trusted types with an attribute telling whether this parameter is used in a strictly positive way in this type. Once this is done, we would need to do something similar in Why3, which is non-trivial. But anyway, now that I think about it, I have to say that this type definition is a bit weird: why do you have a token in each tree node? This allows duplicated children for one node, but disallow more involved subtree sharing. This seems to be somewhat half-way between a native definition using |
About the representation: In viper, I use predicates to reason about the ownership of direct children. Example. At every node, I can conclude that only the current node holds the permissions to its children. Secondly, with an axiom like for every pair of GhostPtrTokens, their models do not share a pointer, I can show that there are no cycles in this tree. In the end, I am trying to emulate the behavior of viper predicates with permissions and separating conjunctions using GhostPtrToken. The sea-of-nodes approach: I typically use this for graphs but a single token for the entire tree makes it hard to prove the absence of cycles based on my attempts so far. The simple definition using direct Box'd children works too, but this is not sufficient to prove the functional properties I'm looking for. |
What are these? I don't see how such a representation can allow proving more properties than the approach based on The only reason I can see you would need such a definition is that children can be shared. But it seems weird to allow sharing of children but not of subtrees in general. |
My goal is to use GhostPtrToken specifically to translate separation logic proofs in viper into creusot. That also means translating the functional specs using viper permissions into creusot specs almost mechanically. The Tree example is just an attempt at that. I'm not sharing any child nodes in the same parent node. Ignoring the why of what I'm trying to do, I think the what in the original issue still has merit. Rephrasing my problem more abstractly, can I hold a GhostPtrToken in T, as long as I show that the holder is not managed by this token? |
Hello! I'm trying a permissions-ish representation for a tree data structure using GhostPtrToken.
I get the error from creusot (I built the latest commit)
I vaguely remember seeing this before but I forget what the workaround was. Any input appreciated :)
Thanks!
The text was updated successfully, but these errors were encountered: