Manuscript Offprint
arXiv:2611.02192Concatenation Locality under Successive Adjacent Transpositions
Abstract
We study codes correcting up to successive adjacent transpositions, using block concatenation to support blockwise encoding and decoding. A fixed set of words of length over a -symbol alphabet generates, for every , the length- code of all concatenations of words from . For our explicit constructions, the prepared encoder and decoder depend only on the block parameters and are reused at every concatenation length. We first prove that correction at every concatenation length is certified by a single finite test at blocks, and this test is tight over a -symbol alphabet exactly when . For binary words and , we give an explicit construction with total redundancy at most , matching the optimal per-block redundancy among block sets correcting at every concatenation length. Among all binary -correcting codes of length , the optimal total redundancy is . Using all concatenations of one block set makes our total redundancy grow linearly in and buys independent block encoding, with one encoder and decoder at every length. The construction encodes and decodes in time linear in for fixed , and recovers the -th source block from the first received symbols. We also prove that, whenever the length- code corrects transpositions, the -th source block is determined within received symbols beyond position , and that explicit binary block sets with rates tending to one as grows with fixed attain this bound in the worst case. Finally, we prove that every ordinary correcting code contains a constant fraction of its words whose arbitrary concatenations retain correction, for fixed .
Keywords: adjacent transpositions, block concatenation, error correction, streaming decoding, decoding delay, finite automata.
1 Introduction
Local reordering errors, which preserve the symbols of a word but may change their order, arise in bit-shift channels [12] and in limited permutation channels [14]. The corresponding coding problems depend on which reorderings the channel permits. Successive adjacent transpositions count each exchange of two neighboring symbols separately and allow later exchanges to overlap earlier ones. Other models restrict exchanges to disjoint pairs or bound the displacement of each symbol [13, 14].
We study codes that correct up to successive adjacent transpositions and are built by block concatenation. We use a fixed nonempty set of blocks of length , where is a -symbol alphabet, and write for all concatenations of such blocks. Each message block is encoded independently by the same map into a source block in . Block concatenation permits the same prepared encoder and decoder to serve every number of blocks. Our two explicit binary block constructions are the derivative and endpoint families of Sections 4 and 5; their preparation is deterministic and polynomial in (searches over candidate defining polynomials and field elements, fewer than each; Section 4), and the prepared code data are reused when changes. Each transmission is framed: the receiver's initial side information consists of , , and the total length . The composition of the transmitted word generally depends on the message. The complete received word determines this composition because swaps preserve it, whereas a proper received prefix may leave several compositions possible. The decoders of both families process symbols as they arrive, using data memory bounded in terms of , together with bits for framing counters.
We require correction of at most successive adjacent transpositions in the entire transmitted word, swaps across block boundaries included; a swap of two equal symbols counts as an error but leaves the word unchanged. The error budget applies to the complete frame. As in Kovačević's bounds [12], is fixed while varies. Boundary swaps couple neighboring blocks, so correction of isolated blocks alone is insufficient. By the finite-locality theorem below, a single finite test, done once, certifies correction at every concatenation length.
Adjacent transpositions are related to deletion and insertion errors: the change can be performed by deleting and inserting it after . Gabrys, Yaakobi, and Milenkovic combine a Varshamov–Tenengolts decoding step with a transposition decoder to correct one deletion and several adjacent transpositions [8]. This combination is a further application of efficient transposition decoding, beyond correcting transpositions alone. For a single adjacent transposition, Radonjic, Das, and Pokhrel give integer-code constructions [16]. Wu et al. study systematic deletion-correcting codes for permutations and words of prescribed composition [17]. Their fixed-composition setting also provides block sets for the present channel (Remark 6.3).
For binary words, the model of successive adjacent transpositions is the bit-shift model studied by Kovačević [12]: the error budget is the sum of the absolute displacements of the ordered occurrences of 1. His lattice constructions and packing bounds determine the asymptotic order of the largest code for every fixed , giving optimal redundancy for ordinary binary codes of length (codes that are arbitrary subsets of ; this sense of “ordinary” is used throughout). We study the same channel with an additional requirement on how codewords are assembled and decoded.
Block concatenation has been used for codewords whose blocks are permutations, with an outer code [11], and for the limited permutation channel [14, 6]. Ben Shimon and Zabokritskiy study binary and -ary block-concatenation codes for the latter channel [3, 2]. Their channel radius bounds the displacement of each symbol: already at radius one, a received word may result from arbitrarily many disjoint adjacent swaps. At radius one they give a local criterion that reduces correction at every length to finitely many local checks between blocks [3]; they also give an exact finite verifier of all-length correction for finite prefix-free binary block sets [3, Section 6.2, Theorems 13–14]. Our finite test gives a uniform -block criterion for the different error set of at most successive adjacent swaps. Kovačević, Kiah, and Goyal also give block constructions for the limited permutation channel [13, Section 3.2]. Our codes share the block-concatenation approach, but use a different error budget: two disjoint swaps are two errors here, whereas both are permitted at radius one in their model, and successive swaps here may also overlap.
We ask when corrects at every concatenation length, how large it can be, and how soon each source block can be decoded. We first prove that correction at blocks guarantees correction at every concatenation length. The proof restricts a collision, two distinct codewords that reach a common received word with at most swaps each, to a connected interval of the blocks touched by these swaps. The interval has at most blocks because the two paths cross at most block boundaries; this count also underlies the test's tightness and the delay bound.
The test is tight over a -symbol alphabet exactly when : a block set can then correct through blocks and first have a collision at , which needs a distinct unordered pair of symbols at each of its block boundaries. Over smaller alphabets, binary alphabets included for every , a test at blocks suffices; whether fewer blocks suffice is open when , as for binary words with (Section 7). The tightness construction is a guarded encoding of a labelled digraph derived from the Černý automaton [5]: each arc becomes a block whose long constant internal factor of guard symbols forces colliding codewords to agree away from block boundaries. The automaton has pairs of states whose shortest synchronizing words take every length from one through [1, pp. 2, 4] (Lemma 3.3). Two walks that diverge into the pair with synchronization time give a first collision at blocks. Its symbol pairs at the block boundaries are the distinct pairs of states the walks visit, so sufficiency counts the same pairs as necessity.
We give an explicit binary block construction for , the derivative family, with total redundancy at most , compared with the optimum for ordinary binary codes in Kovačević's setting [12]. Its blocks are the derivatives (inverse prefix sums) of the codewords of a binary BCH code [4]. By the established prefix-sum reduction [8, 13], prefix sums of the whole received word turn each swap, boundary swaps included, into at most one substitution in one block's segment, so the -th source block is recovered from the first received symbols. Its correction at every concatenation length is thus proved directly, as for the endpoint family. The finite test serves arbitrary block sets, which it certifies in principle by an enumeration over ; its value is structural: it bounds the number of blocks that must be examined. Every binary block set correcting at every concatenation length is itself a -correcting code of length , so Kovačević's upper bound shows that our per-block redundancy is optimal up to an additive term; equivalently, the largest such block set has size . Given this optimum, the gap in total redundancy is inherent to using all concatenations of one block set: their redundancy is times the per-block redundancy, linear in , whereas the optimum for ordinary codes grows logarithmically. In exchange, one block encoder and decoder serve every number of blocks. For an ordinary code, preparation, encoding and decoding costs, and the position by which each block is available depend on its construction (Table 1).
For the derivative family and the full transmitted word of length , using schoolbook arithmetic in a polynomial basis, the encoding and decoding costs after the reusable preparation are and bit operations, respectively. For fixed , these processing costs are and , as for the endpoint family (Table 1); they are linear in when is also fixed.
For decoding delay, we count the additional received symbols beyond position needed to determine the -th source block. Computation steps are counted separately. Our delay results are stated for the receiver described above, whose initial side information consists of and . We prove that whenever is -correcting, the delay is at most , by the same count of block boundaries crossed by the two paths. The derivative family has zero additional delay. The endpoint family, at lengths , places the derivative of a BCH codeword between two endpoint bits that let an uncertainty persist across successive blocks. Its worst-case delay is exactly in frames of at least blocks, so the general delay bound is sharp even at rates tending to one; in frames of at least blocks, it is even for a receiver told the composition (Section 5).
At these block lengths, Proposition 4.1, applied to the endpoint family's BCH code with two zero coordinates appended, gives a block set of the same length and size with zero additional delay. The derivative family of Table 1 instead uses a longer, shortened BCH code and has bound at these block lengths. The endpoint family's guarantee , smaller when , thus reflects the choice of BCH constituent. Its role here is to attain the general delay bound.
Finally, we prove that, for general alphabets, every ordinary -correcting code contains a subset of size at least whose concatenations correct at every length, where with . To select , we group the codewords of by their symbol counts modulo and keep a largest group, whose congruent compositions extend its correction at length to every length. If is half the -distance between two words' prefix symbol-count vectors at a cut, then the words are at least swaps apart (Lemma 6.4). Consequently, two source concatenations in at distance at most have equal prefix compositions at every block boundary: otherwise congruence modulo gives , forcing their distance to be at least . Thus, relative to , arbitrary concatenation costs only a constant additional redundancy per block for fixed . The guarantee covers correction and size; efficient selection and encoding of the subset depend on the representation of the supplied code.
Our contributions are as follows.
(i) We prove that correction at blocks guarantees correction at every length, and that this finite test is tight precisely when , with explicit block sets attaining it.
(ii) We construct binary codes of length with total redundancy at most for , and give encoding and decoding algorithms that run in time linear in for fixed and decode the -th source block from the first received symbols.
(iii) We prove that whenever is -correcting, the -th source block is determined after at most additional received symbols beyond position , and construct an explicit binary family, the endpoint family, whose worst-case delay equals this bound, with block redundancy .
(iv) We prove that every ordinary correcting code contains a subset with whose concatenations correct at every length, where is independent of .
Table 1 summarizes these redundancy and processing guarantees.
Table 1: Ordinary binary codes of optimal redundancy [12] versus the two explicit binary block families of this paper, for fixed and total length : the derivative family and the endpoint family. The derivative family requires . The endpoint family uses , with and ; there its smaller redundancy bound for comes from its choice of BCH code (Section 5). Processing costs count bit operations under schoolbook arithmetic; per-block quantities refer to the indicated block families. Block is the -th segment of symbols of the transmitted word.
| Ordinary code | Derivative family | Endpoint family | |
|---|---|---|---|
| Total redundancy | |||
| Per-block redundancy | — | ||
| Per-block optimum | — | met within | met within |
| Preparation | code-dependent | once, for | once, for |
| Encoding (fixed ) | code-dependent | ||
| Decoding (fixed ) | code-dependent | ||
| Block available by | code-dependent | symbol | |
| Correction for every | not required | yes | yes |
Section 2 defines the channel and proves finite locality. Section 3 proves tightness of the finite test and determines the alphabet threshold. Section 4 gives the explicit binary construction and its encoding and decoding algorithms. Section 5 studies decoding delay. Section 6 extracts block sets correcting at every concatenation length from ordinary codes and compares their sizes. Section 7 concludes with the remaining questions.
2.1 Channel model and first collision powers
Let be a finite alphabet, and let . For , let be the word obtained from by swapping and . The adjacent-transposition graph has vertex set and an edge between two distinct words when one is obtained from the other by one adjacent swap. A swap of two equal symbols counts as a channel error but leaves the word unchanged, so the graph has no edge for it; the paragraph after the next definition justifies this omission. Write for its shortest-path distance, with if and lie in different components, equivalently if some symbol has different multiplicities in the two words. This adjacent-transposition metric is also known as the Kendall tau sequence distance [7]. For any word , write for its composition vector, whose coordinate indexed by counts the occurrences of in . Let denote the corresponding standard basis vector.
Definition 2.1 (Predecessor balls and correction). For an integer and a received word , define
For , the product of transpositions is the identity. A code corrects adjacent transpositions, or is -correcting, if
Thus contains the words that can reach using at most swaps. A code is -correcting when every received word has at most one codeword predecessor in this ball.
For block concatenations, fix a nonempty set , where . Write for the set of all concatenations of blocks from . Each codeword has total length , and . Thus is the number of concatenated blocks and is the number of distinct blocks available at each position. Because every block has the same length , each word in has a unique decomposition into blocks. For and in , the blocks and correspond to the same block position. The -th block boundary, , lies between blocks and ; the adjacent coordinates are positions and . For , cut separates positions and , and the block boundaries are the fixed cuts . The channel acts on all words in ; intermediate and received words need not belong to . Reversibility lets us view the words reachable from in at most swaps as its possible predecessors; decoding asks which of them is a codeword. The decoder knows the block set , its block length , and the error radius ; the received length determines the power . Each transposition counts as one error. In particular, two disjoint swaps count as two errors. A swap sequence may repeat indices and may contain overlapping swaps. A transposition of two equal adjacent symbols counts as an error but leaves the current word unchanged; deleting such steps preserves every subsequent state and the final output, so omitting them from the graph does not change which words can be reached with at most swaps. Consequently,
A language is -correcting when the code is -correcting for every length . Let . Then , and every word in has length divisible by . In particular, is -correcting if and only if is -correcting for every ; we write for statements that hold uniformly over all concatenation lengths, and (equivalently ) when the length is fixed.
Lemma 2.2 (Correction and minimum distance). A code is -correcting if and only if
In particular, correcting two successive adjacent transpositions is equivalent to minimum adjacent-transposition distance at least five.
Proof. If , the two paths through give . Conversely, let a shortest path from to have length at most . Choose a vertex on this path after at most edges and with at most edges remaining. Then .
A radius- collision in a set is a pair of distinct words together with a word such that , written . Such a received word exists if and only if , by the two directions in the proof of Lemma 2.2.
Fix integers and , write , and let be nonempty. Define its first collision power at radius by
When every power is -correcting, set . For each , the derivative family of Section 4 contains explicit binary block sets with and arbitrarily large , the number of distinct blocks. If a collision occurs, appending the same block to both predecessors and the received word preserves it, so collisions persist in every larger power. Let be the supremum of the finite first collision power over all block lengths and block sets:
The indexing family is nonempty: for distinct , the block set has . Indeed, its first power is -correcting, while and differ by one adjacent transposition. For the finite test, once Theorem 2.3 shows that is finite, it is the number of blocks that a test must cover to certify every block set over ; the discussion after that theorem makes this precise.
2.2 Finite locality
The channel preserves length, so a collision in always compares two words in one power . The next theorem shows that correction of one power certifies correction at every concatenation length. The proof uses a graph on block positions, with each swap joining the blocks it touches: a component containing a differing block carries a collision on at most one more block than its number of swaps.
Theorem 2.3 (Finite locality). Let be nonempty and let be an integer. With at most successive adjacent transpositions on each predecessor path,
In particular, corrects two successive adjacent transpositions if and only if does.
Proof. Suppose that distinct reach one received word , using at most swaps on each path. Write and , with all displayed factors in . For , let be the -th block interval. Thus and occupy the coordinates of . Form a multigraph on , with one edge occurrence for each swap used by either path. A swap inside block gives a loop at ; a swap across the boundary between blocks and gives an edge . Since each path uses at most swaps, contains at most edge occurrences.
On every block untouched by the swaps, both paths preserve the restricted word, so agree there. Choose with ; at least one used swap touches block . Let be the vertex set of its connected component in . Edges between distinct vertices join consecutive blocks, so is a contiguous interval. Write , put , and define , , and , with the inherited coordinate order. Every used swap is supported wholly inside or wholly outside it, since a swap crossing an endpoint of would join to another vertex. Projecting each intermediate word onto turns an outside swap into an unchanged step and an inside swap into the corresponding adjacent transposition on the restricted word. Deleting the unchanged steps from the two projected paths therefore gives paths of adjacent swaps
If the component contains edge occurrences, it has at most vertices, since a spanning tree uses of those edge occurrences. Hence spans at most blocks.
Thus a collision in yields a collision in some , where . Choose any . Appending identical copies of to both predecessors and the received word pads this collision to . The reverse implication is immediate.
In terms of (1), Theorem 2.3 gives
Because the indexing family in (1) is nonempty and its finite integer values now lie in , the supremum is attained; that is, is the largest finite first collision power. Thus means that testing through power always suffices and that some block set has its first collision exactly in power ; whether depends on , as Section 3 shows.
Operationally, Theorem 2.3 gives a finite test for correction at every concatenation length: it suffices to test the single power . A direct testing procedure follows by enumeration. Put , and . Generate every word of and every sequence of at most adjacent swap indices, keeping each resulting word together with its predecessor. There are at most
such pairs. Grouping pairs with the same resulting word determines whether any received word has two distinct predecessors.
To determine when the finite test is tight, we will use the following cut estimate. It lower-bounds the number of swaps by the composition imbalances across prefixes. For a vector indexed by , write .
Lemma 2.4 (A lower bound from prefix compositions). Let have the same composition, and for put
Then
Proof. An adjacent transposition across cut , the boundary between positions and , changes only the prefix-composition difference at that cut, by a vector of -norm at most two. Let be a shortest path, and let be the number of its swaps crossing cut . At the prefix difference is ; at every prefix of the word equals the corresponding prefix of , so the prefix difference is 0. Hence , that is . Every swap crosses exactly one cut, and , so summing over proves (2).
3 Tightness and alphabet size
The next theorem characterizes when from (1) attains . A first collision at that power uses one swap at each of the block boundaries, which is the whole swap budget of the two predecessor paths, and the unordered pairs of symbols exchanged at these boundaries must be distinct: repeating one in either orientation would give a collision in a smaller power.
Whatever the block length, there are only unordered symbol pairs, so longer blocks cannot supply the 2t distinct pairs this needs. Put
Theorem 3.1 (Exact alphabet threshold). For every and ,
Consequently, the smallest alphabet size attaining the locality bound is
For sufficiency, we encode labelled transitions as blocks so that two walks with the same endpoints and label word yield a channel collision. Adding two equally labelled start arcs to the Černý automaton lets the walks diverge, after which a state pair synchronizes in the required number of steps. We give this construction first and then prove the alphabet obstruction. This section also determines immediately below the threshold, when .
3.1 Guarded encoding
Encode a directed arc by its tail, a long constant internal factor representing its label, and its head. For , the symbols at the -th block boundary are reversed between and when and . Long constant factors force two nearby concatenations to have the same aligned labels and to differ only by reversals of the symbols at block boundaries. On a run of consecutive blocks whose internal boundary pairs are all reversed, taking the arcs alternately from the two concatenations, starting at the run's first block with either one, gives two directed walks.
Let be a finite labelled directed multigraph, with maps tail, head: and , such that
Assume and choose distinct symbols , one for each . These guard symbols may also be vertices, since the estimates below allow arbitrary prefix-composition imbalance at the start of an internal factor. For , define
Write amb() for the minimum length of two directed walks with different arc sequences and the same initial vertex, final vertex, and label word, with the common endpoints ranging over and possibly equal, or if there are no such walks. The distinct guard symbols and (3) ensure that different arcs have different encoded blocks. For two concatenations of encoded blocks at distance at most , the first of the sufficient length conditions below rules out that a nonzero prefix-composition imbalance between them persists across a common internal factor, and the second rules out that their aligned internal labels differ.
Theorem 3.2 (Guarded encoding of labelled digraphs). Let , put M = 2t, and suppose that and
Then
Every pair of distinct directed walks of length at most with the same initial vertex, final vertex, and label word gives two predecessor paths with at most t swaps each to a common received word.
Proof. Suppose that distinct reach the same received word with at most swaps each. Then , and have the same composition. If the internal factor at an aligned position is in and in , with , the prefix differences at the cuts through this factor are
With , Lemma 2.4 gives
Thus the internal factors of corresponding blocks agree.
The remaining coordinates form clusters: the initial tail, the head-tail symbol pair at each block boundary, and the final head. If the first cluster with different multisets precedes the final head, the earlier clusters cancel, leaving a nonzero integer prefix difference of coordinate sum zero and -norm at least two; this difference persists across all cuts of the following common internal factor, contributing at least to (2). Hence all these clusters have equal multisets; equal total composition then gives equality at the final head, which has no following internal factor. The outer endpoints therefore agree, and the symbol pairs at each block boundary are either identical or reversed with unequal symbols. If boundary pairs are reversed, their disjoint swaps transform x into z. Each such boundary contributes one to the sum in (2) and every other cut contributes zero, whence
Split the two block sequences at every boundary where the symbol pairs agree coordinatewise, and select one of the resulting segments (a maximal interval of consecutive blocks, bounded by such boundaries or by the endpoints of the word) containing a reversed boundary pair. It has blocks, and the symbol pairs at all internal boundaries are reversed. Write and for the arcs encoded by its blocks in and . The labels agree at each position, the initial tails and final heads agree by the equalities at the cuts or word endpoints, and the reversed boundary pairs give
Thus the alternating arc sequences
are directed walks with the same label word and endpoints, since their initial tails agree and either possible final arc has the common final head. Equality of these walks would give
at every position, leaving no reversed boundary pair, so they are distinct. By (6), , so every collision in power implies
Conversely, take distinct same-label walks
where , , and . Form from the encoded at odd positions and encoded at even positions, and form by the opposite choice. Injectivity in (3) makes . At block boundary , the words have and , in parity-dependent order, and they agree elsewhere. Swap the symbols at every odd boundary with in , and at every even such boundary in . The resulting words agree coordinate by coordinate, and each path uses at most
adjacent transpositions of unequal symbols. This constructs a common received word; together with (7), it proves (5).
3.2 Construction from the Černý automaton
To obtain two distinct walks of length with the same endpoints and label word, we make them diverge from a common state in one step, then synchronize their two states in exactly further steps. The Černý automaton provides pairs with every synchronization time from one through . Under guarded encoding, the unordered symbol pair at the -th block boundary of the collision built from the two walks is the pair of states they occupy after steps. Along a shortest synchronizing word these pairs are pairwise distinct, since a repeat would shorten the word. For , the construction thus exhibits distinct pairs among the , as Lemma 3.7 requires of every first collision at blocks, and both directions of Theorem 3.1 count the same pairs. Fix , identify with , and use the transformations [5]
In words over , transformations act from left to right. For a two-element set , let be the minimum length of a word in mapping to a singleton.
Lemma 3.3 (Černý pairs). The values are 1, 2, ..., , each once. If , every pair has a unique representation
If , the same formula holds for , and the diameters , , satisfy
The representation chooses the shorter cyclic direction; for diameters the two directions tie, so selects one representative.
Behague and Johnson show that in every deterministic automaton on states that admits a word mapping all states to a singleton, the minimum word length mapping any prescribed pair of distinct states to a singleton is at most , and that this bound on pair rendezvous time is attained by a pair in the Černý automaton [1, pp. 2, 4]. Along a shortest word mapping a pair to a singleton, the images of the pair before the last letter are distinct pairs. For a pair attaining this bound they are therefore all pairs, and the suffixes of such a word, which are shortest words for these images, give each time in the stated range exactly once. For odd , Gusev describes the pairs and the action of the two letters on them, in a presentation that agrees with ours after shifting state indices and interchanging the letters [10, Lemma 1, arXiv pp. 5–6]. We derive the synchronization times , including those of even diameter pairs, and shortest words from the transformations above alone; Gusev's description serves only to match his presentation with ours. We use the derived formulas and shortest words to choose a pair with a prescribed synchronization time and to count the transitions retained in the construction of Theorem 3.4.
Proof. Let equal the claimed value on each pair and zero on singletons. We check that
For nondiameters, decreases by one unless , when wrapping to increases it. The map fixes pairs avoiding . It sends to , with denoting a singleton, and decreases by one. When is the second endpoint, the image of under is . Its canonical representation is , except when and , giving , or when and , giving . Substitution in the corresponding formulas for shows that does not decrease. For even diameters, decreases by one for ; the wrap to does not decrease it. The map fixes for , and sends to , or to a singleton when , decreasing by one. This proves (11), and hence .
The words
and
synchronize and , respectively, in the claimed number of steps. The first factor sends the pair to or ; each remaining factor sends to . Thus . Each nondiameter layer gives the interval ; for even , the diameter layer supplies the remaining values through . These disjoint intervals give the asserted spectrum, including .
We retain a set of transitions containing those used by the chosen pair's shortest word, and add two equally labelled start arcs. The resulting pair of walks gives the desired first collision power under guarded encoding, whose distinct guard symbols in for the three labels require .
Theorem 3.4 (Construction from the Černý automaton). Let , , and . There is a block set with
(14) where
In particular, has first collision power for every .
Proof. Put . Lemma 3.3 supplies the pair
whose synchronization time is . Write and fix a state . Define on with labels and arcs
where . The successive -steps in (12) or (13) act on . Thus the shortest synchronizing word uses only retained arcs. Prefixing the two start arcs gives two distinct walks of length with the same endpoints and label word.
Conversely, choose a shortest pair of distinct walks with the same endpoints and label word. These walks diverge at their first step and meet again only at their last: a common prefix or an earlier meeting would give a shorter such pair. The a- and c-transitions are deterministic, so divergence uses the two s-arcs. A later s-step would require both walks to have returned to h before their final meeting. The remaining word therefore uses only a, c and synchronizes in the full automaton, taking at least R steps. Hence .
Choose distinct guard symbols for the three labels, and take when and when ; for , would make the second quantity in (4) equal to , rather than strictly larger. The two quantities in (4) are 4, 4 for , and , for , so both exceed . Theorem 3.2 gives . Set . There are cycle arcs, retained -arcs, and two start arcs. Their distinct encodings all have length , proving the stated parameters.
Corollary 3.5 (Realizable first collision powers). For and , every integer
is the first collision power of a block set over . In particular, .
Proof. The sets and have first collision powers one and two. This covers the asserted range for . For and , use Theorem 3.4 with .
Example 3.6 (Explicit radius-two realization). Take , , guards , and . The pair is synchronized by aaac in four steps. The eight blocks are
Interleaving the walks that start with and and then follow aaac, as in the proof of Theorem 3.2, gives the predecessors
These predecessors differ only at their four reversed boundary pairs, so swapping any two of these boundaries in and the other two in gives a common received word. Applying to and to gives . All four swaps exchange unequal symbols, and their unordered pairs are distinct. The construction theorem shows that the first four powers are 2-correcting, so this collision first occurs in power five.
3.3 The alphabet obstruction
The construction proves sufficiency in Theorem 3.1. For the converse, in any collision at first collision power , a component that contains a differing block, in the multigraph of the proof of Theorem 2.3, must span every block, since restriction to a smaller component would contradict minimality. Connecting all blocks then uses all available swaps, forcing one crossing per boundary. In the following lemma, shortest predecessor paths to the received word ensure that the swapped boundary pairs have unequal symbols; the proof then shows that their unordered symbol pairs are distinct.
Lemma 3.7 (First collisions at power ). Let and satisfy . Then . In any collision in , with each predecessor path shortest to the chosen , each path uses exactly swaps, and each of the block boundaries is crossed exactly once across the two paths. The words agree away from the boundary coordinates and have reversed unequal pairs and at boundary . The unordered pairs , , are pairwise distinct.
Proof. If , a singleton has no collision, while a set containing distinct has first collision power two, witnessed by . Thus . Form the multigraph of the proof of Theorem 2.3 for the chosen paths. A component containing a differing block must contain all blocks, since otherwise restriction gives a collision in a smaller power. Connecting these blocks requires all boundary edges, while the two paths together use at most swaps. Hence each path has exactly swaps, every swap crosses a block boundary, and every boundary is crossed once.
Since , the coordinate pairs at the block boundaries are disjoint. Their swaps commute, and the sets of boundaries crossed on the two paths are complementary. From we obtain , the result of swapping the symbols at every block boundary of . Here shortestness excludes equal-symbol swaps, which would be removable unchanged steps, so the swapped pairs are unequal. This proves the claimed form of .
Suppose that for . If , delete blocks from both words. If , cross-splice instead:
After deletion, the new boundary pairs are and ; after cross-splicing, they are and . In both operations, retained boundary pairs remain reversed, with the word roles exchanged on the cross-spliced suffix, and all other coordinates agree. Thus are distinct words of , where , differing only at the coordinate pairs at their block boundaries. Partition those boundaries into two sets whose sizes differ by at most one, and swap the symbols at the boundaries in one set in and those in the other set in . The outputs coincide, using at most swaps on each path. This contradicts the first collision power .
Proof of Theorem 3.1. If , attainment of the supremum in (1) gives a block set with . Lemma 3.7 supplies distinct unordered symbol pairs, so . Conversely, this inequality implies , and Theorem 3.4 with gives . The reverse inequality is Theorem 2.3. Solving for the least integer gives the stated value of .
Corollary 3.8 (One pair below the threshold). Let and . If , then . In particular, , , , and .
Proof. Corollary 3.5 gives the lower bound. The finite-locality bound and Theorem 3.1 give , hence .
At radius one, therefore, : , whereas for every . At radius two, the corresponding threshold is , with and for . For , these results give , by Corollary 3.5, Theorem 2.3 and Theorem 3.1; at radius two this gives .
4 Explicit binary block codes
The finite-locality theorem reduces correction at every concatenation length to one finite test. We now give an explicit binary family, the derivative family, that corrects at every concatenation length, with an independent block encoder and a decoder that recovers block from the first received symbols. Its construction uses the prefix-sum reduction and standard binary BCH codes, and Proposition 4.1 proves its correction directly from their Hamming distance.
4.1 Binary constituents and the prefix-sum map
The established prefix-sum reduction turns each binary adjacent transposition into at most one substitution [8, 13]. It therefore allows standard codes correcting substitution errors to provide block sets for our channel. For , define the linear prefix-sum (integral) map and its inverse, the derivative , by
All sums in these maps are in , and denotes Hamming distance. A swap at positions changes only coordinate of . Chaining this fact along any successive swap path from to gives
Throughout, decoders are analyzed under the assumption that the received word results from at most successive adjacent transpositions of some codeword. For the streaming cost analysis, the receiver is given the transmission length before decoding starts. Recovery positions count the received symbols needed; the computation performed after those symbols arrive is accounted for separately. Remark 5.5 collects these receiver conventions in one place.
Proposition 4.1. Let be nonempty with Hamming distance at least , and set . Then , and every corrects successive adjacent transpositions. An encoder and a radius- Hamming decoder for give an independent block encoder and a decoder that recovers block from the first received symbols, under the stated error bound. If is closed under complement, then
Proof. The map is bijective, giving the cardinality assertion. Fix . For distinct , let block be the first where they differ. Their preceding blocks are identical, leaving a common cumulative parity prior to block . Because is the identity map, the global prefix sums and restricted to block evaluate to and for distinct ; these global prefix-sum segments thus have the same incoming parity offset . Since adding preserves Hamming distance, they retain the constituent code's Hamming separation and differ in at least coordinates. Thus, by (17), and Lemma 2.2 ensures is -correcting.
To encode, encode each message block as and transmit . To decode , form with one running parity bit of the received word. Keep the decoded source parity at the preceding block boundary, initially zero. Subtract from the next block of , Hamming-decode the result to , output , whose parity is , and replace by . Under the stated error bound, has at most Hamming errors in total relative to the true global prefix sum. Inductively the stored is correct, so every constituent decoding has at most errors and recovers the next source block. For each block , a swap across the next block boundary changes only integrated coordinate , which the Hamming decoder corrects using the decoded incoming source parity without observing symbol . Under the stated error bound, one block buffer and the constituent decoder's workspace suffice.
If is complement-closed, every block of a global prefix sum belongs to , proving one inclusion in (18). Conversely, for , the local prefix sum of block of is its block plus , with the boundary bit taken as zero when . This too belongs to , proving the other inclusion. In this case one may Hamming-decode the blocks of independently and apply to their concatenation, using the preceding decoded integrated bit at each block boundary.
For exact acceptance on arbitrary inputs, require each constituent decoding to return a word of or report failure, and accept a reconstructed source only after verifying its adjacent-transposition distance from the received word is at most . On an input that is finally rejected, earlier emitted blocks carry no recovery guarantee; withholding them until acceptance requires buffering the reconstructed message. For binary of equal weight, the representation of the distance by the positions of successive ones [12] gives
Since the prefix-composition difference of Lemma 2.4 has half -norm for binary words, (19) is that lemma holding with equality. Indeed, match the -th one of to the -th one of . At cut , the crossing matched indices are precisely those above the smaller prefix weight and at most the larger one; hence exactly matches cross, all in one direction. Summing counts their unit displacements. Every swap of two unequal symbols moves a single one by one position, giving the lower bound. For attainment, first move the ones whose matched positions lie to their left in increasing order of their matched indices, then those whose matched positions lie to their right in decreasing order. In either phase, the order of the matched positions leaves only zeros along each move, so the number of swaps is the total matched displacement. Unequal total weights give infinite adjacent-transposition distance. A scan thus checks that and the sum in (19) is at most . Whenever a radius- predecessor exists, the decoder of Proposition 4.1 reconstructs it, and every accepted candidate lies within adjacent transpositions of the received word. For this final check, keep the current received block until its source block is reconstructed, then update the global imbalance and accumulated distance by comparing the two blocks before reusing their buffers. Under the stated error bound, block is recovered from the first received symbols.
4.2 An explicit family and its encoding and decoding costs
Binary BCH codes provide constituents with logarithmic redundancy [4]. We give the defining checks and the needed parameter proof, so that the construction and its decoder use the same coordinate convention.
Lemma 4.2 (Binary BCH constituents). Let , , and . Fix a primitive element , and define
Then is a binary linear code of dimension at least , Hamming distance at least , and is closed under complement. For every , taking and shortening this code to length gives a binary linear code of dimension at least and the same distance lower bound. This bound guarantees positive dimension when .
Proof. The check with index is the square of the check with index . Repeated halving reduces every even index to one of the odd indices in . Each such field equation imposes at most binary linear constraints, so the dimension is at least . For a nonzero word of weight , let be its distinct nonzero location values . Its first checks say for . The matrix is a Vandermonde matrix times the invertible diagonal matrix with entries , and hence is invertible. It cannot annihilate the all-one vector, a contradiction. Finally, satisfies every check because and the geometric sum of all powers of vanishes. Linearity gives complement closure.
For shortening, require coordinates to be zero and delete them. These constraints reduce dimension by at most ; deletion of prescribed-zero coordinates preserves dimension and pairwise distance. The resulting dimension is at least .
The shortened constituent need not be complement-closed, so we use the sequential decoder in the proof of Proposition 4.1, carrying the decoded source parity between blocks. The following bounds are those of the decoder specified and analyzed in the proof of Theorem 4.3, which follows the standard syndrome and linear-system method [9, Section 2.1, Proposition 2.1.2]. For a nonnegative function , we write when there is a constant with for all admissible parameter values, and when, in addition, there is a constant with for all these values; these constants do not depend on the parameters, except on those named in a subscript or held fixed. Stored code data consist of the polynomial defining , the primitive element, the systematic parity matrix, and the coordinate ordering; powers of the primitive element are computed as needed. Throughout, a bit operation is a Boolean operation on a bounded number of bits, the reading or writing of one stored bit, or the movement of a head by one position on one of a fixed number of sequential stores, so every scan and rewind is charged and the explicit families' bounds therefore hold without random access. Preparation stores the parity matrix with one row for each parity coordinate, rows and entries in increasing coordinate order, and the coordinate ordering as a mask of bits marking the information coordinates.
Theorem 4.3 (Explicit binary block encoding and decoding). For and , set . There is a binary linear block set of dimension , with
such that every corrects successive adjacent transpositions. After preparing a polynomial basis of , a primitive element, and a systematic constituent encoder, independent encoding of message blocks takes bit operations, where . Algebraic decoding takes
in addition to stream counters and stored code data. Under the stated error bound, source block is recovered upon receipt of symbol . With schoolbook arithmetic in a polynomial basis, the algebraic decoding cost is bit operations.
Proof. Take , with from Lemma 4.2. The dimension, redundancy, and correction assertions follow from that lemma and Proposition 4.1. In systematic form, the constituent encoder computes its parity coordinates from information coordinates using at most binary additions, each parity coordinate in one pass over its stored row and the information bits; merging the information and parity bits under the mask then restores the original coordinate order in bit operations. Its parity matrix has bits, and the mask has bits. Differentiation costs , giving the encoding bound.
It remains to specify and bound the constituent decoder. First reinsert the prescribed zeros, where , obtaining . Compute its syndromes and their Hankel matrix
Find by Gaussian elimination. If , set . Otherwise solve
rejecting if this system is singular. Evaluate at every , require exactly roots among these locations, and flip the corresponding bits of . Return the shortened word only if all defining syndromes vanish, the prescribed-zero coordinates remain zero, and at most bits were flipped; otherwise reject.
To verify recovery, suppose , where and has weight . At its distinct error locations , the binary error values equal one, so . Consequently,
The first rows of form an invertible Vandermonde matrix. Thus is onto and is injective, giving . For , the leading -by- submatrix of is also invertible. The monic polynomial satisfies (22): multiply each equality by and sum. Uniqueness of the solution gives , so precisely the erroneous bits are flipped. If , all syndromes vanish and the decoder makes no flips. Conversely, every returned word passes the code checks and is within Hamming distance of its input. This proves exact constituent decoding, including rejection outside its Hamming balls. The preceding proposition supplies the blockwise channel decoder; the check in (19) supplies exact final acceptance for adjacent transpositions.
Syndrome computation, root evaluation, and final syndrome checking each take field operations, using successive powers or Horner evaluation. One rank computation and one linear solve take field operations and store field elements. A block buffer has bits, and , proving (21). Integration, differentiation, and comparison for the final distance check take additional binary or counter operations.
In a supplied polynomial basis, multiplication and reduction cost bit operations. Inversion by exponentiation to uses multiplications and costs bit operations. On the sequential stores, v, the rows of H in order, and the coefficients of f each have their own store, with s consecutive bits per field element; a pivot step copies the pivot row to a scratch store and rewinds this copy for each other row. Head movement is then dominated by the accompanying field arithmetic: a syndrome scan moves positions, a pivot step of the elimination , and a rewind of the locator polynomial . Gaussian elimination uses pivot inversions per block, so the bit cost is
where the last equality uses .
Preparation is reusable for every . Once a polynomial basis of and a primitive element are supplied, the remaining preparation expands the checks over and applies binary Gaussian elimination to compute a systematic generator in polynomial time in . Let be the bit cost of the whole preparation, which supplies a polynomial basis and a primitive element, computes the systematic encoder, and fixes the layouts of the stored code data. Since the field data can be found by a finite search, is finite and depends only on and , so preparation is independent of . We call the construction explicit because it is deterministic and fully specified, with this finite preparation. Moreover, is polynomial in : since , the field data come from a deterministic search over fewer than candidate defining polynomials and fewer than field elements, each tested in time polynomial in , and the remaining preparation is polynomial in , where . Including preparation, the final distance check, and the framing procedure described below, the first message costs bit operations to encode and to decode. These totals hold for all and , with the displayed dependence on , and ; for fixed , both are over the complete transmission. The decoder uses working bits, and the stored code data, including the parity matrix of bits and the mask of bits, are reused. Framing adds bits, and output storage is additional when release waits for final acceptance. For final distance checking, the accumulated distance can be capped at and rejection declared immediately when it exceeds ; before rejection the imbalance counters are bounded by . Thus this check adds bit operations. For framing, use a binary countdown from and a block-position counter. The countdown uses bit operations over the whole transmission: decrementing it touches bits in total, with constant-factor overhead for returning to its low-order bit. The block-position counter has size bounded in terms of . The test for the end of the frame compares the countdown with zero through a mark on its highest nonzero bit, which the decrements maintain, as Remark 5.5 describes; the test for a block boundary reads the block-position counter, at bit operations per symbol. Framing therefore takes bit operations, and for fixed . Both totals above absorb this: for decoding because , and for encoding because the Hamming packing bound, applied to the constituent , which has length , distance at least and the same redundancy , gives .
The code carries information bits and has total redundancy . At fixed , its rate tends to one as grows. At fixed , increasing reuses the same encoder and decoder while leaving the rate fixed. Under independent block encoding, the total redundancy grows linearly with , whereas the same prepared code data and bounded workspace are reused as grows. A single prepared implementation therefore encodes and decodes finite framed transmissions of any length known to the receiver. Every binary block set correcting at every concatenation length must itself correct errors at length . Kovačević's upper bound on the size of ordinary binary codes [12, Theorem 11, Corollary 12, and equation (54)] covers such codes. It concerns codes correcting a total displacement of the ordered ones of at most , whose codewords may have any weight and, by the convention stated right after his equation (54), may end in either bit. For equal weights this displacement equals the distance in (19), and words of unequal weights are infinitely far apart under both distances. The bound therefore gives per-block redundancy at least , so this family's bound is optimal up to an additive constant for fixed .
5 Decoding delay
The explicit binary family in the preceding section permits the same encoder to be used independently on every message block. We now analyze the decoding delay required to recover a block. Received symbols arrive sequentially from left to right, and the decoder knows the block parameters and the total sequence length . The composition of the transmitted word remains unknown to the decoder. The additional decoding delay for block is defined as the number of received symbols needed beyond position to determine that block. That is, the symbols beyond position are those at positions , position being the last position of block . This measures delay by symbol arrivals; computational operations performed between arrivals are accounted for separately.
Correct and irrevocable block recovery is required for every word within successive adjacent transpositions of , with a single swap budget for the entire word. On inputs outside this radius, the decoders below can report failure after emitting a prefix. An interface that releases output only after final channel acceptance buffers emitted blocks until the stream terminates. Working-memory bounds below exclude this final output buffer, as well as static, reusable code descriptions.
5.1 The general delay bound
Two possible transmissions that remain consistent with a received prefix agree on every source block that ends at least symbols before the end of the prefix. Their two swap paths together cross at most block boundaries. An untouched boundary therefore lets us apply correction to a shorter pair of source prefixes.
Theorem 5.1. Let be nonempty, and suppose that corrects successive adjacent transpositions. For every , all transmissions within the error bound whose received words share their first symbols have the same first source blocks, even if their received words differ later.
Proof. First, is -correcting for every . A collision in would extend to one in by appending the same blocks of to both sources and their common received word. At position , the claimed determination follows directly from correction of .
Suppose instead that . Consider two sources in and two paths of at most swaps whose received words agree through position . Among the cuts
at least one is crossed by neither path. Indeed, each crossing uses a swap at that cut, and the two paths contain at most 2t swaps in total. Restrict both paths to the prefix ending at an untouched cut hb. The source prefixes belong to , and their received prefixes agree. Correction of forces the source prefixes to agree. Since , their first blocks agree.
Thus at most 2tb additional received symbols beyond position jb suffice to decode source block j, for every alphabet and every correcting block set. The finite-locality result of Section 2 concerns a different quantity: is the number of source blocks needed to certify correction at every concatenation length. Here correction is assumed, and the bound describes the decoding delay during stream processing when source blocks become uniquely determined.
5.2 Binary decoding with bounded working memory
The preceding theorem gives unique determination over any alphabet. We now give a general decoder, using (19), for binary block sets whose layered recognizer, defined below, is supplied with the set or has width small compared with . It serves block sets without a decoder of their own; the explicit families of Theorem 4.3 and Corollary 5.4 have their own decoders. We assume a deterministic layered recognizer for : its layers correspond to positions in one block, its edges read one binary symbol, and acceptance at layer resets it to the initial state for the next block. Let bound the number of states in any layer. Trimming states outside accepting paths and merging the accepting states at layer yield a proper trellis of without increasing the width. A trie gives such a recognizer, of width at most , for a listed block set; a more compact description can give a smaller width.
Proposition 5.2 counts operations in the word RAM model rather than the bit operations of Section 4: addition, subtraction, multiplication, shifts, comparison, conditional branching, and direct or indirect memory access on words each count as one operation, as do reading and emitting one bit. Words accommodate recognizer-state indices, stream positions, addresses of the working memory, and integers of magnitude , such as costs, imbalances, their indices, and the product in the completion test of the proof below. Their bit lengths therefore depend on ; representing an arbitrary position from 0 through requires at least bits. The width bounds one layer, while construction and storage of the full recognizer are separate resources. The proposition assumes that a transition for a specified layer, state, and input bit is accessible in word operations, with the stored recognizer addressable in this model.
Proposition 5.2. Let be nonempty and have a deterministic layered recognizer of width at most , with constant-time transitions. If corrects successive adjacent transpositions, it has a decoder using
Block is output upon reaching received position . Recognizer construction and storage, and storage of the input and emitted output, are separate resources.
Proof. For a candidate source prefix and the observed prefix , put
The integer records the excess source weight in the prefix; is the cost already accumulated. The binary distance identity (19), equivalently the shift-distance representation by the positions of successive ones [12], gives at the end precisely when .
After reading position , retain for each recognizer state and imbalance only the smallest attainable cost , together with one predecessor pointer and its source bit. Initially the recognizer is at its initial state and . A source bit with a transition from gives the update
Block acceptance and reset are checked at every multiple of . For two histories with the same , each possible source continuation has the same recognizer path from and the same future cost increments. A minimum-cost history can therefore replace the other without losing an accepting continuation. This is a weighted shortest-path calculation on a product automaton, as in the general framework of [15, Section 5].
Early output requires an additional test. At position , set . With the source and received suffixes ranging freely over , completion at total distance at most is possible if and only if
To prove necessity, each new pair of bits changes the imbalance by at most one. Reaching zero therefore takes at least positions and adds cost at least ; the current contribution is already included in . For sufficiency, use source/received pairs when , or when , until the imbalance is zero. Fill any remaining positions with equal bits. The distance identity then gives the claimed completion. Discard every state failing (24). This test is monotone in , so minimum-cost replacement remains valid. Every codeword predecessor in survives these steps through some representative. At the end the test forces , and the stored cost is its exact adjacent-transposition distance.
We next justify output before the end. At a block boundary kb, every retained history contains k blocks of P and, by the completion test, extends to some full pair of binary words joined by at most t swaps. The received extension agrees with the observed prefix. For any two histories and k > 2t, apply the untouched-cut argument to these extensions and the cuts
At the untouched cut both source prefixes are words of , even though their arbitrary suffix extensions need not be. Correction of the corresponding shorter power forces agreement through block k - 2t. All retained histories consequently have the same first k - 2t blocks. Output the next common block and discard its stored history. At the end, output all remaining blocks of the unique accepted history, or report failure if none remains. For an input within the stated error bound an accepting history always remains, so each earlier output is a prefix of the unique source.
For the resource bound, implies . There are at most cells at each position, with two possible transitions per cell. Store predecessor nodes only for the uncommitted part of the stream. Immediately before a block is output, this part spans at most positions. Following any one live predecessor chain reconstructs the next block in operations. Remove the committed layers and cut the predecessor pointers at the retained boundary; keep the accumulated costs, so the swap budget continues to apply to the entire word. Retiring nodes takes at most as many operations as creating them. These counts give operations and working words. When the stream ends before a scheduled block output, its entire length is already within this window. For , each block is checked and output upon receipt of its last bit.
The decoder reads the input once and need not retain its past symbols. A listed block set can have a large recognizer, whose preparation and stored representation remain outside the online bounds.
5.3 High-rate block sets attaining the bound
The derivative construction in Proposition 4.1 has zero additional decoding delay. We now construct block sets of rate tending to one for which the full 2tb delay is necessary. We use the binary maps from (16). A code with prescribed Hamming distance will determine the block interiors, while the two endpoints permit uncertainty to persist across successive blocks.
Theorem 5.3. Let . Suppose that has Hamming distance at least , is closed under complement, and has at least four words. Put and , selecting one word per complement pair. Partition into any two nonempty sets, and define
Then , and corrects successive adjacent transpositions for every . For every , the maximum additional delay required for unique determination, over source-block indices and valid received words, is exactly 2tb.
Proof. Complementation pairs the words with first coordinate zero and one, so , while makes the partition into two nonempty classes possible. The derivative is injective, the two interior classes are disjoint, and each interior has two distinct endpoint choices. Hence .
For correction, suppose that are joined by at most swaps. By (17), their global binary prefix sums have Hamming distance at most . In a corresponding block with interior , the coordinates of the global prefix sum corresponding to that interior are , where , is the all-one word of length , and is the prefix parity immediately after the left endpoint. Complement closure puts this segment in . The corresponding two segments for must agree by the distance of . Since , the first coordinate of each segment equals its offset . Their first coordinates give equality of the offsets , and then equality of . Thus every aligned pair of interiors agrees, including its type or .
It remains to determine the endpoint bits. The parity argument identified the interiors and their parity offsets; we now use integer prefix weights to obtain the endpoint relations. The total absolute imbalance bound will force zero imbalance through each long interior and allow only compensating changes at a block boundary. Put
Each swap changes one integer prefix weight by one, so , and . Equal interiors make constant on the cuts from just after a block's left endpoint to just before its right endpoint.
Complement closure gives for every . Every such constant is consequently zero. It follows that the first left endpoints agree, the last right endpoints agree, and the endpoints at each block boundary satisfy
(26) where the differences are integers.
With equal interiors, a block of type , whose left endpoint is fixed, permits a first endpoint disagreement, while a block of type , whose endpoints are equal, propagates it. If the words differ, their first differing block has equal left endpoints, by the preceding boundary equation or the initial endpoint equality, and equal interiors. Its right endpoints must therefore differ, so its type is : type would force them equal. Equation (26) carries any right-endpoint disagreement to the next left endpoints. Each subsequent block must therefore have type , since type has fixed left endpoint zero, and its equal-endpoint rule carries the disagreement to its right endpoints. The disagreement thus reaches the final right endpoints, contradicting their equality. Hence , and Lemma 2.2 proves correction for every .
For the delay lower bound, choose , and abbreviate , . Take the two sources of blocks
At each of their block boundaries, the endpoint pairs are unequal-bit reversals. Choose any set of boundaries and swap the endpoint pairs there in ; swap the endpoint pairs at the complementary boundaries in . These coordinate pairs are disjoint, so these are two valid paths of exactly swaps. At a chosen boundary, the first pair becomes the second; at an unchosen boundary, the second becomes the first. All interiors and the first left endpoint already agree. Hence the resulting received words agree through position and differ only at their last coordinate, which is zero in the first word and one in the second. Their first source blocks differ. A decoder with the stated side information therefore cannot complete the first block before receiving symbol , giving additional symbols. For larger , append the same blocks of to both sources and received words. The two paths and their common received prefix remain valid. Theorem 5.1 gives the matching upper bound.
The two sources in (27) have weights differing by one. Each channel path preserves its own source weight; since that weight is not supplied to the decoder, both sources stay consistent with what it knows. Appending at least one common block places the necessary decision strictly before the end of the stream. For frames of at least blocks, the same worst-case delay occurs even when the receiver is told the composition: append to the lighter source in (27) and to , for any , and then common blocks if needed, so the two source weights become equal while their received words still agree before symbol .
Corollary 5.4 (The endpoint family). Let , , and . The unshortened complement-closed BCH constituent of Lemma 4.2 gives an explicit binary block set of length with redundancy at most
that has the properties stated in Theorem 5.3. For fixed , its rate tends to one along these block lengths.
Proof. The primitive binary BCH code of Lemma 4.2 has dimension , distance at least , and contains the all-one word. It is therefore complement-closed and has at least four words. Apply Theorem 5.3; its cardinality formula gives and . Dividing this redundancy bound by gives the rate limit.
The specialization in Corollary 5.4 also has a direct block encoder and a decoder that avoids listing and releases block by received position ; these explicit algorithms, whose costs follow, thus attain the smallest worst-case additional delay that Theorem 5.3 shows possible for this family. The subspace has dimension . Choose a systematic encoder for it and let be one of its information coordinates. Partition its derivatives according to or 1. The resulting block set is nonlinear, with encoding map
It uses information bits per block. If , the subspace has redundancy ; a prepared systematic parity matrix evaluates the map in bit operations per block, including differentiation and endpoint output.
To decode, form with one running parity bit. In each received block, Hamming-decode the interior coordinates of this global prefix sum to a word . Under the stated error bound, this segment differs in at most coordinates from the true , where is the prefix parity of the source immediately after the left endpoint. Since , . Normalizing by and applying therefore recovers the interior and its type before the preceding endpoints have been fixed. The sequential decoder in the proof of Proposition 4.1 instead subtracts the decoded prefix parity of the source at the preceding block boundary. Here combines that parity with the current left endpoint, so the two values of in (28) supply the remaining block candidates.
For each imbalance , retain a minimum prefix cost and a predecessor pointer at block boundaries. Compare each of the two candidate blocks with the received block, bit by bit, using (23); discard a branch as soon as its cost exceeds , and apply (24) at the boundary. Equal imbalances have identical future candidate blocks and future cost increments, since future interiors are recovered from received prefix sums. Thus minimum-cost replacement is valid. At a block boundary with imbalance , the prefix parity of the source is that of the received word plus modulo 2, and it fixes each candidate's segment of the global prefix sum. Since is within Hamming distance of the received segment, a candidate with segment disagrees with it in at least integrated bits. A disagreeing integrated bit at position makes the prefix weights through differ in parity, so is odd and . Summed over the interior, the candidate's prefix cost is at least , as ; this bound depends only on the prefix imbalances. The cost test thus discards every candidate with the wrong offset. The true source survives, and every retained history consists of blocks of with an arbitrary radius- completion. The same untouched-cut argument permits commitment after further blocks. At the end, zero imbalance and the accumulated cost certify exact acceptance; a failed constituent decoding or an empty state set causes rejection.
There are at most boundary imbalances and two length- candidate blocks per state. The endpoint calculation takes word operations. Store the common recovered interiors for the last blocks, and store only endpoint choices and predecessor pointers in the boundary nodes. This uses buffered bits, including the current received block, and working words for the boundary nodes. Here prefix costs and imbalances are bounded by , and predecessor pointers index these nodes, so costs, imbalances and pointers have bits; in the bit operations of Section 4, the endpoint calculation therefore takes bit operations, separate from constituent arithmetic and global framing. A constituent Hamming decoder with time and workspace adds time and workspace in its own cost model. The explicit constituent decoder in the proof of Theorem 4.3, applied to the interior coordinates of the unshortened constituent, gives field operations in as in (21), in addition to the endpoint calculation. The bit-cost conversion stated in that theorem and the reusable preparation costs described after its proof apply unchanged.
With the BCH constituents specified above, the derivative family and the endpoint family both have block redundancy for fixed , while their worst-case additional delays are zero and , respectively. For the lower redundancy estimate, a constituent of length and dimension satisfies the Hamming packing bound . Apply this with for the derivative family and for the endpoint family; the BCH bounds supply the other direction. Thus, as the block length grows, rate tending to one is compatible with either zero additional delay or worst-case additional delay . The endpoint family shows, through Theorem 5.3, that the delay bound of Theorem 5.1 is sharp at rates tending to one. At these lengths, Proposition 4.1, applied to the endpoint family's BCH constituent with two zero coordinates appended, gives a block set of the same length and size with zero additional delay. The derivative family of Theorem 4.3 instead, at , shortens a BCH code of length and guarantees redundancy at most when ; the endpoint family's smaller stated guarantee at these lengths therefore reflects the choice of constituent.
Remark 5.5 (Streaming operation). These results describe a streaming receiver for a framed transmission whose length is known. Preparation and stored code data are reused for every , and block is output by received position , or upon receipt of symbol in the derivative family (Theorem 4.3). The general recognizer-based decoder uses a number of working words bounded independently of ; their bit lengths follow the word RAM model stated above.
For the two explicit BCH-based families, the stated error bound, exact acceptance on arbitrary inputs, and early or withheld release of output are described before and after Proposition 4.1 and at the opening of Section 5, where recovery positions count symbol arrivals; computational resources are stated after the proof of Theorem 4.3 and after Corollary 5.4, with preparation charged once. In both, constituent decoding has the costs of Theorem 4.3 in field and bit operations. The derivative family adds integration, differentiation, and the final distance check; the endpoint family adds the word operations of the endpoint calculation, which also cover its integration, normalization, and differentiation and use operands and pointers of bits. For fixed , the local data-processing cost per block is independent of , so the numbers of operations in , bit operations, and word operations are each linear in ; for growing parameters, each has the dependence on the parameters stated where it is derived.
For both explicit BCH-based families, the data memory is bounded in terms of , with framing adding counter bits. The endpoint storage described above has this same bit-memory interpretation. These bounds exclude already emitted output and the reusable code description. The total length is used in the output position and in the completion test (24); the delay bound is independent of . The countdown described in Section 4 adds bit operations over the complete transmission; the endpoint completion test compares the remaining length only with . For comparisons with values at most , a mark on the highest nonzero bit identifies whether the remaining length fits in bits; only in that case are those bits inspected. The decrements already visit the bits needed to move the mark, and a flag recording whether the length fits, set with the counter, changes only when the mark crosses the threshold; each comparison thus uses bit operations beyond the countdown's amortized .
6 Extraction from ordinary correcting codes
A code correcting adjacent transpositions at one fixed length can lose correction when its words are concatenated. We seek one fixed subset, with the same block length and ambient alphabet, that corrects at every concatenation length, as the following example illustrates.
Example 6.1 (Correction under concatenation). Let , , and . Its three words have different weights, so corrects one adjacent transposition. Its second power contains
Swapping positions 2, 3 in gives . Thus the received word has predecessors and , reached with one and zero swaps, respectively, and fails to correct one error. The subset , however, corrects at every concatenation length; its blocks have different compositions but equal composition residues modulo 2, illustrating the later modular criterion. Every swap of two unequal symbols crosses a boundary and changes either 00 | 11 into 01 | 01, or 11 | 00 into 10 | 10. The resulting two mixed blocks identify the boundary and the original pair uniquely. A word received unchanged consists entirely of blocks 00 and 11. Thus every word produced by at most one swap has a unique predecessor in , and the restriction retains two of the three available blocks.
For a fixed alphabet and error radius, we will show that every ordinary correcting code contains such a subset retaining a constant fraction of its words. We first treat equal block compositions, then pass to composition residues with a modulus depending only on the error radius, giving a bounded number of classes independent of the block length.
6.1 Constant-composition blocks
For a pair of words whose corresponding blocks have equal compositions, the number of inversions of the matching that pairs the -th occurrences of each symbol separates across blocks, even though swap paths may cross their boundaries. Equal cumulative symbol counts before each block keep this matching inside corresponding block intervals, and its inversion count is the adjacent-transposition distance, which is therefore additive over the blocks. A common composition throughout the block set supplies this pairwise condition for every pair in every power.
Proposition 6.2 (Constant-composition blocks). Suppose that is nonempty and all its blocks have the same composition. For every and in ,
Consequently, is -correcting if and only if is -correcting, and .
Proof. Match the -th occurrence of each symbol in to its -th occurrence in , and let be the position matched to position . Every swap of two unequal symbols preserves the order of equal symbols, so a path from to realizes this matching. Its length is at least the inversion count of , since an adjacent swap changes that count by one. Sorting by adjacent inversions attains the count; each such swap exchanges different symbols. This gives the distance representation in [7, Section 3.3]. Equal compositions of corresponding blocks also give equal cumulative symbol counts before each block. The matching therefore stays within corresponding block intervals, and its inversion count separates over the blocks:
The correction criterion follows: distinct words of differ in some corresponding block, so Lemma 2.2 and the identity make every power -correcting once is, while a that is not -correcting has a collision already in . Hence .
Thus a finite first collision power greater than one requires blocks with different compositions.
Remark 6.3 (Deletion-channel reduction and systematic constructions). A direct map from swap paths to common deletions relates deletion-correcting constructions to the present channel. This application enlarges the alphabet; the extraction below keeps it fixed.
(i) General reduction: Along a path of adjacent swaps, distinguish individual symbol occurrences and select one occurrence from each swapped pair. Deleting the set of selected occurrences from both endpoints leaves the same subsequence: every pair of retained occurrences keeps its relative order. At most occurrences are deleted from each endpoint. For example, a single swap leaves either or as a common subsequence. Here a symbol-invariant deletion preserves the values of the surviving symbols. Applying this reduction to a direct path of at most swaps between two codewords shows that a code correcting at most symbol-invariant deletions has adjacent-transposition distance at least .
(ii) Application to explicit families: For fixed , and message length sufficiently large as a function of , the systematic constructions of Wu et al. [17, Theorems 6 and 9(i)], applied with deletion budget , insert markers into permutation messages, in which each symbol of the message alphabet occurs exactly once, or into messages of any prescribed composition. In these constructions, removing the inserted markers from a codeword recovers its message in order; this is the meaning of systematic for these insertion-based constructions. The deletion guarantee applies to the complete encoded words, markers included, under the deletion model in part (i). The same new, distinct symbols are used once each in every codeword. Each resulting block set consists of the codewords of all messages in one class, with one message length and one message multiset. Its block length is the message length plus or , its alphabet consists of the message symbols and the or markers, and the fixed message and marker multisets give all its blocks one composition. The cited general construction treats message alphabets with at least two symbols; a one-symbol message class is a singleton code. These marker counts refer to the enlarged alphabet. The distance bound makes each resulting block set -correcting; Proposition 6.2 then lifts correction to every power, yielding .
6.2 Composition residues and code size
Proposition 6.2 treats blocks of one fixed composition. Congruent composition vectors also suffice when the modulus is large enough relative to the error budget. The proof of Theorem 6.5 uses distance additivity only after a hypothetical pair within distance 2t has been forced to have equal corresponding-block compositions. For such a pair, the prefix-composition difference at each internal block boundary is componentwise a multiple of the modulus , so a nonzero one would have half -norm at least , and the following bound would give distance at least ; hence these differences vanish, and corresponding blocks have equal compositions. The following bound controls the composition difference that a short sequence of swaps can create at a cut.
Lemma 6.4 (A bound on prefix composition). Let have the same composition, and put
Then for every . The bound is attained over two symbols, as shown in the tightness construction for Theorem 6.5.
Proof. Lemma 2.4 gives . The coordinates of sum to zero, so is a nonnegative integer. Moreover, , and gives . If , then and . For , the indices are internal cuts and each contributes at least . Consequently,
The case is immediate.
Theorem 6.5 (Congruent block compositions). Let be integers with . Suppose that the nonempty set satisfies
Then is -correcting if and only if is -correcting. In particular, . The condition is tight as a uniform guarantee: for every and integers with , there is some block length admitting a nonempty set whose composition vectors are congruent modulo , and which is -correcting at the first power but not at every power.
Proof. The first power gives one direction. Conversely, suppose that is -correcting and that distinct words and in satisfy . They have equal total composition. At every internal block boundary,
A nonzero vector in this lattice whose coordinates sum to zero has positive-coordinate sum at least . Thus would give and hence by Lemma 6.4. The prefix compositions at all block boundaries therefore agree. Taking successive differences shows that each pair of corresponding blocks has equal composition.
Match occurrences of each symbol in their left-to-right order, as in Proposition 6.2. Equality of the compositions within each pair of corresponding blocks keeps this matching inside the corresponding block interval. Its inversions are precisely the within-block inversions, giving
At least one pair differs, so one summand is at least by Lemma 2.2, a contradiction.
For tightness, choose distinct symbols , set , and take . Its compositions are congruent modulo , and its two blocks have infinite mutual distance. There is a path of length from to : for , perform the swaps at indices , moving the next to position . The prefix bound with shows that this path is shortest. If , its vertex after swaps is within swaps of both endpoints, so fails to correct swaps.
Contrapositively, a block set with has block compositions that are not all congruent modulo any with .
Partitioning a given code by composition residues now yields the required block set of the same block length. This guarantees correction and cardinality; algorithms for selection, encoding and decoding depend on the representation of the supplied code. The additional-delay bound of Theorem 5.1 separately applies to the extracted block set for known-length transmissions, and for Proposition 5.2 decodes its concatenations within that delay, at a cost linear in the width of a supplied layered recognizer, which is at most for a trie of the listed set.
Corollary 6.6 (The cost of correction at every power). For and , let be the largest size of a -correcting code in , and let be the largest size of a nonempty for which is -correcting. With , the fixed total length makes the last symbol-count residue determined by the other , and
More generally, every nonempty -correcting code contains such a block set of size at least . This is a lower bound on the retained fraction. The tightness statement in Theorem 6.5 concerns the modulus threshold as a uniform guarantee.
Proof. Partition by the counts of the first symbols modulo . There are at most classes, and the fixed block length determines the remaining count modulo . A largest class has size at least , inherits correction from , and corrects at every power by Theorem 6.5. Apply this to a largest ordinary code for the lower bound; the first power gives the upper bound.
For a nonempty code , write . The subset supplied by Corollary 6.6 satisfies
and every concatenation power of corrects errors. The input code is assumed to correct only at length ; the extraction adds correction under arbitrary concatenation. Taking of largest possible size shows that the smallest redundancy per block among block sets correcting at every concatenation length exceeds the ordinary length- optimum by at most , a constant for fixed . The binary case is an instance of this comparison. Kovačević's upper and lower bounds concern codes in the whole space of binary words of length , with codewords of any weight, and count the total displacement of the ones, which equals the adjacent-transposition distance. With the radius and the convention after his equation (54) as stated at the end of Section 4, they give [12, Theorem 11, Corollary 12, and equation (54)]. Combining this estimate with Corollary 6.6 gives . Thus the optimal per-block redundancy is for fixed . The derivative family of Section 4 attains this order for every ; the endpoint family of Section 5 does so at its stated BCH lengths , with and . Section 4 thus already gives both halves of , the upper one through the upper bound used there and the lower one through the derivative family; the cited lower bound, with Corollary 6.6, supplies an independent existence proof for the lower half. For their own block sets, the derivative family of Section 4 and the endpoint family of Section 5 provide explicit encoding and decoding algorithms. For an extracted block set, the correction and size guarantee is uniform over all input codes; its algorithmic use depends on how that code is represented.
In Example 6.1, the extraction retains two of three words, and the increase in redundancy per block is bit.
7 Conclusion and open problems
A fixed block set corrects successive adjacent transpositions at every concatenation length precisely when it does so at blocks. The test addresses correction across block boundaries, which independent blockwise encoding requires in addition to correction of isolated blocks. It is tight over a -symbol alphabet exactly when . The guarded encoding of a labelled digraph derived from the Černý automaton supplies block sets whose first collision occurs at blocks.
In the binary case, the derivative family, built from BCH codes, provides a reusable block encoder and decoder with total redundancy at most . This total is times the per-block redundancy , which is optimal among block sets correcting at every concatenation length: every such block set is itself a -correcting code of length , so Kovačević's upper bound gives it per-block redundancy at least (Section 4). The linear growth of the total redundancy in is therefore a cost of using all concatenations of a fixed block set. For fixed block parameters, the encoder and decoder of the derivative family take time linear in the total length, and their data memory is bounded in terms of , with additional bits for framing counters. For every block set such that is -correcting, we prove an additional decoding delay of at most received symbols. The derivative family and the endpoint family attain zero delay and worst-case delay , respectively, with the same leading per-block redundancy.
Finally, the extraction of Section 6 retains a constant fraction of any ordinary correcting code when are fixed. It bounds the cost of correction under arbitrary concatenation for general alphabets.
Several questions remain. Below the alphabet threshold, Section 3 bounds the largest finite first collision power by , with equality on the right when , as in ; we leave open the value of when . For fixed and , the ratio of the largest size of an ordinary length- correcting code to the largest size of a block set of length- words correcting at every concatenation length is at least 1 and, by the extraction, at most ; we leave open whether it tends to one as grows.
For larger alphabets, a natural objective is an explicit family combining the size guarantees of ordinary correcting codes with efficient blockwise encoding and decoding under arbitrary concatenation. The binary results also suggest studying the tradeoff between redundancy per block and decoding delay: both extremes of the delay interval, 0 and , are attained with logarithmic redundancy per block, and how its additive constant depends on the delay is open. We ask which integer worst-case delays between 0 and can be attained by families with per-block redundancy , and what the smallest additive constant in this per-block redundancy is among families whose worst-case delay is at most . Finally, when grows with , the dependence of redundancy, preparation, running time, and storage on both parameters becomes essential. The explicit bounds here provide a starting point for that regime.
References
[1] Natalie C. Behague and J. Robert Johnson. Synchronizing times for k-sets in automata. The Electronic Journal of Combinatorics, 29(3):P3.41, 2022.
[2] Noam Ben Shimon and Aryeh Lev Zabokritskiy (Yohananov). Extinction depth and q-ary error-correcting codes for the limited permutation channel, 2026. arXiv:2607.19566v1, preprint.
[3] Noam Ben Shimon and Aryeh Lev Zabokritskiy (Yohananov). A q-ary local criterion for the radius-one limited permutation channel and almost-optimal binary block-concatenation codes, 2026. arXiv:2606.26905v1, preprint.
[4] R. C. Bose and D. K. Ray-Chaudhuri. On a class of error correcting binary group codes. Information and Control, 3(1):68–79, 1960.
[5] Ján Černý. Poznámká k homogénnym experimentom s konečnými automatmi. Matematicko-fyzikálny časopis, 14(3):208–216, 1964.
[6] Yeow Meng Chee, Han Mao Kiah, San Ling, Tuan Thanh Nguyen, Van Khu Vu, and Xiande Zhang. String concatenation construction for Chebyshev permutation channel codes. In 2016 IEEE International Symposium on Information Theory (ISIT), pages 2824–2828, 2016.
[7] Vincent A. Cicirello. Kendall tau sequence distance: Extending Kendall tau from ranks to sequences. EAI Endorsed Transactions on Industrial Networks and Intelligent Systems, 7(23):e1, 2020.
[8] Ryan Gabrys, Eitan Yaakobi, and Olgica Milenkovic. Codes in the Damerau distance for deletion and adjacent transposition correction. IEEE Transactions on Information Theory, 64(4):2550–2570, April 2018.
[9] Irene Giacomelli. Improved decoding algorithms for Reed–Solomon codes, 2013. Master’s thesis, Università di Pisa, 2012. Cited section and proposition numbers refer to arXiv:1310.2473v1.
[10] Vladimir V. Gusev. Synchronizing automata with random inputs. In Developments in Language Theory, volume 8633 of Lecture Notes in Computer Science, pages 68–75. Springer, 2014. Cited lemma and page numbers refer to arXiv:1404.6731v1.
[11] Reolyn Heymann, Jos H. Weber, Theo G. Swart, and Hendrik C. Ferreira. Concatenated permutation block codes for correcting single transposition errors. In 2014 IEEE Information Theory Workshop (ITW), pages 576–580, 2014.
[12] Mladen Kovačević. Runlength-limited sequences and shift-correcting codes: Asymptotic analysis. IEEE Transactions on Information Theory, 65(8):4804–4814, August 2019. Cited result and equation numbers refer to arXiv:1803.06117v3.
[13] Mladen Kovačević, Han Mao Kiah, and Keshav Goyal. Bounds on codes correcting adjacent transpositions, 2025. arXiv:2509.06692v3, preprint, revised 14 August 2026.
[14] Michael Langberg, Moshe Schwartz, and Eitan Yaakobi. Coding for the -limited permutation channel. IEEE Transactions on Information Theory, 63(12):7676–7686, December 2017.
[15] Mehryar Mohri. Edit-distance of weighted automata: General definitions and algorithms. International Journal of Foundations of Computer Science, 14(6):957–982, 2003.
[16] Aleksandar Radonjic, Pankaj Kumar Das, and Nabin Kumar Pokhrel. Integer codes correcting single adjacent transposition errors. IEEE Communications Letters, 28(7):1499–1503, July 2024.
[17] Bolin Wu, Quan D. Bui, Kai Niu, Van Khu Vu, and Shuche Wang. Order-optimal systematic permutation codes for correcting deletions, 2026. arXiv:2609.37578v1.