File: chap13_mj.html

package info (click to toggle)
gap 4.15.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 110,212 kB
  • sloc: ansic: 97,261; xml: 48,343; cpp: 13,946; sh: 4,900; perl: 1,650; javascript: 255; makefile: 252; ruby: 9
file content (948 lines) | stat: -rw-r--r-- 107,540 bytes parent folder | download | duplicates (2)
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
<?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>
<script type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<title>GAP (ref) - Chapter 13: Types of Objects</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="chap13"  onload="jscontent()">


<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0_mj.html">Top</a>  <a href="chap1_mj.html">1</a>  <a href="chap2_mj.html">2</a>  <a href="chap3_mj.html">3</a>  <a href="chap4_mj.html">4</a>  <a href="chap5_mj.html">5</a>  <a href="chap6_mj.html">6</a>  <a href="chap7_mj.html">7</a>  <a href="chap8_mj.html">8</a>  <a href="chap9_mj.html">9</a>  <a href="chap10_mj.html">10</a>  <a href="chap11_mj.html">11</a>  <a href="chap12_mj.html">12</a>  <a href="chap13_mj.html">13</a>  <a href="chap14_mj.html">14</a>  <a href="chap15_mj.html">15</a>  <a href="chap16_mj.html">16</a>  <a href="chap17_mj.html">17</a>  <a href="chap18_mj.html">18</a>  <a href="chap19_mj.html">19</a>  <a href="chap20_mj.html">20</a>  <a href="chap21_mj.html">21</a>  <a href="chap22_mj.html">22</a>  <a href="chap23_mj.html">23</a>  <a href="chap24_mj.html">24</a>  <a href="chap25_mj.html">25</a>  <a href="chap26_mj.html">26</a>  <a href="chap27_mj.html">27</a>  <a href="chap28_mj.html">28</a>  <a href="chap29_mj.html">29</a>  <a href="chap30_mj.html">30</a>  <a href="chap31_mj.html">31</a>  <a href="chap32_mj.html">32</a>  <a href="chap33_mj.html">33</a>  <a href="chap34_mj.html">34</a>  <a href="chap35_mj.html">35</a>  <a href="chap36_mj.html">36</a>  <a href="chap37_mj.html">37</a>  <a href="chap38_mj.html">38</a>  <a href="chap39_mj.html">39</a>  <a href="chap40_mj.html">40</a>  <a href="chap41_mj.html">41</a>  <a href="chap42_mj.html">42</a>  <a href="chap43_mj.html">43</a>  <a href="chap44_mj.html">44</a>  <a href="chap45_mj.html">45</a>  <a href="chap46_mj.html">46</a>  <a href="chap47_mj.html">47</a>  <a href="chap48_mj.html">48</a>  <a href="chap49_mj.html">49</a>  <a href="chap50_mj.html">50</a>  <a href="chap51_mj.html">51</a>  <a href="chap52_mj.html">52</a>  <a href="chap53_mj.html">53</a>  <a href="chap54_mj.html">54</a>  <a href="chap55_mj.html">55</a>  <a href="chap56_mj.html">56</a>  <a href="chap57_mj.html">57</a>  <a href="chap58_mj.html">58</a>  <a href="chap59_mj.html">59</a>  <a href="chap60_mj.html">60</a>  <a href="chap61_mj.html">61</a>  <a href="chap62_mj.html">62</a>  <a href="chap63_mj.html">63</a>  <a href="chap64_mj.html">64</a>  <a href="chap65_mj.html">65</a>  <a href="chap66_mj.html">66</a>  <a href="chap67_mj.html">67</a>  <a href="chap68_mj.html">68</a>  <a href="chap69_mj.html">69</a>  <a href="chap70_mj.html">70</a>  <a href="chap71_mj.html">71</a>  <a href="chap72_mj.html">72</a>  <a href="chap73_mj.html">73</a>  <a href="chap74_mj.html">74</a>  <a href="chap75_mj.html">75</a>  <a href="chap76_mj.html">76</a>  <a href="chap77_mj.html">77</a>  <a href="chap78_mj.html">78</a>  <a href="chap79_mj.html">79</a>  <a href="chap80_mj.html">80</a>  <a href="chap81_mj.html">81</a>  <a href="chap82_mj.html">82</a>  <a href="chap83_mj.html">83</a>  <a href="chap84_mj.html">84</a>  <a href="chap85_mj.html">85</a>  <a href="chap86_mj.html">86</a>  <a href="chap87_mj.html">87</a>  <a href="chapBib_mj.html">Bib</a>  <a href="chapInd_mj.html">Ind</a>  </div>

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

<p id="mathjaxlink" class="pcenter"><a href="chap13.html">[MathJax off]</a></p>
<p><a id="X7E8202627B421DB1" name="X7E8202627B421DB1"></a></p>
<div class="ChapSects"><a href="chap13_mj.html#X7E8202627B421DB1">13 <span class="Heading">Types of Objects</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X846063757EC05986">13.1 <span class="Heading">Families</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7CF70EAC84284919">13.1-1 FamilyObj</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7FB4123E7E22137D">13.1-2 NewFamily</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X84EFA4C07D4277BB">13.2 <span class="Heading">Filters</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X82E62B997C05E05E">13.2-1 RankFilter</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7A78ECC67E2C9D78">13.2-2 NamesFilter</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7F6645D87DD26CF0">13.2-3 FilterByName</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7F9568A67F3840DE">13.2-4 ShowImpliedFilters</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X836FAA18861BE387">13.2-5 FiltersType</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X7CC6903E78F24167">13.3 <span class="Heading">Categories</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X792A23BF82BDF66B">13.3-1 IsCategory</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X85C6EB707A406A5A">13.3-2 CategoriesOfObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X85D07C3E7F4D4043">13.3-3 CategoryByName</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X87F68F887B44DBBD">13.3-4 NewCategory</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X879DE2A17A6C6E92">13.3-5 DeclareCategory</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X787BACEE7937EF01">13.3-6 CategoryFamily</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X8698205F8648EB33">13.4 <span class="Heading">Representation</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X805F1C3B7C730062">13.4-1 <span class="Heading">Basic Representations of Objects</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X86D42C7783ACA5F4">13.4-2 IsRepresentation</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7BBE93BE7977750F">13.4-3 RepresentationsOfObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7CC8106F809E15CF">13.4-4 NewRepresentation</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7C81FB2682AE54CD">13.4-5 DeclareRepresentation</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X7C701DBF7BAE649A">13.5 <span class="Heading">Attributes</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7973C8F4782D15A1">13.5-1 IsAttribute</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7F7960338163AA88">13.5-2 KnownAttributesOfObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7B9654807858A3B0">13.5-3 NewAttribute</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7A00FC8A7A677A56">13.5-4 DeclareAttribute</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7A951C33839AF2C1">13.5-5 IsAttributeStoringRep</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X79DE5208877AE42A">13.6 <span class="Heading">Setter and Tester for Attributes</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X87D5B5AC7DAF932D">13.6-1 Tester</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7FD8952C841D2B1F">13.6-2 Setter</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X8529F8A17884A32C">13.6-3 AttributeValueNotSet</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X79120CE37BB69D11">13.6-4 InfoAttributes</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7851E2DB79656DB0">13.6-5 DisableAttributeValueStoring</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7E5DACBE7A9A9AD1">13.6-6 EnableAttributeValueStoring</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X871597447BB998A1">13.7 <span class="Heading">Properties</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X81F1C3EE83003FA0">13.7-1 IsProperty</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7E51C08286E03E7F">13.7-2 KnownPropertiesOfObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X86711BC77B62EB02">13.7-3 KnownTruePropertiesOfObject</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7F2D6FD979FE23DD">13.7-4 NewProperty</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7F4602F082682A04">13.7-5 DeclareProperty</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X7997705185C7E720">13.8 <span class="Heading">Other Filters</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X821635DA7821ED74">13.8-1 NewFilter</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X846EA18A7D36626C">13.8-2 DeclareFilter</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7C92D53E7920CE02">13.8-3 SetFilterObj</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X8117FD03870FB02E">13.8-4 ResetFilterObj</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap13_mj.html#X7E340B8C833BC440">13.9 <span class="Heading">Types</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7D3E6B6482BE5B16">13.9-1 TypeObj</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X85A60A7F8083C1C4">13.9-2 DataType</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap13_mj.html#X7CE39E9478AEC826">13.9-3 NewType</a></span>
</div></div>
</div>

<h3>13 <span class="Heading">Types of Objects</span></h3>

<p>Every <strong class="pkg">GAP</strong> object has a <em>type</em>. The type of an object is the information which is used to decide whether an operation is admissible or possible with that object as an argument, and if so, how it is to be performed (see Chapter <a href="chap78_mj.html#X8058CC8187162644"><span class="RefLink">78</span></a>).</p>

<p>For example, the types determine whether two objects can be multiplied and what function is called to compute the product. Analogously, the type of an object determines whether and how the size of the object can be computed. It is sometimes useful in discussing the type system, to identify types with the set of objects that have this type. Partial types can then also be regarded as sets, such that any type is the intersection of its parts.</p>

<p>The type of an object consists of two main parts, which describe different aspects of the object.</p>

<p>The <em>family</em> determines the relation of the object to other objects. For example, all permutations form a family. Another family consists of all collections of permutations, this family contains the set of permutation groups as a subset. A third family consists of all rational functions with coefficients in a certain family.</p>

<p>The other part of a type is a collection of <em>filters</em> (actually stored as a bit-list indicating, from the complete set of possible filters, which are included in this particular type). These filters are all treated equally by the method selection, but, from the viewpoint of their creation and use, they can be divided (with a small number of unimportant exceptions) into categories, representations, attribute testers and properties. Each of these is described in more detail below.</p>

<p>This chapter does not describe how types and their constituent parts can be created. Information about this topic can be found in Chapter <a href="chap79_mj.html#X83548994805AD1C9"><span class="RefLink">79</span></a>.</p>

<p><em>Note:</em> Detailed understanding of the type system is not required to use <strong class="pkg">GAP</strong>. It can be helpful, however, to understand how things work and why <strong class="pkg">GAP</strong> behaves the way it does.</p>

<p>A discussion of the type system can be found in <a href="chapBib_mj.html#biBBreuerLinton98">[BL98]</a>.</p>

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

<h4>13.1 <span class="Heading">Families</span></h4>

<p>The family of an object determines its relationship to other objects.</p>

<p>More precisely, the families form a partition of all <strong class="pkg">GAP</strong> objects such that the following two conditions hold: objects that are equal w.r.t. <code class="code">=</code> lie in the same family; and the family of the result of an operation depends only on the families of its operands.</p>

<p>The first condition means that a family can be regarded as a set of elements instead of a set of objects. Note that this does not hold for categories and representations (see below), two objects that are equal w.r.t. <code class="code">=</code> need not lie in the same categories and representations. For example, a sparsely represented matrix can be equal to a densely represented matrix. Similarly, each domain is equal w.r.t. <code class="code">=</code> to the sorted list of its elements, but a domain is not a list, and a list is not a domain.</p>

<p>Families are probably the least obvious part of the <strong class="pkg">GAP</strong> type system, so some remarks about the role of families are necessary. When one uses <strong class="pkg">GAP</strong> as it is, one will (better: should) not meet families at all. The two situations where families come into play are the following.</p>

<p>First, since families are used to describe relations between arguments of operations in the method selection mechanism (see Chapter <a href="chap78_mj.html#X8058CC8187162644"><span class="RefLink">78</span></a>, and also Chapter <a href="chap13_mj.html#X7E8202627B421DB1"><span class="RefLink">13</span></a>), one has to prescribe such a relation in each method installation (see <a href="chap78_mj.html#X795EE8257848B438"><span class="RefLink">78.3</span></a>); usual relations are <code class="func">ReturnTrue</code> (<a href="chap5_mj.html#X7DB422A2876CCC4D"><span class="RefLink">5.4-1</span></a>) (which means that any relation of the actual arguments is admissible), <code class="func">IsIdenticalObj</code> (<a href="chap12_mj.html#X7961183378DFB902"><span class="RefLink">12.5-1</span></a>) (which means that there are two arguments that lie in the same family), and <code class="code">IsCollsElms</code> (which means that there are two arguments, the first being a collection of elements that lie in the same family as the second argument).</p>

<p>Second –and this is the more complicated situation– whenever one creates a new kind of objects, one has to decide what its family shall be. If the new object shall be equal to existing objects, for example if it is just represented in a different way, there is no choice: The new object must lie in the same family as all objects that shall be equal to it. So only if the new object is different (w.r.t. the equality <q><code class="code">=</code></q>) from all other <strong class="pkg">GAP</strong> objects, we are likely to create a new family for it. Note that enlarging an existing family by such new objects may be problematic because of implications that have been installed for all objects of the family in question. The choice of families depends on the applications one has in mind. For example, if the new objects in question are not likely to be arguments of operations for which family relations are relevant (for example binary arithmetic operations), one could create one family for all such objects, and regard it as <q>the family of all those <strong class="pkg">GAP</strong> objects that would in fact not need a family</q>. On the other extreme, if one wants to create domains of the new objects then one has to choose the family in such a way that all intended elements of a domain do in fact lie in the same family. (Remember that a domain is a collection, see Chapter <a href="chap12_mj.html#X7BAF69417BB925F6"><span class="RefLink">12.4</span></a>, and that a collection consists of elements in the same family, see Chapter <a href="chap30_mj.html#X8050A8037984E5B6"><span class="RefLink">30</span></a> and Section <a href="chap13_mj.html#X846063757EC05986"><span class="RefLink">13.1</span></a>.)</p>

<p>Let us look at an example. Suppose that no permutations are available in <strong class="pkg">GAP</strong>, and that we want to implement permutations. Clearly we want to support permutation groups, but it is not a priori clear how to distribute the new permutations into families. We can put all permutations into one family; this is how in fact permutations are implemented in <strong class="pkg">GAP</strong>. But it would also be possible to put all permutations of a given degree into a family of their own; this would for example mean that for each degree, there would be distinguished trivial permutations, and that the stabilizer of the point <code class="code">5</code> in the symmetric group on the points <code class="code">1</code>, <code class="code">2</code>, <span class="SimpleMath">\(\ldots\)</span>, <code class="code">5</code> is not regarded as equal to the symmetric group on <code class="code">1</code>, <code class="code">2</code>, <code class="code">3</code>, <code class="code">4</code>. Note that the latter approach would have the advantage that it is no problem to construct permutations and permutation groups acting on arbitrary (finite) sets, for example by constructing first the symmetric group on the set and then generating any desired permutation group as a subgroup of this symmetric group.</p>

<p>So one aspect concerning a reasonable choice of families is to make the families large enough for being able to form interesting domains of elements in the family. But on the other hand, it is useful to choose the families small enough for admitting meaningful relations between objects. For example, the elements of different free groups in <strong class="pkg">GAP</strong> lie in different families; the multiplication of free group elements is installed only for the case that the two operands lie in the same family, with the effect that one cannot erroneously form the product of elements from different free groups. In this case, families appear as a tool for providing useful restrictions.</p>

<p>As another example, note that an element and a collection containing this element never lie in the same family, by the general implementation of collections; namely, the family of a collection of elements in the family <var class="Arg">Fam</var> is the collections family of <var class="Arg">Fam</var> (see <code class="func">CollectionsFamily</code> (<a href="chap30_mj.html#X84E5A67E87D8DD66"><span class="RefLink">30.2-1</span></a>)). This means that for a collection, we need not (because we cannot) decide about its family.</p>

<p>A few functions in <strong class="pkg">GAP</strong> return families, see <code class="func">CollectionsFamily</code> (<a href="chap30_mj.html#X84E5A67E87D8DD66"><span class="RefLink">30.2-1</span></a>) and <code class="func">ElementsFamily</code> (<a href="chap30_mj.html#X864BB3748546F63F"><span class="RefLink">30.2-3</span></a>).</p>

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

<h5>13.1-1 FamilyObj</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FamilyObj</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns the family of the object <var class="Arg">obj</var>.</p>

<p>The family of the object <var class="Arg">obj</var> is itself an object, its family is <code class="code">FamilyOfFamilies</code>.</p>

<p>It should be emphasized that families may be created when they are needed. For example, the family of elements of a finitely presented group is created only after the presentation has been constructed. Thus families are the dynamic part of the type system, that is, the part that is not fixed after the initialisation of <strong class="pkg">GAP</strong>.</p>

<p>Families can be parametrized. For example, the elements of each finitely presented group form a family of their own. Here the family of elements and the finitely presented group coincide when viewed as sets. Note that elements in different finitely presented groups lie in different families. This distinction allows <strong class="pkg">GAP</strong> to forbid multiplications of elements in different finitely presented groups.</p>

<p>As a special case, families can be parametrized by other families. An important example is the family of <em>collections</em> that can be formed for each family. A collection consists of objects that lie in the same family, it is either a nonempty dense list of objects from the same family or a domain.</p>

<p>Note that every domain is a collection, that is, it is not possible to construct domains whose elements lie in different families. For example, a polynomial ring over the rationals cannot contain the integer <code class="code">0</code> because the family that contains the integers does not contain polynomials. So one has to distinguish the integer zero from each zero polynomial.</p>

<p>Let us look at this example from a different viewpoint. A polynomial ring and its coefficients ring lie in different families, hence the coefficients ring cannot be embedded <q>naturally</q> into the polynomial ring in the sense that it is a subset. But it is possible to allow, e.g., the multiplication of an integer and a polynomial over the integers. The relation between the arguments, namely that one is a coefficient and the other a polynomial, can be detected from the relation of their families. Moreover, this analysis is easier than in a situation where the rationals would lie in one family together with all polynomials over the rationals, because then the relation of families would not distinguish the multiplication of two polynomials, the multiplication of two coefficients, and the multiplication of a coefficient with a polynomial. So the wish to describe relations between elements can be taken as a motivation for the introduction of families.</p>

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

<h5>13.1-2 NewFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NewFamily</code>( <var class="Arg">name</var>[, <var class="Arg">req</var>[, <var class="Arg">imp</var>[, <var class="Arg">famfilter</var>]]] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">NewFamily</code> returns a new family <var class="Arg">fam</var> with name <var class="Arg">name</var>. The argument <var class="Arg">req</var>, if present, is a filter of which <var class="Arg">fam</var> shall be a subset. If one tries to create an object in <var class="Arg">fam</var> that does not lie in the filter <var class="Arg">req</var>, an error message is printed. Also the argument <var class="Arg">imp</var>, if present, is a filter of which <var class="Arg">fam</var> shall be a subset. Any object that is created in the family <var class="Arg">fam</var> will lie automatically in the filter <var class="Arg">imp</var>.</p>

<p>The filter <var class="Arg">famfilter</var>, if given, specifies a filter that will hold for the family <var class="Arg">fam</var> (not for objects in <var class="Arg">fam</var>).</p>

<p>Families are always represented as component objects (see <a href="chap79_mj.html#X866E223484649E5A"><span class="RefLink">79.2</span></a>). This means that components can be used to store and access useful information about the family.</p>

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

<h4>13.2 <span class="Heading">Filters</span></h4>

<p>A <em>filter</em> is a special unary <strong class="pkg">GAP</strong> function that returns either <code class="keyw">true</code> or <code class="keyw">false</code>, depending on whether or not the argument lies in the set defined by the filter. Filters are used to express different aspects of information about a <strong class="pkg">GAP</strong> object, which are described below (see <a href="chap13_mj.html#X7CC6903E78F24167"><span class="RefLink">13.3</span></a>, <a href="chap13_mj.html#X8698205F8648EB33"><span class="RefLink">13.4</span></a>, <a href="chap13_mj.html#X7C701DBF7BAE649A"><span class="RefLink">13.5</span></a>, <a href="chap13_mj.html#X79DE5208877AE42A"><span class="RefLink">13.6</span></a>, <a href="chap13_mj.html#X871597447BB998A1"><span class="RefLink">13.7</span></a>, <a href="chap13_mj.html#X7997705185C7E720"><span class="RefLink">13.8</span></a>).</p>

<p>Presently any filter in <strong class="pkg">GAP</strong> is implemented as a function which corresponds to a set of positions in the bitlist which forms part of the type of each <strong class="pkg">GAP</strong> object, and returns <code class="keyw">true</code> if and only if the bitlist of the type of the argument has the value <code class="keyw">true</code> at all of these positions.</p>

<p>The intersection (or meet) of two filters <var class="Arg">filt1</var>, <var class="Arg">filt2</var> is again a filter, it can be formed as</p>

<p><var class="Arg">filt1</var> <code class="keyw">and</code> <var class="Arg">filt2</var></p>

<p>See <a href="chap20_mj.html#X79AD41A185FD7213"><span class="RefLink">20.4</span></a> for more details.</p>

<p>For example, <code class="code">IsList and IsEmpty</code> is a filter that returns <code class="keyw">true</code> if its argument is an empty list, and <code class="keyw">false</code> otherwise. The filter <code class="func">IsGroup</code> (<a href="chap39_mj.html#X7939B3177BBD61E4"><span class="RefLink">39.2-7</span></a>) is defined as the intersection of the category <code class="func">IsMagmaWithInverses</code> (<a href="chap35_mj.html#X82CBFF648574B830"><span class="RefLink">35.1-4</span></a>) and the property <code class="func">IsAssociative</code> (<a href="chap35_mj.html#X7C83B5A47FD18FB7"><span class="RefLink">35.4-7</span></a>).</p>

<p>A filter that is not the meet of other filters is called a <em>simple filter</em>. For example, each attribute tester (see <a href="chap13_mj.html#X79DE5208877AE42A"><span class="RefLink">13.6</span></a>) is a simple filter. Each simple filter corresponds to a position in the bitlist currently used as part of the data structure representing a type.</p>

<p>Every filter has a <em>rank</em>, which is used to define a ranking of the methods installed for an operation, see Section <a href="chap78_mj.html#X795EE8257848B438"><span class="RefLink">78.3</span></a>. The rank of a filter can be accessed with <code class="func">RankFilter</code> (<a href="chap13_mj.html#X82E62B997C05E05E"><span class="RefLink">13.2-1</span></a>).</p>

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

<h5>13.2-1 RankFilter</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RankFilter</code>( <var class="Arg">filt</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>For simple filters, an <em>incremental rank</em> is defined when the filter is created, see the sections about the creation of filters: <code class="func">NewCategory</code> (<a href="chap13_mj.html#X87F68F887B44DBBD"><span class="RefLink">13.3-4</span></a>), <code class="func">NewRepresentation</code> (<a href="chap13_mj.html#X7CC8106F809E15CF"><span class="RefLink">13.4-4</span></a>), <code class="func">NewAttribute</code> (<a href="chap13_mj.html#X7B9654807858A3B0"><span class="RefLink">13.5-3</span></a>), <code class="func">NewProperty</code> (<a href="chap13_mj.html#X7F2D6FD979FE23DD"><span class="RefLink">13.7-4</span></a>), <code class="func">NewFilter</code> (<a href="chap13_mj.html#X821635DA7821ED74"><span class="RefLink">13.8-1</span></a>). For an arbitrary filter, its rank is given by the sum of the incremental ranks of the <em>involved</em> simple filters; in addition to the implied filters, these are also the required filters of attributes (again see the sections about the creation of filters). In other words, for the purpose of computing the rank and <em>only</em> for this purpose, attribute testers are treated as if they would imply the requirements of their attributes.</p>

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

<h5>13.2-2 NamesFilter</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NamesFilter</code>( <var class="Arg">filt</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">NamesFilter</code> returns a list of names of the <em>implied</em> simple filters of the filter <var class="Arg">filt</var>, these are all those simple filters <code class="code">imp</code> such that every object in <var class="Arg">filt</var> also lies in <code class="code">imp</code>. For implications between filters, see <code class="func">ShowImpliedFilters</code> (<a href="chap13_mj.html#X7F9568A67F3840DE"><span class="RefLink">13.2-4</span></a>) as well as sections <a href="chap78_mj.html#X7FB5016E83DB4349"><span class="RefLink">78.8</span></a>, <code class="func">NewCategory</code> (<a href="chap13_mj.html#X87F68F887B44DBBD"><span class="RefLink">13.3-4</span></a>), <code class="func">NewRepresentation</code> (<a href="chap13_mj.html#X7CC8106F809E15CF"><span class="RefLink">13.4-4</span></a>), <code class="func">NewAttribute</code> (<a href="chap13_mj.html#X7B9654807858A3B0"><span class="RefLink">13.5-3</span></a>), <code class="func">NewProperty</code> (<a href="chap13_mj.html#X7F2D6FD979FE23DD"><span class="RefLink">13.7-4</span></a>).</p>

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

<h5>13.2-3 FilterByName</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FilterByName</code>( <var class="Arg">name</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>finds the filter with name <var class="Arg">name</var> in the global FILTERS list. This is useful to find filters that were created but not bound to a global variable.</p>

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

<h5>13.2-4 ShowImpliedFilters</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShowImpliedFilters</code>( <var class="Arg">filter</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>Displays information about the filters that may be implied by <var class="Arg">filter</var>. They are given by their names. <code class="func">ShowImpliedFilters</code> first displays the names of all filters that are unconditionally implied by <var class="Arg">filter</var>. It then displays implications that require further filters to be present (indicating by <code class="code">+</code> the required further filters).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ShowImpliedFilters(IsNilpotentGroup);</span>
Implies:
   IsListOrCollection
   IsCollection
   IsDuplicateFree
   IsExtLElement
   CategoryCollections(IsExtLElement)
   IsExtRElement
   CategoryCollections(IsExtRElement)
   CategoryCollections(IsMultiplicativeElement)
   CategoryCollections(IsMultiplicativeElementWithOne)
   CategoryCollections(IsMultiplicativeElementWithInverse)
   IsGeneralizedDomain
   IsMagma
   IsMagmaWithOne
   IsMagmaWithInversesIfNonzero
   IsMagmaWithInverses
   IsAssociative
   HasMultiplicativeNeutralElement
   IsGeneratorsOfSemigroup
   IsSimpleSemigroup
   IsRegularSemigroup
   IsInverseSemigroup
   IsCompletelyRegularSemigroup
   IsGroupAsSemigroup
   IsMonoidAsSemigroup
   IsOrthodoxSemigroup
   IsSupersolvableGroup
   IsSolvableGroup
   IsNilpotentByFinite


May imply with:
+IsFinitelyGeneratedGroup
   IsPolycyclicGroup

</pre></div>

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

<h5>13.2-5 FiltersType</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FiltersType</code>( <var class="Arg">type</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; FiltersObj</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>returns a list of the filters in the type <var class="Arg">type</var>, or in the type of the object <var class="Arg">object</var> respectively.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">FiltersObj(fail);</span>
[ &lt;Category "IsBool"&gt;, &lt;Representation "IsInternalRep"&gt; ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">FiltersType(TypeOfTypes);</span>
[ &lt;Representation "IsPositionalObjectRep"&gt;, &lt;Category "IsType"&gt;, &lt;Representation "IsTypeDefaultRep"&gt; ]
</pre></div>

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

<h4>13.3 <span class="Heading">Categories</span></h4>

<p>The <em>categories</em> of an object are filters (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) that determine what operations an object admits. For example, all integers form a category, all rationals form a category, and all rational functions form a category. An object which claims to lie in a certain category is accepting the requirement that it should have methods for certain operations (and perhaps that their behaviour should satisfy certain axioms). For example, an object lying in the category <code class="func">IsList</code> (<a href="chap21_mj.html#X7C4CC4EA8299701E"><span class="RefLink">21.1-1</span></a>) must have methods for <code class="func">Length</code> (<a href="chap21_mj.html#X780769238600AFD1"><span class="RefLink">21.17-5</span></a>), <code class="func">IsBound<span>\</span>[<span>\</span>]</code> (<a href="chap21_mj.html#X8297BBCD79642BE6"><span class="RefLink">21.2-1</span></a>) and the list element access operation <code class="func"><span>\</span>[<span>\</span>]</code> (<a href="chap21_mj.html#X8297BBCD79642BE6"><span class="RefLink">21.2-1</span></a>).</p>

<p>An object can lie in several categories. For example, a row vector lies in the categories <code class="func">IsList</code> (<a href="chap21_mj.html#X7C4CC4EA8299701E"><span class="RefLink">21.1-1</span></a>) and <code class="func">IsVector</code> (<a href="chap31_mj.html#X802F34F280B29DF4"><span class="RefLink">31.14-14</span></a>); each list lies in the category <code class="func">IsCopyable</code> (<a href="chap12_mj.html#X811EFD727EBD1ADC"><span class="RefLink">12.6-1</span></a>), and depending on whether or not it is mutable, it may lie in the category <code class="func">IsMutable</code> (<a href="chap12_mj.html#X7999AD1D7A4F1F46"><span class="RefLink">12.6-2</span></a>). Every domain lies in the category <code class="func">IsDomain</code> (<a href="chap31_mj.html#X86B4AC017FAF4D12"><span class="RefLink">31.9-1</span></a>).</p>

<p>Of course some categories of a mutable object may change when the object is changed. For example, after assigning values to positions of a mutable non-dense list, this list may become part of the category <code class="func">IsDenseList</code> (<a href="chap21_mj.html#X870AA9D8798C93DD"><span class="RefLink">21.1-2</span></a>).</p>

<p>However, if an object is immutable then the set of categories it lies in is fixed.</p>

<p>All categories in the library are created during initialization, in particular they are not created dynamically at runtime.</p>

<p>The following list gives an overview of important categories of arithmetic objects. Indented categories are to be understood as subcategories of the non indented category listed above it.</p>


<div class="example"><pre>
    IsObject
        IsExtLElement
        IsExtRElement
            IsMultiplicativeElement
                IsMultiplicativeElementWithOne
                    IsMultiplicativeElementWithInverse
        IsExtAElement
            IsAdditiveElement
                IsAdditiveElementWithZero
                    IsAdditiveElementWithInverse
</pre></div>

<p>Every object lies in the category <code class="func">IsObject</code> (<a href="chap12_mj.html#X7B130AC98415CAFB"><span class="RefLink">12.1-1</span></a>).</p>

<p>The categories <code class="func">IsExtLElement</code> (<a href="chap31_mj.html#X860D1E387DD5CCCF"><span class="RefLink">31.14-8</span></a>) and <code class="func">IsExtRElement</code> (<a href="chap31_mj.html#X809E0C097E480AF1"><span class="RefLink">31.14-9</span></a>) contain objects that can be multiplied with other objects via <code class="code">*</code> from the left and from the right, respectively. These categories are required for the operands of the operation <code class="code">*</code>.</p>

<p>The category <code class="func">IsMultiplicativeElement</code> (<a href="chap31_mj.html#X797D3B2A7A2B2F53"><span class="RefLink">31.14-10</span></a>) contains objects that can be multiplied from the left and from the right with objects from the same family. <code class="func">IsMultiplicativeElementWithOne</code> (<a href="chap31_mj.html#X82BC294F7D388AE8"><span class="RefLink">31.14-11</span></a>) contains objects <code class="code">obj</code> for which a multiplicatively neutral element can be obtained by taking the <span class="SimpleMath">\(0\)</span>-th power <code class="code">obj^0</code>. <code class="func">IsMultiplicativeElementWithInverse</code> (<a href="chap31_mj.html#X7FDB14E57814FA3B"><span class="RefLink">31.14-13</span></a>) contains objects <code class="code">obj</code> for which a multiplicative inverse can be obtained by forming <code class="code">obj^-1</code>.</p>

<p>Likewise, the categories <code class="func">IsExtAElement</code> (<a href="chap31_mj.html#X7FBD4F65861C2DF2"><span class="RefLink">31.14-1</span></a>), <code class="func">IsAdditiveElement</code> (<a href="chap31_mj.html#X78D042B486E1D7F7"><span class="RefLink">31.14-3</span></a>), <code class="func">IsAdditiveElementWithZero</code> (<a href="chap31_mj.html#X87F3552A789C572D"><span class="RefLink">31.14-5</span></a>) and <code class="func">IsAdditiveElementWithInverse</code> (<a href="chap31_mj.html#X7C0E4AE883947778"><span class="RefLink">31.14-7</span></a>) contain objects that can be added via <code class="code">+</code> to other objects, objects that can be added to objects of the same family, objects for which an additively neutral element can be obtained by multiplication with zero, and objects for which an additive inverse can be obtained by multiplication with <code class="code">-1</code>.</p>

<p>So a vector lies in <code class="func">IsExtLElement</code> (<a href="chap31_mj.html#X860D1E387DD5CCCF"><span class="RefLink">31.14-8</span></a>), <code class="func">IsExtRElement</code> (<a href="chap31_mj.html#X809E0C097E480AF1"><span class="RefLink">31.14-9</span></a>) and <code class="func">IsAdditiveElementWithInverse</code> (<a href="chap31_mj.html#X7C0E4AE883947778"><span class="RefLink">31.14-7</span></a>). A ring element must additionally lie in <code class="func">IsMultiplicativeElement</code> (<a href="chap31_mj.html#X797D3B2A7A2B2F53"><span class="RefLink">31.14-10</span></a>).</p>

<p>As stated above it is not guaranteed by the categories of objects whether the result of an operation with these objects as arguments is defined. For example, the category <code class="func">IsMatrix</code> (<a href="chap24_mj.html#X7E1AE46B862B185F"><span class="RefLink">24.2-1</span></a>) is a subcategory of <code class="func">IsMultiplicativeElementWithInverse</code> (<a href="chap31_mj.html#X7FDB14E57814FA3B"><span class="RefLink">31.14-13</span></a>). Clearly not every matrix has a multiplicative inverse. But the category <code class="func">IsMatrix</code> (<a href="chap24_mj.html#X7E1AE46B862B185F"><span class="RefLink">24.2-1</span></a>) makes each matrix an admissible argument of the operation <code class="func">Inverse</code> (<a href="chap31_mj.html#X78EE524E83624057"><span class="RefLink">31.10-8</span></a>), which may sometimes return <code class="keyw">fail</code>. Likewise, two matrices can be multiplied only if they are of appropriate shapes.</p>

<p>Analogous to the categories of arithmetic elements, there are categories of domains of these elements.</p>


<div class="example"><pre>
    IsObject
        IsDomain
            IsMagma
                IsMagmaWithOne
                    IsMagmaWithInversesIfNonzero
                        IsMagmaWithInverses
            IsAdditiveMagma
                IsAdditiveMagmaWithZero
                    IsAdditiveMagmaWithInverses
            IsExtLSet
            IsExtRSet
</pre></div>

<p>Of course <code class="func">IsDomain</code> (<a href="chap31_mj.html#X86B4AC017FAF4D12"><span class="RefLink">31.9-1</span></a>) is a subcategory of <code class="func">IsObject</code> (<a href="chap12_mj.html#X7B130AC98415CAFB"><span class="RefLink">12.1-1</span></a>). A domain that is closed under multiplication <code class="code">*</code> is called a magma and it lies in the category <code class="func">IsMagma</code> (<a href="chap35_mj.html#X87D3F38B7EAB13FA"><span class="RefLink">35.1-1</span></a>). If a magma is closed under taking the identity, it lies in <code class="func">IsMagmaWithOne</code> (<a href="chap35_mj.html#X86071DE7835F1C7C"><span class="RefLink">35.1-2</span></a>), and if it is also closed under taking inverses, it lies in <code class="func">IsMagmaWithInverses</code> (<a href="chap35_mj.html#X82CBFF648574B830"><span class="RefLink">35.1-4</span></a>). The category <code class="func">IsMagmaWithInversesIfNonzero</code> (<a href="chap35_mj.html#X83E4903D7FBB2E24"><span class="RefLink">35.1-3</span></a>) denotes closure under taking inverses only for nonzero elements, every division ring lies in this category.</p>

<p>Note that every set of categories constitutes its own notion of generation, for example a group may be generated as a magma with inverses by some elements, but to generate it as a magma with one it may be necessary to take the union of these generators and their inverses.</p>

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

<h5>13.3-1 IsCategory</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsCategory</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns <code class="keyw">true</code> if <var class="Arg">object</var> is a category (see <a href="chap13_mj.html#X7CC6903E78F24167"><span class="RefLink">13.3</span></a>), and <code class="keyw">false</code> otherwise.</p>

<p>Note that <strong class="pkg">GAP</strong> categories are <em>not</em> categories in the usual mathematical sense.</p>

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

<h5>13.3-2 CategoriesOfObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CategoriesOfObject</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>returns a list of the names of the categories in which <var class="Arg">object</var> lies.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:=Group((1,2),(1,2,3));;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CategoriesOfObject(g);</span>
[ "IsListOrCollection", "IsCollection", "IsExtLElement",
  "CategoryCollections(IsExtLElement)", "IsExtRElement",
  "CategoryCollections(IsExtRElement)",
  "CategoryCollections(IsMultiplicativeElement)",
  "CategoryCollections(IsMultiplicativeElementWithOne)",
  "CategoryCollections(IsMultiplicativeElementWithInverse)",
  "CategoryCollections(IsAssociativeElement)",
  "CategoryCollections(IsFiniteOrderElement)", "IsGeneralizedDomain",
  "CategoryCollections(IsPerm)", "IsMagma", "IsMagmaWithOne",
  "IsMagmaWithInversesIfNonzero", "IsMagmaWithInverses" ]
</pre></div>

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

<h5>13.3-3 CategoryByName</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CategoryByName</code>( <var class="Arg">name</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns the category with name <var class="Arg">name</var> if it is found, or fail otherwise.</p>

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

<h5>13.3-4 NewCategory</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NewCategory</code>( <var class="Arg">name</var>, <var class="Arg">super</var>[, <var class="Arg">rank</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">NewCategory</code> returns a new category <var class="Arg">cat</var> that has the name <var class="Arg">name</var> and is contained in the filter <var class="Arg">super</var>, see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>. This means that every object in <var class="Arg">cat</var> lies automatically also in <var class="Arg">super</var>. We say also that <var class="Arg">super</var> is an implied filter of <var class="Arg">cat</var>.</p>

<p>For example, if one wants to create a category of group elements then <var class="Arg">super</var> should be <code class="func">IsMultiplicativeElementWithInverse</code> (<a href="chap31_mj.html#X7FDB14E57814FA3B"><span class="RefLink">31.14-13</span></a>) or a subcategory of it. If no specific supercategory of <var class="Arg">cat</var> is known, <var class="Arg">super</var> may be <code class="func">IsObject</code> (<a href="chap12_mj.html#X7B130AC98415CAFB"><span class="RefLink">12.1-1</span></a>).</p>

<p>The optional third argument <var class="Arg">rank</var> denotes the incremental rank (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) of <var class="Arg">cat</var>, the default value is 1.</p>

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

<h5>13.3-5 DeclareCategory</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DeclareCategory</code>( <var class="Arg">name</var>, <var class="Arg">super</var>[, <var class="Arg">rank</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>does the same as <code class="func">NewCategory</code> (<a href="chap13_mj.html#X87F68F887B44DBBD"><span class="RefLink">13.3-4</span></a>) and then binds the result to the global variable <var class="Arg">name</var>. The variable must previously be writable, and is made read-only by this function.</p>

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

<h5>13.3-6 CategoryFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CategoryFamily</code>( <var class="Arg">cat</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>For a category <var class="Arg">cat</var>, <code class="func">CategoryFamily</code> returns the <em>family category</em> of <var class="Arg">cat</var>. This is a category in which all families lie that know from their creation that all their elements are in the category <var class="Arg">cat</var>, see <a href="chap13_mj.html#X846063757EC05986"><span class="RefLink">13.1</span></a>.</p>

<p>For example, a family of associative words is in the category <code class="code">CategoryFamily( IsAssocWord )</code>, and one can distinguish such a family from others by this category. So it is possible to install methods for operations that require one argument to be a family of associative words.</p>

<p><code class="func">CategoryFamily</code> is quite technical, and in fact of minor importance.</p>

<p>See also <code class="func">CategoryCollections</code> (<a href="chap30_mj.html#X78C38017804B2EA7"><span class="RefLink">30.2-4</span></a>).</p>

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

<h4>13.4 <span class="Heading">Representation</span></h4>

<p>The <em>representation</em> of an object is a set of filters (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) that determines how an object is actually represented. For example, a matrix or a polynomial can be stored sparsely or densely; all dense polynomials form a representation. An object which claims to lie in a certain representation is accepting the requirement that certain fields in the data structure be present and have specified meanings.</p>

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

<h5>13.4-1 <span class="Heading">Basic Representations of Objects</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsInternalRep</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; IsDataObjectRep</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; IsPositionalObjectRep</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; IsComponentObjectRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;representation&nbsp;)</td></tr></table></div>
<p><strong class="pkg">GAP</strong> distinguishes four essentially different ways to represent objects. First there are the representations <code class="func">IsInternalRep</code> for internal objects such as integers and permutations, and <code class="func">IsDataObjectRep</code> for other objects that are created and whose data are accessible only by kernel functions. The data structures underlying such objects cannot be manipulated at the <strong class="pkg">GAP</strong> level.</p>

<p>All other objects are either in the representation <code class="func">IsComponentObjectRep</code> or in the representation <code class="func">IsPositionalObjectRep</code>, see <a href="chap79_mj.html#X866E223484649E5A"><span class="RefLink">79.2</span></a> and <a href="chap79_mj.html#X834893D07FAA6FD2"><span class="RefLink">79.3</span></a>.</p>

<p>An object can belong to several representations in the sense that it lies in several subrepresentations of <code class="func">IsComponentObjectRep</code> or of <code class="func">IsPositionalObjectRep</code>. The representations to which an object belongs should form a chain and either two representations are disjoint or one is contained in the other. So the subrepresentations of <code class="func">IsComponentObjectRep</code> and <code class="func">IsPositionalObjectRep</code> each form trees. In the language of Object Oriented Programming, we support only single inheritance for representations.</p>

<p>These trees are typically rather shallow, since for one representation to be contained in another implies that all the components of the data structure implied by the containing representation, are present in, and have the same meaning in, the smaller representation (whose data structure presumably contains some additional components).</p>

<p>Objects may change their representation, for example a mutable list of characters can be converted into a string.</p>

<p>All representations in the library are created during initialization, in particular they are not created dynamically at runtime.</p>

<p>Examples of subrepresentations of <code class="func">IsPositionalObjectRep</code> are <code class="code">IsModulusRep</code>, which is used for residue classes in the ring of integers, and <code class="code">IsDenseCoeffVectorRep</code>, which is used for elements of algebras that are defined by structure constants.</p>

<p>An important subrepresentation of <code class="func">IsComponentObjectRep</code> is <code class="func">IsAttributeStoringRep</code> (<a href="chap13_mj.html#X7A951C33839AF2C1"><span class="RefLink">13.5-5</span></a>), which is used for many domains and some other objects. It provides automatic storing of all attribute values (see Section <a href="chap13_mj.html#X7C701DBF7BAE649A"><span class="RefLink">13.5</span></a>).</p>

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

<h5>13.4-2 IsRepresentation</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsRepresentation</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns <code class="keyw">true</code> if <var class="Arg">object</var> is a representation (see <a href="chap13_mj.html#X8698205F8648EB33"><span class="RefLink">13.4</span></a>), and <code class="keyw">false</code> otherwise.</p>

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

<h5>13.4-3 RepresentationsOfObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RepresentationsOfObject</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>returns a list of the names of the representations <var class="Arg">object</var> has.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:=Group((1,2),(1,2,3));;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RepresentationsOfObject(g);</span>
[ "IsComponentObjectRep", "IsAttributeStoringRep" ]
</pre></div>

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

<h5>13.4-4 NewRepresentation</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NewRepresentation</code>( <var class="Arg">name</var>, <var class="Arg">super</var>[, <var class="Arg">slots</var>[, <var class="Arg">req</var>]] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">NewRepresentation</code> returns a new representation <var class="Arg">rep</var> that has the name <var class="Arg">name</var> and is a subrepresentation of the representation <var class="Arg">super</var>. This means that every object in <var class="Arg">rep</var> lies automatically also in <var class="Arg">super</var>. We say also that <var class="Arg">super</var> is an implied filter of <var class="Arg">rep</var>.</p>

<p>Each representation in <strong class="pkg">GAP</strong> is a subrepresentation of exactly one of the four representations <code class="func">IsInternalRep</code> (<a href="chap13_mj.html#X805F1C3B7C730062"><span class="RefLink">13.4-1</span></a>), <code class="func">IsDataObjectRep</code> (<a href="chap13_mj.html#X805F1C3B7C730062"><span class="RefLink">13.4-1</span></a>), <code class="func">IsComponentObjectRep</code> (<a href="chap13_mj.html#X805F1C3B7C730062"><span class="RefLink">13.4-1</span></a>), <code class="func">IsPositionalObjectRep</code> (<a href="chap13_mj.html#X805F1C3B7C730062"><span class="RefLink">13.4-1</span></a>). The data describing objects in the former two can be accessed only via <strong class="pkg">GAP</strong> kernel functions, the data describing objects in the latter two is accessible also in library functions, see <a href="chap79_mj.html#X866E223484649E5A"><span class="RefLink">79.2</span></a> and <a href="chap79_mj.html#X834893D07FAA6FD2"><span class="RefLink">79.3</span></a> for the details.</p>

<p>The optional third and fourth arguments <var class="Arg">slots</var> and <var class="Arg">req</var> are (and always were) unused and are only provided for backwards compatibility. Note that <var class="Arg">slots</var> was required (but still unused) before GAP 4.12.</p>

<p>The incremental rank (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) of <var class="Arg">rep</var> is 1.</p>

<p>Examples for the use of <code class="func">NewRepresentation</code> can be found in <a href="chap79_mj.html#X866E223484649E5A"><span class="RefLink">79.2</span></a>, <a href="chap79_mj.html#X834893D07FAA6FD2"><span class="RefLink">79.3</span></a>, and also in <a href="chap81_mj.html#X85B914DD81732492"><span class="RefLink">81.3</span></a>.</p>

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

<h5>13.4-5 DeclareRepresentation</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DeclareRepresentation</code>( <var class="Arg">name</var>, <var class="Arg">super</var>[, <var class="Arg">slots</var>[, <var class="Arg">req</var>]] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>does the same as <code class="func">NewRepresentation</code> (<a href="chap13_mj.html#X7CC8106F809E15CF"><span class="RefLink">13.4-4</span></a>) and then binds the result to the global variable <var class="Arg">name</var>. The variable must previously be writable, and is made read-only by this function.</p>

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

<h4>13.5 <span class="Heading">Attributes</span></h4>

<p>The attributes of an object describe knowledge about it.</p>

<p>An attribute is a unary operation without side-effects.</p>

<p>An object may store values of its attributes once they have been computed, and claim that it knows these values. Note that <q>store</q> and <q>know</q> have to be understood in the sense that it is very cheap to get such a value when the attribute is called again.</p>

<p>The value returned by an attribute is in general immutable (see <a href="chap12_mj.html#X7F0C119682196D65"><span class="RefLink">12.6</span></a>), except if the attribute had been specially constructed as <q>mutable attribute</q>, see <code class="func">NewAttribute</code> (<a href="chap13_mj.html#X7B9654807858A3B0"><span class="RefLink">13.5-3</span></a>).</p>

<p>Note that functions installed as methods for attributes may return mutable objects, the attribute returns the value of <code class="func">Immutable</code> (<a href="chap12_mj.html#X7F0ABF2C870B0CBB"><span class="RefLink">12.6-3</span></a>) for the result. Thus it is recommended that these methods ensure their return values are immutable, e.g., by calling <code class="func">MakeImmutable</code> (<a href="chap12_mj.html#X80CE136D804097C7"><span class="RefLink">12.6-4</span></a>) if this is possible, in order to avoid that <code class="func">Immutable</code> (<a href="chap12_mj.html#X7F0ABF2C870B0CBB"><span class="RefLink">12.6-3</span></a>) creates an unnecessary copy of the object.</p>

<p>It depends on the representation of an object (see <a href="chap13_mj.html#X8698205F8648EB33"><span class="RefLink">13.4</span></a>) which attribute values it stores. An immutable object in the representation <code class="func">IsAttributeStoringRep</code> (<a href="chap13_mj.html#X7A951C33839AF2C1"><span class="RefLink">13.5-5</span></a>) stores <em>all</em> attribute values once they are computed.</p>

<p>Note that it is impossible to get rid of a stored attribute value because the system may have drawn conclusions from the old attribute value, and just removing the value might leave the data structures in an inconsistent state. If necessary, a new object can be constructed.</p>

<p>Each method that is installed for an attribute via <code class="func">InstallMethod</code> (<a href="chap78_mj.html#X837EFDAB7BEF290B"><span class="RefLink">78.3-1</span></a>) must require exactly one argument, and this must lie in the filter <var class="Arg">filter</var> that was entered as second argument of <code class="func">NewAttribute</code> (<a href="chap13_mj.html#X7B9654807858A3B0"><span class="RefLink">13.5-3</span></a>) resp. <code class="func">NewProperty</code> (<a href="chap13_mj.html#X7F2D6FD979FE23DD"><span class="RefLink">13.7-4</span></a>).</p>

<p>As for any operation, for attributes one can install a method taking an argument that does not lie in <var class="Arg">filt</var> via <code class="func">InstallOtherMethod</code> (<a href="chap78_mj.html#X7D2C12DB841CE539"><span class="RefLink">78.3-2</span></a>), or a method for more than one argument. For example, <code class="func">IsTransitive</code> (<a href="chap41_mj.html#X79B15750851828CB"><span class="RefLink">41.10-1</span></a>) is an attribute for a <span class="SimpleMath">\(G\)</span>-set that can also be called for the two arguments, being a group <span class="SimpleMath">\(G\)</span> and its action domain. If attributes are called with more than one argument then the return value is not stored in any of the arguments.</p>

<p>Properties are a special form of attributes that have the value <code class="keyw">true</code> or <code class="keyw">false</code>, see section <a href="chap13_mj.html#X871597447BB998A1"><span class="RefLink">13.7</span></a>.</p>

<p>Examples of attributes for multiplicative elements are <code class="func">Inverse</code> (<a href="chap31_mj.html#X78EE524E83624057"><span class="RefLink">31.10-8</span></a>), <code class="func">One</code> (<a href="chap31_mj.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>), and <code class="func">Order</code> (<a href="chap31_mj.html#X84F59A2687C62763"><span class="RefLink">31.10-10</span></a>). <code class="func">Size</code> (<a href="chap30_mj.html#X858ADA3B7A684421"><span class="RefLink">30.4-6</span></a>) is an attribute for domains, <code class="func">Centre</code> (<a href="chap35_mj.html#X847ABE6F781C7FE8"><span class="RefLink">35.4-5</span></a>) is an attribute for magmas, and <code class="func">DerivedSubgroup</code> (<a href="chap39_mj.html#X7CC17CF179ED7EF2"><span class="RefLink">39.12-3</span></a>) is an attribute for groups.</p>

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

<h5>13.5-1 IsAttribute</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsAttribute</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns <code class="keyw">true</code> if <var class="Arg">object</var> is an attribute (see <a href="chap13_mj.html#X7C701DBF7BAE649A"><span class="RefLink">13.5</span></a>), and <code class="keyw">false</code> otherwise.</p>

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

<h5>13.5-2 KnownAttributesOfObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; KnownAttributesOfObject</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>returns a list of the names of the attributes whose values are known for <var class="Arg">object</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:=Group((1,2),(1,2,3));;Size(g);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">KnownAttributesOfObject(g);</span>
[ "Size", "OneImmutable", "NrMovedPoints", "MovedPoints",
  "GeneratorsOfMagmaWithInverses", "MultiplicativeNeutralElement",
  "HomePcgs", "Pcgs", "StabChainMutable", "StabChainOptions" ]
</pre></div>

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

<h5>13.5-3 NewAttribute</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NewAttribute</code>( <var class="Arg">name</var>, <var class="Arg">filter</var>[, <var class="Arg">"mutable"</var>][, <var class="Arg">rank</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">NewAttribute</code> returns a new attribute getter with name <var class="Arg">name</var> that is applicable to objects with the property <var class="Arg">filter</var>.</p>

<p>Contrary to the situation with categories and representations, the tester of the new attribute does <em>not</em> imply <var class="Arg">filter</var>. This is exactly because of the possibility to install methods that do not require <var class="Arg">filter</var>.</p>

<p>For example, the attribute <code class="func">Size</code> (<a href="chap30_mj.html#X858ADA3B7A684421"><span class="RefLink">30.4-6</span></a>) was created with second argument a list or a collection, but there is also a method for <code class="func">Size</code> (<a href="chap30_mj.html#X858ADA3B7A684421"><span class="RefLink">30.4-6</span></a>) that is applicable to a character table, which is neither a list nor a collection.</p>

<p>For the optional third and fourth arguments, there are the following possibilities.</p>


<ul>
<li><p>The integer argument <var class="Arg">rank</var> causes the attribute tester to have this incremental rank (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>),</p>

</li>
<li><p>If the argument <var class="Arg">mutable</var> is the string <code class="code">"mutable"</code> or the boolean <code class="keyw">true</code>, then the values of the attribute are mutable.</p>

</li>
<li><p>If the argument <var class="Arg">mutable</var> is the boolean <code class="keyw">false</code>, then the values of the attribute are immutable.</p>

</li>
</ul>
<p>When a value of such mutable attribute is set then this value itself is stored, not an immutable copy of it, and it is the user's responsibility to set an object that is mutable. This is useful for an attribute whose value is some partial information that may be completed later. For example, there is an attribute <code class="code">ComputedSylowSubgroups</code> for the list holding those Sylow subgroups of a group that have been computed already by the function <code class="func">SylowSubgroup</code> (<a href="chap39_mj.html#X7AA351308787544C"><span class="RefLink">39.13-1</span></a>), and this list is mutable because one may want to enter groups into it as they are computed.</p>

<p>If no argument for <var class="Arg">rank</var> is given, then the rank of the tester is 1.</p>

<p>Each method for the new attribute that does <em>not</em> require its argument to lie in <var class="Arg">filter</var> must be installed using <code class="func">InstallOtherMethod</code> (<a href="chap78_mj.html#X7D2C12DB841CE539"><span class="RefLink">78.3-2</span></a>).</p>

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

<h5>13.5-4 DeclareAttribute</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DeclareAttribute</code>( <var class="Arg">name</var>, <var class="Arg">filter</var>[, <var class="Arg">"mutable"</var>][, <var class="Arg">rank</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>does the same as <code class="func">NewAttribute</code> (<a href="chap13_mj.html#X7B9654807858A3B0"><span class="RefLink">13.5-3</span></a>) and then binds the result to the global variable <var class="Arg">name</var>. The variable must previously be writable, and is made read-only by this function. It also binds read-only global variables with names <code class="code">Has<var class="Arg">name</var></code> and <code class="code">Set<var class="Arg">name</var></code> for the tester and setter of the attribute (see Section <a href="chap13_mj.html#X79DE5208877AE42A"><span class="RefLink">13.6</span></a>).</p>

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

<h5>13.5-5 IsAttributeStoringRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsAttributeStoringRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;representation&nbsp;)</td></tr></table></div>
<p>Objects in this representation have default methods to get stored values of attributes and –if they are immutable– to store attribute values automatically once they have been computed. (These methods are called the <q>system getter</q> and the <q>system setter</q> of the attribute, respectively.)</p>

<p>As a consequence, for immutable objects in <code class="func">IsAttributeStoringRep</code>, subsequent calls to an attribute will return the <em>same</em> object.</p>

<p><em>Mutable</em> objects in <code class="func">IsAttributeStoringRep</code> are allowed, but attribute values are not stored automatically in them. Such objects are useful because they may later be made immutable using <code class="func">MakeImmutable</code> (<a href="chap12_mj.html#X80CE136D804097C7"><span class="RefLink">12.6-4</span></a>), at which point they will start storing all attribute values.</p>

<p>Note that one can force an attribute value to be stored in a mutable object in <code class="func">IsAttributeStoringRep</code>, by explicitly calling the attribute setter. This feature should be used with care. For example, think of a mutable matrix whose rank or trace gets stored, and the values later become wrong when somebody changes the matrix entries.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:= Group( (1,2)(3,4), (1,3)(2,4) );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsAttributeStoringRep( g );</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">HasSize( g );  Size( g );  HasSize( g );</span>
false
4
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r:= 7/4;;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsAttributeStoringRep( r );</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Int( r );  HasInt( r );</span>
1
false
</pre></div>

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

<h4>13.6 <span class="Heading">Setter and Tester for Attributes</span></h4>

<p>For every attribute, the <em>attribute setter</em> and the <em>attribute tester</em> are defined.</p>

<p>To check whether an object belongs to an attribute <var class="Arg">attr</var>, the tester of the attribute is used, see <code class="func">Tester</code> (<a href="chap13_mj.html#X87D5B5AC7DAF932D"><span class="RefLink">13.6-1</span></a>). To store a value for the attribute <var class="Arg">attr</var> in an object, the setter of the attribute is used, see <code class="func">Setter</code> (<a href="chap13_mj.html#X7FD8952C841D2B1F"><span class="RefLink">13.6-2</span></a>).</p>

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

<h5>13.6-1 Tester</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Tester</code>( <var class="Arg">attr</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>For an attribute <var class="Arg">attr</var>, <code class="code">Tester(<var class="Arg">attr</var>)</code> is a filter (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) that returns <code class="keyw">true</code> or <code class="keyw">false</code>, depending on whether or not the value of <var class="Arg">attr</var> for the object is known. For example, <code class="code">Tester( Size )( <var class="Arg">obj</var> )</code> is <code class="keyw">true</code> if the size of the object <var class="Arg">obj</var> is known.</p>

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

<h5>13.6-2 Setter</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Setter</code>( <var class="Arg">attr</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>For an attribute <var class="Arg">attr</var>, <code class="code">Setter(<var class="Arg">attr</var>)</code> is called automatically when the attribute value has been computed for an immutable object which does not already have a value stored for <var class="Arg">attr</var>. One can also call the setter explicitly, for example, <code class="code">Setter( Size )( <var class="Arg">obj</var>, <var class="Arg">val</var> )</code> sets <var class="Arg">val</var> as size of the object <var class="Arg">obj</var> if the size was not yet known.</p>

<p>For each attribute <var class="Arg">attr</var> that is declared with <code class="func">DeclareAttribute</code> (<a href="chap13_mj.html#X7A00FC8A7A677A56"><span class="RefLink">13.5-4</span></a>) resp. <code class="func">DeclareProperty</code> (<a href="chap13_mj.html#X7F4602F082682A04"><span class="RefLink">13.7-5</span></a>), tester and setter are automatically made accessible by the names <code class="code">Has<var class="Arg">attr</var></code> and <code class="code">Set<var class="Arg">attr</var></code>, respectively. For example, the tester for <code class="func">Size</code> (<a href="chap30_mj.html#X858ADA3B7A684421"><span class="RefLink">30.4-6</span></a>) is called <code class="code">HasSize</code>, and the setter is called <code class="code">SetSize</code>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:=Group((1,2,3,4),(1,2));;Size(g);</span>
24
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">HasSize(g);</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetSize(g,99);</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size(g);</span>
24
</pre></div>

<p>For two properties <var class="Arg">prop1</var> and <var class="Arg">prop2</var>, the intersection <code class="code"><var class="Arg">prop1</var> and <var class="Arg">prop2</var></code> (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) is again a property for which a setter and a tester exist. Setting the value of this intersection to <code class="keyw">true</code> for a <strong class="pkg">GAP</strong> object means to set the values of <var class="Arg">prop1</var> and <var class="Arg">prop2</var> to <code class="keyw">true</code> for this object.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">prop:= IsFinite and IsCommutative;</span>
&lt;Property "(IsFinite and IsCommutative)"&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:= Group( (1,2,3), (4,5) );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Tester( prop )( g );</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Setter( prop )( g, true );</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Tester( prop )( g );  prop( g );</span>
true
true
</pre></div>

<p>It is <em>not allowed</em> to set the value of such an intersection to <code class="keyw">false</code> for an object.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Setter( prop )( Rationals, false );</span>
You cannot set an "and-filter" except to true
not in any function
Entering break read-eval-print loop ...
you can 'quit;' to quit to outer loop, or
you can type 'return true;' to set all components true
(but you might really want to reset just one component) to continue
<span class="GAPbrkprompt">brk&gt;</span>
</pre></div>

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

<h5>13.6-3 AttributeValueNotSet</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AttributeValueNotSet</code>( <var class="Arg">attr</var>, <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>If the value of the attribute <var class="Arg">attr</var> is already stored for <var class="Arg">obj</var>, <code class="func">AttributeValueNotSet</code> simply returns this value. Otherwise the value of <code class="code"><var class="Arg">attr</var>( <var class="Arg">obj</var> )</code> is computed and returned <em>without storing it</em> in <var class="Arg">obj</var>. This can be useful when <q>large</q> attribute values (such as element lists) are needed only once and shall not be stored in the object.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">HasAsSSortedList(g);</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AttributeValueNotSet(AsSSortedList,g);</span>
[ (), (4,5), (1,2,3), (1,2,3)(4,5), (1,3,2), (1,3,2)(4,5) ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">HasAsSSortedList(g);</span>
false
</pre></div>

<p>The normal behaviour of attributes (when called with just one argument) is that once a method has been selected and executed, and has returned a value the setter of the attribute is called, to (possibly) store the computed value. In special circumstances, this behaviour can be altered dynamically on an attribute-by-attribute basis, using the functions <code class="func">DisableAttributeValueStoring</code> (<a href="chap13_mj.html#X7851E2DB79656DB0"><span class="RefLink">13.6-5</span></a>) and <code class="func">EnableAttributeValueStoring</code> (<a href="chap13_mj.html#X7E5DACBE7A9A9AD1"><span class="RefLink">13.6-6</span></a>).</p>

<p>In general, the code in the library assumes, for efficiency, but not for correctness, that attribute values <em>will</em> be stored (in suitable objects), so disabling storing may cause substantial computations to be repeated.</p>

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

<h5>13.6-4 InfoAttributes</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InfoAttributes</code></td><td class="tdright">(&nbsp;info class&nbsp;)</td></tr></table></div>
<p>This info class (together with <code class="func">InfoWarning</code> (<a href="chap7_mj.html#X7A28F77C82D6A3E0"><span class="RefLink">7.4-8</span></a>)) is used for messages about attributes. Messages are shown under the following circumstances:</p>


<ul>
<li><p><code class="func">EnableAttributeValueStoring</code> (<a href="chap13_mj.html#X7E5DACBE7A9A9AD1"><span class="RefLink">13.6-6</span></a>) is used (level 2).</p>

</li>
<li><p><code class="func">DisableAttributeValueStoring</code> (<a href="chap13_mj.html#X7851E2DB79656DB0"><span class="RefLink">13.6-5</span></a>) is used (level 3).</p>

</li>
<li><p>When trying to assign to non-mutable attribute which already is set to a different value (level 3).</p>

</li>
<li><p>When the test filter for an attribute (i.e., <code class="code">HasFOO</code>) is set, but no value is assigned (level 3).</p>

</li>
</ul>
<p><a id="X7851E2DB79656DB0" name="X7851E2DB79656DB0"></a></p>

<h5>13.6-5 DisableAttributeValueStoring</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DisableAttributeValueStoring</code>( <var class="Arg">attr</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>disables the usual call of <code class="code">Setter( <var class="Arg">attr</var> )</code> when a method for <var class="Arg">attr</var> returns a value. In consequence the values will never be stored. Note that <var class="Arg">attr</var> must be an attribute and <em>not</em> a property.</p>

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

<h5>13.6-6 EnableAttributeValueStoring</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EnableAttributeValueStoring</code>( <var class="Arg">attr</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>enables the usual call of <code class="code">Setter( <var class="Arg">attr</var> )</code> when a method for <var class="Arg">attr</var> returns a value. In consequence the values may be stored. This will usually have no effect unless <code class="func">DisableAttributeValueStoring</code> (<a href="chap13_mj.html#X7851E2DB79656DB0"><span class="RefLink">13.6-5</span></a>) has previously been used for <var class="Arg">attr</var>. Note that <var class="Arg">attr</var> must be an attribute and <em>not</em> a property.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g := Group((1,2,3,4,5),(1,2,3));</span>
Group([ (1,2,3,4,5), (1,2,3) ])
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">KnownAttributesOfObject(g);</span>
[ "LargestMovedPoint", "GeneratorsOfMagmaWithInverses",
  "MultiplicativeNeutralElement" ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetInfoLevel(InfoAttributes,3);</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DisableAttributeValueStoring(Size);</span>
#I  Disabling value storing for Size
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size(g);</span>
60
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">KnownAttributesOfObject(g);</span>
[ "OneImmutable", "LargestMovedPoint", "NrMovedPoints",
  "MovedPoints", "GeneratorsOfMagmaWithInverses",
  "MultiplicativeNeutralElement", "StabChainMutable",
  "StabChainOptions" ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size(g);</span>
60
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">EnableAttributeValueStoring(Size);</span>
#I  Enabling value storing for Size
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size(g);</span>
60
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">KnownAttributesOfObject(g);</span>
[ "Size", "OneImmutable", "LargestMovedPoint", "NrMovedPoints",
  "MovedPoints", "GeneratorsOfMagmaWithInverses",
  "MultiplicativeNeutralElement", "StabChainMutable",
  "StabChainOptions" ]
</pre></div>

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

<h4>13.7 <span class="Heading">Properties</span></h4>

<p>The properties of an object are those of its attributes (see <a href="chap13_mj.html#X7C701DBF7BAE649A"><span class="RefLink">13.5</span></a>) whose values can only be <code class="keyw">true</code> or <code class="keyw">false</code>.</p>

<p>The main difference between attributes and properties is that a property defines two sets of objects, namely the usual set of all objects for which the value is known, and the set of all objects for which the value is known to be <code class="keyw">true</code>.</p>

<p>(Note that it makes no sense to consider a third set, namely the set of objects for which the value of a property is <code class="keyw">true</code> whether or not it is known, since there may be objects for which the containment in this set cannot be decided.)</p>

<p>For a property <var class="Arg">prop</var>, the containment of an object <var class="Arg">obj</var> in the first set is checked again by applying <code class="code">Tester( <var class="Arg">prop</var> )</code> to <var class="Arg">obj</var>, and <var class="Arg">obj</var> lies in the second set if and only if <code class="code">Tester( <var class="Arg">prop</var> )( <var class="Arg">obj</var> ) and <var class="Arg">prop</var>( <var class="Arg">obj</var> )</code> is <code class="keyw">true</code>.</p>

<p>If a property value is known for an immutable object then this value is also stored, as part of the type of the object. To some extent, property values of mutable objects also can be stored, for example a mutable list all of whose entries are immutable can store whether it is strictly sorted. When the object is mutated (for example by list assignment) the type may need to be adjusted.</p>

<p>Important properties for domains are <code class="func">IsAssociative</code> (<a href="chap35_mj.html#X7C83B5A47FD18FB7"><span class="RefLink">35.4-7</span></a>), <code class="func">IsCommutative</code> (<a href="chap35_mj.html#X830A4A4C795FBC2D"><span class="RefLink">35.4-9</span></a>), <code class="func">IsAnticommutative</code> (<a href="chap56_mj.html#X82DECD237D49D937"><span class="RefLink">56.4-6</span></a>), <code class="func">IsLDistributive</code> (<a href="chap56_mj.html#X7D4BB44187C55BF2"><span class="RefLink">56.4-3</span></a>) and <code class="func">IsRDistributive</code> (<a href="chap56_mj.html#X79A5AEE786AED315"><span class="RefLink">56.4-4</span></a>), which mean that the multiplication of elements in the domain satisfies <span class="SimpleMath">\(( a * b ) * c = a * ( b * c )\)</span>, <span class="SimpleMath">\(a * b = b * a\)</span>, <span class="SimpleMath">\(a * b = - ( b * a )\)</span>, <span class="SimpleMath">\(a * ( b + c ) = a * b + a * c\)</span>, and <span class="SimpleMath">\(( a + b ) * c = a * c + b * c\)</span>, respectively, for all <span class="SimpleMath">\(a\)</span>, <span class="SimpleMath">\(b\)</span>, <span class="SimpleMath">\(c\)</span> in the domain.</p>

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

<h5>13.7-1 IsProperty</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsProperty</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns <code class="keyw">true</code> if <var class="Arg">object</var> is a property (see <a href="chap13_mj.html#X871597447BB998A1"><span class="RefLink">13.7</span></a>), and <code class="keyw">false</code> otherwise.</p>

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

<h5>13.7-2 KnownPropertiesOfObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; KnownPropertiesOfObject</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>returns a list of the names of the properties whose values are known for <var class="Arg">object</var>.</p>

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

<h5>13.7-3 KnownTruePropertiesOfObject</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; KnownTruePropertiesOfObject</code>( <var class="Arg">object</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
<p>returns a list of the names of the properties known to be <code class="keyw">true</code> for <var class="Arg">object</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:=Group((1,2),(1,2,3));;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">KnownPropertiesOfObject(g);</span>
[ "IsEmpty", "IsTrivial", "IsNonTrivial", "IsFinite",
  "CanEasilyCompareElements", "CanEasilySortElements",
  "IsDuplicateFree", "IsGeneratorsOfMagmaWithInverses",
  "IsAssociative", "IsFinitelyGeneratedMagma",
  "IsGeneratorsOfSemigroup", "IsSimpleSemigroup",
  "IsRegularSemigroup", "IsInverseSemigroup",
  "IsCompletelyRegularSemigroup", "IsCompletelySimpleSemigroup",
  "IsGroupAsSemigroup", "IsMonoidAsSemigroup", "IsOrthodoxSemigroup",
  "IsFinitelyGeneratedMonoid", "IsFinitelyGeneratedGroup",
  "IsSubsetLocallyFiniteGroup", "KnowsHowToDecompose",
  "IsInfiniteAbelianizationGroup", "IsNilpotentByFinite",
  "IsTorsionFree", "IsFreeAbelian" ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size(g);</span>
6
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">KnownPropertiesOfObject(g);</span>
[ "IsEmpty", "IsTrivial", "IsNonTrivial", "IsFinite",
  "CanEasilyCompareElements", "CanEasilySortElements",
  "IsDuplicateFree", "IsGeneratorsOfMagmaWithInverses",
  "IsAssociative", "IsFinitelyGeneratedMagma",
  "IsGeneratorsOfSemigroup", "IsSimpleSemigroup",
  "IsRegularSemigroup", "IsInverseSemigroup",
  "IsCompletelyRegularSemigroup", "IsCompletelySimpleSemigroup",
  "IsGroupAsSemigroup", "IsMonoidAsSemigroup", "IsOrthodoxSemigroup",
  "IsFinitelyGeneratedMonoid", "IsFinitelyGeneratedGroup",
  "IsSubsetLocallyFiniteGroup", "KnowsHowToDecompose",
  "IsPerfectGroup", "IsSolvableGroup", "IsPolycyclicGroup",
  "IsInfiniteAbelianizationGroup", "IsNilpotentByFinite",
  "IsTorsionFree", "IsFreeAbelian" ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">KnownTruePropertiesOfObject(g);</span>
[ "IsNonTrivial", "IsFinite", "CanEasilyCompareElements",
  "CanEasilySortElements", "IsDuplicateFree",
  "IsGeneratorsOfMagmaWithInverses", "IsAssociative",
  "IsFinitelyGeneratedMagma", "IsGeneratorsOfSemigroup",
  "IsSimpleSemigroup", "IsRegularSemigroup", "IsInverseSemigroup",
  "IsCompletelyRegularSemigroup", "IsCompletelySimpleSemigroup",
  "IsGroupAsSemigroup", "IsMonoidAsSemigroup", "IsOrthodoxSemigroup",
  "IsFinitelyGeneratedMonoid", "IsFinitelyGeneratedGroup",
  "IsSubsetLocallyFiniteGroup", "KnowsHowToDecompose",
  "IsSolvableGroup", "IsPolycyclicGroup", "IsNilpotentByFinite" ]
</pre></div>

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

<h5>13.7-4 NewProperty</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NewProperty</code>( <var class="Arg">name</var>, <var class="Arg">filter</var>[, <var class="Arg">rank</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">NewProperty</code> returns a new property <var class="Arg">prop</var> with name <var class="Arg">name</var> (see also <a href="chap13_mj.html#X871597447BB998A1"><span class="RefLink">13.7</span></a>). The filter <var class="Arg">filter</var> describes the involved filters of <var class="Arg">prop</var>. As in the case of attributes, <var class="Arg">filter</var> is not implied by <var class="Arg">prop</var>.</p>

<p>The optional third argument <var class="Arg">rank</var> denotes the incremental rank (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) of the property <var class="Arg">prop</var> itself, i.e. <em>not</em> of its tester; the default value is 1.</p>

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

<h5>13.7-5 DeclareProperty</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DeclareProperty</code>( <var class="Arg">name</var>, <var class="Arg">filter</var>[, <var class="Arg">rank</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>does the same as <code class="func">NewProperty</code> (<a href="chap13_mj.html#X7F2D6FD979FE23DD"><span class="RefLink">13.7-4</span></a>) and then binds the result to the global variable <var class="Arg">name</var>. The variable must previously be writable, and is made read-only by this function. It also binds read-only global variables with names <code class="code">Has<var class="Arg">name</var></code> and <code class="code">Set<var class="Arg">name</var></code> for the tester and setter of the property (see Section <a href="chap13_mj.html#X79DE5208877AE42A"><span class="RefLink">13.6</span></a>).</p>

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

<h4>13.8 <span class="Heading">Other Filters</span></h4>

<p>There are situations where one wants to express a kind of knowledge that is based on some heuristic.</p>

<p>For example, the filters (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) <code class="func">CanEasilyTestMembership</code> (<a href="chap39_mj.html#X798F13EA810FB215"><span class="RefLink">39.26-1</span></a>) and <code class="func">CanEasilyComputePcgs</code> (<a href="chap45_mj.html#X7B561B1685CEC2AB"><span class="RefLink">45.2-3</span></a>) are defined in the <strong class="pkg">GAP</strong> library. Note that such filters do not correspond to a mathematical concept, contrary to properties (see <a href="chap13_mj.html#X871597447BB998A1"><span class="RefLink">13.7</span></a>). Also it need not be defined what <q>easily</q> means for an arbitrary <strong class="pkg">GAP</strong> object, and in this case one cannot compute the value for an arbitrary <strong class="pkg">GAP</strong> object. In order to access this kind of knowledge as a part of the type of an object, <strong class="pkg">GAP</strong> provides filters for which the value is <code class="keyw">false</code> by default, and it is changed to <code class="keyw">true</code> in certain situations, either explicitly (for the given object) or via a logical implication (see <a href="chap78_mj.html#X7FB5016E83DB4349"><span class="RefLink">78.8</span></a>) from other filters.</p>

<p>For example, a <code class="keyw">true</code> value of <code class="func">CanEasilyComputePcgs</code> (<a href="chap45_mj.html#X7B561B1685CEC2AB"><span class="RefLink">45.2-3</span></a>) for a group means that certain methods are applicable that use a pcgs (see <a href="chap45_mj.html#X7F18A01785DBAC4E"><span class="RefLink">45.1</span></a>) for the group. There are logical implications to set the filter value to <code class="keyw">true</code> for permutation groups that are known to be solvable, and for groups that have already a (sufficiently nice) pcgs stored. In the case one has a solvable matrix group and wants to enable methods that use a pcgs, one can set the <code class="func">CanEasilyComputePcgs</code> (<a href="chap45_mj.html#X7B561B1685CEC2AB"><span class="RefLink">45.2-3</span></a>) value to <code class="keyw">true</code> for this particular group.</p>

<p>A filter <var class="Arg">filt</var> of the kind described here is different from the other filters introduced in the previous sections. In particular, <var class="Arg">filt</var> is not a category (see <a href="chap13_mj.html#X7CC6903E78F24167"><span class="RefLink">13.3</span></a>) or a property (see <a href="chap13_mj.html#X871597447BB998A1"><span class="RefLink">13.7</span></a>) because its value may change for a given object, and <var class="Arg">filt</var> is not a representation (see <a href="chap13_mj.html#X8698205F8648EB33"><span class="RefLink">13.4</span></a>) because it has nothing to do with the way an object is made up from some data. <var class="Arg">filt</var> is similar to an attribute tester (see <a href="chap13_mj.html#X79DE5208877AE42A"><span class="RefLink">13.6</span></a>), the only difference is that <var class="Arg">filt</var> does not refer to an attribute value; note that <var class="Arg">filt</var> is also used in the same way as an attribute tester; namely, the <code class="keyw">true</code> value may be required for certain methods to be applicable.</p>

<p>In order to change the value of <var class="Arg">filt</var> for an object <var class="Arg">obj</var>, one can use logical implications (see <a href="chap78_mj.html#X7FB5016E83DB4349"><span class="RefLink">78.8</span></a>) or <code class="func">SetFilterObj</code> (<a href="chap13_mj.html#X7C92D53E7920CE02"><span class="RefLink">13.8-3</span></a>), <code class="func">ResetFilterObj</code> (<a href="chap13_mj.html#X8117FD03870FB02E"><span class="RefLink">13.8-4</span></a>).</p>

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

<h5>13.8-1 NewFilter</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NewFilter</code>( <var class="Arg">name</var>[, <var class="Arg">implied</var>][, <var class="Arg">rank</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">NewFilter</code> returns a simple filter with name <var class="Arg">name</var> (see <a href="chap13_mj.html#X7997705185C7E720"><span class="RefLink">13.8</span></a>).</p>

<p>The optional argument <var class="Arg">implied</var>, if given, must be a filter, meaning that for each object in the new filter, also <var class="Arg">implied</var> will be set. Note that resetting the new filter with <code class="func">ResetFilterObj</code> (<a href="chap13_mj.html#X8117FD03870FB02E"><span class="RefLink">13.8-4</span></a>) does <em>not</em> reset <var class="Arg">implied</var>. If the new filter is intended to be set or reset manually for existing objects then the argument <var class="Arg">implied</var> will cause trouble; if the filter is not intended to be set or reset manually then perhaps calling <code class="func">NewCategory</code> (<a href="chap13_mj.html#X87F68F887B44DBBD"><span class="RefLink">13.3-4</span></a>) is more appropriate than calling <code class="func">NewFilter</code>.</p>

<p>The optional argument <var class="Arg">rank</var> denotes the incremental rank (see <a href="chap13_mj.html#X84EFA4C07D4277BB"><span class="RefLink">13.2</span></a>) of the filter, the default value is 1.</p>

<p>The default value of the new simple filter for each object is <code class="keyw">false</code>.</p>

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

<h5>13.8-2 DeclareFilter</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DeclareFilter</code>( <var class="Arg">name</var>[, <var class="Arg">implied</var>][, <var class="Arg">rank</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>does the same as <code class="func">NewFilter</code> (<a href="chap13_mj.html#X821635DA7821ED74"><span class="RefLink">13.8-1</span></a>) and then binds the result to the global variable <var class="Arg">name</var>. The variable must previously be writable, and is made read-only by this function.</p>

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

<h5>13.8-3 SetFilterObj</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetFilterObj</code>( <var class="Arg">obj</var>, <var class="Arg">filter</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">SetFilterObj</code> sets the value of <var class="Arg">filter</var> (and of all filters implied by <var class="Arg">filter</var>) for <var class="Arg">obj</var> to <code class="keyw">true</code>.</p>

<p>This may trigger immediate methods.</p>

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

<h5>13.8-4 ResetFilterObj</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ResetFilterObj</code>( <var class="Arg">obj</var>, <var class="Arg">filter</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">ResetFilterObj</code> sets the value of <var class="Arg">filter</var> for <var class="Arg">obj</var> to <code class="keyw">false</code>. (Implied filters of <var class="Arg">filt</var> are not touched. This might create inconsistent situations if applied carelessly).</p>

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

<h4>13.9 <span class="Heading">Types</span></h4>

<p>We stated above (see <a href="chap13_mj.html#X7E8202627B421DB1"><span class="RefLink">13</span></a>) that, for an object <var class="Arg">obj</var>, its <em>type</em> is formed from its family and its filters. There is also a third component, used in a few situations, namely defining data of the type.</p>

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

<h5>13.9-1 TypeObj</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TypeObj</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>returns the type of the object <var class="Arg">obj</var>.</p>

<p>The type of an object is itself an object.</p>

<p>Two types are equal if and only if the two families are identical, the filters are equal, and, if present, also the defining data of the types are equal.</p>

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

<h5>13.9-2 DataType</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DataType</code>( <var class="Arg">type</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p>The last part of the type, defining data, has not been mentioned before and seems to be of minor importance. It can be used, e.g., for cosets <span class="SimpleMath">\(U g\)</span> of a group <span class="SimpleMath">\(U\)</span>, where the type of each coset may contain the group <span class="SimpleMath">\(U\)</span> as defining data. As a consequence, two such cosets mod <span class="SimpleMath">\(U\)</span> and <span class="SimpleMath">\(V\)</span> can have the same type only if <span class="SimpleMath">\(U = V\)</span>. The defining data of the type <var class="Arg">type</var> can be accessed via <code class="func">DataType</code>.</p>

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

<h5>13.9-3 NewType</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NewType</code>( <var class="Arg">family</var>, <var class="Arg">filter</var>[, <var class="Arg">data</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
<p><code class="func">NewType</code> returns the type given by the family <var class="Arg">family</var> and the filter <var class="Arg">filter</var>. The optional third argument <var class="Arg">data</var> is any object that denotes defining data of the desired type.</p>

<p>For examples where <code class="func">NewType</code> is used, see <a href="chap79_mj.html#X866E223484649E5A"><span class="RefLink">79.2</span></a>, <a href="chap79_mj.html#X834893D07FAA6FD2"><span class="RefLink">79.3</span></a>, and the example in Chapter <a href="chap81_mj.html#X8125CC6A87409887"><span class="RefLink">81</span></a>.</p>


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


<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0_mj.html">Top</a>  <a href="chap1_mj.html">1</a>  <a href="chap2_mj.html">2</a>  <a href="chap3_mj.html">3</a>  <a href="chap4_mj.html">4</a>  <a href="chap5_mj.html">5</a>  <a href="chap6_mj.html">6</a>  <a href="chap7_mj.html">7</a>  <a href="chap8_mj.html">8</a>  <a href="chap9_mj.html">9</a>  <a href="chap10_mj.html">10</a>  <a href="chap11_mj.html">11</a>  <a href="chap12_mj.html">12</a>  <a href="chap13_mj.html">13</a>  <a href="chap14_mj.html">14</a>  <a href="chap15_mj.html">15</a>  <a href="chap16_mj.html">16</a>  <a href="chap17_mj.html">17</a>  <a href="chap18_mj.html">18</a>  <a href="chap19_mj.html">19</a>  <a href="chap20_mj.html">20</a>  <a href="chap21_mj.html">21</a>  <a href="chap22_mj.html">22</a>  <a href="chap23_mj.html">23</a>  <a href="chap24_mj.html">24</a>  <a href="chap25_mj.html">25</a>  <a href="chap26_mj.html">26</a>  <a href="chap27_mj.html">27</a>  <a href="chap28_mj.html">28</a>  <a href="chap29_mj.html">29</a>  <a href="chap30_mj.html">30</a>  <a href="chap31_mj.html">31</a>  <a href="chap32_mj.html">32</a>  <a href="chap33_mj.html">33</a>  <a href="chap34_mj.html">34</a>  <a href="chap35_mj.html">35</a>  <a href="chap36_mj.html">36</a>  <a href="chap37_mj.html">37</a>  <a href="chap38_mj.html">38</a>  <a href="chap39_mj.html">39</a>  <a href="chap40_mj.html">40</a>  <a href="chap41_mj.html">41</a>  <a href="chap42_mj.html">42</a>  <a href="chap43_mj.html">43</a>  <a href="chap44_mj.html">44</a>  <a href="chap45_mj.html">45</a>  <a href="chap46_mj.html">46</a>  <a href="chap47_mj.html">47</a>  <a href="chap48_mj.html">48</a>  <a href="chap49_mj.html">49</a>  <a href="chap50_mj.html">50</a>  <a href="chap51_mj.html">51</a>  <a href="chap52_mj.html">52</a>  <a href="chap53_mj.html">53</a>  <a href="chap54_mj.html">54</a>  <a href="chap55_mj.html">55</a>  <a href="chap56_mj.html">56</a>  <a href="chap57_mj.html">57</a>  <a href="chap58_mj.html">58</a>  <a href="chap59_mj.html">59</a>  <a href="chap60_mj.html">60</a>  <a href="chap61_mj.html">61</a>  <a href="chap62_mj.html">62</a>  <a href="chap63_mj.html">63</a>  <a href="chap64_mj.html">64</a>  <a href="chap65_mj.html">65</a>  <a href="chap66_mj.html">66</a>  <a href="chap67_mj.html">67</a>  <a href="chap68_mj.html">68</a>  <a href="chap69_mj.html">69</a>  <a href="chap70_mj.html">70</a>  <a href="chap71_mj.html">71</a>  <a href="chap72_mj.html">72</a>  <a href="chap73_mj.html">73</a>  <a href="chap74_mj.html">74</a>  <a href="chap75_mj.html">75</a>  <a href="chap76_mj.html">76</a>  <a href="chap77_mj.html">77</a>  <a href="chap78_mj.html">78</a>  <a href="chap79_mj.html">79</a>  <a href="chap80_mj.html">80</a>  <a href="chap81_mj.html">81</a>  <a href="chap82_mj.html">82</a>  <a href="chap83_mj.html">83</a>  <a href="chap84_mj.html">84</a>  <a href="chap85_mj.html">85</a>  <a href="chap86_mj.html">86</a>  <a href="chap87_mj.html">87</a>  <a href="chapBib_mj.html">Bib</a>  <a href="chapInd_mj.html">Ind</a>  </div>

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