% EJC papers *must* begin with the following two lines.
\documentclass[12pt]{article}
\usepackage{e-jc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{graphicx}
\usepackage[colorlinks=true,citecolor=black,linkcolor=black,urlcolor=blue]{hyperref}
\DeclareMathOperator{\Triples}{\sf{Triples}}
\DeclareMathOperator{\Pre}{Pre} \DeclareMathOperator{\AGL}{AGL}
\DeclareMathOperator{\Aut}{Aut} \DeclareMathOperator{\rep}{rep}
\DeclareMathOperator{\Rep}{Rep} \DeclareMathOperator{\Num}{Num}
\DeclareMathOperator{\Diff}{Diff} \DeclareMathOperator{\PSL}{PSL}
\DeclareMathOperator{\PGaL}{P\Gamma L}
\newcommand{\ub}{\underbar}
\newcommand{\cn}{\mathrm{CN}}
%\newcommand{\rep}{\mathrm{rep}}
%\newcommand{\Rep}{\mathrm{Rep}}
%\newcommand{\Prod}{\mathrm{Prod}}

\DeclareMathOperator{\PGL}{PGL} \DeclareMathOperator{\GaL}{\Gamma
L} \DeclareMathOperator{\Sp}{Sp} \DeclareMathOperator{\PSp}{PSp}
\DeclareMathOperator{\SU}{SU} \DeclareMathOperator{\PSU}{PSU}
%\DeclareMathOperator{\M}{M}
\DeclareMathOperator{\AGaL}{A\Gamma L}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\pt}{\mathcal{P}}
\DeclareMathOperator{\PAut}{PAut}
\DeclareMathOperator{\MAut}{MAut}
\DeclareMathOperator{\GAut}{\Gamma Aut}
\DeclareMathOperator{\B}{\mathcal{B}}
\DeclareMathOperator{\fix}{fix} \DeclareMathOperator{\Ree}{Ree}
\DeclareMathOperator{\GaSp}{\Gamma Sp}
\DeclareMathOperator{\soc}{soc} \DeclareMathOperator{\Inn}{Inn}
\DeclareMathOperator{\GF}{GF} \DeclareMathOperator{\Prod}{Prod}
\DeclareMathOperator{\Diag}{Diag}
\DeclareMathOperator{\PGaU}{P\Gamma U}
\DeclareMathOperator{\All}{All}
%\DeclareMathOperator{\d}{\delta}
\DeclareMathOperator{\Perm}{Perm}
\DeclareMathOperator{\case1}{{\sf{Case\,1}}}
\DeclareMathOperator{\taucase}{{\sf{Case\,2}}}
\DeclareMathOperator{\mindeg}{mindeg}
\DeclareMathOperator{\support}{support}
\DeclareMathOperator{\z}{{\bf{0}}} \DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\SL}{SL} \DeclareMathOperator{\ASL}{ASL}
\DeclareMathOperator{\wt}{wt}
\DeclareMathOperator{\base}{\mathfrak{B}}
\DeclareMathOperator{\topg}{\mathfrak{L}}
%\DeclareMathOperator{\L}{L}
%\usepackage{showkeys}
\DeclareMathOperator{\Sym}{Sym} \DeclareMathOperator{\n}{{\bf{v}}}
\newtheorem{theorem}{Theorem}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}

%\theoremstyle{definition}

\newtheorem{construction}[theorem]{Construction}

\newtheorem{remark}[theorem]{Remark}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{hypothesis}[theorem]{Hypothesis}

\newcommand{\alt}[1]{{\sf A}_{#1}}
\newcommand{\Alt}[1]{{\sf Alt}\,#1}
\newcommand{\mat}[1]{{\sf M}_{#1}}
\newcommand{\sy}[1]{{\sf S}_{#1}}

\newcommand{\psp}[2]{{\sf PSp}_{#1}(#2)}
\renewcommand{\sp}[2]{{\sf Sp}_{#1}(#2)}
\newcommand{\pomegap}[2]{{\sf P}\Omega^+_{#1}(#2)}
\newcommand{\pgammasp}[2]{{\sf P}\Gamma{\sf Sp}_{#1}(#2)}

\newcommand{\id}{\operatorname{id}}
\newcommand{\core}[2]{{\sf Core}_{#1}(#2)}
%\newcommand{\soc}{\operatorname{Soc}}
\newcommand{\sym}[1]{{\sf Sym}\,#1}
%\newcommand{\supp}{\operatorname{Supp}}
\newcommand{\diag}{\operatorname{\sf Diag}}
\newcommand{\twr}[3]{#1\, {\sf twr}_{#2}\,#3}
\renewcommand{\wr}{\,{\sf wr}\,}
\newcommand{\hol}{{\sf Hol}\,}

\newcommand{\dih}[1]{{\sf D}_{#1}}

\newcommand{\aut}[1]{{\sf Aut}\,{#1}}
\newcommand{\out}[1]{{\sf Out}(#1)}
\newcommand{\inn}[1]{{\sf Inn}\,#1}

\newcommand{\cent}[2]{{\mathbb C}_{#1}(#2)}
\newcommand{\norm}[2]{{\mathbb N}_{#1}\left(#2\right)}
\newcommand{\normplus}[1]{{\mathbb N}^+(#1)}
\newcommand{\stab}[2]{{\sf Stab}_{#1}(#2)}


\newcommand{\psl}[2]{\mbox{\sf PSL}_{#1}(#2)}
\newcommand{\pgl}[2]{\mbox{\sf PGL}_{#1}(#2)}
\renewcommand{\sp}[2]{\mbox{\sf Sp}_{#1}(#2)}
\newcommand{\gl}[2]{\mbox{\sf GL}_{#1}(#2)}
\newcommand{\sz}[1]{\mbox{\sf Sz}(#1)}
\newcommand{\func}[2]{\mbox{\sf Func}({#1},#2)}


\newcommand{\F}{\mathbb F}
\newcommand{\Z}{\mathbb Z}
\newcommand{\f}{\mathcal F}

\newcommand{\Ga}{\Gamma}
\newcommand{\maxsoc}{{\sf MaxSoc}}

\renewcommand{\leq}{\leqslant}
\renewcommand{\geq}{\geqslant}

\newcommand{\calH}{\mathcal H}
\newcommand{\calK}{\mathcal K}
\newcommand{\calT}{\mathcal T}

\renewcommand{\L}{\rm L}
\newcommand{\cvb}{c_V^{(b)}(t)}

\newcommand{\one}{ONE}

\title{Increasing the minimum distance of codes by twisting}
\author{Marzieh Akbari\\
\small Faculty of Mathematics\\[-0.8ex]
\small K. N. Toosi University of Technology\\[-0.8ex]
\small Tehran, Iran\\
\small\tt m.akbari@dena.kntu.ac.ir\\
\and
\hspace{-1cm}Neil I. Gillespie \qquad \hspace{3cm} Cheryl E. Praeger\\
\hspace{0.3cm}\small Institute for Mathematical Research \qquad \hspace{-0.3cm} Centre for the Mathematics of Symmetry and Computation\\[-0.8ex]
\hspace{-1.1cm} \small  School of Mathematics, Howard House \qquad \hspace{0.7cm}Department of Mathematics and Statistics\\[-0.8ex]
\hspace{-0.5cm}\small The University of Bristol \qquad \hspace{2.8cm} The University of Western Australia\\[-0.8ex]
\hspace{-2.6cm}\small Bristol, United Kingdom \qquad \hspace{3.8cm}Western Australia\\
\hspace{-1.7cm}\small\tt neil.gillespie@bristol.ac.uk \qquad
\hspace{1.9cm}cheryl.praeger@uwa.edu.au }

\begin{document}
\maketitle
\begin{center}
\dateline{Jan,8 2016}{July, 28 2018}{TBD}\\
\Copyright{The authors. Released under the CC BY-ND license
(International 4.0).}
\end{center}

%\thanks{
%{\it Key words and phrases: powerline communication, constant
%  composition codes, frequency permutation arrays, permutation codes,
%  twisted permutation codes}}

\begin{abstract}
Twisted permutation codes, introduced recently by the second and
third authors, belong to the family of frequency permutation arrays.
Like some other codes in this family, such as the repetition permutation
codes, they are obtained by a repetition construction applied to a smaller
code (but with a ``twist'' allowed). The minimum distance of a twisted permutation code is
known to be at least the minimum distance of a corresponding repetition
permutation code, but in some instances can be larger. We
construct two new infinite families of twisted permutation codes with
minimum distances strictly greater than those for the
corresponding repetition permutation codes. These constructions
are based on two infinite families of finite groups and their representations.
The first is a family of $p$ groups, for an odd prime $p$, while the second family consists of
the $4$-dimensional symplectic groups over a finite field of even order. In the latter construction,
properties of the graph automorphism of these symplectic groups play an important role.\\
\noindent{\bf Mathematics Subject Classifications:
} 11T71, 20G40.
\end{abstract}

\section{Introduction}
\noindent
When considering the delivery of services to customers, the
``last mile'' refers to the often problematic last leg of the
journey.  In the case of infrastructure providers in the telecommunications industry,
the ``last mile'' is the piece of infrastructure connecting the customer to the
main  infrastructure. It has been proposed that this ``last mile''
could involve communication via powerlines as an effective means of
delivering  reliable telecommunications at low cost \cite{han vinck, state of
the art}. Such a solution requires new kinds of encoding techniques for
robust communication of information, and for this purpose
{constant composition codes}, in particular the subclass of
{frequency permutation arrays}, have been suggested
as suitable coding schemes to solve
the narrow band and impulse noise problems associated with
powerline communication \cite{dukes des, dukes dis}.

Frequency permutation arrays (FPA) are also used with
multilevel flash memories. Flash memory is an electronic non-volatile memory that
uses floating-gate cells to store information: namely,
cells are organized into blocks, where each block
has a large number $(\approx 10^5)$ of cells \cite{capp}. Given a
set of $n$ cells with distinct charge levels, the rank of a cell
indicates the relative position of its own charge level, and so the
ranks of the $n$ cells induce a permutation of $\{1, 2, \ldots ,
n\}$. Schwartz et al. \cite{jiang,tamo} studied error-correcting codes
for such permutations under the infinity norm, motivated by a novel
storage scheme for flash memories called rank modulation (which uses these permutations).
%
%The so-called rank modulation scheme uses this permutation to store
%information.
%
As for other applications of flash memory: Shieh and Tasi applied FPAs
to provide multilevel flash memory with error correcting
capabilities, and because of their efficient encoding and decoding
algorithms, FPAs can be used in flash memory systems to represent
information and correct errors caused by charge level fluctuation
\cite{shieh}.

Our aim is to  exploit an idea introduced in \cite{twisted} to
construct two new  infinite families of FPAs with better
error-correcting properties than those
obtained by using a standard construction.  Most of the examples
given in \cite{twisted} are related to specific 2-transitive
permutation groups, and our motivation was to show that
the technique could be successful in a broader setting.
We now introduce the concepts.

A \emph{constant composition code} of length $m$ over
an alphabet $Q$ of size $q$ is a subset of $Q^m$ such that
there are positive integers $p_1, \dots, p_q$  with $\sum{p_i}=m$
and in each codeword  the $i^{th}$ letter of $Q$ occurs $p_i$ times.
If the constants $p_i$ are all equal, hence equal to $p=m/q$, such a code is
called a \emph {frequency permutation array} (FPA).  FPAs have
been studied, for example, in \cite{dukes des, huc
des, huc mullen}. They also play an important role in the study of \emph{neighbour transitive codes}, introduced by
the second and third authors \cite{ntrans}. In particular they arise naturally in certain classifications of these codes \cite{diagntrans,asntrans}. In the even more special case
of FPAs with $m=q$,  each
codeword is a permutation on $m$ letters; such an FPA is called an \emph{$(m, d)$
permutation array}, usually denoted by $PA(m, d)$, if the Hamming
distance between any two distinct permutations in the set is at
least $d$.

The codes we study are called \emph{twisted permutation codes}. They are
FPAs with potentially good error-correcting properties (see
\cite{twisted}). The construction method is based on using groups and their
representations,  and is a
generalisation of the construction of repetition permutation codes. In \cite{twisted}, the
second and third authors, with Spiga,  proved that the error-correcting capability of a
twisted permutation code is at least as good as that of a
corresponding repetition permutation code for the group, and
gave examples for which it was better (see \cite[Table 1]{twisted}).
%
In this paper, we give two new infinite families of twisted permutation
codes with improved error correcting capability.
We hope that the ideas behind these constructions might suggest
further new constructions with equal or better improvements.
\emph{We would be interested to know how much improvement in error correction is
possible:  can this be quantified?}

For a finite group $T$, a homomorphism
$\rho:T\rightarrow \Sym(\Omega)$ from $T$ into the symmetric group
of all permutations of a set $\Omega$ is called a
\emph{permutation representation} of $T$ on $\Omega$. Our construction
involves typically several different permutation representations of $T$ on
the same set. One way in which such multiple permutation representations
arise is by composing a given permutation representation $\rho$ with an
automorphism $\varphi$ of $T$, since the map $\varphi\circ \rho$ (where we
apply $\varphi$ first and then $\rho$)  is again a homomorphism
from $T$ to $\Sym(\Omega)$.  See Section 2 for a discussion of the relevant concepts.

Let $T$ be an abstract group, let $\mathcal{I}$ be an ordered
$r$-tuple of permutation representations of $T$ on the set $\{1,
\ldots , q\}$ (with repeats allowed), and let $\rho$ be (any) one
of these representations. In Section \ref{construction} we define
the twisted permutation code $C(T,\mathcal{I})$. A special case,
the repetition permutation code,  is  $C(T,\rho^r)$ for the
constant $r$-tuple $\rho^r=(\rho,\dots,\rho)$. Twisted
permutation codes are frequency permutation arrays of length $rq$
over the alphabet $\{1, \ldots, q\}$ with each letter occurring
$r$ times in each codeword. Let $\delta_{tw}$ denote the minimum
distance of $C(T,\mathcal{I})$, and let $\delta_{rep}$ be the
minimum of the minimum distance of $C(T,\rho^r)$, over all
$\rho$. We prove the following (noting that $|T|=p^{k+1}$ if
$T=G_k$, and $|\Sp(4,2^n)| =2^{4n}(2^{4n}-1)(2^{2n}-1)$).
\begin{theorem}\label{main thm}
The twisted permutation codes described in Table~$\ref{T}$ have
size $|T|$ and
minimum distance $\delta_{tw}$ strictly greater than
$\delta_{rep}$.
\end{theorem}

\begin{table}[h]
\centering
\begin{tabular}{c|c|c|c|c|c}
\hline
$T$ & $r$ & $q$ (permutation degree)  & $\delta_{tw}$ & $\delta_{tw}-\delta_{\rep}$ & Ref. \\
\hline
${G_k}$ & $p$ & $p^k$ & $p^{k+1}-p$ & $p^2-p$ & Sec. \ref{sec affine} (Prop. \ref{T affine})\\
$\Sp(4, 2^n)$ & $2$ & $2^{3n}+2^{2n}+2^n+1$ &
$2^{3n+1}+2^{2n
}$ & $2^{2n}$ & Sec. \ref{sec symplectic} (Prop. 4.6)\\
\hline
\end{tabular}\\[0.2cm]
\caption{Twisted Permutation Codes with
$\delta_{tw}>
\delta_{\rep}$.}\label{T}
\end{table}
\section{Definitions and Preliminaries}

\subsection{Codes in Hamming Graphs.} For positive integers
$m, q$, each at least $2$, the Hamming graph $\Gamma=H(m, q)$
is the graph whose vertex set $V(\Gamma)$ is the set of
$m$-tuples with entries from an alphabet $Q$ of size
$q$, such that two vertices form an edge if and only if
they differ in precisely one entry.
A code $C$ of length $m$ over $Q$ is a subset of $V(\Gamma)$.

The automorphism group of $\Gamma$, which we denote by
$\Aut(\Gamma)$, is the semi-direct product $B\rtimes L$ where
$B\cong S_q^m$ and $L\cong S_m$, see \cite[Theorem
9.2.1]{brouwer}. Its action is described as follows:
for $g=(g_1,\ldots, g_m)\in B$, $\sigma\in L$
and $\alpha=(\alpha_1,\ldots,\alpha_m)\in V(\Gamma)$,
\begin{align*}
\alpha^g=(\alpha_1^{g_1}, \ldots, \alpha_m^{g_m}), \ \ \
\alpha^\sigma=(\alpha_{1^{\sigma^{-1}}}, \ldots,
\alpha_{m^{\sigma^{-1}}}).
\end{align*}
For all pairs of vertices $\alpha,\beta\in V(\Gamma)$, the \emph{Hamming
  distance} between $\alpha$ and $\beta$, denoted by
$d(\alpha,\beta)$, is defined to be the number of entries in
which the two vertices differ. It is the distance between
$\alpha$ and $\beta$ in $\Gamma$, and so we usually refer
simply to distance, rather than Hamming distance.
%Let $\Gamma_k(\alpha)$ denote
%the set of vertices in $\Gamma$ that are at distance $k$ from
%$\alpha$.
%
The \emph{minimum distance, $\delta(C)$,} defined only for codes $C$
with at least two codewords, is the
smallest distance between distinct codewords of $C$, that is,
$$
\delta(C):={\rm min}\{d(\alpha, \beta) | \alpha, \beta\in C, \alpha\neq\beta\}.
$$
%If $C$ consists of exactly one codeword, then we set
%$\delta(C)=0$.
%
A code $C$ is called \emph{distance invariant} if, for all positive integers $i$,
the number of codewords at distance $i$ from a codeword $\alpha\in C$
is independent of the choice of $\alpha$.

\subsection{Permutation Groups} Let $\Omega$ be an arbitrary non-empty set.
We denote by $\Sym(\Omega)$ the group of all permutations of
$\Omega$, called the symmetric group on $\Omega$.  A
\emph{permutation group} on $\Omega$ is a subgroup of
$\Sym(\Omega)$. For $t\in\Sym(\Omega)$ and $\alpha\in\Omega$,
we denote by $\alpha^t$ the image of $\alpha$ under $t$.
Suppose that $G$ is a permutation group on $\Omega$
and $t\in G$. We define the \emph{support of $t$} by
$$
\supp(t)=\{\alpha\in\Omega\,:\,\alpha^t\neq\alpha\},
$$
and the set of \emph{fixed points of $t$} by
$$
\fix(t)=\{\alpha\in\Omega\,:\,\alpha^t=\alpha\}.
$$
Then $\Omega=\supp(t)\cup\fix(t)$ for all $t\in G$.
For a group $G$ of order at least $2$, the minimum value $\min\{|\supp(t)|\,:\,1\neq t\in
G\}$ is called the \emph{minimal degree} of $G$.

Let $G_1$ and $G_2$ be two groups acting on the sets $\Omega_1$
and $\Omega_2$, respectively. Then the two actions are said to be
\emph{permutationally isomorphic} if there exists a bijection
$\lambda: \Omega_1 \rightarrow\Omega_2$ and an isomorphism
$\varphi: G_1 \rightarrow G_2$ such that
\begin{equation}
\lambda(\alpha^g)=\lambda(\alpha)^{g^\varphi} \ \ \textnormal{for
all $\alpha\in\Omega_1$ and $g\in G_1$}.
\end{equation}
The pair $(\lambda, \varphi)$ is called a \emph{permutational
isomorphism}.
%%%%%%%%%%%%%%%%%%
\subsection{Construction}\label{construction}
Let $Q=\{1,\ldots,q\}$ and $H(q,q)$ be the Hamming graph of
length $q$ over $Q$. Let $T$ be an abstract group, and let
$\rho:T\longrightarrow S_q$ be a (permutation) representation of
$T$ on $Q$ given by $t\mapsto \rho(t)$. For $t\in T$, we identify
the permutation $\rho(t)$ with the vertex in $H(q,q)$ that
represents its passive form, that is,
$\alpha(t,\rho)=(1^{\rho(t)},\ldots,q^{\rho(t)})\in H(q,q)$. We define
\begin{equation}\label{1code}
C(T,\rho):=\{\alpha(t,\rho)\,:\,t\in T\}
\end{equation}
as a code in $H(q,q)$. Then $C(T,\rho)$ is a $(q,d)$-permutation array,
where $d$ is the minimal degree of $\rho(T)$:

\begin{lemma}\cite[Lemma 3.2]{twisted}\label{2.1lem}
For $t\in T$, the distance $d(\alpha(1_T, \rho), \alpha(t,
\rho))=|\supp(\rho(t))|$, and  $C(T, \rho)$ has minimum
distance $\delta(C(T,\rho))$ equal to the minimal degree
$\min\{|\supp(\rho(t))|\,:\,1\neq t\in
T\}$ of $\rho(T)$.
\end{lemma}

Now we consider a general construction. Let
$\mathcal{I}=(\rho_1,\ldots,\rho_r)$ be an ordered list of
representations from $T$ to $S_q$ (with repetitions allowed) and define
$$
\alpha(t,\mathcal{I}):=(\alpha(t,\rho_1),\ldots,\alpha(t,\rho_r))\in
H(rq,q),
$$
an $r$-tuple of codewords of the form given
in (\ref{1code}).  Set
$$
C(T,\mathcal{I}):=\{\alpha(t,\mathcal{I})\,:\,t\in T\}.
$$
Then $C(T,\mathcal{I})$ is a code in $H(rq,q)$, and is called a
\emph{twisted permutation code}. In particular, if $r=1$
then  $C(T,\mathcal{I})$ is the permutation code  $C(T,\rho_1)$ given in
(\ref{1code}), and if $\rho_1=\cdots=\rho_r$ then
$C(T,\mathcal{I}) = C(T,\rho_1^r)$ is called the \emph{$r$-fold repetition
permutation code} for $T\rho_1$.

\begin{proposition}\label{lower bound}\cite[Proposition 3.3 and equation (3.2)]{twisted}
With the notation as above, consider the code $C=C(T,\mathcal{I})$.
Then,
\begin{itemize}
\item[(i)] $\Aut(C)$ has a subgroup acting regularly on $C$; in particular,
$C$ is distance invariant;
\item[(ii)] $|C|=|T/K|$, where $K=\cap_{\rho\in\mathcal{I}}\ker\rho$;
\item[(iii)] $\delta(C)=\min_{t\in T^\#}\{\sum_{\rho\in\mathcal{I}}|\supp(\rho(t))|\}
\geq \min_{\rho\in\mathcal{I}}\{\delta(C(T,\rho^r)\}$,
where $T^\#=T\backslash \{1\}$. In particular, for $\rho\in\mathcal{I}$,
$\delta(C(T,\rho^r)=rd$, where $d$ is the minimal degree of $\rho(T)$.
\end{itemize}
\end{proposition}

The lower bound for $\delta(C(T,\mathcal{I}))$ given in Proposition~\ref{lower bound}~(iii)
is the bound we wish to improve on!

\section{The affine group}\label{sec affine}

In this section we use affine groups to construct a family of twisted permutation
codes with minimum distance greater than the
lower bound of Proposition \ref{lower bound}. Let $k$ be an
integer and $p$ an odd prime such that $p>k\geq 2$, and let $V=\mathbb{F}_p^k$ be
the  vector space of $k$-dimensional row vectors over the finite field
$\mathbb{F}_p$, and let $e_i$ denote the $i$th standard basis (row) vector of $V$,
for $i=1,\dots,k$.

\subsection{The matrix group $\overline{G}_k$ and the affine group $G_k$}   We define a subgroup $\overline{G}_k$ of $\GL(k+1,p)$
which turns out to be isomorphic to a subgroup $G_k$ of order $p^{k+1}$ of the affine group $\AGL(k,p)$
(Lemmas~\ref{lem:ogk}(d) and~\ref{iso}).
The representation in terms of $(k+1)\times(k+1)$ matrices is computationally convenient.
We define a matrix $B_k:=I_k+A_k\in\GL(k,p)$ where $I_k$ is the $k\times k$ identity matrix and, writing $X^T$ for the transpose of a matrix $X$,  $A_k$ is given by
\begin{equation}\label{eq:ak}
A_k = \left(
\begin{array}{ccc}
{\bf{0}}\\
e_1\\
\vdots\\
e_{k-1}
\end{array}\right)=\left(
\begin{array}{cccc}
e_2^T&\ldots&e_k^T&{\bf{0}}
\end{array}\right).
\end{equation}
%
Thus $B_k$ is a lower unitriangular matrix, and in particular $B_k$ is nonsingular.
We write $B_k^i = (B_k)^i$ for any integer $i$, so in particular $B_k^0 = I_k$.
For ${\bf v}\in V$ and $i\geq1$, we set
\begin{equation}\label{gvi}
g_{{\bf v}, i} =
\left(
\begin{array}{cc}
1& {\bf v}\\
{\bf 0}& B_{k}^i\\
\end{array}
\right)
\end{equation}
and we define $\overline{G}_k$ as the subset
\begin{equation}\label{eee111}
\overline{G}_k:= \{ g_{{\n}, i} :\ {\n}\in V, \ 0\leq i\leq p-1 \}
\end{equation}
of $\GL(k+1,p)$. We prove in Lemma~\ref{lem:ogk}
that $\overline{G}_k$ is a group with the operation of matrix multiplication.
For a vector $\n\in V$, we denote by $\varphi_{\n}$ the translation by $\n$, and
for a matrix $B\in\GL(k,p)$ we denote by $\Phi_B$ the linear transformation
$V\to V$ given by $\n \mapsto \n B$.
Then we define the subset
\begin{equation}\label{eq:gk}
G_k:=\{ \varphi_{\n}\Phi_{B_k^i} :  \ {\n}\in V,  \  i\geq 1\}
\end{equation}
of the affine group $\AGL(k,p)$. We prove in Lemma~\ref{lem:ogk}
that $G_k$ is a subgroup of  $\AGL(k,p)$, and in Lemma~\ref{iso} that $G_k$ is isomorphic to $\overline{G}_k$.
As preparation  we define $\Omega(k,0):= {\bf 0}_k$,
$\Omega(k,1):= I_k$ and, for
$i\geq 2$, we set $\Omega(k,i):= I+B_k+B_k^2+\cdots
+B_k^{i-1}$.


%
%\left\langle   \Big\langle
%
%

\begin{lemma}\label{lem:bk}
For $2\leq k<p$ and any positive integer $i$, we have
\begin{equation}\label{e0}
B_k^i=\left(
\begin{array}{ccccc}
1&0&0&\cdots &0\\
i&1&0&\cdots &0\\
\binom{i}{2}&i&1&\cdots &0\\
 \vdots&\vdots&\vdots&\ddots&\vdots\\
 \binom{i}{k-1}&\binom{i}{k-2}&\binom{i}{k-3}&\cdots &1\\
\end{array}
\right)
\quad \mbox{and}\quad
\Omega(k,i)=\left(
\begin{array}{ccccc}
i&0&0&\cdots &0\\
 \binom{i}{2}&i&0&\cdots &0\\
 \binom{i}{3}&\binom{i}{2}&i&\cdots &0\\
 \vdots&\vdots&\vdots&\ddots&\vdots\\
 \binom{i}{k}&\binom{i}{k-1}&\binom{i}{k-2}&\cdots &i\\
\end{array}
\right)
\end{equation}
where for $1\leq j\leq k-1$, the matrix entry ${i}\choose{j}$  denotes
$\underbrace{1+\ldots+1}_{{i}\choose{j}}$ in $\F_p$. In particular,
$B_k^p=I_k$, $B_k$ has multiplicative order $p$, and $\Omega(k,p)={\bf{0}_k}$.
\end{lemma}

\begin{proof}
First we deal with $B_k^i$. Multiplying together the two expressions for $A_k$ in \eqref{eq:ak} we find that
\[
A_k^2 = \left(
\begin{array}{ccccc}
e_3^T&\ldots&e_k^T&{\bf{0}}&{\bf{0}}
\end{array}\right).
\]
Then observe that, by induction, for $1\leq s\leq k-1$,
\[
A_k^s=\left(
\begin{array}{cccccc}
e_{s+1}^T&\ldots&e_k^T&{\bf{0}}&\ldots&{\bf{0}}
\end{array}\right)=\left(
\begin{array}{cc}
{\bf 0}& {\bf 0}\\
I_{k-s}&{\bf 0}\\
\end{array}
\right).
\]
Thus $A_k^k={\bf{0}}$. Now for any positive integer $i$ we evaluate
$$
B_k^i=(I_k+A_k)^i=I_k+{{i}\choose{1}}A_k+{{i}\choose{2}}A_k^2+\ldots+{{i}\choose{i-1}}A_k^{i-1}+A_k^i.
$$
Using the expression for $A_k^s$ above and the fact that $A_k^k={\bf{0}}$, we obtain the expression for $B_k^i$ in the statement. Since $k<p$, it follows
that $B_k^p=I_k$. Since $B_k\ne I_k$ it follows that $B_k$ has multiplicative order $p$.

Now we consider $\Omega(k,i)$. We will use  the following binomial identity (see, for example,
\cite[(4.3.9)]{bru}\footnote{It is sometimes called the Hockey-stick identity, see
{https://en.wikipedia.org/wiki/Hockey-stick\_identity}}): for $0\leq\ell\leq i-1$,
$$
\sum_{j=0}^{i-1}{{j}\choose{\ell}}=\sum_{j=\ell}^{i-1}{{j}\choose{\ell}}={{i}\choose{\ell+1}}.
$$
Using this, and Lemma \ref{lem:bk}, it follows that  the $(s,t)$ entry of $\Omega(k,i)$, $a_{s,t}$, satisfies
\[
a_{s,t}=\begin{cases}
0&\textnormal{if $t>s$}\\
\sum_{j=0}^{i-1}{{j}\choose{s-t}}={{i}\choose{s-t+1}}&\textnormal{if $t\leq s$,}\\
\end{cases}
\]
giving us the required expression for $\Omega(k,i)$. Since $k<p$, we deduce that $\Omega(k,p)={\bf{0}}$.
\end{proof}

\begin{lemma}\label{lem:ogk}
Let $2\leq k< p$ and,  for $\n\in V$ and $i\geq0$, let $g_{\n,i},  \varphi_{\n}\Phi_{B_k^i}$ and $\Omega(k,i)$ be as above. Let $\n, {\bf w}\in V$ and $i,j\geq 0$. Then
\begin{enumerate}
\item[(a)]    $i\equiv j\pmod{p}$  $\iff$   $g_{\n,i} = g_{{\bf v},j}$   $\iff$  $\Phi_{B_k^i} =  \Phi_{B_k^j}$   $\iff$   $\Omega(k,i) = \Omega(k,j)$;
\item[(b)] $\left(\n = {\bf w}\  \mbox{and}\ i\equiv j\pmod{p}\right)$  $\iff$ $g_{\n,i} = g_{{\bf w},j}$  $\iff$  $\varphi_{\n}\Phi_{B_k^i} =  \varphi_{\bf w}\Phi_{B_k^j}$;

\item[(c)] $g_{\n,i}g_{{\bf w},j} = g_{\n B_k^j+{\bf w}, i+j}$; $\varphi_{\n}\Phi_{B_k^i} \circ  \varphi_{\bf w}\Phi_{B_k^j} =  \varphi_{\n + {\bf w}B_k^{-i}}\Phi_{B_k^{i+j}}$; and $\Omega(k,i+j)=\Omega(k,i)+B_k^i\Omega(k,j)$;

\item[(d)]  both $\overline{G}_k$ and $G_k$ are groups of order $p^{k+1}$.
\end{enumerate}
\end{lemma}

\begin{proof}
First we deal with all assertions about $\Omega(k,i)$. The equality $\Omega(k,i) = \Omega(k,j)$ holds by Lemma~\ref{lem:bk}
if and only if  $i\equiv j\pmod{p}$, as required for part (a). The assertion in (c)
follows from the definition, namely that  $\Omega(k,0):= {\bf 0}_k$,
$\Omega(k,1):= I_k$, and for $i\geq2$,  $\Omega(k,i):= I+B_k+B_k^2+\cdots
+B_k^{i-1}$.

The remaining assertions of part (a) follow from part (b), which we now proceed to prove.
It follows from \eqref{gvi} that  $g_{\n,i} = g_{{\bf v},j}$ if and only if $\n = {\bf w}$ and $B_k^i=B_k^j$,
and the latter equality holds if and only if  $i\equiv j\pmod{p}$  by Lemma~\ref{lem:bk}.
Now we consider the affine maps. If  $\n = {\bf w}\  \mbox{and}\ i\equiv j\pmod{p}$ then
 $B_k^i=B_k^j$   by Lemma~\ref{lem:bk}, so $\varphi_{\n}\Phi_{B_k^i} =  \varphi_{\bf w}\Phi_{B_k^j}$.
 Suppose conversely that $\varphi_{\n}\Phi_{B_k^i} =  \varphi_{\bf w}\Phi_{B_k^j} = \psi$, say. Then,
 for all ${\bf x}\in V$, ${\bf x}\psi = ({\bf x} + \n)B_k^i = ({\bf x}+{\bf w})B_k^j$.
 Taking ${\bf x} = {\bf 0}$ this implies that $\n B_k^i = {\bf w}B_k^j$, and so, for all
 ${\bf x}$,  ${\bf x} B_k^i = {\bf x}B_k^j$. This, in turn, implies that $B_k^i=B_k^j$ and hence,
  by Lemma~\ref{lem:bk}, that  $i\equiv j\pmod{p}$. Since $B_k^i$ is invertible,
   $\n B_k^i = {\bf w}B_k^j$ now implies that $\n = {\bf w}$. Thus (b), and hence also (a), are proved.

Now we prove part (c).  The equality  $g_{\n,i}g_{{\bf w},j} = g_{\n B_k^j+{\bf w}, i+j}$ follows
from matrix multiplication using \eqref{gvi}.  Let $\psi = \varphi_{\n}\Phi_{B_k^i} \circ  \varphi_{\bf w}\Phi_{B_k^j}$.
Then, for ${\bf x}\in V$, ${\bf x}\psi = ( ({\bf x} + \n)B_k^i + {\bf w})B_k^j =
 ( {\bf x} +  \n + {\bf w}B_k^{-i} ) B_k^{i+j}$, and hence
$\psi =  \varphi_{\n + {\bf w}B_k^{-i}}\Phi_{B_k^{i+j}}$. Thus part (c) is proved.

It follows from parts (a) and (c) that  $\overline{G}_k$ and $G_k$ are closed under the relevant
multiplication, and hence both are groups. The groups have order $p^{k+1}$, by part (b).
\end{proof}


Now we study several maps from $G_k$ to $\overline{G}_k$,
all of which turn out to be isomorphisms.


\begin{lemma}\label{iso}
For each ${\bf w}\in V$, the map $\tau_{\bf w}: G_k\rightarrow \overline{G}_k$ defined by
\[
\tau_{\bf w}:
\varphi_{\n}\Phi_{B_k^i}\longmapsto g_{\n B_k^i + {\bf w}\Omega(k,i),i}\quad \mbox{for each $\n\in V$ and for $0\leq i\leq p-1$, }
\]
is an isomorphism.
\end{lemma}

\begin{proof}
Since $B_k$ is invertible, it follows from Lemma~\ref{lem:ogk}~(b) that
$\tau_{\bf w}$ is injective, and then the fact that $\tau_{\bf w}$ is a bijection follows from Lemma~\ref{lem:ogk}~(d).
It remains to prove that $\tau_{\bf w}$ is a homomorphism, and for this we use all of the equalities in Lemma~\ref{lem:ogk}(c): for each $\n_1,\n_2\in V$ and for each $i,j$,
$$
\begin{array}{lll} \tau_{\bf w}(\varphi_{\n_1}\Phi_{B_k^i})\tau_{\bf w}(\varphi_{\n_2}\Phi_{B_k^j})&=&
    g_{\n_1B_k^i + {\bf w}\Omega(k,i),i}\cdot  g_{\n_2B_k^j + {\bf w}\Omega(k,j), j}\\[0.2cm]
&=&  g_{(\n_1B_k^i + {\bf w}\Omega(k,i))B_k^j + \n_2B_k^j + {\bf w}\Omega(k,j), i+j} \\[0.2cm]
&=&  g_{(\n_1 + \n_2B_k^{-i})B_k^{i+j}  + {\bf w}\Omega(k,i+j) , i+j}\\[0.2cm]
&=& \tau_{\bf w}(\varphi_{\n_1+\n_2B_k^{-i}} \Phi_{B_k^{i+j}})\\[0.2cm]
&=& \tau_{\bf w}(\varphi_{\n_1}\Phi_{B_k^i}\cdot\varphi_{\n_2}\Phi_{B_k^j}).
\end{array}
$$
\end{proof}

\subsection{Viewing $\overline{G}_k$ as a permutation group}\label{sub:permgp}
In the usual action of $\overline{G}_k$ on the row space $\mathbb{F}_p^{k+1}$
we show that $\overline{G}_k$ is faithful and transitive on the subset
$\Omega :=\{(1, \n) | \n\in V\}$ of $\mathbb{F}_p^{k+1}$, and we will regard $\overline{G}_k$
as a permutation group on $\Omega$.

\begin{lemma}\label{L4}
Let $2\leq k < p$, let $\Omega=\{(1, \n) | \n\in V=\mathbb{F}_p^k\}$, and let
$\overline{G}_k$ be as in \eqref{eee111}.
\begin{enumerate}
\item[(a)] Then $\Omega$ is  $\overline{G}_k$-invariant, and $\overline{G}_k$ is faithful and transitive on $\Omega$.
\item[(b)] For $\n=(v_1, v_2, \ldots, v_k)\in V$ and $0\leq i\leq p-1$,
    \begin{enumerate}
    \item[(i)] $g_{\n,i}$ fixes $p$ points of $\Omega$  $\Longleftrightarrow$ $1\leq i\leq p-1\,$ and
$v_k=0$;
    \item[(ii)] $g_{\n,i}$fixes no points of $\Omega$  $\Longleftrightarrow$ either $1\leq i\leq p-1\,$ and $v_k\neq 0$, or
    $i=0\,$ and $\n\ne{\bf 0}$.
    \item[(iii)] $g_{\n,i}$ fixes all $p^k$ points of $\Omega$  $\Longleftrightarrow$  $i=0\,$ and $\n={\bf 0}$.
        \end{enumerate}
\end{enumerate}
\end{lemma}

\begin{proof}
Consider $g_{\n,i}\in \overline{G}_k$, where $\n=(v_1,
v_2, \ldots, v_k)$ and $0\leq i\leq p-1$, and $(1, {\bf x})\in\Omega$, where ${\bf x}=(x_1,
x_2, \ldots, x_k)$. Then by Lemma~\ref{lem:bk} and some easy
calculations,
\[
\begin{array}{lll}
(1,{\bf x})g_{\n,i} & = &
(1, x_1, x_2, \ldots, x_k)\left(
\begin{array}{ccccc}
1&v_1&v_2&\cdots &v_k\\
0&1&0&\cdots &0\\
0&i&1&\cdots &0\\
 \vdots&\vdots&\vdots&\ddots&\vdots\\
0&\binom{i}{k-1}&\binom{i}{k-2}&\cdots &1\\
\end{array}
\right)\\[1.5 cm] &=&
\left(1, v_1+\sum\limits_{t=0}^{k-1}\binom{i}{t}x_{t+1},
v_2+\sum\limits_{t=0}^{k-2}\binom{i}{t}x_{t+2}, \ldots, v_k+x_k\right) \in\Omega.
\end{array}
\]
Thus $\Omega$ is invariant under the action of $\overline{G}_k$.
In particular, taking ${\bf x}={\bf 0}$, we see that
$(1,{\bf 0})g_{\n,i}$ is equal to
$(1,v_1, v_2, \ldots, v_k) = (1,\n)$. Letting $\n$ vary through $V$ this shows that
$\overline{G}_k$ is transitive on $\Omega$. Also,
it shows that the only group elements fixing $(1,{\bf 0})$ are those of the form
$g_{{\bf 0},i}$. Finally, taking ${\bf x}=(0,\dots,0,1)$, we find that
the only value of $i$ such that $g_{{\bf 0},i}$ fixes $(1,{\bf x})$ is
$i=0$. Thus $\overline{G}_k$ is faithful on $\Omega$, proving part (a)
and also part (b)(iii).

Suppose in the above display that $g_{\n,i}\ne g_{{\bf 0},0}$ and that  $(1, {\bf x})g_{\n,i} = (1,{\bf x})$.
Comparing the entries in both sides of the equation, we see that

\begin{equation}\label{eq:first}
x_j = v_j + \sum\limits_{t=0}^{k-j}\binom{i}{t} x_{t+j}.  \ \ \
\textnormal{ for $j=1,\ldots,k$.}
\end{equation}
%
In particular, \eqref{eq:first} with $j=k$ implies that $v_k=0$.
If $i=0$ then  \eqref{eq:first} implies that
$x_j=v_j+x_j$ for all $j$, so $\n={\bf 0}$. Thus, $g_{\n,i}=
g_{{\bf 0},0}$, which is a contradiction.
Hence, if  $g_{\n,i}\ne g_{{\bf 0},0}$  and  $g_{\n,i}$  fixes a point of $\Omega$, then $1\leq i\leq p-1$
and $v_k=0$.

Conversely suppose that  $1\leq i\leq p-1$
and $v_k=0$. Then $(1,{\bf x})$ is fixed by $g_{\n,i}$ if and only if
the equations \eqref{eq:first} hold. Now there exists $i'$ such that $1\leq i'\leq p-1$ and $ii'\equiv 1\pmod{p}$.
We solve the equations  \eqref{eq:first} for $j=k, k-1, \dots, 1$ to determine  recursively $x_{k-1},\dots,x_2$.
The equation with $j=k$ yields the tautology $x_k=x_k$, while the equation for $j=k-1$ implies $0=v_{k-1} + ix_{k}$, that is, $x_k = -i'v_{k-1}$.
Continuing to solve the equations for $j=k-2, \dots,1$ yields
\begin{equation}\label{eq:second}
x_{j+1}=\begin{cases}-i'\,v_{k-1}   &\textnormal{ if $j=k-1$}\\
-i'\big(v_j+\sum\limits_{t=2}^{k-j}\binom{i}{t}x_{t+j}\big) &\textnormal{
if $j=1,\ldots,k-2$.}
\end{cases}
\end{equation}
Thus $x_2, \ldots, x_k$ are
determined by ${\n}=(v_1, v_2, \ldots, v_k)$, while $x_1$ is unrestricted;
so $g_{\n,i}$ fixes exactly $p$ points of $\Omega$, namely
$(1,\  a, \ x_2, \ \ldots, \ x_k )$ for $a\in
\mathbb{F}_p$.
This completes the proof of part (b).
\end{proof}

\subsection{Multiple permutation representations of $G_k$ on $\Omega$}
Now that we regard $\overline{G}_k$ as a permutation group on $\Omega$ (as
described in Subsection~\ref{sub:permgp}), we may view the $\tau_{\bf w}$
in Lemma~\ref{iso} as faithful permutation representations of $G_k$ into
${\rm Sym}(\Omega)$. We study $p$ of these permutation representations,
and from them build a family of twisted permutation codes.


\begin{lemma}\label{fixpoint}
For  $r\in \mathbb{F}_p$, let  ${\bf w}_r:=(0, 0, \ldots, 0, r)\in V$, and
 $\rho_r := \tau_{{\bf w}_r}$, as defined in Lemma~$\ref{iso}$. Then
 $\rho_r$ is a faithful, transitive permutation representation of $G_k$ on $\Omega$.
Further let $\n\in V$ and let $i$ be an integer such that $0\leq i\leq p-1$,
and $(\n,i)\ne ({\bf 0}, 0)$.
\begin{enumerate}
\item[(i)] If $i=0$ then,  for each $r\in \mathbb{F}_p$, $\rho_r(\varphi_{\n}\Phi_{B_k^i})$ has no fixed points in $\Omega$.
\item[(ii)] If $i\ne 0$, then there exists a unique $r\in \mathbb{F}_p$
such that $\rho_r(\varphi_{\n}\Phi_{B_k^i})$ fixes $p$ points of $\Omega$,
and for each $s\ne r$,
$\rho_s(\varphi_{\n}\Phi_{B_k^i})$ has no fixed points in $\Omega$.
\end{enumerate}
\end{lemma}

\begin{proof}
Since   $\rho_r := \tau_{{\bf w}_r}$ is a homomorphism,
and since we regard $\overline{G}_k$ as a permutation group of $\Omega$,
it follows that $\rho_r$ is a permutation representation of $G_k$ on $\Omega$.
 It is faithful and transitive, by Lemmas~\ref{iso} and~\ref{L4}.

From the definition in Lemma~\ref{iso}, $\rho_r(\varphi_{\n}\Phi_{B_k^i})
= g_{\n',i}$, where $\n'=\n B_k^i + {\bf w_r}\Omega(k,i)$.
Suppose first that $i=0$.  Then $\n\ne {\bf 0}$, by assumption, and
$\Omega(k,i)={\bf 0}_k$ by Lemmas~\ref{lem:bk} and~\ref{lem:ogk}(a).
As $B_k$ is invertible, it follows that $\n'\ne {\bf 0}$, and hence, by Lemma~\ref{L4} that
$\rho_r(\varphi_{\n}\Phi_{B_k^i})$ has no fixed points in $\Omega$, proving (i).

Suppose then that $1\leq i\leq p-1$. Then by
Lemma~\ref{lem:bk}, ${\bf w}_r\Omega(k,i)$ has $k^{th}$ entry $ri$.
As $r$ ranges over $\mathbb{F}_p$, we find exactly one value of $r$ for which
 the  $k^{th}$ entry of $\n'$ is zero, and hence, by  Lemma~\ref{L4},
 for this unique value of $r$, $\rho_r(\varphi_{\n}\Phi_{B_k^i})=g_{\n',i} $ has $p$
 fixed points in $\Omega$, and for all other values, $\rho_r(\varphi_{\n}\Phi_{B_k^i})$
 has no fixed points in $\Omega$.
\end{proof}





Table~\ref{T1} summarises the information about the support sizes of
$\rho_r(\varphi_{\n}\Phi_{B_k^i})$ derived in the proof of
Lemma \ref{fixpoint}.

\begin{table}[h] \centering
\begin{tabular}{|c|c|c|c|}
\hline
$i$ and $r$ & $i=0$, any $r$ &$1\leq i< p,\, ri=-v_k$ &  $1\leq i< p,\, ri\ne -v_k$ \\[0.2cm]
%\hline \hline
$|\supp(\rho_r(\varphi_{\n}\Phi_{B_k^i}))|$& $p^k$  &$p^k-p$ & $p^k$ \\[0.2cm]\hline
%\hline
\end{tabular} \\[0.2cm]
\caption{$|\supp(\rho_r(\varphi_{\n}\Phi_{B_k^i}))|$ for $r\in\mathbb{F}_p, \n\in V,$  $0\leq i<p$,
 with ${\n}B_k^i=(v_1,\ldots , v_k)$ and  $(\n,i)\ne ({\bf 0}, 0)$.}\label{T1}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newpage

\subsection{Twisted permutation codes for $G_k$}
We now define a family of twisted permutation codes using these permutation representations of $G_k$ on $\Omega$.
Let $q=p^k$, and choose an ordering
$({\bf v}_1,{\bf v}_2,\ldots,{\bf v}_q)$ for the $q$ vectors of $V$.
For each  $g_{\n,i}\in \overline{G}_k$, define a vertex
in the Hamming graph of length $q$ over $\Omega$ by writing the passive form for $g_{\n,i}$
\begin{equation}\label{deftauaction}
\alpha_0(g_{\n,i})=((1,{\bf v}_1)g_{\n,i},\ldots,(1,{\bf v}_q)g_{\n,i}),
\end{equation}
that is, the $i$th entry of
$\alpha_0(g_{\n,i})$ is the image of $(1,{\bf v}_i)$ under $g_{\n,i}$.
%
We denote the sequence of permutation representations of $G_k$ in Lemma~$\ref{fixpoint}$ by
$\mathcal{I}:=(\rho_0, \rho_1,\ldots,\rho_{p-1})$.
We associate with $g$ the following vertex of the
Hamming graph of length $qp$ over
$\Omega$:
$$
\alpha(\varphi_{\n}\Phi_{B_k^i},\mathcal{I}) := (\alpha_0(\rho_0(\varphi_{\n}\Phi_{B_k^i})),\alpha_0(\rho_1(\varphi_{\n}\Phi_{B_k^i})),
\ldots,\alpha_0(\rho_{p-1}(\varphi_{\n}\Phi_{B_k^i})))
$$
that is, $\alpha(\varphi_{\n}\Phi_{B_k^i},\mathcal{I})$ is a $p$-tuple of vertices of the form \eqref{deftauaction}.
We define the corresponding twisted permutation code relative to $\mathcal{I}$ as
$$
C(G_k, \mathcal{I})=\{\alpha(g,\mathcal{I}) | g\in G_k\}.
$$
For the untwisted versions we choose any $s\in\mathbb{F}_p$, and we first
define the permutation code as in \eqref{1code}
\[
C(G_k,\rho_s) = \{\alpha(g, \rho_s) | g\in G_k\}, \ \mbox{where}\ \alpha(g, \rho_s)=\alpha_0(\rho_s(g))\ \mbox{for}\ g \in G_k.
\]
As noted in Subsection~\ref{construction} (see Lemma~\ref{2.1lem}),  $C(G_k,\rho_s)$ is a $(q,d)$-permutation array,
where $d$ is the minimal degree of $\rho_s(G_k)=\overline{G}_k$, and  by Lemma~\ref{L4}, $d= q-p=p^k-p$.
 Note also that $C(G_k,\rho_s)$ is independent of the choice of $s$.
 Thus, the $p$-fold repetition permutation code  $C(G_k,\rho_s^p)$ generated by $C(G_k, \rho_s)$ is also
 independent of $s$.

\begin{proposition}\label{T affine}
For $s\in\mathbb{F}_p$ and with the notation above, the codes
$C(G_k,\mathcal{I})$ and $C(G_k,\rho_s^p)$ each have size
$|G_k|=p^{k+1}$, and have minimum distance $p^{k+1}-p$ and $p^{k+1}-p^2$,
respectively. The lower bound
given by Proposition $\ref{lower bound}$ for the minimum distance of
$C(G_k,\mathcal{I})$ is $p^{k+1}-p^2$.
\end{proposition}

We note that $\delta(C(G_k,\mathcal{I}))= p^{k+1}-p$
is strictly greater than the lower bound  $p^{k+1}-p^2$ given by Proposition \ref{lower bound} (iii).


\begin{proof}
Since each $\rho_s$ is faithful, the codes all have size $|G_k|=p^{k+1}$.
As noted above, the minimum distance of
$C(G_k, \rho_s^p)$ is $p^k-p$.
Hence the lower bound on the minimum distance of
$C(G_k,\mathcal{I})$ given by Proposition~\ref{lower bound}(iii),
namely the minimum distance of   $C(G_k,\rho_s^p)$, is $p^{k+1}-p^2$.
On the other hand, by Proposition~\ref{lower bound}(iii), the minimum distance of
$C(G_k,\mathcal{I})$ is the minimum, over all non-identity $g\in G_k$, of
$\sum_{\rho_s\in \mathcal{I}}|\supp(\rho_s(g))|$.
By  Lemma \ref{fixpoint} and Table \ref{T1}, for $g= \varphi_{\n}\Phi_{B_k^i}\in G_k$
with $0\leq i<p$, $\n\in V$ and $(\n,i)\ne({\bf 0}, 0)$,
this sum is $ p^{k+1}-p$ if $i\ne 0$, and $ p^{k+1}$ if $i=0$.
Thus $\delta(C(G_k,\mathcal{I}))= p^{k+1}-p$.
\end{proof}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The symplectic group}\label{sec symplectic}

In this section, we consider the symplectic group $T=\Sp(4, q)$
over a field of order $q=2^n\geq 4$. We exploit the fact that G has
an outer automorphism $\tau$ which does not map transvections to
transvections (see Section~\ref{sub:sp}). We preserve this notation throughout. Set
$\mathcal{I}=\{\iota, \tau\}$ where $\iota$ denotes the identity map. We
show that the twisted permutation code $C(T,\mathcal{I})$ has minimum
distance strictly greater than the lower bound in
Proposition \ref{lower bound}.

\subsection{The group $\Sp(4,q)$}
Let $V=\mathbb{F}^4$, the space of $4$-dimensional row vectors over a field
$\mathbb{F}$ of order $q=2^n$. Then $V$ admits a non-degenerate symplectic form $\beta$ with
isometry group $T=\Sp(4, q)$. Let $e_1, e_2, f_1, f_2$ be a
symplectic basis for $V$ such that $\{e_1, f_1\}$ and $\{e_2, f_2\}$
are hyperbolic pairs, and
\[
V=\langle e_1,f_1\rangle\perp \langle e_2,f_2\rangle,
\]
that is, $\beta(e_i,f_i)=0$ for $i=1,2$, and if $\{i,j\}=\{1,2\}$ then $\beta(e_i,e_j)=\beta(f_i,f_j)=\beta(e_i, f_j)=0$.
Then $M:=\langle e_1, e_2\rangle$ is a maximal totally isotropic
subspace with ${\rm dim}M=2=({\rm dim}V)/2$.
%
We use ``Witt's Lemma'', stated below, versions of which go back to Witt's work in \cite{Chevalley} -- a proof may be found in the book of Artin \cite[p.121]{artin}.

\begin{lemma}\label{Witt} Let $U$ be a subspace of a non-degenerate symplectic space $V$, and let $f:U\rightarrow V$ be a linear isometry.
Then $f$ can be extended to a linear isometry of $V$, that is, there is a linear isometry $h:V\rightarrow V$ such that $f(u)=h(u)$ for all $u\in U$.
\end{lemma}




%\begin{theorem}\label{Witt}
%Suppose that $U$ is a subspace of $V$ and that the map
%$f:U\rightarrow V$ is a linear isometry. Then there is a linear
%isometry $h:V\rightarrow V$ such that $h(u)=f(u)$ for all $u\in
%U$ if and only if $f(U\cap {\rm Rad} \ V)=f(U)\cap {\rm Rad} \ V$.
%\end{theorem}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%*****************************************************************************

\begin{lemma}\label{g conjugate} Let $g\in T=\Sp(4,q)$ such that there are (at least) three $1$-dimensional
subspaces, each fixed setwise by $g$, which span a $3$-dimensional subspace. Then $g$ is conjugate in $T$ to an element whose
matrix, with respect to the ordered basis $(e_1, f_1, e_2,
f_2)$, has the following form, for some $a,b,d\in\F$,
\begin{equation}\label{newg}
\left(
\begin{array}{cccc}
a&0&0&0\\
d&a^{-1}&0&0\\
0&0&b&0\\
0&0&0&b^{-1}\\
\end{array}
\right).
\end{equation}
\end{lemma}

\begin{proof}
By assumption $V$ contains three linearly independent vectors
$v_1, v_2, v_3$ such that $g$ fixes each $\langle v_i\rangle$
setwise, and thus g fixes setwise $W:=\langle v_1, v_2, v_3
\rangle$. Since $W$ is of odd dimension, its radical
$R:=W\cap W^\perp$ (where $W^\perp=\{w\in W\,|\,(w,u)=0\textnormal{ for all $u\in W$}\}$) must be non-zero, and also $R< W$,
because the maximum dimension of the totally isotropic subspaces of
$V$ is equal to 2. Thus $W/R$ is nontrivial and non-degenerate,
and hence $\dim (W/R)=2$ and $\dim R=1$.
Further, since $R\subseteq W^\perp$,
and since $V$ is non-degenerate, we have
$W=R^\perp$. Now there is a linear isometry $R\rightarrow V$
which maps $R$ to $\langle e_1\rangle$, and
by Lemma \ref{Witt} this extends to an element
of $T$ mapping $R$ to $\langle e_1\rangle$. Replacing $g$, if necessary,
by its conjugate under this element, we may assume that
$R=\langle e_1\rangle$ and hence that $W=R^\perp =\langle e_1,e_2, f_2\rangle$.

We claim that the setwise stabiliser ${\rm Stab}_T(W)$
is transitive on the $1$-spaces contained in $W\setminus R$.
To see this, let $w_1$ and $w_2$
be linearly independent vectors in $W\setminus  R$. Then $U_i:=\langle e_1,
w_i\rangle$ is totally isotropic for $i=1, 2$. There is a unique linear map
$f:U_1\rightarrow V$ such that
%\[
$f: e_1 \rightarrow  e_1 ,  \ \   w_1 \rightarrow  w_2,$
%\]
and this map $f$ is a linear isometry, because $U_i$ is totally isotropic for $i=1,2$.
 Therefore, by Lemma~\ref{Witt},
there exists $y$ in $T$ such that
%\[
$y: e_1 \rightarrow e_1 ,  \ \   w_1 \rightarrow w_2.$
%\]
Now $y$ fixes $\langle e_1\rangle$, and hence also $\langle
e_1\rangle^{\perp }=W$, so $y\in {\rm Stab}_T(W)$ and the
claim is established.

In what follows, we may assume without loss that $v_1\in
W\setminus R$. By the previous paragraph, there exists an element
$x\in {\rm Stab}_T(W)$ such that $x$ sends $v_1\rightarrow e_2$
and $e_1\rightarrow e_1$. So $g^x=x^{-1}gx$ fixes $\langle
e_2\rangle$ setwise. Hence $g^x$ fixes $\langle e_1\rangle$,
$\langle e_2\rangle$, and $W$.
Since $g^x$ is a conjugate of our original element $g$,
there exists a vector $w\in W\setminus \langle e_1, e_2\rangle$ such that
$\langle w\rangle$ is fixed by $g^x$. Replacing $w$ by a scalar
multiple if necessary, we may assume that $w=ce_1+de_2+f_2$,
for some $c, d\in\mathbb{F}$.
%Also $\langle w\rangle$
%is fixed by $g^x$, so $g^x: w\rightarrow a' w$ for some nonzero $a'$.
%
Now $W=\langle e_1, e_2, f_2\rangle=\langle e_1, e_2,
w\rangle$ and it is straightforward to check that the map $\phi :W\rightarrow
V$ such that
%\[
$\phi : e_1 \rightarrow  e_1 ,  \ \   e_2 \rightarrow  e_2, \ \
f_2 \rightarrow  w,$
%\]
defines a linear isometry. Hence by Lemma~\ref{Witt}, there exists an
element say $y\in T$ such that
%\[
$y: e_1 \rightarrow  e_1 ,  \ \   e_2 \rightarrow  e_2, \ \ f_2
\rightarrow  w.$
%\]
%
Then $g^{xy^{-1}}=yg^xy^{-1}$ fixes $\langle e_1\rangle$, $\langle
e_2\rangle$, and $\langle f_2\rangle$. Now we replace $g$ by
its conjugate $g^{xy^{-1}}$. Then $g$ fixes $W$,
$\langle e_1\rangle$, $\langle e_2\rangle$, and $\langle
f_2\rangle$, and so, for some $a, b, c'$ and $d_i$,
\[
g: e_1 \rightarrow  ae_1 ,  \ \   e_2 \rightarrow  be_2, \ \ f_2
\rightarrow  c'f_2, \ \ f_1\rightarrow
d_1e_1+d_2f_1+d_3e_2+d_4f_2.
\]
Since $g$ preserves the form and $(e_2, f_2)=1$, $(e_1, f_1)=1$, $(e_2,
f_1)=0$, and $(f_1, f_2)=0$, we obtain $c'=b^{-1}$, $d_2=a^{-1}$,
$d_4=0$, and $d_3=0$. This shows that the matrix for $g$ with
respect to the ordered basis $(e_1, f_1, e_2, f_2)$ is as in \eqref{newg}
with $d=d_1$.
\end{proof}

\subsection{Viewing $\Sp(4,q)$ as a permutation group.}\label{sub:sp}
The group $T=\Sp(4,q)$ has a faithful,
transitive permutation representation on the set
$$
\Omega = {\rm PG}(V)=\{\langle v\rangle \ | \  v\in V \},
$$
of $1$-dimensional subspaces ($1$-spaces) of $V$, and we henceforth regard $T$ as a permutation group of $\Omega$.
For any $g\in \GL(4,q)$, we write the subset of $1$-spaces fixed setwise by $g$ as
$$
{\rm Fix}_{\Omega}(g)=\{\langle v\rangle \ | \ \langle
v\rangle^g=\langle v\rangle,  \langle v\rangle\in \Omega
\}.
$$
Transvections play a pivotal role in our construction. As in \cite[page 71]{Taylor},
for $u\in V$ and $d\in \mathbb{F}$, the \emph{symplectic transvection} $t_{d,u}$
relative to the symplectic form $\beta$ is defined as  the map
\[
t_{d,u}(v) = v + d \beta(v,u)u \quad \mbox{for $v\in V$}.
\]
Each $t_{d,u} \in \Sp(4, q)$ and, for example, the matrix in \eqref{newg} with $a=b=1$ is the
transvection $t_{d,e_1}$. More generally, transvections  may be defined on any vector space $U$ over a field $\mathbb{K}$
by replacing $d\beta(v,u)$ in the displayed formula above with $\varphi(v)$,  for any linear functional
$\varphi:U\rightarrow \mathbb{K}$ (\cite[page 20]{Taylor}). In particular if $\dim U$ is odd and
$U$ is an orthogonal geometry defined by a quadratic form $Q$ such that the polar form $\beta'$ of $Q$ is non-degenerate, then
the corresponding orthogonal group $\mathrm{O}(U)$ (the isometry group of $Q$) contains transvections
if and only if $\mathbb{K}$ has characteristic $2$. Moreover, when $\mathbb{K}$ has characteristic $2$,
the  radical $U^\perp$ of $U$ with respect to $\beta'$ is 1-dimensional, $\beta'$ induces a
symplectic form on $U/U^\perp$, and there is a one-to-one correspondence between the
transvections in $\mathrm{O}(U)$ and the symplectic transvections on $U/U^\perp$
relative to this symplectic form \cite[page 144]{Taylor}. These comments are the basis (in the $4$-dimensional case) of
Lemma~\ref{t11-9-new}(ii) in the next subsection.

\begin{lemma}\label{transvection} Let
$g\in T$ with $g\ne1$.
If $g$ is a symplectic transvection,
then $|{\rm Fix}_{\Omega}(g)|=q^2+q+1$, and otherwise
$|{\rm Fix}_{\Omega}(g)|\leq 2q+2$.
\end{lemma}

\begin{proof}
If a non-scalar element $g\in
\GL(4,q)$ fixes a $2$-dimensional subspace $\langle v_1, v_2\rangle$ setwise and $g$ fixes
$\langle v_1\rangle$ and $\langle v_2\rangle$, then the number of
$1$-spaces in $\langle v_1, v_2\rangle$ fixed setwise by $g$ is
$2$ or $q+1$. Thus  there is nothing to prove if all the $1$-spaces
fixed setwise by $g$ lie in a $2$-space.
So we assume that $g$ fixes setwise three $1$-spaces $\langle
v_1\rangle$, $\langle v_2\rangle$, and $\langle v_3\rangle$
such that $v_1, v_2, v_3$ are linearly independent. Then by Lemma \ref{g
conjugate}, conjugating $g$ by an element of $T$ if
necessary, we may assume that the matrix for $g$ with respect to
the ordered basis $(e_1, f_1, e_2, f_2)$ is as in \eqref{newg},
we write $W=\langle e_1, e_2, f_2\rangle$, and $g$ fixes
$\langle e_1\rangle$, $\langle e_2\rangle$, and $\langle f_2\rangle$.

Let $S=\{a, a^{-1}, b, b^{-1}\}$. Let
$v=xe_1+yf_1+ze_2+wf_2\in W\setminus\{0\}$,
and suppose that $g$ fixes $\langle v\rangle$
setwise, so $vg=tv$ for some $t\in \mathbb{F}\setminus\{0\}$.
Then
\begin{align*}
ax+yd &=tx,\\
a^{-1}y &=ty,\\
bz &=tz,\\
b^{-1}w &=tw.
\end{align*}
We find ${\rm Fix}_{\Omega}(g)$ and its
size according to the possibilities for $|S|$ and $d$ (as in \eqref{newg}).
Assume first that $d=0$. In this case $|S|\geq 2$ since
$g\ne 1$ and the only scalar matrix in $\Sp(4,q)$ is the identity.

\begin{itemize}
\item[{(1)}] If $|S|=4$ (i.e., $a$, $a^{-1}$, $b$, $b^{-1}$ are all distinct), then
${\rm Fix}_{\Omega}(g)=\{\langle e_1\rangle, \langle
f_1\rangle, \langle e_2\rangle, \langle f_2\rangle\}$, and so
$|{\rm Fix}_{\Omega}(g)|=4< 2q+2$ (and $g$ is not a transvection).

\item[{(2)}] If $|S|=3$, then either $a=a^{-1}$ or $b=b^{-1}$ and we find
\[
{\rm Fix}_{\Omega}(g)=\left\{\begin{array}{lll} \Big\{\langle
xe_1+yf_1\rangle, \langle e_2\rangle, \langle f_2\rangle \ | \ x,
y\in \mathbb{F}, (x, y)\neq (0, 0) \Big\} & \mbox{if}  &
a=a^{-1},\\[0.3cm]
\Big\{\langle e_1\rangle, \langle f_1\rangle, \langle
ze_2+wf_2\rangle | z, w\in \mathbb{F}, (z,w )\ne (0, 0)\Big\} &
\mbox{if} & b=b^{-1}.\end{array}\right.
\]
Thus $|{\rm Fix}_{\Omega}(g)|=q+3\leq 2q+2$ (and $g$ is not a transvection).

\item[{(3)}] If $|S|=2$, then

\[ {\rm Fix}_{\Omega}(g)=\left\{\begin{array}{lll}
\Big\{\langle xe_1+yf_1\rangle, \langle ze_2+wf_2\rangle | x, y,
z, w\in \mathbb{F}, (x,y),(z,w)\ne (0,0 ) \Big\} & \mbox{if}  &
a=a^{-1}, b=b^{-1},\\[0.3cm]
\Big\{\langle xe_1+ze_2\rangle, \langle yf_1+wf_2\rangle | x, y,
z, w\in \mathbb{F}, (x,z),(y,w)\ne (0,0 )\Big\} & \mbox{if} &
a^{-1}\ne a=b,\\[0.3cm]
\Big\{\langle xe_1+wf_2\rangle, \langle yf_1+ze_2\rangle | x, y,
z, w\in \mathbb{F}, (x,w),(y,z)\ne (0,0 )\Big\} & \mbox{if} &
a^{-1}\ne a= b^{-1}.\end{array}\right.
\]
Thus $|{\rm
Fix}_{\Omega}(g)|=2q+2< 1+q+q^2$ (and $g$ is not a transvection).
\end{itemize}

Now we assume that $d\neq 0$. Let $h:=(a^{-1}-a)^{-1}$.

\begin{itemize}
\item[{(1)}] If $|S|=4$ (i.e., $a$, $a^{-1}$, $b$, $b^{-1}$ are all distinct), then
\[
{\rm Fix}_{\Omega}(g)=\Big\{\langle e_1\rangle, \langle
d_1he_1+f_1\rangle, \langle e_2\rangle, \langle
f_2\rangle\Big\},
\]
and $|{\rm
Fix}_{\Omega}(g)|=4< 2q+2$ (and $g$ is not a transvection).

\item[{(2)}] If $|S|=3$, then exactly one of $a=a^{-1}$ or $b=b^{-1}$, and we find
\[
{\rm Fix}_{\Omega}(g)= \left\{\begin{array}{lll}
\{\langle e_1\rangle, \langle e_2\rangle, \langle f_2\rangle\} & \mbox{if} & a=a^{-1}\\
\Big\{\langle e_1\rangle, \langle
d_1he_1+f_1\rangle, \langle ze_2+wf_2\rangle |
z, w\in \mathbb{F}, (z, w)\ne (0,0) \Big\}  & \mbox{if} & b=b^{-1}\\
\end{array}\right.
\]
and $|{\rm Fix}_{\Omega}(g)|=3$ or $q+3$ respectively, so is less that
$2q+2$ (and $g$ is not a transvection).


\item[{(3)}]
If $|S|=2$, then
\[{\rm Fix}_{\Omega}(g)=
\Big\{\langle e_1\rangle, \langle ze_2+wf_2\rangle | z, w\in
\mathbb{F}, (z, w)\ne (0, 0)\Big\}, \] if $a=a^{-1}$ and
$b=b^{-1}$, and hence in this case  $|{\rm Fix}_{\Omega}(g)|=q+2$.
%
Similarly, we obtain %\small{
\[ {\rm Fix}_{\Omega}(g)=\left\{\begin{array}{lll} \Big\{\langle
xe_1+ze_2\rangle, \langle
d_1hye_1+yf_1+wf_2\rangle | x,y,z,w\in
\mathbb{F}, (x,z), (y, w)\ne(0,0)\Big\} & \mbox{if} &
a=b,\\[0.3cm]
\Big\{\langle xe_1+wf_2\rangle, \langle
d_1hye_1+yf_1+ze_2\rangle| x,y,z,w\in
\mathbb{F}, (x,w), (y, z)\ne(0,0)\Big\} & \mbox{if} & a=
b^{-1}.\end{array}\right.
\] %}
and in these two cases $|{\rm Fix}_{\Omega}(g)|=2q+2$
 (and $g$ is not a transvection).

\item[{(4)}] If $|S|=1$, then $a=b=a^{-1}$ and $g$ has determinant
$a^4=1$, so $a=1$ (since $q$ is even). As noted above, in ths case $g$ is
the symplectic transvection $t_{d,e_1}$.
Then
\[
{\rm Fix}_{\Omega}(g)=\Big\{\langle xe_1+ze_2+wf_2\rangle |
x,z,w\in \mathbb{F}, (x, z, w)\neq (0,0,0)\Big\},
\]
and its size is equal to $q^2+q+1$. This is the only case in which
the number of $1$-spaces fixed setwise by $g$ is more that
$2q+2$.
%\[
%\left(
%\begin{array}{cccc}
%1&0&0&0\\
%d&1&0&0\\
%0&0&1&0\\
%0&0&0&1\\
%\end{array}
%\right)
%\]
\end{itemize}
\end{proof}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{A second permutation representation  of $\Sp(4, q)$ on $\Omega$}\label{sub:outer}
We construct another permutation representation making use of an outer automorphism
$\tau$ of $T=\Sp(4,q)$. Such an automorphism arises only when $q$ is even, as it is here.
We need information about the action of $\tau$, especially on the involutions in $T$.
The following lemma is taken from
\cite{Taylor} (see also the discussion preceding Lemma~\ref{transvection}).
\begin{lemma}\label{t11-9-new}
The following conditions hold, for all $m\geq2$ and even $q$:
\begin{itemize}
\item[$(i)$] $O(2m+1, q)$ is isomorphic to $\Sp(2m, q)$ {\rm (see
\label{T11.9}\cite[Theorem 11.9]{Taylor})}.

\item[$(ii)$] Every transvection in $O(2m+1, q)$ corresponds to a symplectic transvection in
$\Sp(2m, q)$ {\rm  (see \cite[p. 144]{Taylor})}.

\item[$(iii)$] $\PSp(4, q)\simeq P\Omega(5, q)$, for both even and odd $q$ {\rm  (see \label{C12.32}\cite[Corollary 12.32]{Taylor})}.
\end{itemize}
\end{lemma}

As pointed out by Todd \cite{todd}, using Lemma \ref{T11.9} one can
obtain some isomorphisms between $T=\Sp(4, 2^n)$ and $O(5, 2^n)$.
However the geometric reasons for these isomorphisms are quite
different. Taylor \cite[p. 201]{Taylor} observes that a certain $4$-dimensional
$T$-invariant section $\overline W$ of the ($6$-dimensional) exterior
square $\Lambda_2V$ of $V=\mathbb{F}^4$ admits a
nondegenerate alternating form which is invariant under
$T$. Moreover each element $g\in T$ induces a
linear map of $\Lambda_2V$, which we denote by $\Lambda_2g$,
and $\Lambda_2g$ induces a linear map  $\overline{\Lambda_2 g}\in\Sp(\overline W)$,
giving an isomorphism $T\rightarrow \Sp(\overline W)$
defined by $g \mapsto \overline{\Lambda_2 g}$.
%
Further, Taylor \cite[pp. 201-202]{Taylor} constructs an explicit linear isomorphism
$\overline p : \overline W \rightarrow V$ such that the map $\tau:T\rightarrow T$
defined by
\[
\tau(g) = \overline p \ \overline{\Lambda_2 g} \ {\overline p}^{-1}
\]
is an automorphism of $T$.
%
Let $t$ be a symplectic transvection in $T$. Then Taylor shows
\cite[p. 202]{Taylor} that $\tau(t)$ has a $2$-dimensional fixed point space in $V$, and hence that
$\tau(t)$ is not a symplectic transvection. Thus $\tau$ is not induced by conjugation
by any element of $T$, that is, $\tau$ is an outer automorphism of $T$.
Taylor~\cite[p.202]{Taylor} also shows that $\tau^2$ is the automorphism of $T$ induced by the
field automorphism $x\mapsto x^2$ of $\mathbb{F}$, so $\tau$ has order $2n$.
In particular, $\tau^2$ is a semilinear map, thus leaving the class of transvections invariant.
He also notes that, if $n$ is odd,
the field automorphism $\tau^2$ can be expressed as the square of another field automorphism, say $\sigma$, and
in this case the related outer automorphism $\sigma^{-1}\tau$ has order $2$.


A computation for the specific  transvection
$t=t_{1,e_1}$  shows that in this case $\overline{\Lambda_2 t}$  fixes exactly $q+1$
of the $1$-spaces of $\overline W$, and hence that $\tau(t)$ fixes exactly $q+1$
of the $1$-spaces of $V$. As all symplectic transvections are conjugate in $T$,
this is true for all symplectic transvections $t$,
that is, $| {\rm Fix}_{\Omega}(\tau(t))|=q+1$.

\begin{lemma}\label{l:trans} The image of a symplectic transvection of  $\Sp(4,q)$ under the (outer)
automorphism $\tau$  is an element with exactly $q+1$
fixed $1$-spaces.
\end{lemma}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

As above, we may regard  the outer automorphism from Lemma $\ref{l:trans}$
as a second (faithful, transitive) permutation representation of $T$ on $\Omega$.
We let  $\mathcal{I}=(\iota, \tau)$,with $\iota$ the identity automorphism of $T$,
and construct the twisted permutation code $C(T,\mathcal{I})$
for $T=\Sp(4, q)$ relative to $\mathcal{I}$.
Set $m:=|\Omega| = (q^4-1)/(q-1)$, and choose an ordering
$(\langle v_1\rangle, \langle v_2\rangle, \ldots , \langle v_m\rangle)$
for $\Omega$.  Each $g\in T$ then corresponds to the vertex
$$
\alpha(g,\iota)=\left(\langle v_1\rangle^g, \langle v_2\rangle^g,
\ldots , \langle v_m\rangle^g\right)
$$
of the Hamming graph of length $m$ over $\Omega$.
We define the permutation code as
$$
C(T,\iota)=\{\alpha(g,\iota) | g\in T\}
$$
and the twisted permutation code $C(T,\mathcal{I})$
relative to $\mathcal{I}=(\iota, \tau)$ as the code in the
Hamming graph of length $2m = 2q^3+2q^2+2q+2$ over $\Omega$ consisting of the vertices
$$
\alpha(g,\mathcal{I})=(\alpha(g,\iota),\alpha(g,\tau))\quad \mbox{for $g\in T$.}
$$

\begin{proposition}\label{symplectic}
Let $T=\Sp(4, q)$ ($q=2^n\geq4$) and $\mathcal{I}=(\iota, \tau)$ be as above.
Then the twisted permutation
code $C(T,\mathcal{I})$ has size $|T|$, and
minimum distance $2q^3+q^2$, while the $2$-fold repetition permutation codes  $C(T, \iota^2)$ and $C(T, \tau^2)$
have minimum distance $2q^3$. The difference between the
minimum distance of $C(T,\mathcal{I})$ and the lower bound given by Proposition
$\ref{lower bound}$ is $q^2$.
\end{proposition}

\begin{proof}
By Proposition \ref{lower bound}, the minimum distance
$\delta(C(T,\mathcal{I}))$ is equal to the minimum of $|\supp(g)|+
|\supp(\tau(g))|$, for $g\neq 1$ in $T$, where $\supp (g)$
denotes the subset of $\Omega$ consisting of the $1$-spaces which
are moved by $g$ (not fixed setwise). It follows from Lemmas
\ref{transvection} and \ref{l:trans} that, if $g$ is a
transvection, then $|\supp (g)|+|\supp
(\tau(g))|=(m-q^2-q-1)+(m-q-1)=2q^3+q^2$.  Similarly, if $\tau(g)$
is a transvection then, by Lemma~\ref{l:trans}, $\tau^2(g)$ and
(since $\tau^2$ is a semilinear map) also $g$ fixes exactly $q+1$
of the $1$-spaces, and again we obtain  $|\supp (g)|+|\supp
(\tau(g))|=2q^3+q^2$.
%
For all other non-identity elements $g$, it follows from Lemma \ref{transvection}
that $|\supp(g)|+|\supp(\tau(g))|\geq 2(m-2q-2)$, which is strictly greater than
$2q^3+q^2$ for $q\geq 4$. Therefore,
$\delta(C(T,\mathcal{I}))=2q^3+q^2.$

Finally, we have from Proposition \ref{lower bound} and Lemma
\ref{transvection} that the lower bound in Proposition \ref{lower
bound}, and also the minimum distances of the repetition permutation codes,
are all equal to the minimum of $2|\supp (g)|$ for nontrivial $g\in T$, and
that this is attained when $g$ is a transvection and is $2(m-q^2-q-1)=2q^3$.
The difference between $\delta(C(T,\mathcal{I}))$ and this lower
bound is $q^2$.
\end{proof}

\subsection{Proof of Theorem \ref{main thm}.}
By considering $\delta_{tw} := \delta(C(T,\mathcal{I}))$ and
$\delta_{\rep} :=\min_{\rho\in \mathcal{I}}\{\delta(C(T,\rho^r))\}$,
Theorem~\ref{main thm} follows from Propositions \ref{T affine} and
\ref{symplectic}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{Acknowledgements}
%\begin{center}
%{\bf Acknowledgements}
%\end{center}
The first author would like to thank the School of Mathematics and
Statistics of the University of Western Australia for their
hospitality during the preparation of this paper. She also would
like to express her deep gratitude to the second and third authors for numerous mathematical discussions.

The second author acknowledges the support of a grant from the University of Western Australia associated with
the Australian Research Council Federation Fellowship FF0776186 of the third author.

All authors gratefully acknowledge  insightful comments from an anonymous referee which led to significant improvements in the exposition of the paper.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{thebibliography}{99}
\bibitem{artin} Artin, E. Geometric algebra.
{\em Interscience Publishers, Inc., New York-London}, 1957. x+214 pp.

%\bibitem{count} Benjamin, Arthur T. and Quinn, Jennifer J., Proofs that really count: the art of combinatorial proof,
%{\em Mathematical Association of America, Washington, DC}, 2003.

\bibitem{brouwer} Brouwer, A. E., Cohen, A. M., Neumaier, A. Distance-regular
graphs. Ergebnisse der Mathematik und ihrer Grenzgebiete (3)
[Results in Mathematics and Related Areas (3)], 18. {\em
Springer-Verlag}, Berlin, 1989.

\bibitem{bru}
Brualdi, Richard A. Introductory combinatorics. {\em
North-Holland, New York-Oxford-Amsterdam}, 1977.

\bibitem{dukes des} Chu, W., Colbourn, C. J., Dukes, P. Constructions for
permutation codes in powerline communications. {\em Des. Codes
Cryptogr.} 32 (2004), no. 1-3, 51--64.

\bibitem{dukes dis} Chu, W., Colbourn, C. J., Dukes, P. On constant composition codes.
{\em Discrete Appl. Math.} 154 (2006), no. 6, 912--929.

\bibitem{capp} Cappelletti, P., Golla, C., Olivo, P., Zanoni, E. Flash
Memories. {\em Kluwer Academic Press}, 1999.

\bibitem{ntrans} Gillespie, N. I. and Praeger, C. E. Neighbour transitivity on
codes in Hamming graphs. {\em Des. Codes Cryptogr.}, 67, (2013), no. 3, 385--393.

\bibitem{diagntrans} Gillespie, N. I. and Praeger, C. E. Diagonally neighbour transitive codes. {\em J. Algebraic Combinatorics},
Vol 39, Issue 3, (2014), 733--747.

\bibitem{asntrans} Gillespie, N. I. and Praeger, C. E. Classification of a family of neighbour transitive codes. {\em ArXiv:1405.5427.}

\bibitem{twisted} Gillespie, N. I., Praeger, C. E.,
Spiga, P. Twisted permutation codes. {\em J. Group Theory},
18 (2015), no. 3, 407--433.

\bibitem{han vinck} Han Vinck, A. J. Coded modulation for power line
communications. {\em AE\"{U} Journal}, 45--49 (Jan 2000).

\bibitem{huc des} Huczynska, S.  Equidistant frequency permutation arrays
and related constant composition codes. {\em Des. Codes Cryptogr.}
54 (2010), no. 2, 109--120.

\bibitem{huc mullen} Huczynska, S., Mullen, G. L. Frequency permutation arrays.
{\em J. Combin. Des.} 14 (2006), no. 6, 463--478.

\bibitem{jiang} Jiang, A., Schwartz, M., Bruck, J. Error-Correcting Codes for Rank
Modulation. {\em International Symposium on Information Theory
(ISIT)}, pp. 1736--1740, July 2008.

\bibitem{state of the art} Pavlidou, N., Han Vinck, A., Yazdani,
J., Honary, B. Power line communications: state of the art and
future trends. {\em Communications Magazine, IEEE} 41(4), 34--40
(2003).

\bibitem{shieh} Shieh, M., Tasi, S. Decoding frequency permutation arrays
under Chebyshev distance. {\em IEEE Trans. Inform. Theory} 56
(2010), no. 11, 5730--5737.

\bibitem{tamo} Tamo, I., Schwartz, M. Correcting limited-magnitude errors
in the rank-modulation scheme. {\em IEEE Trans. Inform. Theory} 56
(2010), no. 6, 2551--2560.

\bibitem{Taylor} Taylor, D. E. The geometry of the classical groups.
Sigma Series in Pure Mathematics, 9. {\em Heldermann Verlag,
Berlin}, 1992. xii+229 pp.

\bibitem{todd} Todd, J.A. As it might have been. {\em Bull. London Math Soc.}, 2 (1970), Issue 1, 1--4.

\bibitem{Chevalley} Witt, E. Theorie der quadratischen Formen in beliebigen K$\rm\ddot{o}$rpern,
{\em J. Reine Angew. Math.}, 176 (1937), 31--44.
\end{thebibliography}
\end{document}
