-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Set_object_enumerated should be in FiniteEnumeratedSets() #34376
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Commit: |
New commits:
|
Author: Matthias Koeppe |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:8
You shouldn't need the You can simplify these checks: - if all(S in Sets().Finite() for S in (X, Y)):
- category = category.Finite()
if all(S in Sets().Enumerated() for S in (X, Y)):
category = category.Enumerated()
if any(S in Sets().Infinite() for S in (X, Y)):
category = category.Infinite()
+ elif all(S in Sets().Finite() for S in (X, Y)):
+ category = category.Finite()
Set_object_binary.__init__(self, X, Y, "union", "\\cup", category=category) - if X in Sets().Finite():
- category = category.Finite()
if X in Sets().Enumerated():
category = category.Enumerated()
+ if X in Sets().Finite():
+ category = category.Finite()
+ elif X in Sets().Infinite() and Y in Sets().Finite():
- if X in Sets().Infinite() and Y in Sets().Finite():
category = category.Infinite()
Set_object_binary.__init__(self, X, Y, "difference", "-", category=category) I am also slightly worried about this change: diff --git a/src/sage/categories/enumerated_sets.py b/src/sage/categories/enumerated_sets.py
index 563a802..e1dcbd8 100644
--- a/src/sage/categories/enumerated_sets.py
+++ b/src/sage/categories/enumerated_sets.py
@@ -137,7 +137,7 @@ class EnumeratedSets(CategoryWithAxiom):
sage: S = EnumeratedSets()(Set([1, 2, 3])); S
{1, 2, 3}
sage: S.category()
- Category of facade finite enumerated sets
+ Category of finite enumerated sets
Also Python3 range are now accepted::
Can you explain why this happened? I can't see the reason immediately from your changes. |
comment:9
Thanks! I agree with these simplifications. I'll investigate how the facade got lost |
comment:10
By the way, should these |
comment:11
I think so. All of the various constructions (e.g., |
comment:12
Replying to @tscrim:
Set([1, 2, 3]) is already in |
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
comment:17
Replying to @tscrim:
The new method Now why exactly |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:19
Replying to @mkoeppe:
Ah, because of |
comment:20
Good idea. |
comment:22
This ended up being a good test:
because
However, fixing that is for another ticket. |
Reviewer: Travis Scrimshaw |
comment:23
Yes, I was briefly surprised by this one. |
comment:24
By the way, I'm a bit annoyed by |
comment:25
It is quite possible that people in combinatorics use it. For example, things like
should call it (the implementation does a redirect to the category). |
comment:26
There's probably a better solution for getting this kind of syntax when it's convenient, maybe using a mixin class (like the mixin classes Also one could maybe have something like an But that's for another ticket. Thanks for the review! |
This comment has been minimized.
This comment has been minimized.
comment:28
Replying to @mkoeppe:
That would negate a fair part of the category framework, it removes the fact that an enumerated set should (generally) behave like a list, and essentially every
Indeed. No problem. |
Changed branch from u/mkoeppe/set_object_enumerated_should_be_in_finiteenumeratedsets__ to |
Likewise for the
Set_object_binary
classes (which implement lazy union, intersection, ...), the category should be computed from the categories of the inputs.Also we add a
category
argument to theSet
factory and the__init__
methods of the various implementation classes.Follow ups:
Set_object_enumerated
andFiniteEnumeratedSet
(andTrivialFamily
,EnumeratedFamily
) should be clarifiedSet()
should construct facade parentsCC: @tscrim
Component: categories
Author: Matthias Koeppe
Branch/Commit:
e58d2ab
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/34376
The text was updated successfully, but these errors were encountered: