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

ExprKind::NeverToAny => Term::Absurd => Invalid Why3 #972

Open
dewert99 opened this issue Mar 15, 2024 · 5 comments
Open

ExprKind::NeverToAny => Term::Absurd => Invalid Why3 #972

dewert99 opened this issue Mar 15, 2024 · 5 comments

Comments

@dewert99
Copy link
Collaborator

When running CI for the Prusti translation I noticed that absurd seem to no longer be valid Why3, but it still can get generated from the THIR never to any expression eg.

#[ensures(match x {Some(x) => x, None => true})]
//                            ^ x is implicitly cast from ! to bool, which generates ExprKind::NeverToAny
fn test(x: Option<!>) {}
@xldenis
Copy link
Collaborator

xldenis commented Mar 16, 2024

absurd was never valid in why's logic but we can provide an encoding for the purposes of verification in vcgen, it should work the same way as the `let functions did before.

Something like absurd = assert(false); any

@dewert99
Copy link
Collaborator Author

I don't think this has to do with vcgen since the error is from a pre-condition I mentioned you in a comment on the Why3 line giving the error.

@xldenis
Copy link
Collaborator

xldenis commented Mar 17, 2024

Hmmm, yea but that's still incorrect in why3; we should generate false instead I think. Just need to thin through the consequences of that typing rule...

@jhjourdan
Copy link
Collaborator

I don't think we should generated false here. This does not generalizes to all types. We should really generate any or something alike. If it's on a piece of code which is not handled by the VCGen (like here), then we won't check this is dead code, but at least we would generate an unpredictable value of the right type.

@xldenis
Copy link
Collaborator

xldenis commented Mar 18, 2024

Yea that's better than false but the point is: it's fixable

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

No branches or pull requests

3 participants