Ask Your Question

Revision history [back]


Your question is not very well defined. The variables x and y may be anything (even if you think of them as integer or real number). They may be substituted with a complex number, a function, a matrix, ... anything. Preserving the truth of an expression involving undefined quantities is just impossible. Even the mathematical meaning of such an expression is not very well defined. Moreover, you don't want that multiplication preserves trueness as

sage: print bool(5), bool(0), bool(5*0)
True False False

You may have a look at the code for the multiplication of symbolic expression sage.symbolic.expression.Expression._mul_ (note that you can not access this method through the reference manual). For that method, the documentation says almost nothing except some examples which contain

# multiplying relational expressions
sage: ( (x+y) > x ) * ( x > y )
(x + y)*x > x*y

sage: ( (x+y) > x ) * x
(x + y)*x > x^2

sage: ( (x+y) > x ) * -1
-x - y > -x

The second line is particularly interesting with respect to your question. What would you like as a result of the following operation ?

sage: x,y,z
sage: (x + 3 < y - 2) * z