I've always thought it would be cool to have a language where functions were tagged as distributive, associative, symmetric/commutative, and monotonic and the optimizer (and editor!) used these properties to determine optimizations or simplifications. Note that this would be for all expressions, not just arithmetical ones.
I vaguely recall hearing about some fancy C++ template based techniques for accomplishing this, actually, but haven't looked into it.