This article is about how to use GAP (Groups, Algorithms and Programming) for computations involving groups, particularly finite groups.
- 1 Running GAP
- 2 Some basic information about finite groups
- 3 Properties in GAP
- 4 Computation using GAP
- 5 Writing code for properties
GAP runs best in a terminal/command line environment. On a UNIX machine where gap is installed, it can be run from the commandline with the command:
This command opens GAP in interpreter mode.
Giving commands and assigning values
GAP embodies principles both of declarative programming and of imperative programming. A command in GAP could be an instruction to do something, but typically, it is just an assignment of a value.
Every GAP command produces an output value, which is displayed on the screen after the command is executed. In addition, a command can introduce new variables that can be used in future commands. For instance, consider the command:
The sole effect of this command is to output the cyclic group of order 23. The group isn't output as a multiplication table; rather a somewhat cryiptic description is given.
G := CyclicGroup(23);
outputs the cyclic group of order 23, and also stores the information that equals this group. Thus, we can later use in place of writing the full expression.
in this case is a variable.
If you are unsure of the spelling of a command, pressing "Tab" on a UNIX environment gives a list of possible completions. The first time you press the key, the command will be completed to whatever further number of letters are uniquely determined. The next time you press the tab key, a list of possible further completions is shown.
Functions are case-sensitive.
GAP has a number of in-built functions, and one can invoke these functions by providing the parameters to the function in parentheses. For instance, consider the pair of lines:
G := DirectProduct(CyclicGroup(23), CyclicGroup(21)); IsAbelian(G);
The first line here assigns, to the variable , the value which is the direct product of the cyclic groups of order 23 and 21. The output here is itself. The second line takes as input the group , and outputs whether or not it is Abelian. The output here is either true or false (in this case, it's true).
Some basic information about finite groups
Finite groups are stored as permutations
Finite groups are stored as subgroups of permutation groups. Most importantly, the same finite group could be stored in any number of different ways. Thus, if we define:
G := CyclicGroup(6); H := DirectProduct(CyclicGroup(2),CyclicGroup(3)); G = H;
Then the final answer is false. The groups are not equal, because their internal representations are not equal. To check whether the groups are isomorphic, the correct command is:
This constructs an isomorphism if there exists one, and otherwise returns "false".
To define a finite group, one can usually describe it as a permutation group. For instance, suppose I want to define the group generated by the permutations:
Then the command is:
G := Group((1,2,3)(4,5), (3,4,5,6,7));
Using presentations for finite groupsPLACEHOLDER FOR INFORMATION TO BE FILLED IN: [SHOW MORE]
Construction techniques for finite groups
A permutation representation could be pretty unwieldy for finite groups, so there are many alternative commands to define finite groups that occur in practice. Some of these include:
- CyclicGroup takes a positive integer parameter and constructs a cyclic group with that order
- GL takes two parameters as input, and outputs the corresponding general linear group. For instance:
outputs the general linear group on the field of three elements, of order two.
- Similar commands exist for special linear groups, orthogonal groups, unitary groups.
- Commands like DirectProduct, SemidirectProduct, can be used to construct bigger groups from smaller ones.
Group Ids for finite groups
For finite groups of order upto 1000, there is a complete list of Group Ids. This is part of the "Small Groups" project. Commands related to this are:
- IdGroup takes as input a finite group and outputs its Group Id. The Group Id is an ordered pair of integers. The first integer is the size of the group, and the second is its ID among groups of that size (the IDs are determined by a procedure).
- SmallGroup takes as input two numbers and outputs a group with that pair as its Group Id.
- AllSmallGroups takes one parameter and returns the list of all finite groups with that order. The list is in the order of Group Ids.
Properties in GAP
GAP has in-built commands for testing properties, that can be checked out at:
- For testing group properties: The command is usually of the form IsCommandName and takes as input the group for which the property is being tested. For instance:
returns "true" if is an Abelian group and "false" if is a non-Abelian group.
- For testing subgroup properties: The command is usually of the form IsCommandName and takes as input the pair of the group and the subgroup. For instance, we have:
returns "true" if is a normal subgroup of and "false" otherwise. Note that when is not a subgroup of it may still return "true" for other reasons (i.e. that normalizes inside whatever huge permutation group they're secretly embedded in).
Listing all groups/subgroups with a particular property
We can use a property test to filter out a list of groups, and return only those groups satisfying the property. For instance, suppose we need to determine all nilpotent groups of a particular order . The command for that is:
this filters the list of all groups of order , against the criterion of being nilpotent.
Most finite groups have a lot of subgroups, so it is sometimes helpful to list only one representative of each conjugacy class. The following command creates a list of one representative of each conjugacy class.
This applies the Representative function to the list of conjugacy classes of subgroups of . We can then filter this list based on whatever property we are interested in. For instance:
filters out the list of all representatives of conjugacy classes of subgroups to return only the subnormal subgroups.
Listing conjugate subgroups
returns the list of all conjugate subgroups to in .
Computation using GAP
Conjugation and automorphism
GAP uses right exponentiation for conjugation and for automorphisms. If is a group and is an automorphism of , we write for the effect of on . Actions are assumed to be on the right.