#18251: CombinatorialFreeModule: fix arithmetic/comparison with base ring zero
-------------------------------------+-------------------------------------
Reporter: tscrim | Owner: tscrim
Type: defect | Status: new
Priority: critical | Milestone: sage-7.4
Component: coercion | Resolution:
Keywords: zero | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jdemeyer/combinatorialfreemodule_should_use_coercion_for_comparisons|
3aa0ccae4e5c42359636afd5b77a504388e26928
Dependencies: #21128 | Stopgaps:
-------------------------------------+-------------------------------------
Description changed by jdemeyer:
Old description:
> Currently we have the following in Sage:
> {{{
> sage: C = CombinatorialFreeModule(QQ, ['a','b'])
> sage: C.zero() == ZZ(0)
> True
> sage: C.zero() == QQ(0)
> False
> }}}
>
> The problem is that there is no coercion `QQ -> C`. The coercion model
> special-cases `ZZ(0)` but not other kinds of zero.
New description:
Currently we have the following in Sage:
{{{
sage: C = CombinatorialFreeModule(QQ, ['a','b'])
sage: C(0) + ZZ(0)
0
sage: C(0) + QQ(0)
TypeError: unsupported operand parent(s) for '+': 'Free module generated
by {'a', 'b'} over Rational Field' and 'Rational Field'
}}}
and also
{{{
sage: C = CombinatorialFreeModule(QQ, ['a','b'])
sage: C.zero() == ZZ(0)
True
sage: C.zero() == QQ(0)
False
}}}
The problem is that there is no coercion `QQ -> C`. The coercion model
special-cases `ZZ(0)` but not other kinds of zero.
--
--
Ticket URL: <https://trac.sagemath.org/ticket/18251#comment:13>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.