Better product reducer.

Simplify had difficulties with terms like (a * c) * a * (b * c * d). Those
difficulties are solved now by a new algorithm which linearizes products
(similar like we do when we factor out); It transforms the term above to list of
factors [a,c,a,b,c,d], sorts them [a,a,b,c,c,d], groups the result
[[a,a],[b],[c,c],[d]] and then applies a function which transforms such lists of
same elements to powers [a^2,b,c^2,d]. Finally, listToProd converts this list
back to a product.