Transitive ideal closure tool¶
- sage.combinat.tools.transitive_ideal(f, x)[source]¶
Return a list of all elements reachable from
in the abstract reduction system whose reduction relation is given by the function .In more elementary terms:
If
is a set, and is a function sending every element of to a list of elements of , then we can define a digraph on the vertex set by drawing an edge from to for every and every .If
, then an element is said to be reachable from if there is a path in this graph.Given
and , this method computes the list of all elements of reachable from .Note that if there are infinitely many such elements, then this method will never halt.
For more powerful versions, see
sage.combinat.backtrack
EXAMPLES:
sage: f = lambda x: [x-1] if x > 0 else [] sage: sage.combinat.tools.transitive_ideal(f, 10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> from sage.all import * >>> f = lambda x: [x-Integer(1)] if x > Integer(0) else [] >>> sage.combinat.tools.transitive_ideal(f, Integer(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]