Opened 8 years ago

Closed 8 years ago

#16037 closed defect (fixed)

Hash value of Family is based on string representation

Reported by: tscrim Owned by: sage-combinat
Priority: major Milestone: sage-6.3
Component: combinatorics Keywords:
Cc: sage-combinat, nthiery Merged in:
Authors: Travis Scrimshaw Reviewers: Nicolas M. Thiéry
Report Upstream: N/A Work issues:
Branch: 5aa1e5b (Commits, GitHub, GitLab) Commit: 5aa1e5bfa4b6054df40482d9274792e2d2a64b96
Dependencies: Stopgaps:

Status badges

Description (last modified by tscrim)

Which can cause equality without hash equality. The proposed fix is to hash the frozenset of the keys and the repr of the values into a frozen set if finite, or hash the keys and the function name for lazy families.

Change History (9)

comment:1 Changed 8 years ago by tscrim

This came up in #15300, but apparently we can create (python) dictionaries whose result from keys is not consistent (despite the dictionaries being equal).

comment:2 Changed 8 years ago by tscrim

  • Branch set to public/combinat/hash_family-16037
  • Commit set to 44ae929f513bb00df4dc006d3888a9e597263264
  • Description modified (diff)
  • Status changed from new to needs_review

New commits:

44ae929Hash function for families.

comment:3 Changed 8 years ago by tscrim

Nicolas, do you think you could get this reviewed? We're almost done with #15300 and it fixes a doctest there about the unique representation behavior.

comment:4 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 Changed 8 years ago by git

  • Commit changed from 44ae929f513bb00df4dc006d3888a9e597263264 to e611e562d63879d812ddd249fb7f8a41dc94f66c

Branch pushed to git repo; I updated commit sha1. New commits:

92657dbMerge branch 'public/combinat/hash_family-16037' of into public/combinat/hash_family-16037
e611e56Some improvements from talking with Nicolas.

comment:6 Changed 8 years ago by git

  • Commit changed from e611e562d63879d812ddd249fb7f8a41dc94f66c to 5aa1e5bfa4b6054df40482d9274792e2d2a64b96

Branch pushed to git repo; I updated commit sha1. New commits:

f403eb3Minor tweaks for family sets.
5aa1e5bExtra doctest for Nicolas.

comment:7 Changed 8 years ago by nthiery

  • Reviewers set to Nicolas M. Thiéry
  • Status changed from needs_review to positive_review

We just discussed this together, and I am happy with it. Positive review assuming all long doctest pass! Thanks Travis :-)

comment:8 Changed 8 years ago by tscrim

Thanks again Nicolas.

comment:9 Changed 8 years ago by vbraun

  • Branch changed from public/combinat/hash_family-16037 to 5aa1e5bfa4b6054df40482d9274792e2d2a64b96
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.