Opened 6 years ago

Last modified 13 months ago

#15297 new defect

Elements from a Field of Fractions that compare equal should have equal hashes

Reported by: Stefan Owned by:
Priority: major Milestone: sage-8.4
Component: algebra Keywords: field of fractions, hashing
Cc: yzh, mkoeppe Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:


Sage can't guarantee that p == q implies hash(p) == hash(q), but it is not unreasonable to strive to make this work in case p,q belong to the same ring or field.

This ticket deals with Fields of Fractions. The proposed solution from this post appears to do the trick:!topic/sage-devel/TOp_5LCBBR4


sage: R.<x> = ZZ['x']
sage: F = R.fraction_field()
sage: p = 1/(1-x)
sage: q = (-1)/(x-1)
sage: p == q
sage: hash(p) == hash(q)

Change History (5)

comment:1 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:2 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:3 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:4 Changed 4 years ago by mkoeppe

  • Cc yzh mkoeppe added

comment:5 Changed 13 months ago by mkoeppe

  • Milestone changed from sage-6.4 to sage-8.4

Still broken even with #16268; see #26339.

Note: See TracTickets for help on using tickets.