@@ -116,7 +116,8 @@ class AutomaticSemigroup(UniqueRepresentation, Parent):
116116 sage: [ x.lift() for x in M.list() ]
117117 [1, 3, 5, 9]
118118
119- sage: G = M.cayley_graph(side = "twosided"); G
119+ sage: # needs sage.graphs
120+ sage: G = M.cayley_graph(side="twosided"); G
120121 Looped multi-digraph on 4 vertices
121122 sage: G.edges(sort=True, key=str)
122123 [([1, 1], [1, 1], (2, 'left')),
@@ -142,14 +143,16 @@ class AutomaticSemigroup(UniqueRepresentation, Parent):
142143 sage: M.j_transversal_of_idempotents()
143144 [[1, 1], []]
144145
145- sage: list(map(attrcall('pseudo_order'), M.list()))
146+ sage: list(map(attrcall('pseudo_order'), M.list())) # needs sage.graphs
146147 [[1, 0], [3, 1], [2, 0], [2, 1]]
147148
148149 We can also use it to get submonoids from groups. We check that in the
149150 symmetric group, a transposition and a long cycle generate the whole group::
150151
152+ sage: # needs sage.groups
151153 sage: G5 = SymmetricGroup(5)
152- sage: N = AutomaticSemigroup(Family({1: G5([2,1,3,4,5]), 2: G5([2,3,4,5,1])}), one=G5.one())
154+ sage: N = AutomaticSemigroup(Family({1: G5([2,1,3,4,5]), 2: G5([2,3,4,5,1])}),
155+ ....: one=G5.one())
153156 sage: N.repr_element_method("reduced_word")
154157 sage: N.cardinality() == G5.cardinality()
155158 True
@@ -161,23 +164,26 @@ class AutomaticSemigroup(UniqueRepresentation, Parent):
161164 We can also create a semigroup of matrices, where we define the
162165 multiplication as matrix multiplication::
163166
164- sage: M1=matrix([[0,0,1],[1,0,0],[0,1,0]])
165- sage: M2=matrix([[0,0,0],[1,1,0],[0,0,1]])
167+ sage: # needs sage.modules
168+ sage: M1 = matrix([[0,0,1],[1,0,0],[0,1,0]])
169+ sage: M2 = matrix([[0,0,0],[1,1,0],[0,0,1]])
166170 sage: M1.set_immutable()
167171 sage: M2.set_immutable()
168172 sage: def prod_m(x,y):
169173 ....: z=x*y
170174 ....: z.set_immutable()
171175 ....: return z
172- sage: Mon = AutomaticSemigroup([M1,M2], mul=prod_m, category=Monoids().Finite().Subobjects())
176+ sage: Mon = AutomaticSemigroup([M1,M2], mul=prod_m,
177+ ....: category=Monoids().Finite().Subobjects())
173178 sage: Mon.cardinality()
174179 24
175- sage: C = Mon.cayley_graph()
176- sage: C.is_directed_acyclic()
180+ sage: C = Mon.cayley_graph() # needs sage.graphs
181+ sage: C.is_directed_acyclic() # needs sage.graphs
177182 False
178183
179184 Let us construct and play with the 0-Hecke Monoid::
180185
186+ sage: # needs sage.graphs sage.modules
181187 sage: W = WeylGroup(['A',4]); W.rename("W")
182188 sage: ambient_monoid = FiniteSetMaps(W, action="right")
183189 sage: pi = W.simple_projections(length_increasing=True).map(ambient_monoid)
@@ -199,9 +205,9 @@ class AutomaticSemigroup(UniqueRepresentation, Parent):
199205 We check that the 0-Hecke monoid is `J`-trivial and contains `2^4`
200206 idempotents::
201207
202- sage: len(M.idempotents())
208+ sage: len(M.idempotents()) # needs sage.graphs sage.modules
203209 16
204- sage: all(len(j) == 1 for j in M.j_classes())
210+ sage: all(len(j) == 1 for j in M.j_classes()) # needs sage.graphs sage.modules
205211 True
206212
207213 TESTS::
@@ -210,9 +216,9 @@ class AutomaticSemigroup(UniqueRepresentation, Parent):
210216 True
211217 sage: g[1] == g[1]*g[1]*g[1]
212218 True
213- sage: M.__class__
219+ sage: M.__class__ # needs sage.graphs sage.modules
214220 <class 'sage.monoids.automatic_semigroup.AutomaticMonoid_with_category'>
215- sage: TestSuite(M).run()
221+ sage: TestSuite(M).run() # needs sage.graphs sage.modules
216222
217223 sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup
218224 sage: R = IntegerModRing(34)
@@ -263,7 +269,10 @@ def __classcall_private__(cls, generators, ambient=None, one=None, mul=operator.
263269 sage: M.ambient() == R
264270 True
265271 sage: AutomaticSemigroup((0,)).category()
266- Join of Category of finitely generated semigroups and Category of subquotients of semigroups and Category of commutative magmas and Category of subobjects of sets
272+ Join of Category of finitely generated semigroups
273+ and Category of subquotients of semigroups
274+ and Category of commutative magmas
275+ and Category of subobjects of sets
267276 sage: AutomaticSemigroup((0,), one=1).category()
268277 Join of Category of subquotients of monoids and
269278 Category of commutative monoids and
@@ -279,8 +288,8 @@ def __classcall_private__(cls, generators, ambient=None, one=None, mul=operator.
279288 sage: AutomaticSemigroup((0,), one=0, mul=operator.add).category()
280289 Join of Category of monoids and Category of subobjects of sets
281290
282- sage: S5 = SymmetricGroup(5)
283- sage: AutomaticSemigroup([S5((1,2))]).category()
291+ sage: S5 = SymmetricGroup(5) # needs sage.groups
292+ sage: AutomaticSemigroup([S5((1,2))]).category() # needs sage.groups
284293 Join of Category of finite groups and
285294 Category of subquotients of monoids and
286295 Category of finite finitely generated semigroups and
@@ -400,8 +409,9 @@ def _repr_(self):
400409 sage: AutomaticSemigroup(Family({1: R(3), 2: R(5)}), mul=operator.add, one=R.zero())
401410 A semigroup with 2 generators
402411
403- sage: S5 = SymmetricGroup(5); S5.rename("S5")
404- sage: AutomaticSemigroup(Family({1: S5((1,2))}), category=Groups().Finite().Subobjects())
412+ sage: S5 = SymmetricGroup(5); S5.rename("S5") # needs sage.groups
413+ sage: AutomaticSemigroup(Family({1: S5((1,2))}), # needs sage.groups
414+ ....: category=Groups().Finite().Subobjects())
405415 A subgroup of (S5) with 1 generators
406416 """
407417 categories = [Groups (), Monoids (), Semigroups ()]
@@ -468,8 +478,9 @@ def ambient(self):
468478 sage: M.ambient()
469479 Ring of integers modulo 12
470480
471- sage: M1=matrix([[0,0,1],[1,0,0],[0,1,0]])
472- sage: M2=matrix([[0,0,0],[1,1,0],[0,0,1]])
481+ sage: # needs sage.modules
482+ sage: M1 = matrix([[0,0,1],[1,0,0],[0,1,0]])
483+ sage: M2 = matrix([[0,0,0],[1,1,0],[0,0,1]])
473484 sage: M1.set_immutable()
474485 sage: M2.set_immutable()
475486 sage: def prod_m(x,y):
@@ -488,9 +499,11 @@ def retract(self, ambient_element, check=True):
488499
489500 EXAMPLES::
490501
502+ sage: # needs sage.groups
491503 sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup
492504 sage: S5 = SymmetricGroup(5); S5.rename("S5")
493- sage: M = AutomaticSemigroup(Family({1:S5((1,2)), 2:S5((1,2,3,4))}), one=S5.one())
505+ sage: M = AutomaticSemigroup(Family({1:S5((1,2)), 2:S5((1,2,3,4))}),
506+ ....: one=S5.one())
494507 sage: m = M.retract(S5((3,1))); m
495508 (1,3)
496509 sage: m.parent() is M
@@ -504,7 +517,7 @@ def retract(self, ambient_element, check=True):
504517
505518 TESTS::
506519
507- sage: len(M._retract.cache.keys())
520+ sage: len(M._retract.cache.keys()) # needs sage.groups
508521 24
509522 """
510523 element = self ._retract (ambient_element )
@@ -527,14 +540,15 @@ def _retract(self, ambient_element):
527540 EXAMPLES::
528541
529542 sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup
530- sage: S5 = SymmetricGroup(5)
531- sage: S4 = AutomaticSemigroup(Family({1:S5((1,2)), 2:S5((1,2,3,4))}), one=S5.one())
532- sage: S4._retract(S5((3,1)))
543+ sage: S5 = SymmetricGroup(5) # needs sage.groups
544+ sage: S4 = AutomaticSemigroup(Family({1:S5((1,2)), 2:S5((1,2,3,4))}), # needs sage.groups
545+ ....: one=S5.one())
546+ sage: S4._retract(S5((3,1))) # needs sage.groups
533547 (1,3)
534548
535549 No check is done::
536550
537- sage: S4._retract(S5((4,5)))
551+ sage: S4._retract(S5((4,5))) # needs sage.groups
538552 (4,5)
539553 """
540554 return self .element_class (self , ambient_element )
@@ -769,9 +783,11 @@ def from_reduced_word(self, l):
769783
770784 EXAMPLES::
771785
786+ sage: # needs sage.groups
772787 sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup
773788 sage: G4 = SymmetricGroup(4)
774- sage: M = AutomaticSemigroup(Family({1:G4((1,2)), 2:G4((1,2,3,4))}), one=G4.one())
789+ sage: M = AutomaticSemigroup(Family({1:G4((1,2)), 2:G4((1,2,3,4))}),
790+ ....: one=G4.one())
775791 sage: M.from_reduced_word([2, 1, 2, 2, 1]).lift()
776792 (1,3)
777793 sage: M.from_reduced_word([2, 1, 2, 2, 1]) == M.retract(G4((3,1)))
@@ -784,7 +800,7 @@ def from_reduced_word(self, l):
784800
785801 def construct (self , up_to = None , n = None ):
786802 """
787- Construct the elements of the ``self``.
803+ Construct the elements of ``self``.
788804
789805 INPUT:
790806
@@ -800,6 +816,7 @@ def construct(self, up_to=None, n=None):
800816
801817 EXAMPLES::
802818
819+ sage: # needs sage.groups sage.modules
803820 sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup
804821 sage: W = WeylGroup(['A',3]); W.rename("W")
805822 sage: ambient_monoid = FiniteSetMaps(W, action="right")
0 commit comments