Opened 5 years ago

Closed 5 years ago

#17364 closed defect (fixed)

Homset categories should be subcategories of the category of all homsets

Reported by: nthiery Owned by:
Priority: major Milestone: sage-6.5
Component: categories Keywords:
Cc: sage-combinat, SimonKing, nbruin, pbruin Merged in:
Authors: Nicolas M. Thiéry Reviewers: Peter Bruin, Jean-Pierre Flori
Report Upstream: N/A Work issues:
Branch: 0925390 (Commits) Commit: 0925390c0d1eacabd75bb24c815d30124c8e8a2b
Dependencies: Stopgaps:

Description (last modified by pbruin)

All homset categories should be subcategories of the category of all homsets. For example, we want:

sage: from sage.categories.homsets import Homsets
sage: Schemes().Homsets().is_subcategory(Homsets())
True
sage: AdditiveMagmas().Homsets().is_subcategory(Homsets())
True
sage: AdditiveMagmas().AdditiveUnital().Homsets().is_subcategory(Homsets())
True

The inheritance of a homset category C.Homsets() from Homsets() used to be implemented in HomsetsCategory.extra_super_categories; this meant that any custom implementation of C.Homsets.extra_super_categories would overwrite it, which broke all the above examples.

This ticket fixes this, and uses the occasion to refactor the logic, getting rid along the way of the custom category_of method which almost duplicated that of functorial constructions. Hopefully the logic and its documentation are clearer now.

Change History (13)

comment:1 Changed 5 years ago by nthiery

  • Branch set to u/nthiery/all_homsets_category_should_be_subcategories_of_the_category_of_all_homsets

comment:2 Changed 5 years ago by nthiery

  • Commit set to 0925390c0d1eacabd75bb24c815d30124c8e8a2b
  • Status changed from new to needs_review

New commits:

092539017364: All homsets category should be subcategories of the category of all homsets

comment:3 follow-up: Changed 5 years ago by SimonKing

What is meant by "category of all homsets"? A questionable construction such as the "category of all objects", Objects()?

comment:4 follow-up: Changed 5 years ago by nthiery

There remains one thing: what to do with Schemes.Homsets and HeckeModules.Homsets? Probably fine as they are without extra_super_categories. My tiny changes there are likely to conflict with those in #17359. Please take over, and feel free too edit that part, and make either ticket depend on the other.

Last edited 5 years ago by nthiery (previous) (diff)

comment:5 in reply to: ↑ 3 Changed 5 years ago by nthiery

Replying to SimonKing:

What is meant by "category of all homsets"? A questionable construction such as the "category of all objects", Objects()?

Yeah, this basically serves the same role indeed. Anyway, it's not a new thing: you already positive reviewed it in #10668 :-)

comment:6 in reply to: ↑ 4 ; follow-up: Changed 5 years ago by pbruin

  • Description modified (diff)
  • Summary changed from All homsets category should be subcategories of the category of all homsets to Homset categories should be subcategories of the category of all homsets

(just fixing some typos in the description and summary)

Replying to nthiery:

There remains one thing: what to do with Schemes.Homsets and HeckeModules.Homsets? Probably fine as they are without extra_super_categories. My tiny changes there are likely to conflict with those in #17359. Please take over, and feel free too edit that part, and make either ticket depend on the other.

In that case I propose using #17359 to finish the two TODO items from this ticket (for Hecke modules and schemes).

comment:7 in reply to: ↑ 6 Changed 5 years ago by nthiery

Replying to pbruin:

(just fixing some typos in the description and summary) ... In that case I propose using #17359 to finish the two TODO items from this ticket (for Hecke modules and schemes).

Sounds good. Thanks for taking over!

comment:8 follow-up: Changed 5 years ago by pbruin

I am not sure that this ticket solves all difficulties with determining the supercategories of Hom set categories. For example (both before and after this ticket):

sage: HeckeModules(ZZ).is_subcategory(Modules(ZZ))
True
sage: Modules(ZZ).Homsets().all_super_categories()
[Category of homsets of modules over Integer Ring,
 Category of modules over Integer Ring,
 Category of bimodules over Integer Ring on the left and Integer Ring on the right,
 Category of right modules over Integer Ring,
 Category of left modules over Integer Ring,
 Category of commutative additive groups,
 Category of additive groups,
 Category of additive inverse additive unital additive magmas,
 Category of commutative additive monoids,
 Category of additive monoids,
 Category of additive unital additive magmas,
 Category of commutative additive semigroups,
 Category of additive commutative additive magmas,
 Category of additive semigroups,
 Category of additive magmas,
 Category of homsets of right modules over Integer Ring and left modules over Integer Ring,
 Category of homsets,
 Category of sets,
 Category of sets with partial maps,
 Category of objects]
sage: HeckeModules(ZZ).Homsets().all_super_categories()
[Category of homsets of Hecke modules over Integer Ring,
 Category of homsets,
 Category of sets,
 Category of sets with partial maps,
 Category of objects]

Note that the fact that Hom sets of modules are Abelian groups is not reflected in the output of the last command.

comment:9 in reply to: ↑ 8 ; follow-up: Changed 5 years ago by nthiery

Hi Peter,

Replying to pbruin:

I am not sure that this ticket solves all difficulties with determining the supercategories of Hom set categories.

Thanks for checking whether everything is correct.

For example (both before and after this ticket):

sage: HeckeModules(ZZ).is_subcategory(Modules(ZZ))

...

}}} Note that the fact that Hom sets of modules are Abelian groups is not reflected in the output of the last command.

This is not about the infrastructure (which is the theme of this ticket), but about what Sage knows about Hecke modules (which is what the TODO I left is about):

  • If the category Hecke modules is a full subcategory of the category of modules, Sage should be told about this by implementing HeckeModules.additional_structure to return None.
  • Otherwise, one needs to state explicitly that HeckeModules(ZZ).Homsets() is a subcategory of AbelianGroups() (or whatever appropriate) in HeckeModules.Homsets.extra_super_categories.

Cheers,

Nicolas

comment:10 in reply to: ↑ 9 Changed 5 years ago by pbruin

Replying to nthiery:

Note that the fact that Hom sets of modules are Abelian groups is not reflected in the output of the last command.

This is not about the infrastructure (which is the theme of this ticket), but about what Sage knows about Hecke modules (which is what the TODO I left is about):

  • If the category Hecke modules is a full subcategory of the category of modules, Sage should be told about this by implementing HeckeModules.additional_structure to return None.
  • Otherwise, one needs to state explicitly that HeckeModules(ZZ).Homsets() is a subcategory of AbelianGroups() (or whatever appropriate) in HeckeModules.Homsets.extra_super_categories.

OK, I see. Thanks for the clarification!

comment:11 Changed 5 years ago by pbruin

A related question: in an Abelian category (or more generally an additive category), all Hom sets have a structure of Abelian groups. Would the current infrastructure allow inserting this fact somewhere in the code, so that all Hom sets in an Abelian category are automatically in CommutativeAdditiveGroups? I (very simple-mindedly) tried inserting some variants of the following in sage/categories/category_types.py:

lazy_import('sage.categories.homsets', 'HomsetsCategory')

class AbelianCategory(Category):
    ...
    class Homsets(HomsetsCategory):
        def extra_super_categories(self):
            return [CommutativeAdditiveGroups()]

but got a strange ImportError: No module named Homsets.

comment:12 Changed 5 years ago by jpflori

  • Reviewers set to Peter Bruin, Jean-Pierre Flori
  • Status changed from needs_review to positive_review

Let's get this fix in.

comment:13 Changed 5 years ago by vbraun

  • Branch changed from u/nthiery/all_homsets_category_should_be_subcategories_of_the_category_of_all_homsets to 0925390c0d1eacabd75bb24c815d30124c8e8a2b
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.