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

Loop scope rule uses variables outside the name space #3158

Closed
mattulbrich opened this issue Jun 5, 2023 · 1 comment · Fixed by #3224
Closed

Loop scope rule uses variables outside the name space #3158

mattulbrich opened this issue Jun 5, 2023 · 1 comment · Fixed by #3224

Comments

@mattulbrich
Copy link
Member

Description

The loop scope invariant rule introduces variables (usually called h and a that are not within the namespace of the current goal).

In some cases this may even lead to two variables of the same name, but with different types on the sequent.

Reproducible

always

Steps to reproduce

  1. Load the sum and max example from the example browser..
  2. In the proof search strategy set "Loop treatment" to "none".
  3. Set "Arithmetic treatment" to "basic".
  4. Push the green arrow button
  5. On the one open goal apply the rule "loopScopeInvDia".
  6. Navigate to the 2nd open goal

Two things are bad now:

  • There is an update h := heap, but you cannot perform a cut h = h because h is an unknown name.
  • There is an update a := _a.length - k assigning an int value to a. However, a is the parameter of the method and an int[] variable.

The rule fails to register the assigned variables in the goal context (in other rules that usually happens by declaring the new names within modalities).

Additional information

Discovered, since this is a deal breaker for research on a scripting engine.


@mattulbrich
Copy link
Member Author

Another related problem with the loop scope rule is that it introduces conflicting location variables with the same name.

  1. Load Binary Search and press autoplay.
  2. Have a look at node 125 (invariant preserved and used)

It contains two variables called a. One of type any (introduced to store the variant) and one of type int[] which is the array to be searched.

Here a screenshot indicating the problem:
image

on 0ac6d7f

@unp1 unp1 linked a pull request Jul 26, 2023 that will close this issue
github-merge-queue bot pushed a commit that referenced this issue Oct 13, 2023
Fix for issue #3158
- The program variable replacer also needs to consider lefthandside's of
elementary updates
- Avoid collisions with names occurring in the namespace (and not only
inside programs)
- Introduce new program variables properly in loop invariant rules
- Minor clean ups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants