Skip to content

Fix element and parent classes of Hom categories to be abstract, and simplify the Hom logic. #12876

@nthiery

Description

@nthiery

This patch fixes the parent and element classes for Hom categories to
be purely abstract, and simplifies the Hom logic:

  • Unified the logic for selecting the class when building a Homset
    (e.g. Homset, RingHomset, HeckeModuleHomspace, ...). This is now
    systematically done through the _Hom_ hook. The logic still has a
    fundamental flaw, but that's for the later Refactor category support for morphisms (Hom is not a functorial construction!) #10668.
  • The cache for Hom is handled at a single point in Hom
    In particular, homsets created via the _Hom_ hook are now unique.
  • If category is None, Hom simply calls itself with the meet of the
    categories of the parent, which removes a cache handling duplication
    in the code
  • Parent.Hom calls Hom directly (removes duplicate _Hom_ logic).
  • ParentWithBase.Hom was redundant and is gone.
  • Reduce the footprint of the current trick to delegate
    Hom(F,F)(on_basis=...) to module_morphism, allow for the diagonal
    option too, an make sure the homset category is set properly.
  • Update a doctest in sage.modules.vector_space_homspace to take into
    account that homsets created via _Hom_ are now unique.
  • Scheme is (apparently) an abstract base class; so it should not be
    instantiated. I changed some doctests in
    sage.schemes.generic.SchemeMorphism to use instead the concrete
    Spec(ZZ). Those doctests were breaking because Scheme does not
    implement equality, which is required for Hom caching.

As a byproduct, the HeckeModules category does not import any more
HeckeModulesHomspace, which was a recurrent source of import loops.

#11935 depends on this ticket

Apply:

Depends on #715
Depends on #11521
Depends on #12215
Depends on #12313
Depends on #13412
Depends on #13145
Depends on #14159
Depends on #13184
Depends on #14287
Depends on #14217

CC: @sagetrac-sage-combinat @simon-king-jena

Component: categories

Keywords: Hom

Author: Nicolas M. Thiéry

Reviewer: Simon King

Merged: sage-5.11.beta0

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions