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