Question: define shows unexpected behavoir

I'm trying to use define but get unexpected behavior. Say I want to declare that the map phi is additive. I would try this

define('phi',phi(x::`+`)=map(phi,x));

But if I do phi(x+y) now, I get a warning about an infinite recursion. I get an indication of what the problem is if I define instead

define('phi',phi(x::`+`)=op(x));

Now phi(x+y) produces "x+y" rather than "x,y", so somehow the sum is considered atomic. Can somebody explain this to me?

In fact, I want phi to be linear in the end, so you might wonder why I don't just use the keyword 'linear'. The short answer is, I want to understand what's going on in the example above. The long answer is, I also want phi to map a certain element sigma to itself. But if I define

define('phi','linear',phi(sigma)=sigma);

Then phi(x*sigma) does not reduce to phi(x)*sigma and neither does it with

define('phi','linear',phi(x::name sigma)=phi(x) sigma);

So, if somebody can explain this to me, I'm gratefull, too.

Finally, here is another surprise. After

define('sigma',sigma^3=Z);

entering sigma^3 produces sigma^3, not Z.

Please Wait...