GAP Lesson 3


Change to the directory where you store your GAP files, and then start up GAP.

gap> LogTo("GAPlesson3");
gap> At:=KnownAttributesOfObject;

The last command is there because the function KnownPropertiesOfObject has a long name and it is inconvenient to keep typing it. It shows that a function can be assigned to a variable. There is also KnownPropertiesOfObject but it does something different.

Some manipulation with permutation groups.
We start by entering a group. Every so often we will check what GAP knows about the group by doing the command At. The first lines are to show you how to access the generators of the group.

gap> c:=Group((1,2,3,4,5,6,7),(2,3)(4,7));
gap> At(c);
gap> Size(c);
gap> GeneratorsOfGroup(c);
gap> c.1;
gap> c.2;
gap> At(c);
gap> s:=SylowSubgroup(c,2);
gap> Size(s);
gap> At(c);
gap> At(s);

Comment on anything you notice.
We now learn: Orbits, Action, Tuples, UnorderedTuples, Arrangements, Combinations.


gap> Orbits(s,[1..7]);
gap> news:=Action(s,last[3]);
gap> Size(news);

Make sure you understand what Action is doing. What kind of data type does this command return? Obtaining a group as a permutation group on a smaller set than originally given can be quite useful. Comment on anything weird that happened.
How would things be different if you had done instead
gap> news:=Action(s,last[2]);
gap> Size(news);

What do you think would happen if you were to do
gap> Orbits(s,[1..8]);
or
gap> Orbits(s,[2..7]);
or
gap> Orbits(s,[3..7]);
?
Now try the following:

gap> Tuples([1..3],2);
gap> UnorderedTuples([1..3],2);
gap> Arrangements([1..3],2);
gap> Combinations([1..3],2);

Most of the above were straightforward. Explain what Arrangements seems to do.
Exercise: Find out what GAP command returns a list of all partitions of [1,2,3].

gap> newers:=Action(news,Tuples([1..4],2),OnTuples);
gap> Orbits(newers);

Other possibilities in Action instead of OnTuples: OnPairs, OnTuples, OnSets, OnRight, OnLeft. Investigate by doing ?Actions.
The following is very useful.

gap> Action(c,RightCosets(c,s),OnRight);
gap> Orbits(last);

We use these commands to show computationally that SL(2,4) is isomorphic to the alternating group A_5. We first call up SL(2,4) from a library of matrix groups. We will learn about matrix groups in just a moment.

gap> g:=SL(2,4);
gap> Size(g);
gap> sg:=SylowSubgroup(g,2);
gap> n:=Normalizer(g,sg);
gap> Size(n);
gap> newg:=Action(g,RightCosets(g,n),OnRight);
gap> Size(newg);

Exercise: Show that the group
gap> k:=Group((1,5)(2,6),(1,3)(4,6),(2,3)(4,5));
is isomorphic to the symmetric group S_4.




Matrices, Finite Fields and Matrix Groups

We learn: vectors are lists, matrices are lists of lists, they can be manipulated the same way as integers, the functions BaseMat, TransposedMat, NullspaceMat, RankMat, TriangulizeMat, PrintArray, the library of matrix groups; how finite field elements are represented and manipulated; computations with matrix groups are mostly done by finding a permutation representation first.

With the calculations using SL(2,4) we have already seen that GAP can compute with matrix groups, and that some of the same commands for permutation groups also work in this context. Let us examine this group a little more.


gap> GeneratorsOfGroup(g);
gap> g.1;

We set about trying to get GAP to print out what these matrices really are.

gap> Print(g.1);
gap> PrintArray(g.1);

You can see that matrices are lists of lists and that the field with 4 elements appears to be stored in a funny way.

gap> FieldOfMatrixGroup(g);
gap> GF(2);
gap> Elements(GF(2));
gap> Elements(GF(4));
gap> Z(16)^3+Z(16)^4;
gap> Z(4) in GF(16);
gap> Z(4) in GF(8);

From these calculations, describe how finite field elements are stored, and why the last two commands gave the results you got.
Exercise: Find the power of Z(16) that equals Z(4).
We next see how to display elements of the prime field in a user-friendly fashion.


gap> List(Elements(GF(2)),Int);
gap> List(Elements(GF(4)),Int);
gap> List(Elements(GF(11)),Int);
gap> Elements(GF(11));

Using the function Int we now write a function which prints out (some) matrices nicely.

gap> MatPrint:=function(mat)
> PrintArray(List(mat,x->List(x,Int)));
> end;
function( mat ) ... end

The following lines illustrate some standard matrix operations.

gap> g:=GL(3,2);
gap> MatPrint(g.1);
gap> MatPrint(g.2);
gap> Size(g);
gap> g.1*g.2;
gap> MatPrint(g.1*g.2);
gap> mat:=g.2+g.2^2;
gap> MatPrint(mat);
gap> MatPrint(BaseMat(mat));
gap> MatPrint(mat);
gap> MatPrint(NullspaceMat(mat));
gap> RankMat(mat);
gap> MatPrint(TransposedMat(g.2));

Algorithms for permutation groups generally work much faster than algorithms for matrix groups. Because of this, one of the first things frequently done with a matrix group is to convert it to a permutation group. We now see some ways to do this.

gap> Orbits(g,GF(2)^3);
gap> gcopy:=Action(g, last[2]);
gap> Size(gcopy);

gap> Print(g.1);
gap> Orbit(g,g.1[1]);
gap> Action(g,last);

gap> NiceObject(g);

The latter may be created by doing the next two lines:

gap> hom:=NiceMonomorphism(g);
<Action homomorphism>
gap> Image(hom,g);
Group([ (5,7)(6,8), (2,3,5)(4,7,6) ])
gap> Image(hom,g.1);
(5,7)(6,8)