#11309: Sage sees -x +y > 0, -y + x >= 0,  and  x -y > 0 as equivalent
-------------------------------------------------------------------+--------
       Reporter:  tnv                                              |         
Owner:  burcin                             
           Type:  defect                                           |        
Status:  needs_review                       
       Priority:  major                                            |     
Milestone:  sage-5.0                           
      Component:  symbolics                                        |    
Resolution:                                     
       Keywords:  inequality equality relational sd31 __richcmp__  |   Work 
issues:                                     
Report Upstream:  N/A                                              |     
Reviewers:  Karl-Dieter Crisman, ThanhVu Nguyen
        Authors:  Keshav Kini, Burcin Erocal                       |     Merged 
in:                                     
   Dependencies:                                                   |      
Stopgaps:                                     
-------------------------------------------------------------------+--------
Changes (by kini):

  * status:  needs_work => needs_review


Old description:

> -x + y > 0 and x - y > 0  are treated the same in Sage.
>
> {{{
> #!python
> sage: version()
> 'Sage Version 4.6.2, Release Date: 2011-02-25'
>
> sage: (-x +y < 0) in [x -y < 0]
> True
>
> Set([-x +y >= 0,x -y >= 0])
> {-x + y >= 0}
> }}}
>
> and they have the same Hash
>
> {{{
> #!python
> sage: var('x,y')
> (x, y)
> sage: hash(-x + y > 0 )
> 1221566266
> sage: hash(-x + y >= 0 )
> 1221566266
> sage: hash(x - y >= 0 )
> 1221566266
> sage: hash(-y + x >= 0 )
> 1221566266
> sage: hash(x - y > 0 )
> 1221566266
> }}}
>
> It seems to me that Sage treats `>`, `>=`, and `==` the same (see #7660).
> If this is true then it's a serious problem and needs to be addressed.

New description:

 -x + y > 0 and x - y > 0  are treated the same in Sage.

 {{{
 #!python
 sage: version()
 'Sage Version 4.6.2, Release Date: 2011-02-25'

 sage: (-x +y < 0) in [x -y < 0]
 True

 Set([-x +y >= 0,x -y >= 0])
 {-x + y >= 0}
 }}}

 and they have the same Hash

 {{{
 #!python
 sage: var('x,y')
 (x, y)
 sage: hash(-x + y > 0 )
 1221566266
 sage: hash(-x + y >= 0 )
 1221566266
 sage: hash(x - y >= 0 )
 1221566266
 sage: hash(-y + x >= 0 )
 1221566266
 sage: hash(x - y > 0 )
 1221566266
 }}}

 It seems to me that Sage treats `>`, `>=`, and `==` the same (see #7660).
 If this is true then it's a serious problem and needs to be addressed.

 Apply:

  1. [attachment:trac_11309-fix-comparison-of-comparisons.patch]
  1. [attachment:trac_11309-equate-flipped-comparisons.patch]

--

Comment:

 Added a new patch. Burcin, can you look over it to make sure I'm doing
 this the right way? In particular are those operator comparisons
 optimizable somehow?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11309#comment:37>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
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-trac?hl=en.

Reply via email to