#14019: equality is broken for Posets
---------------------------------+------------------------------------------
       Reporter:  ncohen         |         Owner:  sage-combinat
           Type:  defect         |        Status:  new          
       Priority:  major          |     Milestone:  sage-5.7     
      Component:  combinatorics  |    Resolution:               
       Keywords:                 |   Work issues:               
Report Upstream:  N/A            |     Reviewers:               
        Authors:  Nathann Cohen  |     Merged in:               
   Dependencies:                 |      Stopgaps:               
---------------------------------+------------------------------------------
Description changed by ncohen:

Old description:

> Plain and simple :
>
> {{{
> sage: d = DiGraph({2:[1],3:[1]})
> sage: p1 = Poset(d, linear_extension = [1,2,3])
> sage: p2 = p1.relabel({1:1,2:3,3:2})
> sage: p1.hasse_diagram() == p1.hasse_diagram()
> True
> sage: p1 == p2
> False
> }}}
>
> This can be fixed by saying that two posets are equal if their hasse
> diagrams are equal, as it should have been since the beginning.
>
> This will probably make poset equality much slower. On the bright side it
> will work correctly.
>
> Of course this patch could have been almost trivial, but there is in the
> FinitePoset class a "key" argument, whose purpose is to make two posets
> different if they have different keys. So this patch checks that too.
>
> And the next time that somebody will need to store pairs "(a poset, a
> key)", the best will be to store pairs "(a poset, a key)". And not "A
> poset with a key included inside, which is useful just for my own code"
> as one could easily believe.
>
> Oh. And the same with linear orderings, of course.
>
> Nathann

New description:

 Plain and simple :

 {{{
 sage: d = DiGraph({2:[1],3:[1]})
 sage: p1 = Poset(d, linear_extension = [1,2,3])
 sage: p2 = p1.relabel({1:1,2:3,3:2})
 sage: p1.hasse_diagram() == p2.hasse_diagram()
 True
 sage: p1 == p2
 False
 }}}

 This can be fixed by saying that two posets are equal if their hasse
 diagrams are equal, as it should have been since the beginning.

 This will probably make poset equality much slower. On the bright side it
 will work correctly.

 Of course this patch could have been almost trivial, but there is in the
 FinitePoset class a "key" argument, whose purpose is to make two posets
 different if they have different keys. So this patch checks that too.

 And the next time that somebody will need to store pairs "(a poset, a
 key)", the best will be to store pairs "(a poset, a key)". And not "A
 poset with a key included inside, which is useful just for my own code" as
 one could easily believe.

 Oh. And the same with linear orderings, of course.

 Nathann

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14019#comment:1>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to