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

Perm under inhale-exhale expression handled differently by Silicon vs. Carbon #808

Open
mschwerhoff opened this issue Jul 1, 2024 · 0 comments

Comments

@mschwerhoff
Copy link
Contributor

mschwerhoff commented Jul 1, 2024

While playing with a forall-introduction lemma, I noticed that Silicon and Carbon handle perm() nested inside inhale-exhale expressions differently:

field f: Int

function foo(x: Ref, p: Perm): Bool
  requires p > none
  requires acc(x.f, p)

method lemma_forall_intro()
  ensures [forall y: Ref :: perm(y.f) > none ==> foo(y, write), true]
    // Silicon: Rejected as illformed
    // Carbon: Not rejected

method test0() {
  var a: Ref

  inhale acc(a.f, 1/2)
  lemma_forall_intro()
  assert perm(a.f) > none ==> foo(a, write)
    // Silicon: OK
    // Carbon: Fails with insufficient permission
}

method test1() {
  var a: Ref

  inhale acc(a.f, 1/2)
  lemma_forall_intro()
  assert perm(a.f) > none ==> foo(a, 1/2)
    // Silicon: OK
    // Carbon: Fails with "might not hold"
}

method test2() {
  var a: Ref

  inhale acc(a.f, write) 
  lemma_forall_intro()
  assert perm(a.f) > none ==> foo(a, write)
    // Silicon: Fails with "might not hold"
    // Carbon: OK
}
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

1 participant