#9940: Fix equality/inequality for AdditiveAbelianGroup
-----------------------------+----------------------------------------------
Reporter: mpatel | Owner: joyner
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-4.6.1
Component: group theory | Keywords:
Author: John Palmieri | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------+----------------------------------------------
Comment(by rbeezer):
It seems that other comparisons are not working properly either,
{{{
sage: G=AdditiveAbelianGroup([0,0])
sage: H=AdditiveAbelianGroup([0,0])
sage: G==H
True
sage: G!=H
True
sage: G<=H
True
sage: H<=G
False
}}}
`AdditiveAbelianGroup` is implemented as a quotient of finitely-generated
modules over ZZ, V/W, and you can get these two modules as follows:
{{{
sage: G._V
Ambient free module of rank 2 over the principal ideal domain Integer Ring
sage: G._W
Free module of degree 2 and rank 0 over Integer Ring
Echelon basis matrix:
[]
}}}
The equality of G and H is determined by the {{{__eq__}}} method in
{{{sage.modules.fg_pid.fgp_module.FGP_Module_class}}} which does the
obvious thing, checking the equality of the V and W modules.
I cannot seem to figure out how the "non-equality" comparison is
accomplished. I get the impression this could be the logical negation of
the equality comparison, automatically, but inserting print statements
various places does not verify that hypothesis.
If I rebuild the quotient of modules from the relevant pieces of G and H,
then equality and non-equality both behave as expected.
{{{
sage: X=sage.modules.fg_pid.fgp_module.FGP_Module(G._V, G._W)
sage: Y=sage.modules.fg_pid.fgp_module.FGP_Module(H._V, H._W)
sage: X==Y
True
sage: X!=Y
False
}}}
So I am at a bit of a loss to understand what is broken in the non-
equality of G and H. But still, a suggestion. Since equality is
implemented in the FGP_Module class, maybe the non-equality, as just the
logical opposite, should be implemented at the same level? In other
words, use the same logic as in the patch, but place it as
{{{sage.modules.fg_pid.fgp_module.FGP_Module_class.__ne__}}}? Does that
make sense?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9940#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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.