# General Group Properties

## `IsCyclic(G): GrpAb -> BoolElt`

Returns `true` if the group $G$ is cyclic, `false` otherwise.

## `IsElementaryAbelian(G): GrpAb -> BoolElt`

Returns `true` if the group $G$ is elementary abelian, `false` otherwise.

## `IsFree(G): GrpAb -> BoolElt`

Returns `true` if $G$ is free, `false` otherwise.

## `IsMixed(G): GrpAb -> BoolElt`

Returns `true` if $G$ is a mixed group, `false` otherwise. An abelian group is mixed if it is neither a torsion group nor free.

## `IspGroup(G): GrpAb -> BoolElt`

Returns `true` if the finite group $G$ is a $p$-group, i.e. if all elements have order a power of $p$.

## `DerivedLength(G): GrpAb -> RngIntElt`

The length of the derived series of $G$.

## Properties of Subgroups

### `IsMaximal(G, H): GrpAb, GrpAb -> BoolElt`

Returns `true` if the subgroup $H$ of the finite group $G$ is a maximal subgroup of $G$, `false` otherwise.

### `Index(G, H): GrpAb, GrpAb -> RngIntElt`

The index of the subgroup $H$ in the group $G$, returned as an ordinary integer. If $H$ has infinite index in $G$, the value zero is returned.

### `FactoredIndex(G, H): GrpAb, GrpAb -> [<RngIntElt, RngIntElt>]`

The factored index of the subgroup $H$ in the group $G$, returned as a sequence of prime-exponent pairs. If $H$ has infinite index in $G$, the empty sequence is returned.

### `IsPure(G, H): GrpAb, GrpAb -> BoolElt`

Returns `true` if the subgroup $H$ of the finite group $G$ is pure, ie. if for all $n$ we have $nG \cap H = nH$.

### `IsNeat(G, H): GrpAb, GrpAb -> BoolElt`

Returns `true` if the subgroup $H$ of the finite group $G$ is neat, i.e., if for all primes $p$ we have $pG \cap H = pH$.

## Enumeration of Subgroups

### `MaximalSubgroups(G): GrpAb -> [GrpAb]`

The maximal subgroups of the finite group $G$ returned as a sequence of subgroups.

### `Subgroups(G:parameters): GrpAb -> [Rec]`

```magma
Sub : [RngIntElt]                    Default: []
Quot: [RngIntElt]                    Default: []
```

The subgroups of the finite group $G$ are returned as a sequence of records. The record fields are `subgroup`, storing the actual group; `order`, storing the group order; and `length`, storing the length of the conjugacy class, which is always 1 for abelian groups.

If the parameter `Sub` is set, only subgroups with invariants equal to the given sequence are found. The given sequence should contain positive integers, such that each divides the following.

If the parameter `Quot` is set, only subgroups such that the quotient group has invariants equal to the given sequence are found. The given sequence should contain positive integers, such that each divides the following.

### `NumberOfSubgroupsAbelianPGroup(A): SeqEnum -> SeqEnum`

Return the number of subgroups of each non-trivial order in the abelian $p$-group $G$ where $A = [a_1, a_2, \ldots]$ and $G = C_{a_1} \times C_{a_2} \times \ldots$. The $m$-th entry in the sequence returned is the number of subgroups of order $p^m$.

### `HasComplement(G, U): GrpAb, GrpAb -> BoolElt, GrpAb`

For a finite abelian group $G$ and a subgroup $U$ decide if there exist some other subgroup $V$ such that $G = U+V$ and $U \cap V = \lbrace 0\rbrace$. In case such a $V$ exists, it is returned as the second value.

### `Example: Subgroups (ex-604d09)`

We look at subgroups of an abelian group of order 12.

```magma
> G := AbelianGroup([2,6]);
> s := Subgroups(G); #s;
10
> s[7];
rec<recformat<order, length, subgroup, presentation> |
   order := 3, length := 1,
   subgroup := Abelian Group isomorphic to Z/3
Defined on 1 generator in supergroup G:
  $.1 = 2*G.2
Relations:
  3*$.1 = 0>
> [x`order:x in s];
[ 12, 6, 4, 2, 6, 6, 3, 2, 2, 1 ]

```

Now we find the elementary abelian subgroup of order 4.

```magma
> s22 := Subgroups(G:Sub := [2,2]); #s22;
1
> s22;
Conjugacy classes of subgroups
------------------------------

[1]     Order 4            Length 1
        Abelian Group isomorphic to Z/2 + Z/2
        Defined on 2 generators in supergroup G:
          $.1 = G.1
          $.2 = 3*G.2
        Relations:
          2*$.1 = 0
          2*$.2 = 0

```

There is more than one subgroup of index 2 in $G$.

```magma
> q2 := Subgroups(G:Quot := [2]); #q2;
3
> q2[3]`subgroup;
Abelian Group isomorphic to Z/6
Defined on 1 generator in supergroup G:
  $.1 = G.1 + G.2
Relations:
  6*$.1 = 0

```
