[MONOiD]

2.7 Comparisons of Relations

rel1 = rel2
rel1 < rel2

The equality operator = applied to two relations rel1 and rel2 evaluates to true if the two relations are equal and to false otherwise. The inequality operator < applied to two relations rel1 and rel2 evaluates to true if the two relations are not equal and to false otherwise. A relation can also be compared to any other object that is not a relation, of course they are never equal. Two relations are considered equal if and only if their successors lists are equal as lists. In particular, they must have the same degree.

    gap> Relation( [ [ 1 ], [ 2 ], [ 3 ], [ 4 ] ] ) =
    > IdentityRelation( 4 );
    true
    gap> Relation( [ [ ], [ 1 ], [ 1, 2 ] ] ) =
    > Relation( [ [ ], [ 1 ], [ 1, 2 ], [ ] ] );
    false

rel1 < rel2
rel1 <= rel2
rel1 rel2
rel1 = rel2

The operators <, <=, , and = evaluate to true if the relation rel1 is less than, less than or equal to, greater than, or greater than or equal to the relation rel2, and to false otherwise.

Let rel1 and rel2 be two relations that are not equal. Then rel1 is considered smaller than rel2 if and only if the successors list of rel1 is smaller than the successors list of rel2.

You can also compare relations with objects of other types. Here any object that is not a relation will be considered smaller than any relation.

[Previous] [Up] [Next] 
[Index]

Version 2.4 (May 1998)

[MONOiD]