This file is indexed.

/usr/share/gap/doc/ref/chap37.html is in gap-doc 4r8p8-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>GAP (ref) - Chapter 37: Associative Words</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap37"  onload="jscontent()">


<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chap11.html">11</a>  <a href="chap12.html">12</a>  <a href="chap13.html">13</a>  <a href="chap14.html">14</a>  <a href="chap15.html">15</a>  <a href="chap16.html">16</a>  <a href="chap17.html">17</a>  <a href="chap18.html">18</a>  <a href="chap19.html">19</a>  <a href="chap20.html">20</a>  <a href="chap21.html">21</a>  <a href="chap22.html">22</a>  <a href="chap23.html">23</a>  <a href="chap24.html">24</a>  <a href="chap25.html">25</a>  <a href="chap26.html">26</a>  <a href="chap27.html">27</a>  <a href="chap28.html">28</a>  <a href="chap29.html">29</a>  <a href="chap30.html">30</a>  <a href="chap31.html">31</a>  <a href="chap32.html">32</a>  <a href="chap33.html">33</a>  <a href="chap34.html">34</a>  <a href="chap35.html">35</a>  <a href="chap36.html">36</a>  <a href="chap37.html">37</a>  <a href="chap38.html">38</a>  <a href="chap39.html">39</a>  <a href="chap40.html">40</a>  <a href="chap41.html">41</a>  <a href="chap42.html">42</a>  <a href="chap43.html">43</a>  <a href="chap44.html">44</a>  <a href="chap45.html">45</a>  <a href="chap46.html">46</a>  <a href="chap47.html">47</a>  <a href="chap48.html">48</a>  <a href="chap49.html">49</a>  <a href="chap50.html">50</a>  <a href="chap51.html">51</a>  <a href="chap52.html">52</a>  <a href="chap53.html">53</a>  <a href="chap54.html">54</a>  <a href="chap55.html">55</a>  <a href="chap56.html">56</a>  <a href="chap57.html">57</a>  <a href="chap58.html">58</a>  <a href="chap59.html">59</a>  <a href="chap60.html">60</a>  <a href="chap61.html">61</a>  <a href="chap62.html">62</a>  <a href="chap63.html">63</a>  <a href="chap64.html">64</a>  <a href="chap65.html">65</a>  <a href="chap66.html">66</a>  <a href="chap67.html">67</a>  <a href="chap68.html">68</a>  <a href="chap69.html">69</a>  <a href="chap70.html">70</a>  <a href="chap71.html">71</a>  <a href="chap72.html">72</a>  <a href="chap73.html">73</a>  <a href="chap74.html">74</a>  <a href="chap75.html">75</a>  <a href="chap76.html">76</a>  <a href="chap77.html">77</a>  <a href="chap78.html">78</a>  <a href="chap79.html">79</a>  <a href="chap80.html">80</a>  <a href="chap81.html">81</a>  <a href="chap82.html">82</a>  <a href="chap83.html">83</a>  <a href="chap84.html">84</a>  <a href="chap85.html">85</a>  <a href="chap86.html">86</a>  <a href="chap87.html">87</a>  <a href="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp;  <a href="chap0.html#contents">[Contents]</a>&nbsp;  &nbsp;<a href="chap36.html">[Previous Chapter]</a>&nbsp;  &nbsp;<a href="chap38.html">[Next Chapter]</a>&nbsp;  </div>

<p id="mathjaxlink" class="pcenter"><a href="chap37_mj.html">[MathJax on]</a></p>
<p><a id="X78C56A0A87CE380E" name="X78C56A0A87CE380E"></a></p>
<div class="ChapSects"><a href="chap37.html#X78C56A0A87CE380E">37 <span class="Heading">Associative Words</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X7AB546CB7B929253">37.1 <span class="Heading">Categories of Associative Words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7FA8DA728773BA89">37.1-1 IsAssocWord</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X82E7EA7F7FD31EC3">37.2 <span class="Heading">Free Groups, Monoids and Semigroups</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8215999E835290F0">37.2-1 <span class="Heading">FreeGroup</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8601654A7C4AF1E7">37.2-2 IsFreeGroup</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X814203E281F3272E">37.2-3 AssignGeneratorVariables</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X8405BECB7AC4EB61">37.3 <span class="Heading">Comparison of Associative Words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8206153078E97B90"><code>37.3-1 \=</code></a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7BB12B9D7F990899"><code>37.3-2 \&lt;</code></a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X805C519682B0A7ED">37.3-3 IsShortLexLessThanOrEqual</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X84875E08847B39E1">37.3-4 IsBasicWreathLessThanOrEqual</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X79AF6C757A3547BD">37.4 <span class="Heading">Operations for Associative Words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8680FCAD83019E70">37.4-1 Length</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7F5ED4357A9C12E6">37.4-2 ExponentSumWord</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X82CC92C17AF6FFA0">37.4-3 Subword</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8509A0A4851981BB">37.4-4 PositionWord</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X79186218787C224A">37.4-5 <span class="Heading">SubstitutedWord</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8486BFE1844CFE59">37.4-6 EliminatedWord</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X7D357E047ABD2C6B">37.5 <span class="Heading">Operations for Associative Words by their Syllables</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X842D0B547CE93CF2">37.5-1 NumberSyllables</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7E91575F848F4526">37.5-2 ExponentSyllable</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7F2A8CFD811C73B1">37.5-3 GeneratorSyllable</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7B4F7A167E844FA5">37.5-4 SubSyllables</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X80A9F39582ED296E">37.6 <span class="Heading">Representations for Associative Words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7E3612247B3E241B">37.6-1 IsLetterAssocWordRep</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7E36F7897D82417F">37.6-2 IsLetterWordsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7C84789D7BB161E9">37.6-3 IsBLetterAssocWordRep</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8719E7F27CDA1995">37.6-4 IsBLetterWordsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7886F8BD83CD8081">37.6-5 IsSyllableAssocWordRep</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7869716C84EA9D81">37.6-6 IsSyllableWordsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X83F669828481FC32">37.6-7 Is16BitsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7BD7647C7B088389">37.6-8 LetterRepAssocWord</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7AC8EC757CFB9A51">37.6-9 AssocWordByLetterRep</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X7934D3D5797102EC">37.7 <span class="Heading">The External Representation for Associative Words</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X7DC99E4284093FBB">37.8 <span class="Heading">Straight Line Programs</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7F69FF3F7C6694CB">37.8-1 IsStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7AECA57280DA3195">37.8-2 StraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X81A8AFC47F8E4B91">37.8-3 LinesOfStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X820A592881D57802">37.8-4 NrInputsOfStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7847D32B863E822F">37.8-5 ResultOfStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8098EAAF7D344466">37.8-6 StringOfResultOfStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8274C7948248C053">37.8-7 CompositionOfStraightLinePrograms</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7A582FA97C786640">37.8-8 IntegratedStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7C9CABD17BE4850F">37.8-9 RestrictOutputsOfSLP</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7EF202F17DCA5D1C">37.8-10 IntermediateResultOfSLP</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X8085CF79856B2889">37.8-11 IntermediateResultOfSLPWithoutOverwrite</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X873244F37FAA717A">37.8-12 IntermediateResultsOfSLPWithoutOverwrite</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X837101F982C35035">37.8-13 ProductOfStraightLinePrograms</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X84C83CE98194FD03">37.8-14 SlotUsagePattern</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap37.html#X8188799182D82A92">37.9 <span class="Heading">Straight Line Program Elements</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X85A5838482944FA5">37.9-1 IsStraightLineProgElm</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X78889E5B7E1B3BFF">37.9-2 StraightLineProgElm</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X81BC263A7E45E775">37.9-3 StraightLineProgGens</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7BEAE8AC809B27DC">37.9-4 EvalStraightLineProgElm</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap37.html#X7D85D1DF84DC68E3">37.9-5 StretchImportantSLPElement</a></span>
</div></div>
</div>

<h3>37 <span class="Heading">Associative Words</span></h3>

<p><a id="X7AB546CB7B929253" name="X7AB546CB7B929253"></a></p>

<h4>37.1 <span class="Heading">Categories of Associative Words</span></h4>

<p>Associative words are used to represent elements in free groups, semigroups and monoids in <strong class="pkg">GAP</strong> (see <a href="chap37.html#X82E7EA7F7FD31EC3"><span class="RefLink">37.2</span></a>). An associative word is just a sequence of letters, where each letter is an element of an alphabet (in the following called a <em>generator</em>) or its inverse. Associative words can be multiplied; in free monoids also the computation of an identity is permitted, in free groups also the computation of inverses (see <a href="chap37.html#X79AF6C757A3547BD"><span class="RefLink">37.4</span></a>).</p>

<p>Different alphabets correspond to different families of associative words. There is no relation whatsoever between words in different families.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:= FreeGroup( "a", "b", "c" );</span>
&lt;free group on the generators [ a, b, c ]&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">gens:= GeneratorsOfGroup(f);</span>
[ a, b, c ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w:= gens[1]*gens[2]/gens[3]*gens[2]*gens[1]/gens[1]*gens[3]/gens[2];</span>
a*b*c^-1*b*c*b^-1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w^-1;</span>
b*c^-1*b^-1*c*b^-1*a^-1
</pre></div>

<p>Words are displayed as products of letters. The letters are usually printed like <code class="code">f1</code>, <code class="code">f2</code>, <span class="SimpleMath">...</span>, but it is possible to give user defined names to them, which can be arbitrary strings. These names do not necessarily identify a unique letter (generator), it is possible to have several letters –even in the same family– that are displayed in the same way. Note also that <em>there is no relation between the names of letters and variable names</em>. In the example above, we might have typed</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a:= f.1;; b:= f.2;; c:= f.3;;</span>
</pre></div>

<p>(<em>Interactively</em>, the function <code class="func">AssignGeneratorVariables</code> (<a href="chap37.html#X814203E281F3272E"><span class="RefLink">37.2-3</span></a>) provides a shorthand for this.) This allows us to define <code class="code">w</code> more conveniently:</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w := a*b/c*b*a/a*c/b;</span>
a*b*c^-1*b*c*b^-1
</pre></div>

<p>Using homomorphisms it is possible to express elements of a group as words in terms of generators, see <a href="chap39.html#X7E19F92284F6684E"><span class="RefLink">39.5</span></a>.</p>

<p><a id="X7FA8DA728773BA89" name="X7FA8DA728773BA89"></a></p>

<h5>37.1-1 IsAssocWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsAssocWord</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsAssocWordWithOne</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsAssocWordWithInverse</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<p><code class="func">IsAssocWord</code> is the category of associative words in free semigroups, <code class="func">IsAssocWordWithOne</code> is the category of associative words in free monoids (which admit the operation <code class="func">One</code> (<a href="chap31.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>) to compute an identity), <code class="func">IsAssocWordWithInverse</code> is the category of associative words in free groups (which have an inverse). See <code class="func">IsWord</code> (<a href="chap36.html#X843F5C3A82239398"><span class="RefLink">36.1-1</span></a>) for more general categories of words.</p>

<p><a id="X82E7EA7F7FD31EC3" name="X82E7EA7F7FD31EC3"></a></p>

<h4>37.2 <span class="Heading">Free Groups, Monoids and Semigroups</span></h4>

<p>Usually a family of associative words will be generated by constructing the free object generated by them. See <code class="func">FreeMonoid</code> (<a href="chap51.html#X79FA3FA978CA2E43"><span class="RefLink">51.2-9</span></a>), <code class="func">FreeSemigroup</code> (<a href="chap51.html#X7C72E4747BF642BB"><span class="RefLink">51.1-10</span></a>) for details.</p>

<p><a id="X8215999E835290F0" name="X8215999E835290F0"></a></p>

<h5>37.2-1 <span class="Heading">FreeGroup</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FreeGroup</code>( [<var class="Arg">wfilt</var>, ]<var class="Arg">rank</var>[, <var class="Arg">name</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FreeGroup</code>( [<var class="Arg">wfilt</var>, ]<var class="Arg">name1</var>, <var class="Arg">name2</var>, <var class="Arg">...</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FreeGroup</code>( [<var class="Arg">wfilt</var>, ]<var class="Arg">names</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FreeGroup</code>( [<var class="Arg">wfilt</var>, ]<var class="Arg">infinity</var>, <var class="Arg">name</var>, <var class="Arg">init</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>Called with a positive integer <var class="Arg">rank</var>, <code class="func">FreeGroup</code> returns a free group on <var class="Arg">rank</var> generators. If the optional argument <var class="Arg">name</var> is given then the generators are printed as <var class="Arg">name</var><code class="code">1</code>, <var class="Arg">name</var><code class="code">2</code> etc., that is, each name is the concatenation of the string <var class="Arg">name</var> and an integer from <code class="code">1</code> to <var class="Arg">range</var>. The default for <var class="Arg">name</var> is the string <code class="code">"f"</code>.</p>

<p>Called in the second form, <code class="func">FreeGroup</code> returns a free group on as many generators as arguments, printed as <var class="Arg">name1</var>, <var class="Arg">name2</var> etc.</p>

<p>Called in the third form, <code class="func">FreeGroup</code> returns a free group on as many generators as the length of the list <var class="Arg">names</var>, the <span class="SimpleMath">i</span>-th generator being printed as <var class="Arg">names</var><code class="code">[</code><span class="SimpleMath">i</span><code class="code">]</code>.</p>

<p>Called in the fourth form, <code class="func">FreeGroup</code> returns a free group on infinitely many generators, where the first generators are printed by the names in the list <var class="Arg">init</var>, and the other generators by <var class="Arg">name</var> and an appended number.</p>

<p>If the extra argument <var class="Arg">wfilt</var> is given, it must be either <code class="code">IsSyllableWordsFamily</code> or <code class="code">IsLetterWordsFamily</code> or <code class="code">IsWLetterWordsFamily</code> or <code class="code">IsBLetterWordsFamily</code>. This filter then specifies the representation used for the elements of the free group (see <a href="chap37.html#X80A9F39582ED296E"><span class="RefLink">37.6</span></a>). If no such filter is given, a letter representation is used.</p>

<p>(For interfacing to old code that omits the representation flag, use of the syllable representation is also triggered by setting the option <code class="code">FreeGroupFamilyType</code> to the string <code class="code">"syllable"</code>.)</p>

<p><a id="X8601654A7C4AF1E7" name="X8601654A7C4AF1E7"></a></p>

<h5>37.2-2 IsFreeGroup</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsFreeGroup</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<p>Any group consisting of elements in <code class="func">IsAssocWordWithInverse</code> (<a href="chap37.html#X7FA8DA728773BA89"><span class="RefLink">37.1-1</span></a>) lies in the filter <code class="func">IsFreeGroup</code>; this holds in particular for any group created with <code class="func">FreeGroup</code> (<a href="chap37.html#X8215999E835290F0"><span class="RefLink">37.2-1</span></a>), or any subgroup of such a group.</p>

<p>Also see Chapter <a href="chap47.html#X7AA982637E90B35A"><span class="RefLink">47</span></a>.</p>

<p><a id="X814203E281F3272E" name="X814203E281F3272E"></a></p>

<h5>37.2-3 AssignGeneratorVariables</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AssignGeneratorVariables</code>( <var class="Arg">G</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>If <var class="Arg">G</var> is a group, whose generators are represented by symbols (for example a free group, a finitely presented group or a pc group) this function assigns these generators to global variables with the same names.</p>

<p>The aim of this function is to make it easy in interactive use to work with (for example) a free group. It is a shorthand for a sequence of assignments of the form</p>


<div class="example"><pre>
var1:=GeneratorsOfGroup(G)[1];
var2:=GeneratorsOfGroup(G)[2];
...
varn:=GeneratorsOfGroup(G)[n];
</pre></div>

<p>However, since overwriting global variables can be very dangerous, <em>it is not permitted to use this function within a function</em>. (If –despite this warning– this is done, the result is undefined.)</p>

<p>If the assignment overwrites existing variables a warning is given, if any of the variables if write protected, or any of the generator names would not be a proper variable name, an error is raised.</p>

<p><a id="X8405BECB7AC4EB61" name="X8405BECB7AC4EB61"></a></p>

<h4>37.3 <span class="Heading">Comparison of Associative Words</span></h4>

<p><a id="X8206153078E97B90" name="X8206153078E97B90"></a></p>

<h5><code>37.3-1 \=</code></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; \=</code>( <var class="Arg">w1</var>, <var class="Arg">w2</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>Two associative words are equal if they are words over the same alphabet and if they are sequences of the same letters. This is equivalent to saying that the external representations of the words are equal, see <a href="chap37.html#X7934D3D5797102EC"><span class="RefLink">37.7</span></a> and <a href="chap36.html#X852C815F85DBE4BD"><span class="RefLink">36.2</span></a>.</p>

<p>There is no "universal" empty word, every alphabet (that is, every family of words) has its own empty word.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:= FreeGroup( "a", "b", "b" );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">gens:= GeneratorsOfGroup(f);</span>
[ a, b, b ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">gens[2] = gens[3];</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x:= gens[1]*gens[2];</span>
a*b
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">y:= gens[2]/gens[2]*gens[1]*gens[2];</span>
a*b
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x = y;</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">z:= gens[2]/gens[2]*gens[1]*gens[3];</span>
a*b
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x = z;</span>
false
</pre></div>

<p><a id="X7BB12B9D7F990899" name="X7BB12B9D7F990899"></a></p>

<h5><code>37.3-2 \&lt;</code></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; \&lt;</code>( <var class="Arg">w1</var>, <var class="Arg">w2</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>The ordering of associative words is defined by length and lexicography (this ordering is called <em>short-lex</em> ordering), that is, shorter words are smaller than longer words, and words of the same length are compared w.r.t. the lexicographical ordering induced by the ordering of generators. Generators are sorted according to the order in which they were created. If the generators are invertible then each generator <var class="Arg">g</var> is larger than its inverse <var class="Arg">g</var><code class="code">^-1</code>, and <var class="Arg">g</var><code class="code">^-1</code> is larger than every generator that is smaller than <var class="Arg">g</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:= FreeGroup( 2 );;  gens:= GeneratorsOfGroup( f );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a:= gens[1];;  b:= gens[2];;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">One(f) &lt; a^-1;  a^-1 &lt; a;  a &lt; b^-1;  b^-1 &lt; b; b &lt; a^2;  a^2 &lt; a*b;</span>
true
true
true
true
true
true
</pre></div>

<p><a id="X805C519682B0A7ED" name="X805C519682B0A7ED"></a></p>

<h5>37.3-3 IsShortLexLessThanOrEqual</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsShortLexLessThanOrEqual</code>( <var class="Arg">u</var>, <var class="Arg">v</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns <code class="code">IsLessThanOrEqualUnder(<var class="Arg">ord</var>, <var class="Arg">u</var>, <var class="Arg">v</var>)</code> where <var class="Arg">ord</var> is the short less ordering for the family of <var class="Arg">u</var> and <var class="Arg">v</var>. (This is here for compatibility with <strong class="pkg">GAP</strong> 4.2.)</p>

<p><a id="X84875E08847B39E1" name="X84875E08847B39E1"></a></p>

<h5>37.3-4 IsBasicWreathLessThanOrEqual</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsBasicWreathLessThanOrEqual</code>( <var class="Arg">u</var>, <var class="Arg">v</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns <code class="code">IsLessThanOrEqualUnder(<var class="Arg">ord</var>, <var class="Arg">u</var>, <var class="Arg">v</var>)</code> where <var class="Arg">ord</var> is the basic wreath product ordering for the family of <var class="Arg">u</var> and <var class="Arg">v</var>. (This is here for compatibility with <strong class="pkg">GAP</strong> 4.2.)</p>

<p><a id="X79AF6C757A3547BD" name="X79AF6C757A3547BD"></a></p>

<h4>37.4 <span class="Heading">Operations for Associative Words</span></h4>

<p>The product of two given associative words is defined as the freely reduced concatenation of the words. Besides the multiplication <code class="func">\*</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>), the arithmetical operators <code class="func">One</code> (<a href="chap31.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>) (if the word lies in a family with identity) and (if the generators are invertible) <code class="func">Inverse</code> (<a href="chap31.html#X78EE524E83624057"><span class="RefLink">31.10-8</span></a>), <code class="func">\/</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>),<code class="func">\^</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>), <code class="func">Comm</code> (<a href="chap31.html#X80761843831B468E"><span class="RefLink">31.12-3</span></a>), and <code class="func">LeftQuotient</code> (<a href="chap31.html#X7A37082878DB3930"><span class="RefLink">31.12-2</span></a>) are applicable to associative words, see <a href="chap31.html#X7A2914307963E370"><span class="RefLink">31.12</span></a>.</p>

<p>See also <code class="func">MappedWord</code> (<a href="chap36.html#X7EC17930781D104A"><span class="RefLink">36.3-1</span></a>), an operation that is applicable to arbitrary words.</p>

<p>See Section <a href="chap37.html#X80A9F39582ED296E"><span class="RefLink">37.6</span></a> for a discussion of the internal representations of associative words that are supported by <strong class="pkg">GAP</strong>. Note that operations to extract or act on parts of words (letter or syllables) can carry substantially different costs, depending on the representation the words are in.</p>

<p><a id="X8680FCAD83019E70" name="X8680FCAD83019E70"></a></p>

<h5>37.4-1 Length</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Length</code>( <var class="Arg">w</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
<p>For an associative word <var class="Arg">w</var>, <code class="func">Length</code> returns the number of letters in <var class="Arg">w</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f := FreeGroup("a","b");; gens := GeneratorsOfGroup(f);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a := gens[1];; b := gens[2];;w := a^5*b*a^2*b^-4*a;;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput"> w; Length( w );  Length( a^17 );  Length( w^0 );</span>
a^5*b*a^2*b^-4*a
13
17
0
</pre></div>

<p><a id="X7F5ED4357A9C12E6" name="X7F5ED4357A9C12E6"></a></p>

<h5>37.4-2 ExponentSumWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ExponentSumWord</code>( <var class="Arg">w</var>, <var class="Arg">gen</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>For an associative word <var class="Arg">w</var> and a generator <var class="Arg">gen</var>, <code class="func">ExponentSumWord</code> returns the number of times <var class="Arg">gen</var> appears in <var class="Arg">w</var> minus the number of times its inverse appears in <var class="Arg">w</var>. If both <var class="Arg">gen</var> and its inverse do not occur in <var class="Arg">w</var> then <span class="SimpleMath">0</span> is returned. <var class="Arg">gen</var> may also be the inverse of a generator.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w;  ExponentSumWord( w, a );  ExponentSumWord( w, b );</span>
a^5*b*a^2*b^-4*a
8
-3
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ExponentSumWord( (a*b*a^-1)^3, a );  ExponentSumWord( w, b^-1 );</span>
0
3
</pre></div>

<p><a id="X82CC92C17AF6FFA0" name="X82CC92C17AF6FFA0"></a></p>

<h5>37.4-3 Subword</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Subword</code>( <var class="Arg">w</var>, <var class="Arg">from</var>, <var class="Arg">to</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>For an associative word <var class="Arg">w</var> and two positive integers <var class="Arg">from</var> and <var class="Arg">to</var>, <code class="func">Subword</code> returns the subword of <var class="Arg">w</var> that begins at position <var class="Arg">from</var> and ends at position <var class="Arg">to</var>. Indexing is done with origin 1.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w;  Subword( w, 3, 7 );</span>
a^5*b*a^2*b^-4*a
a^3*b*a
</pre></div>

<p><a id="X8509A0A4851981BB" name="X8509A0A4851981BB"></a></p>

<h5>37.4-4 PositionWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PositionWord</code>( <var class="Arg">w</var>, <var class="Arg">sub</var>, <var class="Arg">from</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>Let <var class="Arg">w</var> and <var class="Arg">sub</var> be associative words, and <var class="Arg">from</var> a positive integer. <code class="func">PositionWord</code> returns the position of the first occurrence of <var class="Arg">sub</var> as a subword of <var class="Arg">w</var>, starting at position <var class="Arg">from</var>. If there is no such occurrence, <code class="keyw">fail</code> is returned. Indexing is done with origin 1.</p>

<p>In other words, <code class="code">PositionWord( <var class="Arg">w</var>, <var class="Arg">sub</var>, <var class="Arg">from</var> )</code> is the smallest integer <span class="SimpleMath">i</span> larger than or equal to <var class="Arg">from</var> such that <code class="code">Subword( <var class="Arg">w</var>, </code><span class="SimpleMath">i</span><code class="code">,</code> <span class="SimpleMath">i</span><code class="code">+Length( <var class="Arg">sub</var> )-1 ) =</code> <var class="Arg">sub</var>, see <code class="func">Subword</code> (<a href="chap37.html#X82CC92C17AF6FFA0"><span class="RefLink">37.4-3</span></a>).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w;  PositionWord( w, a/b, 1 );</span>
a^5*b*a^2*b^-4*a
8
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Subword( w, 8, 9 );</span>
a*b^-1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PositionWord( w, a^2, 1 );</span>
1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PositionWord( w, a^2, 2 );</span>
2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PositionWord( w, a^2, 6 );</span>
7
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PositionWord( w, a^2, 8 );</span>
fail
</pre></div>

<p><a id="X79186218787C224A" name="X79186218787C224A"></a></p>

<h5>37.4-5 <span class="Heading">SubstitutedWord</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SubstitutedWord</code>( <var class="Arg">w</var>, <var class="Arg">from</var>, <var class="Arg">to</var>, <var class="Arg">by</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SubstitutedWord</code>( <var class="Arg">w</var>, <var class="Arg">sub</var>, <var class="Arg">from</var>, <var class="Arg">by</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>Let <var class="Arg">w</var> be an associative word.</p>

<p>In the first form, <code class="func">SubstitutedWord</code> returns the associative word obtained by replacing the subword of <var class="Arg">w</var> that begins at position <var class="Arg">from</var> and ends at position <var class="Arg">to</var> by the associative word <var class="Arg">by</var>. <var class="Arg">from</var> and <var class="Arg">to</var> must be positive integers, indexing is done with origin 1. In other words, <code class="code">SubstitutedWord( <var class="Arg">w</var>, <var class="Arg">from</var>, <var class="Arg">to</var>, <var class="Arg">by</var> )</code> is the product of the three words <code class="code">Subword( <var class="Arg">w</var>, 1, <var class="Arg">from</var>-1 )</code>, <var class="Arg">by</var>, and <code class="code">Subword( <var class="Arg">w</var>, <var class="Arg">to</var>+1, Length( <var class="Arg">w</var> ) )</code>, see <code class="func">Subword</code> (<a href="chap37.html#X82CC92C17AF6FFA0"><span class="RefLink">37.4-3</span></a>).</p>

<p>In the second form, <code class="func">SubstitutedWord</code> returns the associative word obtained by replacing the first occurrence of the associative word <var class="Arg">sub</var> of <var class="Arg">w</var>, starting at position <var class="Arg">from</var>, by the associative word <var class="Arg">by</var>; if there is no such occurrence, <code class="keyw">fail</code> is returned.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w;  SubstitutedWord( w, 3, 7, a^19 );</span>
a^5*b*a^2*b^-4*a
a^22*b^-4*a
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SubstitutedWord( w, a, 6, b^7 );</span>
a^5*b^8*a*b^-4*a
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SubstitutedWord( w, a*b, 6, b^7 );</span>
fail
</pre></div>

<p><a id="X8486BFE1844CFE59" name="X8486BFE1844CFE59"></a></p>

<h5>37.4-6 EliminatedWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EliminatedWord</code>( <var class="Arg">w</var>, <var class="Arg">gen</var>, <var class="Arg">by</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>For an associative word <var class="Arg">w</var>, a generator <var class="Arg">gen</var>, and an associative word <var class="Arg">by</var>, <code class="func">EliminatedWord</code> returns the associative word obtained by replacing each occurrence of <var class="Arg">gen</var> in <var class="Arg">w</var> by <var class="Arg">by</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w;  EliminatedWord( w, a, a^2 );  EliminatedWord( w, a, b^-1 );</span>
a^5*b*a^2*b^-4*a
a^10*b*a^4*b^-4*a^2
b^-11
</pre></div>

<p><a id="X7D357E047ABD2C6B" name="X7D357E047ABD2C6B"></a></p>

<h4>37.5 <span class="Heading">Operations for Associative Words by their Syllables</span></h4>

<p>For an associative word <var class="Arg">w</var> <span class="SimpleMath">= x_1^{n_1} x_2^{n_2} ⋯ x_k^{n_k}</span> over an alphabet containing <span class="SimpleMath">x_1, x_2, ..., x_k</span>, such that <span class="SimpleMath">x_i ≠ x_{i+1}^{± 1}</span> for <span class="SimpleMath">1 ≤ i ≤ k-1</span>, the subwords <span class="SimpleMath">x_i^{e_i}</span> are uniquely determined; these powers of generators are called the <em>syllables</em> of <span class="SimpleMath">w</span>.</p>

<p><a id="X842D0B547CE93CF2" name="X842D0B547CE93CF2"></a></p>

<h5>37.5-1 NumberSyllables</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NumberSyllables</code>( <var class="Arg">w</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
<p><code class="func">NumberSyllables</code> returns the number of syllables of the associative word <var class="Arg">w</var>.</p>

<p><a id="X7E91575F848F4526" name="X7E91575F848F4526"></a></p>

<h5>37.5-2 ExponentSyllable</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ExponentSyllable</code>( <var class="Arg">w</var>, <var class="Arg">i</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p><code class="func">ExponentSyllable</code> returns the exponent of the <var class="Arg">i</var>-th syllable of the associative word <var class="Arg">w</var>.</p>

<p><a id="X7F2A8CFD811C73B1" name="X7F2A8CFD811C73B1"></a></p>

<h5>37.5-3 GeneratorSyllable</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GeneratorSyllable</code>( <var class="Arg">w</var>, <var class="Arg">i</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p><code class="func">GeneratorSyllable</code> returns the number of the generator that is involved in the <var class="Arg">i</var>-th syllable of the associative word <var class="Arg">w</var>.</p>

<p><a id="X7B4F7A167E844FA5" name="X7B4F7A167E844FA5"></a></p>

<h5>37.5-4 SubSyllables</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SubSyllables</code>( <var class="Arg">w</var>, <var class="Arg">from</var>, <var class="Arg">to</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p><code class="func">SubSyllables</code> returns the subword of the associative word <var class="Arg">w</var> that consists of the syllables from positions <var class="Arg">from</var> to <var class="Arg">to</var>, where <var class="Arg">from</var> and <var class="Arg">to</var> must be positive integers, and indexing is done with origin 1.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w;  NumberSyllables( w );</span>
a^5*b*a^2*b^-4*a
5
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ExponentSyllable( w, 3 );</span>
2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">GeneratorSyllable( w, 3 );</span>
1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SubSyllables( w, 2, 3 );</span>
b*a^2
</pre></div>

<p><a id="X80A9F39582ED296E" name="X80A9F39582ED296E"></a></p>

<h4>37.6 <span class="Heading">Representations for Associative Words</span></h4>

<p><strong class="pkg">GAP</strong> provides two different internal kinds of representations of associative words. The first one are "syllable representations" in which words are stored in syllable (i.e. generator,exponent) form. (Older versions of <strong class="pkg">GAP</strong> only used this representation.) The second kind are "letter representations" in which each letter in a word is represented by its index number. Negative numbers are used for inverses. Unless the syllable representation is specified explicitly when creating the free group/monoid or semigroup, a letter representation is used by default.</p>

<p>Depending on the task in mind, either of these two representations will perform better in time or in memory use and algorithms that are syllable or letter based (for example <code class="func">GeneratorSyllable</code> (<a href="chap37.html#X7F2A8CFD811C73B1"><span class="RefLink">37.5-3</span></a>) and <code class="func">Subword</code> (<a href="chap37.html#X82CC92C17AF6FFA0"><span class="RefLink">37.4-3</span></a>)) perform substantially better in the corresponding representation. For example when creating pc groups (see <a href="chap46.html#X7EAD57C97EBF7E67"><span class="RefLink">46</span></a>), it is advantageous to use a syllable representation while calculations in free groups usually benefit from using a letter representation.</p>

<p><a id="X7E3612247B3E241B" name="X7E3612247B3E241B"></a></p>

<h5>37.6-1 IsLetterAssocWordRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsLetterAssocWordRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;representation&nbsp;)</td></tr></table></div>
<p>A word in letter representation stores a list of generator/inverses numbers (as given by <code class="func">LetterRepAssocWord</code> (<a href="chap37.html#X7BD7647C7B088389"><span class="RefLink">37.6-8</span></a>)). Letter access is fast, syllable access is slow for such words.</p>

<p><a id="X7E36F7897D82417F" name="X7E36F7897D82417F"></a></p>

<h5>37.6-2 IsLetterWordsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsLetterWordsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<p>A letter word family stores words by default in letter form.</p>

<p>Internally, there are letter representations that use integers (4 Byte) to represent a generator and letter representations that use single bytes to represent a character. The latter are more memory efficient, but can only be used if there are less than 128 generators (in which case they are used by default).</p>

<p><a id="X7C84789D7BB161E9" name="X7C84789D7BB161E9"></a></p>

<h5>37.6-3 IsBLetterAssocWordRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsBLetterAssocWordRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;representation&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsWLetterAssocWordRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;representation&nbsp;)</td></tr></table></div>
<p>these two subrepresentations of <code class="func">IsLetterAssocWordRep</code> (<a href="chap37.html#X7E3612247B3E241B"><span class="RefLink">37.6-1</span></a>) indicate whether the word is stored as a list of bytes (in a string) or as a list of integers).</p>

<p><a id="X8719E7F27CDA1995" name="X8719E7F27CDA1995"></a></p>

<h5>37.6-4 IsBLetterWordsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsBLetterWordsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsWLetterWordsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<p>These two subcategories of <code class="func">IsLetterWordsFamily</code> (<a href="chap37.html#X7E36F7897D82417F"><span class="RefLink">37.6-2</span></a>) specify the type of letter representation to be used.</p>

<p><a id="X7886F8BD83CD8081" name="X7886F8BD83CD8081"></a></p>

<h5>37.6-5 IsSyllableAssocWordRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsSyllableAssocWordRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;representation&nbsp;)</td></tr></table></div>
<p>A word in syllable representation stores generator/exponents pairs (as given by <code class="func">ExtRepOfObj</code> (<a href="chap79.html#X8542B32A8206118C"><span class="RefLink">79.16-1</span></a>). Syllable access is fast, letter access is slow for such words.</p>

<p><a id="X7869716C84EA9D81" name="X7869716C84EA9D81"></a></p>

<h5>37.6-6 IsSyllableWordsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsSyllableWordsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<p>A syllable word family stores words by default in syllable form. There are also different versions of syllable representations, which compress a generator exponent pair in 8, 16 or 32 bits or use a pair of integers. Internal mechanisms try to make this as memory efficient as possible.</p>

<p><a id="X83F669828481FC32" name="X83F669828481FC32"></a></p>

<h5>37.6-7 Is16BitsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Is16BitsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Is32BitsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsInfBitsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<p>Regardless of the internal representation used, it is possible to convert a word in a list of numbers in letter or syllable representation and vice versa.</p>

<p><a id="X7BD7647C7B088389" name="X7BD7647C7B088389"></a></p>

<h5>37.6-8 LetterRepAssocWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LetterRepAssocWord</code>( <var class="Arg">w</var>[, <var class="Arg">gens</var>] )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>The <em>letter representation</em> of an associated word is as a list of integers, each entry corresponding to a group generator. Inverses of the generators are represented by negative numbers. The generator numbers are as associated to the family.</p>

<p>This operation returns the letter representation of the associative word <var class="Arg">w</var>.</p>

<p>In the call with two arguments, the generator numbers correspond to the generator order given in the list <var class="Arg">gens</var>.</p>

<p>(For words stored in syllable form the letter representation has to be computed.)</p>

<p><a id="X7AC8EC757CFB9A51" name="X7AC8EC757CFB9A51"></a></p>

<h5>37.6-9 AssocWordByLetterRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AssocWordByLetterRep</code>( <var class="Arg">Fam</var>, <var class="Arg">lrep</var>[, <var class="Arg">gens</var>] )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>takes a letter representation <var class="Arg">lrep</var> (see <code class="func">LetterRepAssocWord</code> (<a href="chap37.html#X7BD7647C7B088389"><span class="RefLink">37.6-8</span></a>)) and returns an associative word in family <var class="Arg">fam</var> corresponding to this letter representation.</p>

<p>If <var class="Arg">gens</var> is given, the numbers in the letter representation correspond to <var class="Arg">gens</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w:=AssocWordByLetterRep( FamilyObj(a), [-1,2,1,-2,-2,-2,1,1,1,1]);</span>
a^-1*b*a*b^-3*a^4
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LetterRepAssocWord( w^2 );</span>
[ -1, 2, 1, -2, -2, -2, 1, 1, 1, 2, 1, -2, -2, -2, 1, 1, 1, 1 ]
</pre></div>

<p>The external representation (see section <a href="chap37.html#X7934D3D5797102EC"><span class="RefLink">37.7</span></a>) can be used if a syllable representation is needed.</p>

<p><a id="X7934D3D5797102EC" name="X7934D3D5797102EC"></a></p>

<h4>37.7 <span class="Heading">The External Representation for Associative Words</span></h4>

<p>The external representation of the associative word <span class="SimpleMath">w</span> is defined as follows. If <span class="SimpleMath">w = g_{i_1}^{e_1} * g_{i_2}^{e_2} * ⋯ * g_{i_k}^{e_k}</span> is a word over the alphabet <span class="SimpleMath">g_1, g_2, ...</span>, i.e., <span class="SimpleMath">g_i</span> denotes the <span class="SimpleMath">i</span>-th generator of the family of <span class="SimpleMath">w</span>, then <span class="SimpleMath">w</span> has external representation <span class="SimpleMath">[ i_1, e_1, i_2, e_2, ..., i_k, e_k ]</span>. The empty list describes the identity element (if exists) of the family. Exponents may be negative if the family allows inverses. The external representation of an associative word is guaranteed to be freely reduced; for example, <span class="SimpleMath">g_1 * g_2 * g_2^{-1} * g_1</span> has the external representation <code class="code">[ 1, 2 ]</code>.</p>

<p>Regardless of the family preference for letter or syllable representations (see <a href="chap37.html#X80A9F39582ED296E"><span class="RefLink">37.6</span></a>), <code class="code">ExtRepOfObj</code> and <code class="code">ObjByExtRep</code> can be used and interface to this "syllable"-like representation.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">w:= ObjByExtRep( FamilyObj(a), [1,5,2,-7,1,3,2,4,1,-2] );</span>
a^5*b^-7*a^3*b^4*a^-2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ExtRepOfObj( w^2 );</span>
[ 1, 5, 2, -7, 1, 3, 2, 4, 1, 3, 2, -7, 1, 3, 2, 4, 1, -2 ]
</pre></div>

<p><a id="X7DC99E4284093FBB" name="X7DC99E4284093FBB"></a></p>

<h4>37.8 <span class="Heading">Straight Line Programs</span></h4>

<p><em>Straight line programs</em> describe an efficient way for evaluating an abstract word at concrete generators, in a more efficient way than with <code class="func">MappedWord</code> (<a href="chap36.html#X7EC17930781D104A"><span class="RefLink">36.3-1</span></a>). For example, the associative word <span class="SimpleMath">ababbab</span> of length <span class="SimpleMath">7</span> can be computed from the generators <span class="SimpleMath">a</span>, <span class="SimpleMath">b</span> with only four multiplications, by first computing <span class="SimpleMath">c = ab</span>, then <span class="SimpleMath">d = cb</span>, and then <span class="SimpleMath">cdc</span>; Alternatively, one can compute <span class="SimpleMath">c = ab</span>, <span class="SimpleMath">e = bc</span>, and <span class="SimpleMath">aee</span>. In each step of these computations, one forms words in terms of the words computed in the previous steps.</p>

<p>A straight line program in <strong class="pkg">GAP</strong> is represented by an object in the category <code class="func">IsStraightLineProgram</code> (<a href="chap37.html#X7F69FF3F7C6694CB"><span class="RefLink">37.8-1</span></a>)) that stores a list of "lines" each of which has one of the following three forms.</p>

<ol>
<li><p>a nonempty dense list <span class="SimpleMath">l</span> of integers,</p>

</li>
<li><p>a pair <span class="SimpleMath">[ l, i ]</span> where <span class="SimpleMath">l</span> is a list of form 1. and <span class="SimpleMath">i</span> is a positive integer,</p>

</li>
<li><p>a list <span class="SimpleMath">[ l_1, l_2, ..., l_k ]</span> where each <span class="SimpleMath">l_i</span> is a list of form 1.; this may occur only for the last line of the program.</p>

</li>
</ol>
<p>The lists of integers that occur are interpreted as external representations of associative words (see Section  <a href="chap37.html#X7934D3D5797102EC"><span class="RefLink">37.7</span></a>); for example, the list <span class="SimpleMath">[ 1, 3, 2, -1 ]</span> represents the word <span class="SimpleMath">g_1^3 g_2^{-1}</span>, with <span class="SimpleMath">g_1</span> and <span class="SimpleMath">g_2</span> the first and second abstract generator, respectively.</p>

<p>For the meaning of the list of lines, see <code class="func">ResultOfStraightLineProgram</code> (<a href="chap37.html#X7847D32B863E822F"><span class="RefLink">37.8-5</span></a>).</p>

<p>Straight line programs can be constructed using <code class="func">StraightLineProgram</code> (<a href="chap37.html#X7AECA57280DA3195"><span class="RefLink">37.8-2</span></a>).</p>

<p>Defining attributes for straight line programs are <code class="func">NrInputsOfStraightLineProgram</code> (<a href="chap37.html#X820A592881D57802"><span class="RefLink">37.8-4</span></a>) and <code class="func">LinesOfStraightLineProgram</code> (<a href="chap37.html#X81A8AFC47F8E4B91"><span class="RefLink">37.8-3</span></a>). Another operation for straight line programs is <code class="func">ResultOfStraightLineProgram</code> (<a href="chap37.html#X7847D32B863E822F"><span class="RefLink">37.8-5</span></a>).</p>

<p>Special methods applicable to straight line programs are installed for the operations <code class="func">Display</code> (<a href="chap6.html#X83A5C59278E13248"><span class="RefLink">6.3-6</span></a>), <code class="func">IsInternallyConsistent</code> (<a href="chap12.html#X7F6C5C3287E8B816"><span class="RefLink">12.8-4</span></a>), <code class="func">PrintObj</code> (<a href="chap6.html#X815BF22186FD43C9"><span class="RefLink">6.3-5</span></a>), and <code class="func">ViewObj</code> (<a href="chap6.html#X815BF22186FD43C9"><span class="RefLink">6.3-5</span></a>).</p>

<p>For a straight line program <var class="Arg">prog</var>, the default <code class="func">Display</code> (<a href="chap6.html#X83A5C59278E13248"><span class="RefLink">6.3-6</span></a>) method prints the interpretation of <var class="Arg">prog</var> as a sequence of assignments of associative words; a record with components <code class="code">gensnames</code> (with value a list of strings) and <code class="code">listname</code> (a string) may be entered as second argument of <code class="func">Display</code> (<a href="chap6.html#X83A5C59278E13248"><span class="RefLink">6.3-6</span></a>), in this case these names are used, the default for <code class="code">gensnames</code> is <code class="code">[ g1, g2, </code><span class="SimpleMath">...</span><code class="code"> ]</code>, the default for <code class="code">listname</code> is <span class="SimpleMath">r</span>.</p>

<p><a id="X7F69FF3F7C6694CB" name="X7F69FF3F7C6694CB"></a></p>

<h5>37.8-1 IsStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsStraightLineProgram</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
<p>Each straight line program in <strong class="pkg">GAP</strong> lies in the category <code class="func">IsStraightLineProgram</code>.</p>

<p><a id="X7AECA57280DA3195" name="X7AECA57280DA3195"></a></p>

<h5>37.8-2 StraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StraightLineProgram</code>( <var class="Arg">lines</var>[, <var class="Arg">nrgens</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StraightLineProgram</code>( <var class="Arg">string</var>, <var class="Arg">gens</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StraightLineProgramNC</code>( <var class="Arg">lines</var>[, <var class="Arg">nrgens</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StraightLineProgramNC</code>( <var class="Arg">string</var>, <var class="Arg">gens</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>In the first form, <var class="Arg">lines</var> must be a list of lists that defines a unique straight line program (see <code class="func">IsStraightLineProgram</code> (<a href="chap37.html#X7F69FF3F7C6694CB"><span class="RefLink">37.8-1</span></a>)); in this case <code class="func">StraightLineProgram</code> returns this program, otherwise an error is signalled. The optional argument <var class="Arg">nrgens</var> specifies the number of input generators of the program; if a line of form 1. (that is, a list of integers) occurs in <var class="Arg">lines</var> except in the last position, this number is not determined by <var class="Arg">lines</var> and therefore <em>must</em> be specified by the argument <var class="Arg">nrgens</var>; if not then <code class="func">StraightLineProgram</code> returns <code class="keyw">fail</code>.</p>

<p>In the second form, <var class="Arg">string</var> must be a string describing an arithmetic expression in terms of the strings in the list <var class="Arg">gens</var>, where multiplication is denoted by concatenation, powering is denoted by <code class="code">^</code>, and round brackets <code class="code">(</code>, <code class="code">)</code> may be used. Each entry in <var class="Arg">gens</var> must consist only of uppercase or lowercase letters (i.e., letters in <code class="func">IsAlphaChar</code> (<a href="chap27.html#X84634DF67A431D26"><span class="RefLink">27.5-4</span></a>)) such that no entry is an initial part of another one. Called with this input, <code class="func">StraightLineProgram</code> returns a straight line program that evaluates to the word corresponding to <var class="Arg">string</var> when called with generators corresponding to <var class="Arg">gens</var>.</p>

<p>The <code class="code">NC</code> variant does the same, except that the internal consistency of the program is not checked.</p>

<p><a id="X81A8AFC47F8E4B91" name="X81A8AFC47F8E4B91"></a></p>

<h5>37.8-3 LinesOfStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LinesOfStraightLineProgram</code>( <var class="Arg">prog</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
<p>For a straight line program <var class="Arg">prog</var>, <code class="func">LinesOfStraightLineProgram</code> returns the list of program lines. There is no default method to compute these lines if they are not stored.</p>

<p><a id="X820A592881D57802" name="X820A592881D57802"></a></p>

<h5>37.8-4 NrInputsOfStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrInputsOfStraightLineProgram</code>( <var class="Arg">prog</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
<p>For a straight line program <var class="Arg">prog</var>, <code class="func">NrInputsOfStraightLineProgram</code> returns the number of generators that are needed as input.</p>

<p>If a line of form 1. (that is, a list of integers) occurs in the lines of <var class="Arg">prog</var> except the last line then the number of generators is not determined by the lines, and must be set in the construction of the straight line program (see <code class="func">StraightLineProgram</code> (<a href="chap37.html#X7AECA57280DA3195"><span class="RefLink">37.8-2</span></a>)). So if <var class="Arg">prog</var> contains a line of form 1. other than the last line and does <em>not</em> store the number of generators then <code class="func">NrInputsOfStraightLineProgram</code> signals an error.</p>

<p><a id="X7847D32B863E822F" name="X7847D32B863E822F"></a></p>

<h5>37.8-5 ResultOfStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ResultOfStraightLineProgram</code>( <var class="Arg">prog</var>, <var class="Arg">gens</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p><code class="func">ResultOfStraightLineProgram</code> evaluates the straight line program (see <code class="func">IsStraightLineProgram</code> (<a href="chap37.html#X7F69FF3F7C6694CB"><span class="RefLink">37.8-1</span></a>)) <var class="Arg">prog</var> at the group elements in the list <var class="Arg">gens</var>.</p>

<p>The <em>result</em> of a straight line program with lines <span class="SimpleMath">p_1, p_2, ..., p_k</span> when applied to <var class="Arg">gens</var> is defined as follows.</p>


<dl>
<dt><strong class="Mark">(a)</strong></dt>
<dd><p>First a list <span class="SimpleMath">r</span> of intermediate results is initialized with a shallow copy of <var class="Arg">gens</var>.</p>

</dd>
<dt><strong class="Mark">(b)</strong></dt>
<dd><p>For <span class="SimpleMath">i &lt; k</span>, before the <span class="SimpleMath">i</span>-th step, let <span class="SimpleMath">r</span> be of length <span class="SimpleMath">n</span>. If <span class="SimpleMath">p_i</span> is the external representation of an associative word in the first <span class="SimpleMath">n</span> generators then the image of this word under the homomorphism that is given by mapping <span class="SimpleMath">r</span> to these first <span class="SimpleMath">n</span> generators is added to <span class="SimpleMath">r</span>; if <span class="SimpleMath">p_i</span> is a pair <span class="SimpleMath">[ l, j ]</span>, for a list <span class="SimpleMath">l</span>, then the same element is computed, but instead of being added to <span class="SimpleMath">r</span>, it replaces the <span class="SimpleMath">j</span>-th entry of <span class="SimpleMath">r</span>.</p>

</dd>
<dt><strong class="Mark">(c)</strong></dt>
<dd><p>For <span class="SimpleMath">i = k</span>, if <span class="SimpleMath">p_k</span> is the external representation of an associative word then the element described in (b) is the result of the program, if <span class="SimpleMath">p_k</span> is a pair <span class="SimpleMath">[ l, j ]</span>, for a list <span class="SimpleMath">l</span>, then the result is the element described by <span class="SimpleMath">l</span>, and if <span class="SimpleMath">p_k</span> is a list <span class="SimpleMath">[ l_1, l_2, ..., l_k ]</span> of lists then the result is a list of group elements, where each <span class="SimpleMath">l_i</span> is treated as in (b).</p>

</dd>
</dl>

<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:= FreeGroup( "x", "y" );;  gens:= GeneratorsOfGroup( f );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x:= gens[1];;  y:= gens[2];;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= StraightLineProgram( [ [] ] );</span>
&lt;straight line program&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ResultOfStraightLineProgram( prg, [] );</span>
[  ]
</pre></div>

<p>The above straight line program <code class="code">prg</code> returns –for <em>any</em> list of input generators– an empty list.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">StraightLineProgram( [ [1,2,2,3], [3,-1] ] );</span>
fail
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= StraightLineProgram( [ [1,2,2,3], [3,-1] ], 2 );</span>
&lt;straight line program&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LinesOfStraightLineProgram( prg );</span>
[ [ 1, 2, 2, 3 ], [ 3, -1 ] ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= StraightLineProgram( "(a^2b^3)^-1", [ "a", "b" ] );</span>
&lt;straight line program&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LinesOfStraightLineProgram( prg );</span>
[ [ [ 1, 2, 2, 3 ], 3 ], [ [ 3, -1 ], 4 ] ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">res:= ResultOfStraightLineProgram( prg, gens );</span>
y^-3*x^-2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">res = (x^2 * y^3)^-1;</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrInputsOfStraightLineProgram( prg );</span>
2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Print( prg, "\n" );</span>
StraightLineProgram( [ [ [ 1, 2, 2, 3 ], 3 ], [ [ 3, -1 ], 4 ] ], 2 )
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Display( prg );</span>
# input:
r:= [ g1, g2 ];
# program:
r[3]:= r[1]^2*r[2]^3;
r[4]:= r[3]^-1;
# return value:
r[4]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsInternallyConsistent( StraightLineProgramNC( [ [1,2] ] ) );</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsInternallyConsistent( StraightLineProgramNC( [ [1,2,3] ] ) );</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg1:= StraightLineProgram( [ [1,1,2,2], [3,3,1,1] ], 2 );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg2:= StraightLineProgram( [ [ [1,1,2,2], 2 ], [2,3,1,1] ] );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">res1:= ResultOfStraightLineProgram( prg1, gens );</span>
(x*y^2)^3*x
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">res1 = (x*y^2)^3*x;</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">res2:= ResultOfStraightLineProgram( prg2, gens );</span>
(x*y^2)^3*x
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">res2 = (x*y^2)^3*x;</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= StraightLineProgram( [ [2,3], [ [3,1,1,4], [1,2,3,1] ] ], 2 );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">res:= ResultOfStraightLineProgram( prg, gens );</span>
[ y^3*x^4, x^2*y^3 ]
</pre></div>

<p><a id="X8098EAAF7D344466" name="X8098EAAF7D344466"></a></p>

<h5>37.8-6 StringOfResultOfStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StringOfResultOfStraightLineProgram</code>( <var class="Arg">prog</var>, <var class="Arg">gensnames</var>[, <var class="Arg">"LaTeX"</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">StringOfResultOfStraightLineProgram</code> returns a string that describes the result of the straight line program (see <code class="func">IsStraightLineProgram</code> (<a href="chap37.html#X7F69FF3F7C6694CB"><span class="RefLink">37.8-1</span></a>)) <var class="Arg">prog</var> as word(s) in terms of the strings in the list <var class="Arg">gensnames</var>. If the result of <var class="Arg">prog</var> is a single element then the return value of <code class="func">StringOfResultOfStraightLineProgram</code> is a string consisting of the entries of <var class="Arg">gensnames</var>, opening and closing brackets <code class="code">(</code> and <code class="code">)</code>, and powering by integers via <code class="code">^</code>. If the result of <var class="Arg">prog</var> is a list of elements then the return value of <code class="func">StringOfResultOfStraightLineProgram</code> is a comma separated concatenation of the strings of the single elements, enclosed in square brackets <code class="code">[</code>, <code class="code">]</code>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= StraightLineProgram( [ [ 1, 2, 2, 3 ], [ 3, -1 ] ], 2 );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">StringOfResultOfStraightLineProgram( prg, [ "a", "b" ] );</span>
"(a^2b^3)^-1"
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">StringOfResultOfStraightLineProgram( prg, [ "a", "b" ], "LaTeX" );</span>
"(a^{2}b^{3})^{-1}"
</pre></div>

<p><a id="X8274C7948248C053" name="X8274C7948248C053"></a></p>

<h5>37.8-7 CompositionOfStraightLinePrograms</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CompositionOfStraightLinePrograms</code>( <var class="Arg">prog2</var>, <var class="Arg">prog1</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>For two straight line programs <var class="Arg">prog1</var> and <var class="Arg">prog2</var>, <code class="func">CompositionOfStraightLinePrograms</code> returns a straight line program <var class="Arg">prog</var> with the properties that <var class="Arg">prog1</var> and <var class="Arg">prog</var> have the same number of inputs, and the result of <var class="Arg">prog</var> when applied to given generators <var class="Arg">gens</var> equals the result of <var class="Arg">prog2</var> when this is applied to the output of <var class="Arg">prog1</var> applied to <var class="Arg">gens</var>.</p>

<p>(Of course the number of outputs of <var class="Arg">prog1</var> must be the same as the number of inputs of <var class="Arg">prog2</var>.)</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg1:= StraightLineProgram( "a^2b", [ "a","b" ] );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg2:= StraightLineProgram( "c^5", [ "c" ] );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">comp:= CompositionOfStraightLinePrograms( prg2, prg1 );</span>
&lt;straight line program&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">StringOfResultOfStraightLineProgram( comp, [ "a", "b" ] );</span>
"(a^2b)^5"
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= StraightLineProgram( [ [2,3], [ [3,1,1,4], [1,2,3,1] ] ], 2 );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">StringOfResultOfStraightLineProgram( prg, [ "a", "b" ] );</span>
"[ b^3a^4, a^2b^3 ]"
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">comp:= CompositionOfStraightLinePrograms( prg, prg );</span>
&lt;straight line program&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">StringOfResultOfStraightLineProgram( comp, [ "a", "b" ] );</span>
"[ (a^2b^3)^3(b^3a^4)^4, (b^3a^4)^2(a^2b^3)^3 ]"
</pre></div>

<p><a id="X7A582FA97C786640" name="X7A582FA97C786640"></a></p>

<h5>37.8-8 IntegratedStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IntegratedStraightLineProgram</code>( <var class="Arg">listofprogs</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>For a nonempty dense list <var class="Arg">listofprogs</var> of straight line programs that have the same number <span class="SimpleMath">n</span>, say, of inputs (see <code class="func">NrInputsOfStraightLineProgram</code> (<a href="chap37.html#X820A592881D57802"><span class="RefLink">37.8-4</span></a>)) and for which the results (see <code class="func">ResultOfStraightLineProgram</code> (<a href="chap37.html#X7847D32B863E822F"><span class="RefLink">37.8-5</span></a>)) are single elements (i.e., <em>not</em> lists of elements), <code class="func">IntegratedStraightLineProgram</code> returns a straight line program <var class="Arg">prog</var> with <span class="SimpleMath">n</span> inputs such that for each <span class="SimpleMath">n</span>-tuple <var class="Arg">gens</var> of generators, <code class="code">ResultOfStraightLineProgram( <var class="Arg">prog</var>, <var class="Arg">gens</var> )</code> is equal to the list <code class="code">List( <var class="Arg">listofprogs</var>, <var class="Arg">p</var> -&gt; ResultOfStraightLineProgram( <var class="Arg">p</var>, <var class="Arg">gens</var> )</code>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:= FreeGroup( "x", "y" );;  gens:= GeneratorsOfGroup( f );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg1:= StraightLineProgram([ [ [ 1, 2 ], 1 ], [ 1, 2, 2, -1 ] ], 2);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg2:= StraightLineProgram([ [ [ 2, 2 ], 3 ], [ 1, 3, 3, 2 ] ], 2);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg3:= StraightLineProgram([ [ 2, 2 ], [ 1, 3, 3, 2 ] ], 2);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= IntegratedStraightLineProgram( [ prg1, prg2, prg3 ] );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ResultOfStraightLineProgram( prg, gens );</span>
[ x^4*y^-1, x^3*y^4, x^3*y^4 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= IntegratedStraightLineProgram( [ prg2, prg3, prg1 ] );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ResultOfStraightLineProgram( prg, gens );</span>
[ x^3*y^4, x^3*y^4, x^4*y^-1 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prg:= IntegratedStraightLineProgram( [ prg3, prg1, prg2 ] );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ResultOfStraightLineProgram( prg, gens );</span>
[ x^3*y^4, x^4*y^-1, x^3*y^4 ]
</pre></div>

<p><a id="X7C9CABD17BE4850F" name="X7C9CABD17BE4850F"></a></p>

<h5>37.8-9 RestrictOutputsOfSLP</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RestrictOutputsOfSLP</code>( <var class="Arg">slp</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><var class="Arg">slp</var> must be a straight line program returning a tuple of values. This function returns a new slp that calculates only those outputs specified by <var class="Arg">k</var>. The argument <var class="Arg">k</var> may be an integer or a list of integers. If <var class="Arg">k</var> is an integer, the resulting slp calculates only the result with that number in the original output tuple. If <var class="Arg">k</var> is a list of integers, the resulting slp calculates those results with indices <var class="Arg">k</var> in the original output tuple. In both cases the resulting slp does only what is necessary. Obviously, the slp must have a line with enough expressions (lists) for the supplied <var class="Arg">k</var> as its last line. <var class="Arg">slp</var> is either an slp or a pair where the first entry are the lines of the slp and the second is the number of inputs.</p>

<p><a id="X7EF202F17DCA5D1C" name="X7EF202F17DCA5D1C"></a></p>

<h5>37.8-10 IntermediateResultOfSLP</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IntermediateResultOfSLP</code>( <var class="Arg">slp</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>Returns a new slp that calculates only the value of slot <var class="Arg">k</var> at the end of <var class="Arg">slp</var> doing only what is necessary. slp is either an slp or a pair where the first entry are the lines of the slp and the second is the number of inputs. Note that this assumes a general SLP with possible overwriting. If you know that your SLP does not overwrite slots, please use <code class="func">IntermediateResultOfSLPWithoutOverwrite</code> (<a href="chap37.html#X8085CF79856B2889"><span class="RefLink">37.8-11</span></a>), which is much faster in this case.</p>

<p><a id="X8085CF79856B2889" name="X8085CF79856B2889"></a></p>

<h5>37.8-11 IntermediateResultOfSLPWithoutOverwrite</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IntermediateResultOfSLPWithoutOverwrite</code>( <var class="Arg">slp</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>Returns a new slp that calculates only the value of slot <var class="Arg">k</var>, which must be an integer. Note that <var class="Arg">slp</var> must not overwrite slots but only append!!! Use <code class="func">IntermediateResultOfSLP</code> (<a href="chap37.html#X7EF202F17DCA5D1C"><span class="RefLink">37.8-10</span></a>) in the other case! <var class="Arg">slp</var> is either an slp or a pair where the first entry is the lines of the slp and the second is the number of inputs.</p>

<p><a id="X873244F37FAA717A" name="X873244F37FAA717A"></a></p>

<h5>37.8-12 IntermediateResultsOfSLPWithoutOverwrite</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IntermediateResultsOfSLPWithoutOverwrite</code>( <var class="Arg">slp</var>, <var class="Arg">k</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>Returns a new slp that calculates only the value of slots contained in the list k. Note that <var class="Arg">slp</var> must not overwrite slots but only append!!! Use <code class="func">IntermediateResultOfSLP</code> (<a href="chap37.html#X7EF202F17DCA5D1C"><span class="RefLink">37.8-10</span></a>) in the other case! <var class="Arg">slp</var> is either a slp or a pair where the first entry is the lines of the slp and the second is the number of inputs.</p>

<p><a id="X837101F982C35035" name="X837101F982C35035"></a></p>

<h5>37.8-13 ProductOfStraightLinePrograms</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProductOfStraightLinePrograms</code>( <var class="Arg">s1</var>, <var class="Arg">s2</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><var class="Arg">s1</var> and <var class="Arg">s2</var> must be two slps that return a single element with the same number of inputs. This function constructs an slp that returns the product of the two results the slps <var class="Arg">s1</var> and <var class="Arg">s2</var> would produce with the same input.</p>

<p><a id="X84C83CE98194FD03" name="X84C83CE98194FD03"></a></p>

<h5>37.8-14 SlotUsagePattern</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SlotUsagePattern</code>( <var class="Arg">s</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
<p>Analyses the straight line program <var class="Arg">s</var> for more efficient evaluation. This means in particular two things, when this attribute is known: First of all, intermediate results which are not actually needed later on are not computed at all, and once an intermediate result is used for the last time in this SLP, it is discarded. The latter leads to the fact that the evaluation of the SLP needs less memory.</p>

<p><a id="X8188799182D82A92" name="X8188799182D82A92"></a></p>

<h4>37.9 <span class="Heading">Straight Line Program Elements</span></h4>

<p>When computing with very large (in terms of memory) elements, for example permutations of degree a few hundred thousands, it can be helpful (in terms of memory usage) to represent them via straight line programs in terms of an original generator set. (So every element takes only small extra storage for the straight line program.)</p>

<p>A straight line program element has a <em>seed</em> (a list of group elements) and a straight line program on the same number of generators as the length of this seed, its value is the value of the evaluated straight line program.</p>

<p>At the moment, the entries of the straight line program have to be simple lists (i.e. of the first form).</p>

<p>Straight line program elements are in the same categories and families as the elements of the seed, so they should work together with existing algorithms.</p>

<p>Note however, that due to the different way of storage some normally very cheap operations (such as testing for element equality) can become more expensive when dealing with straight line program elements. This is essentially the tradeoff for using less memory.</p>

<p>See also Section <a href="chap43.html#X78A68F5A80ADD1B6"><span class="RefLink">43.13</span></a>.</p>

<p><a id="X85A5838482944FA5" name="X85A5838482944FA5"></a></p>

<h5>37.9-1 IsStraightLineProgElm</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsStraightLineProgElm</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;representation&nbsp;)</td></tr></table></div>
<p>A straight line program element is a group element given (for memory reasons) as a straight line program. Straight line program elements are positional objects, the first component is a record with a component <code class="code">seeds</code>, the second component the straight line program.</p>

<p><a id="X78889E5B7E1B3BFF" name="X78889E5B7E1B3BFF"></a></p>

<h5>37.9-2 StraightLineProgElm</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StraightLineProgElm</code>( <var class="Arg">seed</var>, <var class="Arg">prog</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>Creates a straight line program element for seed <var class="Arg">seed</var> and program <var class="Arg">prog</var>.</p>

<p><a id="X81BC263A7E45E775" name="X81BC263A7E45E775"></a></p>

<h5>37.9-3 StraightLineProgGens</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StraightLineProgGens</code>( <var class="Arg">gens</var>[, <var class="Arg">base</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns a set of straight line program elements corresponding to the generators in <var class="Arg">gens</var>. If <var class="Arg">gens</var> is a set of permutations then <var class="Arg">base</var> can be given which must be a base for the group generated by <var class="Arg">gens</var>. (Such a base will be used to speed up equality tests.)</p>

<p><a id="X7BEAE8AC809B27DC" name="X7BEAE8AC809B27DC"></a></p>

<h5>37.9-4 EvalStraightLineProgElm</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EvalStraightLineProgElm</code>( <var class="Arg">slpel</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>evaluates a straight line program element <var class="Arg">slpel</var> from its seeds.</p>

<p><a id="X7D85D1DF84DC68E3" name="X7D85D1DF84DC68E3"></a></p>

<h5>37.9-5 StretchImportantSLPElement</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StretchImportantSLPElement</code>( <var class="Arg">elm</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>If <var class="Arg">elm</var> is a straight line program element whose straight line representation is very long, this operation changes the representation of <var class="Arg">elm</var> to a straight line program element, equal to <var class="Arg">elm</var>, whose seed contains the evaluation of <var class="Arg">elm</var> and whose straight line program has length 1.</p>

<p>For other objects nothing happens.</p>

<p>This operation permits to designate "important" elements within an algorithm (elements that will be referred to often), which will be represented by guaranteed short straight line program elements.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">gens:=StraightLineProgGens([(1,2,3,4),(1,2)]);</span>
[ &lt;[ [ 2, 1 ] ]|(1,2,3,4)&gt;, &lt;[ [ 1, 1 ] ]|(1,2)&gt; ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:=Group(gens);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">(gens[1]^3)^gens[2];</span>
&lt;[ [ 1, -1, 2, 3, 1, 1 ] ]|(1,2,4,3)&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size(g);</span>
24
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Random(g);</span>
&lt;
[ [ 1, -1, 2, -1, 1, 1, 2, -1, 1, -1, 2, 1, 1, 1, 2, 1, 1, -1, 2, 2, 
      1, 1 ], [ 3, -2, 2, -2 ], 
  [ 4, 1, 1, -1, 2, -2, 1, 1, 2, -1, 4, 1 ] ]|(1,3)&gt;
</pre></div>


<div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp;  <a href="chap0.html#contents">[Contents]</a>&nbsp;  &nbsp;<a href="chap36.html">[Previous Chapter]</a>&nbsp;  &nbsp;<a href="chap38.html">[Next Chapter]</a>&nbsp;  </div>


<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chap11.html">11</a>  <a href="chap12.html">12</a>  <a href="chap13.html">13</a>  <a href="chap14.html">14</a>  <a href="chap15.html">15</a>  <a href="chap16.html">16</a>  <a href="chap17.html">17</a>  <a href="chap18.html">18</a>  <a href="chap19.html">19</a>  <a href="chap20.html">20</a>  <a href="chap21.html">21</a>  <a href="chap22.html">22</a>  <a href="chap23.html">23</a>  <a href="chap24.html">24</a>  <a href="chap25.html">25</a>  <a href="chap26.html">26</a>  <a href="chap27.html">27</a>  <a href="chap28.html">28</a>  <a href="chap29.html">29</a>  <a href="chap30.html">30</a>  <a href="chap31.html">31</a>  <a href="chap32.html">32</a>  <a href="chap33.html">33</a>  <a href="chap34.html">34</a>  <a href="chap35.html">35</a>  <a href="chap36.html">36</a>  <a href="chap37.html">37</a>  <a href="chap38.html">38</a>  <a href="chap39.html">39</a>  <a href="chap40.html">40</a>  <a href="chap41.html">41</a>  <a href="chap42.html">42</a>  <a href="chap43.html">43</a>  <a href="chap44.html">44</a>  <a href="chap45.html">45</a>  <a href="chap46.html">46</a>  <a href="chap47.html">47</a>  <a href="chap48.html">48</a>  <a href="chap49.html">49</a>  <a href="chap50.html">50</a>  <a href="chap51.html">51</a>  <a href="chap52.html">52</a>  <a href="chap53.html">53</a>  <a href="chap54.html">54</a>  <a href="chap55.html">55</a>  <a href="chap56.html">56</a>  <a href="chap57.html">57</a>  <a href="chap58.html">58</a>  <a href="chap59.html">59</a>  <a href="chap60.html">60</a>  <a href="chap61.html">61</a>  <a href="chap62.html">62</a>  <a href="chap63.html">63</a>  <a href="chap64.html">64</a>  <a href="chap65.html">65</a>  <a href="chap66.html">66</a>  <a href="chap67.html">67</a>  <a href="chap68.html">68</a>  <a href="chap69.html">69</a>  <a href="chap70.html">70</a>  <a href="chap71.html">71</a>  <a href="chap72.html">72</a>  <a href="chap73.html">73</a>  <a href="chap74.html">74</a>  <a href="chap75.html">75</a>  <a href="chap76.html">76</a>  <a href="chap77.html">77</a>  <a href="chap78.html">78</a>  <a href="chap79.html">79</a>  <a href="chap80.html">80</a>  <a href="chap81.html">81</a>  <a href="chap82.html">82</a>  <a href="chap83.html">83</a>  <a href="chap84.html">84</a>  <a href="chap85.html">85</a>  <a href="chap86.html">86</a>  <a href="chap87.html">87</a>  <a href="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<hr />
<p class="foot">generated by <a href="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>