JuliaSymbolics / Metatheory.jl

Makes Julia reason with equations. General purpose metaprogramming, symbolic computation and algebraic equational reasoning library for the Julia programming language: E-Graphs & equality saturation, term rewriting and more.
https://juliasymbolics.github.io/Metatheory.jl/dev/
MIT License
362 stars 47 forks source link

Conditions involving more than one variable #151

Open jariji opened 1 year ago

jariji commented 1 year ago

Is there a way I can put conditions on the relationship between variables?

@rule x y (x < y) x - y --> 0
kylebd99 commented 1 year ago

Not sure if this is still helpful, but I think that this is a good use case for the where predicate. It allows you to insert a general boolean function of the arguments. For example, this rule would look like:

@rule x y   x - y --> 0  where (x < y)

However, you will want to be careful about types and making sure that all of the arguments work in your boolean function, e.g. sometimes the arguments will be EClasses.

gkronber commented 4 weeks ago

Related to #246