IsFinite( G )
The group G, which must consist of rational matrices, is tested for finiteness.
A group of rational matrices is finite iff the following two conditions hold: There is a basis with respect to which all elements of G have integer entries, and G preserves a positive definite quadratic form.
If G contains non-integer matrices, then IsFinite first calls InvariantLattice (see InvariantLattice for rational matrix groups) to find a basis with respect to which all elements of G are integer matrices.
IsFinite then finds a positive definite quadratic form, or determines that none exists. If G is finite, then the quadratic form is stored in G.quadraticForm.
gap> a := [[1,1/2],[0,-1]];; G := Group(a);; gap> IsFinite(G); true gap> L := G.invariantLattice;; gap> L*a*L^(-1); [ [ 1, 1 ], [ 0, -1 ] ] gap> B := G.quadraticForm; [ [ 4, 1 ], [ 1, 3/2 ] ] gap> TransposedMat(a)*B*a; [ [ 4, 1 ], [ 1, 3/2 ] ]
This function is Las Vegas: it is randomized, but the randomness only affects the running time, not the correctness of the output. (See IsFiniteDeterministic for integer matrix groups.)
GAP 3.4.4