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

Set() should construct facade parents or use ElementWrapper #34387

Open
mkoeppe opened this issue Aug 18, 2022 · 38 comments
Open

Set() should construct facade parents or use ElementWrapper #34387

mkoeppe opened this issue Aug 18, 2022 · 38 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Aug 18, 2022

Currently, Set(...) does not always construct an object with the full set of set operations.

sage: P = Set(Primes()); P
Set of all prime numbers: 2, 3, 5, 7, ...
sage: P.union
AttributeError: 'Primes_with_category' object has no attribute 'union'
sage: type(P)
<class 'sage.sets.primes.Primes_with_category'>

We change this so that users can rely on the methods provided by the mixins Set_base, Set_boolean_operators, Set_add_sub_operators being available.

When Set(...) does construct an instance of Set_object, this is a parent whose elements do not belong to it. We update the category so that it is in Sets().Facade().

We add the option Set(..., universe=...). This option will be handled like Sequence(..., universe=...): We convert the given elements to the given parent first. Via #34461, we register a "pointless" inclusion map from the set to the universe.

Finally, we add the option Set(..., facade=False). In this case, Set will use ElementWrappers.

Here on the ticket we ignore all issues of (1) sets of unhashable elements (#23324, #33932) and (2) abuses of Set and EnumeratedSets for multisets (#34389).

Depends on #34461

CC: @tscrim

Component: categories

Author: Matthias Koeppe

Branch/Commit: u/mkoeppe/set___should_construct_facade_parents @ 9cc1113

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

@mkoeppe mkoeppe added this to the sage-9.7 milestone Aug 18, 2022
@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 18, 2022

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 19, 2022

Commit: 45245b1

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 19, 2022

New commits:

b19a1ffsrc/sage/sets/set.py: Accept and handle 'category' arguments
d461411Update doctest outputs
df327b9src/sage/sets/set.py: Refine categories of unions, intersections, differences
8a30493src/sage/sets/set.py: Simplify category checks as suggested
141ebf1src/sage/categories/sets_cat.py: Update doctest output
8aa274esrc/sage/categories/sets_cat.py: Fix doctest
402af5dMerge #34376
45245b1WIP Set_parent

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Changed commit from 45245b1 to 6424fea

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

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

6424feaSet: Always create facade sets

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

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

233da80src/sage/sets/set.py: Pass keyword 'facade' to `__init__` methods

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Changed commit from 6424fea to 233da80

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 19, 2022

Author: Matthias Koeppe

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

Changed commit from 233da80 to c10ff34

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 19, 2022

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

c10ff34src/sage/categories/homset.py: Remove outdated 'todo' in doctest

@mkoeppe mkoeppe changed the title Set() should construct facade parents Set() should construct facade parents or use ElementWrapper Aug 19, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 20, 2022

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

fbdda32Update some doctest outputs

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 20, 2022

Changed commit from c10ff34 to fbdda32

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 31, 2022

Changed dependencies from #34376 to #34376, #34461

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

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

5db7f09src/sage/categories/morphism.pyx (FacadeInclusionMorphism): New
dc94887Merge #34461
96b6b94WIP use FacadeInclusionMorphism

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Changed commit from fbdda32 to 96b6b94

@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Changed commit from 96b6b94 to 0965a16

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

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

fe22973Merge tag '9.7.rc0' into t/34387/set___should_construct_facade_parents
62634bcsrc/sage/sets/set.py (Set): If input is a parent, make use it as facade_for
0965a16src/sage/sets/set.py: Add examples

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

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

83c5ec0src/sage/sets/real_set.py (RealSet): Make it a subclass of Set_parent

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Changed commit from 0965a16 to 83c5ec0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

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

8d7518bsrc/sage/sets/set.py (Set): Pass input through if it is a Set_parent of the right category

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Changed commit from 83c5ec0 to 8d7518b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

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

5890ff0src/sage/sets/real_set.py (RealSet): Make it a facade parent
aade7d1src/sage/sets/set.py: Add examples
c4f1cb5src/sage/sets/real_set.py (RealSet): Make it a facade parent (fixup)
caae0b3src/sage/sets/set.py (Set_object_enumerated): Do not require passed category to be a subcat
20c153dsrc/sage/sets/set.py (Set_object._element_constructor_): New
9a789a9RealSet._element_constructor_: Add example

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Changed commit from 8d7518b to 9a789a9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

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

203bb84src/sage/categories/enumerated_sets.py: Update doctest output
cfb975esrc/sage/sets/set.py (Set_object._element_constructor_): When universe is given, convert to it

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Changed commit from 9a789a9 to cfb975e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

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

e86438bsrc/sage/sets/set.py (Set): Handle generators of unhashables. Fixes part of #33932

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 31, 2022

Changed commit from cfb975e to e86438b

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2022

Changed commit from e86438b to 8c1212b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2022

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

8c1212bSet, Set_object_enumerated: Use both frozenset and tuple; remove methods duplicated from category

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2022

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

f117aa2src/sage/sets/finite_set_map_cy.pyx: Do not use Set_object_enumerated directly

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2022

Changed commit from 8c1212b to f117aa2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2022

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

9cc1113src/sage/sets/{set,image_set,real_set}.py, src/sage/categories/[finite_]enumerated_sets.py: Update copyright according to git blame -w --date=format:%Y FILE | sort -k2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2022

Changed commit from f117aa2 to 9cc1113

@mkoeppe
Copy link
Member Author

mkoeppe commented Sep 1, 2022

Changed dependencies from #34376, #34461 to #34461

@mkoeppe

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant