![[MONOiD]](monoid.png)
Relations are not implemented as GAP domains, therefore the usual set
functions (like Elements and Size) do not apply (even if we provide
methods for them). However, union and difference of relations are
implemented through the operators + and -.
rel1 + rel2
The operator + evaluates to the union of the relations rel1 and
rel2 if both have the same degree.
gap> a:= Relation( [ [ ], [ 4 ], [ 1, 4 ], [ 1 ] ] );;
gap> b:= Relation( [ [ 1 ], [ ], [ 4 ], [ ] ] );;
gap> a + b;
Relation( [ [ 1 ], [ 4 ], [ 1, 4 ], [ 1 ] ] )
rel1 - rel2
The operator - evaluates to the difference of the relations rel1 and
rel2 if both have the same degree.
gap> a:= Relation( [ [ ], [ 4 ], [ 1, 4 ], [ 1 ] ] );;
gap> b:= Relation( [ [ 1 ], [ ], [ 4 ], [ ] ] );;
gap> a - b;
Relation( [ [ ], [ 4 ], [ 1 ], [ 1 ] ] )
elm in rel
The operator in evaluates to true if the pair elm is in the
relation rel, that is if elm[1] is related to elm[2], and to
false otherwise. If elm is not a pair, or if an entry in pair
exceeds the degree of rel an error is produced.
gap> a:= Relation( [ [ ], [ 4 ], [ 1, 4 ], [ 1 ] ] );;
gap> [1,2] in a;
false
gap> [2,4] in a;
true
Version 2.4 (May 1998)