1BindGlobal("YBFamily", NewFamily("YBFamily"));
2InstallValue(YBType, NewType(YBFamily, IsYB));
3
4### This function returns the set-theoretic solution given by the permutations <l_actions> and <r_actions>
5### <l_action> and <r_action> are matrices!
6InstallMethod(YB, "for a two lists of permutations", [ IsList, IsList ],
7function(l, r)
8  local obj;
9  if not IS_YB(l, r) then
10    Error("this is not a solution of the YBE\n");
11  fi;
12
13  obj := Objectify(YBType, rec());
14
15  SetSize(obj, Size(l));
16  SetLMatrix(obj, List(l, x->List(x, y->y)));
17  SetRMatrix(obj, List(r, x->List(x, y->y)));
18
19  return obj;
20
21end);
22
23InstallMethod(ViewObj,
24  "for a set-theoretical solution",
25  [ IsYB ],
26  function(obj)
27  Print("<A set-theoretical solution of size ", Size(obj), ">");
28end);
29
30InstallMethod(PrintObj,
31  "for a set-theoretical solution",
32  [ IsYB ],
33  function(obj)
34  if Size(obj) < 5 then
35    Print("YB(", LMatrix(obj), ",", RMatrix(obj), ")");
36  else
37    Print("<A set-theoretical solution of size ", Size(obj), ">");
38  fi;
39end);
40
41InstallMethod(SmallIYB, "for two integers", [ IsInt, IsInt ],
42function(size, number)
43  return CycleSet2YB(SmallCycleSet(size, number));
44end);
45
46InstallMethod(Permutations2YB, "for a list of permutations", [ IsList, IsList ],
47function(l, r)
48  return YB(List(l, x->ListPerm(x, Size(l))), List(r, y->ListPerm(y, Size(l))));
49end);
50
51### This function returns the set-theoretic solution
52### corresponding to the matrix <table> such that the (i,j) entry is r(i,j)
53#InstallMethod(Table2YB, "for a square matrix", [ IsList ],
54#function(table)
55#  local ll, rr, x, y, p, n;
56#
57#  n := Sqrt(Size(table));
58#
59#  ll := List([1..n], x->[1..n]);
60#  rr := List([1..n], x->[1..n]);
61#
62#  for p in table do
63#    x := p[1][1];
64#    y := p[1][2];
65#    ll[x][y] := p[2][1];
66#    rr[y][x] := p[2][2];
67#  od;
68#  return YB(ll, rr);
69#end);
70
71##### This function returns the table of the solution, which is
72##### the matrix that in the (i,j)-entry has r(i,j)
73#InstallMethod(DisplayTable, "for a set theoretic solution", [ IsYB ],
74#function(obj)
75#  local m, x, y;
76#  m := NullMat(Size(obj), Size(obj));
77#  for x in [1..Size(obj)] do
78#    for y in [1..Size(obj)] do
79#      m[x][y] := TableYB(obj, x, y);
80#    od;
81#  od;
82#  return m;
83#end);
84
85### This function returns true if <obj> is square-free
86### A solution r is square-free iff r(x,x)=(x,x) for all x
87InstallOtherMethod(IsSquareFree,
88  "for a set-theoretical solution",
89  [ IsYB ],
90  function(obj)
91  local x;
92  for x in [1..Size(obj)] do
93    if [LMatrix(obj)[x][x], RMatrix(obj)[x][x]] <> [x, x] then
94      return false;
95    fi;
96  od;
97  return true;
98end);
99
100InstallMethod(IYBGroup, "for a set-theoretical solution", [ IsYB ],
101function(obj)
102  return YBPermutationGroup(obj);
103end);
104
105InstallMethod(YBPermutationGroup, "for a set-theoretical solution", [ IsYB ],
106function(obj)
107  return Group(LPerms(obj));
108end);
109
110InstallMethod(Evaluate, "for a set-theoretical solution and a list of two elements", [ IsYB, IsList ],
111function(obj, pair)
112  local x,y;
113  x := pair[1];
114  y := pair[2];
115  return [LMatrix(obj)[x][y], RMatrix(obj)[y][x]];
116end);
117
118
119### This function returns the vector value of <obj> at (<x>,<y>)
120InstallMethod(TableYB, "for a set-theoretical solution", [ IsYB, IsInt, IsInt ],
121function(obj, x, y)
122  return [LMatrix(obj)[x][y], RMatrix(obj)[y][x]];
123end);
124
125### This function returns true if <obj> is involutive
126### r is involutive <=> r^2=id
127InstallMethod(IsInvolutive, "for a set-theoretical solution", [ IsYB ],
128function(obj)
129  local x,y,s;
130  for x in [1..Size(obj)] do
131    for y in [1..Size(obj)] do
132      s :=  TableYB(obj, x, y);
133      if TableYB(obj, s[1], s[2]) <> [x,y] then
134        return false;
135      fi;
136    od;
137  od;
138  return true;
139end);
140
141#InstallMethod(YBTable, "for a set-theoretical solution", [ IsYB, IsInt, IsInt ],
142#function(obj, i, j)
143#  return [obj!.l_actions[x][y], obj!.r_actions[y][x]];
144#end);
145
146
147### This function returns true if the maps x->L_x are bijective
148### r(x,y)=(L_x(y), R_y(x))
149### CHECK
150InstallMethod(IsLeftNonDegenerate,
151  "for a set-theoretical solution",
152  [ IsYB ],
153  function(obj)
154  local l;
155  l := List(LMatrix(obj), PermList);
156  if fail in l then
157    return false;
158  else
159    SetLPerms(obj, l);
160    return true;
161  fi;
162
163  #for x in [1..Size(obj)] do
164  #  if PermList(LMatrix(obj)[x]) = fail then
165  #    return false;
166  #  fi;
167  #od;
168  #SetLPerms(obj, List(LMatrix(obj), PermList));
169  #return true;
170end);
171
172### This function returns true if the maps x->R_x are bijective
173### r(x,y)=(L_x(y), R_y(x))
174InstallMethod(IsRightNonDegenerate,
175  "for a set-theoretical solution",
176  [ IsYB ],
177  function(obj)
178  local l;
179  l := List(RMatrix(obj), PermList);
180  if fail in l then
181    return false;
182  else
183    SetRPerms(obj, l);
184    return true;
185  fi;
186end);
187
188### This function returns true if <r> is left and right non-degenerate
189InstallMethod(IsNonDegenerate,
190  "for a set-theoretical solution",
191  [ IsYB ],
192  function(obj)
193  return IsLeftNonDegenerate(obj) and IsRightNonDegenerate(obj);
194end);
195
196InstallMethod(LPerms,
197  "for a set-theoretical solution",
198  [ IsYB ],
199  function(obj)
200  if IsLeftNonDegenerate(obj) then
201    return LPerms(obj);# List(obj!.l_actions, x->PermList(x));
202  fi;
203  return fail;
204end);
205
206InstallMethod(RPerms,
207  "for a set-theoretical solution",
208  [ IsYB ],
209  function(obj)
210  if IsRightNonDegenerate(obj) then
211    return RPerms(obj);
212  fi;
213  return fail;
214end);
215
216InstallMethod(YB2CycleSet,
217  "for a set-theoretical solution",
218  [ IsYB ],
219  function(obj)
220
221  if not IsInvolutive(obj) then
222    Error("the solution of the YBE is not involutive\n");
223  fi;
224
225  if not IsRightNonDegenerate(obj) then
226    Error("the soslution of the YBE is not (right) non-degenerate\n");
227  fi;
228  return CycleSet(List(RMatrix(obj), x->ListPerm(Inverse(PermList(x)),Size(obj))));
229
230  return CycleSet(RMatrix(obj));
231end);
232
233InstallGlobalFunction(YB_xy,
234  function(obj, x, y)
235  return [LMatrix(obj)[x][y], RMatrix(obj)[y][x]];
236  #return [obj!.l_actions[x][y], obj!.r_actions[y][x]];
237end);
238
239InstallMethod(Retract,
240  "for a set-theoretical solution",
241  [ IsYB ],
242  function(obj)
243  local e, c, s, pairs, x, y, z, ll, rr;
244
245  if not IsInvolutive(obj) then
246    Error("the solutions of the YBE is not involutive\n");
247  fi;
248
249  pairs := [];
250  for x in [1..Size(obj)] do
251    for y in [1..Size(obj)] do
252      if LPerms(obj)[x] = LPerms(obj)[y] then
253        Add(pairs, [x, y]);
254      fi;
255    od;
256  od;
257
258  e := EquivalenceRelationByPairs(Domain([1..Size(obj)]), pairs);
259  c := EquivalenceClasses(e);
260  s := Size(c);
261
262  ll := List([1..s], x->[1..s]);
263  rr := List([1..s], x->[1..s]);
264
265  for x in [1..s] do
266    for y in [1..s] do
267      z := YB_xy(obj, Representative(c[x]), Representative(c[y]));
268      ll[x][y] := Position(c, First(c, u->z[1] in u));
269      rr[y][x] := Position(c, First(c, u->z[2] in u));
270    od;
271  od;
272  return YB(ll, rr);
273end);
274
275InstallMethod(IsRetractable,
276  "for a set-theoretical solution",
277  [ IsYB ],
278  function(obj)
279  local r;
280  r := Retract(obj);
281  if Size(r) = Size(obj) then
282    return false;
283  else
284    return true;
285  fi;
286end);
287
288InstallMethod(IsMultipermutation,
289  "for a set-theoretical solution",
290  [ IsYB ],
291  function(obj)
292  if not MultipermutationLevel(obj) = fail then
293    return true;
294  else
295    return false;
296  fi;
297end);
298
299InstallMethod(MultipermutationLevel,
300  "for a set-theoretical solution",
301   [ IsYB ],
302  function(obj)
303  local r,s,l;
304
305  l := 0;
306  r := ShallowCopy(obj);
307
308  repeat
309    s := ShallowCopy(r);
310    r := Retract(s);
311    if Size(r) <> Size(s) then
312      l := l+1;
313    else
314      return fail;
315    fi;
316  until Size(r) = 1;
317  return l;
318end);
319
320### This function returns the number of involutive set-theoretic solutions of size <n>
321InstallGlobalFunction(NrSmallIYB,
322function(n)
323  return NrSmallCycleSets(n);
324end);
325
326### This function returns the permutations defining the set-theoretic solution
327### These permutations are in the following form: [ left_permutations, right_permutations ]
328InstallOtherMethod(Permutations,
329  "for set-theoretic solutions",
330  [ IsYB ],
331  function(obj)
332  return [LPerms(obj), RPerms(obj)];
333end);
334
335
336### This function returns the <i>-th involutive set-theoretic solution of size <n>
337### These solutions were computed by Etingof, Schedler and Soloviev
338#InstallGlobalFunction(SmallIYB,
339#function(n, i)
340#  return CycleSet2YB(SmallCycleSet(n,i));
341#  local r, data;
342#  data := [
343#    YB_size1,
344#    YB_size2,
345#    YB_size3,
346#    YB_size4,
347#    YB_size5,
348#    YB_size6,
349#    YB_size7,
350#    YB_size8
351#  ];
352#  if n in [1..8] then
353#    r := data[n][i];
354#    return YB(r[1], r[2]);
355#  else
356#    return fail;
357#  fi;
358#end);
359
360InstallGlobalFunction(YB_IsBraidedSet,
361function(l_actions, r_actions)
362  local x, y, z, v;
363
364  if Size(r_actions) <> Size(l_actions) then
365    return false;
366  fi;
367
368  for x in [1..Size(l_actions)] do
369    for y in [1..Size(l_actions)] do
370      for z in [1..Size(l_actions)] do
371        v := [x,y,z];
372        if YB_ij(l_actions, r_actions, YB_ij(l_actions, r_actions, YB_ij(l_actions, r_actions, v, 2, 3), 1, 2), 2, 3) \
373          <> YB_ij(l_actions, r_actions, YB_ij(l_actions, r_actions, YB_ij(l_actions, r_actions, v, 1, 2), 2, 3), 1, 2) then
374          return false;
375        fi;
376      od;
377    od;
378  od;
379  return true;
380end);
381
382### This function returns true if <subset> is r-invariant
383### A subset Y of X is r-invariant if r(YxY) is included in YxY
384InstallMethod(IsInvariant, "for a solution and a list", [IsYB, IsList],
385function(obj, subset)
386  local x, y, z;
387  for x in subset do
388    for y in subset do
389      z := YB_xy(obj, x, y);
390      if not z[1] in subset or not z[2] in subset then
391        return false;
392      fi;
393    od;
394  od;
395  return true;
396end);
397
398### This function returns the restricted solution with respect to <subset>
399### If <subset> is not invariant, the function returns fail
400InstallMethod(RestrictedYB, "for a solution and a list", [ IsYB, IsList ],
401function(obj, subset)
402  local x, y, z, ll, rr;
403
404  if not IsInvariant(obj, subset) then
405    return fail;
406  fi;
407
408  ll := List([1..Size(subset)], x->[1..Size(subset)]);
409  rr := List([1..Size(subset)], x->[1..Size(subset)]);
410
411  for x in [1..Size(subset)] do
412    for y in [1..Size(subset)] do
413      ll[x][y] := Position(subset, subset[y]^LPerms(obj)[subset[x]]);
414      rr[y][x] := Position(subset, subset[x]^RPerms(obj)[subset[y]]);
415    od;
416  od;
417  return YB(ll, rr);
418end);
419
420### This function returns the structure group of <r>
421### Generators: x_1,x_2,...,x_n
422### Relations: x_ix_j=x_kx_l whenever r(i,j)=(k,l)
423InstallMethod(StructureGroup, "for a solution", [ IsYB ],
424function(obj)
425  local n, f, x, y, rels, i, j;
426
427  n := Size(obj);
428  f := FreeGroup(n);
429  x := GeneratorsOfGroup(f);
430
431  rels := [];
432
433  for i in [1..n] do
434    for j in [1..n] do
435      y := YB_xy(obj, i, j);
436      Add(rels, x[i]*x[j]*Inverse(x[y[1]]*x[y[2]]));
437    od;
438  od;
439  return f/rels;
440end);
441
442### This function returns the trivial solution over [1..size]
443### r is trivial <=> r(x,y)=(y,x)
444InstallMethod(TrivialYB, "for an integer", [ IsInt ],
445function(n)
446  return YB(List([1..n], x->[1..n]), List([1..n], x->[1..n]));
447end);
448
449InstallMethod(LyubashenkoYB, "for an integer and two permutations", [ IsInt, IsPerm, IsPerm ],
450function(size, f, g)
451  if f*g=g*f then
452    return YB(List([1..size], x->ListPerm(f, size)), List([1..size], x->ListPerm(g,size)));
453  else
454    return fail;
455  fi;
456end);
457
458### This function returns the cartesian product of the solutions <r> and <s>
459### This means: r((a,b),(c,d))=(r(a,c),r(b,d))
460InstallMethod(CartesianProduct, "for two solutions", [ IsYB, IsYB ],
461function(r, s)
462  local c, l, u, v, w;
463  l := [];
464  c := Cartesian([1..Size(r)], [1..Size(s)]);
465  for u in c do
466    for v in c do
467      w := [YB_xy(r, u[1], v[1]),  YB_xy(s, u[2], v[2])];
468      Add(l, [[Position(c, u), Position(c, v)], [Position(c, [w[1][1], w[2][1]]), Position(c, [w[1][2], w[2][2]])]]);
469    od;
470  od;
471  return Table2YB(l);
472end);
473
474### This function returns the matrix of the rack corresponding to the derived solution of a solution
475InstallMethod(DerivedRack, "for a solution", [ IsYB ],
476function(obj)
477  local x, y, z, m;
478
479  if not IsNonDegenerate(obj) then
480    return fail;
481  fi;
482
483  m := NullMat(Size(obj), Size(obj));
484  for x in [1..Size(obj)] do
485    for y in [1..Size(obj)] do
486      # I have two operations. Let S(x,y)=(g_x(y),f_y(x)) and
487      # xoy=g_y(x), y*x=Inverse(f)_y(x).
488      # Then the derived rack structure is given by x>y=f_x((y*x)oy)
489      z := y^LPerms(obj)[x^Inverse(RPerms(obj)[y])];
490      m[x][y] := z^RPerms(obj)[x];
491    od;
492  od;
493  return Rack(m);
494end);
495
496InstallMethod(Wada, "for a group", [ IsGroup ],
497function(group)
498  local x, y, e, l, r;
499
500  e := Elements(group);
501  l := NullMat(Size(group), Size(group));
502  r := NullMat(Size(group), Size(group));
503  for x in group do
504    for y in group do
505      l[Position(e, x)][Position(e, y)] := Position(e, x*Inverse(y)*Inverse(x));
506      r[Position(e, y)][Position(e, x)] := Position(e, x*y^2);
507    od;
508  od;
509  return YB(l, r);
510end);
511
512### CHECK and FIXME
513InstallMethod(IsBiquandle, "for a solution", [ IsYB ],
514function(obj)
515  local x, y;
516  for x in [1..Size(obj)] do
517    if not ForAny([1..Size(obj)], y->YB_xy(obj, x, y)=[x,y]) then
518      return false;
519    fi;
520  od;
521  return true;
522end);
523
524InstallMethod(YB2Permutation, "for a solution", [ IsYB ],
525function(obj)
526  local perm, x, y, u, v;
527
528  perm := [1..Size(obj)^2];
529
530  for x in [1..Size(obj)] do
531    for y in [1..Size(obj)] do
532      u := YB_xy(obj, x, y)[1];
533      v := YB_xy(obj, x, y)[2];
534      perm[x+Size(obj)*y] := u+Size(obj)*v;
535    od;
536  od;
537  return PermList(perm);
538end);
539
540## j>i = s_y t_(s_x^(-1)(y))(x)
541#lrack := function(lperms, rperms)
542#  local i,j,m,n;
543#  n := Size(lperms);
544#  m := NullMat(n,n);
545#  for i in [1..n] do
546#    for j in [1..n] do
547#      m[j][i] := (i^lperms[j^Inverse(rperms[i])])^rperms[j];
548#    od;
549#  od;
550#  return Rack(m);
551#end;
552
553InstallMethod(DerivedRightRack, "for a solution", [ IsYB ],
554function(obj)
555  local i,j,m,n,lperms,rperms;
556  lperms := List(obj!.l_actions, PermList);
557  rperms := List(obj!.r_actions, PermList);
558  n := Size(lperms);
559  m := NullMat(n,n);
560  for i in [1..n] do
561    for j in [1..n] do
562      m[j][i] := (i^rperms[j^Inverse(lperms[i])])^lperms[j];
563    od;
564  od;
565  return Rack(m);
566end);
567
568# j>i = s_y t_(s_x^(-1)(y))(x)
569# it follows the notation of my paper with Lebed
570InstallMethod(DerivedLeftRack, "for a solution", [ IsYB ],
571function(obj)
572  return DerivedRack(obj);
573end);
574
575InstallMethod(YB2Permutation, "for a solution", [ IsYB ], function(obj)
576  local perm, x, y, u, v;
577
578  perm := [1..Size(obj)^2];
579
580  for x in [1..Size(obj)] do
581    for y in [1..Size(obj)] do
582      u := YB_xy(obj, x, y)[1];
583      v := YB_xy(obj, x, y)[2];
584      perm[x+Size(obj)*y] := u+Size(obj)*v;
585    od;
586  od;
587  return PermList(perm);
588end);
589
590# FIXME: IsObject?
591InstallMethod(DehornoyRepresentationOfStructureGroup, "for an involutive solution and a symbol", [ IsYB, IsObject ],
592function(obj,q)
593  local i, m, gens;
594
595  gens := [];
596
597	if not IsInvolutive(obj) then
598		return fail;
599  fi;
600
601  for i in [1..Size(obj)] do
602    m := One(Field(q))*IdentityMat(Size(obj), Size(obj));
603    m[i][i] := q;
604    Add(gens, m*PermutationMat(Inverse(Permutations(obj)[1][i]), Size(obj)));
605  od;
606
607  return Group(gens);
608end);
609
610InstallMethod(DehornoyClass, "for an involutive solution", [ IsYB ],
611function(obj)
612  local x, m, tmp, sigmas, T;
613
614	if not IsInvolutive(obj) then
615		return fail;
616	fi;
617
618  tmp := [];
619  sigmas := Permutations(obj)[2];
620	T := PermList(List([1..Size(obj)], x->x^Inverse(sigmas[x])));
621
622  for x in [1..Size(obj)] do
623    Add(tmp, First(PositiveIntegers, m->Product(List([0..m-1], k->sigmas[x^(T^k)])) = ()));
624  od;
625  return Maximum(tmp);
626end);
627
628InstallMethod(IdYB, "for an involutive solution", [ IsYB ],
629function(obj)
630  local cs;
631  cs := YB2CycleSet(obj);
632  if not Size(obj) in [1..8] then
633    Error("solutions of size ", Size(obj), " are not in the database\n");
634  else
635    return [Size(obj), First([1..NrSmallCycleSets(Size(obj))], k->IsomorphismCycleSets(cs, SmallCycleSet(Size(obj),k)) <> fail)];
636  fi;
637end);
638
639InstallMethod(IYBBrace, "for an involutive solution", [ IsYB ],
640function(obj)
641  local gens, fam, brace, sum, group, add, x, y, mul, ESS_1cocycle, AllMatrices, ESS_inverse1cocycle;
642
643	group := AffineCrystGroupOnLeft(GeneratorsOfGroup(LinearRepresentationOfStructureGroup(obj)));
644
645  ESS_1cocycle := function(m)
646	  local n, A;
647	  n := Size(m);
648	  A := TransposedMat(m);
649	  A := A{[n]}{[1..(n-1)]};
650	  return A[1];
651  end;
652
653  AllMatrices := function(hol,v)
654  	local n, P, M, i, z, V, A, B;
655	  n := Size(v);
656  	P := AsList(hol);
657
658  	A := [];
659  	B := [];
660  	z := NullMat(n,n);
661
662  	for i in [1..n] do
663      z[i][1]:=v[i];
664  	od;
665
666  	B[1] := BlockMatrix([ [1,1, P[1] ], [1,2, z], [2,2,One(P[1])]],2,2);
667  	A[1] := MatrixByBlockMatrix(B[1]);
668  	A[1] := A[1]{[1..n+1]}{[1..n+1]};
669
670    for i in [2..Size(P)] do
671  		B[i]:=BlockMatrix([[1,1,P[i]], [1,2,z], [2,2,One(P[i])]],2,2);
672  		A[i]:=MatrixByBlockMatrix(B[i]);
673      A[i]:=A[i]{[1..n+1]}{[1..n+1]};
674    od;
675  	return A;
676  end;
677
678  ESS_inverse1cocycle := function(v)
679	  local hol;
680	  hol := PointGroup(group);
681    return First(AllMatrices(hol, v), x->x in group);
682  end;
683
684  sum := function(x, y)
685		local f,g,h,a,b,c;
686
687		f := PointHomomorphism(group);
688
689		g := PreImagesRepresentative(f,x);
690		h := PreImagesRepresentative(f,y);
691
692		a:=ESS_1cocycle(g);
693		b:=ESS_1cocycle(h);
694
695		return Image(f, ESS_inverse1cocycle(a+b));
696
697	end;
698
699	mul := AsList(PointGroup(group));
700	add := NullMat(Size(mul),Size(mul));
701
702	for x in mul do
703		for y in mul do
704			add[Position(mul, x)][Position(mul,y)] := Position(mul, sum(x,y));
705		od;
706	od;
707
708	add := List(add, PermList);
709
710  fam := NewFamily("SkewbraceElmFamily", IsSkewbraceElm, IsMultiplicativeElementWithInverse and IsAdditiveElementWithInverse);
711  fam!.DefaultType := NewType(fam, IsSkewbraceElmRep);
712  brace := Objectify(NewType(CollectionsFamily(fam), IsSkewbrace and IsAttributeStoringRep), rec());
713  fam!.Skewbrace := brace;
714
715  SetSize(brace, Size(add));
716  SetSkewbraceAList(brace, add);
717  SetSkewbraceMList(brace, mul);
718
719  #gens := SmallGeneratingSet(Group(add));
720  gens := GeneratorsOfGroup(Group(add));
721  if gens = [] then
722    SetUnderlyingAdditiveGroup(brace, Group(()));
723  else
724    SetUnderlyingAdditiveGroup(brace, Group(gens));
725  fi;
726
727  gens := GeneratorsOfGroup(Group(mul));
728  if gens = [] then
729    SetUnderlyingMultiplicativeGroup(brace, Group(()));
730  else
731    SetUnderlyingMultiplicativeGroup(brace, Group(gens));
732  fi;
733
734  return brace;
735
736end);
737
738InstallMethod(LinearRepresentationOfStructureGroup, "for an involutive solution", [ IsYB ],
739function(obj)
740  local i,j,m,l,n,x,perms;
741
742  if not IsInvolutive(obj) then
743    return fail;
744  fi;
745
746  n := Size(obj);
747  l := [];
748  perms := GeneratorsOfGroup(DehornoyRepresentationOfStructureGroup(obj,1));
749
750  for x in [1..n] do
751
752    m := NullMat(n+1, n+1);
753
754    for i in [1..n] do
755      for j in [1..n] do
756        m[i][j] := perms[x][i][j];
757      od;
758    od;
759
760    m[x][n+1] := 1;
761    m[n+1][n+1] := 1;
762
763    Add(l, m);
764
765  od;
766
767  return Group(l);
768
769end);
770
771
772