I would think that the method `__hash__` of FractionFieldElement in fraction_field_element.pyx is broken, since
sage: f1 = x/y
sage: f2 = (2*x)/(2*y)
sage: f1 == f2
True
sage: hash(f1)
-284264079394034550
sage: hash(f2)
-284264773958195866
In `__hash__`, we do the following:
if self._parent.is_exact():
...
self.reduce()
# Same algorithm as for elements of QQ
n = hash(self._numerator)
d = hash(self._denominator)
if d == 1:
return n
else:
return n ^ d
The problem is that `self.reduce()` doesn't have any effect: it divides out the gcd of numerator and denominator, which is 1, since QQ is a field. (Over ZZ it is 2, which is the reason why it works)
I don't know how to fix this properly. Can we define a sensible hash generically for FractionFieldElement at all?
:-(
Martin