Skip to content

Hom: introduce a check argument to simplify the unpickling detection logic #16275

@nthiery

Description

@nthiery

As was noticed in #14793, some sanity checks need to be disabled in Hom when called upon unpickling because the input may include an unitialized parent. Since #14793, this is achieved by looking at the parent to detect if it is unitilialized.

As an alternative, this ticket proposes to add a check=True/False
optional argument to Hom, and to use it upon unpickling. The advantages are:

  • The logic is quite simpler, slightly faster, and more robust.

  • This check argument is of general purpose, and indeed immediately
    put to use when Hom calls itself recursively.

  • It made it easier for the first feature below

A potential caveat: pickles created since #14793 might not unpickle
properly. This was very recent; do we care?

Other changes in this ticket:

  • Hom now uses X in category as sanity check rather than
    X.category().is_subcategory(category). This is more expressive,
    and indeed a necessary preliminary step for Categories over a base ring category #15801 which makes those
    two idioms not always equivalent (example: X is a QQ-module,
    X.category() is Modules(Rings) and category is
    Modules(QQ))

  • A bug fix for Homsets between simplicial complexes over some higher
    category (Hom was not checking its input).

CC: @simon-king-jena @tscrim

Component: categories

Keywords: homset

Author: Nicolas M. Thiéry, Simon King

Branch: e1e916c

Reviewer: Simon King, Nicolas M. Thiéry

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions