I am having trouble that my parents are being assigned in a category of finite dimensional modules and the culprit seems to be this:

sage: M = CombinatorialFreeModule(QQ, DisjointUnionEnumeratedSets([Integers(), 
Family([])]))
sage: M.category()
Category of finite dimensional vector spaces with basis over Rational Field
sage: M.dimension()
+Infinity

And this is the bug that is biting me. CombinatorialFreeModule.__init__ is setting the extra dressing to FiniteDimensional() because of this

sage: NonNegativeIntegers() in Sets().Finite()
False
sage: E = DisjointUnionEnumeratedSets([NonNegativeIntegers(), Family(['x'])]); E
Disjoint union of Family (Non negative integers, Family ('x',))
sage: E in Sets().Finite()
True
sage: E.cardinality()
+Infinity

I suppose this is coming from sage.categories.category_singleton that has the __contain__ method for Sets().Finite() but the problem is that I am not sure what is the bug, as a set this is the disjoint union of two sets. So perhaps the idea behind the above was that this is a finite set with two elements, one of them being an infinite set. I can live with E in Sets().Finite() being True (although I don't like it if that was intended)

But I certainly do not like M.category() being finite dimensional. Since basis_keys in CombinatorialFreeModule is Enumerated, I have been using this simple patch to get the right behaviour on the modules and it doesn't seem to break anything.

$ git diff src/sage/combinat/free_module.py
diff --git a/src/sage/combinat/free_module.py b/src/sage/combinat/free_module.py
index 2fbe8b225e..a2bf2a53d6 100644
--- a/src/sage/combinat/free_module.py
+++ b/src/sage/combinat/free_module.py
@@ -449,7 +449,8 @@ class CombinatorialFreeModule(UniqueRepresentation, Module, 
IndexedGenerators):
             category = ModulesWithBasis(R)
         elif isinstance(category, tuple):
             category = Category.join(category)
-        if basis_keys in Sets().Finite():
+        from sage.rings.infinity import Infinity
+        if basis_keys.cardinality() != Infinity:
             category = category.FiniteDimensional()
Parent.__init__(self, base=R, category=category, names=names)


Either way one of the two issues should be corrected I think. Best, R.
--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/20200620003300.GA346930%40vertex.

Attachment: signature.asc
Description: PGP signature

Reply via email to