# Quaternions over Galois rings and their codes

Pierre Lance A. Tan and Virgilio P. Sison
Institute of Mathematical Sciences and Physics
University of the Philippines Los Baños
College 4031, Laguna, Philippines
Emails: {patan3<EMAIL_ADDRESS>

Corresponding Author

###### Abstract

It is shown in this paper that, if $R$ is a Frobenius ring, then the
quaternion ring $\mathcal{H}_{a,b}(R)$ is a Frobenius ring for all units
$a,b\in R$. In particular, if $q$ is an odd prime power then
$\mathcal{H}_{a,b}(\mathbb{F}_{q})$ is the semisimple non-commutative matrix
ring $M_{2}(\mathbb{F}_{q})$. Consequently, a homogeneous weight that depends
on the field size $q$ is obtained. On the other hand, the homogeneous weight
of a finite Frobenius ring with a unique minimal ideal is derived in terms of
the size of the ideal. This is illustrated by the quaternions over the Galois
ring $GR(2^{r},m)$. Finally, one-sided linear block codes over the quaternions
over Galois rings are constructed, and certain bounds on the homogeneous
distance of the images of these codes are proved. These bounds are based on
the Hamming distance of the quaternion code and the parameters of the Galois
ring. Good examples of one-sided rate-$2/6$, $3$-quasi-cyclic quaternion codes
and their images are generated. One of these codes meets the Singleton bound
and is therefore a maximum distance separable code.

Keywords: quaternions, Galois rings, Frobenius rings, homogeneous weight
MSC 2020: 16H05, 16L99, 94B05, 94B65

##  1 Introduction

The classical notion of quaternions began with Hamilton in 1843 when he
attempted to describe three-dimensional problems in mechanics. Much like how
the field of complex numbers $\mathbb{C}$ is an extension of the field
$\mathbb{R}$ of real numbers, so too is the ring of real quaternions which
forms a $4$-dimensional central simple algebra over $\mathbb{R}$ with basis
$\\{1,i,j,k\\}$ such that $i^{2}=j^{2}=k^{2}=ijk=-1$, but with the commutative
law of multiplication removed. The quaternions over $\mathbb{R}$ are the only
noncommutative division ring over the real numbers. They can be viewed as
$2\times 2$ complex matrices of the form

$\left(\begin{matrix}z&w\\\ -\overline{w}&\overline{z}\end{matrix}\right).$
(1)

Quaternions have seen applications in computer science and other fields of
mathematics. The multiplication rules of quaternions make algorithms faster
and more compact than when matrix representations are used.

More recently, quaternion algebras have been studied as Frobenius algebras
[1]. An algebra $A$ over a commutative ring $K$ with unity is a ring that
behaves as a unitary (left) module over $K$ such that $k(ab)=(ka)b=a(kb)$ for
all $k\in K$ and $a,b\in A$. Moreover, quaternions have been constructed over
finite fields including the prime field $\mathbb{F}_{p}$ [2]. The quaternions
over $\mathbb{F}_{p}$, where $p$ is odd, are simply the matrix ring
$M_{2}(\mathbb{F}_{p})$, which has been the subject of study in [3] in the
context of orbit codes. This is further extended to quaternions over finite
commutative rings with unity, such as the residue class ring $\mathbb{Z}_{n}$
of integers modulo $n$ [4].

Quaternions have been further generalized in numerous directions. There is the
octonion algebra, which is an 8-dimensional extension of $\mathbb{R}$. Using
the Cayley-Dickson construction as given in [5], the dimension of the
quaternions is doubled, however the property of associativity is lost.

It is quite natural to deal with quaternions over finite Frobenius rings which
include not only $\mathbb{Z}_{n}$, but more generally all the Galois rings,
such as the finite fields and the ring $\mathbb{Z}_{p^{r}}$ where $p$ is prime
and $r$ is a positive integer. This paper shows that quaternions over
Frobenius rings, in particular, over Galois rings, are Frobenius rings on
which a suitable homogeneous weight can be defined. Then the so-called
quaternion codes that satisfy certain good distance properties are
constructed.

The material is organized as follows: Section 2 provides the conceptual
framework while Section 3 presents the main results.

##  2 Preliminaries and definitions

This section tackles briefly the structural properties of Galois rings,
Frobenius rings, quaternion rings and linear block codes. For a more detailed
discussion of these topics, we refer the reader to [4], [6] and [7].

###  2.1 Galois rings

Let $p$ be a prime number and $r\geq 1$ an integer. Consider the finite
commutative ring $\mathbb{Z}_{p^{r}}$ of integers modulo $p^{r}$. When $r=1$
then the ring $\mathbb{Z}_{p}$ is a field and is usually denoted by
$\mathbb{F}_{p}$. Let $\mathbb{Z}_{p^{r}}[x]$ be the ring of polynomials in
the indeterminate $x$ with coefficients in $\mathbb{Z}_{p^{r}}$. The Galois
ring with characteristic $p^{r}$ and cardinality $p^{rm}$ is the residue class
ring $\mathbb{Z}_{p^{r}}[x]/(h(x))$, where $h(x)$ is a monic polynomial of
degree $m$ in $\mathbb{Z}_{p^{r}}$ whose image under the mod $p$ reduction map
is an irreducible polynomial in $\mathbb{F}_{p}[x]$. The Galois ring can also
be seen as a Galois extension $\mathbb{Z}_{p^{r}}[\omega]$ of
$\mathbb{Z}_{p^{r}}$ by a root $\omega$ of $h(x)$. Thus, every element has a
unique additive representation

$x=b_{0}+b_{1}\omega+b_{2}\omega^{2}+\dots+b_{m-1}\omega^{m-1}$ (2)

where $b_{i}\in\mathbb{Z}_{p^{r}},i=0,1,\dots,m-1$, which makes it a free
module over $\mathbb{Z}_{p^{r}}$ with basis
$\\{1,\omega,\omega^{2},\dots,\omega^{m-1}\\}$. The ring satisfies the
invariant dimension property in the sense that any other basis has exactly $m$
elements.

Since any two Galois rings of the same characteristic and the same cardinality
are isomorphic, we shall use $GR(p^{r},m)$ to denote such rings. When $m=1$,
the Galois ring $GR(p^{r},m)$ is the integer ring $\mathbb{Z}_{p^{r}}$, and
when $r=1$, we obtain the Galois field $\mathbb{F}_{p^{m}}$. The ring
$GR(p^{r},m)$ is a commutative local principal ideal ring and is a finite
chain ring of length $r$ with its unique maximal ideal $(p)$ containing the
nilpotent elements.

###  2.2 Frobenius rings

Let $R$ be a finite ring with unity, and $\mathbb{T}$ be the multiplicative
group of unit complex numbers. The group $\mathbb{T}$ is a one-dimensional
torus. A character of $R$, considered as an additive abelian group, is a group
homomorphism $\chi:R\rightarrow\mathbb{T}$. A character $\chi$ of $R$ is
called a left (resp. right) generating character if and only if $\ker\chi$
contains no nonzero left (resp. right) ideals. The ring $R$ is called
Frobenius if and only if $R$ admits a left or a right generating character. A
character $\chi$ on $R$ is a left generating character if and only if it is a
right generating character [7]. Alternatively, a finite ring $R$ is Frobenius
if and only if the left (resp. right) socle of $R$ is a left (resp. right)
principal ideal.

We note that any finite principal ideal ring is Frobenius. In particular, the
Galois ring $GR(p^{r},m)$ is a Frobenius ring with generating character

$\chi(x)=e^{2\pi ib_{m-1}/p^{r}}\text{ for
}x=\Sigma^{m-1}_{i=0}b_{i}\omega^{i}$ (3)

Furthermore the non-commutative ring $M_{n}(R)$ of $n\times n$ matrices over a
Frobenius ring $R$ is Frobenius with generating character

$\chi^{*}(B)=\chi(tr(B))$ (4)

where $\chi$ is a generating character of $R$ and $tr$ is the usual matrix
trace.

###  2.3 Homogeneous weight

A left homogeneous weight on an arbitrary finite ring $R$ with unity is
defined in the sense of [8] in terms of the nonzero principal left ideals.
Right homogeneous weights are defined analogously.

###### Definition 2.1

A weight function $w:R\rightarrow\mathbb{R}$ on a finite ring $R$ is called
(left) homogeneous if $w(0)=0$ and the following are true.

  1. 1.

If $Rx=Ry$, then $w(x)=w(y)$ for all $x,y\in R$.

  2. 2.

There exists a real number $\Gamma\geq 0$ such that $\dfrac{\Sigma_{y\in
Rx}w(y)}{|Rx|}=\Gamma$, for all nonzero ideals $Rx$.

If a weight is both left homogeneous and right homogeneous, we call it simply
as a homogeneous weight. The constant $\Gamma$ is called the average value.
The homogeneous weight $w$ can be normalized by replacing it with
$\widetilde{w}=\Gamma^{-1}w$. It was proved in [6] that, if $R$ is Frobenius
with generating character $\chi$, then every homogeneous weight $w$ on $R$ can
be expressed in terms of $\chi$ as

$w(x)=\Gamma\left[1-\dfrac{1}{|R^{\times}|}\sum_{u\in
R^{\times}}\chi(xu)\right]$ (5)

where $R^{\times}$ is the multiplicative group $R$.

Another formula for the homogeneous weight is given in terms of the Möbius
function $\mu$ on the poset of the principal left ideals of $R$ with the
property that (i) $\mu(Rx,Rx)=1$ for all $x\in R$, (ii) $\mu(Ry,Rx)=0$ if
$Ry\nleq Rx$, and (iii) $\Sigma_{Ry\leq Rz\leq Rx}\mu(Rz,Rx)=0$ if $Ry\leq
Rx$.

$w(x)=\Gamma\left[1-\dfrac{\mu(0,Rx)}{|R^{\times}x|}\right]$ (6)

The homogeneous weight of $GR(p^{r},m)$ as a finite chain ring is derived in
[9] as follows.

$w_{\textnormal{hom}}(x)=\begin{cases}0,&\text{if }x=0\\\ p^{m(r-1)},&\text{if
}x\in(p^{r-1})\setminus\\{0\\}\\\
(p^{m}-1)p^{m(r-2)},&\text{otherwise}\end{cases}$ (7)

in which the average value $\Gamma$ is computed as follows.

$\Gamma=(p^{m}-1)p^{m(r-2)}$ (8)

This value happens to be the minimum nonzero weight, while the maximum weight
is $p^{m(r-1)}$.

###  2.4 Quaternion rings

Let $R$ be a commutative ring with unity and $a,b$ are units. The quaternion
ring over $R$ denoted by $\mathcal{H}_{a,b}(R)$ consists of elements of the
form

$x_{0}+x_{1}i+x_{2}j+x_{3}k$ (9)

where $x_{i}\in R,i^{2}=a,j^{2}=b,ij=-ji=k$. Clearly, $\mathcal{H}_{a,b}(R)$
is a non-commutative ring with unity and a two-sided module over $R$ with
basis $\\{1,i,j,k\\}$. Specifically, when $a=b=-1$, we denote the ring by
$\mathcal{H}(R)$ in reference to Hamilton’s quaternions. On the other hand,
when $a=b=1$, we denote the ring by $\mathcal{L}(R)$ which is the convention
used in [4].

In the classical sense, quaternions have been defined over finite or infinite
fields. At present there has been keen interest on quaternion rings over
finite rings such as the residue class ring $\mathbb{Z}_{n}$, as shown in the
following theorems.

###### Theorem 2.2

[4] Let $R$ be the residue class ring $\mathbb{Z}_{n}$ and $M_{2}(R)$ the non-
commutative ring of $2\times 2$ matrices over $R$. Then
$\mathcal{H}_{a,b}(R)\cong\mathcal{H}(R)$ if and only if $a\equiv
b\equiv-1\mod 4$, otherwise $\mathcal{H}_{a,b}(R)\cong\mathcal{L}(R)$.
Moreover, $\mathcal{H}_{a,b}(R)\cong M_{2}(R)$ if and only if $n$ is odd.

###### Corollary 2.3

[4]
$\mathcal{H}_{a,b}(\mathbb{Z}_{n})\cong\mathcal{H}(\mathbb{Z}_{n})\cong\mathcal{L}(\mathbb{Z}_{n})$
if and only if $n$ is odd or $n=2$.

###  2.5 One-sided block codes

A block code $C$ of length $n$ over an arbitrary finite ring $R$ with unity is
a nonempty subset of the free module $R^{n}$ which contains all the $n$-tuples
over $R$. The code $C$ is said to be left (resp. right) $R$-linear if $C$ is a
left (resp. right) $R$-submodule of $R^{n}$. If $C$ is both left $R$-linear
and right $R$-linear, we simply call $C$ a linear block code over $R$. If $C$
is a free module, then $C$ is said to be a free code. A $k\times n$ matrix $G$
over $R$ is called a generator matrix if its rows span $C$ and no proper
subset of the rows generates $C$, that is $C=\\{v\in R^{n}:v=uG,u\in R^{k}\\}$
so that the rate of $C$ is $k/n$. In this paper, a block code over a
quaternion ring will be called a quaternion code.

Let $w$ be a weight function on the ring $R$ which is extended coordinate-wise
to $R^{n}$. The minimum weight of $C$ is the minimum of the weights of the
nonzero elements of $C$. The distance metric $d:R^{n}\times
R^{n}\rightarrow\mathbb{R}$ is defined by $d(x,y)=w(x-y)$ for $x,y\in R^{n}$.
The minimum distance $d$ of the code $C$ with respect to $w$ is defined to be
$d=\min\\{d(x,y)|x,y\in C,x\neq y\\}$. For linear codes, the minimum distance
is equal to the minimum weight.

It is given in [10] that the Singleton bound for codes over any alphabet of
size $m$ is as follows.

$d_{H}\leq n-\log_{m}(|C|)+1$ (10)

where $d_{H}$ is the minimum Hamming distance of $C$.

Let $C$ be a linear block code of length $n$. The code $C$ is called cyclic
if, for every codeword $c=(c_{1},\dots,c_{n})$ from $C$, the word
$(c_{n},c_{1},\dots,c_{n-1})$ is again a codeword. The code $C$ is called
$\ell$-quasi-cyclic if, a cyclic shift of a codeword by $q$ positions results
in another codeword, that is, for every codeword $c=(c_{1},\dots,c_{n})$ from
$C$, the word $(c_{n-\ell+1},\dots,c_{n},c_{1},\dots,c_{n-\ell})$ is again a
codeword. A $1$-quasi cyclic code is a cyclic code.

##  3 Results and discussion

The results are divided as follows: First, we develop the theory of
quaternions over Galois rings. There are several existing literature on
quaternions over specific classes of Galois rings, but now we are able to
unify these results. We claim that they are Frobenius rings and hence a
homogeneous weight can be defined. Second, we construct the so-called
quaternion codes and get their images as codes over Galois rings with four
times the length. Theoretical distance bounds involving these codes are
derived. Finally, new good examples of such codes and their distances are
presented, one of which satisfies the Singleton bound.

###  3.1 Quaternions over Galois rings

It has been proved in [1] that quaternions over Frobenius algebras are also
Frobenius algebras. We shall prove it for the case of rings instead of
algebras, which was a conjecture in the said paper. It follows that the rings
are Artinian, finite and with unity. It is also clear that quaternions are
modular with the standard basis $\\{1,i,j,k\\}$.

###### Theorem 3.1

Let $R$ be a Frobenius ring and $a,b\in R^{\times}$. Then the quaternion ring
$\mathcal{H}_{a,b}(R)$ is also a Frobenius ring.

Proof: Let $x=x_{0}+x_{1}i+x_{2}j+x_{3}k$ and $y=y_{0}+y_{1}i+y_{2}j+y_{3}k$.
Let $\chi$ be a generating character of $R$. Define the map
$\chi^{*}(x)=\chi(x_{0})$. Then
$\chi^{*}(x+y)=\chi(x_{0}+y_{0})=\chi(x_{0})\chi(y_{0})=\chi^{*}(x)\chi^{*}(y)$.
Thus $\chi^{*}$ is a group homomorphism and hence is a character of
$\mathcal{H}_{a,b}(R)$. Furthermore, $\ker\chi^{*}=\\{x:x_{0}\in\ker\chi\\}$.
We show that $\ker\chi^{*}$ contains no nonzero left ideals. Let
$I\subseteq\ker\chi^{*}$ and $x\in I$. First observe that $x_{0}=0$, for if
$Rx_{0}\neq\\{0\\}$ then $\ker\chi$ contains a nonzero left ideal $Rx_{0}$,
which is a contradiction. Next observe that $x=0$, for if say $x_{1}\neq 0$
then since $a$ is a unit, the scalar term of $ix$ is $x_{1}a\neq 0$, which is
a contradiction. Hence $\chi^{*}$ is a generating character. $\Box$

If $R$ is finite then $\mathcal{H}_{a,b}(R)$ is finite with cardinality
$|R|^{4}$. The following more specific result, which will be useful in the
succeeding discussion, is an immediate consequence of the preceding theorem
via (3).

###### Corollary 3.2

Let $R=GR(p^{r},m)$ be a Galois ring. Then the quaternion ring
$\mathcal{H}_{a,b}(R)$ is Frobenius.

It should be noted that, in a more general sense as given in [4], if $R$ is a
commutative, associative and unital ring, just like $GR(p^{r},m)$, the
quaternion ring $\mathcal{H}_{-1,-1}(R)$ is isomorphic to a subring of complex
matrices given similarly in (1). However, in a more specific case, the paper
by Miguel [2] proved that quaternion rings over the prime field
$\mathbb{F}_{p}$, where $p$ is odd, is isomorphic to the full matrix ring
$M_{2}(\mathbb{F}_{p})$. A more general theorem is stated as follows.

###### Theorem 3.3

[2] Over a field $F$ with characteristic different from $2$, there are exactly
two quaternion rings: the matrix ring $M_{2}(F)$ and a division ring.

This theorem leads us to extend the isomorphism as follows.

###### Corollary 3.4

If $p$ is an odd prime, then $\mathcal{H}_{a,b}(\mathbb{F}_{p^{m}})\cong
M_{2}(\mathbb{F}_{p^{m}})$.

Since the choice of $a$ and $b$ no longer matters when $p$ is odd, we can
simply use the notation $\mathcal{H}(\mathbb{F}_{q})$, where $q=p^{m}$.
Because of Corollary 3.4, our study of quaternions now has access to the deep
results in [3] on rings of matrices. We now combine the results of [2], which
is limited to $\mathbb{F}_{p}$, and [3], which makes no reference to
quaternions. Hence, the formulas for the number of zero divisors and
idempotents are easily computed. These formulas coincide with the results in
[3] for the matrix ring $M_{2}(\mathbb{F}_{q})$, where $q$ is a power of a
prime.

###### Corollary 3.5

Let $\mathcal{H}(\mathbb{F}_{q})$ be the ring of quaternions over the finite
field $\mathbb{F}_{q}$ where $q=p^{r}$ (odd $p$). Then
$\mathcal{H}(\mathbb{F}_{q})$ has $q^{3}+q^{2}-q-1$ zero divisors and
$q^{2}+q+2$ idempotents.

The zero divisors and idempotents of $\mathcal{H}(\mathbb{F}_{q})$ each play a
role in the homogeneous weight of $\mathcal{H}(\mathbb{F}_{q})$. The
idempotents are the generators of the nontrivial proper ideals of
$\mathcal{H}(\mathbb{F}_{q})$, which altogether contain all of the zero
divisors. This is why the nonzero values of the homogeneous weight function,
which we will see later, are segregated into the zero divisors and units.

The next results follow immediately from the work in [3] which uses (6).

###### Corollary 3.6

Let $\mathcal{H}(\mathbb{F}_{q})$ be the ring of quaternions over the finite
field $\mathbb{F}_{q}$ where $q=p^{r}$ (odd $p$). Then
$\mathcal{H}(\mathbb{F}_{q})$ is a semisimple ring with $q+1$ proper left
(resp. right) ideals, and moreover, each proper left (resp. right) ideal is
principal, minimal and maximal, and has $q^{2}$ elements.

###### Corollary 3.7

Let $\mathcal{H}(\mathbb{F}_{q})$ be the ring of quaternions over the finite
field $\mathbb{F}_{q}$ where $q=p^{r}$ (odd $p$). Then the homogeneous weight
of $\mathcal{H}(\mathbb{F}_{q})$ with average value $\Gamma$ is given by

$w(x)=\begin{cases}0,&\text{if }x=0\\\
\Gamma\left(\dfrac{q^{2}}{q^{2}-1}\right),&\text{if }x\text{ is a zero
divisor}\\\ \Gamma\left(1-\dfrac{1}{(q-1)(q^{2}-1)}\right),&\text{if }x\text{
is a unit}\end{cases}$

We highlight the fact that although these results speak of quaternions, it is
only the field size $q$ that determines the above weights.

Since much work has been done on the case when $p$ is odd, we are interested
in completing the case when $p$ is even. Note that the underlying Galois ring
may have characteristic equal to $2$, which leads to a commutative quaternion
ring. We discovered that the corresponding lattice contains a unique minimal
ideal, from which the homogeneous weight is completely determined. By minimal
left (resp. right) ideal $I$ we mean, $I\neq\\{0\\}$, and if $K$ is a left
(resp. right) ideal with $\\{0\\}\subseteq K\subseteq I$, then either
$K=\\{0\\}$ or $K=I$.

###### Theorem 3.8

Let $R$ be a finite Frobenius ring with a unique minimal left (resp. right)
ideal $I$. The homogeneous weight on $R$ with average value $\Gamma$ is given
as follows.

$w_{\textnormal{hom}}(x)=\begin{cases}0,&\text{if }x=0\\\
\Gamma\dfrac{|I|}{|I|-1},&\text{if }x\in I\setminus\\{0\\}\\\
\Gamma,&\text{otherwise}\end{cases}$

Proof: In the following arguments, we assume that all ideals are left ideals.
The proof is analogous for right ideals. Let $x\in I$ be nonzero. Then
$Rx\subseteq I$ and $Rx$ is nontrivial. But since $I$ is a minimal ideal, then
$Rx=I$. This is true for all $x\in I$ nonzero. Therefore, all the $|I|-1$
nonzero elements have the same weight $W$. Furthermore, the average value is
$\Gamma=W\dfrac{|I|-1}{|I|}$. Thus, we have proven the first statement. We
remark that this part of the proof is applicable to rings that have more than
one minimal ideal. Now, let $J$ be an ideal containing $I$ such that there is
no proper ideal between $I$ and $J$. Then the elements of $J-I$ are
associates. Since the average value across $I$ is already $\Gamma$, then by
arithmetic computation, the weight of any element in $J-I$ must be
$W=\Gamma\dfrac{|J-I|}{|J-I|}=\Gamma$. We can repeat this argument for all
ideals $J_{n}$ satisfying the assumption. Thus, we know the weight of ideals
one level above $I$. Furthermore, we can generalize the argument for each
level of ideals by induction. We stress that this is due to the uniqueness of
$I$. We can repeat this argument up to the whole ring, since it is finite.
Hence, the weight of any element not in $I$ is $\Gamma$. $\Box$

Note that the average value $\Gamma$ is still the minimum nonzero weight. A
special case of Theorem 3.8 occurs when $R$ is a finite chain ring. In this
case, we know the exact value of $\Gamma$. For example, if
$R=\mathbb{F}_{p^{m}}$ then $I=R$ and

$\Gamma\dfrac{|I|}{|I|-1}=\left(\dfrac{p^{m}-1}{p^{m}}\right)\left(\dfrac{p^{m}}{p^{m}-1}\right)=1.$
(11)

Therefore, the homogeneous weight is just the Hamming weight. On the other
hand, if $R=\mathbb{Z}_{p^{r}}$ then $I=(p^{r-1})$ and

$\Gamma\dfrac{|I|}{|I|-1}=(p-1)p^{r-2}\left(\dfrac{p}{p-1}\right)=p^{r-1}.$
(12)

Hence,

$w_{\textnormal{hom}}(x)=\begin{cases}0,&\text{if }x=0\\\ p^{r-1},&\text{if
}x\in(p^{r-1})\setminus\\{0\\}\\\ (p-1)p^{r-2},&\text{otherwise}\end{cases}$
(13)

In general, it can be easily shown that applying Theorem 3.8 to the Galois
rings $GR(p^{r},m)$ will give us the homogeneous weight in (7) with the unique
minimal ideal $(p^{r-1})$ having $p^{m}$ elements.

However, Theorem 3.8 applies to more than just Galois rings and finite chain
rings. In the succeeding discussion, we will cover
$\mathcal{H}(\mathbb{F}_{2^{m}})$ and $\mathcal{H}(\mathbb{Z}_{2^{r}})$, in
which we will find explicit forms for the minimal ideal. This in stark
contrast to $\mathcal{H}(\mathbb{F}_{p^{r}})$ (odd $p$), where there is more
than one minimal ideal. We begin by splitting the cases $r=1,m>1$ and
$r>1,m=1$. We then generalize to $r>1,m>1$ from the latter.

###### Theorem 3.9

The two-sided principal ideal $(x)=x\mathbb{F}_{2^{m}}$, where

$x=1+i+j+k$ (14)

is the only minimal ideal of $\mathcal{H}(\mathbb{F}_{2^{m}})$. Furthermore,
$|(x)|=2^{m}$.

Proof: Let $y=y_{0}+y_{1}i+y_{2}j+y_{3}k$. Since $char(\mathbb{F}_{2^{m}})=2$,
positives and negatives are the same. Then $yx=xy=xz$, where
$z=y_{0}+y_{1}+y_{2}+y_{3}\in\mathbb{F}_{2^{m}}$. Thus $(x)\subseteq
x\mathbb{F}_{2^{m}}$. On the other hand,
$\mathbb{F}_{2^{m}}\subseteq\mathcal{H}(\mathbb{F}_{2^{m}})$, so that
$x\mathbb{F}_{2^{m}}\subseteq(x)$. Hence, $(x)=x\mathbb{F}_{2^{m}}$.
Furthermore, it is easy to see that for any nonzero ideal $I$ with generator
$y$, there is always a quaternion such that when multiplied to $y$, the
product is a nonzero scalar multiple of $x$. Therefore $(x)$ is always
contained in $I$. $\Box$

With this, we have settled the case $r=1$. We separate this result from the
cases $r>1$ because in those cases, the minimal ideal degenerates to two
elements.

###### Theorem 3.10

The two-sided principal ideal $(x)=\\{0,x\\}$, where

$x=2^{r-1}(1+i+j+k)$ (15)

is the only minimal ideal of $\mathcal{H}(\mathbb{Z}_{2^{r}})$.

Proof: The proof is analogous to that of Theorem 3.9, as evident in the
$1+i+j+k$ term and due to $2^{r-1}$ having characteristic $2$. The distinction
lies in the fact that $\mathbb{F}_{2^{m}}$ is a field, hence the minimal ideal
of $\mathcal{H}(\mathbb{F}_{2^{m}})$ has cardinality $2^{m}$. In contrast,
$2^{r}$ is a zero divisor that, when multiplied to any other scalar, results
in $2^{r}$ or $0$. $\Box$

We remark that from Corollary 3.6, Theorem 3.9 and Theorem 3.10, we can give
another proof that such rings are Frobenius. We reason with the socle
definition of Frobenius rings. In the case of Corollary 3.6, the socle is the
entire ring, while in the case of Theorem 3.9 (resp. Theorem 3.10), the socle
is the respective minimal ideal. In each case, it is clear that the socle is
principal.

We further generalize Theorem 3.10.

###### Corollary 3.11

Let $R=GR(2^{r},m)$ be a Galois ring with $r>1$. The two-sided principal ideal
$(x)=\\{0,x\\}$, where

$x=2^{r-1}(1+\omega+\dots+\omega^{m-1})(1+i+j+k)$ (16)

is the only minimal ideal of $\mathcal{H}(R)$.

Proof: This follows from a tedious extension of the proof of Theorem 3.10.

We have a specific case which will be useful in a later example.

###### Corollary 3.12

The normalized homogeneous weight on $\mathcal{H}(\mathbb{F}_{2})$ is given as
follows.

$w_{\textnormal{hom}}(x)=\begin{cases}0,&\text{if }x=0\\\ 2,&\text{if
}x=1+i+j+k\\\ 1,&\text{otherwise}\end{cases}$

###  3.2 Quaternion codes

Let $R=GR(p^{r},m)$ be a Galois ring and let $\mathcal{H}$ be a quaternion
ring over $R$. Let $B$ be a left $\mathcal{H}$-linear block code of length
$n$. We consider the map $\tau:\mathcal{H}\rightarrow R^{4}$ defined by

$\tau(x_{0}+x_{1}i+x_{2}j+x_{3}k)=(x_{0},x_{1},x_{2},x_{3})$ (17)

This map is a bijection and an additive homomorphism, and can be extended
coordinate-wise to $\mathcal{H}^{n}$. It can be shown that $\tau(B)$ is a
linear block code of length $4n$ over $R$. We equip $\tau(B)$ with a
homogeneous distance metric with respect to the weight $w_{\textnormal{hom}}$
in (7) whose average value is given in (8). Analogously, the right
$\mathcal{H}$-linear block code $B^{\prime}$ can be obtained with its
corresponding image $\tau(B^{\prime})$. However, even if the codes $B$ and
$B^{\prime}$ have the same generator matrix, $B$ and $B^{\prime}$, and
respectively $\tau(B)$ and $\tau(B^{\prime})$, are not necessarily equal
although they share the same distance properties.

The minimum Hamming weight of $B$ can be used to bound the minimum homogeneous
distance of $\tau(B)$, as the next proposition shows. The proof below is
analogous to that in [11].

###### Proposition 3.13

Let $R=GR(p^{r},m)$ be a Galois ring and let $\mathcal{H}$ be a quaternion
ring over $R$. Let $B$ be a left $\mathcal{H}$-linear block code of length $n$
with minimum Hamming distance $d$, and $\tau(B)$ be the corresponding image
code. Let $\delta$ denote the minimum homogeneous distance of $\tau(B)$ with
respect to the homogeneous weight $w_{\textnormal{hom}}$. Then we have the
bounds

$\Gamma d\leq\delta\leq p^{m(r-1)}4d.$ (18)

Furthermore, let $\widetilde{\delta}$ be the minimum normalized homogeneous
distance of $\tau(B)$ with respect to the normalized weight
$\widetilde{w}_{\textnormal{hom}}$. Then we have the bounds

$d\leq\widetilde{\delta}\leq\dfrac{p^{m}}{p^{m}-1}4d.$ (19)

Proof: As $\Gamma$ is the minimum nonzero value of $w_{\textnormal{hom}}$,
then $\Gamma d\leq\delta$. Furthermore, the minimum homogeneous distance
$\delta$ is bounded above by $p^{m(r-1)}4n$. We have $\delta\leq
w_{\textnormal{hom}}(\tau(x))$ for all $x\in B\setminus\\{0\\}$. Thus if $x$
is a codeword in $B$ of weight $d$, we then have $\delta\leq p^{m(r-1)}4d$.
The second bound follows immediately. $\Box$

Let the minimum Hamming distance of $\tau(B)$ be denoted by $d_{\tau(B)}$. We
say that $\tau(B)$ is Type $\alpha$ if

$\delta=p^{m(r-1)}d_{\tau(B)}.$ (20)

In particular, when $r=1$, the equality in (20) reduces to
$\delta=d_{\tau(B)}$, and when $m=1$, we have $\delta=p^{r-1}d_{\tau(B)}$ so
that $\delta=2d_{\tau(B)}$ for codes over $\mathcal{H}(\mathbb{Z}_{4})$.

###  3.3 New examples

A Fortran algorithm is written to verify the minimum distance of rate-$2/6$
codes. Note that this output is highly specific. However, the algorithm can be
generalized to codes of any rate as desired and any number of variables in the
generator matrix, at the cost of program runtime.

The algorithm first builds the quaternion ring, then iterates values for
$x,y,z$ and builds a code for each iteration while computing for the weight of
each codeword. It takes the minimum weight which corresponds to the minimum
distance. Note that the codes are generally not two-sided.

Example 1. The left linear 3-quasi-cyclic rate-$2/6$ quaternion block code $B$
over $\mathcal{H}(\mathbb{F}_{3})$ is a free code with generator matrix

$\begin{pmatrix}1&1&i&i&1+i&1+i\\\ i&1+i&1+i&1&1&i\end{pmatrix}.$ (21)

The code $B$ has 6561 codewords and minimum Hamming distance $d=5$. Its
Hamming weight enumerator is given below.

$W(x,y)=x^{6}+480xy^{5}+6080y^{6}$ (22)

The Hamming distance $d$ meets the Singleton upper bound as given in (10) and
therefore code $B$ is a maximum distance separable code. The code has minimum
normalized homogeneous distance $75/16$. Its image $\tau(B)$ is a linear block
code over $\mathbb{F}_{3}$ of length $24$. Its minimum homogeneous distance
$\delta$ is the same as its Hamming distance $d_{\tau(B)}$ which is $6$, and
therefore by (20), the code trivially is Type $\alpha$. Furthermore, the right
linear 3-quasi-cyclic rate-$2/6$ quaternion block code with the above
generator matrix has exactly the same distance properties. However, the two
codes are not equal. For example, the codeword
$\begin{pmatrix}1+2k&1+j+2k&i+j+2k&i+j&1+i+j&1+i+2k\end{pmatrix}$ belongs to
the left linear code but not to the right linear code. The image codes are
also not equal.

Example 2. The 3-quasi-cyclic rate-$2/6$ quaternion block code $B$ over
$\mathcal{H}(\mathbb{F}_{2})$ is a free code with generator matrix

$\begin{pmatrix}1&1&i&i&1+j&1+j\\\ i&1+j&1+j&1&1&i\end{pmatrix}.$ (23)

The code $B$ has 256 codewords, minimum Hamming distance $d=4$ and minimum
normalized homogeneous distance $4$. The code is nearly optimal with respect
to (10). Necessarily, the minimum homogeneous distance cannot be less than the
minimum Hamming distance because they only differ at multiples of $1+i+j+k$.
The code is two-sided since $\mathbb{F}_{2}$ has characteristic $2$ and hence
$\mathcal{H}(\mathbb{F}_{2})$ is commutative. Its image $\tau(B)$ is a linear
block code over $\mathbb{F}_{2}$ of length $24$. Its minimum homogeneous
distance $\delta$ is the same as its Hamming distance $d_{\tau(B)}$ which is
$8$, and therefore by (20), the code trivially is Type $\alpha$.

Example 3. The left linear 3-quasi-cyclic rate-$2/6$ quaternion block code $B$
over $\mathcal{H}(\mathbb{Z}_{4})$ is a free code with generator matrix

$\begin{pmatrix}1&1&2&2&1+4i&1+4i\\\ 2&1+4i&1+4i&1&1&2\end{pmatrix}.$ (24)

The code $B$ has 65536 codewords, minimum Hamming distance $d=4$ and minimum
normalized homogeneous distance $4$. The code is nearly optimal with respect
to (10). Its image $\tau(B)$ is a linear block code over $\mathbb{Z}_{4}$ of
length $24$. Its minimum homogeneous distance $\delta$ is the same as its
Hamming distance $d_{\tau(B)}$ which is $8$. Furthermore, the right linear
3-quasi-cyclic rate-$2/6$ quaternion block code with the above generator
matrix has exactly the same distance properties. However, the two codes are
not equal. The image codes are also not equal.

##  4 Conclusion and recommendations

This paper dealt with one-sided linear block codes over non-commutative finite
rings, in particular, the quaternion rings. By a suitable bijective map, these
codes can be seen as linear block codes over finite commutative rings,
specifically, the Galois rings. Furthermore, we have extended the notion of
homogeneous weight to the quaternions and established certain bounds involving
this weight, giving rise to good codes. It is also interesting to view a set
of quaternions as a matrix code, and via lifting, to construct other
quaternion codes that form a class similar to subspace codes in which an
appropriate subspace metric can be applied. The authors recommend a more
extensive review of the lattice structure of the quaternions over
$GR(2^{r},m)$ and the construction of other one-sided quaternion codes, in
particular, over $GR(4,2)$. Finally, it is interesting to consider the
equivalence between the left linear quaternion code and the right linear
quaternion code and their corresponding image codes.

##  5 Acknowledgement

The authors gratefully acknowledge the members of the IMSP Coding Theory and
Cryptography Research Cluster for helpful discussions.

## References

  * [1] Lee G. and Oshiro K., “Quaternion rings and octonion rings,” Front. Math. China, vol. 12, pp. 143-155, 2017.
  * [2] Miguel C. and Serodio R., “On the structure of quaternion rings over $\mathbb{Z}_{p}$,” Int. J. Algebra, vol. 5, pp. 1313-1325, 2011.
  * [3] Corro E. C., Lampos J. M., Palines H., Sison V., “Orbit codes over $M_{2}(\mathbb{F}_{q})$ and their homogeneous distance,” J. Phys.: Conf., 2018.
  * [4] Grau J. M., Miguel C., Oller-Marcen A., “On the structure of quaternion rings over $\mathbb{Z}/n\mathbb{Z}$,” Adv. Appl. Clifford Algebras, vol. 25, pp. 875-887, 2014.
  * [5] Dickson L. E., “On quaternions and their generalization and the history of the eight square theorem,” Annals of Mathematics, vol. 20, pp. 155-171, 1919.
  * [6] Honold T., “A characterization of finite Frobenius rings,” Arch. Math. (Basel), vol. 76, pp. 406-415, 2001.
  * [7] Wood J., “Duality for modules over finite rings and applications to coding theory,” Amer. J. Math., vol. 121, pp. 555-575, 1999.
  * [8] Greferath M. and Schmidt S. E., “Finite-ring combinatorics and MacWilliams’ equivalence theorem,” J. Combin. Theory Ser. A, vol. 92, pp. 17-28, 2000.
  * [9] Greferath M. and Schmidt S. E., “Gray isometries for finite chain rings and a nonlinear ternary $(36,3^{12},15)$ code,” IEEE Trans. Inf. Theory, vol. 45, pp. 2522-2524, 2001.
  * [10] MacWilliams F. J. and Sloane S. J. A., “The theory of error-correcting codes,” North-Holland, Amsterdam, 1977.
  * [11] Sole P. and Sison V., “Bounds on the minimum homogeneous distance of the $p^{r}$-ary image of linear block codes over the Galois ring $GR(p^{r},m)$,” IEEE Trans. Inf. Theory, vol. 53, pp. 2270-2273, 2007.
  * [12] Greferath M. and O’Sullivan M. E., “On bounds for codes over Frobenius rings under homogeneous weights,” Discr. Math., vol. 289, pp. 11-24, 2004.
  * [13] Guenda K. and Gulliver T. A., “MDS and self-dual codes over rings,” Finite Fields and Their Applications, vol. 18, pp.1061-1075, 2012.
  * [14] Hungerford T. W., Algebra (Graduate text in mathematics), vol. 73, New York: Springer-Verlag, 1974.