# Homomorphisms

Two functions are provided to construct homomorphisms or isomorphisms from one group into another, where either of the groups, or both, may be generic abelian groups.

## `hom< A -> B | L>: Grp, Grp, List -> Map`

Given groups $A$ and $B$, construct a homomorphism from $A$ to $B$ as defined by the extension $L$. If one or both of $A$ and $B$ are generic abelian groups this works as usual, with one minor difference as explained below. Suppose that the generators of $A$ are $g_1, \dots, g_n$, and that $\phi(g_i)=h_i$ for each $i$, where $\phi$ is the homomorphism one wishes to construct. The list $L$ as required by the constructors must be one of the following:

**(a)**
a list of the $n$ 2-tuples $< g_i, h_i >$ (order not important);

**(b)**
a list of the $n$ arrow-pairs $g_i \rightarrow h_i$ (order not important);

**(c)**
$h_1, \dots, h_n$ (order is important).

If $A$ is a generic abelian group this rule is relaxed somewhat in the following sense: If $L$ is a list of $n$ 2-tuples or of $n$ arrow-pairs, the elements $g_i$ need not be the defining generators of $A$. The only requirement is that the set $\{g_1, \ldots, g_n\}$ does actually generate the whole of $A$.

## `Homomorphism(A, B, X, Y): Grp, Grp, [ GrpElt ], [ GrpElt ] -> Map`

Creates a homomorphism from $A$ into $B$ as given by the mapping of $X$ into $Y$. The arguments $A$ and $B$ may be any type of group, including of course, generic abelian groups.

The function `Homomorphism` does not require the elements of the argument $X$ to be generators of $A$ as given by `Generators(A)`, so it allows more freedom when creating a homomorphism. If, however, these elements fail to generate the whole of $A$ then the subsequent map application will fail.

## `iso< A -> B | L>: Grp, Grp, List -> Map`

Given groups $A$ and $B$, construct an isomorphism from $A$ to $B$ as defined by the extension $L$. If one or both of $A$ and $B$ are generic abelian groups this works as usual, with one minor difference as explained below. Suppose that the generators of $A$ are $g_1, \dots, g_n$, and that $\phi(g_i)=h_i$ for each $i$, where $\phi$ is the isomorphism one wishes to construct. The list $L$ as required by the constructors must be one of the following:

**(a)**
a list of the $n$ 2-tuples $< g_i, h_i >$ (order not important);

**(b)**
a list of the $n$ arrow-pairs $g_i \rightarrow h_i$ (order not important);

**(c)**
$h_1, \dots, h_n$ (order is important).

If $A$ is a generic abelian group this rule is relaxed somewhat in the following sense: If $L$ is a list of $n$ 2-tuples or of $n$ arrow-pairs, the elements $g_i$ may not necessarily be generators of $A$ as given by the function `Generators(A)`. The only requirement is that the set $\{h_1, \ldots, h_n\}$ does actually generate the whole of $B$.

## `Isomorphism(A, B, X, Y): Grp, Grp, [ GrpElt ], [ GrpElt ] -> Map`

Creates a isomorphism from $A$ into $B$ as given by the mapping of $X$ into $Y$. The arguments $A$ and $B$ can be any type of group, including of course, generic abelian groups.

The function `Isomorphism` does not require the elements of the argument $X$ to be generators of $A$ as given by `Generators(A)`, so it allows more freedom when creating an isomorphism. If, however, these elements fail to generate the whole of $A$ then the subsequent map application will fail.

## `Example: Homomorphisms (ex-32bea9)`

Recall that we defined the subgroups $GH1_{Zm}$ and $GH2_{Zm}$ of $G$ as:

```magma
> GH1_Zm;
Generic Abelian Group over
Residue class ring of integers modulo 34384
Abelian Group isomorphic to Z/6 + Z/612
Defined on 2 generators in supergroup G:
  GH1_Zm.1 = G.2 + G.3
  GH1_Zm.2 = G.4
Relations:
  6*GH1_Zm.1 = 0
  612*GH1_Zm.2 = 0
> GH2_Zm;
Generic Abelian Group over
Residue class ring of integers modulo 34384
Abelian Group isomorphic to Z/2 + Z/2 + Z/6 + Z/612
Defined on 4 generators in supergroup G:
  GH2_Zm.1 = G.1
  GH2_Zm.2 = G.2
  GH2_Zm.3 = G.3
  GH2_Zm.4 = G
Relations:
  2*GH2_Zm.1 = 0
  2*GH2_Zm.2 = 0
  6*GH2_Zm.3 = 0
  612*GH2_Zm.4 = 0

```

We construct the homomorphism

```magma
> h := hom<GH1_Zm -> GH2_Zm | GH2_Zm.1, GH2_Zm.2 >;
> h(GH1_Zm);
Generic Abelian Group over
Residue class ring of integers modulo 34384
Abelian Group isomorphic to Z/2 + Z/2
Defined on 2 generators in supergroup GH2_Zm:
  $.1 = GH2_Zm.2
  $.2 = GH2_Zm.1
Relations:
  2*$.1 = 0
  2*$.2 = 0

```

but we cannot construct the isomorphism

```magma
> i := iso<GH1_Zm -> GH2_Zm | GH2_Zm.1, GH2_Zm.2 >;

>> i := iso<GH1_Zm -> GH2_Zm | GH2_Zm.1, GH2_Zm.2 >;
           ^
Runtime error in map< ... >: Images do not generate the (whole) codomain

```

An alternative way of creating the homomorphism $h$ would be

```magma
> h := Homomorphism(GH1_Zm, GH2_Zm, Generators(GH1_Zm), [GH2_Zm.1, GH2_Zm.2]);

```
