On 03/06/2018 10:54, Travis Scrimshaw wrote:
(4) Modify == to test equality as subobjects/subsets.
-1, as I tend to think of "==" as a QUICK test.
If testing equality has a potential to hit decision problems (which
certainly is the case for subgroups), then "==" should give a swift
"True" if the two objects are easily seen to be equal (by equality of
the set of generators, say), and should return "False" otherwise.
In these cases, there ought to be a special method that the user will only
call if s/he really is prepared to wait for the answer for a couple of
hours.
Note that in a way it would be nice if "==" had a ternary logic
"True/False/Unknown". But Python isn't there yet (although I do recall
that there used to be a PEP for it).
I am also generally in favor of having == being a (generally) fast check.
However, the symbolics code takes the opposite approach: it has the method
is_trivial_equal() for quick checks but == fires up the proof engine. In
terms of surprise, the fast == is clearly worse, but using
is_trivially_equal() makes the code harder to read and maintain (often
because of inconsistent use in regards to speed regressions).
It is urgent to decide clear semantics for equality *globally* in Sage.
That is
1. what Python `==` means in Sage and state it clearly in the
developer's guide and documentation
2. alternative function/operator for other kind of equalities
Note that Python == is used in non-trivial operation such as
constructing hash tables (set, dictionaries). It would be a bad
design to set == to be something else than mathematical equality
(ie equality of the subgroups).
Note also that it is perfectly fine for "==" to raise an error such as
NotImplementedError. If some algorithm is not able to decide whether
H1 and H2 are equal it can just give up.
Vincent
--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.