3.1. Code Construction
Exploring a new design for the quaternary code to correct one or two consecutive symbols, we explain the proposed code design as the following definition. In the proposed code design, the binary sequence which has the same length and related to the quaternary sequence is used to construct the constraints for the proposed code.
Definition 4. For , , and , a quaternary code has a codeword = . First, we can consider a mapping from the quaternary codeword to a binary sequence = for as, Then, the quaternary code which satisfies the following three conditions can correct at most two consecutive deletion or insertion errors. The basic idea of the mapping (10) is that the quaternary codeword corresponds to the binary sequence with the same length n. Therefore, a deletion in the j-th position of the codeword also leads to a deletion in the j-th position of the binary sequence . For example, if the received sequence is = , after using the mapping (10), we can obtain the binary sequence , which has one deletion error in the j-th position.
In Definition 4, the condition (11) is the same as the condition (3) in Definition 1 for , which means that the sequence is protected by a binary codeword of . Therefore, decoding of the binary sequence can be used for finding the positions of the deleted symbols and guessing the values of deleted symbols of codeword .
The two constraints (12) and (13) in Definition 4, which are not in Definition 1, are used to obtain the correcting property in the quaternary regime. Since from constraint (11), the possible positions of the deletion errors can be obtained; however, in the case there is more than one value which satisfies the constraint (11), the constraints (12), (13) are used to remove invalid values of the possible positions. The constraint (13) is added to determine exactly the value of the deleted symbol and sum value of two consecutive deleted symbols. Then, finally the position and the value of symbols satisfy 3 constraints (11), (12) and (13) will be unique and the resulting quaternary sequence will be corrected. For example,
and
, the binary sequence is corrected as
, the underlined bits are the bits which are inserted to correct
. From the mapping (10), the possible quaternary sequence can be
,
,
, or
. If there are no constraints (12), (13), the decoder cannot output the corrected quaternary sequence. Therefore, the constraints (12), (13) exclude the invalid quaternary sequences as described in
Table 1, then the output is the unique sequence
.
3.2. Decoding Procedure for One Deletion Error
It is assumed that a transmitter and receiver share the parameters of the code in Definition 4. Then, we first consider a case that one deletion error occurs in the codeword . For , if the j-th symbol in is removed, we obtain a received sequence , with length .
If the symbol at the j-th position is deleted, the constraint (13) can be rewritten as . From the received sequence , the constraint is given as . Thus, the value of the deleted symbol value is calculated as .
Next, we need to find the deletion position j. From the mapping (10) for the received sequence to acquire the binary sequence with length , is obtained as = . Then, the run-length vector is determined from and = in the constraint (11). As mentioned in Definition 1, when one deletion error occurs, the run-syndrome decreases by = .
To provide a proof for the correction capabilities of the proposed quaternary code in Definition 4, we develop Algorithm 1 as a correcting method in the case of one deletion symbol.
Algorithm 1 Correct one deletion symbol. |
- Input:
. - Output:
. - 1:
. - 2:
Get the binary sequence and the run-length vector of . - 3:
Get the total number of elements of as . - 4:
. - 5:
Set . - 6:
while
do - 7:
if then - 8:
if then - 9:
del_correct1 - 10:
else - 11:
- 12:
end if - 13:
else - 14:
if then - 15:
del_correct1 - 16:
else - 17:
- 18:
end if - 19:
end if - 20:
end while
|
Function 1 provides function
del_correct1 for Algorithm 1 to determine the deletion position, and then the output of Function 1 is the corrected quaternary sequence. In addition, in Function 1,
Syn_new stands for the syndrome of the quaternary sequence after inserting the lost symbol
in the
j-th position of
.
- Function 1:
c = del_correct1 (n, a, y, j, cj) - Input:
n, a, y, j, cj. - Output:
. - 1:
Syn_new = mod (8n + 1) - 2:
ifSyn_new = a then - 3:
c = c1,c2,…,cj−1,cj,cj + 1,…,cn - 4:
else - 5:
- 6:
end if
|
Example 1: Let , and e be 10, 0, 0, and 0, respectively. Assume that one deletion occurs at the sixth position of the codeword = . The received sequence is = = . As mentioned in Algorithm 1, the value of the lost symbol is = . From the mapping (10), we obtain the binary sequence = 010000111. Then, the run-length vector of is so = 4 and the run-syndrome of is = = 18. The change of the run-syndrome is computed as = .
For , since , following Algorithm 1, when j = 6, then = = 2. If inserting the lost symbol with = 1 in the sixth position of the received sequence as , the syndrome of this quaternary sequence = = 0 (equals to a). Thus, the deletion error of the quaternary sequence is recovered correctly.
3.3. Decoding Procedure for Two Deletion Errors
Suppose that the received sequence = with length , where two consecutive symbols in the j-th and -th positions of codeword are deleted.
The constraint (13) in Definition 4 can be rewritten as , and it is easy to obtain as = , corresponding to = . Since = , we can rewrite as = .
From the mapping (10) for the received sequence , the binary sequence with length is obtained as = . Then, the run-length vector of also can determine the run-syndrome of as = . Thus, similar to the approach mentioned in Definition 1, the difference of the run-syndrome is computed as = .
To recover two deletion errors, we first recover the binary sequence
with length
n from the binary sequence
. The authors of [
7] suggested the eight possible instances when two consecutive bits are deleted, as summarized in
Table 2. However, in this work, we consider more instances which are 16 in total, and the remaining eight instances are listed in
Table 3. Please note that in Algorithms 2 and A2, a notation
is used to imply that the reverse value of the
-th position is assigned to the bit at the
j-th position. Thus, two notations
and
have the same meaning, and this means that two neighbor
-th and
j-th bits have different values. For example, if
, then
or
.
In an analysis approach similar to [
7], for
, there are four possible deleted bit pairs
=
. Then, if
2
, we combine four possible cases of
with neighboring bits
=
and (1,1), and we need to consider 16 instances of
.
From the above analysis, we develop Algorithm 2 for the proposed code to correct two consecutive deletion errors. In addition, in Algorithm 2, though it was not mentioned, the bit
is mathematically analyzed as an accompanied pair with
, as described above, to obtain the conditions, such as lines 9, 16, 27, 34 to determine the deleted positions.
Algorithm 2 Correct two consecutive deletion symbols |
- Input:
. - Output:
. - 1:
. - 2:
Get the binary sequence and the run-length vector of . - 3:
Get the total number of elements of as . - 4:
= . - 5:
Set . - 6:
if
then - 7:
while do - 8:
if mod then - 9:
if then - 10:
; - 11:
= del_correct2+ - 12:
else - 13:
- 14:
end if - 15:
else - 16:
if then - 17:
; - 18:
= del_correct2+ - 19:
else - 20:
- 21:
end if - 22:
end if - 23:
end while - 24:
else - 25:
while do - 26:
if mod then - 27:
if then - 28:
; - 29:
= del_correct2+ - 30:
else - 31:
- 32:
end if - 33:
else - 34:
if then - 35:
; - 36:
= del_correct2+ - 37:
else - 38:
- 39:
end if - 40:
end if - 41:
end while - 42:
end if
|
To clarify the explanation of the function
del_correct2 for Algorithm 3 in
Section 3.3, we provide the detail in Function 2. In Function 2,
Syn_new implies the syndrome of the quaternary sequence after inserting the lost symbols
and
in the
j-th and
-th position of
. If the value of
Syn_new equals to the parameter of syndrome
a, we infer that the quaternary sequence is retrieved successful.
- Function 2:
c = del_correct2 (n, a, y, j, cj + cj+1) - Input:
n, a, y, j, xj, xj+1, cj + cj+1. - Output:
. - 1:
Using mapping (10) to obtain cj, then cj+1 = cj + cj+1 − cj - 2:
Syn_new = mod (8n + 1) - 3:
ifSyn_new = a then - 4:
c = c1,c2,…,cj−1,cj,cj + 1,…,cn - 5:
else - 6:
- 7:
end if
|
Example 2: Let , and e be 10, 0, 0, and 0, respectively. It is assumed that two consecutive deletions occur at the seventh and eighth position of the codeword = and the received the quaternary sequence is = = . As mentioned in Algorithm 3, the sum of the values of the two deleted symbols is = = = 0.
From the mapping (10) for , the binary sequence and are = 001000011 and = , respectively. Then, = 4 and the run-syndrome = 15. The difference of run-syndrome is calculated as = = 5.
From Algorithm 2, since and , for , the value satisfies the equation = = = 5. Thus, as mentioned in line 28 of Algorithm 2, we obtain and , and the corrected binary sequence is 0100000111.
Applying mapping (10) to the binary sequence and , the two deleted symbols are determined as . The syndrome Syn_new of the quaternary sequence when inserting = (1,3) into is 0, which equals the syndrome a of codeword . Thus, finally the recovered quaternary sequence is .
Algorithms 1 and 2 are proved using an exhaustive search strategy to show that the proposed code can correct at most two consecutive deletion symbols. However, as mentioned in [
9], deletion-correcting codes are not always successful in identifying the exact location of the deleted symbols. For example, if an all-zero codeword is sent and one deletion error occurs, to find value of the deleted symbol is easy but it is impossible to find the exact position of the deleted symbol. Even though the exact position cannot be detected, the codeword can be successfully recovered by inserting a zero symbol in any position. This means that when the exact index of the deleted error is not detected but the run index which the deleted error belongs to is determined, the codeword can be successfully recovered by inserting one symbol in any position in the run.
If a codeword with a large run was sent and one deletion occurs in the large run, the proposed algorithm can always determine the value and the run index of the deleted symbol but rarely find the exact position of the deleted symbol in the run. In this case, we prioritize the proposed algorithm to output the first index in the detected run. Therefore, when a deletion error occurs in a large run and it is not possible to find the exact position in a codeword, the codeword of the proposed code will be successfully decoded by inserting the deleted symbol in the first index of the run.