On Thursday, May 10, 2012 7:14:01 PM UTC-4, John H Palmieri wrote:
>
>
>
> On Thursday, May 10, 2012 2:41:07 PM UTC-7, Duc Trung Ha wrote:
>>
>> Hola,
>>
>> would anybody be so kind and explain to me the mechanism behind 
>> "assume(sth)"?
>>
>
> The mechanism seems to be broken. Actually, the mechanism that compares 
> boolean expressions seems to be broken, which means that assumptions don't 
> work right, either.
>
>     sage: a = (x - 2 <= 0)
>     sage: b = (x <= 2)
>     sage: c = (x - 1 <= 0)
>     sage: a == b
>     False
>     sage: a == c
>     True
>     sage: b == c
>     False
>
> The first two claimed equalities are a bit troubling...
>
>
Remember, False = we didn't/couldn't prove it was True, so the first one is 
annoying but technically ok.

As to the original post, we must be preprocessing things not quite right. 
Maxima:

(%i1) assume(x-2<=0);
(%o1)                              [x <= 2]
(%i2) assume(x-1<=0);
(%o2)                              [x <= 1]
(%i3) assumptions;
(%o3)                             assumptions
(%i4) facts();
(%o4)                          [2 >= x, 1 >= x]


And indeed

sage: c = (x-2<=0)
sage: maxima.assume(c._maxima_init_assume_())
[x<=2]
sage: c = (x-2<=0)
sage: maxima.assume(c._maxima_init_assume_())
[redundant]

But we don't use "facts()" per se, we instead append the relation x-2<=0 
directly to the assumption list.

sage: a = (x-1<=0)
sage: sage.symbolic.assumptions._assumptions
[x - 2 <= 0]
sage: if a in sage.symbolic.assumptions._assumptions:
    print 'yes'
....:     
yes

Aack!  Something horrible is happening here.  Okay, John, now I understand 
your somewhat cryptic post; since 

sage: a == c
True

assumptions thinks this is already in the list.  And this is already true 
in a Sage from two years ago (4.4.4).  Why on earth is a == c True?   
Apparently Ginac thinks so?

cdef int _cmp_c_impl(left, Element right) except -2:
return left._gobj.compare((<Expression>right)._gobj)

I must be missing something here.  Burcin, any ideas - maybe this is 
already on some ticket that should have been merged but got hung up on a 
technicality, there was some stuff about symbolic expression comparisons a 
while back.

Sorry I had to go through all this - hopefully it clarifies things a little 
for the original poster.  

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to