passagemath-objects 10.6.41__cp314-cp314t-macosx_13_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-objects might be problematic. Click here for more details.
- passagemath_objects/.dylibs/libgmp.10.dylib +0 -0
- passagemath_objects/__init__.py +3 -0
- passagemath_objects-10.6.41.dist-info/METADATA +115 -0
- passagemath_objects-10.6.41.dist-info/RECORD +280 -0
- passagemath_objects-10.6.41.dist-info/WHEEL +6 -0
- passagemath_objects-10.6.41.dist-info/top_level.txt +3 -0
- sage/all__sagemath_objects.py +37 -0
- sage/arith/all__sagemath_objects.py +5 -0
- sage/arith/long.pxd +411 -0
- sage/arith/numerical_approx.cpython-314t-darwin.so +0 -0
- sage/arith/numerical_approx.pxd +35 -0
- sage/arith/numerical_approx.pyx +75 -0
- sage/arith/power.cpython-314t-darwin.so +0 -0
- sage/arith/power.pxd +31 -0
- sage/arith/power.pyx +127 -0
- sage/categories/action.cpython-314t-darwin.so +0 -0
- sage/categories/action.pxd +29 -0
- sage/categories/action.pyx +641 -0
- sage/categories/algebra_functor.py +745 -0
- sage/categories/all__sagemath_objects.py +33 -0
- sage/categories/basic.py +62 -0
- sage/categories/cartesian_product.py +295 -0
- sage/categories/category.py +3401 -0
- sage/categories/category_cy_helper.cpython-314t-darwin.so +0 -0
- sage/categories/category_cy_helper.pxd +8 -0
- sage/categories/category_cy_helper.pyx +322 -0
- sage/categories/category_singleton.cpython-314t-darwin.so +0 -0
- sage/categories/category_singleton.pxd +3 -0
- sage/categories/category_singleton.pyx +342 -0
- sage/categories/category_types.py +637 -0
- sage/categories/category_with_axiom.py +2876 -0
- sage/categories/covariant_functorial_construction.py +703 -0
- sage/categories/facade_sets.py +228 -0
- sage/categories/functor.cpython-314t-darwin.so +0 -0
- sage/categories/functor.pxd +7 -0
- sage/categories/functor.pyx +691 -0
- sage/categories/homset.py +1338 -0
- sage/categories/homsets.py +364 -0
- sage/categories/isomorphic_objects.py +73 -0
- sage/categories/map.cpython-314t-darwin.so +0 -0
- sage/categories/map.pxd +34 -0
- sage/categories/map.pyx +2112 -0
- sage/categories/morphism.cpython-314t-darwin.so +0 -0
- sage/categories/morphism.pxd +14 -0
- sage/categories/morphism.pyx +895 -0
- sage/categories/objects.py +167 -0
- sage/categories/primer.py +1696 -0
- sage/categories/pushout.py +4834 -0
- sage/categories/quotients.py +64 -0
- sage/categories/realizations.py +200 -0
- sage/categories/sets_cat.py +3228 -0
- sage/categories/sets_with_partial_maps.py +52 -0
- sage/categories/subobjects.py +64 -0
- sage/categories/subquotients.py +21 -0
- sage/categories/with_realizations.py +311 -0
- sage/cpython/__init__.py +19 -0
- sage/cpython/_py2_random.py +619 -0
- sage/cpython/all.py +3 -0
- sage/cpython/atexit.cpython-314t-darwin.so +0 -0
- sage/cpython/atexit.pyx +269 -0
- sage/cpython/builtin_types.cpython-314t-darwin.so +0 -0
- sage/cpython/builtin_types.pyx +7 -0
- sage/cpython/cython_metaclass.cpython-314t-darwin.so +0 -0
- sage/cpython/cython_metaclass.h +117 -0
- sage/cpython/cython_metaclass.pxd +3 -0
- sage/cpython/cython_metaclass.pyx +130 -0
- sage/cpython/debug.cpython-314t-darwin.so +0 -0
- sage/cpython/debug.pyx +302 -0
- sage/cpython/dict_del_by_value.cpython-314t-darwin.so +0 -0
- sage/cpython/dict_del_by_value.pxd +9 -0
- sage/cpython/dict_del_by_value.pyx +191 -0
- sage/cpython/dict_internal.h +245 -0
- sage/cpython/getattr.cpython-314t-darwin.so +0 -0
- sage/cpython/getattr.pxd +9 -0
- sage/cpython/getattr.pyx +439 -0
- sage/cpython/pycore_long.h +97 -0
- sage/cpython/pycore_long.pxd +10 -0
- sage/cpython/python_debug.h +44 -0
- sage/cpython/python_debug.pxd +47 -0
- sage/cpython/pyx_visit.h +13 -0
- sage/cpython/string.cpython-314t-darwin.so +0 -0
- sage/cpython/string.pxd +76 -0
- sage/cpython/string.pyx +34 -0
- sage/cpython/string_impl.h +60 -0
- sage/cpython/type.cpython-314t-darwin.so +0 -0
- sage/cpython/type.pxd +2 -0
- sage/cpython/type.pyx +40 -0
- sage/cpython/wrapperdescr.pxd +67 -0
- sage/ext/all__sagemath_objects.py +3 -0
- sage/ext/ccobject.h +64 -0
- sage/ext/cplusplus.pxd +17 -0
- sage/ext/mod_int.h +30 -0
- sage/ext/mod_int.pxd +24 -0
- sage/ext/stdsage.pxd +39 -0
- sage/groups/all__sagemath_objects.py +1 -0
- sage/groups/group.cpython-314t-darwin.so +0 -0
- sage/groups/group.pxd +14 -0
- sage/groups/group.pyx +322 -0
- sage/groups/old.cpython-314t-darwin.so +0 -0
- sage/groups/old.pxd +14 -0
- sage/groups/old.pyx +219 -0
- sage/libs/all__sagemath_objects.py +3 -0
- sage/libs/gmp/__init__.py +1 -0
- sage/libs/gmp/all.pxd +6 -0
- sage/libs/gmp/binop.pxd +23 -0
- sage/libs/gmp/misc.pxd +8 -0
- sage/libs/gmp/mpf.pxd +88 -0
- sage/libs/gmp/mpn.pxd +57 -0
- sage/libs/gmp/mpq.pxd +57 -0
- sage/libs/gmp/mpz.pxd +202 -0
- sage/libs/gmp/pylong.cpython-314t-darwin.so +0 -0
- sage/libs/gmp/pylong.pxd +12 -0
- sage/libs/gmp/pylong.pyx +150 -0
- sage/libs/gmp/random.pxd +25 -0
- sage/libs/gmp/randomize.pxd +59 -0
- sage/libs/gmp/types.pxd +53 -0
- sage/libs/gmpxx.pxd +19 -0
- sage/misc/abstract_method.py +276 -0
- sage/misc/all__sagemath_objects.py +43 -0
- sage/misc/bindable_class.py +253 -0
- sage/misc/c3_controlled.cpython-314t-darwin.so +0 -0
- sage/misc/c3_controlled.pxd +2 -0
- sage/misc/c3_controlled.pyx +1402 -0
- sage/misc/cachefunc.cpython-314t-darwin.so +0 -0
- sage/misc/cachefunc.pxd +43 -0
- sage/misc/cachefunc.pyx +3781 -0
- sage/misc/call.py +188 -0
- sage/misc/classcall_metaclass.cpython-314t-darwin.so +0 -0
- sage/misc/classcall_metaclass.pxd +14 -0
- sage/misc/classcall_metaclass.pyx +599 -0
- sage/misc/constant_function.cpython-314t-darwin.so +0 -0
- sage/misc/constant_function.pyx +130 -0
- sage/misc/decorators.py +747 -0
- sage/misc/fast_methods.cpython-314t-darwin.so +0 -0
- sage/misc/fast_methods.pxd +20 -0
- sage/misc/fast_methods.pyx +351 -0
- sage/misc/flatten.py +90 -0
- sage/misc/fpickle.cpython-314t-darwin.so +0 -0
- sage/misc/fpickle.pyx +177 -0
- sage/misc/function_mangling.cpython-314t-darwin.so +0 -0
- sage/misc/function_mangling.pxd +11 -0
- sage/misc/function_mangling.pyx +308 -0
- sage/misc/inherit_comparison.cpython-314t-darwin.so +0 -0
- sage/misc/inherit_comparison.pxd +5 -0
- sage/misc/inherit_comparison.pyx +105 -0
- sage/misc/instancedoc.cpython-314t-darwin.so +0 -0
- sage/misc/instancedoc.pyx +331 -0
- sage/misc/lazy_attribute.cpython-314t-darwin.so +0 -0
- sage/misc/lazy_attribute.pyx +607 -0
- sage/misc/lazy_format.py +135 -0
- sage/misc/lazy_import.cpython-314t-darwin.so +0 -0
- sage/misc/lazy_import.pyx +1299 -0
- sage/misc/lazy_import_cache.py +36 -0
- sage/misc/lazy_list.cpython-314t-darwin.so +0 -0
- sage/misc/lazy_list.pxd +19 -0
- sage/misc/lazy_list.pyx +1187 -0
- sage/misc/lazy_string.cpython-314t-darwin.so +0 -0
- sage/misc/lazy_string.pxd +7 -0
- sage/misc/lazy_string.pyx +546 -0
- sage/misc/misc.py +1066 -0
- sage/misc/misc_c.cpython-314t-darwin.so +0 -0
- sage/misc/misc_c.pxd +3 -0
- sage/misc/misc_c.pyx +766 -0
- sage/misc/namespace_package.py +37 -0
- sage/misc/nested_class.cpython-314t-darwin.so +0 -0
- sage/misc/nested_class.pxd +3 -0
- sage/misc/nested_class.pyx +394 -0
- sage/misc/persist.cpython-314t-darwin.so +0 -0
- sage/misc/persist.pyx +1251 -0
- sage/misc/prandom.py +418 -0
- sage/misc/randstate.cpython-314t-darwin.so +0 -0
- sage/misc/randstate.pxd +30 -0
- sage/misc/randstate.pyx +1059 -0
- sage/misc/repr.py +203 -0
- sage/misc/reset.cpython-314t-darwin.so +0 -0
- sage/misc/reset.pyx +196 -0
- sage/misc/sage_ostools.cpython-314t-darwin.so +0 -0
- sage/misc/sage_ostools.pyx +323 -0
- sage/misc/sage_timeit.py +276 -0
- sage/misc/sage_timeit_class.cpython-314t-darwin.so +0 -0
- sage/misc/sage_timeit_class.pyx +120 -0
- sage/misc/sage_unittest.py +637 -0
- sage/misc/sageinspect.py +2768 -0
- sage/misc/session.cpython-314t-darwin.so +0 -0
- sage/misc/session.pyx +392 -0
- sage/misc/superseded.py +557 -0
- sage/misc/test_nested_class.py +228 -0
- sage/misc/timing.py +264 -0
- sage/misc/unknown.py +222 -0
- sage/misc/verbose.py +253 -0
- sage/misc/weak_dict.cpython-314t-darwin.so +0 -0
- sage/misc/weak_dict.pxd +15 -0
- sage/misc/weak_dict.pyx +1231 -0
- sage/modules/all__sagemath_objects.py +1 -0
- sage/modules/module.cpython-314t-darwin.so +0 -0
- sage/modules/module.pxd +5 -0
- sage/modules/module.pyx +329 -0
- sage/rings/all__sagemath_objects.py +3 -0
- sage/rings/integer_fake.h +22 -0
- sage/rings/integer_fake.pxd +55 -0
- sage/sets/all__sagemath_objects.py +3 -0
- sage/sets/pythonclass.cpython-314t-darwin.so +0 -0
- sage/sets/pythonclass.pxd +9 -0
- sage/sets/pythonclass.pyx +247 -0
- sage/structure/__init__.py +4 -0
- sage/structure/all.py +30 -0
- sage/structure/category_object.cpython-314t-darwin.so +0 -0
- sage/structure/category_object.pxd +28 -0
- sage/structure/category_object.pyx +1087 -0
- sage/structure/coerce.cpython-314t-darwin.so +0 -0
- sage/structure/coerce.pxd +44 -0
- sage/structure/coerce.pyx +2107 -0
- sage/structure/coerce_actions.cpython-314t-darwin.so +0 -0
- sage/structure/coerce_actions.pxd +27 -0
- sage/structure/coerce_actions.pyx +988 -0
- sage/structure/coerce_dict.cpython-314t-darwin.so +0 -0
- sage/structure/coerce_dict.pxd +51 -0
- sage/structure/coerce_dict.pyx +1557 -0
- sage/structure/coerce_exceptions.py +23 -0
- sage/structure/coerce_maps.cpython-314t-darwin.so +0 -0
- sage/structure/coerce_maps.pxd +28 -0
- sage/structure/coerce_maps.pyx +718 -0
- sage/structure/debug_options.cpython-314t-darwin.so +0 -0
- sage/structure/debug_options.pxd +6 -0
- sage/structure/debug_options.pyx +54 -0
- sage/structure/dynamic_class.py +541 -0
- sage/structure/element.cpython-314t-darwin.so +0 -0
- sage/structure/element.pxd +272 -0
- sage/structure/element.pyx +4772 -0
- sage/structure/element_wrapper.cpython-314t-darwin.so +0 -0
- sage/structure/element_wrapper.pxd +12 -0
- sage/structure/element_wrapper.pyx +582 -0
- sage/structure/factorization.py +1422 -0
- sage/structure/factorization_integer.py +105 -0
- sage/structure/factory.cpython-314t-darwin.so +0 -0
- sage/structure/factory.pyx +786 -0
- sage/structure/formal_sum.py +489 -0
- sage/structure/gens_py.py +73 -0
- sage/structure/global_options.py +1743 -0
- sage/structure/indexed_generators.py +863 -0
- sage/structure/list_clone.cpython-314t-darwin.so +0 -0
- sage/structure/list_clone.pxd +65 -0
- sage/structure/list_clone.pyx +1867 -0
- sage/structure/list_clone_demo.cpython-314t-darwin.so +0 -0
- sage/structure/list_clone_demo.pyx +248 -0
- sage/structure/list_clone_timings.py +179 -0
- sage/structure/list_clone_timings_cy.cpython-314t-darwin.so +0 -0
- sage/structure/list_clone_timings_cy.pyx +86 -0
- sage/structure/mutability.cpython-314t-darwin.so +0 -0
- sage/structure/mutability.pxd +21 -0
- sage/structure/mutability.pyx +348 -0
- sage/structure/nonexact.py +69 -0
- sage/structure/parent.cpython-314t-darwin.so +0 -0
- sage/structure/parent.pxd +112 -0
- sage/structure/parent.pyx +3093 -0
- sage/structure/parent_base.cpython-314t-darwin.so +0 -0
- sage/structure/parent_base.pxd +13 -0
- sage/structure/parent_base.pyx +44 -0
- sage/structure/parent_gens.cpython-314t-darwin.so +0 -0
- sage/structure/parent_gens.pxd +22 -0
- sage/structure/parent_gens.pyx +377 -0
- sage/structure/parent_old.cpython-314t-darwin.so +0 -0
- sage/structure/parent_old.pxd +25 -0
- sage/structure/parent_old.pyx +294 -0
- sage/structure/proof/__init__.py +1 -0
- sage/structure/proof/all.py +243 -0
- sage/structure/proof/proof.py +300 -0
- sage/structure/richcmp.cpython-314t-darwin.so +0 -0
- sage/structure/richcmp.pxd +213 -0
- sage/structure/richcmp.pyx +495 -0
- sage/structure/sage_object.cpython-314t-darwin.so +0 -0
- sage/structure/sage_object.pxd +3 -0
- sage/structure/sage_object.pyx +988 -0
- sage/structure/sage_object_test.py +19 -0
- sage/structure/sequence.py +937 -0
- sage/structure/set_factories.py +1178 -0
- sage/structure/set_factories_example.py +527 -0
- sage/structure/support_view.py +179 -0
- sage/structure/test_factory.py +56 -0
- sage/structure/unique_representation.py +1359 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-objects
|
|
2
|
+
r"""
|
|
3
|
+
SetsWithPartialMaps
|
|
4
|
+
"""
|
|
5
|
+
#*****************************************************************************
|
|
6
|
+
# Copyright (C) 2008 David Kohel <kohel@maths.usyd.edu> and
|
|
7
|
+
# William Stein <wstein@math.ucsd.edu>
|
|
8
|
+
# Nicolas M. Thiery <nthiery at users.sf.net>
|
|
9
|
+
#
|
|
10
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
11
|
+
# http://www.gnu.org/licenses/
|
|
12
|
+
#******************************************************************************
|
|
13
|
+
|
|
14
|
+
from sage.categories.category_singleton import Category_singleton
|
|
15
|
+
from sage.categories.objects import Objects
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SetsWithPartialMaps(Category_singleton):
|
|
19
|
+
"""
|
|
20
|
+
The category whose objects are sets and whose morphisms are
|
|
21
|
+
maps that are allowed to raise a :exc:`ValueError` on some inputs.
|
|
22
|
+
|
|
23
|
+
This category is equivalent to the category of pointed sets,
|
|
24
|
+
via the equivalence sending an object X to X union {error},
|
|
25
|
+
a morphism f to the morphism of pointed sets that sends x
|
|
26
|
+
to f(x) if f does not raise an error on x, or to error if it
|
|
27
|
+
does.
|
|
28
|
+
|
|
29
|
+
EXAMPLES::
|
|
30
|
+
|
|
31
|
+
sage: SetsWithPartialMaps()
|
|
32
|
+
Category of sets with partial maps
|
|
33
|
+
|
|
34
|
+
sage: SetsWithPartialMaps().super_categories()
|
|
35
|
+
[Category of objects]
|
|
36
|
+
|
|
37
|
+
TESTS::
|
|
38
|
+
|
|
39
|
+
sage: TestSuite(SetsWithPartialMaps()).run()
|
|
40
|
+
"""
|
|
41
|
+
#def __call__(self, X, pt):
|
|
42
|
+
# import sage.sets.all
|
|
43
|
+
# return sage.sets.all.Set(X, pt)
|
|
44
|
+
|
|
45
|
+
def super_categories(self):
|
|
46
|
+
"""
|
|
47
|
+
EXAMPLES::
|
|
48
|
+
|
|
49
|
+
sage: SetsWithPartialMaps().super_categories()
|
|
50
|
+
[Category of objects]
|
|
51
|
+
"""
|
|
52
|
+
return [Objects()]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-objects
|
|
2
|
+
"""
|
|
3
|
+
Subobjects Functorial Construction
|
|
4
|
+
|
|
5
|
+
AUTHORS:
|
|
6
|
+
|
|
7
|
+
- Nicolas M. Thiery (2010): initial revision
|
|
8
|
+
"""
|
|
9
|
+
#*****************************************************************************
|
|
10
|
+
# Copyright (C) 2009 Nicolas M. Thiery <nthiery at users.sf.net>
|
|
11
|
+
#
|
|
12
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
13
|
+
# http://www.gnu.org/licenses/
|
|
14
|
+
#*****************************************************************************
|
|
15
|
+
|
|
16
|
+
from sage.categories.category import Category
|
|
17
|
+
from sage.categories.covariant_functorial_construction import RegressiveCovariantConstructionCategory
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class SubobjectsCategory(RegressiveCovariantConstructionCategory):
|
|
21
|
+
|
|
22
|
+
_functor_category = "Subobjects"
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def default_super_categories(cls, category):
|
|
26
|
+
"""
|
|
27
|
+
Return the default super categories of ``category.Subobjects()``.
|
|
28
|
+
|
|
29
|
+
Mathematical meaning: if `A` is a subobject of `B` in the
|
|
30
|
+
category `C`, then `A` is also a subquotient of `B` in the
|
|
31
|
+
category `C`.
|
|
32
|
+
|
|
33
|
+
INPUT:
|
|
34
|
+
|
|
35
|
+
- ``cls`` -- the class ``SubobjectsCategory``
|
|
36
|
+
- ``category`` -- a category `Cat`
|
|
37
|
+
|
|
38
|
+
OUTPUT: a (join) category
|
|
39
|
+
|
|
40
|
+
In practice, this returns ``category.Subquotients()``, joined
|
|
41
|
+
together with the result of the method
|
|
42
|
+
:meth:`RegressiveCovariantConstructionCategory.default_super_categories() <sage.categories.covariant_functorial_construction.RegressiveCovariantConstructionCategory.default_super_categories>`
|
|
43
|
+
(that is the join of ``category`` and ``cat.Subobjects()`` for
|
|
44
|
+
each ``cat`` in the super categories of ``category``).
|
|
45
|
+
|
|
46
|
+
EXAMPLES:
|
|
47
|
+
|
|
48
|
+
Consider ``category=Groups()``, which has ``cat=Monoids()`` as
|
|
49
|
+
super category. Then, a subgroup of a group `G` is
|
|
50
|
+
simultaneously a subquotient of `G`, a group by itself, and a
|
|
51
|
+
submonoid of `G`::
|
|
52
|
+
|
|
53
|
+
sage: Groups().Subobjects().super_categories()
|
|
54
|
+
[Category of groups, Category of subquotients of monoids, Category of subobjects of sets]
|
|
55
|
+
|
|
56
|
+
Mind the last item above: there is indeed currently nothing
|
|
57
|
+
implemented about submonoids.
|
|
58
|
+
|
|
59
|
+
This resulted from the following call::
|
|
60
|
+
|
|
61
|
+
sage: sage.categories.subobjects.SubobjectsCategory.default_super_categories(Groups())
|
|
62
|
+
Join of Category of groups and Category of subquotients of monoids and Category of subobjects of sets
|
|
63
|
+
"""
|
|
64
|
+
return Category.join([category.Subquotients(), super().default_super_categories(category)])
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-objects
|
|
2
|
+
"""
|
|
3
|
+
Subquotient Functorial Construction
|
|
4
|
+
|
|
5
|
+
AUTHORS:
|
|
6
|
+
|
|
7
|
+
- Nicolas M. Thiery (2010): initial revision
|
|
8
|
+
"""
|
|
9
|
+
#*****************************************************************************
|
|
10
|
+
# Copyright (C) 2009 Nicolas M. Thiery <nthiery at users.sf.net>
|
|
11
|
+
#
|
|
12
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
13
|
+
# http://www.gnu.org/licenses/
|
|
14
|
+
#*****************************************************************************
|
|
15
|
+
|
|
16
|
+
from sage.categories.covariant_functorial_construction import RegressiveCovariantConstructionCategory
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SubquotientsCategory(RegressiveCovariantConstructionCategory):
|
|
20
|
+
|
|
21
|
+
_functor_category = "Subquotients"
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-objects
|
|
2
|
+
"""
|
|
3
|
+
With Realizations Covariant Functorial Construction
|
|
4
|
+
|
|
5
|
+
.. SEEALSO::
|
|
6
|
+
|
|
7
|
+
- :func:`Sets().WithRealizations <sage.categories.with_realizations.WithRealizations>`
|
|
8
|
+
for an introduction to *realizations* and *with realizations*.
|
|
9
|
+
- :mod:`sage.categories.covariant_functorial_construction`
|
|
10
|
+
for an introduction to covariant functorial constructions.
|
|
11
|
+
"""
|
|
12
|
+
#*****************************************************************************
|
|
13
|
+
# Copyright (C) 2010-2012 Nicolas M. Thiery <nthiery at users.sf.net>
|
|
14
|
+
#
|
|
15
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
16
|
+
# http://www.gnu.org/licenses/
|
|
17
|
+
#*****************************************************************************
|
|
18
|
+
|
|
19
|
+
from sage.categories.category import Category
|
|
20
|
+
from sage.categories.covariant_functorial_construction import RegressiveCovariantConstructionCategory
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def WithRealizations(self):
|
|
24
|
+
r"""
|
|
25
|
+
Return the category of parents in ``self`` endowed with multiple realizations.
|
|
26
|
+
|
|
27
|
+
INPUT:
|
|
28
|
+
|
|
29
|
+
- ``self`` -- a category
|
|
30
|
+
|
|
31
|
+
.. SEEALSO::
|
|
32
|
+
|
|
33
|
+
- The documentation and code
|
|
34
|
+
(:mod:`sage.categories.examples.with_realizations`) of
|
|
35
|
+
``Sets().WithRealizations().example()`` for more on how to use and
|
|
36
|
+
implement a parent with several realizations.
|
|
37
|
+
|
|
38
|
+
- Various use cases:
|
|
39
|
+
|
|
40
|
+
- :class:`SymmetricFunctions`
|
|
41
|
+
- :class:`QuasiSymmetricFunctions`
|
|
42
|
+
- :class:`NonCommutativeSymmetricFunctions`
|
|
43
|
+
- :class:`SymmetricFunctionsNonCommutingVariables`
|
|
44
|
+
- :class:`DescentAlgebra`
|
|
45
|
+
- :class:`algebras.Moebius`
|
|
46
|
+
- :class:`IwahoriHeckeAlgebra`
|
|
47
|
+
- :class:`ExtendedAffineWeylGroup`
|
|
48
|
+
|
|
49
|
+
- The `Implementing Algebraic Structures
|
|
50
|
+
<../../../../../thematic_tutorials/tutorial-implementing-algebraic-structures>`_
|
|
51
|
+
thematic tutorial.
|
|
52
|
+
|
|
53
|
+
- :mod:`sage.categories.realizations`
|
|
54
|
+
|
|
55
|
+
.. NOTE:: this *function* is actually inserted as a *method* in the class
|
|
56
|
+
:class:`~sage.categories.category.Category` (see
|
|
57
|
+
:meth:`~sage.categories.category.Category.WithRealizations`). It is defined
|
|
58
|
+
here for code locality reasons.
|
|
59
|
+
|
|
60
|
+
EXAMPLES::
|
|
61
|
+
|
|
62
|
+
sage: Sets().WithRealizations()
|
|
63
|
+
Category of sets with realizations
|
|
64
|
+
|
|
65
|
+
.. RUBRIC:: Parent with realizations
|
|
66
|
+
|
|
67
|
+
Let us now explain the concept of realizations. A *parent with
|
|
68
|
+
realizations* is a facade parent (see :class:`Sets.Facade`)
|
|
69
|
+
admitting multiple concrete realizations where its elements are
|
|
70
|
+
represented. Consider for example an algebra `A` which admits
|
|
71
|
+
several natural bases::
|
|
72
|
+
|
|
73
|
+
sage: A = Sets().WithRealizations().example(); A # needs sage.modules
|
|
74
|
+
The subset algebra of {1, 2, 3} over Rational Field
|
|
75
|
+
|
|
76
|
+
For each such basis `B` one implements a parent `P_B` which
|
|
77
|
+
realizes `A` with its elements represented by expanding them on
|
|
78
|
+
the basis `B`::
|
|
79
|
+
|
|
80
|
+
sage: # needs sage.modules
|
|
81
|
+
sage: A.F()
|
|
82
|
+
The subset algebra of {1, 2, 3} over Rational Field in the Fundamental basis
|
|
83
|
+
sage: A.Out()
|
|
84
|
+
The subset algebra of {1, 2, 3} over Rational Field in the Out basis
|
|
85
|
+
sage: A.In()
|
|
86
|
+
The subset algebra of {1, 2, 3} over Rational Field in the In basis
|
|
87
|
+
sage: A.an_element()
|
|
88
|
+
F[{}] + 2*F[{1}] + 3*F[{2}] + F[{1, 2}]
|
|
89
|
+
|
|
90
|
+
If `B` and `B'` are two bases, then the change of basis from `B`
|
|
91
|
+
to `B'` is implemented by a canonical coercion between `P_B` and
|
|
92
|
+
`P_{B'}`::
|
|
93
|
+
|
|
94
|
+
sage: # needs sage.modules
|
|
95
|
+
sage: F = A.F(); In = A.In(); Out = A.Out()
|
|
96
|
+
sage: i = In.an_element(); i
|
|
97
|
+
In[{}] + 2*In[{1}] + 3*In[{2}] + In[{1, 2}]
|
|
98
|
+
sage: F(i)
|
|
99
|
+
7*F[{}] + 3*F[{1}] + 4*F[{2}] + F[{1, 2}]
|
|
100
|
+
sage: F.coerce_map_from(Out)
|
|
101
|
+
Generic morphism:
|
|
102
|
+
From: The subset algebra of {1, 2, 3} over Rational Field in the Out basis
|
|
103
|
+
To: The subset algebra of {1, 2, 3} over Rational Field in the Fundamental basis
|
|
104
|
+
|
|
105
|
+
allowing for mixed arithmetic::
|
|
106
|
+
|
|
107
|
+
sage: (1 + Out.from_set(1)) * In.from_set(2,3) # needs sage.modules
|
|
108
|
+
Out[{}] + 2*Out[{1}] + 2*Out[{2}] + 2*Out[{3}] + 2*Out[{1, 2}]
|
|
109
|
+
+ 2*Out[{1, 3}] + 4*Out[{2, 3}] + 4*Out[{1, 2, 3}]
|
|
110
|
+
|
|
111
|
+
In our example, there are three realizations::
|
|
112
|
+
|
|
113
|
+
sage: A.realizations() # needs sage.modules
|
|
114
|
+
[The subset algebra of {1, 2, 3} over Rational Field in the Fundamental basis,
|
|
115
|
+
The subset algebra of {1, 2, 3} over Rational Field in the In basis,
|
|
116
|
+
The subset algebra of {1, 2, 3} over Rational Field in the Out basis]
|
|
117
|
+
|
|
118
|
+
Instead of manually defining the shorthands ``F``, ``In``, and
|
|
119
|
+
``Out``, as above one can just do::
|
|
120
|
+
|
|
121
|
+
sage: A.inject_shorthands() # needs sage.modules
|
|
122
|
+
Defining F as shorthand for
|
|
123
|
+
The subset algebra of {1, 2, 3} over Rational Field in the Fundamental basis
|
|
124
|
+
Defining In as shorthand for
|
|
125
|
+
The subset algebra of {1, 2, 3} over Rational Field in the In basis
|
|
126
|
+
Defining Out as shorthand for
|
|
127
|
+
The subset algebra of {1, 2, 3} over Rational Field in the Out basis
|
|
128
|
+
|
|
129
|
+
.. RUBRIC:: Rationale
|
|
130
|
+
|
|
131
|
+
Besides some goodies described below, the role of `A` is threefold:
|
|
132
|
+
|
|
133
|
+
- To provide, as illustrated above, a single entry point for the
|
|
134
|
+
algebra as a whole: documentation, access to its properties and
|
|
135
|
+
different realizations, etc.
|
|
136
|
+
|
|
137
|
+
- To provide a natural location for the initialization of the
|
|
138
|
+
bases and the coercions between, and other methods that are
|
|
139
|
+
common to all bases.
|
|
140
|
+
|
|
141
|
+
- To let other objects refer to `A` while allowing elements to be
|
|
142
|
+
represented in any of the realizations.
|
|
143
|
+
|
|
144
|
+
We now illustrate this second point by defining the polynomial
|
|
145
|
+
ring with coefficients in `A`::
|
|
146
|
+
|
|
147
|
+
sage: P = A['x']; P # needs sage.modules
|
|
148
|
+
Univariate Polynomial Ring in x over
|
|
149
|
+
The subset algebra of {1, 2, 3} over Rational Field
|
|
150
|
+
sage: x = P.gen() # needs sage.modules
|
|
151
|
+
|
|
152
|
+
In the following examples, the coefficients turn out to be all
|
|
153
|
+
represented in the `F` basis::
|
|
154
|
+
|
|
155
|
+
sage: P.one() # needs sage.modules
|
|
156
|
+
F[{}]
|
|
157
|
+
sage: (P.an_element() + 1)^2 # needs sage.modules
|
|
158
|
+
F[{}]*x^2 + 2*F[{}]*x + F[{}]
|
|
159
|
+
|
|
160
|
+
However we can create a polynomial with mixed coefficients, and
|
|
161
|
+
compute with it::
|
|
162
|
+
|
|
163
|
+
sage: p = P([1, In[{1}], Out[{2}] ]); p # needs sage.modules
|
|
164
|
+
Out[{2}]*x^2 + In[{1}]*x + F[{}]
|
|
165
|
+
sage: p^2 # needs sage.modules
|
|
166
|
+
Out[{2}]*x^4
|
|
167
|
+
+ (-8*In[{}] + 4*In[{1}] + 8*In[{2}] + 4*In[{3}]
|
|
168
|
+
- 4*In[{1, 2}] - 2*In[{1, 3}] - 4*In[{2, 3}] + 2*In[{1, 2, 3}])*x^3
|
|
169
|
+
+ (F[{}] + 3*F[{1}] + 2*F[{2}] - 2*F[{1, 2}] - 2*F[{2, 3}] + 2*F[{1, 2, 3}])*x^2
|
|
170
|
+
+ (2*F[{}] + 2*F[{1}])*x
|
|
171
|
+
+ F[{}]
|
|
172
|
+
|
|
173
|
+
Note how each coefficient involves a single basis which need not
|
|
174
|
+
be that of the other coefficients. Which basis is used depends on
|
|
175
|
+
how coercion happened during mixed arithmetic and needs not be
|
|
176
|
+
deterministic.
|
|
177
|
+
|
|
178
|
+
One can easily coerce all coefficient to a given basis with::
|
|
179
|
+
|
|
180
|
+
sage: p.map_coefficients(In) # needs sage.modules
|
|
181
|
+
(-4*In[{}] + 2*In[{1}] + 4*In[{2}] + 2*In[{3}]
|
|
182
|
+
- 2*In[{1, 2}] - In[{1, 3}] - 2*In[{2, 3}] + In[{1, 2, 3}])*x^2
|
|
183
|
+
+ In[{1}]*x + In[{}]
|
|
184
|
+
|
|
185
|
+
Alas, the natural notation for constructing such polynomials does
|
|
186
|
+
not yet work::
|
|
187
|
+
|
|
188
|
+
sage: In[{1}] * x # needs sage.modules
|
|
189
|
+
Traceback (most recent call last):
|
|
190
|
+
...
|
|
191
|
+
TypeError: unsupported operand parent(s) for *:
|
|
192
|
+
'The subset algebra of {1, 2, 3} over Rational Field in the In basis'
|
|
193
|
+
and 'Univariate Polynomial Ring in x over
|
|
194
|
+
The subset algebra of {1, 2, 3} over Rational Field'
|
|
195
|
+
|
|
196
|
+
.. RUBRIC:: The category of realizations of `A`
|
|
197
|
+
|
|
198
|
+
The set of all realizations of `A`, together with the coercion morphisms
|
|
199
|
+
is a category (whose class inherits from
|
|
200
|
+
:class:`~sage.categories.realizations.Category_realization_of_parent`)::
|
|
201
|
+
|
|
202
|
+
sage: A.Realizations() # needs sage.modules
|
|
203
|
+
Category of realizations of
|
|
204
|
+
The subset algebra of {1, 2, 3} over Rational Field
|
|
205
|
+
|
|
206
|
+
The various parent realizing `A` belong to this category::
|
|
207
|
+
|
|
208
|
+
sage: A.F() in A.Realizations() # needs sage.modules
|
|
209
|
+
True
|
|
210
|
+
|
|
211
|
+
`A` itself is in the category of algebras with realizations::
|
|
212
|
+
|
|
213
|
+
sage: A in Algebras(QQ).WithRealizations() # needs sage.modules
|
|
214
|
+
True
|
|
215
|
+
|
|
216
|
+
The (mostly technical) ``WithRealizations`` categories are the
|
|
217
|
+
analogs of the ``*WithSeveralBases`` categories in
|
|
218
|
+
MuPAD-Combinat. They provide support tools for handling the
|
|
219
|
+
different realizations and the morphisms between them.
|
|
220
|
+
|
|
221
|
+
Typically, ``VectorSpaces(QQ).FiniteDimensional().WithRealizations()``
|
|
222
|
+
will eventually be in charge, whenever a coercion `\phi: A\mapsto B` is
|
|
223
|
+
registered, to register `\phi^{-1}` as coercion `B \mapsto A`
|
|
224
|
+
if there is none defined yet. To achieve this,
|
|
225
|
+
``FiniteDimensionalVectorSpaces`` would provide a nested class
|
|
226
|
+
``WithRealizations`` implementing the appropriate logic.
|
|
227
|
+
|
|
228
|
+
``WithRealizations`` is a :mod:`regressive covariant functorial
|
|
229
|
+
construction <sage.categories.covariant_functorial_construction>`.
|
|
230
|
+
On our example, this simply means that `A` is automatically in the
|
|
231
|
+
category of rings with realizations (covariance)::
|
|
232
|
+
|
|
233
|
+
sage: A in Rings().WithRealizations() # needs sage.modules
|
|
234
|
+
True
|
|
235
|
+
|
|
236
|
+
and in the category of algebras (regressiveness)::
|
|
237
|
+
|
|
238
|
+
sage: A in Algebras(QQ) # needs sage.modules
|
|
239
|
+
True
|
|
240
|
+
|
|
241
|
+
.. NOTE::
|
|
242
|
+
|
|
243
|
+
For ``C`` a category, ``C.WithRealizations()`` in fact calls
|
|
244
|
+
``sage.categories.with_realizations.WithRealizations(C)``. The
|
|
245
|
+
later is responsible for building the hierarchy of the
|
|
246
|
+
categories with realizations in parallel to that of their base
|
|
247
|
+
categories, optimizing away those categories that do not
|
|
248
|
+
provide a ``WithRealizations`` nested class. See
|
|
249
|
+
:mod:`sage.categories.covariant_functorial_construction` for
|
|
250
|
+
the technical details.
|
|
251
|
+
|
|
252
|
+
.. NOTE::
|
|
253
|
+
|
|
254
|
+
Design question: currently ``WithRealizations`` is a
|
|
255
|
+
regressive construction. That is ``self.WithRealizations()``
|
|
256
|
+
is a subcategory of ``self`` by default::
|
|
257
|
+
|
|
258
|
+
sage: Algebras(QQ).WithRealizations().super_categories()
|
|
259
|
+
[Category of algebras over Rational Field,
|
|
260
|
+
Category of monoids with realizations,
|
|
261
|
+
Category of additive unital additive magmas with realizations]
|
|
262
|
+
|
|
263
|
+
Is this always desirable? For example,
|
|
264
|
+
``AlgebrasWithBasis(QQ).WithRealizations()`` should certainly
|
|
265
|
+
be a subcategory of ``Algebras(QQ)``, but not of
|
|
266
|
+
``AlgebrasWithBasis(QQ)``. This is because
|
|
267
|
+
``AlgebrasWithBasis(QQ)`` is specifying something about the
|
|
268
|
+
concrete realization.
|
|
269
|
+
|
|
270
|
+
TESTS::
|
|
271
|
+
|
|
272
|
+
sage: Semigroups().WithRealizations()
|
|
273
|
+
Join of Category of semigroups and Category of sets with realizations
|
|
274
|
+
sage: C = GradedHopfAlgebrasWithBasis(QQ).WithRealizations(); C
|
|
275
|
+
Category of graded Hopf algebras with basis over Rational Field with realizations
|
|
276
|
+
sage: C.super_categories()
|
|
277
|
+
[Join of Category of Hopf algebras over Rational Field
|
|
278
|
+
and Category of graded algebras over Rational Field
|
|
279
|
+
and Category of graded coalgebras over Rational Field]
|
|
280
|
+
sage: TestSuite(Semigroups().WithRealizations()).run()
|
|
281
|
+
"""
|
|
282
|
+
return WithRealizationsCategory.category_of(self)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
Category.WithRealizations = WithRealizations
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class WithRealizationsCategory(RegressiveCovariantConstructionCategory):
|
|
289
|
+
"""
|
|
290
|
+
An abstract base class for all categories of parents with multiple
|
|
291
|
+
realizations.
|
|
292
|
+
|
|
293
|
+
.. SEEALSO:: :func:`Sets().WithRealizations <sage.categories.with_realizations.WithRealizations>`
|
|
294
|
+
|
|
295
|
+
The role of this base class is to implement some technical goodies, such
|
|
296
|
+
as the name for that category.
|
|
297
|
+
"""
|
|
298
|
+
|
|
299
|
+
_functor_category = "WithRealizations"
|
|
300
|
+
|
|
301
|
+
def _repr_(self):
|
|
302
|
+
"""
|
|
303
|
+
String representation.
|
|
304
|
+
|
|
305
|
+
EXAMPLES::
|
|
306
|
+
|
|
307
|
+
sage: C = GradedHopfAlgebrasWithBasis(QQ).WithRealizations(); C # indirect doctest
|
|
308
|
+
Category of graded Hopf algebras with basis over Rational Field with realizations
|
|
309
|
+
"""
|
|
310
|
+
s = repr(self.base_category())
|
|
311
|
+
return s + " with realizations"
|
sage/cpython/__init__.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-objects
|
|
2
|
+
# delvewheel: patch
|
|
3
|
+
# sage.cpython is an ordinary package, not a namespace package.
|
|
4
|
+
|
|
5
|
+
# This package is imported very early, which is why workarounds/monkey-patching
|
|
6
|
+
# are done in this file.
|
|
7
|
+
|
|
8
|
+
# Make sure that the correct zlib library is loaded. This is needed
|
|
9
|
+
# to prevent the system zlib to be loaded instead of the Sage one.
|
|
10
|
+
# See https://github.com/sagemath/sage/issues/23122
|
|
11
|
+
import zlib as _zlib
|
|
12
|
+
del _zlib
|
|
13
|
+
|
|
14
|
+
# Monkey-patch ExtensionFileLoader to allow IPython to find the sources
|
|
15
|
+
# of Cython files. See https://github.com/sagemath/sage/issues/24681
|
|
16
|
+
from importlib.machinery import ExtensionFileLoader as _ExtensionFileLoader
|
|
17
|
+
if hasattr(_ExtensionFileLoader, 'get_source'):
|
|
18
|
+
del _ExtensionFileLoader.get_source
|
|
19
|
+
del _ExtensionFileLoader
|