passagemath-gap-pkg-semigroups 10.6.29__cp312-abi3-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.

Potentially problematic release.


This version of passagemath-gap-pkg-semigroups might be problematic. Click here for more details.

Files changed (356) hide show
  1. gap/pkg/semigroups/CHANGELOG.md +1699 -0
  2. gap/pkg/semigroups/CONTRIBUTING.md +91 -0
  3. gap/pkg/semigroups/GNUmakefile +110 -0
  4. gap/pkg/semigroups/GNUmakefile.in +110 -0
  5. gap/pkg/semigroups/GPL +674 -0
  6. gap/pkg/semigroups/LICENSE +16 -0
  7. gap/pkg/semigroups/Makefile +26 -0
  8. gap/pkg/semigroups/Makefile.gappkg +225 -0
  9. gap/pkg/semigroups/PackageInfo.g +529 -0
  10. gap/pkg/semigroups/README.md +102 -0
  11. gap/pkg/semigroups/VERSIONS +112 -0
  12. gap/pkg/semigroups/aclocal.m4 +375 -0
  13. gap/pkg/semigroups/autogen.sh +25 -0
  14. gap/pkg/semigroups/bin/aarch64-unknown-linux-musl-default64-kv10/semigroups.so +0 -0
  15. gap/pkg/semigroups/config.guess +1807 -0
  16. gap/pkg/semigroups/config.log +1021 -0
  17. gap/pkg/semigroups/config.status +1131 -0
  18. gap/pkg/semigroups/config.sub +1960 -0
  19. gap/pkg/semigroups/configure +9742 -0
  20. gap/pkg/semigroups/configure.ac +71 -0
  21. gap/pkg/semigroups/data/doc/greens.pickle +1 -0
  22. gap/pkg/semigroups/data/gens/fullbool-8.pickle.gz +0 -0
  23. gap/pkg/semigroups/data/gens/fullbool.pickle.gz +0 -0
  24. gap/pkg/semigroups/data/gens/hall.pickle.gz +0 -0
  25. gap/pkg/semigroups/data/gens/reflex-6.pickle.gz +0 -0
  26. gap/pkg/semigroups/data/gens/reflex.pickle.gz +0 -0
  27. gap/pkg/semigroups/data/tst/bipart4 +10 -0
  28. gap/pkg/semigroups/data/tst/pperm10 +1 -0
  29. gap/pkg/semigroups/data/tst/tables.gz +0 -0
  30. gap/pkg/semigroups/data/tst/testdata +1 -0
  31. gap/pkg/semigroups/data/tst/testinstall.pickle +1 -0
  32. gap/pkg/semigroups/data/tst/trans3 +7 -0
  33. gap/pkg/semigroups/data/tst/trans3-old +7 -0
  34. gap/pkg/semigroups/environment.yml +7 -0
  35. gap/pkg/semigroups/gap/attributes/acting.gd +15 -0
  36. gap/pkg/semigroups/gap/attributes/acting.gi +297 -0
  37. gap/pkg/semigroups/gap/attributes/attr.gd +91 -0
  38. gap/pkg/semigroups/gap/attributes/attr.gi +1214 -0
  39. gap/pkg/semigroups/gap/attributes/dual.gd +25 -0
  40. gap/pkg/semigroups/gap/attributes/dual.gi +209 -0
  41. gap/pkg/semigroups/gap/attributes/factor.gd +17 -0
  42. gap/pkg/semigroups/gap/attributes/factor.gi +453 -0
  43. gap/pkg/semigroups/gap/attributes/homomorph.gd +84 -0
  44. gap/pkg/semigroups/gap/attributes/homomorph.gi +591 -0
  45. gap/pkg/semigroups/gap/attributes/inverse.gd +38 -0
  46. gap/pkg/semigroups/gap/attributes/inverse.gi +708 -0
  47. gap/pkg/semigroups/gap/attributes/isomorph.gd +16 -0
  48. gap/pkg/semigroups/gap/attributes/isomorph.gi +377 -0
  49. gap/pkg/semigroups/gap/attributes/isorms.gd +49 -0
  50. gap/pkg/semigroups/gap/attributes/isorms.gi +1383 -0
  51. gap/pkg/semigroups/gap/attributes/maximal.gd +16 -0
  52. gap/pkg/semigroups/gap/attributes/maximal.gi +1876 -0
  53. gap/pkg/semigroups/gap/attributes/properties.gd +109 -0
  54. gap/pkg/semigroups/gap/attributes/properties.gi +1658 -0
  55. gap/pkg/semigroups/gap/attributes/rms-translat.gd +39 -0
  56. gap/pkg/semigroups/gap/attributes/rms-translat.gi +1078 -0
  57. gap/pkg/semigroups/gap/attributes/semifp.gd +12 -0
  58. gap/pkg/semigroups/gap/attributes/semifp.gi +84 -0
  59. gap/pkg/semigroups/gap/attributes/translat.gd +474 -0
  60. gap/pkg/semigroups/gap/attributes/translat.gi +1779 -0
  61. gap/pkg/semigroups/gap/congruences/cong.gd +154 -0
  62. gap/pkg/semigroups/gap/congruences/cong.gi +351 -0
  63. gap/pkg/semigroups/gap/congruences/conginv.gd +38 -0
  64. gap/pkg/semigroups/gap/congruences/conginv.gi +589 -0
  65. gap/pkg/semigroups/gap/congruences/conglatt.gd +101 -0
  66. gap/pkg/semigroups/gap/congruences/conglatt.gi +886 -0
  67. gap/pkg/semigroups/gap/congruences/congpairs.gd +21 -0
  68. gap/pkg/semigroups/gap/congruences/congpairs.gi +272 -0
  69. gap/pkg/semigroups/gap/congruences/congpart.gd +90 -0
  70. gap/pkg/semigroups/gap/congruences/congpart.gi +449 -0
  71. gap/pkg/semigroups/gap/congruences/congrees.gd +20 -0
  72. gap/pkg/semigroups/gap/congruences/congrees.gi +313 -0
  73. gap/pkg/semigroups/gap/congruences/congrms.gd +54 -0
  74. gap/pkg/semigroups/gap/congruences/congrms.gi +1467 -0
  75. gap/pkg/semigroups/gap/congruences/congsemigraph.gd +28 -0
  76. gap/pkg/semigroups/gap/congruences/congsemigraph.gi +289 -0
  77. gap/pkg/semigroups/gap/congruences/congsimple.gd +27 -0
  78. gap/pkg/semigroups/gap/congruences/congsimple.gi +236 -0
  79. gap/pkg/semigroups/gap/congruences/conguniv.gd +20 -0
  80. gap/pkg/semigroups/gap/congruences/conguniv.gi +271 -0
  81. gap/pkg/semigroups/gap/congruences/congwordgraph.gd +21 -0
  82. gap/pkg/semigroups/gap/congruences/congwordgraph.gi +250 -0
  83. gap/pkg/semigroups/gap/elements/bipart.gd +71 -0
  84. gap/pkg/semigroups/gap/elements/bipart.gi +995 -0
  85. gap/pkg/semigroups/gap/elements/blocks.gd +31 -0
  86. gap/pkg/semigroups/gap/elements/blocks.gi +134 -0
  87. gap/pkg/semigroups/gap/elements/boolmat.gd +74 -0
  88. gap/pkg/semigroups/gap/elements/boolmat.gi +726 -0
  89. gap/pkg/semigroups/gap/elements/elements.gd +11 -0
  90. gap/pkg/semigroups/gap/elements/elements.gi +121 -0
  91. gap/pkg/semigroups/gap/elements/ffmat.gd +71 -0
  92. gap/pkg/semigroups/gap/elements/ffmat.gi +311 -0
  93. gap/pkg/semigroups/gap/elements/maxplusmat.gd +131 -0
  94. gap/pkg/semigroups/gap/elements/maxplusmat.gi +782 -0
  95. gap/pkg/semigroups/gap/elements/pbr.gd +51 -0
  96. gap/pkg/semigroups/gap/elements/pbr.gi +740 -0
  97. gap/pkg/semigroups/gap/elements/pperm.gd +11 -0
  98. gap/pkg/semigroups/gap/elements/pperm.gi +14 -0
  99. gap/pkg/semigroups/gap/elements/semiringmat.gd +136 -0
  100. gap/pkg/semigroups/gap/elements/semiringmat.gi +717 -0
  101. gap/pkg/semigroups/gap/elements/star.gd +21 -0
  102. gap/pkg/semigroups/gap/elements/star.gi +21 -0
  103. gap/pkg/semigroups/gap/elements/trans.gd +13 -0
  104. gap/pkg/semigroups/gap/elements/trans.gi +50 -0
  105. gap/pkg/semigroups/gap/fp/freeband.gd +22 -0
  106. gap/pkg/semigroups/gap/fp/freeband.gi +502 -0
  107. gap/pkg/semigroups/gap/fp/freeinverse.gd +30 -0
  108. gap/pkg/semigroups/gap/fp/freeinverse.gi +465 -0
  109. gap/pkg/semigroups/gap/fp/tietze.gd +89 -0
  110. gap/pkg/semigroups/gap/fp/tietze.gi +1578 -0
  111. gap/pkg/semigroups/gap/fp/word.gd +15 -0
  112. gap/pkg/semigroups/gap/fp/word.gi +67 -0
  113. gap/pkg/semigroups/gap/greens/acting-inverse.gi +774 -0
  114. gap/pkg/semigroups/gap/greens/acting-regular.gi +553 -0
  115. gap/pkg/semigroups/gap/greens/acting.gd +81 -0
  116. gap/pkg/semigroups/gap/greens/acting.gi +2433 -0
  117. gap/pkg/semigroups/gap/greens/froidure-pin.gd +25 -0
  118. gap/pkg/semigroups/gap/greens/froidure-pin.gi +741 -0
  119. gap/pkg/semigroups/gap/greens/generic.gd +117 -0
  120. gap/pkg/semigroups/gap/greens/generic.gi +630 -0
  121. gap/pkg/semigroups/gap/ideals/acting.gd +17 -0
  122. gap/pkg/semigroups/gap/ideals/acting.gi +1155 -0
  123. gap/pkg/semigroups/gap/ideals/froidure-pin.gd +11 -0
  124. gap/pkg/semigroups/gap/ideals/froidure-pin.gi +105 -0
  125. gap/pkg/semigroups/gap/ideals/ideals.gd +45 -0
  126. gap/pkg/semigroups/gap/ideals/ideals.gi +442 -0
  127. gap/pkg/semigroups/gap/ideals/lambda-rho.gd +16 -0
  128. gap/pkg/semigroups/gap/ideals/lambda-rho.gi +614 -0
  129. gap/pkg/semigroups/gap/libsemigroups/cong.gd +24 -0
  130. gap/pkg/semigroups/gap/libsemigroups/cong.gi +431 -0
  131. gap/pkg/semigroups/gap/libsemigroups/fpsemi.gd +16 -0
  132. gap/pkg/semigroups/gap/libsemigroups/fpsemi.gi +53 -0
  133. gap/pkg/semigroups/gap/libsemigroups/froidure-pin.gd +17 -0
  134. gap/pkg/semigroups/gap/libsemigroups/froidure-pin.gi +945 -0
  135. gap/pkg/semigroups/gap/libsemigroups/sims1.gd +38 -0
  136. gap/pkg/semigroups/gap/libsemigroups/sims1.gi +308 -0
  137. gap/pkg/semigroups/gap/main/acting.gd +36 -0
  138. gap/pkg/semigroups/gap/main/acting.gi +779 -0
  139. gap/pkg/semigroups/gap/main/froidure-pin.gd +72 -0
  140. gap/pkg/semigroups/gap/main/froidure-pin.gi +655 -0
  141. gap/pkg/semigroups/gap/main/graded.gd +26 -0
  142. gap/pkg/semigroups/gap/main/graded.gi +355 -0
  143. gap/pkg/semigroups/gap/main/lambda-rho.gd +29 -0
  144. gap/pkg/semigroups/gap/main/lambda-rho.gi +514 -0
  145. gap/pkg/semigroups/gap/main/orbits.gd +24 -0
  146. gap/pkg/semigroups/gap/main/orbits.gi +512 -0
  147. gap/pkg/semigroups/gap/main/semiact.gd +20 -0
  148. gap/pkg/semigroups/gap/main/semiact.gi +821 -0
  149. gap/pkg/semigroups/gap/main/setup.gd +61 -0
  150. gap/pkg/semigroups/gap/main/setup.gi +1094 -0
  151. gap/pkg/semigroups/gap/obsolete.gd +9 -0
  152. gap/pkg/semigroups/gap/obsolete.gi +14 -0
  153. gap/pkg/semigroups/gap/options.g +55 -0
  154. gap/pkg/semigroups/gap/semigroups/grpperm.gd +12 -0
  155. gap/pkg/semigroups/gap/semigroups/grpperm.gi +177 -0
  156. gap/pkg/semigroups/gap/semigroups/semibipart.gd +28 -0
  157. gap/pkg/semigroups/gap/semigroups/semibipart.gi +570 -0
  158. gap/pkg/semigroups/gap/semigroups/semiboolmat.gd +20 -0
  159. gap/pkg/semigroups/gap/semigroups/semiboolmat.gi +104 -0
  160. gap/pkg/semigroups/gap/semigroups/semicons.gd +52 -0
  161. gap/pkg/semigroups/gap/semigroups/semicons.gi +1194 -0
  162. gap/pkg/semigroups/gap/semigroups/semidp.gd +13 -0
  163. gap/pkg/semigroups/gap/semigroups/semidp.gi +509 -0
  164. gap/pkg/semigroups/gap/semigroups/semieunit.gd +126 -0
  165. gap/pkg/semigroups/gap/semigroups/semieunit.gi +889 -0
  166. gap/pkg/semigroups/gap/semigroups/semiex.gd +104 -0
  167. gap/pkg/semigroups/gap/semigroups/semiex.gi +1590 -0
  168. gap/pkg/semigroups/gap/semigroups/semiffmat.gd +37 -0
  169. gap/pkg/semigroups/gap/semigroups/semiffmat.gi +565 -0
  170. gap/pkg/semigroups/gap/semigroups/semifp.gd +28 -0
  171. gap/pkg/semigroups/gap/semigroups/semifp.gi +1364 -0
  172. gap/pkg/semigroups/gap/semigroups/semigraph.gd +40 -0
  173. gap/pkg/semigroups/gap/semigroups/semigraph.gi +292 -0
  174. gap/pkg/semigroups/gap/semigroups/semigrp.gd +165 -0
  175. gap/pkg/semigroups/gap/semigroups/semigrp.gi +1225 -0
  176. gap/pkg/semigroups/gap/semigroups/semimaxplus.gd +72 -0
  177. gap/pkg/semigroups/gap/semigroups/semimaxplus.gi +710 -0
  178. gap/pkg/semigroups/gap/semigroups/semintmat.gd +13 -0
  179. gap/pkg/semigroups/gap/semigroups/semintmat.gi +74 -0
  180. gap/pkg/semigroups/gap/semigroups/semipbr.gd +19 -0
  181. gap/pkg/semigroups/gap/semigroups/semipbr.gi +139 -0
  182. gap/pkg/semigroups/gap/semigroups/semipperm.gd +27 -0
  183. gap/pkg/semigroups/gap/semigroups/semipperm.gi +711 -0
  184. gap/pkg/semigroups/gap/semigroups/semiquo.gd +14 -0
  185. gap/pkg/semigroups/gap/semigroups/semiquo.gi +97 -0
  186. gap/pkg/semigroups/gap/semigroups/semiringmat.gd +16 -0
  187. gap/pkg/semigroups/gap/semigroups/semiringmat.gi +21 -0
  188. gap/pkg/semigroups/gap/semigroups/semirms.gd +19 -0
  189. gap/pkg/semigroups/gap/semigroups/semirms.gi +977 -0
  190. gap/pkg/semigroups/gap/semigroups/semitrans.gd +49 -0
  191. gap/pkg/semigroups/gap/semigroups/semitrans.gi +909 -0
  192. gap/pkg/semigroups/gap/tools/display.gd +24 -0
  193. gap/pkg/semigroups/gap/tools/display.gi +749 -0
  194. gap/pkg/semigroups/gap/tools/io.gd +17 -0
  195. gap/pkg/semigroups/gap/tools/io.gi +543 -0
  196. gap/pkg/semigroups/gap/tools/iterators.gd +16 -0
  197. gap/pkg/semigroups/gap/tools/iterators.gi +253 -0
  198. gap/pkg/semigroups/gap/tools/utils.gd +19 -0
  199. gap/pkg/semigroups/gap/tools/utils.gi +756 -0
  200. gap/pkg/semigroups/gapbind14/.ccls +18 -0
  201. gap/pkg/semigroups/gapbind14/.clang-format +104 -0
  202. gap/pkg/semigroups/gapbind14/CPPLINT.cfg +5 -0
  203. gap/pkg/semigroups/gapbind14/LICENSE +674 -0
  204. gap/pkg/semigroups/gapbind14/README.md +76 -0
  205. gap/pkg/semigroups/gapbind14/demo/.gitignore +4 -0
  206. gap/pkg/semigroups/gapbind14/demo/LICENSE +293 -0
  207. gap/pkg/semigroups/gapbind14/demo/Makefile.gappkg +220 -0
  208. gap/pkg/semigroups/gapbind14/demo/Makefile.in +19 -0
  209. gap/pkg/semigroups/gapbind14/demo/PackageInfo.g +87 -0
  210. gap/pkg/semigroups/gapbind14/demo/README.md +17 -0
  211. gap/pkg/semigroups/gapbind14/demo/configure +34 -0
  212. gap/pkg/semigroups/gapbind14/demo/gap/gapbind_demo.gd +19 -0
  213. gap/pkg/semigroups/gapbind14/demo/gap/gapbind_demo.gi +10 -0
  214. gap/pkg/semigroups/gapbind14/demo/init.g +16 -0
  215. gap/pkg/semigroups/gapbind14/demo/makedoc.g +10 -0
  216. gap/pkg/semigroups/gapbind14/demo/read.g +6 -0
  217. gap/pkg/semigroups/gapbind14/demo/src/gapbind_demo.cc +142 -0
  218. gap/pkg/semigroups/gapbind14/demo/tst/testall.g +12 -0
  219. gap/pkg/semigroups/gapbind14/include/gapbind14/cpp_fn.hpp +223 -0
  220. gap/pkg/semigroups/gapbind14/include/gapbind14/gap_include.hpp +26 -0
  221. gap/pkg/semigroups/gapbind14/include/gapbind14/gapbind14.hpp +445 -0
  222. gap/pkg/semigroups/gapbind14/include/gapbind14/tame_free_fn.hpp +420 -0
  223. gap/pkg/semigroups/gapbind14/include/gapbind14/tame_mem_fn.hpp +556 -0
  224. gap/pkg/semigroups/gapbind14/include/gapbind14/to_cpp.hpp +162 -0
  225. gap/pkg/semigroups/gapbind14/include/gapbind14/to_gap.hpp +158 -0
  226. gap/pkg/semigroups/gapbind14/src/.clang-format +108 -0
  227. gap/pkg/semigroups/gapbind14/src/gapbind14.cpp +334 -0
  228. gap/pkg/semigroups/init.g +150 -0
  229. gap/pkg/semigroups/m4/ax_append_flag.m4 +50 -0
  230. gap/pkg/semigroups/m4/ax_check_compile_flag.m4 +53 -0
  231. gap/pkg/semigroups/m4/ax_check_hpcombi.m4 +121 -0
  232. gap/pkg/semigroups/m4/ax_check_libsemigroup.m4 +68 -0
  233. gap/pkg/semigroups/m4/ax_compare_version.m4 +177 -0
  234. gap/pkg/semigroups/m4/ax_cxx_compile_stdcxx.m4 +1009 -0
  235. gap/pkg/semigroups/m4/ax_cxx_compile_stdcxx_14.m4 +34 -0
  236. gap/pkg/semigroups/m4/ax_prefix_config_h.m4 +203 -0
  237. gap/pkg/semigroups/m4/ax_pthread.m4 +522 -0
  238. gap/pkg/semigroups/m4/find_gap.m4 +94 -0
  239. gap/pkg/semigroups/makedoc.g +153 -0
  240. gap/pkg/semigroups/prerequisites.sh +62 -0
  241. gap/pkg/semigroups/read.g +105 -0
  242. gap/pkg/semigroups/release.toml +6 -0
  243. gap/pkg/semigroups/tst/extreme/README +2 -0
  244. gap/pkg/semigroups/tst/extreme/attrinv.tst +703 -0
  245. gap/pkg/semigroups/tst/extreme/bipart.tst +2803 -0
  246. gap/pkg/semigroups/tst/extreme/closure.tst +652 -0
  247. gap/pkg/semigroups/tst/extreme/cong.tst +286 -0
  248. gap/pkg/semigroups/tst/extreme/conginv.tst +43 -0
  249. gap/pkg/semigroups/tst/extreme/examples.tst +2449 -0
  250. gap/pkg/semigroups/tst/extreme/freeband.tst +37 -0
  251. gap/pkg/semigroups/tst/extreme/greens-acting-regular.tst +27 -0
  252. gap/pkg/semigroups/tst/extreme/greens-acting.tst +1999 -0
  253. gap/pkg/semigroups/tst/extreme/ideals.tst +858 -0
  254. gap/pkg/semigroups/tst/extreme/inverse.tst +1025 -0
  255. gap/pkg/semigroups/tst/extreme/maximal.tst +856 -0
  256. gap/pkg/semigroups/tst/extreme/misc.tst +4236 -0
  257. gap/pkg/semigroups/tst/extreme/monoid_pkg.tst +1488 -0
  258. gap/pkg/semigroups/tst/extreme/properties.tst +914 -0
  259. gap/pkg/semigroups/tst/extreme/semibipart.tst +2837 -0
  260. gap/pkg/semigroups/tst/extreme/semieunit.tst +49 -0
  261. gap/pkg/semigroups/tst/extreme/semiffmat.tst +353 -0
  262. gap/pkg/semigroups/tst/extreme/semigroups.tst +245 -0
  263. gap/pkg/semigroups/tst/extreme/semiiter.tst +58 -0
  264. gap/pkg/semigroups/tst/extreme/semirms.tst +1091 -0
  265. gap/pkg/semigroups/tst/extreme/transform.tst +305 -0
  266. gap/pkg/semigroups/tst/extreme/translat.tst +44 -0
  267. gap/pkg/semigroups/tst/standard/README +2 -0
  268. gap/pkg/semigroups/tst/standard/attributes/acting.tst +388 -0
  269. gap/pkg/semigroups/tst/standard/attributes/attr.tst +2404 -0
  270. gap/pkg/semigroups/tst/standard/attributes/dual.tst +308 -0
  271. gap/pkg/semigroups/tst/standard/attributes/factor.tst +629 -0
  272. gap/pkg/semigroups/tst/standard/attributes/homomorph.tst +1134 -0
  273. gap/pkg/semigroups/tst/standard/attributes/inverse.tst +1521 -0
  274. gap/pkg/semigroups/tst/standard/attributes/isomorph.tst +435 -0
  275. gap/pkg/semigroups/tst/standard/attributes/isorms.tst +1147 -0
  276. gap/pkg/semigroups/tst/standard/attributes/maximal.tst +853 -0
  277. gap/pkg/semigroups/tst/standard/attributes/properties.tst +2028 -0
  278. gap/pkg/semigroups/tst/standard/attributes/semifp.tst +53 -0
  279. gap/pkg/semigroups/tst/standard/attributes/translat.tst +796 -0
  280. gap/pkg/semigroups/tst/standard/congruences/cong.tst +1044 -0
  281. gap/pkg/semigroups/tst/standard/congruences/conginv.tst +292 -0
  282. gap/pkg/semigroups/tst/standard/congruences/conglatt.tst +421 -0
  283. gap/pkg/semigroups/tst/standard/congruences/congpairs.tst +1011 -0
  284. gap/pkg/semigroups/tst/standard/congruences/congrees.tst +288 -0
  285. gap/pkg/semigroups/tst/standard/congruences/congrms.tst +701 -0
  286. gap/pkg/semigroups/tst/standard/congruences/congsemigraph.tst +422 -0
  287. gap/pkg/semigroups/tst/standard/congruences/congsimple.tst +311 -0
  288. gap/pkg/semigroups/tst/standard/congruences/conguniv.tst +259 -0
  289. gap/pkg/semigroups/tst/standard/congruences/congwordgraph.tst +330 -0
  290. gap/pkg/semigroups/tst/standard/elements/bipart.tst +783 -0
  291. gap/pkg/semigroups/tst/standard/elements/blocks.tst +166 -0
  292. gap/pkg/semigroups/tst/standard/elements/boolmat.tst +608 -0
  293. gap/pkg/semigroups/tst/standard/elements/elements.tst +117 -0
  294. gap/pkg/semigroups/tst/standard/elements/ffmat.tst +349 -0
  295. gap/pkg/semigroups/tst/standard/elements/maxplusmat.tst +613 -0
  296. gap/pkg/semigroups/tst/standard/elements/pbr.tst +506 -0
  297. gap/pkg/semigroups/tst/standard/elements/pperm.tst +32 -0
  298. gap/pkg/semigroups/tst/standard/elements/semiringmat.tst +601 -0
  299. gap/pkg/semigroups/tst/standard/elements/trans.tst +58 -0
  300. gap/pkg/semigroups/tst/standard/fp/freeband.tst +311 -0
  301. gap/pkg/semigroups/tst/standard/fp/freeinverse.tst +147 -0
  302. gap/pkg/semigroups/tst/standard/fp/tietze.tst +780 -0
  303. gap/pkg/semigroups/tst/standard/fp/word.tst +106 -0
  304. gap/pkg/semigroups/tst/standard/greens/acting-inverse.tst +545 -0
  305. gap/pkg/semigroups/tst/standard/greens/acting-regular.tst +396 -0
  306. gap/pkg/semigroups/tst/standard/greens/acting.tst +2033 -0
  307. gap/pkg/semigroups/tst/standard/greens/froidure-pin.tst +1831 -0
  308. gap/pkg/semigroups/tst/standard/greens/generic.tst +1436 -0
  309. gap/pkg/semigroups/tst/standard/ideals/acting.tst +279 -0
  310. gap/pkg/semigroups/tst/standard/ideals/froidure-pin.tst +178 -0
  311. gap/pkg/semigroups/tst/standard/ideals/ideals.tst +380 -0
  312. gap/pkg/semigroups/tst/standard/libsemigroups/cong.tst +310 -0
  313. gap/pkg/semigroups/tst/standard/libsemigroups/froidure-pin.tst +778 -0
  314. gap/pkg/semigroups/tst/standard/libsemigroups/sims1.tst +379 -0
  315. gap/pkg/semigroups/tst/standard/main/acting.tst +411 -0
  316. gap/pkg/semigroups/tst/standard/main/froidure-pin.tst +392 -0
  317. gap/pkg/semigroups/tst/standard/main/semiact.tst +203 -0
  318. gap/pkg/semigroups/tst/standard/main/setup.tst +1144 -0
  319. gap/pkg/semigroups/tst/standard/obsolete.tst +19 -0
  320. gap/pkg/semigroups/tst/standard/options.tst +54 -0
  321. gap/pkg/semigroups/tst/standard/semigroups/grpperm.tst +581 -0
  322. gap/pkg/semigroups/tst/standard/semigroups/semibipart.tst +2635 -0
  323. gap/pkg/semigroups/tst/standard/semigroups/semiboolmat.tst +1871 -0
  324. gap/pkg/semigroups/tst/standard/semigroups/semicons.tst +1173 -0
  325. gap/pkg/semigroups/tst/standard/semigroups/semidp.tst +739 -0
  326. gap/pkg/semigroups/tst/standard/semigroups/semieunit.tst +339 -0
  327. gap/pkg/semigroups/tst/standard/semigroups/semiex.tst +2055 -0
  328. gap/pkg/semigroups/tst/standard/semigroups/semiffmat.tst +746 -0
  329. gap/pkg/semigroups/tst/standard/semigroups/semifp.tst +2702 -0
  330. gap/pkg/semigroups/tst/standard/semigroups/semigraph.tst +133 -0
  331. gap/pkg/semigroups/tst/standard/semigroups/semigrp.tst +1112 -0
  332. gap/pkg/semigroups/tst/standard/semigroups/semimaxplus.tst +654 -0
  333. gap/pkg/semigroups/tst/standard/semigroups/semipbr.tst +2142 -0
  334. gap/pkg/semigroups/tst/standard/semigroups/semipperm.tst +2169 -0
  335. gap/pkg/semigroups/tst/standard/semigroups/semiquo.tst +278 -0
  336. gap/pkg/semigroups/tst/standard/semigroups/semirms.tst +3010 -0
  337. gap/pkg/semigroups/tst/standard/semigroups/semitrans.tst +2758 -0
  338. gap/pkg/semigroups/tst/standard/tools/display.tst +1040 -0
  339. gap/pkg/semigroups/tst/standard/tools/io.tst +363 -0
  340. gap/pkg/semigroups/tst/testinstall.tst +1815 -0
  341. gap/pkg/semigroups/tst/teststandard.g +22 -0
  342. gap/pkg/semigroups/tst/workspaces/load-workspace.tst +142 -0
  343. gap/pkg/semigroups/tst/workspaces/load.g +11 -0
  344. gap/pkg/semigroups/tst/workspaces/save-workspace.tst +166 -0
  345. gap/pkg/semigroups/tst/workspaces/save.g +14 -0
  346. passagemath_gap_pkg_semigroups-10.6.29.dist-info/METADATA +93 -0
  347. passagemath_gap_pkg_semigroups-10.6.29.dist-info/METADATA.bak +94 -0
  348. passagemath_gap_pkg_semigroups-10.6.29.dist-info/RECORD +356 -0
  349. passagemath_gap_pkg_semigroups-10.6.29.dist-info/WHEEL +5 -0
  350. passagemath_gap_pkg_semigroups-10.6.29.dist-info/top_level.txt +1 -0
  351. passagemath_gap_pkg_semigroups.libs/libgcc_s-2d945d6c.so.1 +0 -0
  352. passagemath_gap_pkg_semigroups.libs/libsemigroups-81d76771.so.2.0.0 +0 -0
  353. passagemath_gap_pkg_semigroups.libs/libstdc++-85f2cd6d.so.6.0.33 +0 -0
  354. sage/all__sagemath_gap_pkg_semigroups.py +1 -0
  355. sage/libs/all__sagemath_gap_pkg_semigroups.py +1 -0
  356. sage/libs/gap_pkg_semigroups.abi3.so +0 -0
@@ -0,0 +1,1225 @@
1
+ #############################################################################
2
+ ##
3
+ ## semigroups/semigrp.gi
4
+ ## Copyright (C) 2013-2022 James D. Mitchell
5
+ ##
6
+ ## Licensing information can be found in the README file of this package.
7
+ ##
8
+ #############################################################################
9
+ ##
10
+
11
+ #############################################################################
12
+ ## This file contains methods for finite semigroups which do not depend on
13
+ ## whether they are acting or not, i.e. they should work for all semigroups.
14
+ ## It is organized as follows:
15
+ ##
16
+ ## 1. Helper functions
17
+ ##
18
+ ## 2. Generators
19
+ ##
20
+ ## 3. Semigroup/Monoid/InverseSemigroup/InverseMonoidByGenerators
21
+ ##
22
+ ## 4. RegularSemigroup
23
+ ##
24
+ ## 5. ClosureSemigroup/Monoid
25
+ ##
26
+ ## 6. ClosureInverseSemigroup/Monoid
27
+ ##
28
+ ## 7. Subsemigroups
29
+ ##
30
+ ## 8. Random semigroups and elements
31
+ ##
32
+ ## 9. Changing representation: AsSemigroup, AsMonoid
33
+ ##
34
+ ## 10. Operators
35
+ ##
36
+ #############################################################################
37
+
38
+ #############################################################################
39
+ ## 1. Helper functions
40
+ #############################################################################
41
+
42
+ # Returns an isomorphism from the semigroup <S> to a semigroup in <filter> by
43
+ # composing an isomorphism from <S> to a transformation semigroup <T> with an
44
+ # isomorphism from <T> to a semigroup in <filter>, i.e. <filter> might be
45
+ # IsMaxPlusMatrixSemigroup or similar.
46
+
47
+ SEMIGROUPS.DefaultIsomorphismSemigroup := function(filter, S)
48
+ local iso1, inv1, iso2, inv2;
49
+
50
+ iso1 := IsomorphismTransformationSemigroup(S);
51
+ inv1 := InverseGeneralMapping(iso1);
52
+ iso2 := IsomorphismSemigroup(filter, Range(iso1));
53
+ inv2 := InverseGeneralMapping(iso2);
54
+
55
+ return SemigroupIsomorphismByFunctionNC(S,
56
+ Range(iso2),
57
+ x -> (x ^ iso1) ^ iso2,
58
+ x -> (x ^ inv2) ^ inv1);
59
+ end;
60
+
61
+ # Returns an isomorphism from the monoid (or IsMonoidAsSemigroup) <S> to a
62
+ # monoid in <filter> by composing an isomorphism from <S> to a transformation
63
+ # monoid <T> with an isomorphism from <T> to a monoid in <filter>, i.e.
64
+ # <filter> might be IsMaxPlusMatrixMonoid or similar.
65
+
66
+ SEMIGROUPS.DefaultIsomorphismMonoid := function(filter, S)
67
+ local iso1, inv1, iso2, inv2;
68
+
69
+ iso1 := IsomorphismTransformationMonoid(S);
70
+ inv1 := InverseGeneralMapping(iso1);
71
+ iso2 := IsomorphismMonoid(filter, Range(iso1));
72
+ inv2 := InverseGeneralMapping(iso2);
73
+
74
+ return SemigroupIsomorphismByFunctionNC(S,
75
+ Range(iso2),
76
+ x -> (x ^ iso1) ^ iso2,
77
+ x -> (x ^ inv2) ^ inv1);
78
+ end;
79
+
80
+ #############################################################################
81
+ ## 2. Generators
82
+ #############################################################################
83
+
84
+ InstallMethod(IsGeneratorsOfInverseSemigroup,
85
+ "for a semigroup with generators",
86
+ [IsSemigroup and HasGeneratorsOfSemigroup],
87
+ function(S)
88
+ if IsInverseActingSemigroupRep(S) then
89
+ # There is currently no way to enter this!
90
+ return true;
91
+ fi;
92
+ return IsGeneratorsOfInverseSemigroup(GeneratorsOfSemigroup(S));
93
+ end);
94
+
95
+ # TODO(later) the next method should really be in the library
96
+ InstallMethod(IsGeneratorsOfInverseSemigroup, "for a list",
97
+ [IsList], ReturnFalse);
98
+
99
+ InstallMethod(Generators, "for a semigroup",
100
+ [IsSemigroup],
101
+ function(S)
102
+
103
+ if HasGeneratorsOfMagmaIdeal(S) then
104
+ return GeneratorsOfMagmaIdeal(S);
105
+ elif HasGeneratorsOfGroup(S) then
106
+ return GeneratorsOfGroup(S);
107
+ elif HasGeneratorsOfInverseMonoid(S) then
108
+ return GeneratorsOfInverseMonoid(S);
109
+ elif HasGeneratorsOfInverseSemigroup(S) then
110
+ return GeneratorsOfInverseSemigroup(S);
111
+ elif HasGeneratorsOfMonoid(S) then
112
+ return GeneratorsOfMonoid(S);
113
+ fi;
114
+
115
+ return GeneratorsOfSemigroup(S);
116
+ end);
117
+
118
+ #############################################################################
119
+ ## 3. Semigroup/Monoid/InverseSemigroup/InverseMonoidByGenerators
120
+ #############################################################################
121
+
122
+ InstallImmediateMethod(IsTrivial, IsMonoid and HasGeneratorsOfMonoid, 0,
123
+ function(S)
124
+ local gens;
125
+ gens := GeneratorsOfMonoid(S);
126
+ if CanEasilyCompareElements(gens) and Length(gens) = 1
127
+ and gens[1] = One(gens[1]) then
128
+ return true;
129
+ fi;
130
+ TryNextMethod();
131
+ end);
132
+
133
+ InstallImmediateMethod(IsTrivial, IsMonoid and HasGeneratorsOfSemigroup, 0,
134
+ function(S)
135
+ local gens;
136
+ gens := GeneratorsOfSemigroup(S);
137
+ if CanEasilyCompareElements(gens) and Length(gens) = 1
138
+ and gens[1] = One(gens[1]) then
139
+ return true;
140
+ fi;
141
+ TryNextMethod();
142
+ end);
143
+
144
+ InstallMethod(MagmaByGenerators,
145
+ "for a finite associative element collection",
146
+ [IsAssociativeElementCollection and IsFinite], SemigroupByGenerators);
147
+
148
+ InstallMethod(SemigroupByGenerators,
149
+ "for a finite list or collection",
150
+ [IsListOrCollection and IsFinite],
151
+ {coll} -> SemigroupByGenerators(coll, SEMIGROUPS.DefaultOptionsRec));
152
+
153
+ InstallMethod(SemigroupByGenerators,
154
+ "for a finite list or collection and record",
155
+ [IsListOrCollection and IsFinite, IsRecord],
156
+ function(gens, opts)
157
+ local filts, S;
158
+
159
+ opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec, opts);
160
+
161
+ if CanEasilyCompareElements(gens) then
162
+ # Check if the One of the generators is a generator
163
+ if (IsMultiplicativeElementWithOneCollection(gens)
164
+ or (IsFFECollCollColl(gens) and IsGeneratorsOfSemigroup(gens)))
165
+ and Position(gens, One(gens)) <> fail then
166
+ return MonoidByGenerators(gens, opts);
167
+ fi;
168
+
169
+ # Try to find a smaller generating set
170
+ if opts.small and Length(gens) > 1 then
171
+ opts := ShallowCopy(opts);
172
+ opts.small := false;
173
+ opts.regular := false;
174
+ return ClosureSemigroup(Semigroup(gens[1], opts), gens, opts);
175
+ fi;
176
+ fi;
177
+
178
+ filts := IsSemigroup and IsAttributeStoringRep;
179
+
180
+ if opts.regular then # This overrides everything!
181
+ filts := filts and IsRegularActingSemigroupRep;
182
+ elif opts.acting and IsGeneratorsOfActingSemigroup(gens) then
183
+ filts := filts and IsActingSemigroup;
184
+ fi;
185
+
186
+ if IsMatrixObj(Representative(gens)) then
187
+ if BaseDomain(Representative(gens)) = Integers then
188
+ filts := filts and IsIntegerMatrixSemigroup;
189
+ elif IsField(BaseDomain(Representative(gens)))
190
+ and IsFinite(BaseDomain(Representative(gens))) then
191
+ filts := filts and IsMatrixOverFiniteFieldSemigroup;
192
+ fi;
193
+ fi;
194
+
195
+ S := Objectify(NewType(FamilyObj(gens), filts), rec(opts := opts));
196
+ SetGeneratorsOfMagma(S, AsList(gens));
197
+
198
+ return S;
199
+ end);
200
+
201
+ InstallMethod(MonoidByGenerators,
202
+ "for a finite list or collection",
203
+ [IsListOrCollection and IsFinite],
204
+ {gens} -> MonoidByGenerators(gens, SEMIGROUPS.DefaultOptionsRec));
205
+
206
+ InstallMethod(MonoidByGenerators,
207
+ "for a finite list or collection and record",
208
+ [IsListOrCollection and IsFinite, IsRecord],
209
+ function(gens, opts)
210
+ local mgens, pos, filts, one, S;
211
+
212
+ opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec, opts);
213
+ mgens := ShallowCopy(gens);
214
+
215
+ if CanEasilyCompareElements(gens) then
216
+ # Try to find a smaller generating set
217
+ if opts.small and Length(gens) > 1 then
218
+ opts := ShallowCopy(opts);
219
+ opts.small := false;
220
+ opts.regular := false;
221
+ return ClosureMonoid(Monoid(One(gens), opts), gens, opts);
222
+ elif (IsMultiplicativeElementWithOneCollection(gens)
223
+ or IsFFECollCollColl(gens)) and Length(gens) > 1 then
224
+ pos := Position(gens, One(gens));
225
+ if pos <> fail and
226
+ (not IsPartialPermCollection(gens) or One(gens) =
227
+ One(gens{Concatenation([1 .. pos - 1],
228
+ [pos + 1 .. Length(gens)])})) then
229
+ Remove(mgens, pos);
230
+ fi;
231
+ fi;
232
+ fi;
233
+
234
+ filts := IsMonoid and IsAttributeStoringRep;
235
+
236
+ if opts.regular then # This overrides everything!
237
+ filts := filts and IsRegularActingSemigroupRep;
238
+ elif opts.acting and IsGeneratorsOfActingSemigroup(gens) then
239
+ filts := filts and IsActingSemigroup;
240
+ fi;
241
+ if IsMatrixObj(Representative(gens)) then
242
+ one := One(Representative(gens));
243
+ if BaseDomain(Representative(gens)) = Integers then
244
+ filts := filts and IsIntegerMatrixMonoid;
245
+ elif IsField(BaseDomain(Representative(gens)))
246
+ and IsFinite(BaseDomain(Representative(gens))) then
247
+ filts := filts and IsMatrixOverFiniteFieldMonoid;
248
+ fi;
249
+ else
250
+ one := One(gens);
251
+ fi;
252
+
253
+ S := Objectify(NewType(FamilyObj(gens), filts), rec(opts := opts));
254
+
255
+ if not CanEasilyCompareElements(gens) or not one in gens then
256
+ SetGeneratorsOfMagma(S, Concatenation([one], gens));
257
+ else
258
+ SetGeneratorsOfMagma(S, AsList(gens));
259
+ fi;
260
+ SetGeneratorsOfMagmaWithOne(S, AsList(mgens));
261
+
262
+ return S;
263
+ end);
264
+
265
+ InstallMethod(InverseSemigroupByGenerators,
266
+ "for a finite collection",
267
+ [IsCollection and IsFinite],
268
+ {gens} -> InverseSemigroupByGenerators(gens, SEMIGROUPS.DefaultOptionsRec));
269
+
270
+ InstallMethod(InverseSemigroupByGenerators,
271
+ "for a finite multiplicative element collection and record",
272
+ [IsMultiplicativeElementCollection and IsFinite, IsRecord],
273
+ function(gens, opts)
274
+ local filts, S;
275
+
276
+ if not IsGeneratorsOfInverseSemigroup(gens) then
277
+ ErrorNoReturn("the 1st argument (a finite mult. elt. coll.) must satisfy ",
278
+ "IsGeneratorsOfInverseSemigroup");
279
+ fi;
280
+
281
+ opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec, opts);
282
+
283
+ if CanEasilyCompareElements(gens) then
284
+ # Check if the One of the generators is a generator
285
+ if IsMultiplicativeElementWithOneCollection(gens)
286
+ and Position(gens, One(gens)) <> fail then
287
+ return InverseMonoidByGenerators(gens, opts);
288
+ elif opts.small and Length(gens) > 1 then
289
+ # Try to find a smaller generating set
290
+ opts := ShallowCopy(opts);
291
+ opts.small := false;
292
+ return ClosureInverseSemigroup(InverseSemigroup(gens[1], opts),
293
+ gens,
294
+ opts);
295
+ fi;
296
+ fi;
297
+
298
+ filts := IsMagma and IsInverseSemigroup and IsAttributeStoringRep;
299
+
300
+ if opts.acting and IsGeneratorsOfActingSemigroup(gens) then
301
+ filts := filts and IsInverseActingSemigroupRep;
302
+ fi;
303
+
304
+ S := Objectify(NewType(FamilyObj(gens), filts), rec(opts := opts));
305
+ SetGeneratorsOfInverseSemigroup(S, AsList(gens));
306
+
307
+ return S;
308
+ end);
309
+
310
+ InstallMethod(InverseMonoidByGenerators,
311
+ "for a finite collection",
312
+ [IsCollection and IsFinite],
313
+ {gens} -> InverseMonoidByGenerators(gens, SEMIGROUPS.DefaultOptionsRec));
314
+
315
+ InstallMethod(InverseMonoidByGenerators,
316
+ "for a finite multiplicative element collection and record",
317
+ [IsMultiplicativeElementCollection and IsMultiplicativeElementWithOneCollection
318
+ and IsFinite, IsRecord],
319
+ function(gens, opts)
320
+ local pos, filts, S;
321
+
322
+ if not IsGeneratorsOfInverseSemigroup(gens) then
323
+ ErrorNoReturn("the 1st argument (a finite mult. elt. coll.) must satisfy ",
324
+ "IsGeneratorsOfInverseSemigroup");
325
+ fi;
326
+
327
+ opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec, opts);
328
+
329
+ if CanEasilyCompareElements(gens) then
330
+ if (not IsPartialPermCollection(gens) or not opts.small)
331
+ and IsMultiplicativeElementWithOneCollection(gens)
332
+ and Length(gens) > 1 then
333
+ pos := Position(gens, One(gens));
334
+ if pos <> fail and
335
+ (not IsPartialPermCollection(gens) or One(gens) =
336
+ One(gens{Concatenation([1 .. pos - 1],
337
+ [pos + 1 .. Length(gens)])})) then
338
+ gens := ShallowCopy(gens);
339
+ Remove(gens, pos);
340
+ fi;
341
+ fi;
342
+ if opts.small and Length(gens) > 1 then
343
+ # Try to find a smaller generating set
344
+ opts := ShallowCopy(opts);
345
+ opts.small := false;
346
+ return ClosureInverseMonoid(InverseMonoid(One(gens), opts),
347
+ gens,
348
+ opts);
349
+ fi;
350
+ fi;
351
+
352
+ filts := IsMagmaWithOne and IsInverseMonoid and IsAttributeStoringRep;
353
+
354
+ if opts.acting and IsGeneratorsOfActingSemigroup(gens) then
355
+ filts := filts and IsInverseActingSemigroupRep;
356
+ fi;
357
+
358
+ S := Objectify(NewType(FamilyObj(gens), filts), rec(opts := opts));
359
+ SetOne(S, One(gens));
360
+
361
+ SetGeneratorsOfInverseMonoid(S, AsList(gens));
362
+ if not CanEasilyCompareElements(gens) or not One(gens) in gens then
363
+ SetGeneratorsOfInverseSemigroup(S, Concatenation(gens, [One(gens)]));
364
+ else
365
+ SetGeneratorsOfInverseSemigroup(S, AsList(gens));
366
+ fi;
367
+ return S;
368
+ end);
369
+
370
+ #############################################################################
371
+ ## 4. RegularSemigroup
372
+ #############################################################################
373
+
374
+ InstallGlobalFunction(RegularSemigroup,
375
+ function(arg...)
376
+ if not IsRecord(Last(arg)) then
377
+ Add(arg, rec(regular := true));
378
+ else
379
+ Last(arg).regular := true;
380
+ fi;
381
+ return CallFuncList(Semigroup, arg);
382
+ end);
383
+
384
+ #############################################################################
385
+ ## 5. ClosureSemigroup/Monoid
386
+ #############################################################################
387
+
388
+ InstallMethod(ClosureSemigroup,
389
+ "for a semigroup and finite list or collection",
390
+ [IsSemigroup, IsListOrCollection and IsFinite],
391
+ {S, coll} -> ClosureSemigroup(S, coll, SEMIGROUPS.OptionsRec(S)));
392
+
393
+ InstallMethod(ClosureMonoid,
394
+ "for a monoid and finite mult. element with one collection",
395
+ [IsMonoid, IsMultiplicativeElementWithOneCollection and IsFinite],
396
+ {S, coll} -> ClosureMonoid(S, coll, SEMIGROUPS.OptionsRec(S)));
397
+
398
+ InstallMethod(ClosureSemigroup, "for a semigroup and multiplicative element",
399
+ [IsSemigroup, IsMultiplicativeElement],
400
+ {S, x} -> ClosureSemigroup(S, [x], SEMIGROUPS.OptionsRec(S)));
401
+
402
+ InstallMethod(ClosureMonoid, "for a monoid and mult. element with one",
403
+ [IsMonoid, IsMultiplicativeElementWithOne],
404
+ {S, x} -> ClosureMonoid(S, [x], SEMIGROUPS.OptionsRec(S)));
405
+
406
+ InstallMethod(ClosureSemigroup,
407
+ "for a semigroup, multiplicative element, and record",
408
+ [IsSemigroup, IsMultiplicativeElement, IsRecord],
409
+ {S, x, opts} -> ClosureSemigroup(S, [x], opts));
410
+
411
+ InstallMethod(ClosureMonoid,
412
+ "for a monoid, mult. element with one, and record",
413
+ [IsMonoid, IsMultiplicativeElementWithOne, IsRecord],
414
+ {S, x, opts} -> ClosureMonoid(S, [x], opts));
415
+
416
+ InstallMethod(ClosureSemigroup,
417
+ "for a semigroup, finite list or collection, and record",
418
+ [IsSemigroup, IsListOrCollection and IsFinite, IsRecord],
419
+ function(S, coll, opts)
420
+
421
+ # coll is copied here to avoid doing it repeatedly in
422
+ # ClosureSemigroupOrMonoidNC
423
+
424
+ if IsEmpty(coll) then
425
+ return S;
426
+ elif IsSemigroup(coll) then
427
+ coll := GeneratorsOfSemigroup(coll);
428
+ elif not IsList(coll) then
429
+ coll := AsList(coll);
430
+ fi;
431
+
432
+ if not IsMutable(coll) then
433
+ coll := ShallowCopy(coll);
434
+ fi;
435
+
436
+ # This error has to come after coll is turned into a list, otherwise it may
437
+ # fail in Concatenation(GeneratorsOfSemigroup(S), coll).
438
+
439
+ if ElementsFamily(FamilyObj(S)) <> FamilyObj(Representative(coll))
440
+ or not IsGeneratorsOfSemigroup(Concatenation(GeneratorsOfSemigroup(S),
441
+ coll)) then
442
+ ErrorNoReturn("the 1st argument (a semigroup) and the 2nd argument ",
443
+ "(a list or coll.) cannot be used to ",
444
+ "generate a semigroup");
445
+ fi;
446
+
447
+ # opts is copied and processed here to avoid doing it repeatedly in
448
+ # ClosureSemigroupOrMonoidNC
449
+
450
+ opts := ShallowCopy(opts);
451
+ opts.small := false;
452
+ opts.regular := false;
453
+ opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec,
454
+ opts);
455
+
456
+ return ClosureSemigroupOrMonoidNC(Semigroup, S, coll, opts);
457
+ end);
458
+
459
+ InstallMethod(ClosureMonoid,
460
+ "for a monoid, finite multiplicative with one element collection, and record",
461
+ [IsMonoid, IsMultiplicativeElementWithOneCollection and IsFinite, IsRecord],
462
+ function(S, coll, opts)
463
+ # coll is copied here to avoid doing it repeatedly in
464
+ # ClosureSemigroupOrMonoidNC
465
+
466
+ if IsSemigroup(coll) then
467
+ coll := ShallowCopy(GeneratorsOfSemigroup(coll));
468
+ elif not IsList(coll) then
469
+ coll := AsList(coll);
470
+ fi;
471
+
472
+ if not IsMutable(coll) then
473
+ coll := ShallowCopy(coll);
474
+ fi;
475
+
476
+ # This error has to come after coll is turned into a list, otherwise it may
477
+ # fail in Concatenation(GeneratorsOfSemigroup(S), coll).
478
+
479
+ if ElementsFamily(FamilyObj(S)) <> FamilyObj(Representative(coll))
480
+ or not IsGeneratorsOfSemigroup(Concatenation(GeneratorsOfSemigroup(S),
481
+ coll)) then
482
+ ErrorNoReturn("the 1st argument (a monoid) and the 2nd argument ",
483
+ "(a mult. elt. with one coll.) cannot be ",
484
+ "used to generate a monoid");
485
+ fi;
486
+
487
+ # opts is copied and processed here to avoid doing it repeatedly in
488
+ # ClosureSemigroupOrMonoidNC
489
+
490
+ opts := ShallowCopy(opts);
491
+ opts.small := false;
492
+ opts.regular := false;
493
+ opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec,
494
+ opts);
495
+
496
+ return ClosureSemigroupOrMonoidNC(Monoid, S, coll, opts);
497
+ end);
498
+
499
+ InstallMethod(ClosureSemigroupOrMonoidNC,
500
+ "for a function, semigroup, finite list, and record",
501
+ [IsFunction, IsSemigroup, IsList and IsFinite, IsRecord],
502
+ function(Constructor, S, coll, opts)
503
+ local n, T, x;
504
+
505
+ # opts must be copied and processed before calling this function
506
+ # coll must be copied before calling this function
507
+
508
+ coll := Filtered(coll, x -> not x in S);
509
+ if IsEmpty(coll) then
510
+ return S;
511
+ fi;
512
+
513
+ coll := Shuffle(Set(coll));
514
+ if IsGeneratorsOfActingSemigroup(coll) then
515
+ n := ActionDegree(coll);
516
+ Sort(coll, {x, y} -> ActionRank(x, n) > ActionRank(y, n));
517
+ elif Length(coll) < 120 then
518
+ Sort(coll, IsGreensDGreaterThanFunc(Semigroup(coll)));
519
+ fi;
520
+
521
+ T := Constructor(S, opts);
522
+
523
+ for x in coll do
524
+ if not x in T then
525
+ T := Constructor(T, x, opts);
526
+ fi;
527
+ od;
528
+ return T;
529
+ end);
530
+
531
+ #############################################################################
532
+ ## 5. ClosureInverseSemigroup
533
+ #############################################################################
534
+
535
+ InstallMethod(ClosureInverseSemigroup,
536
+ "for an inverse semigroup with inverse op and finite mult. element coll",
537
+ [IsInverseSemigroup and IsGeneratorsOfInverseSemigroup,
538
+ IsMultiplicativeElementCollection and IsFinite],
539
+ {S, coll} -> ClosureInverseSemigroup(S, coll, SEMIGROUPS.OptionsRec(S)));
540
+
541
+ InstallMethod(ClosureInverseMonoid,
542
+ "for an inverse monoid with inverse op and finite mult. element with one coll",
543
+ [IsInverseMonoid and IsGeneratorsOfInverseSemigroup,
544
+ IsMultiplicativeElementWithOneCollection and IsFinite],
545
+ {S, coll} -> ClosureInverseMonoid(S, coll, SEMIGROUPS.OptionsRec(S)));
546
+
547
+ InstallMethod(ClosureInverseSemigroup,
548
+ "for an inverse semigroup with inverse op and a multiplicative element",
549
+ [IsInverseSemigroup and IsGeneratorsOfInverseSemigroup,
550
+ IsMultiplicativeElement],
551
+ {S, x} -> ClosureInverseSemigroup(S, [x], SEMIGROUPS.OptionsRec(S)));
552
+
553
+ InstallMethod(ClosureInverseMonoid,
554
+ "for an inverse monoid with inverse op and a mult. element with one",
555
+ [IsInverseMonoid and IsGeneratorsOfInverseSemigroup,
556
+ IsMultiplicativeElementWithOne],
557
+ {S, x} -> ClosureInverseMonoid(S, [x], SEMIGROUPS.OptionsRec(S)));
558
+
559
+ InstallMethod(ClosureInverseSemigroup,
560
+ "for inverse semigroup with inverse op, multiplicative element, record",
561
+ [IsInverseSemigroup and IsGeneratorsOfInverseSemigroup,
562
+ IsMultiplicativeElement,
563
+ IsRecord],
564
+ {S, x, opts} -> ClosureInverseSemigroup(S, [x], opts));
565
+
566
+ InstallMethod(ClosureInverseMonoid,
567
+ "for inverse monoid with inverse op, multiplicative element with one, record",
568
+ [IsInverseMonoid and IsGeneratorsOfInverseSemigroup,
569
+ IsMultiplicativeElementWithOne,
570
+ IsRecord],
571
+ {S, x, opts} -> ClosureInverseMonoid(S, [x], opts));
572
+
573
+ InstallMethod(ClosureInverseSemigroup,
574
+ "for an inverse semigroup with inverse op, finite mult elt coll, and record",
575
+ [IsInverseSemigroup and IsGeneratorsOfInverseSemigroup,
576
+ IsMultiplicativeElementCollection and IsFinite,
577
+ IsRecord],
578
+ function(S, coll, opts)
579
+
580
+ # coll is copied here to avoid doing it repeatedly in
581
+ # ClosureSemigroupOrMonoidNC
582
+
583
+ if not IsGeneratorsOfInverseSemigroup(coll) then
584
+ ErrorNoReturn("the 2nd argument (a finite mult. elt. coll.) must satisfy ",
585
+ "IsGeneratorsOfInverseSemigroup");
586
+ elif IsSemigroup(coll) then
587
+ coll := ShallowCopy(GeneratorsOfSemigroup(coll));
588
+ elif not IsList(coll) then
589
+ coll := AsList(coll);
590
+ else
591
+ coll := ShallowCopy(coll);
592
+ fi;
593
+
594
+ # This error has to come after coll is turned into a list, otherwise it may
595
+ # fail in Concatenation(GeneratorsOfSemigroup(S), coll).
596
+
597
+ if ElementsFamily(FamilyObj(S)) <> FamilyObj(Representative(coll))
598
+ or not IsGeneratorsOfSemigroup(Concatenation(GeneratorsOfSemigroup(S),
599
+ coll)) then
600
+ ErrorNoReturn("the 1st argument (a semigroup) and the 2nd argument ",
601
+ "(a mult. elt. coll.) cannot be used to ",
602
+ "generate an inverse semigroup");
603
+ fi;
604
+
605
+ # opts is copied and processed here to avoid doing it repeatedly in
606
+ # ClosureInverseSemigroupOrMonoidNC
607
+
608
+ opts := ShallowCopy(opts);
609
+ opts.small := false;
610
+ opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec,
611
+ opts);
612
+
613
+ return ClosureInverseSemigroupOrMonoidNC(InverseSemigroup, S, coll, opts);
614
+ end);
615
+
616
+ InstallMethod(ClosureInverseMonoid,
617
+ "for an inverse monoid, finite mult elt with one coll, and record",
618
+ [IsInverseMonoid and IsGeneratorsOfInverseSemigroup,
619
+ IsMultiplicativeElementCollection and IsFinite,
620
+ IsRecord],
621
+ function(S, coll, opts)
622
+
623
+ # coll is copied here to avoid doing it repeatedly in
624
+ # ClosureSemigroupOrMonoidNC
625
+
626
+ if not IsGeneratorsOfInverseSemigroup(coll) then
627
+ ErrorNoReturn("the 2nd argument (a finite mult. elt. coll.) must satisfy ",
628
+ "IsGeneratorsOfInverseSemigroup");
629
+ elif IsSemigroup(coll) then
630
+ coll := ShallowCopy(GeneratorsOfSemigroup(coll));
631
+ elif not IsList(coll) then
632
+ coll := AsList(coll);
633
+ else
634
+ coll := ShallowCopy(coll);
635
+ fi;
636
+
637
+ # This error has to come after coll is turned into a list, otherwise it may
638
+ # fail in Concatenation(GeneratorsOfSemigroup(S), coll).
639
+
640
+ if ElementsFamily(FamilyObj(S)) <> FamilyObj(Representative(coll))
641
+ or not IsGeneratorsOfSemigroup(Concatenation(GeneratorsOfSemigroup(S),
642
+ coll)) then
643
+ ErrorNoReturn("the 1st argument (a semigroup) and the 2nd argument ",
644
+ "(a mult. elt. coll.) cannot be used to ",
645
+ "generate an inverse monoid");
646
+ fi;
647
+
648
+ # opts is copied and processed here to avoid doing it repeatedly in
649
+ # ClosureInverseSemigroupOrMonoidNC
650
+
651
+ opts := ShallowCopy(opts);
652
+ opts.small := false;
653
+ opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec,
654
+ opts);
655
+
656
+ return ClosureInverseSemigroupOrMonoidNC(InverseMonoid, S, coll, opts);
657
+ end);
658
+
659
+ InstallMethod(ClosureInverseSemigroupOrMonoidNC,
660
+ "for a function, an inverse semigroup, finite list of mult. element, and rec",
661
+ [IsFunction,
662
+ IsInverseSemigroup and IsGeneratorsOfInverseSemigroup,
663
+ IsMultiplicativeElementCollection and IsFinite and IsList,
664
+ IsRecord],
665
+ function(Constructor, S, coll, opts)
666
+ local n, x, one, i;
667
+ coll := Filtered(coll, x -> not x in S);
668
+ if IsEmpty(coll) then
669
+ return S;
670
+ fi;
671
+
672
+ # opts must be copied and processed before calling this function
673
+ # coll must be copied before calling this function
674
+
675
+ # Make coll closed under inverses
676
+ coll := Set(coll);
677
+ n := Length(coll);
678
+ for i in [1 .. n] do
679
+ x := coll[i] ^ -1;
680
+ if not x in coll then
681
+ AddSet(coll, x);
682
+ fi;
683
+ od;
684
+
685
+ if Constructor = InverseMonoid
686
+ and IsMultiplicativeElementWithOneCollection(S)
687
+ and IsMultiplicativeElementWithOneCollection(coll) then
688
+ one := One(Concatenation(coll, GeneratorsOfSemigroup(S)));
689
+ if not one in coll and not one in S then
690
+ AddSet(coll, one);
691
+ fi;
692
+ fi;
693
+
694
+ # Shuffle and sort by rank or the D-order
695
+ coll := Shuffle(coll);
696
+ if IsGeneratorsOfActingSemigroup(coll) then
697
+ n := ActionDegree(coll);
698
+ Sort(coll, {x, y} -> ActionRank(x, n) > ActionRank(y, n));
699
+ elif Length(coll) < 120 then
700
+ Sort(coll, IsGreensDGreaterThanFunc(InverseSemigroup(coll)));
701
+ fi;
702
+
703
+ return ClosureSemigroupOrMonoidNC(Constructor, S, coll, opts);
704
+ end);
705
+
706
+ # Both of these methods are required for ClosureInverseSemigroup(NC) and an
707
+ # empty list because ClosureInverseSemigroup might be called with an empty
708
+ # list, it might be that all of the elements in the collection passed to
709
+ # ClosureInverseSemigroup already belong to the semigroup, in which case we
710
+ # call ClosureInverseSemigroupOrMonoidNC with an empty list.
711
+
712
+ InstallMethod(ClosureInverseSemigroup,
713
+ "for an inverse semigroup, empty list or collection, and record",
714
+ [IsInverseSemigroup and IsGeneratorsOfInverseSemigroup,
715
+ IsListOrCollection and IsEmpty,
716
+ IsRecord],
717
+ ReturnFirst);
718
+
719
+ InstallMethod(ClosureInverseMonoid,
720
+ "for an inverse monoid, empty list or collection, and record",
721
+ [IsInverseMonoid and IsGeneratorsOfInverseSemigroup,
722
+ IsListOrCollection and IsEmpty,
723
+ IsRecord],
724
+ ReturnFirst);
725
+
726
+ InstallMethod(ClosureInverseSemigroupOrMonoidNC,
727
+ "for a function, inverse semigroup, empty list, and record",
728
+ [IsFunction,
729
+ IsInverseSemigroup and IsGeneratorsOfInverseSemigroup,
730
+ IsList and IsEmpty,
731
+ IsRecord],
732
+ {Constructor, S, coll, opts} -> S);
733
+
734
+ #############################################################################
735
+ ## 7. Subsemigroups
736
+ #############################################################################
737
+
738
+ InstallMethod(SubsemigroupByProperty,
739
+ "for a semigroup, function, and positive integer",
740
+ [IsSemigroup, IsFunction, IsPosInt],
741
+ function(S, func, limit)
742
+ local iter, x, closure, T;
743
+
744
+ iter := Iterator(S);
745
+
746
+ repeat
747
+ x := NextIterator(iter);
748
+ until func(x) or IsDoneIterator(iter);
749
+
750
+ if not func(x) then
751
+ return fail; # should really return the empty semigroup
752
+ elif CanUseLibsemigroupsFroidurePin(S) then
753
+ closure := {S, coll, opts} ->
754
+ ClosureSemigroupOrMonoidNC(Semigroup, S, coll, opts);
755
+ else
756
+ closure := ClosureSemigroup;
757
+ fi;
758
+ T := Semigroup(x);
759
+
760
+ while Size(T) < limit and not IsDoneIterator(iter) do
761
+ x := NextIterator(iter);
762
+ if func(x) and not x in T then
763
+ T := closure(T, [x], SEMIGROUPS.OptionsRec(T));
764
+ fi;
765
+ od;
766
+ SetParent(T, S);
767
+ return T;
768
+ end);
769
+
770
+ InstallMethod(InverseSubsemigroupByProperty,
771
+ "for an inverse semigroup with inverse op, function, positive integer",
772
+ [IsInverseSemigroup and IsGeneratorsOfInverseSemigroup, IsFunction, IsPosInt],
773
+ function(S, func, limit)
774
+ local iter, T, x;
775
+
776
+ iter := Iterator(S);
777
+
778
+ repeat
779
+ x := NextIterator(iter);
780
+ until func(x) or IsDoneIterator(iter);
781
+
782
+ if not func(x) then
783
+ return fail; # should really return the empty semigroup
784
+ fi;
785
+
786
+ T := InverseSemigroup(x);
787
+
788
+ while Size(T) < limit and not IsDoneIterator(iter) do
789
+ x := NextIterator(iter);
790
+ if func(x) then
791
+ T := ClosureInverseSemigroup(T, x);
792
+ fi;
793
+ od;
794
+ SetParent(T, S);
795
+ return T;
796
+ end);
797
+
798
+ InstallMethod(SubsemigroupByProperty, "for a semigroup and function",
799
+ [IsSemigroup, IsFunction],
800
+ {S, func} -> SubsemigroupByProperty(S, func, Size(S)));
801
+
802
+ InstallMethod(InverseSubsemigroupByProperty,
803
+ "for inverse semigroup with inverse op and function",
804
+ [IsInverseSemigroup and IsGeneratorsOfInverseSemigroup, IsFunction],
805
+ {S, func} -> InverseSubsemigroupByProperty(S, func, Size(S)));
806
+
807
+ #############################################################################
808
+ ## 8. Random semigroups and elements
809
+ #############################################################################
810
+
811
+ InstallMethod(Random,
812
+ "for a semigroup with AsList",
813
+ [IsSemigroup and HasAsList],
814
+ 20, # to beat other random methods
815
+ {S} -> AsList(S)[Random(1, Size(S))]);
816
+
817
+ InstallMethod(SEMIGROUPS_ProcessRandomArgsCons,
818
+ [IsSemigroup, IsList],
819
+ function(_, params)
820
+ if Length(params) < 1 then # nr gens
821
+ params[1] := Random(1, 20);
822
+ elif not IsPosInt(params[1]) then
823
+ return "the 2nd argument (number of generators) must be a pos int";
824
+ fi;
825
+ if Length(params) < 2 then # degree / dimension
826
+ params[2] := Random(1, 20);
827
+ elif not IsPosInt(params[2]) then
828
+ return "the 3rd argument (degree or dimension) must be a pos int";
829
+ fi;
830
+ if Length(params) > 2 then
831
+ return "there must be at most 3 arguments";
832
+ fi;
833
+ return params;
834
+ end);
835
+
836
+ InstallMethod(SEMIGROUPS_ProcessRandomArgsCons,
837
+ [IsMonoid, IsList],
838
+ {filt, params} -> SEMIGROUPS_ProcessRandomArgsCons(IsSemigroup, params));
839
+
840
+ SEMIGROUPS.DefaultRandomInverseSemigroup := function(filt, params)
841
+ if Length(params) = 2 then
842
+ return AsSemigroup(filt,
843
+ RandomInverseSemigroup(IsPartialPermSemigroup,
844
+ params[1],
845
+ params[2]));
846
+ elif Length(params) = 3 then
847
+ return AsSemigroup(filt,
848
+ params[3], # threshold
849
+ RandomInverseSemigroup(IsPartialPermSemigroup,
850
+ params[1],
851
+ params[2]));
852
+ elif Length(params) = 4 then
853
+ return AsSemigroup(filt,
854
+ params[3], # threshold
855
+ params[4], # period
856
+ RandomInverseSemigroup(IsPartialPermSemigroup,
857
+ params[1],
858
+ params[2]));
859
+ fi;
860
+ ErrorNoReturn("the 2nd argument must have length 2, 3, or 4");
861
+ end;
862
+
863
+ SEMIGROUPS.DefaultRandomInverseMonoid := function(filt, params)
864
+ if Length(params) = 2 then
865
+ return AsMonoid(filt,
866
+ RandomInverseMonoid(IsPartialPermMonoid,
867
+ params[1],
868
+ params[2]));
869
+ elif Length(params) = 3 then
870
+ return AsMonoid(filt,
871
+ params[3], # threshold
872
+ RandomInverseMonoid(IsPartialPermMonoid,
873
+ params[1],
874
+ params[2]));
875
+ elif Length(params) = 4 then
876
+ return AsMonoid(filt,
877
+ params[3], # threshold
878
+ params[4], # period
879
+ RandomInverseMonoid(IsPartialPermMonoid,
880
+ params[1],
881
+ params[2]));
882
+ fi;
883
+ ErrorNoReturn("the 2nd argument must have length 2, 3, or 4");
884
+ end;
885
+
886
+ InstallGlobalFunction(RandomSemigroup,
887
+ function(arg...)
888
+ local filt, params;
889
+
890
+ # check for optional first arg
891
+ if Length(arg) >= 1 and IsPosInt(arg[1]) then
892
+ CopyListEntries(arg, 1, 1, arg, 2, 1, Length(arg));
893
+ Unbind(arg[1]);
894
+ fi;
895
+
896
+ if Length(arg) >= 1 and IsBound(arg[1]) then
897
+ filt := arg[1];
898
+ if not IsFilter(filt) then
899
+ ErrorNoReturn("the 1st argument must be a filter");
900
+ fi;
901
+ else
902
+ filt := Random([IsReesMatrixSemigroup,
903
+ IsReesZeroMatrixSemigroup,
904
+ IsFpSemigroup,
905
+ IsPBRSemigroup,
906
+ IsBipartitionSemigroup,
907
+ IsBlockBijectionSemigroup,
908
+ IsTransformationSemigroup,
909
+ IsPartialPermSemigroup,
910
+ IsBooleanMatSemigroup,
911
+ IsMaxPlusMatrixSemigroup,
912
+ IsMinPlusMatrixSemigroup,
913
+ IsTropicalMaxPlusMatrixSemigroup,
914
+ IsTropicalMinPlusMatrixSemigroup,
915
+ IsProjectiveMaxPlusMatrixSemigroup,
916
+ IsNTPMatrixSemigroup,
917
+ IsIntegerMatrixSemigroup,
918
+ IsMatrixOverFiniteFieldSemigroup]);
919
+ fi;
920
+
921
+ params := SEMIGROUPS_ProcessRandomArgsCons(filt, arg{[2 .. Length(arg)]});
922
+ if IsString(params) then
923
+ ErrorNoReturn(params);
924
+ fi;
925
+ return RandomSemigroupCons(filt, params);
926
+ end);
927
+
928
+ InstallGlobalFunction(RandomMonoid,
929
+ function(arg...)
930
+ local filt, params;
931
+
932
+ # check for optional first arg
933
+ if Length(arg) >= 1 and IsPosInt(arg[1]) then
934
+ CopyListEntries(arg, 1, 1, arg, 2, 1, Length(arg));
935
+ Unbind(arg[1]);
936
+ fi;
937
+
938
+ if Length(arg) >= 1 and IsBound(arg[1]) then
939
+ filt := arg[1];
940
+ if not IsFilter(filt) then
941
+ ErrorNoReturn("the 1st argument must be a filter");
942
+ fi;
943
+ else
944
+ filt := Random([IsFpMonoid,
945
+ IsPBRMonoid,
946
+ IsBipartitionMonoid,
947
+ IsTransformationMonoid,
948
+ IsPartialPermMonoid,
949
+ IsBooleanMatMonoid,
950
+ IsMaxPlusMatrixMonoid,
951
+ IsMinPlusMatrixMonoid,
952
+ IsTropicalMaxPlusMatrixMonoid,
953
+ IsTropicalMinPlusMatrixMonoid,
954
+ IsProjectiveMaxPlusMatrixMonoid,
955
+ IsNTPMatrixMonoid,
956
+ IsBlockBijectionMonoid,
957
+ IsIntegerMatrixMonoid,
958
+ IsMatrixOverFiniteFieldMonoid]);
959
+ fi;
960
+
961
+ params := SEMIGROUPS_ProcessRandomArgsCons(filt, arg{[2 .. Length(arg)]});
962
+ if IsString(params) then
963
+ ErrorNoReturn(params);
964
+ fi;
965
+ return RandomMonoidCons(filt, params);
966
+ end);
967
+
968
+ InstallGlobalFunction(RandomInverseSemigroup,
969
+ function(arg...)
970
+ local filt, params;
971
+
972
+ # check for optional first arg
973
+ if Length(arg) >= 1 and IsPosInt(arg[1]) then
974
+ CopyListEntries(arg, 1, 1, arg, 2, 1, Length(arg));
975
+ Unbind(arg[1]);
976
+ fi;
977
+
978
+ if Length(arg) >= 1 and IsBound(arg[1]) then
979
+ filt := arg[1];
980
+ if not IsFilter(filt) then
981
+ ErrorNoReturn("the 1st argument must be a filter");
982
+ fi;
983
+ else
984
+ filt := Random([IsFpSemigroup,
985
+ IsPBRSemigroup,
986
+ IsBipartitionSemigroup,
987
+ IsTransformationSemigroup,
988
+ IsPartialPermSemigroup,
989
+ IsBooleanMatSemigroup,
990
+ IsMaxPlusMatrixSemigroup,
991
+ IsMinPlusMatrixSemigroup,
992
+ IsTropicalMaxPlusMatrixSemigroup,
993
+ IsTropicalMinPlusMatrixSemigroup,
994
+ IsProjectiveMaxPlusMatrixSemigroup,
995
+ IsNTPMatrixSemigroup,
996
+ IsBlockBijectionSemigroup,
997
+ IsIntegerMatrixSemigroup,
998
+ IsMatrixOverFiniteFieldSemigroup]);
999
+ fi;
1000
+
1001
+ params := SEMIGROUPS_ProcessRandomArgsCons(filt, arg{[2 .. Length(arg)]});
1002
+ if IsString(params) then
1003
+ ErrorNoReturn(params);
1004
+ fi;
1005
+ return RandomInverseSemigroupCons(filt, params);
1006
+ end);
1007
+
1008
+ InstallGlobalFunction(RandomInverseMonoid,
1009
+ function(arg...)
1010
+ local filt, params;
1011
+
1012
+ # check for optional first arg
1013
+ if Length(arg) >= 1 and IsPosInt(arg[1]) then
1014
+ CopyListEntries(arg, 1, 1, arg, 2, 1, Length(arg));
1015
+ Unbind(arg[1]);
1016
+ fi;
1017
+
1018
+ if Length(arg) >= 1 and IsBound(arg[1]) then
1019
+ filt := arg[1];
1020
+ if not IsFilter(filt) then
1021
+ ErrorNoReturn("the 1st argument must be a filter");
1022
+ fi;
1023
+ else
1024
+ filt := Random([IsFpMonoid,
1025
+ IsPBRMonoid,
1026
+ IsBipartitionMonoid,
1027
+ IsTransformationMonoid,
1028
+ IsPartialPermMonoid,
1029
+ IsBooleanMatMonoid,
1030
+ IsMaxPlusMatrixMonoid,
1031
+ IsMinPlusMatrixMonoid,
1032
+ IsTropicalMaxPlusMatrixMonoid,
1033
+ IsTropicalMinPlusMatrixMonoid,
1034
+ IsProjectiveMaxPlusMatrixMonoid,
1035
+ IsNTPMatrixMonoid,
1036
+ IsBlockBijectionMonoid,
1037
+ IsIntegerMatrixMonoid,
1038
+ IsMatrixOverFiniteFieldMonoid]);
1039
+ fi;
1040
+
1041
+ params := SEMIGROUPS_ProcessRandomArgsCons(filt, arg{[2 .. Length(arg)]});
1042
+ if IsString(params) then
1043
+ ErrorNoReturn(params);
1044
+ fi;
1045
+ return RandomInverseMonoidCons(filt, params);
1046
+ end);
1047
+
1048
+ #############################################################################
1049
+ ## 9. Changing representation: AsSemigroup, AsMonoid
1050
+ #############################################################################
1051
+
1052
+ # IsomorphismSemigroup can be used to find an isomorphism from any semigroup to
1053
+ # a semigroup of any other type (provided a method is installed!). This is done
1054
+ # to avoid having to have an operation/attribute called IsomorphismXSemigroup
1055
+ # for every single type of semigroup (X = Bipartition, MaxPlusMatrix, etc).
1056
+ # This is simpler but has the disadvantage that the isomorphisms are not stored
1057
+ # as attributes, and slightly more typing is required.
1058
+ #
1059
+ # The following IsomorphismXSemigroup functions remain:
1060
+ #
1061
+ # - IsomorphismTransformationSemigroup/Monoid
1062
+ # - IsomorphismPartialPermSemigroup/Monoid
1063
+ # - IsomorphismFpSemigroup/Monoid
1064
+ # - IsomorphismRees(Zero)MatrixSemigroup
1065
+ #
1066
+ # since they are defined in the GAP library, and, in some sense, are
1067
+ # fundamental and so it is desirable that they are stored as attributes. The
1068
+ # method for IsomorphismSemigroup(IsTransformationSemigroup, S) delegates to
1069
+ # IsomorphismTransformationSemigroup(S), and similarly for the other types
1070
+ # listed above.
1071
+ #
1072
+ # If introducing a new type IsNewTypeOfSemigroup of semigroup, then the minimum
1073
+ # requirement is to install a method for:
1074
+ #
1075
+ # IsomorphismSemigroup(IsNewTypeOfSemigroup, IsTransformationSemigroup)
1076
+ #
1077
+ # and
1078
+ #
1079
+ # InstallMethod(IsomorphismSemigroup,
1080
+ # "for IsNewTypeOfSemigroup and a semigroup",
1081
+ # [IsNewTypeOfSemigroup, IsSemigroup],
1082
+ # SEMIGROUPS.DefaultIsomorphismSemigroup);
1083
+ #
1084
+ # Since every other isomorphism can then be computed by composing with an
1085
+ # isomorphism to a transformation semigroup. Of course, if a better method is
1086
+ # known, then this can be installed instead. The default (right regular)
1087
+ # isomorphism from a semigroup in IsNewTypeOfSemigroup to a transformation
1088
+ # semigroup will be used, if no better method is installed.
1089
+ #
1090
+ # It is necessary that all of the methods for IsomorphismSemigroup in a given
1091
+ # file have the same filter IsXSemigroup for the first argument. (i.e.
1092
+ # methods for IsomorphismSemgroup(IsXSemigroup, ...) must go in the
1093
+ # corresponding file). Also the methods for IsomorphismSemigroup must appear
1094
+ # from lowest to highest rank due to the way that constructors are implemented.
1095
+ # If they are not in lowest to highest rank order, then the wrong constructor
1096
+ # method is selected (i.e. the last applicable one is selected).
1097
+ #
1098
+ # IsomorphismMonoid is only really necessary to convert semigroups with
1099
+ # MultiplicativeNeutralElement, which are not in IsMonoid, to monoids. For
1100
+ # example,
1101
+ #
1102
+ # gap> S := Monoid(Transformation([1, 4, 6, 2, 5, 3, 7, 8, 9, 9]),
1103
+ # > Transformation([6, 3, 2, 7, 5, 1, 8, 8, 9, 9]));;
1104
+ # gap> AsSemigroup(IsBooleanMatSemigroup, S);
1105
+ # <monoid of 10x10 boolean matrices with 2 generators>
1106
+ # gap> AsMonoid(IsBooleanMatMonoid, S);
1107
+ # <monoid of 10x10 boolean matrices with 2 generators>
1108
+ # gap> S := Semigroup(Transformation([1, 4, 6, 2, 5, 3, 7, 8, 9, 9]),
1109
+ # > Transformation([6, 3, 2, 7, 5, 1, 8, 8, 9, 9]));;
1110
+ # gap> AsSemigroup(IsBooleanMatSemigroup, S);
1111
+ # <semigroup of 10x10 boolean matrices with 2 generators>
1112
+ # gap> AsMonoid(IsBooleanMatMonoid, S);
1113
+ # <monoid of 8x8 boolean matrices with 2 generators>
1114
+ #
1115
+ # The reason that AsSemigroup(IsBooleanMatSemigroup, S) returns a monoid, is
1116
+ # that in IsomorphismSemigroup the GeneratorsOfSemigroup(S) are used to
1117
+ # construct generators <gens> for the isomorphic boolean matrix semigroup. But
1118
+ # GeneratorsOfSemigroup(S) contains the One(S) (since it is a monoid) and so
1119
+ # when we call Semigroup(gens), Semigroup detects that one of the generators is
1120
+ # the One of the others, and so returns a monoid.
1121
+ #
1122
+ # Note also that in the example of semigroups of pbrs, there is a good
1123
+ # (semigroup) embedding of the partition monoid, but not a good monoid
1124
+ # embedding. So, if you do AsSemigroup(IsPBRSemigroup, S) when S is a
1125
+ # bipartition monoid, it returns a semigroup of pbrs with degree equal to the
1126
+ # degree of S, whereas if you do AsMonoid(IsPBRMonoid, S), you get a monoid
1127
+ # where the degree is equal to the size of S plus 1 (since this is computed by
1128
+ # computing an isomorphic transformation monoid, and then this is embedded, as
1129
+ # a monoid, into a monoid of pbrs).
1130
+
1131
+ InstallMethod(AsSemigroup, "for a filter and a semigroup",
1132
+ [IsOperation, IsSemigroup],
1133
+ function(filt, S)
1134
+
1135
+ if Tester(filt)(S) and filt(S) then
1136
+ return S;
1137
+ elif filt = IsTransformationSemigroup then
1138
+ return Range(IsomorphismTransformationSemigroup(S));
1139
+ elif filt = IsPartialPermSemigroup then
1140
+ return Range(IsomorphismPartialPermSemigroup(S));
1141
+ elif filt = IsReesMatrixSemigroup then
1142
+ return Range(IsomorphismReesMatrixSemigroup(S));
1143
+ elif filt = IsReesZeroMatrixSemigroup then
1144
+ return Range(IsomorphismReesZeroMatrixSemigroup(S));
1145
+ elif filt = IsFpSemigroup then
1146
+ return Range(IsomorphismFpSemigroup(S));
1147
+ fi;
1148
+
1149
+ return Range(IsomorphismSemigroup(filt, S));
1150
+ end);
1151
+
1152
+ InstallMethod(AsSemigroup, "for a filter, pos int, a semigroup",
1153
+ [IsOperation, IsPosInt, IsSemigroup],
1154
+ {filt, threshold, S} -> Range(IsomorphismSemigroup(filt, threshold, S)));
1155
+
1156
+ InstallMethod(AsSemigroup,
1157
+ "for a filter, pos int, pos int, a semigroup",
1158
+ [IsOperation, IsPosInt, IsPosInt, IsSemigroup],
1159
+ {filt, threshold, period, S}
1160
+ -> Range(IsomorphismSemigroup(filt, threshold, period, S)));
1161
+
1162
+ InstallMethod(AsSemigroup, "for a filter, ring, and semigroup",
1163
+ [IsOperation, IsRing, IsSemigroup],
1164
+ {filt, R, S} -> Range(IsomorphismSemigroup(filt, R, S)));
1165
+
1166
+ InstallMethod(AsMonoid, "for a filter and a semigroup",
1167
+ [IsOperation, IsSemigroup],
1168
+ function(filt, S)
1169
+
1170
+ if IsMonoid(S) and Tester(filt)(S) and filt(S) then
1171
+ return S;
1172
+ elif filt = IsTransformationMonoid then
1173
+ return Range(IsomorphismTransformationMonoid(S));
1174
+ elif filt = IsPartialPermMonoid then
1175
+ return Range(IsomorphismPartialPermMonoid(S));
1176
+ elif filt = IsFpMonoid then
1177
+ return Range(IsomorphismFpMonoid(S));
1178
+ fi;
1179
+
1180
+ return Range(IsomorphismMonoid(filt, S));
1181
+ end);
1182
+
1183
+ InstallMethod(AsMonoid, "for a filter, pos int, and a semigroup",
1184
+ [IsOperation, IsPosInt, IsSemigroup],
1185
+ {filt, threshold, S} -> Range(IsomorphismMonoid(filt, threshold, S)));
1186
+
1187
+ InstallMethod(AsMonoid,
1188
+ "for a filter, pos int, pos int, and a semigroup",
1189
+ [IsOperation, IsPosInt, IsPosInt, IsSemigroup],
1190
+ {filt, threshold, period, S} ->
1191
+ Range(IsomorphismMonoid(filt, threshold, period, S)));
1192
+
1193
+ InstallMethod(AsMonoid, "for a filter, ring, and semigroup",
1194
+ [IsOperation, IsRing, IsSemigroup],
1195
+ {filt, R, S} -> Range(IsomorphismMonoid(filt, R, S)));
1196
+
1197
+ #############################################################################
1198
+ ## 10. Operators
1199
+ #############################################################################
1200
+
1201
+ InstallMethod(\<, "for semigroups in the same family", IsIdenticalObj,
1202
+ [IsSemigroup, IsSemigroup],
1203
+ function(S, T)
1204
+ local SS, TT, s, t;
1205
+
1206
+ if not IsFinite(S) or not IsFinite(T) then
1207
+ TryNextMethod();
1208
+ fi;
1209
+
1210
+ SS := IteratorSorted(S);
1211
+ TT := IteratorSorted(T);
1212
+
1213
+ while not (IsDoneIterator(SS) or IsDoneIterator(TT)) do
1214
+ s := NextIterator(SS);
1215
+ t := NextIterator(TT);
1216
+ if s <> t then
1217
+ return s < t;
1218
+ fi;
1219
+ od;
1220
+
1221
+ if IsDoneIterator(SS) and IsDoneIterator(TT) then
1222
+ return false; # S = T
1223
+ fi;
1224
+ return IsDoneIterator(SS);
1225
+ end);