File: rwspcsng.gi

package info (click to toggle)
gap 4r7p5-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 29,272 kB
  • ctags: 7,129
  • sloc: ansic: 107,802; xml: 46,868; sh: 3,548; perl: 2,329; makefile: 740; python: 94; asm: 62; awk: 6
file content (1739 lines) | stat: -rw-r--r-- 49,750 bytes parent folder | download
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
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
#############################################################################
##
#W  rwspcsng.gi                 GAP Library                      Frank Celler
##
#Y  Copyright (C)  1997,  Lehrstuhl D für Mathematik,  RWTH Aachen, Germany
#Y  (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland
#Y  Copyright (C) 2002 The GAP Group
##
##  This files implement a single collector as representation of a polycyclic
##  collector with power/conjugate presentation.
##
##  As the  collector  needs access to  the  information as fast as  possible
##  single collectors are not record objects but list objects.  However, they
##  still support the required components via '.'.  The positions in the list
##  object are defined in the kernel and are exported as "SCP_something".
##


#############################################################################
##
#R  IsSingleCollectorRep( <obj> )
##
DeclareRepresentation(
    "IsSingleCollectorRep",
    IsPositionalObjectRep, [1..SCP_AVECTOR],
    IsPowerConjugateCollector and IsFinite );


#############################################################################
##
#R  Is8BitsSingleCollectorRep( <obj> )
##
DeclareRepresentation(
    "Is8BitsSingleCollectorRep",
    IsSingleCollectorRep, [],
    IsPowerConjugateCollector and IsFinite );


#############################################################################
##
#R  Is16BitsSingleCollectorRep( <obj> )
##
DeclareRepresentation(
    "Is16BitsSingleCollectorRep",
    IsSingleCollectorRep, [],
    IsPowerConjugateCollector and IsFinite );


#############################################################################
##
#R  Is32BitsSingleCollectorRep( <obj> )
##
DeclareRepresentation(
    "Is32BitsSingleCollectorRep",
    IsSingleCollectorRep, [],
    IsPowerConjugateCollector and IsFinite );


#############################################################################
##

#P  IsDefaultRhsTypeSingleCollector
##
##  This feature is set as soon as all right hand sides have the same type as
##  the one stored  in  the component 'defaultType'.   Calling  'ReduceRules'
##  will reduce all right hand sides and convert  them into an object of type
##  'defaultType'.
##
DeclareFilter( "IsDefaultRhsTypeSingleCollector" );


#############################################################################
##

#F  SingleCollector_CollectWord( <sc>, <v>, <w> )
##
##  'CollectWord' implements  a  single  collector  for a presentation  of  a
##  finite  polycyclic group.  The functions expects  a rewriting system <sc>
##  describing the polycyclic presentation, an exponent vector <v> and a word
##  <w> in the corresponding free group.  It collects <w> into <v>.
##
SingleCollector_CollectWordRunning := false;

SingleCollector_CollectWord := function( sc, v, w )

    local   cnj,        # <cnj>[g][h] contains g^h for g > h
            pow,        # <pow>[g] contains g^p
            gns,        # the group generators
            ro,         # <ro>[g] contains the relative order of g
            nw,         # stack of words to process
            lw,         # stack of number of syllabels in <nw>
            pw,         # stack of position of the in <nw> to look at
            ew,         # stack of unprocessed exponents at position <pw>
            ge,         # stack of global exponents of the words in <nw>
            sp,         # stack pointer
            gn,         # generator number
            inv,        # inverses
            i,          # loop variable
            start,      # last non-trivial entry in <v>
            tmp,        # temporary
            avc;        # g_i .. g_n commutes with g_avc[i]+1 .. g_n

    # the collector is not reentrant
    if SingleCollector_CollectWordRunning  then
        SingleCollector_CollectWordRunning := false;
        Error( "collector is not reentrant" );
    fi;
    #Print( "#I  using the GAP level single collector\n" );
    SingleCollector_CollectWordRunning := true;

    # <nw> contains the stack of words to insert
    nw := [];  nw[1] := w;

    # <lw> contains the number of syllables in <nw>
    lw := [];  lw[1] := NumberSyllables(nw[1]);

    # if we got the identity return
    if lw[1] = 0  then
        SingleCollector_CollectWordRunning := false;
        return true;
    fi;

    # get the array of conjugates, powers, orders and the avector
    gns := sc![SCP_RWS_GENERATORS];
    cnj := sc![SCP_CONJUGATES];
    pow := sc![SCP_POWERS];
    ro  := sc![SCP_RELATIVE_ORDERS];
    avc := sc![SCP_AVECTOR];

    # compute the inverses in case we need them
    inv := sc![SCP_INVERSES];

    # <pw> contains the position of the word in <nw> to look at
    pw := [];  pw[1] := 1;

    # <ew> contains the unprocessed exponents at position <pw>
    ew := [];  ew[1] := ExponentSyllable(nw[1],pw[1]);

    # <ge> contains the global exponent of the word
    ge := [];  ge[1] := 1;

    # <sp> is the stack pointer
    sp := 1;

    # <start> is the first non-trivial entry in <v>
    start := Length(v);

    # run until the stack is empty
    while 0 < sp  do

        # if <ew> is negative use inverse
        if ew[sp] < 0  then
            sp := sp+1;
            gn :=  GeneratorSyllable( nw[sp-1], pw[sp-1] );
            #Print( "#I  pushing INV(", gn, ")\n" );

            nw[sp] := inv[gn];
            lw[sp] := NumberSyllables(nw[sp]);
            pw[sp] := 1;
            ew[sp] := ExponentSyllable( nw[sp], pw[sp] );
            ge[sp] := -ew[sp-1];
            ew[sp-1] := 0;


        # if <ew> is zero get next syllable
        elif 0 = ew[sp]  then

            # if <pw> has reached <lw> get next & reduce globale exponent
            if pw[sp] = lw[sp]  then

                # if the globale exponent is greater one reduce it
                if 1 < ge[sp]  then
                    ge[sp] := ge[sp]-1;
                    pw[sp] := 1;
                    ew[sp] := ExponentSyllable( nw[sp], pw[sp] );

                # otherwise get the next word from the stack
                else
                    #Print( "#I  poping\n" );
                    sp := sp-1;
                fi;

            # otherwise set <ew> to exponent of next syllable
            else
                pw[sp] := pw[sp] + 1;
                ew[sp] := ExponentSyllable( nw[sp], pw[sp] );
            fi;

        # now move the next generator to the correct position
        else

            # get generator number
            gn := GeneratorSyllable( nw[sp], pw[sp] );

            # we can move <gn> directly to the correct position
            if avc[gn] = gn  then
                v[gn]  := v[gn] + ew[sp];
                ew[sp] := 0;
                if start <= gn  then start := gn;  fi;

            # we have to move <gn> step by step
            else
                ew[sp] := ew[sp] - 1;
                if start <= avc[gn]  then
                    tmp := start;
                else
                    tmp := avc[gn];
                fi;
                for i  in [ tmp, tmp-1 .. gn+1 ]  do
                    if 0 <> v[i]  then
                        #Print( "#I  pushing CONJ(",i,",",gn,")\n" );
                        sp := sp+1;
                        if IsBound(cnj[i][gn])  then
                            if 0 = NumberSyllables(cnj[i][gn])  then
                                nw[sp] := gns[i];
                            else
                                nw[sp] := cnj[i][gn];
                            fi;
                        else
                            nw[sp] := gns[i];
                        fi;
                        lw[sp] := NumberSyllables(nw[sp]);
                        pw[sp] := 1;
                        ew[sp] := ExponentSyllable( nw[sp], pw[sp] );
                        ge[sp] := v[i];
                        v[i] := 0;
                    fi;
                od;
                v[gn] := v[gn] + 1;
                if start <= avc[gn]  then start := gn;  fi;
            fi;

            # check that the exponent is not too big
            if ro[gn] <= v[gn]  then
                tmp := QuoInt( v[gn], ro[gn] );
                v[gn] := v[gn] - ro[gn]*tmp;
                if IsBound(pow[gn]) and 0 < NumberSyllables(nw[sp])  then
                    #Print( "#I  pushing POWER(",gn,")\n" );
                    sp := sp+1;
                    nw[sp] := pow[gn];
                    lw[sp] := NumberSyllables(nw[sp]);
                    pw[sp] := 1;
                    ew[sp] := ExponentSyllable( nw[sp], pw[sp] );
                    ge[sp] := tmp;
                fi;
            fi;
        fi;
    od;
    SingleCollector_CollectWordRunning := false;
    return true;

end;


#############################################################################
##
#F  SingleCollector_Solution( <sc>, <a>, <b> )
##
##  Solve the equation <a> X = <b>.
##
SingleCollector_Solution := function( sc, a, b )
    local   gns,  rod,  av,  bv,  x,  i,  dif,  y;

    # get the free group generators and relative orders
    gns := sc![SCP_RWS_GENERATORS];
    rod := sc![SCP_RELATIVE_ORDERS];

    # write <a> as exponent vector
    av := ExponentSums( a, 1, sc![SCP_NUMBER_RWS_GENERATORS] );

    # write <b> as exponent vector
    bv := ExponentSums( b, 1, sc![SCP_NUMBER_RWS_GENERATORS] );

    # and build the solution in <x>
    x := [];

    # loop over all generators
    for i  in [ 1 .. sc![SCP_NUMBER_RWS_GENERATORS] ]  do
        dif := (bv[i] - av[i]) mod rod[i];
        if dif <> 0  then
            y := AssocWord( sc![SCP_DEFAULT_TYPE], [ i, dif ] );
            Add( x, i );
            Add( x, dif );
            CollectWord( sc, av, y );
        fi;
    od;

    # and return the solution <x>
    return AssocWord( sc![SCP_DEFAULT_TYPE], x );

end;


#############################################################################
##

#M  Rules( <sc> )
##
InstallMethod( Rules,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    local   rels,  gens,  ords,  i,  j;

    # first the power relators
    rels := [];
    gens := sc![SCP_RWS_GENERATORS];
    ords := sc![SCP_RELATIVE_ORDERS];
    for i  in [ 1 .. sc![SCP_NUMBER_RWS_GENERATORS] ]  do
        if IsBound( sc![SCP_POWERS][i])  then
            Add( rels, gens[i]^ords[i] / sc![SCP_POWERS][i] );
        else
            Add( rels, gens[i]^ords[i] );
        fi;
    od;

    # and now the non-trivial conjugates
    for i  in [ 2 .. sc![SCP_NUMBER_RWS_GENERATORS] ]  do
        for j  in [ 1 .. i-1 ]  do
            if IsBound(sc![SCP_CONJUGATES][i][j])  then
                Add( rels, gens[i]^gens[j] / sc![SCP_CONJUGATES][i][j] );
            else
                Add( rels, gens[i]^gens[j] / gens[i] );
            fi;
        od;
    od;

    # and return
    return rels;

end );


#############################################################################
##
#M  ReduceRules( <sc> )
##
InstallMethod( ReduceRules,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep 
        and IsMutable ],
    0,

function( sc )
    local   pow,  cnj,  rod,  gns,  n,  m,  i,  j,  l;

    # check all powers and conjugates
    pow := sc![SCP_POWERS];
    cnj := sc![SCP_CONJUGATES];
    rod := sc![SCP_RELATIVE_ORDERS];
    gns := sc![SCP_RWS_GENERATORS];
    n   := sc![SCP_NUMBER_RWS_GENERATORS];

    # return if there is nothing to reduce
    if n = 0  then
        SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, true );
        OutdatePolycyclicCollector(sc);
        UpdatePolycyclicCollector(sc);
        return;
    fi;

    # start at the bottom
    if IsBound(pow[n])  then
        if 1 < NumberSyllables(pow[n])  then
            Error( "illegal power rule for generator ", n );
        fi;
        if n <> GeneratorSyllable( pow[n], 1 )  then
            Error( "illegal power rule for generator ", n );
        fi;
        m := ExponentSyllable(pow[n],1) mod rod[n];
        if m = 0  then
            Unbind(pow[n]);
        else
            pow[n] := gns[n]^m;
        fi;
    fi;

    # and work up the composition series
    for i  in [ n-1, n-2 .. 1 ]  do
        for j  in [ n, n-1 .. i+1 ]  do
            if IsBound(cnj[j][i])  then
                l := List( gns, x -> 0 );
                while CollectWordOrFail( sc, l, cnj[j][i] ) = fail  do
                    l := List( gns, x -> 0 );
                od;
                cnj[j][i] := ObjByVector( sc![SCP_DEFAULT_TYPE], l );
                if cnj[j][i] = gns[j]  then
                    Unbind(cnj[j][i]);
                fi;
            fi;
        od;
        if IsBound(pow[i])  then
            l := List( gns, x -> 0 );
            while CollectWordOrFail( sc, l, pow[i] ) = fail  do
                l := List( gns, x -> 0 );
            od;
            pow[i] := ObjByVector( sc![SCP_DEFAULT_TYPE], l );
            if 0 = NumberSyllables(pow[i])  then
                Unbind(pow[i]);
            fi;
        fi;
    od;

    # now all right hand sides have the default type
    SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, true );

    # but we have to outdate the collector to force recomputation of avec
    OutdatePolycyclicCollector(sc);
    UpdatePolycyclicCollector(sc);

end );


#############################################################################
##
#M  SetConjugate( <sc>, <i>, <j>, <rhs> )
##
##  required: <i> > <j>
##
InstallMethod( SetConjugateANC,
    "pow conj single collector",
    IsIdenticalObjFamiliesColXXXXXXObj,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
        and IsMutable,
      IsInt,
      IsInt,
      IsMultiplicativeElementWithInverse ],
    0,
function( sc, i, j, rhs )

    # if <i> and <j> commute unbind the entry
    if rhs = sc![SCP_RWS_GENERATORS][i]  then
        Unbind(sc![SCP_CONJUGATES][i][j]);

    # install the rhs
    else
        sc![SCP_CONJUGATES][i][j] := rhs;
        if not sc![SCP_IS_DEFAULT_TYPE](rhs)  then
            Print( "#W  Warning: mixed types in collector\n" );
            SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, false );
        fi;
    fi;

end );

SingleCollector_SetConjugateNC := function( sc, i, j, rhs )

    # if <i> and <j> commute unbind the entry
    if rhs = sc![SCP_RWS_GENERATORS][i]  then
        Unbind(sc![SCP_CONJUGATES][i][j]);

    # install the rhs
    else
        sc![SCP_CONJUGATES][i][j] := rhs;
        if not sc![SCP_IS_DEFAULT_TYPE](rhs)  then
            SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, false );
        fi;
    fi;

    # collector info must be updated
    OutdatePolycyclicCollector(sc);

end;


#############################################################################
InstallMethod( SetConjugateNC,
    IsIdenticalObjFamiliesColXXXXXXObj,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
        and IsMutable,
      IsInt,
      IsInt,
      IsMultiplicativeElementWithInverse ],
    0,
    SingleCollector_SetConjugateNC );


#############################################################################
InstallMethod( SetConjugate,
    IsIdenticalObjFamiliesColXXXXXXObj,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
        and IsMutable,
      IsInt,
      IsInt,
      IsMultiplicativeElementWithInverse ],
    0,

function( sc, i, j, rhs )
    local   m,  n,  l;

    # check <i> and <j>
    if i <= 1  then
        Error( "<i> must be at least 2" );
    fi;
    if sc![SCP_NUMBER_RWS_GENERATORS] < i  then
        Error( "<i> must be at most ", sc![SCP_NUMBER_RWS_GENERATORS] );
    fi;
    if j <= 0  then
        Error( "<j> must be positive" );
    fi;
    if i <= j  then
        Error( "<j> must be at most ", i-1 );
    fi;

    # check that the rhs is non-trivial
    if 0 = NumberSyllables(rhs)  then
        Error( "right hand side is trivial" );
    fi;

    # check that the rhs lies underneath <j>
    m := sc![SCP_NUMBER_RWS_GENERATORS]+1;
    for l  in [ 1 .. NumberSyllables(rhs) ]  do
        n := GeneratorSyllable( rhs, l );
        if n < m  then m := n;  fi;
    od;
    if m <= j  then
        Error( "<rhs> contains illegal generator ", m );
    fi;

    # install the conjugate relator
    SingleCollector_SetConjugateNC( sc, i, j, rhs );

end );


#############################################################################
##
#M  SetPower( <sc>, <i>, <rhs> )
##
InstallMethod( SetPowerANC,
    "pow conj single collector",
    IsIdenticalObjFamiliesColXXXObj,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
        and IsMutable, 
      IsInt,
      IsMultiplicativeElementWithInverse ],
    0,
function( sc, i, rhs )
    # enter the rhs
    if 0 = NumberSyllables(rhs)  then
        Unbind(sc![SCP_POWERS][i]);
    else
        sc![SCP_POWERS][i] := rhs;
        if not sc![SCP_IS_DEFAULT_TYPE](rhs)  then
            Print( "#  Warning: mixed types in collector\n" );
            SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, false );
        fi;
    fi;

end );

SingleCollector_SetPowerNC := function( sc, i, rhs )

    # enter the rhs
    if 0 = NumberSyllables(rhs)  then
        Unbind(sc![SCP_POWERS][i]);
    else
        sc![SCP_POWERS][i] := rhs;
        if not sc![SCP_IS_DEFAULT_TYPE](rhs)  then
            SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, false );
        fi;
    fi;

    # collector info must be updated
    OutdatePolycyclicCollector(sc);

end;


#############################################################################
InstallMethod( SetPowerNC,
    IsIdenticalObjFamiliesColXXXObj,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
        and IsMutable, 
      IsInt,
      IsMultiplicativeElementWithInverse ],
    0,
    SingleCollector_SetPowerNC );


#############################################################################
InstallMethod( SetPower, 
    IsIdenticalObjFamiliesColXXXObj,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
        and IsMutable,
      IsInt,
      IsMultiplicativeElementWithInverse ],
    0,

function( sc, i, rhs )
    local   fam,  m,  n,  l;

    # check the family (this cannot be done in install)
    fam := sc![SCP_UNDERLYING_FAMILY];
    if not IsIdenticalObj( FamilyObj(rhs), fam )  then
        Error( "<rhs> must lie in the group of <sc>" );
    fi;

    # check <i>
    if i <= 0  then
        Error( "<i> must be positive" );
    fi;
    if sc![SCP_NUMBER_RWS_GENERATORS] < i  then
        Error( "<i> must be at most ", sc![SCP_NUMBER_RWS_GENERATORS] );
    fi;

    # check that the rhs lies underneath <i>
    m := sc![SCP_NUMBER_RWS_GENERATORS]+1;
    for l  in [ 1 .. NumberSyllables(rhs) ]  do
        n := GeneratorSyllable( rhs, l );
        if n < m  then m := n;  fi;
    od;
    if m <= i  then
        Error( "<rhs> contains illegal generator ", m );
    fi;

    # enter the rhs
    SingleCollector_SetPowerNC( sc, i, rhs );

end );


#############################################################################
##
#M  GetConjugateNC  . . . . . . .  conjugate relation from a single collector
##
InstallMethod( GetConjugateNC,
        "finite pow-conj single collector",
        true,
        [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep,
          IsInt, 
          IsInt ],
        0,
function( coll, h, g )

    if IsBound( coll![SCP_CONJUGATES][h] ) and
       IsBound( coll![SCP_CONJUGATES][h][g] ) then
        return coll![SCP_CONJUGATES][h][g];
    fi;

    # return the generators h.
    return coll![SCP_RWS_GENERATORS][h];
end );


#############################################################################
##
#M  GetPowerNC  . . . . . . . . . . .  power relation from a single collector
##
InstallMethod( GetPowerNC,
        true,
        [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep,
          IsInt ],
        0,
function( coll, g )

    if IsBound( coll![SCP_POWERS][g] ) then
        return coll![SCP_POWERS][g];
    fi;

    #  return the identity.
    return AssocWord( coll![SCP_DEFAULT_TYPE], [] );
end );

#############################################################################
##
#M  SetRelativeOrder( <sc>, <i>, <ord> )
##
SingleCollector_SetRelativeOrderNC := function( sc, i, ord )

    # store the new order
    sc![SCP_RELATIVE_ORDERS][i] := ord;

    # collector info must be updated
    OutdatePolycyclicCollector(sc);

end;


#############################################################################
InstallMethod( SetRelativeOrderNC,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
        and IsMutable, 
      IsInt,
      IsInt ],
    0,
    SingleCollector_SetRelativeOrderNC );


#############################################################################
InstallMethod( SetRelativeOrder, 
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
        and IsMutable,
      IsInt,
      IsInt ],
    0,

function( sc, i, ord )

    if ord < 2  or ord = infinity  then
        Error( "<ord> order must be finite and greater 1" );
    fi;
    SingleCollector_SetRelativeOrderNC( sc, i, ord );

end );


#############################################################################
##
#M  UpdatePolycyclicCollector( <sc> )
##
##  The `Avector' routine was taken from the \package{NQ} package.
##
SingleCollector_MakeAvector := function( sc )
    local   com,  cnj,  n,  g,  again,  h;

    # number of generators
    n := sc![SCP_NUMBER_RWS_GENERATORS];

    # list of rhs
    cnj := sc![SCP_CONJUGATES];

    # <com>[i] is the smallest j >= i such that a_i,...,a_n commutes with
    # a_(j+1),...,a_n.
    com := ListWithIdenticalEntries( n, n );

    # After the while loop two cases can occur :
    #
    # a) h > g+1. In this case h is the first generator among
    #    a_n,...,a_(j+1) with which g does not commute.
    #
    # b) h = g+1. Then <com>[g+1] = g+1 follows and g commutes with all
    #    generators a_(g+2),..,a_n. So it has to be checked whether a_g and
    #    a_(g+1) commute.  If that is the case, then <com>[g] = g. If not
    #    then <com>[g] = g+1 = h.

    for g  in [ n-1, n-2 .. 1 ]  do
        again := true;
        h := n;
        while again and h > com[g+1]  do
            if IsBound(cnj[h][g])  then
                again := false;
            else
                h := h-1;
            fi;
        od;

        if h = g+1 and not IsBound(cnj[h][g]) then
            com[g] := g;
        else
            com[g] := h;
        fi;
    od;

    # set the avector
    sc![SCP_AVECTOR] := com;

end;

SingleCollector_MakeInverses := function( sc )
    local   n,  gn,  id,  i;

    # start at the bottom
    n  := sc![SCP_NUMBER_RWS_GENERATORS];
    gn := sc![SCP_RWS_GENERATORS];
    id := One(sc![SCP_UNDERLYING_FAMILY]);
    for i  in [ n, n-1 .. 1 ]  do
        sc![SCP_INVERSES][i] := SingleCollector_Solution( sc, gn[i], id );
    od;
end;

InstallMethod( UpdatePolycyclicCollector,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )

    # update the avector
    SingleCollector_MakeAvector(sc);

    # 'MakeInverses' is very careful
    SetFeatureObj( sc, IsUpToDatePolycyclicCollector, true );

    # construct the inverses
    SingleCollector_MakeInverses(sc);

end );


#############################################################################
##
#M  UpdatePolycyclicCollector( <sc> )
##
##
#############################################################################
##

#M  SingleCollector( <fgrp>, <orders> )
##


#############################################################################
InstallMethod( SingleCollector,
    true,
    [ IsFreeGroup and IsGroupOfFamily,
      IsList ],
    0,

function( fgrp, orders )
    local   gens;

    # check the orders
    gens := GeneratorsOfGroup(fgrp);
    if Length(orders) <> Length(gens)  then
        Error( "need ", Length(gens), " orders, not ", Length(orders) );
    fi;
    if ForAny( orders, x -> not IsInt(x) or x <= 0 )  then
        Error( "relative orders must be positive integers" );
    fi;

    # create a new single collector
    return SingleCollectorByGenerators(
        ElementsFamily(FamilyObj(fgrp)), gens, orders );

end );


#############################################################################
InstallMethod( SingleCollector,
    true,
    [ IsFreeGroup and IsGroupOfFamily,
      IsInt ],
    0,

function( fgrp, order )
    local   gens;

    # check the order
    if order <= 0  then
        Error( "relative order must be a positive integers" );
    fi;
    order := List( GeneratorsOfGroup(fgrp), x -> order );
    gens  := GeneratorsOfGroup(fgrp);

    # create a new object
    return SingleCollectorByGenerators(
        ElementsFamily(FamilyObj(fgrp)), gens, order );

end );


#############################################################################
InstallMethod( SingleCollector,
    true, 
    [ IsList,
      IsList ],
    0,

function( gens, orders )

    # check the orders
    if Length(orders) <> Length(gens)  then
        Error( "need ", Length(gens), " orders, not ", Length(orders) );
    fi;
    if ForAny( orders, x -> not IsInt(x) or x <= 0 )  then
        Error( "relative orders must be positive integers" );
    fi;

    # create a new object
    return SingleCollectorByGenerators(
        ElementsFamily(FamilyObj(gens)), gens, orders );

end );


#############################################################################
InstallMethod( SingleCollector,
    true,
    [ IsList,
      IsInt ],
    0,

function( gens, order )

    # check the orders
    if order <= 0  then
        Error( "relative orders must be positive integers" );
    fi;
    order := List( gens, x -> order );

    # create a new object
    return SingleCollectorByGenerators(
        ElementsFamily(FamilyObj(gens)), gens, order );

end );


#############################################################################
##
#M  SingleCollectorByGenerators( <fam>, <gens>, <orders>
##
InstallMethod( SingleCollectorByGenerators,
    true,
    [ IsFamily,
      IsList,
      IsList ],
    0,

function( efam, gens, orders )
    local   i,  sc,  m,  bits,  type,  fam;

    # create the correct family
    fam := NewFamily( "PowerConjugateCollectorFamily",
                      IsPowerConjugateCollector );
    fam!.underlyingFamily := efam;

    # check the generators
    for i  in [ 1 .. Length(gens) ]  do
        if 1 <> NumberSyllables(gens[i])  then
            Error( gens[i], " must be a word of length 1" );
        elif 1 <> ExponentSyllable( gens[i], 1 )  then
            Error( gens[i], " must be a word of length 1" );
        elif i <> GeneratorSyllable( gens[i], 1 )  then
            Error( gens[i], " must be generator number ", i );
        fi;
    od;

    # construct a single collector as list object
    sc := [];

    # we need the the family
    sc[SCP_UNDERLYING_FAMILY] := efam;

    # and the relative orders
    sc[SCP_RELATIVE_ORDERS] := ShallowCopy(orders);

    # and a default type
    if 0 = Length(gens)  then
        m := 1;
    else
        m := Maximum( sc[SCP_RELATIVE_ORDERS] );
    fi;
    i := 1;
    while i < 4 and sc[SCP_UNDERLYING_FAMILY]!.expBitsInfo[i] <= m  do
        i := i + 1;
    od;
    sc[SCP_DEFAULT_TYPE] := sc[SCP_UNDERLYING_FAMILY]!.types[i];

    # set the corresponding feature later
    if i = 1  then
        sc[SCP_IS_DEFAULT_TYPE] := Is8BitsAssocWord;
        sc[SCP_COLLECTOR] := 8Bits_SingleCollector;
        bits := Is8BitsSingleCollectorRep;
    elif i = 2  then
        sc[SCP_IS_DEFAULT_TYPE] := Is16BitsAssocWord;
        sc[SCP_COLLECTOR] := 16Bits_SingleCollector;
        bits := Is16BitsSingleCollectorRep;
    elif i = 3  then
        sc[SCP_IS_DEFAULT_TYPE] := Is32BitsAssocWord;
        sc[SCP_COLLECTOR] := 32Bits_SingleCollector;
        bits := Is32BitsSingleCollectorRep;
    else
        sc[SCP_IS_DEFAULT_TYPE] := IsInfBitsAssocWord;
        bits := IsSingleCollectorRep;
    fi;

    # the generators must have the default type
    gens := ShallowCopy(gens);
    for i  in [ 1 .. Length(gens) ]  do
        if not sc[SCP_IS_DEFAULT_TYPE](gens[i])  then
	    # this generates words in syllable rep!
            gens[i] := AssocWord( sc[SCP_DEFAULT_TYPE],
                                  ExtRepOfObj(gens[i]) );
        fi;
    od;
    sc[SCP_RWS_GENERATORS] := gens;
    sc[SCP_NUMBER_RWS_GENERATORS] := Length(sc[SCP_RWS_GENERATORS]);

    # the rhs of the powers
    sc[SCP_POWERS] := [];

    # and the inverses of the generators
    sc[SCP_INVERSES] := [];

    # and the rhs of the conjugates
    sc[SCP_CONJUGATES] := List( sc[SCP_RWS_GENERATORS], x -> [] );

    # add the various stacks
    sc[SCP_NW_STACK]   := [];
    sc[SCP_LW_STACK]   := [];
    sc[SCP_PW_STACK]   := [];
    sc[SCP_EW_STACK]   := [];
    sc[SCP_GE_STACK]   := [];
    sc[SCP_CW_VECTOR]  := "";
    sc[SCP_CW2_VECTOR] := "";

    # and the maximal stack size
    sc[SCP_MAX_STACK_SIZE] := 256;

    # convert into a list object and set number of bits
    type := NewType( fam, IsSingleCollectorRep and bits and IsFinite
                          and IsMutable );
    Objectify( type, sc );
    SetFeatureObj( sc, HasUnderlyingFamily,      true );
    SetFeatureObj( sc, HasRelativeOrders,        true );
    SetFeatureObj( sc, HasGeneratorsOfRws,       true );
    SetFeatureObj( sc, HasNumberGeneratorsOfRws, true );

    # there are no right hand sides
    SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, true );

    # we haven't computed the avector and the inverses
    OutdatePolycyclicCollector(sc);

    # and return
    return sc;

end );


#############################################################################
##
#M  NumberGeneratorsOfRws( <sc> )
##
InstallMethod( NumberGeneratorsOfRws,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    return sc![SCP_NUMBER_RWS_GENERATORS];
end );


#############################################################################
##
#M  GeneratorsOfRws( <sc> )
##
InstallMethod( GeneratorsOfRws,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    return sc![SCP_RWS_GENERATORS];
end );


#############################################################################
##
#M  UnderlyingFamily( <sc> )
##
InstallMethod( UnderlyingFamily,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    return sc![SCP_UNDERLYING_FAMILY];
end );


#############################################################################
##
#M  RelativeOrders( <sc> )
##
InstallMethod( RelativeOrders,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    return sc![SCP_RELATIVE_ORDERS];
end );


#############################################################################
##

#M  CollectWordOrFail( <sc>, <v>, <w> )
##


#############################################################################
InstallMethod( CollectWordOrFail,
    IsIdenticalObjFamiliesColXXXObj,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
      and IsUpToDatePolycyclicCollector,
      IsList,
      IsMultiplicativeElementWithInverse ],
    0,
    SingleCollector_CollectWord );


#############################################################################
InstallMethod( CollectWordOrFail,
    IsIdenticalObjFamiliesColXXXObj,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
      and IsDefaultRhsTypeSingleCollector and IsUpToDatePolycyclicCollector,
      IsList,
      Is8BitsAssocWord ],
    0,
    FinPowConjCol_CollectWordOrFail );


#############################################################################
InstallMethod( CollectWordOrFail,
    IsIdenticalObjFamiliesColXXXObj,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector and IsUpToDatePolycyclicCollector,
      IsList,
      Is16BitsAssocWord ],
    0,
    FinPowConjCol_CollectWordOrFail );


#############################################################################
InstallMethod( CollectWordOrFail,
    IsIdenticalObjFamiliesColXXXObj,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      IsList,
      Is32BitsAssocWord ],
    0,
    FinPowConjCol_CollectWordOrFail );


#############################################################################
##
#M  ShallowCopy( <sc> )
##
ShallowCopy_SingleCollector := function( sc )
    local   copy;

    # construct new single collector as list object
    copy := [];

    # we need the the family
    copy[SCP_UNDERLYING_FAMILY] := sc![SCP_UNDERLYING_FAMILY];

    # and the relative orders
    copy[SCP_RELATIVE_ORDERS] := ShallowCopy(sc![SCP_RELATIVE_ORDERS]);

    # and a default type
    copy[SCP_DEFAULT_TYPE] := sc![SCP_DEFAULT_TYPE];
    copy[SCP_IS_DEFAULT_TYPE] := sc![SCP_IS_DEFAULT_TYPE];

    # the generators must have the default type
    copy[SCP_RWS_GENERATORS] := ShallowCopy(sc![SCP_RWS_GENERATORS]);
    copy[SCP_NUMBER_RWS_GENERATORS] := sc![SCP_NUMBER_RWS_GENERATORS];

    # the rhs of the powers
    copy[SCP_POWERS] := ShallowCopy(sc![SCP_POWERS]);

    # and the inverses of the generators
    copy[SCP_INVERSES] := ShallowCopy(sc![SCP_INVERSES]);

    # and the rhs of the conjugates
    copy[SCP_CONJUGATES] := List( sc![SCP_CONJUGATES], ShallowCopy );

    # and the avector
    if IsBound(sc![SCP_AVECTOR])  then
        copy[SCP_AVECTOR] := ShallowCopy(sc![SCP_AVECTOR]);
    fi;

    # add the various stacks
    copy[SCP_NW_STACK]   := [];
    copy[SCP_LW_STACK]   := [];
    copy[SCP_PW_STACK]   := [];
    copy[SCP_EW_STACK]   := [];
    copy[SCP_GE_STACK]   := [];
    copy[SCP_CW_VECTOR]  := "";
    copy[SCP_CW2_VECTOR] := "";

    # and the maximal stack size
    copy[SCP_MAX_STACK_SIZE] := sc![SCP_MAX_STACK_SIZE];

    # and the collector to use
    copy[SCP_COLLECTOR] := sc![SCP_COLLECTOR];

    # convert into a list object
    copy := Objectify( TypeObj(sc), copy );
    SetFilterObj( copy, IsMutable );
    return copy;

end;

InstallMethod( ShallowCopy,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,
    ShallowCopy_SingleCollector );

#############################################################################
##
#M  NonTrivialRightHandSides( <sc> )
##
InstallMethod( NonTrivialRightHandSides,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    local   rels,  len,  i,  j;

    rels := [];
    len  := NumberGeneratorsOfRws(sc);
    for i  in [ 1 .. len ]  do
        if IsBound(sc![SCP_POWERS][i])  then
            Add( rels, [ i, sc![SCP_POWERS][i] ] );
        fi;
    od;
    for i  in [ 1 .. len ]  do
        for j  in [ 1 .. i-1 ]  do
            if IsBound(sc![SCP_CONJUGATES][i][j])  then
                Add( rels, [ i, j, sc![SCP_CONJUGATES][i][j] ] );
            fi;
        od;
    od;
    return rels;
end );


#############################################################################
##
#M  ObjByExponents( <sc>, <data> )
##
InstallMethod( ObjByExponents,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep,
      IsList ],
    0,

function( sc, data )
    return ObjByVector( sc![SCP_DEFAULT_TYPE], data );
end );


#############################################################################
##
#M  ViewObj( <sc> )
##


#############################################################################
InstallMethod( ViewObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    Print( "<<single collector>>" );
end );


#############################################################################
InstallMethod( ViewObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
          and IsUpToDatePolycyclicCollector ],
    0,

function( sc )
    Print( "<<up-to-date single collector>>" );
end );


#############################################################################
InstallMethod( ViewObj,
    true,
    [ IsPowerConjugateCollector and IsFinite
          and Is8BitsSingleCollectorRep ],
    0,

function( sc )
    Print( "<<single collector, 8 Bits>>" );
end );


#############################################################################
InstallMethod( ViewObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
          and IsUpToDatePolycyclicCollector ],
    0,

function( sc )
    Print( "<<up-to-date single collector, 8 Bits>>" );
end );


#############################################################################
InstallMethod( ViewObj,
    true,
    [ IsPowerConjugateCollector and IsFinite
          and Is16BitsSingleCollectorRep ],
    0,

function( sc )
    Print( "<<single collector, 16 Bits>>" );
end );


#############################################################################
InstallMethod( ViewObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsUpToDatePolycyclicCollector ],
    0,

function( sc )
    Print( "<<up-to-date single collector, 16 Bits>>" );
end );


#############################################################################
InstallMethod( ViewObj,
    true,
    [ IsPowerConjugateCollector and IsFinite
          and Is32BitsSingleCollectorRep ],
    0,

function( sc )
    Print( "<<single collector, 32 Bits>>" );
end );


#############################################################################
InstallMethod( ViewObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsUpToDatePolycyclicCollector ],
    0,

function( sc )
    Print( "<<up-to-date single collector, 32 Bits>>" );
end );


#############################################################################
##
#M  PrintObj( <sc> )
##


#############################################################################
InstallMethod( PrintObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    Print( "<<single collector>>" );
end );
#T install a better `PrintObj' method!


#############################################################################
InstallMethod( PrintObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep
          and IsUpToDatePolycyclicCollector ],
    0,

function( sc )
    Print( "<<up-to-date single collector>>" );
end );
#T install a better `PrintObj' method!


#############################################################################
InstallMethod( PrintObj,
    true,
    [ IsPowerConjugateCollector and IsFinite
          and Is8BitsSingleCollectorRep ],
    0,

function( sc )
    Print( "<<single collector, 8 Bits>>" );
end );
#T install a better `PrintObj' method!


#############################################################################
InstallMethod( PrintObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
          and IsUpToDatePolycyclicCollector ],
    0,

function( sc )
    Print( "<<up-to-date single collector, 8 Bits>>" );
end );
#T install a better `PrintObj' method!


#############################################################################
InstallMethod( PrintObj,
    true,
    [ IsPowerConjugateCollector and IsFinite
          and Is16BitsSingleCollectorRep ],
    0,

function( sc )
    Print( "<<single collector, 16 Bits>>" );
end );
#T install a better `PrintObj' method!


#############################################################################
InstallMethod( PrintObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsUpToDatePolycyclicCollector ],
    0,

function( sc )
    Print( "<<up-to-date single collector, 16 Bits>>" );
end );
#T install a better `PrintObj' method!


#############################################################################
InstallMethod( PrintObj,
    true,
    [ IsPowerConjugateCollector and IsFinite
          and Is32BitsSingleCollectorRep ],
    0,

function( sc )
    Print( "<<single collector, 32 Bits>>" );
end );
#T install a better `PrintObj' method!


#############################################################################
InstallMethod( PrintObj,
    true,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsUpToDatePolycyclicCollector ],
    0,

function( sc )
    Print( "<<up-to-date single collector, 32 Bits>>" );
end );
#T install a better `PrintObj' method!


#############################################################################
##

#M  ReducedComm( <sc>, <left>, <right> )
##


#############################################################################
InstallMethod( ReducedComm,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is8BitsAssocWord,
      Is8BitsAssocWord ],
    0,
    FinPowConjCol_ReducedComm );


#############################################################################
InstallMethod( ReducedComm,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is16BitsAssocWord,
      Is16BitsAssocWord ],
    0,
    FinPowConjCol_ReducedComm );


#############################################################################
InstallMethod( ReducedComm,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is32BitsAssocWord,
      Is32BitsAssocWord ],
    0,
    FinPowConjCol_ReducedComm );


#############################################################################
##
#M  ReducedInverse( <sc>, <word> )
##
InstallMethod( ReducedInverse,
    IsIdenticalObjFamiliesRwsObj,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep,
      IsAssocWord ],
    0,

function( sc, word )
    return SingleCollector_Solution( sc, word,
               AssocWord( sc![SCP_DEFAULT_TYPE], [] ) );
end );


#############################################################################
##
#M  ReducedForm( <sc>, <word> )
##


#############################################################################
InstallMethod( ReducedForm,
    IsIdenticalObjFamiliesRwsObj,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector 
          and IsUpToDatePolycyclicCollector,
      Is8BitsAssocWord ],
    0,
    FinPowConjCol_ReducedForm );


#############################################################################
InstallMethod( ReducedForm,
    IsIdenticalObjFamiliesRwsObj,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector 
          and IsUpToDatePolycyclicCollector,
      Is16BitsAssocWord ],
    0,
    FinPowConjCol_ReducedForm );


#############################################################################
InstallMethod( ReducedForm,
    IsIdenticalObjFamiliesRwsObj,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is32BitsAssocWord ],
    0,
    FinPowConjCol_ReducedForm );


#############################################################################
##
#M  ReducedLeftQuotient( <sc>, <left>, <right> )
##


#############################################################################
InstallMethod( ReducedLeftQuotient,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is8BitsAssocWord,
      Is8BitsAssocWord ],
    0,
    FinPowConjCol_ReducedLeftQuotient );


#############################################################################
InstallMethod( ReducedLeftQuotient,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is16BitsAssocWord,
      Is16BitsAssocWord ],
    0,
    FinPowConjCol_ReducedLeftQuotient );


#############################################################################
InstallMethod( ReducedLeftQuotient,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is32BitsAssocWord,
      Is32BitsAssocWord ],
    0,
    FinPowConjCol_ReducedLeftQuotient );


#############################################################################
##
#M  ReducedOne( <sc> )
##
InstallMethod( ReducedOne,
    true,
    [ IsPowerConjugateCollector and IsFinite and IsSingleCollectorRep ],
    0,

function( sc )
    return AssocWord( sc![SCP_DEFAULT_TYPE], [] );
end );


#############################################################################
##
#M  ReducedProduct( <sc>, <left>, <right> )
##


#############################################################################
InstallMethod( ReducedProduct,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is8BitsAssocWord,
      Is8BitsAssocWord ],
    0,
    FinPowConjCol_ReducedProduct );


#############################################################################
InstallMethod( ReducedProduct,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is16BitsAssocWord,
      Is16BitsAssocWord ],
    0,
    FinPowConjCol_ReducedProduct );


#############################################################################
InstallMethod( ReducedProduct,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is32BitsAssocWord,
      Is32BitsAssocWord ],
    0,
    FinPowConjCol_ReducedProduct );


#############################################################################
##
#M  ReducedPower( <sc>, <left>, <pow> )
##


#############################################################################
InstallMethod( ReducedPower,
    IsIdenticalObjFamiliesRwsObjXXX,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is8BitsAssocWord,
      IsInt and IsSmallIntRep ],
    0,
    FinPowConjCol_ReducedPowerSmallInt );


#############################################################################
InstallMethod( ReducedPower,
    IsIdenticalObjFamiliesRwsObjXXX,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is16BitsAssocWord,
      IsInt and IsSmallIntRep ],
    0,
    FinPowConjCol_ReducedPowerSmallInt );


#############################################################################
InstallMethod( ReducedPower,
    IsIdenticalObjFamiliesRwsObjXXX,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is32BitsAssocWord,
      IsInt and IsSmallIntRep ],
    0,
    FinPowConjCol_ReducedPowerSmallInt );


#############################################################################
##
#M  ReducedQuotient( <sc>, <left>, <right> )
##


#############################################################################
InstallMethod( ReducedQuotient,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is8BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is8BitsAssocWord,
      Is8BitsAssocWord ],
    0,
    FinPowConjCol_ReducedQuotient );


#############################################################################
InstallMethod( ReducedQuotient,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is16BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is16BitsAssocWord,
      Is16BitsAssocWord ],
    0,
    FinPowConjCol_ReducedQuotient );


#############################################################################
InstallMethod( ReducedQuotient,
    IsIdenticalObjFamiliesRwsObjObj,
    [ IsPowerConjugateCollector and IsFinite and Is32BitsSingleCollectorRep
          and IsDefaultRhsTypeSingleCollector
          and IsUpToDatePolycyclicCollector,
      Is32BitsAssocWord,
      Is32BitsAssocWord ],
    0,
    FinPowConjCol_ReducedQuotient );


#############################################################################
##

#F  rwspcsng.gi . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
##