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

@acrule only uses associativity-commutativity on the top-level operand #586

Open
Alseidon opened this issue Mar 13, 2024 · 0 comments
Open

Comments

@Alseidon
Copy link

Alseidon commented Mar 13, 2024

Prompted by this discussion

When using @acrule, I can't "propagate" AC to operands other than the toplevel one. In the example below, a correct factorisation rewriter would be Rewriters.Chain([factor, factor2, factor3]) where I would expect to only have to write the first rule. Maybe there is a way to circumvent this though?

using SymbolicUtils

@syms a b c
expr = a*b + b*c

factor = @acrule +(~x*~y, ~x*~z) => *(~x, ~y+~z)
factor2 = @acrule +(~y*~x, ~z*~x) => *(~x, ~y+~z)

factor(expr) # nothing
factor2(expr) # nothing

factor3 = @acrule +(~x*~y, ~z*~x) => *(~x, ~y+~z)
factor3(expr) # b*(a+c)
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

No branches or pull requests

1 participant