I'm stuck on trying to define simplification rules for NonCommutativeMultiply, much like ExpandNCM found in Documentation Center, under Applications.
For example, I'd like
1**x = x,
x**1 = x,
x**(1/x) = (1/x)**x = 1, i.e., I'd like to write rules that would mimic those of multiplication in non-commutative unital ring.
I'm not looking for code (although I wouldn't object if someone would provide one), but for reference where I can learn to write such things myself. My knowledge of Mathematica is basic, I know how to write simple functions, and would like to learn how to write functions using pattern matching.
More generally, I'm interested to know how one could write operation like NonCommutativeMultiply from scratch, that is how could one mimic associativity:
(x**y)**z == x**(y**z).