3128: Sum / Product Simplification.

Attempt to fix issue 3128.

Some of the simplification proposed in the issue is hooked to `simplify()`. And others are implemented as helper functions separately. Functions which have been implemented separately are,

* `change_index()` --> for changing index variable (inverting and shifting)
* `reorder()` --> reorder the indexes
* `reverse_order()` --> reversing the limits of an index