# Construction of a Finitely Presented Abelian Group and its Elements

## The Free Abelian Group

### `FreeAbelianGroup(n): RngIntElt -> GrpAb`

Construct the free abelian group $F$ on $n$ generators, where $n$ is a positive integer. The $i$-th generator may be referenced by the expression `F.i`, $i = 1, \ldots, n$. Note that a special form of the assignment statement is provided which enables the user to assign names to the generators of $F$. In this form of assignment, the list of generator names is enclosed within angle brackets and appended to the variable name on the *left hand side* of the assignment statement.

### `Example: Free Abelian Group (ex-c01eb3)`

The statement

```magma
> F := FreeAbelianGroup(2);

```

creates the free abelian group on two generators. Here the generators may be referenced using the standard names, $F.1$ and $F.2$.

The statement

```magma
> F<x, y> := FreeAbelianGroup(2);

```

defines $F$ to be the free abelian group on two generators and assigns the names $x$ and $y$ to the generators.

## Relations

### `w₁ = w₂: GrpAbElt, GrpAbElt -> Rel`

Given words $w_1$ and $w_2$ over the generators of an abelian group $A$, create the relation $w_1 = w_2$. Note that this relation is not automatically added to the existing set of defining relations $R$ for $S$. It may be added to $R$, for example, through use of the `quo`-constructor (see below).

### `r[1]: GrpAbRel, RngIntElt -> GrpAbElt`

### `LHS(r): Rel -> GrpAbElt`

Given a relation $r$ over the generators of $A$, return the left hand side of the relation $r$. The object returned is a word over the generators of $A$.

### `r[2]: GrpAbRel, RngIntElt -> GrpAbElt`

### `RHS(r): Rel -> GrpAbElt`

Given a relation $r$ over the generators of $A$, return the right hand side of the relation $r$. The object returned is a word over the generators of $A$.

### `Parent(r): RelElt -> GrpAb`

Group over which the relation $r$ is taken.

### `Example: Relations (ex-0f1824)`

We may define a group and a set of relations as follows:

```magma
> F<x, y> := FreeAbelianGroup(2);
> rels := { 2*x = 3*y, 4*x + 4*y = Id(F)} ;

```

To replace one side of a relation, the easiest way is to reassign the relation. So for example, to replace the relation $2 x = 3 y$ by $2 x = 4 y$:

```magma
> r := 2*x = 3*y;
> r := LHS(r) = 4*y;

```

## Specification of a Presentation

An abelian group with non-trivial relations is constructed as a quotient of an existing abelian group, possibly a free abelian group.

### `AbelianGroup< X | R >: List(Var), List(GrpAbRel) -> GrpAb, Hom(GrpAb)`

Given a list $X$ of variables $x_1, \ldots, x_r$, and a list of relations $R$ over these generators, let $F$ be the free abelian group on the generators $x_1, \ldots, x_r$. Then construct (a) an abelian group $A$ isomorphic to the quotient of $F$ by the subgroup of $F$ defined by $R$, and (b) the natural homomorphism $\phi : F \rightarrow A$.

Each term of the list $R$ is either a *word*, a *relation*, a *relation list* or a *subgroup* of $F$.

- A *relation* consists of a pair of words, separated by ‘=’.

- A *word* $w$ is interpreted as a *relator*, that is, it is equivalent to the relation $w = 0$. (See above).

- A *relation list* consists of a list of words, where each pair of adjacent words is separated by ‘=’: $w_1 = w_2 = \cdots = w_r$. This is interpreted as the set of relations $w_1 = w_r, \ldots, w_{r - 1} = w_r$. Note that the relation list construct is only meaningful in the context of the `quo`-constructor.

A *subgroup* $H$ appearing in the list $R$ contributes its generators to the relation set for $A$, i.e., each generator of $H$ is interpreted as a relator for $A$. The group $F$ may be referred to by the special symbol `$` in any word appearing to the right of the ‘`|`’ symbol in the `quo`-constructor. Also, in the context of the `quo`-constructor, the identity element (empty word) may be represented by the digit $0$.

The function returns:

**(a)**
The quotient group $A$;

**(b)**
The natural homomorphism $\phi : F \rightarrow A$.

### `Example: Abelian Group (ex-bd5820)`

We create the abelian group defined by the presentation $< a, b, c\ |\ 7a + 4b + c, 8a + 5b + 2c, 9a + 6b + 3c >$.

```magma
> F<a, b, c> := FreeAbelianGroup(3);
> A := quo< F | 7*a + 4*b + c, 8*a + 5*b + 2*c, 9*a + 6*b + 3*c >;
> A;
AbelianGroup isomorphic to Z_3 + Z
Defined on 2 generators
Relations:
    3*A.1 = 0

```

A simple way of specifying an abelian group is as a product of cyclic groups.

### `AbelianGroup([n₁,...,nᵣ]): [ RngIntElt ] -> GrpAb`

Construct the abelian group defined by the sequence $[n_1,\ldots,n_r]$ of non-negative integers as an abelian group. The function returns the direct product of cyclic groups $C_{n_1} \times C_{n_2} \times \cdots \times C_{n_r}$, where $C_0$ is interpreted as an infinite cyclic group.

### `Example: Abelian Group2 (ex-ea4c01)`

We create the abelian group $Z_2 \times Z_3 \times Z_4 \times Z_5 \times Z_6 \times Z \times Z$.

```magma
> G<[x]> := AbelianGroup([2,3,4,5,6,0,0]);
> G;
Abelian Group isomorphic to Z/2 + Z/6 + Z/60 + Z + Z
Defined on 7 generators
Relations:
    2*G.1 = 0
    3*G.2 = 0
    4*G.3 = 0
    5*G.4 = 0
    6*G.5 = 0

```

## Accessing the Defining Generators and Relations

The functions described here provide access to basic information stored for an abelian group $A$.

### `A . i: GrpAb, RngIntElt -> GrpAbElt`

The $i$-th defining generator for $A$.

### `Generators(A): GrpAb -> { GrpAbElt}`

A set containing the generators for $A$.

### `NumberOfGenerators(A): GrpAb -> RngIntElt`

### `Ngens(A): GrpAb -> RngIntElt`

The number of generators for $A$.

### `Parent(u): GrpAbElt -> GrpAb`

The parent group $A$ of the word $u$.

### `Relations(A): GrpAb -> [ Rel ]`

A sequence containing the defining relations for $A$.

### `RelationMatrix(A): GrpAb -> Mtrx`

A matrix where each row corresponds to one of the defining relations of $A$.
