Running doctests with ID 2023-05-15-15-56-48-c3de2cc4.
Running with SAGE_LOCAL='/usr' and SAGE_VENV='/usr'
Using --optional=pip,sage
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_jones_numfield,database_knotinfo,dvipng,fpylll,gfan,graphviz,imagemagick,ipython,jupymake,kenzo,latte_int,lrcalc_python,lrslib,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.gap,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modules,sage.plot,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.real_double,sage.rings.real_mpfr,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,sympy,tdlib
Doctesting 1 file.
sage -t --long --warn-long 8.8 --random-seed=72334392402293453007476860292589154167 /usr/lib/python3.11/site-packages/sage/sets/recursively_enumerated_set.pyx
    Timed out
**********************************************************************
Tests run before process (pid=1212) timed out:
sage: succ = lambda a:[a+2,a+3] ## line 36 ##
sage: C = RecursivelyEnumeratedSet([0], succ) ## line 37 ##
sage: C ## line 38 ##
A recursively enumerated set (breadth first search)
sage: it = C.breadth_first_search_iterator() ## line 43 ##
sage: [next(it) for _ in range(10)] ## line 44 ##
[0, 2, 3, 4, 5, 6, 7, 8, 9, 10]
sage: it = C.depth_first_search_iterator() ## line 49 ##
sage: [next(it) for _ in range(10)] ## line 50 ##
[0, 3, 6, 9, 12, 15, 18, 21, 24, 27]
sage: succ = lambda a: [(a[0]-1,a[1]), (a[0],a[1]-1), (a[0]+1,a[1]), (a[0],a[1]+1)] ## line 60 ##
sage: seeds = [(0,0)] ## line 61 ##
sage: C = RecursivelyEnumeratedSet(seeds, succ, structure='symmetric', enumeration='depth') ## line 62 ##
sage: C ## line 63 ##
A recursively enumerated set with a symmetric structure (depth first search)
sage: it_depth = iter(C) ## line 68 ##
sage: [next(it_depth) for _ in range(10)] ## line 69 ##
[(0, 0),
 (0, 1),
 (0, 2),
 (0, 3),
 (0, 4),
 (0, 5),
 (0, 6),
 (0, 7),
 (0, 8),
 (0, 9)]
sage: it_breadth = C.breadth_first_search_iterator() ## line 74 ##
sage: [next(it_breadth) for _ in range(13)] ## line 75 ##
[(0, 0),
 (-1, 0),
 (0, -1),
 (1, 0),
 (0, 1),
 (-2, 0),
 (-1, -1),
 (-1, 1),
 (0, -2),
 (1, -1),
 (2, 0),
 (1, 1),
 (0, 2)]
sage: sorted(C.graded_component(0)) ## line 82 ##
[(0, 0)]
sage: sorted(C.graded_component(1)) ## line 84 ##
[(-1, 0), (0, -1), (0, 1), (1, 0)]
sage: sorted(C.graded_component(2)) ## line 86 ##
[(-2, 0), (-1, -1), (-1, 1), (0, -2), (0, 2), (1, -1), (1, 1), (2, 0)]
sage: succ = attrcall("permutohedron_succ") ## line 95 ##
sage: seed = [Permutation([1..5])] ## line 96 ##
sage: R = RecursivelyEnumeratedSet(seed, succ, structure='graded') ## line 97 ##
sage: R ## line 98 ##
A recursively enumerated set with a graded structure (breadth first search)
sage: it_depth = R.depth_first_search_iterator() ## line 103 ##
sage: [next(it_depth) for _ in range(5)] ## line 104 ##
[[1, 2, 3, 4, 5],
 [1, 2, 3, 5, 4],
 [1, 2, 5, 3, 4],
 [1, 2, 5, 4, 3],
 [1, 5, 2, 4, 3]]
sage: it_breadth = R.breadth_first_search_iterator() ## line 113 ##
sage: [next(it_breadth) for _ in range(5)] ## line 114 ##
[[1, 2, 3, 4, 5],
 [2, 1, 3, 4, 5],
 [1, 3, 2, 4, 5],
 [1, 2, 4, 3, 5],
 [1, 2, 3, 5, 4]]
sage: sorted(R.elements_of_depth_iterator(9)) ## line 123 ##
[[4, 5, 3, 2, 1], [5, 3, 4, 2, 1], [5, 4, 2, 3, 1], [5, 4, 3, 1, 2]]
sage: list(R.elements_of_depth_iterator(10)) ## line 125 ##
[[5, 4, 3, 2, 1]]
sage: sorted(R.graded_component(0)) ## line 130 ##
[[1, 2, 3, 4, 5]]
sage: sorted(R.graded_component(1)) ## line 132 ##
[[1, 2, 3, 5, 4], [1, 2, 4, 3, 5], [1, 3, 2, 4, 5], [2, 1, 3, 4, 5]]
sage: sorted(R.graded_component(9)) ## line 134 ##
[[4, 5, 3, 2, 1], [5, 3, 4, 2, 1], [5, 4, 2, 3, 1], [5, 4, 3, 1, 2]]
sage: sorted(R.graded_component(10)) ## line 136 ##
[[5, 4, 3, 2, 1]]
sage: seeds = [''] ## line 146 ##
sage: succ = lambda w: [w+'a', w+'b'] ## line 147 ##
sage: C = RecursivelyEnumeratedSet(seeds, succ, structure='forest') ## line 148 ##
sage: C ## line 149 ##
An enumerated set with a forest structure
sage: it = C.depth_first_search_iterator() ## line 154 ##
sage: [next(it) for _ in range(6)] ## line 155 ##
['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa']
sage: it = C.breadth_first_search_iterator() ## line 160 ##
sage: [next(it) for _ in range(6)] ## line 161 ##
['', 'a', 'b', 'aa', 'ab', 'ba']
sage: def children(x):
    if len(x) < 2:
        for letter in ['a', 'b', 'c']:
            yield x+letter ## line 228 ##
sage: S = RecursivelyEnumeratedSet([''],
    lambda x: [x+letter for letter in ['a', 'b', 'c']]
              if len(x) < 2 else [],
    structure='forest', enumeration='depth',
    category=FiniteEnumeratedSets()) ## line 235 ##
sage: S.list() ## line 240 ##
['', 'a', 'aa', 'ab', 'ac', 'b', 'ba', 'bb', 'bc', 'c', 'ca', 'cb', 'cc']
sage: S = RecursivelyEnumeratedSet([''], children,
    structure='forest', enumeration='depth',
    category=FiniteEnumeratedSets()) ## line 245 ##
sage: S.list() ## line 248 ##
['', 'a', 'aa', 'ab', 'ac', 'b', 'ba', 'bb', 'bc', 'c', 'ca', 'cb', 'cc']
sage: def children(node):
    (lst, st) = node
    st = set(st) # make a copy
    if st:
       el = st.pop()
       for i in range(len(lst)+1):
           yield (lst[0:i]+[el]+lst[i:], st) ## line 271 ##
sage: list(children(([1,2], {3,7,9}))) ## line 278 ##
[([9, 1, 2], {3, 7}), ([1, 9, 2], {3, 7}), ([1, 2, 9], {3, 7})]
sage: def post_process(node):
    (l, s) = node
    return tuple(l) if not s else None ## line 280 ##
sage: S = RecursivelyEnumeratedSet( [([], {1,3,6,8})],
    children, post_process=post_process,
    structure='forest', enumeration='depth',
    category=FiniteEnumeratedSets()) ## line 283 ##
sage: S.list() ## line 287 ##
[(6, 3, 1, 8),
 (3, 6, 1, 8),
 (3, 1, 6, 8),
 (3, 1, 8, 6),
 (6, 1, 3, 8),
 (1, 6, 3, 8),
 (1, 3, 6, 8),
 (1, 3, 8, 6),
 (6, 1, 8, 3),
 (1, 6, 8, 3),
 (1, 8, 6, 3),
 (1, 8, 3, 6),
 (6, 3, 8, 1),
 (3, 6, 8, 1),
 (3, 8, 6, 1),
 (3, 8, 1, 6),
 (6, 8, 3, 1),
 (8, 6, 3, 1),
 (8, 3, 6, 1),
 (8, 3, 1, 6),
 (6, 8, 1, 3),
 (8, 6, 1, 3),
 (8, 1, 6, 3),
 (8, 1, 3, 6)]
sage: S.cardinality() ## line 293 ##
24
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 295 ##
0
sage: f = lambda a: [a+3, a+5] ## line 364 ##
sage: C = RecursivelyEnumeratedSet([0], f) ## line 365 ##
sage: C ## line 366 ##
A recursively enumerated set (breadth first search)
sage: it = iter(C) ## line 368 ##
sage: [next(it) for _ in range(10)] ## line 369 ##
[0, 3, 5, 6, 8, 10, 9, 11, 13, 15]
sage: f = lambda a: [2*a,2*a+1] ## line 374 ##
sage: C = RecursivelyEnumeratedSet([1], f, structure='forest') ## line 375 ##
sage: C ## line 376 ##
An enumerated set with a forest structure
sage: it = C.depth_first_search_iterator() ## line 378 ##
sage: [next(it) for _ in range(7)] ## line 379 ##
[1, 2, 4, 8, 16, 32, 64]
sage: it = C.breadth_first_search_iterator() ## line 381 ##
sage: [next(it) for _ in range(7)] ## line 382 ##
[1, 2, 3, 4, 5, 6, 7]
sage: f = lambda a: [a-1,a+1] ## line 387 ##
sage: C = RecursivelyEnumeratedSet([10, 15], f, structure='symmetric') ## line 388 ##
sage: C ## line 389 ##
A recursively enumerated set with a symmetric structure (breadth first search)
sage: it = iter(C) ## line 391 ##
sage: [next(it) for _ in range(7)] ## line 392 ##
[10, 15, 9, 11, 14, 16, 8]
sage: f = lambda a: [a+1, a+I] ## line 397 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='graded') ## line 398 ##
sage: C ## line 399 ##
A recursively enumerated set with a graded structure (breadth first search)
sage: it = iter(C) ## line 401 ##
sage: [next(it) for _ in range(7)] ## line 402 ##
[0, 1, I, 2, I + 1, 2*I, 3]
sage: f = lambda a: [a-1,a+1] ## line 410 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='graded') ## line 411 ##
sage: it = iter(C) ## line 412 ##
sage: [next(it) for _ in range(7)] ## line 413 ##
[0, -1, 1, -2, 0, 2, -3]
sage: R = RecursivelyEnumeratedSet([1], lambda x: [x+1, x-1]) ## line 420 ##
sage: R.successors(4) ## line 421 ##
[5, 3]
sage: C = RecursivelyEnumeratedSet((1, 2, 3), factor) ## line 426 ##
sage: C.successors ## line 427 ##
<function factor at 0xffff2134dee0>
sage: C._seeds ## line 429 ##
(1, 2, 3)
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 431 ##
0
sage: f = lambda a:[a+1] ## line 465 ##
sage: RecursivelyEnumeratedSet([0], f, structure=None) ## line 469 ##
A recursively enumerated set (breadth first search)
sage: RecursivelyEnumeratedSet([0], f, structure='graded') ## line 471 ##
A recursively enumerated set with a graded structure (breadth first search)
sage: RecursivelyEnumeratedSet([0], f, structure='symmetric') ## line 473 ##
A recursively enumerated set with a symmetric structure (breadth first search)
sage: RecursivelyEnumeratedSet([0], f, structure='forest') ## line 475 ##
An enumerated set with a forest structure
sage: RecursivelyEnumeratedSet([0], f, enumeration='breadth') ## line 480 ##
A recursively enumerated set (breadth first search)
sage: RecursivelyEnumeratedSet([0], f, enumeration='naive') ## line 482 ##
A recursively enumerated set (naive search)
sage: RecursivelyEnumeratedSet([0], f, enumeration='depth') ## line 484 ##
A recursively enumerated set (depth first search)
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 486 ##
0
sage: f = lambda a: [a+3, a+5] ## line 493 ##
sage: C = RecursivelyEnumeratedSet([0], f) ## line 494 ##
sage: C ## line 495 ##
A recursively enumerated set (breadth first search)
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 497 ##
0
sage: C = RecursivelyEnumeratedSet((1, 2, 3), factor) ## line 521 ##
sage: loads(dumps(C)) ## line 522 ##
A recursively enumerated set (breadth first search)
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 524 ##
0
sage: C = RecursivelyEnumeratedSet((1, 2, 3), factor) ## line 550 ##
sage: C.__getstate__() ## line 551 ##
(None,)
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 553 ##
0
sage: C = RecursivelyEnumeratedSet((1, 2, 3), factor) ## line 566 ##
sage: C.__setstate__(C.__getstate__()) ## line 567 ##
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 568 ##
0
sage: f = lambda a: [a+3, a+5] ## line 583 ##
sage: C = RecursivelyEnumeratedSet([0], f) ## line 584 ##
sage: len(C) ## line 585 ##
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 589 ##
0
sage: f = lambda a: [a+3, a+5] ## line 601 ##
sage: it_naive = iter(RecursivelyEnumeratedSet([0], f, enumeration='naive')) ## line 602 ##
sage: it_depth = iter(RecursivelyEnumeratedSet([0], f, enumeration='depth')) ## line 603 ##
sage: it_breadth = iter(RecursivelyEnumeratedSet([0], f, enumeration='breadth')) ## line 604 ##
sage: sorted([next(it_naive) for _ in range(10)]) ## line 605 ##
[0, 3, 5, 6, 8, 9, 10, 11, 12, 13]
sage: [next(it_depth) for _ in range(10)] ## line 607 ##
[0, 5, 10, 15, 20, 25, 30, 35, 40, 45]
sage: [next(it_breadth) for _ in range(10)] ## line 609 ##
[0, 3, 5, 6, 8, 10, 9, 11, 13, 15]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 611 ##
0
sage: f = lambda a:[a+3,a+5] ## line 635 ##
sage: R = RecursivelyEnumeratedSet([0], f) ## line 636 ##
sage: R ## line 637 ##
A recursively enumerated set (breadth first search)
sage: 8 in R ## line 639 ##
True
sage: R = RecursivelyEnumeratedSet([0], f, enumeration='depth') ## line 644 ##
sage: R ## line 645 ##
A recursively enumerated set (depth first search)
sage: it = iter(R) ## line 647 ##
sage: [next(it) for _ in range(6)] ## line 648 ##
[0, 5, 10, 15, 20, 25]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 652 ##
0
sage: f = lambda x: [x-1, x+1] ## line 659 ##
sage: RecursivelyEnumeratedSet([1], f, structure=None) ## line 660 ##
A recursively enumerated set (breadth first search)
sage: RecursivelyEnumeratedSet([1], f, structure='graded') ## line 665 ##
A recursively enumerated set with a graded structure (breadth first search)
sage: RecursivelyEnumeratedSet([1], f, structure='symmetric') ## line 670 ##
A recursively enumerated set with a symmetric structure (breadth first search)
sage: RecursivelyEnumeratedSet([1], f, structure='symmetric', max_depth=4) ## line 675 ##
A recursively enumerated set with a symmetric structure (breadth first search) with max_depth=4
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 678 ##
0
sage: R = RecursivelyEnumeratedSet([1], lambda x: [x+1, x-1]) ## line 703 ##
sage: R.seeds() ## line 704 ##
[1]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 706 ##
0
sage: f = lambda a: [a+3, a+5] ## line 740 ##
sage: C = RecursivelyEnumeratedSet([0], f) ## line 741 ##
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 743 ##
0
sage: f = lambda a: [a+3, a+5] ## line 768 ##
sage: C = RecursivelyEnumeratedSet([0], f) ## line 769 ##
sage: C.graded_component(0) ## line 770 ##
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 774 ##
0
sage: f = lambda a: [a-1, a+1] ## line 795 ##
sage: S = RecursivelyEnumeratedSet([5, 10], f, structure='symmetric') ## line 796 ##
sage: it = S.elements_of_depth_iterator(2) ## line 797 ##
sage: sorted(it) ## line 798 ##
[3, 7, 8, 12]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 800 ##
0
sage: f = lambda a: [a+3, a+5] ## line 819 ##
sage: C = RecursivelyEnumeratedSet([0], f) ## line 820 ##
sage: it = C.breadth_first_search_iterator() ## line 821 ##
sage: [next(it) for _ in range(10)] ## line 822 ##
[0, 3, 5, 6, 8, 10, 9, 11, 13, 15]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 824 ##
0
sage: f = lambda a: [a+3, a+5] ## line 856 ##
sage: C = RecursivelyEnumeratedSet([0], f) ## line 857 ##
sage: it = C._breadth_first_search_iterator_using_queue() ## line 858 ##
sage: [next(it) for _ in range(10)] ## line 859 ##
[0, 3, 5, 6, 8, 10, 9, 11, 13, 15]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 861 ##
0
sage: seeds = [Permutation([1,2,3])] ## line 884 ##
sage: succ = attrcall("permutohedron_succ") ## line 885 ##
sage: R = RecursivelyEnumeratedSet(seeds, succ) ## line 886 ##
sage: sorted(R.naive_search_iterator()) ## line 887 ##
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 889 ##
0
sage: f = lambda a: [a+3, a+5] ## line 915 ##
sage: C = RecursivelyEnumeratedSet([0], f) ## line 916 ##
sage: it = C.depth_first_search_iterator() ## line 917 ##
sage: [next(it) for _ in range(10)] ## line 918 ##
[0, 5, 10, 15, 20, 25, 30, 35, 40, 45]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 920 ##
0
sage: child = lambda i: [(i+3) % 10, (i+8) % 10] ## line 956 ##
sage: R = RecursivelyEnumeratedSet([0], child) ## line 957 ##
sage: R.to_digraph() ## line 958 ##
Looped multi-digraph on 10 vertices
sage: succ = lambda a: [(a[0]-1,a[1]), (a[0],a[1]-1), (a[0]+1,a[1]), (a[0],a[1]+1)] ## line 964 ##
sage: seeds = [(0,0)] ## line 965 ##
sage: C = RecursivelyEnumeratedSet(seeds, succ, structure='symmetric') ## line 966 ##
sage: C.to_digraph(max_depth=3) ## line 967 ##
Looped multi-digraph on 41 vertices
sage: C = RecursivelyEnumeratedSet(seeds, succ, structure='symmetric', max_depth=2) ## line 972 ##
sage: C.to_digraph() ## line 973 ##
Looped multi-digraph on 25 vertices
sage: f = lambda a: [a+1, a+I] ## line 978 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='graded') ## line 979 ##
sage: C.to_digraph(max_depth=4) ## line 980 ##
Looped multi-digraph on 21 vertices
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 982 ##
0
sage: f = lambda a: [a-1,a+1] ## line 1004 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='symmetric') ## line 1005 ##
sage: C ## line 1006 ##
A recursively enumerated set with a symmetric structure (breadth first search)
sage: it = iter(C) ## line 1008 ##
sage: [next(it) for _ in range(7)] ## line 1009 ##
[0, -1, 1, -2, 2, -3, 3]
sage: f = lambda a: [a-1,a+1] ## line 1016 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='symmetric') ## line 1017 ##
sage: loads(dumps(C)) ## line 1018 ##
sage: def f(a): return [a-1,a+1] ## line 1025 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='symmetric') ## line 1026 ##
sage: loads(dumps(C)) ## line 1027 ##
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1031 ##
0
sage: f = lambda a: [(a[0]-1,a[1]), (a[0],a[1]-1), (a[0]+1,a[1]), (a[0],a[1]+1)] ## line 1050 ##
sage: C = RecursivelyEnumeratedSet([(0,0)], f, structure='symmetric') ## line 1051 ##
sage: s = list(C.breadth_first_search_iterator(max_depth=2)); s ## line 1052 ##
[(0, 0),
 (-1, 0),
 (0, -1),
 (1, 0),
 (0, 1),
 (-2, 0),
 (-1, -1),
 (-1, 1),
 (0, -2),
 (1, -1),
 (2, 0),
 (1, 1),
 (0, 2)]
sage: it = iter(C) ## line 1059 ##
sage: s == [next(it) for _ in range(13)] ## line 1060 ##
True
sage: D = RecursivelyEnumeratedSet([(0,0)], f) ## line 1067 ##
sage: s == list(D.breadth_first_search_iterator(max_depth=2)) ## line 1068 ##
True
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1070 ##
0
sage: f = lambda a: [a-1, a+1] ## line 1114 ##
sage: S = RecursivelyEnumeratedSet([10], f, structure='symmetric') ## line 1115 ##
sage: it = S.graded_component_iterator() ## line 1116 ##
sage: [sorted(next(it)) for _ in range(5)] ## line 1117 ##
[[10], [9, 11], [8, 12], [7, 13], [6, 14]]
sage: f = lambda a: [a-1, a+1] ## line 1122 ##
sage: S = RecursivelyEnumeratedSet([5, 10], f, structure='symmetric') ## line 1123 ##
sage: it = S.graded_component_iterator() ## line 1124 ##
sage: [sorted(next(it)) for _ in range(5)] ## line 1125 ##
[[5, 10], [4, 6, 9, 11], [3, 7, 8, 12], [2, 13], [1, 14]]
sage: f = lambda a: [a+1, a+I] ## line 1130 ##
sage: S = RecursivelyEnumeratedSet([0], f, structure='symmetric') ## line 1131 ##
sage: it = S.graded_component_iterator() ## line 1132 ##
sage: [sorted(next(it)) for _ in range(7)] ## line 1133 ##
[[0],
 [I, 1],
 [2*I, I + 1, 2],
 [3*I, 2*I + 1, I + 2, 3],
 [4*I, 3*I + 1, 2*I + 2, I + 3, 4],
 [5*I, 4*I + 1, 3*I + 2, 2*I + 3, I + 4, 5],
 [6*I, 5*I + 1, 4*I + 2, 3*I + 3, 2*I + 4, I + 5, 6]]
sage: def f(a):
    sleep(0.05r)
    return [a-1,a+1] ## line 1147 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='symmetric') ## line 1150 ##
sage: it = C.graded_component_iterator() ## line 1151 ##
sage: next(it) ## line 1152 ##
{0}
sage: next(it) ## line 1154 ##
{-1, 1}
sage: from cysignals.alarm import alarm ## line 1156 ##
sage: alarm(0.02); next(it) ## line 1157 ##
sage: next(it) ## line 1161 ##
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1165 ##
0
sage: f = lambda a: [a-1,a+1] ## line 1194 ##
sage: C = RecursivelyEnumeratedSet([10, 15], f, structure='symmetric') ## line 1195 ##
sage: for i in range(5): sorted(C.graded_component(i)) ## line 1196 ##
[10, 15]
[9, 11, 14, 16]
[8, 12, 13, 17]
[7, 18]
[6, 19]
sage: def f(a):
   sleep(0.1r)
   return [a-1,a+1] ## line 1207 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='symmetric') ## line 1210 ##
sage: from cysignals.alarm import alarm ## line 1211 ##
sage: alarm(0.45); C.graded_component(10) ## line 1212 ##
sage: C.graded_component(1) ## line 1216 ##
{-1, 1}
sage: C.graded_component(2) ## line 1218 ##
{-2, 2}
sage: C.graded_component(3) ## line 1220 ##
{-3, 3}
sage: C.graded_component(4) ## line 1222 ##
{-4, 4}
sage: C.graded_component(5) ## line 1224 ##
{-5, 5}
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1226 ##
0
sage: f = lambda a: [a-1, a+1] ## line 1260 ##
sage: S = RecursivelyEnumeratedSet([5, 10], f, structure='symmetric') ## line 1261 ##
sage: it = S.graded_component_iterator() ## line 1262 ##
sage: [sorted(next(it)) for _ in range(3)] # indirect doctest ## line 1263 ##
[[5, 10], [4, 6, 9, 11], [3, 7, 8, 12]]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1265 ##
0
sage: f = lambda a: [(a[0]+1,a[1]), (a[0],a[1]+1)] ## line 1289 ##
sage: C = RecursivelyEnumeratedSet([(0,0)], f, structure='graded', max_depth=3) ## line 1290 ##
sage: C ## line 1291 ##
A recursively enumerated set with a graded structure (breadth first search) with max_depth=3
sage: list(C) ## line 1294 ##
[(0, 0),
 (1, 0),
 (0, 1),
 (2, 0),
 (1, 1),
 (0, 2),
 (3, 0),
 (2, 1),
 (1, 2),
 (0, 3)]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1299 ##
0
sage: f = lambda a: [(a[0]+1,a[1]), (a[0],a[1]+1)] ## line 1317 ##
sage: C = RecursivelyEnumeratedSet([(0,0)], f, structure='graded') ## line 1318 ##
sage: list(C.breadth_first_search_iterator(max_depth=3)) ## line 1319 ##
[(0, 0),
 (1, 0),
 (0, 1),
 (2, 0),
 (1, 1),
 (0, 2),
 (3, 0),
 (2, 1),
 (1, 2),
 (0, 3)]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1324 ##
0
sage: f = lambda a: [(a[0]+1,a[1]), (a[0],a[1]+1)] ## line 1364 ##
sage: C = RecursivelyEnumeratedSet([(0,0)], f, structure='graded', max_depth=3) ## line 1365 ##
sage: it = C.graded_component_iterator() ## line 1366 ##
sage: for _ in range(4): sorted(next(it)) ## line 1367 ##
[(0, 0)]
[(0, 1), (1, 0)]
[(0, 2), (1, 1), (2, 0)]
[(0, 3), (1, 2), (2, 1), (3, 0)]
sage: child = lambda k:[2*k,2*k+1] if k<8 else [] ## line 1377 ##
sage: root = [0] ## line 1378 ##
sage: R = RecursivelyEnumeratedSet(root, child, structure='graded') ## line 1379 ##
sage: it = R.graded_component_iterator() ## line 1380 ##
sage: for _ in range(7): next(it) ## line 1381 ##
{0}
{1}
{2, 3}
{4, 5, 6, 7}
{8, 9, 10, 11, 12, 13, 14, 15}
set()
set()
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1389 ##
0
sage: f = lambda a: [a+1, a+I] ## line 1417 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='graded') ## line 1418 ##
sage: for i in range(5): sorted(C.graded_component(i)) ## line 1419 ##
[0]
[I, 1]
[2*I, I + 1, 2]
[3*I, 2*I + 1, I + 2, 3]
[4*I, 3*I + 1, 2*I + 2, I + 3, 4]
sage: def f(a):
   sleep(0.1r)
   return [a+1, a+I] ## line 1430 ##
sage: C = RecursivelyEnumeratedSet([0], f, structure='graded') ## line 1433 ##
sage: from cysignals.alarm import alarm ## line 1434 ##
sage: alarm(0.45); C.graded_component(10) ## line 1435 ##
sage: C.graded_component(2) ## line 1439 ##
{2*I, I + 1, 2}
sage: C.graded_component(3) ## line 1441 ##
{3*I, 2*I + 1, I + 2, 3}
sage: C.graded_component(4) ## line 1443 ##
{4*I, 3*I + 1, 2*I + 2, I + 3, 4}
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1445 ##
0
sage: f = lambda a: [(a[0]+1,a[1]), (a[0],a[1]+1)] ## line 1475 ##
sage: C = RecursivelyEnumeratedSet([(0,0)], f, structure='graded') ## line 1476 ##
sage: it = C.graded_component_iterator() ## line 1477 ##
sage: [sorted(next(it)) for _ in range(2)] # indirect doctest ## line 1478 ##
[[(0, 0)], [(0, 1), (1, 0)]]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1480 ##
0
sage: from sage.sets.recursively_enumerated_set import _imap_and_filter_none ## line 1499 ##
sage: p = _imap_and_filter_none(lambda x: x if is_prime(x) else None, range(15)) ## line 1500 ##
sage: [next(p), next(p), next(p), next(p), next(p), next(p)] ## line 1501 ##
[2, 3, 5, 7, 11, 13]
sage: p = _imap_and_filter_none(lambda x: x+x, ['a','b','c','d','e']) ## line 1503 ##
sage: [next(p), next(p), next(p), next(p), next(p)] ## line 1504 ##
['aa', 'bb', 'cc', 'dd', 'ee']
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1506 ##
0
sage: from sage.sets.recursively_enumerated_set import search_forest_iterator ## line 1530 ##
sage: list(search_forest_iterator([[]], lambda l: [l+[0], l+[1]]
                                  if len(l) < 3 else [])) ## line 1531 ##
[[],
 [0],
 [0, 0],
 [0, 0, 0],
 [0, 0, 1],
 [0, 1],
 [0, 1, 0],
 [0, 1, 1],
 [1],
 [1, 0],
 [1, 0, 0],
 [1, 0, 1],
 [1, 1],
 [1, 1, 0],
 [1, 1, 1]]
sage: list(search_forest_iterator([[]], lambda l: [l+[0], l+[1]]
                                  if len(l) < 3 else [],
                            algorithm='breadth')) ## line 1539 ##
[[],
 [0],
 [1],
 [0, 0],
 [0, 1],
 [1, 0],
 [1, 1],
 [0, 0, 0],
 [0, 0, 1],
 [0, 1, 0],
 [0, 1, 1],
 [1, 0, 0],
 [1, 0, 1],
 [1, 1, 0],
 [1, 1, 1]]
sage: it = search_forest_iterator([[]], lambda l: [l+[0], l+[1]], algorithm='breadth') ## line 1550 ##
sage: [ next(it) for i in range(16) ] ## line 1551 ##
[[],
 [0],
 [1],
 [0, 0],
 [0, 1],
 [1, 0],
 [1, 1],
 [0, 0, 0],
 [0, 0, 1],
 [0, 1, 0],
 [0, 1, 1],
 [1, 0, 0],
 [1, 0, 1],
 [1, 1, 0],
 [1, 1, 1],
 [0, 0, 0, 0]]
sage: list(search_forest_iterator([[]], lambda l: [l + [i] for i in range(3) if i not in l],
                            algorithm='breadth')) ## line 1562 ##
[[],
 [0],
 [1],
 [2],
 [0, 1],
 [0, 2],
 [1, 0],
 [1, 2],
 [2, 0],
 [2, 1],
 [0, 1, 2],
 [0, 2, 1],
 [1, 0, 2],
 [1, 2, 0],
 [2, 0, 1],
 [2, 1, 0]]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1568 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1627 ##
sage: S = RecursivelyEnumeratedSet_forest( [[]],
    lambda l: [l+[0], l+[1]] if len(l) < 3 else [],
    category=FiniteEnumeratedSets()) ## line 1628 ##
sage: S.list() ## line 1631 ##
[[],
 [0],
 [0, 0],
 [0, 0, 0],
 [0, 0, 1],
 [0, 1],
 [0, 1, 0],
 [0, 1, 1],
 [1],
 [1, 0],
 [1, 0, 0],
 [1, 0, 1],
 [1, 1],
 [1, 1, 0],
 [1, 1, 1]]
sage: S.category() ## line 1639 ##
Category of finite enumerated sets
sage: S.cardinality() ## line 1641 ##
15
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1648 ##
sage: tb = RecursivelyEnumeratedSet_forest( [[]],
      lambda l: [l + [i] for i in range(3) if i not in l],
      algorithm = 'breadth',
      category=FiniteEnumeratedSets()) ## line 1649 ##
sage: tb[0] ## line 1653 ##
[]
sage: tb.cardinality() ## line 1655 ##
16
sage: list(tb) ## line 1657 ##
[[],
 [0],
 [1],
 [2],
 [0, 1],
 [0, 2],
 [1, 0],
 [1, 2],
 [2, 0],
 [2, 1],
 [0, 1, 2],
 [0, 2, 1],
 [1, 0, 2],
 [1, 2, 0],
 [2, 0, 1],
 [2, 1, 0]]
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1668 ##
sage: I = RecursivelyEnumeratedSet_forest([(0,0)],
                 lambda l: [(l[0]+1, l[1]), (l[0], 1)]
                           if l[1] == 0 else [(l[0], l[1]+1)]) ## line 1669 ##
sage: depth_search = I.depth_first_search_iterator() ## line 1676 ##
sage: [next(depth_search) for i in range(7)] ## line 1677 ##
[(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0)]
sage: breadth_search = I.breadth_first_search_iterator() ## line 1683 ##
sage: [next(breadth_search) for i in range(15)] ## line 1684 ##
[(0, 0),
 (1, 0),
 (0, 1),
 (2, 0),
 (1, 1),
 (0, 2),
 (3, 0),
 (2, 1),
 (1, 2),
 (0, 3),
 (4, 0),
 (3, 1),
 (2, 2),
 (1, 3),
 (0, 4)]
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1709 ##
sage: class A(UniqueRepresentation, RecursivelyEnumeratedSet_forest):
    def __init__(self):
        RecursivelyEnumeratedSet_forest.__init__(self, [()],
            lambda x : [x+(0,), x+(1,)] if sum(x) < 3 else [],
            lambda x : sum(x[i]*2^i for i in range(len(x))) if sum(x) != 0 and x[-1] != 0 else None,
            algorithm = 'breadth',
            category=InfiniteEnumeratedSets()) ## line 1710 ##
sage: MyForest = A(); MyForest ## line 1717 ##
An enumerated set with a forest structure
sage: MyForest.category() ## line 1719 ##
Category of infinite enumerated sets
sage: p = iter(MyForest) ## line 1721 ##
sage: [next(p) for i in range(30)] ## line 1722 ##
[1,
 2,
 3,
 4,
 6,
 5,
 7,
 8,
 12,
 10,
 14,
 9,
 13,
 11,
 16,
 24,
 20,
 28,
 18,
 26,
 22,
 17,
 25,
 21,
 19,
 32,
 48,
 40,
 56,
 36]
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1733 ##
sage: class A(UniqueRepresentation, RecursivelyEnumeratedSet_forest):
    def __init__(self):
        RecursivelyEnumeratedSet_forest.__init__(self, algorithm = 'breadth',
                              category=InfiniteEnumeratedSets())
    def roots(self):
        return [()]
    def children(self, x):
        if sum(x) < 3:
            return [x+(0,), x+(1,)]
        else:
            return []
    def post_process(self, x):
        if sum(x) == 0 or x[-1] == 0:
            return None
        else:
            return sum(x[i]*2^i for i in range(len(x))) ## line 1734 ##
sage: MyForest = A(); MyForest ## line 1750 ##
An enumerated set with a forest structure
sage: MyForest.category() ## line 1752 ##
Category of infinite enumerated sets
sage: p = iter(MyForest) ## line 1754 ##
sage: [next(p) for i in range(30)] ## line 1755 ##
[1,
 2,
 3,
 4,
 6,
 5,
 7,
 8,
 12,
 10,
 14,
 9,
 13,
 11,
 16,
 24,
 20,
 28,
 18,
 26,
 22,
 17,
 25,
 21,
 19,
 32,
 48,
 40,
 56,
 36]
sage: def children(x):
    return [x+1] ## line 1764 ##
sage: S = RecursivelyEnumeratedSet_forest( [1], children, category=InfiniteEnumeratedSets()) ## line 1766 ##
sage: dumps(S) ## line 1767 ##
sage: import __main__ ## line 1774 ##
sage: __main__.children = children ## line 1775 ##
sage: S = RecursivelyEnumeratedSet_forest( [1], children, category=InfiniteEnumeratedSets()) ## line 1776 ##
sage: loads(dumps(S)) ## line 1777 ##
An enumerated set with a forest structure
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1779 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1785 ##
sage: S = RecursivelyEnumeratedSet_forest(NN, lambda x : [], lambda x: x^2 if x.is_prime() else None) ## line 1786 ##
sage: S.category() ## line 1787 ##
Category of enumerated sets
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1789 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1805 ##
sage: RecursivelyEnumeratedSet_forest( [1], lambda x: [x+1]) ## line 1806 ##
An enumerated set with a forest structure
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1808 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1817 ##
sage: I = RecursivelyEnumeratedSet_forest([(0,0)], lambda l: [(l[0]+1, l[1]), (l[0], 1)] if l[1] == 0 else [(l[0], l[1]+1)]) ## line 1818 ##
sage: [i for i in I.roots()] ## line 1819 ##
[(0, 0)]
sage: I = RecursivelyEnumeratedSet_forest([(0,0),(1,1)], lambda l: [(l[0]+1, l[1]), (l[0], 1)] if l[1] == 0 else [(l[0], l[1]+1)]) ## line 1821 ##
sage: [i for i in I.roots()] ## line 1822 ##
[(0, 0), (1, 1)]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1824 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1837 ##
sage: I = RecursivelyEnumeratedSet_forest([(0,0)], lambda l: [(l[0]+1, l[1]), (l[0], 1)] if l[1] == 0 else [(l[0], l[1]+1)]) ## line 1838 ##
sage: [i for i in I.children((0,0))] ## line 1839 ##
[(1, 0), (0, 1)]
sage: [i for i in I.children((1,0))] ## line 1841 ##
[(2, 0), (1, 1)]
sage: [i for i in I.children((1,1))] ## line 1843 ##
[(1, 2)]
sage: [i for i in I.children((4,1))] ## line 1845 ##
[(4, 2)]
sage: [i for i in I.children((4,0))] ## line 1847 ##
[(5, 0), (4, 1)]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1849 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1857 ##
sage: def children(l):
     return [l+[0], l+[1]] ## line 1858 ##
sage: C = RecursivelyEnumeratedSet_forest(([],), children) ## line 1860 ##
sage: f = C.__iter__() ## line 1861 ##
sage: next(f) ## line 1862 ##
[]
sage: next(f) ## line 1864 ##
[0]
sage: next(f) ## line 1866 ##
[0, 0]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1868 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1882 ##
sage: f = RecursivelyEnumeratedSet_forest([[]],
                 lambda l: [l+[0], l+[1]] if len(l) < 3 else []) ## line 1883 ##
sage: list(f.depth_first_search_iterator()) ## line 1885 ##
[[],
 [0],
 [0, 0],
 [0, 0, 0],
 [0, 0, 1],
 [0, 1],
 [0, 1, 0],
 [0, 1, 1],
 [1],
 [1, 0],
 [1, 0, 0],
 [1, 0, 1],
 [1, 1],
 [1, 1, 0],
 [1, 1, 1]]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1887 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1896 ##
sage: f = RecursivelyEnumeratedSet_forest([[]],
                 lambda l: [l+[0], l+[1]] if len(l) < 3 else []) ## line 1897 ##
sage: list(f.breadth_first_search_iterator()) ## line 1899 ##
[[],
 [0],
 [1],
 [0, 0],
 [0, 1],
 [1, 0],
 [1, 1],
 [0, 0, 0],
 [0, 0, 1],
 [0, 1, 0],
 [0, 1, 1],
 [1, 0, 0],
 [1, 0, 1],
 [1, 1, 0],
 [1, 1, 1]]
sage: S = RecursivelyEnumeratedSet_forest([(0,0)],
lambda x : [(x[0], x[1]+1)] if x[1] != 0 else [(x[0]+1,0), (x[0],1)],
post_process = lambda x: x if ((is_prime(x[0]) and is_prime(x[1])) and ((x[0] - x[1]) == 2)) else None) ## line 1901 ##
sage: p = S.breadth_first_search_iterator() ## line 1904 ##
sage: [next(p), next(p), next(p), next(p), next(p), next(p), next(p)] ## line 1905 ##
[(5, 3), (7, 5), (13, 11), (19, 17), (31, 29), (43, 41), (61, 59)]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1907 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1922 ##
sage: I = RecursivelyEnumeratedSet_forest([(0,0)], lambda l: [(l[0]+1, l[1]), (l[0], 1)] if l[1] == 0 else [(l[0], l[1]+1)]) ## line 1923 ##
sage: list(I._elements_of_depth_iterator_rec(8)) ## line 1924 ##
[(8, 0), (7, 1), (6, 2), (5, 3), (4, 4), (3, 5), (2, 6), (1, 7), (0, 8)]
sage: I = RecursivelyEnumeratedSet_forest([[]], lambda l: [l+[0], l+[1]] if len(l) < 3 else []) ## line 1926 ##
sage: list(I._elements_of_depth_iterator_rec(0)) ## line 1927 ##
[[]]
sage: list(I._elements_of_depth_iterator_rec(1)) ## line 1929 ##
[[0], [1]]
sage: list(I._elements_of_depth_iterator_rec(2)) ## line 1931 ##
[[0, 0], [0, 1], [1, 0], [1, 1]]
sage: list(I._elements_of_depth_iterator_rec(3)) ## line 1933 ##
[[0, 0, 0],
 [0, 0, 1],
 [0, 1, 0],
 [0, 1, 1],
 [1, 0, 0],
 [1, 0, 1],
 [1, 1, 0],
 [1, 1, 1]]
sage: list(I._elements_of_depth_iterator_rec(4)) ## line 1935 ##
[]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1937 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1954 ##
sage: S = RecursivelyEnumeratedSet_forest([(0,0)] ,
       lambda x : [(x[0], x[1]+1)] if x[1] != 0 else [(x[0]+1,0), (x[0],1)],
       post_process = lambda x: x if ((is_prime(x[0]) and is_prime(x[1]))
                                       and ((x[0] - x[1]) == 2)) else None) ## line 1955 ##
sage: p = S.elements_of_depth_iterator(8) ## line 1959 ##
sage: next(p) ## line 1960 ##
(5, 3)
sage: S = RecursivelyEnumeratedSet_forest(NN, lambda x : [],
                     lambda x: x^2 if x.is_prime() else None) ## line 1962 ##
sage: p = S.elements_of_depth_iterator(0) ## line 1964 ##
sage: [next(p), next(p), next(p), next(p), next(p)] ## line 1965 ##
[4, 9, 25, 49, 121]
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 1967 ##
0
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 1986 ##
sage: S = RecursivelyEnumeratedSet_forest( [[]], lambda l: [l+[0], l+[1]] if len(l) < 3 else [], category=FiniteEnumeratedSets()) ## line 1987 ##
sage: [4] in S ## line 1988 ##
False
sage: [1] in S ## line 1990 ##
True
sage: [1,1,1,1] in S ## line 1992 ##
False
sage: all(S.__contains__(i) for i in iter(S)) ## line 1994 ##
True
sage: S = RecursivelyEnumeratedSet_forest([1], lambda x: [x+1], category=InfiniteEnumeratedSets()) ## line 1996 ##
sage: 1 in S ## line 1997 ##
True
sage: 732 in S ## line 1999 ##
True
sage: from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet_forest ## line 2010 ##
sage: S = RecursivelyEnumeratedSet_forest(Family(NN, lambda x : (x, 0)),
lambda x : Family(PositiveIntegers(), lambda y : (x[0], y)) if x[1] == 0 else []) ## line 2011 ##
sage: p = S.depth_first_search_iterator() ## line 2013 ##
sage: [next(p), next(p), next(p), next(p), next(p), next(p), next(p)] ## line 2014 ##
[(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6)]
sage: p = S.breadth_first_search_iterator() ## line 2016 ##
sage: [next(p), next(p), next(p), next(p), next(p), next(p), next(p)] ## line 2017 ##
[(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0)]
sage: (0,0) in S ## line 2019 ##
True
sage: (1,1) in S ## line 2021 ##
True
sage: (10,10) in S ## line 2023 ##
True
sage: (42,18) in S ## line 2025 ##
True
sage: S = RecursivelyEnumeratedSet_forest(Family(NN, lambda x : (x, 0)) , lambda x : [(x[0], x[1]+1)]) ## line 2034 ##
sage: p = S.depth_first_search_iterator() ## line 2035 ##
sage: [next(p), next(p), next(p), next(p), next(p), next(p), next(p)] ## line 2036 ##
[(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6)]
sage: p = S.breadth_first_search_iterator() ## line 2038 ##
sage: [next(p), next(p), next(p), next(p), next(p), next(p), next(p)] ## line 2039 ##
[(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0)]
sage: (0,0) in S ## line 2041 ##
True
sage: (1,1) in S ## line 2043 ##
True
sage: (10,10) in S ## line 2045 ##
True
sage: (37,11) in S ## line 2047 ##
True
sage: sig_on_count() # check sig_on/off pairings (virtual doctest) ## line 2049 ##
0
sage: seeds = [([i],i, i) for i in range(1,10)] ## line 2089 ##
sage: def succ(t):
    list, sum, last = t
    return [(list + [i], sum + i, i) for i in range(1, last)] ## line 2090 ##
sage: F = RecursivelyEnumeratedSet(seeds, succ,
                      structure='forest', enumeration='depth') ## line 2093 ##
sage: y = var('y') ## line 2096 ##
sage: def map_function(t):
    li, sum, _ = t
    return y ^ sum ## line 2097 ##
sage: reduce_function = lambda x,y: x + y ## line 2100 ##
sage: F.map_reduce(map_function, reduce_function, 0) ## line 2101 ##
Process RESetMapReduceWorker-1:2:
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1760, in run_myself
    node = self._todo.pop()
           ^^^^^^^^^^^^^^^^
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1719, in run
    self.run_myself()
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1762, in run_myself
    node = self.steal()
           ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1666, in steal
    self._mapred._signal_task_done()
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1386, in _signal_task_done
    if self._active_tasks.task_done() <= 0:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 858, in task_done
    return self._active_tasks.get_value()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/multiprocessing/synchronize.py", line 129, in get_value
    return self._semlock._get_value()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
NotImplementedError
Process RESetMapReduceWorker-1:1:
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1760, in run_myself
    node = self._todo.pop()
           ^^^^^^^^^^^^^^^^
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1719, in run
    self.run_myself()
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1762, in run_myself
    node = self.steal()
           ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1666, in steal
    self._mapred._signal_task_done()
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 1386, in _signal_task_done
    if self._active_tasks.task_done() <= 0:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/sage/parallel/map_reduce.py", line 858, in task_done
    return self._active_tasks.get_value()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/multiprocessing/synchronize.py", line 129, in get_value
    return self._semlock._get_value()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
NotImplementedError
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x735c)[0xffff312f735c]
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x741c)[0xffff312f741c]
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x960c)[0xffff312f960c]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffff331048dc]
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x735c)[0xffff312f735c]
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x741c)[0xffff312f741c]
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x960c)[0xffff312f960c]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffff331048dc]
/usr/lib/libc.so.6(read+0x6c)[0xffff32a5a3ec]
/usr/lib/libc.so.6(+0x7bca8)[0xffff329fbca8]
/usr/lib/libpython3.11.so.1.0(_Py_read+0x5c)[0xffff32dbe08c]
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x735c)[0xffff312f735c]
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x741c)[0xffff312f741c]
/usr/lib/python3.11/site-packages/cysignals/signals.so(+0x960c)[0xffff312f960c]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffff331048dc]
/usr/lib/libc.so.6(+0x8796c)[0xffff32a0796c]
/usr/lib/libpython3.11.so.1.0(+0x28f97c)[0xffff32dcf97c]
/usr/lib/libpython3.11.so.1.0(PyThread_acquire_lock_timed+0x15c)[0xffff32db21ac]
/usr/lib/libpython3.11.so.1.0(+0x191ae0)[0xffff32cd1ae0]
/usr/lib/libpython3.11.so.1.0(+0x2d2870)[0xffff32e12870]
/usr/lib/libpython3.11.so.1.0(PyObject_Vectorcall+0x48)[0xffff32c8dac8]
/usr/lib/libc.so.6(+0x7bca8)[0xffff329fbca8]
/usr/lib/libpython3.11.so.1.0(+0x2d2a08)[0xffff32e12a08]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x15918c)[0xffff32c9918c]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(PyObject_Vectorcall+0x48)[0xffff32c8dac8]
/usr/lib/libc.so.6(+0x8796c)[0xffff32a0796c]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(PyThread_acquire_lock_timed+0x15c)[0xffff32db21ac]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/python3.11/site-packages/sage/sets/recursively_enumerated_set.so(+0xe204)[0xfffed935e204]
/usr/lib/python3.11/site-packages/sage/sets/recursively_enumerated_set.so(+0x151d0)[0xfffed93651d0]
/usr/lib/libpython3.11.so.1.0(_PyObject_FastCallDictTstate+0x74)[0xffff32c8d604]
/usr/lib/libpython3.11.so.1.0(_PyObject_Call_Prepend+0xdc)[0xffff32c8d8ec]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(+0x2d2870)[0xffff32e12870]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x1b40ac)[0xffff32cf40ac]
/usr/lib/libpython3.11.so.1.0(+0x2d2a08)[0xffff32e12a08]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(+0x1ab3b8)[0xffff32ceb3b8]
/usr/lib/libpython3.11.so.1.0(PyEval_EvalCode+0x98)[0xffff32d61fbc]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(+0x219ec8)[0xffff32d59ec8]
/usr/lib/libpython3.11.so.1.0(+0x15918c)[0xffff32c9918c]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x1dc4)[0xffff32c3c834]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(_PyObject_FastCallDictTstate+0x74)[0xffff32c8d604]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(PyObject_Vectorcall+0x48)[0xffff32c8dac8]
/usr/lib/libpython3.11.so.1.0(_PyObject_Call_Prepend+0xdc)[0xffff32c8d8ec]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x1b3f58)[0xffff32cf3f58]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(_PyObject_FastCallDictTstate+0x74)[0xffff32c8d604]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(_PyObject_Call_Prepend+0xdc)[0xffff32c8d8ec]
/usr/lib/python3.11/site-packages/sage/sets/recursively_enumerated_set.so(+0xe204)[0xfffed935e204]
/usr/lib/python3.11/site-packages/sage/sets/recursively_enumerated_set.so(+0x151d0)[0xfffed93651d0]
/usr/lib/libpython3.11.so.1.0(+0x1b40ac)[0xffff32cf40ac]
/usr/lib/libpython3.11.so.1.0(_PyObject_FastCallDictTstate+0x74)[0xffff32c8d604]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(+0x1ab3b8)[0xffff32ceb3b8]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(_PyObject_Call_Prepend+0xdc)[0xffff32c8d8ec]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(PyEval_EvalCode+0x98)[0xffff32d61fbc]
/usr/lib/libpython3.11.so.1.0(PyEval_EvalCode+0x98)[0xffff32d61fbc]
/usr/lib/libpython3.11.so.1.0(+0x219ec8)[0xffff32d59ec8]
/usr/lib/libpython3.11.so.1.0(+0x1b40ac)[0xffff32cf40ac]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x1dc4)[0xffff32c3c834]
/usr/lib/libpython3.11.so.1.0(+0x261a5c)[0xffff32da1a5c]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(_PyObject_FastCallDictTstate+0x74)[0xffff32c8d604]
/usr/lib/libpython3.11.so.1.0(+0x261c84)[0xffff32da1c84]
/usr/lib/libpython3.11.so.1.0(_PyObject_Call_Prepend+0xdc)[0xffff32c8d8ec]
/usr/lib/libpython3.11.so.1.0(+0x1ab3b8)[0xffff32ceb3b8]
/usr/lib/libpython3.11.so.1.0(+0x261d84)[0xffff32da1d84]
/usr/lib/libpython3.11.so.1.0(+0x1b3f58)[0xffff32cf3f58]
/usr/lib/libpython3.11.so.1.0(_PyRun_SimpleFileObject+0x114)[0xffff32da4524]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(_PyRun_AnyFileObject+0x84)[0xffff32da4a14]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(Py_RunMain+0x6ac)[0xffff32dc065c]
/usr/lib/libpython3.11.so.1.0(_PyObject_FastCallDictTstate+0x74)[0xffff32c8d604]
/usr/lib/libpython3.11.so.1.0(_PyObject_Call_Prepend+0xdc)[0xffff32c8d8ec]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(Py_BytesMain+0x5c)[0xffff32dc0b7c]
/usr/lib/libpython3.11.so.1.0(+0x1b40ac)[0xffff32cf40ac]
/usr/lib/libpython3.11.so.1.0(+0x1ab3b8)[0xffff32ceb3b8]
/usr/lib/libc.so.6(+0x27780)[0xffff329a7780]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libc.so.6(__libc_start_main+0x98)[0xffff329a7858]
/usr/bin/python3(_start+0x30)[0xaaab94660870]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
------------------------------------------------------------------------
/usr/lib/libpython3.11.so.1.0(PyEval_EvalCode+0x98)[0xffff32d61fbc]
/usr/lib/libpython3.11.so.1.0(+0x261a5c)[0xffff32da1a5c]
/usr/lib/libpython3.11.so.1.0(+0x261c84)[0xffff32da1c84]
/usr/lib/libpython3.11.so.1.0(+0x261d84)[0xffff32da1d84]
/usr/lib/libpython3.11.so.1.0(_PyRun_SimpleFileObject+0x114)[0xffff32da4524]
/usr/lib/libpython3.11.so.1.0(_PyRun_AnyFileObject+0x84)[0xffff32da4a14]
/usr/lib/libpython3.11.so.1.0(Py_RunMain+0x6ac)[0xffff32dc065c]
/usr/lib/libpython3.11.so.1.0(Py_BytesMain+0x5c)[0xffff32dc0b7c]
/usr/lib/libc.so.6(+0x27780)[0xffff329a7780]
/usr/lib/libc.so.6(__libc_start_main+0x98)[0xffff329a7858]
/usr/bin/python3(_start+0x30)[0xaaab94660870]
------------------------------------------------------------------------
/usr/lib/python3.11/site-packages/sage/sets/recursively_enumerated_set.so(+0xe204)[0xfffed935e204]
/usr/lib/python3.11/site-packages/sage/sets/recursively_enumerated_set.so(+0x151d0)[0xfffed93651d0]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(PyEval_EvalCode+0x98)[0xffff32d61fbc]
/usr/lib/libpython3.11.so.1.0(+0x219ec8)[0xffff32d59ec8]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x1dc4)[0xffff32c3c834]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(_PyObject_FastCallDictTstate+0x74)[0xffff32c8d604]
/usr/lib/libpython3.11.so.1.0(_PyObject_Call_Prepend+0xdc)[0xffff32c8d8ec]
/usr/lib/libpython3.11.so.1.0(+0x1b3f58)[0xffff32cf3f58]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(_PyObject_FastCallDictTstate+0x74)[0xffff32c8d604]
/usr/lib/libpython3.11.so.1.0(_PyObject_Call_Prepend+0xdc)[0xffff32c8d8ec]
/usr/lib/libpython3.11.so.1.0(+0x1b40ac)[0xffff32cf40ac]
/usr/lib/libpython3.11.so.1.0(+0x1ab3b8)[0xffff32ceb3b8]
/usr/lib/libpython3.11.so.1.0(_PyObject_MakeTpCall+0x90)[0xffff32c8d450]
/usr/lib/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x6920)[0xffff32c41390]
/usr/lib/libpython3.11.so.1.0(+0x221f1c)[0xffff32d61f1c]
/usr/lib/libpython3.11.so.1.0(PyEval_EvalCode+0x98)[0xffff32d61fbc]
/usr/lib/libpython3.11.so.1.0(+0x261a5c)[0xffff32da1a5c]
/usr/lib/libpython3.11.so.1.0(+0x261c84)[0xffff32da1c84]
/usr/lib/libpython3.11.so.1.0(+0x261d84)[0xffff32da1d84]
/usr/lib/libpython3.11.so.1.0(_PyRun_SimpleFileObject+0x114)[0xffff32da4524]
/usr/lib/libpython3.11.so.1.0(_PyRun_AnyFileObject+0x84)[0xffff32da4a14]
/usr/lib/libpython3.11.so.1.0(Py_RunMain+0x6ac)[0xffff32dc065c]
/usr/lib/libpython3.11.so.1.0(Py_BytesMain+0x5c)[0xffff32dc0b7c]
/usr/lib/libc.so.6(+0x27780)[0xffff329a7780]
/usr/lib/libc.so.6(__libc_start_main+0x98)[0xffff329a7858]
/usr/bin/python3(_start+0x30)[0xaaab94660870]
------------------------------------------------------------------------
Attaching gdb to process id 1212.
Attaching gdb to process id 1213.
Cannot find gdb installedCannot find gdb installed
GDB is not installed.
Install gdb for enhanced tracebacks.

GDB is not installed.
Install gdb for enhanced tracebacks.
------------------------------------------------------------------------
------------------------------------------------------------------------

**********************************************************************
----------------------------------------------------------------------
sage -t --long --warn-long 8.8 --random-seed=72334392402293453007476860292589154167 /usr/lib/python3.11/site-packages/sage/sets/recursively_enumerated_set.pyx  # Timed out
----------------------------------------------------------------------
Total time for all tests: 1800.1 seconds
    cpu time: 0.0 seconds
    cumulative wall time: 0.0 seconds
Features detected for doctesting: 
