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

rewrite each does not require equality #110

Open
mtzguido opened this issue Jun 24, 2024 · 1 comment
Open

rewrite each does not require equality #110

mtzguido opened this issue Jun 24, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@mtzguido
Copy link
Member

I was surprised by this second test succeeding, since it is just replacing i by j in the context and proving the equality between the resources (so foo i == foo j). But I would have expected that we check i == j. Doing that could also make the implementation of rewrite each more efficient, as it would involve a single query (instead of one per resource pair).

assume val foo : int -> vprop

```pulse
fn test1 (i j : int)
requires foo i ** pure (foo i == foo j)
ensures  foo j
{
  rewrite foo i as foo j;
}
```

```pulse
fn test2 (i j : int)
requires foo i ** pure (foo i == foo j)
ensures  foo j
{
  rewrite each i as j;
}
```

Calling this a bug, even though according to the documentation this is expected behavior (paraphrasing: "rewrite each e1 as e1' is equivalent to rewrite goal as goal' where goal' is computed by rewriting, in parallel, every occurrence of ei as ei' in goal.").

@mtzguido mtzguido added the question Further information is requested label Jun 26, 2024
@mtzguido mtzguido self-assigned this Sep 4, 2024
mtzguido added a commit to mtzguido/pulse that referenced this issue Sep 9, 2024
@mtzguido
Copy link
Member Author

We agreed this is a quirk and should be changed. We may consider a construct to retain the old behavior, but the usual intention is that the equality is proven once and then substituted.

@mtzguido mtzguido added bug Something isn't working and removed question Further information is requested labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant