-
Notifications
You must be signed in to change notification settings - Fork 33
Flatten Variable Derivation Chains #137
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
base: main
Are you sure you want to change the base?
Conversation
|
So the example would look like: |
|
I'm just not super sure about this because it will have more disconnect from code right? That expression probably came from code like: int y = 3;
int z = y;
@Refinement(...)
int x = -z *2;If we are say that Now, if you are mentioning flattening variable instances for the same variable like |
|
You're right. Let me try only flattening variable instances for the same variable. |
|
I think Catarina raises an interesting point, but with tens of variables, I'm not sure I would want to play "connect the dots" with all variables. In some cases, I want it all collapsed (to see that I am accessing out of bounds), and in other cases I would want (as Catarina) the connection to the variables in the code first and front. We might need to write some more real-world examples to decide the best default behavior, but in principle, I like that we are able to simplify as most as possible, but then expand to connect to the source code. |
|
Yeah maybe with very large programs it becomes useful, but for debugging it will be a pain to understand where each predicate is created. I think most examples we have are rather small but we can try creating some bigger ones to test it on |
This PR improves the simplification for expressions by flattening variable derivation chains to avoid redundancy.
When a variable's origin is the same variable instance (e.g.,
#y_3=>#y_2), we collapse the chain to use the final node directly, eliminating redundant nestedVarDerivationNodesin the derivation tree.Example
Before
After