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

Add refutation support #583

Merged
merged 7 commits into from
Jun 30, 2022
Merged

Add refutation support #583

merged 7 commits into from
Jun 30, 2022

Conversation

JonasAlaif
Copy link
Contributor

@JonasAlaif JonasAlaif commented Jun 2, 2022

Adds a refute expr statement, which is an assert expr with errors inverted and without assuming anything in the following statements (an assert expr assumes expr afterwards). That is, a refute expr does not report an error iff an assert expr would. Note that this is not the same as assert !expr since both asserts fail in the following snippet:

var b: Bool
if (*) { assert b }
else { assert !b }

One useful application is to check reachability (e.g. for identifying dead code) since all assertions pass in unreachable code (i.e. refute false will only error in dead code).

To workaround Silicon's numberOfErrorsToReport limit, this PR also adds an ExpectFail info tag to be used on assertions which should not be counted towards the limit (see linked Silicon PR).

  • Decide if ExpectFail should be an abstract class instead
  • Decide if ⭐ is a good name for a non-deterministic local variable, avoiding clashes
  • Add more tests

Copy link
Contributor

@mschwerhoff mschwerhoff 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, mostly a few minor comments.

Copy link
Contributor

@mschwerhoff mschwerhoff 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, modulo a few minor comments

src/main/scala/viper/silver/ast/Ast.scala Outdated Show resolved Hide resolved
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