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

Support for new expression asserting a in e #531

Merged
merged 2 commits into from
Nov 13, 2024
Merged

Conversation

marcoeilers
Copy link
Contributor

Adds support for evaluating the new expression type asserting (a) in e added in viperproject/silver#814.

Based on @dewert99's implementation in PR #455, but instead of killing the branch the assertion is checked in, this PR does it in the same branch. The reasoning behind that change is that one can use the assertion in an asserting expression to create triggering terms that will then be around when evaluating the expression.

@gauravpartha
Copy link
Contributor

gauravpartha commented Oct 28, 2024

Thanks for the PR.

A question on asserting A in e in specifications:

method m(x: Int)
  requires asserting x > 0 in true
  ensures true

Since the precondition is not well-defined according to the current PR is it intended that Viper returns a "specification is not well-formed" error here?

@viper-admin
Copy link
Member

Yes, I think that's what you should get. I think it should be analogous to when you have an unfolding in a spec but might not have the predicate.
(Though you need to put parentheses around the x > 0).

Copy link
Contributor

@gauravpartha gauravpartha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

The only thing that one might want to change is to potentially rename definednessStateOpt in methods of DefinednessComponent (which represents the state in which permissions to reads of heap locations and predicates for unfoldings should be checked during an exhale). The reason is that with asserting A in e it's even more obvious that there are different states in which one performs definedness checks.

@marcoeilers marcoeilers merged commit 0fe38f7 into master Nov 13, 2024
1 check passed
@marcoeilers marcoeilers deleted the meilers_asserting branch November 13, 2024 16:23
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.

3 participants