#16247: Abuse of Modules() for modules over noncommutative rings
-------------------------------------------------+-------------------------
Reporter: darij | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.2
Component: algebra | Resolution:
Keywords: modules, categories, | Merged in:
associativity, matrices | Reviewers:
Authors: | Work issues:
Report Upstream: N/A | Commit:
Branch: | Stopgaps:
Dependencies: 10963 |
-------------------------------------------------+-------------------------
Changes (by darij):
* keywords: modules, categories, associativity, => modules, categories,
associativity, matrices
* dependencies: => 10963
Old description:
> We have `LeftModules` and `RightModules` functorial constructions (not
> sure if since #10963 or already before), and they should be used.
> `Modules` implements left and right multiplication to be *the same*,
> which causes misleading and counterintuitive non-associativity issues.
>
> I'm currently running the (short) doctests of src/sage with a commit that
> adds a warning every time Modules(A) is called for A noncommutative. I'll
> post the results once it's done. So far:
> {{{
> ----------------------------------------------------------------------
> sage -t src/sage/groups/finitely_presented.py # 2 doctests failed
> sage -t src/sage/matrix/matrix_sparse.pyx # 4 doctests failed
> sage -t src/sage/matrix/matrix0.pyx # 5 doctests failed
> sage -t src/sage/matrix/matrix2.pyx # 1 doctest failed
> sage -t src/sage/matrix/matrix_space.py # 2 doctests failed
> Doctests interrupted: 231/2069 files tested
> ----------------------------------------------------------------------
> }}}
New description:
We have `LeftModules` and `RightModules` functorial constructions, and
they should be used. `Modules` implements left and right multiplication to
be *the same*, which causes misleading and counterintuitive non-
associativity issues.
I'm currently running the (short) doctests of src/sage with a commit that
adds a warning every time Modules(A) is called for A noncommutative. I'll
post the results once it's done. So far:
{{{
----------------------------------------------------------------------
sage -t src/sage/groups/finitely_presented.py # 2 doctests failed
sage -t src/sage/matrix/matrix_sparse.pyx # 4 doctests failed
sage -t src/sage/matrix/matrix0.pyx # 5 doctests failed
sage -t src/sage/matrix/matrix2.pyx # 1 doctest failed
sage -t src/sage/matrix/matrix_space.py # 2 doctests failed
Doctests interrupted: 231/2069 files tested
----------------------------------------------------------------------
}}}
It seems that matrices over noncommutative rings are the main culprit here
-- or, rather, matrix spaces being cast as modules over the base rings.
They should be bimodules! The reason why this doesn't blow up in the
user's face (well, as far as I can tell) is that (I guess) the matrix
space classes override the `*` operator to do the right thing instead of
use the defaults from the `Modules` category.
Apparently people have been aware of this for a while; the following
warning message is doctested for and not written by me:
{{{
doctest:...: UserWarning: You are constructing a free module
over a noncommutative ring. Sage does not have a concept
of left/right and both sided modules, so be careful.
It's also not guaranteed that all multiplications are
done from the right side.
doctest:...: UserWarning: You are constructing a free module
over a noncommutative ring. Sage does not have a concept
of left/right and both sided modules, so be careful.
It's also not guaranteed that all multiplications are
done from the right side.
}}}
(We do have left/right/bi-modules now.)
There are some tracebacks I don't really understand... can it be that some
methods in Sage construct matrices consisting of matrices? There's nothing
wrong about that; I just think the constructor for the respective matrix
spaces should pick the right category for that.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/16247#comment:1>
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.