Say I have an expression involving adds, subtractions, and multiplications. I know that it is safe to assume commutativity, associativity, distributivity, etc., and would like to automatically generate a simpler expression which involves fewer operations. All interesting variants of this problem are NP complete, but are there existing tools or algorithms which work well in practice?
As a baseline, currently I am using Mathematica's FullSimplify command and then running common subexpression elimination on the result. Unfortunately, the result isn't even minimal (it misses obvious distributive law simplifications), and it'd be nicer to have a tool which works on DAGs natively.