Question: Is "MultiSet" reliable?

Something really weird is going on when I build a MultiSet in two different ways, using the "+" operation.  The two constructions give the same MultiSet (since U=V), but in some mysterious way they are not really equal (since X=Y is false).  Does anyone know how to avoid this?  Should the "+" operator be avoided altogether?

There is more:  I tried saving the values of X and Y using the command:  save X, Y, "anomaly.m" 

When I tried reading it with the command:  read "anomaly.m"
I got the error message:  "Error, could not open `anomaly.m` for reading".

Thanks!
 

restart

 

U := MultiSet(3 = 1)+MultiSet(4 = 1)

module MultiSet () local instance, hash, generalized; option object; end module

(1)

V := MultiSet(3 = 1)+MultiSet(4 = 1)

module MultiSet () local instance, hash, generalized; option object; end module

(2)

evalb(U = V)

true

(3)

X := [2, 7, U]; Y := [2, 7, V]

[2, 7, module MultiSet () local instance, hash, generalized; option object; end module]

 

[2, 7, module MultiSet () local instance, hash, generalized; option object; end module]

(4)

evalb(X = Y)

false

(5)

seq(evalb(X[i] = Y[i]), i = 1 .. 3)

true, true, true

(6)

``


 

Download Anomaly.mw

Please Wait...