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

Resources are not allowed in \unfolding #776

Open
bobismijnnaam opened this issue Sep 7, 2022 · 2 comments
Open

Resources are not allowed in \unfolding #776

bobismijnnaam opened this issue Sep 7, 2022 · 2 comments
Labels
A-Bug B-Viper Backend: Silicon and Carbon R Rewriting problem

Comments

@bobismijnnaam
Copy link
Contributor

The following code:

resource x() = true;
requires x() ** x();
requires \unfolding x() \in x();
void m();

Gives the following error on the ast branch:

[ERROR] Viper has crashed: java.lang.RuntimeException: Unexpected expression acc(x(), write) cannot be symbolically evaluated

A similar program in viper also gives the error that you cannot have an impure expression in an unfolding expression. VerCors should probably disallow this and prevent it in the typechecking phase. Alternatively we can ask the viper team if this is a bug or if it can be extended to allow resources inside unfolding.

@pieter-bos
Copy link
Member

pieter-bos commented Sep 7, 2022

Seems to me there are reasonable cases where you would want this:

class C2 {
  resource p() = Perm(x, write) ** Perm(y, write);
  int x;
  int y;
}

class C1 {
  resource p() = Perm(x, write) ** Perm(y, write) ** Perm(z, write);
  int x;
  int y;
  C2 z;

  //@ requires p() ** \unfolding p() \in z.p();
  void test();
}

Although in this case sensible alternatives might be making the predicates inline, or making C1 own C2 by including z.p() in C1.p. If you were thinking of different scenarios please include them.

@pieter-bos
Copy link
Member

Related: viperproject/silver#606

@pieter-bos pieter-bos added A-Bug B-Silicon Backend: Silicon R Rewriting problem labels Sep 28, 2022
@pieter-bos pieter-bos added B-Viper Backend: Silicon and Carbon and removed B-Silicon Backend: Silicon labels Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Bug B-Viper Backend: Silicon and Carbon R Rewriting problem
Projects
None yet
Development

No branches or pull requests

2 participants