Bounds on the Probability of Undetected Error for q-Ary Codes

We study the probability of an undetected error for general q-ary codes. We give upper and lower bounds on this quantity, by the Linear Programming and the Polynomial methods, as a function of the length, size, and minimum distance. Sharper bounds are obtained in the important special case of binary Hamming codes. Finally, several examples are given to illustrate the results of this paper.


Introduction
Let A = {a 1 , . . ., a q } be an alphabet with q distinct symbols, where q 2 and the alphabet do not have any structure.For instance, A can be F q , the finite field with q elements, or Z q , the ring of integers modulo q.Moreover, a linear [n, k] code is a subspace of the vector space F n q and k is the dimension of the subspace.For every two vectors x, y ∈ A n , the (Hamming) distance d H (x, y) between x and y is defined as the number of coordinates where they are different.A nonempty subset C of A n with cardinality M is called a q-ary (n, M) code, whose elements are called codewords.The minimum distance d of the code C is the minimum distance between any two different codewords in C. The distance distribution of C is defined as |{(x, y) : x, y ∈ C, d H (x, y) = i}|, i = 0, 1, . . ., n.
Assume that the code C is used for error detection on a discrete memoryless channel with q inputs and q outputs.Each symbol transmitted has a probability 1 − p of being received correctly and a probability p q = p/(q − 1) of being transformed into each of the q − 1 other symbols.It is natural to let 0 p (q − 1)/q.Such a channel model is called a q-ary symmetric channel qSC(p).When such a code is used on the symmetric q-ary channel qSC(p), errors occur with a probability p q−1 per symbol.Let x ∈ C be the codeword transmitted and y = x + e ∈ F n q be the vector received, where e = y − x is the error vector from the channel noise.Obviously, e ∈ C if and only if y ∈ C. Note that the decoder will accept y as error free if y ∈ C. Clearly, this decision is wrong, and such an error is not detected.Thus, when error detection is being used, the decoder will make a mistake and accept a codeword which is not the one transmitted if and only if the error vector is a nonzero codeword [1,2].In this way, the probability that the decoder fails to detect the existence of an error is called the probability of undetected error and denoted by P ue (C, p), which is defined as ( In general, the smaller the probability of undetected error P ue for some p, the better the code performs in error detection.However, this function is difficult to characterize in general.
As for the code C, comparing its P ue with the average probability P ue [3,4] for the ensemble of all q-ary linear [n, k] codes is a natural way to decide whether C is suitable for error detection or not, where According to [4], there exists a code C such that P ue (C, p) > q −(n−k) and there are many codes, the P ue of each of whom is smaller than q −(n−k) .In fact, it was commonly assumed that P ue (C, p) q −(n−k) for the linear [n, k] code C in [5], where q −(n−k) = q −r is called the q −r bound.The q −r bound is satisfied for certain specific codes, e.g., Hamming codes and binary perfect codes, when 0 < p < 1/2.
For the worst channel condition, i.e., when p = (q − 1)/q, From the above formula, a code C is called good if P ue (C, p) P ue ((q − 1)/q) for all 0 < p < (q − 1)/q.In particular, if P ue (C, p) is an increasing function of p in the interval [0, (q − 1)/q], then the code is good, and the code is called proper.There are many proper codes [1], for example, perfect codes (and their extended codes and their dual codes), primitive binary 2-error correcting BCH codes, a class of punctured of Simplex codes, MDS codes, and near MDS codes (see [5][6][7][8][9] for details).Moreover, for practical purposes, a good binary code C may be defined a bit different, i.e., P ue (C, p) cP ue (C, 1/2) for every 0 p 1/2 and a reasonably small c 1. Furthermore, an infinite class C of binary codes is called uniformly good if there exists a constant c such that for every 0 p 1/2 and C ∈ C, the inequality P ue (C, p) cP ue (C, 1/2) holds.Otherwise, it is called ugly, for example, some special Reed-Muller codes are ugly (see [10]).
Another way to assess the performance of a code for error detection is to give bounds of the probability of undetected error.In [11], Abdel-Ghaffar defined the combinatorial invariant F j of the code C and proved that Using combinatorial arguments, Abdel-Ghaffar [11] obtained a lower bound on the undetected error probability P ue (C, p).Later, Ashikhmin and Barg called F j the binomial moments of the distance function and derived more bounds for P ue (see [12,13]).
In particular, constant weight codes are attractive and many bounds are developed, for example, binary constant weight codes (see [14,15]) and q-ary constant weight codes (see [16]).In fact, the probability of an undetected error for binary constant weight codes has been studied and can be given explicitly (see [14,16]).
Note that when A = F q and p → 0, according to Equation (2), we have where p q = p/(q − 1), d is the minimum distance of C and A d is called the kissing number of the linear code C. In 2021, Solé et al. [17] studied the kissing number by Linear Programming and the Polynomial Method.They gave bounds for A d under different conditions and made tables for some special parameters.Motivated by the work, this paper is devoted to studying the function P ue using the same techniques.The rest of this paper is organized as follows.In Section 2, we briefly give the definition of the (dual) distance distribution of q-ary codes and give some trivial bounds of the probability of an undetected error.In Section 3.1, linear programming bounds are discussed.The applications of Krawtchouk polynomial (Polynomial Method) to error detection are given in Section 3.2.In Section 4, some bounds better than the 2 −m bound are given for binary Hamming codes.Finally, we end with some concluding remarks in Section 5.

Preliminaries
Recall some basic definitions and notations from [2,[18][19][20].Throughout this paper, to simplify some formulas, we let p q = p q−1 and k = log q |C| for some real k.Furthermore, in this paper, it is natural to define p < (q − 1)(1 − p), equivalently, p q < 1 − p.

Dual Distance Distribution
Assume that A = F q is the finite field of size q and C is a subspace of F n q , i.e., C is a linear code over F q .Then, the dual code C ⊥ of C is the orthogonal complement of the subspace C. That is to say, The distance distribution A i of C ⊥ can be determined similarly.It is well known (see Chapter 5. §2. in [2]) that where P i (j) denotes the Krawtchouk polynomial of degree i.For each integer q 2, the Krawtchouk polynomial P k (x; n) is defined as When there is no ambiguity for n, the function P k (x; n) is often simplified to P k (x).
Note that Equation (4) holds when C is linear.When C is nonlinear, the dual distance distribution A i is defined by Equation (4).Furthermore, by the MacWilliams-Delsarte inequality, holds for all i = 0, 1, • • • , n.Moreover, A 0 = 1 and

Probability of Undetected Error
The q-ary symmetric channel with symbol probability p, where 0 p (q − 1)/q, is defined as follows: symbols from some alphabet A with q elements are transmitted over the channel, and where P (b received | a sent) is the conditional probability that b is received, given that a is sent.For a q-ary code C, when it is used on such a channel, it is possible that the decoder fails to detect the existence of the errors.Thus, P ue , the function in terms of the weight distribution of C is given in Equation ( 2).Clearly, this is a difficult computational problem for large parameters n, k, d, and q (see [2]).Hence, it is better to give bounds for P ue .For example, here are some trivial bounds.
Theorem 1.For every q-ary code C with |C| = q k , if p < (q − 1)(1 − p), then where p q = p q−1 .Especially, when q = 2 and 0 < p < 1 2 , we have Proof.It is easy to check that p q j (1 The lower bound can be obtained similarly.
The above bounds are trivial.However, they are both tight, because simplex codes over the finite field F q attain these bounds.

Some Special Bounds
It is clear that the general bounds given by Theorem 1 will be much larger (or smaller) than the true value of P ue for a fixed code.If the distance distribution is known, one computes P ue (C, p) (as a function of p), and if we know some particular information about the distance distribution, then we may get some bounds.The following is a special case and more thoughts can be seen in Section 4.

Theorem 2. Let C be a binary code with A n = 1 and A
Moreover, when d t, we have where 0 < p < 1 2 and d t.
Proof.By the definition of P ue , Equation (7) Similarly for the case n = 2t.Hence, we get the bounds.Remark 1.If the binary code C satisfies A i = A n−i and A n = 0, we can get the following bounds: Here, 0, the all zero vector, may not be a codeword.
Example 1.For a binary linear code, if the all-one vector 1 is a codeword, then A i = A n−i .So, Theorem 2 can be applied to many codes, for example, Hamming codes.It is known that the binary The distance distribution of the [15,11,3] Hamming code H 4 is listed in Table 1.According to Theorem 2, the values of the bounds and true probability can be seen in Figure 1.

Universal Bounds for q-Ary Codes
In this section, we will discuss the bounds for P ue using different methods.These bounds are for general codes, thus they do not look so good.Meanwhile, compared with some known bounds, they do not perform better.However, it is the first as far as we know to give bounds for P ue using the following two methods, though they have been shown in [21,22] due to different thoughts.

Linear Programming Bounds
Consider the linear programming problem M(n, k, d, p) that maximizes the objective function n ∑ j=1 A j p q j (1 − p) n−j under the constraints: (1) Likewise, let m(n, k, d, p) be the minimization of the same objective function under the same constraints.Theorem 3. If C is a q-ary code of parameters (n, q k , d), then m(n, k, d, p) P ue M(n, k, d, p).
Proof.The objective function expression comes from (2).Constraint (1) is immediate by the definition of the distance distribution.Constraints (2) and (3) come from Equation (6) and Equation ( 5), respectively.Constraint (4) is a consequence of the definition of minimum distance.
Remark 2. Let f (x) and g(x) be two functions of x, then f g if f < g or f ∼ g, when x → 0, where 0 < x < 1.For example, let f (x) = x 2 + x and g(x) = x 3 + x, then f (x) > g(x) when 0 < x < 1.But f (x) ∼ g(x), then f (x) g(x) when 0 < x < 1 and x → 0. Motivated by Equation (3) and [17], we have the following result.Theorem 4. Let C be a q-ary [n, k, d] q linear code, then when p → 0, where L (resp.S) denotes the maximum (resp.minimum) of ∑ n j=d+1 A j subject to the 2n − d constraints Proof.It is clear that P ue (C, p) A d p q d (1 − p) n−d , then by [17], we get the left side of Equation (8).As for the right side, if A d < q k − 1 − S and p is small enough, then by Equation (3), Table 2 is a part of Table I in [17], which is helpful to give bounds for P ue .Example 2. Let C 1 be a binary [15,4,8] code, then As for the binary [12,4,6] code C 2 , we have Obviously, for any [n, k, d] code, one can give bounds for its P ue .
Remark 3. From the above discussion, it is clear that our bounds depend solely on the three parameters [n, k, d] of the code, and [n, k, d] is the minimal requirement to use a code in practice.

Polynomial Method
In this section, we will give some general bounds for P ue for any binary (n, 2 k , d) code.Recall the definition of the Krawtchouk polynomials and some properties.The following identity is a Polynomial Method of expressing the duality of LP.
Then we have the following identity Proof.Immediate by Equation ( 4), upon swapping the order of summation.
From now on, we denote the coefficient of Krawtchouk expansion of the polynomial f (x) of degree n by f j , j = 0, 1, • • • , n, i.e., f (x) = ∑ n j=0 f j P j (x).The first main result of this section is inspired by Theorem 1 in [23], and given as follows.
Theorem 5. Let β(x) and γ(x) be polynomials over Q such that β j 0, γ j 0 for j 1 and γ(i) p q i (1 − p) n−i β(i) for all i with A i = 0. Then we have the upper bound and the lower bound Proof.By Lemma 1, we have Returning to the definition of P ue and using the property of β(j) p q j (1 − p) n−j , we get The proof of the lower bound is analogous and ommitted.

Remark 4.
The above result is a special case of Proposition 5 in [22].More general setting of the linear programming bounds from Section 3 (Theorem 5) were already considered in [21,22].
The following are some properties of the Krawtchouk expansion, and we omit the proof, since they are not difficult.Lemma 2 ([24] Corollary 3.13).Let f (x) = ∑ n j=0 f j P j (x) and g(x) = ∑ n j=0 g j P j (x) be polynomials over Q, where f j 0, g j 0, 0 j n.Then the coefficients of the Krawtchouk expansion of λ f (x) + µg(x) are nonnegative, where λ, µ are nonnegative rational numbers.

Upper Bounds
For convenience, let δ i,j be the Kronecker symbol, i.e., Lemma 3.For general q, the coefficients of the Krawtchouk expansion of the following polynomial are all nonnegative if and only if i is odd, where 1 i n is an integer and 0! = 1.Moreover, g i (j) = δ i,j .
where d s n.Then, by Proposition 5.8.2 in [20], According to Lemma 2, the coefficients of the Krawtchouk expansion of (−1) i−1 g i (x) are all nonnegative.
Obviously, for any j = i, g i (j) = 0, because j is a root of g i (x).Moreover, which means g i (j) = δ i,j .Theorem 6.Let C be a binary code with the distance distribution A j , where A j = 0 for all possible odd j, then P ue where even i means that i runs through the even intergers between d and n.
Proof.According to Lemma 3, the coefficients of the Krawtchouk expansion of the following polynomial: Hence, f j 0, f (i) = p i (1 − p) n−i for even i and f (i) = 0 for odd i.By the proof of Theorem 5, where and Thus, the upper bound follows from Theorem 5.

Remark 5.
If C is linear, then A i is the number of codewords of weight i, which implies that A i ( n i ).Hence, where I = {i|A i = 0}.Moreover, if A i = 0 for all odd i, then Example 3. Consider the Nordstrom-Robinson code, it is a binary nonlinear code with the distance distribution in Table 3.Moreover, the weight distribution is the same as the distance distribution.By Equation (2), According to Theorem 6, the values of the upper bound and true probability can be seen in Figure 2.  Example 4. Let E be the set of binary vectors of length n and even weight, then it is actually the Reed-Muller code RM(n − 1, n) in Problem 5 in [2] and is generated by all the binary vectors of weight 2. Hence, Remark 6.The bound is suitable for many codes, and thus it seems not good.In fact, there exists some code C, whose P ue is very large.
Motivated by [17], we have the following upper bounds for linear codes over F 2 .
Proposition 1.When C is a q-ary linear [n, k, d] code and p is small enough, we have the following statements: (1) If n + 1 + qd − nq > 0, then Proof.These three bounds can be deduced easily by Equation ( 3) and Corollaries 4-6 in [17].
Remark 7. The results in Corollary 4-6 in [17] are actually the upper bounds of A d under different conditions.Considering Equation (3), it is necessary to make p small enough.According to the proof of Theorem 4, if A d does not meet such bounds, then "<" holds.

Lower Bounds
Similar to Proposition 1, by Corollaries 1-3 in [17], we have Proposition 2. If C is a q-ary linear code, then we have the following statements: (1) If d = (n − 1)(q − 1)/q , then When using quadratic polynomials, we have the following bound.
Proposition 3. Let f 0 , f 1 and f 2 be nonnegative rational numbers such that then, for a binary (n, 2 k , d) code, we have where 0 p 1 2 .
Proof.It is known that, when q = 2, P 0 (x) = 1, P 1 (x) = n − 2x and and then it is a quadratic function whose axis of symmetry is The result follows from Theorem 5.

Good Bounds for Hamming Codes
Recall that the weight enumerator of the code C is the homogeneous polynomial and the recurrence Moreover, Let α ∈ F 2 m be a primitive element and let g(x) ∈ F 2 [x] be the minimal polynomial of α with respect to F 2 .According to Exercise 7.20 in [20], g(x) can be regarded as the generator polynomial of a Hamming code.Since deg(g(x)) = m > 1, then g(x) x n − 1 which implies that the all-one vector is a codeword of the Hamming code and A n = 1.Note that Let y = ε = p 1−p , where p ∈ (0, 1/2), then According to Chapter 6, Exercise(E2), page 157 in [2], there are n − 4 nonzero weights of H m .Considering that A n = 1, we have A i = 0 if and only if i = 1, 2, n − 1, n − 2. Since 0 < p < 1/2, then 0 < ε < 1 and we have Similarly, Thus, Summarize the above discussions, we get Proof.Note that the upper bound should be larger or equal than the lower bound, then In fact, H is a polynomial of p whose degree n + 2 and the leading coefficient is That is to say, the lower bound and the upper bound are very close.On the other hand, Then, It is known that the Hamming codes satisfy the 2 −m bound when 0 < p < 1/2 i.e., P ue 2 −m .See [5] for more details.In fact, the obtained new bound is better than the ordinary 2 −m bound, when p is not large.Obviously, the inequality holds when p < p 0 , where is the smaller root of the equation (2 m+1 − 2)x 2 − (2 m + 5)x + 3 = 0.
Example 6.It is clear that when p is small enough, the new upper bound Equation ( 14) is smaller than the 2 −m bound in Figures 3 and 4.
Remark 9. Of course, the weight distribution of the binary Hamming codes can be computed and expressed by the sum of combinatorial numbers, which are usually very large when m is large.So, the method in this section is to estimate P ue quickly.Compared with the 2 −m bound, our bounds are better when p is small enough.

Figure 2 .
Figure 2. The Probability of Undetected Error of the Nordstrom-Robinson Code.
W C (x, y) = ∑ c∈C x n−wt(u) y wt(u) , where wt(u) means the Hamming weight the codeword u.The binary Hamming code H m is a [n = 2 m − 1, k = n − m, d = 3] code, with the weight enumerator

Table 1 .
Distance Distribution of the Hamming Code H 4 .
Figure 1.Bounds in Theorem 2 of P ue for the Hamming Code H 4 .

Table 2 .
Bounds of A d for Some Binary Codes.

Table 3 .
Distance Distribution of the Nordstrom-Robinson Code.
(15)e, m 3. The difference of the upper bound and the lower bound is small.Let U(n, p) = H 1 /H and L(n, p) = H 2 /H be the bound given by Equation(14)and Equation(15), respectively, where H 1