#15381: gens() can mean both module and algebra generators, confusing 
morphism.pyx
-------------------------+-------------------------------------------------
   Reporter:  darij      |            Owner:
       Type:  defect     |           Status:  new
   Priority:  major      |        Milestone:  sage-5.13
  Component:             |         Keywords:  categories, gens, morphisms,
  categories             |  modules
  Merged in:             |          Authors:
  Reviewers:             |  Report Upstream:  N/A
Work issues:             |           Branch:
     Commit:             |     Dependencies:
   Stopgaps:             |
-------------------------+-------------------------------------------------
 {{{
 sage: D3 = GroupAlgebra(DihedralGroup(3), QQ)
 sage: from sage.categories.modules_with_basis import *
 sage: g = ModuleMorphismByLinearity(domain=D3, codomain=D3,
 on_basis=lambda x: (D3.zero() if list(x) == [] else D3.basis()[x]))
 sage: g.is_identity()
 True
 }}}

 Of course, `g` is not the identity. The culprit is here:

 {{{
             gens = domain.gens()
             for x in gens:
                 if self(x) != x:
                     return False
             return True
 }}}

 This is part of the `is_identity` method in
 `sage/categories/morphism.pyx`. The assumption is that the `gens` method
 and the morphism refer to the same category, but here they don't: the
 morphism is a module morphism, while `D3.gens()` refers to the generators
 as algebra.

 Note that the equality check takes the other extreme and seems to only
 return `True` if the `on_basis` lambda functions of both morphisms are
 identical (i. e., I can add zero to each image and it doesn't return
 `True` anymore, even if they are identical).

--
Ticket URL: <http://trac.sagemath.org/ticket/15381>
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/groups/opt_out.

Reply via email to