Skip to content
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

Include definedness checks during exhale #457

Merged
merged 33 commits into from
Apr 25, 2023
Merged

Conversation

gauravpartha
Copy link
Contributor

Previously, the encoding for exhale A first checked well-definedness of A and in a second step performed the actual exhale. This approach is flawed, because (1) well-definedness of A depends on the actual exhale in the general case and (2) in cases where the exhale fails, the reported errors are not the expected ones. See #406 for examples illustrating these two problems.

This PR implements an exhale implementation, which (if enabled) does the well-definedness checks during the exhale (as we already do with inhale).

This will allow one to be able to be able to do permission definendess checks in a different state than the standard evaluation state.
…permission checks

The setDefState field in DefinednessState is now mutable such that when unfolding one can change the definedness state (assuming there is a separate definedness state). An alternative would be to keep the same definedness state during an unfolding statement but to then explicitly reset this state via a Boogie statement at the end of an unfolding. Since Boogie performs constant propagation the resulting VC should essentially be the same for both approaches. The currently implemented approach is more in-line with the way encoding is currently handled, where new states are constructed instead of reusing previous states.
…nedness check)

o special treatment for permission introspection since permission introspection within unfoldings still needs to be explored properly
…nedness state. As a result, we can remove the predicate in this state (but do not check whether it is there, because in this mode well-definedness is assumed; analogous to inhale).
… exhale

this check should not be required, but I add it as a sanity check
@gauravpartha
Copy link
Contributor Author

gauravpartha commented Apr 25, 2023

One aspect that this PR does not resolve and that should be handled in another PR is when one of the following two cases occur during an exhale:

  • Permission introspection is used in function call arguments
  • Permission introspection is used in the predicate arguments of an unfolding expression

The expected behavior is to evaluate those occurrences of permission introspection in the evaluation permission mask, that is, the mask which the exhale modifies when permissions are removed. Currently, these occurrences are evaluated in the well-definedness permission mask, that is, the permission mask right before the exhale.

The code contains FIXME annotations for these two instances. One solution is to evaluate the arguments before checking the precondition of a function call or before executing an unfolding expressions, similarly to how method calls are currently encoded. Ideally, one would write code that could be reused by all three instances (method call encoding, function call encoding, unfolding encoding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant