Cartesian products of Posets¶
AUTHORS:
- Daniel Krenn (2015)
-
sage.combinat.posets.cartesian_product.
CartesianProductPoset
¶ A class implementing Cartesian products of posets (and elements thereof). Compared to
CartesianProduct
you are able to specify an order for comparison of the elements.INPUT:
sets
– a tuple of parents.category
– a subcategory ofSets().CartesianProducts() & Posets()
.order
– a string or function specifying an order less or equal. It can be one of the following:'native'
– elements are ordered by their native ordering, i.e., the order the wrapped elements (tuples) provide.'lex'
– elements are ordered lexicographically.'product'
– an element is less or equal to another element, if less or equal is true for all its components (Cartesian projections).- A function which performs the comparison \(\leq\). It takes two input arguments and outputs a boolean.
Other keyword arguments (
kwargs
) are passed to the constructor ofCartesianProduct
.EXAMPLES:
sage: P = Poset((srange(3), lambda left, right: left <= right)) sage: Cl = cartesian_product((P, P), order='lex') sage: Cl((1, 1)) <= Cl((2, 0)) True sage: Cp = cartesian_product((P, P), order='product') sage: Cp((1, 1)) <= Cp((2, 0)) False sage: def le_sum(left, right): ....: return (sum(left) < sum(right) or ....: sum(left) == sum(right) and left[0] <= right[0]) sage: Cs = cartesian_product((P, P), order=le_sum) sage: Cs((1, 1)) <= Cs((2, 0)) True
See also