Skip to content

rewrite each: make sure to normalize/unfold each side #417

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mtzguido
Copy link
Member

@mtzguido mtzguido commented Jul 3, 2025

This fixes the attached test case, where we try to rewrite every bar in the context into baz, but since bar is unfold, it will never appear as such, making the rewrite do nothing.

This happens pretty often for operators like SizeT.(+), which is just defined as SizeT.add, with an unfold qualifier. Without this patch, one cannot use these operators in the LHS of a rewrite and must use the underlying names.

This fixes the attached test case, where we try to rewrite every `bar`
in the context into `baz`, but since `bar` is unfold, it will never
appear as such, making the rewrite do nothing.

This happens pretty often for operators like `SizeT.(+)`, which is just
defined as `SizeT.add`, with an unfold qualifier. Without this patch,
one cannot use these operators in the LHS of a rewrite and must use the
underlying names.
@gebner
Copy link
Contributor

gebner commented Jul 3, 2025

BTW, do you think we should change normalize_slprop to use the new rewrites_to substitution by default?

fn foo (x: ref (ref int))
  preserves exists* (y: ref int) z. (x |-> y) ** (y |-> z)
{
  let z = ! !x;
  rewrite each z as id z; // no-op now, but would work with this PR and that change
}

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

Successfully merging this pull request may close these issues.

2 participants