dreal/dreal4

An issue on multiplication by (-1) for Expressions

Opened this issue · 2 comments

Hi,

I encountered a severe problem when (right) multiplying the dreal expressions with (-1). When I right multiply an expression by dreal.Expression(-1) or simply (-1), it modifies the original expression incorrectly. Specifically, the original expression retains only the first term after the operation. Below is a minimal code example and its output:

import dreal

x1 = dreal.Variable("x1")
a = -0.5 + x1 - x1**2
b = a * dreal.Expression(-1)
print(a)

Output:

-0.5

The multiplication operation modifies the original expression a. When the expression multiplies (-1) with (-1) on the left, i.e., dreal.Expression(-1)*a, there was no such an issue.

Thanks.

Thanks for the report. I think there is an issue in its Python binding. I'll take a look.

Thanks a lot!