@@ -860,10 +860,13 @@ If you know what you are doing, you can set check=False to skip this warning."""
860
860
861
861
OUTPUT:
862
862
863
- ``None `` if this method finds a proof that there
863
+ ``True `` if this method finds a proof that there
864
864
exists an upper bound on the length. Otherwise a
865
865
:exc:`ValueError` is raised.
866
866
867
+ Note that :func:`cached_method` does not work with methods
868
+ returning ``None``, so ``True`` is returned instead.
869
+
867
870
EXAMPLES::
868
871
869
872
sage: L = IntegerListsLex( 4, max_length=4)
@@ -1002,20 +1005,20 @@ If you know what you are doing, you can set check=False to skip this warning."""
1002
1005
"""
1003
1006
# Trivial cases
1004
1007
if self. max_length < Infinity:
1005
- return
1008
+ return True
1006
1009
if self. max_sum < self. min_sum:
1007
- return
1010
+ return True
1008
1011
if self. min_slope > self. max_slope:
1009
- return
1012
+ return True
1010
1013
if self. max_slope < 0:
1011
- return
1014
+ return True
1012
1015
if self. ceiling. limit( ) < self. floor. limit( ) :
1013
- return
1016
+ return True
1014
1017
if self. ceiling. limit( ) == 0:
1015
1018
# This assumes no trailing zeroes
1016
- return
1019
+ return True
1017
1020
if self. min_slope > 0 and self. ceiling. limit( ) < Infinity:
1018
- return
1021
+ return True
1019
1022
1020
1023
# Compute a lower bound on the sum of floor( i) for i=1 to infinity
1021
1024
if self. floor. limit( ) > 0 or self. min_slope > 0:
@@ -1028,24 +1031,24 @@ If you know what you are doing, you can set check=False to skip this warning."""
1028
1031
floor_sum_lower_bound = Infinity
1029
1032
1030
1033
if self. max_sum < floor_sum_lower_bound:
1031
- return
1034
+ return True
1032
1035
if self. max_sum == floor_sum_lower_bound and self. max_sum < Infinity:
1033
1036
# This assumes no trailing zeroes
1034
- return
1037
+ return True
1035
1038
1036
1039
# Variant on ceiling. limit( ) ==0 where we actually discover that the ceiling limit is 0
1037
1040
if ( self. max_slope == 0 and
1038
1041
( self. max_sum < Infinity or
1039
1042
( self. ceiling. limit_start( ) < Infinity and
1040
1043
any( self. ceiling( i) == 0 for i in range( self. ceiling. limit_start( ) + 1)))
1041
1044
) ) :
1042
- return
1045
+ return True
1043
1046
1044
1047
limit_start = max( self. ceiling. limit_start( ) , self. floor. limit_start( ))
1045
1048
if limit_start < Infinity:
1046
1049
for i in range( limit_start+ 1) :
1047
1050
if self. ceiling( i) < self. floor( i) :
1048
- return
1051
+ return True
1049
1052
1050
1053
raise ValueError( "could not prove that the specified constraints yield a finite set")
1051
1054
0 commit comments