# Automorphism Groups

## `PermutationGroupHadamardCodeZ4(δ, m): RngIntElt, RngIntElt -> GrpPerm, Mtrx`

## `PAutHadamardCodeZ4(δ, m): RngIntElt, RngIntElt -> GrpPerm, Mtrx`

Given an integer $m\geq 1$ and an integer $\delta$ such that $1\leq \delta \leq \lfloor (m+1)/2 \rfloor$, this function returns the permutation group $G$ of a Hadamard code over ${\mathbb{Z}}_4$ of length $2^{m-1}$ and type $2^\gamma 4^\delta$, where $\gamma=m+1-2\delta$. The group $G$ contains all permutations of the coordinates which preserve the code. Thus only permutation of coordinates is allowed, and the degree of $G$ is always $2^{m-1}$. Moreover, the generator matrix with $\gamma+\delta$ rows used to generate the code is returned. This matrix is constructed in a recursive way using the `Plotkin` and `BQPlotkin` constructions defined in Section [New Codes from Old](constructions.md#sec-plotkin).

## `PermutationGroupHadamardCodeZ4Order(δ, m): RngIntElt, RngIntElt -> RngIntElt`

## `PAutHadamardCodeZ4Order(δ, m): RngIntElt, RngIntElt -> RngIntElt`

Given an integer $m\geq 1$ and an integer $\delta$ such that $1\leq \delta \leq \lfloor (m+1)/2 \rfloor$, return the order of the permutation group $G$ of a Hadamard code over ${\mathbb{Z}}_4$ of length $2^{m-1}$ and type $2^\gamma 4^\delta$, where $\gamma=m+1-2\delta$. The group $G$ contains all permutations of the coordinates which preserve the code.

## `PermutationGroupExtendedPerfectCodeZ4(δ, m): RngIntElt, RngIntElt -> GrpPerm, Mtrx`

## `PAutExtendedPerfectCodeZ4(δ, m): RngIntElt, RngIntElt -> GrpPerm, Mtrx`

Given an integer $m\geq 2$ and an integer $\delta$ such that $1\leq \delta \leq \lfloor (m+1)/2 \rfloor$, return the permutation group $G$ of an extended perfect code over ${\mathbb{Z}}_4$ of length $2^{m-1}$, such that its dual code is of type $2^\gamma 4^\delta$, where $\gamma=m+1-2\delta$. The group $G$ contains all permutations of the coordinates which preserve the code. Thus only permutation of coordinates is allowed, and the degree of $G$ is always $2^{m-1}$. Moreover, the generator matrix with $\gamma+\delta$ rows used to generate the code is returned. This matrix is constructed in a recursive way using the Plotkin and BQPlotkin constructions defined in Section [New Codes from Old](constructions.md#sec-plotkin).

## `PermutationGroupExtendedPerfectCodeZ4Order(δ, m): RngIntElt, RngIntElt -> RngIntElt`

## `PAutExtendedPerfectCodeZ4Order(δ, m): RngIntElt, RngIntElt -> RngIntElt`

Given an integer $m\geq 2$ and an integer $\delta$ such that $1\leq \delta \leq \lfloor (m+1)/2 \rfloor$, return the order of the permutation group $G$ of an extended perfect code over ${\mathbb{Z}}_4$ of length $2^{m-1}$, such that its dual code is of type $2^\gamma 4^\delta$, where $\gamma=m+1-2\delta$. The group $G$ contains all permutations of the coordinates which preserve the code.

## `Example: Spain Z4 8 (ex-61ad8c)`

```magma
> C := HadamardCodeZ4(2,4);
> PAut := PAutHadamardCodeZ4(2,4);
> PAut;
Permutation group PAut acting on a set of cardinality 8
    (1, 2)(3, 4)(5, 6)(7, 8)
    (2, 4)(6, 8)
    (5, 7)(6, 8)
    (1, 5)(3, 7)
> {p : p in Sym(8) | C^p eq C} eq Set(PAut);
true
> #PAut eq PAutHadamardCodeZ4Order(2,4);
true
> d := 2; m := 4; g := m+1-2*d;
> PAutHadamardCodeZ4Order(d, m) eq
>  #GL(d-1,Integers(4))*#GL(g,Integers(2))*2^g*4^((g+1)*(d-1));
true
> d := 4; m := 8; g := m+1-2*d;
> PAutHadamardCodeZ4Order(d, m) eq
>   #GL(d-1,Integers(4))*#GL(g,Integers(2))*2^g*4^((g+1)*(d-1));
true
> PAutHadamardCodeZ4(2,4) eq PAutExtendedPerfectCodeZ4(2,4);
true

```

## `PermutationGroup(C): CodeLinRng -> GrpPerm`

The permutation group $G$ of the linear code $C$ of length $n$ over the ring $R$, where $G$ is the group of all permutation-action permutations which preserve the code. Thus only permutation of coordinates is allowed, and the degree of $G$ is always $n$.

## `PermutationGroupGrayMapImage(C): CodeLinRng -> GrpPerm`

Given a code $C$ over ${\mathbb{Z}}_4$ of length $n$, return the permutation group $G_{bin}$ of $C_{bin}=\Phi(C)$, where $G_{bin}$ is the group of all permutation-action permutations which preserve the binary code $C_{bin}$ of length $2n$ and $\Phi$ is the Gray map. Thus only permutation of coordinates is allowed, and the degree of $G_{bin}$ is always $2n$.

## `Example: Code Z4 Perm Group (ex-326517)`

```magma
> C := HadamardCodeZ4(2,4);
> PAutC := PermutationGroup(C);
> PAutC eq PAutHadamardCodeZ4(2,4);
true
> #PAutC eq PAutHadamardCodeZ4Order(2,4);
true
> {p : p in Sym(8) | C^p eq C} eq Set(PAutC);
true

> Cbin := GrayMapImage(C);
> PAutCbin := PermutationGroupGrayMapImage(C);
> {p : p in PAutCbin | Set(Cbin)^p eq Set(Cbin)} eq Set(PAutCbin);
true

```
