Codes Over The P-Adic Integers
Codes Over The P-Adic Integers
Codes Over The P-Adic Integers
Received March 23, 2004; Revised May 16, 2005; Accepted May 26, 2005
Abstract. We study codes over the p-adic integers and correct errors in the existing literature. We
show that MDS codes exist over the p-adics for all lengths, ranks and p. We show that self-dual
codes exist over the 2-adics if and only if the length is a multiple of 8 and that self-dual codes exist
over the p-adics with p odd if and only if the length is 0 (mod 4) for p ≡ 3 (mod 4) and 0 (mod 2)
for p ≡ 1 (mod 4).
1. Introduction
Codes over rings have received a good deal of attention since the landmark
paper [6]. Generally, the rings have been finite and have been either Zk or alge-
braic extensions of these rings. Interesting results have been obtained study-
ing the relationship of these codes to codes over fields and to lattices. In [1],
prompted by Solé [9], codes over the p-adics were introduced and numerous
interesting examples of codes were given. Specifically, they studied modular and
cyclic codes over these rings. In this work we shall consider other codes over
these infinite rings and study their relation to codes over the finite rings Zpe .
Additionally, we shall correct some errors that exist in [1].
A different approach could be taken with respect to the results in the paper.
Specifically, we would view the p-adic integers as the valuation ring of a field
and consider the quadratic form x1 y1 + x2 y2 + · · · + nn yn over the p-adics. Cer-
tainly more general versions of some of the theorems could be obtained using
this technique. We follow the approach in the paper to be in line with the gen-
eral techniques of coding theory and to produce proofs using only elementary
techniques whenever possible.
We begin with some necessary definitions. Each element in the finite ring Zpe
can be written as the finite sum
*Corresponding author.
66 DOUGHERTY AND PARK
e−1
ai p i = a0 + a1 p + a2 p 2 + a3 p 3 + · · · + ae−1 p e−1 , (1)
i=0
where 0 ≤ ai < p. Similarly a p-adic integer in the infinite ring Zp∞ can be writ-
ten as the infinite sum
∞
ai p i = a0 + a1 p + a2 p 2 + a3 p 3 + · · · , (2)
i=0
where 0 ≤ ai < p. The ring Zp∞ is an integral domain and the units in the ring
are those elements with a0 = 0. The ring is contained in the field of p-adic num-
bers which are contained in the field of complex numbers.
We shall use the notation Zpe to mean either the finite ring or the infinite
ring of p-adic integers. A code of length n over Zpe is a subset of Znpe and a
code is linear if it is a submodule of the ambient space. It is assumed through-
out that all codes are linear unless otherwise stated. The Hamming weight of a
vector is the number of non-zero coordinates in that vector and the minimum
weight of a code is the smallest weight of all non-zero vectors in the code.
We attach the usual inner product to the space Znpe , specifically
[v, w] = vi wi . (3)
The dual code C ⊥ = {v | [v, w] = 0 for all w ∈ C}. The dual code C ⊥ is always
linear, and if C is linear and e is finite, then (C ⊥ )⊥ = C. The latter is not nec-
essarily true when e is infinite as is shown later.
Define the following map pe : Zp∞ → Zpe by
∞
e−1
pe ai p i
= ai p i . (4)
i=0 i=0
This function is the analog of the modulo map for the regular integers. Note
that an element in Zpe is mapped to by infinitely many elements via this map.
∞ ∞
Lemma 1.1. If a = i=0 ai p
i and b = i=0 bi p
i then
and
The following result and definition are given in [1]. Let {m0 , m1 , m2 , . . . , mr }
be a set of integers arranged so that mi < mj for i < j . Any code over Zp∞ has
a generator matrix of the form:
⎛ ⎞
pm0 Ik0 p m0 A0,1 p m0 A0,2 p m0 A0,3 ··· ··· p m0 A0,r+1
⎜ 0 pm1 Ik1 p m1 A1,2 p m1 A1,3 ··· ··· p m1 A1,r+1 ⎟
⎜ ⎟
⎜ . .. .. .. .. .. .. ⎟, (5)
⎝ .. . . . . . . ⎠
0 0 0 ··· 0 pmr Ikr p mr Ar,r+1
where Iki is the identity matrix of size ki . A code of this form is said to be of
type
These statement are not correct. We shall correct them in the following propo-
sitions.
Proposition 1.3. The linear code satisfies C = (C ⊥ )⊥ if and only if C has type
1k for some k.
Proof. If C is a linear code then C ⊥ is linear and has type 1n−k and then
(C ⊥ )⊥ has type 1k .
The example of codes given in [1] were all of the type 1k and hence these
errors did not cause errors in further results.
Any code over Zpe with e finite is permutation-equivalent to a code with gen-
erator matrix of the form
⎛ ⎞
Ik0 A0,1 A0,2 A0,3 · · · ··· A0,e
⎜ 0 pI pA pA1,e ⎟
⎜ k1 1,2 pA1,3 · · · ··· ⎟
⎜ . ⎟
⎜ . ⎟
⎜ . 0 p 2 Ik2 p 2 A2,3 · · · ··· p 2 A2,e ⎟
⎜ . ⎟, (7)
⎜ . .. .. .. .. ⎟
⎜ . . 0 . . . ⎟
⎜ ⎟
⎜ .. .. .. .. .. .. .. ⎟
⎝ . . . . . . . ⎠
0 0 0 ··· 0 p e−1 Ike−1 p e−1 Ae−1,e
68 DOUGHERTY AND PARK
where the columns are grouped into blocks of sizes k0 , k1 , . . . , ke−1 , where each
ki is a non-negative integer.
A code
e of this form to be of type {1k0 , pk1 , (p2 )k2 , . . . , (p (e−1) )ke−1
eis saide−j } and
pe kj
it has j =0 ( pj ) = j =0 (p )kj codewords. The rank of the code is ki . A
k
code with type 1 for some k is said to be a free code.
Often in coding theory a code is defined by its parity check matrix, namely
for a given matrix H , we define a code C by
C = {v | H v T = 0}.
Specifically, C contains precisely those vectors that have inner product 0 with
every row of H . In this case, we see that C is defined as the orthogonal to the
code generated by H and then has type 1k for some k. In this respect these
codes are unlike codes over finite fields in that the form of H did not effect the
type of the code C.
Given a generator matrix M = (Mij ) for a code C over the p-adic integers we
form a generator matrix pe (M) = ((Mij )) for a code over Zpe .
Proposition 1.4. Let C be a code over the p-adic integers Zp∞ of type
{pm0 k0 , pm1 k1 , p m2 k2 , . . . , p mr−1 kr−1 }
with generator matrix M. Then the code generated by pe (M) is a code over Zpe
of type {p m0 k0 , p m1 k1 , p m2 k2 , . . . , p ms−1 ks−1 } where s is the largest mi that is less
than e. Moreover, the code generated by pe (M) is equal to
{(pe (c1 ), pe (c2 ), . . . , pe (cn )) | (c1 , c2 , . . . , cn ) ∈ C}. (8)
2. MDS Codes
In [1], the Singleton bound is generalized to codes over Zp∞ by showing that
for a code of length n, rank k, and minimum weight d we have
d ≤ n − k + 1. (9)
In [1], they define a Maximum Distance Separable (MDS) code over Zp∞ to
be a code meeting the bound in (9) or, equivalently, a code where every k col-
umns of the generator matrix are linearly independent. This definition is often
CODES OVER THE p-ADIC INTEGERS 69
given in the literature of MDS codes over finite fields as every n − k columns
of the parity check matrix are linearly independent. We shall change this defi-
nition slightly. If the code has the property that every k columns of the genera-
tor matrix are linearly independent then we shall say that the code is Maximum
Distance Separable with respect to Rank (MDR) and reserve the name MDS
for codes that are MDR and of type 1k , see [4] for similar definition for codes
over finite rings. The reason is that codes meeting this bound are not necessar-
ily as large as they could be with a given minimum weight. By this we mean
that there are vectors that can be added to the code and still maintain the
minimum weight. Hence the codes are not necessarily maximal. This definition
matches the definition for codes over finite rings. This means that if a code of
rank k over a ring satisfies d = n − k + 1 then the code is said to be MDR. If
the ring has cardinality r, then a code with d = n − logr (C) + 1 is said to be
MDS.
The next proposition illustrates the point.
Proof. The minimum weight of an ideal is 1 and the rank is 1, and thus 1 =
1 − 1 + 1 and hence the code is MDR.
Notice that even though the code is MDR, it is contained in the ring Zp∞
which itself is MDR (in fact it is MDS). So in this sense it is not maximal. As
usual the ambient space is an MDS code, since the minimum weight is 1 and
the rank is equal to the length.
If C is an ideal in Zp∞ then C ⊥ = {0}, since Zp∞ is an integral domain. So
unlike for finite rings the orthogonal of a rank 1 code of length 1 cannot have
non-trivial rank.
Proof. The minimum distance is n which is the length and the rank is 1 and
hence meets the bound in (9). If the ideal generated by α is the ring then the
generator can be written as (1, 1, 1, . . . , 1).
The MDS codes given in [1] are all of the type 1k so that they satisfy the
modified definition.
Notice that for codes over finite rings we can only prove that the orthogo-
nal is MDR. In the case for the p-adics we have that the orthogonal is actually
MDS. Notice that we are using the fact that the ring sits inside a field when we
assert that the rank must be n − k.
has length n, rank n − 1, and minimum weight 2 for any α and hence is MDR.
If α is a unit then it is MDS. The orthogonal to this code is generated by the
all 1 vector and is MDS.
In [1], they show that the lifted length 7 Hamming code with a parity check
is an [8, 4, 5] code and thus MDS. So there can exist MDS codes over the
2-adics for parameters where they do not exist for the binary field.
We notice that if C is an MDS code over Zpe then any lift of this code over
Zpk with k > e (including k = ∞) is also an MDS code. If C is an MDR code
then e (C) is not necessarily an MDR code since some of the coordinates may
be sent to 0. However if the code C is MDS over Zpe then k (C) with k < e
is an MDS code. But it is not true for MDS codes over Zp∞ . For example, the
Hamming [8, 4, 5] code over the 2-adics is MDS but its projections to Z2k are
not since they all have minimum weight 4.
We shall see that MDS codes are abundant for the p-adics which of course
does not mean they are abundant over finite rings. For example, there are no
non-trivial MDS binary codes, yet there are MDS 2-adic codes for all lengths
and ranks.
Lemma 2.5. For any n and k there exists an (n − k) by n matrix over Zp∞ such
that all (n − k) by (n − k) submatrices have non-zero determinants.
CODES OVER THE p-ADIC INTEGERS 71
Theorem 2.6. MDS codes exist over the p-adics for all n and k with k ≤ n.
Proof. Take the matrix in (11) as the parity-check matrix for C. Then C has
length n and rank k and the minimum weight must be at least n − k + 1 which
is optimal by (9). Moreover the code C has type 1k since it is described as the
orthogonal to the code generated by H .
Of course, there are MDS codes other than those formed in the previous the-
orem. Most of these codes however are lifts of codes that are not MDS over
finite rings.
3. Self-Dual Codes
Self-dual codes have been widely studied over finite rings, see [8] and the refer-
ences therein for a complete description. In this section, we shall examine which
parameters allow for self-dual codes.
A code over Zpe is said to be self-dual if C = C ⊥ and is said to be self-orthog-
onal if C ⊆ C ⊥ .
Unlike Zp2 there are no self-dual codes of length 1 over Zp∞ since Zp∞ is an
integral domain and hence there is no vector v of length 1 with [v, v] = v1 v1 = 0.
Lemma 3.1. Let C be a self-orthogonal code over Zp∞ . The code pe (C) is a
self-orthogonal code over Zpe .
Proof. If [v, w] = 0 for all v, w ∈ C then v i wi ≡ pe (vi )pe (wi ) (mod p e ) ≡
0 (mod pe ).
Unlike the case for finite rings the type of self-dual codes is very restricted.
We illustrate it in the following theorem.
n
Theorem 3.2. If C is a self-dual code of length n over Zp∞ then C has type 1 2 .
Theorem 3.3. If C is a self-dual code of length n over Zp∞ then pe (C) is a
self-dual code of length n for all finite e.
Proof. We know that C has type 1n/2 by Theorem 3.2. By Proposition 1.4 the
code pe (C) has free rank n/2 and so has (p e )n/2 elements and by Lemma 3.1
pe (C) is self-orthogonal. These facts give that the code is self-dual.
Of course, a maximal self-orthogonal code can have its image under pe
which is not self-dual since it may send part of the code C to 0. A similar thing
can happen for the finite case. For example the code {0, 2} is a self-dual code
of length 1 over Z4 , however reading its elements (mod 2) we only have {0}
which is not self-dual.
Proof. From Theorem 3.3 we have that p (C) is a self-dual code over the field
Zp and it is well known self-dual codes exists over Zp only for even lengths
when p ≡ 1 (mod 4) and for lengths that are 0 (mod 4) when p ≡ 3 (mod 4) (see
[8] for proofs of these statements).
Theorem 3.5. A maximal self-orthogonal code of rank 1n/2 and length n exists
over Zp∞ if and only if a self-dual code of length n exists over Zp∞ .
Proof. If
⎛ ⎞
Ik0 A0,1 A0,2 A0,3 ··· ··· A0,e
⎜ 0 pI pA ··· ··· ⎟
⎜ k1 1,2 pA1,3 pA1,e ⎟
⎜ . ⎟
⎜ . ⎟
⎜ . 0 p 2 Ik2 p 2 A2,3 ··· ··· p 2 A2,e ⎟
⎜ . ⎟ (12)
⎜ . .. .. .. .. ⎟
⎜ . . 0 . . . ⎟
⎜ ⎟
⎜ .. .
.. .
.. .. .. .. .. ⎟
⎝ . . . . . ⎠
0 0 0 ··· e−1 e−1
0 p Ike−1 p Ae−1,e
⎛ ⎞
Ik0 A0,1 A0,2 A0,3 · · · · · ·A0,e
⎜ 0 I A1,2 A1,3 · · · · · ·A1,e ⎟
⎜ k1 ⎟
⎜ . ⎟
⎜ . ⎟
⎜ . 0 Ik2 A2,3 · · · · · · A2,e ⎟
⎜ . .. ⎟ (13)
⎜ . .. .. .. ⎟
⎜ . . 0 . . . ⎟
⎜ ⎟
⎜ .. .. .. . . . . . . .. ⎟
⎝ . . . . . . . ⎠
0 0 0 · · · 0 Ike−1 Ae−1,e
generates a self-dual code since [ps v, p r w] = 0 ⇐⇒ ps p r [v, w] = 0 because Zp∞
is an integral domain. For the other direction simply multiply any row of the
generator matrix of a self-dual code by some p e .
We shall show constructions of self-dual codes for odd primes. We require two
technical lemmas first.
Lemma 3.6. Let p be an odd prime. If there exists x = e−1
i=0 ai p ∈ Zp with x =
i e 2
e
−1 then there exists x = i=0 bi p ∈ Zpe+1 with (x ) = −1 and ai = bi for i with
i 2
0 ≤ i ≤ e − 1.
Proof. Let x = e−1 i=0 ai p ∈ Zp with x = −1. Consider the element x = x +
i e 2
ae p in Zpe+1 . Take
e
Since p is odd then two is relatively prime to p and is a unit. Also x 2 ≡ a02 ≡ −1
(mod p) and hence a0 is a unit in Zp .
−r
Set ae = 2a0
. Then 0 ≤ ae ≤ p − 1 and (x + ae p e )2 ≡ −1 (mod p e+1 ) and we
have a square root of −1 in Zpe+1 .
Note that this proof fails for p = 2, in fact 12 = −1 in Z2 , yet there is no
square root of −1 in Z4 .
Proof. The result in Lemma 3.7 can be obtained by a lemma of Hensel [10].
The lemma states that if f (x) ∈ Zp [x], with f (α1 ) ≡ 0 (mod p) and f (α1 ) ≡
0 (mod p) then there exists α ∈ Zp∞ such that α ≡ α1 (mod p) and f (α) ≡
0. However, we retain the following constructive proof to show the generator
matrix of the code and the generator matrix of the entire family of self-dual
codes. Specifically, if αpe is the square root of −1 in Zpe for 1 ≤ e ≤ ∞ then
(1, αpe ) generates the self-dual code of length 2 over Zpe in this infinite fam-
ily of codes. Note also that the lemma of Hensel does not apply to the binary
case since the derivative is 2x which is 0 in Z2 [x].
thati if p ≡ 1(mod
The constructive proof is as follows. It is well known 4)
then there exists a square root of −1 in Zp . Let x = ∞ a
i=0 i p where e−1
a
i=0 i p i
is the solution to x = −1 in Zpe . We know from Lemma 3.6 that such solutions
2
exist and that there is a sequence of such solutions with identical ai with small
enough indices. This x satisfies x 2 = −1 in Zp∞ .
Theorem 3.8. If p ≡ 1 (mod 4) then there exist self-dual codes for all even
lengths over Zp∞ .
Proof. Let α be the solution to x 2 = −1 in Lemma 3.7. Then the code gener-
ated by (1, α) is a self-dual code of length 2. The direct product of this code
with itself gives self-dual codes of all even lengths.
These codes produce an infinite family of self-dual codes over Zpe . That is, for
each e > 1pe (⊗ki=1 (1, α)) generates a self-dual code of length 2k over Zpe .
Lemma 3.9. Let p be an odd prime. If there exists x = e−1 i=0 ai p ∈ Zp and y =
i e
e−1 i ∈ Z e with x 2 + y 2 = −1 then there exists x =
e i ∈Z
i=0
b i p p c
i=0 i p pe+1 and y =
e
i=0 di p ∈ Zpe+1 with (x ) + (y ) = −1 and ai = ci , bi = di for i with 0 ≤ i ≤ e − 1.
i 2 2
e−1
Proof. Let x = e−1i=0 ai p ∈ Zp and y =
i e
i=0 bi p ∈ Zp with x + y = −1.
i e 2 2
Consider the elements x = x + ae p and y = y + 0p . Then take
e e
−r
Then ae = 2a0
as before.
Proof. Identical to the proof of Lemma 3.7 except we use Lemma 3.9 instead
of Lemma 3.6.
Theorem 3.11. If p ≡ 3 (mod 4) then there exist self-dual codes for all lengths
congruent to 0 (mod 4) over Zp∞ .
is a self-dual code of length 4. The direct product of this code with itself gives
self-dual codes of all lengths congruent to 0 (mod 4).
Again the codes formed in this theorem all generate an infinite family of
self-dual codes.
These results give the following.
Theorem 3.12. Self-dual codes exist over Zp∞ if and only if n ≡ 0 (mod 4) for
p ≡ 3 (mod 4) and n ≡ 0 (mod 2) for p ≡ 1 (mod 4).
The case for p = 2 is significantly different from the case where the prime is
odd. We now examine this case. We first need to define Euclidean weight. For
any element α ∈ Z2r its Euclidean weight is
The Euclidean weight of a vector is simply the sum of the Euclidean weights of
its coordinates. If r = 1 then the Euclidean weight coincides with the Hamming
weight.
Recall that a Type II code over Z2r is a self-dual code with the property that
the Euclidean weight of any vector in the code is 0 mod 2r+1 . Specifically, this
means that if v is in a Type II code then reading the coordinates as elements in
Z we have Euc(vi ) ≡ 0 (mod 2r+1 ). A vector with this property is said to be
a doubly-even vector. Notice that for binary codes this means that the Ham-
ming weight of any vector is 0 mod 4, which explains why such vectors bear
this name.
76 DOUGHERTY AND PARK
A Type II code over Z2r produces a Type II unimodular lattice via Con-
struction A, see [8] for a complete description. It is well known that Type II
unimodular lattices exist only when the length of the lattice is a multiple of 8.
This gives the following well known lemma.
Lemma 3.13. If there exists a Type II code of length n over Z2r then n ≡ 0
(mod 8).
Lemma 3.14. If v = (vi ) is a self-orthogonal vector in Zn2∞ , then 2r (v) is a dou-
bly-even vector in Zn2r .
Theorem 3.15. If there exists a self-dual code of length n over Z2∞ then n ≡ 0
(mod 8).
Proof. By Theorem 3.3 we know that 2 (C) is a self-dual code. By Lemma 3.14
we known that each vector is doubly-even and so it is a Type II code. Hence we
have that the length must be a multiple of 8.
In [1], they show that the code formed by lifting the [7, 4, 3] Hamming code
to the 2-adics and adding a parity check is a self-dual code of length 8. This
give the following:
Theorem 3.16. Self-dual codes exist for all n ≡ 0 (mod 8) over Z2∞ .
We summarize the case for self-dual codes over Z2∞ in the following
corollary.
Corollary 3.17. Self-dual codes exist over Z2∞ if and only if the length is a
multiple of 8.
This case is significantly different from the case for odd primes since for odd
primes if a self-dual code exists over Fp then it exists over the p-adics. However,
CODES OVER THE p-ADIC INTEGERS 77
for p = 2 self-dual codes exists for all even lengths but only for lengths a mul-
tiple of eight over the 2-adics.
Proof. Take the generator matrix given in (7). Then for all k with k > e we
have that k (C) is a Type II code.
In this section we shall investigate which self-dual codes lift to self-dual codes
over larger rings and to self-dual codes over the p-adics. The weight enumera-
tors of lifts of the length 8 Hamming code, the length 24 Binary Golay code,
and the length 12 ternary Golay code were described in [3].
It is shown in [8] that a binary self-dual code lifts to a self-dual code over
Z4 if and only if it is Type II. It further shows that these codes can be chosen
to be Type II as well. They further assert that this lifting can be extended to
the 2-adics. The proof given in Theorem 3 of [8] is easily generalized by sim-
ply replacing 2 with 2e and 4 with 2e+1 so that a Type II code over Z2e can be
lifted to a Type II code over Z2e+1 . This gives us the following result.
Theorem 3.19. A self-dual code over Z2e lifts to a code over Z2r for all r > e
(including ∞) if and only if C is Type II.
Proof. If a code C e over Z2e has a lift to a code C e+1 over Z2e+1 then by
Lemma 3.14 we know that the code must be a Type II code. The discussion
before the theorem gives the other direction.
Theorem 3.20. For p = 2, any self-dual code C over Zp lifts to a self-dual code
over p-adics.
I + Ae Ate = p e Se .
78 DOUGHERTY AND PARK
and
Since we have already proven when a code over Zpi lifts we have the follow-
ing theorem.
80 DOUGHERTY AND PARK
Proof. Follows from the previous lemma and the fact that all self-dual codes
over Zpi lift when p is odd and only Type II codes lift over Z2e .
References
1. A. R. Calderbank and N. J. A. Sloane, Modular and p-adic cyclic codes, Designs, Codes and
Cryptography, Vol. 6 (1995) pp. 21–35.
2. S. T. Dougherty, M. Harada and P. Solé, Self-dual codes over rings and the Chinese remainder
theorem, Hokkaido Math. J., Vol. 28 (1999) pp. 253–283.
3. S. T. Dougherty, S. Y. Kim and Y. H. Park, Lifted Codes and their Weight Enumerators,
Discrete mathematics, to appear.
4. S. T. Dougherty and K. Shiromoto, MDR Codes over Zk , IEEE Transactions on Information
Theory, Vol. 46, No. 1 (2000) pp. 265–269.
5. F. Q. Gouvêa, P -adic Numbers: An Introduction, Springer-Verlag, Berlin, New York (1993).
6. A. R. Hammons, Jr., P. V. Kumar, A. R. Calderbank, N. J. A. Sloane and P. Solé, The Z4 -line-
arity of Kerdock, Preparata, Goethals and related codes, IEEE Trans. Inform. Theory, Vol. IT-
40 (1994) pp. 301–319.
7. V. Pless, Introduction to the Theory of Error-Correcting Codes, Second Edition, Wiley, New
York (1989).
8. E. Rains and N. J. A. Sloane, Self-dual codes, In (V.S. Pless and W.C. Huffman, eds.), the
Handbook of Coding Theory, Elsevier, Amsterdam (1998) pp. 177–294.
9. P. Solé, Open problems 2: cyclic codes over rings and p-adic fields, In (G. Cohen and J.
Wolfmann eds.), Coding Theory and Applications, Lect. Notes Comp. Sci, 338, Springer-Verlag,
New York (1988) p. 329.
10. B. R. McDonald, Finite Rings with identity, Dekker, New York (1974).