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

Separating definitions and other assumptions to fix a wand-related unsoundness #757

Merged
merged 7 commits into from
Oct 16, 2023

Conversation

marcoeilers
Copy link
Contributor

@marcoeilers marcoeilers commented Oct 10, 2023

This PR extends Silicon's path condition stacks to differentiate between general assumptions and assumptions that represent definitions. For the latter, the new method assumeDefinition is introduced.
The purpose of this distinction is to fix the unsoundness described in issue #338, which was previously already partly addressed and made much more difficult to trigger by @mschwerhoff.

Now, after packaging a wand, instead of performing a smoke check to see if assumptions from producing a wand left us in an inconsistent state and only remembering path conditions if this is not the case (this was the previous workaround, but it does not prevent us from unsoundly assuming properties other than false), we can omit the smoke check and always assume only the definitions, but no other path conditions.

The previous implementation unsoundly verified the following example:

function otherFunc(s: Seq[Int], i: Int): Bool
    requires |s| > 1
{ true }

method foo(x: Ref, y: Ref, s: Seq[Int], i: Int)
{
    package (|s| > 3 ? (i > 1 && i < |s| - 2 && otherFunc(s, i)) : (i > 1 && i < |s| - 2))  --* true {
    }
    //:: ExpectedOutput(assert.failed:assertion.false)
    assert |s| > 0
}

@marcoeilers
Copy link
Contributor Author

marcoeilers commented Oct 12, 2023

@mschwerhoff Do you think this makes sense the way I did it?

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 to me. Thanks for addressing this long-standing issue!

@marcoeilers marcoeilers merged commit a234555 into master Oct 16, 2023
4 checks passed
@marcoeilers marcoeilers deleted the meilers_wand_fix_attempt branch October 16, 2023 11:54
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.

None yet

2 participants