Skip to content

Comparison of morphisms assumes that a Morphism is determined by its action on gens() #15381

@darijgr

Description

@darijgr

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).

Depends on #10963

CC: @tscrim @xcaruso @simon-king-jena @nthiery @mezzarobba

Component: categories

Keywords: gens, morphisms, modules

Stopgaps: wrongAnswerMarker

Issue created by migration from https://trac.sagemath.org/ticket/15381

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions