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

Canonical recursive #432

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Canonical recursive #432

wants to merge 4 commits into from

Conversation

IgnaceBleukx
Copy link
Collaborator

Made canonical comparison fully recursive.
This covers some dangling edge cases I found such as having a sum with only one argument.
Also cleaned up the code a bit : )

@IgnaceBleukx
Copy link
Collaborator Author

After discussing offline: an alternative can be to merge this code into simplify_bool which would then become simplify.
Hard-ish part will be to ensure we do not run simplify again after flattening.
E.g., the constraint max(a + b, c,d) != 10 will be flattened to max(IV0,c,d) != 10 & a + b == IV0. Thereby introducing a non-canonical comparison...

@Wout4
Copy link
Collaborator

Wout4 commented Nov 8, 2023

do we want to cover division as well? I guess it would make sense to do.


if lhs.name == "sum":
lhs_weights = [1]*len(lhs.args) + extra_weights
Copy link
Collaborator

Choose a reason for hiding this comment

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

extra_weights will not be defined if the rhs is an operator other than sum or wsum (like div or mul or whatever)

@IgnaceBleukx IgnaceBleukx mentioned this pull request Nov 30, 2023
@IgnaceBleukx IgnaceBleukx mentioned this pull request Dec 11, 2023
@Wout4 Wout4 marked this pull request as draft January 31, 2024 10:07
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