passagemath-graphs 10.5.43__cp39-cp39-musllinux_1_2_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. passagemath_graphs-10.5.43.dist-info/METADATA +293 -0
  2. passagemath_graphs-10.5.43.dist-info/RECORD +258 -0
  3. passagemath_graphs-10.5.43.dist-info/WHEEL +5 -0
  4. passagemath_graphs-10.5.43.dist-info/top_level.txt +2 -0
  5. passagemath_graphs.libs/libgcc_s-69c45f16.so.1 +0 -0
  6. passagemath_graphs.libs/libgmp-8e78bd9b.so.10.5.0 +0 -0
  7. passagemath_graphs.libs/libstdc++-1f1a71be.so.6.0.33 +0 -0
  8. sage/all__sagemath_graphs.py +39 -0
  9. sage/combinat/abstract_tree.py +2552 -0
  10. sage/combinat/all__sagemath_graphs.py +34 -0
  11. sage/combinat/binary_tree.py +5306 -0
  12. sage/combinat/cluster_algebra_quiver/all.py +22 -0
  13. sage/combinat/cluster_algebra_quiver/cluster_seed.py +5208 -0
  14. sage/combinat/cluster_algebra_quiver/interact.py +125 -0
  15. sage/combinat/cluster_algebra_quiver/mutation_class.py +625 -0
  16. sage/combinat/cluster_algebra_quiver/mutation_type.py +1556 -0
  17. sage/combinat/cluster_algebra_quiver/quiver.py +2262 -0
  18. sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +2468 -0
  19. sage/combinat/designs/MOLS_handbook_data.py +570 -0
  20. sage/combinat/designs/all.py +58 -0
  21. sage/combinat/designs/bibd.py +1655 -0
  22. sage/combinat/designs/block_design.py +1071 -0
  23. sage/combinat/designs/covering_array.py +269 -0
  24. sage/combinat/designs/covering_design.py +534 -0
  25. sage/combinat/designs/database.py +5614 -0
  26. sage/combinat/designs/design_catalog.py +122 -0
  27. sage/combinat/designs/designs_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  28. sage/combinat/designs/designs_pyx.pxd +21 -0
  29. sage/combinat/designs/designs_pyx.pyx +993 -0
  30. sage/combinat/designs/difference_family.py +3951 -0
  31. sage/combinat/designs/difference_matrices.py +279 -0
  32. sage/combinat/designs/evenly_distributed_sets.cpython-39-aarch64-linux-gnu.so +0 -0
  33. sage/combinat/designs/evenly_distributed_sets.pyx +661 -0
  34. sage/combinat/designs/ext_rep.py +1064 -0
  35. sage/combinat/designs/gen_quadrangles_with_spread.cpython-39-aarch64-linux-gnu.so +0 -0
  36. sage/combinat/designs/gen_quadrangles_with_spread.pyx +339 -0
  37. sage/combinat/designs/group_divisible_designs.py +361 -0
  38. sage/combinat/designs/incidence_structures.py +2357 -0
  39. sage/combinat/designs/latin_squares.py +548 -0
  40. sage/combinat/designs/orthogonal_arrays.py +2243 -0
  41. sage/combinat/designs/orthogonal_arrays_build_recursive.py +1780 -0
  42. sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-39-aarch64-linux-gnu.so +0 -0
  43. sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +966 -0
  44. sage/combinat/designs/resolvable_bibd.py +781 -0
  45. sage/combinat/designs/steiner_quadruple_systems.py +1306 -0
  46. sage/combinat/designs/subhypergraph_search.cpython-39-aarch64-linux-gnu.so +0 -0
  47. sage/combinat/designs/subhypergraph_search.pyx +530 -0
  48. sage/combinat/designs/twographs.py +306 -0
  49. sage/combinat/finite_state_machine.py +14874 -0
  50. sage/combinat/finite_state_machine_generators.py +2006 -0
  51. sage/combinat/graph_path.py +448 -0
  52. sage/combinat/interval_posets.py +3908 -0
  53. sage/combinat/nu_tamari_lattice.py +269 -0
  54. sage/combinat/ordered_tree.py +1446 -0
  55. sage/combinat/posets/all.py +46 -0
  56. sage/combinat/posets/cartesian_product.py +493 -0
  57. sage/combinat/posets/d_complete.py +182 -0
  58. sage/combinat/posets/elements.py +273 -0
  59. sage/combinat/posets/forest.py +30 -0
  60. sage/combinat/posets/hasse_cython.cpython-39-aarch64-linux-gnu.so +0 -0
  61. sage/combinat/posets/hasse_cython.pyx +174 -0
  62. sage/combinat/posets/hasse_diagram.py +3678 -0
  63. sage/combinat/posets/incidence_algebras.py +796 -0
  64. sage/combinat/posets/lattices.py +5119 -0
  65. sage/combinat/posets/linear_extension_iterator.cpython-39-aarch64-linux-gnu.so +0 -0
  66. sage/combinat/posets/linear_extension_iterator.pyx +292 -0
  67. sage/combinat/posets/linear_extensions.py +1039 -0
  68. sage/combinat/posets/mobile.py +275 -0
  69. sage/combinat/posets/moebius_algebra.py +776 -0
  70. sage/combinat/posets/poset_examples.py +2131 -0
  71. sage/combinat/posets/posets.py +9169 -0
  72. sage/combinat/rooted_tree.py +1070 -0
  73. sage/combinat/shard_order.py +239 -0
  74. sage/combinat/tamari_lattices.py +384 -0
  75. sage/combinat/yang_baxter_graph.py +923 -0
  76. sage/databases/all__sagemath_graphs.py +1 -0
  77. sage/databases/knotinfo_db.py +1230 -0
  78. sage/ext_data/all__sagemath_graphs.py +1 -0
  79. sage/ext_data/graphs/graph_plot_js.html +330 -0
  80. sage/ext_data/kenzo/CP2.txt +45 -0
  81. sage/ext_data/kenzo/CP3.txt +349 -0
  82. sage/ext_data/kenzo/CP4.txt +4774 -0
  83. sage/ext_data/kenzo/README.txt +49 -0
  84. sage/ext_data/kenzo/S4.txt +20 -0
  85. sage/graphs/all.py +42 -0
  86. sage/graphs/asteroidal_triples.cpython-39-aarch64-linux-gnu.so +0 -0
  87. sage/graphs/asteroidal_triples.pyx +299 -0
  88. sage/graphs/base/all.py +1 -0
  89. sage/graphs/base/boost_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  90. sage/graphs/base/boost_graph.pxd +106 -0
  91. sage/graphs/base/boost_graph.pyx +3045 -0
  92. sage/graphs/base/c_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  93. sage/graphs/base/c_graph.pxd +106 -0
  94. sage/graphs/base/c_graph.pyx +5096 -0
  95. sage/graphs/base/dense_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  96. sage/graphs/base/dense_graph.pxd +26 -0
  97. sage/graphs/base/dense_graph.pyx +757 -0
  98. sage/graphs/base/graph_backends.cpython-39-aarch64-linux-gnu.so +0 -0
  99. sage/graphs/base/graph_backends.pxd +5 -0
  100. sage/graphs/base/graph_backends.pyx +797 -0
  101. sage/graphs/base/overview.py +85 -0
  102. sage/graphs/base/sparse_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  103. sage/graphs/base/sparse_graph.pxd +90 -0
  104. sage/graphs/base/sparse_graph.pyx +1653 -0
  105. sage/graphs/base/static_dense_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  106. sage/graphs/base/static_dense_graph.pxd +5 -0
  107. sage/graphs/base/static_dense_graph.pyx +1032 -0
  108. sage/graphs/base/static_sparse_backend.cpython-39-aarch64-linux-gnu.so +0 -0
  109. sage/graphs/base/static_sparse_backend.pxd +27 -0
  110. sage/graphs/base/static_sparse_backend.pyx +1580 -0
  111. sage/graphs/base/static_sparse_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  112. sage/graphs/base/static_sparse_graph.pxd +37 -0
  113. sage/graphs/base/static_sparse_graph.pyx +1304 -0
  114. sage/graphs/bipartite_graph.py +2709 -0
  115. sage/graphs/centrality.cpython-39-aarch64-linux-gnu.so +0 -0
  116. sage/graphs/centrality.pyx +965 -0
  117. sage/graphs/cographs.py +519 -0
  118. sage/graphs/comparability.cpython-39-aarch64-linux-gnu.so +0 -0
  119. sage/graphs/comparability.pyx +813 -0
  120. sage/graphs/connectivity.cpython-39-aarch64-linux-gnu.so +0 -0
  121. sage/graphs/connectivity.pxd +157 -0
  122. sage/graphs/connectivity.pyx +4813 -0
  123. sage/graphs/convexity_properties.cpython-39-aarch64-linux-gnu.so +0 -0
  124. sage/graphs/convexity_properties.pxd +16 -0
  125. sage/graphs/convexity_properties.pyx +827 -0
  126. sage/graphs/digraph.py +4410 -0
  127. sage/graphs/digraph_generators.py +1921 -0
  128. sage/graphs/distances_all_pairs.cpython-39-aarch64-linux-gnu.so +0 -0
  129. sage/graphs/distances_all_pairs.pxd +12 -0
  130. sage/graphs/distances_all_pairs.pyx +2938 -0
  131. sage/graphs/domination.py +1363 -0
  132. sage/graphs/dot2tex_utils.py +100 -0
  133. sage/graphs/edge_connectivity.cpython-39-aarch64-linux-gnu.so +0 -0
  134. sage/graphs/edge_connectivity.pyx +1215 -0
  135. sage/graphs/generators/all.py +1 -0
  136. sage/graphs/generators/basic.py +1769 -0
  137. sage/graphs/generators/chessboard.py +538 -0
  138. sage/graphs/generators/classical_geometries.py +1611 -0
  139. sage/graphs/generators/degree_sequence.py +235 -0
  140. sage/graphs/generators/distance_regular.cpython-39-aarch64-linux-gnu.so +0 -0
  141. sage/graphs/generators/distance_regular.pyx +2846 -0
  142. sage/graphs/generators/families.py +4749 -0
  143. sage/graphs/generators/intersection.py +565 -0
  144. sage/graphs/generators/platonic_solids.py +262 -0
  145. sage/graphs/generators/random.py +2623 -0
  146. sage/graphs/generators/smallgraphs.py +5741 -0
  147. sage/graphs/generators/world_map.py +724 -0
  148. sage/graphs/generic_graph.py +26395 -0
  149. sage/graphs/generic_graph_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  150. sage/graphs/generic_graph_pyx.pxd +34 -0
  151. sage/graphs/generic_graph_pyx.pyx +1626 -0
  152. sage/graphs/genus.cpython-39-aarch64-linux-gnu.so +0 -0
  153. sage/graphs/genus.pyx +623 -0
  154. sage/graphs/graph.py +9362 -0
  155. sage/graphs/graph_coloring.cpython-39-aarch64-linux-gnu.so +0 -0
  156. sage/graphs/graph_coloring.pyx +2284 -0
  157. sage/graphs/graph_database.py +1122 -0
  158. sage/graphs/graph_decompositions/all.py +1 -0
  159. sage/graphs/graph_decompositions/bandwidth.cpython-39-aarch64-linux-gnu.so +0 -0
  160. sage/graphs/graph_decompositions/bandwidth.pyx +428 -0
  161. sage/graphs/graph_decompositions/clique_separators.cpython-39-aarch64-linux-gnu.so +0 -0
  162. sage/graphs/graph_decompositions/clique_separators.pyx +595 -0
  163. sage/graphs/graph_decompositions/cutwidth.cpython-39-aarch64-linux-gnu.so +0 -0
  164. sage/graphs/graph_decompositions/cutwidth.pyx +753 -0
  165. sage/graphs/graph_decompositions/fast_digraph.cpython-39-aarch64-linux-gnu.so +0 -0
  166. sage/graphs/graph_decompositions/fast_digraph.pxd +13 -0
  167. sage/graphs/graph_decompositions/fast_digraph.pyx +212 -0
  168. sage/graphs/graph_decompositions/graph_products.cpython-39-aarch64-linux-gnu.so +0 -0
  169. sage/graphs/graph_decompositions/graph_products.pyx +462 -0
  170. sage/graphs/graph_decompositions/modular_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  171. sage/graphs/graph_decompositions/modular_decomposition.pxd +27 -0
  172. sage/graphs/graph_decompositions/modular_decomposition.pyx +1536 -0
  173. sage/graphs/graph_decompositions/slice_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  174. sage/graphs/graph_decompositions/slice_decomposition.pxd +18 -0
  175. sage/graphs/graph_decompositions/slice_decomposition.pyx +1080 -0
  176. sage/graphs/graph_decompositions/tree_decomposition.cpython-39-aarch64-linux-gnu.so +0 -0
  177. sage/graphs/graph_decompositions/tree_decomposition.pxd +17 -0
  178. sage/graphs/graph_decompositions/tree_decomposition.pyx +1996 -0
  179. sage/graphs/graph_decompositions/vertex_separation.cpython-39-aarch64-linux-gnu.so +0 -0
  180. sage/graphs/graph_decompositions/vertex_separation.pxd +5 -0
  181. sage/graphs/graph_decompositions/vertex_separation.pyx +1963 -0
  182. sage/graphs/graph_editor.py +82 -0
  183. sage/graphs/graph_generators.py +3301 -0
  184. sage/graphs/graph_generators_pyx.cpython-39-aarch64-linux-gnu.so +0 -0
  185. sage/graphs/graph_generators_pyx.pyx +95 -0
  186. sage/graphs/graph_input.py +812 -0
  187. sage/graphs/graph_latex.py +2064 -0
  188. sage/graphs/graph_list.py +367 -0
  189. sage/graphs/graph_plot.py +1749 -0
  190. sage/graphs/graph_plot_js.py +338 -0
  191. sage/graphs/hyperbolicity.cpython-39-aarch64-linux-gnu.so +0 -0
  192. sage/graphs/hyperbolicity.pyx +1702 -0
  193. sage/graphs/hypergraph_generators.py +364 -0
  194. sage/graphs/independent_sets.cpython-39-aarch64-linux-gnu.so +0 -0
  195. sage/graphs/independent_sets.pxd +13 -0
  196. sage/graphs/independent_sets.pyx +402 -0
  197. sage/graphs/isgci.py +1033 -0
  198. sage/graphs/isoperimetric_inequalities.cpython-39-aarch64-linux-gnu.so +0 -0
  199. sage/graphs/isoperimetric_inequalities.pyx +453 -0
  200. sage/graphs/line_graph.cpython-39-aarch64-linux-gnu.so +0 -0
  201. sage/graphs/line_graph.pyx +627 -0
  202. sage/graphs/lovasz_theta.py +77 -0
  203. sage/graphs/matching.py +1633 -0
  204. sage/graphs/matching_covered_graph.py +3566 -0
  205. sage/graphs/orientations.py +1504 -0
  206. sage/graphs/partial_cube.py +459 -0
  207. sage/graphs/path_enumeration.cpython-39-aarch64-linux-gnu.so +0 -0
  208. sage/graphs/path_enumeration.pyx +2040 -0
  209. sage/graphs/pq_trees.py +1129 -0
  210. sage/graphs/print_graphs.py +201 -0
  211. sage/graphs/schnyder.py +865 -0
  212. sage/graphs/spanning_tree.cpython-39-aarch64-linux-gnu.so +0 -0
  213. sage/graphs/spanning_tree.pyx +1457 -0
  214. sage/graphs/strongly_regular_db.cpython-39-aarch64-linux-gnu.so +0 -0
  215. sage/graphs/strongly_regular_db.pyx +3340 -0
  216. sage/graphs/traversals.cpython-39-aarch64-linux-gnu.so +0 -0
  217. sage/graphs/traversals.pxd +9 -0
  218. sage/graphs/traversals.pyx +1871 -0
  219. sage/graphs/trees.cpython-39-aarch64-linux-gnu.so +0 -0
  220. sage/graphs/trees.pxd +15 -0
  221. sage/graphs/trees.pyx +310 -0
  222. sage/graphs/tutte_polynomial.py +713 -0
  223. sage/graphs/views.cpython-39-aarch64-linux-gnu.so +0 -0
  224. sage/graphs/views.pyx +794 -0
  225. sage/graphs/weakly_chordal.cpython-39-aarch64-linux-gnu.so +0 -0
  226. sage/graphs/weakly_chordal.pyx +562 -0
  227. sage/groups/all__sagemath_graphs.py +1 -0
  228. sage/groups/perm_gps/all__sagemath_graphs.py +1 -0
  229. sage/groups/perm_gps/partn_ref/all__sagemath_graphs.py +1 -0
  230. sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-39-aarch64-linux-gnu.so +0 -0
  231. sage/groups/perm_gps/partn_ref/refinement_graphs.pxd +38 -0
  232. sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +1666 -0
  233. sage/knots/all.py +6 -0
  234. sage/knots/free_knotinfo_monoid.py +507 -0
  235. sage/knots/gauss_code.py +291 -0
  236. sage/knots/knot.py +682 -0
  237. sage/knots/knot_table.py +284 -0
  238. sage/knots/knotinfo.py +2880 -0
  239. sage/knots/link.py +4682 -0
  240. sage/sandpiles/all.py +13 -0
  241. sage/sandpiles/examples.py +225 -0
  242. sage/sandpiles/sandpile.py +6365 -0
  243. sage/topology/all.py +22 -0
  244. sage/topology/cell_complex.py +1214 -0
  245. sage/topology/cubical_complex.py +1977 -0
  246. sage/topology/delta_complex.py +1806 -0
  247. sage/topology/filtered_simplicial_complex.py +744 -0
  248. sage/topology/moment_angle_complex.py +823 -0
  249. sage/topology/simplicial_complex.py +5161 -0
  250. sage/topology/simplicial_complex_catalog.py +86 -0
  251. sage/topology/simplicial_complex_examples.py +1692 -0
  252. sage/topology/simplicial_complex_homset.py +205 -0
  253. sage/topology/simplicial_complex_morphism.py +836 -0
  254. sage/topology/simplicial_set.py +4102 -0
  255. sage/topology/simplicial_set_catalog.py +55 -0
  256. sage/topology/simplicial_set_constructions.py +2954 -0
  257. sage/topology/simplicial_set_examples.py +865 -0
  258. sage/topology/simplicial_set_morphism.py +1464 -0
@@ -0,0 +1,46 @@
1
+ # sage_setup: distribution = sagemath-graphs
2
+ r"""
3
+ Posets
4
+
5
+ Common posets can be accessed through ``posets.<tab>`` and are listed in the
6
+ posets catalog:
7
+
8
+ - :ref:`Catalog of posets and lattices <sage.combinat.posets.poset_examples>`
9
+
10
+ Poset-related classes:
11
+
12
+ - :ref:`sage.combinat.posets.posets`
13
+ - :ref:`sage.combinat.posets.lattices`
14
+
15
+ - :ref:`sage.combinat.posets.linear_extensions`
16
+ - :ref:`sage.combinat.posets.d_complete`
17
+ - :ref:`sage.combinat.posets.forest`
18
+ - :ref:`sage.combinat.posets.mobile`
19
+ - :ref:`sage.combinat.posets.incidence_algebras`
20
+
21
+ - :ref:`sage.combinat.posets.cartesian_product`
22
+
23
+ - :ref:`sage.combinat.posets.moebius_algebra`
24
+
25
+ - :ref:`sage.combinat.tamari_lattices`
26
+ - :ref:`sage.combinat.interval_posets`
27
+ - :ref:`sage.combinat.shard_order`
28
+
29
+ If you are looking for Poset-related :mod:`categories
30
+ <sage.categories.category>`, see
31
+ :class:`~sage.categories.posets.Posets`,
32
+ :class:`~sage.categories.finite_posets.FinitePosets`,
33
+ :class:`~sage.categories.lattice_posets.LatticePosets` and
34
+ :class:`~sage.categories.finite_lattice_posets.FiniteLatticePosets`.
35
+ """
36
+ # install the docstring of this module to the containing package
37
+ from sage.misc.namespace_package import install_doc
38
+ install_doc(__package__, __doc__)
39
+
40
+ from sage.combinat.posets.posets import Poset
41
+
42
+ from sage.combinat.posets.lattices import LatticePoset, MeetSemilattice, JoinSemilattice
43
+
44
+ from sage.combinat.posets.poset_examples import posets, Posets
45
+
46
+ del install_doc
@@ -0,0 +1,493 @@
1
+ # sage_setup: distribution = sagemath-graphs
2
+ """
3
+ Cartesian products of posets
4
+
5
+ AUTHORS:
6
+
7
+ - Daniel Krenn (2015)
8
+ """
9
+ # ****************************************************************************
10
+ # Copyright (C) 2015 Daniel Krenn <dev@danielkrenn.at>
11
+ #
12
+ # Distributed under the terms of the GNU General Public License (GPL)
13
+ # as published by the Free Software Foundation; either version 2 of
14
+ # the License, or (at your option) any later version.
15
+ # https://www.gnu.org/licenses/
16
+ # ****************************************************************************
17
+
18
+ from sage.sets.cartesian_product import CartesianProduct
19
+
20
+
21
+ class CartesianProductPoset(CartesianProduct):
22
+ r"""
23
+ A class implementing Cartesian products of posets (and elements
24
+ thereof). Compared to :class:`CartesianProduct` you are able to
25
+ specify an order for comparison of the elements.
26
+
27
+ INPUT:
28
+
29
+ - ``sets`` -- tuple of parents
30
+
31
+ - ``category`` -- a subcategory of ``Sets().CartesianProducts() & Posets()``
32
+
33
+ - ``order`` -- string or function specifying an order less or equal;
34
+ it can be one of the following:
35
+
36
+ - ``'native'`` -- elements are ordered by their native ordering,
37
+ i.e., the order the wrapped elements (tuples) provide
38
+
39
+ - ``'lex'`` -- elements are ordered lexicographically
40
+
41
+ - ``'product'`` -- an element is less or equal to another
42
+ element, if less or equal is true for all its components
43
+ (Cartesian projections)
44
+
45
+ - a function which performs the comparison `\leq`; it takes two
46
+ input arguments and outputs a boolean
47
+
48
+ Other keyword arguments (``kwargs``) are passed to the constructor
49
+ of :class:`CartesianProduct`.
50
+
51
+ EXAMPLES::
52
+
53
+ sage: P = Poset((srange(3), lambda left, right: left <= right))
54
+ sage: Cl = cartesian_product((P, P), order='lex')
55
+ sage: Cl((1, 1)) <= Cl((2, 0))
56
+ True
57
+ sage: Cp = cartesian_product((P, P), order='product')
58
+ sage: Cp((1, 1)) <= Cp((2, 0))
59
+ False
60
+ sage: def le_sum(left, right):
61
+ ....: return (sum(left) < sum(right) or
62
+ ....: sum(left) == sum(right) and left[0] <= right[0])
63
+ sage: Cs = cartesian_product((P, P), order=le_sum)
64
+ sage: Cs((1, 1)) <= Cs((2, 0))
65
+ True
66
+
67
+ TESTS::
68
+
69
+ sage: Cl.category()
70
+ Join of Category of finite posets and
71
+ Category of Cartesian products of finite enumerated sets
72
+ sage: TestSuite(Cl).run(skip=['_test_construction'])
73
+ sage: Cp.category()
74
+ Join of Category of finite posets and
75
+ Category of Cartesian products of finite enumerated sets
76
+ sage: TestSuite(Cp).run(skip=['_test_construction'])
77
+
78
+ .. SEEALSO::
79
+
80
+ :class:`CartesianProduct`
81
+ """
82
+
83
+ def __init__(self, sets, category, order=None, **kwargs) -> None:
84
+ r"""
85
+ See :class:`CartesianProductPoset` for details.
86
+
87
+ TESTS::
88
+
89
+ sage: P = Poset((srange(3), lambda left, right: left <= right))
90
+ sage: C = cartesian_product((P, P), order='notexisting')
91
+ Traceback (most recent call last):
92
+ ...
93
+ ValueError: no order 'notexisting' known
94
+ sage: C = cartesian_product((P, P), category=(Groups(),))
95
+ sage: C.category()
96
+ Join of Category of groups and Category of posets
97
+ """
98
+ if order is None:
99
+ self._le_ = self.le_product
100
+ elif isinstance(order, str):
101
+ try:
102
+ self._le_ = getattr(self, 'le_' + order)
103
+ except AttributeError:
104
+ raise ValueError(f"no order '{order}' known")
105
+ else:
106
+ self._le_ = order
107
+
108
+ from sage.categories.category import Category
109
+ from sage.categories.posets import Posets
110
+ if not isinstance(category, tuple):
111
+ category = (category,)
112
+ category = Category.join(category + (Posets(),))
113
+ super().__init__(sets, category, **kwargs)
114
+
115
+ def le(self, left, right):
116
+ r"""
117
+ Test whether ``left`` is less than or equal to ``right``.
118
+
119
+ INPUT:
120
+
121
+ - ``left`` -- an element
122
+
123
+ - ``right`` -- an element
124
+
125
+ OUTPUT: boolean
126
+
127
+ .. NOTE::
128
+
129
+ This method uses the order defined on creation of this
130
+ Cartesian product. See :class:`CartesianProductPoset`.
131
+
132
+ EXAMPLES::
133
+
134
+ sage: P = posets.ChainPoset(10)
135
+ sage: def le_sum(left, right):
136
+ ....: return (sum(left) < sum(right) or
137
+ ....: sum(left) == sum(right) and left[0] <= right[0])
138
+ sage: C = cartesian_product((P, P), order=le_sum)
139
+ sage: C.le(C((1, 6)), C((6, 1)))
140
+ True
141
+ sage: C.le(C((6, 1)), C((1, 6)))
142
+ False
143
+ sage: C.le(C((1, 6)), C((6, 6)))
144
+ True
145
+ sage: C.le(C((6, 6)), C((1, 6)))
146
+ False
147
+ """
148
+ return self._le_(left, right)
149
+
150
+ def le_lex(self, left, right):
151
+ r"""
152
+ Test whether ``left`` is lexicographically smaller or equal
153
+ to ``right``.
154
+
155
+ INPUT:
156
+
157
+ - ``left`` -- an element
158
+
159
+ - ``right`` -- an element
160
+
161
+ OUTPUT: boolean
162
+
163
+ EXAMPLES::
164
+
165
+ sage: P = Poset((srange(2), lambda left, right: left <= right))
166
+ sage: Q = cartesian_product((P, P), order='lex')
167
+ sage: T = [Q((0, 0)), Q((1, 1)), Q((0, 1)), Q((1, 0))]
168
+ sage: for a in T:
169
+ ....: for b in T:
170
+ ....: assert Q.le(a, b) == (a <= b)
171
+ ....: print('%s <= %s = %s' % (a, b, a <= b))
172
+ (0, 0) <= (0, 0) = True
173
+ (0, 0) <= (1, 1) = True
174
+ (0, 0) <= (0, 1) = True
175
+ (0, 0) <= (1, 0) = True
176
+ (1, 1) <= (0, 0) = False
177
+ (1, 1) <= (1, 1) = True
178
+ (1, 1) <= (0, 1) = False
179
+ (1, 1) <= (1, 0) = False
180
+ (0, 1) <= (0, 0) = False
181
+ (0, 1) <= (1, 1) = True
182
+ (0, 1) <= (0, 1) = True
183
+ (0, 1) <= (1, 0) = True
184
+ (1, 0) <= (0, 0) = False
185
+ (1, 0) <= (1, 1) = True
186
+ (1, 0) <= (0, 1) = False
187
+ (1, 0) <= (1, 0) = True
188
+
189
+ TESTS:
190
+
191
+ Check that :issue:`19999` is resolved::
192
+
193
+ sage: P = Poset((srange(2), lambda left, right: left <= right))
194
+ sage: Q = cartesian_product((P, P), order='product')
195
+ sage: R = cartesian_product((Q, P), order='lex')
196
+ sage: R(((1, 0), 0)) <= R(((0, 1), 0))
197
+ False
198
+ sage: R(((0, 1), 0)) <= R(((1, 0), 0))
199
+ False
200
+ """
201
+ for l, r, S in \
202
+ zip(left.value, right.value, self.cartesian_factors()):
203
+ if l == r:
204
+ continue
205
+ if S.le(l, r):
206
+ return True
207
+ if S.le(r, l):
208
+ return False
209
+ return False # incomparable components
210
+ return True # equal
211
+
212
+ def le_product(self, left, right):
213
+ r"""
214
+ Test whether ``left`` is component-wise smaller or equal
215
+ to ``right``.
216
+
217
+ INPUT:
218
+
219
+ - ``left`` -- an element
220
+
221
+ - ``right`` -- an element
222
+
223
+ OUTPUT: boolean
224
+
225
+ The comparison is ``True`` if the result of the
226
+ comparison in each component is ``True``.
227
+
228
+ EXAMPLES::
229
+
230
+ sage: P = Poset((srange(2), lambda left, right: left <= right))
231
+ sage: Q = cartesian_product((P, P), order='product')
232
+ sage: T = [Q((0, 0)), Q((1, 1)), Q((0, 1)), Q((1, 0))]
233
+ sage: for a in T:
234
+ ....: for b in T:
235
+ ....: assert Q.le(a, b) == (a <= b)
236
+ ....: print('%s <= %s = %s' % (a, b, a <= b))
237
+ (0, 0) <= (0, 0) = True
238
+ (0, 0) <= (1, 1) = True
239
+ (0, 0) <= (0, 1) = True
240
+ (0, 0) <= (1, 0) = True
241
+ (1, 1) <= (0, 0) = False
242
+ (1, 1) <= (1, 1) = True
243
+ (1, 1) <= (0, 1) = False
244
+ (1, 1) <= (1, 0) = False
245
+ (0, 1) <= (0, 0) = False
246
+ (0, 1) <= (1, 1) = True
247
+ (0, 1) <= (0, 1) = True
248
+ (0, 1) <= (1, 0) = False
249
+ (1, 0) <= (0, 0) = False
250
+ (1, 0) <= (1, 1) = True
251
+ (1, 0) <= (0, 1) = False
252
+ (1, 0) <= (1, 0) = True
253
+ """
254
+ return all(
255
+ S.le(l, r)
256
+ for l, r, S in
257
+ zip(left.value, right.value, self.cartesian_factors()))
258
+
259
+ def le_native(self, left, right):
260
+ r"""
261
+ Test whether ``left`` is smaller or equal to ``right`` in the order
262
+ provided by the elements themselves.
263
+
264
+ INPUT:
265
+
266
+ - ``left`` -- an element
267
+
268
+ - ``right`` -- an element
269
+
270
+ OUTPUT: boolean
271
+
272
+ EXAMPLES::
273
+
274
+ sage: P = Poset((srange(2), lambda left, right: left <= right))
275
+ sage: Q = cartesian_product((P, P), order='native')
276
+ sage: T = [Q((0, 0)), Q((1, 1)), Q((0, 1)), Q((1, 0))]
277
+ sage: for a in T:
278
+ ....: for b in T:
279
+ ....: assert Q.le(a, b) == (a <= b)
280
+ ....: print('%s <= %s = %s' % (a, b, a <= b))
281
+ (0, 0) <= (0, 0) = True
282
+ (0, 0) <= (1, 1) = True
283
+ (0, 0) <= (0, 1) = True
284
+ (0, 0) <= (1, 0) = True
285
+ (1, 1) <= (0, 0) = False
286
+ (1, 1) <= (1, 1) = True
287
+ (1, 1) <= (0, 1) = False
288
+ (1, 1) <= (1, 0) = False
289
+ (0, 1) <= (0, 0) = False
290
+ (0, 1) <= (1, 1) = True
291
+ (0, 1) <= (0, 1) = True
292
+ (0, 1) <= (1, 0) = True
293
+ (1, 0) <= (0, 0) = False
294
+ (1, 0) <= (1, 1) = True
295
+ (1, 0) <= (0, 1) = False
296
+ (1, 0) <= (1, 0) = True
297
+ """
298
+ return left.value <= right.value
299
+
300
+ class Element(CartesianProduct.Element):
301
+
302
+ def _le_(self, other):
303
+ r"""
304
+ Return if this element is less or equal to ``other``.
305
+
306
+ INPUT:
307
+
308
+ - ``other`` -- an element
309
+
310
+ OUTPUT: boolean
311
+
312
+ .. NOTE::
313
+
314
+ This method calls :meth:`CartesianProductPoset.le`. Override
315
+ it in inherited class to change this.
316
+
317
+ It can be assumed that this element and ``other`` have
318
+ the same parent.
319
+
320
+ TESTS::
321
+
322
+ sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
323
+ sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
324
+ sage: def le_sum(left, right):
325
+ ....: return (sum(left) < sum(right) or
326
+ ....: sum(left) == sum(right) and left[0] <= right[0])
327
+ sage: C = cartesian_product((QQ, QQ), order=le_sum)
328
+ sage: C((1/3, 2)) <= C((2, 1/3)) # indirect doctest
329
+ True
330
+ sage: C((1/3, 2)) <= C((2, 2)) # indirect doctest
331
+ True
332
+ """
333
+ return self.parent().le(self, other)
334
+
335
+ def __le__(self, other):
336
+ r"""
337
+ Return if this element is less than or equal to ``other``.
338
+
339
+ INPUT:
340
+
341
+ - ``other`` -- an element
342
+
343
+ OUTPUT: boolean
344
+
345
+ .. NOTE::
346
+
347
+ This method uses the coercion framework to find a
348
+ suitable common parent.
349
+
350
+ This method can be deleted once :issue:`10130` is fixed and
351
+ provides these methods automatically.
352
+
353
+ TESTS::
354
+
355
+ sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
356
+ sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
357
+ sage: def le_sum(left, right):
358
+ ....: return (sum(left) < sum(right) or
359
+ ....: sum(left) == sum(right) and left[0] <= right[0])
360
+ sage: C = cartesian_product((QQ, QQ), order=le_sum)
361
+ sage: C((1/3, 2)) <= C((2, 1/3))
362
+ True
363
+ sage: C((1/3, 2)) <= C((2, 2))
364
+ True
365
+
366
+ The following example tests that the coercion gets involved in
367
+ comparisons; it can be simplified once :issue:`18182` is merged.
368
+ ::
369
+
370
+ sage: class MyCP(CartesianProductPoset):
371
+ ....: def _coerce_map_from_(self, S):
372
+ ....: if isinstance(S, self.__class__):
373
+ ....: S_factors = S.cartesian_factors()
374
+ ....: R_factors = self.cartesian_factors()
375
+ ....: if len(S_factors) == len(R_factors):
376
+ ....: if all(r.has_coerce_map_from(s)
377
+ ....: for r,s in zip(R_factors, S_factors)):
378
+ ....: return True
379
+ sage: QQ.CartesianProduct = MyCP
380
+ sage: A = cartesian_product((QQ, ZZ), order=le_sum)
381
+ sage: B = cartesian_product((QQ, QQ), order=le_sum)
382
+ sage: A((1/2, 4)) <= B((1/2, 5))
383
+ True
384
+ """
385
+ from sage.structure.element import have_same_parent
386
+ if have_same_parent(self, other):
387
+ return self._le_(other)
388
+
389
+ from sage.structure.element import get_coercion_model
390
+ import operator
391
+ try:
392
+ return get_coercion_model().bin_op(self, other, operator.le)
393
+ except TypeError:
394
+ return False
395
+
396
+ def __ge__(self, other):
397
+ r"""
398
+ Return if this element is greater than or equal to ``other``.
399
+
400
+ INPUT:
401
+
402
+ - ``other`` -- an element
403
+
404
+ OUTPUT: boolean
405
+
406
+ .. NOTE::
407
+
408
+ This method uses the coercion framework to find a
409
+ suitable common parent.
410
+
411
+ This method can be deleted once :issue:`10130` is fixed and
412
+ provides these methods automatically.
413
+
414
+ TESTS::
415
+
416
+ sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
417
+ sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
418
+ sage: def le_sum(left, right):
419
+ ....: return (sum(left) < sum(right) or
420
+ ....: sum(left) == sum(right) and left[0] <= right[0])
421
+ sage: C = cartesian_product((QQ, QQ), order=le_sum)
422
+ sage: C((1/3, 2)) >= C((2, 1/3))
423
+ False
424
+ sage: C((1/3, 2)) >= C((2, 2))
425
+ False
426
+ """
427
+ return other <= self
428
+
429
+ def __lt__(self, other):
430
+ r"""
431
+ Return if this element is less than ``other``.
432
+
433
+ INPUT:
434
+
435
+ - ``other`` -- an element
436
+
437
+ OUTPUT: boolean
438
+
439
+ .. NOTE::
440
+
441
+ This method uses the coercion framework to find a
442
+ suitable common parent.
443
+
444
+ This method can be deleted once :issue:`10130` is fixed and
445
+ provides these methods automatically.
446
+
447
+ TESTS::
448
+
449
+ sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
450
+ sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
451
+ sage: def le_sum(left, right):
452
+ ....: return (sum(left) < sum(right) or
453
+ ....: sum(left) == sum(right) and left[0] <= right[0])
454
+ sage: C = cartesian_product((QQ, QQ), order=le_sum)
455
+ sage: C((1/3, 2)) < C((2, 1/3))
456
+ True
457
+ sage: C((1/3, 2)) < C((2, 2))
458
+ True
459
+ """
460
+ return not self == other and self <= other
461
+
462
+ def __gt__(self, other):
463
+ r"""
464
+ Return if this element is greater than ``other``.
465
+
466
+ INPUT:
467
+
468
+ - ``other`` -- an element
469
+
470
+ OUTPUT: boolean
471
+
472
+ .. NOTE::
473
+
474
+ This method uses the coercion framework to find a
475
+ suitable common parent.
476
+
477
+ This method can be deleted once :issue:`10130` is fixed and
478
+ provides these methods automatically.
479
+
480
+ TESTS::
481
+
482
+ sage: from sage.combinat.posets.cartesian_product import CartesianProductPoset
483
+ sage: QQ.CartesianProduct = CartesianProductPoset # needed until #19269 is fixed
484
+ sage: def le_sum(left, right):
485
+ ....: return (sum(left) < sum(right) or
486
+ ....: sum(left) == sum(right) and left[0] <= right[0])
487
+ sage: C = cartesian_product((QQ, QQ), order=le_sum)
488
+ sage: C((1/3, 2)) > C((2, 1/3))
489
+ False
490
+ sage: C((1/3, 2)) > C((2, 2))
491
+ False
492
+ """
493
+ return not self == other and other <= self