Skip to content

proc change: well-formed goals when introducing fresh locals#1040

Open
strub wants to merge 1 commit into
mainfrom
fix-1026
Open

proc change: well-formed goals when introducing fresh locals#1040
strub wants to merge 1 commit into
mainfrom
fix-1026

Conversation

@strub

@strub strub commented Jun 10, 2026

Copy link
Copy Markdown
Member

Closes #1026.

When proc change bound new local variables, both generated subgoals
were ill-formed: the local-equivalence goal carried the fresh local in
the memtype of the original (un-replaced) fragment, and the continuation
goal rewrote the side to a statement using the fresh local while keeping
the un-extended memtype, leaving a program that referenced a variable
absent from its memory type.

Thread the extended memtype to the side that runs the replacement: in
the local-equivalence goal it goes on the right (the new fragment) while
the left keeps the original memtype; in the continuation goal it goes on
the rewritten side. hl_set_stmt gains an optional ?mt to override the
active side's memtype.

When `proc change` bound new local variables, both generated subgoals
were ill-formed: the local-equivalence goal carried the fresh local in
the memtype of the original (un-replaced) fragment, and the continuation
goal rewrote the side to a statement using the fresh local while keeping
the un-extended memtype, leaving a program that referenced a variable
absent from its memory type.

Thread the extended memtype to the side that runs the replacement: in
the local-equivalence goal it goes on the right (the new fragment) while
the left keeps the original memtype; in the continuation goal it goes on
the rewritten side. `hl_set_stmt` gains an optional `?mt` to override the
active side's memtype.
@strub strub requested review from Gustavo2622 and fdupress June 10, 2026 11:22
@strub strub self-assigned this Jun 10, 2026
@strub strub added the bug label Jun 10, 2026

@fdupress fdupress left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add unit tests for the memtype-changing variants of proc change?

This does fix the problem also in the context of my broader proof, so the fix is verified for me.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

proc change produces ill-formed goals when introducing new local variables (memory type)

2 participants