Skip to content
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

Categories for Family #34340

Open
mkoeppe opened this issue Aug 11, 2022 · 179 comments · May be fixed by #35175
Open

Categories for Family #34340

mkoeppe opened this issue Aug 11, 2022 · 179 comments · May be fixed by #35175

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 11, 2022

Currently a LazyFamily is automatically in EnumeratedSets, so at most countable.

We add keyword category to the constructor Family and all implementation classes, so that the user can choose the correct category.

Moreover, we define a (non-full) subcategory of Sets named Families, which captures the additional structure (= the map from the keys onto the parent).

Follow-ups / related:

Depends on #34375

CC: @tscrim

Component: combinatorics

Work Issues: Add method "as_map"

Author: Matthias Koeppe

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

@mkoeppe mkoeppe added this to the sage-9.7 milestone Aug 11, 2022
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 11, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 14, 2022

Commit: 6de0424

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 14, 2022

New commits:

6de0424Family: Pass keyword 'category' through to implementation classes

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 14, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

5809547src/sage/sets/family.py: Expand doc, clarify relationship to collections.abc and the Sets() category

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 14, 2022

Changed commit from 6de0424 to 5809547

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

18937bbsrc/sage/sets/family.py: Accept init arg 'category' in Family implementation classes

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Changed commit from 5809547 to 18937bb

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

96dd8casrc/sage/sets/family.py: Update copyright according to git blame -w --date=format:%Y FILE | sort -k2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Changed commit from 18937bb to 96dd8ca

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

9efef62src/sage/sets/family.py: Improve some docstring markup

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Changed commit from 96dd8ca to 9efef62

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 15, 2022

Author: Matthias Koeppe

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title LazyFamily: Accept category keyword Family: Accept category keyword Aug 15, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

cdfb2dbsrc/sage/sets/family.py: Add example with an uncountable index set

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Changed commit from 9efef62 to cdfb2db

@mkoeppe

This comment has been minimized.

@tscrim
Copy link
Collaborator

tscrim commented Aug 15, 2022

comment:14

The main part of your changes LGTM, it is good to have this extra flexibility. I just have some issues with the docstring you changed.

For the first paragraph, I am not a fan of giving implementation details to the more casual user in the docstring. If they care about such details, then they almost certainly are already looking at the code. I know it was there previously, but now it has been given more prominence. So I think the first paragraph about the function being a factory should go last (although I really would like to remove it altogether).

The second paragraph is good (I am not counting the one-line description as a paragraph).

I don't really understand the third paragraph, even what you are trying to say. My thought is that it will be far too technical and likely should be removed. Although it would be worthwhile to state that iterating through the object returns the values rather than the keys.

I don't understand the second part of the fourth paragraph. I think I know what you are trying to say, but that is not anything that belongs in this documentation. It seems like a code comment for within the category. I don't think the first sentence is even necessary (this is true for nearly every object in Sage).

I would change .. NOTE:: -> .. WARNING::.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 15, 2022

comment:15

It boils down to this: When the function is not injective, there is a subtle conflict between methods such as __len__ according to the collections.abc and cardinality from Sets.ParentMethods. Arguably, __len__ should return the number of keys, whereas cardinality definitely must return the cardinality of the set (values)

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Changed commit from cdfb2db to 5fa0915

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 15, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

5fa0915src/sage/sets/family.py: NOTE -> WARNING, talk about factory later

@tscrim
Copy link
Collaborator

tscrim commented Aug 15, 2022

comment:17

Unfortunately I don't see how that is in the documentation (beyond the .. WARNING::; also `iter` -> ``iter`` in there). Nor does that seem to be true that is is values():

sage: F = Family([1,1,1])
sage: F
Family (1, 1, 1)
sage: F.cardinality()
3

The __len__ also redirects from cardinality() by default (from the category). Or perhaps that is your point, that it is different than what you would expect as a set (of values). Since this is a mapping, it is a set of pairs (k, v), so the cardinality for me is consistent.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 18, 2022

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

b96983asrc/sage/algebras/yangian.py: Make GeneratorIndexingSet a Parent
75ea8bfMerge #34375

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 18, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

993c9ccsrc/doc/en/reference/categories/index.rst: Add new files

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 18, 2022

Changed commit from 75ea8bf to 993c9cc

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

f49dc8dsrc/sage/sets/family.py: WIP facade families

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Changed commit from 993c9cc to f49dc8d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Changed commit from f49dc8d to 7d7e23b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

7d7e23bsrc/sage/categories/families.py: Make all families facade

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

fa7accbLazyFamily.__init__: Category when index set is infinite depends on is_injective
434932fsrc/sage/categories/families.py: Update doctest output for facade sets
7569a95src/sage/categories/finitely_enumerated_families.py: New

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Changed commit from 7d7e23b to 7569a95

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 25, 2022

Changed dependencies from #34375, #34377 to #34375, #34377, #30300

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 26, 2022

Work Issues: Add method "as_map"

@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 1, 2022

Changed dependencies from #34375, #34377, #30300 to #34375

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 17, 2022

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

5be1bdfsrc/sage/categories/families.py: New
bfab550src/sage/categories/families.py: Add example
5857d9bsrc/sage/categories/enumerated_families.py: New
af7aa99src/sage/sets/family.py: Use category EnumeratedFamilies
dd48ffdsrc/doc/en/reference/categories/index.rst: Add new files
22970fdsrc/sage/sets/family.py: WIP facade families
fe3a7a4src/sage/categories/families.py: Make all families facade
204c1e2LazyFamily.__init__: Category when index set is infinite depends on is_injective
b8f5295src/sage/categories/families.py: Update doctest output for facade sets
0b352a8src/sage/categories/finitely_enumerated_families.py: New

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 17, 2022

Changed commit from 7569a95 to 0b352a8

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 17, 2022

Changed commit from 0b352a8 to 6bbbdb9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 17, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

b4f413dReplacing the indedxing set of the Yangian with cartesian_product.
a346bffFixing pyflakes for yangian.py.
abf1edcChoosing smaller degree elements to run the test suite.
6bbbdb9Merge #34375

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 17, 2022

Changed commit from 6bbbdb9 to f3cdfe8

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 17, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

e6c999fsrc/sage/sets/family.py: Rephrase a sentence
f3cdfe8src/sage/sets/family.py: Mention that families are immutable (fixes Trac #14124)

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 18, 2022

comment:143
sage -t --random-seed=143738364655453723155583373959896127051 src/sage/combinat/root_system/type_G.py  # 1 doctest failed
sage -t --random-seed=143738364655453723155583373959896127051 src/sage/sets/family.py  # 6 doctests failed

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 3, 2023

Changed commit from f3cdfe8 to 192483d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 3, 2023

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

4b73142src/sage/categories/enumerated_families.py: New
4bb87f6src/sage/sets/family.py: Use category EnumeratedFamilies
533cadcsrc/doc/en/reference/categories/index.rst: Add new files
c0ce059src/sage/sets/family.py: WIP facade families
fcf8d99src/sage/categories/families.py: Make all families facade
306c62aLazyFamily.__init__: Category when index set is infinite depends on is_injective
13490f6src/sage/categories/families.py: Update doctest output for facade sets
3bb3b53src/sage/categories/finitely_enumerated_families.py: New
cd42510src/sage/sets/family.py: Rephrase a sentence
192483dsrc/sage/sets/family.py: Mention that families are immutable (fixes Trac #14124)

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 22, 2023

Removed branch from issue description; replaced by PR #35175

@mkoeppe mkoeppe removed this from the sage-10.0 milestone Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants