Set Operations

Random(M, n) : MonRWS, RngIntElt -> MonRWSElt
A random word of length at most n in the generators of M.
Random(M) : MonRWS -> MonRWSElt
A random word (of length at most the order of M) in the generators of M.
Representative(M) : MonRWS -> MonRWSElt
Rep(M) : MonRWS -> MonRWSElt
An element chosen from M.
Set(M, a, b) : MonRWS, RngIntElt, RngIntElt -> SetEnum
    Search: MonStgElt                   Default: "DFS"
Create the set of words, w, in M with a ≤ length(w) ≤b. If Search is set to "DFS" (depth-first search) then words are enumerated in lexicographical order. If Search is set to "BFS" (breadth-first-search) then words are enumerated in lexicographical order for each individual length (i.e. in short-lex order). Depth-first-search is marginally quicker. Since the result is a set the words may not appear in the resultant set in the search order specified (although internally they will be enumerated in this order).
Set(M) : MonRWS -> SetEnum
    Search: MonStgElt                   Default: "DFS"
Create the set of words that is the carrier set of M. If Search is set to "DFS" (depth-first search) then words are enumerated in lexicographical order. If Search is set to "BFS" (breadth-first-search) then words are enumerated in lexicographical order for each individual length (i.e. in short-lex order). Depth-first-search is marginally quicker. Since the result is a set the words may not appear in the resultant set in the search order specified (although internally they will be enumerated in this order).
Seq(M, a, b) : MonRWS, RngIntElt, RngIntElt -> SeqEnum
    Search: MonStgElt                   Default: "DFS"
Create the sequence S of words, w, in M with a ≤ length(w) ≤b. If Search is set to "DFS" (depth-first search) then words will appear in S in lexicographical order. If Search is set to "BFS" (breadth-first-search) then words will appear in S in lexicographical order for each individual length (i.e. in short-lex order). Depth-first-search is marginally quicker.
Seq(M) : MonRWS -> SeqEnum
    Search: MonStgElt                   Default: "DFS"
Create a sequence S of words from the carrier set of M. If Search is set to "DFS" (depth-first search) then words will appear in S in lexicographical order. If Search is set to "BFS" (breadth-first-search) then words will appear in S in lexicographical order for each individual length (i.e. in short-lex order). Depth-first-search is marginally quicker.

Example MonRWS_Set (H85E11)

We construct the group D22, together with a representative word from the group, a random word and a random word of length at most 5 from the group, and the set of elements of the group.
> FM<a,b,c,d,e,f> := FreeMonoid(6);
> Q := quo< FM | a^2=1, f^2=1,
>                d*a=a*c, e*b=b*f, d*c=c*e, d*f=a*d, a*e=e*b, b*f*c=f >;
> M<a,b,c,d,e,f> := RWSMonoid(Q);
> print Order(M);
22
> print Representative(M);
Id(M)
> print Random(M);
c * e
> print Random(M, 5);
d
> Set(M);
{ a * c, e, a * d, f, a * e, a * f, Id(M), a * c * e, b * a,
  b * d, a * d * b, b * e, c * e, a * b * a, d * b, a * b * d,
  a, a * b * e, b, c, a * b, d }
> Seq(M : Search := "BFS");
[ Id(M), a, b, c, d, e, f, a * b, a * c, a * d, a * e, a * f,
  b * a, b * d, b * e, c * e, d * b, a * b * a, a * b * d,
  a * b * e, a * c * e, a * d * b ]
V2.28, 13 July 2023