Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElementWrapperCheckWrappedClass does not implement comparison properly #26890

Closed
jdemeyer opened this issue Dec 13, 2018 · 19 comments
Closed

ElementWrapperCheckWrappedClass does not implement comparison properly #26890

jdemeyer opened this issue Dec 13, 2018 · 19 comments

Comments

@jdemeyer
Copy link

Comparisons with the wrapped class should just delegate to the wrapped class, handling also inequalities instead of only == and !=.

Component: categories

Author: Jeroen Demeyer

Branch/Commit: 8418f8e

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/26890

@jdemeyer jdemeyer added this to the sage-8.5 milestone Dec 13, 2018
@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link
Author

Dependencies: #26586

@jdemeyer
Copy link
Author

@jdemeyer
Copy link
Author

New commits:

dc77918Mark doctest as known bug
8acc586Delegate comparisons for ElementWrapperCheckWrappedClass to wrapped class

@jdemeyer
Copy link
Author

Commit: 8acc586

@jdemeyer
Copy link
Author

Author: Jeroen Demeyer

@tscrim
Copy link
Collaborator

tscrim commented Dec 13, 2018

comment:5

You are changing the comparison logic a bit, in particular, comparisons between two wrapped classes no longer takes into account the parents. Since this is an extension class, it will not get subclassed when constructing elements; you've added an isinstance check that would also take care of if that happened as well. So we would get comparisons between objects that should not necessarily be treated as the same.

For a more concrete example, consider (1,0) as a Z-vector and (1,0) as a partition in an 2x2 box. These are (mathematically) incomparable objects, but your change would have them be equal. So at least the parent check should be added back in.

My recollection of why this was done this way was because we did not want the wrapped objects to have an ordering on them. However, I do not think there is any harm in inducing an ordering from the underlying objects. So the rest of your changes are fine with me.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 14, 2018

Changed commit from 8acc586 to ada6174

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 14, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

ada6174Delegate comparisons for ElementWrapperCheckWrappedClass to wrapped class

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 14, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

7c515f2Delegate comparisons for ElementWrapperCheckWrappedClass to wrapped class

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 14, 2018

Changed commit from ada6174 to 7c515f2

@tscrim
Copy link
Collaborator

tscrim commented Dec 16, 2018

comment:10

There is one failure because of the fact that coercion is now taken into account. So we also need this change in sage/combinat/root_system/extended_affine_weyl_group.py:

     Note that for untwisted affine type the dual form of the classical Weyl group
     is isomorphic to the usual one, but acts on a different lattice and is therefore different to sage::
 
         sage: W0v = E.dual_classical_weyl(); W0v
         Weyl Group of type ['A', 2] (as a matrix group acting on the weight lattice)
         sage: v = W0v.from_reduced_word([1,2])
         sage: x = PvW0(v); x
         s1*s2
         sage: y = PW0(v); y
         s1*s2
-        sage: x == y
-        False
         sage: x.parent() == y.parent()
         False
+
+    However, because there is a coercion from ``PvW0`` to ``PW0``,
+    the elements ``x`` and ``y`` compare as equal::
+
+        sage: x == y
+        True
+

Once changed, you can set a positive review on my behalf.

@tscrim
Copy link
Collaborator

tscrim commented Dec 16, 2018

Reviewer: Travis Scrimshaw

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 17, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

8418f8eDelegate comparisons for ElementWrapperCheckWrappedClass to wrapped class

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 17, 2018

Changed commit from 7c515f2 to 8418f8e

@jdemeyer
Copy link
Author

Changed dependencies from #26586 to none

@jdemeyer

This comment has been minimized.

@vbraun
Copy link
Member

vbraun commented Dec 23, 2018

@vbraun vbraun closed this as completed in 110bcf7 Dec 23, 2018
@embray
Copy link
Contributor

embray commented Dec 28, 2018

comment:15

This tickets were closed as fixed after the Sage 8.5 release.

@embray embray modified the milestones: sage-8.5, sage-8.6 Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants