#11979: Divided power algebras
-------------------------------------+-------------------------------------
       Reporter:  bruce              |        Owner:  jbandlow
           Type:  enhancement        |       Status:  needs_review
       Priority:  minor              |    Milestone:  sage-6.4
      Component:  combinatorics      |   Resolution:
       Keywords:  divided powers     |    Merged in:
        Authors:  Bruce Westbury     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  public/combinat/divided_power_alg  |  103a503427c2ad28a10dad60cad3646f86e4f18b
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by darij):

 Here is a minimal counterexample:
 {{{
 darij@travis-virtualbox:~/gitsage$ ./sage
 ┌────────────────────────────────────────────────────────────────────┐
 │ Sage Version 6.4.rc0, Release Date: 2014-10-30                     │
 │ Type "notebook()" for the browser-based notebook interface.        │
 │ Type "help()" for help.                                            │
 └────────────────────────────────────────────────────────────────────┘
 ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
 ┃ Warning: this is a prerelease version, and it may be unstable.     ┃
 ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
 sage: from sage.algebras.divided_power_algebra import
 UnivariateDividedPowerAlgebra
 sage: A = UnivariateDividedPowerAlgebra(Zmod(9)); A
 The divided power algebra over Ring of integers modulo 9
 sage: A = UnivariateDividedPowerAlgebra(Zmod(5)); A
 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.py:867: UserWarning: Inconsistent
 sorting results for all super categories of <class
 'sage.categories.hopf_algebras.HopfAlgebras_with_category'>
   self.__class__))
 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.py:867: UserWarning: Inconsistent
 sorting results for all super categories of <class
 'sage.categories.hopf_algebras_with_basis.HopfAlgebrasWithBasis'>
   self.__class__))
 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.py:867: UserWarning: Inconsistent
 sorting results for all super categories of <class
 'sage.categories.category.JoinCategory'>
   self.__class__))
 Exception TypeError: 'Cannot create a consistent method resolution\norder
 (MRO) for bases Bialgebras.parent_class, Algebras.parent_class,
 CoalgebrasWithBasis.parent_class' in
 'sage.categories.category_cy_helper.is_supercategory_of_done' ignored
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 <ipython-input-3-008c24a8840f> in <module>()
 ----> 1 A = UnivariateDividedPowerAlgebra(Zmod(Integer(5))); A

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/classcall_metaclass.so in
 sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
 (build/cythonized/sage/misc/classcall_metaclass.c:1176)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/cachefunc.so in
 sage.misc.cachefunc.WeakCachedFunction.__call__
 (build/cythonized/sage/misc/cachefunc.c:8031)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/unique_representation.pyc in __classcall__(cls,
 *args, **options)
    1019             True
    1020         """
 -> 1021         instance = typecall(cls, *args, **options)
    1022         assert isinstance( instance, cls )
    1023         if instance.__class__.__reduce__ ==
 CachedRepresentation.__reduce__:

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/classcall_metaclass.so in
 sage.misc.classcall_metaclass.typecall
 (build/cythonized/sage/misc/classcall_metaclass.c:1603)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/algebras/divided_power_algebra.pyc in __init__(self, R)
     123         if not R in Rings():
     124             raise ValueError('R is not a ring')
 --> 125         GHWBR = GradedHopfAlgebrasWithBasis(R)
     126         CombinatorialFreeModule.__init__(self, R,
 NonNegativeIntegers(),
     127                                          category=GHWBR)

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/classcall_metaclass.so in
 sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
 (build/cythonized/sage/misc/classcall_metaclass.c:1176)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/graded_modules.pyc in __classcall__(cls,
 category, *args)
     110             return super(GradedModulesCategory,
 cls).__classcall__(cls, category, *args)
     111         else:
 --> 112             return base_category_class(category, *args).Graded()
     113
     114     def _repr_object_names(self):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/cachefunc.so in
 sage.misc.cachefunc.CachedMethodCaller.__call__
 (build/cythonized/sage/misc/cachefunc.c:11291)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/cachefunc.so in
 sage.misc.cachefunc.CachedMethod._instance_call
 (build/cythonized/sage/misc/cachefunc.c:14055)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/modules.pyc in Graded(self, base_ring)
     377             assert base_ring is None or base_ring is
 self.base_ring()
     378             from sage.categories.graded_modules import
 GradedModulesCategory
 --> 379             return GradedModulesCategory.category_of(self)
     380
     381         @cached_method

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/cachefunc.so in
 sage.misc.cachefunc.CachedFunction.__call__
 (build/cythonized/sage/misc/cachefunc.c:4969)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/covariant_functorial_construction.pyc in
 category_of(cls, category, *args)
     277         functor_category = getattr(category.__class__,
 cls._functor_category)
     278         if isinstance(functor_category, type) and
 issubclass(functor_category, Category):
 --> 279             return functor_category(category, *args)
     280         else:
     281             return cls.default_super_categories(category, *args)

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/classcall_metaclass.so in
 sage.misc.classcall_metaclass.ClasscallMetaclass.__call__
 (build/cythonized/sage/misc/classcall_metaclass.c:1176)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/graded_modules.pyc in __classcall__(cls,
 category, *args)
     108         base_category_class = cls._base_category_class[0]
     109         if isinstance(category, base_category_class):
 --> 110             return super(GradedModulesCategory,
 cls).__classcall__(cls, category, *args)
     111         else:
     112             return base_category_class(category, *args).Graded()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in __classcall__(cls, *args,
 **options)
     440         if isinstance(cls, DynamicMetaclass):
     441             cls = cls.__base__
 --> 442         return super(Category, cls).__classcall__(cls, *args,
 **options)
     443
     444     def __init__(self, s=None):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/cachefunc.so in
 sage.misc.cachefunc.WeakCachedFunction.__call__
 (build/cythonized/sage/misc/cachefunc.c:8031)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/unique_representation.pyc in __classcall__(cls,
 *args, **options)
    1019             True
    1020         """
 -> 1021         instance = typecall(cls, *args, **options)
    1022         assert isinstance( instance, cls )
    1023         if instance.__class__.__reduce__ ==
 CachedRepresentation.__reduce__:

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/classcall_metaclass.so in
 sage.misc.classcall_metaclass.typecall
 (build/cythonized/sage/misc/classcall_metaclass.c:1603)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/graded_modules.pyc in __init__(self,
 base_category)
      35             Rational Field
      36         """
 ---> 37         super(GradedModulesCategory, self).__init__(base_category,
 base_category.base_ring())
      38
      39     _functor_category = "Graded"

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/covariant_functorial_construction.pyc in
 __init__(self, category, *args)
     302         self._base_category = category
     303         self._args = args
 --> 304         super(FunctorialConstructionCategory,
 self).__init__(*args)
     305
     306     def base_category(self):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category_types.pyc in __init__(self, base, name)
     483                 isinstance(base, Category) and
 base.is_subcategory(Rings())):
     484             raise ValueError("base must be a ring or a subcategory
 of Rings()")
 --> 485         Category_over_base.__init__(self, base, name)
     486
     487     def base_ring(self):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category_types.pyc in __init__(self, base, name)
     241         """
     242         self.__base = base
 --> 243         Category.__init__(self, name)
     244
     245     def _test_category_over_bases(self, **options):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in __init__(self, s)
     471         assert s is None
     472         self.__class__ =
 dynamic_class("{}_with_category".format(self.__class__.__name__),
 --> 473                                        (self.__class__,
 self.subcategory_class, ),
     474                                        cache = False, reduction =
 None,
     475                                        doccls=self.__class__)

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/lazy_attribute.so in
 sage.misc.lazy_attribute._lazy_attribute.__get__
 (build/cythonized/sage/misc/lazy_attribute.c:1276)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in subcategory_class(self)
    1630         """
    1631         return self._make_named_class('subcategory_class',
 'SubcategoryMethods',
 -> 1632                                       cache=False,
 picklable=False)
    1633
    1634     @lazy_attribute

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in _make_named_class(self, name,
 method_provider, cache, **options)
    2791             pass
    2792         result = Category._make_named_class(self, name,
 method_provider,
 -> 2793                                             cache=cache,
 **options)
    2794         self._make_named_class_cache[key] = result
    2795         return result

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in _make_named_class(self, name,
 method_provider, cache, picklable)
    1586             reduction = None
    1587         return dynamic_class(class_name,
 -> 1588                              tuple(getattr(cat,name) for cat in
 self._super_categories_for_classes),
    1589                              method_provider_cls,
 prepend_cls_bases = False, doccls = doccls,
    1590                              reduction = reduction, cache = cache)

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/lazy_attribute.so in
 sage.misc.lazy_attribute._lazy_attribute.__get__
 (build/cythonized/sage/misc/lazy_attribute.c:1276)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in
 _super_categories_for_classes(self)
    1027             [Category of rngs, Category of semirings]
    1028         """
 -> 1029         self._all_super_categories
    1030         return self._super_categories_for_classes
    1031

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/lazy_attribute.so in
 sage.misc.lazy_attribute._lazy_attribute.__get__
 (build/cythonized/sage/misc/lazy_attribute.c:1276)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in _all_super_categories(self)
     860         """
     861         (result, bases) =
 C3_sorted_merge([cat._all_super_categories
 --> 862                                            for cat in
 self._super_categories] +
     863
 [self._super_categories],
     864                                           category_sort_key)

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/lazy_attribute.so in
 sage.misc.lazy_attribute._lazy_attribute.__get__
 (build/cythonized/sage/misc/lazy_attribute.c:1276)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in _super_categories(self)
    1002             [Category of rngs, Category of semirings]
    1003         """
 -> 1004         return
 sorted(_flatten_categories(self.super_categories(),JoinCategory), key =
 category_sort_key, reverse=True)
    1005
    1006     @lazy_attribute

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/covariant_functorial_construction.pyc in
 super_categories(self)
     345             [Category of subquotients of semigroups, Category of
 quotients of sets]
     346         """
 --> 347         return
 Category.join([self.__class__.default_super_categories(self.base_category(),
 *self._args)] +
     348                              self.extra_super_categories(),
     349                              as_list = True)

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/covariant_functorial_construction.pyc in
 default_super_categories(cls, category, *args)
     550             Category of unital subquotients of semigroups
     551         """
 --> 552         return Category.join([category,
 super(RegressiveCovariantConstructionCategory,
 cls).default_super_categories(category, *args)])

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/covariant_functorial_construction.pyc in
 default_super_categories(cls, category, *args)
     441         return Category.join([getattr(cat,
 cls._functor_category)(*args)
     442                               for cat in
 category._super_categories
 --> 443                               if hasattr(cat,
 cls._functor_category)])
     444
     445     def is_construction_defined_by_base(self):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in join(categories, as_list,
 ignore_axioms, axioms)
    2473
    2474         # Handle axioms
 -> 2475         result = join_as_tuple(cache_key, axioms, ignore_axioms)
    2476         if as_list:
    2477             return list(result)

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category_cy_helper.so in
 sage.categories.category_cy_helper.join_as_tuple
 (build/cythonized/sage/categories/category_cy_helper.c:3145)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category_cy_helper.so in
 sage.categories.category_cy_helper.join_as_tuple
 (build/cythonized/sage/categories/category_cy_helper.c:2425)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in is_subcategory(self, c)
    1800         if c is self:
    1801             return True
 -> 1802         subcat_hook = c._subcategory_hook_(self)
    1803         if subcat_hook is Unknown:
    1804             return c in self._set_of_super_categories

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category_types.pyc in _subcategory_hook_(self, C)
     432
     433         """
 --> 434         if not issubclass(C.parent_class, self.parent_class):
     435             return False
     436         if not isinstance(C, Category_over_base):

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/misc/lazy_attribute.so in
 sage.misc.lazy_attribute._lazy_attribute.__get__
 (build/cythonized/sage/misc/lazy_attribute.c:1276)()

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in parent_class(self)
    1675         :class:`sage.categories.category.JoinCategory`.
    1676         """
 -> 1677         return self._make_named_class('parent_class',
 'ParentMethods')
    1678
    1679     @lazy_attribute

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in _make_named_class(self, name,
 method_provider, cache, **options)
    2791             pass
    2792         result = Category._make_named_class(self, name,
 method_provider,
 -> 2793                                             cache=cache,
 **options)
    2794         self._make_named_class_cache[key] = result
    2795         return result

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/categories/category.pyc in _make_named_class(self, name,
 method_provider, cache, picklable)
    1588                              tuple(getattr(cat,name) for cat in
 self._super_categories_for_classes),
    1589                              method_provider_cls,
 prepend_cls_bases = False, doccls = doccls,
 -> 1590                              reduction = reduction, cache = cache)
    1591
    1592

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/dynamic_class.pyc in dynamic_class(name, bases,
 cls, reduction, doccls, prepend_cls_bases, cache)
     314     elif cache is False:
     315         # bypass the cached method
 --> 316         return dynamic_class_internal.f(name, bases, cls,
 reduction, doccls, prepend_cls_bases)
     317     else: # cache = "ignore_reduction"
     318         result = dynamic_class_internal(name, bases, cls, False,
 doccls, prepend_cls_bases)

 /home/darij/sage-6.3.beta6/local/lib/python2.7/site-
 packages/sage/structure/dynamic_class.pyc in dynamic_class_internal(name,
 bases, cls, reduction, doccls, prepend_cls_bases)
     409         if isinstance(base, ClasscallMetaclass):
     410             metaclass = DynamicClasscallMetaclass
 --> 411     return metaclass(name, bases, methods)
     412
     413 class DynamicMetaclass(type):

 TypeError: Cannot create a consistent method resolution
 order (MRO) for bases Bialgebras.parent_class, Algebras.parent_class,
 CoalgebrasWithBasis.parent_class
 sage:
 }}}
 Compare with the following, which does not go wrong:
 {{{
 darij@travis-virtualbox:~/gitsage$ ./sage
 ┌────────────────────────────────────────────────────────────────────┐
 │ Sage Version 6.4.rc0, Release Date: 2014-10-30                     │
 │ Type "notebook()" for the browser-based notebook interface.        │
 │ Type "help()" for help.                                            │
 └────────────────────────────────────────────────────────────────────┘
 ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
 ┃ Warning: this is a prerelease version, and it may be unstable.     ┃
 ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
 sage:  from sage.algebras.divided_power_algebra import
 UnivariateDividedPowerAlgbra
 sage: A = UnivariateDividedPowerAlgebra(Zmod(5)); A
 The divided power algebra over Ring of integers modulo 5
 sage: A = UnivariateDividedPowerAlgebra(Zmod(9)); A
 The divided power algebra over Ring of integers modulo 9
 sage:
 }}}
 (It says rc0, but it is rc1 which I have only compiled with ./sage -br
 instead of make build to avoid building atlas again.)

 It seems that the category refinement for the bialgebra category goes
 wrong when first applied over a ring and then over a field, but goes fine
 the other way roud.

--
Ticket URL: <http://trac.sagemath.org/ticket/11979#comment:22>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to