Skip to content

Smoke Detection Plugin#762

Merged
bruggerl merged 4 commits into
masterfrom
lbrugger_smoke
Jan 8, 2024
Merged

Smoke Detection Plugin#762
bruggerl merged 4 commits into
masterfrom
lbrugger_smoke

Conversation

@bruggerl

@bruggerl bruggerl commented Jan 3, 2024

Copy link
Copy Markdown
Contributor

Adds the option to automatically detect contradictions in specifications (we call this smoke detection), which lead to the verifier being able to prove anything (even false). This is done by inserting refute false at various locations in the code; if one of them fails, the specification is unsound. More specifically, these refute statements are added

  • at the end of each method body (to catch unsatisfiable preconditions),
  • at the end of each loop body,
  • at the end of each if/else body,
  • before each goto statement and
  • after each assume and inhale statement (for more fine-grained error reporting; in theory, this would not be necessary).

In order to avoid false positives, this pull request also introduces the unreachable statement, which is used to mark pieces of code as not reachable. As a result, no refute false statements are inserted inside of an unreachable branch. To illustrate the problem, consider the following example:

method test(a: Bool)
    requires a
{
    if (!a)
    {
        assume false
    }
}

Here, the smoke detection plugin would raise an error because false can be proven inside of the body of the if statement. However, since the precondition requires that a is true, the body of the if statement is not reachable. Hence, in order to avoid getting the error, one can add an unreachable statement inside of the if branch:

method test(a: Bool)
    requires a
{
    if (!a)
    {
        unreachable
        assume false
    }
}

The unreachable statement marks the current branch in the control flow as not reachable. This holds until the next join point - in this case, until the end of the body of the if branch. When verifying this example with smoke detection enabled, the plugin reports no errors.

Smoke detection is disabled by default and can be enabled by providing the option --enableSmokeDetection.

@bruggerl bruggerl requested a review from marcoeilers January 3, 2024 16:46

@marcoeilers marcoeilers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have one major comment or question and a bunch of smaller suggestions.

Comment thread src/main/scala/viper/silver/frontend/SilFrontEndConfig.scala Outdated
Comment thread src/main/scala/viper/silver/frontend/SilFrontend.scala Outdated
Comment thread src/main/scala/viper/silver/plugin/standard/refute/RefuteErrors.scala Outdated
Comment thread src/main/scala/viper/silver/plugin/standard/smoke/SmokeDetectionPlugin.scala Outdated
Comment thread src/main/scala/viper/silver/plugin/standard/smoke/SmokeDetectionPlugin.scala Outdated
Comment thread src/main/scala/viper/silver/plugin/standard/smoke/SmokeDetectionPlugin.scala Outdated
Comment thread src/test/resources/smoke/axiom.vpr Outdated
Comment thread src/test/resources/smoke/method.vpr
@bruggerl bruggerl requested a review from marcoeilers January 4, 2024 16:17
@bruggerl bruggerl merged commit 3e164c8 into master Jan 8, 2024
@bruggerl bruggerl deleted the lbrugger_smoke branch January 8, 2024 15:16
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.

2 participants