{'fraction_non_alphanumeric': 0.060729486064711, 'fraction_numerical': 0.011944533430964258, 'mean_word_length': 3.5763350785340315, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Error Correction for Cooperative Data Exchange

This paper considers the problem of error correction for a cooperative data exchange (CDE) system, where some clients are compromised or failed and send false messages. Assuming each client possesses a subset of the total messages, we analyze the error correction capability when every client is allowed to broadcast only one linearly-coded message. Our error correction capability bound determines the maximum number of clients that can be compromised or failed without jeopardizing the final decoding solution at each client. We show that deterministic, feasible linear codes exist that can achieve the derived bound. We also evaluate random linear codes, where the coding coefficients are drawn randomly, and then develop the probability for a client to withstand a certain number of compromised or failed peers and successfully deduce the complete message for any network size and any initial message distributions.


I. INTRODUCTION
The fundamental challenge of networks is to pull together all the available network resources and to arrange all the clients in efficient cooperation, such that they can collaboratively deliver a quality and trustworthy service. Cooperative data exchange (CDE) [1] among the clients has become a promising approach for achieving efficient data communications. In a CDE system, each client initially holds only a subset of packets, and is in quest for all the packets (from its peers). It is typical to assume that the clients communicate through (wireless) broadcast channels. The objective is to design a network coded transmission scheme that minimizes the total number of transmissions [1]- [3] or the total transmission cost [4]- [6], and at the same time, ensures all the clients can deduce the complete information.
Most of the existing studies on the CDE problem assume that the transmission from every client is reliable and trustworthy. However, in practice, there may exist compromised clients who intentionally send false messages 1 , or failed clients who send wrong readings. Such could cause decoding error or failure, and therefore motivates us to explore of error correction for the CDE problem. One example could be in W. Song is with the School of Mathematical Sciences, Peking University, China, and with Singapore University of Technology and Design, Singapore. E-mail: songwentu@gmail.com.
X. Wang was with Singapore University of Technology and Design, Singapore, and with School of Computer and Information, Hefei University of Technology, Hefei 230009, China. Email: wxiumin@hfut.edu.cn.
C. Yuen is with Singapore University of Technology and Design, Singapore. Email: yuenchau@sutd.edu.sg.
T. J. Li is with the department of electrical and computer engineering, Lehigh University, Bethlehem, PA 18015, USA. Email: jingli@ece.lehigh.edu.
R. Feng is with the School of Mathematical Sciences, Peking University, China. Email: fengrq@math.pku.edu.cn.
This research is partly supported by the International Design Center (grant no. IDG31100102 and IDD11100101). 1 For simplicity, we consider error-free transmission. A transmission error may be treated as an error-free transmission from a compromised client. a sensor network, when one sensor fails, how can we detect and correct the error through the readings of other sensors.
In the literature, several interesting works [7], [8] have studied the problem of network coding based error correction [9], [10], but these works cannot be applied in CDE. This is because the existing studies assume that there exists a single source node (sender) in possession of all the packets, whereas in the CDE problem, there exist multiple source nodes (senders), each equipped with only a subset of the packets.
Assuming that each client initially holds a subset of the messages, we investigate the error correction capability that a "fair and once" cooperative data exchange scheme can achieve, where "fair and once" means each client is allowed to broadcast exactly one packet. We say a CDE transmission scheme is a δ-error correction solution if it guarantees the correct recovery of the complete messages by all the clients, in the presence of up to δ comprised clients. The contributions of this paper include • Given initial message distribution, we derive the error correction capability for a linear-coded CDE problem, which specifies the maximum number of compromised clients the system can tolerate without jeopardizing ultimate integrity and accuracy of the message at each client. • We show that deterministic, feasible linear code designs exist to achieve the derived error correction capability. • Since deterministic coding schemes are inflexible and unscalable, we also investigate the case of random linear network coding. We derive the ensemble average probability for any client to correctly deduce all the messages despite the existence of certain compromised peers. The rest of this paper is organized as follows. Sec. II formulates the problem. Sec. III develops error correction for a general CDE problem. We discuss the performance of random network coding in Sec. IV, and conclude the paper in Sec. V.

II. PROBLEM DEFINITION AND SIGNAL MODEL
Consider a set of k packets X = {x 1 , x 2 , · · · , x k } to be delivered to n clients in R = {r 1 , r 2 , · · · , r n }, where each message x i is assumed to be an element of a finite field F. Suppose that initially, client r j ∈ R holds a subset of packets {x i } i∈Aj , and the clients collectively have all the packets in X, i.e., rj ∈R A j = {1, · · · , k}. To simplify the presentation, we use A j to denote the index set of the missing packets of client r j , i.e., A j = {1, · · · , k} \ A j , and use |A j | to denote the size of A j . Following the system model in [1], the clients will exchange packets over a common broadcast channel to assist each other to correctly obtain all of its missing packet(s). This problem, thereafter referred to as the cooperative data exchange problem, is denoted by the quaternary H = (k, n, X, X ), where X = {A 1 , · · · , A n }.
We assume that each client is permitted to use the common broadcast channel exactly once. There are n clients and each takes turn to broadcast. In the jth round, the client r j broadcasts an encoded packet y j which is an F-linear combination of the packets it initially has, i.e., y j = k i=1 a i,j x i , where a i,j ∈ F and a i,j = 0 if i ∈ A j . The matrix (a i,j ) k×n specifies a transmission scheme for the CDE problem H = (k, n, X, X ) and is called an encoding matrix of this problem.
We define the error correction problem for a general CDE problem H = (k, n, X, X ) as follows: Definition 1 The δ-error correction problem for the CDE problem H = (k, n, X, X ) is to find a transmission scheme such that each client r j can correctly recover all the packets in X, so long as there are no more than δ compromised clients.
and ξ i,j = 0 otherwise. The local incidence matrix of r j , denoted by C j , is defined as the sub-matrix of C, which only includes the row vectors with indices in A j . Remark 1 Clearly, an arbitrary encoding matrix is obtained by assigning a value in F to each ξ i,j in the incidence matrix, where F is the support field of encoding and decoding. Example 1 : Consider a CDE problem in which there are six messages x 1 , · · · , x 6 and six clients r 1 , · · · , r 6 , where each message x i is an element of the ternary field The local incidence matrix of the client r 1 is: Note that the elements in jth column of the local incidence matrix of client r j are all zero. This is because, the jth column vector denotes the encoding vector of the packet sent by itself, and the packets in {x i } i∈Aj are unknown to r j . Based on the above definition, we further define the following matrix. Definition 3 Let E = (a i,j ) k×n be an encoding matrix of the CDE problem H = (k, n, X, X ). The local receiving matrix of r j is defined as the sub-matrix of E, which includes the row vectors of E with indices in A j .

Example 2
Consider the CDE problem in Example 1, the communication is completed by six rounds: in the ith round, the clients r i broadcast y i to all other clients, where y 1 = 6 and y 6 = x 1 + 2x 5 + 2x 6 , which is specified by the following encoding matrix For r 1 , he will receive y 2 , y 3 , y 4 , y 5 , y 6 . Since r 1 knows x 1 , x 3 and x 6 , then he can compute 5 . So for r 1 , he has the equation (0, z 2 , z 3 , z 4 , z 5 , z 6 ) = (x 2 , x 4 , x 5 )E 1 and can uniquely solve the value of x 2 , x 4 , x 5 from z 2 , z 3 , z 4 , z 5 , z 6 , where E 1 is the local receiving matrix of the client r 1 is III. ERROR CORRECTION Given the initial information held by each client, in this section, we will first derive the error correction capability, δ, for the fair-and-once CDE problem H = (k, n, X, X ). We will demonstrate, in the next section, the tightness and achieveability of δ by demonstrating feasible code designs.
To simplify the presentation, we write the packet set X = {x 1 , · · · , x k } as a vector X = (x 1 , · · · , x k ). For any vector u, we let wt(u) denote the Hamming weight of u, i.e., wt(u) is the number of non-zero components in u. If C is a linear code of length n and dimension k, then C is referred to as an [n, k] linear code. Moreover, if C has a minimum distance d, then C is referred to as an [n, k, d] linear code.
For a CDE problem H = (k, n, X, X ), we define the information space of r j as follows: Definition 4 The information space of r j , denoted by V j , is defined as the set of all possible packets of X estimated by the client r j , i.e., Clearly, V j contains altogether |F| |Aj| vectors, corresponding to all the exhaustive trial decoding solutions, yet only one is the true and correct message solution. For example, in Example 1, the information space of r 1 is Since the client r j knows packets x i , ∀i ∈ A j , it must determine, from its received message vector Y = (y 1 , · · · , y n ), a candidate vectorX ∈ V j as its decoder output. Given a received vector Y ∈ F n , the minimum distance decoder of r j is a map D : F n → V j such that the decoder output D(Y ) where d H (·, ·) is the Hamming distance function. Lemma 1 A transmission scheme with the encoding matrix E is a δ-error correction solution of the CDE problem H = (k, n, X, X ) if and only if each local receiving matrix E j is a generating matrix of an [n, |A j |] linear code with minimum distance d ≥ 2δ + 1.
Proof: From the theory of classical error-correcting codes [13], for any client r j ∈ R, the transmission scheme can correct δ ′ ≤ δ errors if and only if for anyX,X ′ ∈ V j and X =X ′ , d H (XE,X ′ E) ≥ 2δ + 1, or, equivalently, Let where 0 k denotes all-zero row vector of length k. Note that XE −X ′ E = (X −X ′ )E. It is easy to see that U j = {X − X ′ ;X,X ′ ∈ V j andX =X ′ }, so Eq. (1) is equivalent to By the definition of E j and U j , Eq. (2) is equivalent to Eq. (3) means that E j is a generating matrix of an [n, |A j |] linear code with minimum weight at least 2δ + 1. Note that the minimum distance of a linear code equals to the minimum weight of it, and this proves Lemma 1. Lemma 1 shows an important relation between the errorcorrection capability of a transmission scheme and the minimum distance of the linear code generated by the corresponding local receiving matrices. The following lemma gives a method to determine the minimum distance of a linear code from its generating matrix.

Lemma 2 Suppose C is an [n, k] linear code and G is a generating matrix of C. Then the minimum distance of C is at least d if and only if any sub-matrix including
Proof: Let G 1 , · · · , G n be the n columns of G. Note that the minimum distance of a linear code equals to the minimum weight of it. The minimum distance of C is at least d if and only if the minimum weight of C is at least d. That is, for any X ∈ F k \ {0 k }, wt(XG) ≥ d. Clearly, this condition is equivalent to the following condition ( * ): For any X ∈ F k \ {0 k }, the vector XG has at most n − d zero elements.
For any {i 1 , · · · , i n−d+1 } ⊆ {1, · · · , n}, consider the system of linear equationŝ X(Gi 1 , · · · , Gi n−d+1 ) = 0 n−d+1 (4) whereX is a vector of k variables. Note that Eq. (4) are n − d + 1 equations. Then condition ( * ) holds if and only if for any X ∈ F k \ {0 k }, X is not a solution of Eq. (4), which means that Eq. (4) has only zero solution, i.e., only 0 k is the solution of it. By the knowledge of linear algebra, Eq. (4) has only zero solution if and only if the submatrix (G i1 , · · · , G i n−d+1 ) has rank k. Thus, the minimum distance of C is at least d if and only if any submatrix including n−d+1 columns of G has rank k. By remark 1, designing a δ-error correction solution of a CDE problem is equivalent to assign a value in F to each variable ξ i,j in the incidence matrix such that the resulted local receiving matrices satisfy the condition of Lemma 2 (for their own parameters). In the following, we focus on the incidence matrix of the CDE problem H = (k, n, X, X ).
We use F[ξ 1 , · · · , ξ N ] to denote the polynomial ring of the variables ξ 1 , · · · , ξ N over the field F. Let r be a positive integer. An r × r matrix L over the ring F[ξ 1 , · · · , ξ N ] is said to be non-singular if the determinant of L is a nonzero polynomial in F[ξ 1 , · · · , ξ N ].

Definition 5
Suppose M is an r × l (r ≤ l) matrix over F[ξ 1 , · · · , ξ N ]. The diameter of M is defined as the smallest positive integer ρ such that any ρ columns of M contain an r × r non-singular sub-matrix.
For a given CDE problem H = (k, n, X, X ), let ρ j be the diameter of the local incidence matrix of r j , j = 1, · · · , n. We define the diameter of H as ρ = max{ρ 1 , · · · , ρ n }.
Reconsider the CDE problem in Example 2. It is easy to verify that ρ j = 4, ∀j ∈ {1, · · · , 6}. Thus the diameter of H in this example is ρ = 4.

Definition 6
For a CDE problem H = (k, n, X, X ), let L j = {L; L is a non-singular square sub-matrix of C j of order |A j |} and L = ∪ n j=1 L j . We then define the character polynomial of H as the polynomial h(· · · , ξi,j , · · · ) = L∈L det (L) where det(L) is the determinant of the square matrix L.
The following lemma transfers the problem of designing a δ-error correction solution of H to the problem of finding a nonzero point of the character polynomial of H. Lemma 3 Let h(· · · , ξ i,j , · · · ) be the character polynomial of H and E = (a i,j ) be an encoding matrix of H such that h(· · · , a i,j , · · · ) = 0. Then E is a ⌊ n−ρ 2 ⌋-error correcting solution of H, where ρ is the diameter of H.
Proof: Let C j and E j be the local incidence matrix and the local receiving matrix of client r j . Since ρ is the diameter of H, any set of ρ columns of C j contains a non-singular sub-matrix L of order |A j |, i.e., L ∈ L. Correspondingly, any set of ρ columns of E j contains a sub-matrix L ′ such that L ′ is obtained by replacing ξ i,j by a i,j in L. Since h(· · · , a i,j , · · · ) = 0, we have det(L ′ ) = 0. As L ′ has rank |A j |, and it follows that any set of ρ columns of E j has rank |A j |. According to Lemma 2, E j is a generating matrix of an [n, |A j |] linear code and its minimum distance d ≥ n − ρ + 1. Let δ = ⌊ n−ρ 2 ⌋. Then, we have 2δ ≤ n − ρ. Thus, 2δ + 1 ≤ d. According to Lemma 1, E is the encoding matrix of a ⌊ n−ρ 2 ⌋error correcting solution of H.
To make further discussion, we need the following lemma, which is a well-known result in algebra (e.g., see [11]).
Theorem 1 Suppose F is sufficiently large. Then the CDE problem H = (k, n, X, X ) has a δ-error correcting solution if and only if δ ≤ ⌊ n−ρ 2 ⌋, where ρ is the diameter of H. Proof: We first prove the sufficiency of the condition by assuming that δ ≤ ⌊ n−ρ 2 ⌋. According to Lemma 4, there exists a feasible assignment for each ξ i,j with a i,j ∈ F, such that h(· · · , a i,j , · · · ) = 0. By Lemma 3, E = (a i,j ) is the encoding matrix of a ⌊ n−ρ 2 ⌋-error correcting solution of H. That is, E is the encoding matrix of a δ-error correcting solution.
We then prove the necessity of the condition, where we assume that H has a δ-error correcting solution with encoding matrix E = (a i,j ) k×n . By Lemma 1, each local encoding matrix E j is a generating matrix of a [n, |A j |] linear code with minimum distance d ≥ 2δ + 1. By Lemma 2, any set of n − d + 1 columns of E j has rank |A j |, i.e., any set of n − d + 1 columns of E j contains a non-singular sub-matrix of order |A j |. Correspondingly, any set of n − d + 1 columns of C j contains a non-singular sub-matrix of order |A j | over the ring F[· · · , ξ i,j , · · · ]. We have ρ j ≤ n − d + 1 and ρ = max{ρ 1 , · · · , ρ n } ≤ n − d + 1, where ρ j is the diameter of the local incidence matrix C j of r j . Thus, d ≤ n − ρ + 1.
Combining the afore-proven result that d ≥ 2δ + 1, we can deduce that 2δ ≤ n − ρ. Since δ is an integer, we have δ ≤ ⌊ n−ρ 2 ⌋. Thus, we complete the proof of Theorem 1. Consider the CDE problem H = (6, 6, X, X ) in Example 1, of which we have shown that the diameter is 4. So by Theorem 1, H has a δ-error correcting solution for any δ ≤ 1, which means the system can tolerate at most one compromised client; otherwise, some clients may not be able to correctly deduce all the messages. It can also be easily verified that the encoding strategy given by the encoding matrix E in Example 2 achieves the derived capability δ ≤ 1. In other words, if any one client is compromised and sends a false message intentionally, the encoding strategy given by matrix E can detect the false message and make sure all the clients can successfully decode their missing packets using their local receiving matrices.
For example, if among y 2 , y 3 , y 4 , y 5 , y 6 in Example 2 there is one, say y 2 , which change to a erroneous value y ′ 2 , then z 2 will also change to a erroneous value z ′ 2 = y ′ 2 − x 3 . Since C is with minimum distance 3, (0, z 2 , z 3 , z 4 , z 5 , z 6 ) is the the nearest codeword to (0, z ′ 2 , z 3 , z 4 , z 5 , z 6 ), i.e., for any )E 1 has at least two elements different from (0, z ′ 2 , z 3 , z 4 , z 5 , z 6 ). By the minimum distance decoder, we can still obtain the correct value of x 2 , x 4 , x 5 .

IV. PERFORMANCE WITH RANDOM NETWORK CODING
Although there exists feasible deterministic code designs to realize the δ error-correction, the deterministic encoding matrix must be defined and distribute across the network system beforehand. This not only incurs extra communication overhead, but also makes the system rather inadaptive and unscalable, as any change in the network size, or in the individual packet sets possessed by the clients, will cause a recomputation and re-distribution of the entire coding scheme. To make the system more robust, scalable and hence more practical, we now consider using random linear network codes and evaluate its performance.
In the distributed, random coding context, each client locally and independently generates an encoded packet over its possession, and broadcasts to all of its peers. The coefficients of the encoding vector are randomly selected from a predefined field F. Again, assuming there exist malicious clients, we are interested in the computing the error tolerance capability of the system. Unlike the deterministic case, here the error tolerance must be evaluated over the ensemble of the random coding schemes, assuming each and every instance is equally probable. The analytical result is therefore represented in terms of the probability.
Lemma 5 Let f (ξ 1 , · · · , ξ N ) be a nonzero polynomial of degree d ≥ 0 over a field F. Let S be a finite subset of F, and the value of each ξ 1 , · · · , ξ N be selected independently and uniformly at random from S. Then the probability that the polynomial equals zero is at most d |S| , i.e., Pr(f (ξ 1 , · · · , ξ N ) = 0) ≤ d |S| . We now prove our random coding result: Theorem 2 Suppose that the character polynomial of the CDE problem H = (k, n, X, X ) is of degree d and the size of the field F is q > d. Let the encoding coefficients {a i,j } be chosen independently and uniformly at random from F. Then the probability that E = (a i,j ) is the encoding matrix of a ⌊ n−ρ 2 ⌋-error correcting solution of H is at least 1 − d q , where ρ is the diameter of H.
Proof: Let h(· · · , ξ i,j , · · · ) be the character polynomial of H. According to Lemma 5, by randomly selecting a i,j in the field F, Pr(h(· · · , a i,j , · · · ) = 0) ≤ d q . Hence, Pr(h(· · · , a i,j , · · · ) = 0) ≥ 1 − d q . From Lemma 3, the probability that E = (a i,j ) k×n is the encoding matrix of a ⌊ n−ρ 2 ⌋-error correcting solution of H is at least 1 − d q . Remark 2: Clearly, the degree of the character polynomial of the CDE problem H = (k, n, X, X ) only depends on the parameters k, n and X and is independent of the field F. By Theorem 2, if the field F is sufficiently large, with a high probability, we can obtain a ⌊ n−ρ 2 ⌋-error correcting solution of H by randomly choosing the encoding coefficients from the given field.
V. CONCLUSION We have studied the error correction capability for a network coded data exchange problem. Assuming every client in the network is allowed to exchange only one message, we develop a tight upper bound on the maximal clients that can be compromised or failed without undermining the final messages. We show that deterministic schemes exist to achieve the bound. For the system to be more scalable, we also consider random coding, and develop the probability that each client can successfully identify the erroneous message and deduce the complete information. It is worthy remark that since the encoding matrix is restrict, the construction technique in classical linear code can not apply to the CDE error correction code. Thus, we give rise to a new problem in code design.