#19055: Tableau hash depends on subclass
-------------------------------------+-------------------------------------
Reporter: darij | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.9
Component: combinatorics | Resolution:
Keywords: tableaux, hashing | Merged in:
Authors: Darij Grinberg | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
public/combinat/tableau_hash | 27788705a3241374377904895b341c9c504605df
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nthiery):
To be precise, I indeed in favor of:
- Making sure that each object specifies clearly what equality means.
- Having hash be consistent with that definition of equality to
conform to the Python specifications. Otherwise we can get all sort
of weird, if not non-deterministic behavior when building sets of
dictionaries of mixed objects. Note that some people consider that
this is to be weighted against usability of equality.
- Distinguishing syntactical equality (to be tested by `==`) and
mathematical equality. See also
http://wiki.sagemath.org/EqualityCoercion for some comments on the
topic. Alas in Sage we don't have (yet?) a separate idiom for
mathematical equality, so we are kind of stuck here.
So now what needs to be decided is what equality should mean for
tableau-like objects.
I would tend to consider that, when `A` and `B` are two parents where
`A` is naturally a subset of `B` (operations on elements don't depend,
or not too much, on whether the elements are considered as in `A` or
as in `B`), and both parents use the same data representation for
their elements (no non-trivial embedding), it can be ok to consider
`a` with `A` as parent or `a` with `B` as parent as equal, if that's
what the user would expect.
With that rule of thumb, that is ok::
{{{
sage: A = StandardTableaux([2,1])
sage: B = StandardTableaux()
sage: A([[1,2],[3]]) == B([[1,2],[3]])
True
}}}
But a tableau and a Gelfand Tsetlin Pattern would not be equal (same
data representation, but no canonical subset relation). Nor would I
consider the partition 321 as equal to the permutation 321. I probably
would not want either to consider a skew tableau with trivial inner
shape equal to the corresponding tableau (different data
representations).
Now all of this is a just a preliminary rule of thumb. The most
important is to be well defined, as consistent as possible within a
given context (e.g. tableau-like objects, permutation like objects,
...), and to advertise the specs to the user.
Cheers,
--
Ticket URL: <http://trac.sagemath.org/ticket/19055#comment:7>
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.
For more options, visit https://groups.google.com/d/optout.