id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
15381,Comparison of morphisms assumes that a Morphism is determined by its action on gens(),darij,,"Counterexamples:
{{{
sage: from sage.categories.morphism import SetMorphism
sage: f = SetMorphism(Hom(QQ, QQ, Sets()), numerator)
sage: f.is_identity()
True
}}}
and
{{{
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).",defect,new,major,sage-6.4,categories,,"categories, gens, morphisms, modules",tscrim caruso SimonKing nthiery mmezzarobba,,,,N/A,,,,#10963,wrongAnswerMarker