Introduction
A k k k -substring edit replaces a substring of length at most k k k by another sequence of length at most k k k . More precisely, over the alphabet Σ q = { 0 , 1 , … , q − 1 } \Sigma_q = \{0,1,\ldots,q-1\} Σ q = { 0 , 1 , … , q − 1 } , it transforms a sequence x = u s v x = usv x = u s v into y = u t v y = utv y = u t v , where u u u , s s s , t t t , and v v v are sequences over Σ q \Sigma_q Σ q , with the lengths of s s s , t t t being at most k k k . This operation encompasses insertions, deletions, substitutions, and combinations of these errors within one short region. A k k k -substring edit correcting code must uniquely recover the original codeword x x x from y y y without knowing the location of the edit or the lengths of s s s and t t t .
Tang et al. introduced the k k k -substring edit model in [1 ] . Their analysis of source-code revisions and simulated nanopore sequencing reads provides empirical evidence that edits tend to occur in clusters. In file synchronization, for example, updating an expression in a source-code file may replace a block of characters while leaving the rest unchanged. Similarly, a cluster of insertion, deletion, and substitution errors in a stored or transmitted sequence can be represented by a substring replacement. From a coding perspective, the main feature of a k k k -substring edit is that all changes are confined to one short region, even though the symbols after that region may shift. Using this restriction can substantially reduce the redundancy compared with protecting against the same number of edits at arbitrary positions.
For the binary alphabet and fixed k k k , Tang et al. [1 ] constructed codes correcting one k k k -substring edit with redundancy 2 log n + o ( log n ) 2\log n+o(\log n) 2 log n + o ( log n ) , where n n n is the code length. Li et al. [2 ] subsequently improved the redundancy bound to log n + 16 k log log n + o ( log log n ) \log n+16k\log\log n+o(\log\log n) log n + 16 k log log n + o ( log log n ) . As shown later in the current paper, for fixed q q q and k k k , any q q q -ary code of length n n n correcting one k k k -substring edit requires at least log n − O q , k ( 1 ) \log n-O_{q,k}(1) log n − O q , k ( 1 ) bits of redundancy. Thus, Li’s construction achieves the optimal leading term log n \log n log n in the binary case, with an additive O k ( log log n ) O_k(\log\log n) O k ( log log n ) gap between their redundancy bound and the lower bound.
We review some error models which are special cases of the k k k -substring edit model.
Burst/Localized Deletions
A burst of exactly t t t deletions removes t t t consecutive symbols, whereas a burst of at most t t t deletions removes a substring of length at most t t t . Codes correcting these errors are called t t t -burst-deletion correcting codes and ( ≤ t ) (\le t) ( ≤ t ) -burst-deletion correcting codes, respectively. The study of these codes goes back to Levenshtein’s work in 1967 [3 ] , where a binary ( ≤ 2 ) (\le2) ( ≤ 2 ) -burst-deletion correcting code was constructed. Applications in DNA storage and file synchronization have motivated further studies of these codes in the past two decades [4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 ] . A central objective is to construct q q q -ary codes whose redundancy matches the lower bound log n − O q , t ( 1 ) \log n-O_{q,t}(1) log n − O q , t ( 1 ) [4 , 7 ] up to an additive constant, for fixed q ≥ 2 q \ge2 q ≥ 2 and t ≥ 1 t \ge1 t ≥ 1 .
For a prescribed burst length t t t , Sun et al. [10 ] constructed q q q -ary t t t -burst-deletion correcting codes with redundancy log n + O q , t ( 1 ) \log n+O_{q,t}(1) log n + O q , t ( 1 ) , attaining this objective. For ( ≤ t ) (\le t) ( ≤ t ) -burst-deletion correcting codes, several redundancy upper bounds are available in different parameter ranges [6 , 9 , 10 , 11 ] . For arbitrary fixed q , t ≥ 2 q,t \ge2 q , t ≥ 2 , Song, Cai, and Quek [9 ] obtained redundancy log n + \log n+ log n +
This research is supported by the National Key Research and Development Program of China under Grant 2025YFC3409900, the National Natural Science Foundation of China under Grant 12231014 and Grant 12501466, Beijing Scholars Program, and Xiaomi Young Scholars Program. 8 log log n + o ( log log n ) 8 \log\log n + o(\log\log n) 8 log log n + o ( log log n ) . For even q q q , Sun et al. [10, Theorem 10] obtained redundancy log n + t log log n + O q , t ( 1 ) \log n + t \log\log n + O_{q,t}(1) log n + t log log n + O q , t ( 1 ) . Very recently, Ye, Sun, and Ge [11, Theorem 17] reduced the redundancy to log n + ( t − 1 ) log log n + O q , t ( 1 ) \log n + (t-1) \log\log n + O_{q,t}(1) log n + ( t − 1 ) log log n + O q , t ( 1 ) when t < q t < q t < q , or when q q q is even and t < 2 q t < 2q t < 2 q . Sharper bounds are available in some special cases. For t = 1 t = 1 t = 1 , optimal q q q -ary single-deletion codes have redundancy log n + O q ( 1 ) \log n + O_q(1) log n + O q ( 1 ) [8 , 12 ] . For q = 2 q = 2 q = 2 , Levenshtein’s code achieves redundancy log n + O ( 1 ) \log n + O(1) log n + O ( 1 ) when t = 2 t = 2 t = 2 [3 ] , and [11 Remark 18] gives redundancy log n + log log n + O ( 1 ) \log n + \log\log n + O(1) log n + log log n + O ( 1 ) when t = 3 t = 3 t = 3 .
A t t t -localized deletion removes at most t t t symbols from an unknown window of t t t consecutive symbols, without requiring the deleted positions to be consecutive. Schoeny et al. introduced and studied this model under the name “bursts of non-consecutive deletions” [4 ] . Bitar et al. [13 ] constructed binary codes with redundancy log n + O ( t log 2 ( t log n ) ) \log n + O(t \log^2(t \log n)) log n + O ( t log 2 ( t log n )) , which becomes log n + O t ( ( log log n ) 2 ) \log n + O_t((\log\log n)^2) log n + O t (( log log n ) 2 ) for fixed t t t . For even q q q , Sun et al. [10, Theorem 11] obtained q q q -ary codes with redundancy log n + 2 t log log n + O q , t ( 1 ) \log n + 2t \log\log n + O_{q,t}(1) log n + 2 t log log n + O q , t ( 1 ) .
More generally, a ( t , T ) (t,T) ( t , T ) -localized deletion removes at most t t t symbols from an unknown window of T T T consecutive symbols, where the window length T ≥ t T \ge t T ≥ t is specified separately from t t t . The t t t -localized-deletion model is the special case T = t T = t T = t . For fixed q q q , t t t and T T T , Ye, Sun, and Ge [11, Theorem 20] constructed q q q -ary codes correcting ( t , T ) (t,T) ( t , T ) -localized deletions with redundancy log n + ( t − 1 ) log log n + O q , t , T ( 1 ) \log n + (t - 1) \log\log n + O_{q,t,T}(1) log n + ( t − 1 ) log log n + O q , t , T ( 1 ) when t < q t < q t < q , or when q q q is even and t < 2 q t < 2q t < 2 q .
Clearly, the ( t , T ) (t,T) ( t , T ) -localized-deletion model includes both the t t t -burst-deletion and ( ≤ t ) (\le t) ( ≤ t ) -burst-deletion models. Its connection with substring edits can be seen directly. Let s s s be the affected length-T T T window, and let t t t be the subsequence remaining after d d d deletions, where 1 ≤ d ≤ t 1 \le d \le t 1 ≤ d ≤ t . Replacing s s s by t t t is a T T T -substring edit.
The ( t , s ) (t,s) ( t , s ) -Burst Error
For prescribed nonnegative integers t t t and s s s with t + s > 0 t+s > 0 t + s > 0 , a ( t , s ) (t,s) ( t , s ) -burst error replaces a length-t t t substring by a length-s s s sequence. The special case ( t , s ) = ( 2 , 1 ) (t,s) = (2,1) ( t , s ) = ( 2 , 1 ) was introduced by Schoeny et al. in [4 ] as a component of their constructions for correcting localized deletions. Lu and Zhang subsequently formulated the general model in [14 ] . This model also generalizes the t t t -deletion-burst error model.
Sun et al. [10 ] later constructed q q q -ary ( t , s ) (t,s) ( t , s ) -burst correcting codes with redundancy log n + O q , t , s ( 1 ) \log n + O_{q,t,s}(1) log n + O q , t , s ( 1 ) for every fixed q ≥ 2 q \ge2 q ≥ 2 and every fixed pair ( t , s ) (t,s) ( t , s ) with t + s > 0 t + s > 0 t + s > 0 . Their redundancy is optimal up to an additive constant depending only on q , t , s q,t,s q , t , s .
Every ( t , s ) (t,s) ( t , s ) -burst error with max { t , s } ≤ k \max\{t,s\} \le k max { t , s } ≤ k is a k k k -substring edit. A ( t , s ) (t,s) ( t , s ) -burst correcting code is required to correct errors for one prescribed pair ( t , s ) (t,s) ( t , s ) , whereas a k k k -substring edit correcting code must handle all such pairs simultaneously. For a codeword of length n n n , the received sequence has length n − t + s n-t+s n − t + s , which determines s − t s-t s − t but generally does not determine t t t and s s s individually. Consequently, the optimal redundancy result for each fixed pair does not by itself give a single code with the same redundancy for the more general substring edit model.
The t t t -Burst-Edit
A t t t -burst-edit, as defined in [15 ] , is one of three operations: deleting exactly t t t consecutive symbols, inserting a sequence of length t t t at one position, or replacing a length-t t t substring by another length-t t t substring. When t = 1 t = 1 t = 1 , this reduces to the single-edit model, whose binary case was studied by Levenshtein [16 ] . Sun, Xi, and Ge [17 ] considered the burst-edit channel in the sequence reconstruction setting. Sun and Ge [15 ] subsequently studied codes correcting these errors. The objective is to construct a single code that protects against both synchronization errors and length-preserving substitutions.
For a single binary edit, redundancy log n + O ( 1 ) \log n + O(1) log n + O ( 1 ) is achievable [16 ] . For arbitrary fixed alphabet size q ≥ 2 q \ge2 q ≥ 2 , Gabrys et al. [18 ] obtained single-edit correcting codes with redundancy log n + O q ( log log n ) \log n + O_q(\log\log n) log n + O q ( log log n ) . For fixed t ≥ 1 t \ge1 t ≥ 1 and fixed q ≥ 2 q \ge2 q ≥ 2 , this is a power of two, Sun and Ge [15, Theorem 12] constructed q q q -ary t t t -burst-edit correcting codes with redundancy log n + log log n + O q , t ( 1 ) \log n + \log\log n + O_{q,t}(1) log n + log log n + O q , t ( 1 ) . This redundancy is within an additive log log n + O q , t ( 1 ) \log\log n + O_{q,t}(1) log log n + O q , t ( 1 ) term of the log n − O q , t ( 1 ) \log n - O_{q,t}(1) log n − O q , t ( 1 ) lower bound inherited from t t t -burst-deletion correcting codes.
Writing ( a , b ) (a,b) ( a , b ) for the lengths of the removed and replacement substrings, the three operations above correspond to ( t , 0 ) (t,0) ( t , 0 ) , ( 0 , t ) (0,t) ( 0 , t ) , and ( t , t ) (t,t) ( t , t ) . Thus, every t t t -substring edit correcting code also corrects a t t t -burst-edit. The two error models coincide when t = 1 t = 1 t = 1 . For t ≥ 2 t \ge2 t ≥ 2 , however, the substring edit model also allows pairs ( a , b ) (a,b) ( a , b ) with 1 ≤ a , b ≤ t 1 \le a,b \le t 1 ≤ a , b ≤ t and a ≠ b a \ne b a = b , as well as bursts of fewer than t t t deletions or insertions. Correcting a t t t -burst-edit alone therefore does not guarantee correction of all these additional errors.
Single Deletion or Single Adjacent Transposition
An adjacent transposition exchanges two neighboring symbols, replacing a b ab ab by b a ba ba , where a , b ∈ Σ q a,b \in\Sigma_q a , b ∈ Σ q and a ≠ b a \ne b a = b . Motivated by DNA-based storage, Gabrys, Yaakobi, and Milenkovic [19 ] initiated the study of codes correcting deletions and adjacent transpositions. A basic case requires a single code to correct either one deletion or one adjacent transposition, thereby providing protection against both symbol loss and a local change in symbol order.
For the binary alphabet, Gabrys et al. [18, Theorem 2] constructed codes correcting either one deletion or one adjacent transposition with redundancy log n + O ( log log n ) \log n + O(\log\log n) log n + O ( log log n ) , which is within an additive O ( log log n ) O(\log\log n) O ( log log n ) of the lower bound log n − O ( 1 ) \log n - O(1) log n − O ( 1 ) . For arbitrary fixed q ≥ 2 q \ge2 q ≥ 2 , Khuat and Kim [20 ] constructed q q q -ary codes for the stronger model allowing one insertion, deletion, substitution, or adjacent transposition, with redundancy 2 log n + O q ( 1 ) 2 \log n + O_q(1) 2 log n + O q ( 1 ) bits.
A single deletion replaces a length-one substring by the empty sequence, whereas an adjacent transposition replaces a length-two substring by another sequence of length two. Both are 2-substring edits. Consequently, taking k = 2 k = 2 k = 2 in our first construction gives q q q -ary codes for this model, and also for the stronger one-edit-or-transposition model.
Our Contributions and Main Ideas
This paper continues the study of k k k -substring edit correcting codes. For fixed q ≥ 2 q \ge2 q ≥ 2 and k ≥ 1 k \ge1 k ≥ 1 and sufficiently large code length n n n , we obtain the following two constructions.
We construct q q q -ary k k k -substring edit correcting codes with redundancy at most log n + 8 log log n + 8 log log log n + O q , k ( 1 ) \log n + 8\log\log n + 8\log\log\log n + O_{q,k}(1) log n + 8 log log n + 8 log log log n + O q , k ( 1 ) . This extends the leading redundancy term log n \log n log n achieved by the binary construction in [2 ] to arbitrary fixed alphabets. Moreover, the coefficient of log log n \log\log n log log n is reduced from 16 k 16k 16 k to 8 8 8 and is independent of both q q q and k k k .
When the removed substring and its replacement have different lengths, we construct q q q -ary codes correcting one such edit with redundancy log n + O q , k ( 1 ) \log n + O_{q,k}(1) log n + O q , k ( 1 ) .
These constructions also yield codes for several related error models mentioned in § 1 -A. Applying Theorem V.1 with k = 2 k = 2 k = 2 gives q q q -ary codes correcting one insertion, deletion, substitution, or adjacent transposition with redundancy log n + 8 log log n + o ( log log n ) \log n + 8\log\log n + o(\log\log n) log n + 8 log log n + o ( log log n ) for every fixed q ≥ 2 q \ge2 q ≥ 2 . Applying Theorem VI.1 with k = T k = T k = T gives q q q -ary ( t , T ) (t,T) ( t , T ) -localized deletion correcting codes with redundancy log n + O q , T ( 1 ) \log n + O_{q,T}(1) log n + O q , T ( 1 ) for all fixed q ≥ 2 q \ge2 q ≥ 2 and 1 ≤ t ≤ T 1 \le t \le T 1 ≤ t ≤ T . Taking T = t T = t T = t gives, in particular, ( ≤ t ) (\le t) ( ≤ t ) -burst-deletion correcting codes with redundancy log n + O q , t ( 1 ) \log n + O_{q,t}(1) log n + O q , t ( 1 ) . For both deletion models, the redundancy is optimal up to an additive constant, since correcting even a single deletion requires log n − O q ( 1 ) \log n - O_q(1) log n − O q ( 1 ) bits of redundancy.
We next outline the first construction. An overview of the second construction is given in § 6 -A.
The first construction builds on the partition and integer-valued mapping of Li et al. [2 ] . Their method partitions a binary sequence into segments at occurrences of a prescribed pattern and maps each segment to an integer. It first locates the induced edit within O k ( log n ) O_k(\log n) O k ( log n ) consecutive entries of the resulting integer sequence. Since each entry represents a segment of length O k ( log n ) O_k(\log n) O k ( log n ) , this locates the edit in the original sequence within an interval of O k ( ( log n ) 2 ) O_k((\log n)^2) O k (( log n ) 2 ) symbols.
We extend the partition and mapping to q q q -ary sequences and sharpen the localization bound by accounting for the actual lengths of the segments. When the edit changes the number of segments, we estimate the VT-syndrome difference associated with each possible edit location. As this location moves across a segment, the estimate changes monotonically by at least a fixed positive multiple of the segment length. The bound on the estimation error then implies that the segments between candidate edit locations have total length O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) . When the number of segments is unchanged, we show that the induced edit changes at most two adjacent entries of the integer sequence. The VT syndrome, together with two additional modular sums, identifies the first changed entry exactly. In either case, we obtain an interval of O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) symbols covering the edit region. The general localization framework is developed in § 3 .
To complete recovery, we adapt the distributed graph coloring method of Li, Gabrys, and Farnoud [21 ] to obtain a local syndrome requiring 4 log m + 4 log log m + O q , k ( 1 ) 4\log m + 4\log\log m + O_{q,k}(1) 4 log m + 4 log log m + O q , k ( 1 ) bits for a block of length m m m . We use two partitions into blocks of length m = Θ q , k ( log n ) m = \Theta_{q,k}(\log n) m = Θ q , k ( log n ) , with their boundaries shifted by half a block. This ensures that the localized interval obtained above lies entirely within one block of at least one partition. For each partition, we store modular sums of the components of the block syndromes. Since the other blocks in the selected partition can be read from the received sequence, their contributions can be subtracted to recover the syndrome of the affected block. The two sets of sums, together with the log n + O q , k ( 1 ) \log n + O_{q,k}(1) log n + O q , k ( 1 ) bits used for localization, yield the stated redundancy bound.
Organization
Section II defines the notation and error model, and establishes bounds on code size. § 3 develops the general localization framework, and Section IV gives its q q q -ary instantiation. § 5 supplies the local recovery component and the first code construction. § 6 presents the unequal-length construction and its application to localized/burst deletions. Section VII concludes the paper.
Preliminaries
For any q ≥ 2 q \ge2 q ≥ 2 , denote by Σ q \Sigma_q Σ q the q q q -ary alphabet { 0 , 1 , … , q − 1 } \{0,1,\ldots,q-1\} { 0 , 1 , … , q − 1 } . We write Z \mathbb{Z} Z for the set of integers and Z ≥ 0 \mathbb{Z}_{\ge0} Z ≥ 0 for the set of nonnegative integers. For any alphabet Σ \Sigma Σ , sequences over Σ \Sigma Σ are written in bold lowercase letters, and symbols in Σ \Sigma Σ are written in plain lowercase letters. The length of a sequence x \boldsymbol{x} x , denoted by ∣ x ∣ |\boldsymbol{x}| ∣ x ∣ , is the number of symbols in x \boldsymbol{x} x . Note that the empty sequence, denoted by ϵ \epsilon ϵ , is the unique sequence of length 0 0 0 .
The notation ∣ ⋅ ∣ |\cdot| ∣ ⋅ ∣ is also used for the cardinality of a finite set and the absolute value of a real number. Its meaning will always be clear from the argument. For n ∈ Z ≥ 0 n \in\mathbb{Z}_{\ge0} n ∈ Z ≥ 0 , let Σ n \Sigma^n Σ n be the set of all sequences of length n n n over Σ \Sigma Σ . Define Σ ∗ ≜ ⋃ n ≥ 0 Σ n \Sigma^* \triangleq\bigcup_{n \ge0}\Sigma^n Σ ∗ ≜ ⋃ n ≥ 0 Σ n . By convention, the i i i -th symbol of sequence x ∈ Σ n \boldsymbol{x} \in\Sigma^n x ∈ Σ n is denoted by x i x_i x i , for any 1 ≤ i ≤ n 1 \le i \le n 1 ≤ i ≤ n . Thus, the sequence x \boldsymbol{x} x of length n n n can be written as x 1 ⋯ x n x_1 \cdots x_n x 1 ⋯ x n or ( x 1 , … , x n ) (x_1,\ldots,x_n) ( x 1 , … , x n ) . The concatenation of two sequences x \boldsymbol{x} x and y \boldsymbol{y} y over the same alphabet is denoted by x y \boldsymbol{x}\boldsymbol{y} x y . For any sequence x \boldsymbol{x} x over Z ≥ 0 \mathbb{Z}_{\ge0} Z ≥ 0 or Σ q \Sigma_q Σ q , define
wt L 1 ( x ) ≜ ∑ i = 1 ∣ x ∣ x i , VT ( x ) ≜ ∑ i = 1 ∣ x ∣ i ⋅ x i . (1) \operatorname{wt}_{L_1}(\boldsymbol{x}) \triangleq\sum_{i=1}^{|\boldsymbol{x}|} x_i,\qquad\operatorname{VT}(\boldsymbol{x}) \triangleq\sum_{i=1}^{|\boldsymbol{x}|} i \cdot x_i. \tag*{(1)} wt L 1 ( x ) ≜ i = 1 ∑ ∣ x ∣ x i , VT ( x ) ≜ i = 1 ∑ ∣ x ∣ i ⋅ x i . (1)
We call wt L 1 ( x ) \operatorname{wt}_{L_1}(\boldsymbol{x}) wt L 1 ( x ) the L 1 L_1 L 1 -weight of x \boldsymbol{x} x , and VT ( x ) \operatorname{VT}(\boldsymbol{x}) VT ( x ) the VT syndrome of x \boldsymbol{x} x .
For integers a a a and b b b , define [ a , b ] = { i ∈ Z : a ≤ i ≤ b } [a,b]=\{i\in\mathbb{Z}:a\le i\le b\} [ a , b ] = { i ∈ Z : a ≤ i ≤ b } , with [ a , b ] = ∅ [a,b]=\varnothing [ a , b ] = ∅ when a > b a>b a > b . For n ∈ Z ≥ 0 n\in\mathbb{Z}_{\ge0} n ∈ Z ≥ 0 , abbreviate [ 1 , n ] [1,n] [ 1 , n ] as [ n ] [n] [ n ] .
Let x x x be a sequence of length n n n . For a set I = { i 1 , i 2 , … , i r } I=\{i_1,i_2,\ldots,i_r\} I = { i 1 , i 2 , … , i r } with 1 ≤ i 1 < i 2 < ⋯ < i r ≤ n 1\le i_1<i_2<\cdots<i_r\le n 1 ≤ i 1 < i 2 < ⋯ < i r ≤ n , denote x I = x i 1 x i 2 ⋯ x i r x_I=x_{i_1}x_{i_2}\cdots x_{i_r} x I = x i 1 x i 2 ⋯ x i r . We set x I = ϵ x_I=\epsilon x I = ϵ when I I I is empty. In particular, if I = [ i , j ] I=[i,j] I = [ i , j ] for some 1 ≤ i ≤ j ≤ n 1\le i\le j\le n 1 ≤ i ≤ j ≤ n , the sequence x I x_I x I is called a substring of x x x .
Definition II.1 (k k k -substring edit). Let Σ \Sigma Σ be an alphabet and x , y ∈ Σ ∗ x,y\in\Sigma^* x , y ∈ Σ ∗ . We say that y y y is obtained from x x x by a k k k -substring edit if
x = u s v , y = u t v , (2) x=usv,\qquad y=utv, \tag*{(2)} x = u s v , y = u t v , (2) for some sequences u , s , t , v ∈ Σ ∗ u,s,t,v\in\Sigma^* u , s , t , v ∈ Σ ∗ with ∣ s ∣ , ∣ t ∣ ≤ k |s|,|t|\le k ∣ s ∣ , ∣ t ∣ ≤ k and ∣ s ∣ + ∣ t ∣ > 0 |s|+|t|>0 ∣ s ∣ + ∣ t ∣ > 0 . In other words, the edit replaces s s s by t t t . We write x → k y x\to_k y x → k y whenever such a representation exists, and call the edit nontrivial if x ≠ y x\ne y x = y .
In the above definition, if s = ϵ s=\epsilon s = ϵ , the edit inserts t t t between u u u and v v v . If t = ϵ t=\epsilon t = ϵ , the edit deletes s s s .
When Σ = Σ q \Sigma=\Sigma_q Σ = Σ q and the k k k -substring edit x → k y x\to_k y x → k y is nontrivial, we always choose the representation in (2) so that the replaced substring is minimal. Concretely, when both s s s and t t t are nonempty, we always assume that the first symbols of s s s and t t t are different, and that the last symbols of s s s and t t t are different, i.e.,
s 1 ≠ t 1 , s ∣ s ∣ ≠ t ∣ t ∣ . (3) s_1\ne t_1,\qquad s_{|s|}\ne t_{|t|}. \tag*{(3)} s 1 = t 1 , s ∣ s ∣ = t ∣ t ∣ . (3)
Pure insertions (when s = ϵ s=\epsilon s = ϵ ) and pure deletions (when t = ϵ t=\epsilon t = ϵ ) already have this form.
For x ∈ Σ ∗ x\in\Sigma^* x ∈ Σ ∗ , let E b , k ( x ) E_{b,k}(x) E b , k ( x ) be the set of all sequences obtainable from x x x by at most b b b k k k -substring edits.
Definition II.2. A nonempty set C ⊆ Σ q n C\subseteq\Sigma_q^n C ⊆ Σ q n is a ( b , k ) (b,k) ( b , k ) -substring-edit correcting code if E b , k ( x ) ∩ E b , k ( y ) = ∅ E_{b,k}(x)\cap E_{b,k}(y)=\varnothing E b , k ( x ) ∩ E b , k ( y ) = ∅ for all distinct x , y ∈ C x,y\in C x , y ∈ C . When b = 1 b=1 b = 1 , we simply call C C C a k k k -substring-edit correcting code.
The bit redundancy of a code C ⊆ Σ q n C\subseteq\Sigma_q^n C ⊆ Σ q n is red 2 ( C ) ≔ log ( q n / ∣ C ∣ ) \operatorname{red}_2(C)\coloneqq\log(q^n/|C|) red 2 ( C ) : = log ( q n /∣ C ∣ ) , where log \log log denotes the base-2 logarithm. A subscript on O ( ⋅ ) O(\cdot) O ( ⋅ ) or Ω ( ⋅ ) \Omega(\cdot) Ω ( ⋅ ) lists the fixed parameters on which the implicit constants may depend.
Regarding the maximum size (or the minimum redundancy) of a ( b , k ) (b,k) ( b , k ) -substring-edit correcting code, we have the next theorem.
Theorem II.1. Let q ≥ 2 q\ge2 q ≥ 2 , b ≥ 1 b\ge1 b ≥ 1 , and 1 ≤ k ≤ n 1\le k\le n 1 ≤ k ≤ n be integers. Set τ = min { b , ⌊ n / k ⌋ } \tau=\min\{b,\lfloor n/k\rfloor\} τ = min { b , ⌊ n / k ⌋} and
V q , k , b ( n ) = ∑ j = 0 τ ( n − ( k − 1 ) j j ) ( ( q − 1 ) q k − 1 ) j . V_{q,k,b}(n)=\sum_{j=0}^{\tau}\binom{n-(k-1)j}{j}\bigl((q-1)q^{k-1}\bigr)^j. V q , k , b ( n ) = j = 0 ∑ τ ( j n − ( k − 1 ) j ) ( ( q − 1 ) q k − 1 ) j . Let C ⊆ Σ q n C\subseteq\Sigma_q^n C ⊆ Σ q n be a ( b , k ) (b,k) ( b , k ) -substring edit correcting code with maximum size. Then
q n − 2 k b ( n + k b ) 2 b ( k + 1 ) 4 b ≤ ∣ C ∣ ≤ min { q max { 0 , n − 2 k b } , q n V q , k , b ( n ) } . (4) \frac{q^{n-2kb}}{(n+kb)^{2b}(k+1)^{4b}}\le|C|\le\min\left\{q^{\max\{0,n-2kb\}},\frac{q^n}{V_{q,k,b}(n)}\right\}. \tag*{(4)} ( n + k b ) 2 b ( k + 1 ) 4 b q n − 2 k b ≤ ∣ C ∣ ≤ min { q m a x { 0 , n − 2 k b } , V q , k , b ( n ) q n } . (4) Equivalently, it holds that
max { min { n , 2 k b } log q , log V q , k , b ( n ) } ≤ red 2 ( C ) ≤ 2 b log ( n + k b ) + 4 b log ( k + 1 ) + 2 k b log q . \max\{\min\{n,2kb\}\log q,\log V_{q,k,b}(n)\}\le\operatorname{red}_2(C)\le2b\log(n+kb)+4b\log(k+1)+2kb\log q. max { min { n , 2 k b } log q , log V q , k , b ( n )} ≤ red 2 ( C ) ≤ 2 b log ( n + k b ) + 4 b log ( k + 1 ) + 2 k b log q . Suppose that q q q and b b b are fixed. When n ≥ 2 k b n\ge2kb n ≥ 2 k b , we have
red 2 ( C ) ≥ max { 2 k b log q , b log n + k b log q } − O q , b ( 1 ) . (5) \operatorname{red}_2(C)\ge\max\{2kb\log q,b\log n+kb\log q\}-O_{q,b}(1). \tag*{(5)} red 2 ( C ) ≥ max { 2 k b log q , b log n + k b log q } − O q , b ( 1 ) . (5)
Proof: The lower bound in (4) is given in [1 Lemma 2] . We only have to prove the upper bound. We first prove the first upper bound in (4) . Put m = min { n , 2 k b } m=\min\{n,2kb\} m = min { n , 2 k b } , and fix an interval I = [ i , i + m − 1 ] ⊆ [ n ] I=[i,i+m-1]\subseteq[n] I = [ i , i + m − 1 ] ⊆ [ n ] . Let r = ⌈ m / k ⌉ r=\lceil m/k\rceil r = ⌈ m / k ⌉ . Then r ≤ 2 b r\le2b r ≤ 2 b . For j ∈ [ r − 1 ] j\in[r-1] j ∈ [ r − 1 ] , define I j = [ i + ( j − 1 ) k , i + j k − 1 ] I_j=[i+(j-1)k,i+jk-1] I j = [ i + ( j − 1 ) k , i + j k − 1 ] . Denote I r = [ i + ( r − 1 ) k , i + m − 1 ] I_r=[i+(r-1)k,i+m-1] I r = [ i + ( r − 1 ) k , i + m − 1 ] . Clearly, I 1 , … , I r I_1,\ldots,I_r I 1 , … , I r are sub-intervals of I I I of length at most k k k . Moreover, they form a partition of I I I .
Suppose that codewords x , y ∈ C x,y\in C x , y ∈ C agree outside I I I , i.e., x [ n ] ∖ I = y [ n ] ∖ I x_{[n]\setminus I}=y_{[n]\setminus I} x [ n ] ∖ I = y [ n ] ∖ I . Form z ∈ Σ q n z\in\Sigma_q^n z ∈ Σ q n as follows:
z [ n ] ∖ I = x [ n ] ∖ I = y [ n ] ∖ I , z I j = x I j for j ≤ ⌈ r / 2 ⌉ , z I j = y I j for j > ⌈ r / 2 ⌉ . \begin{aligned}
z_{[n]\setminus I}&=x_{[n]\setminus I}=y_{[n]\setminus I},\\
z_{I_j}&=x_{I_j}\quad\text{for }j\le\lceil r/2\rceil,\\
z_{I_j}&=y_{I_j}\quad\text{for }j>\lceil r/2\rceil.
\end{aligned} z [ n ] ∖ I z I j z I j = x [ n ] ∖ I = y [ n ] ∖ I , = x I j for j ≤ ⌈ r /2 ⌉ , = y I j for j > ⌈ r /2 ⌉ .
Since r ≤ 2 b r\le2b r ≤ 2 b , we have ⌈ r / 2 ⌉ , r − ⌈ r / 2 ⌉ ≤ b \lceil r/2\rceil,r-\lceil r/2\rceil\le b ⌈ r /2 ⌉ , r − ⌈ r /2 ⌉ ≤ b . Then it follows that z ∈ E b , k ( x ) ∩ E b , k ( y ) z\in E_{b,k}(x)\cap E_{b,k}(y) z ∈ E b , k ( x ) ∩ E b , k ( y ) . This implies x = y x=y x = y because C C C is a ( b , k ) (b,k) ( b , k ) -substring-edit correcting code. Therefore, it holds that x [ n ] ∖ I ≠ y [ n ] ∖ I x_{[n]\setminus I}\ne y_{[n]\setminus I} x [ n ] ∖ I = y [ n ] ∖ I for any distinct x , y ∈ C x,y\in C x , y ∈ C , which gives ∣ C ∣ ≤ q n − m = q max { n − 2 k b , 0 } |C|\le q^{n-m}=q^{\max\{n-2kb,0\}} ∣ C ∣ ≤ q n − m = q m a x { n − 2 k b , 0 } .
We next prove the second upper bound. Since C C C is a ( b , k ) (b,k) ( b , k ) -substring-edit correcting code, by the sphere-packing argument, it is sufficient to establish the following lower bound on the size of E b , k ( x ) ∩ Σ q n E_{b,k}(x)\cap\Sigma_q^n E b , k ( x ) ∩ Σ q n .
Claim. For every x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n , it holds that ∣ E b , k ( x ) ∩ Σ q n ∣ ≥ V q , k , b ( n ) |E_{b,k}(x)\cap\Sigma_q^n|\ge V_{q,k,b}(n) ∣ E b , k ( x ) ∩ Σ q n ∣ ≥ V q , k , b ( n ) .
Proof of Claim: It is clear that x ∈ E b , k ( x ) ∩ Σ q n x\in E_{b,k}(x)\cap\Sigma_q^n x ∈ E b , k ( x ) ∩ Σ q n . We next estimate the size of E b , k ( x ) ∩ Σ q n ∖ { x } E_{b,k}(x)\cap\Sigma_q^n\setminus\{x\} E b , k ( x ) ∩ Σ q n ∖ { x } . For each integer j ∈ [ τ ] j \in[\tau] j ∈ [ τ ] , choose j j j pairwise disjoint intervals
I h = [ i h , i h + k − 1 ] , 1 ≤ i 1 < ⋯ < i j ≤ n − k + 1 , i h + 1 ≥ i h + k ( 1 ≤ h < j ) . (6) I_h=[i_h,i_h+k-1],\qquad1\le i_1<\cdots<i_j\le n-k+1,\qquad i_{h+1}\ge i_h+k\quad(1\le h<j). \tag*{(6)} I h = [ i h , i h + k − 1 ] , 1 ≤ i 1 < ⋯ < i j ≤ n − k + 1 , i h + 1 ≥ i h + k ( 1 ≤ h < j ) . (6)
For each choice of the tuple ( I 1 , … , I j ) (I_1,\ldots,I_j) ( I 1 , … , I j ) , define j + 1 j+1 j + 1 integers a 1 , a 2 , … , a j + 1 a_1,a_2,\ldots,a_{j+1} a 1 , a 2 , … , a j + 1 as follows:
a 1 = i 1 − 1 , a h = i h − i h − 1 , for every 2 ≤ h ≤ j , a j + 1 = n + 1 − i j . (7) \begin{aligned}
a_1&=i_1-1,\\
a_h&=i_h-i_{h-1},\quad\text{for every }2\le h\le j,\\
a_{j+1}&=n+1-i_j. \tag*{(7)}
\end{aligned} a 1 a h a j + 1 = i 1 − 1 , = i h − i h − 1 , for every 2 ≤ h ≤ j , = n + 1 − i j . (7)
Clearly, the tuple ( a 1 , … , a j + 1 ) (a_1,\ldots,a_{j+1}) ( a 1 , … , a j + 1 ) satisfies
a 1 + a 2 + ⋯ + a j + 1 = n , a 1 ≥ 0 , a h ≥ k , for every 2 ≤ h ≤ j + 1. (8) \begin{aligned}
a_1+a_2+\cdots+a_{j+1}&=n,\\
a_1&\ge0,\\
a_h&\ge k,\quad\text{for every }2\le h\le j+1. \tag*{(8)}
\end{aligned} a 1 + a 2 + ⋯ + a j + 1 a 1 a h = n , ≥ 0 , ≥ k , for every 2 ≤ h ≤ j + 1. (8)
On the other hand, it follows from (7) that each tuple ( a 1 , … , a j + 1 ) ∈ Z j + 1 (a_1,\ldots,a_{j+1})\in\mathbb{Z}^{j+1} ( a 1 , … , a j + 1 ) ∈ Z j + 1 satisfying (8) uniquely determines a tuple ( I 1 , … , I j ) (I_1,\ldots,I_j) ( I 1 , … , I j ) satisfying (6) . Therefore, for each j ∈ [ τ ] j\in[\tau] j ∈ [ τ ] , the number of the tuples ( I 1 , … , I j ) (I_1,\ldots,I_j) ( I 1 , … , I j ) satisfying (6) equals the number of tuples ( a 1 , … , a j + 1 ) ∈ Z j + 1 (a_1,\ldots,a_{j+1})\in\mathbb{Z}^{j+1} ( a 1 , … , a j + 1 ) ∈ Z j + 1 satisfying (8) , which is ( n − ( k − 1 ) j j ) \binom{n-(k-1)j}{j} ( j n − ( k − 1 ) j ) .
For every j ∈ [ τ ] j\in[\tau] j ∈ [ τ ] and every tuple ( I 1 , … , I j ) (I_1,\ldots,I_j) ( I 1 , … , I j ) that satisfies (6) , form a sequence z ∈ Σ q n z\in\Sigma_q^n z ∈ Σ q n from x x x as follows: on each I h I_h I h , replace x I h x_{I_h} x I h with an arbitrary t ( h ) ∈ Σ q k t^{(h)}\in\Sigma_q^k t ( h ) ∈ Σ q k satisfying t ( h ) ≠ x i h t^{(h)}\ne x_{i_h} t ( h ) = x i h . There are ( q − 1 ) q k − 1 (q-1)q^{k-1} ( q − 1 ) q k − 1 choices for each replacement. By construction, sequences z z z and x x x differ at at least j j j coordinates.
Distinct tuples ( j , I 1 , … , I j , t ( 1 ) , … , t ( j ) ) (j,I_1,\ldots,I_j,t^{(1)},\ldots,t^{(j)}) ( j , I 1 , … , I j , t ( 1 ) , … , t ( j ) ) produce distinct z z z . Indeed, for an output z z z , let D ( x , z ) = { i ∈ [ n ] : x i ≠ z i } D(x,z)=\{i\in[n]:x_i\ne z_i\} D ( x , z ) = { i ∈ [ n ] : x i = z i } , which is not empty because x ≠ z x\ne z x = z . Then i 1 = min D ( x , z ) i_1=\min D(x,z) i 1 = min D ( x , z ) and thus, the interval I 1 I_1 I 1 is determined. After removing the elements of D ( x , z ) D(x,z) D ( x , z ) that lie in I 1 I_1 I 1 , the smallest remaining element, if one exists, is i 2 i_2 i 2 . This gives I 2 I_2 I 2 . Repeating this procedure recovers j j j and all the intervals I 1 , … , I j I_1,\ldots,I_j I 1 , … , I j . Finally, we have ( t ( 1 ) , … , t ( j ) ) = ( z I 1 , … , z I j ) (t^{(1)},\ldots,t^{(j)})=(z_{I_1},\ldots,z_{I_j}) ( t ( 1 ) , … , t ( j ) ) = ( z I 1 , … , z I j ) .
The preceding argument shows that E b , k ( x ) ∩ Σ q n ∖ { x } E_{b,k}(x)\cap\Sigma_q^n\setminus\{x\} E b , k ( x ) ∩ Σ q n ∖ { x } is at least the number of tuples ( j , I 1 , … , I j , t ( 1 ) , … , t ( j ) ) (j,I_1,\ldots,I_j,t^{(1)},\ldots,t^{(j)}) ( j , I 1 , … , I j , t ( 1 ) , … , t ( j ) ) , which is ∑ j = 1 τ ( n − ( k − 1 ) j j ) ( ( q − 1 ) q k − 1 ) j = V q , k , b ( n ) − 1 \sum_{j=1}^{\tau}\binom{n-(k-1)j}{j}\bigl((q-1)q^{k-1}\bigr)^j=V_{q,k,b}(n)-1 ∑ j = 1 τ ( j n − ( k − 1 ) j ) ( ( q − 1 ) q k − 1 ) j = V q , k , b ( n ) − 1 . This completes the proof of the claim. □
Finally, if n ≥ 2 k b n\ge2kb n ≥ 2 k b , the term with j = b j=b j = b gives
V q , k , b ( n ) ≥ ( n − ( k − 1 ) b b ) ( ( q − 1 ) q k − 1 ) b ≥ ( n − ( k − 1 ) b b ) b ( ( q − 1 ) q k − 1 ) b ≥ ( n 2 b ) b ( ( q − 1 ) q k − 1 ) b . \begin{aligned}
V_{q,k,b}(n)\ge\binom{n-(k-1)b}{b}\bigl((q-1)q^{k-1}\bigr)^b \\
&\ge\left(\frac{n-(k-1)b}{b}\right)^b\bigl((q-1)q^{k-1}\bigr)^b \\
&\ge\left(\frac{n}{2b}\right)^b\bigl((q-1)q^{k-1}\bigr)^b.
\end{aligned} V q , k , b ( n ) ≥ ( b n − ( k − 1 ) b ) ( ( q − 1 ) q k − 1 ) b ≥ ( b n − ( k − 1 ) b ) b ( ( q − 1 ) q k − 1 ) b ≥ ( 2 b n ) b ( ( q − 1 ) q k − 1 ) b .
Now (5) follows.
Throughout the rest of this paper, parameters q q q and k k k are assumed to be fixed integers which are independent of the code-length n n n . Our objective is to construct k k k -substring edit correcting codes with small redundancy.
The following two definitions will make the exposition in this paper clearer and more precise.
Definition II.3 (edit region). Let x x x and y y y be represented as in (2) and (3) . Set i = ∣ u ∣ i=|u| i = ∣ u ∣ . If ∣ s ∣ > 0 |s|>0 ∣ s ∣ > 0 , the edit region in x x x is the interval [ i + 1 , i + ∣ s ∣ ] [i+1,i+|s|] [ i + 1 , i + ∣ s ∣ ] . If ∣ s ∣ = 0 |s|=0 ∣ s ∣ = 0 , it must be that ∣ t ∣ > 0 |t|>0 ∣ t ∣ > 0 . In this case, the edit region in x x x is the gap g = i + 1 g=i+1 g = i + 1 between x i x_i x i and x i + 1 x_{i+1} x i + 1 , with the convention that g = 1 g=1 g = 1 precedes the first symbol x 1 x_1 x 1 and g = ∣ x ∣ + 1 g=|x|+1 g = ∣ x ∣ + 1 follows the last symbol x ∣ x ∣ x_{|x|} x ∣ x ∣ . Equivalently, if ∣ s ∣ > 0 |s|>0 ∣ s ∣ > 0 , the edit region is the coordinates occupied by s s s ; if ∣ s ∣ = 0 |s|=0 ∣ s ∣ = 0 , the edit region is the position where t t t is inserted. The edit region in y y y is defined analogously using t t t .
By definition, the edit region in x x x is a sub-interval of [ 1 , ∣ x ∣ ] [1,|x|] [ 1 , ∣ x ∣ ] when s s s is not empty, or a gap between coordinates when s s s is empty. The same observation holds for y y y . Figure 1 illustrates Definition II.3.
Figure 1. Edit regions for the specified decomposition x = u s v x=usv x = u s v , y = u t v y=utv y = u t v , where i = ∣ u ∣ i=|u| i = ∣ u ∣ : (a) replacement of a nonempty substring by a nonempty sequence; (b) pure insertion; (c) pure deletion. In (c), the interval occupied by s s s in x x x becomes a gap in y y y .
Definition II.4 (covering an edit region). For a coordinate interval J = [ a , b ] ⊆ [ 1 , ∣ x ∣ ] J=[a,b]\subseteq[1,|x|] J = [ a , b ] ⊆ [ 1 , ∣ x ∣ ] , we say that J J J or x J x_J x J covers the edit region in x x x if [ i + 1 , i + ∣ s ∣ ] ⊆ J [i+1,i+|s|]\subseteq J [ i + 1 , i + ∣ s ∣ ] ⊆ J when ∣ s ∣ > 0 |s|>0 ∣ s ∣ > 0 , and if a ≤ i + 1 ≤ b + 1 a\le i+1\le b+1 a ≤ i + 1 ≤ b + 1 when ∣ s ∣ = 0 |s|=0 ∣ s ∣ = 0 . Coverage in y y y is defined in the same way.
Notice that the above definition allows a gap at either endpoint of a substring to be regarded as covered by that substring.
Example II.1. Here we give some examples to illustrate Definitions II.3 and II.4. Each edit region refers to the specified decomposition in (2) .
( i ) (i) ( i ) Let u = 01 u=01 u = 01 , s = 10 s=10 s = 10 , t = 01 t=01 t = 01 , and v = 01 v=01 v = 01 . Replacing s s s by t t t changes x = 011001 x=011001 x = 011001 to y = 010101 y=010101 y = 010101 . Both edit regions are [ 3 , 4 ] [3,4] [ 3 , 4 ] . The interval [ 2 , 5 ] [2,5] [ 2 , 5 ] covers either region, whereas [ 3 , 3 ] [3,3] [ 3 , 3 ] does not.
(ii) Let u = 01 u=01 u = 01 , s = 10 s=10 s = 10 , t = ϵ t=\epsilon t = ϵ , and v = 01 v=01 v = 01 . Deleting s s s changes x = 011001 x=011001 x = 011001 to y = 0101 y=0101 y = 0101 . The edit region in x x x is [ 3 , 4 ] [3,4] [ 3 , 4 ] , and the edit region in y y y is the gap g = 3 g=3 g = 3 . In y y y , each of [ 1 , 2 ] [1,2] [ 1 , 2 ] , [ 3 , 4 ] [3,4] [ 3 , 4 ] and [ 2 , 3 ] [2,3] [ 2 , 3 ] covers this gap. The interval [ 1 , 1 ] [1,1] [ 1 , 1 ] does not cover it.
(iii) Reversing the edit in (ii) inserts 10 10 10 into x = 0101 x=0101 x = 0101 and gives y = 011001 y=011001 y = 011001 . The edit region in x x x is now the gap g = 3 g=3 g = 3 , and that in y y y is [ 3 , 4 ] [3,4] [ 3 , 4 ] .
(iv) For x = 01 x=01 x = 01 , insertion before the first symbol has gap g = 1 g=1 g = 1 , covered by [ 1 , 1 ] [1,1] [ 1 , 1 ] . Insertion after the last symbol has gap g = 3 g=3 g = 3 , covered by [ 2 , 2 ] [2,2] [ 2 , 2 ] . Thus endpoint insertions are included in Definition II.4.
In this paper, we measure computational complexity in bit operations. A bit operation reads, writes, or applies a Boolean operation to a fixed number of bits. The following standard bounds for elementary integer arithmetic will be used in our syndrome-computation and decoding analyses. For an integer a a a , define its binary length by len ( 0 ) = 1 \operatorname{len}(0)=1 len ( 0 ) = 1 and len ( a ) = ⌊ log ∣ a ∣ ⌋ + 1 \operatorname{len}(a)=\lfloor\log|a|\rfloor+1 len ( a ) = ⌊ log ∣ a ∣ ⌋ + 1 when a ≠ 0 a\ne0 a = 0 .
Proposition II.1. [22 Theorem 3.3] Let a , b ∈ Z a,b\in\mathbb{Z} a , b ∈ Z . Then the following computations can be performed deterministically.
(i) Addition and subtraction, a ± b a\pm b a ± b , require O ( len ( a ) + len ( b ) ) O(\operatorname{len}(a)+\operatorname{len}(b)) O ( len ( a ) + len ( b )) bit operations.
(ii) Multiplication, a b ab ab , requires O ( len ( a ) len ( b ) ) O(\operatorname{len}(a)\operatorname{len}(b)) O ( len ( a ) len ( b )) bit operations.
(iii) If b > 0 b>0 b > 0 , the quotient c = ⌊ a / b ⌋ c=\lfloor a/b\rfloor c = ⌊ a / b ⌋ and the remainder r = a − b c ∈ [ 0 , b − 1 ] r=a-bc\in[0,b-1] r = a − b c ∈ [ 0 , b − 1 ] can be computed in O ( len ( b ) len ( c ) ) O(\operatorname{len}(b)\operatorname{len}(c)) O ( len ( b ) len ( c )) bit operations. In particular, this is O ( len ( a ) len ( b ) ) O(\operatorname{len}(a)\operatorname{len}(b)) O ( len ( a ) len ( b )) .
Thus, for integers represented using at most λ \lambda λ bits, addition, subtraction, and comparison cost O ( λ ) O(\lambda) O ( λ ) bit operations, whereas multiplication and division with remainder cost O ( λ 2 ) O(\lambda^2) O ( λ 2 ) bit operations.
A General Framework for Locating One k-Substring Edit Error
Let x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n and y y y be obtained from x x x by a nontrivial k k k -substring edit. Represent x x x and y y y as in (2) with the convention in (3). This section establishes sufficient conditions for determining an interval I ⊆ [ n ] I\subseteq[n] I ⊆ [ n ] with ∣ I ∣ = O q , k ( log n ) |I|=O_{q,k}(\log n) ∣ I ∣ = O q , k ( log n ) that covers the edit region in x x x . The main result is presented in Theorem III.1.
Let x [ i 1 , j 1 ] x[i_1,j_1] x [ i 1 , j 1 ] and x [ i 2 , j 2 ] x[i_2,j_2] x [ i 2 , j 2 ] be two substrings of x x x . We say that they are overlapping (or x [ i 1 , j 1 ] x[i_1,j_1] x [ i 1 , j 1 ] overlaps with x [ i 2 , j 2 ] x[i_2,j_2] x [ i 2 , j 2 ] ) if [ i 1 , j 1 ] ∩ [ i 2 , j 2 ] ≠ ∅ [i_1,j_1]\cap[i_2,j_2]\ne\varnothing [ i 1 , j 1 ] ∩ [ i 2 , j 2 ] = ∅ and non-overlapping otherwise.
A partition rule P \mathcal{P} P is a rule under which we divide every nonempty sequence a a a into several non-overlapping nonempty substrings whose concatenation is a a a . Each of these substrings is called a segment of a a a under the partition rule. Let m P ( a ) m_{\mathcal{P}}(a) m P ( a ) denote the number of segments of a a a under partition rule P \mathcal{P} P . Denote
Part P ( a ) = ( a 1 P , a 2 P , … , a m P ( a ) P ) . \operatorname{Part}_{\mathcal{P}}(a)=\left(a_1^{\mathcal{P}},a_2^{\mathcal{P}},\ldots,a_{m_{\mathcal{P}}(a)}^{\mathcal{P}}\right). Part P ( a ) = ( a 1 P , a 2 P , … , a m P ( a ) P ) .
where a i P a_i^{\mathcal{P}} a i P is the i i i -th segment of a a a . By definition, we have a = a 1 P a 2 P ⋯ a m P ( a ) P a=a_1^{\mathcal{P}}a_2^{\mathcal{P}}\cdots a_{m_{\mathcal{P}}(a)}^{\mathcal{P}} a = a 1 P a 2 P ⋯ a m P ( a ) P .
For a function f : Σ q ∗ → Z ≥ 0 f:\Sigma_q^*\to\mathbb{Z}_{\ge0} f : Σ q ∗ → Z ≥ 0 , define
F P ( a ) = ( f ( a 1 P ) , f ( a 2 P ) , … , f ( a m P ( a ) P ) ) . F_{\mathcal{P}}(a)=\left(f\left(a_1^{\mathcal{P}}\right),f\left(a_2^{\mathcal{P}}\right),\ldots,f\left(a_{m_{\mathcal{P}}(a)}^{\mathcal{P}}\right)\right). F P ( a ) = ( f ( a 1 P ) , f ( a 2 P ) , … , f ( a m P ( a ) P ) ) .
In other words, F P ( a ) F_{\mathcal{P}}(a) F P ( a ) is the sequence over Z ≥ 0 \mathbb{Z}_{\ge0} Z ≥ 0 obtained by applying f f f to every segment of a a a .
Let x x x and y y y be given at the beginning of this section. We further make the following assumption throughout this section.
Assumption 1. There exist integers p 1 , p 2 ≥ 0 p_1,p_2\ge0 p 1 , p 2 ≥ 0 and 1 ≤ l 1 , l 2 ≤ K 1\le l_1,l_2\le K 1 ≤ l 1 , l 2 ≤ K such that
Part P ( x ) = ( e 1 , … , e p 1 , a 1 , … , a l 1 , h 1 , … , h p 2 ) , \operatorname{Part}_{\mathcal{P}}(x)=\left(e_1,\ldots,e_{p_1},a_1,\ldots,a_{l_1},h_1,\ldots,h_{p_2}\right), Part P ( x ) = ( e 1 , … , e p 1 , a 1 , … , a l 1 , h 1 , … , h p 2 ) ,
Part P ( y ) = ( e 1 , … , e p 1 , b 1 , … , b l 2 , h 1 , … , h p 2 ) . \operatorname{Part}_{\mathcal{P}}(y)=\left(e_1,\ldots,e_{p_1},b_1,\ldots,b_{l_2},h_1,\ldots,h_{p_2}\right). Part P ( y ) = ( e 1 , … , e p 1 , b 1 , … , b l 2 , h 1 , … , h p 2 ) .
The edit region in x x x is covered by the substring a 1 ⋯ a l 1 a_1\cdots a_{l_1} a 1 ⋯ a l 1 , and the edit region in y y y is covered by the substring b 1 ⋯ b l 2 b_1\cdots b_{l_2} b 1 ⋯ b l 2 .
Under this assumption, denote
u ′ = ( f ( e 1 ) , … , f ( e p 1 ) ) , s ′ = ( f ( a 1 ) , … , f ( a l 1 ) ) , u'=(f(e_1),\ldots,f(e_{p_1})),\ s'=(f(a_1),\ldots,f(a_{l_1})), u ′ = ( f ( e 1 ) , … , f ( e p 1 )) , s ′ = ( f ( a 1 ) , … , f ( a l 1 )) ,
v ′ = ( f ( h 1 ) , … , f ( h p 2 ) ) , t ′ = ( f ( b 1 ) , … , f ( b l 2 ) ) . v'=(f(h_1),\ldots,f(h_{p_2})),\ t'=(f(b_1),\ldots,f(b_{l_2})). v ′ = ( f ( h 1 ) , … , f ( h p 2 )) , t ′ = ( f ( b 1 ) , … , f ( b l 2 )) .
Then it holds that
F P ( x ) = u ′ s ′ v ′ , F P ( y ) = u ′ t ′ v ′ . (9) F_P(x)=u's'v',\quad F_P(y)=u't'v'. \tag*{(9)} F P ( x ) = u ′ s ′ v ′ , F P ( y ) = u ′ t ′ v ′ . (9)
Clearly, F P ( y ) F_P(y) F P ( y ) is obtained from F P ( x ) F_P(x) F P ( x ) by a K K K -substring edit. To locate the k k k -substring edit error in x x x , the idea is to locate the K K K -substring edit error in F P ( x ) F_P(x) F P ( x ) .
Notice that both F P ( x ) F_P(x) F P ( x ) and F P ( y ) F_P(y) F P ( y ) are sequences over the alphabet Z ≥ 0 \mathbb{Z}_{\geq0} Z ≥ 0 . We now study the induced edit independently of its underlying partition. In the rest of this section, assume that z ∈ Z ≥ 0 ∗ z\in\mathbb{Z}_{\geq0}^{*} z ∈ Z ≥ 0 ∗ and that w w w is obtained from z z z by a nontrivial K K K -substring edit for some K ≥ 2 K\geq2 K ≥ 2 . Denote
d = ∣ w ∣ − ∣ z ∣ , E = wt L 1 ( z ) − wt L 1 ( w ) , Δ V T = V T ( z ) − V T ( w ) , (10) d=|w|-|z|,\quad E=\operatorname{wt}_{L_1}(z)-\operatorname{wt}_{L_1}(w),\quad\Delta_{\mathrm{VT}}=\mathrm{VT}(z)-\mathrm{VT}(w), \tag*{(10)} d = ∣ w ∣ − ∣ z ∣ , E = wt L 1 ( z ) − wt L 1 ( w ) , Δ VT = VT ( z ) − VT ( w ) , (10)
where the two functions wt L 1 ( ⋅ ) \operatorname{wt}_{L_1}(\cdot) wt L 1 ( ⋅ ) and V T ( ⋅ ) \mathrm{VT}(\cdot) VT ( ⋅ ) are defined in (1).
We first consider the case ∣ z ∣ = ∣ w ∣ |z|=|w| ∣ z ∣ = ∣ w ∣ . For r ∈ { 0 , 1 , 2 } r\in\{0,1,2\} r ∈ { 0 , 1 , 2 } , define the function G r : Z ≥ 0 ∗ → Z ≥ 0 G_r:\mathbb{Z}_{\geq0}^{*}\to\mathbb{Z}_{\geq0} G r : Z ≥ 0 ∗ → Z ≥ 0 by
G r ( a ) = ∑ i ∈ [ ∣ a ∣ ] i ≡ r ( m o d 3 ) a i . (11) G_r(a)=\sum_{\substack{i\in[|a|]\\ i\equiv r\pmod3}}a_i. \tag*{(11)} G r ( a ) = i ∈ [ ∣ a ∣ ] i ≡ r ( mod 3 ) ∑ a i . (11)
Proposition III.1. Let d d d , E E E and Δ V T \Delta_{\mathrm{VT}} Δ VT be defined in (10). Suppose that d = 0 d=0 d = 0 , and that z z z and w w w differ in one coordinate or two consecutive coordinates. For 0 ≤ r ≤ 2 0\leq r\leq2 0 ≤ r ≤ 2 , set c r = G r ( z ) − G r ( w ) c_r=G_r(z)-G_r(w) c r = G r ( z ) − G r ( w ) . If E ≠ 0 E\ne0 E = 0 , and all the values of E E E , Δ V T \Delta_{\mathrm{VT}} Δ VT , c 0 c_0 c 0 and c 1 c_1 c 1 are known, we can determine exactly the first index at which z z z and w w w differ.
Proof: It is clear that c 0 + c 1 + c 2 = E c_0+c_1+c_2=E c 0 + c 1 + c 2 = E . Thus, we can obtain c 2 c_2 c 2 when c 0 c_0 c 0 , c 1 c_1 c 1 and E E E are given. Since z z z and w w w differ in one or two consecutive coordinates, exactly one or two of c 0 c_0 c 0 , c 1 c_1 c 1 and c 2 c_2 c 2 are nonzero.
If only one of c 0 c_0 c 0 , c 1 c_1 c 1 and c 2 c_2 c 2 is nonzero, there is a unique j j j such that z j ≠ w j z_j\ne w_j z j = w j . The definitions of E E E and Δ V T \Delta_{\mathrm{VT}} Δ VT give E = z j − w j E=z_j-w_j E = z j − w j and Δ V T = j ( z j − w j ) \Delta_{\mathrm{VT}}=j(z_j-w_j) Δ VT = j ( z j − w j ) . Therefore, j = Δ V T / E j=\Delta_{\mathrm{VT}}/E j = Δ VT / E .
Now suppose that exactly two of c 0 c_0 c 0 , c 1 c_1 c 1 and c 2 c_2 c 2 are nonzero. Then there are two indices j j j and j + 1 j+1 j + 1 at which z z z and w w w differ. Let r r r be the unique element of { 0 , 1 , 2 } \{0,1,2\} { 0 , 1 , 2 } satisfying c r = 0 c_r=0 c r = 0 . It follows that j ≡ r + 1 ( m o d 3 ) j\equiv r+1\pmod3 j ≡ r + 1 ( mod 3 ) and z j + 1 − w j + 1 = c ( r + 2 ) m o d 3 z_{j+1}-w_{j+1}=c_{(r+2)\bmod3} z j + 1 − w j + 1 = c ( r + 2 ) mod 3 . Moreover,
Δ V T = j ( z j − w j ) + ( j + 1 ) ( z j + 1 − w j + 1 ) = j ( z j − w j + z j + 1 − w j + 1 ) + z j + 1 − w j + 1 = j ⋅ E + z j + 1 − w j + 1 . \begin{aligned}
\Delta_{\mathrm{VT}}&=j(z_j-w_j)+(j+1)(z_{j+1}-w_{j+1})\\
&=j(z_j-w_j+z_{j+1}-w_{j+1})+z_{j+1}-w_{j+1}\\
&=j\cdot E+z_{j+1}-w_{j+1}.
\end{aligned} Δ VT = j ( z j − w j ) + ( j + 1 ) ( z j + 1 − w j + 1 ) = j ( z j − w j + z j + 1 − w j + 1 ) + z j + 1 − w j + 1 = j ⋅ E + z j + 1 − w j + 1 . Consequently, it holds that j = ( Δ V T − c ( r + 2 ) m o d 3 ) / E j=(\Delta_{\mathrm{VT}}-c_{(r+2)\bmod3})/E j = ( Δ VT − c ( r + 2 ) mod 3 ) / E . This completes the proof.
Next we consider the case ∣ z ∣ ≠ ∣ w ∣ |z|\ne|w| ∣ z ∣ = ∣ w ∣ . Let d d d and E E E be given in (10). Since z → K w z\to_K w z → K w , there are sequences u ′ u' u ′ , v ′ v' v ′ , s ′ s' s ′ , and t ′ t' t ′ with ∣ s ′ ∣ , ∣ t ′ ∣ ≤ K |s'|,|t'|\leq K ∣ s ′ ∣ , ∣ t ′ ∣ ≤ K , such that
z = u ′ s ′ v ′ , w = u ′ t ′ v ′ . (12) z=u's'v',\quad w=u't'v'. \tag*{(12)} z = u ′ s ′ v ′ , w = u ′ t ′ v ′ . (12)
For r ∈ [ 0 , ∣ w ∣ ] r\in[0,|w|] r ∈ [ 0 , ∣ w ∣ ] , define
r ∗ = ∣ u ′ ∣ , η ( r ) = − d ∑ i = r + 1 ∣ w ∣ w i + r ⋅ E . (13) r^{*}=|u'|,\quad\eta(r)=-d\sum_{i=r+1}^{|w|}w_i+r\cdot E. \tag*{(13)} r ∗ = ∣ u ′ ∣ , η ( r ) = − d i = r + 1 ∑ ∣ w ∣ w i + r ⋅ E . (13)
Lemmas III.1 and III.2 appeared in the proof of [2 Lemma 4] . We present their proofs here for completeness.
Lemma III.1. If d ≠ 0 d\ne0 d = 0 and ∣ E ∣ ≤ w i |E|\leq w_i ∣ E ∣ ≤ w i for all i ∈ [ ∣ w ∣ ] i\in[|w|] i ∈ [ ∣ w ∣ ] , the function η ( r ) \eta(r) η ( r ) is monotone in r r r .
Proof: By definition, for r , r − 1 ∈ [ 0 , ∣ w ∣ ] r,r-1\in[0,|w|] r , r − 1 ∈ [ 0 , ∣ w ∣ ] , it holds that η ( r ) − η ( r − 1 ) = d ⋅ w r + E \eta(r)-\eta(r-1)=d\cdot w_r+E η ( r ) − η ( r − 1 ) = d ⋅ w r + E . Since d d d is a non-zero integer and ∣ E ∣ ≤ w i |E|\leq w_i ∣ E ∣ ≤ w i for all i ∈ [ ∣ w ∣ ] i\in[|w|] i ∈ [ ∣ w ∣ ] , we have η ( r ) − η ( r − 1 ) ≥ 0 \eta(r)-\eta(r-1)\geq0 η ( r ) − η ( r − 1 ) ≥ 0 if d > 0 d>0 d > 0 and η ( r ) − η ( r − 1 ) ≤ 0 \eta(r)-\eta(r-1)\leq0 η ( r ) − η ( r − 1 ) ≤ 0 if d < 0 d<0 d < 0 .
For a positive integer A A A , a sequence a ∈ Z ≥ 0 ∗ a\in\mathbb{Z}_{\geq0}^{*} a ∈ Z ≥ 0 ∗ is called A A A -bounded if a i ≤ A a_i\leq A a i ≤ A for every i ∈ [ ∣ a ∣ ] i\in[|a|] i ∈ [ ∣ a ∣ ] .
Lemma III.2. Let Δ V T \Delta_{\mathrm{VT}} Δ VT be defined in (10), and r ∗ r^{*} r ∗ and η ( ⋅ ) \eta(\cdot) η ( ⋅ ) be defined in (13). If both z z z and w w w are A A A -bounded, then ∣ Δ V T − η ( r ∗ ) ∣ < 2 K 2 A |\Delta_{\mathrm{VT}}-\eta(r^{*})|<2K^2A ∣ Δ VT − η ( r ∗ ) ∣ < 2 K 2 A .
Proof: It follows from (12) that z [ 1 , r ∗ ] = w [ 1 , r ∗ ] = u ′ z_{[1,r^*]}=w_{[1,r^*]}=u' z [ 1 , r ∗ ] = w [ 1 , r ∗ ] = u ′ , z [ r ∗ + ∣ s ′ ∣ + 1 , ∣ z ∣ ] = w [ r ∗ + ∣ t ′ ∣ + 1 , ∣ w ∣ ] = v ′ z_{[r^*+|s'|+1,|z|]}=w_{[r^*+|t'|+1,|w|]}=v' z [ r ∗ + ∣ s ′ ∣ + 1 , ∣ z ∣ ] = w [ r ∗ + ∣ t ′ ∣ + 1 , ∣ w ∣ ] = v ′ , z [ r ∗ + 1 , r ∗ + ∣ s ′ ∣ ] = s ′ z_{[r^*+1,r^*+|s'|]}=s' z [ r ∗ + 1 , r ∗ + ∣ s ′ ∣ ] = s ′ and w [ r ∗ + 1 , r ∗ + ∣ t ′ ∣ ] = t ′ w_{[r^*+1,r^*+|t'|]}=t' w [ r ∗ + 1 , r ∗ + ∣ t ′ ∣ ] = t ′ . This implies that d = ∣ w ∣ − ∣ z ∣ = ∣ t ′ ∣ − ∣ s ′ ∣ d=|w|-|z|=|t'|-|s'| d = ∣ w ∣ − ∣ z ∣ = ∣ t ′ ∣ − ∣ s ′ ∣ and E = wt L 1 ( z ) − wt L 1 ( w ) = wt L 1 ( s ′ ) − wt L 1 ( t ′ ) E=\operatorname{wt}_{L_1}(z)-\operatorname{wt}_{L_1}(w)=\operatorname{wt}_{L_1}(s')-\operatorname{wt}_{L_1}(t') E = wt L 1 ( z ) − wt L 1 ( w ) = wt L 1 ( s ′ ) − wt L 1 ( t ′ ) . Therefore, we have
Δ V T = V T ( z ) − V T ( w ) = ∑ i = r ∗ + 1 r ∗ + ∣ s ′ ∣ i z i + ∑ i = r ∗ + ∣ s ′ ∣ + 1 ∣ z ∣ i z i − ∑ i = r ∗ + 1 r ∗ + ∣ t ′ ∣ i w i − ∑ i = r ∗ + ∣ t ′ ∣ + 1 ∣ w ∣ i w i = ( ∑ i = r ∗ + 1 r ∗ + ∣ s ′ ∣ i z i − ∑ i = r ∗ + 1 r ∗ + ∣ t ′ ∣ i w i ) + ( ∑ i = r ∗ + ∣ s ′ ∣ + 1 ∣ z ∣ i z i − ∑ i = r ∗ + ∣ t ′ ∣ + 1 ∣ w ∣ i w i ) = V T ( s ′ ) − V T ( t ′ ) + r ∗ ( wt L 1 ( s ′ ) − wt L 1 ( t ′ ) ) − ( ∣ t ′ ∣ − ∣ s ′ ∣ ) ∑ i = r ∗ + ∣ t ′ ∣ + 1 ∣ w ∣ w i (14) \begin{aligned}
\Delta_{\mathrm{VT}}&=\mathrm{VT}(z)-\mathrm{VT}(w)\\
&=\sum_{i=r^*+1}^{r^*+|s'|}iz_i+\sum_{i=r^*+|s'|+1}^{|z|}iz_i-\sum_{i=r^*+1}^{r^*+|t'|}iw_i-\sum_{i=r^*+|t'|+1}^{|w|}iw_i\\
&=\left(\sum_{i=r^*+1}^{r^*+|s'|}iz_i-\sum_{i=r^*+1}^{r^*+|t'|}iw_i\right)+\left(\sum_{i=r^*+|s'|+1}^{|z|}iz_i-\sum_{i=r^*+|t'|+1}^{|w|}iw_i\right)\\
&=\mathrm{VT}(s')-\mathrm{VT}(t')+r^*\left(\operatorname{wt}_{L_1}(s')-\operatorname{wt}_{L_1}(t')\right)-\left(|t'|-|s'|\right)\sum_{i=r^*+|t'|+1}^{|w|}w_i \tag*{(14)}
\end{aligned} Δ VT = VT ( z ) − VT ( w ) = i = r ∗ + 1 ∑ r ∗ + ∣ s ′ ∣ i z i + i = r ∗ + ∣ s ′ ∣ + 1 ∑ ∣ z ∣ i z i − i = r ∗ + 1 ∑ r ∗ + ∣ t ′ ∣ i w i − i = r ∗ + ∣ t ′ ∣ + 1 ∑ ∣ w ∣ i w i = i = r ∗ + 1 ∑ r ∗ + ∣ s ′ ∣ i z i − i = r ∗ + 1 ∑ r ∗ + ∣ t ′ ∣ i w i + i = r ∗ + ∣ s ′ ∣ + 1 ∑ ∣ z ∣ i z i − i = r ∗ + ∣ t ′ ∣ + 1 ∑ ∣ w ∣ i w i = VT ( s ′ ) − VT ( t ′ ) + r ∗ ( wt L 1 ( s ′ ) − wt L 1 ( t ′ ) ) − ( ∣ t ′ ∣ − ∣ s ′ ∣ ) i = r ∗ + ∣ t ′ ∣ + 1 ∑ ∣ w ∣ w i (14)
= − d ∑ i = r ∗ + 1 ∣ w ∣ w i + r ∗ ⋅ E + V T ( s ′ ) − V T ( t ′ ) + ( ∣ t ′ ∣ − ∣ s ′ ∣ ) ∑ i = r ∗ + 1 r ∗ + ∣ t ′ ∣ w i = η ( r ∗ ) + V T ( s ′ ) − V T ( t ′ ) + ( ∣ t ′ ∣ − ∣ s ′ ∣ ) wt L 1 ( t ′ ) . \begin{aligned}
&=-d\sum_{i=r^*+1}^{|w|}w_i+r^*\cdot E+\mathrm{VT}(s')-\mathrm{VT}(t')+\left(|t'|-|s'|\right)\sum_{i=r^*+1}^{r^*+|t'|}w_i\\
&=\eta(r^*)+\mathrm{VT}(s')-\mathrm{VT}(t')+\left(|t'|-|s'|\right)\operatorname{wt}_{L_1}(t').
\end{aligned} = − d i = r ∗ + 1 ∑ ∣ w ∣ w i + r ∗ ⋅ E + VT ( s ′ ) − VT ( t ′ ) + ( ∣ t ′ ∣ − ∣ s ′ ∣ ) i = r ∗ + 1 ∑ r ∗ + ∣ t ′ ∣ w i = η ( r ∗ ) + VT ( s ′ ) − VT ( t ′ ) + ( ∣ t ′ ∣ − ∣ s ′ ∣ ) wt L 1 ( t ′ ) .
Since both z z z and w w w are A A A -bounded, K ≥ 2 K\ge2 K ≥ 2 , and ∣ s ′ ∣ , ∣ t ′ ∣ ≤ K |s'|,|t'|\le K ∣ s ′ ∣ , ∣ t ′ ∣ ≤ K , it holds that ∣ V T ( s ′ ) − V T ( t ′ ) ∣ < K 2 A |\mathrm{VT}(s')-\mathrm{VT}(t')|<K^2A ∣ VT ( s ′ ) − VT ( t ′ ) ∣ < K 2 A , ∣ ∣ t ′ ∣ − ∣ s ′ ∣ ∣ ≤ K \left||t'|-|s'|\right|\le K ∣ ∣ t ′ ∣ − ∣ s ′ ∣ ∣ ≤ K and wt L 1 ( t ′ ) ≤ K A \operatorname{wt}_{L_1}(t')\le KA wt L 1 ( t ′ ) ≤ K A . Then it follows that ∣ Δ V T − η ( r ∗ ) ∣ ≤ ∣ V T ( s ′ ) − V T ( t ′ ) ∣ + ∣ ∣ t ′ ∣ − ∣ s ′ ∣ ∣ wt L 1 ( t ′ ) < 2 K 2 A |\Delta_{\mathrm{VT}}-\eta(r^*)|\le|\mathrm{VT}(s')-\mathrm{VT}(t')|+\left||t'|-|s'|\right|\operatorname{wt}_{L_1}(t')<2K^2A ∣ Δ VT − η ( r ∗ ) ∣ ≤ ∣ VT ( s ′ ) − VT ( t ′ ) ∣ + ∣ ∣ t ′ ∣ − ∣ s ′ ∣ ∣ wt L 1 ( t ′ ) < 2 K 2 A .
We next retain the unequal-length assumption d ≠ 0 d\ne0 d = 0 and associate a positive number ℓ i \ell_i ℓ i with w i w_i w i for every i i i .
Proposition III.2. Suppose that z z z and w w w are A A A -bounded. Let d d d , E E E , Δ V T \Delta_{\mathrm{VT}} Δ VT be defined by (10). Assume that d ≠ 0 d\ne0 d = 0 and ∣ E ∣ ≤ w i |E|\le w_i ∣ E ∣ ≤ w i for every i ∈ [ ∣ w ∣ ] i\in[|w|] i ∈ [ ∣ w ∣ ] . Let ℓ 1 , … , ℓ ∣ w ∣ \ell_1,\ldots,\ell_{|w|} ℓ 1 , … , ℓ ∣ w ∣ be positive numbers. Suppose that there are positive numbers C ( 1 ) C^{(1)} C ( 1 ) , C ( 2 ) C^{(2)} C ( 2 ) and C ( 3 ) C^{(3)} C ( 3 ) satisfying:
(i) w i ≥ C ( 1 ) ℓ i w_i\ge C^{(1)}\ell_i w i ≥ C ( 1 ) ℓ i for every i ∈ [ ∣ w ∣ ] i\in[|w|] i ∈ [ ∣ w ∣ ] ;
(ii) ℓ i ≥ C ( 2 ) \ell_i\ge C^{(2)} ℓ i ≥ C ( 2 ) for every i ∈ [ ∣ w ∣ ] i\in[|w|] i ∈ [ ∣ w ∣ ] ;
(iii) ∣ E ∣ ≤ C ( 3 ) |E|\le C^{(3)} ∣ E ∣ ≤ C ( 3 ) ;
(iv) C ( 3 ) < C ( 1 ) C ( 2 ) C^{(3)}<C^{(1)}C^{(2)} C ( 3 ) < C ( 1 ) C ( 2 ) .
Let r ∗ r^* r ∗ and η ( ⋅ ) \eta(\cdot) η ( ⋅ ) be defined as in (13), R = { r ∈ [ 0 , ∣ w ∣ ] : ∣ Δ V T − η ( r ) ∣ < 2 K 2 A } \mathcal{R}=\{r\in[0,|w|]:|\Delta_{\mathrm{VT}}-\eta(r)|<2K^2A\} R = { r ∈ [ 0 , ∣ w ∣ ] : ∣ Δ VT − η ( r ) ∣ < 2 K 2 A } , r 1 = min R r_1=\min\mathcal{R} r 1 = min R and r 2 = max R r_2=\max\mathcal{R} r 2 = max R . Then r ∗ ∈ R r^*\in\mathcal{R} r ∗ ∈ R , R = [ r 1 , r 2 ] \mathcal{R}=[r_1,r_2] R = [ r 1 , r 2 ] , and
∑ i = r 1 + 1 r 2 ℓ i < 4 K 2 A C ( 1 ) − C ( 3 ) C ( 2 ) . (15) \sum_{i=r_1+1}^{r_2}\ell_i<\frac{4K^2A}{C^{(1)}-\frac{C^{(3)}}{C^{(2)}}}. \tag*{(15)} i = r 1 + 1 ∑ r 2 ℓ i < C ( 1 ) − C ( 2 ) C ( 3 ) 4 K 2 A . (15)
Proof: It follows from Lemma III.2 that r ∗ ∈ R r^*\in\mathcal{R} r ∗ ∈ R . By Lemma III.1, the function η ( r ) \eta(r) η ( r ) is monotone in r ∈ [ 0 , ∣ w ∣ ] r\in[0,|w|] r ∈ [ 0 , ∣ w ∣ ] . This implies R = [ r 1 , r 2 ] \mathcal{R}=[r_1,r_2] R = [ r 1 , r 2 ] . Since r 1 , r 2 ∈ R r_1,r_2\in\mathcal{R} r 1 , r 2 ∈ R , we have
∣ η ( r 2 ) − η ( r 1 ) ∣ < 4 K 2 A . (16) |\eta(r_2)-\eta(r_1)|<4K^2A. \tag*{(16)} ∣ η ( r 2 ) − η ( r 1 ) ∣ < 4 K 2 A . (16)
By the definition of η ( ⋅ ) \eta(\cdot) η ( ⋅ ) , it holds that η ( r ) − η ( r − 1 ) = d ⋅ w r + E \eta(r)-\eta(r-1)=d\cdot w_r+E η ( r ) − η ( r − 1 ) = d ⋅ w r + E whenever r , r − 1 ∈ [ 0 , ∣ w ∣ ] r,r-1\in[0,|w|] r , r − 1 ∈ [ 0 , ∣ w ∣ ] , which gives
∣ η ( r ) − η ( r − 1 ) ∣ ≥ ∣ d ∣ w r − ∣ E ∣ ≥ ( a ) w r − ∣ E ∣ ≥ ( b ) C ( 1 ) ℓ r − C ( 3 ) = ( C ( 1 ) − C ( 3 ) ℓ r ) ℓ r ≥ ( c ) ( C ( 1 ) − C ( 3 ) C ( 2 ) ) ℓ r . (17) \begin{aligned}
|\eta(r)-\eta(r-1)|&\ge|d|w_r-|E|\\
&\mathrel{\overset{(a)}{\ge}} w_r-|E|\\
&\mathrel{\overset{(b)}{\ge}} C^{(1)}\ell_r-C^{(3)}\\
&=\left(C^{(1)}-\frac{C^{(3)}}{\ell_r}\right)\ell_r\\
&\mathrel{\overset{(c)}{\ge}}\left(C^{(1)}-\frac{C^{(3)}}{C^{(2)}}\right)\ell_r. \tag*{(17)}
\end{aligned} ∣ η ( r ) − η ( r − 1 ) ∣ ≥ ∣ d ∣ w r − ∣ E ∣ ≥ ( a ) w r − ∣ E ∣ ≥ ( b ) C ( 1 ) ℓ r − C ( 3 ) = ( C ( 1 ) − ℓ r C ( 3 ) ) ℓ r ≥ ( c ) ( C ( 1 ) − C ( 2 ) C ( 3 ) ) ℓ r . (17)
where (a) uses the assumption d ≠ 0 d\ne0 d = 0 , (b) follows from conditions (i) and (iii), and (c) follows from condition (ii). Since η ( r ) \eta(r) η ( r ) is monotone in r r r , we conclude from (17) that
∣ η ( r 2 ) − η ( r 1 ) ∣ = ∣ ∑ r = r 1 + 1 r 2 ( η ( r ) − η ( r − 1 ) ) ∣ = ∑ r = r 1 + 1 r 2 ∣ η ( r ) − η ( r − 1 ) ∣ ≥ ( C ( 1 ) − C ( 3 ) C ( 2 ) ) ∑ r = r 1 + 1 r 2 ℓ r . (18) |\eta(r_2)-\eta(r_1)|=\left|\sum_{r=r_1+1}^{r_2}\left(\eta(r)-\eta(r-1)\right)\right|=\sum_{r=r_1+1}^{r_2}|\eta(r)-\eta(r-1)|\ge\left(C^{(1)}-\frac{C^{(3)}}{C^{(2)}}\right)\sum_{r=r_1+1}^{r_2}\ell_r. \tag*{(18)} ∣ η ( r 2 ) − η ( r 1 ) ∣ = r = r 1 + 1 ∑ r 2 ( η ( r ) − η ( r − 1 ) ) = r = r 1 + 1 ∑ r 2 ∣ η ( r ) − η ( r − 1 ) ∣ ≥ ( C ( 1 ) − C ( 2 ) C ( 3 ) ) r = r 1 + 1 ∑ r 2 ℓ r . (18)
Now (15) follows from (16), (18) and condition (iv).
Both Proposition III.1 and Proposition III.2 use the value of Δ V T \Delta_{\mathrm{VT}} Δ VT . The next lemma gives the bound required later in Lemma IV.9. It is claim (iii) in the proof of [2 Lemma 4] . We reproduce its proof in the present notation.
Lemma III.3. Let z ∈ Z ≥ 0 ∗ z \in\mathbb{Z}_{\geq0}^{*} z ∈ Z ≥ 0 ∗ and z → K w z \to_K w z → K w for some K ≥ 2 K \geq2 K ≥ 2 . Suppose that both z z z and w w w are A A A -bounded, and that ∣ w t L 1 ( z ) − w t L 1 ( w ) ∣ ≤ w i \lvert\mathrm{wt}_{L_1}(z)-\mathrm{wt}_{L_1}(w)\rvert\leq w_i ∣ wt L 1 ( z ) − wt L 1 ( w )∣ ≤ w i for all i ∈ [ ∣ w ∣ ] i \in[\lvert w\rvert] i ∈ [∣ w ∣] . Then ∣ Δ V T ∣ < K 2 ( w t L 1 ( z ) + A ) \lvert\Delta_{\mathrm{VT}\rvert} < K^2(\mathrm{wt}_{L_1}(z)+A) ∣ Δ VT ∣ < K 2 ( wt L 1 ( z ) + A ) .
Proof: Represent z z z and w w w as in (12). Since w [ r ∗ + ∣ t ′ ∣ + 1 , ∣ w ∣ ] = v ′ w_{[r^*+\lvert t'\rvert+1,\lvert w\rvert]}=v' w [ r ∗ + ∣ t ′ ∣ + 1 , ∣ w ∣] = v ′ , we conclude from (14) that
∣ Δ V T ∣ ≤ ∣ V T ( s ′ ) − V T ( t ′ ) ∣ + ∣ u ′ ∣ ∣ w t L 1 ( s ′ ) − w t L 1 ( t ′ ) ∣ + ∣ ∣ t ′ ∣ − ∣ s ′ ∣ ∣ w t L 1 ( v ′ ) < K 2 A + ∣ u ′ ∣ ∣ w t L 1 ( z ) − w t L 1 ( w ) ∣ + ∣ ∣ t ′ ∣ − ∣ s ′ ∣ ∣ w t L 1 ( v ′ ) ≤ K 2 A + ∑ i = 1 ∣ u ′ ∣ ∣ w t L 1 ( z ) − w t L 1 ( w ) ∣ + K w t L 1 ( v ′ ) ≤ K 2 A + ∑ i = 1 ∣ u ′ ∣ w i + K w t L 1 ( v ′ ) ≤ ( a ) K 2 A + ∑ i = 1 ∣ u ′ ∣ z i + K w t L 1 ( v ′ ) ≤ K 2 A + ∑ i = 1 ∣ u ′ ∣ z i + K ∑ i = ∣ u ′ ∣ + 1 ∣ z ∣ z i ≤ K 2 ( w t L 1 ( z ) + A ) , \begin{aligned}
\lvert\Delta_{\mathrm{VT}}\rvert&\leq\lvert\mathrm{VT}(s')-\mathrm{VT}(t')\rvert+\lvert u'\rvert\lvert\mathrm{wt}_{L_1}(s')-\mathrm{wt}_{L_1}(t')\rvert+\lvert\lvert t'\rvert-\lvert s'\rvert\rvert\mathrm{wt}_{L_1}(v')\\
&<K^2A+\lvert u'\rvert\lvert\mathrm{wt}_{L_1}(z)-\mathrm{wt}_{L_1}(w)\rvert+\lvert\lvert t'\rvert-\lvert s'\rvert\rvert\mathrm{wt}_{L_1}(v')\\
&\leq K^2A+\sum_{i=1}^{\lvert u'\rvert}\lvert\mathrm{wt}_{L_1}(z)-\mathrm{wt}_{L_1}(w)\rvert+K\mathrm{wt}_{L_1}(v')\\
&\leq K^2A+\sum_{i=1}^{\lvert u'\rvert}w_i+K\mathrm{wt}_{L_1}(v')\\
&\overset{(a)}{\leq}K^2A+\sum_{i=1}^{\lvert u'\rvert}z_i+K\mathrm{wt}_{L_1}(v')\\
&\leq K^2A+\sum_{i=1}^{\lvert u'\rvert}z_i+K\sum_{i=\lvert u'\rvert+1}^{\lvert z\rvert}z_i\\
&\leq K^2(\mathrm{wt}_{L_1}(z)+A),
\end{aligned} ∣ Δ VT ∣ ≤ ∣ VT ( s ′ ) − VT ( t ′ )∣ + ∣ u ′ ∣ ∣ wt L 1 ( s ′ ) − wt L 1 ( t ′ )∣ + ∣∣ t ′ ∣ − ∣ s ′ ∣∣ wt L 1 ( v ′ ) < K 2 A + ∣ u ′ ∣ ∣ wt L 1 ( z ) − wt L 1 ( w )∣ + ∣∣ t ′ ∣ − ∣ s ′ ∣∣ wt L 1 ( v ′ ) ≤ K 2 A + i = 1 ∑ ∣ u ′ ∣ ∣ wt L 1 ( z ) − wt L 1 ( w )∣ + K wt L 1 ( v ′ ) ≤ K 2 A + i = 1 ∑ ∣ u ′ ∣ w i + K wt L 1 ( v ′ ) ≤ ( a ) K 2 A + i = 1 ∑ ∣ u ′ ∣ z i + K wt L 1 ( v ′ ) ≤ K 2 A + i = 1 ∑ ∣ u ′ ∣ z i + K i = ∣ u ′ ∣ + 1 ∑ ∣ z ∣ z i ≤ K 2 ( wt L 1 ( z ) + A ) ,
where (a) follows from the fact that z i = w i z_i=w_i z i = w i for every 1 ≤ i ≤ ∣ u ′ ∣ 1\leq i\leq\lvert u'\rvert 1 ≤ i ≤ ∣ u ′ ∣ . ■
Although it is permitted that ∣ E ∣ = w i \lvert E\rvert=w_i ∣ E ∣ = w i in Lemma III.1 and Lemma III.3, (17) implies that we must have ∣ E ∣ < w i \lvert E\rvert<w_i ∣ E ∣ < w i for all i i i under the assumption in Proposition III.2. The following definition collects the properties of the K K K -substring edit z → K w z\to_K w z → K w required in Proposition III.1, Proposition III.2 and Lemma III.3.
Definition III.1. Let z , w ∈ Z ≥ 0 ∗ z,w\in\mathbb{Z}_{\geq0}^{*} z , w ∈ Z ≥ 0 ∗ . Suppose that w w w is obtained from z z z by a nontrivial K K K -substring edit. We call this K K K -substring edit strongly locatable if the following three conditions are satisfied:
(i) ∣ z ∣ ≠ ∣ w ∣ \lvert z\rvert\ne\lvert w\rvert ∣ z ∣ = ∣ w ∣ or w t L 1 ( z ) ≠ w t L 1 ( w ) \mathrm{wt}_{L_1}(z)\ne\mathrm{wt}_{L_1}(w) wt L 1 ( z ) = wt L 1 ( w ) ;
(ii) if ∣ z ∣ = ∣ w ∣ \lvert z\rvert=\lvert w\rvert ∣ z ∣ = ∣ w ∣ , then z z z and w w w differ in one coordinate or two consecutive coordinates;
(iii) ∣ w t L 1 ( z ) − w t L 1 ( w ) ∣ < w i \lvert\mathrm{wt}_{L_1}(z)-\mathrm{wt}_{L_1}(w)\rvert<w_i ∣ wt L 1 ( z ) − wt L 1 ( w )∣ < w i for every i ∈ [ ∣ w ∣ ] i\in[\lvert w\rvert] i ∈ [∣ w ∣] .
With these preliminary results, we are now ready to return to our goal in this section, that is, finding an interval I ⊆ [ n ] I\subseteq[n] I ⊆ [ n ] with ∣ I ∣ = O q , k ( log n ) \lvert I\rvert=O_{q,k}(\log n) ∣ I ∣ = O q , k ( log n ) that covers the edit region in x x x .
Let x x x , y y y , P P P and f f f be as before. Then F P ( x ) F_P(x) F P ( x ) and F P ( y ) F_P(y) F P ( y ) have the forms in (9) for some K ≥ 2 K\geq2 K ≥ 2 . To explain how Propositions III.1 and III.2 are helpful, assume that the K K K -substring edit F P ( x ) → K F P ( y ) F_P(x)\to_K F_P(y) F P ( x ) → K F P ( y ) is strongly locatable. Denote z = F P ( x ) z=F_P(x) z = F P ( x ) and w = F P ( y ) w=F_P(y) w = F P ( y ) .
If all the assumptions in Proposition III.1 are satisfied, then we can determine the first index, say j j j , at which F P ( x ) F_P(x) F P ( x ) and F P ( y ) F_P(y) F P ( y ) differ. This implies x j P ≠ y j P x_j^P\ne y_j^P x j P = y j P . Notice that it is possible that x j P ≠ y j P x_j^P\ne y_j^P x j P = y j P but f ( x j P ) = f ( y j P ) f(x_j^P)=f(y_j^P) f ( x j P ) = f ( y j P ) . Set a 0 = min { ∣ w ∣ , j + K − 1 } a_0=\min\{\lvert w\rvert,j+K-1\} a 0 = min {∣ w ∣ , j + K − 1 } and b 0 = min { ∣ w ∣ , j + K − 1 } b_0=\min\{\lvert w\rvert,j+K-1\} b 0 = min {∣ w ∣ , j + K − 1 } . By (9) and the fact ∣ t ′ ∣ ≤ K \lvert t'\rvert\leq K ∣ t ′ ∣ ≤ K , the substring t ′ t' t ′ is contained in the substring F P ( y ) [ a 0 , b 0 ] F_P(y)_{[a_0,b_0]} F P ( y ) [ a 0 , b 0 ] . Then by Assumption 1 and the definition of t ′ t' t ′ , the edit region in y y y is covered by J J J , where y J = y a 0 P ⋯ y b 0 P y_J=y^P_{a_0}\cdots y^P_{b_0} y J = y a 0 P ⋯ y b 0 P .
For every 1 ≤ i ≤ m P ( y ) 1\leq i\leq m_P(y) 1 ≤ i ≤ m P ( y ) , let ℓ i = ∣ y i P ∣ \ell_i=\lvert y_i^P\rvert ℓ i = ∣ y i P ∣ . If all the assumptions in Proposition III.2 are satisfied and all the values of d d d , E E E and Δ V T \Delta_{\mathrm{VT}} Δ VT are given, then we can find an interval [ r 1 , r 2 ] ⊆ [ 0 , ∣ w ∣ ] [r_1,r_2]\subseteq[0,\lvert w\rvert] [ r 1 , r 2 ] ⊆ [ 0 , ∣ w ∣] that contains ∣ u ′ ∣ \lvert u'\rvert ∣ u ′ ∣ . Specifically, initialize η ( ∣ w ∣ ) = ∣ w ∣ E \eta(\lvert w\rvert)=\lvert w\rvert E η (∣ w ∣) = ∣ w ∣ E and sequentially compute η ( r ) \eta(r) η ( r ) for r ∈ [ ∣ w ∣ − r 1 , ∣ w ∣ ] r\in[\lvert w\rvert-r_1,\lvert w\rvert] r ∈ [∣ w ∣ − r 1 , ∣ w ∣] using η ( r − 1 ) = η ( r ) − d w r − E \eta(r-1)=\eta(r)-d_{w_r}-E η ( r − 1 ) = η ( r ) − d w r − E when r ≥ 1 r\geq1 r ≥ 1 . Record the first and last r r r satisfying ∣ Δ V T − η ( r ) ∣ < 2 K 2 A \lvert\Delta_{\mathrm{VT}}-\eta(r)\rvert<2K^2A ∣ Δ VT − η ( r )∣ < 2 K 2 A . These are r 2 r_2 r 2 and r 1 r_1 r 1 , respectively.
Set b 0 = min { ∣ w ∣ , r 2 + K } b_0=\min\{\lvert w\rvert,r_2+K\} b 0 = min {∣ w ∣ , r 2 + K } . By (9) and the fact ∣ t ′ ∣ ≤ K \lvert t'\rvert\leq K ∣ t ′ ∣ ≤ K , the substring t ′ t' t ′ is contained in F P ( y ) [ r 1 + 1 , b 0 ] F_P(y)_{[r_1+1,b_0]} F P ( y ) [ r 1 + 1 , b 0 ] , which implies that the edit region in y y y is covered by J J J , where y J = y r 1 + 1 P ⋯ y b 0 P y_J=y^P_{r_1+1}\cdots y^P_{b_0} y J = y r 1 + 1 P ⋯ y b 0 P . If each segment of y y y has length at most L L L , then ∣ J ∣ ≤ ( 2 K − 1 ) L |J| \le(2K-1)L ∣ J ∣ ≤ ( 2 K − 1 ) L in the case of Proposition III.1, or
∣ J ∣ < 4 K 2 A C ( 1 ) − C ( 3 ) C ( 2 ) + ∣ y r 2 + 1 P ⋯ y b 0 P ∣ ≤ 4 K 2 A C ( 1 ) − C ( 3 ) C ( 2 ) + K L |J| < \frac{4K^2A}{C^{(1)}-\frac{C^{(3)}}{C^{(2)}}}+\left|y^P_{r_2+1}\cdots y^P_{b_0}\right| \le\frac{4K^2A}{C^{(1)}-\frac{C^{(3)}}{C^{(2)}}}+KL ∣ J ∣ < C ( 1 ) − C ( 2 ) C ( 3 ) 4 K 2 A + y r 2 + 1 P ⋯ y b 0 P ≤ C ( 1 ) − C ( 2 ) C ( 3 ) 4 K 2 A + K L
in the case of Proposition III.2. Assume J = [ a , b ] J=[a,b] J = [ a , b ] . By the definition of a k k k -substring edit, the edit region in x x x is covered by [ a − k , b + k ] ∩ [ n ] [a-k,b+k]\cap[n] [ a − k , b + k ] ∩ [ n ] , which is the interval I I I we are looking for.
The above analysis yields the following theorem.
Theorem III.1. Let x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n , where n > k n>k n > k , and let y y y be obtained from x x x by a nontrivial k k k -substring edit. Let P \mathcal{P} P be a partition rule and f : Σ q ∗ → Z ≥ 0 f:\Sigma_q^*\to\mathbb{Z}_{\ge0} f : Σ q ∗ → Z ≥ 0 be a function. Set z = F P ( x ) z=F_{\mathcal{P}}(x) z = F P ( x ) and w = F P ( y ) w=F_{\mathcal{P}}(y) w = F P ( y ) . Suppose that the following conditions hold.
(i) Assumption 1 holds.
(ii) The two sequences z z z and w w w are A A A -bounded, where A ≥ 1 A\ge1 A ≥ 1 is an integer.
(iii) The K K K -substring edit z → K w z\to_K w z → K w is strongly locatable, where K ≥ 2 K\ge2 K ≥ 2 is an integer.
(iv) Each segment of y y y under P \mathcal{P} P has length at most L L L .
(v) The values of A A A , K K K and L L L are known.
(vi) There are known positive numbers C ( 1 ) , C ( 2 ) , C ( 3 ) C^{(1)},C^{(2)},C^{(3)} C ( 1 ) , C ( 2 ) , C ( 3 ) such that if d ≠ 0 d\ne0 d = 0 , they satisfy, for ℓ i = ∣ y i P ∣ \ell_i=|y_i^{\mathcal{P}}| ℓ i = ∣ y i P ∣ and every i ∈ [ ∣ w ∣ ] i\in[|w|] i ∈ [ ∣ w ∣ ] , w i ≥ C ( 1 ) ℓ i w_i\ge C^{(1)}\ell_i w i ≥ C ( 1 ) ℓ i , ℓ i ≥ C ( 2 ) \ell_i\ge C^{(2)} ℓ i ≥ C ( 2 ) , and ∣ E ∣ ≤ C ( 3 ) < C ( 1 ) C ( 2 ) |E|\le C^{(3)}<C^{(1)}C^{(2)} ∣ E ∣ ≤ C ( 3 ) < C ( 1 ) C ( 2 ) , where d d d and E E E are defined in (10) .
Let G 0 ( ⋅ ) G_0(\cdot) G 0 ( ⋅ ) , G 1 ( ⋅ ) G_1(\cdot) G 1 ( ⋅ ) and Δ V T \Delta_{\mathrm{VT}} Δ VT be defined as before. Suppose that d d d , E E E , Δ V T \Delta_{\mathrm{VT}} Δ VT , together with G 0 ( z ) − G 0 ( w ) G_0(z)-G_0(w) G 0 ( z ) − G 0 ( w ) and G 1 ( z ) − G 1 ( w ) G_1(z)-G_1(w) G 1 ( z ) − G 1 ( w ) when d = 0 d=0 d = 0 , are given. Then one can determine from y y y an interval I ⊆ [ n ] I\subseteq[n] I ⊆ [ n ] that covers the edit region in x x x and satisfies
∣ I ∣ ≤ max { ( 2 K − 1 ) L , 4 K 2 A C ( 1 ) − C ( 3 ) C ( 2 ) + K L } + 2 k . (19) |I|\le\max\left\{(2K-1)L,\frac{4K^2A}{C^{(1)}-\frac{C^{(3)}}{C^{(2)}}}+KL\right\}+2k. \tag*{(19)} ∣ I ∣ ≤ max { ( 2 K − 1 ) L , C ( 1 ) − C ( 2 ) C ( 3 ) 4 K 2 A + K L } + 2 k . (19) Given Part P ( y ) \operatorname{Part}_{\mathcal{P}}(y) Part P ( y ) and w w w , this interval can be found using O q , k ( n λ 2 ) O_{q,k}(n\lambda^2) O q , k ( n λ 2 ) bit operations, where λ = ⌈ log ( ( n + k + 1 ) 2 K 2 A ) ⌉ \lambda=\lceil\log((n+k+1)^2K^2A)\rceil λ = ⌈ log (( n + k + 1 ) 2 K 2 A )⌉ .
Proof. The preceding analysis shows how to find such an interval. We only need to count bit operations. Since z → K w z\to_K w z → K w , we have ∣ d ∣ ≤ K |d|\le K ∣ d ∣ ≤ K . Since every segment is nonempty, we obtain ∣ z ∣ ≤ n |z|\le n ∣ z ∣ ≤ n and ∣ w ∣ ≤ n + k |w|\le n+k ∣ w ∣ ≤ n + k . Then the A A A -bounded property of z z z and w w w gives ∣ E ∣ ≤ K A |E|\le KA ∣ E ∣ ≤ K A , ∣ Δ V T ∣ ≤ A ( n + k + 1 ) 2 |\Delta_{\mathrm{VT}}|\le A(n+k+1)^2 ∣ Δ VT ∣ ≤ A ( n + k + 1 ) 2 , and ∣ G r ( z ) − G r ( w ) ∣ ≤ A ( n + k ) |G_r(z)-G_r(w)|\le A(n+k) ∣ G r ( z ) − G r ( w ) ∣ ≤ A ( n + k ) for every 0 ≤ r ≤ 2 0\le r\le2 0 ≤ r ≤ 2 . Each value of η ( r ) \eta(r) η ( r ) has absolute value at most 2 K A ( n + k ) 2KA(n+k) 2 K A ( n + k ) . We need to compare each η ( r ) \eta(r) η ( r ) with Δ V T − 2 K 2 A \Delta_{\mathrm{VT}}-2K^2A Δ VT − 2 K 2 A and Δ V T + 2 K 2 A \Delta_{\mathrm{VT}}+2K^2A Δ VT + 2 K 2 A . Thus all integers used below, including 2 K 2 A 2K^2A 2 K 2 A , Δ V T − η ( r ) \Delta_{\mathrm{VT}}-\eta(r) Δ VT − η ( r ) , segment indices, and coordinate sums, have O ( λ ) O(\lambda) O ( λ ) bits.
If d = 0 d=0 d = 0 , the proof of Proposition III.1 computes the index j j j by a constant number of additions, subtractions, and comparisons, followed by one exact division by E E E . Hence it costs O ( λ 2 ) O(\lambda^2) O ( λ 2 ) bit operations. Set a 0 = max { 1 , j − K + 1 } a_0=\max\{1,j-K+1\} a 0 = max { 1 , j − K + 1 } and b 0 = min { ∣ w ∣ , j + K − 1 } b_0=\min\{|w|,j+K-1\} b 0 = min { ∣ w ∣ , j + K − 1 } . Computing these two indices costs O ( λ ) O(\lambda) O ( λ ) further bit operations.
Now suppose that d ≠ 0 d\ne0 d = 0 . Compute the threshold 2 K 2 A 2K^2A 2 K 2 A and initialize η ( ∣ w ∣ ) = ∣ w ∣ \eta(|w|)=|w| η ( ∣ w ∣ ) = ∣ w ∣ . These computations cost O ( λ 2 ) O(\lambda^2) O ( λ 2 ) bit operations. For r = ∣ w ∣ , ∣ w ∣ − 1 , … , 1 r=|w|,|w|-1,\ldots,1 r = ∣ w ∣ , ∣ w ∣ − 1 , … , 1 , compute η ( r − 1 ) = η ( r ) − d w r − E \eta(r-1)=\eta(r)-d w_r-E η ( r − 1 ) = η ( r ) − d w r − E . At every index r ∈ [ 0 , ∣ w ∣ ] r\in[0,|w|] r ∈ [ 0 , ∣ w ∣ ] , test whether ∣ Δ V T − η ( r ) ∣ < 2 K 2 A |\Delta_{\mathrm{VT}}-\eta(r)|<2K^2A ∣ Δ VT − η ( r ) ∣ < 2 K 2 A . For each r r r , the process uses a fixed number of multiplications, additions, subtractions, and comparisons. Therefore, scanning all ∣ w ∣ + 1 |w|+1 ∣ w ∣ + 1 indices costs O ( ( n + k + 1 ) λ 2 ) O((n+k+1)\lambda^2) O (( n + k + 1 ) λ 2 ) bit operations. Set a 0 = r 1 + 1 a_0=r_1+1 a 0 = r 1 + 1 and b 0 = min { ∣ w ∣ , r 2 + K } b_0=\min\{|w|,r_2+K\} b 0 = min { ∣ w ∣ , r 2 + K } , which costs O ( λ ) O(\lambda) O ( λ ) further bit operations.
In either case, the selected substring of y y y is y a 0 P ⋯ y b 0 P y^P_{a_0}\cdots y^P_{b_0} y a 0 P ⋯ y b 0 P . Determining J J J and I I I requires additional O ( n + k ) O(n+k) O ( n + k ) bit operations. Therefore, the total number of bit operations is O q , k ( n λ 2 ) O_{q,k}(n\lambda^2) O q , k ( n λ 2 ) . ■
Thus the task is to choose P \mathcal{P} P and f f f so that all the hypotheses of Theorem III.1 hold and the right-hand side of (19) is O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) . This is done in the next section.
Instantiation of the Framework
To apply the general framework in Theorem III.1, we need to design a suitable partition rule P \mathcal{P} P and a function f f f that satisfy all the hypotheses. We must also determine the exact values of K K K , A A A , L L L , C ( 1 ) C^{(1)} C ( 1 ) , C ( 2 ) C^{(2)} C ( 2 ) , C ( 3 ) C^{(3)} C ( 3 ) , d d d , E E E , Δ V T \Delta_{\mathrm{VT}} Δ VT , G 0 ( F P ( x ) ) − G 0 ( F P ( y ) ) G_0(F_{\mathcal{P}}(x))-G_0(F_{\mathcal{P}}(y)) G 0 ( F P ( x )) − G 0 ( F P ( y )) , and G 1 ( F P ( x ) ) − G 1 ( F P ( y ) ) G_1(F_{\mathcal{P}}(x))-G_1(F_{\mathcal{P}}(y)) G 1 ( F P ( x )) − G 1 ( F P ( y )) .
This section accomplishes this task. The partition rule and the function f f f are specified in Section IV-A, where the values of K K K , A A A , L L L , C ( 1 ) C^{(1)} C ( 1 ) , C ( 2 ) C^{(2)} C ( 2 ) and C ( 3 ) C^{(3)} C ( 3 ) are also determined. In Section IV-B, we show that the induced edit F P ( x ) → K F P ( y ) F_{\mathcal{P}}(x)\to_K F_{\mathcal{P}}(y) F P ( x ) → K F P ( y ) is strongly locatable if x ≠ y x\ne y x = y . Finally, Section IV-C shows how to determine the values of d d d , E E E , Δ V T \Delta_{\mathrm{VT}} Δ VT , G 0 ( F P ( x ) ) − G 0 ( F P ( y ) ) G_0(F_{\mathcal{P}}(x))-G_0(F_{\mathcal{P}}(y)) G 0 ( F P ( x )) − G 0 ( F P ( y )) and G 1 ( F P ( x ) ) − G 1 ( F P ( y ) ) G_1(F_{\mathcal{P}}(x))-G_1(F_{\mathcal{P}}(y)) G 1 ( F P ( x )) − G 1 ( F P ( y )) , and presents a code which can locate a k k k -substring edit within a window of length O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) .
The Partition Rule P \mathcal{P} P and the Function f f f
In [2, § 3 ], Li et al. introduced a partition rule P \mathcal{P} P and a function f f f with the property that if x → k y x\to_k y x → k y and x ≠ y x\ne y x = y , then F P ( y ) F_{\mathcal{P}}(y) F P ( y ) differed from F P ( x ) F_{\mathcal{P}}(x) F P ( x ) by a locatable 3-substring edit. In this section, we show that the same P \mathcal{P} P and f f f , with suitable modifications, give a strongly locatable edit F P ( x ) → K F P ( y ) F_{\mathcal{P}}(x)\to_K F_{\mathcal{P}}(y) F P ( x ) → K F P ( y ) .
In the rest of this paper, denote p k ≜ 0 ∗ 1 k p_k\triangleq0^*1^k p k ≜ 0 ∗ 1 k for every integer k ≥ 1 k\ge1 k ≥ 1 . We call p k p_k p k the pattern. For a nonempty sequence a ∈ Σ q ∗ a\in\Sigma_q^* a ∈ Σ q ∗ , if a [ i , i + 2 k − 1 ] = p k a_{[i,i+2k-1]}=p_k a [ i , i + 2 k − 1 ] = p k for some 1 ≤ i ≤ ∣ a ∣ − 2 k + 1 1\le i\le|a|-2k+1 1 ≤ i ≤ ∣ a ∣ − 2 k + 1 , we say that i i i is a pattern start and that a [ i , i + 2 k − 1 ] a_{[i,i+2k-1]} a [ i , i + 2 k − 1 ] is an occurrence of the pattern. It is straightforward to see that two occurrences of p k p_k p k cannot overlap.
Denote by m k ( a ) m_k(\mathbf{a}) m k ( a ) the number of occurrences of p k p_k p k in a \mathbf{a} a . The partition rule P \mathcal{P} P in [2 Section III] is defined as follows.
If m k ( a ) = 0 m_k(\mathbf{a})=0 m k ( a ) = 0 , then Part P ( a ) \operatorname{Part}_{\mathcal{P}}(\mathbf{a}) Part P ( a ) consists of the single segment a \mathbf{a} a .
If m k ( a ) ≥ 1 m_k(\mathbf{a})\geq1 m k ( a ) ≥ 1 , for 1 ≤ i ≤ m k ( a ) 1\leq i\leq m_k(\mathbf{a}) 1 ≤ i ≤ m k ( a ) , let τ i \tau_i τ i be the start of the i i i -th pattern in a \mathbf{a} a . Set τ 0 = 1 \tau_0=1 τ 0 = 1 and τ m k ( a ) + 1 = ∣ a ∣ + 1 \tau_{m_k(\mathbf{a})+1}=|\mathbf{a}|+1 τ m k ( a ) + 1 = ∣ a ∣ + 1 . When τ 1 > 1 \tau_1>1 τ 1 > 1 , there are m k ( a ) + 1 m_k(\mathbf{a})+1 m k ( a ) + 1 segments in a \mathbf{a} a . For 1 ≤ i ≤ m k ( a ) + 1 1\leq i\leq m_k(\mathbf{a})+1 1 ≤ i ≤ m k ( a ) + 1 , the i i i -th segment is a i ( k ) ≜ a [ τ i − 1 , τ i − 1 ] \mathbf{a}^{(k)}_i\triangleq\mathbf{a}_{[\tau_{i-1},\tau_i-1]} a i ( k ) ≜ a [ τ i − 1 , τ i − 1 ] . When τ 1 = 1 \tau_1=1 τ 1 = 1 , there are m k ( a ) m_k(\mathbf{a}) m k ( a ) segments in a \mathbf{a} a . For 1 ≤ i ≤ m k ( a ) 1\leq i\leq m_k(\mathbf{a}) 1 ≤ i ≤ m k ( a ) , the i i i -th segment is a i ( k ) ≜ a [ τ i , τ i + 1 − 1 ] \mathbf{a}^{(k)}_i\triangleq\mathbf{a}_{[\tau_i,\tau_{i+1}-1]} a i ( k ) ≜ a [ τ i , τ i + 1 − 1 ] .
For clarity, we use Part k ( a ) \operatorname{Part}_k(\mathbf{a}) Part k ( a ) for Part P ( a ) \operatorname{Part}_{\mathcal{P}}(\mathbf{a}) Part P ( a ) throughout this section.
When m k ( a ) ≥ 1 m_k(\mathbf{a})\geq1 m k ( a ) ≥ 1 and τ 1 > 1 \tau_1>1 τ 1 > 1 , it holds that ∣ a i ( k ) ∣ ≥ 2 k \left|\mathbf{a}^{(k)}_i\right|\geq2k a i ( k ) ≥ 2 k for every 2 ≤ i ≤ m k ( a ) + 1 2\leq i\leq m_k(\mathbf{a})+1 2 ≤ i ≤ m k ( a ) + 1 . But the first segment a 1 ( k ) \mathbf{a}^{(k)}_1 a 1 ( k ) may have length smaller than 2 k 2k 2 k . In this paper, we apply this rule to the virtually extended sequence
a ^ ≜ p k a p k \widehat{\mathbf{a}}\triangleq p_k\mathbf{a}p_k a ≜ p k a p k
rather than to a \mathbf{a} a itself. It is important to notice that the two virtual patterns at both ends of a ^ \widehat{\mathbf{a}} a are used only to compute the partition and the function f k f_k f k defined below. They are not transmitted through the channel. We do not assume that a transmitted a \mathbf{a} a begins with a pattern or ends with a pattern to save 4 k log q 4k\log q 4 k log q redundant bits.
Remark IV.1. Before proceeding, we explain why we consider the partition of a ^ \widehat{\mathbf{a}} a instead of a \mathbf{a} a . Clearly, the sequence a ^ \widehat{\mathbf{a}} a is obtained by adding a copy of p k p_k p k to both ends of a \mathbf{a} a . Both copies are needed for our construction. The left copy starts at coordinate 1. Consequently every segment of a ^ \widehat{\mathbf{a}} a begins with a complete occurrence of p k p_k p k and hence has length at least 2 k 2k 2 k . Without this copy, the first segment could have length in [ 1 , 2 k − 1 ] [1,2k-1] [ 1 , 2 k − 1 ] , so the inequality ℓ i ≥ C ( 2 ) = 2 k \ell_i\geq C^{(2)}=2k ℓ i ≥ C ( 2 ) = 2 k used in Proposition III.2 and theorem III.1 would be false. In addition, for a k k k -substring edit before the first p k p_k p k inside a \mathbf{a} a , the unchanged pattern start α \alpha α chosen in the proof of Lemma IV.2 (ii) would not exist.
The right copy begins at coordinate ∣ a ^ ∣ − 2 k + 1 |\widehat{\mathbf{a}}|-2k+1 ∣ a ∣ − 2 k + 1 . It guarantees an unchanged pattern occurrence to the right of every edit in a \mathbf{a} a . Without it, a k k k -substring edit after the last p k p_k p k inside a \mathbf{a} a could leave no such occurrence, and the pattern start β \beta β in the proof of Lemma IV.2 (ii) would not exist. The decompositions in (33), and hence condition (i) of Theorem III.1, would then require separate boundary cases and would not follow from the stated argument.
Thus the left and right copies respectively supply the two pattern starts that bound the edit from the left and from the right. Omitting either copy breaks a specific hypothesis used by the present proof.
Now suppose x ∈ Σ q n \mathbf{x}\in\Sigma_q^n x ∈ Σ q n and x → k y \mathbf{x}\to_k\mathbf{y} x → k y . Use the representation in (2) , with the convention (3) whenever the edit is nontrivial. Then
x ^ = p k u s v p k , y ^ = p k u t v p k . (20) \widehat{\mathbf{x}}=p_k\mathbf{u}s\mathbf{v}p_k,\qquad\widehat{\mathbf{y}}=p_k\mathbf{u}t\mathbf{v}p_k. \tag*{(20)} x = p k u s v p k , y = p k u t v p k . (20)
Thus the k k k -substring edit x ^ → k y ^ \widehat{\mathbf{x}}\to_k\widehat{\mathbf{y}} x → k y replaces the same pair s , t s,t s , t . Let ρ = ∣ p k u ∣ = 2 k + ∣ u ∣ \rho=|p_k\mathbf{u}|=2k+|\mathbf{u}| ρ = ∣ p k u ∣ = 2 k + ∣ u ∣ and d = ∣ t ∣ − ∣ s ∣ d=|t|-|s| d = ∣ t ∣ − ∣ s ∣ . Coordinates outside the edit regions are related by the bijection ϕ : [ ρ ] ∪ [ ρ + ∣ s ∣ + 1 , ∣ x ^ ∣ ] → [ ρ ] ∪ [ ρ + ∣ t ∣ + 1 , ∣ y ^ ∣ ] \phi:[\rho]\cup[\rho+|s|+1,|\widehat{\mathbf{x}}|]\to[\rho]\cup[\rho+|t|+1,|\widehat{\mathbf{y}}|] ϕ : [ ρ ] ∪ [ ρ + ∣ s ∣ + 1 , ∣ x ∣ ] → [ ρ ] ∪ [ ρ + ∣ t ∣ + 1 , ∣ y ∣ ] defined by
ϕ ( i ) = { i , i ≤ ρ , i + d , i ≥ ρ + ∣ s ∣ + 1. (21) \phi(i)=
\begin{cases}
i, & i\leq\rho,\\
i+d, & i\geq\rho+|s|+1.
\end{cases} \tag*{(21)} ϕ ( i ) = { i , i + d , i ≤ ρ , i ≥ ρ + ∣ s ∣ + 1. (21)
For a set I ⊆ [ ρ ] ∪ [ ρ + ∣ s ∣ + 1 , ∣ x ^ ∣ ] I\subseteq[\rho]\cup[\rho+|s|+1,|\widehat{\mathbf{x}}|] I ⊆ [ ρ ] ∪ [ ρ + ∣ s ∣ + 1 , ∣ x ∣ ] , write ϕ ( I ) = { ϕ ( i ) : i ∈ I } \phi(I)=\{\phi(i):i\in I\} ϕ ( I ) = { ϕ ( i ) : i ∈ I } . Clearly, we have
x ^ I = y ^ ϕ ( I ) . (22) \widehat{\mathbf{x}}_I=\widehat{\mathbf{y}}_{\phi(I)}. \tag*{(22)} x I = y ϕ ( I ) . (22)
The coordinate relation in (22) is illustrated in Figure 2 .
Figure 2. The coordinate correspondence ϕ \phi ϕ in (21) and (22) in the case d > 0 d>0 d > 0 .
Coordinate i i i of x \mathbf{x} x corresponds to coordinate i + 2 k i+2k i + 2 k of x ^ \widehat{\mathbf{x}} x . The same relation holds between y \mathbf{y} y and y ^ \widehat{\mathbf{y}} y . Therefore, locating errors in x \mathbf{x} x is equivalent to locating errors in x ^ \widehat{\mathbf{x}} x .
Next, we introduce the function f f f needed in Theorem III.1. For z = z 1 ⋯ z r ∈ Σ q ∗ z=z_1\cdots z_r\in\Sigma_q^* z = z 1 ⋯ z r ∈ Σ q ∗ and a ∈ [ k ] a\in[k] a ∈ [ k ] , let
d a ( z ) = ∑ 1 ≤ i ≤ r i ≡ a ( m o d k ) z i ( m o d q ) . (23) d_a(z)=\sum_{\substack{1\le i\le r\\i\equiv a\pmod{k}}}z_i\pmod q. \tag*{(23)} d a ( z ) = 1 ≤ i ≤ r i ≡ a ( mod k ) ∑ z i ( mod q ) . (23)
The vector ( d 1 ( z ) , … , d k ( z ) ) (d_1(z),\ldots,d_k(z)) ( d 1 ( z ) , … , d k ( z )) records the symbol sums in the k k k residue classes modulo k k k of the coordinate index. Since 0 ≤ d a ( z ) < q 0\le d_a(z)<q 0 ≤ d a ( z ) < q , we can store this vector as the integer
D q ( z ) ≔ ∑ a = 1 k d a ( z ) q a − 1 ∈ { 0 , 1 , … , q k − 1 } . (24) D_q(z)\coloneqq\sum_{a=1}^{k}d_a(z)q^{a-1}\in\{0,1,\ldots,q^k-1\}. \tag*{(24)} D q ( z ) : = a = 1 ∑ k d a ( z ) q a − 1 ∈ { 0 , 1 , … , q k − 1 } . (24)
Also let
N k ( z ) ≜ ∣ { 1 ≤ i ≤ ∣ z ∣ − k + 1 : z [ i , i + k − 1 ] = 1 k } ∣ N_k(z)\triangleq\left|\left\{1\le i\le|z|-k+1:z_{[i,i+k-1]}=1^k\right\}\right| N k ( z ) ≜ { 1 ≤ i ≤ ∣ z ∣ − k + 1 : z [ i , i + k − 1 ] = 1 k }
be the number of occurrences of 1 k 1^k 1 k in z z z . For later use in this section and in § 5 , set
Q = q k , D max = 3 ( Q − 1 ) , B = 3 Q − 2 , (25) Q=q^k,\qquad D_{\max}=3(Q-1),\qquad B=3Q-2, \tag*{(25)} Q = q k , D m a x = 3 ( Q − 1 ) , B = 3 Q − 2 , (25)
C k = B ( 2 k − 1 ) + D max + 1. (26) C_k=B(2k-1)+D_{\max}+1. \tag*{(26)} C k = B ( 2 k − 1 ) + D m a x + 1. (26)
The choice of these parameters is justified in the proofs of Lemma IV.2 (iv) and Lemma IV.6.
With the above notations, we define the function f k : Σ q ∗ → Z ≥ 0 f_k:\Sigma_q^*\to\mathbb{Z}_{\ge0} f k : Σ q ∗ → Z ≥ 0 by
f k ( z ) = D q ( z ) + B N k ( z ) + C k ∣ z ∣ . (27) f_k(z)=D_q(z)+BN_k(z)+C_k|z|. \tag*{(27)} f k ( z ) = D q ( z ) + B N k ( z ) + C k ∣ z ∣. (27)
For the framework in Theorem III.1, take f = f k f=f_k f = f k . Applying this map to all segments of x ^ \hat{x} x ^ gives the integer sequence
F k ( x ) ≜ ( f k ( x ^ 1 ( k ) ) , … , f k ( x ^ m k ( x ^ ) ( k ) ) ) . (28) F_k(x)\triangleq\left(f_k\left(\hat{x}^{(k)}_1\right),\ldots,f_k\left(\hat{x}^{(k)}_{m_k(\hat{x})}\right)\right). \tag*{(28)} F k ( x ) ≜ ( f k ( x ^ 1 ( k ) ) , … , f k ( x ^ m k ( x ^ ) ( k ) ) ) . (28)
The argument of F k F_k F k is written as x x x , because x ^ = p k x p k \hat{x}=p_kx p_k x ^ = p k x p k is uniquely determined by x x x .
In Lemma IV.2 below, we show that the partition rule P P P and the function f k f_k f k described above satisfy conditions (i)–(ii) and (iv)–(vi) in Theorem III.1. This lemma also determines the six quantities K K K , A A A , L L L , C ( 1 ) C^{(1)} C ( 1 ) , C ( 2 ) C^{(2)} C ( 2 ) and C ( 3 ) C^{(3)} C ( 3 ) . Before presenting this lemma and its proof, more notations and definitions are needed.
For a sequence a a a , define the set of pattern starts in it by T k ( a ) = { a ∈ [ 1 , ∣ a ∣ − 2 k + 1 ] : a [ a , a + 2 k − 1 ] = p k } T_k(a)=\{a\in[1,|a|-2k+1]:a_{[a,a+2k-1]}=p_k\} T k ( a ) = { a ∈ [ 1 , ∣ a ∣ − 2 k + 1 ] : a [ a , a + 2 k − 1 ] = p k } . Let x ^ \hat{x} x ^ and y ^ \hat{y} y ^ be given in (20). Denote
U ( x ^ ) = { a ∈ T k ( x ^ ) : a ≤ ρ − 2 k + 1 or a ≥ ρ + ∣ s ∣ + 1 } , U(\hat{x})=\{a\in T_k(\hat{x}):a\le\rho-2k+1\text{ or }a\ge\rho+|s|+1\}, U ( x ^ ) = { a ∈ T k ( x ^ ) : a ≤ ρ − 2 k + 1 or a ≥ ρ + ∣ s ∣ + 1 } ,
U ( y ^ ) = { b ∈ T k ( y ^ ) : b ≤ ρ − 2 k + 1 or b ≥ ρ + ∣ t ∣ + 1 } . U(\hat{y})=\{b\in T_k(\hat{y}):b\le\rho-2k+1\text{ or }b\ge\rho+|t|+1\}. U ( y ^ ) = { b ∈ T k ( y ^ ) : b ≤ ρ − 2 k + 1 or b ≥ ρ + ∣ t ∣ + 1 } .
In other words, the set U ( x ^ ) U(\hat{x}) U ( x ^ ) (resp. U ( y ^ ) U(\hat{y}) U ( y ^ ) ) consists of the starts of patterns in x ^ \hat{x} x ^ (resp. y ^ \hat{y} y ^ ) that are entirely contained in p k u p_ku p k u or v p k vp_k v p k . Then (20) implies that
1 ∈ U ( x ^ ) ∩ [ ρ − 2 k + 1 ] , n + 2 k + 1 ∈ U ( x ^ ) ∩ [ ρ + ∣ s ∣ + 1 , ∣ x ^ ∣ ] . (29) 1\in U(\hat{x})\cap[\rho-2k+1],\qquad n+2k+1\in U(\hat{x})\cap[\rho+|s|+1,|\hat{x}|]. \tag*{(29)} 1 ∈ U ( x ^ ) ∩ [ ρ − 2 k + 1 ] , n + 2 k + 1 ∈ U ( x ^ ) ∩ [ ρ + ∣ s ∣ + 1 , ∣ x ^ ∣ ] . (29)
Let ϕ \phi ϕ be the mapping defined in (21). Then (22) gives
U ( y ^ ) ∩ [ ρ − 2 k + 1 ] = U ( x ^ ) ∩ [ ρ − 2 k + 1 ] , (30) U(\hat{y})\cap[\rho-2k+1]=U(\hat{x})\cap[\rho-2k+1], \tag*{(30)} U ( y ^ ) ∩ [ ρ − 2 k + 1 ] = U ( x ^ ) ∩ [ ρ − 2 k + 1 ] , (30)
U ( y ^ ) ∩ [ ρ + ∣ t ∣ + 1 , ∣ y ^ ∣ ] = ϕ ( U ( x ^ ) ∩ [ ρ + ∣ s ∣ + 1 , ∣ x ^ ∣ ] ) . (31) U(\hat{y})\cap[\rho+|t|+1,|\hat{y}|]=\phi\left(U(\hat{x})\cap[\rho+|s|+1,|\hat{x}|]\right). \tag*{(31)} U ( y ^ ) ∩ [ ρ + ∣ t ∣ + 1 , ∣ y ^ ∣ ] = ϕ ( U ( x ^ ) ∩ [ ρ + ∣ s ∣ + 1 , ∣ x ^ ∣ ] ) . (31)
Definition IV.1 (destroyed and created pattern). A pattern in x ^ \hat{x} x ^ with start a ∈ D e s ( x ^ ) ≜ T k ( x ^ ) ∖ U ( x ^ ) a\in D_{\mathrm{es}}(\hat{x})\triangleq T_k(\hat{x})\setminus U(\hat{x}) a ∈ D es ( x ^ ) ≜ T k ( x ^ ) ∖ U ( x ^ ) is called a destroyed pattern . In other words, the interval [ a , a + 2 k − 1 ] [a,a+2k-1] [ a , a + 2 k − 1 ] intersects the edit region in x ^ \hat{x} x ^ in the case ∣ s ∣ > 0 |s|>0 ∣ s ∣ > 0 , or crosses the edit region in x ^ \hat{x} x ^ in the case s = ϵ s=\epsilon s = ϵ .
A pattern in y ^ \hat{y} y ^ with start b ∈ C r e ( y ^ ) ≜ T k ( y ^ ) ∖ U ( y ^ ) b\in C_{\mathrm{re}}(\hat{y})\triangleq T_k(\hat{y})\setminus U(\hat{y}) b ∈ C re ( y ^ ) ≜ T k ( y ^ ) ∖ U ( y ^ ) is called a created pattern . In other words, the interval [ b , b + 2 k − 1 ] [b,b+2k-1] [ b , b + 2 k − 1 ] intersects the edit region in y ^ \hat{y} y ^ in the case ∣ t ∣ > 0 |t|>0 ∣ t ∣ > 0 , or crosses the edit region in y ^ \hat{y} y ^ in the case t = ϵ t=\epsilon t = ϵ .
Thus, “destroyed” and “created” refer to a pattern affected by the specified edit, even if it has an occurrence both before and after the edit.
Example IV.1. Let q = k = 2 q=k=2 q = k = 2 . Then p k = 0011 p_k=0011 p k = 0011 . Take u = 00 u=00 u = 00 , s = 0 s=0 s = 0 , t = ϵ t=\epsilon t = ϵ , and v = 11 v=11 v = 11 . This edit deletes the third symbol of x = 00011 x=00011 x = 00011 and gives y = 0011 y=0011 y = 0011 . The extended sequences are x ^ = 0011 00 00 11 0011 \hat{x}=0011\,00\,00\,11\,0011 x ^ = 0011 00 00 11 0011 and y ^ = 0011 00 11 0011 \hat{y}=0011\,00\,11\,0011 y ^ = 0011 00 11 0011 . Here ρ = 6 \rho=6 ρ = 6 and d = − 1 d=-1 d = − 1 . By definition, we have
T k ( x ^ ) = { 1 , 6 , 10 } , U ( x ^ ) = { 1 , 10 } , D e s ( x ^ ) = { 6 } , T_k(\hat{x})=\{1,6,10\},\qquad U(\hat{x})=\{1,10\},\qquad D_{\mathrm{es}}(\hat{x})=\{6\}, T k ( x ^ ) = { 1 , 6 , 10 } , U ( x ^ ) = { 1 , 10 } , D es ( x ^ ) = { 6 } , T k ( y ^ ) = { 1 , 5 , 9 } , U ( y ^ ) = { 1 , 9 } , C r e ( y ^ ) = { 5 } . T_k(\hat{y})=\{1,5,9\},\qquad U(\hat{y})=\{1,9\},\qquad C_{\mathrm{re}}(\hat{y})=\{5\}. T k ( y ^ ) = { 1 , 5 , 9 } , U ( y ^ ) = { 1 , 9 } , C re ( y ^ ) = { 5 } . The destroyed pattern occupies [ 6 , 9 ] [6,9] [ 6 , 9 ] and contains the deleted coordinate 7. The created pattern occupies [ 5 , 8 ] [5,8] [ 5 , 8 ] and crosses the edit region q = 7 q=7 q = 7 in y ^ \hat{y} y ^ .
To obtain a short interval from Theorem III.1, we need every segment of y ^ \hat{y} y ^ to have length at most L = O q , k ( log n ) L = O_{q,k}(\log n) L = O q , k ( log n ) . We enforce this by restricting x x x to sequences satisfying a pattern-density condition. Set
ℓ n , k = 2 k q 2 k ⌈ log ( 2 n ) ⌉ . (32) \ell_{n,k}=2kq^{2k}\left\lceil\log(2n)\right\rceil. \tag*{(32)} ℓ n , k = 2 k q 2 k ⌈ log ( 2 n ) ⌉ . (32)
A sequence in Σ q n \Sigma_q^n Σ q n is called ( p k , ℓ n , k ) (p_k,\ell_{n,k}) ( p k , ℓ n , k ) -dense if every length-ℓ n , k \ell_{n,k} ℓ n , k substring of it contains at least one copy of p k p_k p k . For the construction in Sections IV and V, assume n ≥ ℓ n , k n \ge\ell_{n,k} n ≥ ℓ n , k . This holds for all sufficiently large n n n because q q q and k k k are fixed.
To the best of our knowledge, pattern-density constraints were first introduced [5 ] for constructing binary burst-deletion correcting codes, and were subsequently used for constructing non-binary burst-deletion correcting codes [6 ] , [7 ] , [9 ] , localized-deletion correcting codes [13 ] , and k k k -substring edit correcting codes [1 ] , [2 ] .
Let D q , k ( n ) D_{q,k}(n) D q , k ( n ) be the subset of Σ q n \Sigma_q^n Σ q n consisting of all ( p k , ℓ n , k ) (p_k,\ell_{n,k}) ( p k , ℓ n , k ) -dense sequences. We have the following lemma.
Lemma IV.1. For fixed integers q ≥ 2 q \ge2 q ≥ 2 and k ≥ 1 k \ge1 k ≥ 1 , let n ≥ max { ℓ n , k , q ( 6 k + 3 ) log q − log e 0.4 log q } n \ge\max\left\{\ell_{n,k},q^{\frac{(6k+3)\log q-\log e}{0.4\log q}}\right\} n ≥ max { ℓ n , k , q 0.4 l o g q ( 6 k + 3 ) l o g q − l o g e } be an integer.
(cf. [9 Lemma 6] ) It holds that ∣ D q , k ( n ) ∣ ≥ q n − 1 |D_{q,k}(n)| \ge q^{n-1} ∣ D q , k ( n ) ∣ ≥ q n − 1 .
If x ∈ D q , k ( n ) x \in D_{q,k}(n) x ∈ D q , k ( n ) , every segment of x ^ \hat{x} x ^ has length at most ℓ n , k \ell_{n,k} ℓ n , k .
Proof. Claim (i) follows from [9 Lemma 6] , where Song et al. presented an efficient algorithm that encodes any sequence in Σ q n − 1 \Sigma_q^{n-1} Σ q n − 1 into D q , k ( n ) D_{q,k}(n) D q , k ( n ) whenever n ≥ q ( 6 k + 3 ) log q − log e 0.4 log q n \ge q^{\frac{(6k+3)\log q-\log e}{0.4\log q}} n ≥ q 0.4 l o g q ( 6 k + 3 ) l o g q − l o g e , where e e e is the base of the natural logarithm. Claim (ii) follows immediately from the definition.
Lemma IV.2. Let x ∈ Σ q n x \in\Sigma_q^n x ∈ Σ q n and x → k y x \to_k y x → k y . Write x ^ \hat{x} x ^ and y ^ \hat{y} y ^ as in (20).
It holds that F k ( y ) i ≥ C k ∣ y ^ i ( k ) ∣ F_k(y)_i \ge C_k\left|\hat{y}^{(k)}_i\right| F k ( y ) i ≥ C k y ^ i ( k ) and ∣ y ^ i ( k ) ∣ ≥ 2 k \left|\hat{y}^{(k)}_i\right| \ge2k y ^ i ( k ) ≥ 2 k for every 1 ≤ i ≤ m k ( y ^ ) 1 \le i \le m_k(\hat{y}) 1 ≤ i ≤ m k ( y ^ ) . Thus, one may take C ( 1 ) = C k C^{(1)}=C_k C ( 1 ) = C k and C ( 2 ) = 2 k C^{(2)}=2k C ( 2 ) = 2 k in Proposition III.2.
There are sequences of segments P \mathbf{P} P , S \mathbf{S} S , A \mathbf{A} A and A ′ \mathbf{A}' A ′ such that
Part k ( x ^ ) = P A S , Part k ( y ^ ) = P A ′ S . (33) \operatorname{Part}_k(\hat{x})=\mathbf{P}\mathbf{A}\mathbf{S},\qquad\operatorname{Part}_k(\hat{y})=\mathbf{P}\mathbf{A}'\mathbf{S}. \tag*{(33)} Part k ( x ^ ) = PAS , Part k ( y ^ ) = P A ′ S . (33) Let r = ∣ Des ( x ^ ) ∣ r=|\operatorname{Des}(\hat{x})| r = ∣ Des ( x ^ ) ∣ and r ′ = ∣ Cre ( y ^ ) ∣ r'=|\operatorname{Cre}(\hat{y})| r ′ = ∣ Cre ( y ^ ) ∣ . Then A \mathbf{A} A contains r + 1 r+1 r + 1 segments, and A ′ \mathbf{A}' A ′ contains r ′ + 1 r'+1 r ′ + 1 segments. Moreover,
0 ≤ r , r ′ ≤ 2 0 \le r,r' \le2 0 ≤ r , r ′ ≤ 2 ;
the edit region in x ^ \hat{x} x ^ is covered by the concatenation of segments in A \mathbf{A} A ;
the edit region in y ^ \hat{y} y ^ is covered by the concatenation of segments in A ′ \mathbf{A}' A ′ .
The sequence F k ( y ) F_k(y) F k ( y ) is obtained from F k ( x ) F_k(x) F k ( x ) by one 3-substring edit, and ∣ m k ( x ) − m k ( y ) ∣ ≤ 2 |m_k(x)-m_k(y)| \le2 ∣ m k ( x ) − m k ( y ) ∣ ≤ 2 .
We have
∣ wt L 1 ( F k ( x ) ) − wt L 1 ( F k ( y ) ) ∣ ≤ C k ( k + 1 ) − 1. (34) \left|\operatorname{wt}_{L_1}(F_k(x))-\operatorname{wt}_{L_1}(F_k(y))\right|\le C_k(k+1)-1. \tag*{(34)} ∣ wt L 1 ( F k ( x )) − wt L 1 ( F k ( y )) ∣ ≤ C k ( k + 1 ) − 1. (34) Thus one may take C ( 3 ) = C k ( k + 1 ) − 1 C^{(3)}=C_k(k+1)-1 C ( 3 ) = C k ( k + 1 ) − 1 in Proposition III.2.
If x ∈ D q , k ( n ) x \in D_{q,k}(n) x ∈ D q , k ( n ) , every segment of y ^ \hat{y} y ^ has length at most 3 ℓ n , k + k 3\ell_{n,k}+k 3 ℓ n , k + k .
If x ∈ D q , k ( n ) x \in D_{q,k}(n) x ∈ D q , k ( n ) , both F k ( x ) F_k(x) F k ( x ) and F k ( y ) F_k(y) F k ( y ) are A n , k A_{n,k} A n , k bounded, where
A n , k ≜ Q − 1 + B ( 3 ℓ n , k + 1 ) + C k ( 3 ℓ n , k + k ) . (35) A_{n,k}\triangleq Q-1+B(3\ell_{n,k}+1)+C_k(3\ell_{n,k}+k). \tag*{(35)} A n , k ≜ Q − 1 + B ( 3 ℓ n , k + 1 ) + C k ( 3 ℓ n , k + k ) . (35)
Proof. Claim (i) follows from (27), because D q D_q D q and N k N_k N k are nonnegative and every segment of y ^ \hat{y} y ^ begins with the length-2 k 2k 2 k pattern. In the following, denote ρ = 2 k + ∣ u ∣ \rho=2k+|u| ρ = 2 k + ∣ u ∣ .
Next, we prove claim (ii). Let a ∈ D e s ( x ^ ) a\in D_{\mathrm{es}}(\hat{x}) a ∈ D es ( x ^ ) . By the definition of D e s ( x ^ ) D_{\mathrm{es}}(\hat{x}) D es ( x ^ ) , either [ a , a + 2 k − 1 ] ∩ [ ρ + 1 , ρ + ∣ s ∣ ] ≠ ∅ [a,a+2k-1]\cap[\rho+1,\rho+|s|]\ne\varnothing [ a , a + 2 k − 1 ] ∩ [ ρ + 1 , ρ + ∣ s ∣ ] = ∅ when ∣ s ∣ > 0 |s|>0 ∣ s ∣ > 0 , or a ≤ ρ < a + 2 k − 1 a\le\rho<a+2k-1 a ≤ ρ < a + 2 k − 1 when ∣ s ∣ = 0 |s|=0 ∣ s ∣ = 0 . Both cases imply a ∈ [ ρ − 2 k + 2 , ρ + ∣ s ∣ ] a\in[\rho-2k+2,\rho+|s|] a ∈ [ ρ − 2 k + 2 , ρ + ∣ s ∣ ] . This interval has length 2 k + ∣ s ∣ − 1 ≤ 3 k − 1 2k+|s|-1\le3k-1 2 k + ∣ s ∣ − 1 ≤ 3 k − 1 , whereas distinct pattern starts differ by at least 2 k 2k 2 k . Therefore, the interval [ ρ − 2 k + 2 , ρ + ∣ s ∣ ] [\rho-2k+2,\rho+|s|] [ ρ − 2 k + 2 , ρ + ∣ s ∣ ] contains at most two starts, which implies ∣ D e s ( x ^ ) ∣ ≤ 2 |D_{\mathrm{es}}(\hat{x})|\le2 ∣ D es ( x ^ ) ∣ ≤ 2 . Similarly, replacing ( x ^ , s , D e s ( x ^ ) ) (\hat{x},s,D_{\mathrm{es}}(\hat{x})) ( x ^ , s , D es ( x ^ )) by ( y ^ , t , D c r ( y ^ ) ) (\hat{y},t,D_{\mathrm{cr}}(\hat{y})) ( y ^ , t , D cr ( y ^ )) gives ∣ D c r ( y ^ ) ∣ ≤ 2 |D_{\mathrm{cr}}(\hat{y})|\le2 ∣ D cr ( y ^ ) ∣ ≤ 2 .
Let α \alpha α be the largest start in U ( x ^ ) U(\hat{x}) U ( x ^ ) satisfying α ≤ ρ − 2 k + 1 \alpha\le\rho-2k+1 α ≤ ρ − 2 k + 1 , and let β \beta β be the smallest start in U ( x ^ ) U(\hat{x}) U ( x ^ ) satisfying β ≥ ρ + ∣ s ∣ + 1 \beta\ge\rho+|s|+1 β ≥ ρ + ∣ s ∣ + 1 . Their existence follows from (29). Write U ( x ^ ) ∩ [ ρ − 2 k + 1 ] = { i 1 , … , i L } U(\hat{x})\cap[\rho-2k+1]=\{i_1,\ldots,i_L\} U ( x ^ ) ∩ [ ρ − 2 k + 1 ] = { i 1 , … , i L } and U ( x ^ ) ∩ [ ρ + ∣ s ∣ + 1 , ∣ x ^ ∣ ] = { j 1 , … , j R } U(\hat{x})\cap[\rho+|s|+1,|\hat{x}|]=\{j_1,\ldots,j_R\} U ( x ^ ) ∩ [ ρ + ∣ s ∣ + 1 , ∣ x ^ ∣ ] = { j 1 , … , j R } , where 1 = i 1 < ⋯ < i L = α 1=i_1<\cdots<i_L=\alpha 1 = i 1 < ⋯ < i L = α and β = j 1 < ⋯ < j R = n + 2 k + 1 \beta=j_1<\cdots<j_R=n+2k+1 β = j 1 < ⋯ < j R = n + 2 k + 1 . Then x ^ [ i 1 , i 2 − 1 ] , … , x ^ [ i L − 1 , i L − 1 ] \hat{x}_{[i_1,i_2-1]},\ldots,\hat{x}_{[i_{L-1},i_L-1]} x ^ [ i 1 , i 2 − 1 ] , … , x ^ [ i L − 1 , i L − 1 ] are all the segments of x ^ \hat{x} x ^ whose starts are to the left of α \alpha α , and x ^ [ j 1 , j 2 − 1 ] , … , x ^ [ j R − 1 , j R − 1 ] , x ^ [ j R , ∣ x ^ ∣ ] \hat{x}_{[j_1,j_2-1]},\ldots,\hat{x}_{[j_{R-1},j_R-1]},\hat{x}_{[j_R,|\hat{x}|]} x ^ [ j 1 , j 2 − 1 ] , … , x ^ [ j R − 1 , j R − 1 ] , x ^ [ j R , ∣ x ^ ∣ ] are all the segments of x ^ \hat{x} x ^ whose starts are no smaller than β \beta β . Let P = ( x ^ [ i 1 , i 2 − 1 ] , … , x ^ [ i L − 1 , i L − 1 ] ) \mathbf{P}=(\hat{x}_{[i_1,i_2-1]},\ldots,\hat{x}_{[i_{L-1},i_L-1]}) P = ( x ^ [ i 1 , i 2 − 1 ] , … , x ^ [ i L − 1 , i L − 1 ] ) and S = ( x ^ [ j 1 , j 2 − 1 ] , … , x ^ [ j R − 1 , j R − 1 ] , x ^ [ j R , ∣ x ^ ∣ ] ) \mathbf{S}=(\hat{x}_{[j_1,j_2-1]},\ldots,\hat{x}_{[j_{R-1},j_R-1]},\hat{x}_{[j_R,|\hat{x}|]}) S = ( x ^ [ j 1 , j 2 − 1 ] , … , x ^ [ j R − 1 , j R − 1 ] , x ^ [ j R , ∣ x ^ ∣ ] ) . Notice that P \mathbf{P} P might be empty.
By the definition of D e s ( x ^ ) D_{\mathrm{es}}(\hat{x}) D es ( x ^ ) , the set { α } ∪ D e s ( x ^ ) \{\alpha\}\cup D_{\mathrm{es}}(\hat{x}) { α } ∪ D es ( x ^ ) consists of the pattern starts that determine all the segments of x ^ \hat{x} x ^ which do not appear in P \mathbf{P} P or S \mathbf{S} S . Let A \mathbf{A} A be the sequence of these r + 1 r+1 r + 1 segments. Then we have Part k ( x ^ ) = P A S \operatorname{Part}_k(\hat{x})=\mathbf{P}\mathbf{A}\mathbf{S} Part k ( x ^ ) = PAS .
By (22), α \alpha α is also the largest start in U ( y ^ ) U(\hat{y}) U ( y ^ ) satisfying α ≤ ρ − 2 k + 1 \alpha\le\rho-2k+1 α ≤ ρ − 2 k + 1 , and that ϕ ( β ) \phi(\beta) ϕ ( β ) is the smallest start in U ( y ^ ) U(\hat{y}) U ( y ^ ) satisfying ϕ ( β ) ≥ ρ + ∣ t ∣ + 1 \phi(\beta)\ge\rho+|t|+1 ϕ ( β ) ≥ ρ + ∣ t ∣ + 1 . Then it follows from (22) and (30) that y ^ [ i 1 , i 2 − 1 ] , … , y ^ [ i L − 1 , i L − 1 ] \hat{y}_{[i_1,i_2-1]},\ldots,\hat{y}_{[i_{L-1},i_L-1]} y ^ [ i 1 , i 2 − 1 ] , … , y ^ [ i L − 1 , i L − 1 ] are all the segments of y ^ \hat{y} y ^ whose starts are to the left of α \alpha α , and that y ^ [ j 1 , j 2 − 1 ] , … , y ^ [ j R − 1 , j R − 1 ] , y ^ [ j R , ∣ y ^ ∣ ] \hat{y}_{[j_1,j_2-1]},\ldots,\hat{y}_{[j_{R-1},j_R-1]},\hat{y}_{[j_R,|\hat{y}|]} y ^ [ j 1 , j 2 − 1 ] , … , y ^ [ j R − 1 , j R − 1 ] , y ^ [ j R , ∣ y ^ ∣ ] are all the segments of y ^ \hat{y} y ^ whose starts are no smaller than ϕ ( β ) \phi(\beta) ϕ ( β ) . By the definition of D c r ( y ^ ) D_{\mathrm{cr}}(\hat{y}) D cr ( y ^ ) , the set { α } ∪ D c r ( y ^ ) \{\alpha\}\cup D_{\mathrm{cr}}(\hat{y}) { α } ∪ D cr ( y ^ ) consists of the pattern starts that determine all the segments of y ^ \hat{y} y ^ which do not appear in P \mathbf{P} P and S \mathbf{S} S . Let A ′ \mathbf{A}' A ′ be the sequence of these r ′ + 1 r'+1 r ′ + 1 segments. Thus we have Part k ( y ^ ) = P A ′ S \operatorname{Part}_k(\hat{y})=\mathbf{P}\mathbf{A}'\mathbf{S} Part k ( y ^ ) = P A ′ S . This proves (ii). Claim (ii) and (28) imply that F k ( y ~ ) F_k(\widetilde{y}) F k ( y ) is obtained from F k ( x ) F_k(x) F k ( x ) by one 3-substring edit and ∣ m k ( x ~ ) − m k ( y ~ ) ∣ ≤ 2 |m_k(\widetilde{x})-m_k(\widetilde{y})|\leq2 ∣ m k ( x ) − m k ( y ) ∣ ≤ 2 . Since m k ( x ~ ) = m k ( x ) + 2 m_k(\widetilde{x})=m_k(x)+2 m k ( x ) = m k ( x ) + 2 and m k ( y ~ ) = m k ( y ) + 2 m_k(\widetilde{y})=m_k(y)+2 m k ( y ) = m k ( y ) + 2 , we have ∣ m k ( x ) − m k ( y ) ∣ ≤ 2 |m_k(x)-m_k(y)|\leq2 ∣ m k ( x ) − m k ( y ) ∣ ≤ 2 . To prove (iv), define
Δ D = ∑ i = 1 m k ( x ~ ) D q ( x ~ i ( k ) ) − ∑ j = 1 m k ( y ~ ) D q ( y ~ j ( k ) ) , Δ N = ∑ i = 1 m k ( x ~ ) N k ( x ~ i ( k ) ) − ∑ j = 1 m k ( y ~ ) N k ( y ~ j ( k ) ) . (36) \Delta_D=\sum_{i=1}^{m_k(\widetilde{x})}D_q\left(\widetilde{x}_i^{(k)}\right)-\sum_{j=1}^{m_k(\widetilde{y})}D_q\left(\widetilde{y}_j^{(k)}\right),\quad\Delta_N=\sum_{i=1}^{m_k(\widetilde{x})}N_k\left(\widetilde{x}_i^{(k)}\right)-\sum_{j=1}^{m_k(\widetilde{y})}N_k\left(\widetilde{y}_j^{(k)}\right). \tag*{(36)} Δ D = i = 1 ∑ m k ( x ) D q ( x i ( k ) ) − j = 1 ∑ m k ( y ) D q ( y j ( k ) ) , Δ N = i = 1 ∑ m k ( x ) N k ( x i ( k ) ) − j = 1 ∑ m k ( y ) N k ( y j ( k ) ) . (36)
Let S S S and S ′ S' S ′ be the multisets of segments contained in A \mathbf{A} A and A ′ \mathbf{A}' A ′ , respectively. Then by claim (ii), we have 1 ≤ ∣ S ∣ , ∣ S ′ ∣ ≤ 3 1\leq|S|,|S'|\leq3 1 ≤ ∣ S ∣ , ∣ S ′ ∣ ≤ 3 and
∣ Δ D ∣ = ∣ ∑ x ~ i ( k ) ∈ S D q ( x ~ i ( k ) ) − ∑ y ~ j ( k ) ∈ S ′ D q ( y ~ j ( k ) ) ∣ ≤ max { ∑ x ~ i ( k ) ∈ S D q ( x ~ i ( k ) ) , ∑ y ~ j ( k ) ∈ S ′ D q ( y ~ j ( k ) ) } ≤ 3 ( Q − 1 ) = D max . (37) \begin{aligned}
|\Delta_D|&=\left|\sum_{\widetilde{x}_i^{(k)}\in S}D_q\left(\widetilde{x}_i^{(k)}\right)-\sum_{\widetilde{y}_j^{(k)}\in S'}D_q\left(\widetilde{y}_j^{(k)}\right)\right|\\
&\leq\max\left\{\sum_{\widetilde{x}_i^{(k)}\in S}D_q\left(\widetilde{x}_i^{(k)}\right),\sum_{\widetilde{y}_j^{(k)}\in S'}D_q\left(\widetilde{y}_j^{(k)}\right)\right\}\\
&\leq3(Q-1)=D_{\max}. \tag*{(37)}
\end{aligned} ∣ Δ D ∣ = x i ( k ) ∈ S ∑ D q ( x i ( k ) ) − y j ( k ) ∈ S ′ ∑ D q ( y j ( k ) ) ≤ max ⎩ ⎨ ⎧ x i ( k ) ∈ S ∑ D q ( x i ( k ) ) , y j ( k ) ∈ S ′ ∑ D q ( y j ( k ) ) ⎭ ⎬ ⎫ ≤ 3 ( Q − 1 ) = D m a x . (37)
Notice that no occurrence of 1 k 1^k 1 k overlaps with two segments, because every segment starts with 0 k 0^k 0 k . Consequently,
∑ i = 1 m k ( x ~ ) N k ( x ~ i ( k ) ) = N k ( x ~ ) , ∑ j = 1 m k ( y ~ ) N k ( y ~ j ( k ) ) = N k ( y ~ ) . (38) \sum_{i=1}^{m_k(\widetilde{x})}N_k\left(\widetilde{x}_i^{(k)}\right)=N_k(\widetilde{x}),\qquad\sum_{j=1}^{m_k(\widetilde{y})}N_k\left(\widetilde{y}_j^{(k)}\right)=N_k(\widetilde{y}). \tag*{(38)} i = 1 ∑ m k ( x ) N k ( x i ( k ) ) = N k ( x ) , j = 1 ∑ m k ( y ) N k ( y j ( k ) ) = N k ( y ) . (38)
Therefore,
Δ N = N k ( x ~ ) − N k ( y ~ ) . (39) \Delta_N=N_k(\widetilde{x})-N_k(\widetilde{y}). \tag*{(39)} Δ N = N k ( x ) − N k ( y ) . (39)
Suppose that x ~ [ a , a + k − 1 ] = 1 k \widetilde{x}_{[a,a+k-1]}=1^k x [ a , a + k − 1 ] = 1 k . This occurrence of 1 k 1^k 1 k can be destroyed by the k k k -substring edit only if [ a , a + k − 1 ] [a,a+k-1] [ a , a + k − 1 ] intersects or crosses the edit region in x ~ \widetilde{x} x , implying that ρ − k + 2 ≤ a ≤ ρ + ∣ s ∣ \rho-k+2\leq a\leq\rho+|s| ρ − k + 2 ≤ a ≤ ρ + ∣ s ∣ . Therefore, there are at most ∣ s ∣ + k − 1 ≤ 2 k − 1 |s|+k-1\leq2k-1 ∣ s ∣ + k − 1 ≤ 2 k − 1 copies of 1 k 1^k 1 k in x ~ \widetilde{x} x that can be destroyed. By the same argument, there are at most 2 k − 1 2k-1 2 k − 1 copies of 1 k 1^k 1 k in y ~ \widetilde{y} y that can be created. Consequently,
∣ Δ N ∣ = ∣ N k ( x ~ ) − N k ( y ~ ) ∣ ≤ 2 k − 1. (40) |\Delta_N|=|N_k(\widetilde{x})-N_k(\widetilde{y})|\leq2k-1. \tag*{(40)} ∣ Δ N ∣ = ∣ N k ( x ) − N k ( y ) ∣ ≤ 2 k − 1. (40)
Now it follows that
∣ wt L 1 ( F k ( x ) ) − wt L 1 ( F k ( y ) ) ∣ ≤ ∣ ∑ i D q ( x ~ i ( k ) ) − ∑ j D q ( y ~ j ( k ) ) ∣ + B ∣ ∑ i N k ( x ~ i ( k ) ) − ∑ j N k ( y ~ j ( k ) ) ∣ + C k ∣ ∑ i x ~ i ( k ) − ∑ j y ~ j ( k ) ∣ = ∣ Δ D ∣ + B ∣ Δ N ∣ + C k ∣ x ∣ − ∣ y ∣ ≤ D max + B ( 2 k − 1 ) + C k k = C k ( k + 1 ) − 1. (41) \begin{aligned}
|\operatorname{wt}_{L_1}(F_k(x))-\operatorname{wt}_{L_1}(F_k(y))|
&\leq\left|\sum_iD_q\left(\widetilde{x}_i^{(k)}\right)-\sum_jD_q\left(\widetilde{y}_j^{(k)}\right)\right|+B\left|\sum_iN_k\left(\widetilde{x}_i^{(k)}\right)-\sum_jN_k\left(\widetilde{y}_j^{(k)}\right)\right|\\
&\qquad+C_k\left|\sum_i\widetilde{x}_i^{(k)}-\sum_j\widetilde{y}_j^{(k)}\right|\\
&=|\Delta_D|+B|\Delta_N|+C_k|x|-|y|\\
&\leq D_{\max}+B(2k-1)+C_kk=C_k(k+1)-1. \tag*{(41)}
\end{aligned} ∣ wt L 1 ( F k ( x )) − wt L 1 ( F k ( y )) ∣ ≤ i ∑ D q ( x i ( k ) ) − j ∑ D q ( y j ( k ) ) + B i ∑ N k ( x i ( k ) ) − j ∑ N k ( y j ( k ) ) + C k i ∑ x i ( k ) − j ∑ y j ( k ) = ∣ Δ D ∣ + B ∣ Δ N ∣ + C k ∣ x ∣ − ∣ y ∣ ≤ D m a x + B ( 2 k − 1 ) + C k k = C k ( k + 1 ) − 1. (41)
This completes the proof of (iv).
Since C k ( k + 1 ) − 1 ≥ 2 k C k C_k(k+1)-1\geq2kC_k C k ( k + 1 ) − 1 ≥ 2 k C k , the choice of C ( 1 ) C^{(1)} C ( 1 ) , C ( 2 ) C^{(2)} C ( 2 ) and C ( 3 ) C^{(3)} C ( 3 ) in claims (i) and (iv) is correct.
When x ∈ D q , k ( n ) x\in D_{q,k}(n) x ∈ D q , k ( n ) , each segment of x ~ \widetilde{x} x has length at most ℓ n , k \ell_{n,k} ℓ n , k by Lemma IV.1. A segment of y ~ \widetilde{y} y contains symbols from at most three segments of x ~ \widetilde{x} x , together with at most k k k symbols of t t t . Its length is therefore at most 3 ℓ n , k + k 3\ell_{n,k}+k 3 ℓ n , k + k . This proves (v).
Finally, claim (vi) follows from (27), (28) and (v).
Strong Locatability of the Induced 3-Substring Edit
Throughout this subsection, let y y y be obtained from x x x by a nontrivial k k k -substring edit, and use the representation in (2)–(3). Then x ~ \widetilde{x} x and y ~ \widetilde{y} y have the forms in (20). We will show that the induced 3-substring edit F k ( x ) → 3 F k ( y ) F_k(x)\to_3 F_k(y) F k ( x ) → 3 F k ( y ) is strongly locatable. Conditions (i)–(iii) in Definition III.1 are established in Lemmas IV.6 to IV.8, respectively.
Notice that ∣ F k ( x ) ∣ = ∣ F k ( y ) ∣ |F_k(x)|=|F_k(y)| ∣ F k ( x ) ∣ = ∣ F k ( y ) ∣ (i.e., m k ( x ~ ) = m k ( y ~ ) m_k(\widetilde{x})=m_k(\widetilde{y}) m k ( x ) = m k ( y ) ) is equivalent to m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) . Recall the definition of D e s ( x ~ ) D_{\mathrm{es}}(\widetilde{x}) D es ( x ) and C r e ( y ~ ) C_{\mathrm{re}}(\widetilde{y}) C re ( y ) from Definition IV.1. In the following proofs, put ρ = ∣ p k u ∣ = 2 k + ∣ u ∣ \rho=|pku|=2k+|u| ρ = ∣ p k u ∣ = 2 k + ∣ u ∣ .
Lemma IV.3. If m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) , then exactly one of the following two situations occurs.
(i) D e s ( x ~ ) = C r e ( y ~ ) = ∅ D_{\mathrm{es}}(\widetilde{x})=C_{\mathrm{re}}(\widetilde{y})=\varnothing D es ( x ) = C re ( y ) = ∅ . In this case, for some i ∈ [ m k ( x ~ ) ] i\in[m_k(\widetilde{x})] i ∈ [ m k ( x )] , the edit region in x ~ \widetilde{x} x is covered by the i i i -th segment of x ~ \widetilde{x} x and the edit region in y ~ \widetilde{y} y is covered by the i i i -th segment of y ~ \widetilde{y} y . Moreover, x ~ j ( k ) = y ~ j ( k ) \widetilde{x}_j^{(k)}=\widetilde{y}_j^{(k)} x j ( k ) = y j ( k ) for every j ≠ i j\neq i j = i .
(ii) ∣ D e s ( x ~ ) ∣ = ∣ C r e ( y ~ ) ∣ = 1 |D_{\mathrm{es}}(\widetilde{x})|=|C_{\mathrm{re}}(\widetilde{y})|=1 ∣ D es ( x ) ∣ = ∣ C re ( y ) ∣ = 1 .
Proof. Set r = ∣ D e s ( x ~ ) ∣ r=|D_{\mathrm{es}}(\widetilde{x})| r = ∣ D es ( x ) ∣ and r ′ = ∣ C r e ( y ~ ) ∣ r'=|C_{\mathrm{re}}(\widetilde{y})| r ′ = ∣ C re ( y ) ∣ . By Lemma IV.2 (ii), we have 0 ≤ r , r ′ ≤ 2 0\leq r,r'\leq2 0 ≤ r , r ′ ≤ 2 and m k ( x ) − m k ( y ) = m k ( x ~ ) − m k ( y ~ ) = r − r ′ m_k(x)-m_k(y)=m_k(\widetilde{x})-m_k(\widetilde{y})=r-r' m k ( x ) − m k ( y ) = m k ( x ) − m k ( y ) = r − r ′ . The assumption m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) therefore gives r = r ′ r=r' r = r ′ . We exclude the case r = r ′ = 2 r=r'=2 r = r ′ = 2 . Suppose first that r = 2 r=2 r = 2 . Write Des ( x ^ ) = { a 1 , a 2 } \operatorname{Des}(\hat{x})=\{a_1,a_2\} Des ( x ^ ) = { a 1 , a 2 } with a 1 < a 2 a_1<a_2 a 1 < a 2 . It holds that a 2 − a 1 ≥ 2 k a_2-a_1\ge2k a 2 − a 1 ≥ 2 k because both a 1 a_1 a 1 and a 2 a_2 a 2 are pattern starts in x ^ \hat{x} x ^ . By the definition of Des ( x ^ ) \operatorname{Des}(\hat{x}) Des ( x ^ ) , both [ a 1 , a 1 + 2 k − 1 ] [a_1,a_1+2k-1] [ a 1 , a 1 + 2 k − 1 ] and [ a 2 , a 2 + 2 k − 1 ] [a_2,a_2+2k-1] [ a 2 , a 2 + 2 k − 1 ] intersect or cross the edit region in x ^ \hat{x} x ^ . If s = ϵ s=\epsilon s = ϵ , this implies a j ≤ ρ < a j + 2 k − 1 a_j\le\rho<a_j+2k-1 a j ≤ ρ < a j + 2 k − 1 for j = 1 , 2 j=1,2 j = 1 , 2 , contradicting the fact a 2 − a 1 ≥ 2 k a_2-a_1\ge2k a 2 − a 1 ≥ 2 k .
Hence ∣ s ∣ ≥ 1 |s|\ge1 ∣ s ∣ ≥ 1 . Put L = ρ + 1 L=\rho+1 L = ρ + 1 and R = ρ + ∣ s ∣ R=\rho+|s| R = ρ + ∣ s ∣ . Since ∣ s ∣ ≤ k |s|\le k ∣ s ∣ ≤ k and both [ a 1 , a 1 + 2 k − 1 ] [a_1,a_1+2k-1] [ a 1 , a 1 + 2 k − 1 ] and [ a 2 , a 2 + 2 k − 1 ] [a_2,a_2+2k-1] [ a 2 , a 2 + 2 k − 1 ] intersect [ L , R ] [L,R] [ L , R ] , we have L ∈ [ a 1 + k , a 1 + 2 k − 1 ] L\in[a_1+k,a_1+2k-1] L ∈ [ a 1 + k , a 1 + 2 k − 1 ] and R ∈ [ a 2 , a 2 + k − 1 ] R\in[a_2,a_2+k-1] R ∈ [ a 2 , a 2 + k − 1 ] . Thus s 1 = x ^ L = 1 s_1=\hat{x}_L=1 s 1 = x ^ L = 1 and s ∣ s ∣ = x ^ R = 0 s_{|s|}=\hat{x}_R=0 s ∣ s ∣ = x ^ R = 0 .
The same argument applied to y ^ \hat{y} y ^ , t t t and Cre ( y ^ ) \operatorname{Cre}(\hat{y}) Cre ( y ^ ) shows that r ′ = 2 r'=2 r ′ = 2 implies ∣ t ∣ ≥ 1 |t|\ge1 ∣ t ∣ ≥ 1 , t 1 = 1 t_1=1 t 1 = 1 , and t ∣ t ∣ = 0 t_{|t|}=0 t ∣ t ∣ = 0 . This contradicts the assumption s 1 ≠ t 1 s_1\ne t_1 s 1 = t 1 and s ∣ s ∣ ≠ t ∣ t ∣ s_{|s|}\ne t_{|t|} s ∣ s ∣ = t ∣ t ∣ in (3). Hence r = r ′ ∈ { 0 , 1 } r=r'\in\{0,1\} r = r ′ ∈ { 0 , 1 } .
If r = r ′ = 1 r=r'=1 r = r ′ = 1 , claim (ii) holds. If r = r ′ = 0 r=r'=0 r = r ′ = 0 , it follows from Lemma IV.2 (ii) that the edit region in x ^ \hat{x} x ^ is covered by the single segment in A A A , and the edit region in y ^ \hat{y} y ^ is covered by the single segment in A ′ A' A ′ . Equation (33) implies that if the segment in A A A is the i i i -th segment of x ^ \hat{x} x ^ , then the segment in A ′ A' A ′ is the i i i -th segment of y ^ \hat{y} y ^ . Finally, the assertion that x ^ j ( k ) = y ^ j ( k ) \hat{x}^{(k)}_j=\hat{y}^{(k)}_j x ^ j ( k ) = y ^ j ( k ) for every j ≠ i j\ne i j = i also follows from (33).
The next statement is the q q q -ary counterpart of [2 Lemma 10] . We give a new proof because the argument there is stated for binary sequences.
Lemma IV.4. Suppose ∣ x ∣ = ∣ y ∣ |x|=|y| ∣ x ∣ = ∣ y ∣ and m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) . If situation (ii) in Lemma IV.3 holds, then N k ( x ^ ) ≠ N k ( y ^ ) N_k(\hat{x})\ne N_k(\hat{y}) N k ( x ^ ) = N k ( y ^ ) .
Proof: Since ∣ x ∣ = ∣ y ∣ |x|=|y| ∣ x ∣ = ∣ y ∣ , we have ∣ s ∣ = ∣ t ∣ |s|=|t| ∣ s ∣ = ∣ t ∣ . Since x ≠ y x\ne y x = y , 1 ≤ ∣ s ∣ ≤ k 1\le|s|\le k 1 ≤ ∣ s ∣ ≤ k . Put [ L , R ] = [ ρ + 1 , ρ + ∣ s ∣ ] [L,R]=[\rho+1,\rho+|s|] [ L , R ] = [ ρ + 1 , ρ + ∣ s ∣ ] . Equation (3) gives x ^ L ≠ y ^ L \hat{x}_L\ne\hat{y}_L x ^ L = y ^ L and x ^ R ≠ y ^ R \hat{x}_R\ne\hat{y}_R x ^ R = y ^ R . Write Des ( x ^ ) = { a } \operatorname{Des}(\hat{x})=\{a\} Des ( x ^ ) = { a } and Cre ( y ^ ) = { b } \operatorname{Cre}(\hat{y})=\{b\} Cre ( y ^ ) = { b } . By definition, it holds that x ^ [ a , a + 2 k − 1 ] = y ^ [ b , b + 2 k − 1 ] = p k \hat{x}_{[a,a+2k-1]}=\hat{y}_{[b,b+2k-1]}=p_k x ^ [ a , a + 2 k − 1 ] = y ^ [ b , b + 2 k − 1 ] = p k , and both intervals [ a , a + 2 k − 1 ] [a,a+2k-1] [ a , a + 2 k − 1 ] and [ b , b + 2 k − 1 ] [b,b+2k-1] [ b , b + 2 k − 1 ] intersect the edit region [ L , R ] [L,R] [ L , R ] .
We first show that a ≠ b a\ne b a = b . Suppose a = b a=b a = b . Then x ^ [ a , a + 2 k − 1 ] = y ^ [ a , a + 2 k − 1 ] \hat{x}_{[a,a+2k-1]}=\hat{y}_{[a,a+2k-1]} x ^ [ a , a + 2 k − 1 ] = y ^ [ a , a + 2 k − 1 ] . Since R − L < 2 k R-L<2k R − L < 2 k , the interval [ a , a + 2 k − 1 ] [a,a+2k-1] [ a , a + 2 k − 1 ] cannot be contained in [ L , R ] [L,R] [ L , R ] . On the other hand, we have [ L , R ] ∩ [ a , a + 2 k − 1 ] ≠ ∅ [L,R]\cap[a,a+2k-1]\ne\varnothing [ L , R ] ∩ [ a , a + 2 k − 1 ] = ∅ . Therefore, at least one of L L L and R R R belongs to [ a , a + 2 k − 1 ] [a,a+2k-1] [ a , a + 2 k − 1 ] , implying x ^ L = y ^ L \hat{x}_L=\hat{y}_L x ^ L = y ^ L or x ^ R = y ^ R \hat{x}_R=\hat{y}_R x ^ R = y ^ R . This contradicts the fact x ^ L ≠ y ^ L \hat{x}_L\ne\hat{y}_L x ^ L = y ^ L and x ^ R ≠ y ^ R \hat{x}_R\ne\hat{y}_R x ^ R = y ^ R . Thus a ≠ b a\ne b a = b .
Interchanging x x x and y y y interchanges a a a and b b b . Thus, it is sufficient to assume a < b a<b a < b . This arrangement is illustrated in Figure 3 . We next prove
Figure 3. The case a < b a<b a < b in the proof of Lemma IV.4. The edit region [ L , R ] [L,R] [ L , R ] meets the 1 k 1^k 1 k half of the pattern starting at a a a and the 0 k 0^k 0 k half of the pattern starting at b b b .
L ∈ [ a + k , a + 2 k − 1 ] , R ∈ [ b , b + k − 1 ] . (42) L\in[a+k,a+2k-1],\quad R\in[b,b+k-1]. \tag*{(42)} L ∈ [ a + k , a + 2 k − 1 ] , R ∈ [ b , b + k − 1 ] . (42)
There are three possible relative positions of a a a and b b b .
If b ≥ a + 2 k b\ge a+2k b ≥ a + 2 k , (42) follows immediately from the fact that R − L < k R-L<k R − L < k and the interval [ L , R ] [L,R] [ L , R ] intersects both [ a , a + 2 k − 1 ] [a,a+2k-1] [ a , a + 2 k − 1 ] and [ b , b + 2 k − 1 ] [b,b+2k-1] [ b , b + 2 k − 1 ] .
If b < a + 2 k b<a+2k b < a + 2 k , then a + k ≤ b + k − 1 < a + 2 k − 1 a+k\le b+k-1<a+2k-1 a + k ≤ b + k − 1 < a + 2 k − 1 . Thus x ^ [ a + k , b + k − 1 ] = 1 b − a \hat{x}_{[a+k,b+k-1]}=1^{b-a} x ^ [ a + k , b + k − 1 ] = 1 b − a and y ^ [ a + k , b + k − 1 ] = 0 b − a \hat{y}_{[a+k,b+k-1]}=0^{b-a} y ^ [ a + k , b + k − 1 ] = 0 b − a , which implies L ≤ a + k L\le a+k L ≤ a + k and R ≥ b + k − 1 R\ge b+k-1 R ≥ b + k − 1 . Since R − L < k R-L<k R − L < k , x ^ [ b , a + k − 1 ] = y ^ [ b , a + k − 1 ] = 0 a + k − b \hat{x}_{[b,a+ k-1]}=\hat{y}_{[b,a+k-1]}=0^{a+k-b} x ^ [ b , a + k − 1 ] = y ^ [ b , a + k − 1 ] = 0 a + k − b , x ^ [ b + k , a + 2 k − 1 ] = y ^ [ b + k , a + 2 k − 1 ] = 1 a + 2 k − b \hat{x}_{[b+k,a+2k-1]}=\hat{y}_{[b+k,a+2k-1]}=1^{a+2k-b} x ^ [ b + k , a + 2 k − 1 ] = y ^ [ b + k , a + 2 k − 1 ] = 1 a + 2 k − b , we conclude that L = a + k L=a+k L = a + k and R = b + k − 1 R=b+k-1 R = b + k − 1 .
Finally, suppose a + k ≤ b < a + 2 k a+k\le b<a+2k a + k ≤ b < a + 2 k . Then a + 2 k − 1 ≤ b + k − 1 a+2k-1\le b+k-1 a + 2 k − 1 ≤ b + k − 1 . Therefore, we have x ^ [ b , a + 2 k − 1 ] = 1 a + 2 k − b \hat{x}_{[b,a+2k-1]}=1^{a+2k-b} x ^ [ b , a + 2 k − 1 ] = 1 a + 2 k − b and y ^ [ b , a + 2 k − 1 ] = 0 a + 2 k − b \hat{y}_{[b,a+2k-1]}=0^{a+2k-b} y ^ [ b , a + 2 k − 1 ] = 0 a + 2 k − b , which implies L ≤ b L\le b L ≤ b and R ≥ a + 2 k − 1 R\ge a+2k-1 R ≥ a + 2 k − 1 . Combining these inequalities with R − L < k R-L<k R − L < k yields a + k ≤ L ≤ b a+k\le L\le b a + k ≤ L ≤ b and a + 2 k − 1 ≤ R ≤ b + k − 1 a+2k-1\le R\le b+k-1 a + 2 k − 1 ≤ R ≤ b + k − 1 . This proves (42) in all three cases.
Combining L ∈ [ a + k , a + 2 k − 1 ] L\in[a+k,a+2k-1] L ∈ [ a + k , a + 2 k − 1 ] with x ^ L ≠ y ^ L \hat{x}_L\ne\hat{y}_L x ^ L = y ^ L , we get x ^ L = 1 \hat{x}_L=1 x ^ L = 1 and y ^ L ≠ 1 \hat{y}_L\ne1 y ^ L = 1 . Combining R ∈ [ b , b + k − 1 ] R\in[b,b+k-1] R ∈ [ b , b + k − 1 ] with x ^ R ≠ y ^ R \hat{x}_R\ne\hat{y}_R x ^ R = y ^ R , we get x ^ R ≠ 0 \hat{x}_R\ne0 x ^ R = 0 and y ^ R = 0 \hat{y}_R=0 y ^ R = 0 . In particular, x ^ [ a + k , a + 2 k − 1 ] = 1 k \hat{x}_{[a+k,a+2k-1]}=1^k x ^ [ a + k , a + 2 k − 1 ] = 1 k but y ^ [ a + k , a + 2 k − 1 ] ≠ 1 k \hat{y}_{[a+k,a+2k-1]}\ne1^k y ^ [ a + k , a + 2 k − 1 ] = 1 k .
It remains to show that y ^ \hat{y} y ^ has no occurrence of 1 k 1^k 1 k that is absent from x ^ \hat{x} x ^ . Consider a length-k k k substring y ^ [ i , i + k − 1 ] \hat{y}_{[i,i+k-1]} y ^ [ i , i + k − 1 ] of y ^ \hat{y} y ^ . If L − k + 1 ≤ i ≤ R L-k+1\le i\le R L − k + 1 ≤ i ≤ R , this implies that the substring y ^ [ i , i + k − 1 ] \hat{y}_{[i,i+k-1]} y ^ [ i , i + k − 1 ] must contain a symbol that is not 1 and thus, y ^ [ i , i + k − 1 ] ≠ 1 k \hat{y}_{[i,i+k-1]}\ne1^k y ^ [ i , i + k − 1 ] = 1 k . If i ≤ L − k i\le L-k i ≤ L − k or i > R i>R i > R , we have y ^ [ i , i + k − 1 ] = x ^ [ i , i + k − 1 ] \hat{y}_{[i,i+k-1]}=\hat{x}_{[i,i+k-1]} y ^ [ i , i + k − 1 ] = x ^ [ i , i + k − 1 ] . Therefore, we can conclude that N k ( x ^ ) − N k ( y ^ ) ≥ 1 N_k(\hat{x})-N_k(\hat{y})\ge1 N k ( x ^ ) − N k ( y ^ ) ≥ 1 . This completes the proof. ■
Regarding the function D q ( ⋅ ) D_q(\cdot) D q ( ⋅ ) defined in (24), we have the following lemma.
Lemma IV.5. Let z , z ′ ∈ Σ q r z,z'\in\Sigma_q^r z , z ′ ∈ Σ q r be two distinct sequences. Suppose that there is an interval [ L , R ] ⊆ [ r ] [L,R]\subseteq[r] [ L , R ] ⊆ [ r ] with R − L < k R-L<k R − L < k such that z i ≠ z i ′ z_i\ne z'_i z i = z i ′ only if i ∈ [ L , R ] i\in[L,R] i ∈ [ L , R ] . Then D q ( z ) ≠ D q ( z ′ ) D_q(z)\ne D_q(z') D q ( z ) = D q ( z ′ ) .
Proof: Because R − L < k R-L<k R − L < k , the interval [ L , R ] [L,R] [ L , R ] contains at most one coordinate from each residue class modulo k k k . Then by (23) and the assumption that z ≠ z ′ z\ne z' z = z ′ and z [ r ] ∖ [ L , R ] = z [ r ] ∖ [ L , R ] ′ z_{[r]\setminus[L,R]}=z'_{[r]\setminus[L,R]} z [ r ] ∖ [ L , R ] = z [ r ] ∖ [ L , R ] ′ , we have ( d 1 ( z ) , … , d k ( z ) ) ≠ ( d 1 ( z ′ ) , … , d k ( z ′ ) ) (d_1(z),\ldots,d_k(z))\ne(d_1(z'),\ldots,d_k(z')) ( d 1 ( z ) , … , d k ( z )) = ( d 1 ( z ′ ) , … , d k ( z ′ )) . Now the conclusion follows from (24). ■
With Lemmas IV.3 to IV.5 in hand, we are ready to prove that F k ( x ) F_k(x) F k ( x ) and F k ( y ) F_k(y) F k ( y ) satisfy condition (i) in Definition III.1.
Lemma IV.6. If m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) , then wt L 1 ( F k ( x ) ) ≠ wt L 1 ( F k ( y ) ) \operatorname{wt}_{L_1}(F_k(x))\ne\operatorname{wt}_{L_1}(F_k(y)) wt L 1 ( F k ( x )) = wt L 1 ( F k ( y )) .
Proof: Let E = wt L 1 ( F k ( x ) ) − wt L 1 ( F k ( y ) ) E=\operatorname{wt}_{L_1}(F_k(x))-\operatorname{wt}_{L_1}(F_k(y)) E = wt L 1 ( F k ( x )) − wt L 1 ( F k ( y )) . From (27), (28) and (36), we obtain E = Δ D + B Δ N + C k ( ∣ x ^ ∣ − ∣ y ^ ∣ ) E=\Delta_D+B\Delta_N+C_k(|\hat{x}|-|\hat{y}|) E = Δ D + B Δ N + C k ( ∣ x ^ ∣ − ∣ y ^ ∣ ) . It is sufficient to show ∣ E ∣ > 0 |E|>0 ∣ E ∣ > 0 .
First suppose ∣ x ∣ ≠ ∣ y ∣ |x|\ne|y| ∣ x ∣ = ∣ y ∣ . By (20), we have ∥ x ^ ∥ − ∥ y ^ ∥ ≥ 1 \lVert\hat{x}\rVert-\lVert\hat{y}\rVert\ge1 ∥ x ^ ∥ − ∥ y ^ ∥ ≥ 1 . Then ∣ E ∣ ≥ C k ∣ ∥ x ^ ∥ − ∥ y ^ ∥ ∣ − ( ∣ Δ D ∣ + B ∣ Δ N ∣ ) ≥ ( a ) C k − ( D max + B ( 2 k − 1 ) ) > 0 |E|\ge C_k|\lVert\hat{x}\rVert-\lVert\hat{y}\rVert|-(|\Delta_D|+B|\Delta_N|)\overset{(a)}{\ge}C_k-(D_{\max}+B(2k-1))>0 ∣ E ∣ ≥ C k ∣ ∥ x ^ ∥ − ∥ y ^ ∥ ∣ − ( ∣ Δ D ∣ + B ∣ Δ N ∣ ) ≥ ( a ) C k − ( D m a x + B ( 2 k − 1 )) > 0 , where (a) follows from (37) and (40), and the last inequality follows from (26).
Now suppose ∣ x ∣ = ∣ y ∣ |x|=|y| ∣ x ∣ = ∣ y ∣ . If N k ( x ^ ) ≠ N k ( y ^ ) N_k(\hat{x})\ne N_k(\hat{y}) N k ( x ^ ) = N k ( y ^ ) , it holds that ∣ E ∣ ≥ B ∣ Δ N ∣ − ∣ Δ D ∣ ≥ ( b ) B ∣ N k ( x ^ ) − N k ( y ^ ) ∣ − ∣ Δ D ∣ ≥ B − D max > 0 |E|\ge B|\Delta_N|-|\Delta_D|\overset{(b)}{\ge}B|N_k(\hat{x})-N_k(\hat{y})|-|\Delta_D|\ge B-D_{\max}>0 ∣ E ∣ ≥ B ∣ Δ N ∣ − ∣ Δ D ∣ ≥ ( b ) B ∣ N k ( x ^ ) − N k ( y ^ ) ∣ − ∣ Δ D ∣ ≥ B − D m a x > 0 , where (b) follows from (39) and the last inequality follows from (25).
It remains to consider the case ∣ x ∣ = ∣ y ∣ |x|=|y| ∣ x ∣ = ∣ y ∣ and N k ( x ^ ) = N k ( y ^ ) N_k(\hat{x})=N_k(\hat{y}) N k ( x ^ ) = N k ( y ^ ) . Lemma IV.4 excludes situation (ii) of Lemma IV.3. Let i ∈ [ m k ( x ^ ) ] i\in[m_k(\hat{x})] i ∈ [ m k ( x ^ )] be the index in Lemma IV.3 (i). Since ∣ x ^ ∣ = ∣ y ^ ∣ |\hat{x}|=|\hat{y}| ∣ x ^ ∣ = ∣ y ^ ∣ and x ^ j ( k ) = y ^ j ( k ) \hat{x}^{(k)}_j=\hat{y}^{(k)}_j x ^ j ( k ) = y ^ j ( k ) for every j ≠ i j\ne i j = i , we conclude ∣ x ^ i ( k ) ∣ = ∣ y ^ i ( k ) ∣ \left|\hat{x}^{(k)}_i\right|=\left|\hat{y}^{(k)}_i\right| x ^ i ( k ) = y ^ i ( k ) . Moreover, by Lemma IV.3 (i), x ^ i ( k ) \hat{x}^{(k)}_i x ^ i ( k ) and y ^ i ( k ) \hat{y}^{(k)}_i y ^ i ( k ) differ only in the edit regions, whose length is at most k k k . Thus, the hypotheses of Lemma IV.5 hold and ∣ E ∣ = ∣ Δ D ∣ = ∣ D q ( x ^ i ( k ) ) − D q ( y ^ i ( k ) ) ∣ > 0 |E|=|\Delta_D|=\left|D_q\left(\hat{x}^{(k)}_i\right)-D_q\left(\hat{y}^{(k)}_i\right)\right|>0 ∣ E ∣ = ∣ Δ D ∣ = D q ( x ^ i ( k ) ) − D q ( y ^ i ( k ) ) > 0 . This completes the proof. ■
The next lemma states that F k ( x ) F_k(x) F k ( x ) and F k ( y ) F_k(y) F k ( y ) satisfy condition (ii) in Definition III.1.
Lemma IV.7. If m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) , then F k ( x ) F_k(x) F k ( x ) and F k ( y ) F_k(y) F k ( y ) differ in either one coordinate or two consecutive coordinates.
Proof. First, it follows from Lemma IV.6 that F k ( x ) ≠ F k ( y ) F_k(x)\ne F_k(y) F k ( x ) = F k ( y ) .
If situation (i) in Lemma IV.3 holds, then by (28), there is some i ∈ [ m k ( x ^ ) ] i\in[m_k(\hat{x})] i ∈ [ m k ( x ^ )] such that F k ( x ) j = F k ( y ) j F_k(x)_j=F_k(y)_j F k ( x ) j = F k ( y ) j for all j ≠ i j\ne i j = i . Since F k ( x ) ≠ F k ( y ) F_k(x)\ne F_k(y) F k ( x ) = F k ( y ) , we conclude that F k ( x ) i ≠ F k ( y ) i F_k(x)_i\ne F_k(y)_i F k ( x ) i = F k ( y ) i .
Now suppose that situation (ii) in Lemma IV.3 holds. By Lemma IV.2 (ii), we can write A = ( x ^ i ( k ) , x ^ i + 1 ( k ) ) A=(\hat{x}^{(k)}_i,\hat{x}^{(k)}_{i+1}) A = ( x ^ i ( k ) , x ^ i + 1 ( k ) ) and A ′ = ( y ^ i ( k ) , y ^ i + 1 ( k ) ) A'=(\hat{y}^{(k)}_i,\hat{y}^{(k)}_{i+1}) A ′ = ( y ^ i ( k ) , y ^ i + 1 ( k ) ) for some 1 ≤ i < m k ( x ^ ) 1\le i<m_k(\hat{x}) 1 ≤ i < m k ( x ^ ) . Equations (28) and (33) give F k ( x ) j = F k ( y ) j F_k(x)_j=F_k(y)_j F k ( x ) j = F k ( y ) j for every j ∉ { i , i + 1 } j\notin\{i,i+1\} j ∈ / { i , i + 1 } . Since F k ( x ) ≠ F k ( y ) F_k(x)\ne F_k(y) F k ( x ) = F k ( y ) , at least one of the two equalities F k ( x ) i = F k ( y ) i F_k(x)_i=F_k(y)_i F k ( x ) i = F k ( y ) i and F k ( x ) i + 1 = F k ( y ) i + 1 F_k(x)_{i+1}=F_k(y)_{i+1} F k ( x ) i + 1 = F k ( y ) i + 1 must fail. Now the proof is completed.
Finally, we verify condition (iii) in Definition III.1.
Lemma IV.8. It holds that ∣ wt L 1 ( F k ( x ) ) − wt L 1 ( F k ( y ) ) ∣ < F k ( y ) i \left|\operatorname{wt}_{L_1}(F_k(x))-\operatorname{wt}_{L_1}(F_k(y))\right|<F_k(y)_i ∣ wt L 1 ( F k ( x )) − wt L 1 ( F k ( y )) ∣ < F k ( y ) i for all 1 ≤ i ≤ m k ( y ^ ) 1\le i\le m_k(\hat{y}) 1 ≤ i ≤ m k ( y ^ ) .
Proof. It follows from (27) and (28) that F k ( y ) i = f k ( y ^ i ( k ) ) ≥ C k ∣ y ^ i ( k ) ∣ ≥ 2 k C k F_k(y)_i=f_k\left(\hat{y}^{(k)}_i\right)\ge C_k\left|\hat{y}^{(k)}_i\right|\ge2kC_k F k ( y ) i = f k ( y ^ i ( k ) ) ≥ C k y ^ i ( k ) ≥ 2 k C k for every i i i . On the other hand, (34) gives ∣ wt L 1 ( F k ( x ) ) − wt L 1 ( F k ( y ) ) ∣ ≤ C k ( k + 1 ) − 1 < 2 k C k ≤ F k ( y ) i \left|\operatorname{wt}_{L_1}(F_k(x))-\operatorname{wt}_{L_1}(F_k(y))\right|\le C_k(k+1)-1<2kC_k\le F_k(y)_i ∣ wt L 1 ( F k ( x )) − wt L 1 ( F k ( y )) ∣ ≤ C k ( k + 1 ) − 1 < 2 k C k ≤ F k ( y ) i , completing the proof. ■
Combining Lemmas IV.6 to IV.8 yields the following main result of this subsection.
Corollary IV.1. Let x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n and y y y be obtained from x x x by one nontrivial k k k -substring edit. Then F k ( y ) F_k(y) F k ( y ) is obtained from F k ( x ) F_k(x) F k ( x ) by a strongly locatable 3 3 3 -substring edit.
The Localization Syndrome
Throughout this subsection, it is assumed that x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n and y y y is obtained from x x x by a (not necessarily nontrivial) k k k -substring edit. Write x x x and y y y as in (2). Then x ^ \hat{x} x ^ and y ^ \hat{y} y ^ have the forms in (20). Define
d : = ∣ F k ( y ) ∣ − ∣ F k ( x ) ∣ = m k ( y ) − m k ( x ) , E : = wt L 1 ( F k ( x ) ) − wt L 1 ( F k ( y ) ) , Δ V T : = VT ( F k ( x ) ) − VT ( F k ( y ) ) , Δ G r : = G r ( F k ( x ) ) − G r ( F k ( y ) ) , r ∈ { 0 , 1 } , (43) \begin{aligned}
d&:=|F_k(y)|-|F_k(x)|=m_k(y)-m_k(x),\\
E&:=\operatorname{wt}_{L_1}(F_k(x))-\operatorname{wt}_{L_1}(F_k(y)),\\
\Delta_{\mathrm{VT}}&:=\operatorname{VT}(F_k(x))-\operatorname{VT}(F_k(y)),\\
\Delta_{G_r}&:=G_r(F_k(x))-G_r(F_k(y)),\quad r\in\{0,1\}, \tag*{(43)}
\end{aligned} d E Δ VT Δ G r := ∣ F k ( y ) ∣ − ∣ F k ( x ) ∣ = m k ( y ) − m k ( x ) , := wt L 1 ( F k ( x )) − wt L 1 ( F k ( y )) , := VT ( F k ( x )) − VT ( F k ( y )) , := G r ( F k ( x )) − G r ( F k ( y )) , r ∈ { 0 , 1 } , (43)
where the functions G 0 G_0 G 0 and G 1 G_1 G 1 are defined in (11).
With the results in Lemma IV.2 and Corollary IV.1, to apply Theorem III.1, it remains to determine the values of d d d , E E E , Δ V T \Delta_{\mathrm{VT}} Δ VT , Δ G 0 \Delta_{G_0} Δ G 0 and Δ G 1 \Delta_{G_1} Δ G 1 . The information needed to determine these values is specified in Lemmas IV.9 and IV.10 below. It is important to notice that the values of m k ( y ) m_k(y) m k ( y ) , wt L 1 ( F k ( y ) ) \operatorname{wt}_{L_1}(F_k(y)) wt L 1 ( F k ( y )) , VT ( F k ( y ) ) \operatorname{VT}(F_k(y)) VT ( F k ( y )) , G 0 ( F k ( y ) ) G_0(F_k(y)) G 0 ( F k ( y )) , G 1 ( F k ( y ) ) G_1(F_k(y)) G 1 ( F k ( y )) can be immediately computed once y y y is given.
Recall Q Q Q , B B B , C k C_k C k from (25)–(26), and A n , k A_{n,k} A n , k from (35). Set
R k = 2 C k ( k + 1 ) − 1 , M n , k ≜ 18 ( S n , k + A n , k ) , (44) R_k=2C_k(k+1)-1,\quad M_{n,k}\triangleq18(S_{n,k}+A_{n,k}), \tag*{(44)} R k = 2 C k ( k + 1 ) − 1 , M n , k ≜ 18 ( S n , k + A n , k ) , (44)
where S n , k = ( Q − 1 ) ( ⌊ n / ( 2 k ) ⌋ + 2 ) + B ( n + 2 ) + C k ( n + 4 k ) S_{n,k}=(Q-1)(\lfloor n/(2k)\rfloor+2)+B(n+2)+C_k(n+4k) S n , k = ( Q − 1 ) (⌊ n / ( 2 k )⌋ + 2 ) + B ( n + 2 ) + C k ( n + 4 k ) .
Recall that D q , k ( n ) D_{q,k}(n) D q , k ( n ) is the set of all ( p k , n , k ) (p_{k,n,k}) ( p k , n , k ) -dense sequences in Σ q n \Sigma_q^n Σ q n .
Lemma IV.9. Suppose x ∈ D q , k ( n ) x \in D_{q,k}(n) x ∈ D q , k ( n ) . Given y y y and the three residues
m k ( x ) m o d 5 , wt L 1 ( F k ( x ) ) m o d R k , VT ( F k ( x ) ) m o d M n , k , m_k(x) \bmod5,\qquad\operatorname{wt}_{L_1}(F_k(x)) \bmod R_k,\qquad\operatorname{VT}(F_k(x)) \bmod M_{n,k}, m k ( x ) mod 5 , wt L 1 ( F k ( x )) mod R k , VT ( F k ( x )) mod M n , k , one can determine d d d , E E E , and Δ V T \Delta_{\mathrm{VT}} Δ VT uniquely.
Proof. By Lemma IV.2 (iii), ∣ d ∣ ≤ 2 |d| \le2 ∣ d ∣ ≤ 2 . Now the congruence m k ( x ) ( m o d 5 ) m_k(x) \pmod5 m k ( x ) ( mod 5 ) determines d d d uniquely because m k ( y ) m_k(y) m k ( y ) is known. (34) gives
∣ E ∣ ≤ C k ( k + 1 ) − 1 = R k − 1 2 . |E| \le C_k(k+1)-1 = \frac{R_k-1}{2}. ∣ E ∣ ≤ C k ( k + 1 ) − 1 = 2 R k − 1 . Thus knowing wt L 1 ( F k ( x ) ) ( m o d R k ) \operatorname{wt}_{L_1}(F_k(x)) \pmod{R_k} wt L 1 ( F k ( x )) ( mod R k ) is sufficient to obtain the value of E E E .
By Lemma IV.2 (ii), the sequence F k ( y ) F_k(y) F k ( y ) is obtained from F k ( x ) F_k(x) F k ( x ) by a 3-substring edit. Moreover, Lemma IV.2 (vi) says that both F k ( x ) F_k(x) F k ( x ) and F k ( y ) F_k(y) F k ( y ) are A n , k A_{n,k} A n , k bounded. Then it follows from Lemma III.3 that ∣ Δ V T ∣ < 9 ( wt L 1 ( F k ( x ) ) + A n , k ) |\Delta_{\mathrm{VT}}| < 9(\operatorname{wt}_{L_1}(F_k(x)) + A_{n,k}) ∣ Δ VT ∣ < 9 ( wt L 1 ( F k ( x )) + A n , k ) . This implies that knowing VT ( F k ( x ) ) ( m o d 18 ( wt L 1 ( F k ( x ) ) + A n , k ) ) \operatorname{VT}(F_k(x)) \pmod{18(\operatorname{wt}_{L_1}(F_k(x)) + A_{n,k})} VT ( F k ( x )) ( mod 18 ( wt L 1 ( F k ( x )) + A n , k )) is sufficient to obtain the value of Δ V T \Delta_{\mathrm{VT}} Δ VT .
It remains to prove wt L 1 ( F k ( x ) ) ≤ S n , k \operatorname{wt}_{L_1}(F_k(x)) \le S_{n,k} wt L 1 ( F k ( x )) ≤ S n , k . Since every segment has length at least 2 k 2k 2 k and ∣ x ^ ∣ = ∣ x ∣ + 4 k = n + 4 k |\hat{x}| = |x| + 4k = n + 4k ∣ x ^ ∣ = ∣ x ∣ + 4 k = n + 4 k , we have m k ( x ^ ) ≤ ⌊ ( n + 4 k ) / ( 2 k ) ⌋ m_k(\hat{x}) \le\lfloor(n+4k)/(2k)\rfloor m k ( x ^ ) ≤ ⌊( n + 4 k ) / ( 2 k )⌋ . Moreover, it holds that N k ( x ^ ) = 1 + N k ( p k x ) ≤ n + 2 N_k(\hat{x}) = 1 + N_k(p_kx) \le n+2 N k ( x ^ ) = 1 + N k ( p k x ) ≤ n + 2 . Then it follows from (27), (28) and (38) that
wt L 1 ( F k ( x ) ) = ∑ i = 1 m k ( x ^ ) D q ( x ^ i ( k ) ) + B ∑ i = 1 m k ( x ^ ) N k ( x ^ i ( k ) ) + C k ∣ x ^ ∣ ≤ m k ( x ^ ) ( Q − 1 ) + B ∑ i = 1 m k ( x ^ ) N k ( x ^ i ( k ) ) + C k ( n + 4 k ) = m k ( x ^ ) ( Q − 1 ) + B N k ( x ^ ) + C k ( n + 4 k ) ≤ ( ⌊ n 2 k ⌋ + 2 ) ( Q − 1 ) + B ( n + 2 ) + C k ( n + 4 k ) = S n , k . \begin{aligned}
\operatorname{wt}_{L_1}(F_k(x)) & = \sum_{i=1}^{m_k(\hat{x})} D_q\left(\hat{x}^{(k)}_i\right) + B\sum_{i=1}^{m_k(\hat{x})} N_k\left(\hat{x}^{(k)}_i\right) + C_k|\hat{x}| \\
& \le m_k(\hat{x})(Q-1) + B\sum_{i=1}^{m_k(\hat{x})} N_k\left(\hat{x}^{(k)}_i\right) + C_k(n+4k) \\
& = m_k(\hat{x})(Q-1) + BN_k(\hat{x}) + C_k(n+4k) \\
& \le\left(\left\lfloor\frac{n}{2k}\right\rfloor+ 2\right)(Q-1) + B(n+2) + C_k(n+4k) \\
& = S_{n,k}.
\end{aligned} wt L 1 ( F k ( x )) = i = 1 ∑ m k ( x ^ ) D q ( x ^ i ( k ) ) + B i = 1 ∑ m k ( x ^ ) N k ( x ^ i ( k ) ) + C k ∣ x ^ ∣ ≤ m k ( x ^ ) ( Q − 1 ) + B i = 1 ∑ m k ( x ^ ) N k ( x ^ i ( k ) ) + C k ( n + 4 k ) = m k ( x ^ ) ( Q − 1 ) + B N k ( x ^ ) + C k ( n + 4 k ) ≤ ( ⌊ 2 k n ⌋ + 2 ) ( Q − 1 ) + B ( n + 2 ) + C k ( n + 4 k ) = S n , k . Now the proof is completed. ■
Lemma IV.10. If m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) , then ∣ F k ( x ) i − F k ( y ) i ∣ ≤ Λ q , k |F_k(x)_i-F_k(y)_i| \le\Lambda_{q,k} ∣ F k ( x ) i − F k ( y ) i ∣ ≤ Λ q , k for every i ∈ [ m k ( x ^ ) ] i \in[m_k(\hat{x})] i ∈ [ m k ( x ^ )] , where
Λ q , k = ( Q − 1 ) + B ( 4 k − 2 ) + C k ( 3 k − 2 ) . (45) \Lambda_{q,k}=(Q-1)+B(4k-2)+C_k(3k-2). \tag*{(45)} Λ q , k = ( Q − 1 ) + B ( 4 k − 2 ) + C k ( 3 k − 2 ) . (45) Consequently, for r ∈ { 0 , 1 } r \in\{0,1\} r ∈ { 0 , 1 } , the sequence y y y and the residue G r ( F k ( x ) ) m o d ( 2 Λ q , k + 1 ) G_r(F_k(x)) \bmod(2\Lambda_{q,k}+1) G r ( F k ( x )) mod ( 2 Λ q , k + 1 ) determine Δ G r \Delta_{G_r} Δ G r uniquely.
Proof: If x = y x=y x = y , every claimed difference is zero. Assume henceforth that the edit is nontrivial. Recall the definition of D e s ( x ^ ) D_{\mathrm{es}}(\hat{x}) D es ( x ^ ) and C r e ( y ^ ) C_{\mathrm{re}}(\hat{y}) C re ( y ^ ) from Definition IV.1. Denote r = ∣ D e s ( x ^ ) ∣ r=|D_{\mathrm{es}}(\hat{x})| r = ∣ D es ( x ^ ) ∣ and r ′ = ∣ C r e ( y ^ ) ∣ r'=|C_{\mathrm{re}}(\hat{y})| r ′ = ∣ C re ( y ^ ) ∣ . The equality m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) and Lemma IV.3 leave two cases: r = r ′ = 0 r=r'=0 r = r ′ = 0 or r = r ′ = 1 r=r'=1 r = r ′ = 1 .
Suppose r = r ′ = 0 r=r'=0 r = r ′ = 0 . In this case, there is some j ∈ [ m k ( x ^ ) ] j \in[m_k(\hat{x})] j ∈ [ m k ( x ^ )] , such that x ^ i ( k ) = y ^ i ( k ) \hat{x}^{(k)}_i=\hat{y}^{(k)}_i x ^ i ( k ) = y ^ i ( k ) if and only if i ≠ j i\ne j i = j , implying ∣ F k ( x ) i − F k ( y ) i ∣ = 0 |F_k(x)_i-F_k(y)_i|=0 ∣ F k ( x ) i − F k ( y ) i ∣ = 0 for every i ≠ j i\ne j i = j . Let x ^ [ i 1 , i 2 ] \hat{x}_{[i_1,i_2]} x ^ [ i 1 , i 2 ] be an occurrence of 1 k 1^k 1 k in x ^ j ( k ) \hat{x}^{(k)}_j x ^ j ( k ) . This 1 k 1^k 1 k can be destroyed by the k k k -substring edit around it if [ i 1 , i 2 ] [i_1,i_2] [ i 1 , i 2 ] intersects on the case ∣ s ∣ > 0 |s|>0 ∣ s ∣ > 0 or crosses (in the case s = ϵ s=\epsilon s = ϵ ) the edit region in x ^ \hat{x} x ^ . Therefore, there are at most ∣ s ∣ + k − 1 |s|+k-1 ∣ s ∣ + k − 1 occurrences of 1 k 1^k 1 k in x ^ \hat{x} x ^ that can be destroyed. Similarly, there are at most ∣ t ∣ + k − 1 |t|+k-1 ∣ t ∣ + k − 1 occurrences of 1 k 1^k 1 k in y ^ \hat{y} y ^ that can be newly created. Then it follows that ∣ N k ( x ^ j ( k ) ) − N k ( y ^ j ( k ) ) ∣ ≤ max { ∣ s ∣ , ∣ t ∣ } + k − 1 ≤ 2 k − 1 \left|N_k\left(\hat{x}^{(k)}_j\right)-N_k\left(\hat{y}^{(k)}_j\right)\right| \le\max\{|s|,|t|\}+k-1 \le2k-1 N k ( x ^ j ( k ) ) − N k ( y ^ j ( k ) ) ≤ max { ∣ s ∣ , ∣ t ∣ } + k − 1 ≤ 2 k − 1 . Now combining (27) and (28) gives
∣ F k ( x ) j − F k ( y ) j ∣ ≤ ∣ D q ( x ^ j ( k ) ) − D q ( y ^ j ( k ) ) ∣ + B ∣ N k ( x ^ j ( k ) ) − N k ( y ^ j ( k ) ) ∣ + C k ∣ ∣ x ^ j ( k ) ∣ − ∣ y ^ j ( k ) ∣ ∣ ≤ Q − 1 + B ( 2 k − 1 ) + C k < Λ q , k . \begin{aligned}
|F_k(x)_j-F_k(y)_j| & \le\left|D_q\left(\hat{x}^{(k)}_j\right)-D_q\left(\hat{y}^{(k)}_j\right)\right| + B\left|N_k\left(\hat{x}^{(k)}_j\right)-N_k\left(\hat{y}^{(k)}_j\right)\right| + C_k\left||\hat{x}^{(k)}_j|-|\hat{y}^{(k)}_j|\right| \\
& \le Q-1+B(2k-1)+C_k<\Lambda_{q,k}.
\end{aligned} ∣ F k ( x ) j − F k ( y ) j ∣ ≤ D q ( x ^ j ( k ) ) − D q ( y ^ j ( k ) ) + B N k ( x ^ j ( k ) ) − N k ( y ^ j ( k ) ) + C k ∣ x ^ j ( k ) ∣ − ∣ y ^ j ( k ) ∣ ≤ Q − 1 + B ( 2 k − 1 ) + C k < Λ q , k . Now suppose r = r ′ = 1 r=r'=1 r = r ′ = 1 . Write D e s ( x ^ ) = { a } D_{\mathrm{es}}(\hat{x})=\{a\} D es ( x ^ ) = { a } and C r e ( y ^ ) = { b } C_{\mathrm{re}}(\hat{y})=\{b\} C re ( y ^ ) = { b } . Let α \alpha α and β \beta β be defined as in the proof of Lemma IV.2 (ii). Set d = ∣ t ∣ − ∣ s ∣ d=|t|-|s| d = ∣ t ∣ − ∣ s ∣ . The proof of Lemma IV.2 (ii) shows that s s s is contained in the substring x ^ [ α , a − 1 ] x ^ [ a , β − 1 ] \hat{x}_{[\alpha,a-1]}\hat{x}_{[a,\beta-1]} x ^ [ α , a − 1 ] x ^ [ a , β − 1 ] and t t t is contained in the substring y ^ [ α , b − 1 ] y ^ [ b , β + d − 1 ] \hat{y}_{[\alpha,b-1]}\hat{y}_{[b,\beta+d-1]} y ^ [ α , b − 1 ] y ^ [ b , β + d − 1 ] . Suppose that x ^ [ α , a − 1 ] \hat{x}_{[\alpha,a-1]} x ^ [ α , a − 1 ] is the j j j -th segment of x ^ \hat{x} x ^ . Lemma IV.2 (ii) claims that y ^ [ α , b − 1 ] \hat{y}_{[\alpha,b-1]} y ^ [ α , b − 1 ] is the j j j -th segment of y ^ \hat{y} y ^ . Then it holds that x ^ i ( k ) = y ^ i ( k ) \hat{x}^{(k)}_i=\hat{y}^{(k)}_i x ^ i ( k ) = y ^ i ( k ) whenever i ∉ { j , j + 1 } i\notin\{j,j+1\} i ∈ / { j , j + 1 } , yielding ∣ F k ( x ) i − F k ( y ) i ∣ = 0 |F_k(x)_i-F_k(y)_i|=0 ∣ F k ( x ) i − F k ( y ) i ∣ = 0 for every i ∉ { j , j + 1 } i\notin\{j,j+1\} i ∈ / { j , j + 1 } .
To bound ∣ F k ( x ) j − F k ( y ) j ∣ |F_k(x)_j-F_k(y)_j| ∣ F k ( x ) j − F k ( y ) j ∣ and ∣ F k ( x ) j + 1 − F k ( y ) j + 1 ∣ |F_k(x)_{j+1}-F_k(y)_{j+1}| ∣ F k ( x ) j + 1 − F k ( y ) j + 1 ∣ , we need to bound the four quantities: ∣ ∣ x ^ [ α , a − 1 ] ∣ − ∣ y ^ [ α , b − 1 ] ∣ ∣ \left||\hat{x}_{[\alpha,a-1]}|-|\hat{y}_{[\alpha,b-1]}|\right| ∣ x ^ [ α , a − 1 ] ∣ − ∣ y ^ [ α , b − 1 ] ∣ , ∣ ∣ x ^ [ α , β − 1 ] ∣ − ∣ y ^ [ β , β + d − 1 ] ∣ ∣ \left||\hat{x}_{[\alpha,\beta-1]}|-|\hat{y}_{[\beta,\beta+d-1]}|\right| ∣ x ^ [ α , β − 1 ] ∣ − ∣ y ^ [ β , β + d − 1 ] ∣ , ∣ N k ( x ^ [ α , a − 1 ] ) − N k ( y ^ [ α , b − 1 ] ) ∣ \left|N_k\left(\hat{x}_{[\alpha,a-1]}\right)-N_k\left(\hat{y}_{[\alpha,b-1]}\right)\right| N k ( x ^ [ α , a − 1 ] ) − N k ( y ^ [ α , b − 1 ] ) and ∣ N k ( x ^ [ α , β − 1 ] ) − N k ( y ^ [ β , β + d − 1 ] ) ∣ \left|N_k\left(\hat{x}_{[\alpha,\beta-1]}\right)-N_k\left(\hat{y}_{[\beta,\beta+d-1]}\right)\right| N k ( x ^ [ α , β − 1 ] ) − N k ( y ^ [ β , β + d − 1 ] ) . We first bound ∣ ∣ x ^ [ α , a − 1 ] ∣ − ∣ y ^ [ α , b − 1 ] ∣ ∣ \left||\hat{x}_{[\alpha,a-1]}|-|\hat{y}_{[\alpha,b-1]}|\right| ∣ x ^ [ α , a − 1 ] ∣ − ∣ y ^ [ α , b − 1 ] ∣ and ∣ ∣ x ^ [ α , β − 1 ] ∣ − ∣ y ^ [ β , β + d − 1 ] ∣ ∣ \left||\hat{x}_{[\alpha,\beta-1]}|-|\hat{y}_{[\beta,\beta+d-1]}|\right| ∣ x ^ [ α , β − 1 ] ∣ − ∣ y ^ [ β , β + d − 1 ] ∣ . To that end, let ρ = ∣ p k u ∣ \rho=|p_k u| ρ = ∣ p k u ∣ (see (20)). The definition of D e s ( x ^ ) D_{\mathrm{es}}(\hat{x}) D es ( x ^ ) and C r e ( y ^ ) C_{\mathrm{re}}(\hat{y}) C re ( y ^ ) gives ρ − 2 k + 2 ≤ a ≤ ρ + ∣ s ∣ \rho-2k+2\le a\le\rho+|s| ρ − 2 k + 2 ≤ a ≤ ρ + ∣ s ∣ and ρ − 2 k + 2 ≤ b ≤ ρ + ∣ t ∣ \rho-2k+2\le b\le\rho+|t| ρ − 2 k + 2 ≤ b ≤ ρ + ∣ t ∣ , respectively. In other words,
a − ∣ s ∣ , b − ∣ t ∣ ∈ [ ρ − 3 k + 2 , ρ ] . (46) a-|s|,b-|t| \in[\rho-3k+2,\rho]. \tag*{(46)} a − ∣ s ∣ , b − ∣ t ∣ ∈ [ ρ − 3 k + 2 , ρ ] . (46)
It is easy to see that
∥ x ^ [ α , α − 1 ] ∥ − ∥ y ^ [ α , b − 1 ] ∥ = ∣ a − b ∣ ≤ 3 k − 2. (47) \left\lVert\hat{x}_{[\alpha,\alpha-1]} \right\rVert-\left\lVert\hat{y}_{[\alpha,b-1]} \right\rVert=|a-b|\le3k-2. \tag*{(47)} x ^ [ α , α − 1 ] − y ^ [ α , b − 1 ] = ∣ a − b ∣ ≤ 3 k − 2. (47)
For the second quantity, notice that
∥ x ^ [ α , β − 1 ] ∥ − ∥ y ^ [ b , β + d − 1 ] ∥ = ∣ ( β + d − b ) − ( β − a ) ∣ = ∣ a + d − b ∣ = ∣ a − ∣ s ∣ − ( b − ∣ t ∣ ) ∣ ≤ 3 k − 2 , (48) \left\lVert\hat{x}_{[\alpha,\beta-1]} \right\rVert-\left\lVert\hat{y}_{[b,\beta+d-1]} \right\rVert=|(\beta+d-b)-(\beta-a)|=|a+d-b|=|a-|s|-(b-|t|)|\le3k-2, \tag*{(48)} x ^ [ α , β − 1 ] − y ^ [ b , β + d − 1 ] = ∣ ( β + d − b ) − ( β − a ) ∣ = ∣ a + d − b ∣ = ∣ a − ∣ s ∣ − ( b − ∣ t ∣ ) ∣ ≤ 3 k − 2 , (48)
where the last inequality follows from (46).
Next, we bound ∣ N k ( x ^ [ α , α − 1 ] ) − N k ( y ^ [ α , b − 1 ] ) ∣ \left|N_k\left(\hat{x}_{[\alpha,\alpha-1]}\right)-N_k\left(\hat{y}_{[\alpha,b-1]}\right)\right| N k ( x ^ [ α , α − 1 ] ) − N k ( y ^ [ α , b − 1 ] ) and ∣ N k ( x ^ [ α , β − 1 ] ) − N k ( y ^ [ b , β + d − 1 ] ) ∣ \left|N_k\left(\hat{x}_{[\alpha,\beta-1]}\right)-N_k\left(\hat{y}_{[b,\beta+d-1]}\right)\right| N k ( x ^ [ α , β − 1 ] ) − N k ( y ^ [ b , β + d − 1 ] ) . Set λ = min { a , b , ρ + 1 } \lambda=\min\{a,b,\rho+1\} λ = min { a , b , ρ + 1 } . By (20), the two segments x ^ [ α , α − 1 ] \hat{x}_{[\alpha,\alpha-1]} x ^ [ α , α − 1 ] and y ^ [ α , b − 1 ] \hat{y}_{[\alpha,b-1]} y ^ [ α , b − 1 ] have the common prefix x ^ [ α , λ − 1 ] = y ^ [ α , λ − 1 ] \hat{x}_{[\alpha,\lambda-1]}=\hat{y}_{[\alpha,\lambda-1]} x ^ [ α , λ − 1 ] = y ^ [ α , λ − 1 ] . After this prefix is removed, their respective lengths are a − λ a-\lambda a − λ and b − λ b-\lambda b − λ . By the choice of λ \lambda λ , we have
0 ≤ a − λ ≤ max { ∣ a − b ∣ , a − ( ρ + 1 ) , 0 } ≤ 3 k − 2 , 0 ≤ b − λ ≤ max { ∣ a − b ∣ , b − ( ρ + 1 ) , 0 } ≤ 3 k − 2. \begin{aligned}
0\le a-\lambda&\le\max\{|a-b|,a-(\rho+1),0\}\le3k-2,\\
0\le b-\lambda&\le\max\{|a-b|,b-(\rho+1),0\}\le3k-2.
\end{aligned} 0 ≤ a − λ 0 ≤ b − λ ≤ max { ∣ a − b ∣ , a − ( ρ + 1 ) , 0 } ≤ 3 k − 2 , ≤ max { ∣ a − b ∣ , b − ( ρ + 1 ) , 0 } ≤ 3 k − 2.
where the last inequalities follow from (46) and the fact ∣ s ∣ , ∣ t ∣ ≤ k |s|,|t|\le k ∣ s ∣ , ∣ t ∣ ≤ k . An occurrence of 1 k 1^k 1 k in x ^ [ α , α − 1 ] \hat{x}_{[\alpha,\alpha-1]} x ^ [ α , α − 1 ] can be destroyed by the k k k -substring edit only if it overlaps with x ^ [ λ , α − 1 ] \hat{x}_{[\lambda,\alpha-1]} x ^ [ λ , α − 1 ] , and an occurrence of 1 k 1^k 1 k in y ^ [ α , b − 1 ] \hat{y}_{[\alpha,b-1]} y ^ [ α , b − 1 ] is created by the k k k -substring edit only if it overlaps with y ^ [ λ , b − 1 ] \hat{y}_{[\lambda,b-1]} y ^ [ λ , b − 1 ] . Thus, it holds that
∣ N k ( x ^ [ α , α − 1 ] ) − N k ( y ^ [ α , b − 1 ] ) ∣ ≤ max { a − λ , b − λ } + k − 1 < 4 k − 2. (49) \left|N_k\left(\hat{x}_{[\alpha,\alpha-1]}\right)-N_k\left(\hat{y}_{[\alpha,b-1]}\right)\right|\le\max\{a-\lambda,b-\lambda\}+k-1<4k-2. \tag*{(49)} N k ( x ^ [ α , α − 1 ] ) − N k ( y ^ [ α , b − 1 ] ) ≤ max { a − λ , b − λ } + k − 1 < 4 k − 2. (49)
The two segments x ^ [ α , β − 1 ] \hat{x}_{[\alpha,\beta-1]} x ^ [ α , β − 1 ] and y ^ [ b , β + d − 1 ] \hat{y}_{[b,\beta+d-1]} y ^ [ b , β + d − 1 ] have the common suffix x ^ [ ρ + ∣ s ∣ + 1 , β − 1 ] = y ^ [ ρ + ∣ t ∣ + 1 , β + d − 1 ] \hat{x}_{[\rho+|s|+1,\beta-1]}=\hat{y}_{[\rho+|t|+1,\beta+d-1]} x ^ [ ρ + ∣ s ∣ + 1 , β − 1 ] = y ^ [ ρ + ∣ t ∣ + 1 , β + d − 1 ] . After this suffix is removed, their respective lengths are ρ + ∣ s ∣ − a + 1 \rho+|s|-a+1 ρ + ∣ s ∣ − a + 1 and ρ + ∣ t ∣ − b + 1 \rho+|t|-b+1 ρ + ∣ t ∣ − b + 1 . It follows from (46) that ρ + ∣ s ∣ − a + 1 , ρ + ∣ t ∣ − b + 1 ≤ 3 k − 1 \rho+|s|-a+1,\ \rho+|t|-b+1\le3k-1 ρ + ∣ s ∣ − a + 1 , ρ + ∣ t ∣ − b + 1 ≤ 3 k − 1 . Then by the same argument in the previous paragraph, we have
∣ N k ( x ^ [ α , β − 1 ] ) − N k ( y ^ [ b , β + d − 1 ] ) ∣ ≤ 4 k − 2. (50) \left|N_k\left(\hat{x}_{[\alpha,\beta-1]}\right)-N_k\left(\hat{y}_{[b,\beta+d-1]}\right)\right|\le4k-2. \tag*{(50)} N k ( x ^ [ α , β − 1 ] ) − N k ( y ^ [ b , β + d − 1 ] ) ≤ 4 k − 2. (50)
Now combining (27), (28), (47) and (49) gives
∣ F k ( x ) j − F k ( y ) j ∣ ≤ ∣ D q ( x ^ j ( k ) ) − D q ( y ^ j ( k ) ) ∣ + B ∣ N k ( x ^ j ( k ) ) − N k ( y ^ j ( k ) ) ∣ + C k ∥ x ^ j ( k ) − y ^ j ( k ) ∥ ≤ Q − 1 + B ( 4 k − 2 ) + C k ( 3 k − 2 ) = Λ q , k . \begin{aligned}
|F_k(x)_j-F_k(y)_j|&\le\left|D_q\left(\hat{x}^{(k)}_j\right)-D_q\left(\hat{y}^{(k)}_j\right)\right|+B\left|N_k\left(\hat{x}^{(k)}_j\right)-N_k\left(\hat{y}^{(k)}_j\right)\right|+C_k\left\lVert\hat{x}^{(k)}_j-\hat{y}^{(k)}_j\right\rVert\\
&\le Q-1+B(4k-2)+C_k(3k-2)=\Lambda_{q,k}.
\end{aligned} ∣ F k ( x ) j − F k ( y ) j ∣ ≤ D q ( x ^ j ( k ) ) − D q ( y ^ j ( k ) ) + B N k ( x ^ j ( k ) ) − N k ( y ^ j ( k ) ) + C k x ^ j ( k ) − y ^ j ( k ) ≤ Q − 1 + B ( 4 k − 2 ) + C k ( 3 k − 2 ) = Λ q , k .
Similarly, the bound ∣ F k ( x ) j + 1 − F k ( y ) j + 1 ∣ ≤ Λ q , k |F_k(x)_{j+1}-F_k(y)_{j+1}|\le\Lambda_{q,k} ∣ F k ( x ) j + 1 − F k ( y ) j + 1 ∣ ≤ Λ q , k follows from (27), (28), (48) and (50).
The preceding argument shows that ∣ G r ( F k ( x ) ) − G r ( F k ( y ) ) ∣ ≤ Λ q , k \left|G_r(F_k(x))-G_r(F_k(y))\right|\le\Lambda_{q,k} ∣ G r ( F k ( x )) − G r ( F k ( y )) ∣ ≤ Λ q , k for r ∈ { 0 , 1 } r\in\{0,1\} r ∈ { 0 , 1 } . Then given x x x and the residue G r ( F k ( x ) ) G_r(F_k(x)) G r ( F k ( x )) mod 2 Λ q , k + 1 2\Lambda_{q,k}+1 2 Λ q , k + 1 , one can compute the residue ( G r ( F k ( x ) ) − G r ( F k ( y ) ) ) \left(G_r(F_k(x))-G_r(F_k(y))\right) ( G r ( F k ( x )) − G r ( F k ( y )) ) mod 2 Λ q , k + 1 2\Lambda_{q,k}+1 2 Λ q , k + 1 and then obtain the exact value of G r ( F k ( x ) ) − G r ( F k ( y ) ) G_r(F_k(x))-G_r(F_k(y)) G r ( F k ( x )) − G r ( F k ( y )) . This completes the proof. ■
Recall R k R_k R k , M n , k M_{n,k} M n , k from (44) and Λ q , k \Lambda_{q,k} Λ q , k from (45). Define the syndrome
Loc e d i t ( x ) = ( m k ( x ) mod 5 , VT ( F k ( x ) ) mod M n , k , wt L 1 ( F k ( x ) ) mod R k , G 0 ( F k ( x ) ) mod 2 Λ q , k + 1 , G 1 ( F k ( x ) ) mod 2 Λ q , k + 1 ) . (51) \operatorname{Loc}_{\mathrm{edit}}(x)=\left(m_k(x)\mathbin{\operatorname{mod}}5,\ \operatorname{VT}(F_k(x))\mathbin{\operatorname{mod}}M_{n,k},\ \operatorname{wt}_{L_1}(F_k(x))\mathbin{\operatorname{mod}}R_k,\ G_0(F_k(x))\mathbin{\operatorname{mod}}2\Lambda_{q,k}+1,\ G_1(F_k(x))\mathbin{\operatorname{mod}}2\Lambda_{q,k}+1\right). \tag*{(51)} Loc edit ( x ) = ( m k ( x ) mod 5 , VT ( F k ( x )) mod M n , k , wt L 1 ( F k ( x )) mod R k , G 0 ( F k ( x )) mod 2 Λ q , k + 1 , G 1 ( F k ( x )) mod 2 Λ q , k + 1 ) . (51)
The main result of this subsection is presented below.
Theorem IV.1. Let n ≥ ℓ n , k n\ge\ell_{n,k} n ≥ ℓ n , k be a sufficiently large integer, where ℓ n , k \ell_{n,k} ℓ n , k is given in (32). Suppose x ∈ D q , k ( n ) x\in D_{q,k}(n) x ∈ D q , k ( n ) and x → k y x\to_k y x → k y . From y y y and Loc e d i t ( x ) \operatorname{Loc}_{\mathrm{edit}}(x) Loc edit ( x ) , one can first determine whether y = x y=x y = x . If y ≠ x y\ne x y = x , one can compute an interval in [ n ] [n] [ n ] covering the edit region in x x x . The interval has length at most
W n , k = max { 15 ℓ n , k + 5 k , ⌈ 36 A n , k C k − C k ( k + 1 ) − 1 2 k ⌉ + 3 ( 3 ℓ n , k + k ) } + 2 k (52) W_{n,k}=\max\left\{15\ell_{n,k}+5k,\left\lceil\frac{36A_{n,k}}{C_k-\frac{C_k(k+1)-1}{2k}}\right\rceil+3(3\ell_{n,k}+k)\right\}+2k \tag*{(52)} W n , k = max { 15 ℓ n , k + 5 k , ⌈ C k − 2 k C k ( k + 1 ) − 1 36 A n , k ⌉ + 3 ( 3 ℓ n , k + k ) } + 2 k (52) = O q , k ( ( log n ) ) , =O_{q,k}((\log n)), = O q , k (( log n )) , where C k C_k C k and A n , k A_{n,k} A n , k are defined in (26) and (35), respectively. Computing the interval I I I from y y y and Loc e d i t ( x ) \operatorname{Loc}_{\mathrm{edit}}(x) Loc edit ( x ) requires O q , k ( n ( log n ) 2 ) O_{q,k}(n(\log n)^2) O q , k ( n ( log n ) 2 ) bit operations.
Proof: Let d , E , Δ V T , Δ G 0 , Δ G 1 d,E,\Delta_{\mathrm{VT}},\Delta_{G_0},\Delta_{G_1} d , E , Δ VT , Δ G 0 , Δ G 1 be the differences in (43). Write ( s m , s V T , s w t , s 0 , s 1 ) = Loc e d i t ( x ) (s_m,s_{\mathrm{VT}},s_{\mathrm{wt}},s_0,s_1)=\operatorname{Loc}_{\mathrm{edit}}(x) ( s m , s VT , s wt , s 0 , s 1 ) = Loc edit ( x ) . We divide the process of deciding whether y = x y=x y = x and finding the claimed interval into the four steps below. The complexity of each step is analyzed.
Compute m k ( y ) m_k(y) m k ( y ) , F k ( y ) F_k(y) F k ( y ) , d d d , and E E E . Form y ^ = p k y p k \hat{y}=p_ky p_k y ^ = p k y p k , whose length is at most n + 5 k n+5k n + 5 k . Scan y ^ \hat{y} y ^ to find all occurrences of p k = 0 k 1 k p_k=0^k1^k p k = 0 k 1 k and record the pattern starts. These starts, together with the endpoints 1 and ∣ y ^ ∣ + 1 |\hat{y}|+1 ∣ y ^ ∣ + 1 , determine the segment boundaries needed to compute F k ( y ) F_k(y) F k ( y ) . During the same scan, initialize a counter at zero and increase it by one whenever an occurrence of p k p_k p k is entirely contained in y y y . At the end of the scan, this counter equals m k ( y ) m_k(y) m k ( y ) .
At each position, testing for an occurrence of p k p_k p k compares at most 2 k 2k 2 k symbols and hence costs O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations. Recording a pattern start or updating an occurrence counter of p k p_k p k costs O k ( log n ) O_k(\log n) O k ( log n ) bit operations because every pattern start and every value of the counter is an integer in [ 0 , n + 5 k ] [0,n+5k] [ 0 , n + 5 k ] . Since there are O k ( n ) O_k(n) O k ( n ) positions, this scan requires O q , k ( n log n ) O_{q,k}(n\log n) O q , k ( n log n ) bit operations.
Let w = F k ( y ) w=F_k(y) w = F k ( y ) and m = ∣ w ∣ m=|w| m = ∣ w ∣ . For each segment y ^ j ( k ) \hat{y}_j^{(k)} y ^ j ( k ) used in (28), write y ^ j ( k ) = v 1 ⋯ v ℓ j \hat{y}_j^{(k)}=v_1\cdots v_{\ell_j} y ^ j ( k ) = v 1 ⋯ v ℓ j . We compute the quantities defining w j w_j w j as follows. First, obtain the length ℓ j \ell_j ℓ j from the recorded segment boundaries by one subtraction. This requires O k ( log n ) O_k(\log n) O k ( log n ) bit operations, since these boundaries have O k ( log n ) O_k(\log n) O k ( log n ) bits.
Next, initialize a count at zero. Scan y ^ j ( k ) \hat{y}_j^{(k)} y ^ j ( k ) to find occurrences of 1 k 1^k 1 k . Whenever an occurrence is found, increase the count by one. At the end of the scan, the count equals N k ( y ^ j ( k ) ) N_k\left(\hat{y}_j^{(k)}\right) N k ( y ^ j ( k ) ) . At each position, testing for an occurrence of 1 k 1^k 1 k compares at most k k k symbols and costs O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations. The count is at most ℓ j ≤ n + 5 k \ell_j\le n+5k ℓ j ≤ n + 5 k , so increasing it by one costs O k ( log n ) O_k(\log n) O k ( log n ) bit operations. Thus computing N k ( y ^ j ( k ) ) N_k\left(\hat{y}_j^{(k)}\right) N k ( y ^ j ( k ) ) requires O q , k ( ℓ j log n ) O_{q,k}(\ell_j\log n) O q , k ( ℓ j log n ) bit operations.
To compute the residues in (23), initialize k k k integers e 1 , … , e k e_1,\ldots,e_k e 1 , … , e k at zero. Read v 1 , … , v ℓ j v_1,\ldots,v_{\ell_j} v 1 , … , v ℓ j in order. When reading v i v_i v i , replace e a e_a e a by ( e a + v i ) m o d q (e_a+v_i)\bmod q ( e a + v i ) mod q , where a = 1 + ( ( i − 1 ) m o d k ) a=1+((i-1)\bmod k) a = 1 + (( i − 1 ) mod k ) . The index a a a cycles through 1 , … , k 1,\ldots,k 1 , … , k . At the end of this scan, e a = d a ( y ^ j ( k ) ) e_a=d_a\left(\hat{y}_j^{(k)}\right) e a = d a ( y ^ j ( k ) ) for every a ∈ [ k ] a\in[k] a ∈ [ k ] . Each e a e_a e a remains in [ 0 , q − 1 ] [0,q-1] [ 0 , q − 1 ] . Since q q q and k k k are fixed, each update costs O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations. Consequently, all k k k residues are obtained using O q , k ( ℓ j ) O_{q,k}(\ell_j) O q , k ( ℓ j ) bit operations.
There are m = O k ( n ) m=O_k(n) m = O k ( n ) segments used in (28), and their total length is at most n + 5 k n+5k n + 5 k . Consequently, computing all the segment lengths, occurrence counts of 1 k 1^k 1 k , and residues requires
O q , k ( ( m + ∑ j = 1 m ℓ j ) log n ) = O q , k ( n log n ) O_{q,k}\left(\left(m+\sum_{j=1}^{m}\ell_j\right)\log n\right)=O_{q,k}(n\log n) O q , k ( ( m + j = 1 ∑ m ℓ j ) log n ) = O q , k ( n log n )
bit operations.
For each j j j , the computed residues determine
D q ( y ^ j ( k ) ) = ∑ a = 1 k e a q a − 1 . D_q\left(\hat{y}_j^{(k)}\right)=\sum_{a=1}^{k}e_aq^{a-1}. D q ( y ^ j ( k ) ) = a = 1 ∑ k e a q a − 1 .
Since q q q and k k k are fixed, this calculation costs O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations. We then compute w j = D q ( y ^ j ( k ) ) + B N k ( y ^ j ( k ) ) + C k ℓ j w_j=D_q\left(\hat{y}_j^{(k)}\right)+BN_k\left(\hat{y}_j^{(k)}\right)+C_k\ell_j w j = D q ( y ^ j ( k ) ) + B N k ( y ^ j ( k ) ) + C k ℓ j . The integers N k ( y ^ j ( k ) ) N_k\left(\hat{y}_j^{(k)}\right) N k ( y ^ j ( k ) ) and ℓ j \ell_j ℓ j have O k ( log n ) O_k(\log n) O k ( log n ) bits. Then computing w j w_j w j from these quantities costs O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bit operations because B B B and C k C_k C k are fixed. Therefore, computing all m m m entries of w w w costs O q , k ( n log n ) O_{q,k}(n\log n) O q , k ( n log n ) bit operations.
Since D q ( y ^ j ( k ) ) ≤ Q − 1 D_q\left(\hat{y}_j^{(k)}\right)\le Q-1 D q ( y ^ j ( k ) ) ≤ Q − 1 and N k ( y ^ j ( k ) ) ≤ ℓ j N_k\left(\hat{y}_j^{(k)}\right)\le\ell_j N k ( y ^ j ( k ) ) ≤ ℓ j , we have 0 ≤ wt L 1 ( w ) ≤ m ( Q − 1 ) + ( B + C k ) ∑ j = 1 m ℓ j ≤ m ( Q − 1 ) + ( B + C k ) ( n + 5 k ) = O q , k ( n ) 0\le\operatorname{wt}_{L_1}(w)\le m(Q-1)+(B+C_k)\sum_{j=1}^{m}\ell_j\le m(Q-1)+(B+C_k)(n+5k)=O_{q,k}(n) 0 ≤ wt L 1 ( w ) ≤ m ( Q − 1 ) + ( B + C k ) ∑ j = 1 m ℓ j ≤ m ( Q − 1 ) + ( B + C k ) ( n + 5 k ) = O q , k ( n ) . Hence every partial sum of w 1 , … , w m w_1,\ldots,w_m w 1 , … , w m has O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bits. Computing wt L 1 ( w ) \operatorname{wt}_{L_1}(w) wt L 1 ( w ) therefore requires O q , k ( m log n ) = O q , k ( n log n ) O_{q,k}(m\log n)=O_{q,k}(n\log n) O q , k ( m log n ) = O q , k ( n log n ) further bit operations.
It remains to recover d d d and E E E . Compute the least nonnegative residues u d = ( m k ( y ) − s m ) m o d 5 u_d=(m_k(y)-s_m)\bmod5 u d = ( m k ( y ) − s m ) mod 5 and u E = ( s w t − wt L 1 ( w ) ) m o d R k u_E=(s_{\mathrm{wt}}-\operatorname{wt}_{L_1}(w))\bmod R_k u E = ( s wt − wt L 1 ( w )) mod R k . By Lemma IV.2 (iii), (34), and (43), the integer d d d is the unique integer in [ − 2 , 2 ] [-2,2] [ − 2 , 2 ] satisfying d ≡ u d ( m o d 5 ) d\equiv u_d\pmod5 d ≡ u d ( mod 5 ) , and E E E is the unique integer in [ − ( R k − 1 ) / 2 , ( R k − 1 ) / 2 ] [-(R_k-1)/2,(R_k-1)/2] [ − ( R k − 1 ) /2 , ( R k − 1 ) /2 ] satisfying E ≡ u E ( m o d R k ) E\equiv u_E\pmod{R_k} E ≡ u E ( mod R k ) . Therefore, set d = u d d=u_d d = u d if u d ≤ 2 u_d\le2 u d ≤ 2 , and d = u d − 5 d=u_d-5 d = u d − 5 otherwise. Similarly, set E = u E E=u_E E = u E if u E ≤ ( R k − 1 ) / 2 u_E\le(R_k-1)/2 u E ≤ ( R k − 1 ) /2 , and E = u E − R k E=u_E-R_k E = u E − R k otherwise. The recovery of d d d and E E E uses a fixed number of subtractions, reductions with remainder, and comparisons involving O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) -bit integers. It therefore costs O q , k ( ( log n ) 2 ) O_{q,k}((\log n)^2) O q , k (( log n ) 2 ) bit operations. Together with the preceding scan for pattern starts and the computation of w w w and wt L 1 ( w ) \operatorname{wt}_{L_1}(w) wt L 1 ( w ) , step (i) requires O q , k ( n log n ) O_{q,k}(n\log n) O q , k ( n log n ) bit operations in total.
(ii) Determine whether $y=x.
If y = x y=x y = x , then d = E = 0 d=E=0 d = E = 0 . Conversely, if y ≠ x y\ne x y = x , then Corollary IV.1 and condition (i) of Definition III.1 imply ( d , E ) ≠ ( 0 , 0 ) (d,E)\ne(0,0) ( d , E ) = ( 0 , 0 ) . Thus y = x y=x y = x if and only if d = E = 0 d=E=0 d = E = 0 . Since ∣ d ∣ ≤ 2 |d|\le2 ∣ d ∣ ≤ 2 and ∣ E ∣ ≤ C k ( k + 1 ) − 1 |E|\le C_k(k+1)-1 ∣ E ∣ ≤ C k ( k + 1 ) − 1 , this test costs O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations. If d = E = 0 d=E=0 d = E = 0 , the procedure stops. For the remaining steps, assume ( d , E ) ≠ ( 0 , 0 ) (d,E)\ne(0,0) ( d , E ) = ( 0 , 0 ) .
(iii) Recover Δ V T \Delta_{\mathrm{VT}} Δ VT and, when d = 0 d=0 d = 0 , Δ G 0 \Delta_{G_0} Δ G 0 and Δ G 1 \Delta_{G_1} Δ G 1 .
We first compute VT ( w ) = ∑ j = 1 m j w j \operatorname{VT}(w)=\sum_{j=1}^{m}jw_j VT ( w ) = ∑ j = 1 m j w j . Step (i) gives m = O k ( n ) m=O_k(n) m = O k ( n ) and wt L 1 ( w ) = O q , k ( n ) \operatorname{wt}_{L_1}(w)=O_{q,k}(n) wt L 1 ( w ) = O q , k ( n ) . Therefore, 0 ≤ VT ( w ) ≤ m wt L 1 ( w ) = O q , k ( n 2 ) 0\le\operatorname{VT}(w)\le m\operatorname{wt}_{L_1}(w)=O_{q,k}(n^2) 0 ≤ VT ( w ) ≤ m wt L 1 ( w ) = O q , k ( n 2 ) . Thus every partial sum of w 1 , 2 w 2 , … , m w m w_1,2w_2,\ldots,mw_m w 1 , 2 w 2 , … , m w m has O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bits. Each multiplication j w j jw_j j w j costs O q , k ( ( log n ) 2 ) O_{q,k}((\log n)^2) O q , k (( log n ) 2 ) bit operations, and each addition costs O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bit operations. There are m = O k ( n ) m=O_k(n) m = O k ( n ) terms, resulting in a total of O q , k ( n ( log n ) 2 ) O_{q,k}(n(\log n)^2) O q , k ( n ( log n ) 2 ) bit operations.
Next, use the given residue s V T = VT ( F k ( x ) ) m o d M n , k s_{\mathrm{VT}}=\operatorname{VT}(F_k(x))\bmod M_{n,k} s VT = VT ( F k ( x )) mod M n , k to compute u V T = ( s V T − VT ( w ) ) m o d M n , k u_{\mathrm{VT}}=(s_{\mathrm{VT}}-\operatorname{VT}(w))\bmod M_{n,k} u VT = ( s VT − VT ( w )) mod M n , k , where 0 ≤ u V T < M n , k 0\le u_{\mathrm{VT}}<M_{n,k} 0 ≤ u VT < M n , k . By (43), we have Δ V T ≡ u V T ( m o d M n , k ) \Delta_{\mathrm{VT}}\equiv u_{\mathrm{VT}}\pmod{M_{n,k}} Δ VT ≡ u VT ( mod M n , k ) . The proof of Lemma IV.9 gives ∣ Δ V T ∣ < 9 ( n k + A n , k ) = M n , k / 2 |\Delta_{\mathrm{VT}}|<9(n_{k}+A_{n,k})=M_{n,k}/2 ∣ Δ VT ∣ < 9 ( n k + A n , k ) = M n , k /2 . Since M n , k M_{n,k} M n , k is even and Δ V T \Delta_{\mathrm{VT}} Δ VT is an integer, it follows that Δ V T ∈ [ − M n , k / 2 + 1 , M n , k / 2 − 1 ] \Delta_{\mathrm{VT}}\in[-M_{n,k}/2+1,M_{n,k}/2-1] Δ VT ∈ [ − M n , k /2 + 1 , M n , k /2 − 1 ] . Thus u V T ≠ M n , k / 2 u_{\mathrm{VT}}\ne M_{n,k}/2 u VT = M n , k /2 , and
Δ V T = { u V T , 0 ≤ u V T < M n , k / 2 , u V T − M n , k , M n , k / 2 < u V T < M n , k . \Delta_{\mathrm{VT}}=
\begin{cases}
u_{\mathrm{VT}}, & 0\le u_{\mathrm{VT}}<M_{n,k}/2,\\
u_{\mathrm{VT}}-M_{n,k}, & M_{n,k}/2<u_{\mathrm{VT}}<M_{n,k}.
\end{cases} Δ VT = { u VT , u VT − M n , k , 0 ≤ u VT < M n , k /2 , M n , k /2 < u VT < M n , k .
Since 0 ≤ s V T < M n , k = O q , k ( n ) 0\le s_{\mathrm{VT}}<M_{n,k}=O_{q,k}(n) 0 ≤ s VT < M n , k = O q , k ( n ) and VT ( w ) = O q , k ( n 2 ) \operatorname{VT}(w)=O_{q,k}(n^2) VT ( w ) = O q , k ( n 2 ) , all integers used in this computation have O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bits. Computing u V T u_{\mathrm{VT}} u VT requires one subtraction and one reduction modulo M n , k M_{n,k} M n , k , costing O q , k ( ( log n ) 2 ) O_{q,k}((\log n)^2) O q , k (( log n ) 2 ) bit operations. Selecting the corresponding value of Δ V T \Delta_{\mathrm{VT}} Δ VT requires one comparison and at most one further subtraction, costing O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bit operations. Therefore, recovering Δ V T \Delta_{\mathrm{VT}} Δ VT from s V T s_{\mathrm{VT}} s VT and the computed value VT ( w ) \operatorname{VT}(w) VT ( w ) requires O q , k ( ( log n ) 2 ) O_{q,k}((\log n)^2) O q , k (( log n ) 2 ) bit operations.
If d = 0 d=0 d = 0 , compute G 0 ( w ) G_0(w) G 0 ( w ) and G 1 ( w ) G_1(w) G 1 ( w ) by adding w j w_j w j to the sum indexed by j j j according to whether that residue is 0 0 0 or 1 1 1 . Each sum is at most wt L 1 ( w ) = O q , k ( n ) \operatorname{wt}_{L_1}(w)=O_{q,k}(n) wt L 1 ( w ) = O q , k ( n ) , implying that these additions require O q , k ( n log n ) O_{q,k}(n\log n) O q , k ( n log n ) bit operations. Since d = 0 d=0 d = 0 implies m k ( x ) = m k ( y ) m_k(x)=m_k(y) m k ( x ) = m k ( y ) , Lemma IV.10 applies. For r ∈ { 0 , 1 } r\in\{0,1\} r ∈ { 0 , 1 } , compute u r = ( s r − G r ( w ) ) m o d ( 2 Λ q , k + 1 ) u_r=(s_r-G_r(w))\bmod(2\Lambda_{q,k}+1) u r = ( s r − G r ( w )) mod ( 2 Λ q , k + 1 ) . The bound ∣ Δ G r ∣ ≤ Λ q , k |\Delta G_r| \le\Lambda_{q,k} ∣Δ G r ∣ ≤ Λ q , k gives Δ G r = u r \Delta G_r = u_r Δ G r = u r when u r ≤ Λ q , k u_r \le\Lambda_{q,k} u r ≤ Λ q , k , and Δ G r = u r − ( 2 Λ q , k + 1 ) \Delta G_r = u_r - (2\Lambda_{q,k} + 1) Δ G r = u r − ( 2 Λ q , k + 1 ) otherwise. Since q q q and k k k are fixed, the integer 2 Λ q , k + 1 2\Lambda_{q,k} + 1 2 Λ q , k + 1 is independent of n n n . Each integer s r − G r ( w ) s_r-G_r(w) s r − G r ( w ) has O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bits. Reducing such an integer modulo 2 Λ q , k + 1 2\Lambda_{q,k} + 1 2 Λ q , k + 1 requires O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bit operations. The subsequent comparisons and subtractions involve only integers with O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bits and therefore cost O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations. Hence recovering both Δ G 0 \Delta G_0 Δ G 0 and Δ G 1 \Delta G_1 Δ G 1 requires O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bit operations. If d ≠ 0 d \ne0 d = 0 , these differences are not needed in Theorem III.1. In either case, step (iii) requires O q , k ( n ( log n ) 2 ) O_{q,k}(n(\log n)^2) O q , k ( n ( log n ) 2 ) bit operations.
(iv) Compute the claimed interval. Apply Theorem III.1 to x ^ \hat{x} x ^ and y ^ \hat{y} y ^ with the partition and segment function from Section IV-A, and with
K = 3 , A = A n , k , L = 3 ℓ n , k + k , K = 3,\qquad A = A_{n,k},\qquad L = 3\ell_{n,k} + k, K = 3 , A = A n , k , L = 3 ℓ n , k + k ,
C ( 1 ) = C k , C ( 2 ) = 2 k , C ( 3 ) = C k ( k + 1 ) − 1. C^{(1)} = C_k,\qquad C^{(2)} = 2k,\qquad C^{(3)} = C_k(k+1)-1. C ( 1 ) = C k , C ( 2 ) = 2 k , C ( 3 ) = C k ( k + 1 ) − 1.
The common segment decompositions in Lemma IV.2 (ii) give Assumption 1. Parts (v) and (vi) of that lemma give the segment-length bound and the A A A -bounded property, respectively. Strong locatability follows from Corollary IV.1, since step (ii) has established y ≠ x y \ne x y = x . Finally, parts (i) and (iv) of Lemma IV.2 give w j ≥ C k ℓ j w_j \ge C_k\ell_j w j ≥ C k ℓ j , ℓ j ≥ 2 k \ell_j \ge2k ℓ j ≥ 2 k , and ∣ E ∣ ≤ C k ( k + 1 ) − 1 |E| \le C_k(k+1)-1 ∣ E ∣ ≤ C k ( k + 1 ) − 1 , while
C ( 1 ) − C ( 3 ) C ( 2 ) = ( k − 1 ) C k + 1 2 k > 0. C^{(1)}-\frac{C^{(3)}}{C^{(2)}}=\frac{(k-1)C_k+1}{2k}>0. C ( 1 ) − C ( 2 ) C ( 3 ) = 2 k ( k − 1 ) C k + 1 > 0.
Thus the hypotheses of Theorem III.1 are satisfied. The partition of y ^ \hat{y} y ^ and F k ( y ) F_k(y) F k ( y ) were computed in step (i). The required differences d d d , E E E , Δ V T \Delta V_T Δ V T , Δ G 0 \Delta G_0 Δ G 0 and Δ G 1 \Delta G_1 Δ G 1 were obtained in steps (i) and (iii).
The original sequence in this application has length ∣ x ^ ∣ = n + 4 k |\hat{x}|=n+4k ∣ x ^ ∣ = n + 4 k . Therefore, the parameter λ \lambda λ in Theorem III.1 is
λ = ⌈ log ( 9 ( n + 5 k + 1 ) 2 A ) ⌉ = O q , k ( log n ) , \lambda=\left\lceil\log\left(9(n+5k+1)^2A\right)\right\rceil=O_{q,k}(\log n), λ = ⌈ log ( 9 ( n + 5 k + 1 ) 2 A ) ⌉ = O q , k ( log n ) ,
where A = A n , k = O q , k ( log n ) A=A_{n,k}=O_{q,k}(\log n) A = A n , k = O q , k ( log n ) follows from (32) and (35). Theorem III.1 consequently computes an interval I ^ = [ a , b ] ⊆ [ n + 4 k ] \hat{I}=[a,b]\subseteq[n+4k] I ^ = [ a , b ] ⊆ [ n + 4 k ] covering the edit region in x ^ \hat{x} x ^ using O q , k ( ( n + 4 k ) λ 2 ) = O q , k ( n ( log n ) 2 ) O_{q,k}((n+4k)\lambda^2)=O_{q,k}(n(\log n)^2) O q , k (( n + 4 k ) λ 2 ) = O q , k ( n ( log n ) 2 ) bit operations. Substituting the above parameters into (19), and using 5 L = 15 ℓ n , k + 5 k 5L=15\ell_{n,k}+5k 5 L = 15 ℓ n , k + 5 k , gives ∣ I ^ ∣ ≤ W n , k |\hat{I}|\le W_{n,k} ∣ I ^ ∣ ≤ W n , k .
To obtain an interval in the coordinates of x x x , define I = [ π ( a ) , π ( b ) ] I=[\pi(a),\pi(b)] I = [ π ( a ) , π ( b )] where π ( t ) = min { n , max { 1 , t − 2 k } } \pi(t)=\min\{n,\max\{1,t-2k\}\} π ( t ) = min { n , max { 1 , t − 2 k }} . It is easy to verify that I I I covers the edit region in x x x . Moreover, π \pi π is non-decreasing and satisfies π ( b ) − π ( a ) ≤ b − a \pi(b)-\pi(a)\le b-a π ( b ) − π ( a ) ≤ b − a . Therefore, I ⊆ [ n ] I\subseteq[n] I ⊆ [ n ] and ∣ I ∣ ≤ ∣ I ^ ∣ ≤ W n , k |I|\le|\hat{I}|\le W_{n,k} ∣ I ∣ ≤ ∣ I ^ ∣ ≤ W n , k . Computing these endpoints requires O k ( log n ) O_k(\log n) O k ( log n ) further bit operations. Since ℓ n , k \ell_{n,k} ℓ n , k and A n , k A_{n,k} A n , k are O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) and C k − ( C k ( k + 1 ) − 1 ) / ( 2 k ) C_k-(C_k(k+1)-1)/(2k) C k − ( C k ( k + 1 ) − 1 ) / ( 2 k ) is a positive constant, (52) also gives W n , k = O q , k ( log n ) W_{n,k}=O_{q,k}(\log n) W n , k = O q , k ( log n ) .
Steps (i) and (ii) cost O q , k ( n log n ) O_{q,k}(n\log n) O q , k ( n log n ) and O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations, respectively. Each of steps (iii) and (iv) costs O q , k ( n ( log n ) 2 ) O_{q,k}(n(\log n)^2) O q , k ( n ( log n ) 2 ) bit operations. Their sum is O q , k ( n ( log n ) 2 ) O_{q,k}(n(\log n)^2) O q , k ( n ( log n ) 2 ) . Now the proof is completed.
Completing the Code Construction
In the previous section, the edit region in x x x has been determined to within a short block. To complete the construction of our k k k -substring edit correcting code, it remains to design a code C ′ C' C ′ that can correct a k k k -substring edit error which occurs in a known short block.
In [2 ] , Li et al. used a code with redundancy 4 k log m + o ( log m ) 4k\log m+o(\log m) 4 k log m + o ( log m ) as a component of C ′ C' C ′ (see [2 ] , Lemmas 15 and 16), where m m m is the length of that code. In § 5 -A below, we apply the distributed graph coloring framework in [21 ] to construct a code with redundancy 4 log m + O q , k ( log log m ) 4\log m+O_{q,k}(\log\log m) 4 log m + O q , k ( log log m ) to serve as the component. Our code C ′ C' C ′ is presented in § 5 -B. The final k k k -substring edit correcting code is given in § 5 -C.
The Component Code for Local Recovery
Let m ≥ max { k , 2 } m\ge\max\{k,2\} m ≥ max { k , 2 } be an integer. For b ∈ Σ q m b\in\Sigma_q^m b ∈ Σ q m , recall that E 1 , k ( b ) \mathcal{E}_{1,k}(b) E 1 , k ( b ) is the set of sequences obtained from b b b by one k k k -substring edit. Define
B k ( b ) ≜ { c ∈ Σ q m : E 1 , k ( b ) ∩ E 1 , k ( c ) ≠ ∅ } . \mathcal{B}_k(b)\triangleq\left\{c\in\Sigma_q^m:\mathcal{E}_{1,k}(b)\cap\mathcal{E}_{1,k}(c)\ne\varnothing\right\}. B k ( b ) ≜ { c ∈ Σ q m : E 1 , k ( b ) ∩ E 1 , k ( c ) = ∅ } .
Clearly, b ∈ B k ( b ) b\in\mathcal{B}_k(b) b ∈ B k ( b ) . Let S q , k ≜ ∑ j = 0 k q j S_{q,k}\triangleq\sum_{j=0}^{k}q^j S q , k ≜ ∑ j = 0 k q j , U m ≜ S q , k ( ( k + 1 ) ( m + 1 ) − ( k + 1 2 ) ) U_m\triangleq S_{q,k}((k+1)(m+1)-\binom{k+1}{2}) U m ≜ S q , k (( k + 1 ) ( m + 1 ) − ( 2 k + 1 ) ) , and D m ≜ U m U m + k D_m\triangleq U_mU_{m+k} D m ≜ U m U m + k .
Lemma V.1 For every b ∈ Σ q m b\in\Sigma_q^m b ∈ Σ q m , it holds that ∣ B k ( b ) ∣ ≤ D m |\mathcal{B}_k(b)|\le D_m ∣ B k ( b ) ∣ ≤ D m . All members of B k ( b ) \mathcal{B}_k(b) B k ( b ) can be generated explicitly in O q , k ( m 3 log m ) O_{q,k}(m^3\log m) O q , k ( m 3 log m ) bit operations.
Proof. Since every k k k -substring edit is reversible, a sequence c ∈ Σ q m c\in\Sigma_q^m c ∈ Σ q m belongs to B k ( b ) \mathcal{B}_k(b) B k ( b ) if and only if there exists c 1 ∈ E 1 , k ( b ) c_1\in\mathcal{E}_{1,k}(b) c 1 ∈ E 1 , k ( b ) such that c ∈ E 1 , k ( c 1 ) c\in\mathcal{E}_{1,k}(c_1) c ∈ E 1 , k ( c 1 ) . Thus, we can generate B k ( b ) \mathcal{B}_k(b) B k ( b ) by the following three steps: first applying every possible k k k -substring edit to b b b , then applying every possible k k k -substring edit to each resulting sequence c 1 c_1 c 1 , and finally retaining only the resulting sequences of length m m m and removing repeated sequences.
Every c 1 ∈ E 1 , k ( b ) c_1\in\mathcal{E}_{1,k}(b) c 1 ∈ E 1 , k ( b ) is obtained by first deleting a substring of length at most k k k in the same position. There are at most S q , k S_{q,k} S q , k choices for t t t and k + 1 k+1 k + 1 choices for the length of s s s . For each ∣ s ∣ |s| ∣ s ∣ , there are m + 1 − ∣ s ∣ m+1-|s| m + 1 − ∣ s ∣ choices for the positions of s s s . Therefore, we have ∣ C 1 , k ( b ) ∣ ≤ S q , k ∑ ∣ s ∣ = 0 k ( m − ∣ s ∣ + 1 ) = U m = O q , k ( m ) |\mathcal{C}_{1,k}(b)| \le S_{q,k}\sum_{|s|=0}^{k}(m-|s|+1)=U_m=O_{q,k}(m) ∣ C 1 , k ( b ) ∣ ≤ S q , k ∑ ∣ s ∣ = 0 k ( m − ∣ s ∣ + 1 ) = U m = O q , k ( m ) . Since the length of c 1 c_1 c 1 is at most m + k m+k m + k , there are ∣ E 1 , k ( c 1 ) ∣ ≤ U m + k = O q , k ( m ) |\mathcal{E}_{1,k}(c_1)| \le U_{m+k}=O_{q,k}(m) ∣ E 1 , k ( c 1 ) ∣ ≤ U m + k = O q , k ( m ) possibilities for c c c once c 1 c_1 c 1 is fixed. Therefore, it holds that ∣ B k ( b ) ∣ ≤ U m U m + k = D m = O q , k ( m 2 ) |\mathcal{B}_k(b)| \le U_mU_{m+k}=D_m=O_{q,k}(m^2) ∣ B k ( b ) ∣ ≤ U m U m + k = D m = O q , k ( m 2 ) .
Next, we analyze the bit operations needed to generate B k ( b ) \mathcal{B}_k(b) B k ( b ) . Constructing each c 1 c_1 c 1 requires copying its unchanged prefix and suffix and writing the inserted symbols, which takes O q , k ( m ) O_{q,k}(m) O q , k ( m ) bit operations. Similarly, constructing a candidate c c c from a given c 1 c_1 c 1 takes O q , k ( m + k ) = O q , k ( m ) O_{q,k}(m+k)=O_{q,k}(m) O q , k ( m + k ) = O q , k ( m ) bit operations. Thus, generating all the candidates c c c costs D m ( O ( m ) + O ( m ) ) = O q , k ( m 3 ) D_m\left(O(m)+O(m)\right)=O_{q,k}(m^3) D m ( O ( m ) + O ( m ) ) = O q , k ( m 3 ) bit operations.
To remove repetitions, we use merge sort to arrange the retained length-m m m sequences in lexicographic order. This requires at most O ( D m log D m ) = O q , k ( m 2 log m ) O(D_m\log D_m)=O_{q,k}(m^2\log m) O ( D m log D m ) = O q , k ( m 2 log m ) string comparisons. Each comparison takes O ( m ) O(m) O ( m ) bit operations because the strings have length m m m . Hence the sorting procedure takes O q , k ( m 3 log m ) O_{q,k}(m^3\log m) O q , k ( m 3 log m ) bit operations. We then scan the sorted list and retain one copy of each distinct sequence. Notice that equal sequences are consecutive in the sorted list, implying that removing repeated sequences costs additional O q , k ( m 3 ) O_{q,k}(m^3) O q , k ( m 3 ) bit operations. Therefore, all members of B k ( b ) \mathcal{B}_k(b) B k ( b ) can be generated without repetitions in O q , k ( m 3 log m ) O_{q,k}(m^3\log m) O q , k ( m 3 log m ) bit operations.
Put N = max { q − 1 , ( D m − 1 ) ( m − 1 ) } N=\max\{q-1,(D_m-1)(m-1)\} N = max { q − 1 , ( D m − 1 ) ( m − 1 )} . Lemma V.1 gives D m = O q , k ( m 2 ) D_m=O_{q,k}(m^2) D m = O q , k ( m 2 ) , implying N = O q , k ( m 3 ) N=O_{q,k}(m^3) N = O q , k ( m 3 ) . Let P m P_m P m be the smallest prime greater than N N N . By Bertrand’s postulate [22 Section 5.2] , there is a prime strictly between N N N and 2 N 2N 2 N for every integer N > 1 N>1 N > 1 . Consequently, we have N < P m < 2 N N<P_m<2N N < P m < 2 N , which gives P m = O q , k ( m 3 ) P_m=O_{q,k}(m^3) P m = O q , k ( m 3 ) . The next lemma helps to find P m P_m P m .
Lemma V.2. (cf. [23 Theorems 4.1 and 5.1] ) There is an algorithm which can decide, for any given integer u ≥ 2 u\ge2 u ≥ 2 , whether u u u is a prime in ( log u ) O ( 1 ) (\log u)^{O(1)} ( log u ) O ( 1 ) bit operations.
See also [24 ] for the corrected proof of Lemma 4.3 in [23 ] .
To find P m P_m P m , we test the integers N + 1 , N + 2 , … N+1,N+2,\ldots N + 1 , N + 2 , … in order and stop at the first prime. Since P m < 2 N P_m<2N P m < 2 N , fewer than N N N integers are tested, and each test requires ( log N ) O ( 1 ) (\log N)^{O(1)} ( log N ) O ( 1 ) bit operations by Lemma V.2. Therefore, P m P_m P m can be found in O ( N ( log N ) O ( 1 ) ) = O q , k ( m 3 ( log m ) O ( 1 ) ) O(N(\log N)^{O(1)})=O_{q,k}(m^3(\log m)^{O(1)}) O ( N ( log N ) O ( 1 ) ) = O q , k ( m 3 ( log m ) O ( 1 ) ) bit operations.
For a prime p p p , let F p \mathbb{F}_p F p denote the finite field with p p p elements. We identify elements in F p \mathbb{F}_p F p with their representatives in [ 0 , p − 1 ] [0,p-1] [ 0 , p − 1 ] . For α ∈ F P m \alpha\in\mathbb{F}_{P_m} α ∈ F P m and b = b 1 ⋯ b m ∈ Σ q m b=b_1\cdots b_m\in\Sigma_q^m b = b 1 ⋯ b m ∈ Σ q m , define
h α ( b ) = ∑ i = 1 m b i α i − 1 , h_\alpha(b)=\sum_{i=1}^{m}b_i\alpha^{i-1}, h α ( b ) = i = 1 ∑ m b i α i − 1 ,
which is an element in F P m \mathbb{F}_{P_m} F P m . The next lemma specializes the polynomial cover-free family in [21 Lemma 13] and the recoloring procedure in [21 Lemma 15] to the confusion graph whose neighbor set at b b b is B k ( b ) ∖ { b } \mathcal{B}_k(b)\setminus\{b\} B k ( b ) ∖ { b } .
Lemma V.3. For every b ∈ Σ q m b\in\Sigma_q^m b ∈ Σ q m , there exists α ∈ F P m \alpha\in\mathbb{F}_{P_m} α ∈ F P m such that
h α ( b ) ≠ h α ( c ) (53) h_\alpha(b)\ne h_\alpha(c) \tag*{(53)} h α ( b ) = h α ( c ) (53) for all c ∈ B k ( b ) ∖ { b } c\in\mathcal{B}_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } . Let α ( b ) \alpha(b) α ( b ) be the smallest α \alpha α in { 0 , 1 , … , P m − 1 } \{0,1,\ldots,P_m-1\} { 0 , 1 , … , P m − 1 } satisfying this property. Define
g m ( b ) = α ( b ) P m + h α ( b ) ( b ) ∈ [ 0 , P m 2 − 1 ] . g_m(b)=\alpha(b)P_m+h_{\alpha(b)}(b)\in[0,P_m^2-1]. g m ( b ) = α ( b ) P m + h α ( b ) ( b ) ∈ [ 0 , P m 2 − 1 ] . Then g m ( c ) ≠ g m ( b ) g_m(c)\ne g_m(b) g m ( c ) = g m ( b ) for every c ∈ B k ( b ) ∖ { b } c\in\mathcal{B}_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } . The value g m ( b ) g_m(b) g m ( b ) is computable in O q , k ( m 6 ( log m ) O ( 1 ) ) O_{q,k}(m^6(\log m)^{O(1)}) O q , k ( m 6 ( log m ) O ( 1 ) ) bit operations.
Proof. For c = c 1 ⋯ c m ∈ B k ( b ) ∖ { b } c=c_1\cdots c_m\in\mathcal{B}_k(b)\setminus\{b\} c = c 1 ⋯ c m ∈ B k ( b ) ∖ { b } , consider the polynomial
P b , c ( X ) = ∑ i = 1 m ( b i − c i ) X i − 1 ∈ F P m [ X ] . P_{b,c}(X)=\sum_{i=1}^{m}(b_i-c_i)X^{i-1}\in\mathbb{F}_{P_m}[X]. P b , c ( X ) = i = 1 ∑ m ( b i − c i ) X i − 1 ∈ F P m [ X ] .
Since b ≠ c b\ne c b = c , there is at least one i ∈ [ m ] i\in[m] i ∈ [ m ] such that b i ≠ c i b_i\ne c_i b i = c i . It follows from the fact P m > q − 1 P_m>q-1 P m > q − 1 and 0 < ∣ b i − c i ∣ ≤ q − 1 0<|b_i-c_i|\le q-1 0 < ∣ b i − c i ∣ ≤ q − 1 that P b , c ( X ) P_{b,c}(X) P b , c ( X ) is a nonzero polynomial over F P m \mathbb{F}_{P_m} F P m . The degree of P b , c ( X ) P_{b,c}(X) P b , c ( X ) is at most m − 1 m-1 m − 1 , implying that it has at most m − 1 m-1 m − 1 roots. Then by Lemma V.1 and the fact P m > ( D m − 1 ) ( m − 1 ) P_m>(D_m-1)(m-1) P m > ( D m − 1 ) ( m − 1 ) , there is at least one element α ∈ F P m \alpha\in\mathbb{F}_{P_m} α ∈ F P m such that P b , c ( α ) ≠ 0 P_{b,c}(\alpha)\ne0 P b , c ( α ) = 0 for every c ∈ B k ( b ) ∖ { b } c\in\mathcal{B}_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } .
Suppose that there is some c ∈ B k ( b ) ∖ { b } c\in\mathcal{B}_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } satisfying g m ( c ) = g m ( b ) g_m(c)=g_m(b) g m ( c ) = g m ( b ) . Then it must hold that α ( c ) = α ( b ) \alpha(c)=\alpha(b) α ( c ) = α ( b ) and h α ( b ) ( c ) = h α ( b ) ( b ) h_{\alpha(b)}(c)=h_{\alpha(b)}(b) h α ( b ) ( c ) = h α ( b ) ( b ) , since 0 ≤ α ( c ) , α ( b ) , h α ( b ) ( c ) , h α ( b ) ( b ) < P m 0\le\alpha(c),\alpha(b),h_{\alpha(b)}(c),h_{\alpha(b)}(b)<P_m 0 ≤ α ( c ) , α ( b ) , h α ( b ) ( c ) , h α ( b ) ( b ) < P m . This contradicts (53) and therefore, g m ( c ) ≠ g m ( b ) g_m(c)\ne g_m(b) g m ( c ) = g m ( b ) for all c ∈ B k ( b ) ∖ { b } c\in\mathcal{B}_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } .
Next, we analyze the complexity of computing g m ( b ) g_m(b) g m ( b ) . First, generate B k ( b ) \mathcal{B}_k(b) B k ( b ) and test α = 0 , 1 , … , P m − 1 \alpha=0,1,\ldots,P_m-1 α = 0 , 1 , … , P m − 1 in increasing order. For each α \alpha α , compute h α ( b ) h_\alpha(b) h α ( b ) and h α ( c ) h_\alpha(c) h α ( c ) for all c ∈ B k ( b ) ∖ { b } c\in\mathcal{B}_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } . Stop at the first α \alpha α for which h α ( c ) ≠ h α ( b ) h_\alpha(c)\ne h_\alpha(b) h α ( c ) = h α ( b ) for all c ∈ B k ( b ) ∖ { b } c\in\mathcal{B}_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } .
For a given α \alpha α and c ∈ B k ( b ) ∖ { b } c\in\mathcal{B}_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } , the value h α ( c ) h_\alpha(c) h α ( c ) can be computed by Horner’s rule (see [25 Section 5.1] ), which uses m m m multiplications and m m m additions in F P m \mathbb{F}_{P_m} F P m . Since there are at most P m P_m P m choices of α \alpha α and at most D m D_m D m sequences to evaluate for each α \alpha α , the total number of field additions and multiplications is O ( P m D m m ) = O q , k ( m 6 ) O(P_mD_mm)=O_{q,k}(m^6) O ( P m D m m ) = O q , k ( m 6 ) .
Put ℓ = ⌈ log 2 P m ⌉ \ell=\lceil\log_2P_m\rceil ℓ = ⌈ log 2 P m ⌉ . Recall that elements in F P m \mathbb{F}_{P_m} F P m are represented by integers in [ 0 , P m − 1 ] [0,P_m-1] [ 0 , P m − 1 ] . Addition modulo P m P_m P m takes O ( ℓ ) O(\ell) O ( ℓ ) bit operations, and multiplication followed by reduction modulo P m P_m P m takes O ( ℓ 2 ) O(\ell^2) O ( ℓ 2 ) bit operations. Comparing two field elements takes O ( ℓ ) O(\ell) O ( ℓ ) bit operations. Thus, all evaluations and comparisons require O ( P m D m ℓ 2 ) = O q , k ( m 6 ( log m ) 2 ) O(P_mD_m\ell^2)=O_{q,k}(m^6(\log m)^2) O ( P m D m ℓ 2 ) = O q , k ( m 6 ( log m ) 2 ) bit operations.
Generating B k ( b ) B_k(b) B k ( b ) costs O q , k ( m 3 log m ) O_{q,k}(m^3 \log m) O q , k ( m 3 log m ) bit operations by Lemma V.1. The prime search costs O q , k ( m 3 ( log m ) O ( 1 ) ) O_{q,k}(m^3(\log m)^{O(1)}) O q , k ( m 3 ( log m ) O ( 1 ) ) bit operations, as established above. Once α ( b ) \alpha(b) α ( b ) has been found, h α ( b ) ( b ) h_{\alpha(b)}(b) h α ( b ) ( b ) is already available. Then computing g m ( b ) g_m(b) g m ( b ) requires only one integer multiplication and one addition, which take O ( ℓ 2 ) O(\ell^2) O ( ℓ 2 ) bit operations. Combining these bounds gives the stated complexity O q , k ( m 6 ( log m ) O ( 1 ) ) O_{q,k}(m^6(\log m)^{O(1)}) O q , k ( m 6 ( log m ) O ( 1 ) ) .
Lemma V.3 says that one can efficiently recover b b b from the syndrome g m ( b ) g_m(b) g m ( b ) and any b ′ ∈ E 1 , k ( b ) b' \in E_{1,k}(b) b ′ ∈ E 1 , k ( b ) . This gives a length-m m m k k k -substring edit correcting code with redundancy log ( P m 2 ) = 6 log m + O q , k ( 1 ) \log(P_m^2)=6\log m+O_{q,k}(1) log ( P m 2 ) = 6 log m + O q , k ( 1 ) . We next compress the syndrome g m ( b ) g_m(b) g m ( b ) by choosing a small prime modulus, which gives a length-m m m k k k -substring edit correcting code with redundancy 4 log m + 4 log log m + O q , k ( 1 ) 4\log m+4\log\log m+O_{q,k}(1) 4 log m + 4 log log m + O q , k ( 1 ) .
Let p j p_j p j denote the j j j -th prime number. We have the following result.
Lemma V.4. [26 eq. (3.13)] It holds that p j < j ( ln j + ln ln j ) p_j<j(\ln j+\ln\ln j) p j < j ( ln j + ln ln j ) for every integer j ≥ 6 j\ge6 j ≥ 6 .
Set
T m = 1 + ( D m − 1 ) ⌈ log ( P m 2 − 1 ) ⌉ . T_m=1+(D_m-1)\left\lceil\log(P_m^2-1)\right\rceil. T m = 1 + ( D m − 1 ) ⌈ log ( P m 2 − 1 ) ⌉ .
Every integer in [ P m 2 − 1 ] \left[P_m^2-1\right] [ P m 2 − 1 ] has at most ⌈ log ( P m 2 − 1 ) ⌉ \left\lceil\log(P_m^2-1)\right\rceil ⌈ log ( P m 2 − 1 ) ⌉ distinct prime divisors, because the product of t t t distinct primes is at least 2 t 2^t 2 t . Consequently, among p 1 , … , p T m p_1,\ldots,p_{T_m} p 1 , … , p T m , there is a prime that divides none of the integers in the set
{ ∣ g m ( b ) − g m ( c ) ∣ : c ∈ B k ( b ) ∖ { b } } . \left\{\lvert g_m(b)-g_m(c)\rvert:c\in B_k(b)\setminus\{b\}\right\}. { ∣ g m ( b ) − g m ( c )∣ : c ∈ B k ( b ) ∖ { b } } .
Let a ( b ) a(b) a ( b ) be the least such prime, and put
r ( b ) = g m ( b ) m o d a ( b ) and A m = p T m + 1. (54) r(b)=g_m(b)\bmod a(b)\quad\text{and}\quad A_m=p_{T_m}+1. \tag*{(54)} r ( b ) = g m ( b ) mod a ( b ) and A m = p T m + 1. (54)
Then 0 ≤ r ( b ) < a ( b ) < A m 0\le r(b)<a(b)<A_m 0 ≤ r ( b ) < a ( b ) < A m . Since log P m = O q , k ( log m ) \log P_m=O_{q,k}(\log m) log P m = O q , k ( log m ) and D m = O q , k ( m 2 ) D_m=O_{q,k}(m^2) D m = O q , k ( m 2 ) , we have T m = O q , k ( m 2 log m ) T_m=O_{q,k}(m^2\log m) T m = O q , k ( m 2 log m ) . Applying Lemma V.4 to p T m p_{T_m} p T m gives A m = O q , k ( m 2 ( log m ) 2 ) A_m=O_{q,k}(m^2(\log m)^2) A m = O q , k ( m 2 ( log m ) 2 ) . Define the syndrome
H m ( b ) = ( a ( b ) , r ( b ) ) . H_m(b)=(a(b),r(b)). H m ( b ) = ( a ( b ) , r ( b )) .
Lemma V.5. Let b ∈ Σ q m b\in\Sigma_q^m b ∈ Σ q m .
(i) The syndrome H m ( b ) H_m(b) H m ( b ) can be computed in O q , k ( m 8 ( log m ) O ( 1 ) ) O_{q,k}(m^8(\log m)^{O(1)}) O q , k ( m 8 ( log m ) O ( 1 ) ) bit operations.
(ii) Given w ∈ E 1 , k ( b ) w\in E_{1,k}(b) w ∈ E 1 , k ( b ) and H m ( b ) H_m(b) H m ( b ) , the sequence b b b can be uniquely recovered in O q , k ( m 7 ( log m ) O ( 1 ) ) O_{q,k}(m^7(\log m)^{O(1)}) O q , k ( m 7 ( log m ) O ( 1 ) ) bit operations.
Proof. (i) To estimate the complexity of computing H m ( b ) H_m(b) H m ( b ) , we estimate the complexity of each step in the computation of H m ( b ) H_m(b) H m ( b ) . The syndrome H m ( b ) H_m(b) H m ( b ) can be computed by the following steps:
Step 1: Generate B k ( b ) B_k(b) B k ( b ) using Lemma V.1. This step takes O q , k ( m 3 log m ) O_{q,k}(m^3\log m) O q , k ( m 3 log m ) bit operations.
Step 2: Compute g m ( c ) g_m(c) g m ( c ) for all c ∈ B k ( b ) c\in B_k(b) c ∈ B k ( b ) , including c = b c=b c = b . Since ∣ B k ( b ) ∣ ≤ D m = O q , k ( m 2 ) \lvert B_k(b)\rvert\le D_m=O_{q,k}(m^2) ∣ B k ( b )∣ ≤ D m = O q , k ( m 2 ) , it follows from Lemma V.3 that this step takes O q , k ( m 8 ( log m ) O ( 1 ) ) O_{q,k}(m^8(\log m)^{O(1)}) O q , k ( m 8 ( log m ) O ( 1 ) ) bit operations. Moreover, each g m ( c ) g_m(c) g m ( c ) has O q , k ( log m ) O_{q,k}(\log m) O q , k ( log m ) bits.
Step 3: For each c ∈ B k ( b ) ∖ { b } c\in B_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } , put Δ c = ∣ g m ( b ) − g m ( c ) ∣ \Delta_c=\lvert g_m(b)-g_m(c)\rvert Δ c = ∣ g m ( b ) − g m ( c )∣ . Calculating all the differences Δ c \Delta_c Δ c takes O q , k ( m 2 log m ) O_{q,k}(m^2\log m) O q , k ( m 2 log m ) bit operations.
Step 4: Generate the first T m T_m T m primes. To that end, test the integers 2 , 3 , … 2,3,\ldots 2 , 3 , … in order and retain those that are prime, stopping when T m T_m T m primes have been obtained. By Lemma V.4 and the bound T m = O q , k ( m 2 log m ) T_m=O_{q,k}(m^2\log m) T m = O q , k ( m 2 log m ) , we have p T m = O q , k ( m 2 ( log m ) 2 ) p_{T_m}=O_{q,k}(m^2(\log m)^2) p T m = O q , k ( m 2 ( log m ) 2 ) . At most p T m − 1 p_{T_m}-1 p T m − 1 integers are tested. Each of these integers has O q , k ( log m ) O_{q,k}(\log m) O q , k ( log m ) bits. By Lemma V.2, each test uses ( log m ) O ( 1 ) (\log m)^{O(1)} ( log m ) O ( 1 ) bit operations. Consequently, generating the first T m T_m T m primes costs O q , k ( m 2 ( log m ) O ( 1 ) ) O_{q,k}(m^2(\log m)^{O(1)}) O q , k ( m 2 ( log m ) O ( 1 ) ) bit operations.
Step 5: Determine the prime a ( b ) a(b) a ( b ) . For 1 ≤ j ≤ T m 1\le j\le T_m 1 ≤ j ≤ T m , compute Δ c m o d p j \Delta_c\bmod p_j Δ c mod p j for every c ∈ B k ( b ) ∖ { b } c\in B_k(b)\setminus\{b\} c ∈ B k ( b ) ∖ { b } . The first prime for which all these remainders are nonzero is a ( b ) a(b) a ( b ) . The analysis preceding this lemma guarantees that such a prime occurs among p 1 , … , p T m p_1,\ldots,p_{T_m} p 1 , … , p T m . There are at most D m ( T m − 1 ) = O q , k ( m 4 log m ) D_m(T_m-1)=O_{q,k}(m^4\log m) D m ( T m − 1 ) = O q , k ( m 4 log m ) remainder computations. For every c c c and every j ∈ [ T m ] j\in[T_m] j ∈ [ T m ] , both Δ c \Delta_c Δ c and p j p_j p j have O q , k ( log m ) O_{q,k}(\log m) O q , k ( log m ) bits. Each remainder can be computed in O q , k ( ( log m ) 2 ) O_{q,k}((\log m)^2) O q , k (( log m ) 2 ) bit operations. Thus, it takes O q , k ( m 4 ( log m ) 3 ) O_{q,k}(m^4(\log m)^3) O q , k ( m 4 ( log m ) 3 ) bit operations to determine the prime a ( b ) a(b) a ( b ) in this step.
Step 6: Finally, compute r ( b ) = g m ( b ) m o d a ( b ) r(b)=g_m(b)\bmod a(b) r ( b ) = g m ( b ) mod a ( b ) and output H m ( b ) = ( a ( b ) , r ( b ) ) H_m(b)=(a(b),r(b)) H m ( b ) = ( a ( b ) , r ( b )) . This last remainder computation takes O q , k ( ( log m ) 2 ) O_{q,k}((\log m)^2) O q , k (( log m ) 2 ) bit operations.
Therefore, the computation of H m ( b ) H_m(b) H m ( b ) costs
O q , k ( m 3 log m ) + O q , k ( m 8 ( log m ) O ( 1 ) ) + O q , k ( m 2 log m ) + O q , k ( m 2 ( log m ) O ( 1 ) ) + O q , k ( m 4 ( log m ) 3 ) + O q , k ( ( log m ) 2 ) = O q , k ( m 8 ( log m ) O ( 1 ) ) \begin{aligned}
&O_{q,k}(m^3\log m)+O_{q,k}\left(m^8(\log m)^{O(1)}\right)+O_{q,k}(m^2\log m)\\
&\quad+O_{q,k}\left(m^2(\log m)^{O(1)}\right)+O_{q,k}\left(m^4(\log m)^3\right)+O_{q,k}\left((\log m)^2\right)\\
&=O_{q,k}\left(m^8(\log m)^{O(1)}\right)
\end{aligned} O q , k ( m 3 log m ) + O q , k ( m 8 ( log m ) O ( 1 ) ) + O q , k ( m 2 log m ) + O q , k ( m 2 ( log m ) O ( 1 ) ) + O q , k ( m 4 ( log m ) 3 ) + O q , k ( ( log m ) 2 ) = O q , k ( m 8 ( log m ) O ( 1 ) )
bit operations. (ii) We next describe the recovery procedure. Let ( a , r ) = H m ( b ) (a,r)=H_m(b) ( a , r ) = H m ( b ) and define L ( w ) = E 1 , k ( w ) ∩ Σ q m \mathcal{L}(w)=\mathcal{E}_{1,k}(w)\cap\Sigma_q^m L ( w ) = E 1 , k ( w ) ∩ Σ q m . By an argument similar to the proof of Lemma V.1, we can show that ∣ L ( w ) ∣ = O q , k ( m ) |\mathcal{L}(w)|=O_{q,k}(m) ∣ L ( w ) ∣ = O q , k ( m ) , and that L ( w ) \mathcal{L}(w) L ( w ) can be generated without repetitions in O q , k ( m 2 log m ) O_{q,k}(m^2\log m) O q , k ( m 2 log m ) bit operations.
For each c ∈ L ( w ) c\in\mathcal{L}(w) c ∈ L ( w ) , compute g m ( c ) g_m(c) g m ( c ) and test whether g m ( c ) m o d a = r g_m(c)\bmod a=r g m ( c ) mod a = r . The sequence b b b belongs to L ( w ) \mathcal{L}(w) L ( w ) and passes this test. Moreover, every c ∈ L ( w ) c\in\mathcal{L}(w) c ∈ L ( w ) belongs to B k ( b ) B_k(b) B k ( b ) . If a sequence c ≠ b c\ne b c = b also passed the test, then a a a would divide g m ( b ) − g m ( c ) g_m(b)-g_m(c) g m ( b ) − g m ( c ) , contrary to the definition of a = a ( b ) a=a(b) a = a ( b ) . Therefore, exactly one sequence passes the test, and this sequence is b b b .
By Lemma V.3, one evaluation of g m g_m g m costs O q , k ( m 6 ( log m ) O ( 1 ) ) O_{q,k}(m^6(\log m)^{O(1)}) O q , k ( m 6 ( log m ) O ( 1 ) ) bit operations. There are O q , k ( m ) O_{q,k}(m) O q , k ( m ) candidates. Evaluating g m g_m g m on all of them therefore costs O q , k ( m 7 ( log m ) O ( 1 ) ) O_{q,k}(m^7(\log m)^{O(1)}) O q , k ( m 7 ( log m ) O ( 1 ) ) bit operations. Since g m ( c ) < P m 2 g_m(c)<P_m^2 g m ( c ) < P m 2 and a ≤ p T m a\le p_{T_m} a ≤ p T m , each remainder computation and comparison with r r r takes O q , k ( ( log m ) 2 ) O_{q,k}((\log m)^2) O q , k (( log m ) 2 ) bit operations. All these tests together take O q , k ( m ( log m ) 2 ) O_{q,k}(m(\log m)^2) O q , k ( m ( log m ) 2 ) bit operations. Therefore, the recovery procedure costs
O q , k ( m 2 log m ) + O q , k ( m 7 ( log m ) O ( 1 ) ) + O q , k ( m ( log m ) 2 ) = O q , k ( m 7 ( log m ) O ( 1 ) ) O_{q,k}(m^2\log m)+O_{q,k}\left(m^7(\log m)^{O(1)}\right)+O_{q,k}\left(m(\log m)^2\right)=O_{q,k}\left(m^7(\log m)^{O(1)}\right) O q , k ( m 2 log m ) + O q , k ( m 7 ( log m ) O ( 1 ) ) + O q , k ( m ( log m ) 2 ) = O q , k ( m 7 ( log m ) O ( 1 ) )
bit operations.
The Code for Local Recovery
Let W ≥ k W\ge k W ≥ k be a positive integer, and put m = 2 W m=2W m = 2 W and s = W = m / 2 s=W=m/2 s = W = m /2 . For each σ ∈ { 0 , s } \sigma\in\{0,s\} σ ∈ { 0 , s } , let r σ r_\sigma r σ be the unique integer in [ m ] [m] [ m ] for which σ + n + r σ \sigma+n+r_\sigma σ + n + r σ is divisible by m m m . For x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n , define
x ( σ ) = 0 σ x 0 r σ , b σ = σ + n + r σ m . x^{(\sigma)}=0^\sigma x0^{r_\sigma},\qquad b_\sigma=\frac{\sigma+n+r_\sigma}{m}. x ( σ ) = 0 σ x 0 r σ , b σ = m σ + n + r σ .
For j ∈ [ b σ ] j\in[b_\sigma] j ∈ [ b σ ] , the j j j -th length-m m m block of x ( σ ) x^{(\sigma)} x ( σ ) is
x j ( σ ) ≜ x [ ( j − 1 ) m + 1 , j m ] ( σ ) . x_j^{(\sigma)}\triangleq x^{(\sigma)}_{[(j-1)m+1,jm]}. x j ( σ ) ≜ x [( j − 1 ) m + 1 , j m ] ( σ ) .
The following lemma explains the use of two shifted block partitions.
Lemma V.6. Let [ i 1 , i 2 ] ⊆ [ n ] [i_1,i_2]\subseteq[n] [ i 1 , i 2 ] ⊆ [ n ] with i 2 − i 1 < W i_2-i_1<W i 2 − i 1 < W . There is σ ∈ { 0 , s } \sigma\in\{0,s\} σ ∈ { 0 , s } such that the shifted interval [ σ + i 1 , σ + i 2 ] [\sigma+i_1,\sigma+i_2] [ σ + i 1 , σ + i 2 ] lies in one length-m m m block of x ( σ ) x^{(\sigma)} x ( σ ) . In other words, there is some h ∈ [ b σ ] h\in[b_\sigma] h ∈ [ b σ ] such that [ σ + i 1 , σ + i 2 ] ⊆ [ ( h − 1 ) m + 1 , h m ] [\sigma+i_1,\sigma+i_2]\subseteq[(h-1)m+1,hm] [ σ + i 1 , σ + i 2 ] ⊆ [( h − 1 ) m + 1 , hm ] .
Proof: For each σ ∈ { 0 , s } \sigma\in\{0,s\} σ ∈ { 0 , s } , compute ⌊ ( i 1 + σ − 1 ) / m ⌋ \lfloor(i_1+\sigma-1)/m\rfloor ⌊( i 1 + σ − 1 ) / m ⌋ and ⌊ ( i 2 + σ − 1 ) / m ⌋ \lfloor(i_2+\sigma-1)/m\rfloor ⌊( i 2 + σ − 1 ) / m ⌋ . Choose a value of σ \sigma σ for which these two integers are equal (such a σ \sigma σ must exist), and let h h h be their common value plus one. Then the index h h h satisfies our requirement.
Recall a ( ⋅ ) a(\cdot) a ( ⋅ ) , r ( ⋅ ) r(\cdot) r ( ⋅ ) and A m A_m A m from (54). For σ ∈ { 0 , s } \sigma\in\{0,s\} σ ∈ { 0 , s } , define
f σ , m ( x ) = ∑ j = 1 b σ a ( x j ( σ ) ) ( m o d A m ) , g σ , m ( x ) = ∑ j = 1 b σ r ( x j ( σ ) ) ( m o d A m ) . (55) \begin{aligned}
f_{\sigma,m}(x)&=\sum_{j=1}^{b_\sigma}a\left(x_j^{(\sigma)}\right)\pmod{A_m},\\
g_{\sigma,m}(x)&=\sum_{j=1}^{b_\sigma}r\left(x_j^{(\sigma)}\right)\pmod{A_m}. \tag*{(55)}
\end{aligned} f σ , m ( x ) g σ , m ( x ) = j = 1 ∑ b σ a ( x j ( σ ) ) ( mod A m ) , = j = 1 ∑ b σ r ( x j ( σ ) ) ( mod A m ) . (55)
Lemma V.7. Let x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n and y y y be obtained from x x x by a k k k -substring edit. Suppose that an interval I = [ i 1 , i 2 ] ⊆ [ n ] I=[i_1,i_2]\subseteq[n] I = [ i 1 , i 2 ] ⊆ [ n ] of length at most W W W is known and that I I I covers the edit region in x x x . Then x x x is uniquely determined by y y y and ( f 0 , m ( x ) , g 0 , m ( x ) , f s , m ( x ) , g s , m ( x ) ) (f_{0,m}(x),g_{0,m}(x),f_{s,m}(x),g_{s,m}(x)) ( f 0 , m ( x ) , g 0 , m ( x ) , f s , m ( x ) , g s , m ( x )) .
The recovery takes O q , k ( n m 7 ( log m ) O ( 1 ) ) O_{q,k}(nm^7(\log m)^{O(1)}) O q , k ( n m 7 ( log m ) O ( 1 ) ) bit operations. In particular, if W = ( log n ) O q , k ( 1 ) W=(\log n)^{O_{q,k}(1)} W = ( log n ) O q , k ( 1 ) , this is at most n ( log n ) O q , k ( 1 ) n(\log n)^{O_{q,k}(1)} n ( log n ) O q , k ( 1 ) for all sufficiently large n n n .
Proof: Since the interval I I I is known, we can choose σ ∈ { 0 , s } \sigma\in\{0,s\} σ ∈ { 0 , s } and h ∈ [ b σ ] h\in[b_\sigma] h ∈ [ b σ ] as in Lemma V.6. Let y ( σ ) = 0 σ y 0 r σ y^{(\sigma)}=0^\sigma y0^{r_\sigma} y ( σ ) = 0 σ y 0 r σ . The sequence y ( σ ) y^{(\sigma)} y ( σ ) is obtained from x ( σ ) x^{(\sigma)} x ( σ ) by a k k k -substring edit. Moreover, the edit region in x ( σ ) x^{(\sigma)} x ( σ ) is covered by the block x h ( σ ) x_h^{(\sigma)} x h ( σ ) . Put d = ∣ y ∣ − ∣ x ∣ = ∣ y ∣ − n d=|y|-|x|=|y|-n d = ∣ y ∣ − ∣ x ∣ = ∣ y ∣ − n .
For j < h j<h j < h , the j j j -th block lies before the edit and therefore, x j ( σ ) = y [ ( j − 1 ) m + 1 , j m ] ( σ ) x_j^{(\sigma)}=y_{[(j-1)m+1,jm]}^{(\sigma)} x j ( σ ) = y [( j − 1 ) m + 1 , j m ] ( σ ) . For j > h j>h j > h , the j j j -th block lies after the edit and is shifted by d d d , implying x j ( σ ) = y [ ( j − 1 ) m + 1 + d , j m + d ] ( σ ) x_j^{(\sigma)}=y_{[(j-1)m+1+d,jm+d]}^{(\sigma)} x j ( σ ) = y [( j − 1 ) m + 1 + d , j m + d ] ( σ ) . Thus the receiver obtains every block except x h ( σ ) x_h^{(\sigma)} x h ( σ ) from y ( σ ) y^{(\sigma)} y ( σ ) and can compute a a a and r r r for all those blocks. It then follows from (55) that
a ( x h ( σ ) ) ≡ f σ , m ( x ) − ∑ j ≠ h a ( x j ( σ ) ) ( m o d A m ) , r ( x h ( σ ) ) ≡ g σ , m ( x ) − ∑ j ≠ h r ( x j ( σ ) ) ( m o d A m ) . (56) \begin{aligned}
a\left(x_h^{(\sigma)}\right)&\equiv f_{\sigma,m}(x)-\sum_{j\ne h}a\left(x_j^{(\sigma)}\right)\pmod{A_m},\\
r\left(x_h^{(\sigma)}\right)&\equiv g_{\sigma,m}(x)-\sum_{j\ne h}r\left(x_j^{(\sigma)}\right)\pmod{A_m}. \tag*{(56)}
\end{aligned} a ( x h ( σ ) ) r ( x h ( σ ) ) ≡ f σ , m ( x ) − j = h ∑ a ( x j ( σ ) ) ( mod A m ) , ≡ g σ , m ( x ) − j = h ∑ r ( x j ( σ ) ) ( mod A m ) . (56) Since a ( x h ( σ ) ) , r ( x h ( σ ) ) ∈ [ 0 , A m − 1 ] a\left(x_h^{(\sigma)}\right),r\left(x_h^{(\sigma)}\right)\in[0,A_m-1] a ( x h ( σ ) ) , r ( x h ( σ ) ) ∈ [ 0 , A m − 1 ] , the exact values of a ( x h ( σ ) ) a\left(x_h^{(\sigma)}\right) a ( x h ( σ ) ) and r ( x h ( σ ) ) r\left(x_h^{(\sigma)}\right) r ( x h ( σ ) ) are uniquely determined by (56).
Let ℓ = ( h − 1 ) m + 1 \ell=(h-1)m+1 ℓ = ( h − 1 ) m + 1 . Since the edit region in x ( σ ) x^{(\sigma)} x ( σ ) is covered by [ ℓ , ℓ + m − 1 ] [\ell,\ell+m-1] [ ℓ , ℓ + m − 1 ] , the sequence y [ ℓ , ℓ + m − 1 + d ] ( σ ) y^{(\sigma)}_{[\ell,\ell+m-1+d]} y [ ℓ , ℓ + m − 1 + d ] ( σ ) is obtained from x h ( σ ) x^{(\sigma)}_h x h ( σ ) by the same k k k -substring edit. By Lemma V.5, sequence y [ ℓ , ℓ + m − 1 + d ] ( σ ) y^{(\sigma)}_{[\ell,\ell+m-1+d]} y [ ℓ , ℓ + m − 1 + d ] ( σ ) and the recovered pair ( a ( x h ( σ ) ) , r ( x h ( σ ) ) ) \left(a\left(x^{(\sigma)}_h\right),r\left(x^{(\sigma)}_h\right)\right) ( a ( x h ( σ ) ) , r ( x h ( σ ) ) ) determine x h ( σ ) x^{(\sigma)}_h x h ( σ ) uniquely. Inserting that block among the already known blocks and deleting the σ \sigma σ left zeros and the r σ r_\sigma r σ right zeros recovers x x x .
We now analyze the bit complexity of the recovery procedure. By the proof of Lemma V.6 , determining σ \sigma σ and h h h requires only a constant number of additions and integer divisions on O ( log ( n + m ) ) O(\log(n+m)) O ( log ( n + m )) -bit integers, and hence takes O ( ( log ( n + m ) ) 2 ) O((\log(n+m))^2) O (( log ( n + m ) ) 2 ) bit operations.
We need to compute the syndrome H m H_m H m for the b σ − 1 b_\sigma-1 b σ − 1 known blocks. Since 1 ≤ r σ ≤ m 1\leq r_\sigma\leq m 1 ≤ r σ ≤ m and σ ∈ { 0 , m / 2 } \sigma\in\{0,m/2\} σ ∈ { 0 , m /2 } , we have b σ − 1 = ⌊ ( n + σ ) / m ⌋ ≤ 2 n / m b_\sigma-1=\lfloor(n+\sigma)/m\rfloor\leq2n/m b σ − 1 = ⌊( n + σ ) / m ⌋ ≤ 2 n / m . By Lemma V.5, computing the syndrome H m ( x j ( σ ) ) = ( a ( x j ( σ ) ) , r ( x j ( σ ) ) ) H_m\left(x^{(\sigma)}_j\right)=\left(a\left(x^{(\sigma)}_j\right),r\left(x^{(\sigma)}_j\right)\right) H m ( x j ( σ ) ) = ( a ( x j ( σ ) ) , r ( x j ( σ ) ) ) for one known block takes O q , k ( m 8 ( log m ) O ( 1 ) ) O_{q,k}(m^8(\log m)^{O(1)}) O q , k ( m 8 ( log m ) O ( 1 ) ) bit operations. There are at most 2 n / m 2n/m 2 n / m such blocks. Therefore, computing all these syndromes takes O q , k ( n m 7 ( log m ) O ( 1 ) ) O_{q,k}(nm^7(\log m)^{O(1)}) O q , k ( n m 7 ( log m ) O ( 1 ) ) bit operations.
To compute the two sums in (56), we reduce each partial sum modulo A m A_m A m after every addition. Thus, every partial sum remains in [ 0 , A m − 1 ] [0,A_m-1] [ 0 , A m − 1 ] . Since A m = O q , k ( m 2 ( log m ) 2 ) A_m=O_{q,k}(m^2(\log m)^2) A m = O q , k ( m 2 ( log m ) 2 ) , each addition involves O q , k ( log m ) O_{q,k}(\log m) O q , k ( log m ) -bit integers. Reduction requires at most one subtraction of A m A_m A m . Consequently, computing both sums and performing the two final modular subtractions in (56) takes O q , k ( b σ log m ) O_{q,k}(b_\sigma\log m) O q , k ( b σ log m ) bit operations.
With the recovered syndrome ( a ( x h ( σ ) ) , r ( x h ( σ ) ) ) \left(a\left(x^{(\sigma)}_h\right),r\left(x^{(\sigma)}_h\right)\right) ( a ( x h ( σ ) ) , r ( x h ( σ ) ) ) , Lemma V.5 recovers the missing block x h ( σ ) x^{(\sigma)}_h x h ( σ ) in O q , k ( m 7 ( log m ) O ( 1 ) ) O_{q,k}(m^7(\log m)^{O(1)}) O q , k ( m 7 ( log m ) O ( 1 ) ) bit operations. The padded sequences have length O ( n + m ) O(n+m) O ( n + m ) . Reading the known blocks, extracting the received sequence corresponding to the missing block, and assembling the recovered sequence can therefore be performed by sequential copying in O q , k ( n + m ) O_{q,k}(n+m) O q , k ( n + m ) bit operations. If the parameters P m P_m P m , T m T_m T m , and A m A_m A m have not already been computed, their computation takes O q , k ( m 3 ( log m ) O ( 1 ) ) O_{q,k}(m^3(\log m)^{O(1)}) O q , k ( m 3 ( log m ) O ( 1 ) ) bit operations, as established previously. Combining these costs gives the total recovery complexity O q , k ( n m 7 ( log m ) O ( 1 ) ) O_{q,k}(nm^7(\log m)^{O(1)}) O q , k ( n m 7 ( log m ) O ( 1 ) ) .
Finally, if W = ( log n ) O q , k ( 1 ) W=(\log n)^{O_{q,k}(1)} W = ( log n ) O q , k ( 1 ) , then m = 2 W = ( log n ) O q , k ( 1 ) m=2W=(\log n)^{O_{q,k}(1)} m = 2 W = ( log n ) O q , k ( 1 ) . The factor m 7 ( log m ) O ( 1 ) m^7(\log m)^{O(1)} m 7 ( log m ) O ( 1 ) is consequently bounded by ( log n ) O q , k ( 1 ) (\log n)^{O_{q,k}(1)} ( log n ) O q , k ( 1 ) for all sufficiently large n n n . This gives the stated bound n ( log n ) O q , k ( 1 ) n(\log n)^{O_{q,k}(1)} n ( log n ) O q , k ( 1 ) .
The Overall Code Construction
Recall the definition of W n , k W_{n,k} W n , k from (52) . In § 5 -B, set
W = W n , k , m = 2 W n , k , s = W n , k . W=W_{n,k},\quad m=2W_{n,k},\quad s=W_{n,k}. W = W n , k , m = 2 W n , k , s = W n , k .
Recall the definition of Loc e d i t ( x ) \operatorname{Loc}_{\mathrm{edit}}(x) Loc edit ( x ) from (51) . Define
Syn e d i t ( x ) = ( Loc e d i t ( x ) , f 0 , m ( x ) , g 0 , m ( x ) , f s , m ( x ) , g s , m ( x ) ) . \operatorname{Syn}_{\mathrm{edit}}(x)=\left(\operatorname{Loc}_{\mathrm{edit}}(x),f_{0,m}(x),g_{0,m}(x),f_{s,m}(x),g_{s,m}(x)\right). Syn edit ( x ) = ( Loc edit ( x ) , f 0 , m ( x ) , g 0 , m ( x ) , f s , m ( x ) , g s , m ( x ) ) .
Recall that D q , k ( n ) D_{q,k}(n) D q , k ( n ) is the set of all ( p k , ℓ n , k ) (p_k,\ell_{n,k}) ( p k , ℓ n , k ) -dense sequences in Σ q n \Sigma_q^n Σ q n . For each possible value θ \theta θ of this function, define
C e d i t ( n ; θ ) ≜ { x ∈ D q , k ( n ) : Syn e d i t ( x ) = θ } . \mathcal{C}_{\mathrm{edit}}(n;\theta)\triangleq\{x\in D_{q,k}(n):\operatorname{Syn}_{\mathrm{edit}}(x)=\theta\}. C edit ( n ; θ ) ≜ { x ∈ D q , k ( n ) : Syn edit ( x ) = θ } .
Theorem V.1. Fix q ≥ 2 q\geq2 q ≥ 2 and k ≥ 1 k\geq1 k ≥ 1 . For all sufficiently large n n n , every nonempty set C e d i t ( n ; θ ) \mathcal{C}_{\mathrm{edit}}(n;\theta) C edit ( n ; θ ) is a k k k -substring edit correcting code. The decoding uses at most n ( log n ) O q , k ( 1 ) n(\log n)^{O_{q,k}(1)} n ( log n ) O q , k ( 1 ) bit operations. Moreover, there is some θ \theta θ such that
red 2 ( C e d i t ( n ; θ ) ) ≤ log n + 8 log log n + 8 log log log n + O q , k ( 1 ) . \operatorname{red}_2(\mathcal{C}_{\mathrm{edit}}(n;\theta))\leq\log n+8\log\log n+8\log\log\log n+O_{q,k}(1). red 2 ( C edit ( n ; θ )) ≤ log n + 8 log log n + 8 log log log n + O q , k ( 1 ) .
Proof. Let x ∈ C e d i t ( n ; θ ) x\in\mathcal{C}_{\mathrm{edit}}(n;\theta) x ∈ C edit ( n ; θ ) , and let y y y be obtained from x x x by one k k k -substring edit. The syndrome Loc e d i t ( x ) \operatorname{Loc}_{\mathrm{edit}}(x) Loc edit ( x ) is part of the fixed value θ \theta θ . By Theorem IV.1, the receiver first determines whether y = x y=x y = x . If equality holds, it outputs y y y . Otherwise, Theorem IV.1 gives an interval of length at most W n , k W_{n,k} W n , k containing the edit region in x x x . The remaining four entries of θ \theta θ are exactly the four values required in Lemma V.7 , which then recovers x x x uniquely. Therefore, the code C e d i t ( n ; θ ) \mathcal{C}_{\mathrm{edit}}(n;\theta) C edit ( n ; θ ) is a k k k -substring edit correcting code.
Next, we estimate the decoding complexity. The receiver uses Theorem IV.1 to test for no error and, otherwise, to locate the edit. This costs O q , k ( n ( log n ) 2 ) O_{q,k}(n(\log n)^2) O q , k ( n ( log n ) 2 ) bit operations. For a nontrivial edit, Lemma V.7 recovers the sequence using O q , k ( n m 7 ( log m ) O ( 1 ) ) O_{q,k}(nm^7(\log m)^{O(1)}) O q , k ( n m 7 ( log m ) O ( 1 ) ) additional bit operations. That bound includes computing the known block syndromes, recovering the missing syndrome by modular subtraction, and recovering and inserting the missing block. For no error, copying the received sequence costs O q ( n ) O_q(n) O q ( n ) bit operations. Hence the same bound covers both cases. Substituting m = Θ q , k ( log n ) m=\Theta_{q,k}(\log n) m = Θ q , k ( log n ) gives the bound n ( log n ) O q , k ( 1 ) n(\log n)^{O_{q,k}(1)} n ( log n ) O q , k ( 1 ) .
To bound the redundancy, we need to bound the number of possible values of θ \theta θ . By (51) , the first component Loc e d i t ( x ) \operatorname{Loc}_{\mathrm{edit}}(x) Loc edit ( x ) has at most 5 M n , k R k ( 2 Λ q , k + 1 ) 2 5M_{n,k}R_k(2\Lambda_{q,k}+1)^2 5 M n , k R k ( 2 Λ q , k + 1 ) 2 values. Each of the remaining four components is a residue modulo A m A_m A m . Hence, the number of possible values of θ \theta θ is at most 5 M n , k R k ( 2 Λ q , k + 1 ) 2 A m 4 5M_{n,k}R_k(2\Lambda_{q,k}+1)^2A_m^4 5 M n , k R k ( 2 Λ q , k + 1 ) 2 A m 4 . By Lemma IV.1, ∣ D q , k ( n ) ∣ ≥ q n − 1 |D_{q,k}(n)|\geq q^{n-1} ∣ D q , k ( n ) ∣ ≥ q n − 1 . Therefore, the pigeonhole principle ensures that there is a choice of θ \theta θ such that
∣ C e d i t ( n ; θ ) ∣ ≥ q n − 1 5 M n , k R k ( 2 Λ q , k + 1 ) 2 A m 4 . |\mathcal{C}_{\mathrm{edit}}(n;\theta)|\geq\frac{q^{n-1}}{5M_{n,k}R_k(2\Lambda_{q,k}+1)^2A_m^4}. ∣ C edit ( n ; θ ) ∣ ≥ 5 M n , k R k ( 2 Λ q , k + 1 ) 2 A m 4 q n − 1 .
or equivalently,
red 2 ( C e d i t ( n ; θ ) ) ≤ log q + log ( 5 M n , k R k ( 2 Λ q , k + 1 ) 2 ) + 4 log A m ≤ log n + 8 log m + 8 log log m + O q , k ( 1 ) . \begin{aligned}
\operatorname{red}_2\left(\mathcal{C}_{\mathrm{edit}}(n;\theta)\right) \le\log q + \log\left(5M_{n,k}R_k\left(2\Lambda_{q,k}+1\right)^2\right) + 4\log A_m \\
&\le\log n + 8\log m + 8\log\log m + O_{q,k}(1).
\end{aligned} red 2 ( C edit ( n ; θ ) ) ≤ log q + log ( 5 M n , k R k ( 2 Λ q , k + 1 ) 2 ) + 4 log A m ≤ log n + 8 log m + 8 log log m + O q , k ( 1 ) .
Indeed, M n , k = Θ q , k ( n ) M_{n,k}=\Theta_{q,k}(n) M n , k = Θ q , k ( n ) , whereas R k R_k R k and 2 Λ q , k + 1 2\Lambda_{q,k}+1 2 Λ q , k + 1 are constants for fixed q , k q,k q , k , and A m = O q , k ( m 2 ( log m ) 2 ) A_m=O_{q,k}(m^2(\log m)^2) A m = O q , k ( m 2 ( log m ) 2 ) . By (32) , we have ℓ n , k = Θ q , k ( log n ) \ell_{n,k}=\Theta_{q,k}(\log n) ℓ n , k = Θ q , k ( log n ) . It follows from (35) and (52) that A n , k = Θ q , k ( log n ) A_{n,k}=\Theta_{q,k}(\log n) A n , k = Θ q , k ( log n ) and W n , k = Θ q , k ( log n ) W_{n,k}=\Theta_{q,k}(\log n) W n , k = Θ q , k ( log n ) . Hence m = Θ q , k ( log n ) m=\Theta_{q,k}(\log n) m = Θ q , k ( log n ) , and therefore
log m = log log n + O q , k ( 1 ) , log log m = log log log n + O q , k ( 1 ) , \log m=\log\log n+O_{q,k}(1),\qquad\log\log m=\log\log\log n+O_{q,k}(1), log m = log log n + O q , k ( 1 ) , log log m = log log log n + O q , k ( 1 ) ,
which proves the redundancy bound.
Codes Correcting One Unequal-Length k k k -Substring Edit
In Theorem V.1, we construct a k k k -substring edit correcting code with redundancy log n + O q , k ( log log n ) \log n+O_{q,k}(\log\log n) log n + O q , k ( log log n ) . For fixed q q q and k k k , the lower bound in (5) is log n − O q , k ( 1 ) \log n-O_{q,k}(1) log n − O q , k ( 1 ) . Thus the gap between these bounds is O q , k ( log log n ) O_{q,k}(\log\log n) O q , k ( log log n ) .
A k k k -substring edit may preserve the sequence length. In this section, we consider only edits that change it. We seek a code that allows us to recover any codeword x x x from any y ∈ E 1 , k ( x ) y\in E_{1,k}(x) y ∈ E 1 , k ( x ) satisfying ∣ y ∣ ≠ ∣ x ∣ |y|\ne|x| ∣ y ∣ = ∣ x ∣ . We call such a code an unequal-length k k k -substring edit correcting code, as defined below.
Definition VI.1. For x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n , define
E 1 , k ≠ ( x ) ≜ { z ∈ E 1 , k ( x ) : ∣ z ∣ ≠ n } . (57) E_{1,k}^{\ne}(x)\triangleq\{z\in E_{1,k}(x):|z|\ne n\}. \tag*{(57)} E 1 , k = ( x ) ≜ { z ∈ E 1 , k ( x ) : ∣ z ∣ = n } . (57)
A nonempty set C ⊆ Σ q n \mathcal{C}\subseteq\Sigma_q^n C ⊆ Σ q n is an unequal-length k k k -substring edit correcting code if E 1 , k ≠ ( x ) ∩ E 1 , k ≠ ( y ) = ∅ E_{1,k}^{\ne}(x)\cap E_{1,k}^{\ne}(y)=\varnothing E 1 , k = ( x ) ∩ E 1 , k = ( y ) = ∅ for any distinct x , y ∈ C x,y\in\mathcal{C} x , y ∈ C .
In this section, we will construct a length-n n n unequal-length k k k -substring edit correcting code with redundancy log n + O q , k ( 1 ) \log n+O_{q,k}(1) log n + O q , k ( 1 ) . Recall Definition II.1 and the representation in (2) . Recall that a ( ≤ t ) (\le t) ( ≤ t ) -burst-deletion or a ( t , T ) (t,T) ( t , T ) -localized deletion is a special k k k -substring edit by setting k = t k=t k = t and k = T k=T k = T , respectively. Our construction also gives a ( ≤ k ) (\le k) ( ≤ k ) -burst-deletion correcting code and a ( t , k ) (t,k) ( t , k ) -localized deletion correcting code.
The main result of this section is presented in Theorem VI.1. We first outline the main idea and explain the role of the unequal-length condition in § 6 -A. The results needed for the construction are then proved in § 6 -B to VI-D.
Outline of the Idea
The construction is motivated by the following observation: a periodic sequence can be recovered from its length and a prefix containing one full period.
For a sequence u ∈ Σ q m u\in\Sigma_q^m u ∈ Σ q m and an integer d ∈ [ m ] d\in[m] d ∈ [ m ] , we say that d d d is a period of u u u if u i = u i + d u_i=u_{i+d} u i = u i + d for every i ∈ [ m − d ] i\in[m-d] i ∈ [ m − d ] . Thus, a sequence with period d d d is determined by its length and its first d d d symbols. For example, let u = ( 01 ) r u=(01)^r u = ( 01 ) r with r ≥ 2 r\ge2 r ≥ 2 . Deleting any of the r r r displayed copies of 01 01 01 gives ( 01 ) r − 1 (01)^{r-1} ( 01 ) r − 1 . Although the deleted copy cannot be identified, the original sequence is determined once its length and the prefix 01 01 01 are known. This example shows that a long sequence need not require much recovery information if it has a fixed small period.
To use this observation for an arbitrary sequence x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n , we first identify where periodicity fails. Set ℓ ∗ = lcm ( 1 , … , k ) \ell_*=\operatorname{lcm}(1,\ldots,k) ℓ ∗ = lcm ( 1 , … , k ) , and call a coordinate i i i special if x i ≠ x i + ℓ ∗ x_i\ne x_{i+\ell_*} x i = x i + ℓ ∗ , where we set x i = 0 x_i=0 x i = 0 for i ∉ [ n ] i\notin[n] i ∈ / [ n ] . A special coordinate is a marker if its length-( ℓ ∗ + 1 ) (\ell_*+1) ( ℓ ∗ + 1 ) substring is lexicographically smaller than those at all other special coordinates within distance k k k . As will be shown in Lemma VI.1, since ℓ ∗ \ell_* ℓ ∗ is divisible by every integer in [ k ] [k] [ k ] , two length-( ℓ ∗ + 1 ) (\ell_*+1) ( ℓ ∗ + 1 ) substrings starting at special coordinates within distance k k k cannot be equal. Consequently, any two markers are at least k + 1 k+1 k + 1 apart. Moreover, every special coordinate is within a constant distance of a marker, where the constant depends only on q q q and k k k .
We partition 0 x 0x 0 x into segments at these markers. The properties above ensure that after removing a prefix and a suffix of suitable constant lengths from a long segment, the remaining middle of that segment has period ℓ ∗ \ell_* ℓ ∗ . The known prefix can therefore be extended periodically to recover the middle. Short segments are covered entirely by their recorded prefixes and suffixes. Consequently, every segment is determined by its length and its recorded prefix and suffix, which form its label . See Lemma VI.2 for details. Recovering x x x therefore reduces to recovering the marker positions, which determine all segment lengths, and the segment labels.
We record the marker positions of x x x in the binary sequence χ k ( x ) \chi_k(x) χ k ( x ) : for i ∈ [ n ] i\in[n] i ∈ [ n ] , χ k ( x ) i = 1 \chi_k(x)_i=1 χ k ( x ) i = 1 if and only if i i i is a marker of x x x . Then recovering the marker positions is equivalent to recovering χ k ( x ) \chi_k(x) χ k ( x ) . Let y y y be obtained from x x x by a k k k -substring edit, and set h = n − ∣ y ∣ h=n-|y| h = n − ∣ y ∣ . Since each marker decision depends only on a window of constant length, the k k k -substring edit can change marker decisions only near the edit region. Outside this neighborhood, the sequence χ k ( x ) \chi_k(x) χ k ( x ) has an unchanged prefix and a suffix shifted by h h h . More precisely, Lemma VI.3 shows that χ k ( y ) \chi_k(y) χ k ( y ) is obtained from χ k ( x ) \chi_k(x) χ k ( x ) by replacing T ∗ T_* T ∗ consecutive bits by T ∗ − h T_*-h T ∗ − h bits, where T ∗ = ℓ ∗ + 3 k T_*=\ell_*+3k T ∗ = ℓ ∗ + 3 k . We call this replacement a ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst error. An important observation is that χ k ( y ) \chi_k(y) χ k ( y ) is k k k -sparse: any two ones are separated by at least k k k zeros, since any two markers of y y y are at least k + 1 k+1 k + 1 positions apart.
Therefore, to recover χ k ( x ) \chi_k(x) χ k ( x ) , we need to correct a ( T ∗ , T ∗ − h ) (T_\ast,T_\ast-h) ( T ∗ , T ∗ − h ) -burst error for fixed T ∗ T_\ast T ∗ and every h ∈ [ − k , k ] ∖ { 0 } h \in[-k,k]\setminus\{0\} h ∈ [ − k , k ] ∖ { 0 } as long as the received sequence is k k k -sparse. In Proposition VI.1, we construct a syndrome representable by log n + O k ( 1 ) \log n+O_k(1) log n + O k ( 1 ) bits that allows this recovery. This is the first point in the construction where we use the unequal-length condition h ≠ 0 h\ne0 h = 0 . See the proof for details.
Once the marker sequence χ k ( x ) \chi_k(x) χ k ( x ) is recovered, all segment boundaries and lengths are known. It remains to recover the segment labels. We do this using a constant number of sums of labels. The key property is that any two possible original sequences with the recovered marker sequence and the same received sequence y y y can differ only among at most 2 U ∗ 2U_\ast 2 U ∗ consecutive segments, where U ∗ = T ∗ + k U_\ast=T_\ast+k U ∗ = T ∗ + k . This property also relies on the condition h ≠ 0 h\ne0 h = 0 . See Lemma VI.6 and its proof.
All segment labels are sequences over Σ q \Sigma_q Σ q of the same length, which depends only on q q q and k k k . To protect the labels, we assign them in order to 2 U ∗ 2U_\ast 2 U ∗ groups, returning to the first group after the last group. For each group, we store the sum of its labels, component-wise modulo q q q . Any 2 U ∗ 2U_\ast 2 U ∗ consecutive segments belong to different groups. Hence, when comparing two possible original sequences, each group contains at most one label that differs. Equality of the group sums therefore forces all labels to agree (see Proposition VI.2). The labels and the known segment lengths then determine x x x .
There are only a constant number of groups, and each label has constant length for fixed q , k q,k q , k . These label checks therefore use only O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bits. Together with the marker syndrome, they give a complete syndrome representable by log n + O q , k ( 1 ) \log n+O_{q,k}(1) log n + O q , k ( 1 ) bits, yielding the claimed redundancy.
Reduction of the Problem
In this section, we will frequently use the following parameters:
ℓ ∗ ≜ lcm ( 1 , … , k ) , D ∗ ≜ q ℓ ∗ ( q − 1 ) , B ∗ ≜ k ( D ∗ − 1 ) + ℓ ∗ + 1. (58) \ell_\ast\triangleq\operatorname{lcm}(1,\ldots,k),\qquad D_\ast\triangleq q^{\ell_\ast}(q-1),\qquad B_\ast\triangleq k(D_\ast-1)+\ell_\ast+1. \tag*{(58)} ℓ ∗ ≜ lcm ( 1 , … , k ) , D ∗ ≜ q ℓ ∗ ( q − 1 ) , B ∗ ≜ k ( D ∗ − 1 ) + ℓ ∗ + 1. (58)
Here, lcm ( 1 , … , k ) \operatorname{lcm}(1,\ldots,k) lcm ( 1 , … , k ) denotes the least common multiple of 1 , … , k 1,\ldots,k 1 , … , k . The choice of these parameters is justified in the proofs of Lemmas VI.1 and VI.2.
There is a natural order on symbols in Σ q \Sigma_q Σ q : 0 < 1 < ⋯ < q − 1 0<1<\cdots<q-1 0 < 1 < ⋯ < q − 1 . This order induces the lexicographic order on sequences of equal length over Σ q \Sigma_q Σ q . For any x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n , set x i = 0 x_i=0 x i = 0 for every i ∉ [ n ] i\notin[n] i ∈ / [ n ] . Symbols with indices outside [ n ] [n] [ n ] are defined only for computing the markers defined below.
Definition VI.2. Let x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n . A coordinate i ∈ Z i\in\mathbb{Z} i ∈ Z is called special (with respect to x x x ) if x i ≠ x i + ℓ ∗ x_i\ne x_{i+\ell_\ast} x i = x i + ℓ ∗ . A special coordinate i i i is called a marker of x x x if x [ i , i + ℓ ∗ ] < x [ j , j + ℓ ∗ ] x_{[i,i+\ell_\ast]}<x_{[j,j+\ell_\ast]} x [ i , i + ℓ ∗ ] < x [ j , j + ℓ ∗ ] for every special coordinate j j j satisfying 0 < ∣ j − i ∣ ≤ k 0<|j-i|\le k 0 < ∣ j − i ∣ ≤ k . In particular, a special coordinate is a marker if there is no other special coordinate within distance k k k from it.
Definition VI.3. Let x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n . We associate with it a binary sequence χ k ( x ) = χ 1 χ 2 ⋯ χ n \chi_k(x)=\chi_1\chi_2\cdots\chi_n χ k ( x ) = χ 1 χ 2 ⋯ χ n , which is defined as follows:
χ i = { 1 , if i is a marker , 0 , else . \chi_i=
\begin{cases}
1, & \text{if } i \text{ is a marker},\\
0, & \text{else}.
\end{cases} χ i = { 1 , 0 , if i is a marker , else . We call χ k ( x ) \chi_k(x) χ k ( x ) the marker sequence of x x x .
Since x i = 0 x_i=0 x i = 0 for every i ∉ [ n ] i\notin[n] i ∈ / [ n ] , all special coordinates belong to [ 1 − ℓ ∗ , n ] [1-\ell_\ast,n] [ 1 − ℓ ∗ , n ] . In particular, comparisons near the left end must include the special coordinates in [ 1 − ℓ ∗ , 0 ] [1-\ell_\ast,0] [ 1 − ℓ ∗ , 0 ] , although these coordinates are not recorded in χ k ( x ) \chi_k(x) χ k ( x ) . We present some examples to illustrate the above two definitions.
Example VI.1. Let q = 2 q=2 q = 2 , k = 1 k=1 k = 1 . Then ℓ ∗ = 1 \ell_\ast=1 ℓ ∗ = 1 .
For x = 001100 x=001100 x = 001100 , the special coordinates are 2 and 4, since x 2 ≠ x 3 x_2\ne x_3 x 2 = x 3 and x 4 ≠ x 5 x_4\ne x_5 x 4 = x 5 . The distance between the two special coordinates is 2 > k 2>k 2 > k , and so each is a marker. Hence χ 1 ( x ) = 010100 \chi_1(x)=010100 χ 1 ( x ) = 010100 .
For x = 100 x=100 x = 100 , the special coordinates are 0 and 1. Since 01 < 10 01<10 01 < 10 , coordinate 0 is a marker and coordinate 1 is not. Only markers in [ 3 ] [3] [ 3 ] are considered in the definition of the marker sequence, so χ 1 ( x ) = 000 \chi_1(x)=000 χ 1 ( x ) = 000 . This example shows that a coordinate outside [ n ] [n] [ n ] can affect whether a coordinate inside [ n ] [n] [ n ] is a marker.
Example VI.2. Let q = 3 q=3 q = 3 , k = 2 k=2 k = 2 , and x = 012012221 x=012012221 x = 012012221 . Then ℓ ∗ = 2 \ell_\ast=2 ℓ ∗ = 2 . The special coordinates and their corresponding sequences are given in the following table.
Table 1.
At each of 0, 4, 9, the sequence x [ i , i + 2 ] x_{[i,i+2]} x [ i , i + 2 ] is smaller than the sequence at every other special coordinate within distance two. Each of the remaining special coordinates has a smaller such neighbor. Thus the markers are 0, 4, 9, and χ 2 ( x ) = 000100001 \chi_2(x)=000100001 χ 2 ( x ) = 000100001 . Notice that x [ 1 , 3 ] = x [ 4 , 6 ] x_{[1,3]}=x_{[4,6]} x [ 1 , 3 ] = x [ 4 , 6 ] , but the distance between these two special coordinates is greater than k k k .
Definition VI.4. A binary sequence is called k k k -sparse if there are at least k k k symbols 0 between any two symbols 1.
The following lemma lists the three properties of markers that are critical in our construction.
Lemma VI.1. For every x ∈ Σ q n x \in\Sigma_q^n x ∈ Σ q n , the following statements hold.
(i) If i i i is special, then x [ i , i + ℓ ∗ ] ≠ x [ j , j + ℓ ∗ ] x_{[i,i+\ell_*]} \ne x_{[j,j+\ell_*]} x [ i , i + ℓ ∗ ] = x [ j , j + ℓ ∗ ] for any j ∈ Z j \in\mathbb{Z} j ∈ Z with 0 < ∣ i − j ∣ ≤ k 0 < |i-j| \le k 0 < ∣ i − j ∣ ≤ k . Moreover, χ k ( x ) \chi_k(x) χ k ( x ) is k k k -sparse.
(ii) For every special coordinate i i i , there is a marker j ∈ Z j \in\mathbb{Z} j ∈ Z such that ∣ i − j ∣ ≤ k ( D ∗ − 1 ) |i-j| \le k(D_* - 1) ∣ i − j ∣ ≤ k ( D ∗ − 1 ) .
(iii) Whether i i i is a marker is determined by x i − k , … , x i + ℓ ∗ + k x_{i-k},\ldots,x_{i+\ell_*+k} x i − k , … , x i + ℓ ∗ + k .
Proof: For (i), suppose x [ i , i + ℓ ∗ ] = x [ i + a , i + a + ℓ ∗ ] x_{[i,i+\ell_*]} = x_{[i+a,i+a+\ell_*]} x [ i , i + ℓ ∗ ] = x [ i + a , i + a + ℓ ∗ ] for some integer a a a with ∣ a ∣ ∈ [ k ] |a| \in[k] ∣ a ∣ ∈ [ k ] , where i i i is special. Then x i + r = x i + a + r x_{i+r} = x_{i+a+r} x i + r = x i + a + r for every r ∈ [ 0 , ℓ ∗ ] r \in[0,\ell_*] r ∈ [ 0 , ℓ ∗ ] . By (58), we have a ∣ ℓ ∗ a \mid\ell_* a ∣ ℓ ∗ . If a > 0 a > 0 a > 0 , then taking r = 0 , a , … , ℓ ∗ − a r = 0,a,\ldots,\ell_* - a r = 0 , a , … , ℓ ∗ − a gives x i = x i + a = ⋯ = x i + ℓ ∗ x_i = x_{i+a} = \cdots= x_{i+\ell_*} x i = x i + a = ⋯ = x i + ℓ ∗ . If a < 0 a < 0 a < 0 , then taking r = ℓ ∗ , ℓ ∗ + a , … , 0 r = \ell_*,\ell_*+a,\ldots,0 r = ℓ ∗ , ℓ ∗ + a , … , 0 gives x i + ℓ ∗ = x i + ℓ ∗ + a = ⋯ = x i x_{i+\ell_*} = x_{i+\ell_*+a} = \cdots= x_i x i + ℓ ∗ = x i + ℓ ∗ + a = ⋯ = x i . Both cases contradict the assumption that i i i is special. Thus the length-( ℓ ∗ + 1 ) (\ell_*+1) ( ℓ ∗ + 1 ) sequence corresponding to a special coordinate must be different from any length-( ℓ ∗ + 1 ) (\ell_*+1) ( ℓ ∗ + 1 ) sequence within distance at most k k k from it.
If two markers were at distance at most k k k , then, by Definition VI.2, each of their corresponding sequences would have to be strictly smaller than the other, which is impossible. Therefore, any two markers have distance at least k + 1 k+1 k + 1 , implying that χ k ( x ) \chi_k(x) χ k ( x ) is k k k -sparse.
For (ii), the number of length-( ℓ ∗ + 1 ) (\ell_*+1) ( ℓ ∗ + 1 ) sequences with different first and last symbols is q ⋅ q ℓ ∗ − 1 ( q − 1 ) = D ∗ q \cdot q^{\ell_*-1}(q-1) = D_* q ⋅ q ℓ ∗ − 1 ( q − 1 ) = D ∗ . If a special coordinate is not a marker, then, by (i) and Definition VI.2, there is another special coordinate within distance k k k whose corresponding sequence is strictly smaller. Starting from i i i , repeatedly choose such a coordinate. The corresponding sequences strictly decrease and belong to a set of size D ∗ D_* D ∗ . Hence this procedure stops at a marker after at most D ∗ − 1 D_* - 1 D ∗ − 1 choices. The total distance from i i i is at most k ( D ∗ − 1 ) k(D_* - 1) k ( D ∗ − 1 ) . This proves (ii).
For (iii), all sequences compared with x [ i , i + ℓ ∗ ] x_{[i,i+\ell_*]} x [ i , i + ℓ ∗ ] start in [ i − k , i + k ] [i-k,i+k] [ i − k , i + k ] and end in [ i − k + ℓ ∗ , i + k + ℓ ∗ ] [i-k+\ell_*,i+k+\ell_*] [ i − k + ℓ ∗ , i + k + ℓ ∗ ] . Thus the symbols in [ i − k , i + ℓ ∗ + k ] [i-k,i+\ell_*+k] [ i − k , i + ℓ ∗ + k ] determine the special coordinates being compared and all the comparisons. ■
Let x ∈ Σ q n x \in\Sigma_q^n x ∈ Σ q n , and s 1 < ⋯ < s w s_1 < \cdots< s_w s 1 < ⋯ < s w be the marker coordinates of x x x in [ n ] [n] [ n ] . Set s 0 = 0 s_0 = 0 s 0 = 0 and s w + 1 = n + 1 s_{w+1} = n+1 s w + 1 = n + 1 . For j ∈ [ 0 , w ] j \in[0,w] j ∈ [ 0 , w ] , define the segment u j x ≜ x [ s j , s j + 1 − 1 ] u_j^x \triangleq x_{[s_j,s_{j+1}-1]} u j x ≜ x [ s j , s j + 1 − 1 ] , using x 0 = 0 x_0 = 0 x 0 = 0 . These segments are nonempty and satisfy u 0 x ⋯ u w x = 0 x u_0^x \cdots u_w^x = 0x u 0 x ⋯ u w x = 0 x . Notice that if w = 0 w = 0 w = 0 , then there is only one segment: 0 x 0x 0 x .
For a sequence u ∈ Σ q m u \in\Sigma_q^m u ∈ Σ q m where m ≥ 1 m \ge1 m ≥ 1 , let d = min { m , B ∗ } d = \min\{m,B_*\} d = min { m , B ∗ } and define
Lab ( u ) ≜ u [ 1 , d ] 0 B ∗ − d u [ m − d + 1 , m ] 0 B ∗ − d , \operatorname{Lab}(u) \triangleq u_{[1,d]}0^{B_*-d}u_{[m-d+1,m]}0^{B_*-d}, Lab ( u ) ≜ u [ 1 , d ] 0 B ∗ − d u [ m − d + 1 , m ] 0 B ∗ − d ,
which is a sequence in Σ q 2 B ∗ \Sigma_q^{2B_*} Σ q 2 B ∗ . We call Lab ( u ) \operatorname{Lab}(u) Lab ( u ) the label of u u u . Clearly, the label records the longest prefix and suffix of length at most B ∗ B_* B ∗ , with each padded on the right to length B ∗ B_* B ∗ .
Example VI.3. For the sequence in Example VI.2, the markers in [ 9 ] [9] [ 9 ] are 4 and 9, so the segments are u 0 x = 0012 u_0^x = 0012 u 0 x = 0012 , u 1 x = 01222 u_1^x = 01222 u 1 x = 01222 , and u 2 x = 1 u_2^x = 1 u 2 x = 1 . Since B ∗ = 37 B_* = 37 B ∗ = 37 , the label of u 0 x u_0^x u 0 x is Lab ( u 0 x ) = 0012 0 33 0012 0 33 \operatorname{Lab}(u_0^x) = 0012\,0^{33}0012\,0^{33} Lab ( u 0 x ) = 0012 0 33 0012 0 33 .
In the above example, it is easy to see that the segment can be read immediately from its label. More generally, we can establish the following lemma.
Lemma VI.2. Every segment u j x u_j^x u j x is uniquely determined by its length ∣ u j x ∣ |u_j^x| ∣ u j x ∣ and its label Lab ( u j x ) \operatorname{Lab}(u_j^x) Lab ( u j x ) .
Proof: Let m = ∣ u j x ∣ m = |u_j^x| m = ∣ u j x ∣ and d = min { m , B ∗ } d = \min\{m,B_*\} d = min { m , B ∗ } . If m ≤ 2 B ∗ m \le2B_* m ≤ 2 B ∗ , then m − d ≤ d m-d \le d m − d ≤ d . Now the conclusion is clear from the definition of Lab ( u j x ) \operatorname{Lab}(u_j^x) Lab ( u j x ) . Next, assume m > 2 B ∗ m > 2B_* m > 2 B ∗ . Then d = B ∗ d = B_* d = B ∗ .
Recall that u j x = x s j ⋯ x s j + 1 − 1 u_j^x = x_{s_j}\cdots x_{s_{j+1}-1} u j x = x s j ⋯ x s j + 1 − 1 . We can obtain x [ s j , s j + B ∗ − 1 ] x_{[s_j,s_j+B_*-1]} x [ s j , s j + B ∗ − 1 ] and x [ s j + 1 − B ∗ , s j + 1 − 1 ] x_{[s_{j+1}-B_*,s_{j+1}-1]} x [ s j + 1 − B ∗ , s j + 1 − 1 ] immediately from Lab ( u j x ) \operatorname{Lab}(u_j^x) Lab ( u j x ) . It remains to determine the unknown part x [ s j + B ∗ , s j + 1 − B ∗ − 1 ] x_{[s_j+B_*,s_{j+1}-B_*-1]} x [ s j + B ∗ , s j + 1 − B ∗ − 1 ] . We claim that
x i = x i − ℓ ∗ (59) x_i = x_{i-\ell_*} \tag*{(59)} x i = x i − ℓ ∗ (59) for every i ∈ [ s j + B ∗ , s j + 1 − B ∗ − 1 ] i \in[s_j+B_*,s_{j+1}-B_*-1] i ∈ [ s j + B ∗ , s j + 1 − B ∗ − 1 ] . Suppose on the contrary that there is an i ∈ [ s j + B ∗ , s j + 1 − B ∗ − 1 ] i \in[s_j+B_*,s_{j+1}-B_*-1] i ∈ [ s j + B ∗ , s j + 1 − B ∗ − 1 ] such that x i ≠ x i − ℓ ∗ x_i \ne x_{i-\ell_*} x i = x i − ℓ ∗ . Then the index i − ℓ ∗ i-\ell_* i − ℓ ∗ is special with respect to x x x . According to Lemma VI.1 (ii), there is a marker in the interval [ i − ℓ ∗ − k ( D ∗ − 1 ) , i − ℓ ∗ + k ( D ∗ − 1 ) ] [i-\ell_* - k(D_* - 1),i-\ell_*+k(D_* - 1)] [ i − ℓ ∗ − k ( D ∗ − 1 ) , i − ℓ ∗ + k ( D ∗ − 1 )] . Since i ∈ [ s j + B ∗ , s j + 1 − B ∗ − 1 ] i \in[s_j+B_*,s_{j+1}-B_* - 1] i ∈ [ s j + B ∗ , s j + 1 − B ∗ − 1 ] and B ∗ = k ( D ∗ − 1 ) + ℓ ∗ + 1 B_* = k(D_* - 1)+\ell_*+1 B ∗ = k ( D ∗ − 1 ) + ℓ ∗ + 1 , we have [ i − ℓ ∗ − k ( D ∗ − 1 ) , i − ℓ ∗ + k ( D ∗ − 1 ) ] ⊆ [ s j + 1 , s j + 1 − 1 ] [i-\ell_* - k(D_* - 1),i-\ell_*+k(D_* - 1)] \subseteq[s_j+1,s_{j+1}-1] [ i − ℓ ∗ − k ( D ∗ − 1 ) , i − ℓ ∗ + k ( D ∗ − 1 )] ⊆ [ s j + 1 , s j + 1 − 1 ] . However, by the definition of s 0 , s 1 , … , s w + 1 s_0,s_1,\ldots,s_{w+1} s 0 , s 1 , … , s w + 1 , there is no marker in [ s j + 1 , s j + 1 − 1 ] [s_j+1,s_{j+1}-1] [ s j + 1 , s j + 1 − 1 ] for any j ∈ [ 0 , w ] j \in[0,w] j ∈ [ 0 , w ] . This proves (59).
Now the substring x [ s j + B ∗ , s j + 1 − B ∗ − 1 ] x_{[s_j+B_*,s_{j+1}-B_*-1]} x [ s j + B ∗ , s j + 1 − B ∗ − 1 ] can be recovered from x [ s j , s j + B ∗ − 1 ] x_{[s_j,s_j+B_*-1]} x [ s j , s j + B ∗ − 1 ] by (59), since B ∗ ≥ ℓ ∗ B_* \ge\ell_* B ∗ ≥ ℓ ∗ . This completes the proof. ■
The case ∣ u j x ∣ ≥ 2 B ∗ |u_j^x| \ge2B_* ∣ u j x ∣ ≥ 2 B ∗ is illustrated in Figure 4 .
Suppose that x ∈ Σ q n x \in\Sigma_q^n x ∈ Σ q n and x → k y x \to_k y x → k y . Recovering x x x from y y y is equivalent to recovering the segments u 0 x , u 1 x , … , u w x u_0^x,u_1^x,\ldots,u_w^x u 0 x , u 1 x , … , u w x from y y y . By Lemma VI.2, it is sufficient to recover ∣ u j x ∣ |u_j^x| ∣ u j x ∣ and Lab ( u j x ) \operatorname{Lab}(u_j^x) Lab ( u j x ) for every j ∈ [ 0 , w ] j \in[0,w] j ∈ [ 0 , w ] . Since the lengths of these segments u 0 x , u 1 x , … , u w x u_0^x,u_1^x,\ldots,u_w^x u 0 x , u 1 x , … , u w x are determined by the markers s 1 , … , s w s_1,\ldots,s_w s 1 , … , s w of x x x in [ n ] [n] [ n ] , and these markers are in turn determined by χ k ( x ) \chi_k(x) χ k ( x ) , recovering x x x reduces to recovering the marker sequence χ k ( x ) \chi_k(x) χ k ( x ) and the labels Lab ( u 0 x ) , Lab ( u 1 x ) , … , Lab ( u w x ) \operatorname{Lab}(u_0^x),\operatorname{Lab}(u_1^x),\ldots,\operatorname{Lab}(u_w^x) Lab ( u 0 x ) , Lab ( u 1 x ) , … , Lab ( u w x ) from y y y .
In the next subsection, we will design a code that corrects the errors on χ k ( x ) \chi_k(x) χ k ( x ) . The recovery of the labels Lab ( u 0 x ) , Lab ( u 1 x ) , … , Lab ( u w x ) \operatorname{Lab}(u_0^x),\operatorname{Lab}(u_1^x),\ldots,\operatorname{Lab}(u_w^x) Lab ( u 0 x ) , Lab ( u 1 x ) , … , Lab ( u w x ) is done in Section VI-D.
Figure 4. Recovery of a segment u x u^x u x of length greater than 2 B ∗ 2B_* 2 B ∗ . The two green parts are recorded in the label. The symbols in the red part are recovered in increasing order using x i = x i − ℓ ∗ x_i=x_{i-\ell_*} x i = x i − ℓ ∗ .
Recovery of the Marker Sequence
In order to give a code that corrects the errors in χ k ( x ) \chi_k(x) χ k ( x ) , we need to understand how a k k k -substring edit changes the marker sequence. The following definition is necessary.
Definition VI.5. Let r 1 , r 2 ≥ 0 r_1,r_2 \ge0 r 1 , r 2 ≥ 0 be integers with r 1 + r 2 > 0 r_1+r_2>0 r 1 + r 2 > 0 . Let α ∈ Σ n \alpha\in\Sigma^n α ∈ Σ n where n ≥ r 1 n \ge r_1 n ≥ r 1 , and p ∈ [ 1 , n − r 1 + 1 ] p \in[1,n-r_1+1] p ∈ [ 1 , n − r 1 + 1 ] . A sequence β ∈ Σ n − r 1 + r 2 \beta\in\Sigma^{n-r_1+r_2} β ∈ Σ n − r 1 + r 2 is obtained from α \alpha α by an ( r 1 , r 2 ) (r_1,r_2) ( r 1 , r 2 ) -burst error at position p p p , if β j = α j \beta_j=\alpha_j β j = α j for every j < p j<p j < p and β j = α j + r 1 − r 2 \beta_j=\alpha_{j+r_1-r_2} β j = α j + r 1 − r 2 for every j ≥ p + r 2 j \ge p+r_2 j ≥ p + r 2 . Thus the error replaces r 1 r_1 r 1 consecutive symbols by a sequence of length r 2 r_2 r 2 at the same position.
In the rest of this section, we will use the following parameters:
T ∗ ≜ ℓ ∗ + 3 k , U ∗ ≜ T ∗ + k , E ∗ ≜ 2 U ∗ ( U ∗ − 1 ) + k ( k − 1 ) , T_* \triangleq\ell_*+3k,\quad U_* \triangleq T_*+k,\quad E_* \triangleq2U_*(U_*-1)+k(k-1), T ∗ ≜ ℓ ∗ + 3 k , U ∗ ≜ T ∗ + k , E ∗ ≜ 2 U ∗ ( U ∗ − 1 ) + k ( k − 1 ) ,
M n , ∗ ≜ ( U ∗ + k ) n + E ∗ , K ∗ ≜ ( k + 1 ) E ∗ + k ( k − 1 ) + U ∗ . (60) M_{n,*} \triangleq(U_*+k)n+E_*,\quad K_* \triangleq(k+1)E_*+k(k-1)+U_*. \tag*{(60)} M n , ∗ ≜ ( U ∗ + k ) n + E ∗ , K ∗ ≜ ( k + 1 ) E ∗ + k ( k − 1 ) + U ∗ . (60)
The choice of these parameters will be justified in the proofs of Lemma VI.3, Lemma VI.4 and Proposition VI.1.
Lemma VI.3. Let n ≥ T ∗ n \ge T_* n ≥ T ∗ , x ∈ Σ q n x \in\Sigma_q^n x ∈ Σ q n and x → k y x \to_k y x → k y . Represent x x x and y y y as in (2) with the convention in (3). Denote i = ∣ u ∣ + 1 i=|u|+1 i = ∣ u ∣ + 1 , s = ∣ s ∣ s=|s| s = ∣ s ∣ and t = ∣ t ∣ t=|t| t = ∣ t ∣ . Let h = s − t h=s-t h = s − t . Then χ k ( y ) \chi_k(y) χ k ( y ) is obtained from χ k ( x ) \chi_k(x) χ k ( x ) by a ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst error at some position p ∈ [ 1 , n − T ∗ + 1 ] p \in[1,n-T_*+1] p ∈ [ 1 , n − T ∗ + 1 ] . The position p p p can be chosen so that i ∈ [ p , p + T ∗ − s ] i \in[p,p+T_*-s] i ∈ [ p , p + T ∗ − s ] or equivalently, the interval [ p , p + T ∗ − 1 ] [p,p+T_*-1] [ p , p + T ∗ − 1 ] covers the edit region in x x x .
Proof. By assumption, it holds that y j = x j y_j=x_j y j = x j when j < i j<i j < i and y j = x j + h y_j=x_{j+h} y j = x j + h when j ≥ i + t j \ge i+t j ≥ i + t . Then by Lemma VI.1 (iii), we have
χ k ( y ) j = { χ k ( x ) j , j < i − ℓ ∗ − k , χ k ( x ) j + h , j ≥ i + t + k . (61) \chi_k(y)_j =
\begin{cases}
\chi_k(x)_j, & j<i-\ell_*-k,\\
\chi_k(x)_{j+h}, & j\ge i+t+k.
\end{cases} \tag*{(61)} χ k ( y ) j = { χ k ( x ) j , χ k ( x ) j + h , j < i − ℓ ∗ − k , j ≥ i + t + k . (61)
Let u = max { 1 , i − ℓ ∗ − k } u=\max\{1,i-\ell_*-k\} u = max { 1 , i − ℓ ∗ − k } and v = min { n , i + s + k − 1 } v=\min\{n,i+s+k-1\} v = min { n , i + s + k − 1 } . Then [ u , v ] = [ i − ℓ ∗ − k , i + s + k − 1 ] ∩ [ n ] [u,v]=[i-\ell_*-k,i+s+k-1]\cap[n] [ u , v ] = [ i − ℓ ∗ − k , i + s + k − 1 ] ∩ [ n ] and v − u + 1 ≤ ℓ ∗ + 2 k + s ≤ T ∗ v-u+1\le\ell_*+2k+s\le T_* v − u + 1 ≤ ℓ ∗ + 2 k + s ≤ T ∗ . (61) implies that all errors in χ k ( x ) \chi_k(x) χ k ( x ) occurred in the interval [ u , v ] [u,v] [ u , v ] . Notice that ∣ χ k ( y ) ∣ = ∣ χ k ( x ) ∣ − h |\chi_k(y)|=|\chi_k(x)|-h ∣ χ k ( y ) ∣ = ∣ χ k ( x ) ∣ − h . Then by Definition VI.5, to prove this lemma, it suffices to find an index p ∈ [ 1 , n − T ∗ + 1 ] p\in[1,n-T_*+1] p ∈ [ 1 , n − T ∗ + 1 ] , such that [ u , v ] ⊆ [ p , p + T ∗ − 1 ] [u,v]\subseteq[p,p+T_*-1] [ u , v ] ⊆ [ p , p + T ∗ − 1 ] and i ∈ [ p , p + T ∗ − s ] i\in[p,p+T_*-s] i ∈ [ p , p + T ∗ − s ] .
Set p = min { u , n − T ∗ + 1 } p=\min\{u,n-T_*+1\} p = min { u , n − T ∗ + 1 } . If p = u p=u p = u , then v ≤ u + T ∗ − 1 = p + T ∗ − 1 v\le u+T_*-1=p+T_*-1 v ≤ u + T ∗ − 1 = p + T ∗ − 1 . If p = n − T ∗ + 1 p=n-T_*+1 p = n − T ∗ + 1 , then v ≤ n = p + T ∗ − 1 v\le n=p+T_*-1 v ≤ n = p + T ∗ − 1 . In either case, we have [ u , v ] ⊆ [ p , p + T ∗ − 1 ] [u,v]\subseteq[p,p+T_*-1] [ u , v ] ⊆ [ p , p + T ∗ − 1 ] .
Now it remains to show i ∈ [ p , p + T ∗ − s ] i\in[p,p+T_*-s] i ∈ [ p , p + T ∗ − s ] . First, notice that u = max { 1 , i − ℓ ∗ − k } u=\max\{1,i-\ell_*-k\} u = max { 1 , i − ℓ ∗ − k } , p ≤ u p\le u p ≤ u , and i , ℓ ∗ , k ≥ 1 i,\ell_*,k\ge1 i , ℓ ∗ , k ≥ 1 . This gives p ≤ i p\le i p ≤ i . By the definition of a k k k -substring edit, we have 1 ≤ i + s ≤ n + 1 1\le i+s\le n+1 1 ≤ i + s ≤ n + 1 . If i + s ≤ n i+s\le n i + s ≤ n , then i + s ≤ v < p + T ∗ i+s\le v<p+T_* i + s ≤ v < p + T ∗ , since k ≥ 1 k\ge1 k ≥ 1 . If i + s = n + 1 i+s=n+1 i + s = n + 1 , then v = n v=n v = n and p + T ∗ = n + 1 ≥ i + s p+T_*=n+1\ge i+s p + T ∗ = n + 1 ≥ i + s . Now the proof is completed. ▪
By Lemma VI.3, the recovery of χ k ( x ) \chi_k(x) χ k ( x ) requires correction of a ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst error for every h ∈ [ − k , k ] ∖ { 0 } h\in[-k,k]\setminus\{0\} h ∈ [ − k , k ] ∖ { 0 } . For every fixed r 1 r_1 r 1 and r 2 r_2 r 2 with r 1 ≠ r 2 r_1\ne r_2 r 1 = r 2 , Sun et al. constructed length-n n n codes that can correct a ( r 1 , r 2 ) (r_1,r_2) ( r 1 , r 2 ) -burst-error [10 Theorem 9] . The redundancy of this code is log n + O r 1 , r 2 ( 1 ) \log n+O_{r_1,r_2}(1) log n + O r 1 , r 2 ( 1 ) . Intersecting 2 k 2k 2 k of these codes (i.e., set r 1 = T ∗ r_1=T_* r 1 = T ∗ and let r 2 r_2 r 2 range over [ T ∗ − k , T ∗ + k ] ∖ { T ∗ } [T_*-k,T_*+k]\setminus\{T_*\} [ T ∗ − k , T ∗ + k ] ∖ { T ∗ } ) gives a trivial code satisfying our requirement. However, the redundancy of this trivial code is as large as 2 k log n + O k ( 1 ) 2k\log n+O_k(1) 2 k log n + O k ( 1 ) .
In Proposition VI.1 below, we instead construct a syndrome H n # H_n^\# H n # representable by log n + O k ( 1 ) \log n+O_k(1) log n + O k ( 1 ) bits, which enables the recovery of χ k ( x ) \chi_k(x) χ k ( x ) from χ k ( y ) \chi_k(y) χ k ( y ) for every 1 ≤ ∣ h ∣ ≤ k 1\le|h|\le k 1 ≤ ∣ h ∣ ≤ k . This construction heavily relies on the k k k -sparse property of χ k ( y ) \chi_k(y) χ k ( y ) , which was proved in Lemma VI.1.
The next two lemmas are useful in the proof of Proposition VI.1. Recall the functions VT ( ⋅ ) \operatorname{VT}(\cdot) VT ( ⋅ ) and wt L 1 ( ⋅ ) \operatorname{wt}_{L_1}(\cdot) wt L 1 ( ⋅ ) defined in (1).
Lemma VI.4. Suppose that β \beta β is obtained from α ∈ Σ 2 n \alpha\in\Sigma_2^n α ∈ Σ 2 n by a ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst-error at position p p p , where 1 ≤ ∣ h ∣ ≤ k 1\le|h|\le k 1 ≤ ∣ h ∣ ≤ k . Put Δ L 1 = wt L 1 ( α ) − wt L 1 ( β ) \Delta_{L_1}=\operatorname{wt}_{L_1}(\alpha)-\operatorname{wt}_{L_1}(\beta) Δ L 1 = wt L 1 ( α ) − wt L 1 ( β ) . Then
VT ( α ) − VT ( β ) = p Δ L 1 + h ∑ i = p + 1 n − h β i + δ p , (62) \operatorname{VT}(\alpha)-\operatorname{VT}(\beta)=p\Delta_{L_1}+h\sum_{i=p+1}^{n-h}\beta_i+\delta_p, \tag*{(62)} VT ( α ) − VT ( β ) = p Δ L 1 + h i = p + 1 ∑ n − h β i + δ p , (62) where
δ p = ∑ i = 1 T ∗ − 1 i α p + i − ∑ i = 1 T ∗ − h − 1 ( i + h ) β p + i . \delta_p=\sum_{i=1}^{T_*-1}i\alpha_{p+i}-\sum_{i=1}^{T_*-h-1}(i+h)\beta_{p+i}. δ p = i = 1 ∑ T ∗ − 1 i α p + i − i = 1 ∑ T ∗ − h − 1 ( i + h ) β p + i .
Clearly, it holds that ∣ δ p ∣ ≤ E ∗ / 2 |\delta_p| \le E_*/2 ∣ δ p ∣ ≤ E ∗ /2 .
Proof. By assumption, we have β i = α i \beta_i=\alpha_i β i = α i for every i < p i<p i < p , and β i = α i + h \beta_i=\alpha_{i+h} β i = α i + h for every i ≥ p + T ∗ − h i\ge p+T_*-h i ≥ p + T ∗ − h . Then it follows from the definition of the function VT \operatorname{VT} VT that
VT ( α ) − VT ( β ) = ∑ i = p p + T ∗ − 1 i α i + ∑ i = p + T ∗ n i α i − ∑ i = p p + T ∗ − h − 1 i β i − ∑ i = p + T ∗ − h n − h i β i = p ( ∑ i = p p + T ∗ − 1 α i − ∑ i = p p + T ∗ − h − 1 β i ) + ∑ i = 1 T ∗ − 1 i α p + i − ∑ i = 1 T ∗ − h − 1 i β p + i + h ∑ i = p + T ∗ − h n − h β i = p Δ L 1 + ∑ i = 1 T ∗ − 1 i α p + i − ∑ i = 1 T ∗ − h − 1 ( i + h ) β p + i + h ∑ i = p + 1 n − h β i = p Δ L 1 + h ∑ i = p + 1 n − h β i + δ p . \begin{aligned}
\operatorname{VT}(\alpha)-\operatorname{VT}(\beta)
&=\sum_{i=p}^{p+T_*-1}i\alpha_i+\sum_{i=p+T_*}^{n}i\alpha_i-\sum_{i=p}^{p+T_*-h-1}i\beta_i-\sum_{i=p+T_*-h}^{n-h}i\beta_i\\
&=p\left(\sum_{i=p}^{p+T_*-1}\alpha_i-\sum_{i=p}^{p+T_*-h-1}\beta_i\right)+\sum_{i=1}^{T_*-1}i\alpha_{p+i}-\sum_{i=1}^{T_*-h-1}i\beta_{p+i}+h\sum_{i=p+T_*-h}^{n-h}\beta_i\\
&=p\Delta_{L_1}+\sum_{i=1}^{T_*-1}i\alpha_{p+i}-\sum_{i=1}^{T_*-h-1}(i+h)\beta_{p+i}+h\sum_{i=p+1}^{n-h}\beta_i\\
&=p\Delta_{L_1}+h\sum_{i=p+1}^{n-h}\beta_i+\delta_p.
\end{aligned} VT ( α ) − VT ( β ) = i = p ∑ p + T ∗ − 1 i α i + i = p + T ∗ ∑ n i α i − i = p ∑ p + T ∗ − h − 1 i β i − i = p + T ∗ − h ∑ n − h i β i = p ( i = p ∑ p + T ∗ − 1 α i − i = p ∑ p + T ∗ − h − 1 β i ) + i = 1 ∑ T ∗ − 1 i α p + i − i = 1 ∑ T ∗ − h − 1 i β p + i + h i = p + T ∗ − h ∑ n − h β i = p Δ L 1 + i = 1 ∑ T ∗ − 1 i α p + i − i = 1 ∑ T ∗ − h − 1 ( i + h ) β p + i + h i = p + 1 ∑ n − h β i = p Δ L 1 + h i = p + 1 ∑ n − h β i + δ p .
Finally, since
∣ ∑ i = 1 T ∗ − 1 i α p + i ∣ ≤ ∑ i = 1 T ∗ − 1 i = ( T ∗ 2 ) , \left|\sum_{i=1}^{T_*-1}i\alpha_{p+i}\right|\le\sum_{i=1}^{T_*-1}i=\binom{T_*}{2}, i = 1 ∑ T ∗ − 1 i α p + i ≤ i = 1 ∑ T ∗ − 1 i = ( 2 T ∗ ) ,
∣ ∑ i = 1 T ∗ − h − 1 ( i + h ) β p + i ∣ ≤ ∑ i = 1 T ∗ − h − 1 ( i + k ) = ( T ∗ + 3 k ) ( T ∗ + k − 1 ) 2 , \left|\sum_{i=1}^{T_*-h-1}(i+h)\beta_{p+i}\right|\le\sum_{i=1}^{T_*-h-1}(i+k)=\frac{(T_*+3k)(T_*+k-1)}{2}, i = 1 ∑ T ∗ − h − 1 ( i + h ) β p + i ≤ i = 1 ∑ T ∗ − h − 1 ( i + k ) = 2 ( T ∗ + 3 k ) ( T ∗ + k − 1 ) ,
we conclude that ∣ δ p ∣ ≤ U ∗ ( U ∗ − 1 ) + ( k 2 ) = E ∗ / 2 |\delta_p|\le U_*(U_*-1)+\binom{k}{2}=E_*/2 ∣ δ p ∣ ≤ U ∗ ( U ∗ − 1 ) + ( 2 k ) = E ∗ /2 .
Lemma VI.5. (cf. [10 Lemma 4] ) Let a , b ∈ Z ≥ 0 n \mathbf{a},\mathbf{b}\in\mathbb{Z}_{\ge0}^n a , b ∈ Z ≥ 0 n , and let K , Q K,Q K , Q be positive integers. Suppose that ∣ a i − b i ∣ < Q |a_i-b_i|<Q ∣ a i − b i ∣ < Q for every i ∈ [ n ] i\in[n] i ∈ [ n ] , and ∑ i ∈ [ n ] : i ≡ r ( m o d K ) a i ≡ ∑ i ∈ [ n ] : i ≡ r ( m o d K ) b i ( m o d Q ) \sum_{i\in[n]:\,i\equiv r\pmod K}a_i\equiv\sum_{i\in[n]:\,i\equiv r\pmod K}b_i\pmod Q ∑ i ∈ [ n ] : i ≡ r ( mod K ) a i ≡ ∑ i ∈ [ n ] : i ≡ r ( mod K ) b i ( mod Q ) for every r ∈ [ 0 , K − 1 ] r\in[0,K-1] r ∈ [ 0 , K − 1 ] . If a \mathbf{a} a and b \mathbf{b} b agree outside an interval containing at most K K K coordinates, then a = b \mathbf{a}=\mathbf{b} a = b .
Let α ∈ Σ 2 n \alpha\in\Sigma_2^n α ∈ Σ 2 n . If w = wt L 1 ( α ) ≥ 1 w=\operatorname{wt}_{L_1}(\alpha)\ge1 w = wt L 1 ( α ) ≥ 1 , let L 1 α < ⋯ < L w α L_1^\alpha<\cdots<L_w^\alpha L 1 α < ⋯ < L w α be the positions of symbols 1 in α \alpha α . For each r ∈ [ 0 , K ∗ − 1 ] r\in[0,K_*-1] r ∈ [ 0 , K ∗ − 1 ] , define
P r ( α ) ≜ ( ∑ i ∈ [ n ] i ≡ r ( m o d K ∗ ) α i ) m o d 2 , R r ( α ) ≜ ( ∑ j ∈ [ w ] j ≡ r ( m o d K ∗ ) L j α ) m o d 2 U ∗ . P_r(\alpha)\triangleq\left(\sum_{\substack{i\in[n]\\i\equiv r\pmod{K_*}}}\alpha_i\right)\bmod2,\qquad R_r(\alpha)\triangleq\left(\sum_{\substack{j\in[w]\\j\equiv r\pmod{K_*}}}L_j^\alpha\right)\bmod2U_*. P r ( α ) ≜ i ∈ [ n ] i ≡ r ( mod K ∗ ) ∑ α i mod 2 , R r ( α ) ≜ j ∈ [ w ] j ≡ r ( mod K ∗ ) ∑ L j α mod 2 U ∗ .
If w = 0 w=0 w = 0 , define R r ( α ) = 0 R_r(\alpha)=0 R r ( α ) = 0 for any α \alpha α and any r r r . The first sum uses the coordinate i i i in the binary sequence. The second sum uses the index j j j of a one in the ordered sequence of ones. Define the syndrome
H n ≠ ( α ) ≜ ( VT ( α ) m o d M n , ∗ , wt L 1 ( α ) m o d 2 U ∗ , ( P r ( α ) ) r = 0 K ∗ − 1 , ( R r ( α ) ) r = 0 K ∗ − 1 ) . (63) H_n^{\neq}(\alpha)\triangleq\left(\operatorname{VT}(\alpha)\bmod M_{n,*},\ \operatorname{wt}_{L_1}(\alpha)\bmod2U_*,\ (P_r(\alpha))_{r=0}^{K_*-1},\ (R_r(\alpha))_{r=0}^{K_*-1}\right). \tag*{(63)} H n = ( α ) ≜ ( VT ( α ) mod M n , ∗ , wt L 1 ( α ) mod 2 U ∗ , ( P r ( α ) ) r = 0 K ∗ − 1 , ( R r ( α ) ) r = 0 K ∗ − 1 ) . (63)
Proposition VI.1. Let n ≥ T ∗ n\ge T_* n ≥ T ∗ and 1 ≤ ∣ h ∣ ≤ k 1\le|h|\le k 1 ≤ ∣ h ∣ ≤ k . Suppose that a k k k -sparse sequence β ∈ Σ 2 n − h \beta\in\Sigma_2^{n-h} β ∈ Σ 2 n − h is obtained from α , γ ∈ Σ 2 n \alpha,\gamma\in\Sigma_2^n α , γ ∈ Σ 2 n by ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst errors. If H n ≠ ( α ) = H n ≠ ( γ ) H_n^{\neq}(\alpha)=H_n^{\neq}(\gamma) H n = ( α ) = H n = ( γ ) , then α = γ \alpha=\gamma α = γ .
As a corollary, if y ∈ E 1 , k ≠ ( x ) y\in E_{1,k}^{\neq}(x) y ∈ E 1 , k = ( x ) for some x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n , then given H n ≠ ( χ k ( x ) ) H_n^{\neq}(\chi_k(x)) H n = ( χ k ( x )) , one can uniquely recover χ k ( x ) \chi_k(x) χ k ( x ) from χ k ( y ) \chi_k(y) χ k ( y ) .
Proof. Suppose that the ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst errors in α \alpha α and γ \gamma γ occurred at positions p p p and r r r , respectively. Without loss of generality, we may assume 1 ≤ p ≤ r ≤ n − T ∗ + 1 1\le p\le r\le n-T_*+1 1 ≤ p ≤ r ≤ n − T ∗ + 1 . Let I = [ p , r + T ∗ − 1 ] I=[p,r+T_*-1] I = [ p , r + T ∗ − 1 ] . Then it holds that
α [ n ] ∖ I = γ [ n ] ∖ I , \alpha_{[n]\setminus I}=\gamma_{[n]\setminus I}, α [ n ] ∖ I = γ [ n ] ∖ I ,
β [ 1 , p − 1 ] = α [ 1 , p − 1 ] , \beta_{[1,p-1]}=\alpha_{[1,p-1]}, β [ 1 , p − 1 ] = α [ 1 , p − 1 ] ,
β i = α i + h , for i ≥ r + T ∗ − h . (64) \beta_i=\alpha_{i+h},\quad\text{for }i\ge r+T_*-h. \tag*{(64)} β i = α i + h , for i ≥ r + T ∗ − h . (64)
The assumption wt L 1 ( α ) ≡ wt L 1 ( γ ) ( m o d 2 U ∗ ) \operatorname{wt}_{L_1}(\alpha)\equiv\operatorname{wt}_{L_1}(\gamma)\pmod{2U_*} wt L 1 ( α ) ≡ wt L 1 ( γ ) ( mod 2 U ∗ ) gives wt L 1 ( α ) − wt L 1 ( β ) ≡ wt L 1 ( γ ) − wt L 1 ( β ) ( m o d 2 U ∗ ) \operatorname{wt}_{L_1}(\alpha)-\operatorname{wt}_{L_1}(\beta)\equiv\operatorname{wt}_{L_1}(\gamma)-\operatorname{wt}_{L_1}(\beta)\pmod{2U_*} wt L 1 ( α ) − wt L 1 ( β ) ≡ wt L 1 ( γ ) − wt L 1 ( β ) ( mod 2 U ∗ ) . Since β \beta β is obtained from both α \alpha α and γ \gamma γ by ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst-errors, we have wt L 1 ( α ) − wt L 1 ( β ) , wt L 1 ( γ ) − wt L 1 ( β ) ∈ [ − ( T ∗ − h ) , T ∗ ] ⊆ [ − U ∗ , U ∗ − 1 ] \operatorname{wt}_{L_1}(\alpha)-\operatorname{wt}_{L_1}(\beta),\operatorname{wt}_{L_1}(\gamma)-\operatorname{wt}_{L_1}(\beta)\in[-(T_*-h),T_*]\subseteq[-U_*,U_*-1] wt L 1 ( α ) − wt L 1 ( β ) , wt L 1 ( γ ) − wt L 1 ( β ) ∈ [ − ( T ∗ − h ) , T ∗ ] ⊆ [ − U ∗ , U ∗ − 1 ] . Then it follows that wt L 1 ( α ) − wt L 1 ( β ) = wt L 1 ( γ ) − wt L 1 ( β ) \operatorname{wt}_{L_1}(\alpha)-\operatorname{wt}_{L_1}(\beta)=\operatorname{wt}_{L_1}(\gamma)-\operatorname{wt}_{L_1}(\beta) wt L 1 ( α ) − wt L 1 ( β ) = wt L 1 ( γ ) − wt L 1 ( β ) . Denote Δ L 1 = wt L 1 ( α ) − wt L 1 ( β ) \Delta_{L_1}=\operatorname{wt}_{L_1}(\alpha)-\operatorname{wt}_{L_1}(\beta) Δ L 1 = wt L 1 ( α ) − wt L 1 ( β ) .
Let L = r − p L=r-p L = r − p and S = ∑ i = p + 1 r β i S=\sum_{i=p+1}^{r}\beta_i S = ∑ i = p + 1 r β i . Applying (62) to the two pairs ( α , β ) (\alpha,\beta) ( α , β ) and ( γ , β ) (\gamma,\beta) ( γ , β ) yields
VT ( γ ) − VT ( α ) = L Δ L 1 − h S + δ r − δ p . (65) \operatorname{VT}(\gamma)-\operatorname{VT}(\alpha)=L\Delta_{L_1}-hS+\delta_r-\delta_p. \tag*{(65)} VT ( γ ) − VT ( α ) = L Δ L 1 − h S + δ r − δ p . (65)
Since S ≤ L ≤ n − T ∗ < n S \le L \le n-T_* < n S ≤ L ≤ n − T ∗ < n , ∣ Δ L 1 ∣ ≤ U ∗ |\Delta_{L_1}| \le U_* ∣ Δ L 1 ∣ ≤ U ∗ and ∣ h ∣ ≤ k < U ∗ |h| \le k < U_* ∣ h ∣ ≤ k < U ∗ , we have
∣ VT ( γ ) − VT ( α ) ∣ ≤ L ∣ Δ L 1 ∣ + ∣ h ∣ S + ∣ δ r ∣ + ∣ δ p ∣ < ( U ∗ + k ) n + E ∗ = M n , ∗ . \begin{aligned}
|\operatorname{VT}(\gamma)-\operatorname{VT}(\alpha)|
&\le L|\Delta_{L_1}|+|h|S+|\delta_r|+|\delta_p|\\
&< (U_*+k)n+E_* = M_{n,*}.
\end{aligned} ∣ VT ( γ ) − VT ( α ) ∣ ≤ L ∣ Δ L 1 ∣ + ∣ h ∣ S + ∣ δ r ∣ + ∣ δ p ∣ < ( U ∗ + k ) n + E ∗ = M n , ∗ .
Then the condition VT ( α ) ≡ VT ( γ ) ( m o d M n , ∗ ) \operatorname{VT}(\alpha) \equiv\operatorname{VT}(\gamma) \pmod{M_{n,*}} VT ( α ) ≡ VT ( γ ) ( mod M n , ∗ ) implies VT ( α ) = VT ( γ ) \operatorname{VT}(\alpha)=\operatorname{VT}(\gamma) VT ( α ) = VT ( γ ) . Combining this with (65) gives
L Δ L 1 = h S + δ p − δ r . (66) L\Delta_{L_1}=hS+\delta_p-\delta_r. \tag*{(66)} L Δ L 1 = h S + δ p − δ r . (66)
Since β \beta β is k k k -sparse, an interval of length L ≥ 1 L \ge1 L ≥ 1 contains at most S ≤ ( L + k ) / ( k + 1 ) S \le(L+k)/(k+1) S ≤ ( L + k ) / ( k + 1 ) ones. For L = 0 L=0 L = 0 , we have S = 0 S=0 S = 0 . Thus the bound S ≤ ( L + k ) / ( k + 1 ) S \le(L+k)/(k+1) S ≤ ( L + k ) / ( k + 1 ) always holds.
Suppose first that Δ L 1 ≠ 0 \Delta_{L_1}\ne0 Δ L 1 = 0 . It follows from (66) that L ≤ L ∣ Δ L 1 ∣ ≤ k S + E ∗ ≤ k ( L + k ) / ( k + 1 ) + E ∗ L \le L|\Delta_{L_1}| \le kS+E_* \le k(L+k)/(k+1)+E_* L ≤ L ∣ Δ L 1 ∣ ≤ k S + E ∗ ≤ k ( L + k ) / ( k + 1 ) + E ∗ . Hence L ≤ k 2 + ( k + 1 ) E ∗ L \le k^2+(k+1)E_* L ≤ k 2 + ( k + 1 ) E ∗ and ∣ I ∣ = L + T ∗ ≤ k 2 + ( k + 1 ) E ∗ + U ∗ − k = K ∗ |I|=L+T_* \le k^2+(k+1)E_*+U_*-k=K_* ∣ I ∣ = L + T ∗ ≤ k 2 + ( k + 1 ) E ∗ + U ∗ − k = K ∗ . Recall from (64) that α i ≠ γ i \alpha_i\ne\gamma_i α i = γ i only if i ∈ I i\in I i ∈ I . Therefore, the condition P r ( α ) = P r ( γ ) P_r(\alpha)=P_r(\gamma) P r ( α ) = P r ( γ ) for every r ∈ [ 0 , K ∗ − 1 ] r\in[0,K_*-1] r ∈ [ 0 , K ∗ − 1 ] gives α = γ \alpha=\gamma α = γ by Lemma VI.5, with K = K ∗ K=K_* K = K ∗ and Q = 2 Q=2 Q = 2 .
Now suppose Δ L 1 = 0 \Delta_{L_1}=0 Δ L 1 = 0 . Then wt L 1 ( α ) = wt L 1 ( β ) = wt L 1 ( γ ) \operatorname{wt}_{L_1}(\alpha)=\operatorname{wt}_{L_1}(\beta)=\operatorname{wt}_{L_1}(\gamma) wt L 1 ( α ) = wt L 1 ( β ) = wt L 1 ( γ ) . Denote w = wt L 1 ( α ) w=\operatorname{wt}_{L_1}(\alpha) w = wt L 1 ( α ) . If w = 0 w=0 w = 0 , then α = γ = 0 n \alpha=\gamma=0^n α = γ = 0 n .
Otherwise, let L j α , L j β , L j γ L^\alpha_j,L^\beta_j,L^\gamma_j L j α , L j β , L j γ be the positions of the j j j -th one in α , β , γ \alpha,\beta,\gamma α , β , γ , respectively. Let w 1 = wt L 1 ( α [ 1 , p − 1 ] ) w_1=\operatorname{wt}_{L_1}(\alpha_{[1,p-1]}) w 1 = wt L 1 ( α [ 1 , p − 1 ] ) and w 2 = wt L 1 ( α I ) w_2=\operatorname{wt}_{L_1}(\alpha_I) w 2 = wt L 1 ( α I ) . It follows from (64) that wt L 1 ( β [ 1 , p − 1 ] ) = wt L 1 ( γ [ 1 , p − 1 ] ) = w 1 \operatorname{wt}_{L_1}(\beta_{[1,p-1]})=\operatorname{wt}_{L_1}(\gamma_{[1,p-1]})=w_1 wt L 1 ( β [ 1 , p − 1 ] ) = wt L 1 ( γ [ 1 , p − 1 ] ) = w 1 , wt L 1 ( β [ p , r + T ∗ − h − 1 ] ) = wt L 1 ( γ I ) = w 2 \operatorname{wt}_{L_1}(\beta_{[p,r+T_*-h-1]})=\operatorname{wt}_{L_1}(\gamma_I)=w_2 wt L 1 ( β [ p , r + T ∗ − h − 1 ] ) = wt L 1 ( γ I ) = w 2 and wt L 1 ( β [ r + T ∗ − h , n − h ] ) = wt L 1 ( α [ r + T ∗ , n ] ) = wt L 1 ( γ [ r + T ∗ , n ] ) = w − w 1 − w 2 \operatorname{wt}_{L_1}(\beta_{[r+T_*-h,n-h]})=\operatorname{wt}_{L_1}(\alpha_{[r+T_*,n]})=\operatorname{wt}_{L_1}(\gamma_{[r+T_*,n]})=w-w_1-w_2 wt L 1 ( β [ r + T ∗ − h , n − h ] ) = wt L 1 ( α [ r + T ∗ , n ] ) = wt L 1 ( γ [ r + T ∗ , n ] ) = w − w 1 − w 2 . Consequently,
L j β = L j α = L j γ , for j ≤ w 1 , L^\beta_j=L^\alpha_j=L^\gamma_j,\qquad\text{for }j\le w_1, L j β = L j α = L j γ , for j ≤ w 1 ,
L j β = L j α − h = L j γ − h , for j > w 1 + w 2 . L^\beta_j=L^\alpha_j-h=L^\gamma_j-h,\qquad\text{for }j>w_1+w_2. L j β = L j α − h = L j γ − h , for j > w 1 + w 2 .
This gives ∣ L j α − L j γ ∣ = 0 |L^\alpha_j-L^\gamma_j|=0 ∣ L j α − L j γ ∣ = 0 for j ∈ [ w 1 ] ∪ [ w 1 + w 2 + 1 , w ] j\in[w_1]\cup[w_1+w_2+1,w] j ∈ [ w 1 ] ∪ [ w 1 + w 2 + 1 , w ] . For every j ∈ [ w 1 + 1 , w 1 + w 2 ] j\in[w_1+1,w_1+w_2] j ∈ [ w 1 + 1 , w 1 + w 2 ] , since ∣ L j α − L j β ∣ , ∣ L j γ − L j β ∣ ≤ max { T ∗ , T ∗ − h } ≤ U ∗ |L^\alpha_j-L^\beta_j|,|L^\gamma_j-L^\beta_j|\le\max\{T_*,T_*-h\}\le U_* ∣ L j α − L j β ∣ , ∣ L j γ − L j β ∣ ≤ max { T ∗ , T ∗ − h } ≤ U ∗ , it holds that ∣ L j α − L j γ ∣ < 2 U ∗ |L^\alpha_j-L^\gamma_j|<2U_* ∣ L j α − L j γ ∣ < 2 U ∗ .
If L j α = L j γ L^\alpha_j=L^\gamma_j L j α = L j γ for every j ∈ [ w ] j\in[w] j ∈ [ w ] , the conclusion follows. Otherwise, let j 1 j_1 j 1 and j 2 j_2 j 2 be the smallest and largest indices j j j such that L j α ≠ L j γ L^\alpha_j\ne L^\gamma_j L j α = L j γ , respectively. To apply Lemma VI.5, it remains to bound j 2 − j 1 j_2-j_1 j 2 − j 1 . First, notice that j 1 , j 2 ∈ [ w 1 + 1 , w 1 + w 2 ] j_1,j_2\in[w_1+1,w_1+w_2] j 1 , j 2 ∈ [ w 1 + 1 , w 1 + w 2 ] and thus, j 2 − j 1 < w 2 j_2-j_1<w_2 j 2 − j 1 < w 2 . The assumption Δ L 1 = 0 \Delta_{L_1}=0 Δ L 1 = 0 and (66) give ∣ h ∣ S ≤ E ∗ |h|S\le E_* ∣ h ∣ S ≤ E ∗ . Since h ≠ 0 h\ne0 h = 0 , it follows that S ≤ E ∗ S\le E_* S ≤ E ∗ . Therefore,
w 2 = β p + ∑ i = p + 1 r β i + ∑ i = r + 1 r + T ∗ − h − 1 β i ≤ S + T ∗ − h ≤ E ∗ + U ∗ < K ∗ . w_2=\beta_p+\sum_{i=p+1}^{r}\beta_i+\sum_{i=r+1}^{r+T_*-h-1}\beta_i\le S+T_*-h\le E_*+U_*<K_*. w 2 = β p + i = p + 1 ∑ r β i + i = r + 1 ∑ r + T ∗ − h − 1 β i ≤ S + T ∗ − h ≤ E ∗ + U ∗ < K ∗ .
Now the condition R r ( α ) = R r ( γ ) R_r(\alpha)=R_r(\gamma) R r ( α ) = R r ( γ ) for every r ∈ [ 0 , K ∗ − 1 ] r\in[0,K_*-1] r ∈ [ 0 , K ∗ − 1 ] , together with Lemma VI.5 with Q = 2 U ∗ Q=2U_* Q = 2 U ∗ and K = K ∗ K=K_* K = K ∗ , gives L j α = L j γ L^\alpha_j=L^\gamma_j L j α = L j γ for every j ∈ [ w ] j\in[w] j ∈ [ w ] , which implies α = γ \alpha=\gamma α = γ . Now the proof is completed. ■
The following remarks clarify the hypotheses of Proposition VI.1.
Remark VI.1. • The hypotheses in Proposition VI.1 require the common received sequence β \beta β to be k k k -sparse. The two original binary sequences need not be k k k -sparse.
• The condition h ≠ 0 h\ne0 h = 0 is used to deduce S ≤ E ∗ S\le E_* S ≤ E ∗ when Δ L 1 = 0 \Delta_{L_1}=0 Δ L 1 = 0 . If h = Δ L 1 = 0 h=\Delta_{L_1}=0 h = Δ L 1 = 0 , (66) gives no bound on S S S .
Recovery of the Labels
By Proposition VI.1, the marker sequence χ k ( x ) \chi_k(x) χ k ( x ) is uniquely determined by χ k ( y ) \chi_k(y) χ k ( y ) and the syndrome in (63) . It remains to recover the labels of the segments defined in Section VI-B. We first bound the number of consecutive segment indices at which two sequences with the same marker sequence and a common received sequence can differ.
Lemma VI.6. Let x , z ∈ Σ q n x,z\in\Sigma_q^n x , z ∈ Σ q n where n ≥ T ∗ n\ge T_* n ≥ T ∗ . Suppose χ k ( x ) = χ k ( z ) \chi_k(x)=\chi_k(z) χ k ( x ) = χ k ( z ) and E 1 , k ≠ ( x ) ∩ E 1 , k ≠ ( z ) ≠ ∅ \mathcal{E}^{\ne}_{1,k}(x)\cap\mathcal{E}^{\ne}_{1,k}(z)\ne\varnothing E 1 , k = ( x ) ∩ E 1 , k = ( z ) = ∅ . Let w = wt L 1 ( χ k ( x ) ) = wt L 1 ( χ k ( z ) ) w=\operatorname{wt}_{L_1}(\chi_k(x))=\operatorname{wt}_{L_1}(\chi_k(z)) w = wt L 1 ( χ k ( x )) = wt L 1 ( χ k ( z )) . Let y ∈ E 1 , k ≠ ( x ) ∩ E 1 , k ≠ ( z ) y\in\mathcal{E}^{\ne}_{1,k}(x)\cap\mathcal{E}^{\ne}_{1,k}(z) y ∈ E 1 , k = ( x ) ∩ E 1 , k = ( z ) and u 1 x , … , u w x u^x_1,\ldots,u^x_w u 1 x , … , u w x and u 1 z , … , u w z b e t h e c o n s e c u t i v e s e g m e n t s o f u^z_1,\ldots,u^z_w be the consecutive segments of u 1 z , … , u w z b e t h eco n sec u t i v ese g m e n t so f x$ and z z z , respectively. Then there exist integers a ≤ b ≤ w a\le b\le w a ≤ b ≤ w such that b − a + 1 ≤ 2 U ∗ b-a+1\le2U_* b − a + 1 ≤ 2 U ∗ and u j x = u j z u^x_j=u^z_j u j x = u j z for every j ∈ [ 0 , w ] ∖ [ a , b ] j\in[0,w]\setminus[a,b] j ∈ [ 0 , w ] ∖ [ a , b ] . In other words, the two sequences x x x and z z z differ in at most $2U_*$ segments.
Proof. Let y ∈ E 1 , k ≠ ( x ) ∩ E 1 , k ≠ ( z ) y\in\mathcal{E}^{\ne}_{1,k}(x)\cap\mathcal{E}^{\ne}_{1,k}(z) y ∈ E 1 , k = ( x ) ∩ E 1 , k = ( z ) and h = n − ∣ y ∣ h=n-|y| h = n − ∣ y ∣ . Then 1 ≤ ∣ h ∣ ≤ k 1\le|h|\le k 1 ≤ ∣ h ∣ ≤ k . Suppose that the k k k -substring edits in x x x and z z z start at positions i x i_x i x and i z i_z i z and remove s x s_x s x and s z s_z s z symbols, respectively, where s x , s z ∈ [ 0 , k ] s_x,s_z\in[0,k] s x , s z ∈ [ 0 , k ] .
Denote α = χ k ( x ) = χ k ( z ) \alpha=\chi_k(x)=\chi_k(z) α = χ k ( x ) = χ k ( z ) and β = χ k ( y ) \beta=\chi_k(y) β = χ k ( y ) . Since y ∈ E 1 , k ≠ ( x ) y\in\mathcal{E}^{\ne}_{1,k}(x) y ∈ E 1 , k = ( x ) , by Lemma VI.3, there exists p ∈ [ 1 , n − T ∗ + 1 ] p\in[1,n-T_*+1] p ∈ [ 1 , n − T ∗ + 1 ] such that β \beta β is obtained from α \alpha α by a ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst error at position p p p , where the index p p p satisfies i x ∈ [ p , p + T ∗ − s x ] i_x\in[p,p+T_*-s_x] i x ∈ [ p , p + T ∗ − s x ] . By the same argument, there exists r ∈ [ 1 , n − T ∗ + 1 ] r\in[1,n-T_*+1] r ∈ [ 1 , n − T ∗ + 1 ] such that β \beta β is obtained from α \alpha α by a ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst error at position r r r , and the index r r r satisfies i z ∈ [ r , r + T ∗ − s z ] i_z\in[r,r+T_*-s_z] i z ∈ [ r , r + T ∗ − s z ] .
Without loss of generality, assume p ≤ r p\le r p ≤ r . Then we have
x j = z j = { y j , j ∈ [ 1 , p − 1 ] , y j − h , j ∈ [ r + T ∗ , n ] . x_j=z_j=
\begin{cases}
y_j, & j\in[1,p-1],\\
y_{j-h}, & j\in[r+T_*,n].
\end{cases} x j = z j = { y j , y j − h , j ∈ [ 1 , p − 1 ] , j ∈ [ r + T ∗ , n ] .
Consequently, x j = z j x_j=z_j x j = z j for every j ∈ [ n ] ∖ I j\in[n]\setminus I j ∈ [ n ] ∖ I , where I ≜ [ p , r + T ∗ − 1 ] I\triangleq[p,r+T_*-1] I ≜ [ p , r + T ∗ − 1 ] .
α j + h = β j = α j , 1 ≤ ∣ h ∣ ≤ k \alpha_{j+h}=\beta_j=\alpha_j,\qquad1\le|h|\le k α j + h = β j = α j , 1 ≤ ∣ h ∣ ≤ k
We next prove that ∑ j ∈ I α j < 2 U ∗ \sum_{j\in I}\alpha_j<2U_* ∑ j ∈ I α j < 2 U ∗ . Put L = r − p L=r-p L = r − p . If L ≤ U ∗ L\le U_* L ≤ U ∗ , then, since T ∗ = U ∗ − k T_*=U_*-k T ∗ = U ∗ − k and k ≥ 1 k\ge1 k ≥ 1 , ∣ I ∣ = L + T ∗ ≤ 2 U ∗ − k < 2 U ∗ |I|=L+T_*\le2U_*-k<2U_* ∣ I ∣ = L + T ∗ ≤ 2 U ∗ − k < 2 U ∗ . The desired bound follows because α \alpha α is binary.
Now assume L > U ∗ L>U_* L > U ∗ . The ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst error at position r r r gives β j = α j \beta_j=\alpha_j β j = α j for j ∈ [ 1 , r − 1 ] j\in[1,r-1] j ∈ [ 1 , r − 1 ] , whereas the ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst error at position p p p gives β j = α j + h \beta_j=\alpha_{j+h} β j = α j + h for j ∈ [ p + T ∗ − h , n − h ] j\in[p+T_*-h,n-h] j ∈ [ p + T ∗ − h , n − h ] . Hence, for every j ∈ [ p + T ∗ − h , r − 1 ] j\in[p+T_*-h,r-1] j ∈ [ p + T ∗ − h , r − 1 ] , it holds that α j = β j = α j + h \alpha_j=\beta_j=\alpha_{j+h} α j = β j = α j + h . All these coordinates are valid: the bounds on p p p , r r r and T ∗ > ∣ h ∣ T_*>|h| T ∗ > ∣ h ∣ imply that j ∈ [ n ] ∩ [ n − h ] j\in[n]\cap[n-h] j ∈ [ n ] ∩ [ n − h ] and j + h ∈ [ n ] j+h\in[n] j + h ∈ [ n ] . If α j = 1 \alpha_j=1 α j = 1 , then α j + h = 1 \alpha_{j+h}=1 α j + h = 1 . This contradicts the k k k -sparsity of α \alpha α established in Lemma VI.1 (i), since 1 ≤ ∣ ( j + h ) − j ∣ = ∣ h ∣ ≤ k 1\le|(j+h)-j|=|h|\le k 1 ≤ ∣ ( j + h ) − j ∣ = ∣ h ∣ ≤ k . Therefore, α j = 0 \alpha_j=0 α j = 0 throughout [ p + T ∗ − h , r − 1 ] [p+T_*-h,r-1] [ p + T ∗ − h , r − 1 ] . Then it follows that
∑ j ∈ I α j = ∑ j = p p + T ∗ − h − 1 α j + ∑ j = r r + T ∗ − 1 α j ≤ ( T ∗ − h ) + T ∗ < 2 U ∗ . \sum_{j\in I}\alpha_j
=
\sum_{j=p}^{p+T_*-h-1}\alpha_j+
\sum_{j=r}^{r+T_*-1}\alpha_j
\le(T_*-h)+T_*<2U_*. j ∈ I ∑ α j = j = p ∑ p + T ∗ − h − 1 α j + j = r ∑ r + T ∗ − 1 α j ≤ ( T ∗ − h ) + T ∗ < 2 U ∗ .
The three subintervals of I I I used here are illustrated in Figure 5 .
Figure 5. The common marker sequence on [ p , r + T ∗ − 1 ] [p,r+T_* -1] [ p , r + T ∗ − 1 ] when r − p > U ∗ r-p>U_* r − p > U ∗ . Markers in this interval can occur only in the two red parts. The white part consists of zeros and can be arbitrarily long.
Let s 1 < ⋯ < s w s_1<\cdots<s_w s 1 < ⋯ < s w be the common markers in [ n ] [n] [ n ] , and put s 0 = 0 s_0=0 s 0 = 0 and s w + 1 = n + 1 s_{w+1}=n+1 s w + 1 = n + 1 . Let a , b ∈ [ 0 , w ] a,b\in[0,w] a , b ∈ [ 0 , w ] be the unique indices satisfying s a ≤ p < s a + 1 s_a\le p<s_{a+1} s a ≤ p < s a + 1 and s b ≤ r + T ∗ − 1 < s b + 1 s_b\le r+T_*-1<s_{b+1} s b ≤ r + T ∗ − 1 < s b + 1 . Then a ≤ b a\le b a ≤ b . The set of markers in [ p + 1 , r + T ∗ − 1 ] [p+1,r+T_*-1] [ p + 1 , r + T ∗ − 1 ] is { s a + 1 , … , s b } \{s_{a+1},\ldots,s_b\} { s a + 1 , … , s b } . By definition of α \alpha α , we have α j = 1 \alpha_j=1 α j = 1 if and only if j ∈ { s 1 , … , s w } j\in\{s_1,\ldots,s_w\} j ∈ { s 1 , … , s w } . Therefore,
b − a + 1 = 1 + ∑ j = p + 1 r + T ∗ − 1 α j ≤ 1 + ∑ j ∈ I α j ≤ 2 U ∗ . b-a+1=1+\sum_{j=p+1}^{r+T_*-1}\alpha_j\le1+\sum_{j\in I}\alpha_j\le2U_*. b − a + 1 = 1 + j = p + 1 ∑ r + T ∗ − 1 α j ≤ 1 + j ∈ I ∑ α j ≤ 2 U ∗ .
It follows from the choice of a a a and b b b that I I I is a subset of [ s a , s b + 1 − 1 ] [s_a,s_{b+1}-1] [ s a , s b + 1 − 1 ] . Since x i = z i x_i=z_i x i = z i for every i ∈ [ n ] ∖ I i\in[n]\setminus I i ∈ [ n ] ∖ I , we conclude that u j x = u j z u_j^x=u_j^z u j x = u j z for every j ∈ [ 0 , w ] ∖ [ a , b ] j\in[0,w]\setminus[a,b] j ∈ [ 0 , w ] ∖ [ a , b ] . This completes the proof.
For r ∈ [ 0 , 2 U ∗ − 1 ] r\in[0,2U_*-1] r ∈ [ 0 , 2 U ∗ − 1 ] , define
G r ≠ ( x ) ≜ ( ∑ j ∈ [ 0 , w ] j ≡ r ( m o d 2 U ∗ ) Lab ( u j x ) ) m o d q , (67) G_r^{\neq}(x)\triangleq
\left(
\sum_{\substack{j\in[0,w]\\j\equiv r\pmod{2U_*}}}
\operatorname{Lab}(u_j^x)
\right)\bmod q, \tag*{(67)} G r = ( x ) ≜ j ∈ [ 0 , w ] j ≡ r ( mod 2 U ∗ ) ∑ Lab ( u j x ) mod q , (67)
where u 0 x , … , u w x u_0^x,\ldots,u_w^x u 0 x , … , u w x are the segments of 0 x 0x 0 x . Each component is added over the integers and reduced to [ 0 , q − 1 ] [0,q-1] [ 0 , q − 1 ] .
Proposition VI.2. Let n ≥ T ∗ n\ge T_* n ≥ T ∗ and x , z ∈ Σ q n x,z\in\Sigma_q^n x , z ∈ Σ q n satisfy χ k ( x ) = χ k ( z ) \chi_k(x)=\chi_k(z) χ k ( x ) = χ k ( z ) . Denote their respective segments by u 0 x , … , u w x u_0^x,\ldots,u_w^x u 0 x , … , u w x and u 0 z , … , u w z u_0^z,\ldots,u_w^z u 0 z , … , u w z . Suppose that E 1 , k ≠ ( x ) ∩ E 1 , k ≠ ( z ) ≠ ∅ E_{1,k}^{\neq}(x)\cap E_{1,k}^{\neq}(z)\ne\varnothing E 1 , k = ( x ) ∩ E 1 , k = ( z ) = ∅ and that G r ≠ ( x ) = G r ≠ ( z ) G_r^{\neq}(x)=G_r^{\neq}(z) G r = ( x ) = G r = ( z ) for every r ∈ [ 0 , 2 U ∗ − 1 ] r\in[0,2U_*-1] r ∈ [ 0 , 2 U ∗ − 1 ] . Then Lab ( u j x ) = Lab ( u j z ) \operatorname{Lab}(u_j^x)=\operatorname{Lab}(u_j^z) Lab ( u j x ) = Lab ( u j z ) for every j ∈ [ 0 , w ] j\in[0,w] j ∈ [ 0 , w ] .
Consequently, given y ∈ E 1 , k ≠ ( x ) y\in E_{1,k}^{\neq}(x) y ∈ E 1 , k = ( x ) , the marker sequence χ k ( x ) \chi_k(x) χ k ( x ) , and ( G r ≠ ( x ) ) r = 0 2 U ∗ − 1 (G_r^{\neq}(x))_{r=0}^{2U_*-1} ( G r = ( x ) ) r = 0 2 U ∗ − 1 , all segment labels of x x x are uniquely determined.
Proof. By Lemma VI.6, there exist integers 0 ≤ a ≤ b ≤ w 0\le a\le b\le w 0 ≤ a ≤ b ≤ w such that b − a + 1 ≤ 2 U ∗ b-a+1\le2U_* b − a + 1 ≤ 2 U ∗ and u j x = u j z u_j^x=u_j^z u j x = u j z for every j ∈ [ 0 , w ] ∖ [ a , b ] j\in[0,w]\setminus[a,b] j ∈ [ 0 , w ] ∖ [ a , b ] . In particular, we have Lab ( u j x ) = Lab ( u j z ) \operatorname{Lab}(u_j^x)=\operatorname{Lab}(u_j^z) Lab ( u j x ) = Lab ( u j z ) for every j ∈ [ 0 , w ] ∖ [ a , b ] j\in[0,w]\setminus[a,b] j ∈ [ 0 , w ] ∖ [ a , b ] .
For every r ∈ [ 0 , 2 U ∗ − 1 ] r\in[0,2U_*-1] r ∈ [ 0 , 2 U ∗ − 1 ] , the equality G r ≠ ( x ) = G r ≠ ( z ) G_r^{\neq}(x)=G_r^{\neq}(z) G r = ( x ) = G r = ( z ) and (67) imply
∑ j ∈ [ 0 , w ] j ≡ r ( m o d 2 U ∗ ) ( Lab ( u j x ) − Lab ( u j z ) ) ≡ 0 ( m o d q ) . \sum_{\substack{j\in[0,w]\\j\equiv r\pmod{2U_*}}}
\left(\operatorname{Lab}(u_j^x)-\operatorname{Lab}(u_j^z)\right)\equiv0\pmod q. j ∈ [ 0 , w ] j ≡ r ( mod 2 U ∗ ) ∑ ( Lab ( u j x ) − Lab ( u j z ) ) ≡ 0 ( mod q ) .
All vector congruences in this proof are componentwise. The summands with indices outside [ a , b ] [a,b] [ a , b ] are zero. Therefore,
∑ j ∈ [ a , b ] j ≡ r ( m o d 2 U ∗ ) ( Lab ( u j x ) − Lab ( u j z ) ) ≡ 0 ( m o d q ) \sum_{\substack{j\in[a,b]\\j\equiv r\pmod{2U_*}}}
\left(\operatorname{Lab}(u_j^x)-\operatorname{Lab}(u_j^z)\right)\equiv0\pmod q j ∈ [ a , b ] j ≡ r ( mod 2 U ∗ ) ∑ ( Lab ( u j x ) − Lab ( u j z ) ) ≡ 0 ( mod q )
for every r ∈ [ 0 , 2 U ∗ − 1 ] r\in[0,2U_*-1] r ∈ [ 0 , 2 U ∗ − 1 ] . This implies Lab ( u j x ) ≡ Lab ( u j z ) ( m o d q ) \operatorname{Lab}(u_j^x)\equiv\operatorname{Lab}(u_j^z)\pmod q Lab ( u j x ) ≡ Lab ( u j z ) ( mod q ) for every j ∈ [ a , b ] j\in[a,b] j ∈ [ a , b ] , since ∣ [ a , b ] ∣ ≤ 2 U ∗ |[a,b]|\le2U_* ∣ [ a , b ] ∣ ≤ 2 U ∗ . Recall that Lab ( u j x ) , Lab ( u j z ) ∈ Σ q 2 B ∗ \operatorname{Lab}(u_j^x),\operatorname{Lab}(u_j^z)\in\Sigma_q^{2B_*} Lab ( u j x ) , Lab ( u j z ) ∈ Σ q 2 B ∗ . Now we conclude that Lab ( u j x ) = Lab ( u j z ) \operatorname{Lab}(u_j^x)=\operatorname{Lab}(u_j^z) Lab ( u j x ) = Lab ( u j z ) for every j j j . Now the proof is completed.
The Code Construction
Define the syndrome
Syn n ≠ ( x ) ≜ ( H n ≠ ( χ k ( x ) ) , ( G r ≠ ( x ) ) r = 0 2 U ∗ − 1 ) . (68) \operatorname{Syn}^{\ne}_{n}(x) \triangleq\left(H^{\ne}_{n}(\chi_k(x)),\left(G^{\ne}_{r}(x)\right)_{r=0}^{2U_*-1}\right). \tag*{(68)} Syn n = ( x ) ≜ ( H n = ( χ k ( x )) , ( G r = ( x ) ) r = 0 2 U ∗ − 1 ) . (68)
By (63) and (67) , the values of this syndrome belong to
V Syn ≜ [ 0 , M n , ∗ − 1 ] × [ 0 , 2 U ∗ − 1 ] × Σ q 2 K ∗ × [ 0 , 2 U ∗ − 1 ] K ∗ × ( Σ q 2 B ∗ ) 2 U ∗ . \mathcal{V}_{\operatorname{Syn}} \triangleq[0,M_{n,*}-1]\times[0,2U_*-1]\times\Sigma_q^{2K_*}\times[0,2U_*-1]^{K_*}\times\left(\Sigma_q^{2B_*}\right)^{2U_*}. V Syn ≜ [ 0 , M n , ∗ − 1 ] × [ 0 , 2 U ∗ − 1 ] × Σ q 2 K ∗ × [ 0 , 2 U ∗ − 1 ] K ∗ × ( Σ q 2 B ∗ ) 2 U ∗ .
This set has 2 U ∗ ( 4 U ∗ ) K ∗ q 4 B ∗ U ∗ M n , ∗ 2U_*(4U_*)^{K_*}q^{4B_*U_*}M_{n,*} 2 U ∗ ( 4 U ∗ ) K ∗ q 4 B ∗ U ∗ M n , ∗ elements.
Proposition VI.3. For n ≥ 1 n\ge1 n ≥ 1 and any x ∈ Σ q n x\in\Sigma_q^n x ∈ Σ q n , the syndrome Syn n ≠ ( x ) \operatorname{Syn}^{\ne}_n(x) Syn n = ( x ) can be computed in O q , k ( n log n ) O_{q,k}(n\log n) O q , k ( n log n ) bit operations.
The proof of this proposition is deferred to Appendix A.
For θ ∈ V Syn \theta\in\mathcal{V}_{\operatorname{Syn}} θ ∈ V Syn , let
C ≠ ( n ; θ ) ≜ { x ∈ Σ q n : Syn n ≠ ( x ) = θ } . \mathcal{C}^{\ne}(n;\theta)\triangleq\left\{x\in\Sigma_q^n:\operatorname{Syn}^{\ne}_n(x)=\theta\right\}. C = ( n ; θ ) ≜ { x ∈ Σ q n : Syn n = ( x ) = θ } .
The main result of this section is given below.
Theorem VI.1. For n ≥ T ∗ n\ge T_* n ≥ T ∗ and θ ∈ V Syn \theta\in\mathcal{V}_{\operatorname{Syn}} θ ∈ V Syn , every nonempty C ≠ ( n ; θ ) \mathcal{C}^{\ne}(n;\theta) C = ( n ; θ ) is an unequal-length k k k -substring edit correcting code. For any x ∈ C ≠ ( n ; θ ) x\in\mathcal{C}^{\ne}(n;\theta) x ∈ C = ( n ; θ ) and any y ∈ E 1 , k ≠ ( x ) y\in\mathcal{E}^{\ne}_{1,k}(x) y ∈ E 1 , k = ( x ) , we can recover x x x from y y y in O q , k ( n 2 log n ) O_{q,k}(n^2\log n) O q , k ( n 2 log n ) bit operations by brute force. Moreover, there exists some θ \theta θ such that red 2 ( C ≠ ( n ; θ ) ) ≤ log n + O q , k ( 1 ) \operatorname{red}_2\left(\mathcal{C}^{\ne}(n;\theta)\right)\le\log n+O_{q,k}(1) red 2 ( C = ( n ; θ ) ) ≤ log n + O q , k ( 1 ) .
Proof. Suppose x , z ∈ C ≠ ( n ; θ ) x,z\in\mathcal{C}^{\ne}(n;\theta) x , z ∈ C = ( n ; θ ) and y ∈ E 1 , k ≠ ( x ) ∩ E 1 , k ≠ ( z ) y\in\mathcal{E}^{\ne}_{1,k}(x)\cap\mathcal{E}^{\ne}_{1,k}(z) y ∈ E 1 , k = ( x ) ∩ E 1 , k = ( z ) . We will prove x = z x=z x = z .
Put h = n − ∣ y ∣ h=n-|y| h = n − ∣ y ∣ . Then 1 ≤ ∣ h ∣ ≤ k 1\le|h|\le k 1 ≤ ∣ h ∣ ≤ k . By Lemmas VI.1 and VI.3, the sequence χ k ( y ) \chi_k(y) χ k ( y ) is k k k -sparse and is obtained from both χ k ( x ) \chi_k(x) χ k ( x ) and χ k ( z ) \chi_k(z) χ k ( z ) by ( T ∗ , T ∗ − h ) (T_*,T_*-h) ( T ∗ , T ∗ − h ) -burst errors. Equation (68) gives H n ≠ ( χ k ( x ) ) = H n ≠ ( χ k ( z ) ) H^{\ne}_n(\chi_k(x))=H^{\ne}_n(\chi_k(z)) H n = ( χ k ( x )) = H n = ( χ k ( z )) . By Proposition VI.1, we have χ k ( x ) = χ k ( z ) \chi_k(x)=\chi_k(z) χ k ( x ) = χ k ( z ) . Then it follows from Proposition VI.2 that Lab ( u j x ) = Lab ( u j z ) \operatorname{Lab}(u_j^x)=\operatorname{Lab}(u_j^z) Lab ( u j x ) = Lab ( u j z ) for every j ∈ [ 0 , wt L 1 ( χ k ( x ) ) ] j\in[0,\operatorname{wt}_{L_1}(\chi_k(x))] j ∈ [ 0 , wt L 1 ( χ k ( x ))] , since G r ≠ ( x ) = G r ≠ ( z ) G_r^{\ne}(x)=G_r^{\ne}(z) G r = ( x ) = G r = ( z ) for every r ∈ [ 0 , 2 U ∗ − 1 ] r\in[0,2U_*-1] r ∈ [ 0 , 2 U ∗ − 1 ] by (68) . Notice that for each j ∈ [ 0 , wt L 1 ( χ k ( x ) ) ] j\in[0,\operatorname{wt}_{L_1}(\chi_k(x))] j ∈ [ 0 , wt L 1 ( χ k ( x ))] , the lengths of u j x u_j^x u j x and u j z u_j^z u j z are determined by χ k ( x ) \chi_k(x) χ k ( x ) . Now the equality x = z x=z x = z follows from Lemma VI.2.
We next give the decoding procedure and bound its complexity. Write m = ∣ y ∣ = n − h m=|y|=n-h m = ∣ y ∣ = n − h and define T h = { t ∈ [ 0 , k ] : 0 ≤ t + h ≤ k } \mathcal{T}_h=\{t\in[0,k]:0\le t+h\le k\} T h = { t ∈ [ 0 , k ] : 0 ≤ t + h ≤ k } . For every t ∈ T h t\in\mathcal{T}_h t ∈ T h , every p ∈ [ 1 , m − t + 1 ] p\in[1,m-t+1] p ∈ [ 1 , m − t + 1 ] , and every v ∈ Σ q t + h v\in\Sigma_q^{t+h} v ∈ Σ q t + h , form the candidate z = y [ 1 , p − 1 ] v y [ p + t , m ] z=y[1,p-1]vy[p+t,m] z = y [ 1 , p − 1 ] v y [ p + t , m ] . Each candidate has length m − t + ( t + h ) = n m-t+(t+h)=n m − t + ( t + h ) = n . Every length-n n n sequence that can give y y y by a k k k -substring edit occurs among these candidates. In particular, the transmitted codeword x x x occurs in this list.
Since m ≤ n + k m\le n+k m ≤ n + k , the number of candidates is at most
∑ t ∈ T h ( m − t + 1 ) q t + h ≤ ( m + 1 ) ∑ s = 0 k q s = O q , k ( n ) . \sum_{t\in\mathcal{T}_h}(m-t+1)q^{t+h}\le(m+1)\sum_{s=0}^{k}q^s=O_{q,k}(n). t ∈ T h ∑ ( m − t + 1 ) q t + h ≤ ( m + 1 ) s = 0 ∑ k q s = O q , k ( n ) .
Writing one candidate costs O q , k ( n ) O_{q,k}(n) O q , k ( n ) bit operations. By Proposition VI.3, computing the syndrome Syn n ≠ \operatorname{Syn}^{\ne}_n Syn n = of each candidate costs O q , k ( n log n ) O_{q,k}(n\log n) O q , k ( n log n ) bit operations. The syndrome has O q , k ( log n ) O_{q,k}(\log n) O q , k ( log n ) bits, so comparing it with θ \theta θ costs at most that many bit operations. The decoder returns the first candidate whose syndrome equals θ \theta θ . Such a candidate exists, and the correction property proved above ensures that it is x x x . The total decoding cost is therefore O q , k ( n 2 log n ) O_{q,k}(n^2\log n) O q , k ( n 2 log n ) bit operations.
Finally, we give the redundancy bound. By the pigeonhole principle, there exists θ ∈ V Syn \theta\in\mathcal{V}_{\operatorname{Syn}} θ ∈ V Syn such that
∣ C ≠ ( n ; θ ) ∣ ≥ q n 2 U ∗ ( 4 U ∗ ) K ∗ q 4 B ∗ U ∗ M n , ∗ . \left|\mathcal{C}^{\ne}(n;\theta)\right|\ge\frac{q^n}{2U_*(4U_*)^{K_*}q^{4B_*U_*}M_{n,*}}. C = ( n ; θ ) ≥ 2 U ∗ ( 4 U ∗ ) K ∗ q 4 B ∗ U ∗ M n , ∗ q n .
or equivalently,
red 2 ( C ≠ ( n ; θ ) ) ≤ log ( M n , ∗ ) + log ( 2 U ∗ ( 4 U ∗ ) K ∗ q 4 B ∗ U ∗ ) = log n + O q , k ( 1 ) . \begin{aligned}
\operatorname{red}_2\left(\mathcal{C}^{\ne}(n;\theta)\right)\le\log(M_{n,*})+\log\left(2U_*(4U_*)^{K_*}q^{4B_*U_*}\right) \\
&=\log n+O_{q,k}(1).
\end{aligned} red 2 ( C = ( n ; θ ) ) ≤ log ( M n , ∗ ) + log ( 2 U ∗ ( 4 U ∗ ) K ∗ q 4 B ∗ U ∗ ) = log n + O q , k ( 1 ) .
This completes the proof. ■
The constant term O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) in red 2 ( C ≠ ( n ; θ ) ) \operatorname{red}_2\left(\mathcal{C}^{\ne}(n;\theta)\right) red 2 ( C = ( n ; θ ) ) could be very large, as shown in the following example.
Example VI.4. For k = 2 k=2 k = 2 , the parameters in (58) and (60) are ℓ ∗ = 2 \ell_*=2 ℓ ∗ = 2 , B ∗ = 2 q 2 ( q − 1 ) + 1 B_*=2q^2(q-1)+1 B ∗ = 2 q 2 ( q − 1 ) + 1 , T ∗ = 8 T_*=8 T ∗ = 8 , U ∗ = 10 U_*=10 U ∗ = 10 , E ∗ = 182 E_*=182 E ∗ = 182 , K ∗ = 558 K_*=558 K ∗ = 558 and M n , ∗ = 12 n + 182 M_{n,*}=12n+182 M n , ∗ = 12 n + 182 . Theorem VI.1 gives a code with redundancy at most log ( 12 n + 182 ) + log 20 + 558 log 40 + 40 B ∗ log q \log(12n+182)+\log20+558\log40+40B_*\log q log ( 12 n + 182 ) + log 20 + 558 log 40 + 40 B ∗ log q .
As mentioned in § 1 -A, a ( ≤ k ) (\le k) ( ≤ k ) -burst-deletion and a ( t , k ) (t,k) ( t , k ) -localized deletion are particular unequal-length substring edits. We therefore obtain the following consequence from Theorem VI.1.
Corollary VI.1. For fixed q ≥ 2 q\ge2 q ≥ 2 and k ≥ t ≥ 1 k\ge t\ge1 k ≥ t ≥ 1 , Theorem VI.1 gives a ( ≤ k ) (\le k) ( ≤ k ) -burst-deletion correcting code with redundancy at most log n + O q , k ( 1 ) \log n+O_{q,k}(1) log n + O q , k ( 1 ) and a ( t , k ) (t,k) ( t , k ) -localized deletion correcting code with redundancy at most log n + O q , t , k ( 1 ) \log n+O_{q,t,k}(1) log n + O q , t , k ( 1 ) .
Conclusion
In this paper, we developed a new method to construct a q q q -ary k k k -substring edit correcting code with redundancy log n + 8 log log n + o ( log log n ) \log n + 8\log\log n + o(\log\log n) log n + 8 log log n + o ( log log n ) , for any fixed q ≥ 2 q \ge2 q ≥ 2 and k ≥ 1 k \ge1 k ≥ 1 . This improves upon the previous binary construction of Li et al., whose redundancy was log n + 16 k log log n + o ( log log n ) \log n+16k\log\log n+o(\log\log n) log n + 16 k log log n + o ( log log n ) . When the deleted substring and the inserted sequence have different lengths, we constructed q q q -ary codes with redundancy log n + O q , k ( 1 ) \log n+O_{q,k}(1) log n + O q , k ( 1 ) , which is optimal up to an additive constant. This gives q q q -ary ( ≤ t ) (\le t) ( ≤ t ) -burst-deletion correcting codes and ( t , T ) (t,T) ( t , T ) -localized deletion correcting codes with redundancies log n + O q , t ( 1 ) \log n+O_{q,t}(1) log n + O q , t ( 1 ) and log n + O q , T ( 1 ) \log n+O_{q,T}(1) log n + O q , T ( 1 ) , respectively, for all fixed q ≥ 2 q \ge2 q ≥ 2 and 1 ≤ t ≤ T 1 \le t \le T 1 ≤ t ≤ T .
Several questions remain. Recall that the lower bound on the redundancy of a k k k -substring edit correcting code is log n − O q , k ( 1 ) \log n-O_{q,k}(1) log n − O q , k ( 1 ) for fixed q q q and k k k . For general k k k -substring edits, it is natural to ask whether the additive O q , k ( log log n ) O_{q,k}(\log\log n) O q , k ( log log n ) redundancy can be reduced to O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) . A natural idea is to extend the unequal-length construction to include the equal-length setting. However, we showed in Proposition B.1 that a straightforward extension fails for a particular syndrome class, indicating that new ideas are required. For the unequal-length model, reducing the parameter-dependent constants in the redundancy and improving the decoding complexity would make the construction more useful at moderate lengths.
Appendix A: Proof of Proposition VI.3
Proof: For fixed q q q , k k k , the parameters ℓ ∗ \ell_* ℓ ∗ , D ∗ D_* D ∗ , B ∗ B_* B ∗ , T ∗ T_* T ∗ , U ∗ U_* U ∗ , E ∗ E_* E ∗ , and K ∗ K_* K ∗ are constants, whereas M n , ∗ = Θ k ( n ) M_{n,*}=\Theta_k(n) M n , ∗ = Θ k ( n ) . We compute the marker sequence, the marker syndrome H n ≠ H_n^{\ne} H n = , and the label checks as follows.
First, compute α = χ k ( x ) \alpha=\chi_k(x) α = χ k ( x ) . Pad x x x with k k k zeros on the left and ℓ ∗ + k \ell_*+k ℓ ∗ + k zeros on the right. Scan the resulting sequence using a sliding window of length ℓ ∗ + 2 k + 1 \ell_*+2k+1 ℓ ∗ + 2 k + 1 . Its n n n successive windows correspond to x [ i − k , i + ℓ ∗ + k ] x_{[i-k,i+\ell_*+k]} x [ i − k , i + ℓ ∗ + k ] for i ∈ [ n ] i\in[n] i ∈ [ n ] , under the zero extension.
By Lemma VI.1 (iii), each window determines whether its corresponding coordinate is a marker. Perform the required tests and comparisons, and output 1 if the coordinate is a marker and 0 otherwise. Advance the window by removing its first symbol and appending the next symbol. Since q , k q,k q , k are fixed, updating one window and deciding whether the corresponding coordinate is a marker cost O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations. There are exactly n n n windows, so computing α \alpha α costs O q , k ( n ) O_{q,k}(n) O q , k ( n ) bit operations.
Next, compute H n ≠ ( α ) H_n^{\ne}(\alpha) H n = ( α ) by scanning α \alpha α from left to right. For the VT residue, maintain V ∈ [ 0 , M n , ∗ − 1 ] V\in[0,M_{n,*}-1] V ∈ [ 0 , M n , ∗ − 1 ] , initially zero, and a position counter i i i , initially one. Whenever α i = 1 \alpha_i=1 α i = 1 , add i i i to V V V and subtract M n , ∗ M_{n,*} M n , ∗ if the sum is at least M n , ∗ M_{n,*} M n , ∗ . Since i ≤ n < M n , ∗ i\le n<M_{n,*} i ≤ n < M n , ∗ , the sum is less than 2 M n , ∗ 2M_{n,*} 2 M n , ∗ . Therefore, at most one subtraction is needed. After reading each bit, increase i i i by one. The counter i i i , the residue V V V , and the temporary sum have O k ( log n ) O_k(\log n) O k ( log n ) bits. Each increment, addition, comparison, or subtraction therefore costs O k ( log n ) O_k(\log n) O k ( log n ) bit operations. There are n n n increments and at most n n n residue updates. Therefore, computing VT ( α ) m o d M n , ∗ \operatorname{VT}(\alpha)\bmod M_{n,*} VT ( α ) mod M n , ∗ costs O k ( n log n ) O_k(n\log n) O k ( n log n ) bit operations.
The 2 K ∗ + 1 2K_*+1 2 K ∗ + 1 residues W : = w t L 1 ( α ) m o d 2 U ∗ W:=w_{tL_1}(\alpha)\bmod2U_* W := w t L 1 ( α ) mod 2 U ∗ , P r P_r P r , and R r R_r R r are computed as we read α \alpha α from left to right. Use a = i m o d K ∗ a=i\bmod K_* a = i mod K ∗ and b = i m o d 2 U ∗ b=i\bmod2U_* b = i mod 2 U ∗ for the current position i i i . Let c c c be the number of ones already read modulo K ∗ K_* K ∗ . Initially, set a = b = 1 a=b=1 a = b = 1 , c = W = 0 c=W=0 c = W = 0 , and all P r , R r P_r,R_r P r , R r to zero. If α i = 1 \alpha_i=1 α i = 1 , first set c = ( c + 1 ) m o d K ∗ c=(c+1)\bmod K_* c = ( c + 1 ) mod K ∗ . Then update W ← ( W + 1 ) m o d 2 U ∗ W\leftarrow(W+1)\bmod2U_* W ← ( W + 1 ) mod 2 U ∗ , P a ← ( P a + 1 ) m o d 2 P_a\leftarrow(P_a+1)\bmod2 P a ← ( P a + 1 ) mod 2 , and R c ← ( R c + 1 ) m o d 2 U ∗ R_c\leftarrow(R_c+1)\bmod2U_* R c ← ( R c + 1 ) mod 2 U ∗ . For the i i i -th one, the updated value of c c c is K ∗ K_* K ∗ , so its position contributes to the required R c R_c R c . After each bit, increase a a a modulo K ∗ K_* K ∗ and b b b modulo 2 U ∗ 2U_* 2 U ∗ . These counters and residues have O k ( 1 ) O_k(1) O k ( 1 ) bits, and each input bit requires only a constant number of updates. Thus the computation of these 2 K ∗ + 1 2K_*+1 2 K ∗ + 1 residues costs O k ( n ) O_k(n) O k ( n ) bit operations. Together with the VT computation, computing H n ≠ ( α ) H_n^{\ne}(\alpha) H n = ( α ) costs O k ( n log n ) O_k(n\log n) O k ( n log n ) bit operations.
Finally, compute the 2 U ∗ 2U_* 2 U ∗ label syndromes G r ≠ ( x ) G_r^{\ne}(x) G r = ( x ) by scanning 0 x 0x 0 x and α \alpha α in order. Initialize all group sums G r ≠ ( x ) G_r^{\ne}(x) G r = ( x ) to zero and a group counter g g g to zero. Start the first segment with the initial symbol of 0 0 0 . Whenever α i = 1 \alpha_i=1 α i = 1 , finish the current segment before x i x_i x i , add its label to G g ≠ ( x ) G_g^{\ne}(x) G g = ( x ) componentwise modulo q q q , increase g g g modulo 2 U ∗ 2U_* 2 U ∗ , and start the next segment at x i x_i x i . After reading x n x_n x n , finish the last segment and add its label to the corresponding G g ≠ ( x ) G_g^{\ne}(x) G g = ( x ) . For segment u j x u_j^x u j x , the group counter is g = j m o d 2 U ∗ g=j\bmod2U_* g = j mod 2 U ∗ , as required.
For each segment, start with d = 0 d=0 d = 0 and two empty strings L a b 1 \mathrm{Lab}_1 Lab 1 and L a b 2 \mathrm{Lab}_2 Lab 2 . Read the segment from left to right. For each new symbol, set d = min { d + 1 , B ∗ } d=\min\{d+1,B_*\} d = min { d + 1 , B ∗ } . Add the symbol to the end of L a b 1 \mathrm{Lab}_1 Lab 1 if ∣ L a b 1 ∣ < B ∗ |\mathrm{Lab}_1|<B_* ∣ Lab 1 ∣ < B ∗ . Also add the symbol to the end of L a b 2 \mathrm{Lab}_2 Lab 2 . If this makes L a b 2 \mathrm{Lab}_2 Lab 2 longer than B ∗ B_* B ∗ , remove the first symbol of L a b 2 \mathrm{Lab}_2 Lab 2 . At the end of a segment of length m m m , we have d = min { m , B ∗ } d=\min\{m,B_*\} d = min { m , B ∗ } , and the two length-d d d sequences L a b 1 \mathrm{Lab}_1 Lab 1 and L a b 2 \mathrm{Lab}_2 Lab 2 are respectively the prefix and suffix of that segment. Add B ∗ − d B_*-d B ∗ − d zeros to the end of each of L a b 1 \mathrm{Lab}_1 Lab 1 and L a b 2 \mathrm{Lab}_2 Lab 2 , and then form the label L a b = L a b 1 L a b 2 \mathrm{Lab}=\mathrm{Lab}_1\mathrm{Lab}_2 Lab = Lab 1 Lab 2 . Since q , k q,k q , k are fixed, the counter and both strings have O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bits. Thus each symbol update and each label computation cost O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations.
Adding one label to a group sum requires 2 B ∗ 2B_* 2 B ∗ component updates modulo q q q . Each update adds two integers in [ 0 , q − 1 ] [0,q-1] [ 0 , q − 1 ] and subtracts q q q if necessary, so it costs O q ( 1 ) O_q(1) O q ( 1 ) bit operations. Increasing g g g modulo 2 U ∗ 2U_* 2 U ∗ , setting d = 0 d=0 d = 0 , and resetting L a b 1 \mathrm{Lab}_1 Lab 1 and L a b 2 \mathrm{Lab}_2 Lab 2 to empty sequences also cost O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations per segment. Reading 0 x 0x 0 x processes n + 1 n+1 n + 1 symbols and gives at most n + 1 n+1 n + 1 segments. Updating d d d and the two stored strings costs O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations for each input symbol. After a segment has been read, forming its label, updating the group sum, and preparing the stored strings for the next segment cost O q , k ( 1 ) O_{q,k}(1) O q , k ( 1 ) bit operations. There are n + 1 n+1 n + 1 input symbols and at most n + 1 n+1 n + 1 segments, so all label checks cost O q , k ( n ) O_{q,k}(n) O q , k ( n ) bit operations.
Computing α \alpha α and the label syndromes costs O q , k ( n ) O_{q,k}(n) O q , k ( n ) bit operations, while computing H n ≠ ( α ) H_n^{\ne}(\alpha) H n = ( α ) costs O k ( n log n ) O_k(n\log n) O k ( n log n ) bit operations. The total cost is therefore O q , k ( n log n ) O_{q,k}(n\log n) O q , k ( n log n ) , as claimed. ▪
Equal-Length Edits
In Theorem VI.1, we show that every nonempty set C ≠ ( n ; θ ) C^{\ne}(n;\theta) C = ( n ; θ ) is an unequal-length k k k -substring edit correcting code. The example below shows that the correction property in Theorem VI.1 cannot be extended to all equal-length edits.
Proposition B.1. Let q ≥ 3 q \ge3 q ≥ 3 and k = 2 k = 2 k = 2 . At length n = 84 n = 84 n = 84 , there is a syndrome value θ ∈ V S y n \theta\in\mathcal{V}_{\mathrm{Syn}} θ ∈ V Syn such that C ≠ ( n ; θ ) C^{\ne}(n;\theta) C = ( n ; θ ) contains two distinct sequences with a common received sequence after one substitution.
Proof. Here ℓ ∗ = 2 \ell_* = 2 ℓ ∗ = 2 and U ∗ = 10 U_* = 10 U ∗ = 10 , so the segment labels are grouped by their indices modulo 2 U ∗ = 20 2U_* = 20 2 U ∗ = 20 . Consider the following three sequences:
y = ( 0010 ) 21 , x = ( 0020 ) ( 0010 ) 20 , z = ( 0010 ) 20 ( 0020 ) . y = (0010)^{21}, \qquad x = (0020)(0010)^{20}, \qquad z = (0010)^{20}(0020). y = ( 0010 ) 21 , x = ( 0020 ) ( 0010 ) 20 , z = ( 0010 ) 20 ( 0020 ) .
Clearly, x ≠ z x \ne z x = z . All three sequences have length n = 84 n = 84 n = 84 . Replacing the symbol 2 by 1 at position 3 of x x x , or at position 83 of z z z , gives y y y . Thus, x x x and z z z have a common received sequence after one substitution.
We next check their markers. In each block 00 c 0 00c0 00 c 0 , where c ∈ { 1 , 2 } c \in\{1, 2\} c ∈ { 1 , 2 } , only the first and third positions are special. Their corresponding length-three sequences are 00 c 00c 00 c and c 00 c00 c 00 . A first position is a marker: every other special position within distance two is a third position, whose corresponding sequence starts with 1 or 2, whereas 00 c 00c 00 c starts with 0. A third position is not a marker because the first position of its own block is at distance two and has a smaller corresponding sequence. There are no special coordinates outside [ 84 ] [84] [ 84 ] , since the first two symbols are zero and the sequences are extended by zeros. Hence the set of markers of each of x x x , y y y and z z z is { 1 , 5 , 9 , … , 81 } \{1,5,9,\ldots,81\} { 1 , 5 , 9 , … , 81 } , and χ k ( x ) = χ k ( z ) = χ k ( y ) = ( 1000 ) 21 \chi_k(x) = \chi_k(z) = \chi_k(y) = (1000)^{21} χ k ( x ) = χ k ( z ) = χ k ( y ) = ( 1000 ) 21 . Their marker syndromes in (63) are therefore equal.
The markers split 0 x 0x 0 x and 0 z 0z 0 z into the initial segment 0, followed by the 21 displayed blocks of length four. For x x x , segments 1 and 21 are 0020 and 0010; for z z z , they are 0010 and 0020. All other segments are equal. Since 1 ≡ 21 ( m o d 20 ) 1 \equiv21 \pmod{20} 1 ≡ 21 ( mod 20 ) , both labels are added to G 1 ≠ G_1^{\ne} G 1 = . For both sequences, this group sum contains one label for 0020 and one label for 0010, so the sums are equal. Every other group sum is also equal because its segments are unchanged. Thus G r ≠ ( x ) = G r ≠ ( z ) G_r^{\ne}(x) = G_r^{\ne}(z) G r = ( x ) = G r = ( z ) for every r ∈ [ 0 , 19 ] r \in[0,19] r ∈ [ 0 , 19 ] .
By (68) , we have Syn 84 ≠ ( x ) = Syn 84 ≠ ( z ) \operatorname{Syn}_{84}^{\ne}(x) = \operatorname{Syn}_{84}^{\ne}(z) Syn 84 = ( x ) = Syn 84 = ( z ) . Take θ \theta θ to be this common value. Then x , z ∈ C ≠ ( 84 ; θ ) x,z \in C^{\ne}(84;\theta) x , z ∈ C = ( 84 ; θ ) , and both give y y y after one substitution, as required. ▪