IMHO the real bug is that == is group-comparison instead of 
presentation-comparison. This obviously breaks hashes, and therefor makes 
associative containers useless. Getting rid of the hashes just means that 
associative containers are now useless because the word problem is not 
decidable. At least you just run out of memory instead of getting the wrong 
result, yay.  



On Wednesday, August 12, 2015 at 1:19:06 PM UTC+2, Nathann Cohen wrote:
>
> Hello everybody,
>
> I have been playing with groups recently, and fought very hard with my code
> before I noticed the usual bug:
>
>     sage: a == b
>     True
>     sage: hash(a) == hash(b)
>     False
>
> Which has (among others) the following consequence:
>
>     sage: G = groups.presentation.Cyclic(4)
>     sage: G.cayley_graph().vertices()
>     [1, a, a^2, a^-2, a^3, a^-1]
>
> To me, the problem comes from the "default" implementation of __hash__ 
> that can
> be found in sage.structure.element:
>
>     def __hash__(self):
>        return hash(str(self))
>
> Of course, with such a definition it is very likely that "__hash__" and 
> "__eq__"
> will never agree. As I expect that removing this dangerous default
> implementation may break a *lot* of things, I created a ticket 
> (needs_review)
> that replaces it with "return 0".
>
> http://trac.sagemath.org/ticket/19016
>
> Nathann
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to