This file is indexed.

/usr/share/gap/lib/semiring.gd is in gap-libs 4r7p9-1.

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

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
#############################################################################
##
#W  semiring.gd                 GAP library                     Thomas Breuer
##
##
#Y  Copyright (C)  1999,  Lehrstuhl D für Mathematik,  RWTH Aachen,  Germany
#Y  (C) 1999 School Math and Comp. Sci., University of St Andrews, Scotland
#Y  Copyright (C) 2002 The GAP Group
##
##  This file declares the operations for semirings.
##


#############################################################################
##
#P  IsLDistributive( <C> )
##
##  <#GAPDoc Label="IsLDistributive">
##  <ManSection>
##  <Prop Name="IsLDistributive" Arg='C'/>
##
##  <Description>
##  is <K>true</K> if the relation
##  <M>a * ( b + c ) = ( a * b ) + ( a * c )</M>
##  holds for all elements <M>a</M>, <M>b</M>, <M>c</M> in the collection
##  <A>C</A>, and <K>false</K> otherwise.
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareProperty( "IsLDistributive", IsRingElementCollection );

InstallSubsetMaintenance( IsLDistributive,
    IsRingElementCollection and IsLDistributive,
    IsRingElementCollection );

InstallFactorMaintenance( IsLDistributive,
    IsRingElementCollection and IsLDistributive,
    IsObject,
    IsRingElementCollection );


#############################################################################
##
#P  IsRDistributive( <C> )
##
##  <#GAPDoc Label="IsRDistributive">
##  <ManSection>
##  <Prop Name="IsRDistributive" Arg='C'/>
##
##  <Description>
##  is <K>true</K> if the relation
##  <M>( a + b ) * c = ( a * c ) + ( b * c )</M>
##  holds for all elements <M>a</M>, <M>b</M>, <M>c</M> in the collection
##  <A>C</A>, and <K>false</K> otherwise.
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareProperty( "IsRDistributive", IsRingElementCollection );

InstallSubsetMaintenance( IsRDistributive,
    IsRingElementCollection and IsRDistributive,
    IsRingElementCollection );

InstallFactorMaintenance( IsRDistributive,
    IsRingElementCollection and IsRDistributive,
    IsObject,
    IsRingElementCollection );


#############################################################################
##
#P  IsDistributive( <C> )
##
##  <#GAPDoc Label="IsDistributive">
##  <ManSection>
##  <Prop Name="IsDistributive" Arg='C'/>
##
##  <Description>
##  is <K>true</K> if the collection <A>C</A> is both left and right
##  distributive
##  (see <Ref Func="IsLDistributive"/>, <Ref Func="IsRDistributive"/>),
##  and <K>false</K> otherwise.
##  <Example><![CDATA[
##  gap> IsDistributive( Integers );
##  true
##  ]]></Example>
##  </Description>
##  </ManSection>
##  <#/GAPDoc>
##
DeclareSynonymAttr( "IsDistributive", IsLDistributive and IsRDistributive );


#############################################################################
##
#P  IsSemiring( <S> )
##
##  <ManSection>
##  <Prop Name="IsSemiring" Arg='S'/>
##
##  <Description>
##  A <E>semiring</E> in &GAP; is an additive magma (see&nbsp;<Ref Func="IsAdditiveMagma"/>)
##  that is also a magma (see&nbsp;<Ref Func="IsMagma"/>),
##  such that addition <C>+</C> and multiplication <C>*</C> are distributive.
##  <P/>
##  The multiplication need <E>not</E> be associative (see&nbsp;<Ref Func="IsAssociative"/>).
##  For example, a Lie algebra (see&nbsp;<Ref Chap="Lie Algebras"/>) is regarded as a
##  semiring in &GAP;.
##  A semiring need not have an identity and a zero element,
##  see&nbsp;<Ref Prop="IsSemiringWithOne"/> and <Ref Prop="IsSemiringWithZero"/>.
##  </Description>
##  </ManSection>
##
DeclareSynonymAttr( "IsSemiring",
    IsAdditiveMagma and IsMagma and IsDistributive );


#############################################################################
##
#P  IsSemiringWithOne( <S> )
##
##  <ManSection>
##  <Prop Name="IsSemiringWithOne" Arg='S'/>
##
##  <Description>
##  A <E>semiring-with-one</E> in &GAP; is a semiring (see&nbsp;<Ref Prop="IsSemiring"/>)
##  that is also a magma-with-one (see&nbsp;<Ref Func="IsMagmaWithOne"/>).
##  <P/>
##  Note that a semiring-with-one need not contain a zero element
##  (see&nbsp;<Ref Prop="IsSemiringWithZero"/>).
##  </Description>
##  </ManSection>
##
DeclareSynonymAttr( "IsSemiringWithOne",
    IsAdditiveMagma and IsMagmaWithOne and IsDistributive );


#############################################################################
##
#P  IsSemiringWithZero( <S> )
##
##  <ManSection>
##  <Prop Name="IsSemiringWithZero" Arg='S'/>
##
##  <Description>
##  A <E>semiring-with-zero</E> in &GAP; is a semiring (see&nbsp;<Ref Prop="IsSemiring"/>)
##  that is also an additive magma-with-zero (see&nbsp;<Ref Func="IsAdditiveMagmaWithZero"/>).
##  <P/>
##  Note that a semiring-with-zero need not contain an identity element
##  (see&nbsp;<Ref Prop="IsSemiringWithOne"/>).
##  </Description>
##  </ManSection>
##
DeclareSynonymAttr( "IsSemiringWithZero",
    IsAdditiveMagmaWithZero and IsMagma and IsDistributive );


#############################################################################
##
#P  IsSemiringWithOneAndZero( <S> )
##
##  <ManSection>
##  <Prop Name="IsSemiringWithOneAndZero" Arg='S'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareSynonymAttr( "IsSemiringWithOneAndZero",
    IsAdditiveMagmaWithZero and IsMagmaWithOne and IsDistributive );


#############################################################################
##
#A  GeneratorsOfSemiring( <S> )
##
##  <ManSection>
##  <Attr Name="GeneratorsOfSemiring" Arg='S'/>
##
##  <Description>
##  <C>GeneratorsOfSemiring</C> returns a list of elements such that
##  the semiring <A>S</A> is the closure of these elements
##  under addition and multiplication.
##  </Description>
##  </ManSection>
##
DeclareAttribute( "GeneratorsOfSemiring", IsSemiring );


#############################################################################
##
#A  GeneratorsOfSemiringWithOne( <S> )
##
##  <ManSection>
##  <Attr Name="GeneratorsOfSemiringWithOne" Arg='S'/>
##
##  <Description>
##  <C>GeneratorsOfSemiringWithOne</C> returns a list of elements such that
##  the semiring <A>R</A> is the closure of these elements
##  under addition, multiplication, and taking the identity element
##  <C>One( <A>S</A> )</C>.
##  <P/>
##  <A>S</A> itself need <E>not</E> be known to be a semiring-with-one.
##  </Description>
##  </ManSection>
##
DeclareAttribute( "GeneratorsOfSemiringWithOne", IsSemiringWithOne );


#############################################################################
##
#A  GeneratorsOfSemiringWithZero( <S> )
##
##  <ManSection>
##  <Attr Name="GeneratorsOfSemiringWithZero" Arg='S'/>
##
##  <Description>
##  <C>GeneratorsOfSemiringWithZero</C> returns a list of elements such that
##  the semiring <A>S</A> is the closure of these elements
##  under addition, multiplication, and taking the zero element
##  <C>Zero( <A>S</A> )</C>.
##  <P/>
##  <A>S</A> itself need <E>not</E> be known to be a semiring-with-zero.
##  </Description>
##  </ManSection>
##
DeclareAttribute( "GeneratorsOfSemiringWithZero", IsSemiringWithZero );


#############################################################################
##
#A  GeneratorsOfSemiringWithOneAndZero( <S> )
##
##  <ManSection>
##  <Attr Name="GeneratorsOfSemiringWithOneAndZero" Arg='S'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareAttribute( "GeneratorsOfSemiringWithOneAndZero",
    IsSemiringWithOneAndZero );


#############################################################################
##
#A  AsSemiring( <C> )
##
##  <ManSection>
##  <Attr Name="AsSemiring" Arg='C'/>
##
##  <Description>
##  If the elements in the collection <A>C</A> form a semiring
##  then <C>AsSemiring</C> returns this semiring,
##  otherwise <K>fail</K> is returned.
##  </Description>
##  </ManSection>
##
DeclareAttribute( "AsSemiring", IsRingElementCollection );


#############################################################################
##
#A  AsSemiringWithOne( <C> )
##
##  <ManSection>
##  <Attr Name="AsSemiringWithOne" Arg='C'/>
##
##  <Description>
##  If the elements in the collection <A>C</A> form a semiring-with-one
##  then <C>AsSemiringWithOne</C> returns this semiring-with-one,
##  otherwise <K>fail</K> is returned.
##  </Description>
##  </ManSection>
##
DeclareAttribute( "AsSemiringWithOne", IsRingElementCollection );


#############################################################################
##
#A  AsSemiringWithZero( <C> )
##
##  <ManSection>
##  <Attr Name="AsSemiringWithZero" Arg='C'/>
##
##  <Description>
##  If the elements in the collection <A>C</A> form a semiring-with-zero
##  then <C>AsSemiringWithZero</C> returns this semiring-with-zero,
##  otherwise <K>fail</K> is returned.
##  </Description>
##  </ManSection>
##
DeclareAttribute( "AsSemiringWithZero", IsRingElementCollection );


#############################################################################
##
#A  AsSemiringWithOneAndZero( <C> )
##
##  <ManSection>
##  <Attr Name="AsSemiringWithOneAndZero" Arg='C'/>
##
##  <Description>
##  If the elements in the collection <A>C</A> form a semiring-with-one-and-zero
##  then <C>AsSemiringWithOneAndZero</C> returns this semiring-with-one-and-zero,
##  otherwise <K>fail</K> is returned.
##  </Description>
##  </ManSection>
##
DeclareAttribute( "AsSemiringWithOneAndZero", IsRingElementCollection );


#############################################################################
##
#O  ClosureSemiring( <S>, <s> )
#O  ClosureSemiring( <S>, <T> )
##
##  <ManSection>
##  <Oper Name="ClosureSemiring" Arg='S, s'/>
##  <Oper Name="ClosureSemiring" Arg='S, T'/>
##
##  <Description>
##  For a semiring <A>S</A> and either an element <A>s</A> of its elements family
##  or a semiring <A>T</A>,
##  <C>ClosureSemiring</C> returns the semiring generated by both arguments.
##  </Description>
##  </ManSection>
##
DeclareOperation( "ClosureSemiring", [ IsSemiring, IsObject ] );


#############################################################################
##
#O  SemiringByGenerators( <C> ) . . .  semiring gener. by elements in a coll.
##
##  <ManSection>
##  <Oper Name="SemiringByGenerators" Arg='C'/>
##
##  <Description>
##  <C>SemiringByGenerators</C> returns the semiring generated by the elements
##  in the collection <A>C</A>,
##  i.&nbsp;e., the closure of <A>C</A> under addition and multiplication.
##  </Description>
##  </ManSection>
##
DeclareOperation( "SemiringByGenerators", [ IsCollection ] );


#############################################################################
##
#O  SemiringWithOneByGenerators( <C> )
##
##  <ManSection>
##  <Oper Name="SemiringWithOneByGenerators" Arg='C'/>
##
##  <Description>
##  <C>SemiringWithOneByGenerators</C> returns the semiring-with-one generated by
##  the elements in the collection <A>C</A>, i.&nbsp;e., the closure of <A>C</A> under
##  addition, multiplication, and taking the identity of an element.
##  </Description>
##  </ManSection>
##
DeclareOperation( "SemiringWithOneByGenerators", [ IsCollection ] );


#############################################################################
##
#O  SemiringWithZeroByGenerators( <C> )
##
##  <ManSection>
##  <Oper Name="SemiringWithZeroByGenerators" Arg='C'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareOperation( "SemiringWithZeroByGenerators", [ IsCollection ] );


#############################################################################
##
#O  SemiringWithOneAndZeroByGenerators( <C> )
##
##  <ManSection>
##  <Oper Name="SemiringWithOneAndZeroByGenerators" Arg='C'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareOperation( "SemiringWithOneAndZeroByGenerators", [ IsCollection ] );


#############################################################################
##
#F  Semiring( <r> ,<s>, ... )  . . . . . . semiring generated by a collection
#F  Semiring( <C> )  . . . . . . . . . . . semiring generated by a collection
##
##  <ManSection>
##  <Func Name="Semiring" Arg='r ,s, ...'/>
##  <Func Name="Semiring" Arg='C'/>
##
##  <Description>
##  In the first form <C>Semiring</C> returns the smallest semiring that
##  contains all the elements <A>r</A>, <A>s</A>... etc.
##  In the second form <C>Semiring</C> returns the smallest semiring that
##  contains all the elements in the collection <A>C</A>.
##  If any element is not an element of a semiring or if the elements lie in
##  no common semiring an error is raised.
##  </Description>
##  </ManSection>
##
DeclareGlobalFunction( "Semiring" );


#############################################################################
##
#F  SemiringWithOne( <r>, <s>, ... )
#F  SemiringWithOne( <C> )
##
##  <ManSection>
##  <Func Name="SemiringWithOne" Arg='r, s, ...'/>
##  <Func Name="SemiringWithOne" Arg='C'/>
##
##  <Description>
##  In the first form <C>SemiringWithOne</C> returns the smallest
##  semiring-with-one that contains all the elements <A>r</A>, <A>s</A>... etc.
##  In the second form <C>SemiringWithOne</C> returns the smallest
##  semiring-with-one that contains all the elements in the collection <A>C</A>.
##  If any element is not an element of a semiring or if the elements lie in
##  no common semiring an error is raised.
##  </Description>
##  </ManSection>
##
DeclareGlobalFunction( "SemiringWithOne" );


#############################################################################
##
#F  SemiringWithZero( <r>, <s>, ... )
#F  SemiringWithZero( <C> )
##
##  <ManSection>
##  <Func Name="SemiringWithZero" Arg='r, s, ...'/>
##  <Func Name="SemiringWithZero" Arg='C'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareGlobalFunction( "SemiringWithZero" );


#############################################################################
##
#F  SemiringWithOneAndZero( <r>, <s>, ... )
#F  SemiringWithOneAndZero( <C> )
##
##  <ManSection>
##  <Func Name="SemiringWithOneAndZero" Arg='r, s, ...'/>
##  <Func Name="SemiringWithOneAndZero" Arg='C'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareGlobalFunction( "SemiringWithOneAndZero" );


#############################################################################
##
#F  Subsemiring( <S>, <gens> )
#F  SubsemiringNC( <S>, <gens> )
##
##  <ManSection>
##  <Func Name="Subsemiring" Arg='S, gens'/>
##  <Func Name="SubsemiringNC" Arg='S, gens'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareGlobalFunction( "Subsemiring" );
DeclareGlobalFunction( "SubsemiringNC" );


#############################################################################
##
#F  SubsemiringWithOne( <S>, <gens> )
#F  SubsemiringWithOneNC( <S>, <gens> )
##
##  <ManSection>
##  <Func Name="SubsemiringWithOne" Arg='S, gens'/>
##  <Func Name="SubsemiringWithOneNC" Arg='S, gens'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareGlobalFunction( "SubsemiringWithOne" );
DeclareGlobalFunction( "SubsemiringWithOneNC" );


#############################################################################
##
#F  SubsemiringWithZero( <S>, <gens> )
#F  SubsemiringWithZeroNC( <S>, <gens> )
##
##  <ManSection>
##  <Func Name="SubsemiringWithZero" Arg='S, gens'/>
##  <Func Name="SubsemiringWithZeroNC" Arg='S, gens'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareGlobalFunction( "SubsemiringWithZero" );
DeclareGlobalFunction( "SubsemiringWithZeroNC" );


#############################################################################
##
#F  SubsemiringWithOneAndZero( <S>, <gens> )
#F  SubsemiringWithOneAndZeroNC( <S>, <gens> )
##
##  <ManSection>
##  <Func Name="SubsemiringWithOneAndZero" Arg='S, gens'/>
##  <Func Name="SubsemiringWithOneAndZeroNC" Arg='S, gens'/>
##
##  <Description>
##  </Description>
##  </ManSection>
##
DeclareGlobalFunction( "SubsemiringWithOneAndZero" );
DeclareGlobalFunction( "SubsemiringWithOneAndZeroNC" );


#############################################################################
##
#A  CentralIdempotentsOfSemiring( <S> )
##
##  <ManSection>
##  <Attr Name="CentralIdempotentsOfSemiring" Arg='S'/>
##
##  <Description>
##  For a semiring <A>S</A>, this function returns
##  a list of central primitive idempotents such that their sum is
##  the identity element of <A>S</A>.
##  Therefore <A>S</A> is required to have an identity.
##  </Description>
##  </ManSection>
##
DeclareAttribute( "CentralIdempotentsOfSemiring", IsSemiring );


#############################################################################
##
#E