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

Function body is not available while checking the well-formedness of the postcondition #624

Open
pieter-bos opened this issue Jun 29, 2022 · 2 comments

Comments

@pieter-bos
Copy link
Contributor

Contrary to carbon, it seems the function body/result is not available when establishing the well-formedness of the postcondition:

function require_true(x: Bool): Bool
requires x
{ x }

function f(): Bool
ensures require_true(result)
{ true }

reports:

Silicon found 1 error in 2.27s:
  [0] Precondition of function require_true might not hold. Assertion result might not hold. (funcax.vpr@6.9--6.29)

carbon finished verification successfully in 1.65s.

Of course there is something to be said for requiring contracts to be self-framing, but I am wondering about the difference with carbon :)

@mschwerhoff
Copy link
Contributor

Interesting catch :-) I have the vague feeling this was observed before, and we concluded it's an incompleteness.

@marcoeilers
Copy link
Contributor

I would consider this intentional behavior, especially now that Viper has opaque functions, which means that for individual function applications, the function body may not be known to the verifier. In that case, the postcondition will still be assumed and IMO should still be well-defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants