# Products in a free algebra.

If I have a free algebra generated by x and y is there a way to tell that x*y is a product of x and y? I would like to define a function that takes products x*y and returns -2*x - 2*y - 4.