Assumptions giving wrong boolean answer for simple expression

asked 2023-01-15 17:15:53 +0100

narodnik gravatar image

Let $a, b \in \mathbb{Z}$ with $a < 0$, then we can plainly see that $a b^2 = 0 \implies b = 0$ since $\mathbb{Z}$ is an integral domain.

sage: var("a b")
(a, b)
sage: assumptions()
[]
sage: assume(a, "integer")
sage: assume(b, "integer")
sage: assume(b^2 == 0)
sage: bool(b == 0)
True

But as soon as I introduce another non-zero variable in the expression, it cannot detect b is 0.

sage: var("a b")
(a, b)
sage: assumptions()
[]
sage: assume(a, "integer")
sage: assume(b, "integer")
sage: assume(a < 0)
sage: a != 0
a != 0
sage: bool(a != 0)
True
sage: assume(a*b^2 == 0)
sage: bool(b == 0)
False
edit retag flag offensive close merge delete

Comments

bool(b != 0) also evaluates to False. Perhaps, Sage cannot do much deductions from the given assumptions. If you deal with polynomial (in)equalities, you'd better employ specialized machinery such as QEPCAD.

Max Alekseyev gravatar imageMax Alekseyev ( 2023-01-15 18:07:59 +0100 )edit