37.3 Example Functions

OneLibraryGroup( fun1, val1, fun2, val2, ... )

For each group library there is a example function. This function allows you to find one group from the library that has a given set of properties.

The name of the example functions always begins with One and always ends with Group. Inbetween is a name that hints at the nature of the group library. For example, the example function for the library of all The Primitive Groups Library) is called OnePrimitiveGroup, and the example function for the library of all 2-groups of size at most 256 (see The 2-Groups Library) is called OneTwoGroup.

These functions take an arbitrary number of pairs of arguments. The first argument in such a pair is a function that can be applied to the groups in the library, and the second argument is either a single value that this function must return in order to have this group returned by the example function, or a list of such values.

For example

    OnePrimitiveGroup( DegreeOperation,  [10..15],
                        Size,             [1..100],
                        IsAbelian,        false    );

should return one primitive group with degree between 10 and 15 and size size less than 100 that is not abelian.

Thus the OnePrimitiveGroup behaves as if it was implemented by a function similar to the one defined below, where PrimitiveGroupsList is a list of all primitive groups. Note, in the definition below we assume for simplicity that OnePrimitiveGroup accepts exactly 4 arguments. It is of course obvious how to change this definition so that the function would accept a variable number of arguments.

    OnePrimitiveGroup := function ( fun1, val1, fun2, val2 )
        local    g, i;
        for i  in [ 1 .. Length( PrimitiveGroupsList ) ] do
            g := PrimitiveGroupsList[i];
            if      fun1(g) = val1  or IsList(val1) and fun1(g) in val1
                and fun2(g) = val2  or IsList(val2) and fun2(g) in val2
            then
                return g;
            fi;
        od;
        return false;
    end; 

Note that the real example functions are considerably more difficult, to improve the efficiency. Most important, each recognizes a certain set of About Group Libraries).

Previous Up Top Next
Index

GAP 3.4.4
April 1997