-
-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infrastructure for modelling full subcategories #16340
Comments
comment:1
Suggestions anyone before I start implementing this? Cheers, |
comment:2
Ideally, for every piece of algebraic structure there should be both a full and a fully structure-aware subcategory. So there should be a UnitalAlgebrasWithUnitalMorphisms and a UnitalAlgebrasWithArbitraryMorphisms, etc.; more importantly, there should be categories for graded modules with graded morphisms and with arbitrary morphisms (I don't remember out of the hat which is the one we have) and categories for modules-with-basis with basis-preserving morphisms and with arbitrary morphisms etc.. This might not belong into this ticket, but please make sure that your model takes this into account and does not handle fullness as a hardcoded property of the relevant axiom / functorial construct. Other than this I like the proposal! |
comment:3
Is it possible to have a proper subcategory (within Sage) which has the same number, but actually different set, of operators (i.e. is |
Commit: |
comment:5
Replying to @darijgr:
Agreed.
I guess that's alright: when we will want both, we will just need to In the mean time, the current implementation makes a default choice on
Cool. I just pushed a first attempt. It's probably reasonably
Cheers, Last 10 new commits:
|
comment:6
Replying to @tscrim:
In the current implementation, we are comparing the set of all super categories that define some structure. This set can only become larger for inclusion when going down the category hierarchy. So technically we are fine. And this implementation seems to correctly models the mathematics, right? |
comment:8
I haven't had time to look at this in detail, but at first sight it looks like a good approach to me. For me the main point to think about is the terminology "structure category". It would be nice if the name made it slightly clearer that this property is not so much about the category itself as about its relation to its supercategories. (Some random alternative names for |
comment:9
Replying to @pjbruin:
Definitely!
Also, instead of an "is_..." method, we could name the method something like |
comment:10
Replying to @nthiery:
Or, even more informative: Return a pair
|
comment:11
Replying to @simon-king-jena:
Possibly so indeed. Although this would be duplicating a bit the job Speaking of which: see #16363. |
comment:12
Any other suggestions for the terminology? At this point, I am leaning toward |
comment:13
One thing I don't know how to handle. Assume we want the morphisms of euclidean rings to preserve euclidean division (I'd say that this is equivalent to preserving the degree). Then, We can't model this in the current implementation. An approach might be to have A similar situation appears for graded connected hopf algebras where there is a single choice for the antipode (and, IIRC, it's preserved for free by bialgebra morphisms). So this is a full subcategory of the category of bialgebras. Cheers, |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:15
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Work Issues: find good names |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:56
For info: Simon is sitting with me in Orsay, and we will be banging Expect some action :-) Finally! Cheers, |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:59
I went through all of the diff, fixed some typos, and I checked that with #10668 all tests pass. To be on the safe side, I will re-run certain tests with this branch, but it is close to a positive review. |
Changed reviewer from Darij Grinberg, Travis Scrimshaw to Darij Grinberg, Travis Scrimshaw, Simon King |
comment:60
Replying to @pjbruin:
This is not really addressed yet: There is Anyway, I am still somewhat confident that I can make something out of the idea to use Gröbner bases in boolean polynomial rings to deal with deduction rules (à la Wedderburn Theorem) for axioms and structures. And then, it would be a matter of filling a dictionary with information about what structure corresponds to what operation. |
comment:61
Replying to @tscrim:
I am not very much confident about the functorial constructions either. I am (re-)reading the chapter on functorial constructions in the category primer right now. Anyway, it seems to me that Nicolas has addressed the concerns expressed here (I was rereading all comments), the code is relatively clear (to me, the unclear parts concern things that existed before, like functorial constructions), and moreover all tests pass. So, if nobody objects, I am putting this to positive review, after reading the chapter in the primer... |
comment:62
Hm. I did not find the category primer very helpful, as it only gives an example (cartesian product) on objects. But it does not tell what actually happens to the categories, and it does not tell how it is defined, nor how it is implemented. I somehow recall from reviewing it how it was implemented, but I would not easily be able to provide a mathematical definition. Anyway. The new code that we are discussing here seems good to me. |
Changed branch from public/categories/full_subcategories-16340 to |
Changed commit from |
comment:64
Yeah! Thanks everyone for the review! |
comment:65
Wasn't there a way to make all these classes inherit the Nathann |
comment:66
Replying to @nathanncohen:
Probably not, if you talk about the case that If you have a default (which here is chosen so that the test for a full subcategory will not give a false-positive answer by default), then you need to do something special for all cases that are special. |
comment:67
Yo !
Hmmmmm... Then perhaps only a flag when this infrastructure is initialized ? Doesn't matter much I guess, I it just unpleasant to see the same (empty) function being copy/pasted one thousand times. Nathann |
comment:68
Replying to @nathanncohen:
Or an attribute def additional_structure(self):
if getattr(self._adds_structure, None):
return self In that way, the method Nicolas, what do you think about it? To me, it sounds like a good idea. |
comment:69
Also, if I may say: the name "additional_structure" is like VERY vague. Perhaps this is the best you can do on the "mathematical side" of the feature, but it may be possible to give it a more informative name describing what exactly this parameter does, i.e. a more code-specific description. But of course I have absolutely no idea of what I am talking about. Nathann |
comment:70
Replying to @nathanncohen:
Yeah, I agree it's verbose looking. But I am actually quite happy that With this ticket, we are really adding a not so trivial mathematical Cheers, |
comment:71
Replying to @nathanncohen:
I am open to suggestions. This is completely local to categories and easy to change. That being said, since it's a method on categories, the context is rather well specified. And in this context, it's rather customary to say things like ``a ring is a set endowed with a structure of unital magma and unital additive magma satisfying the axioms xxx'':
(btw: for that purpose, in the first example above, we might want to have a separate method that returns only the lowest categories, i.e. unital magmas and additive unital magmas). Then, from "structure" to "additional structure", the leap is not too big. Cheers, |
It has been desired for a while to be able to test, when B is a subcategory of A, whether it is a full subcategory or not; equivalently this is whether any A-morphism is a B-morphism (up to forgetfull functor; note that the converse always holds).
The main application is for #10668, which will let
B.homset_class
inherit fromA.homset_class
in this case and only in this case.References
Implementation proposal
For each category
C
, we encode the following data: isC
is a fullsubcategory of the join of its super categories? Informally, the
question is whether
C
introduces more structure or operations. Forthe sake of the discussion, I am going to call
C
a structurecategory in this case, but a better name is to be found.
Here are some of the main structure categories in Sage, and the
structure or main operation they introduce:
Possible implementation: provide a method
C.is_structure_category()
(name to be found). The default implementation would return
True
fora plain category and
False
for a CategoryWithAxiom. This would covermost cases, and require to implement
foo
methods only in a fewcategories (e.g. the Unital axiom categories).
Once we have this data encoded, we can implement recursively a
(cached) method such as:
(just take the union of the structure super categories of the super
categories of
``self``
, and add``self``
if relevant).It is now trivial to check whether a subcategory B of A is actually a
full subcategory: they just need to have the same structure super
categories! Hence
is_full_subcategory
can be written as:Advantages of this proposal
This requires very little data to be encoded, and should be quite
cheap to compute.
This is generally useful; in particular, for a user, the structure
super categories together with the axioms would give an interesting
overview of a category:
In fact, we could hope/want to always have:
which could be used e.g. for pickling by construction while exposing
very little implementation details.
Bonus
Each structure category could name the main additional operations, so
that we could have something like:
or maybe:
Limitation
The current model forces the following assumption:
C \subset B \subset A
is a chain of categories andC
is a full subcategory ofA
, thenC
is a full subcategory ofB
andB
is a full subcategory ofA
.In particular, we can't model situations where, within the context of
C
, anyA
morphism is in fact aB
morphism because theB
structure is rigid.
Example: C=Groups, B=Monoids, A=Semigroups.
This is documented in details in the methods .is_fullsubcategory and
.full_super_categories.
Questions
Find good names for all the methods above
Ideas on how to later lift the limitation?
CC: @sagetrac-sage-combinat @hivert @simon-king-jena @darijgr @nbruin @pjbruin @vbraun
Component: categories
Keywords: full subcategories, homset
Author: Nicolas M. Thiéry
Branch:
eb621c7
Reviewer: Darij Grinberg, Travis Scrimshaw, Simon King
Issue created by migration from https://trac.sagemath.org/ticket/16340
The text was updated successfully, but these errors were encountered: