On the size distribution of Levenshtein balls with radius one

Geyang Wang, Qi Wang · OpenReview

Abstract

In the study of synchronization errors, the Fixed-Length Levenshtein (FLL) distance provides a critical framework for understanding insertions and deletions that preserve sequence length. Unlike the Hamming metric, where the neighborhood size (ball size) of any given word is constant, the size of an FLL ball depends on the specific composition of the word. This paper investigates the distribution of these ball sizes for radius $t=1$. By applying Azuma’s inequality to Doob martingales, we prove that the size of FLL balls is highly concentrated around the mean. This suggests that despite the structural variability of individual words, most sequences in a language possess "neighborhoods" of remarkably similar size.

Introduction

In classical coding theory, the Hamming distance is the standard metric for measuring substitution errors. A key property of the Hamming space is its regularity: every word of length $n$ over an alphabet of size $m$ has exactly the same number of neighbors at a distance $d$. However, real-world communication channels are often prone to synchronization errors, such as insertions and deletions. These are measured using the Levenshtein distance.

This paper focuses on the Fixed-Length Levenshtein (FLL) metric. The FLL distance between two words $\mathbf{x, y} \in \mathbb{Z}_m^n$ is defined as the smallest integer $t$ such that $\mathbf{x}$ can be transformed into $\mathbf{y}$ via $t$ insertions and $t$ deletions. A fundamental challenge in this metric is that the size of a ball of radius $t$—the set of all words within distance $t$ of a center word—is not constant. For example, in a binary alphabet, the word 0000 has significantly fewer neighbors than the word 0101. While previous research by Bar-Lev, Etzion, and Yaakobi (2023) established the minimum, maximum, and average sizes for FLL balls of radius one, the distribution of these sizes remained an open question until now.

Methodology

To determine how ball sizes are distributed across the space of all possible words, we employ a probabilistic approach to prove concentration around the mean.

1. Doob Martingales

We treat a word as a sequence of random variables (symbols) exposed one by one. By calculating the conditional expectation of the ball size at each step of this exposure, we construct a Doob martingale. This allows us to track how the expected ball size evolves as more information about the word is revealed.

2. Azuma’s Inequality

The core of the proof relies on Azuma’s inequality, which bounds the probability that a random variable deviates from its mean. The primary technical hurdle was proving the "bounded difference" condition: showing that changing a single symbol in a word of length $n$ does not change the size of its FLL ball by more than a small constant.

3. Combinatorial Analysis

We analyzed the internal structure of words, specifically the number of "runs" (consecutive identical symbols) and "alternating segments" (e.g., 0101). Since the size of an FLL ball of radius one is directly related to these structural properties, we performed a rigorous combinatorial analysis to establish how symbol substitutions affect the aggregate count of these segments.

Key Results

Exponential Concentration

The main theoretical contribution (Theorems 3.3 and 3.5) is the proof that the probability of a word's ball size deviating from the mean by more than a factor of $n\sqrt{n}$ decays exponentially. This confirms that the "typical" word behaves very much like the average word in terms of its error-correction neighborhood.

Alphabet Generality

The concentration effect is not limited to binary sequences. We provide detailed proofs for both binary strings and the general $m$-ary case. While the specific constants change, the underlying phenomenon of concentration remains robust across different alphabet sizes.

Simulation Validation

To complement the theoretical proofs, we conducted simulations using synthetic random sequences (length $n=100$, sample size $N=5000$). The resulting histograms show a clear bell-curve distribution. While our theoretical bounds derived from Azuma’s inequality are mathematically rigorous, the simulations suggest that the actual concentration is even tighter than the theory currently predicts.

Discussion and Limitations

While this work provides a foundation for understanding the geometry of synchronization errors, several challenges remain:

  • Tightness of Bounds: The bounds provided by Azuma’s inequality are relatively "loose." Future work may involve using more sophisticated concentration inequalities to match the tighter distributions observed in simulations.
  • Radius Constraints: This study is restricted to radius $t=1$. As the radius increases, the combinatorial complexity of overlapping insertion/deletion sequences grows exponentially, making the distribution of balls for $t > 1$ a significantly more difficult problem.
  • Practical Application: Understanding the size distribution is a precursor to designing efficient error-correcting codes. These insights can eventually help in constructing codes that maintain high rates while remaining robust against synchronization slips.

Conclusion

We have demonstrated that the size of Fixed-Length Levenshtein balls of radius one is highly concentrated around the mean. By correcting previous calculations and applying martingale methods, we show that the variability of neighborhoods in the FLL metric is statistically predictable, providing a clearer picture of the mathematical landscape of edit-distance-based coding theory.

Summary updated

Abstract

The fixed length Levenshtein (FLL) distance between two words $\mathbf{x,y} \in \mathbb{Z}_m^n$ is the smallest integer $t$ such that $\mathbf{x}$ can be transformed to $\mathbf{y}$ by $t$ insertions and $t$ deletions. The size of a ball in FLL metric is a fundamental but challenging problem. Very recently, Bar-Lev, Etzion, and Yaakobi explicitly determined the minimum, maximum and average sizes of the FLL balls with radius one. In this paper, based on these results, we further prove that the size of the FLL balls with radius one is highly concentrated around its mean by Azuma's inequality.
BibTeX
@misc{wang2022size,
  author = {Geyang Wang and Qi Wang},
  title = {{On the size distribution of Levenshtein balls with radius one}},
  year = {2022},
  eprint = {2204.02201},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.02201},
}
Figure