42.6 Comparisons of Mappings

map1 = map2
map1 < map2

The equality operator = applied to two mappings map1 and map2 evaluates to true if the two mappings are equal and to false otherwise. The unequality operator < applied to two mappings map1 and map2 evaluates to true if the two mappings are not equal and to false otherwise. A mapping can also be compared with another object that is not a mapping, of course they are never equal.

Two mappings are considered equal if and only if their sources are equal, their ranges are equal, and for each elment elm of the source Images( map1, elm ) is equal to Images( map2, elm ) (see Images).

    gap> g := Group( (1,2,3,4), (2,4), (5,6,7) );;  g.name := "g";;
    gap> p4 := MappingByFunction( g, g, x -> x^4 );
    MappingByFunction( g, g, function ( x )
        return x ^ 4;
    end )
    gap> p13 := MappingByFunction( g, g, x -> x^13 );
    MappingByFunction( g, g, function ( x )
        return x ^ 13;
    end )
    gap> p4 = p13;
    false
    gap> p13 = IdentityMapping( g );
    true 

map1 < map2
map1 <= map2
map1 map2
map1 = map2

The operators <, <=, , and = applied to two mappings evaluates to true if map1 is less than, less than or equal to, greater than, or greater than or equal to map2 and false otherwise. A mapping can also be compared with another object that is not a mapping, everything except booleans, lists, and records is smaller than a mapping.

If the source of map1 is less than the source of map2, then map1 is considered to be less than map2. If the sources are equal and the range of map1 is less than the range of map2, then map1 is considered to be less than map2. If the sources and the ranges are equal the mappings are compared lexicographically with respect to the sets of images of the elements of the source under the mappings.

    gap> g := Group( (1,2,3,4), (2,4), (5,6,7) );;  g.name := "g";;
    gap> p4 := MappingByFunction( g, g, x -> x^4 );
    MappingByFunction( g, g, function ( x )
        return x ^ 4;
    end )
    gap> p5 := MappingByFunction( g, g, x -> x^5 );
    MappingByFunction( g, g, function ( x )
        return x ^ 5;
    end )
    gap> p4 < p5;
    true    # since '(5,6,7)' is the smallest nontrivial element of 'g'
            # and the image of '(5,6,7)' under 'p4' is smaller
            # than the image of '(5,6,7)' under 'p5' 

The operator = calls map2.operations.=( map1, map2 ) and returns this value. The operator < also calls map2.operations.=( map1, map2 ) and returns the logical not of this value.

The default function called this way is MappingOps.=, which first compares the sources of map1 and map2, then, if they are equal, compares the ranges of map1 and map2, and then, if both are equal and the source is finite, compares the images of all elements of the source under map1 and map2. Look in the index under equality to see for which mappings this function is overlaid.

The operator < calls map2.operations.<( map1, map2 ) and returns this value. The operator <= calls map2.operations.<( map2, map1 ) and returns the logical not of this value. The operator calls map2.operations.<( map2, map1 ) and returns this value. The operator = calls map2.operations.<( map1, map2 ) and returns the logical not of this value.

The default function called this way is MappingOps.<, which first compares the sources of map1 and map2, then, if they are equal, compares the ranges of map1 and map2, and then, if both are equal and the source is finite, compares the images of all elements of the source under map1 and map2. Look in the index under ordering to see for which mappings this function is overlaid.

Previous Up Top Next
Index

GAP 3.4.4
April 1997