sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.45k stars 482 forks source link

IntegerListsLex has finite issues #13749

Open tscrim opened 11 years ago

tscrim commented 11 years ago

IntegerListsLex has some issues with finiteness:

sage: L = IntegerListsLex(NonNegativeIntegers(), max_length=3, ceiling=lambda i: 3)
sage: L
Integer lists of sum in <class 'sage.sets.non_negative_integers.NonNegativeIntegers'> satisfying certain constraints
sage: for x in L:
....:
[]
[1]
[0, 1]
[0, 0, 1]
...
[3, 3, 2]
[3, 2, 3]
[2, 3, 3]
[3, 3, 3]
# Continues looping for forever (which I guess is okay)
sage: L.is_finite()
True
sage: L.category()
Category of finite enumerated sets

sage: L2 = IntegerListsLex(NonNegativeIntegers(), max_length=3)                   
sage: L2.is_finite()
True
sage: L2.category()
Category of finite enumerated sets

The last two are not correct, and this would likely need moderate checking of combinations of the input arguments.

Depends on #13605

Component: combinatorics

Keywords: finite sets, integer lists

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

tscrim commented 11 years ago

Description changed:

--- 
+++ 
@@ -17,14 +17,14 @@
 [3, 3, 3]
 # Continues looping for forever (which I guess is okay)
 sage: L.is_finite()
-True
+# Loops for forever
 sage: L.category()
-Category of finite enumerated sets
+Category of sets

 sage: L2 = IntegerListsLex(NonNegativeIntegers(), max_length=3)                   
 sage: L2.is_finite()
-True
+# Loops for forever
 sage: L2.category()
-Category of finite enumerated sets
+Category of sets

The last two are not correct, and this would likely need moderate checking of combinations of the input arguments.

tscrim commented 11 years ago

Dependencies: #13605

tscrim commented 11 years ago

Description changed:

--- 
+++ 
@@ -17,14 +17,14 @@
 [3, 3, 3]
 # Continues looping for forever (which I guess is okay)
 sage: L.is_finite()
-# Loops for forever
+True
 sage: L.category()
-Category of sets
+Category of finite enumerated sets

 sage: L2 = IntegerListsLex(NonNegativeIntegers(), max_length=3)                   
 sage: L2.is_finite()
-# Loops for forever
+True
 sage: L2.category()
-Category of sets
+Category of finite enumerated sets

The last two are not correct, and this would likely need moderate checking of combinations of the input arguments.

tscrim commented 11 years ago
comment:2

Without #13605 applied, the is_finite() loops for forever and the category is just Category of sets.

ea1d0bf8-c27a-4548-8cb7-de0b1d02441a commented 8 years ago

Description changed:

--- 
+++ 
@@ -1,7 +1,7 @@
 `IntegerListsLex` has some issues with finiteness:

-sage: L = IntegerListsLex(NonNegativeIntegers(), max_length=3, ceiling=lamabda i: 3) +sage: L = IntegerListsLex(NonNegativeIntegers(), max_length=3, ceiling=lambda i: 3) sage: L Integer lists of sum in <class 'sage.sets.non_negative_integers.NonNegativeIntegers'> satisfying certain constraints sage: for x in L:

ea1d0bf8-c27a-4548-8cb7-de0b1d02441a commented 8 years ago
comment:8

is this issue fixed meanwhile?

L.is_finite()  # is false with recent sage
L2.is_finite() # is false with recent sage
tscrim commented 8 years ago
comment:9

Now the first answer is wrong.

mantepse commented 9 months ago

It seems to me that this issue is outdated: IntegersListsLex does not take NonNegativeIntegers as first argument anymore.