This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Lower Bounds and Improved Algorithms for Asymmetric Streaming Edit Distance and Longest Common Subsequence

Xin Li
Department of Computer Science,
Johns Hopkins University.
lixints@cs.jhu.edu
Supported by NSF CAREER Award CCF-1845349.
   Yu Zheng
Department of Computer Science
Johns Hopkins University.
yuzheng@cs.jhu.edu
Supported by NSF CAREER Award CCF-1845349.

In this paper, we study edit distance (𝖤𝖣\mathsf{ED}) and longest common subsequence (𝖫𝖢𝖲\mathsf{LCS}) in the asymmetric streaming model, introduced by Saks and Seshadhri [SS13]. As an intermediate model between the random access model and the streaming model, this model allows one to have streaming access to one string and random access to the other string. Meanwhile, 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS} are both fundamental problems that are often studied on large strings, thus the (asymmetric) streaming model is ideal for studying these problems.

Our first main contribution is a systematic study of space lower bounds for 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS} in the asymmetric streaming model. Previously, there are no explicitly stated results in this context, although some lower bounds about 𝖫𝖢𝖲\mathsf{LCS} can be inferred from the lower bounds for longest increasing subsequence (𝖫𝖨𝖲\mathsf{LIS}) in [SW07, GG10, EJ08]. Yet these bounds only work for large alphabet size. In this paper, we develop several new techniques to handle 𝖤𝖣\mathsf{ED} in general and 𝖫𝖢𝖲\mathsf{LCS} for small alphabet size, thus establishing strong lower bounds for both problems. In particular, our lower bound for 𝖤𝖣\mathsf{ED} provides an exponential separation between edit distance and Hamming distance in the asymmetric streaming model. Our lower bounds also extend to 𝖫𝖨𝖲\mathsf{LIS} and longest non-decreasing subsequence (𝖫𝖭𝖲\mathsf{LNS}) in the standard streaming model. Together with previous results, our bounds provide an almost complete picture for these two problems.

As our second main contribution, we give improved algorithms for 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS} in the asymmetric streaming model. For 𝖤𝖣\mathsf{ED}, we improve the space complexity of the constant factor approximation algorithms in [FHRS20, CJLZ20] from O~(nδδ)\tilde{O}(\frac{n^{\delta}}{\delta}) to O(dδδpolylog(n))O(\frac{d^{\delta}}{\delta}\;\operatorname{polylog}(n)), where nn is the length of each string and dd is the edit distance between the two strings. For 𝖫𝖢𝖲\mathsf{LCS}, we give the first 1/2+ε1/2+\varepsilon approximation algorithm with space nδn^{\delta} for any constant δ>0\delta>0, over a binary alphabet. Our work leaves a plethora of intriguing open questions, including establishing lower bounds and designing algorithms for a natural generalization of 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS}, which we call longest non-decreasing subsequence with threshold (𝖫𝖭𝖲𝖳\mathsf{LNST}).

1 Introduction

Edit distance (𝖤𝖣\mathsf{ED}) and longest common subsequence (𝖫𝖢𝖲\mathsf{LCS}) are two classical problems studied in the context of measuring similarities between two strings. Edit distance is defined as the smallest number of edit operations (insertions, deletions, and substitutions) to transform one string to the other, while longest common subsequence is defined as the longest string that appears as a subsequence in both strings. These two problems have found wide applications in areas such as bioinformatics, text and speech processing, compiler design, data analysis, image analysis and so on. In turn, these applications have led to an extensive study of both problems.

With the era of information explosion, nowadays these two problems are often studied on very large strings. For example, in bioinformatics a human genome can be represented as a string with 33 billion letters (base pairs). Such data provides a huge challenge to the algorithms for 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS}, as the standard algorithms for these two problems using dynamic programming need Θ(n2)\Theta(n^{2}) time and Θ(n)\Theta(n) space where nn is the length of each string. These bounds quickly become infeasible or too costly as nn becomes large, such as in the human genome example. Especially, some less powerful computers may not even have enough memory to store the data, let alone processing it.

One appealing approach to dealing with big data is designing streaming algorithms, which are algorithms that process the input as a data stream. Typically, the goal is to compute or approximate the solution by using sublinear space (e.g., nαn^{\alpha} for some constant 0<α<10<\alpha<1 or even polylog(n)\operatorname{polylog}(n)) and a few (ideally one) passes of the data stream. These algorithms have become increasingly popular, and attracted a lot of research activities recently.

Designing streaming algorithms for 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS}, however, is not an easy task. For 𝖤𝖣\mathsf{ED}, only a couple of positive results are known. In particular, assuming that the edit distance between the two strings is bounded by some parameter kk, [CGK16a] gives a randomized one pass algorithm achieving an O(k)O(k) approximation of 𝖤𝖣\mathsf{ED}, using linear time and O(logn)O(\log n) space, in a variant of the streaming model where one can scan the two strings simultaneously in a coordinated way. In the same model [CGK16a] also give randomized one pass algorithms computing 𝖤𝖣\mathsf{ED} exactly, using space O(k6)O(k^{6}) and time O(n+k6)O(n+k^{6}). This was later improved to space O(k)O(k) and time O(n+k2)O(n+k^{2}) in [CGK16b, BZ16]. Furthermore, [BZ16] give a randomized one pass algorithm computing 𝖤𝖣\mathsf{ED} exactly, using space O~(k8)\tilde{O}(k^{8}) and time O~(k2n)\tilde{O}(k^{2}n), in the standard streaming model. We note that all of these algorithms are only interesting if kk is small, e.g., knαk\leq n^{\alpha} where α\alpha is some small constant, otherwise the space complexity can be as large as nn. For 𝖫𝖢𝖲\mathsf{LCS}, strong lower bounds are given in [LNVZ05, SW07], which show that for exact computation, even constant pass randomized algorithms need space Ω(n)\Omega(n); while any constant pass deterministic algorithm achieving a 2n\frac{2}{\sqrt{n}} approximation of 𝖫𝖢𝖲\mathsf{LCS} also needs space Ω(n)\Omega(n), if the alphabet size is at least nn.

Motivated by this situation and inspired by the work of [AKO10], Saks and Seshadhri [SS13] studied the asymmetric data streaming model. This model is a relaxation of the standard streaming model, where one has streaming access to one string (say xx), and random access to the other string (say yy). In this model, [SS13] gives a deterministic one pass algorithm achieving a 1+ε1+\varepsilon approximation of n𝖫𝖢𝖲n-\mathsf{LCS} using space O((nlogn)/ε)O(\sqrt{(n\log n)/\varepsilon}), as well as a randomized one pass algorithm algorithm achieving an εn\varepsilon n additive approximation of 𝖫𝖢𝖲\mathsf{LCS} using space O(klog2n/ε)O(k\log^{2}n/\varepsilon) where kk is the maximum number of times any symbol appears in yy. Another work by Saha [Sah17] also gives an algorithm in this model that achieves an εn\varepsilon n additive approximation of 𝖤𝖣\mathsf{ED} using space O(nϵ)O(\frac{\sqrt{n}}{\epsilon}).

The asymmetric streaming model is interesting for several reasons. First, it still inherits the spirit of streaming algorithms, and is particularly suitable for a distributed setting. For example, a local, less powerful computer can use the streaming access to process the string xx, while sending queries to a remote, more powerful server which has access to yy. Second, because it is a relaxation of the standard streaming model, one can hope to design better algorithms for 𝖤𝖣\mathsf{ED} or to beat the strong lower bounds for 𝖫𝖢𝖲\mathsf{LCS} in this model. The latter point is indeed verified by two recent works [FHRS20, CJLZ20] (recently accepted to ICALP as a combined paper [CFH+21]), which give a deterministic one pass algorithm achieving a O(21/δ)O(2^{1/\delta}) approximation of 𝖤𝖣\mathsf{ED}, using space O~(nδ/δ)\tilde{O}(n^{\delta}/\delta) and time O~δ(n4)\tilde{O}_{\delta}(n^{4}) for any constant δ>0\delta>0, as well as deterministic one pass algorithms achieving 1±ε1\pm\varepsilon approximation of 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS}, using space O~(nε)\tilde{O}(\frac{\sqrt{n}}{\varepsilon}) and time O~ε(n2)\tilde{O}_{\varepsilon}(n^{2}).

A natural question is how much we can improve these results. Towards answering this question, we study both lower bounds and upper bounds for the space complexity of 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS} in the asymmetric streaming model, and we obtain several new, non-trivial results.

Related work.

On a different topic, there are many works that study the time complexity of 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS}. In particular, while [BI15, ABW15] showed that 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS} cannot be computed exactly in truly sub-quadratic time unless the strong Exponential time hypothesis [IPZ01] is false, a successful line of work [CDG+19, BR20, KS20, AN20, HSSS19, RSSS19, RS20] has led to randomized algorithms that achieve constant approximation of 𝖤𝖣\mathsf{ED} in near linear time, and randomized algorithms that provide various non-trivial approximation of 𝖫𝖢𝖲\mathsf{LCS} in linear or sub-quadratic time. Another related work is [AKO10], where the authors proved a lower bound on the query complexity for computing 𝖤𝖣\mathsf{ED} in the asymmetric query model, where one have random access to one string but only limited number of queries to the other string.

1.1 Our Contribution

We initiate a systematic study on lower bounds for computing or approximating 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS} in the asymmetric streaming model. To simplify notation we always use 1+ε1+\varepsilon approximation for some ε>0\varepsilon>0, i.e., outputting an λ\lambda with 𝖮𝖯𝖳λ(1+ε)𝖮𝖯𝖳\mathsf{OPT}\leq\lambda\leq(1+\varepsilon)\mathsf{OPT}, where 𝖮𝖯𝖳\mathsf{OPT} is either 𝖤𝖣(x,y)\mathsf{ED}(x,y) or 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y). We note that for 𝖫𝖢𝖲\mathsf{LCS}, this is equivalent to a 1/(1+ε)1/(1+\varepsilon) approximation in the standard notation.

Previously, there are no explicitly stated space lower bounds in this model, although as we will discuss later, some lower bounds about 𝖫𝖢𝖲\mathsf{LCS} can be inferred from the lower bounds for longest increasing subsequence 𝖫𝖨𝖲\mathsf{LIS} in [SW07, GG10, EJ08]. As our first contribution, we prove strong lower bounds for 𝖤𝖣\mathsf{ED} in the asymmetric streaming model.

Theorem 1.

There is a constant c>1c>1 such that for any k,nk,n\in\mathbb{N} with nckn\geq ck, given an alphabet Σ\Sigma, any RR-pass randomized algorithm in the asymmetric streaming model that decides if 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\geq k for two strings x,yΣnx,y\in\Sigma^{n} with success probability 2/3\geq 2/3 must use space Ω(𝗆𝗂𝗇(k,|Σ|)/R)\Omega(\mathsf{min}(k,|\Sigma|)/R).

This theorem implies the following corollary.

Corollary 1.1.

Given an alphabet Σ\Sigma, the following space lower bounds hold for any constant pass randomized algorithm with success probability 2/3\geq 2/3 in the asymmetric streaming model.

  1. 1.

    Ω(n)\Omega(n) for computing 𝖤𝖣(x,y)\mathsf{ED}(x,y) of two strings x,yΣnx,y\in\Sigma^{n} if |Σ|n|\Sigma|\geq n.

  2. 2.

    Ω(1ε)\Omega(\frac{1}{\varepsilon}) for 1+ε1+\varepsilon approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y) for two strings x,yΣnx,y\in\Sigma^{n} if |Σ|1/ε|\Sigma|\geq 1/\varepsilon.

Our theorems thus provide a justification for the study of approximating 𝖤𝖣\mathsf{ED} in the asymmetric streaming model. Furthermore, we note that previously, unconditional lower bounds for 𝖤𝖣\mathsf{ED} in various computational models are either weak, or almost identical to the bounds for Hamming distance. For example, a simple reduction from the equality function implies the deterministic two party communication complexity (and hence also the space lower bound in the standard streaming model) for computing or even approximating 𝖤𝖣\mathsf{ED} is Ω(n)\Omega(n).111We include this bound in the appendix for completeness, as we cannot find any explicit statement in the literature. However the same bound holds for Hamming distance. Thus it has been an intriguing question to prove a rigorous, unconditional separation of the complexity of 𝖤𝖣\mathsf{ED} and Hamming distance. To the best of our knowledge the only previous example achieving this is the work of [AK10] and [AJP10], which showed that the randomized two party communication complexity of achieving a 1+ε1+\varepsilon approximation of 𝖤𝖣\mathsf{ED} is Ω(logn(1+ε)loglogn)\Omega(\frac{\log n}{(1+\varepsilon)\log\log n}), while the same problem for Hamming distance has an upper bound of O(1ε2)O(\frac{1}{\varepsilon^{2}}). Thus if ε\varepsilon is a constant, this provides a separation of Ω(lognloglogn)\Omega(\frac{\log n}{\log\log n}) vs. a constant. However, this result also has some disadvantages: (1) It only works in the randomized setting; (2) The separation becomes obsolete when ε\varepsilon is small, e.g., ε=1/logn\varepsilon=1/\sqrt{\log n}; and (3) The lower bound for 𝖤𝖣\mathsf{ED} is still weak and thus it does not apply to the streaming setting, as there even recoding the index needs space logn\log n.

Our result from Corollary 1.1, on the other hand, complements the above result in the aforementioned aspects by providing another strong separation of 𝖤𝖣\mathsf{ED} and Hamming distance. Note that even exact computation of the Hamming distance between xx and yy is easy in the asymmetric streaming model with one pass and space O(logn)O(\log n). Thus our result provides an exponential gap between edit distance and Hamming distance, in terms of the space complexity in the asymmetric streaming model (and also the communication model since our proof uses communication complexity), even for deterministic exact computation.

Next we turn to 𝖫𝖢𝖲\mathsf{LCS}, which can be viewed as a generalization of 𝖫𝖨𝖲\mathsf{LIS}. For example, if the alphabet Σ=[n]\Sigma=[n], then we can fix the string yy to be the concatenation from 11 to nn, and it’s easy to see that 𝖫𝖢𝖲(x,y)=𝖫𝖨𝖲(x)\mathsf{LCS}(x,y)=\mathsf{LIS}(x). Therefore, the lower bound of computing 𝖫𝖨𝖲\mathsf{LIS} for randomized streaming in [SW07] with |Σ|n|\Sigma|\geq n also implies a similar bound for 𝖫𝖢𝖲\mathsf{LCS} in the asymmetric streaming model. However, the bound in [SW07] does not apply to the harder case where xx is a permutation of yy, and their lower bound where |Σ|<n|\Sigma|<n is actually for longest non-decreasing subsequence, which does not give a similar bound for 𝖫𝖢𝖲\mathsf{LCS} in the asymmetric streaming model. 222One can get a similar reduction to 𝖫𝖢𝖲\mathsf{LCS}, but now yy needs to be the sorted version of xx, which gives additional information about xx in the asymmetric streaming model since we have random access to yy. Therefore, we first prove a strong lower bound for 𝖫𝖢𝖲\mathsf{LCS} in general.

Theorem 2.

There is a constant c>1c>1 such that for any k,nk,n\in\mathbb{N} with nckn\geq ck, given an alphabet Σ\Sigma, any RR-pass randomized algorithm in the asymmetric streaming model that decides if 𝖫𝖢𝖲(x,y)k\mathsf{LCS}(x,y)\geq k for two strings x,yΣnx,y\in\Sigma^{n} with success probability 2/3\geq 2/3 must use space Ω(𝗆𝗂𝗇(k,|Σ|)/R)\Omega\big{(}\mathsf{min}(k,|\Sigma|)/R\big{)}. Moreover, this holds even if xx is a permutation of yy when |Σ|n|\Sigma|\geq n or |Σ|k|\Sigma|\leq k.

Similar to the case of 𝖤𝖣\mathsf{ED}, this theorem also implies the following corollary.

Corollary 1.2.

Given an alphabet Σ\Sigma, the following space lower bounds hold for any constant pass randomized algorithm with success probability 2/3\geq 2/3 in the asymmetric streaming model.

  1. 1.

    Ω(n)\Omega(n) for computing 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) of two strings x,yΣnx,y\in\Sigma^{n} if |Σ|n|\Sigma|\geq n.

  2. 2.

    Ω(1ε)\Omega(\frac{1}{\varepsilon}) for 1+ε1+\varepsilon approximation of 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) for two strings x,yΣnx,y\in\Sigma^{n} if |Σ|1/ε|\Sigma|\geq 1/\varepsilon.

We then consider deterministic approximation of 𝖫𝖢𝖲\mathsf{LCS}. Here, the work of [GG10, EJ08] gives a lower bound of Ω(1Rnεlog(|Σ|εn))\Omega\left(\frac{1}{R}\sqrt{\frac{n}{\varepsilon}}\log\left(\frac{|\Sigma|}{\varepsilon n}\right)\right) for any RR pass streaming algorithm achieving a 1+ε1+\varepsilon approximation of 𝖫𝖨𝖲\mathsf{LIS}, which also implies a lower bound of Ω(1Rnεlog(1ε))\Omega\left(\frac{1}{R}\sqrt{\frac{n}{\varepsilon}}\log\left(\frac{1}{\varepsilon}\right)\right) for asymmetric streaming 𝖫𝖢𝖲\mathsf{LCS} when |Σ|n|\Sigma|\geq n. These bounds match the upper bound in [GJKK07] for 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS}, and in [FHRS20, CJLZ20] for 𝖫𝖢𝖲\mathsf{LCS}. However, a major drawback of this bound is that it gives nothing when |Σ||\Sigma| is small (e.g., |Σ|εn|\Sigma|\leq\varepsilon n). For even smaller alphabet size, the bound does not even give anything for exact computation. For example, in the case of a binary alphabet, we know that 𝖫𝖨𝖲(x)2\mathsf{LIS}(x)\leq 2 and thus taking ε=1/2\varepsilon=1/2 corresponds to exact computation. Yet the bound gives a negative number.

This is somewhat disappointing as in most applications of 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS}, the alphabet size is actually a fixed constant. These include for example the English language and the human DNA sequence (where the alphabet size is 44 for the 44 bases). Therefore, in this paper we focus on the case where the alphabet size is small, and we have the following theorem.

Theorem 3.

Given an alphabet Σ\Sigma, for any ε>0\varepsilon>0 where |Σ|2ε=O(n)\frac{|\Sigma|^{2}}{\varepsilon}=O(n), any RR-pass deterministic algorithm in the asymmetric streaming model that computes a 1+ε1+\varepsilon approximation of 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) for two strings x,yΣnx,y\in\Sigma^{n} must use space Ω(|Σ|ε/R)\Omega\left(\frac{|\Sigma|}{\varepsilon}/R\right).

Thus, even for a binary alphabet, achieving 1+ε1+\varepsilon approximation for small ε\varepsilon (e.g., ε=1/n\varepsilon=1/n which corresponds to exact computation) can take space as large as Ω(n)\Omega(n) for any constant pass algorithm. Further note that by taking |Σ|=εn|\Sigma|=\sqrt{\varepsilon n}, we recover the Ω(nε/R)\Omega\left(\frac{\sqrt{n}}{\varepsilon}/R\right) bound with a much smaller alphabet.

Finally, we turn to 𝖫𝖨𝖲\mathsf{LIS} and longest non-decreasing subsequence (𝖫𝖭𝖲\mathsf{LNS}), as well as a natural generalization of 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS} which we call longest non-decreasing subsequence with threshold (𝖫𝖭𝖲𝖳\mathsf{LNST}). Given a string xΣnx\in\Sigma^{n} and a threshold tnt\leq n, 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) denotes the length of the longest non-decreasing subsequence in xx such that each symbol appears at most tt times. It is easy to see that the case of t=1t=1 corresponds to 𝖫𝖨𝖲\mathsf{LIS} and the case of t=nt=n corresponds to 𝖫𝖭𝖲\mathsf{LNS}. Thus 𝖫𝖭𝖲𝖳\mathsf{LNST} is indeed a generalization of both 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS}. It is also a special case of 𝖫𝖢𝖲\mathsf{LCS} when |Σ|tn|\Sigma|t\leq n as we can take yy to be the concatenation of tt copies of each symbol, in the ascending order (and possibly padding some symbols not in xx). How hard is 𝖫𝖭𝖲𝖳\mathsf{LNST}? We note that in the case of t=1t=1 (𝖫𝖨𝖲\mathsf{LIS}) and t=nt=n (𝖫𝖭𝖲\mathsf{LNS}) a simple dynamic programming can solve the problem in one pass with space O(|Σ|logn)O(|\Sigma|\log n), and 1+ε1+\varepsilon approximation can be achieved in one pass with space O~(nε)\tilde{O}(\sqrt{\frac{n}{\varepsilon}}) by [GJKK07]. Thus one can ask what is the situation for other tt. Again we focus on the case of a small alphabet and have the following theorem.

Theorem 4.

Given an alphabet Σ\Sigma, for deterministic (1+ε)(1+\varepsilon) approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) for a string xΣnx\in\Sigma^{n} in the streaming model with RR passes, we have the following space lower bounds:

  1. 1.

    Ω(min(n,|Σ|)/R)\Omega(\min(\sqrt{n},|\Sigma|)/R) for any constant tt (this includes 𝖫𝖨𝖲\mathsf{LIS}), when ε\varepsilon is any constant.

  2. 2.

    Ω(|Σ|log(1/ε)/R)\Omega(|\Sigma|\log(1/\varepsilon)/R) for tn/|Σ|t\geq n/|\Sigma| (this includes 𝖫𝖭𝖲\mathsf{LNS}), when |Σ|2/ε=O(n)|\Sigma|^{2}/\varepsilon=O(n).

  3. 3.

    Ω(|Σ|ε/R)\Omega\left(\frac{\sqrt{|\Sigma|}}{\varepsilon}/R\right) for t=Θ(1/ε)t=\Theta(1/\varepsilon), when |Σ|/ε=O(n)|\Sigma|/\varepsilon=O(n).

Thus, case 1 and 2 show that even for any constant approximation, any constant pass streaming algorithm for 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS} needs space Ω(|Σ|)\Omega(|\Sigma|) when |Σ|n|\Sigma|\leq\sqrt{n}, matching the O(|Σ|logn)O(|\Sigma|\log n) upper bound up to a logarithmic factor. Taking ε=1/n3\varepsilon=1/\sqrt[3]{n} and |Σ|n3|\Sigma|\leq\sqrt[3]{n} for example, we further get a lower bound of Ω(|Σ|logn)\Omega(|\Sigma|\log n) for approximating 𝖫𝖭𝖲\mathsf{LNS} using any constant pass streaming algorithm. This matches the O(|Σ|logn)O(|\Sigma|\log n) upper bound. These results complement the bounds in [GG10, EJ08, GJKK07] for the important case of small alphabet, and together they provide an almost complete picture for 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS}. Case 3 shows that for certain choices of tt and ε\varepsilon, the space we need for 𝖫𝖭𝖲𝖳\mathsf{LNST} can be significantly larger than those for 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS}. It is an intriguing question to completely characterize the behavior of 𝖫𝖭𝖲𝖳\mathsf{LNST} for all regimes of parameters.

We also give improved algorithms for asymmetric streaming 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS}. For 𝖤𝖣\mathsf{ED}, [FHRS20, CJLZ20] gives a O(21/δ)O(2^{1/\delta})-approximation algorithm with O~(nδ)\tilde{O}(n^{\delta}) space for any constant δ(0,1)\delta\in(0,1). We further reduced the space needed from O~(nδδ)\tilde{O}(\frac{n^{\delta}}{\delta}) to O(dδδpolylog(n))O(\frac{d^{\delta}}{\delta}\;\operatorname{polylog}(n)) where d=𝖤𝖣(x,y)d=\mathsf{ED}(x,y). Specifically, we have the following theorem.

Theorem 5.

Assume 𝖤𝖣(x,y)=d\mathsf{ED}(x,y)=d, in the asymmetric streaming model, there are one-pass deterministic algorithms in polynomial time with the following parameters:

  1. 1.

    A (3+ε)(3+\varepsilon)-approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y) using O(dpolylog(n))O(\sqrt{d}\;\operatorname{polylog}(n)) space.

  2. 2.

    For any constant δ(0,1/2)\delta\in(0,1/2), a 2O(1δ)2^{O(\frac{1}{\delta})}-approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y) using O(dδδpolylog(n))O(\frac{d^{\delta}}{\delta}\operatorname{polylog}(n)) space.

For 𝖫𝖢𝖲\mathsf{LCS} over a large alphabet, the upper bounds in [FHRS20, CJLZ20] match the lower bounds implied by [GG10, EJ08]. We thus again focus on small alphabet. Note that our Theorem 3 does not give anything useful if |Σ||\Sigma| is small and ε\varepsilon is large (e.g., both are constants). Thus a natural question is whether one can get better bounds. In particular, is the dependence on 1/ε1/\varepsilon linear as in our theorem, or is there a threshold beyond which the space jumps to say for example Ω(n)\Omega(n)? We note that there is a trivial one pass, O(logn)O(\log n) space algorithm even in the standard streaming model that gives a |Σ||\Sigma| approximation of 𝖫𝖢𝖲\mathsf{LCS} (or 1/|Σ|1/|\Sigma| approximation in standard notation), and no better approximation using sublinear space is known even in the asymmetric streaming model. Thus one may wonder whether this is the threshold. We show that this is not the case, by giving a one pass algorithm in the asymmetric streaming model over the binary alphabet that achieves a 2ε2-\varepsilon approximation of 𝖫𝖢𝖲\mathsf{LCS} (or 1/2+ε1/2+\varepsilon approximation in standard notation), using space nδn^{\delta} for any constant δ>0\delta>0.

Theorem 6.

For any constant δ(0,1/2)\delta\in(0,1/2), there exists a constant ε>0\varepsilon>0 and a one-pass deterministic algorithm that outputs a 2ε2-\varepsilon approximation of 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) for any two strings x,y{0,1}nx,y\in\{0,1\}^{n}, with O~(nδ/δ)\tilde{O}(n^{\delta}/\delta) space and polynomial time in the asymmetric streaming model.

Finally, as mentioned before, we now have an almost complete picture for 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS}, but for the more general 𝖫𝖭𝖲𝖳\mathsf{LNST} the situation is still far from clear. Since 𝖫𝖭𝖲𝖳\mathsf{LNST} is a special case of 𝖫𝖢𝖲\mathsf{LCS}, if |Σ|t=O(n)|\Sigma|t=O(n) then the upper bound of O~(nε)\tilde{O}(\frac{\sqrt{n}}{\varepsilon}) in [FHRS20, CJLZ20] still applies and this matches our lower bound in case 3, Theorem 4 by taking |Σ|=εn|\Sigma|=\varepsilon n. One can then ask the natural question of whether we can get a matching upper bound for the case of small alphabet. We are not able to achieve this, but we provide a simple algorithm that can use much smaller space for certain regimes of parameters in this case.

Theorem 7.

Given an alphabet Σ\Sigma with |Σ|=r\lvert\Sigma\rvert=r. For any ε>0\varepsilon>0 and t1t\geq 1, there is a one-pass streaming algorithm that computes a (1+ε)(1+\varepsilon) approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) for any xΣnx\in\Sigma^{n} with O~((min(t,r/ε)+1)r)\tilde{O}\Big{(}\big{(}\min(t,r/\varepsilon)+1\big{)}^{r}\Big{)} space.

1.2 Overview of our Techniques

Here we provide an informal overview of the techniques used in this paper.

1.2.1 Lower Bounds

Our lower bounds use the general framework of communication complexity. To limit the power of random access to the string yy, we always fix yy to be a specific string, and consider different strings xx. In turn, we divide xx into several blocks and consider the two party/multi party communication complexity of 𝖤𝖣(x,y)\mathsf{ED}(x,y) or 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y), where each party holds one block of xx. However, we need to develop several new techniques to handle edit distance and small alphabets.

Edit distance.

We start with edit distance. One difficulty here is to handle substitutions, as with substitutions edit distance becomes similar to Hamming distance, and this is exactly one of the reasons why strong complexity results separating edit distance and Hamming distance are rare. Indeed, if we define 𝖤𝖣(x,y)\mathsf{ED}(x,y) to be the smallest number of insertions and deletions (without substitutions) to transform xx into yy, then 𝖤𝖣(x,y)=2n2𝖫𝖢𝖲(x,y)\mathsf{ED}(x,y)=2n-2\mathsf{LCS}(x,y) and thus a lower bound for exactly computing 𝖫𝖢𝖲\mathsf{LCS} (e.g., those implied from [GG10, EJ08]) would translate directly into the same bound for exactly computing 𝖤𝖣\mathsf{ED}. On the other hand, with substitutions things become more complicated: if 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) is small (e.g., 𝖫𝖢𝖲(x,y)n/2\mathsf{LCS}(x,y)\leq n/2) then in many cases (such as examples obtained by reducing from [GG10, EJ08]) the best option to transform xx into yy is just replacing each symbol in xx by the corresponding symbol in yy if they are different, which makes 𝖤𝖣(x,y)\mathsf{ED}(x,y) exactly the same as their Hamming distance.

To get around this, we need to ensure that 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) is large. We demonstrate our ideas by first describing an Ω(n)\Omega(n) lower bound for the deterministic two party communication complexity of 𝖤𝖣(x,y)\mathsf{ED}(x,y), using a reduction from the equality function which is well known to have an Ω(n)\Omega(n) communication complexity bound. Towards this, fix Σ=[3n]{a}\Sigma=[3n]\cup\{a\} where aa is a special symbol, and fix y=123ny=1\circ 2\circ\cdots\circ 3n. We divide xx into two parts x=(x1,x2)x=(x_{1},x_{2}) such that x1x_{1} is obtained from the string (1,2,4,5,,3i2,3i1,,3n2,3n1)(1,2,4,5,\cdots,3i-2,3i-1,\cdots,3n-2,3n-1) by replacing some symbols of the form 3j13j-1 by aa, while x2x_{2} is obtained from the string (2,3,5,6,,3i1,3i,,3n1,3n)(2,3,5,6,\cdots,3i-1,3i,\cdots,3n-1,3n) by replacing some symbols of the form 3j13j-1 by aa. Note that the way we choose (x1,x2)(x_{1},x_{2}) ensures that 𝖫𝖢𝖲(x,y)2n\mathsf{LCS}(x,y)\geq 2n before replacing any symbol by aa.

Intuitively, we want to argue that the best way to transform xx into yy, is to delete a substring at the end of x1x_{1} and a substring at the beginning of x2x_{2}, so that the resulted string becomes an increasing subsequence as long as possible. Then, we insert symbols into this string to make it match yy except for those aa symbols. Finally, we replace the aa symbols by substitutions. If this is true then we can finish the argument as follows. Let T1,T2[n]T_{1},T_{2}\subset[n] be two subsets with size t=Ω(n)t=\Omega(n), where for any i{1,2}i\in\{1,2\}, all symbols of the form 3j13j-1 in xix_{i} with jTij\in T_{i} are replaced by aa. Now if T1=T2T_{1}=T_{2} then it doesn’t matter where we choose to delete the substrings in x1x_{1} and x2x_{2}, the number of edit operations is always 3n2+t3n-2+t by a direct calculation. On the other hand if T1T2T_{1}\neq T_{2} and assume for simplicity that the smallest element they differ is an element in T2T_{2}, then there is a way to save one substitution, and the the number of edit operations becomes 3n3+t3n-3+t.

The key part is now proving our intuition. For this, we consider all possible r[3n]r\in[3n] such that x1x_{1} is transformed into y[1:r]y[1:r] and x2x_{2} is transformed into y[r+1:3n]y[r+1:3n], and compute the two edit distances respectively. To analyze the edit distance, we first show by a greedy argument that without loss of generality, we can assume that we apply deletions first, followed by insertions, and substitutions at last. This reduces the edit distance problem to the following problem: for a fixed number of deletions and insertions, what is the best way to minimize the Hamming distance (or maximize the number of agreements of symbols at the same indices) in the end. Now we break the analysis of 𝖤𝖣(x1,y[1:r])\mathsf{ED}(x_{1},y[1:r]) into two cases. Case 1 is where the number of deletions (say ddd_{d}) is large. In this case, the number of insertions (say did_{i}) must also be large, and we argue that the number of agreements is at most 𝖫𝖢𝖲(x1,y[1:r])+di\mathsf{LCS}(x_{1},y[1:r])+d_{i}. Case 2 is where ddd_{d} is small. In this case, did_{i} must also be small. Now we crucially use the structure of x1x_{1} and yy, and argue that symbols in x1x_{1} larger than 3di3d_{i} (or original index beyond 2di2d_{i}) are guaranteed to be out of agreement. Thus the number of agreements is at most 𝖫𝖢𝖲(x1[1:2di],y[1:r])+di\mathsf{LCS}(x_{1}[1:2d_{i}],y[1:r])+d_{i}. In each case combining the bounds gives us a lower bound on the total number of operations. The situation for x2x_{2} and y[r+1:3n]y[r+1:3n] is completely symmetric and this proves our intuition.

In the above construction, xx and yy have different lengths (|x|=4n|x|=4n while |y|=3n|y|=3n). We can fix this by adding a long enough string zz with distinct symbols than those in {x,y}\{x,y\} to the end of both xx and yy, and then add nn symbols of aa at the end of zz for yy. We argue that the best way to do the transformation is to transform xx into yy, and then insert nn symbols of aa. To show this, we first argue that at least one symbol in zz must be kept, for otherwise the number of operations is already larger than the previous transformation. Then, using a greedy argument we show that the entire zz must be kept, and thus the natural transformation is the optimal.

To extend the bound to randomized algorithms, we modify the above construction and reduce from Set Disjointness (𝖣𝖨𝖲\mathsf{DIS}), which is known to have randomized communication complexity Ω(n)\Omega(n). Given two strings α,β{0,1}n\alpha,\beta\in\{0,1\}^{n} representing the characteristic vectors of two sets A,B[n]A,B\subseteq[n], 𝖣𝖨𝖲(α,β)=0\mathsf{DIS}(\alpha,\beta)=0 if and only if ABA\cap B\neq\emptyset, or equivalently, j[n],αj=βj=1\exists j\in[n],\alpha_{j}=\beta_{j}=1. For the reduction, we first create two new strings α,β{0,1}2n\alpha^{\prime},\beta^{\prime}\in\{0,1\}^{2n} which are “balanced” versions of α,β\alpha,\beta. Formally, j[n],α2j1=αj\forall j\in[n],\alpha^{\prime}_{2j-1}=\alpha_{j} and α2j=1αj\alpha^{\prime}_{2j}=1-\alpha_{j}. We create β\beta^{\prime} slightly differently, i.e., j[n],β2j1=1βj\forall j\in[n],\beta^{\prime}_{2j-1}=1-\beta_{j} and β2j=βj\beta^{\prime}_{2j}=\beta_{j}. Now both α\alpha^{\prime} and β\beta^{\prime} have nn 11’s, we can use them as the characteristic vectors of the two sets T1,T2T_{1},T_{2} in the previous construction. A similar argument now leads to the bound for randomized algorithms.

Longest common subsequence.

Our lower bounds for randomized algorithms computing 𝖫𝖢𝖲\mathsf{LCS} exactly are obtained by a similar and simpler reduction from 𝖣𝖨𝖲\mathsf{DIS}: we still fix yy to be an increasing sequence of length 8n8n and divide yy evenly into 4n4n blocks of constant size. Now x1x_{1} consists of the blocks with an odd index, while x2x_{2} consists of the blocks with an even index. Thus xx is a permutation of yy. Next, from α,β{0,1}n\alpha,\beta\in\{0,1\}^{n} we create α,β{0,1}2n\alpha^{\prime},\beta^{\prime}\in\{0,1\}^{2n} in a slightly different way and use α,β\alpha^{\prime},\beta^{\prime} to modify the 2n2n blocks in x1x_{1} and x2x_{2} respectively. If a bit is 11 then we arrange the corresponding block in the increasing order, otherwise we arrange the corresponding block in the decreasing order. A similar argument as before now gives the desired Ω(n)\Omega(n) bound. We note that [SW07] has similar results for LIS by reducing from 𝖣𝖨𝖲\mathsf{DIS}. However, our reduction and analysis are different from theirs. Thus we can handle 𝖫𝖢𝖲\mathsf{LCS}, and even the harder case where xx is a permutation of yy.

We now turn to 𝖫𝖢𝖲\mathsf{LCS} over a small alphabet. To illustrate our ideas, let’s first consider Σ={0,1}\Sigma=\{0,1\} and choose y=0n/21n/2y=0^{n/2}1^{n/2}. It is easy to see that 𝖫𝖢𝖲(x,y)=𝖫𝖭𝖲𝖳(x,n/2)\mathsf{LCS}(x,y)=\mathsf{LNST}(x,n/2). We now represent each string x{0,1}nx\in\{0,1\}^{n} as follows: at any index i[n]{0}i\in[n]\cup\{0\}, we record a pair (p,q)(p,q) where p=𝗆𝗂𝗇(the number of 0’s in x[1:i],n/2)p=\mathsf{min}(\text{the number of 0's in }x[1:i],n/2) and q=𝗆𝗂𝗇(the number of 1’s in x[i+1:n],n/2)q=\mathsf{min}(\text{the number of 1's in }x[i+1:n],n/2). Thus, if we read xx from left to right, then upon reading a 0, pp may increase by 11 and qq does not change; while upon reading a 11, pp does not change and qq may decrease by 11. Hence if we use the horizontal axis to stand for pp and the vertical axis to stand for qq, then these points (p,q)(p,q) form a polygonal chain. We call p+qp+q the value at point (p,q)(p,q) and it is easy to see that 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) must be the value of an endpoint of some chain segment.

Using the above representation, we now fix Σ={0,1,2}\Sigma=\{0,1,2\} and choose y=0n/31n/32n/3y=0^{n/3}1^{n/3}2^{n/3}, so 𝖫𝖢𝖲(x,y)=𝖫𝖭𝖲𝖳(x,n/3)\mathsf{LCS}(x,y)=\mathsf{LNST}(x,n/3). We let x=(x1,x2)x=(x_{1},x_{2}) such that x1{0,1}n/2x_{1}\in\{0,1\}^{n/2} and x2{1,2}n/2x_{2}\in\{1,2\}^{n/2}. Since any common subsequence between xx and yy must be of the form 0a1b2c0^{a}1^{b}2^{c} it suffices to consider common subsequence between x1x_{1} and 0n/31n/30^{n/3}1^{n/3}, and that between x2x_{2} and 1n/32n/31^{n/3}2^{n/3}, and combine them together. Towards that, we impose the following properties on x1,x2x_{1},x_{2}: (1) The number of 0’s, 11’s, and 22’s in each string is at most n/3n/3; (2) In the polygonal chain representation of each string, the values of the endpoints strictly increase when the number of 11’s increases; and (3) For any endpoint in x1x_{1} where the number of 11’s is some rr, there is a corresponding endpoint in x2x_{2} where the number of 11’s is n/3rn/3-r, and the values of these two endpoints sum up to a fixed number t=Ω(n)t=\Omega(n). Note that property (2) implies that 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) must be the sum of the values of an endpoint in x1x_{1} where the number of 11’s is some rr, and an endpoint in x2x_{2} where the number of 11’s is n/3rn/3-r, while property (3) implies that for any string x1x_{1}, there is a unique corresponding string x2x_{2}, and 𝖫𝖢𝖲(x,y)=t\mathsf{LCS}(x,y)=t (regardless of the choice of rr).

We show that under these properties, all possible strings x=(x1,x2)x=(x_{1},x_{2}) form a set SS with |S|=2Ω(n)|S|=2^{\Omega(n)}, and this set gives a fooling set for the two party communication problem of computing 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y). Indeed, for any x=(x1,x2)Sx=(x_{1},x_{2})\in S, we have 𝖫𝖢𝖲(x,y)=t\mathsf{LCS}(x,y)=t. On the other hand, for any (x1,x2)(x1,x2)S(x_{1},x_{2})\neq(x^{\prime}_{1},x^{\prime}_{2})\in S, the values must differ at some point for x1x_{1} and x1x^{\prime}_{1}. Hence by switching, either (x1,x2)(x_{1},x^{\prime}_{2}) or (x1,x2)(x^{\prime}_{1},x_{2}) will have a 𝖫𝖢𝖲\mathsf{LCS} with yy that has length at least t+1t+1. Standard arguments now imply an Ω(n)\Omega(n) communication complexity lower bound. A more careful analysis shows that we can even replace the symbol 22 by 0, thus resulting in a binary alphabet.

The above argument can be easily modified to give a Ω(1/ε)\Omega(1/\varepsilon) bound for 1+ε1+\varepsilon approximation of 𝖫𝖢𝖲\mathsf{LCS} when ε<1\varepsilon<1, by taking the string length to be some n=Θ(1/ε)n^{\prime}=\Theta(1/\varepsilon). To get a better bound, we combine our technique with the technique in [EJ08] and consider the following direct sum problem: we create rr copies of strings {xi,i[r]}\{x^{i},i\in[r]\} and {yi,i[r]}\{y^{i},i\in[r]\} where each copy uses distinct alphabets with size 22. Assume for xix^{i} and yiy^{i} the alphabet is {ai,bi}\{a_{i},b_{i}\}, now xix^{i} again consists of rr copies of (xj1i,xj2i),j[r](x^{i}_{j1},x^{i}_{j2}),j\in[r], where each xji{ai,bi}n/2x^{i}_{j\ell}\in\{a_{i},b_{i}\}^{n^{\prime}/2} for [2]\ell\in[2]; while yiy^{i} consists of rr copies yji=ain/3bin/3ain/3,j[r]y^{i}_{j}=a_{i}^{n^{\prime}/3}b_{i}^{n^{\prime}/3}a_{i}^{n^{\prime}/3},j\in[r]. The direct sum problem is to decide between the following two cases for some t=Ω(n)t=\Omega(n^{\prime}): (1) i\exists i such that there are Ω(r)\Omega(r) copies (xj1i,xj2i)(x^{i}_{j1},x^{i}_{j2}) in xix^{i} with 𝖫𝖢𝖲((xj1ixj2i),yji)t+1\mathsf{LCS}((x^{i}_{j1}\circ x^{i}_{j2}),y^{i}_{j})\geq t+1, and (2) i\forall i and j\forall j, 𝖫𝖢𝖲((xj1ixj2i),yji)t\mathsf{LCS}((x^{i}_{j1}\circ x^{i}_{j2}),y^{i}_{j})\leq t. We do this by arranging the xix^{i}’s row by row into an r×2rr\times 2r matrix (each entry is a length n/2n^{\prime}/2 string) and letting xx be the concatenation of the columns. We call these strings the contents of the matrix, and let yy be the concatenation of the yiy^{i}’s. Now intuitively, case (1) and case (2) correspond to deciding whether 𝖫𝖢𝖲(x,y)2rt+Ω(r)\mathsf{LCS}(x,y)\geq 2rt+\Omega(r) or 𝖫𝖢𝖲(x,y)2rt\mathsf{LCS}(x,y)\leq 2rt, which implies a 1+Ω(1/t)=1+ε1+\Omega(1/t)=1+\varepsilon approximation. The lower bound follows by analyzing the 2r2r-party communication complexity of this problem, where each party holds a column of the matrix.

However, unlike the constructions in [GG10, EJ08] which are relatively easy to analyze because all symbols in xx (respectively yy) are distinct, the repeated symbols in our construction make the analysis of 𝖫𝖢𝖲\mathsf{LCS} much more complicated (we can also use distinct symbols but that will only give us a bound of |Σ|ε\frac{\sqrt{|\Sigma|}}{\varepsilon} instead of |Σ|ε\frac{|\Sigma|}{\varepsilon}). To ensure that the 𝖫𝖢𝖲\mathsf{LCS} is to match each (xj1i,xj2i)(x^{i}_{j1},x^{i}_{j2}) to the corresponding yjiy^{i}_{j}, we use another rr symbols {ci,i[r]}\{c_{i},i\in[r]\} and add buffers of large size (e.g., size nn^{\prime}) between adjacent copies of (xj1i,xj2i)(x^{i}_{j1},x^{i}_{j2}). We do the same thing for yjiy^{i}_{j} correspondingly. Moreover, it turns out we need to arrange the buffers carefully to avoid unwanted issues: in each row xix^{i}, between each copy of (xj1i,xj2i)(x^{i}_{j1},x^{i}_{j2}) we use a buffer of new symbol. Thus the buffers added to each row xix^{i} are c1n,c2n,,crnc_{1}^{n^{\prime}},c_{2}^{n^{\prime}},\cdots,c_{r}^{n^{\prime}} sequentially and this is the same for every row. That is, in each row the contents use the same alphabet {ai,bi}\{a_{i},b_{i}\} but the buffers use different alphabets {ci,i[r]}\{c_{i},i\in[r]\}. Now we have a r×3rr\times 3r matrix and we again let xx be the concatenation of the columns while let yy be the concatenation of the yiy^{i}’s. Note that we are using an alphabet of size |Σ|=3r|\Sigma|=3r. We use a careful analysis to argue that case (1) and case (2) now correspond to deciding whether 𝖫𝖢𝖲(x,y)2rn+rt+Ω(r)\mathsf{LCS}(x,y)\geq 2rn^{\prime}+rt+\Omega(r) or 𝖫𝖢𝖲(x,y)2rn+rt\mathsf{LCS}(x,y)\leq 2rn^{\prime}+rt, which implies a 1+ε1+\varepsilon approximation. The lower bound follows by analyzing the 3r3r-party communication complexity of this problem, and we show a lower bound of Ω(r/ε)=Ω(|Σ|/ε)\Omega(r/\varepsilon)=\Omega(|\Sigma|/\varepsilon) by generalizing our previous fooling set construction to the multi-party case, where we use a good error correcting code to create the Ω(r)\Omega(r) gap.

The above technique works for ε<1\varepsilon<1. For the case of ε1\varepsilon\geq 1 our bound for 𝖫𝖢𝖲\mathsf{LCS} can be derived directly from our bound for 𝖫𝖨𝖲\mathsf{LIS}, which we describe next.

Longest increasing/non-decreasing subsequence.

Our Ω(|Σ|)\Omega(|\Sigma|) lower bound over small alphabet is achieved by modifying the construction in [EJ08] and providing a better analysis. Similar as before, we consider a matrix B{0,1}rc×rB\in\{0,1\}^{\frac{r}{c}\times r} where cc is a large constant and r=|Σ|r=|\Sigma|. We now consider the rr-party communication problem where each party holds one column of BB, and the problem is to decide between the following two cases for a large enough constant ll: (1) for each row in BB, there are at least ll 0’s between any two 11’s, and (2) there exists a row in BB which has more than αr\alpha r 11’s, where α(1/2,1)\alpha\in(1/2,1) is a constant. We can use a similar argument as in [EJ08] to show that the total communication complexity of this problem is Ω(r2)\Omega(r^{2}) and hence at least one party needs Ω(r)\Omega(r). The difference is that [EJ08] sets l=1l=1 while we need to pick ll to be a larger constant to handle the case ε1\varepsilon\geq 1. For this we use the Lovász Local Lemma with a probabilistic argument to show the existence of a large fooling set. To reduce to 𝖫𝖨𝖲\mathsf{LIS}, we define another matrix B~\tilde{B} such that B~i,j=(i1)rc+j\tilde{B}_{i,j}=(i-1)\frac{r}{c}+j if Bi,j=1B_{i,j}=1 and B~i,j=0\tilde{B}_{i,j}=0 otherwise. Now let xx be the concatenation of all columns of B~\tilde{B}. We show that case (2) implies 𝖫𝖨𝖲(x)αr\mathsf{LIS}(x)\geq\alpha r and case (1) implies 𝖫𝖨𝖲(x)(1/c+1/l)r\mathsf{LIS}(x)\leq(1/c+1/l)r. This implies a 1+ε1+\varepsilon approximation for any constant ε>0\varepsilon>0 by setting cc and ll appropriately.

The construction is slightly different for 𝖫𝖭𝖲\mathsf{LNS}. This is because if we keep the 0’s in B~\tilde{B}, they will already form a very long non-decreasing subsequence and we will not get any gap. Thus, we now let the matrix BB have size r×crr\times cr where cc can be any constant. We replace all 0’s in column ii with a symbol bib_{i} for i[cr]i\in[cr], such that b1>b2>>bcrb_{1}>b_{2}>\cdots>b_{cr}. Similarly we replace all 11’s in row jj with a symbol aja_{j} for j[r]j\in[r], such that a1<a2<<ara_{1}<a_{2}<\cdots<a_{r}. Also, we let a1>b1a_{1}>b_{1}. We can show that the two cases now correspond to 𝖫𝖭𝖲(x)>αcr\mathsf{LNS}(x)>\alpha cr and 𝖫𝖭𝖲(x)(2+c/l)r\mathsf{LNS}(x)\leq(2+c/l)r.

We further prove an Ω(|Σ|log(1/ε))\Omega(|\Sigma|\log(1/\varepsilon)) lower bound for 1+ε1+\varepsilon approximation of 𝖫𝖭𝖲\mathsf{LNS} when ε<1\varepsilon<1. This is similar to our previous construction for 𝖫𝖢𝖲\mathsf{LCS}, except we don’t need buffers here, and we only need to record the number of some symbols. More specifically, let l=Θ(1/ε)l=\Theta(1/\varepsilon) and SS be the set of all strings x=(x1,x2)x=(x_{1},x_{2}) over alphabet {a,b}\{a,b\} with length 2l2l such that x1=a34l+tb14ltx_{1}=a^{\frac{3}{4}l+t}b^{\frac{1}{4}l-t} and x2=a34ltb14l+tx_{2}=a^{\frac{3}{4}l-t}b^{\frac{1}{4}l+t} for any t[l4]t\in[\frac{l}{4}]. Thus SS has size l4=Ω(1/ε)\frac{l}{4}=\Omega(1/\varepsilon) and xS\forall x\in S, the number of aa’s in xx is exactly 32l\frac{3}{2}l. Further, for any (x1,x2)(x1,x2)S(x_{1},x_{2})\neq(x^{\prime}_{1},x^{\prime}_{2})\in S, either (x1,x2)(x_{1},x^{\prime}_{2}) or (x1,x2)(x^{\prime}_{1},x_{2}) has more than 32l\frac{3}{2}l aa’s. We now consider the r×2rr\times 2r matrix where each row ii consists of {(xj1i,xj2i),j[r]}\{(x^{i}_{j1},x^{i}_{j2}),j\in[r]\} such that each xjix^{i}_{j{\ell}} has length ll for [2]\ell\in[2], and for the same row ii all {(xj1i,xj2i)}\{(x^{i}_{j1},x^{i}_{j2})\} use the same alphabet {ai,bi}\{a_{i},b_{i}\} while for different rows the alphabets are disjoint. To make sure the 𝖫𝖭𝖲\mathsf{LNS} of the concatenation of the columns is roughly the sum of the number of aia_{i}’s, we require that br<br1<<b1<a1<a2<<arb_{r}<b_{r-1}<\cdots<b_{1}<a_{1}<a_{2}<\cdots<a_{r}. Now we analyze the 2r2r party communication problem of deciding whether the concatenation of the columns has 𝖫𝖭𝖲crl+Ω(r)\mathsf{LNS}\geq crl+\Omega(r) or 𝖫𝖭𝖲crl\mathsf{LNS}\leq crl for some constant cc, which implies a 1+ε1+\varepsilon approximation. The lower bound is again achieved by generalizing the set SS to a fooling set for the 2r2r party communication problem using an error correcting code based approach.

In Theorem 4, we give three lower bounds for 𝖫𝖭𝖲𝖳\mathsf{LNST}. The first two lower bounds are adapted from our lower bounds for 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS}, while the last lower bound is adapted from our lower bound for 𝖫𝖢𝖲\mathsf{LCS} by ensuring all symbols in different rows or columns of the matrix there are different.

1.2.2 Improved Algorithms

We now turn to our improved algorithms for 𝖤𝖣\mathsf{ED} and 𝖫𝖢𝖲\mathsf{LCS} in the asymmetric streaming model.

Edit distance.

Our algorithm for edit distance builds on and improves the algorithm in [FHRS20, CJLZ20]. The key idea of that algorithm is to use triangle inequality. Given a constant δ\delta, the algorithm first divides xx evenly into b=nδb=n^{\delta} blocks. Then for each block xix^{i} of xx, the algorithm recursively finds an α\alpha-approximation of the closest substring to xix^{i} in yy. That is, the algorithm finds a substring y[li:ri]y[l_{i}:r_{i}] and a value did_{i} such that for any substring y[l:r]y[l:r] of yy, 𝖤𝖣(xi,y[li:ri])diα𝖤𝖣(xi,y[l:r])\mathsf{ED}(x^{i},y{[l_{i}:r_{i}]})\leq d_{i}\leq\alpha\mathsf{ED}(x^{i},y{[l:r]}). Let y~\tilde{y} be the concatenation of y[li:ri]y[l_{i}:r_{i}] from i=1i=1 to bb. Then using triangle inequality, [FHRS20] showed that 𝖤𝖣(y,y~)+i=1bdi\mathsf{ED}(y,\tilde{y})+\sum_{i=1}^{b}d_{i} is a 2α+12\alpha+1 approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y). The O~(nδ)\tilde{O}(n^{\delta}) space is achieved by recursively applying this idea, which results in a O(21/δ)O(2^{1/\delta}) approximation.

To further reduce the space complexity, our key observation is that, instead of dividing xx into blocks of equal length, we can divide it according to the positions of the edit operations that transform xx to yy. More specifically, assume we are given a value kk with 𝖤𝖣(x,y)kc𝖤𝖣(x,y)\mathsf{ED}(x,y)\leq k\leq c\mathsf{ED}(x,y) for some constant cc, we show how to design an approximation algorithm using space O~(k)\tilde{O}(\sqrt{k}). Towards this, we can divide xx and yy each into k\sqrt{k} blocks x=x1xkx=x^{1}\circ\cdots\circ x^{\sqrt{k}} and y=y1yky=y^{1}\circ\cdots\circ y^{\sqrt{k}} such that 𝖤𝖣(xi,yi)𝖤𝖣(x,y)kk\mathsf{ED}(x^{i},y^{i})\leq\frac{\mathsf{ED}(x,y)}{\sqrt{k}}\leq\sqrt{k} for any i[k]i\in[\sqrt{k}]. However, such a partition of xx and yy is not known to us. Instead, we start from the first position of xx and find the largest index l1l_{1} such that 𝖤𝖣(x[1:l1],y[p1,q1])k\mathsf{ED}(x[1:l_{1}],y[p_{1},q_{1}])\leq\sqrt{k} for some substring y[p1:q1]y[p_{1}:q_{1}] of yy. To do this, we start with l=kl=\sqrt{k} and try all substrings of yy with length in [lk,l+k][l-\sqrt{k},l+\sqrt{k}]. If there is some substring of yy within edit distance k\sqrt{k} to x[1:l]x[1:l], we set l1=ll_{1}=l and store all the edit operations that transform y[p1:q1]y[p_{1}:q_{1}] to x[1:l1]x[1:l_{1}] where y[p1:q1]y[p_{1}:q_{1}] is the substring closest to x[1:l1]x[1:l_{1}] in edit distance. We continue doing this with l=l+1l=l+1 until we can not find a substring of yy within edit distance k\sqrt{k} to x[1:l]x[1:l].

One problem here is that ll can be much larger than k\sqrt{k} and we cannot store x[1:l]x[1:l] with O~(k)\tilde{O}(\sqrt{k}) space. However, since we have stored some substring y[p1:q1]y[p_{1}:q_{1}] (we only need to store the two indices p1,q1p_{1},q_{1}) and the at most k\sqrt{k} edit operations that transform y[p1:q1]y[p_{1}:q_{1}] to x[1:l1]x[1:l-1], we can still query every bit of x[1:l]x[1:l] using O~(k)\tilde{O}(\sqrt{k}) space.

After we find the largest possible index l1l_{1}, we store l1l_{1}, (p1,q1)(p_{1},q_{1}) and d1=𝖤𝖣(x[1:l1],y[p1:q1])d_{1}=\mathsf{ED}(x[1:l_{1}],y[p_{1}:q_{1}]). We then start from the (l1+1)(l_{1}+1)-th position of xx and do the same thing again to find the largest l2l_{2} such that there is a substring of yy within edit distance k\sqrt{k} to x[l1+1:l1+l2]x[l_{1}+1:l_{1}+l_{2}]. We continue doing this until we have processed the entire string xx. Assume this gives us TT pairs of indices (pi,qi)(p_{i},q_{i}) and integers lil_{i}, did_{i} from i=1i=1 to TT, we can use O(Tlogn)O(T\log n) space to store them. We show by induction that x1xix^{1}\circ\cdots\circ x^{i} is a substring of x[1:j=1ilj]x[1:\sum_{j=1}^{i}l_{j}] for i[T1]i\in[T-1]. Recall that x=x1xkx=x^{1}\circ\cdots\circ x^{\sqrt{k}} and each li>0,i[T1]l_{i}>0,i\in[T-1]. Thus, the process must end within k\sqrt{k} steps and we have TkT\leq\sqrt{k}. Then, let y~\tilde{y} be the concatenation of y[pi:qi]y[p_{i}:q_{i}] from i=1i=1 to TT. Using techniques developed in [FHRS20], we can show 𝖤𝖣(y,y~)+i=1Tdi\mathsf{ED}(y,\tilde{y})+\sum_{i=1}^{T}d_{i} is a 33 approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y). For any small constant ε>0\varepsilon>0, we can compute a 1+ε1+\varepsilon approximation of 𝖤𝖣(y,y~)\mathsf{ED}(y,\tilde{y}) with polylog(n)\operatorname{polylog}(n) space using the algorithm in [CJLZ20]. This gives us a 3+ε3+\varepsilon approximation algorithm with O(𝖤𝖣(x,y)polylog(n))O(\sqrt{\mathsf{ED}(x,y)}\;\operatorname{polylog}(n)) space.

Similar to [FHRS20], we can use recursion to further reduce the space. Let δ\delta be a small constant and a value k=Θ(𝖤𝖣(x,y))k=\Theta(\mathsf{ED}(x,y)) be given as before. There is a way to partition xx and yy each into kδk^{\delta} blocks such that 𝖤𝖣(xi,yi)𝖤𝖣(x,y)kδk1δ\mathsf{ED}(x^{i},y^{i})\leq\frac{\mathsf{ED}(x,y)}{k^{\delta}}\leq k^{1-\delta}. Now similarly, we want to find the largest index l0l^{0} such that there is a substring of yy within edit distance k1δk^{1-\delta} to x[1:l0]x[1:l^{0}]. However naively this would require Θ(k1δ)\Theta(k^{1-\delta}) space to compute the edit distance. Thus again we turn to approximation.

We introduce a recursive algorithm called 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring}. It takes two additional parameters as inputs: an integer uu and a parameter ss for the amount of space we can use. It outputs a three tuple: an index ll, a pair of indices (p,q)(p,q) and an integer dd. Let l0l^{0} be the largest index such that there is a substring of yy within edit distance uu to x[1:l0]x[1:l^{0}].

We show the following two properties of 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring}: (1) ll0l\geq l^{0}, and (2) for any substring y[p:q]y[p^{*}:q^{*}], 𝖤𝖣(x[1:l],y[p:q])dc(u,s)𝖤𝖣(x[1:l],y[p:q])\mathsf{ED}(x[1:l],y[p:q])\leq d\leq c(u,s)\mathsf{ED}(x[1:l],y[p^{*}:q^{*}]). Here, c(u,s)c(u,s) is a function of (u,s)(u,s) that measures the approximation factor. If usu\leq s, 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} outputs l=l0l=l^{0} and the substring of yy that is closest to x[1:l]x[1:l] using O(slogn)O(s\log n) space by doing exact computation. In this case we set c(u,s)=1c(u,s)=1. Otherwise, it calls 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} itself up to ss times with parameters u/su/s and ss. This gives us TsT\leq s outputs {li,(pi,qi),di}\{l_{i},(p_{i},q_{i}),d_{i}\} for i[T]i\in[T]. Let y~\tilde{y} be the concatenation of y[pi:qi]y[p_{i}:q_{i}] for i=1i=1 to TT. We find the pair of indices (p,q)(p,q) such that y[p:q]y[p:q] is the substring that minimizes 𝖤𝖣(y~,y[p:q])\mathsf{ED}(\tilde{y},y[p:q]). We output l=j=1Tljl=\sum_{j=1}^{T}l_{j}, (p,q)(p,q), and d=𝖤𝖣(y~,y[p:q])+i=1Tdid=\mathsf{ED}(\tilde{y},y[p:q])+\sum_{i=1}^{T}d_{i}. We then use induction to show property (1) and (2) hold for these outputs, where c(u,s)=2(c(u/s,s)+1)c(u,s)=2(c(u/s,s)+1) if u>su>s and c(u,s)=1c(u,s)=1 if usu\leq s. Thus we have c(u,s)=2O(logsu)c(u,s)=2^{O(\log_{s}{u})}.

This gives an O(kδ/δpolylog(n))O(k^{\delta}/\delta\;\operatorname{polylog}(n)) space algorithm as follows. We run algorithm 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} with u=k1δu=k^{1-\delta} and s=kδs=k^{\delta} to find TT tuples: {li,(pi,qi),di}\{l_{i},(p_{i},q_{i}),d_{i}\}. Again, let y~\tilde{y} be the concatenation of y[pi:qi]y[p_{i}:q_{i}] from i=1i=1 to TT. Similar to the O(kpolylog(n))O(\sqrt{k}\;\operatorname{polylog}(n)) space algorithm, we can show TkδT\leq k^{\delta} and 𝖤𝖣(y,y~)+i=1Tdi\mathsf{ED}(y,\tilde{y})+\sum_{i=1}^{T}d_{i} is a 2c(k1δ,kδ)+1=2O(1/δ)2c(k^{1-\delta},k^{\delta})+1=2^{O(1/\delta)} approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y). Since the depth of recursion is at most 1/δ1/\delta and each level of recursion needs O(kδpolylog(n))O(k^{\delta}\;\operatorname{polylog}(n)) space, 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} uses O(kδ/δpolylog(n))O(k^{\delta}/\delta\;\operatorname{polylog}(n)) space.

The two algorithms above both require a given value kk. To remove this constraint, our observation is that the two previous algorithms actually only need the number kk to satisfy the following relaxed condition: there is a partition of xx into kδk^{\delta} blocks such that for each block xix^{i}, there is a substring of yy within edit distance k1δk^{1-\delta} to xix^{i}. Thus, when such a kk is not given, we can do the following. We first set kk to be a large constant k0k_{0}. While the algorithm reads xx from left to right, let TT^{\prime} be the number of {li,(pi,qi),di}\{l_{i},(p_{i},q_{i}),d_{i}\} we have stored so far. Each time we run 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} at this level, we increase TT^{\prime} by 11. If the current kk satisfies the relaxed condition, then by a similar argument as before TT^{\prime} should never exceed kδk^{\delta}. Thus whenever T=kδT^{\prime}=k^{\delta}, we increase kk by a 21/δ2^{1/\delta} factor. Assume that kk is updated mm times in total and after the ii-th update, kk becomes kik_{i}. We show that km=O(𝖤𝖣(x,y))k_{m}=O(\mathsf{ED}(x,y)) (but kmk_{m} may be much smaller than 𝖤𝖣(x,y)\mathsf{ED}(x,y)). To see this, suppose kj>21/δ𝖤𝖣(x,y)k_{j}>2^{1/\delta}\mathsf{ED}(x,y) for some jmj\leq m. Let tjt_{j} be the position of xx where kj1k_{j-1} is updated to kjk_{j}. We know it is possible to divide x[tj:n]x[t_{j}:n] into 𝖤𝖣(x,y)δ\mathsf{ED}(x,y)^{\delta} blocks such that for each part, there is a substring of yy within edit distance 𝖤𝖣(x,y)1δkj1δ\mathsf{ED}(x,y)^{1-\delta}\leq k_{j}^{1-\delta} to it. By property (1) and a similar argument as before, we will run 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} at most 𝖤𝖣(x,y)δ\mathsf{ED}(x,y)^{\delta} times until we reach the end of xx. Since kjδkj1δ>𝖤𝖣(x,y)δk_{j}^{\delta}-k^{\delta}_{j-1}>\mathsf{ED}(x,y)^{\delta}, TT^{\prime} must be always smaller than kjδk^{\delta}_{j} and hence kjk_{j} will not be updated. Therefore we must have j=mj=m. This shows km121/δ𝖤𝖣(x,y)k_{m-1}\leq 2^{1/\delta}\mathsf{ED}(x,y) and km22/δ𝖤𝖣(x,y)k_{m}\leq 2^{2/\delta}\mathsf{ED}(x,y). Running 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} with kkmk\leq k_{m} takes O(kmδ/δpolylog(n))=O(𝖤𝖣(x,y)δ/δpolylog(n))O(k_{m}^{\delta}/\delta\;\operatorname{polylog}(n))=O(\mathsf{ED}(x,y)^{\delta}/\delta\;\operatorname{polylog}(n)) space and the number of intermediate results ((pi,qi)(p_{i},q_{i}) and did_{i}’s) is O(kmδ)=O(𝖤𝖣(x,y)δ)O(k_{m}^{\delta})=O(\mathsf{ED}(x,y)^{\delta}). This gives us a 2O(1/δ)2^{O(1/\delta)} approximation algorithm with space complexity O(𝖤𝖣(x,y)δ/δpolylog(n))O(\mathsf{ED}(x,y)^{\delta}/\delta\;\operatorname{polylog}(n)).

𝖫𝖢𝖲\mathsf{LCS} and 𝖫𝖭𝖲𝖳\mathsf{LNST}.

We show that the reduction from 𝖫𝖢𝖲\mathsf{LCS} to 𝖤𝖣\mathsf{ED} discovered in [RS20] can work in the asymmetric streaming model with a slight modification. Combined with our algorithm for 𝖤𝖣\mathsf{ED}, this gives a nδn^{\delta} space algorithm for 𝖫𝖢𝖲\mathsf{LCS} that achieves a 1/2+ε1/2+\varepsilon approximation for binary strings. We stress that the original reduction in [RS20] is not in the asymmetric streaming model and hence our result does not follow directly from previous works.

We also provide a simple algorithm to approximate 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t). Assume the alphabet is [r][r], the idea is to create a set 𝒟[t]r\mathcal{D}\subset[t]^{r} and for each d=(d1,,dr)𝒟d=(d_{1},\dots,d_{r})\in\mathcal{D}, we check whether σ(d)=1d12d2rdr\sigma(d)=1^{d_{1}}2^{d_{2}}\cdots r^{d_{r}} is a subsequence of xx. We show that in a properly chosen 𝒟\mathcal{D} with size O((min(t,r/ε))r)O\big{(}(\min(t,r/\varepsilon))^{r}\big{)} obtained by sparsifying [t]r[t]^{r}, there is some d𝒟d\in\mathcal{D} such that σ(d)\sigma(d) is a subsequence of xx and |σ(d)||\sigma(d)| is a 1ε1-\varepsilon approximation of 𝖫𝖭𝖲𝖳(x,t).\mathsf{LNST}(x,t).

1.3 Open Problems

Our work leaves a plethora of intriguing open problems. The main one is to close the gap between our lower bounds and the upper bounds of known algorithms, especially for the case of small alphabets and large (say constant) approximation. We believe that in this case it is possible to improve both the lower bounds and the upper bounds. Another interesting problem is to completely characterize the space complexity of 𝖫𝖭𝖲𝖳\mathsf{LNST}.

2 Preliminaries

We use the following conventional notations. Let xΣnx\in\Sigma^{n} be a string of length nn over alphabet Σ\Sigma. By |x||x|, we mean the length of xx. We denote the ii-th character of xx by xix_{i} and the substring from the ii-th character to the jj-th character by x[i:j]x{[i:j]}. We denote the concatenation of two strings xx and yy by xyx\circ y. By [n][n], we mean the set of positive integers no larger than nn.

Edit Distance The edit distance (or Levenshtein distance) between two strings x,yΣx,y\in\Sigma^{*} , denoted by 𝖤𝖣(x,y)\mathsf{ED}(x,y), is the smallest number of edit operations (insertion, deletion, and substitution) needed to transform one into another. The insertion (deletion) operation adds (removes) a character at some position. The substitution operation replace a character with another character from the alphabet set Σ\Sigma.

Longest Common Subsequence We say the string sΣts\in\Sigma^{t} is a subsequence of xΣnx\in\Sigma^{n} if there exists indices 1i1<i2<<itn1\leq i_{1}<i_{2}<\cdots<i_{t}\leq n such that s=xi1xi2xits=x_{i_{1}}x_{i_{2}}\cdots x_{i_{t}}. A string ss is called a common subsequence of strings xx and yy if ss is a subsequence of both xx and yy. Given two strings xx and yy, we denote the length of the longest common subsequence (LCS) of xx and yy by 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y).

In the proofs, we sometime consider the matching between x,yΣnx,y\in\Sigma^{n}. By a matching, we mean a function m:[n][n]m:[n]\rightarrow[n]\cup\emptyset such that if m(i)m(i)\neq\emptyset, we have xi=ym(i)x_{i}=y_{m(i)}. We require the matching to be non-crossing. That is, for i<ji<j, if m(i)m(i) and m(j)m(j) are both not \emptyset, we have m(i)<m(j)m(i)<m(j). The size of a matching is the number of i[n]i\in[n] such that m(i)m(i)\neq\emptyset. We say a matching is a best matching if it achieves the maximum size. Each matching between xx and yy corresponds to a common subsequence. Thus, the size of a best matching between xx and yy is equal to 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y).

Longest Increasing Subsequence In the longest increasing subsequence problem, we assume there is a given total order on the alphabet set Σ\Sigma. We say the string sΣts\in\Sigma^{t} is an increasing subsequence of xΣnx\in\Sigma^{n} if there exists indices 1i1<i2<<itn1\leq i_{1}<i_{2}<\cdots<i_{t}\leq n such that s=xi1xi2xits=x_{i_{1}}x_{i_{2}}\cdots x_{i_{t}} and xi1<xi2<<xitx_{i_{1}}<x_{i_{2}}<\cdots<x_{i_{t}}. We denote the length of the longest increasing subsequence (LIS) of string xx by 𝖫𝖨𝖲(x)\mathsf{LIS}(x). In our discussion, we let \infty and -\infty to be two imaginary characters such that <α<-\infty<\alpha<\infty for all αΣ\alpha\in\Sigma.

Longest Non-decreasing Subsequence The longest non-decreasing subsequence is a variant of the longest increasing problem. The difference is that in a non-decreasing subsequence s=xi1xi2xits=x_{i_{1}}x_{i_{2}}\cdots x_{i_{t}}, we only require xi1xi2xitx_{i_{1}}\leq x_{i_{2}}\leq\cdots\leq x_{i_{t}}.

Lemma 2.1 (Lovász Local Lemma).

Let 𝒜={A1,A2,,An}\mathcal{A}=\{A_{1},A_{2},\dots,A_{n}\} be a finite set of events. For A𝒜A\in\mathcal{A}, let Γ(A)\Gamma(A) denote the neighbours of AA in the dependency graph (In the dependency graph, mutually independent events are not adjacent). If there exist an assignment of reals x:𝒜[0,1)x:\mathcal{A}\rightarrow[0,1) to the events such that

A𝒜,Pr(A)x(A)AΓ(A)(1x(A)).\forall\;A\in\mathcal{A},\;\Pr(A)\leq x(A)\prod_{A^{\prime}\in\Gamma(A)}(1-x(A^{\prime})).

Then, for the probability that none of the events in 𝒜\mathcal{A} happens, we have

Pr(A1¯A2¯Atl¯)i=1n(1x(Ai)).\Pr(\overline{A_{1}}\wedge\overline{A_{2}}\wedge\cdots\wedge\overline{A_{t-l}})\geq\prod_{i=1}^{n}(1-x(A_{i})).

In the Set Disjointness problem, we consider a two party game. Each party holds a binary string of length nn, say xx and yy. And the goal is to compute the function 𝖣𝖨𝖲(x,y)\mathsf{DIS}(x,y) as defined below

𝖣𝖨𝖲(x,y)={0, if i, s.t. xi=yi1, otherwise\mathsf{DIS}(x,y)=\begin{cases}0,\text{ if }\exists\;i,\text{ s.t. }x_{i}=y_{i}\\ 1,\text{ otherwise}\end{cases}

We define R1/3(f)R^{1/3}(f) as the minimum number of bits required to be sent between two parties in any randomized multi-round communication protocol with 2-sided error at most 1/31/3. The following is a well-known result.

Lemma 2.2 ([KS92], [Raz90]).

R1/3(𝖣𝖨𝖲)=Ω(n)R^{1/3}(\mathsf{DIS})=\Omega(n).

We will consider the one-way tt-party communication model where tt players P1,P2,,PtP_{1},P_{2},\dots,P_{t} each holds input x1,x2,,xtx_{1},x_{2},\dots,x_{t} respectively. The goal is to compute the function f(x1,x2,,xt)f(x_{1},x_{2},\dots,x_{t}). In the one-way communication model, each player speaks in turn and player PiP_{i} can only send message to player Pi+1P_{i+1}. We sometimes consider multiple round of communication. In an RR round protocol, during round rRr\leq R, each player speaks in turn PiP_{i} sends message to Pi+1P_{i+1}. At the end of round r<Rr<R, player PtP_{t} sends a message to P1P_{1}. At the end of round RR, player PtP_{t} must output the answer of the protocol. We note that our lower bound also hold for a stronger blackboard model. In this model, the players can write messages (in the order of 1,,t1,\dots,t) on a blackboard that is visible to all other players.

We define the total communication complexity of ff in the tt-party one-way communication model, denoted by CCttot(f)CC^{tot}_{t}(f), as the minimum number of bits required to be sent by the players in every deterministic communication protocol that always outputs a correct answer. The total communication complexity in the blackboard model is the total length of the messages written on the blackboard by the players.

For deterministic protocol PP that always outputs the correct answer, we let M(P)M(P) be the maximum number of bits required to be sent by some player in protocol PP. We define CCtmax(f)CC^{max}_{t}(f), the maximum communication complexity of ff as minPM(P)\min_{P}{M(P)} where PP ranges over all deterministic protocol that outputs a correct answer. We have CCtmax(f)1tRCCttot(f)CC^{max}_{t}(f)\geq\frac{1}{tR}CC^{tot}_{t}(f) where RR is the number of rounds.

Let XX be a subset of UtU^{t} where UU is some finite universe and tt is an integer. Define the span of XX by 𝖲𝗉𝖺𝗇(X)={yUt|i[t],xX s. t. yi=xi}\mathsf{Span}(X)=\{y\in U^{t}|\forall\ i\in[t],\ \exists\ x\in X\text{ s. t. }y_{i}=x_{i}\}. The notion kk-fooling set introduced in [EJ08] is defined as following.

Definition 2.1 (kk-fooling set).

Let f:Ut{0,1}f:U^{t}\rightarrow\{0,1\} where UU is some finite universe. Let SUtS\subseteq U^{t}. For some integer kk, we say SS is a kk-fooling set for ff iff f(x)=0f(x)=0 for each xSx\in S and for each subset SS^{\prime} of SS with cardinality kk, the span of SS^{\prime} contains a member yy such that f(y)=1f(y)=1.

We have the following.

Lemma 2.3 (Fact 4.1 from [EJ08]).

Let SS be a kk-fooling set for ff, we have CCttot(f)log(|S|k1)CC^{tot}_{t}(f)\geq\log(\frac{|S|}{k-1}).

3 Lower Bounds for Edit Distance

We show a reduction from the Set Disjointness problem (𝖣𝖨𝖲\mathsf{DIS}) to computing 𝖤𝖣\mathsf{ED} between two strings in the asymmetric streaming model. For this, we define the following two party communication problem between Alice and Bob.

Given an alphabet Σ\Sigma and three integers n1,n2,n3n_{1},n_{2},n_{3}. Suppose Alice has a string x1Σn1x_{1}\in\Sigma^{n_{1}} and Bob has a string x2Σn1x_{2}\in\Sigma^{n_{1}}. There is another fixed reference string yΣn3y\in\Sigma^{n_{3}} that is known to both Alice and Bob. Alice and Bob now tries to compute 𝖤𝖣((x1x2),y)\mathsf{ED}((x_{1}\circ x_{2}),y).We call this problem 𝖤𝖣cc(y)\mathsf{ED}_{cc}(y). We prove the following theorem.

Theorem 8.

Suppose each input string to 𝖣𝖨𝖲\mathsf{DIS} has length nn and let Σ=[6n]{a}\Sigma=[6n]\cup\{a\}. Fix y=(1,2,,6n)y=(1,2,\cdots,6n). Then R1/3(𝖤𝖣cc(y))R1/3(𝖣𝖨𝖲)R^{1/3}(\mathsf{ED}_{cc}(y))\geq R^{1/3}(\mathsf{DIS}).

To prove this theorem, we first construct the strings x1,x2x_{1},x_{2} based on the inputs α,β{0,1}n\alpha,\beta\in\{0,1\}^{n} to 𝖣𝖨𝖲\mathsf{DIS}. From α\alpha, Alice constructs the string α{0,1}2n\alpha^{\prime}\in\{0,1\}^{2n} such that j[n],α2j1=αj\forall j\in[n],\alpha^{\prime}_{2j-1}=\alpha_{j} and α2j=1αj\alpha^{\prime}_{2j}=1-\alpha_{j}. Similarly, from β\beta, Bob constructs the string β{0,1}2n\beta^{\prime}\in\{0,1\}^{2n} such that j[n],β2j1=1βj\forall j\in[n],\beta^{\prime}_{2j-1}=1-\beta_{j} and β2j=βj\beta^{\prime}_{2j}=\beta_{j}. Now Alice lets x1x_{1} be a modification from the string (1,2,4,5,,3i2,3i1,,6n2,6n1)(1,2,4,5,\cdots,3i-2,3i-1,\cdots,6n-2,6n-1) such that j[2n]\forall j\in[2n], if αj=0\alpha^{\prime}_{j}=0 then the symbol 3j13j-1 (at index 2j2j) is replaced by aa. Similarly, Bob lets x2x_{2} be a modification from the string (2,3,5,6,,3i1,3i,,6n1,6n)(2,3,5,6,\cdots,3i-1,3i,\cdots,6n-1,6n) such that j[2n]\forall j\in[2n], if βj=0\beta^{\prime}_{j}=0 then the symbol 3j13j-1 (at index 2j12j-1) is replaced by aa.

We have the following Lemma.

Lemma 3.1.

If 𝖣𝖨𝖲(α,β)=1\mathsf{DIS}(\alpha,\beta)=1 then 𝖤𝖣((x1x2),y)7n2\mathsf{ED}((x_{1}\circ x_{2}),y)\geq 7n-2.

To prove the lemma we observe that in a series of edit operations that transforms (x1,x2)(x_{1},x_{2}) to yy, there exists an index r[6n]r\in[6n] s.t. x1x_{1} is transformed into [1:r][1:r] and x2x_{2} is transformed into [r+1:n][r+1:n]. We analyze the edit distance in each part. We first have the following claim:

Claim 3.1.

For any two strings uu and vv, there is a sequence of optimal edit operations (insertion/deletion/substitution) that transforms uu to vv, where all deletions happen first, followed by all insertions, and all substitutions happen at the end of the operations.

Proof.

Note that a substitution does not change the indices of the symbols. Thus, in any sequence of such edit operations, consider the last substitution which happens at index l. If there are no insertion/deletion after it, then we are good. Otherwise, consider what happens if we switch this substitution and the insertion/deletions before this substitution and after the second to last substitution. The only symbol that may be affected is the symbol where index l is changed into. Thus, depending on this position, we may or may not need a substitution, which results in a sequence of edit operations where the number of operations is at most the original number. In this way, we can change all substitutions to the end.

Further notice that we can assume without loss of generality that any deletion only deletes the original symbols in uu, because otherwise we are deleting an inserted symbol, and these two operations cancel each other. Therefore, in a sequence of optimal edit operations, all the deletions can happen before any insertion. ∎

For any ii, let Γ1(i)\Gamma_{1}(i) denote the number of aa symbols up to index 2i2i in x1x_{1}. Note that Γ1(i)\Gamma_{1}(i) is equal to the number of 0’s in α[1:i]\alpha^{\prime}[1:i]. We have the following lemma.

Lemma 3.2.

For any p[n]p\in[n], let r=3pqr=3p-q where 0q20\leq q\leq 2, then 𝖤𝖣(x1,[1:r])=4npq+Γ1(p)\mathsf{ED}(x_{1},[1:r])=4n-p-q+\Gamma_{1}(p) if q=0,1q=0,1 and 𝖤𝖣(x1,[1:r])=4np+Γ1(p1)\mathsf{ED}(x_{1},[1:r])=4n-p+\Gamma_{1}(p-1) if q=2q=2.

Proof.

By Claim 3.1 we can first consider deletions and insertions, and then compute the Hamming distance after these operations (for substitutions).

We consider the three different cases of qq. Let the number of insertions be did_{i} and the number of deletions be ddd_{d}. Note that didd=r4nd_{i}-d_{d}=r-4n. We define the number of agreements between two strings to be the number of positions where the two corresponding symbols are equal.

The case of q=0q=0 and q=1q=1.

Here again we have two cases.

Case (a):

dd4n2p.d_{d}\geq 4n-2p. In this case, notice that the LCS after the operations between x1x_{1} and yy is at most the original 𝖫𝖢𝖲(x1,y)=2pΓ1(p)\mathsf{LCS}(x_{1},y)=2p-\Gamma_{1}(p). With did_{i} insertions, the number of agreements can be at most 𝖫𝖢𝖲(x1,y)+di=2pΓ1(p)+di\mathsf{LCS}(x_{1},y)+d_{i}=2p-\Gamma_{1}(p)+d_{i}, thus the Hamming distance at the end is at least r2p+Γ1(p)dir-2p+\Gamma_{1}(p)-d_{i}. Therefore, in this case the number of edit operations is at least di+dd+r2p+Γ1(p)di4npq+Γ1(p)d_{i}+d_{d}+r-2p+\Gamma_{1}(p)-d_{i}\geq 4n-p-q+\Gamma_{1}(p), and the equality is achieved when dd=4n2pd_{d}=4n-2p.

Case (b):

dd<4n2p.d_{d}<4n-2p. In this case, notice that all original symbols in x1x_{1} larger than 3di3d_{i} (or beyond index 2di2d_{i} before the insertions) are guaranteed to be out of agreement. Thus the only possible original symbols in x1x_{1} that are in agreement with yy after the operations are the symbols with original index at most 2di2d_{i}. Note that the LCS between x1[1:2di]x_{1}[1:2d_{i}] and yy is 2diΓ1(di)2d_{i}-\Gamma_{1}(d_{i}). Thus with did_{i} insertions the number of agreements is at most 3diΓ1(di)3d_{i}-\Gamma_{1}(d_{i}), and the Hamming distance at the end is at least r3di+Γ1(di)r-3d_{i}+\Gamma_{1}(d_{i}).

Therefore the number of edit operations is at least di+dd+r3di+Γ1(di)=rdi+(dddi)+Γ1(di)=4ndi+Γ1(di)d_{i}+d_{d}+r-3d_{i}+\Gamma_{1}(d_{i})=r-d_{i}+(d_{d}-d_{i})+\Gamma_{1}(d_{i})=4n-d_{i}+\Gamma_{1}(d_{i}). Now notice that di=dd+r4n<pd_{i}=d_{d}+r-4n<p and the quantity diΓ1(di)d_{i}-\Gamma_{1}(d_{i}) is non-decreasing as did_{i} increases. Thus the number of edit operations is at least 4np+Γ1(p)4npq+Γ1(p)4n-p+\Gamma_{1}(p)\geq 4n-p-q+\Gamma_{1}(p).

The other case of qq is similar, as follows.

The case of q=2q=2.

Here again we have two cases.

Case (a):

dd4n2p+1.d_{d}\geq 4n-2p+1. In this case, notice that the LCS after the operations between x1x_{1} and yy is at most the original 𝖫𝖢𝖲(x1,y)=2(p1)Γ1(p1)+1=2p1Γ1(p1)\mathsf{LCS}(x_{1},y)=2(p-1)-\Gamma_{1}(p-1)+1=2p-1-\Gamma_{1}(p-1). With did_{i} insertions, the number of agreements can be at most 𝖫𝖢𝖲(x1,y)+di=2p1Γ1(p1)+di\mathsf{LCS}(x_{1},y)+d_{i}=2p-1-\Gamma_{1}(p-1)+d_{i}, thus the Hamming distance at the end is at least r2p+1+Γ1(p1)dir-2p+1+\Gamma_{1}(p-1)-d_{i}. Therefore, in this case the number of edit operations is at least di+dd+r2p+1+Γ1(p1)di4np+Γ1(p1)d_{i}+d_{d}+r-2p+1+\Gamma_{1}(p-1)-d_{i}\geq 4n-p+\Gamma_{1}(p-1), and the equality is achieved when dd=4n2p+1d_{d}=4n-2p+1.

Case (b):

dd4n2p.d_{d}\leq 4n-2p. In this case, notice that all original symbols in x1x_{1} larger than 3di3d_{i} (or beyond index 2di2d_{i} before the insertions) are guaranteed to be out of agreement. Thus the only possible original symbols in x1x_{1} that are in agreement with yy after the operations are the symbols with original index at most 2di2d_{i}. Note that the LCS between x[1:2di]x[1:2d_{i}] and yy is 2diΓ1(di)2d_{i}-\Gamma_{1}(d_{i}). Thus with did_{i} insertions the number of agreements is at most 3diΓ1(di)3d_{i}-\Gamma_{1}(d_{i}), and the Hamming distance at the end is at least r3di+Γ1(di)r-3d_{i}+\Gamma_{1}(d_{i}).

Therefore the number of edit operations is at least di+dd+r3di+Γ1(di)=rdi+(dddi)+Γ1(di)=4ndi+Γ1(di)d_{i}+d_{d}+r-3d_{i}+\Gamma_{1}(d_{i})=r-d_{i}+(d_{d}-d_{i})+\Gamma_{1}(d_{i})=4n-d_{i}+\Gamma_{1}(d_{i}). Now notice that di=dd+r4n<p1d_{i}=d_{d}+r-4n<p-1 and the quantity diΓ1(di)d_{i}-\Gamma_{1}(d_{i}) is non-decreasing as did_{i} increases. Thus the number of edit operations is at least 4n(p1)+Γ1(p1)>4np+Γ1(p1)4n-(p-1)+\Gamma_{1}(p-1)>4n-p+\Gamma_{1}(p-1).

We can now prove a similar lemma for x2x_{2}. For any ii, let Γ2(i)\Gamma_{2}(i) denote the number of aa symbols from index 2i+12i+1 to 4n4n in x2x_{2}. Note that Γ2(i)\Gamma_{2}(i) is equal to the number of 0’s in β[i+1:2n]\beta^{\prime}[i+1:2n].

Lemma 3.3.

Let r=3p+qr=3p+q where 0q20\leq q\leq 2, then 𝖤𝖣(x2,[r+1:6n])=2n+pq+Γ2(p)\mathsf{ED}(x_{2},[r+1:6n])=2n+p-q+\Gamma_{2}(p) if q=0,1q=0,1 and 𝖤𝖣(x2,[r+1:6n])=2n+p+Γ2(p+1)\mathsf{ED}(x_{2},[r+1:6n])=2n+p+\Gamma_{2}(p+1) if q=2q=2.

Proof.

We can reduce to Lemma 3.2. To do this, use 6n+16n+1 to minus every symbol in x2x_{2} and in [r+1:6n][r+1:6n], while keeping all the aa symbols unchanged. Now, reading both strings from right to left, x2x_{2} becomes the string x2¯=1,2,,3i2,3i1,,6n2,6n1\overline{x_{2}}=1,2,\cdots,3i-2,3i-1,\cdots,6n-2,6n-1 with some symbols of the form 3j13j-1 replaced by aa’s. Similarly [r+1:6n][r+1:6n] becomes [1:6nr][1:6n-r] where 6nr=3(2np)q6n-r=3(2n-p)-q.

If we regard x2¯\overline{x_{2}} as x1x_{1} as in Lemma 3.2 and define Γ1(i)\Gamma_{1}(i) as in that lemma, we can see that Γ1(i)=Γ2(2ni)\Gamma_{1}(i)=\Gamma_{2}(2n-i).

Now the lemma basically follows from Lemma 3.2. In the case of q=0,1q=0,1, we have

𝖤𝖣(x2,[r+1:6n])=𝖤𝖣(x¯,[1:6nr])=4n(2np)q+Γ1(2np)=2n+pq+Γ2(p).\mathsf{ED}(x_{2},[r+1:6n])=\mathsf{ED}(\overline{x^{\prime}},[1:6n-r])=4n-(2n-p)-q+\Gamma_{1}(2n-p)=2n+p-q+\Gamma_{2}(p).

In the case of q=2q=2, we have

𝖤𝖣(x2,[r+1:6n])=𝖤𝖣(x¯,[1:6nr])=4n(2np)+Γ1(2np1)=2n+p+Γ2(p+1).\mathsf{ED}(x_{2},[r+1:6n])=\mathsf{ED}(\overline{x^{\prime}},[1:6n-r])=4n-(2n-p)+\Gamma_{1}(2n-p-1)=2n+p+\Gamma_{2}(p+1).

We can now prove Lemma 3.1.

Proof of Lemma 3.1.

We show that for any r[6n]r\in[6n], 𝖤𝖣(x1,[1:r])+𝖤𝖣(x2,[r+1:6n])7n2\mathsf{ED}(x_{1},[1:r])+\mathsf{ED}(x_{2},[r+1:6n])\geq 7n-2. First we have the following claim.

Claim 3.2.

If 𝖣𝖨𝖲(α,β)=1\mathsf{DIS}(\alpha,\beta)=1, then for any i[2n]i\in[2n], we have Γ1(i)+Γ2(i)n\Gamma_{1}(i)+\Gamma_{2}(i)\geq n.

To see this, note that when ii is even, we have Γ1(i)=i/2\Gamma_{1}(i)=i/2 and Γ1(i)=ni/2\Gamma_{1}(i)=n-i/2 so Γ1(i)+Γ2(i)=n\Gamma_{1}(i)+\Gamma_{2}(i)=n. Now consider the case of ii being odd and let i=2j1i=2j-1 for some j[2n]j\in[2n]. We know Γ1(i1)=(i1)/2=j1\Gamma_{1}(i-1)=(i-1)/2=j-1 and Γ2(i+1)=n(i+1)/2=nj\Gamma_{2}(i+1)=n-(i+1)/2=n-j, so we only need to look at x1[2i1,2i]x_{1}[2i-1,2i] and x2[2i+1,2i+2]x_{2}[2i+1,2i+2] and count the number of symbols aa’s in them. If the number of aa’s is at least 11, then we are done.

The only possible situation where the number of aa’s is 0 is that αi=βi+1=1\alpha^{\prime}_{i}=\beta^{\prime}_{i+1}=1 which means αj=βj=1\alpha_{j}=\beta_{j}=1 and this contradicts the fact that 𝖣𝖨𝖲(α,β)=1\mathsf{DIS}(\alpha,\beta)=1.

We now have the following cases.

Case (a):

r=3pr=3p. In this case, by Lemma 3.2 and Lemma 3.3 we have 𝖤𝖣(x1,[1:r])=4np+Γ1(p)\mathsf{ED}(x_{1},[1:r])=4n-p+\Gamma_{1}(p) and 𝖤𝖣(x2,[r+1:6n])=2n+p+Γ2(p)\mathsf{ED}(x_{2},[r+1:6n])=2n+p+\Gamma_{2}(p). Thus we have 𝖤𝖣(x1,[1:r])+𝖤𝖣(x2,[r+1:6n])=6n+n=7n\mathsf{ED}(x_{1},[1:r])+\mathsf{ED}(x_{2},[r+1:6n])=6n+n=7n.

Case (b):

r=3p1=3(p1)+2r=3p-1=3(p-1)+2. In this case, by Lemma 3.2 and Lemma 3.3 we have 𝖤𝖣(x1,[1:r])=4np1+Γ1(p)\mathsf{ED}(x_{1},[1:r])=4n-p-1+\Gamma_{1}(p) and 𝖤𝖣(x2,[r+1:6n])=2n+(p1)+Γ2(p)\mathsf{ED}(x_{2},[r+1:6n])=2n+(p-1)+\Gamma_{2}(p), thus we have 𝖤𝖣(x1,[1:r])+𝖤𝖣(x2,[r+1:6n])=6n2+n=7n2\mathsf{ED}(x_{1},[1:r])+\mathsf{ED}(x_{2},[r+1:6n])=6n-2+n=7n-2.

Case (c):

r=3p2=3(p1)+1r=3p-2=3(p-1)+1. In this case, by Lemma 3.2 and Lemma 3.3 we have 𝖤𝖣(x1,[1:r])=4np+Γ1(p1)\mathsf{ED}(x_{1},[1:r])=4n-p+\Gamma_{1}(p-1) and 𝖤𝖣(x2,[r+1:6n])=2n+(p1)1+Γ2(p1)\mathsf{ED}(x_{2},[r+1:6n])=2n+(p-1)-1+\Gamma_{2}(p-1), thus we have 𝖤𝖣(x1,[1:r])+𝖤𝖣(x2,[r+1:6n])=6n2+n=7n2\mathsf{ED}(x_{1},[1:r])+\mathsf{ED}(x_{2},[r+1:6n])=6n-2+n=7n-2.

We now prove Theorem 8.

Proof of Theorem 8.

We begin by upper bounding 𝖤𝖣((x1x2),y)\mathsf{ED}((x_{1}\circ x_{2}),y) when 𝖣𝖨𝖲(α,β)=0\mathsf{DIS}(\alpha,\beta)=0.

Claim 3.3.

If 𝖣𝖨𝖲(α,β)=0\mathsf{DIS}(\alpha,\beta)=0 then 𝖤𝖣((x1x2),y)7n3\mathsf{ED}((x_{1}\circ x_{2}),y)\leq 7n-3.

To see this, note that if 𝖣𝖨𝖲(α,β)=0\mathsf{DIS}(\alpha,\beta)=0 then there exists a j[n]j\in[n] such that αj=βj=1\alpha_{j}=\beta_{j}=1. Thus α2j1=1\alpha^{\prime}_{2j-1}=1, β2j1=0\beta^{\prime}_{2j-1}=0 and α2j=0\alpha^{\prime}_{2j}=0, β2j=1\beta^{\prime}_{2j}=1. Note that the number of 0’s in α[1:2j1]\alpha^{\prime}[1:2j-1] is j1j-1 and thus Γ1(2j1)=j1\Gamma_{1}(2j-1)=j-1. Similarly the number of 0’s in β[2j:2n]\beta^{\prime}[2j:2n] is njn-j and thus Γ2(2j1)=nj\Gamma_{2}(2j-1)=n-j. To transform (x1,x2)(x_{1},x_{2}) to yy, we choose r=6j2r=6j-2, transform x1x_{1} to y[1:r]y[1:r], and transform x2x_{2} to y[r+1:6n]y[r+1:6n].

By Lemma 3.2 and Lemma 3.3 we have 𝖤𝖣(x1,[1:r])=4n2j+Γ1(2j1)\mathsf{ED}(x_{1},[1:r])=4n-2j+\Gamma_{1}(2j-1) and 𝖤𝖣(x2,[r+1:6n])=2n+(2j1)1+Γ2(2j1)\mathsf{ED}(x_{2},[r+1:6n])=2n+(2j-1)-1+\Gamma_{2}(2j-1). .Thus we have 𝖤𝖣(x1,[1:r])+𝖤𝖣(x2,[r+1:6n])=6n2+Γ1(2j1)+Γ2(2j1)=6n2+n1=7n3\mathsf{ED}(x_{1},[1:r])+\mathsf{ED}(x_{2},[r+1:6n])=6n-2+\Gamma_{1}(2j-1)+\Gamma_{2}(2j-1)=6n-2+n-1=7n-3. Therefore 𝖤𝖣((x1,x2),y)7n3\mathsf{ED}((x_{1},x_{2}),y)\leq 7n-3.

Therefore, in the case of 𝖣𝖨𝖲(α,β)=1\mathsf{DIS}(\alpha,\beta)=1, we have 𝖤𝖣((x1x2),y)7n2\mathsf{ED}((x_{1}\circ x_{2}),y)\geq 7n-2 while in the case of 𝖣𝖨𝖲(α,β)=0\mathsf{DIS}(\alpha,\beta)=0, we have 𝖤𝖣((x1x2),y)7n3\mathsf{ED}((x_{1}\circ x_{2}),y)\leq 7n-3. Thus any protocol that solves 𝖤𝖣cc(y)\mathsf{ED}_{cc}(y) can also solve 𝖣𝖨𝖲\mathsf{DIS}, hence the theorem follows. ∎

In the proof of Theorem 8, the two strings x=(x1x2)x=(x_{1}\circ x_{2}) and yy have different lengths, however we can extend it to the case where the two strings have the same length and prove the following theorem.

Theorem 9.

Suppose each input string to 𝖣𝖨𝖲\mathsf{DIS} has length nn and let Σ=[16n]{a}\Sigma=[16n]\cup\{a\}. Fix y~=(1,2,,16n,a2n)\tilde{y}=(1,2,\cdots,16n,a^{2n}), let x~1Σ4n\tilde{x}_{1}\in\Sigma^{4n} and x~2Σ14n\tilde{x}_{2}\in\Sigma^{14n}. Define 𝖤𝖣cc(y~)\mathsf{ED}_{cc}(\tilde{y}) as the two party communication problem of computing 𝖤𝖣((x~1x~2),y~)\mathsf{ED}((\tilde{x}_{1}\circ\tilde{x}_{2}),\tilde{y}). Then R1/3(𝖤𝖣cc(y~))R1/3(𝖣𝖨𝖲)R^{1/3}(\mathsf{ED}_{cc}(\tilde{y}))\geq R^{1/3}(\mathsf{DIS}).

Proof.

We extend the construction of Theorem 8 as follows. From input (α,β)(\alpha,\beta) to 𝖣𝖨𝖲\mathsf{DIS}, first construct (x1,x2)(x_{1},x_{2}) as before. Then, let z=(6n+1,6n+2,,16n)z=(6n+1,6n+2,\cdots,16n), x~1=x1\tilde{x}_{1}=x_{1} and x~2=x2z\tilde{x}_{2}=x_{2}\circ z. Note that we also have y~=yza2n\tilde{y}=y\circ z\circ a^{2n}, and |x~1x~2|=18n=|y~||\tilde{x}_{1}\circ\tilde{x}_{2}|=18n=|\tilde{y}|.

We finish the proof by establishing the following two lemmas.

Lemma 3.4.

If 𝖣𝖨𝖲(α,β)=1\mathsf{DIS}(\alpha,\beta)=1 then 𝖤𝖣((x~1x~2),y~)9n2\mathsf{ED}((\tilde{x}_{1}\circ\tilde{x}_{2}),\tilde{y})\geq 9n-2.

Proof.

First we can see that 𝖤𝖣((x~1x~2),y~)<10n\mathsf{ED}((\tilde{x}_{1}\circ\tilde{x}_{2}),\tilde{y})<10n since we can first use at most 8n18n-1 edit operations to change (x1,x2)(x_{1},x_{2}) into yy (note that the first symbols are the same), and then add 2n2n symbols of aa at the end.

Now we have the following claim:

Claim 3.4.

In an optimal sequence of edit operations that transforms (x~1x~2)(\tilde{x}_{1}\circ\tilde{x}_{2}) to y~\tilde{y}, at the end some symbol in zz must be kept and thus matched to y~\tilde{y} at the same position.

To see this, assume for the sake of contradiction that none of the symbols in zz is kept, then this already incurs at least 10n10n edit operations, contradicting the fact that 𝖤𝖣((x~,x~),y~)<10n\mathsf{ED}((\tilde{x},\tilde{x}^{\prime}),\tilde{y})<10n.

We now have a second claim:

Claim 3.5.

In an optimal sequence of edit operations that transforms (x~1x~2)(\tilde{x}_{1}\circ\tilde{x}_{2}) to y~\tilde{y}, at the end all symbols in zz must be kept and thus matched to y~\tilde{y} at the same positions.

To see this, we use Claim 3.4 and first argue that some symbol of zz is kept and matched to y~\tilde{y}. Assume this is the symbol rr. Then we can grow this symbol both to the left and to the right and argue that all the other symbols of zz must be kept. For example, consider the symbol r+1r+1 if r<16nr<16n. There is a symbol r+1r+1 that is matched to y~\tilde{y} in the end. If this symbol is not the original r+1r+1, then the original one must be removed either by deletion or substitution, since there cannot be two symbols of r+1r+1 in the end. Thus instead, we can keep the original r+1r+1 symbol and reduce the number of edit operations.

More precisely, if this r+1r+1 symbol is an insertion, then we can keep the originalr+1r+1 symbol and get rid of this insertion and the deletion of the original r+1r+1, which saves 22 operations. If this r+1r+1 symbol is a substitution, then we can keep the originalr+1r+1 symbol, delete the symbol being substituted, and get rid of the deletion of the original r+1r+1, which saves 11 operation. The case of r1r-1 is completely symmetric. Continue doing this, we see that all symbols of zz must be kept and thus matched to y~\tilde{y}.

Now, we can see the optimal sequence of edit operations must transform (x1,x2)(x_{1},x_{2}) into yy, and transform the empty string into a2na^{2n}. Thus by Lemma 3.1 we have

𝖤𝖣((x~1x~2),y~)=𝖤𝖣((x1,x2),y)+2n9n2.\mathsf{ED}((\tilde{x}_{1}\circ\tilde{x}_{2}),\tilde{y})=\mathsf{ED}((x_{1},x_{2}),y)+2n\geq 9n-2.

We now have the next lemma.

Lemma 3.5.

If 𝖣𝖨𝖲(α,β)=0\mathsf{DIS}(\alpha,\beta)=0 then 𝖤𝖣((x~1x~2),y~)9n3\mathsf{ED}((\tilde{x}_{1}\circ\tilde{x}_{2}),\tilde{y})\leq 9n-3.

Proof.

Again, to transform (x~1x~2)(\tilde{x}_{1}\circ\tilde{x}_{2}) to y~\tilde{y}, we can first transform (x1,x2)(x_{1},x_{2}) into yy, and insert a2na^{2n} at the end. If 𝖣𝖨𝖲(α,β)=0\mathsf{DIS}(\alpha,\beta)=0 then by Claim 3.3 𝖤𝖣((x1x2),y)7n3\mathsf{ED}((x_{1}\circ x_{2}),y)\leq 7n-3. Therefore we have

𝖤𝖣((x~1x~2),y~)𝖤𝖣((x1,x2),y)+2n9n3.\mathsf{ED}((\tilde{x}_{1}\circ\tilde{x}_{2}),\tilde{y})\leq\mathsf{ED}((x_{1},x_{2}),y)+2n\leq 9n-3.

Thus any protocol that solves 𝖤𝖣cc(y~)\mathsf{ED}_{cc}(\tilde{y}) can also solve 𝖣𝖨𝖲\mathsf{DIS}, hence the theorem follows. ∎

From Theorem 9 we immediately have the following theorem.

Theorem 10.

Any RR-pass randomized algorithm in the asymmetric streaming model that computes 𝖤𝖣(x,y)\mathsf{ED}(x,y) exactly between two strings x,yx,y of length nn with success probability at least 2/32/3 must use space at least Ω(n/R)\Omega(n/R).

We can generalize the theorem to the case of deciding if 𝖤𝖣(x,y)\mathsf{ED}(x,y) is a given number kk. First we prove the following lemmas.

Lemma 3.6.

Let Σ\Sigma be an alphabet. For any n,n,\ell\in\mathbb{N} let x,yΣnx,y\in\Sigma^{n} and zΣz\in\Sigma^{\ell} be three strings. Then 𝖤𝖣(xz,yz)=𝖤𝖣(x,y)\mathsf{ED}(x\circ z,y\circ z)=\mathsf{ED}(x,y).

Proof.

First it is clear that 𝖤𝖣(xz,yz)𝖤𝖣(x,y)\mathsf{ED}(x\circ z,y\circ z)\leq\mathsf{ED}(x,y), since we can just transform xx to yy. Next we show that 𝖤𝖣(xz,yz)𝖤𝖣(x,y)\mathsf{ED}(x\circ z,y\circ z)\geq\mathsf{ED}(x,y).

To see this, suppose a series of edit operations transforms xx to y=y[1:nr]y^{\prime}=y[1:n-r] or y=y[1:n]z[1:r]y^{\prime}=y[1:n]\circ z[1:r] for some r0r\geq 0 and transforms zz to the other part of yzy\circ z (called zz^{\prime}). Then by triangle inequality we have 𝖤𝖣(x,y)𝖤𝖣(x,y)r\mathsf{ED}(x,y^{\prime})\geq\mathsf{ED}(x,y)-r. Also note that 𝖤𝖣(z,z)||z||z||=r\mathsf{ED}(z,z^{\prime})\geq\left||z|-|z^{\prime}|\right|=r. Thus the number of edit operations is at least 𝖤𝖣(x,y)+𝖤𝖣(z,z)𝖤𝖣(x,y)\mathsf{ED}(x,y^{\prime})+\mathsf{ED}(z,z^{\prime})\geq\mathsf{ED}(x,y). ∎

Lemma 3.7.

Let Σ\Sigma be an alphabet. For any n,n,\ell\in\mathbb{N} let x,yΣnx,y\in\Sigma^{n} and u,vΣu,v\in\Sigma^{\ell} be four strings. If there is no common symbol between any of the three pairs of strings (u,v)(u,v), (u,y)(u,y) and (v,x)(v,x), then 𝖤𝖣(xu,yv)=𝖤𝖣(x,y)+\mathsf{ED}(x\circ u,y\circ v)=\mathsf{ED}(x,y)+\ell.

Proof.

First it is clear that 𝖤𝖣(xu,yv)𝖤𝖣(x,y)+\mathsf{ED}(x\circ u,y\circ v)\leq\mathsf{ED}(x,y)+\ell, since we can just transform xx to yy and then replace uu by vv. Next we show that 𝖤𝖣(xu,yv)𝖤𝖣(x,y)+\mathsf{ED}(x\circ u,y\circ v)\geq\mathsf{ED}(x,y)+\ell.

To see this, suppose a series of edit operations transforms xx to y=y[1:nr]y^{\prime}=y[1:n-r] for some r0r\geq 0 and transforms uu to the other part of v=y[nr+1:n]vv^{\prime}=y[n-r+1:n]\circ v. Then by triangle inequality we have 𝖤𝖣(x,y)𝖤𝖣(x,y)r\mathsf{ED}(x,y^{\prime})\geq\mathsf{ED}(x,y)-r. Since there is no common symbol between (u,v)(u,v) and (u,y)(u,y) , we have 𝖤𝖣(u,v)r+\mathsf{ED}(u,v^{\prime})\geq r+\ell. Thus the number of edit operations is at least 𝖤𝖣(x,y)+𝖤𝖣(u,v)𝖤𝖣(x,y)+\mathsf{ED}(x,y^{\prime})+\mathsf{ED}(u,v^{\prime})\geq\mathsf{ED}(x,y)+\ell. The case of transforming xx to y=y[1:n]v[1:r]y^{\prime}=y[1:n]\circ v[1:r] for some r0r\geq 0 is completely symmetric since equivalently it is transforming yy to x=[1:nr]x^{\prime}=[1:n-r^{\prime}] for some r0r^{\prime}\geq 0. ∎

We have the following two theorems.

Theorem 11.

There is a constant c>1c>1 such that for any k,nk,n\in\mathbb{N} with nckn\geq ck, and alphabet Σ\Sigma with |Σ|ck|\Sigma|\geq ck, any RR-pass randomized algorithm in the asymmetric streaming model that decides if 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\geq k between two strings x,yΣnx,y\in\Sigma^{n} with success probability at least 2/32/3 must use space at least Ω(k/R)\Omega(k/R).

Proof.

Theorem 9 and Theorem 10 can be viewed as deciding if 𝖤𝖣(x,y)9n2\mathsf{ED}(x,y)\geq 9n-2 for two strings of length 18n18n over an alphabet with size 16n+116n+1. Thus we can first use the constructions there to reduce 𝖣𝖨𝖲\mathsf{DIS} to the problem of deciding if 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\geq k with a fixed string yy of length O(k)O(k). The number of symbols used is O(k)O(k) as well. Now to increase the length of the strings to nn, we pad a sequence of the symbol 11 at the end of both xx and yy until the length reaches nn. By Lemma 3.6 the edit distance stays the same and thus the problem is still deciding if 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\geq k. By Theorem 9 the communication complexity is Ω(k)\Omega(k) and thus the theorem follows. ∎

Theorem 12.

There is a constant c>1c>1 such that for any k,nk,n\in\mathbb{N} and alphabet Σ\Sigma with nck|Σ|n\geq ck\geq|\Sigma|, any RR-pass randomized algorithm in the asymmetric streaming model that decides if 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\geq k between two strings x,yΣnx,y\in\Sigma^{n} with success probability at least 2/32/3 must use space at least Ω(|Σ|/R)\Omega(|\Sigma|/R).

Proof.

Theorem 9 and Theorem 10 can be viewed as deciding if 𝖤𝖣(x,y)9n2\mathsf{ED}(x,y)\geq 9n-2 for two strings of length nn over an alphabet with size 18n+118n+1. Thus we can first use the constructions there to reduce 𝖣𝖨𝖲\mathsf{DIS} to the problem of deciding if 𝖤𝖣(x,y)k=Ω(|Σ|)\mathsf{ED}(x,y)\geq k^{\prime}=\Omega(|\Sigma|) with a fixed string yy of length Θ(|Σ|)\Theta(|\Sigma|), and the number of symbols used is |Σ|2|\Sigma|-2. Now we take the 2 unused symbols and pad a sequence of these two symbols with length kkk-k^{\prime} at the end of xx and yy. By Lemma 3.7 the edit distance increases by kkk-k^{\prime} and thus the problem becomes deciding if 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\geq k. Next, to increase the length of the strings to nn, we pad a sequence of the symbol 11 at the end of both strings until the length reaches nn. By Lemma 3.6 the edit distance stays the same and thus the problem is still deciding if 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\geq k. By Theorem 9 the communication complexity is Ω(|Σ|)\Omega(|\Sigma|) and thus the theorem follows. ∎

Combining the previous two theorems we have the following theorem, which is a restatement of Theorem 1.

Theorem 13 (Restatement of Theorem 1).

There is a constant c>1c>1 such that for any k,nk,n\in\mathbb{N} with nckn\geq ck, given an alphabet Σ\Sigma, any RR-pass randomized algorithm in the asymmetric streaming model that decides if 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\geq k between two strings x,yΣnx,y\in\Sigma^{n} with success probability at least 2/32/3 must use space at least Ω(𝗆𝗂𝗇(k,|Σ|)/R)\Omega(\mathsf{min}(k,|\Sigma|)/R).

For 0<ε<10<\varepsilon<1, by taking k=1/εk=1/\varepsilon we also get the following corollary:

Corollary 3.1.

Given an alphabet Σ\Sigma, for any 0<ε<10<\varepsilon<1, any RR-pass randomized algorithm in the asymmetric streaming model that achieves a 1+ε1+\varepsilon approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y) between two strings x,yΣnx,y\in\Sigma^{n} with success probability at least 2/32/3 must use space at least Ω(𝗆𝗂𝗇(1/ε,|Σ|)/R)\Omega(\mathsf{min}(1/\varepsilon,|\Sigma|)/R).

4 Lower Bounds for LCS

In this section, we study the space lower bounds for asymmetric streaming LCS.

4.1 Exact computation

4.1.1 Binary alphabet, deterministic algorithm

In this section, we assume nn can be diveded by 6060 and let l=n301l=\frac{n}{30}-1. We assume the alphabet is Σ={a,b}\Sigma=\{a,b\}. Consider strings xx of the form

x=b10as1b10as2b10b10aslb10.x=b^{10}a^{s_{1}}b^{10}a^{s_{2}}b^{10}\cdots b^{10}a^{s_{l}}b^{10}. (1)

That is, xx contains ll blocks of consecutive aa symbols. Between each block of aa symbols, we insert 1010 bb’s and we also add 1010 bb’s to the front, and the end of xx. s1,,sls_{1},\dots,s_{l} are ll integers such that

i=1lsi=n6+5,\displaystyle\sum_{i=1}^{l}s_{i}=\frac{n}{6}+5, (2)
1si9,i[l].\displaystyle 1\leq s_{i}\leq 9,\;\forall i\in[l]. (3)

Thus, the length of xx is i=1ln6+5+10(l+1)=n2+5\sum_{i=1}^{l}\frac{n}{6}+5+10(l+1)=\frac{n}{2}+5 and it contains exactly n3\frac{n}{3} bb’s.

Let SS be the set of all x{a,b}n2+5x\in\{a,b\}^{\frac{n}{2}+5} of form 1 that satisfying equations 2, 3. For each string xSx\in S, we can define a string f(x){a,b}n25f(x)\in\{a,b\}^{\frac{n}{2}-5} as following. Assume x=b10as1b10as2b10b10aslb10x=b^{10}a^{s_{1}}b^{10}a^{s_{2}}b^{10}\cdots b^{10}a^{s_{l}}b^{10}, we set f(x)=as1b10as2b10b10aslb10f(x)=a^{s_{1}}b^{10}a^{s_{2}}b^{10}\cdots b^{10}a^{s_{l}}b^{10}. That is, f(x)f(x) simply removed the first 1010 bb’s of xx. We denote S¯={f(x)|xS}\bar{S}=\{f(x)|x\in S\} .

Claim 4.1.

|S|=|S¯|=2Ω(n)|S|=|\bar{S}|=2^{\Omega(n)}.

Proof.

Notice that for x1,x2Sx^{1},x^{2}\in S, if x1x2x^{1}\neq x^{2}, then f(x1)f(x2)f(x^{1})\neq f(x^{2}). We have |S|=|S¯||S|=|\bar{S}|.

The size of SS equals to the number of choices of ll integers s1,s2,,sls_{1},s_{2},\dots,s_{l} that satisfies 2 and 3. For an lower bound of |S||S|, we can pick n60\frac{n}{60} of the integers to be 99, and set the remaining to be 11 or 22. Thus the number of such choices is at least (ln60)=(n301n60)=2Ω(n).\binom{l}{\frac{n}{60}}=\binom{\frac{n}{30}-1}{\frac{n}{60}}=2^{\Omega(n)}.

We first show the following lemma.

Lemma 4.1.

Let y=an/3bn/3an/3y=a^{n/3}b^{n/3}a^{n/3}. For every xSx\in S,

𝖫𝖢𝖲(xf(x),y)=n2+5.\mathsf{LCS}(x\circ f(x),y)=\frac{n}{2}+5.

For any two distinct x1,x2Sx^{1},x^{2}\in S,

max{𝖫𝖢𝖲(x1f(x2),y),𝖫𝖢𝖲(x2f(x1),y)}>n2+5.\max\{\mathsf{LCS}(x^{1}\circ f(x^{2}),y),\mathsf{LCS}(x^{2}\circ f(x^{1}),y)\}>\frac{n}{2}+5.
Proof of Lemma 4.1.

We first show 𝖫𝖢𝖲(xf(x),y)=n2+5\mathsf{LCS}(x\circ f(x),y)=\frac{n}{2}+5. Notice that xf(x)x\circ f(x) is of the form

b10as1b10b10aslb10as1b10b10aslb10.b^{10}a^{s_{1}}b^{10}\cdots b^{10}a^{s_{l}}b^{10}a^{s_{1}}b^{10}\cdots b^{10}a^{s_{l}}b^{10}.

It cantains 2l+12l+1 block of bb’s, each consists 1010 consecutive bb’s. These blocks of bb’s are seperated by some aa’s. Also, xf(x)x\circ f(x) has 2i=1lsi=n3+102\sum_{i=1}^{l}s_{i}=\frac{n}{3}+10 aa’s and 2n310\frac{2n}{3}-10 bb’s. Let pip_{i} be the first position of the ii-th block of bb’s.

Let us consider a matching between xf(x)x\circ f(x) and yy.

If the matching does not match any bb’s in yy to xf(x)x\circ f(x), the size of such a matching is at most n3+10\frac{n}{3}+10 since it is the number of aa’s in xf(x)x\circ f(x).

Now we assume some 1’s in yy are matched to xf(x)x\circ f(x). Without loss of generality, we can assume the first bb symbol in yy is matched. This is because all bb’s in yy are consecutive and if the first bb in yy (i.e. yn3+1y_{\frac{n}{3}+1}) is not matched, we can find another matching of the same size that matches yn3+1y_{\frac{n}{3}+1}. For the same reason, we can assume the first bb in yy is matched to position pip_{i} for some i[2l+1]i\in[2l+1]. Assume nbn_{b} is the number of bb’s matched. Again, without loss of generality, we can assume the first nbn_{b} bb’s starting from position pip_{i} in xf(x)x\circ f(x) are matched since all bb’s in yy are consecutive and there are no matched aa’s between two matched bb’s. We have two cases.

Case 1: yn3+1y_{\frac{n}{3}+1} is matched to pip_{i} for some 1il+11\leq i\leq l+1. Let nbn_{b} be the number of matched bb’s. We know nbn3n_{b}\leq\frac{n}{3} since there are n3\frac{n}{3} bb’s in yy.

If nb=n3n_{b}=\frac{n}{3}, we match first n3\frac{n}{3} bb’s in xf(x)x\circ f(x) starting from position pip_{i}. Consider the number of aa’s that are still free to match in xf(x)x\circ f(x). The number of aa’s before pip_{i} is j=1i1si\sum^{i-1}_{j=1}s_{i}. Since il+1i\leq l+1, j=1i1si\sum^{i-1}_{j=1}s_{i} is at most n6+5\frac{n}{6}+5, we can match all of them to first third of yy. Also, we need l+1l+1 blocks of bb’s to match all bb’s in yy. The number of aa’s after last matched bb in xf(x)x\circ f(x) is j=ilsj\sum_{j=i}^{l}s_{j} (which is zero when i=l+1i=l+1). Again, we can match all these aa’s since j=ilsjn3\sum_{j=i}^{l}s_{j}\leq\frac{n}{3}. In total, we can match j=1lsj=n6+5\sum_{j=1}^{l}s_{j}=\frac{n}{6}+5 aa’s. This gives us a matching of size n3+n6+5=n2+5\frac{n}{3}+\frac{n}{6}+5=\frac{n}{2}+5. We argue that the best strategy is to always match n3\frac{n}{3} bb’s. To see this, if we removed 1010 matched bb’s, this will let us match sjs_{j} additional 0’s for some j[l]j\in[l]. By our construction of xx, sjs_{j} is strictly smaller than 1010 for all j[l]j\in[l]. If we keep doing this, the size of matching will decrease. Thus, the largest matching we can find in this case is n2+5\frac{n}{2}+5.

Case 2: yn3+1y_{\frac{n}{3}+1} is matched to pip_{i} for some l+1<i2l+1l+1<i\leq 2l+1. By the same argument in Case 1, the best strategy is to match as many bb’s as possible. The number of bb’s in xf(x)x\circ f(x) starting from position pip_{i} is (2l+1i+1)t=(2li+2)t(2l+1-i+1)t=(2l-i+2)t. The number of aa’s that are free to match is j=1lsj+j=1il+1sj=n6+5+j=1il1sj\sum_{j=1}^{l}s_{j}+\sum_{j^{\prime}=1}^{i-l+1}s_{j^{\prime}}=\frac{n}{6}+5+\sum_{j=1}^{i-l-1}s_{j}. Since sj<ts_{j}<t for all j[l]j\in[l], the number of aa’s can be matched is strictly smaller than n6+5+(il+1)t\frac{n}{6}+5+(i-l+1)t. The largest matching we can find in this case is smaller than n6+5+(l+1)t=n2+5\frac{n}{6}+5+(l+1)t=\frac{n}{2}+5.

This proves the size of the largest matching we can find is exactly n2+5\frac{n}{2}+5. We have 𝖫𝖢𝖲(xf(x),y)=n2+5\mathsf{LCS}(x\circ f(x),y)=\frac{n}{2}+5.

For the second statement in the lemma, say x1x^{1} and x2x^{2} are two distinct strings in SS. For convenience, we assume x1=b10as11b10as21b10b10asl1b10x^{1}=b^{10}a^{s^{1}_{1}}b^{10}a^{s^{1}_{2}}b^{10}\cdots b^{10}a^{s^{1}_{l}}b^{10}, and x2=b10as12b10as22b10b10asl2b10x^{2}=b^{10}a^{s^{2}_{1}}b^{10}a^{s^{2}_{2}}b^{10}\cdots b^{10}a^{s^{2}_{l}}b^{10}. Let ii be the smallest integer such that si1s2is^{1}_{i}\neq s^{i}_{2}. We have il1i\leq l-1 since j=1lsj1=j=1lsj2\sum_{j=1}^{l}s^{1}_{j}=\sum_{j=1}^{l}s^{2}_{j}. Without loss of generality, we assume si1>si2s^{1}_{i}>s^{2}_{i}. We show that 𝖫𝖢𝖲(x1f(x2),y)>n2+5\mathsf{LCS}(x^{1}\circ f(x^{2}),y)>\frac{n}{2}+5. Notice that x1f(x2)x^{1}\circ f(x^{2}) is of the form

b10as11b10b10asl1b10as12b10b10asl2b10.b^{10}a^{s^{1}_{1}}b^{10}\cdots b^{10}a^{s^{1}_{l}}b^{10}a^{s^{2}_{1}}b^{10}\cdots b^{10}a^{s^{2}_{l}}b^{10}.

By the same notation, let pjp_{j} be the first position of the jj-th block of bb’s in x1f(x2)x^{1}\circ f(x^{2})

Consider the match that matches the first bb in yy to position pi+1p_{i+1}. The number of aa’s before pi+1p_{i+1} is j=1isj1\sum_{j=1}^{i}s^{1}_{j}. We matches all n3\frac{n}{3} bb’s in yy. The number of aa’s after the last matched bb in x1f(x2)x^{1}\circ f(x^{2}) is j=i+1lsj2\sum_{j=i+1}^{l}s^{2}_{j}. This gives us a match of size n3+j=1isj1+j=i+1lsj2\frac{n}{3}+\sum_{j=1}^{i}s^{1}_{j}+\sum_{j=i+1}^{l}s^{2}_{j}. By our choice of ii, we have sj1=sj2s^{1}_{j}=s^{2}_{j} for j[i1]j\in[i-1]. The size of the matching equals to n3+j=1lsj2+si1si2=n2+5+si1si2\frac{n}{3}+\sum_{j=1}^{l}s^{2}_{j}+s^{1}_{i}-s^{2}_{i}=\frac{n}{2}+5+s^{1}_{i}-s^{2}_{i} which is larger than n2+5\frac{n}{2}+5. Thus, the length of LCS between x1f(x2)x^{1}\circ f(x^{2}) and yy is larger than n2+5\frac{n}{2}+5. This finishes our proof.

Lemma 4.2.

In the asymmetric streaming model, any deterministic protocol that computes 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) for any x,y{0,1}nx,y\in\{0,1\}^{n}, in RR passes of xx needs Ω(n/R)\Omega(n/R) space.

Proof.

Consider a two party game where player 1 holds a string x1Sx^{1}\in S and player 2 holds a string x2Sx^{2}\in S. The goal is to verify whether x1=x2x^{1}=x^{2}. It is known that the total communication complexity of testing the equality of two elements from set SS is Ω(log|S|)\Omega(\log|S|), see [KN97] for example. We can reduce this to computing the length of LCS. To see this, we first compute 𝖫𝖢𝖲(x1f(x2),y)\mathsf{LCS}(x^{1}\circ f(x^{2}),y) and 𝖫𝖢𝖲(x2f(x1),y)\mathsf{LCS}(x^{2}\circ f(x^{1}),y) with y=an/3bn/3an/3y=a^{n/3}b^{n/3}a^{n/3}. By lemma 4.1, if both 𝖫𝖢𝖲(x1f(x2),y)=𝖫𝖢𝖲(x2f(x),y)=n2+5\mathsf{LCS}(x^{1}\circ f(x^{2}),y)=\mathsf{LCS}(x^{2}\circ f(x),y)=\frac{n}{2}+5, we know x1=x2x^{1}=x^{2}, otherwise, x1x2x^{1}\neq x^{2}. Here, yy is known to both parties.

The above reduction shows the total communication complexity of this game is Ω(n)\Omega(n) since |S|=2Ω(n)|S|=2^{\Omega(n)}. If we only allow RR rounds of communication, the size of the longest message sent by the players is Ω(n/R)\Omega(n/R). Thus, in the asymmetric model, any protocol that computes 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) in RR passes of xx needs Ω(n/R)\Omega(n/R) space.

4.1.2 Ω(n)\Omega(n) size alphabet, randomized algorithm

Lemma 4.3.

Assume |Σ|=Ω(n)|\Sigma|=\Omega(n). In the asymmetric streaming model, any randomized protocol that computes 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) correctly with probability at least 2/32/3 for any x,yΣnx,y\in\Sigma^{n}, in RR of passes of xx needs Ω(n/R)\Omega(n/R) space. The lower bound also holds when xx is a permutation of yy.

Proof of Lemma 4.3.

The proof is by giving a reduction from set-disjointness.

In the following, we assume alphabet set Σ=[n]\Sigma=[n] which is the set of integers from 1 to nn. We let the online string xx be a permutation of nn and the offline string y=12ny=12\cdots n be the concatenation from 1 to nn. Then computing 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) is equivalent to compute LIS(x)LIS(x) since any common subsequence of xx and yy must be increasing.

We now describe our approach. For convenience, let n=n2n^{\prime}=\frac{n}{2}. Without loss of generality, we assume nn^{\prime} can be divided by 44. Consider a string z{0,1}nz\in\{0,1\}^{n^{\prime}} with the following property.

i[n2],z2i=1z2i1.\forall\;\;i\in[\frac{n^{\prime}}{2}],\qquad z_{2i}=1-z_{2i-1}. (4)

For each i[n]i\in[n^{\prime}], we consider subsets σi[n]\sigma^{i}\subset[n] for i[n]i\in[n^{\prime}] as defined below

σi={{4i1,4i}, if i is odd and in2{4(in2)3,4(in2)2} if i is odd and i>n2{4i3,4i2} if i is even and in2{4(in2)1,4(in2)} if i is even and i>n2\sigma^{i}=\begin{cases}\{4i-1,4i\},&\text{ if $i$ is odd and $i\leq\frac{n^{\prime}}{2}$}\\ \{4(i-\frac{n^{\prime}}{2})-3,4(i-\frac{n^{\prime}}{2})-2\}&\text{ if $i$ is odd and $i>\frac{n^{\prime}}{2}$}\\ \{4i-3,4i-2\}&\text{ if $i$ is even and $i\leq\frac{n^{\prime}}{2}$}\\ \{4(i-\frac{n^{\prime}}{2})-1,4(i-\frac{n^{\prime}}{2})\}&\text{ if $i$ is even and $i>\frac{n^{\prime}}{2}$}\end{cases}

Notice that σiσj=\sigma^{i}\cap\sigma^{j}=\emptyset if iji\neq j and i=1nσi=[n]\cup^{n^{\prime}}_{i=1}\sigma^{i}=[n]. For an odd i[n/2]i\in[n^{\prime}/2], minσi>maxσi+n/2\min\sigma^{i}>\max\sigma^{i+n^{\prime}/2}. Oppositely, for an even i[n/2]i\in[n^{\prime}/2], maxσi<minσi+n/2\max\sigma^{i}<\min\sigma^{i+n^{\prime}/2}. Also notice that for distinct i,j[n/2]i,j\in[n^{\prime}/2] with i<ji<j, maxσi<minσj\max\sigma^{i}<\min\sigma^{j} and maxσi+n/2<minσj+n/2\max\sigma^{i+n^{\prime}/2}<\min\sigma^{j+n^{\prime}/2}.

We abuse the notation a bit and let σi(zi)\sigma^{i}(z_{i}) be a string such that if zi=1z_{i}=1, the string consists of elements in set σi\sigma^{i} arranged in an increasing order, and if zi=0z_{i}=0, the string is arranged in decreasing order.

Let xx be the concatenation of σi(zi)\sigma^{i}(z_{i}) for i[n]i\in[n^{\prime}] such that x=σ1(z1)σ2(z2)σn(zn)x=\sigma^{1}(z_{1})\circ\sigma^{2}(z_{2})\circ\cdots\circ\sigma^{n^{\prime}}(z_{n^{\prime}}). By the definition of σi\sigma^{i}’s, we know xx is a permutation of [n][n].

For convenience, let z1z^{1} and z2z^{2} be two subsequences of zz such that

z1=z2z4zn2\displaystyle z^{1}=z_{2}\circ z_{4}\circ\cdots z_{\frac{n^{\prime}}{2}}
z2=zn2+2zn2+4zn\displaystyle z^{2}=z_{\frac{n^{\prime}}{2}+2}\circ z_{\frac{n^{\prime}}{2}+4}\circ\cdots\circ z_{n^{\prime}}

If 𝖣𝖨𝖲(z1,z2)=0\mathsf{DIS}(z^{1},z^{2})=0. Then there exist some i[n/4]i\in[n^{\prime}/4] such that z2i=zn/2+2i=1z_{2i}=z_{n^{\prime}/2+2i}=1. Notice that in zz, we have j[n2],z2j=1z2j1.\forall j\in[\frac{n^{\prime}}{2}],\;z_{2j}=1-z_{2j-1}. Thus, 𝖫𝖨𝖲(σ2j1(z2j1)σ2j(z2j))=3\mathsf{LIS}(\sigma^{2j-1}({z_{2j-1}})\circ\sigma^{2j}({z_{2j}}))=3 since only one of σ2j1(z2j1)\sigma^{2j-1}({z_{2j-1}}) and σ2j(z2j)\sigma^{2j}({z_{2j}}) is increasing and the other is decreasing. For any j[n/4]j\in[n^{\prime}/4], we have

𝖫𝖨𝖲(σ1(z1)σ2(z2)σ2j(z2j))=3j\displaystyle\mathsf{LIS}(\sigma^{1}(z_{1})\circ\sigma^{2}(z_{2})\circ\cdots\circ\sigma^{2j}(z_{2j}))=3j (5)
𝖫𝖨𝖲(σ2j+n/2+1(z2j+n/2+1)σ2j+n/2+2(z2j+n/2+2)σn(zn))=3n2j2.\displaystyle\mathsf{LIS}(\sigma^{2j+n^{\prime}/2+1}(z_{2j+n^{\prime}/2+1})\circ\sigma^{2j+n^{\prime}/2+2}(z_{2j+n^{\prime}/2+2})\circ\cdots\circ\sigma^{n^{\prime}}(z_{n^{\prime}}))=3\frac{n^{\prime}-2j}{2}. (6)

Since z2i+n/2=1z_{2i+n^{\prime}/2}=1, 𝖫𝖨𝖲(σ2i+n/2(z2i+n/2))=2\mathsf{LIS}(\sigma^{2i+n^{\prime}/2}(z_{2i+n^{\prime}/2}))=2. Since maxσ2i<minσ2i+n/2<maxσ2i+n/2<minσ2i+n/2+1\max\sigma^{2i}<\min\sigma^{2i+n^{\prime}/2}<\max\sigma^{2i+n^{\prime}/2}<\min\sigma^{2i+n^{\prime}/2+1}, combining with equations 5 and 6, we know 𝖫𝖨𝖲(x)3n2+2\mathsf{LIS}(x)\geq 3\frac{n^{\prime}}{2}+2.

If 𝖣𝖨𝖲(z1,z2)=1\mathsf{DIS}(z^{1},z^{2})=1, we prove that 𝖫𝖨𝖲(x)=3n2+1\mathsf{LIS}(x)=3\frac{n^{\prime}}{2}+1. We only need to consider in an longest increasing subsequence, when do we first pick some elements from the second half of xx. Say the first element picked in the second half of xx is in σ2i+n/21\sigma^{2i+n^{\prime}/2-1} or σ2i+n/2\sigma^{2i+n^{\prime}/2} for some i[n/2]i\in[n^{\prime}/2]. We have

𝖫𝖨𝖲(σ2i1(z2i1)σ2i(z2i)σ2i+n/21(z2i+n/21)σ2i+n/2(z2i+n/2))=4.\mathsf{LIS}(\sigma^{2i-1}(z_{2i-1})\circ\sigma^{2i}(z_{2i})\circ\sigma^{2i+n^{\prime}/2-1}(z_{2i+n^{\prime}/2-1})\circ\sigma^{2i+n/2}(z_{2i+n^{\prime}/2}))=4.

This is because z2iz_{2i} and z2i+n/2z_{2i+n^{\prime}/2} can not both be 1, z2i=1z2i1z_{2i}=1-z_{2i-1} , and z2i+n/2=1z2i+n/21z_{2i+n^{\prime}/2}=1-z_{2i+n^{\prime}/2-1} . The length of 𝖫𝖨𝖲\mathsf{LIS} of the substring of xx before σ2i1(z2i1)\sigma^{2i-1}(z_{2i-1}) is 3(i1)3(i-1) and the length of LIS after σ2i+n/2(z2i+n/2)\sigma^{2i+n/2}(z_{2i+n^{\prime}/2}) is 3(n/2i)3(n^{\prime}/2-i). Thus, we have 𝖫𝖨𝖲(x)=3n2+1\mathsf{LIS}(x)=3\frac{n^{\prime}}{2}+1.

This gives a reduction from computing 𝖣𝖨𝖲(z1,z2)\mathsf{DIS}(z^{1},z^{2}) to computing 𝖫𝖨𝖲(x)=𝖫𝖢𝖲(x,y)\mathsf{LIS}(x)=\mathsf{LCS}(x,y). Now assume player 1 holds the first half of xx and player 2 holds the second half. Both players have access to yy. Since |z1|=|z2|=n/4=n8|z^{1}|=|z^{2}|=n^{\prime}/4=\frac{n}{8}. Any randomized protocol that computes 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) with success probability at least 2/32/3 has an total communication complexity Ω(n)\Omega(n). Thus, any randomized asymmetric streaming algorithm with RR passes of xx needs Ω(n/R)\Omega(n/R) space. ∎

We can generalize the above lemma to the following.

Theorem 14 (Restatement of Theorem 2).

There is a constant c>1c>1 such that for any k,nk,n\in\mathbb{N} with n>ckn>ck, given an alphabet Σ\Sigma, any RR-pass randomized algorithm in the asymmetric streaming model that decides if 𝖫𝖢𝖲(x,y)k\mathsf{LCS}(x,y)\geq k between two strings x,yΣnx,y\in\Sigma^{n} with success probability at least 2/32/3 must use at least Ω(𝗆𝗂𝗇(k,|Σ|)/R)\Omega\big{(}\mathsf{min}(k,|\Sigma|)/R\big{)} space.

Proof.

Without loss of generality, assume Σ=[r]\Sigma=[r] so |Σ|=r|\Sigma|=r. Since we assume k<nk<n, we have 𝗆𝗂𝗇(k,r)<n\mathsf{min}(k,r)<n.

Let d=𝗆𝗂𝗇(k,r)d=\mathsf{min}(k,r). we let the offline string yy be the concatenation of two parts y1y^{1} and y2y^{2} where y1y^{1} is the concatenation of symbols in [d2]Σ[d-2]\subseteq\Sigma in ascending order. y2y^{2} is the symbol d1d-1 repeated nd+2n-d+2 times. Thus, yΣny\in\Sigma^{n}. xx also consists of two parts x1x^{1} and x2x^{2} such that x1x^{1} is over alphabet [d2][d-2] with length d2d-2 and x2x^{2} is the symbol dd repeated nd+2n-d+2 times. Since the symbol d1d-1 does not appear in xx and the symbol dd does not appear in yy. Thus, 𝖫𝖢𝖲(x,y)=𝖫𝖢𝖲(x1,y1)\mathsf{LCS}(x,y)=\mathsf{LCS}(x^{1},y^{1}). By Lemma 4.3, any randomized algorithm that computes 𝖫𝖢𝖲(x1,y1)\mathsf{LCS}(x^{1},y^{1}) with probability at least 2/3 using RR passes of x1x^{1} requires Ω(d/R)\Omega(d/R) space.

4.2 Approximation

We now show a lower bound for deterministic 1+ε1+\varepsilon approximation of 𝖫𝖢𝖲\mathsf{LCS} in the asymmetric streaming model.

Theorem 15 (Restatement of Theorem 3).

Assume ε>0\varepsilon>0, and |Σ|2εn\frac{|\Sigma|^{2}}{\varepsilon}\leq n . In the asymmetric streaming model, any deterministic protocol that computes an 1+ε1+\varepsilon approximation of 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) for any x,yΣnx,y\in\Sigma^{n}, with constant number of passes of xx needs Ω(|Σ|ε)\Omega(\frac{|\Sigma|}{\varepsilon}) space.

Proof of Theorem 15.

In the following, we assume the size of alphabet set Σ\Sigma is 3r3r such that

Σ={a1,b1,c1,a2,b2,c2,ar,br,cr}.\Sigma=\{a_{1},b_{1},c_{1},a_{2},b_{2},c_{2},\dots a_{r},b_{r},c_{r}\}.

We let nε=Θ(1/ε)n_{\varepsilon}=\Theta(1/\varepsilon) such that nεn_{\varepsilon} can be divided by 60.

For any distinct a,bΣa,b\in\Sigma, we can build a set Sa,bS_{a,b} in the same way as we did in section 4.1.1 except that we replace nn wtih nεn_{\varepsilon} (we used notation SS instead Sa,bS_{a,b}). Thus, Sa,b{a,b}nε/2+5S_{a,b}\subseteq\{a,b\}^{n_{\varepsilon}/2+5}. Similarly, we can define function ff and Sa,b¯={f(σ)|σSa,b}{a,b}nε/25\overline{S_{a,b}}=\{f(\sigma)|\sigma\in S_{a,b}\}\subset\{a,b\}^{n_{\varepsilon}/2-5}. Let ya,b=anε/3bnε/3anε/3y^{a,b}=a^{n_{\varepsilon}/3}b^{n_{\varepsilon}/3}a^{n_{\varepsilon}/3}. By Claim 4.1 and Lemma 4.1, we know |Sa,b|=|Sa,b¯|=2Ω(nε)|S_{a,b}|=|\overline{S_{a,b}}|=2^{\Omega(n_{\varepsilon})}. For any σSa,b\sigma\in S_{a,b}, we have 𝖫𝖢𝖲(σf(σ),ya,b)=nε/2+5\mathsf{LCS}(\sigma\circ f(\sigma),y^{a,b})=n_{\varepsilon}/2+5. For any two distinct σ1,σ2Sa,b\sigma^{1},\sigma^{2}\in S_{a,b}, we know at least one of 𝖫𝖢𝖲(σ1f(σ2),ya,b)\mathsf{LCS}(\sigma^{1}\circ f(\sigma^{2}),y^{a,b}) and 𝖫𝖢𝖲(σ2f(σ1),ya,b)\mathsf{LCS}(\sigma^{2}\circ f(\sigma^{1}),y^{a,b}) is at larger than nε/2+5n_{\varepsilon}/2+5.

Consider w=(w1,w2,,w2r)w=(w_{1},w_{2},\dots,w_{2r}) such that w2i1Sa,bw_{2i-1}\in S_{a,b} and w2iSa,b¯w_{2i}\in\overline{S_{a,b}} for i[r]i\in[r]. Thus, ww can be viewed as an element in

U=(Sa,b×Sa,b¯)××(Sa,b×Sa,b¯)r times.U=\underbrace{\big{(}S_{a,b}\times\overline{S_{a,b}}\big{)}\times\cdots\times\big{(}S_{a,b}\times\overline{S_{a,b}}\big{)}}_{r\text{ times}}.

For alphabet {ai,bi}\{a_{i},b_{i}\}, we can similarly define Sai,biS_{a_{i},b_{i}}, Sai,bi¯\overline{S_{a_{i},b_{i}}} and yai,biy^{a_{i},b_{i}}. We let UiU_{i} be similarly defined as UU but over alphabet {ai,bi}\{a_{i},b_{i}\}.

Let β=1/3\beta=1/3. We can define function h:(Sa,b×Sa,b¯)r{0,1}h:(S_{a,b}\times\overline{S_{a,b}})^{r}\rightarrow\{0,1\} such that

h(w)={0, if i[r],𝖫𝖢𝖲(w2i1w2i,yai,bi)=nε/2+51, if for at least βr indices i[r]𝖫𝖢𝖲(w2i1w2i,ya,b)>nε/2+5undefined, otherwise.h(w)=\begin{cases}0,&\text{ if }\forall i\in[r],\;\mathsf{LCS}(w_{2i-1}\circ w_{2i},y^{a_{i},b_{i}})=n_{\varepsilon}/2+5\\ 1,&\text{ if for at least $\beta r$ indices $i\in[r]$, }\mathsf{LCS}(w_{2i-1}\circ w_{2i},y^{a,b})>n_{\varepsilon}/2+5\\ \text{undefined},&\text{ otherwise}.\end{cases} (7)

Consider an error-correcting code Ta,bSa,brT_{a,b}\subseteq S_{a,b}^{r} over alphabet Sa,bS_{a,b} with constant rate α\alpha and constant distance β\beta. We can pick α=1/2\alpha=1/2 and β=1/3\beta=1/3, for example. Then the size of the code Ta,bT_{a,b} is |Ta,b|=|Sa,b|αr=2Ω(nεr)|T_{a,b}|=|S_{a,b}|^{\alpha r}=2^{\Omega(n_{\varepsilon}r)}. For any code word χ=χ1χ2χrTa,b\chi=\chi_{1}\chi_{2}\cdots\chi_{r}\in T_{a,b} where χiSa,b\chi_{i}\in S_{a,b}, we can write

ν(χ)=(χ1,f(χ1),χ2,f(χ2),,χr,f(χr)).\nu(\chi)=(\chi_{1},f(\chi_{1}),\chi_{2},f(\chi_{2}),\dots,\chi_{r},f(\chi_{r})).

Let W={ν(χ)|χTa,b}(Sa,b×Sa,b¯)rW=\{\nu(\chi)|\chi\in T_{a,b}\}\in(S_{a,b}\times\overline{S_{a,b}})^{r}. Then

|W|=|Ta,b|=2Ω(nεr)|W|=|T_{a,b}|=2^{\Omega(n_{\varepsilon}r)} (8)

We consider a 2r2r-player one-way game where the goal is to compute the function hh on input w=(w1,w2,,w2r)w=(w_{1},w_{2},\dots,w_{2r}). In this game, player ii holds wiw_{i} for i[2r]i\in[2r] and can only send message to player i+1i+1 (Here, 2r+1=12r+1=1). We now show the following claim.

Claim 4.2.

WW is a fooling set for the function hh.

Proof.

Consider any two different codewords χ,χTa,b\chi,\chi^{\prime}\in T_{a,b}. Denote w=ν(χ)w=\nu(\chi) and w=ν(χ)w^{\prime}=\nu(\chi^{\prime}). By our defintion of ww, we know w2i=f(w2i1)w_{2i}=f(w_{2i-1}) and w2i1Sai,biw_{2i-1}\in S_{a_{i},b_{i}} for i[r]i\in[r]. We have 𝖫𝖢𝖲(w2i1w2i,yai,bi)=nε/2+5\mathsf{LCS}(w_{2i-1}\circ w_{2i},y^{a_{i},b_{i}})=n_{\varepsilon}/2+5. Thus, h(w)=h(w)=0h(w)=h(w^{\prime})=0.

The span of {w,w}\{w,w^{\prime}\} is the set {(v1,v2,,v2r)|vi{wi,wi} for i[2r]}\{(v_{1},v_{2},\dots,v_{2r})|v_{i}\in\{w_{i},w^{\prime}_{i}\}\text{ for }i\in[2r]\}. We need to show that there exists some vv in the span of {w,w}\{w,w^{\prime}\} such that h(v)=1h(v)=1. Since χ,χ\chi,\chi^{\prime} are two different codewords of Ta,bT_{a,b}. We know there are at least βr\beta r indices ii such that w2i1w2i1w_{2i-1}\neq w^{\prime}_{2i-1}. Let I[r]I\subseteq[r] be the set of indices that χiχi\chi_{i}\neq\chi^{\prime}_{i}. Then, for iIi\in I, we have

max(𝖫𝖢𝖲(w2i1w2i,yai,bi),𝖫𝖢𝖲(w2i1w2i,yai,bi)))nε+6.\max\big{(}\mathsf{LCS}(w_{2i-1}\circ w^{\prime}_{2i},y^{a_{i},b_{i}}),\mathsf{LCS}(w^{\prime}_{2i-1}\circ w_{2i},y^{a_{i},b_{i}}))\big{)}\geq n_{\varepsilon}+6.

We can build a vv as following. For iIi\in I, if 𝖫𝖢𝖲(w2i1w2i,ya,bnε+6\mathsf{LCS}(w_{2i-1}\circ w^{\prime}_{2i},y^{a,b}\geq n_{\varepsilon}+6. We then set v2i1=w2i1v_{2i-1}=w_{2i-1} and v2i=w2iv_{2i}=w^{\prime}_{2i}. Otherwise, we set v2i1=w2i1v_{2i-1}=w^{\prime}_{2i-1} and v2i=w2iv_{2i}=w_{2i}. For i[r]Ii\in[r]\setminus I, we set v2i1=w2i1v_{2i-1}=w_{2i-1} and v2i=w2iv_{2i}=w_{2i}. Thus, for at least βr\beta r indices i[r]i\in[r], we have 𝖫𝖢𝖲(v2i1v2i,yai,bi)nε/2+6\mathsf{LCS}(v_{2i-1}\circ v_{2i},y^{a_{i},b_{i}})\geq n_{\varepsilon}/2+6. We must have h(v)=1h(v)=1. ∎

Consider a matrix BB of size r×2rr\times 2r of the following form

(B1,1B1,2B1,2rB2,1B2,2B2,2rBr,1Br,2Br,2r)\begin{pmatrix}B_{1,1}&B_{1,2}&\cdots&B_{1,2r}\\ B_{2,1}&B_{2,2}&\cdots&B_{2,2r}\\ \vdots&\vdots&\ddots&\vdots\\ B_{r,1}&B_{r,2}&\cdots&B_{r,2r}\end{pmatrix}

where Bi,2j1Sai,biB_{i,2j-1}\in S_{a_{i},b_{i}} and Bi,2jSai,bi¯B_{i,2j}\in\overline{S_{a_{i},b_{i}}} for j[r]j\in[r] (the elements of matrix BB are strings over alphabet Σ\Sigma). Thus, the ii-th row of BB is an element in UiU_{i}. We define the following function gg.

g(B)=h1(R1(B))h2(R2(B))hr(Rr(B))g(B)=h_{1}(R_{1}(B))\vee h_{2}(R_{2}(B))\vee\cdots\vee h_{r}(R_{r}(B)) (9)

where Ri(B)UR_{i}(B)\in U is the ii-th row of matrix BB and hih_{i} is the same as hh except the inputs are over alphabet {ai,bi}\{a_{i},b_{i}\} instead of {a,b}\{a,b\} for i[r]i\in[r]. Also, we define WiW_{i} in exactly the same way as WW except elements in WiW_{i} are over alphabet {ai,bi}\{a_{i},b_{i}\} instead of {a,b}\{a,b\}.

Consider a 2t2t player game where each player holds one column of BB. The goal is to compute g(B)g(B). We first show the following Claim.

Claim 4.3.

The set of all r×2rr\times 2r matrix BB such that Ri(B)Wii[r]R_{i}(B)\in W_{i}\;\forall\;i\in[r] is a fooling set for gg.

Proof of Claim 4.3.

For any two matrix B1B2B_{1}\neq B_{2} such that Ri(B1),Ri(B2)Wii[r]R_{i}(B_{1}),R_{i}(B_{2})\in W_{i}\;\forall\;i\in[r]. We know g(B1)=g(B2)=0g(B_{1})=g(B_{2})=0. There is some row ii such that Ri(B1)Ri(B2)R_{i}(B_{1})\neq R_{i}(B_{2}). We know there is some elements vv in the span of Ri(B1)R_{i}(B_{1}) and Ri(B2)R_{i}(B_{2}), such that hi(v)=1h_{i}(v)=1 by Claim 4.2. Thus, there is some element BB^{\prime} in the span of B1B_{1} and B2B_{2} such that g(B)=1g(B^{\prime})=1. Here, by BB^{\prime} in the span of B1B_{1} and B2B_{2}, we mean the ii-th column is either Ci(B1)C_{i}(B_{1}) or Ci(B2)C_{i}(B_{2}) . ∎

Since |W|=2Ω(nεr)\lvert W\rvert=2^{\Omega(n_{\varepsilon}r)}. By the above claim, we have a fooling set for gg size |W|r=2Ω(nεr2)\lvert W\rvert^{r}=2^{\Omega(n_{\varepsilon}r^{2})}. Thus, CC2rtot(g)log(2Ω(nεr2))=Ω(nεr2)CC^{tot}_{2r}(g)\geq\log(2^{\Omega(n_{\varepsilon}r^{2})})=\Omega(n_{\varepsilon}r^{2}). Since CC2rmaxCCtot)2r(g)=Ω(nεr)CC^{\max}_{2r}\geq CC^{tot})_{2r}(g)=\Omega(n_{\varepsilon}r).

We now show how to reduce computing g(B)g(B) to approximating the length of LCS in the asymmetric streaming model.

We consider a matrix B~\tilde{B} of size r×3rr\times 3r such that

B~=(B1,1B1,2c1nεB1,3B1,4c2nεB1,2r1B1,2rcrnεB2,1B2,2c1nεB2,3B2,4c2nεB2,2r1B2,2rcrnεBr,1Br,2c1nεBr,3Br,4c2nεBr,2r1Br,2rcrnε)(r×3r)\tilde{B}=\begin{pmatrix}B_{1,1}&B_{1,2}&c_{1}^{n_{\varepsilon}}&B_{1,3}&B_{1,4}&c_{2}^{n_{\varepsilon}}&\cdots&B_{1,2r-1}&B_{1,2r}&c_{r}^{n_{\varepsilon}}\\ B_{2,1}&B_{2,2}&c_{1}^{n_{\varepsilon}}&B_{2,3}&B_{2,4}&c_{2}^{n_{\varepsilon}}&\cdots&B_{2,2r-1}&B_{2,2r}&c_{r}^{n_{\varepsilon}}\\ \vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\ddots&\vdots&\vdots&\vdots\\ B_{r,1}&B_{r,2}&c_{1}^{n_{\varepsilon}}&B_{r,3}&B_{r,4}&c_{2}^{n_{\varepsilon}}&\cdots&B_{r,2r-1}&B_{r,2r}&c_{r}^{n_{\varepsilon}}\end{pmatrix}_{(r\times 3r)} (10)

In other words, B~\tilde{B} is obtained by inserting a column of cc symbols to BB at every third position. For j[3r]j\in[3r], let Cj(B~)=B~1,jB~2,jB~r,jC_{j}(\tilde{B})=\tilde{B}_{1,j}\circ\tilde{B}_{2,j}\circ\dots\circ\tilde{B}_{r,j}. That is, Cj(B~)C_{j}(\tilde{B}) is the concatenation of elements in the jj-th column of B~\tilde{B}. We can set xx to be the concatenation of the columns of B~\tilde{B}. Thus, since Bi,2j1Bi,2jΣnεB_{i,2j-1}\circ B_{i,2j}\in\Sigma^{n_{\varepsilon}} for any i,j[r]i,j\in[r], we have

x=C1(B~)C2(B~)C3r(B~)Σ2r2nε.x=C_{1}(\tilde{B})\circ C_{2}(\tilde{B})\circ\cdots\circ C_{3r}(\tilde{B})\in\Sigma^{2r^{2}n_{\varepsilon}}.

For iri\in r, we have defined yai,bi=ainε/3binε/3ainε/3Σnεy^{a_{i},b_{i}}=a_{i}^{n_{\varepsilon}/3}b_{i}^{n_{\varepsilon}/3}a_{i}^{n_{\varepsilon}/3}\in\Sigma^{n_{\varepsilon}}. We let yi,1y^{i,1} and yi,2y^{i,2} be two non-empty strings such that yai,bi=yi,1yi,2y^{a_{i},b_{i}}=y^{i,1}\circ y^{i,2}. We consider another matrix B¯\bar{B} of size r×3rr\times 3r such that

B¯=(y1,1y1,2c1nεy1,1y1,2c2nεy1,1y1,2crnεy2,1y2,2c1nεy2,1y2,2c2nεy2,1y2,2crnεyr,1yr,2c1nεyr,1yr,2c2nεyr,1yr,2crnε)(r×3r)\bar{B}=\begin{pmatrix}y^{1,1}&y^{1,2}&c_{1}^{n_{\varepsilon}}&y^{1,1}&y^{1,2}&c_{2}^{n_{\varepsilon}}&\cdots&y^{1,1}&y^{1,2}&c_{r}^{n_{\varepsilon}}\\ y^{2,1}&y^{2,2}&c_{1}^{n_{\varepsilon}}&y^{2,1}&y^{2,2}&c_{2}^{n_{\varepsilon}}&\cdots&y^{2,1}&y^{2,2}&c_{r}^{n_{\varepsilon}}\\ \vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\ddots&\vdots&\vdots&\vdots\\ y^{r,1}&y^{r,2}&c_{1}^{n_{\varepsilon}}&y^{r,1}&y^{r,2}&c_{2}^{n_{\varepsilon}}&\cdots&y^{r,1}&y^{r,2}&c_{r}^{n_{\varepsilon}}\end{pmatrix}_{(r\times 3r)} (11)

For i[r]i\in[r], let Ri(B¯)R_{i}(\bar{B}) be the concatenation of elements in the ii-th row of B¯\bar{B}. We can set yy to be the concatenation of rows of B¯\bar{B}. Thus,

y=R1(B¯)R2(B¯)Cr(B¯)Σ2r2nε.y=R_{1}(\bar{B})\circ R_{2}(\bar{B})\circ\cdots\circ C_{r}(\bar{B})\in\Sigma^{2r^{2}n_{\varepsilon}}.

We now show the following Claim.

Claim 4.4.

If g(B)=0g(B)=0, 𝖫𝖢𝖲(x,y)(52r1)nε+5r\mathsf{LCS}(x,y)\leq(\frac{5}{2}r-1)n_{\varepsilon}+5r. If g(B)=1g(B)=1, 𝖫𝖢𝖲(x,y)(52r1)nε+5r+βr1\mathsf{LCS}(x,y)\geq(\frac{5}{2}r-1)n_{\varepsilon}+5r+\beta r-1.

Proof.

We first divide xx into rr blocks such that

x=x1x2xrx=x^{1}\circ x^{2}\circ\cdots x^{r}

where xi=C3i2(B~)C3i1(B~)C3i(B~)x^{i}=C_{3i-2}(\tilde{B})\circ C_{3i-1}(\tilde{B})\circ C_{3i}(\tilde{B}). We know C3i2(B~)=C2i1(B)C_{3i-2}(\tilde{B})=C_{2i-1}(B) is the (2i1)(2i-1)-th column of BB, C3i1(B~)=C2i(B)C_{3i-1}(\tilde{B})=C_{2i}(B) is the 2i2i-th column of BB and C3i(B~)=cirnεC_{3i}(\tilde{B})=c_{i}^{rn_{\varepsilon}} is symbol cic_{i} repeated rnεrn_{\varepsilon} times.

If g(B)=0g(B)=0, we show 𝖫𝖢𝖲(x,y)(52r1)nε+5r\mathsf{LCS}(x,y)\leq(\frac{5}{2}r-1)n_{\varepsilon}+5r. We consider a matching between xx and yy. For our analysis, we let tit_{i} be the largest integer such that some symbols in xix^{i} is matched to symbols in the tit_{i}-th row of B¯\bar{B}. Since yy is the concatenation of rows of B¯\bar{B}. If no symbols in xix^{i} is matched, we let ti=ti1t_{i}=t_{i-1} and we set t0=1t_{0}=1, we have

1=t0t1t2trr1=t_{0}\leq t_{1}\leq t_{2}\leq\cdots\leq t_{r}\leq r

We now show that, there is an optimal matching such that xix^{i} is matched to at most nε/2+5+(titi1+1)nεn_{\varepsilon}/2+5+(t_{i}-t_{i-1}+1)n_{\varepsilon} symbols in yy. There are two cases:

Case (a): ti=ti1t_{i}=t_{i-1}. In this case, xix^{i} can only be matched to tit_{i}-th row of B¯\bar{B}, Rti(B¯)R_{t_{i}}(\bar{B}). Rti(B¯)R_{t_{i}}(\bar{B}) consists of symbols ati,btia_{t_{i}},b_{t_{i}} and c1,,crc_{1},\dots,c_{r} and is of the form

Rti(B¯)=yati,btic1nεyati,btic2nεyati,bticrnε.R_{t_{i}}(\bar{B})=y^{a_{t_{i}},b_{t_{i}}}\circ c_{1}^{n_{\varepsilon}}\circ y^{a_{t_{i}},b_{t_{i}}}\circ c_{2}^{n_{\varepsilon}}\circ\cdots\circ y^{a_{t_{i}},b_{t_{i}}}\circ c_{r}^{n_{\varepsilon}}.

We first show that we can assume atia_{t_{i}} and btib_{t_{i}} symbols in xix^{i} are only matched to the yati,btiy^{a_{t_{i}},b_{t_{i}}} block between the block of ci1c_{i-1} and the block of cic_{i}.

If in Rti(B¯)R_{t_{i}}(\bar{B}), there are some atia_{t_{i}}, btib_{t_{i}} symbols before the block of ci1c_{i-1} matched to xix^{i}. Say the number of such matches is at most nn^{\prime}. We know nnεn^{\prime}\leq n_{\varepsilon} there are at most nεn_{\varepsilon} atia_{t_{i}}, btib_{t_{i}} symbols in xix^{i}. In this case, notice that, there is no ci1c_{i-1} symbol in Rti(B¯)R_{t_{i}}(\bar{B}) can be matched to xx. We can build another matching between xx and yy by removing these nn^{\prime} matches and add nεn_{\varepsilon} matches between ci1c_{i-1} symbols in xi1x^{i-1} and Rti(B¯)R_{t_{i}}(\bar{B}). We can do this since there are rnεrn_{\varepsilon}\;\; ci1c_{i-1} symbols in xi1x^{i-1} and before the tit_{i}-th row, we can match at most (ti1)nε(t_{i}-1)n_{\varepsilon}\;\; ci1c_{i-1} symbols. So there are at least (rti+1)nε(r-t_{i}+1)n_{\varepsilon} unmatched ci1c_{i-1} symbols in xi1x^{i-1}. The size of the new matching is at least the size of the old matching.

Similarly, if there are some atia_{t_{i}}, btib_{t_{i}} symbols after the block of cic_{i} in Rti(y)R_{t_{i}}(y) matched to xix^{i}. Then, no cic_{i} symbol in xix^{i} can be matched to Rti(B¯)R_{t_{i}}(\bar{B}). We can remove these matches and add nεn_{\varepsilon} matched cic_{i} symbols. This gives us a matching with size at least the size fo the old matching.

Thus, we only need to consider the case where Bti,2i1Bti,2iB_{t_{i},2i-1}\circ B_{t_{i},2i} is matched to the part of Rti(B¯)R_{t_{i}}(\bar{B}) after the block of ci1c_{i-1} symbols and before the block of cic_{i} symbols, which is yati,btiy^{a_{t_{i}},b_{t_{i}}}. Since g(B)=0g(B)=0, we know 𝖫𝖢𝖲(Bti,2i1Bti,2i,yati,bti)\mathsf{LCS}(B_{t_{i},2i-1}\circ B_{t_{i},2i},y^{a_{t_{i}},b_{t_{i}}}) is exactly nε/2+5n_{\varepsilon}/2+5. Also, we can match at most nεn_{\varepsilon} cic_{i} symbols. Thus, xix^{i} is matched to at most nε/2+5+nεn_{\varepsilon}/2+5+n_{\varepsilon} symbols in yy.

Case (b): ti>ti1t_{i}>t_{i-1}. We can assume in xix^{i}, except cic_{i} symbols, only symbols ati1,bti1a_{t_{i-1}},b_{t_{i-1}} are matched to yy. To see this, assume tt^{\prime} with ti1<ttit_{i-1}<t^{\prime}\leq t_{i} is the largest integer that some symbol ata_{t^{\prime}} or btb_{t^{\prime}} in xix^{i} are matched to yy. By a,ba,b symbols, we mean symbols a1,,ara_{1},\dots,a_{r} and b1,,brb_{1},\dots,b_{r}. We now consider how many a,ba,b symbols in xix^{i} can be matched to yy. We only need to consider the substring

Bti1,2i1Bti1+1,2i1Bt,2i1Bti1,2iBti1+1,2iBt,2iB_{t_{i-1},2i-1}\circ B_{t_{i-1}+1,2i-1}\circ\cdots\circ B_{t^{\prime},2i-1}\circ B_{t_{i-1},2i}\circ B_{t_{i-1}+1,2i}\circ\cdots\circ B_{t^{\prime},2i}

Let ti1ktt_{i-1}\leq k\leq t^{\prime} be the largest integer such that some symbol aka_{k} or bkb_{k} from Bk,2i1B_{k,2i-1} is matched. Notice that for any t[r]t\in[r], symbol ata_{t}, btb_{t} only appears in the tt-th row of B¯\bar{B} and yy is the concatenation of row of B¯\bar{B}. For at,bta_{t},b_{t} with t<kt<k, only those in Bt,2i1B_{t,2i-1} can be matched since block Bt,2iB_{t,2i} is after Bk,2i1B_{k,2i-1} in xix^{i}. For at,bta_{t},b_{t}, with t>kt>k, only those in Bt,2iB_{t,2i} can be matched by assumption on kk.

Notice that for any tt, we have Bt,2i1B_{t,2i-1} has length nε/2+5n_{\varepsilon}/2+5 and Bt,2iB_{t,2i} has length nε/25n_{\varepsilon}/2-5. Thus, the number of matched a,ba,b symbols is at most (tti1)(nε/2+5)+nε(t^{\prime}-t_{i-1})(n_{\varepsilon}/2+5)+n_{\varepsilon}. We can build another matching by first remove the matches of a,ba,b symbols in xix^{i}. Then, we match another (tti1)nε(t^{\prime}-t_{i-1})n_{\varepsilon}\; ci1c_{i-1} symbols in xi1x^{i-1} to the ci1c_{i-1} symbols in B¯\bar{B} from (ti1+1)(t_{i-1}+1)-th row to tt^{\prime}-th row. These ci1c_{i-1} symbols are not matched since we assume xi1x^{i-1} is only matched to first ti1t_{i-1} rows of B¯\bar{B} in the original matching. Further, we can match Bt,2i1Bt,2iB_{t^{\prime},2i-1}\circ B_{t^{\prime},2i} to the yat,bty^{a_{t^{\prime}},b_{t^{\prime}}} block in Rt(B¯)R_{t^{\prime}}(\bar{B}) between the block of ci1c_{i-1} and the block of cic_{i}. This gives us (tti1)nε+nε/2+5(t^{\prime}-t_{i-1})n_{\varepsilon}+n_{\varepsilon}/2+5 additional matches. Since we t>ti1t^{\prime}>t_{i-1}, we know the number of added matches is at least the number of removed matches. In the new matching, ti1=tt_{i-1}=t^{\prime}. Thus, we can assume in xix^{i}, except cic_{i} symbols, only symbols ati1,bti1a_{t_{i-1}},b_{t_{i-1}} are matched to yy.

By the same argument in Case (a), we can assume atia_{t_{i}} and btib_{t_{i}} symbols in xix^{i} are only matched to the yati,btiy^{a_{t_{i}},b_{t_{i}}} block between the block of ci1c_{i-1} and the block of cic_{i}. Thus, we can match nε/2+5n_{\varepsilon}/2+5\; atia_{t_{i}} and btib_{t_{i}} symbols. Also, we can match at most (titi1+1)nε(t_{i}-t_{i-1}+1)n_{\varepsilon}\; cic_{i} symbols since there are this many cic_{i} symbols in B¯\bar{B} from ti1t_{i-1}-th row to tit_{i}-th row. Thus, xix^{i} is matched to at most nε/2+5+(titi1+1)nεn_{\varepsilon}/2+5+(t_{i}-t_{i-1}+1)n_{\varepsilon} symbols in yy.

In total, the size of matching is at most

i=1r(nε/2+5+(titi1+1)nε)(2r1)nε+(nε/2+5)r=(52r1)nε+5r\sum_{i=1}^{r}\big{(}n_{\varepsilon}/2+5+(t_{i}-t_{i-1}+1)n_{\varepsilon}\big{)}\leq(2r-1)n_{\varepsilon}+(n_{\varepsilon}/2+5)r=(\frac{5}{2}r-1)n_{\varepsilon}+5r

Thus, if g(B)=0g(B)=0, we know 𝖫𝖢𝖲(x,y)(52r1)nε+5r\mathsf{LCS}(x,y)\leq(\frac{5}{2}r-1)n_{\varepsilon}+5r

If g(B)=1g(B)=1, that means there is some row ii of BB such that for at least βr\beta r positions j[r]j\in[r], we have 𝖫𝖢𝖲(Bi,2j1Bi,2j,yai,bi)nε/2+6\mathsf{LCS}(B_{i,2j-1}\circ B_{i,2j},y^{a_{i},b_{i}})\geq n_{\varepsilon}/2+6.

We now build a mathing between xx and yy with size at least (52r1)nε+5r+βr1(\frac{5}{2}r-1)n_{\varepsilon}+5r+\beta r-1. We first match B1,1B1,2B_{1,1}\circ B_{1,2}, which is a subsequence of C1(B~)C2(B~)C_{1}(\tilde{B})\circ C_{2}(\tilde{B}), to the first ya1,b1y^{a_{1},b_{1}} block in R1(B¯)R_{1}(\bar{B}), this gives us at least nε/2+5n_{\varepsilon}/2+5 matches. Then, we match all the c1c_{1} symbols in the first ii rows of B¯\bar{B} to C3B~C_{3}{\tilde{B}}. This gives us inεin_{\varepsilon} matches.

We consider the string

x~=Bi,3Bi,4c2nεBi,2r1Bi,2rcrnε.\tilde{x}=B_{i,3}\circ B_{i,4}\circ\circ c_{2}^{n_{\varepsilon}}\circ\cdots\circ B_{i,2r-1}\circ B_{i,2r}\circ c_{r}^{n_{\varepsilon}}.

It is a subsequence of x2xrx^{2}\circ\cdots x^{r}. Also, for at least βr1\beta r-1 positions j{2,3,,r}j\in\{2,3,\dots,r\}, we know 𝖫𝖢𝖲(Bi,2j1Bi,2j,yai,bi)nε/2+6\mathsf{LCS}(B_{i,2j-1}\circ B_{i,2j},y^{a_{i},b_{i}})\geq n_{\varepsilon}/2+6. For the rest of the positions, we know 𝖫𝖢𝖲(Bi,2j1Bi,2j,yai,bi)=nε/2+5\mathsf{LCS}(B_{i,2j-1}\circ B_{i,2j},y^{a_{i},b_{i}})=n_{\varepsilon}/2+5. Thus, 𝖫𝖢𝖲(x~,Ri(B¯))(r1)(nε+(nε/2+5))+βr1\mathsf{LCS}(\tilde{x},R_{i}(\bar{B}))\geq(r-1)\big{(}n_{\varepsilon}+(n_{\varepsilon}/2+5)\big{)}+\beta r-1.

After the ii-th row of B¯\bar{B}, we can match another (ri)nε(r-i)n_{\varepsilon}\; crc_{r} symbols to xrx^{r}. This gives us a matching of size at least (52r1)nε+5r+βr1(\frac{5}{2}r-1)n_{\varepsilon}+5r+\beta r-1. Thus, if g(B)=1g(B)=1, 𝖫𝖢𝖲(x,y)(52r1)nε+5r+βr1\mathsf{LCS}(x,y)\geq(\frac{5}{2}r-1)n_{\varepsilon}+5r+\beta r-1.

Assume nε=λ/εn_{\varepsilon}=\lambda/\varepsilon where λ\lambda is some constant. Let ε=β10λε=Θ(ε)\varepsilon^{\prime}=\frac{\beta}{10\lambda}\varepsilon=\Theta(\varepsilon). If we can give a 1+ε1+\varepsilon^{\prime} approximation of 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y), we can distinguish g(B)=0g(B)=0 and g(B)=1g(B)=1.

Thus, we can reduce computing g(B)g(B) in the 2r2r player setting to computing 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y). The string yy (the offline string) is known to all players and it contains no information about BB. For the ii-th player, it holds ii-th column of BB. If ii is odd, the player ii knows the 3i123\frac{i-1}{2}-th column of B~\tilde{B}. If ii is even, the player ii knows the (3i21)(\frac{3i}{2}-1)-th row of B~\tilde{B} which is the ii-th row of BB and (3i2)(\frac{3i}{2})-th row of B~\tilde{B} which consist of only c3i2c_{\frac{3i}{2}}.

5 Lower Bounds for LIS and LNS

In this section, we introduce our space lower bound for 𝖫𝖨𝖲\mathsf{LIS} and 𝖫𝖭𝖲\mathsf{LNS}.

Let a{0,1}ta\in\{0,1\}^{t}, aa can be seen as a binary string of length tt. For each integer l1l\geq 1, we can define a function h(l)h^{(l)} whose domain is a subset of {0,1}t\{0,1\}^{t}. Let α(1/2,1)\alpha\in(1/2,1) be some constant. We have following definition

h(l)(a)={1, if there are at least l zeros between any two nonzero positions in a.0, if a contains at least αt nonzeros.h^{(l)}(a)=\begin{cases}1,\text{ if there are at least $l$ zeros between any two nonzero positions in $a$.}\\ 0,\text{ if $a$ contains at least $\alpha t$ nonzeros.}\end{cases} (12)

We leave h(l)h^{(l)} undefined otherwise. Let B{0,1}s×tB\in\{0,1\}^{s\times t} be a matrix and denote the ii-th row of BB by Ri(B)R_{i}(B). We can define g(l)g^{(l)} as the direct sum of ss copies of h(l)h^{(l)}. Let

g(l)(B)=h(l)(R1(B))h(l)(R2(B))h(l)(Rs(B)).g^{(l)}(B)=h^{(l)}(R_{1}(B))\vee h^{(l)}(R_{2}(B))\vee\cdots\vee h^{(l)}(R_{s}(B)). (13)

That is, g(l)(B)=1g^{(l)}(B)=1 if there is some i[s]i\in[s] such that h(l)(Ri(B))=1h^{(l)}(R_{i}(B))=1 and g(l)(B)=0g^{(l)}(B)=0 if for all i[s]i\in[s], h(l)(Ri(B))=0h^{(l)}(R_{i}(B))=0.

In the following, we consider computing h(l)h^{(l)} and g(l)g^{(l)} in the tt-party one-way communication model. When computing h(l)(a)h^{(l)}(a), player PiP_{i} holds the ii-th element of a{0,1}ta\in\{0,1\}^{t} for i[t]i\in[t]. When computing g(l)(B)g^{(l)}(B), player PiP_{i} holds the ii-th column of matrix BB for i[t]i\in[t]. In the following, we use CCttot(h(l))CC^{tot}_{t}(h^{(l)}) to denote the total communication complexity of h(l)h^{(l)} and respectively use CCttot(g(l))CC^{tot}_{t}(g^{(l)}) to denote the total communication complexity of g(l)g^{(l)}. We also consider multiple rounds of communication and we denote the number of rounds by RR.

Lemma 5.1.

For any constant l1l\geq 1, there exists a constant kk (depending on ll), such that there is a kk-fooling set for function h(l)h^{(l)} of size ctc^{t} for some constant c>1c>1.

We note that Lemma 4.2 of [EJ08] proved a same result for the case l=1l=1.

Proof of Lemma 5.1.

We consider sampling randomly from {0,1}t\{0,1\}^{t} as follows. For i[t]i\in[t], we independently pick ai=1a_{i}=1 with probability pp and ai=0a_{i}=0 with probability 1p1-p. We set p=1kp=\frac{1}{k} for some large constant kk. For i[tl]i\in[t-l], we let AiA_{i} to be event that there are no two 1’s in the substring a[i:i+l]a[i:i+l]. Let Pr(Ai)\Pr(A_{i}) be the probability that event AiA_{i} happens. By a union bound, we have

Pr(Ai)(l2)p2,i[tl]\Pr(A_{i})\leq\binom{l}{2}p^{2},\;\forall\;i\in[t-l] (14)

Let 𝒜={Ai,i[tl]}\mathcal{A}=\{A_{i},\;i\in[t-l]\}. Notice that since we are sampling each position of aa independently, the event AiA_{i} is dependent to at most 2l2l other events in 𝒜\mathcal{A}. We set v=2l(l2)p2v=2l\binom{l}{2}p^{2}. For large enough kk, we have

i[tl],Pr(Ai)(l2)p2v(1v)2l\forall\;i\in[t-l],\;\Pr(A_{i})\leq\binom{l}{2}p^{2}\leq v(1-v)^{2l} (15)

Here, the second inequality follows from the fact that ll is a constant and (l2)p2=v/(2l)\binom{l}{2}p^{2}=v/(2l), so we can pick kk to be large enough, say kl31log(2l)/(2l)k\geq\sqrt{\frac{l^{3}}{1-log(2l)/(2l)}} (or p=1/kp=1/k to be small enough) to guarantee (1v)2l1/2l(1-v)^{2l}\geq 1/{2l}.

Thus, we can use Lovás Local Lemma here. By Lemma 2.1, we have

Pr(A1¯A2¯Atl¯)(1v)t(1l3p2)t.\Pr\big{(}\overline{A_{1}}\wedge\overline{A_{2}}\wedge\cdots\wedge\overline{A_{t-l}}\big{)}\geq(1-v)^{t}\geq(1-l^{3}p^{2})^{t}. (16)

Notice that “there are at least ll 0’s between any two 11’s in aa” is equivalent to none of events AiA_{i} happens. We say a sampled string aa is good if none of AiA_{i} happens. Thus, for any good string aa, we have h(l)(a)=0h^{(l)}(a)=0. The probability that a sampled string aa is good is at least (1l3p2)t(1-l^{3}p^{2})^{t}. For convenience, we let q=1l3p2q=1-l^{3}p^{2}.

Assume we independently sample MM strings in this way, the expected number good string is qtMq^{t}M. Let a1,a2,,aka^{1},a^{2},\dots,a^{k} be kk independent random samples. We consider a string bb in the span of these kk strings, such that, for i[t]i\in[t], let bi=1b_{i}=1 if there is some j[k]j\in[k] such that aij=1a^{j}_{i}=1. bb is in the span of these kk strings. We now consider the probability that bb has at least αt\alpha t 1’s, i.e. h(l)(b)=1h^{(l)}(b)=1. Notice that aij=1a^{j}_{i}=1 with probability pp, thus Pr(bi=1)=1(1p)tPr(b_{i}=1)=1-(1-p)^{t}. Let γ=1(1p)t\gamma=1-(1-p)^{t}. The expected number of 1’s in bb is γt\gamma t. Let ε=γα\varepsilon=\gamma-\alpha and δ\delta be the probability that bb has less than αt\alpha t 1’s. Using Chernoff bound, we have,

Pr(b has less than αt 1’s)eε2γ2t.\Pr(\text{$b$ has less than $\alpha t$ 1's})\leq e^{\frac{-\varepsilon^{2}\gamma}{2}t}. (17)

Let δ=eε2γ2t\delta=e^{\frac{-\varepsilon^{2}\gamma}{2}t} and M=ek(qt2δ)1/kM=\frac{e}{k}(\frac{q^{t}}{2\delta})^{1/k}. We consider the probability that these MM sample is not a kk-fooling set for h(l)h^{(l)}. Since for any kk samples, it is not a kk-fooling set with probability at most δ\delta. Let EE denote the event that these MM samples form a kk-fooling set. Using a union bound, the probability that EE does not happen is

Pr(E¯)(Mk)δ(eMk)kδ12qt.\displaystyle\Pr\big{(}\bar{E}\big{)}\leq\binom{M}{k}\delta\leq(\frac{eM}{k})^{k}\delta\leq\frac{1}{2}q^{t}.

Let ZZ be a random variable equals to the number of good string among the MM samples. As we have shown, the expectation of ZZ, 𝔼(Z)=qtM\mathbb{E}(Z)=q^{t}M. Also notice that 𝔼(Z)=𝔼(Z|E)Pr(E)+𝔼(Z|E¯)Pr(E¯)\mathbb{E}(Z)=\mathbb{E}(Z|E)\Pr(E)+\mathbb{E}(Z|\overline{E})\Pr(\overline{E}). Thus, with a positive probability, there are 12qtM\frac{1}{2}q^{t}M good samples and they form a kk-fooling set.

12qtM=(12)1+1/kek(q1+1/k(1δ)1/k)t.\frac{1}{2}q^{t}M=(\frac{1}{2})^{1+1/k}\frac{e}{k}(q^{1+1/k}(\frac{1}{\delta})^{1/k})^{t}. (18)

Notice that

q1+1/k(1δ)1/k=(1l3k2)1+1/keε2γ2k.q^{1+1/k}(\frac{1}{\delta})^{1/k}=(1-\frac{l^{3}}{k^{2}})^{1+1/k}e^{\frac{\varepsilon^{2}\gamma}{2k}}. (19)

Since we assume ll is a constant, it is larger than 1 when kk is a constant large enough (depends on ll). This finishes the proof.

The following lemma is essentially the same as Lemma 4.3 in [EJ08].

Lemma 5.2.

Let F{0,1}tF\subseteq\{0,1\}^{t} be a kk-fooling set for h(l)h^{(l)}. Then the set of all matrix B{0,1}s×tB\in\{0,1\}^{s\times t} such that Ri(B)FR_{i}(B)\in F is a ksk^{s}-fooling set for g(l)g^{(l)}.

Lemma 5.3.

CCtmax(g(l))=Ω(s/R).CC^{max}_{t}(g^{(l)})=\Omega(s/R).

Proof.

By Lemma 5.1 and Lemma 5.2, there is a ksk^{s}-fooling set for function g(l)g^{(l)} of size ctsc^{ts} for some large enough constant kk and some constant c>1c>1. By Lemma 2.3, in the tt-party one-way communication model, CCttot(g(l))=Ω(logctsks1)=Ω(ts).CC^{tot}_{t}(g^{(l)})=\Omega(\log\frac{c^{ts}}{k^{s}-1})=\Omega(ts). Thus, we have CCtmax(g(l))1tRCCttot(g(l))=Ω(s/R).CC^{max}_{t}(g^{(l)})\geq\frac{1}{tR}CC^{tot}_{t}(g^{(l)})=\Omega(s/R).

5.1 Lower bound for streaming LIS over small alphabet

We now present our space lower bound for approximating LIS in the streaming model.

Lemma 5.4.

For xΣnx\in\Sigma^{n} with |Σ|=O(n)|\Sigma|=O(\sqrt{n}) and any constant ε>0\varepsilon>0, any deterministic algorithm that makes RR passes of xx and outputs a (1+ε)(1+\varepsilon)-approximation of 𝖫𝖨𝖲(x)\mathsf{LIS}(x) requires Ω(|Σ|/R)\Omega(|\Sigma|/R) space.

Proof of Lemma 5.4.

We assume the alphabet set Σ={0,1,,2r}\Sigma=\{0,1,\dots,2r\} which has size |Σ|=2r+1|\Sigma|=2r+1. Let cc be a large constant and assume rr can be divided by cc for similicity. We set s=rcs=\frac{r}{c} and t=rt=r. Consider a matrix BB of size s×ts\times t. We denote the element on ii-th row and jj-th column by Bi,jB_{i,j}. ALso, we require that Bi,jB_{i,j} is either (i1)rc+j(i-1)\frac{r}{c}+j or 0. For each row of BB, say Ri(B)R_{i}(B), either there are at least ll 0’s between any two nonzeros or it has more than αr\alpha r nonzeros. We let B~{0,1}s×r\tilde{B}\in\{0,1\}^{s\times r} be a binary matrix such that B~i,j=1\tilde{B}_{i,j}=1 if Bi,j0B_{i,j}\neq 0 and B~i,j=0\tilde{B}_{i,j}=0 if Bi,j=0B_{i,j}=0 for (i,j)[s]×[r](i,j)\in[s]\times[r].

Without loss of generality, we can view Ri(B)R_{i}(B) for i[s]i\in[s], or Ci(B)C_{i}(B) for i[r]i\in[r] as a string. More specifically, Ri(B)=Bi,1Bi,2Bi,rR_{i}(B)=B_{i,1}B_{i,2}\dots B_{i,r} for i[s]i\in[s], and Ci(B)=B1,iB2,iBs,iC_{i}(B)=B_{1,i}B_{2,i}\dots B_{s,i} for i[r]i\in[r].

We let σ(B)=C1(B)C2(B)Cr(B)\sigma(B)=C_{1}(B)\circ C_{2}(B)\circ\cdots\circ C_{r}(B). Thus, σ(B)\sigma(B) is a string of length srsr. For convenience, we denote σ=σ(B)\sigma=\sigma(B). Here, we require the length of σ=r2/cn\sigma=r^{2}/c\leq n. If |σ|<n|\sigma|<n, we can pad σ\sigma with 0 symbols to make it has length nn. This will not affect the length of the longest increasing subsequence of σ\sigma.

We first show that if there is some row of BB that contains more than αt\alpha t nonzeros, then 𝖫𝖨𝖲(σ)αr\mathsf{LIS}(\sigma)\geq\alpha r. Say Ri(B)R_{i}(B) contains more than αt\alpha t nonzeros. By our definition of BB, Ri(B)R_{i}(B) is strictly increasing when restricted to the nonzero positions. Thus, 𝖫𝖨𝖲(Ri(B))αr\mathsf{LIS}(R_{i}(B))\geq\alpha r. Also notice that Ri(B)R_{i}(B) is a subsequence of σ\sigma. This is because Cj(B)C_{j}(B) contains element Bi,jB_{i,j} for j[r]j\in[r] and σ\sigma is the concatenation of Cj(B)C_{j}(B)’s for jj from 1 to rr. Thus, 𝖫𝖨𝖲(σ)αr\mathsf{LIS}(\sigma)\geq\alpha r.

Otherwise, for any row Ri(B)R_{i}(B), there are at least ll zeros between any two nonzero positions. We show that 𝖫𝖨𝖲(σ(B))(1r+1c)r\mathsf{LIS}(\sigma(B))\leq(\frac{1}{r}+\frac{1}{c})r. Assume 𝖫𝖨𝖲(σ)=m\mathsf{LIS}(\sigma)=m and let σ=Bp1,q1Bp2,q2Bpm,qm\sigma^{\prime}=B_{p_{1},q_{1}}B_{p_{2},q_{2}}\dots B_{p_{m},q_{m}} be a longest increasing subsquence of σ\sigma.

We can think of σ\sigma^{\prime} as a path on the matrix. By go down kk steps from (i,j)(i,j), we mean walk from (i,j)(i,j) to (i+k,j)(i+k,j). By go right kk steps form (i,j)(i,j), we mean walk from (i,j)(i,j) to (i,j+k)(i,j+k). Then σ\sigma^{\prime} corresponds to the path P(σ)=(p1,q1)(p2,q2)(pm,qm)P(\sigma^{\prime})=(p_{1},q_{1})\rightarrow(p_{2},q_{2})\rightarrow\cdots\rightarrow(p_{m},q_{m}). Notice that for each step (pi,qi)(pi+1,qi+1)(p_{i},q_{i})\rightarrow(p_{i+1},q_{i+1}), we know 1Bpi,qi<Bpi+1,qi+11\leq B_{p_{i},q_{i}}<B_{p_{i+1},q_{i+1}}. Thus, by our construction of matrix BB, the step can only be one of the three types:

Type 1: pi<pi+1p_{i}<p_{i+1} and qi+1qiq_{i+1}\geq q_{i}. If pi<pi+1p_{i}<p_{i+1}, then for any qi+1qiq_{i+1}\geq q_{i}, we have Bpi,qi<Bpi+1,qi+1B_{p_{i},q_{i}}<B_{p_{i+1},q_{i+1}} if Bpi,qiB_{p_{i},q_{i}} and Bpi+1,qi+1B_{p_{i+1},q_{i+1}} are both non zero,

Type 2: pi=pi+1p_{i}=p_{i+1} and qi+1qil+1q_{i+1}-q_{i}\geq l+1.This correspons to the case where Bpi,qiB_{p_{i},q_{i}} and Bpi+1,qi+1B_{p_{i+1},q_{i+1}} are picked from the same row of BB. However, since we assume in each row of BB, the number of 0’s between any two nonzeros is at least ll. Since Bpi,qiB_{p_{i},q_{i}} and Bpi+1,qi+1B_{p_{i+1},q_{i+1}} are both nonzeros and Bpi,qi<Bpi+1,qi+1B_{p_{i},q_{i}}<B_{p_{i+1},q_{i+1}}, we must have qi+1qil+1q_{i+1}-q_{i}\geq l+1.

Type 3: pi>pi+1p_{i}>p_{i+1} and qi+1qi(pipi+1)rc+1q_{i+1}-q_{i}\geq(p_{i}-p_{i+1})\frac{r}{c}+1. When pi>pi+1p_{i}>p_{i+1}, Bpi,qiBpi+1,qi>(pipi+1)rcB_{p_{i},q_{i}}-B_{p_{i+1},q_{i}}>(p_{i}-p_{i+1})\frac{r}{c}. Since we require Bpi,qi<Bpi+1,qi+1B_{p_{i},q_{i}}<B_{p_{i+1},q_{i+1}}, we must have qi+1qi(pipi+1)rc+1q_{i+1}-q_{i}\geq(p_{i}-p_{i+1})\frac{r}{c}+1.

For i[3]i\in[3], let aia_{i} be the number of step of Type ii in the path P(σ)P(\sigma^{\prime}). Then, a1+a2+a3=m1a_{1}+a_{2}+a_{3}=m-1. We say (pi,qi)(pi+1,qi+1)(p_{i},q_{i})\rightarrow(p_{i+1},q_{i+1}) is step ii for i[m1]i\in[m-1]. And let

Ui={j[m1]|step j is of Type i} for i[3].U_{i}=\{j\in[m-1]|\text{step $j$ is of Type $i$}\}\text{ for }i\in[3].
a1=iU1(pi+1pi)a^{\prime}_{1}=\sum_{i\in U_{1}}(p_{i+1}-p_{i})
a3=iU3(pipi+1).a^{\prime}_{3}=\sum_{i\in U_{3}}(p_{i}-p_{i+1}).

Or equivalently, a1a^{\prime}_{1} is the distance we go downward with steps of Type 1 and a2a^{\prime}_{2} is the distance we go upward with steps of Type 3. Since only steps of Type 1 and Type 3 can go up and down, we know

a1a3=pmp1rca^{\prime}_{1}-a^{\prime}_{3}=p_{m}-p_{1}\leq\frac{r}{c} (20)

For the number of distance we go right, for each step of Type 2, we go at least l+1{l+1} positions right. For the step of Type 3, we go right at least iT3((pipi+1)rc+1)=rca3+|T3|=rca3+a3\sum_{i\in T_{3}}((p_{i}-p_{i+1})\frac{r}{c}+1)=\frac{r}{c}a^{\prime}_{3}+|T_{3}|=\frac{r}{c}a^{\prime}_{3}+a_{3} steps. Since the total distance we go right is qmq1rq_{m}-q_{1}\leq r. Thus, we have

a2l+a3rc+a3qmq1r.a_{2}l+a^{\prime}_{3}\frac{r}{c}+a_{3}\leq q_{m}-q_{1}\leq r. (21)

We assume ll and cc are both constants and rcl1\frac{r}{cl}\geq 1. Notice that a1a1a_{1}\leq a^{\prime}_{1} and a3a3a_{3}\leq a^{\prime}_{3}, combining 20 and 21, we have

𝖫𝖨𝖲(σ(B))=a1+a2+a3+1rc+rl.\mathsf{LIS}(\sigma(B))=a_{1}+a_{2}+a_{3}+1\leq\frac{r}{c}+\frac{r}{l}.

This show that if g(l)(B~)=0g^{(l)}(\tilde{B})=0, we have 𝖫𝖨𝖲(σ(B))αr\mathsf{LIS}(\sigma(B))\geq\alpha r. And if g(l)(B~)=1g^{(l)}(\tilde{B})=1, 𝖫𝖨𝖲(σ(B))(1c+1l)r\mathsf{LIS}(\sigma(B))\leq(\frac{1}{c}+\frac{1}{l})r. Here, cc and ll can be any large constant up to our choice and α(1/2,1)\alpha\in(1/2,1) is fixed. For any ε>0\varepsilon>0, we can choose cc and ll such that (1+ε)(1c+1l)α(1+\varepsilon)(\frac{1}{c}+\frac{1}{l})\leq\alpha. This gives us a reduction from computing g(l)(B~)g^{(l)}(\tilde{B}) to compute a (1+ε)(1+\varepsilon)-approximation of 𝖫𝖨𝖲(σ(B))\mathsf{LIS}(\sigma(B)).

In the tt-party game for computing g(l)(B~)g^{(l)}(\tilde{B}), each player holds one column of B~\tilde{B}. Thus, player PiP_{i} also holds Ci(B)C_{i}(B) since Ci(B)C_{i}(B) is determined by Ci(B~)C_{i}(\tilde{B}). If the tt players can compute a (1+ε)(1+\varepsilon) approximation of σ(B)\sigma(B) in the one-way communication model, we can distinguish the case of g(l)(B~)=0g^{(l)}(\tilde{B})=0 and g(l)(B~)=1g^{(l)}(\tilde{B})=1. Thus, any RR passes deterministic streaming algorihtm that approximate 𝖫𝖨𝖲\mathsf{LIS} within a 1+ε1+\varepsilon factor requires at least CCtmax(g(l))CC^{max}_{t}(g^{(l)}). By Lemma 5.3, CCtmax(g(l))=Ω(s/R)=Ω(|Σ|/R)CC^{max}_{t}(g^{(l)})=\Omega(s/R)=\Omega(|\Sigma|/R).

5.2 Longest Non-decreasing Subsequence

We can proof a similar space lower bound for approximating the length of longest non-decreasing subsequence in the streaming model.

Lemma 5.5.

For xΣnx\in\Sigma^{n} with |Σ|=O(n)|\Sigma|=O(\sqrt{n}) and any constant ε>0\varepsilon>0, any deterministic algorithm that makes RR passes of xx and outputs a (1+ε)(1+\varepsilon)-approximation of 𝖫𝖭𝖲(x)\mathsf{LNS}(x) requires Ω(|Σ|/R)\Omega(|\Sigma|/R) space.

Proof of Lemma 5.5.

In this proof, we let the alphabet set Σ={1,2,,(c+1)r}\Sigma=\{1,2,\dots,(c+1)r\}. The size of the alphabet is (c+1)r(c+1)r. Without loss of generality, we can assume cr2ncr^{2}\leq n.

Let B~{0,1}s×t\tilde{B}\in\{0,1\}^{s\times t} be a binary matrix such that for any row of B~\tilde{B}, say Ri(B~)R_{i}(\tilde{B}) for i[s]i\in[s], either there are at least ll 0s between any two 1’s, or, Ri(B~)R_{i}(\tilde{B}) has at least αt\alpha t 1’s.

Similar to the proof of Lemma 5.4, we show a reduction from computing g((B~))g((\tilde{B})) to approximating the length of 𝖫𝖭𝖲\mathsf{LNS}. In the following, we set s=rs=r and t=crt=cr for some constant c>0c>0 such that tt is an integer.

Let us consider a matrix BΣs×tB\in\Sigma^{s\times t} such that for any (i,j)[s]×[t](i,j)\in[s]\times[t]:

Bi,j={i, if B~i,j=1,cr+r+1j, if B~i,j=0.B_{i,j}=\begin{cases}i,&\text{ if $\tilde{B}_{i,j}=1$,}\\ cr+r+1-j,&\text{ if $\tilde{B}_{i,j}=0$.}\end{cases} (22)

Thus, for all positions (i,j)(i,j) such that B~i,j=0\tilde{B}_{i,j}=0, we know Bi,j>rB_{i,j}>r. Also, for 1j<jcr1\leq j<j^{\prime}\leq cr, assume B~i,j=B~i,j\tilde{B}_{i,j}=\tilde{B}_{i^{\prime},j^{\prime}} for some i,i[r]i,i^{\prime}\in[r], we have Bi,j>Bi,jB_{i,j}>B_{i^{\prime},j^{\prime}}. For positions (i,j)(i,j) such that B~i,j=1\tilde{B}_{i,j}=1, we have Bi,j=iB_{i,j}=i.

Consider the sequence σ(B)=C1(B)C2(B)Cr(B)\sigma(B)=C_{1}(B)\circ C_{2}(B)\circ\cdots\circ C_{r}(B) where Ci(B)=B1,iB2,iBr,iC_{i}(B)=B_{1,i}B_{2,i}\dots B_{r,i} is the concatenation of symbols in the ii-th column of matrix BB.

We now show that if g(l)(B~)=0g^{(l)}(\tilde{B})=0, 𝖫𝖭𝖲(σ)2r+crl\mathsf{LNS}(\sigma)\leq 2r+\frac{cr}{l} and if g(B~)=1g(\tilde{B})=1, 𝖫𝖭𝖲(σ)αcr\mathsf{LNS}(\sigma)\geq\alpha cr. 333Here, we assume n=|σ|=cr2n=|\sigma|=cr^{2}. If n>cr2n>cr^{2}, we can repeat each symbol in σ\sigma ncr2\frac{n}{cr^{2}} times and show g(l)(B~)=0g^{(l)}(\tilde{B})=0, 𝖫𝖭𝖲(σ)(2r+crl)ncr2\mathsf{LNS}(\sigma)\leq\Big{(}2r+\frac{cr}{l}\big{)}\frac{n}{cr^{2}} and if g(l)(B~)=1g^{(l)}(\tilde{B})=1, 𝖫𝖭𝖲(σ)(αcr)ncr2\mathsf{LNS}(\sigma)\geq\big{(}\alpha cr\big{)}\frac{n}{cr^{2}}. The proof is the same.

If g(l)(B~)=0g^{(l)}(\tilde{B})=0, consider a longest non-decreasing subsequence of σ\sigma denoted by σ\sigma^{\prime}. Than σ\sigma^{\prime} can be divided into two parts σ1\sigma^{\prime 1} and σ2\sigma^{\prime 2} such that σ1\sigma^{\prime 1} consists of symbols from [r][r] and σ2\sigma^{\prime 2} consists of symbols from {r+1,r+2,,cr}\{r+1,r+2,\dots,cr\}. Similar to the proof of Lemma 5.4, σ1\sigma^{\prime 1} corresponds to a path on matrix B~\tilde{B}. Since we are concatenating the columns of BB, the path can never go left. Each step is either go right at least l+1l+1 positions since there are at least ll 0’s between any two 1’s in the same row of B~\tilde{B}, or, go downward to another row. Thus, the total number of steps is at most tl+r\frac{t}{l}+r since B~\tilde{B} has rr rows and tt columns. For σ2\sigma^{\prime 2}, if we restricted BB to positions that are in {r+1,r+2,,(c+1)r}\{r+1,r+2,\dots,(c+1)r\}, symbols in column jj of BB must be smaller than symbols in column jj^{\prime} if j<jj<j^{\prime}. Thus, the length of σ2\sigma^{\prime 2} must be at most the length of Cj(B)C_{j}(B) for any j[cr]j\in[cr], which is at most rr. Thus the length of σ\sigma is at most 2r+crl2r+\frac{cr}{l}.

If g(l)(B~)=1g^{(l)}(\tilde{B})=1, then we know there is some i[r]i\in[r] such that row ii of B~\tilde{B} constains at least αcr\alpha cr 1’s. We know Bi,j=iB_{i,j}=i if B~i,j=1\tilde{B}_{i,j}=1. Thus, Ri(B)R_{i}(B) contains a non-decreasing subseqeunce of length at least αcr\alpha cr. Since RiR_{i} is a subsequence of σ\sigma. We know 𝖫𝖭𝖲(σ)αcr\mathsf{LNS}(\sigma)\geq\alpha cr.

For any constant ε>0\varepsilon>0, we can pick constants c,l>1c,l>1 and α(1/2,1)\alpha\in(1/2,1) such that (1+ε)(2+c/l)αc(1+\varepsilon)(2+c/l)\leq\alpha c. Thus, if we can approximate 𝖫𝖭𝖲(σ)\mathsf{LNS}(\sigma) to within a 1+ε1+\varepsilon factor, we can distinguish the case of g(l)(B~)=0g^{(l)}(\tilde{B})=0 and g(l)(B~)=1g^{(l)}(\tilde{B})=1. The lower bound then follows from Lemma 5.3.

Lemma 5.6.

Let xΣnx\in\Sigma^{n} and ε>0\varepsilon>0 such that |Σ|2/ε=O(n)|\Sigma|^{2}/\varepsilon=O(n). Then any deterministic algorithm that makes constant pass of xx and outputs a (1+ε)(1+\varepsilon) approximation of 𝖫𝖭𝖲(x)\mathsf{LNS}(x) takes Ω(rlog1ε)\Omega(r\log\frac{1}{\varepsilon}) space.

Proof.

Let the alphabet set Σ={a1,a2,,ar}{b1,b2,,br}\Sigma=\{a_{1},a_{2},\dots,a_{r}\}\cup\{b_{1},b_{2},\dots,b_{r}\} and assume that

br<br1<<b1<a1<a2<<arb_{r}<b_{r-1}<\cdots<b_{1}<a_{1}<a_{2}<\cdots<a_{r}

.

We assume t2r/εt\geq 2r/\varepsilon. Since we assume t=Ω(r/ε)t=\Omega(r/\varepsilon), if t<2r/εt<2r/\varepsilon, we can use less symbols in Σ\Sigma for our construction and this will not affect the result. Let l=Θ(1/ε)l=\Theta(1/\varepsilon) that can be divided by 44. For any two symbols a,ba,b, we consider the set Aa,b{a,b}lA_{a,b}\in\{a,b\}^{l} such that

Aa,b={a34l+tb14lt|1tl/4}A_{a,b}=\{a^{\frac{3}{4}l+t}b^{\frac{1}{4}l-t}|1\leq t\leq l/4\}

We define a function ff such that for any σ=a34l+tb14ltAa,b\sigma=a^{\frac{3}{4}l+t}b^{\frac{1}{4}l-t}\in A_{a,b}, f(σ)=a34ltb14l+tf(\sigma)=a^{\frac{3}{4}l-t}b^{\frac{1}{4}l+t}. Thus, for any σAa,b\sigma\in A_{a,b}, the string σf(σ)\sigma\circ f(\sigma) has exactly 32l\frac{3}{2}l aa symbols and 12l\frac{1}{2}l bb symbols.

We let Aa,b¯={f(σ)|σAa,b}\overline{A_{a,b}}=\{f(\sigma)|\sigma\in A_{a,b}\}. We know |Aa,b|=|Aa,b¯|=l/2=Θ(1/ε)\lvert A_{a,b}\rvert=\lvert\overline{A_{a,b}}\rvert=l/2=\Theta(1/\varepsilon).

Consider an error-correcting code Ta,bSa,brT_{a,b}\subset S_{a,b}^{r} over alphabet set Sa,bS_{a,b} with constant rate α\alpha and constant distance β\beta. We can pick α=1/2\alpha=1/2 and β=1/3\beta=1/3. Then the size of the code Ta,bT_{a,b} is |Ta,b|=|Sa,b|αr=2Ω(lr)|T_{a,b}|=|S_{a,b}|^{\alpha r}=2^{\Omega(lr)}. For any code word χ=χ1χ2χrTa,b\chi=\chi_{1}\chi_{2}\cdots\chi_{r}\in T_{a,b} where χiSa,b\chi_{i}\in S_{a,b}, we can write

ν(χ)=(χ1,f(χ1),χ2,f(χ2),,χr,f(χr)).\nu(\chi)=(\chi_{1},f(\chi_{1}),\chi_{2},f(\chi_{2}),\dots,\chi_{r},f(\chi_{r})).

Let W={ν(χ)|χTa,b}(Aa,b×Aa,b¯)rW=\{\nu(\chi)|\chi\in T_{a,b}\}\in(A_{a,b}\times\overline{A_{a,b}})^{r}. Since the code has constant rate α\alpha, the size of WW is (l/4)αr(l/4)^{\alpha r}.

Let β=1/3\beta=1/3. We can define function h:(Aa,b×Aa,b¯)r{0,1}h:(A_{a,b}\times\overline{A_{a,b}})^{r}\rightarrow\{0,1\} such that

h(w)={0, if i[r],f(w2i1)=w2i,1, if for at least βr indices i[r]w2i1w2i contains more than 32l a symbols.undefined, otherwise.h(w)=\begin{cases}0,&\text{ if }\forall i\in[r],\;f(w_{2i-1})=w_{2i},\\ 1,&\text{ if for at least $\beta r$ indices $i\in[r]$, }w_{2i-1}\circ w_{2i}\text{ contains more than $\frac{3}{2}l$ $a$ symbols.}\\ \text{undefined},&\text{ otherwise}.\end{cases} (23)
Claim 5.1.

WW is a fooling set for hh.

Proof.

Let ww and ww^{\prime} be two distinct elements in WW. Let w=(w1,f(w1),w2,f(w2),,wr,f(wr))w=(w_{1},f(w_{1}),w_{2},f(w_{2}),\dots,w_{r},f(w_{r})) and w=(w1,f(w1),w2,f(w2),,wr,f(wr))w^{\prime}=(w^{\prime}_{1},f(w^{\prime}_{1}),w^{\prime}_{2},f(w^{\prime}_{2}),\dots,w^{\prime}_{r},f(w^{\prime}_{r})). By the definition, we know for at least βr\beta r positions i[r]i\in[r], we have wiwiw_{i}\neq w^{\prime}_{i}. Also, by the construction of set Sa,bS_{a,b}, if wiwiw_{i}\neq w^{\prime}_{i}, then one of wif(wi)w_{i}\circ f(w^{\prime}_{i}) and wif(wi)w^{\prime}_{i}\circ f(w_{i}) has more than 32l\frac{3}{2}l aa symbols.

vv in the span of ww and ww^{\prime} if v=(v1,v¯1,,vr,v¯r)v=(v_{1},\bar{v}_{1},\dots,v_{r},\bar{v}_{r}) such that vi{w1,wi}v_{i}\in\{w_{1},w^{\prime}_{i}\} and v¯i{f(wi),f(wi)}\bar{v}_{i}\in\{f(w_{i}),f(w^{\prime}_{i})\}. We can find a vv in the span of ww and ww^{\prime} such that h(v)=1h(v)=1.

For i[r]i\in[r], we can define Aai,biA_{a_{i},b_{i}}, Aai,bi¯\overline{A_{a_{i},b_{i}}}, WiW_{i}, hih_{i} similarly except the alphabet is {ai,bi}\{a_{i},b_{i}\} instead of {a,b}\{a,b\}.

Consider a matrix BB of size r×2rr\times 2r such that Bi,2j1Aai,biB_{i,2j-1}\in A_{a_{i},b_{i}} and Bi,jAai,bi¯B_{i,j}\in\overline{A_{a_{i},b_{i}}}. We define a function gg such that

g(B)=h1(R1(B))h2(R2(B))hr(Rr(B)).g(B)=h_{1}(R_{1}(B))\vee h_{2}(R_{2}(B))\vee\cdots\vee h_{r}(R_{r}(B)). (24)

In the following, we consider a 2r2r-party one way game. In the game, player ii holds Ci(B)C_{i}(B). The goal is to compute g(B)g(B).

Claim 5.2.

The set of all matrix BB such that Ri(B)WiR_{i}(B)\in W_{i} for i[r]i\in[r] is a fooling set for gg.

Proof.

For any two matrix B1B2B_{1}\neq B_{2} such that Ri(B2),Ri(B)Wii[r]R_{i}(B_{2}),R_{i}(B_{)}\in W_{i}\;\forall\;i\in[r]. We know g(B1)=g(B2)=0g(B_{1})=g(B_{2})=0. There is some row ii such that Ri(B1)Ri(B2)R_{i}(B_{1})\neq R_{i}(B_{2}). We know there is some elements vv in the span of Ri(B1)R_{i}(B_{1}) and Ri(B2)R_{i}(B_{2}), such that hi(v)=1h_{i}(v)=1 by Claim 5.1. Thus, there is some element BB^{\prime} in the span of B1B_{1} and B2B_{2} such that g(B)=1g(B^{\prime})=1. ∎

Thus, we get a 22-fooling set for function gg in the 2r2r-party setting. The size of the fooling set is |W|r=(l/4)αr2)|W|^{r}=(l/4)^{\alpha r^{2}}). Thus, CC2rtot(g)=log(|W|r)=Ω(r2log1ε)CC^{tot}_{2r}(g)=\log(|W|^{r})=\Omega(r^{2}\log\frac{1}{\varepsilon}) and CC2rmax(g)=CC2rtot(g)/2r=Ω(rlog1ε)CC^{max}_{2r}(g)=CC^{tot}_{2r}(g)/2r=\Omega(r\log\frac{1}{\varepsilon}).

Consider a matrix B~\tilde{B} of size r×3rr\times 3r such that B~\tilde{B} is obtained by inserting a column of aa symbols to BB at every third position. Thus,

B~=(B1,1B1,2a12lB1,3B1,4a12lB1,2r1B1,2ra12lB2,1B2,2a22lB2,3B2,4a22lB2,2r1B2,2ra22lBr,1Br,2ar2lBr,3Br,4a22lBr,2r1Br,2rar2l)(r×3r)\tilde{B}=\begin{pmatrix}B_{1,1}&B_{1,2}&a_{1}^{2l}&B_{1,3}&B_{1,4}&a_{1}^{2l}&\cdots&B_{1,2r-1}&B_{1,2r}&a_{1}^{2l}\\ B_{2,1}&B_{2,2}&a_{2}^{2l}&B_{2,3}&B_{2,4}&a_{2}^{2l}&\cdots&B_{2,2r-1}&B_{2,2r}&a_{2}^{2l}\\ \vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\ddots&\vdots&\vdots&\vdots\\ B_{r,1}&B_{r,2}&a_{r}^{2l}&B_{r,3}&B_{r,4}&a_{2}^{2l}&\cdots&B_{r,2r-1}&B_{r,2r}&a_{r}^{2l}\end{pmatrix}_{(r\times 3r)}

Let x=C1(B~)C2(B~)C3r(B~)x=C_{1}(\tilde{B})\circ C_{2}(\tilde{B})\circ\cdots\circ C_{3r}(\tilde{B}).

We now show how to reduce computing g(B)g(B) to approximating the length of 𝖫𝖭𝖲(x)\mathsf{LNS}(x). We claim the following.

Claim 5.3.

If g(B)=0g(B)=0, 𝖫𝖭𝖲(x)112rl2l\mathsf{LNS}(x)\leq\frac{11}{2}rl-2l. If g(B)=1g(B)=1, 𝖫𝖭𝖲(x)112rl2l+βr1\mathsf{LNS}(x)\geq\frac{11}{2}rl-2l+\beta r-1.

Proof.

We first divide xx into rr parts such that

x=x1x2xrx=x^{1}\circ x^{2}\circ\cdots x^{r}

where xi=C3i2(B~)C3i1(B~)C3i(B~)x^{i}=C_{3i-2}(\tilde{B})\circ C_{3i-1}(\tilde{B})\circ C_{3i}(\tilde{B}). We know C3i2(B~)=C2i1(B)C_{3i-2}(\tilde{B})=C_{2i-1}(B) is the (2i1)(2i-1)-th column of BB, C3i1(B~)=C2i(B)C_{3i-1}(\tilde{B})=C_{2i}(B) is the 2i2i-th column of BB and C3i(B~)=a12la22lar2lC_{3i}(\tilde{B})=a_{1}^{2l}a_{2}^{2l}\cdots a_{r}^{2l}.

If g(B)=0g(B)=0, we show 𝖫𝖭𝖲(x)=112rl2l\mathsf{LNS}(x)=\frac{11}{2}rl-2l. Let Σ\Sigma be a longest non-decreasing subsequence of xx. We can divide σ\sigma into rr parts such that σi\sigma^{i} is a subsequence of xix^{i}. For our analysis, we set t0=1t_{0}=1. If σi\sigma^{i} is empty or contains no aa symbols, let ti=ti1t_{i}=t_{i-1}. Otherwise, we let tit_{i} be the largest integer such that atia_{t_{i}} appeared in σi\sigma^{i}.We have

1=t0t1t2trr1=t_{0}\leq t_{1}\leq t_{2}\leq\cdots\leq t_{r}\leq r

We now show that, for any ii, the length of σi\sigma^{i} is at most 32l+2(titi1+1)l\frac{3}{2}l+2(t_{i}-t_{i-1}+1)l. To see this, if ti=ti1t_{i}=t_{i-1}, xix^{i} to σ\sigma. Since g(B)=0g(B)=0, there are exactly 32l+2l\frac{3}{2}l+2l atia_{t_{i}} symbols in xix^{i}. Thus |σi|32l+2l|\sigma^{i}|\leq\frac{3}{2}l+2l.

If ti>ti1t_{i}>t_{i-1}, if there is some ata_{t} symbol in the C3i2(B~)C3i1(B~)C_{3i-2}(\tilde{B})\circ C_{3i-1}(\tilde{B}) included in σi\sigma^{i} for some ti1<ttit_{i-1}<t\leq t_{i}. Then σi\sigma^{i} can not include ata_{t^{\prime}} symbols in C3i(B~)C_{3i}(\tilde{B}) for all ti1t<tt_{i-1}\leq t^{\prime}<t. Also for any ti1t<tt_{i-1}\leq t^{\prime}<t, the number of ata_{t^{\prime}} symbols in C3i2(B~)C3i1(B~)C_{3i-2}(\tilde{B})\circ C_{3i-1}(\tilde{B}) is 32l\frac{3}{2}l but the number in C3i(B~)C_{3i}(\tilde{B}) is 2l2l. Thus, the optimal strategy it to pick the 32l\frac{3}{2}l ati1a_{t_{i-1}} symbols in C3i2(B~)C3i1(B~)C_{3i-2}(\tilde{B})\circ C_{3i-1}(\tilde{B}) and then add 2(titi1+1)l2(t_{i}-t_{i-1}+1)l symbols (2l2l ata_{t}’s for ti1ttit_{i-1}\leq t\leq t_{i}) in C3i(B~)C_{3i}(\tilde{B}) to σi\sigma^{i}.

In total, length of σ\sigma is at most

i=1rσi112rl2l\sum_{i=1}^{r}\sigma^{i}\leq\frac{11}{2}rl-2l

Thus, if g(B)=0g(B)=0, we know 𝖫𝖭𝖲(x)112rl2l\mathsf{LNS}(x)\leq\frac{11}{2}rl-2l.

If g(B)=1g(B)=1, that means there is some row ii of BB such that for at least βr\beta r positions j[r]j\in[r], the number of aia_{i} symbols in Bi,2j1Bi,2jB_{i,2j-1}\circ B_{i,2j} is at least 32l+1\frac{3}{2}l+1.

We now build a non-decreasing subsequence σ\sigma of xx with length at least 112rl2l+βr1\frac{11}{2}rl-2l+\beta r-1. We set σ\sigma to be empty initially. There are at least 32l\frac{3}{2}l a1a_{1} symbols in B1,1B1,2B_{1,1}\circ B_{1,2}. We add all of them to σ\sigma. Then, we add all the ata_{t} symbols for 1ti1\leq t\leq i in C3B~C_{3}{\tilde{B}} to σ\sigma. This adds 2il2il symbols to σ\sigma

We consider the string

x~=Bi,3Bi,4ai2lBi,2r1Bi,2rai2l.\tilde{x}=B_{i,3}\circ B_{i,4}\circ\circ a_{i}^{2l}\circ\cdots\circ B_{i,2r-1}\circ B_{i,2r}\circ a_{i}^{2l}.

It is a subsequence of x2xrx^{2}\circ\cdots x^{r}. There are (r1)(32l+2l+βr1)(r-1)(\frac{3}{2}l+2l+\beta r-1) aia_{i} symbols in x~\tilde{x}. This is because for at least βr1\beta r-1 positions j{2,3,,r}j\in\{2,3,\dots,r\}, we know Bi,2j1Bi,2jB_{i,2j-1}\circ B_{i,2j} contains more than 32l\frac{3}{2}l aia_{i} symbols. For the rest of the positions, we know Bi,2j1Bi,2jB_{i,2j-1}\circ B_{i,2j} contains 32l\frac{3}{2}l aia_{i} symbols.

Finally, we add all the ata_{t} symbols for i<tni<t\leq n in C3rB~C_{3r}{\tilde{B}} to σ\sigma. This adds another 2(ri)l2(r-i)l symbols to σ\sigma. The sequence σ\sigma has length at least 112rl2l+βr1\frac{11}{2}rl-2l+\beta r-1. ∎

Assume l=λ/εl=\lambda/\varepsilon where λ\lambda is some constant. Let ε=β10λε=Θ(ε)\varepsilon^{\prime}=\frac{\beta}{10\lambda}\varepsilon=\Theta(\varepsilon). If we can give a 1+ε1+\varepsilon^{\prime} approximation of 𝖫𝖭𝖲(x)\mathsf{LNS}(x), we can distinguish g(B)=0g(B)=0 and g(B)=1g(B)=1.

By the fact that CC2rmax(g)=Ω(rlog1ε)CC^{max}_{2r}(g)=\Omega(r\log\frac{1}{\varepsilon}), any deterministic streaming algorithm with constant passes of xx that approximate 𝖫𝖭𝖲(x)\mathsf{LNS}(x) within a (1+ε)(1+\varepsilon^{\prime}) factor requires Ω(rlog1ε)\Omega(r\log\frac{1}{\varepsilon}) space. ∎

5.3 Longest Non-decreasing Subsequence with Threshold

We now consider a variant of 𝖫𝖭𝖲\mathsf{LNS} problem we call longest non-decreasing subsequence with threshold (𝖫𝖭𝖲𝖳\mathsf{LNST}). In this section, we assume the alphabet is Σ={0,1,2,,r}\Sigma=\{0,1,2,\dots,r\}. In this problem, we are given a sequence xΣnx\in\Sigma^{n} and a threshold t[n]t\in[n], the longest non-decreasing subsequence with threshold tt is the longest non-decreasing subsequence of xx such that each symbol appeared in it is repeated at most tt times. We denote the length of such a subsequence by 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t).

We first give our lower bounds for 𝖫𝖭𝖲𝖳\mathsf{LNST}.

Theorem 16 (Restatement of Theorem 4).

Given an alphabet Σ\Sigma, for deterministic (1+ε)(1+\varepsilon) approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) for a string xΣnx\in\Sigma^{n} in the streaming model with RR passes, we have the following space lower bounds:

  1. 1.

    Ω(min(n,|Σ|)/R)\Omega(\min(\sqrt{n},|\Sigma|)/R) for any constant tt (this includes 𝖫𝖨𝖲\mathsf{LIS}), when ε\varepsilon is any constant.

  2. 2.

    Ω(|Σ|log(1/ε)/R)\Omega(|\Sigma|\log(1/\varepsilon)/R) for tn/|Σ|t\geq n/|\Sigma| (this includes 𝖫𝖭𝖲\mathsf{LNS}), when |Σ|2/ε=O(n)|\Sigma|^{2}/\varepsilon=O(n).

  3. 3.

    Ω(|Σ|ε/R)\Omega\left(\frac{\sqrt{|\Sigma|}}{\varepsilon}/R\right) for t=Θ(1/ε)t=\Theta(1/\varepsilon), when |Σ|/ε=O(n)|\Sigma|/\varepsilon=O(n).

Theorem 16 is a result of the following four Lemmas.

Lemma 5.7.

Let xΣnx\in\Sigma^{n} and |Σ|=rn)|\Sigma|=r\leq\sqrt{n}) and ε>0\varepsilon>0 be any constant. Let tn/rt\geq n/r. Then any RR-pass deterministic algorithm a 1+ε1+\varepsilon approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) takes Ω(r/R)\Omega(r/R) space.

Proof.

In the proof of Lemma 5.5, each symbol in sequence σ\sigma appeared no more than max(r,n/r)\max(r,n/r) times. If rnr\leq\sqrt{n} and tn/rt\geq n/r, we have 𝖫𝖭𝖲(σ)=𝖫𝖭𝖲𝖳(σ,t)\mathsf{LNS}(\sigma)=\mathsf{LNST}(\sigma,t). The lower bound follows from our lower bound for 𝖫𝖭𝖲\mathsf{LNS} in Lemma 5.5.

Lemma 5.8.

Let xΣnx\in\Sigma^{n} and |Σ|=r|\Sigma|=r and ε>0\varepsilon>0 be any constant. Let tt be some constant. Then any RR pass deterministic algorithm outputs a 1+ε1+\varepsilon approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) takes Ω(min(n,r))\Omega(\min(\sqrt{n},r)) space.

Proof.

Let σΣn/t\sigma\in\Sigma^{n/t}. If we repeat every symbol in σ\sigma tt times, we get a string σΣ\sigma^{\prime}\in\Sigma. Then, 𝖫𝖨𝖲(x)=1t𝖫𝖭𝖲𝖳(x,t)\mathsf{LIS}(x)=\frac{1}{t}\mathsf{LNST}(x,t). When tt is a constant, the lower bound follows from lower bounds for 𝖫𝖨𝖲\mathsf{LIS} in Lemma 5.4. ∎

Lemma 5.9.

Let xΣnx\in\Sigma^{n}. Assume |Σ|=r|\Sigma|=r and ε>0\varepsilon>0 such that r2/ε=O(n)r^{2}/\varepsilon=O(n). Let t=Θ(r/ε)t=\Theta(r/\varepsilon). Then any RR-pass deterministic algorithm that outputs a 1+ε1+\varepsilon approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) takes Ω(rlog1/ε\Omega(r\log 1/\varepsilon space.

Proof.

In the proof of Lemma 5.6, we considered strings xx where each symbol is appeared at most 4rl4rl times where l=1/εl=1/\varepsilon. We t=4rl=Θ(r/ε)t=4rl=\Theta(r/\varepsilon). Thus, 𝖫𝖭𝖲𝖳(x,t)=𝖫𝖭𝖲(x)\mathsf{LNST}(x,t)=\mathsf{LNS}(x). The lower bound follows from Lemma 5.6.

Lemma 5.10.

Assume xΣnx\in\Sigma^{n}, ε>0\varepsilon>0, and |Σ|ε=O(n)\frac{|\Sigma|}{\varepsilon}=O(n) . Let t=Θ(1/ε)t=\Theta(1/\varepsilon), any RR-pass deterministic algorithm that outputs an 1+ε1+\varepsilon approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) requires Ω(|Σ|ε)\Omega(\frac{\sqrt{|\Sigma|}}{\varepsilon}) space.

Proof.

The lower bound is achieved using the same construction in the proof of Lemma 15 with some modifications. In Section 4.1.1, for any nn, we build a fooling set Sa,b{a,b}n/2S_{a,b}\subset\{a,b\}^{n/2} and Sa,b¯{a,b}n/2+5\overline{S_{a,b}}\subseteq\{a,b\}^{n/2+5} (we used the notation SS instead of Sa,bS_{a,b} in Section 4.1.1) such that Sa,b¯={f(x)|xSa,b}\overline{S_{a,b}}=\{f(x)|x\in S_{a,b}\} where the function ff simply delete the first 10 bb’s in xx. We prove Lemma 4.1 and Claim 4.1. We modify the construction of Sa,bS_{a,b} and Sa,b¯\overline{S_{a,b}} with three symbols a,b,ca,b,c. The modification is to replace every aa symbols in the strings in Sa,b¯\overline{S_{a,b}} with cc symbols. This gives us a new set Sb,c¯{b,c}n/25\overline{S_{b,c}}\subset\{b,c\}^{n/2-5}. Thus, the function ff now becomes, on input xSa,bx\in S_{a,b}, first remove 10 bb’s and then replace all aa symbols with cc.

Let y=an/3bn/3cn/3y=a^{n/3}b^{n/3}c^{n/3}. We can show that for every xSa,bx\in S_{a,b},

𝖫𝖢𝖲(xf(x),y)=n2+5.\mathsf{LCS}(x\circ f(x),y)=\frac{n}{2}+5.

Also, for any two distinct x1,x2Sa,bx^{1},x^{2}\in S_{a,b},

max{𝖫𝖢𝖲(x1f(x2),y),𝖫𝖢𝖲(x2f(x1),y)}>n2+5.\max\{\mathsf{LCS}(x^{1}\circ f(x^{2}),y),\mathsf{LCS}(x^{2}\circ f(x^{1}),y)\}>\frac{n}{2}+5.

The proof is the same as the proof of Lemma 4.1.

We now modify the construction in the proof of Lemma 15. Since t=Θ(1/ε)t=\Theta(1/\varepsilon), we choose nεn_{\varepsilon} such that nε/3=tn_{\varepsilon}/3=t. More specifically, for the matrix B¯\bar{B} (see equation 11), we do the following modification. For any i,j[r]i,j\in[r], yi,2j1yi,2j=ainε/3binε/3ainε/3y^{i,2j-1}\circ y^{i,2j}=a_{i}^{n_{\varepsilon}/3}b_{i}^{n_{\varepsilon}/3}a_{i}^{n_{\varepsilon}/3}. We replace yi,2j1yi,2jy^{i,2j-1}\circ y^{i,2j} with string di,jnε/3ei,jnε/3fi,jnε/3d_{i,j}^{n_{\varepsilon}/3}e_{i,j}^{n_{\varepsilon}/3}f_{i,j}^{n_{\varepsilon}/3}. Here, di,j,ei,j,fi,jd_{i,j},e_{i,j},f_{i,j} are three symbols in Σ\Sigma such that di,j<ei,j<fi,jd_{i,j}<e_{i,j}<f_{i,j}. In the matrix B~\tilde{B} (see equation 10), for Bi,2j1B_{i,2j-1}, we replace every aia_{i} symbols with di,jd_{i,j} and bib_{i} symbols with ei,je_{i,j}. For Bi,2jB_{i,2j}, we place aia_{i} symbols with fi,jf_{i,j} and bib_{i} symbols with ei,je_{i,j}.

We also replace the cjnεc_{j}^{n_{\varepsilon}} block in the ii-th row of both B¯\bar{B} and B~\tilde{B} with ci,j,1nε/3ci,j,2nε/3ci,j,2nε/3c_{i,j,1}^{n_{\varepsilon}/3}c_{i,j,2}^{n_{\varepsilon}/3}c_{i,j,2}^{n_{\varepsilon}/3}. Here, ci,j,1,ci,j,2.ci,j,3c_{i,j,1},c_{i,j,2}.c_{i,j,3} are three different symbols in Σ\Sigma such that ci,j,1<ci,j,2<ci,j,3c_{i,j,1}<c_{i,j,2}<c_{i,j,3}.

yy is the concatenation of rows of B¯\bar{B}. We require that symbols appeared earlier in yy are smaller. Since yy is the concatenation of all symbols that appeared in xx and each symbol in yy repeated t=nεt=n_{\varepsilon} times. After the symbol replacement, we have 𝖫𝖢𝖲(x,y)=𝖫𝖭𝖲𝖳(x,t)\mathsf{LCS}(x,y)=\mathsf{LNST}(x,t). Also notice that the alphabet size is now O(r2)O(r^{2}) instead of rr in the proof of Lemma 15. The Ω(|Σ|ε)\Omega(\frac{|\Sigma|}{\varepsilon}) space lower bound then follows from a similar analysis in the proof of Lemma 15.

We now prove a trivial space upper bound for 𝖫𝖭𝖲𝖳\mathsf{LNST}.

Input: An online string xΣnx\in\Sigma^{n} where Σ=[r]\Sigma=[r].
1
2Let D={0,εrt,2εrt,,t}D=\{0,\frac{\varepsilon}{r}t,2\frac{\varepsilon}{r}t,\dots,t\} \triangleright if r/εtr/\varepsilon\geq t, D=[t]{0}D=[t]\cup\{0\}.
3 SS\leftarrow\emptyset.
4 foreach d=(d1,,dr)𝒟rd=(d_{1},\dots,d_{r})\in\mathcal{D}^{r} do
5 \triangleright try every d=(d1,,dr)𝒟rd=(d_{1},\dots,d_{r})\in\mathcal{D}^{r} in parallel
6 
7  Let σ(d)=1d12d2rdr\sigma(d)=1^{d_{1}}2^{d_{2}}\cdots r^{d_{r}}.
8   If σ(d)\sigma(d) is a subsequence of xx, add dd to SS.
9 end foreach
10in parallel, compute 𝖫𝖭𝖲(x)\mathsf{LNS}(x) exactly with an additional O~(r)\tilde{O}(r) bits of space.
11 if 𝖫𝖭𝖲(x)t\mathsf{LNS}(x)\leq t then
12 return 𝖫𝖭𝖲(x)\mathsf{LNS}(x).
13 
14 else
15 return maxdS(i[r]di)\max_{d\in S}\big{(}\sum_{i\in[r]}d_{i}\big{)}
16 end if
Algorithm 1 Approximate the length of the longest non-decreasing subsequence with threshold
Lemma 5.11.

Given an alphabet Σ\Sigma with |Σ|=r\lvert\Sigma\rvert=r. For any ε>0\varepsilon>0 and t1t\geq 1, there is a one-pass streaming algorithm that computes a (1+ε)(1+\varepsilon) approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t) for any xΣnx\in\Sigma^{n} with O~((min(t,r/ε)+1)r)\tilde{O}\Big{(}\big{(}\min(t,r/\varepsilon)+1\big{)}^{r}\Big{)} space.

Proof.

We assume Σ=[r]\Sigma=[r] and the input is a string xΣnx\in\Sigma^{n}. Let σ\sigma be a longest non-decreasing subsequence of xx with threshold tt and we can write σ=1n12n2rnr\sigma=1^{n_{1}}2^{n_{2}}\cdots r^{n_{r}} where nin_{i} is the number of times symbol ii repeated and 0nit0\leq n_{i}\leq t.

We let DD be the set {0,εrt,2εrt,,t}\{0,\frac{\varepsilon}{r}t,2\frac{\varepsilon}{r}t,\dots,t\}. Thus, if r/εtr/\varepsilon\geq t, D=[t]{0}D=[t]\cup\{0\}. Consider the set 𝒟\mathcal{D} such that 𝒟=Dr\mathcal{D}=D^{r}. Thus, |𝒟|=(min(t+1,r/ε+1))r\lvert\mathcal{D}\rvert=\big{(}\min(t+1,r/\varepsilon+1)\big{)}^{r}. For convenience, we let f(d)=i=1rdif(d)=\sum_{i=1}^{r}d_{i}. We initialize the set SS to be an empty set. For each d𝒟d\in\mathcal{D}, run in parallel, we check is σ(d)=1d12d2rdr\sigma(d)=1^{d_{1}}2^{d_{2}}\cdots r^{d_{r}} is a subsequence of xx. If σ(d)\sigma(d) is a subsequence of xx, add dd to SS.

Meanwhile, we also compute 𝖫𝖭𝖲(x)\mathsf{LNS}(x) exactly with an additional O~(r)\tilde{O}(r) bits of space. If 𝖫𝖭𝖲<t\mathsf{LNS}<t, we output 𝖫𝖭𝖲(x)\mathsf{LNS}(x). Otherwise, we output maxdS(i[r]di)\max_{d\in S}\big{(}\sum_{i\in[r]}d_{i}\big{)}.

We now show the output is a (1ε)(1-\varepsilon)-approximation of 𝖫𝖭𝖲𝖳(x,t)\mathsf{LNST}(x,t). Let did^{\prime}_{i} be the largest element in 𝒟\mathcal{D} that is no larger than nin_{i} for i[r]i\in[r] and d=(d1,d2,,dr)d^{\prime}=(d^{\prime}_{1},d^{\prime}_{2},\dots,d^{\prime}_{r}).

If t|σ|t\leq|\sigma|, we have 0nidiε/rt0\leq n_{i}-d^{\prime}_{i}\leq\varepsilon/rt and

|σ|f(d)i=1r(nidi)εtε|σ|\lvert\sigma\rvert-f(d^{\prime})\leq\sum_{i=1}^{r}(n_{i}-d^{\prime}_{i})\leq\varepsilon t\leq\varepsilon\lvert\sigma\rvert

since we assume t|σ|t\leq|\sigma|. Thus, f(d)(1ε)|σ|.f(d^{\prime})\geq(1-\varepsilon)\lvert\sigma\rvert. Note that 1d12d2rdr1^{d^{\prime}_{1}}2^{d^{\prime}_{2}}\cdots r^{d^{\prime}_{r}} is a subsequence of σ\sigma and thus also a subsequence of xx. Thus, we add dd^{\prime} to the set SS. That means, the final output will be at least f(d)f(d^{\prime}). Denote the final output by ll, we have

lf(d)(1ε)|σ|.l\geq f(d^{\prime})\geq(1-\varepsilon)\lvert\sigma\rvert.

On the otherhand, the the output is f(d)f(d) for some d=(d1,,dr)d=(d_{1},\dots,d_{r}), we find a subsequence 1d12d2rdr1^{d_{1}}2^{d_{2}}\cdots r^{d_{r}} of xx and thus f(d)|σ|f(d)\leq\lvert\sigma\rvert. We know

l=maxdSf(d)|σ|.l=\max_{d\in S}f(d)\leq\lvert\sigma\rvert.

If t𝖫𝖭𝖲(x)t\geq\mathsf{LNS}(x), no symbol in σ\sigma is repeated more than t1t-1 times. Thus, 𝖫𝖭𝖲𝖳(x,t)=𝖫𝖭𝖲(x)\mathsf{LNST}(x,t)=\mathsf{LNS}(x). Thus, we output 𝖫𝖭𝖲(x)\mathsf{LNS}(x). Notice that if 𝖫𝖭𝖲(x)>t\mathsf{LNS}(x)>t, either some symbol in the longest non-decreasing subsequence is repeated more than tt times, or 𝖫𝖭𝖲𝖳(x,t)=𝖫𝖭𝖲(x)\mathsf{LNST}(x,t)=\mathsf{LNS}(x). In either case, we have t|σ|t\leq|\sigma| and maxdS(i[r]di)\max_{d\in S}\big{(}\sum_{i\in[r]}d_{i}\big{)} is a 1ε1-\varepsilon approximation of 𝖫𝖭𝖲(x)\mathsf{LNS}(x).

6 Algorithms for Edit Distance and LCS

6.1 Algorithm for edit distance

In this section, we presents our space efficient algorithms for approximating edit distance in the asymmetric streaming setting.

We can compute edit distance exactly with dynamic programming using the following recurrence equation. We initialize A(0,0)=0A(0,0)=0 and A(i,0)=A(0,i)=iA(i,0)=A(0,i)=i for i[n]i\in[n]. Then for 0i,jn0\leq i,j\leq n,

A(i,j)={A(i1,j1),if xi=yj.min{A(i1,j1)+1,A(i,j1)+1,A(i1,j)+1,,if xiyj.A(i,j)=\begin{cases}A(i-1,j-1),&\text{if $x_{i}=y_{j}$.}\\ \min\begin{cases}A(i-1,j-1)+1,\\ A(i,j-1)+1,\\ A(i-1,j)+1,\end{cases},&\text{if $x_{i}\neq y_{j}$.}\end{cases} (25)

Where A(i,j)A(i,j) is the edit distance between x[1:i]x[1:i] and y[1:j]y[1:j]. The three options in the case xiyjx_{i}\neq y_{j} each corresponds to one of the edit operations (substitution, insertion, and deletion). Thus, we can run a dynamic programming to compute matrix AA. When the edit distance is bounded by kk, we only need to compute the diagonal stripe of matrix AA with width O(k)O(k). Thus, we have the following.

Lemma 6.1.

Assume we are given streaming access to the online string xΣx\in\Sigma^{*} and random access to the offline string yΣny\in\Sigma^{n}. We can check whether 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\leq k or not, with O(klogn)O(k\log n) bits of space in O(nk)O(nk) time. If 𝖤𝖣(x,y)k\mathsf{ED}(x,y)\leq k, we can compute 𝖤𝖣(x,y)\mathsf{ED}(x,y) exactly with O(klogn)O(k\log n) bits of space in O(nk)O(nk) time.

Claim 6.1.

For two strings x,yΣnx,y\in\Sigma^{n}, assume 𝖤𝖣(x,y)<k\mathsf{ED}(x,y)<k, we can output the edit operations that transforms xx to yy with O(klogn)O(k\log n) bits of space in O(nk2)O(nk^{2}) time.

Proof.

The idea is to run the dynamic programming O(k)O(k) times. We initialize n1=n2=nn_{1}=n_{2}=n. If xn1=yn2x_{n_{1}}=y_{n_{2}}, we find the largest integer such that x[n1i:n1]=y[n2i:n2]x[n_{1}-i:n_{1}]=y[n_{2}-i:n_{2}] and set n1n1in_{1}\leftarrow n_{1}-i and n2n2in_{2}\leftarrow n_{2}-i and continue. If xn1yn2x_{n_{1}}\neq y_{n_{2}}, we compute the the elements A(n1,n21)A(n_{1},n_{2}-1), A(n11,n21)A(n_{1}-1,n_{2}-1), and A(n11,n2)A(n_{1}-1,n_{2}). By 25, we know there is some (n1,n2){(n1,n21),(n11,n21),(n11,n2)}(n^{\prime}_{1},n^{\prime}_{2})\in\{(n_{1},n_{2}-1),(n_{1}-1,n_{2}-1),(n_{1}-1,n_{2})\} such that A(n1,n2)=A(n1,n2)1A(n^{\prime}_{1},n^{\prime}_{2})=A(n_{1},n_{2})-1. We set n1n1n_{1}\leftarrow n^{\prime}_{1} and n2n2n_{2}\leftarrow n^{\prime}_{2}, output the corresponding edit operation and continue. We need to run the dynamic programming O(k)O(k) times. The running time is O(nk2)O(nk^{2}). ∎

Lemma 6.2.

For two strings x,yΣnx,y\in\Sigma^{n}, assume d=𝖤𝖣(x,y)d=\mathsf{ED}(x,y). For any integer 1td1\leq t\leq d, there is a way to divide xx and yy each into tt parts so that x=x1x2xtx=x^{1}\circ x^{2}\circ\cdots\circ x^{t} and y=y1y2yty=y^{1}\circ y^{2}\circ\cdots\circ y^{t} (we allow xix^{i}or yiy^{i} to be empty for some ii), such that d=i=1t𝖤𝖣(xi,yi)d=\sum_{i=1}^{t}\mathsf{ED}(x^{i},y^{i}) and 𝖤𝖣(xi,yi)dt\mathsf{ED}(x^{i},y^{i})\leq\lceil\frac{d}{t}\rceil for all i[t]i\in[t].

Proof of Lemma 6.2.

Since 𝖤𝖣(x,y)=d\mathsf{ED}(x,y)=d, we can find dd edit operations on xx that transforms xx into yy. We can write these edit operations in the same order as where they occured in xx. Then, we first find the largest i1i_{1} and j1j_{1}, such that the first dt\lceil\frac{d}{t}\rceil edit operations transforms x[1:i1]x[1:i_{1}], to y[1:j1]y[1:j_{1}]. Notice that i1i_{1} (or j1j_{1}) is 0 if the first dt\lceil\frac{d}{t}\rceil edit operations insert dt\lceil\frac{d}{t}\rceil before x1x^{1} (or delete first dt\lceil\frac{d}{t}\rceil symbols in xx). We can set x1=x[1:i1]x^{1}=x[1:i_{1}] and y1=y[1:j1]y^{1}=y[1:j_{1}] and continue doing this until we have seen all dd edit operations. This will divide xx and yy each in to at most tt parts. ∎

In our construction, we utilize the following result from [CJLZ20].

Lemma 6.3.

[Theorem 1.1 of [CJLZ20]] For two strings x,yΣnx,y\in\Sigma^{n}, there is a deterministic algorithm that compute a 1+o(1)1+o(1)-approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y) with O(log4nloglogn)O(\frac{\log^{4}n}{\log\log n}) bits of space in polynomial time.

We now present our algorithm that gives a constant approximation of edit distance with improved space complexity compared to the algorithm in [FHRS20], [CJLZ20]. The main ingredient of our algorithm is a recursive procedure called 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring}. The pseudocode is given in algorithm 2. It takes four inputs: an online string xx, an offline string yy, an upper bound of edit distance uu, and an upper bound of space available ss. The output of 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} is a three tuple: a pair of indices (p,q)(p,q), two integers ll and dd. Througout the analysis, we assume ε\varepsilon is a small constant up to our choice.

Input: An online xΣx\in\Sigma^{*} with streaming access, an local string yΣny\in\Sigma^{n}, an upper bound of edit distance uu, and an upper bound of space available ss.
Output: A pair of indices (p,q)[n]×[n](p,q)\in[n]\times[n], an integer lnl\in n, and an approximation of edit distance dd
1 if usu\leq s then
2 for  l=ul^{\prime}=u to |x||x| do
3      try all 1p<qn1\leq p^{\prime}<q^{\prime}\leq n such that lu|qp+1|l+ul^{\prime}-u\leq|q^{\prime}-p^{\prime}+1|\leq l^{\prime}+u and check whether 𝖤𝖣(y[p:q],x[1:l])u\mathsf{ED}(y[p^{\prime}:q^{\prime}],x[1:l^{\prime}])\leq u.
4    if there exists a pair p,qp^{\prime},q^{\prime} such that 𝖤𝖣(y[p:q],x[1:l])u\mathsf{ED}(y[p^{\prime}:q^{\prime}],x[1:l^{\prime}])\leq u then
5         set p,qp,q to be the pair of indices that minimizes 𝖤𝖣(y[p:q],x[1:l])\mathsf{ED}(y[p^{\prime}:q^{\prime}],x[1:l^{\prime}]).
6       d𝖤𝖣(y[p:q],x[1:l])d\leftarrow\mathsf{ED}(y[p:q],x[1:l^{\prime}]), and lll\leftarrow l^{\prime}.
7         compute and record the edit operations that transform y[p:q]y[p:q] to x[1:l]x[1:l^{\prime}].
8       continue
9    else
10       break
11      end if
12    
13   end for
14 
15 else
16   initialize i=1i=1, ai=1a_{i}=1, l=0l=0.
17 while ai|x|a_{i}\leq|x| and isi\leq s  do
18    
19    (pi,qi),li,di𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀(x[ai:n],y,u/s,s)(p_{i},q_{i}),l_{i},d_{i}\leftarrow\mathsf{FindLongestSubstring}(x[a_{i}:n],y,\lceil u/s\rceil,s).
20    ii+1i\leftarrow i+1.
21    aiai1+lia_{i}\leftarrow a_{i-1}+l_{i}.
22    ll+lil\leftarrow l+l_{i}.
23    
24   end while
25 Ti1T\leftarrow i-1.
26   for all 1p<qn1\leq p^{\prime}<q^{\prime}\leq n, use the algorithm guaranteed by Lemma 6.3 to compute d~(p,q)\tilde{d}(p^{\prime},q^{\prime}), a 1+ε1+\varepsilon approximation of 𝖤𝖣(y[p:q],y[p1:q1]y[p2:q2]y[pT:qT])\mathsf{ED}(y[p^{\prime}:q^{\prime}],y[p_{1}:q_{1}]\circ y[p_{2}:q_{2}]\circ\cdots\circ y[p_{T}:q_{T}]).
27 p,qargminp,qd~(p,q)p,q\leftarrow\textbf{argmin}_{p^{\prime},q^{\prime}}\tilde{d}(p^{\prime},q^{\prime}). \triangleright p,qp,q minimizes d~\tilde{d}
28 dd~(p,q)+i=1Tdid\leftarrow\tilde{d}(p,q)+\sum_{i=1}^{T}d_{i}.
29 
30 end if
return (p,q)(p,q), ll, dd
Algorithm 2 FindLongestSubstring

We have the following Lemma.

Lemma 6.4.

Let (p,q),l,d(p,q),l,d be the output of 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} with input x,y,u,sx,y,u,s. Then assume l0l^{0} is the largest integer such that there is a substring of yy, say y[p0:q0]y[p^{0}:q^{0}], with 𝖤𝖣(x[1:l0],y[p0:q0])u\mathsf{ED}(x[1:l^{0}],y[p^{0}:q^{0}])\leq u. Then, we have ll0l\geq l^{0}. Also, assume y[p:q]y[p^{*}:q^{*}] is the substring of yy that is closest to x[1:l]x[1:l] in edit distance. We have

𝖤𝖣(x[1:l],y[p:q])𝖤𝖣(x[1:l],y[p:q])dc(u,s)𝖤𝖣(x[1:l],y[p:q]).\mathsf{ED}(x[1:l],y[p^{*}:q^{*}])\leq\mathsf{ED}(x[1:l],y[p:q])\leq d\leq c(u,s)\mathsf{ED}(x[1:l],y[p^{*}:q^{*}]). (26)

Here c(u,s)=2O(logsu)c(u,s)=2^{O(\log_{s}u)} if u>su>s and c=1c=1 if usu\leq s

Proof of Lemma 6.4.

In the following, we let (p,q),l,d(p,q),l,d be the output of 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} with input x,y,u,sx,y,u,s. We let l0l^{0} be the largest integer such that there is a substring of yy, say y[p0:q0]y[p^{0}:q^{0}], with 𝖤𝖣(x[1:l0],y[p0:q0])u\mathsf{ED}(x[1:l^{0}],y[p^{0}:q^{0}])\leq u and y[p:q]y[p^{*}:q^{*}] is the substring of yy that minimizes the edit distance to x[1:l]x[1:l].

𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} first compares uu and ss. If usu\leq s, we first set l=ul^{\prime}=u, then we know for any p,q[n]p,q\in[n] such that qp+1=uq-p+1=u , 𝖤𝖣(x[1:l],y[p,q])u\mathsf{ED}(x[1:l^{\prime}],y[p,q])\leq u since we can transform x[1:l]x[1:l^{\prime}] to y[p:q]y[p:q] with uu substitutions. Thus, we are guaranteed to find such a pair (p,q)(p,q) and we can record the edit operation that transform y[p:q]y[p:q] to x[1:l]x[1:l]. We set l=ll=l^{\prime}, d=𝖤𝖣(x[1:l],y[p:q])d=\mathsf{ED}(x[1:l^{\prime}],y[p:q]) and continue with ll+1l^{\prime}\leftarrow l^{\prime}+1. When l>ul^{\prime}>u (l=l1l=l^{\prime}-1). we may not be able to store x[1:l]x[1:l] in the memory for random access since our algorithm uses at most O(slogn)O(s\log n) bits of space. However, we have remembered a pair of indices (p,q)(p,q) and at most uu edit operations that can transform y[p:q]y[p:q] to x[1:l]x[1:l]. This allows us to query each bit of x[1:l]x[1:l] from left to right once with O(u+l)O(u+l) time. Thus, for each substring y[p:q]y[p:q] of y, we can compute its edit distance from x[1:l]x[1:l^{\prime}]. Once we find such a substring with 𝖤𝖣(x[1:l],y[p:q])u\mathsf{ED}(x[1:l^{\prime}],y[p:q])\leq u, by Claim 6.1, we can then compute the edit operations that transfom y[p,q]y[p,q] to x[1:l]x[1:l^{\prime}] with O(ulogn)O(u\log n) space. Thus, if usu\leq s, we can find the largest integer ll such that there is a substring of yy, denoted by y[p:q]y[p:q], with 𝖤𝖣(x[1:l],y[p:q])=u\mathsf{ED}(x[1:l],y[p:q])=u with O(slogn)O(s\log n) bits of space. If there is no substring y[p:q]y[p:q] with 𝖤𝖣(x[1:l],y[p:q])u\mathsf{ED}(x[1:l^{\prime}],y[p:q])\leq u, we terminate the procedure and return current (p,q)(p,q), ll, and dd.

If l0>ll^{0}>l, then x[1:l+1]x[1:l+1] is a substring of x[1:l0]x[1:l^{0}], we can find a substring of y[p0:q0]y[p^{0}:q^{0}] such that its edit distance to x[1:l+1]x[1:l+1] is at most uu. Thus, 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} will not terminate at ll. We must have l=l0l=l^{0}.

Also notice that when usu\leq s, we always do exact computation. y[p:q]y[p:q] is the substring in yy that minimizes the edit distance to x[1:l]x[1:l]. Thus, Lemma 6.4 is correct when usu\leq s.

For the case u>su>s, 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} needs to call itself recursively. Notice that each time the algorithm calls itself and enters the next level, the upper bound of edit distance uu is reduced by a factor ss. The recursion ends when usu\leq s. Thus, we denote the depth of recursion by dd, where d=O(logsu)d=O(\log_{s}u). We assume the algoirthm starts from level 1 and at level ii for idi\leq d, the upper bound of edit distance becomes usi1\frac{u}{s^{i-1}}.

We prove the Lemma by induction on the depth of recursion. The base case of the induction is when usu\leq s, for which we have shown the correctness of Lemma 6.4. We now assume Lemma 6.4 holds when the input is x,y,u/s,sx,y,\lceil u/s\rceil,s for any strings x,yx,y.

We first show ll0l\geq l^{0}. Notice that the while loop at line 2 terminates when either ai>|x|a_{i}>|x| or i>si>s. If ai>|x|a_{i}>|x|, we know ll is set to be ai1=|x|a_{i}-1=|x|. Since l0|x|l^{0}\leq|x| by definition. We must have ll0l\geq l^{0}.

If the while loop terminates when i>si>s. By the definition of l0l^{0}, we know x[1:l0]x[1:l^{0}] and y[p0:q0]y[p^{0}:q^{0}] can be divided into ss blocks, say,

x[1:l0]=x[1:l10]x[l10+1:l10+l20]x[i=1s1li0+1:i=1sli0]\displaystyle x[1:l^{0}]=x[1:l^{0}_{1}]\circ x[l^{0}_{1}+1:l^{0}_{1}+l^{0}_{2}]\circ\cdots\circ x[\sum_{i=1}^{s-1}l^{0}_{i}+1:\sum_{i=1}^{s}l^{0}_{i}]
y[p0:q0]=y[p10:q10]y[p20:q20]y[ps0:qs0]\displaystyle y[p^{0}:q^{0}]=y[p^{0}_{1}:q^{0}_{1}]\circ y[p^{0}_{2}:q^{0}_{2}]\circ\cdots\circ y[p^{0}_{s}:q^{0}_{s}]

where l0=i=1sli0l^{0}=\sum_{i=1}^{s}l^{0}_{i}, such that

𝖤𝖣(x[j=1i1lj0+1:j=1ilj0],y[pi0:qi0])u/s,i[s].\mathsf{ED}(x[\sum_{j=1}^{i-1}l^{0}_{j}+1:\sum_{j=1}^{i}l^{0}_{j}],y[p^{0}_{i}:q^{0}_{i}])\leq\lceil u/s\rceil,\;\forall i\in[s].

For convenience, we denote bi0=j=1ilj0b^{0}_{i}=\sum_{j=1}^{i}l^{0}_{j} and bi=j=1iljb_{i}=\sum_{j=1}^{i}l_{j}. By the defintion, we know bs0=l0b^{0}_{s}=l^{0} and bs=lb_{s}=l and all li0,lil^{0}_{i},l_{i} are non-negative. We have bi=ai+11b_{i}=a_{i+1}-1.

We show that bibi0b_{i}\geq b^{0}_{i} for all i[s]i\in[s] by induction on ii. For the base case i=1i=1, let l¯10\bar{l}^{0}_{1} be the largest integer such that there is a substring of yy within edit distance u/s\lceil u/s\rceil to x[1:l¯10]x[1:\bar{l}^{0}_{1}]. We know l¯10l10\bar{l}^{0}_{1}\geq l^{0}_{1}. Since we assume Lemma 6.4 holds for inputs x,y,u/s,sx,y,\lceil u/s\rceil,s, we know l1l¯10l_{1}\geq\bar{l}^{0}_{1}. Thus, l1l10l_{1}\geq l^{0}_{1} and b1b10b_{1}\geq b^{0}_{1}. Now assume bibi0b_{i}\geq b^{0}_{i} holds for some i[s1]i\in[s-1], we show that bi+1bi+10b_{i+1}\geq b^{0}_{i+1}. If bibi+10b_{i}\geq b^{0}_{i+1}, bi+1bi+10b_{i+1}\geq b^{0}_{i+1} holds. We can assume bi+10>bibi0b^{0}_{i+1}>b_{i}\geq b^{0}_{i}. We show that li+1bi+10bil_{i+1}\geq b^{0}_{i+1}-b_{i}. To see this, let l¯i0\bar{l}^{0}_{i} be the largest integer such that there is a substring of yy within edit distance u/s\lceil u/s\rceil to x[bi+1:bi+l¯i+10]x[b_{i}+1:b_{i}+\bar{l}^{0}_{i+1}]. We know li+1l¯i+10l_{i+1}\geq\bar{l}^{0}_{i+1} since we assume Lemma 6.4 holds for inputs x[bi+1:|x|],y,u/s,sx[b_{i}+1:|x|],y,\lceil u/s\rceil,s. Notice that 𝖤𝖣(x[bi0+1:bi+10],y[pi0,qi0])u/s\mathsf{ED}(x[b^{0}_{i}+1:b^{0}_{i+1}],y[p^{0}_{i},q^{0}_{i}])\leq\lceil u/s\rceil, we know l¯i0\bar{l}^{0}_{i} is at least bi+10bib^{0}_{i+1}-b_{i} since x[bi+1:bi+10]x[b_{i}+1:b^{0}_{i+1}] is a substring of x[bi0+1:bi+10]x[b^{0}_{i}+1:b^{0}_{i+1}]. We know li+1l¯i+10bi+10bil_{i+1}\geq\bar{l}^{0}_{i+1}\geq b^{0}_{i+1}-b_{i}. Thus, bi+1=bi+li+1bi+10b_{i+1}=b_{i}+l_{i+1}\geq b^{0}_{i+1}. Thus, we must have ll0l\geq l_{0}.

We now prove inequality 26. After the while loop, the algorithm then finds a substring of yy, y[p:q]y[p:q], that minimizes d~(p,q)\tilde{d}(p^{\prime},q^{\prime}) where d~(p,q)\tilde{d}(p^{\prime},q^{\prime}) is a 1+ε1+\varepsilon approximation of 𝖤𝖣(y[p:q],y[p1:q1]y[p2:q2]y[pT:qT])\mathsf{ED}(y[p^{\prime}:q^{\prime}],y[p_{1}:q_{1}]\circ y[p_{2}:q_{2}]\circ\cdots\circ y[p_{T}:q_{T}]). For convenience, we denote

y~=y[p1:q1]y[p2:q2]y[pT:qT].\tilde{y}=y[p_{1}:q_{1}]\circ y[p_{2}:q_{2}]\circ\cdots\circ y[p_{T}:q_{T}].

Thus,

𝖤𝖣(y[p:q],y~)d~(p,q)(1+ε)𝖤𝖣(y[p:q],y~).\mathsf{ED}(y[p:q],\tilde{y})\leq\tilde{d}(p,q)\leq(1+\varepsilon)\mathsf{ED}(y[p^{*}:q^{*}],\tilde{y}). (27)

Let y[p¯j:q¯j]y[\bar{p}^{*}_{j}:\bar{q}^{*}_{j}] be the substring of yy that is closest to x[aj:aj+11]x[a_{j}:a_{j+1}-1] in edit distance. By the inductive hypothesis, we assume the output of 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀(x,y,u/s,s)\mathsf{FindLongestSubstring}(x,y,\lceil u/s\rceil,s) satisfies Lemma 6.4. We know

𝖤𝖣(x[aj:aj+11],y[p¯j:q¯j])\displaystyle\mathsf{ED}(x[a_{j}:a_{j+1}-1],y[\bar{p}^{*}_{j}:\bar{q}^{*}_{j}]) 𝖤𝖣(x[aj:aj+11],y[pj:qj])\displaystyle\leq\mathsf{ED}(x[a_{j}:a_{j+1}-1],y[p_{j}:q_{j}])
dj\displaystyle\leq d_{j} (28)
c(u/s,s)𝖤𝖣(x[aj:aj+11],y[p¯j:q¯j]).\displaystyle\leq c(u/s,s)\mathsf{ED}(x[a_{j}:a_{j+1}-1],y[\bar{p}^{*}_{j}:\bar{q}^{*}_{j}]).

By the optimality of y[p:q]y[p^{*}:q^{*}] and triangle inequality, we have

𝖤𝖣(x[1:l],y[p:q])\displaystyle\mathsf{ED}(x[1:l],y[p^{*}:q^{*}]) 𝖤𝖣(x[1:l],y[p:q])\displaystyle\leq\mathsf{ED}(x[1:l],y[p:q])
𝖤𝖣(x[1:l],y~)+𝖤𝖣(y~,y[p:q])\displaystyle\leq\mathsf{ED}(x[1:l],\tilde{y})+\mathsf{ED}(\tilde{y},y[p:q]) By triangle inequality
i=1Tdi+d~(p,q)\displaystyle\leq\sum_{i=1}^{T}d_{i}+\tilde{d}(p,q)
=d\displaystyle=d

Also notice that we can write y[p:q]=y[p1:q1]y[p2:q2]y[pT:qT]y[p^{*}:q^{*}]=y[p^{*}_{1}:q^{*}_{1}]\circ y[p^{*}_{2}:q^{*}_{2}]\circ\cdots\circ y[p^{*}_{T}:q^{*}_{T}] such that

𝖤𝖣(x[1:l],y[p:q])=i=1T𝖤𝖣(x[ai:ai+1+1],y[pi,qi]).\mathsf{ED}(x[1:l],y[p^{*}:q^{*}])=\sum_{i=1}^{T}\mathsf{ED}(x[a_{i}:a_{i+1}+1],y[p^{*}_{i},q^{*}_{i}]). (29)

We have

d\displaystyle d =i=1Tdj+d~(p,q)\displaystyle=\sum_{i=1}^{T}d_{j}+\tilde{d}(p,q)
i=1Tdi+(1+ε)𝖤𝖣(y~,y[p:q])\displaystyle\leq\sum_{i=1}^{T}d_{i}+(1+\varepsilon)\mathsf{ED}(\tilde{y},y[p^{*}:q^{*}]) By 27
i=1Tdi+(1+ε)(𝖤𝖣(x[1:l],y[p:q])+𝖤𝖣(x[1:l],y~))\displaystyle\leq\sum_{i=1}^{T}d_{i}+(1+\varepsilon)\Big{(}\mathsf{ED}(x[1:l],y[p^{*}:q^{*}])+\mathsf{ED}(x[1:l],\tilde{y})\Big{)} By triangle inequality
i=1Tdi+(1+ε)i=1T𝖤𝖣(x[ai:ai+11],y[pi:qi])\displaystyle\leq\sum_{i=1}^{T}d_{i}+(1+\varepsilon)\sum_{i=1}^{T}\mathsf{ED}(x[a_{i}:a_{i+1}-1],y[p^{*}_{i}:q^{*}_{i}])
+(1+ε)i=1T𝖤𝖣(x[ai:ai+11],y[pi:qi])\displaystyle\qquad+(1+\varepsilon)\sum_{i=1}^{T}\mathsf{ED}(x[a_{i}:a_{i+1}-1],y[p_{i}:q_{i}])
(1+ε)i=1T(2c(u/s,s)+1)𝖤𝖣(x[ai:ai+11],y[pi:qi])\displaystyle\leq(1+\varepsilon)\sum_{i=1}^{T}(2c(u/s,s)+1)\mathsf{ED}(x[a_{i}:a_{i+1}-1],y[p^{*}_{i}:q^{*}_{i}]) By 28
(1+ε)(2c(u/s,s)+1)𝖤𝖣(x[1:l],y[p:q])\displaystyle\leq(1+\varepsilon)(2c(u/s,s)+1)\mathsf{ED}(x[1:l],y[p^{*}:q^{*}]) By 29

We set c(u,s)=(1+ε)(2c(u/s,s)+1)c(u,s)=(1+\varepsilon)(2c(u/s,s)+1). Since we assume c(u/s,s)=2O(logs(u/s))c(u/s,s)=2^{O(\log_{s}(u/s))}, we know c(u,s)=2O(logsu)c(u,s)=2^{O(\log_{s}u)}. This proves inequality 26.

Lemma 6.5.

Given any x,yΣnx,y\in\Sigma^{n}, let u,snu,s\leq n, 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀(x,y,u,s)\mathsf{FindLongestSubstring}(x,y,u,s) runs in polynomial time. It queries xx from left to right in one pass and uses O(slogsupolylog(n))O(s\log_{s}u\;\operatorname{polylog}(n)) bits of extra space.

Proof of Lemma 6.5.

If usu\leq s, we need to store at most uu edit operations that transforms, y[p:q]y[p:q] to x[1:l]x[1:l] for current (p,q)(p,q) and ll. This takes O(ulogn)=O(slogn)O(u\log n)=O(s\log n) bits of space. Notice when lul\geq u, we do not need to remember x[1:l]x[1:l]. Instead, we query x[1:l]x[1:l] by looking at y[p:q]y[p:q] and the edit operations.

If usu\geq s, the algorithm is recursive. Let us consider the recursion tree. We assume the algoirthm starts from level 1 (root of the tree) and the depth of the recursion tree is dd. At level ii for idi\leq d, the upper bound of edit distance (third input to algorithm 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring}) is ui=usi1u_{i}=\frac{u}{s^{i-1}}. The recursion stops when uisu_{i}\leq s. Thus, the depth of recursion dd is O(logsu)O(\log_{s}u) by our assumption on uu and ss. The order of computation on the recursion tree is the same as depth-first search and we only need to query xx at the bottom level. There are at most sd=O(u)s^{d}=O(u) leaf nodes (nodes at the bottom level). For the ii-th leaf nodes of the recursion tree, we are computing 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀(x[ai:n],y,ud,s)\mathsf{FindLongestSubstring}(x[a_{i}:n],y,u_{d},s) with udsu_{d}\leq s where aia_{i} is the last position visited by the previous leaf node. Thus, we only need to access xx from left to right in one pass.

For each inner node, we need to remember ss pairs of indices (pi,qi)(p_{i},q_{i}) and ss integers did_{i} for i[s]i\in[s], which takes O(slogn)O(s\log n) space. For computing an (1+ε)(1+\varepsilon)-approximation of d~(p,q)\tilde{d}(p^{\prime},q^{\prime}), we can use the space-efficient approximation algorithm from [CJLZ20] that uses only polylog(n)\operatorname{polylog}(n) space. Thus, each inner node takes O(spolylog(n))O(s\;\operatorname{polylog}(n)) bits of space. For the leaf nodes, we have usu\leq s. Thus, we can compute it with O(slogn)O(s\log n) bits of extra memory. Since the order of computation is the same as depth-first search, we only need to maintain one node in each recursive level and we can reuse the space for those nodes we have already explored. Since the depth of recursion is O(logsu)O(\log_{s}u), the total space required is O(slogsupolylog(n))O(s\log_{s}u\;\operatorname{polylog}(n)).

For the time complexity, notice that the space efficient algorithm for 1+ε1+\varepsilon approximating 𝖤𝖣\mathsf{ED} takes polynomial time. The depth of recursion is O(logsu)O(\log_{s}u) and at each recursive level, the number of nodes is polynomial in nn , we need to try O(n2)O(n^{2}) different p,qp^{\prime},q^{\prime} at each node except the leaf nodes. Thus, the running time is still polynomial.

We now present our algorithm for approximating edit distance in the asymmetric streaming model. The pseudocode of our algorithm is given in algorithm 3. It takes three input, an online string xx, an offline string yy and a parametert δ(0,1/2]\delta\in(0,1/2].

Input: Two strings: xΣx\in\Sigma^{*} and yΣny\in\Sigma^{n}, a constant δ(0,1/2]\delta\in(0,1/2]
Output: An estimation of 𝖤𝖣(x,y)\mathsf{ED}(x,y)
1 initialize a1a\leftarrow 1, i1i\leftarrow 1.
2
3set kk to be a large constant such that s=kδs=k^{\delta} is an integer.
4 while ana\leq n  do
5 (pi,qi),li,di𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀(x[a:n],y,k/s,s)(p_{i},q_{i}),l_{i},d_{i}\leftarrow\mathsf{FindLongestSubstring}(x[a:n],y,k/s,s).
6 aa+lia\leftarrow a+l_{i}.
7 ii+1i\leftarrow i+1.
8 if ikδi\geq k^{\delta} then
9    k21/δk.k\leftarrow 2^{1/\delta}k.
10    skδs\leftarrow k^{\delta}.
11    
12   end if
13 
14 end while
15Ti1T\leftarrow i-1.
16 compute d~\tilde{d}, an (1+ε)(1+\varepsilon)-approximation of 𝖤𝖣(y,y[p1,q1]y[p2,q2]y[pT,qT])\mathsf{ED}(y,y[p_{1},q_{1}]\circ y[p_{2},q_{2}]\circ\cdots\circ y[p_{T},q_{T}]). \triangleright Using the algorithm guaranteed by Lemma 6.3
17
18return d¯=d~+i=1Tdi\bar{d}=\tilde{d}+\sum_{i=1}^{T}d_{i}
Algorithm 3 Approximate edit distance in asymmetric streaming model
Lemma 6.6.

Assume d=𝖤𝖣(x,y)d=\mathsf{ED}(x,y), Algorithm 3 can be run with O(dδδpolylog(n))O(\frac{d^{\delta}}{\delta}\operatorname{polylog}(n)) bits of space in polynomial time.

Proof.

Notice that kk is initially set to be a constant k0k_{0} such that s0=k0δs_{0}=k^{\delta}_{0} is an integer. kk is multiplied by 21/δ2^{1/\delta} whenever iki\geq k. We assume that in total, kk is updated uu times and after the jj-th update, k=kjk=k_{j}, where kj=21/δkj1k_{j}=2^{1/\delta}k_{j-1}. We let sj=kjδs_{j}=k^{\delta}_{j}. Thus, kj+1δ=2kjδk^{\delta}_{j+1}=2k^{\delta}_{j} and sj+1=2sjs_{j+1}=2s_{j}. We denote the aa before ii-th while loop by aia_{i} so that a1=1a_{1}=1 and ai=1+j=1i1lja_{i}=1+\sum_{j=1}^{i-1}l_{j} for 1<iT1<i\leq T.

We first show the following claim.

Claim 6.2.

kuδ8dδ.k^{\delta}_{u}\leq 8d^{\delta}.

Proof.

Assume the contrary, we have kuδ>8dδk^{\delta}_{u}>8d^{\delta}, and thus ku1δ>4dδk^{\delta}_{u-1}>4d^{\delta}.

Let i0=ku2δi_{0}=k^{\delta}_{u-2}. That is, after ii is updated to i0i_{0}, kk is updated from ku2k_{u-2} to ku1k_{u-1}. For convenience, we denote x¯=x[ai0:n]\bar{x}=x[a_{i_{0}}:n]. Since 𝖤𝖣(x,y)d\mathsf{ED}(x,y)\leq d, there is a substring of yy, say y¯\bar{y}, such that 𝖤𝖣(x¯,y¯)d\mathsf{ED}(\bar{x},\bar{y})\leq d. Let ξ=ku1su1\xi=\frac{k_{u-1}}{s_{u-1}}, by Lemma 6.2, we can partition x¯\bar{x} and y¯\bar{y} each into d/ξ\lceil d/\xi\rceil parts such that

x¯=x¯1x¯2x¯d/ξ,\displaystyle\bar{x}=\bar{x}^{1}\circ\bar{x}^{2}\circ\cdots\circ\bar{x}^{\lceil d/\xi\rceil},
y¯=y¯1y¯2y¯d/ξ,\displaystyle\bar{y}=\bar{y}^{1}\circ\bar{y}^{2}\circ\cdots\circ\bar{y}^{\lceil d/\xi\rceil},

and 𝖤𝖣(x¯j,y¯j)ξ\mathsf{ED}(\bar{x}^{j},\bar{y}^{j})\leq\xi for j[d/ξ]j\in[\lceil d/\xi\rceil]. We denote x¯j=x[βj:γj]\bar{x}^{j}=x[\beta_{j}:\gamma_{j}] for j[d/ξ]j\in[\lceil d/\xi\rceil] so that x¯j\bar{x}^{j} starts with βj\beta_{j}-th symbol and ends with γj\gamma_{j}-th symbol of xx. We have β1=ai0\beta_{1}=a_{i_{0}} and γi+1=βi+1\gamma_{i}+1=\beta_{i+1}.

We first show that for i0iTi_{0}\leq i\leq T, aiβii0+1a_{i}\geq\beta_{i-i_{0}+1}. Assume there is some ii such that aiβii0+1a_{i}\geq\beta_{i-i_{0}+1} and ai+1<βii0+2a_{i+1}<\beta_{i-i_{0}+2}. By Lemma 6.4, lil_{i} is at least the largest integer ll such that there is a substring of yy within edit distance ξ\xi to x[ai:ai+l1]x[a_{i}:a_{i}+l-1]. Since x[ai:ai+11]=x[ai:ai+li1]x[a_{i}:a_{i+1}-1]=x[a_{i}:a_{i}+l_{i}-1] is a substring of x[βii0+1:γii0+1]=x¯ii0+1x[\beta_{i-i_{0}+1}:\gamma_{i-i_{0}+1}]=\bar{x}^{i-i_{0}+1} and 𝖤𝖣(x¯ii0+1,y¯ii0+1)ξ\mathsf{ED}(\bar{x}^{i-i_{0}+1},\bar{y}^{i-i_{0}+1})\leq\xi. There is a substring of yy within edit distance ξ\xi to x[ai:γii0+1]x[a_{i}:\gamma_{i-i_{0}+1}]. Thus, we must have liγii0+1ai+1l_{i}\geq\gamma_{i-i_{0}+1}-a_{i}+1. Thus ai+1=ai+liγii0+1+1=βii0+2a_{i+1}=a_{i}+l_{i}\geq\gamma_{i-i_{0}+1}+1=\beta_{i-i_{0}+2}. This is contradictory to our assumption that ai+1<βii0+2a_{i+1}<\beta_{i-i_{0}+2}.

We now show that Ti0+d/ξ1T\leq i_{0}+\lceil d/\xi\rceil-1. If T>i0+d/ξT>i_{0}+\lceil d/\xi\rceil, we have ai0+d/ξ1βd/ξa_{i_{0}+\lceil d/\xi\rceil-1}\geq\beta_{\lceil d/\xi\rceil}. By Lemma 6.4, we must have ai0+d/ξ=n+1a_{i_{0}+\lceil d/\xi\rceil}=n+1. Since ai0+d/ξ>na_{i_{0}+\lceil d/\xi\rceil}>n, we will terminate the while loop and set T=i0+d/ξ1T=i_{0}+\lceil d/\xi\rceil-1. Thus, we have Ti0+d/ξ1T\leq i_{0}+\lceil d/\xi\rceil-1.

Meanwhile, by the assumption that ku1δ>4dδk^{\delta}_{u-1}>4d^{\delta}, we have ku1δku2δ=ku2δ>2dδ>2d/ξk^{\delta}_{u-1}-k^{\delta}_{u-2}=k^{\delta}_{u-2}>2d^{\delta}>2d/\xi. If kk is updated uu times, TT is at least ku1δ1k^{\delta}_{u-1}-1. Thus, Tku1δ1>i0+2d/ξ1T\geq k^{\delta}_{u-1}-1>i_{0}+2d/\xi-1. This is contradictory to Ti0+d/ξ1T\leq i_{0}+\lceil d/\xi\rceil-1. ∎

By the above claim, we have T=O(dδ)T=O(d^{\delta}). Thus, we can remember all (pi,qi),li,di(p_{i},q_{i}),l_{i},d_{i} for i[T]i\in[T] with O(dδlogn)O(d^{\delta}\log n) bits of space. For convenience, let y~=y[p1:q1]y[p2:q2]y[pT:qT]\tilde{y}=y[p_{1}:q_{1}]\circ y[p_{2}:q_{2}]\circ\cdots\circ y[p_{T}:q_{T}]. We can use the space efficient algorithm from [CJLZ20] (Lemma 6.3) to compute a (1+ε)(1+\varepsilon)-approximation of 𝖤𝖣(y,y~)\mathsf{ED}(y,\tilde{y}) with polylog(n)\operatorname{polylog}(n) bits of space in polynomial time. By Lemma 6.5, we can run 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} with O(dδδpolylog(n))O(\frac{d^{\delta}}{\delta}\operatorname{polylog}(n)) space since s=O(dδ)s=O(d^{\delta}). The total amount of space used is O(dδδpolylog(n))O(\frac{d^{\delta}}{\delta}\operatorname{polylog}(n)).

We run 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} O(dδ)O(d^{\delta}) times and compute a (1+ε)(1+\varepsilon)-approximation of 𝖤𝖣(y,y~)\mathsf{ED}(y,\tilde{y}) with polynomial time. The total running time is still a polynomial. ∎

Lemma 6.7.

Assume 𝖤𝖣(x,y)=d\mathsf{ED}(x,y)=d, there is a one pass deterministic algorithm that outputs a (3+ε)(3+\varepsilon)-approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y) in asymmetric streaming model, with O(dpolylog(n))O(\sqrt{d}\;\operatorname{polylog}(n)) bits of space in polynomial time.

Proof of Lemma 6.7.

We run algorithm 3 with parameter δ=1/2\delta=1/2. The time and space complexity follows from Lemma 6.6.

Notice that algorithm 3 executes 𝖥𝗂𝗇𝖽𝖫𝗈𝗇𝗀𝖾𝗌𝗍𝖲𝗎𝖻𝗌𝗍𝗋𝗂𝗇𝗀\mathsf{FindLongestSubstring} TT times and records TT outputs (pi,qi),li,di(p_{i},q_{i}),l_{i},d_{i} for i[T]i\in[T]. We also denote ai=1+j=1i1lja_{i}=1+\sum_{j=1}^{i-1}l_{j} with a1=1a_{1}=1. Thus, we can partition xx into TT parts such that

x=x1x2xTx=x^{1}\circ x^{2}\circ\cdots\circ x^{T}

where xi=x[ai:ai+11]x^{i}=x[a_{i}:a_{i+1}-1]. Since s=k1/2=k/ss=k^{1/2}=k/s, by Lemma 6.4, we know 𝖤𝖣(xi,y[pi:qi])=di\mathsf{ED}(x^{i},y[p_{i}:q_{i}])=d_{i}.

We now show that the output d¯=d~+i=1Tdi\bar{d}=\tilde{d}+\sum_{i=1}^{T}d_{i} is a 3+ε3+\varepsilon approximation of d=𝖤𝖣(x,y)d=\mathsf{ED}(x,y). Let y~=y[p1:q1]y[p2:q2]y[pT:qT]\tilde{y}=y[p_{1}:q_{1}]\circ y[p_{2}:q_{2}]\circ\cdots\circ y[p_{T}:q_{T}]. Notice that 𝖤𝖣(x,y~)i=1T𝖤𝖣(xi,y[pi:qi])\mathsf{ED}(x,\tilde{y})\leq\sum_{i=1}^{T}\mathsf{ED}(x^{i},y[p_{i}:q_{i}]) and 𝖤𝖣(y~,y)d~\mathsf{ED}(\tilde{y},y)\leq\tilde{d}. We have

𝖤𝖣(x,y)\displaystyle\mathsf{ED}(x,y) 𝖤𝖣(x,y~)+𝖤𝖣(y~,y)\displaystyle\leq\mathsf{ED}(x,\tilde{y})+\mathsf{ED}(\tilde{y},y) By triangle inequality
d~+i=1Tdi\displaystyle\leq\tilde{d}+\sum_{i=1}^{T}d_{i}
=d¯\displaystyle=\bar{d}

On the other hand, we can divide yy into TT parts such that y=y^1y^2y^Ty=\hat{y}^{1}\circ\hat{y}^{2}\circ\cdots\circ\hat{y}^{T} and guarantee that

𝖤𝖣(x,y)=i=1T𝖤𝖣(xi,y^i).\mathsf{ED}(x,y)=\sum_{i=1}^{T}\mathsf{ED}(x^{i},\hat{y}^{i}). (30)

Also, by Lemma 6.4, y[pi:qi]y[p_{i}:q_{i}] is the substring of yy that is closest to xix^{i} in edit distance, we know

𝖤𝖣(xi,y^i)𝖤𝖣(xi,y[pi:qi]).\mathsf{ED}(x^{i},\hat{y}^{i})\geq\mathsf{ED}(x^{i},y[p_{i}:q_{i}]). (31)

We have

d¯\displaystyle\bar{d} =d~+i=1Tdi\displaystyle=\tilde{d}+\sum_{i=1}^{T}d_{i}
(1+ε)𝖤𝖣(y,y~)+i=1T𝖤𝖣(xi,y[pi:qi])\displaystyle\leq(1+\varepsilon)\mathsf{ED}(y,\tilde{y})+\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},y[p_{i}:q_{i}]\big{)}
(1+ε)(𝖤𝖣(y,x)+𝖤𝖣(y~,x))+i=1T𝖤𝖣(xi,y[pi:qi])\displaystyle\leq(1+\varepsilon)\Big{(}\mathsf{ED}(y,x)+\mathsf{ED}(\tilde{y},x)\Big{)}+\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},y[p_{i}:q_{i}]\big{)}
(1+ε)i=1T𝖤𝖣(xi,y^i)+(2+ε)i=1T𝖤𝖣(xi,y[pi:qi])\displaystyle\leq(1+\varepsilon)\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},\hat{y}^{i}\big{)}+(2+\varepsilon)\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},y[p_{i}:q_{i}]\big{)} By 30
(3+2ε)i=1T𝖤𝖣(xi,y^i)\displaystyle\leq(3+2\varepsilon)\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},\hat{y}^{i}\big{)} By 31
=(3+2ε)𝖤𝖣(x,y).\displaystyle=(3+2\varepsilon)\mathsf{ED}(x,y).

Since we can pick ε\varepsilon to be any constant, we pick ε=2ε\varepsilon^{\prime}=2\varepsilon and the output dd is indeed a 3+ε3+\varepsilon^{\prime} approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y). ∎

Lemma 6.8.

Assume 𝖤𝖣(x,y)=d\mathsf{ED}(x,y)=d, for any constant δ(0,1/2)\delta\in(0,1/2), there is an algorithm that outputs a 2O(1δ)2^{O(\frac{1}{\delta})}-approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y) with O(dδδpolylog(n))O(\frac{d^{\delta}}{\delta}\operatorname{polylog}(n)) bits of space in polynomial time in the asymmetric streaming model.

Proof of Lemma 6.8.

We run algorithm 3 with parameter δ(0,1/2)\delta\in(0,1/2). Without loss of generality,we can assume 1/δ1/\delta is an integer. The time and space complexity follows from Lemma 6.6.

Again we can divide xx into TT parts such that xi=x[ai:ai+11]x^{i}=x[a_{i}:a_{i+1}-1] where ai=1+j=1i1lja_{i}=1+\sum_{j=1}^{i-1}l_{j}. By Lemma 6.4, we have 𝖤𝖣(xi,y[pi:qi])di\mathsf{ED}(x^{i},y[p_{i}:q_{i}])\leq d_{i}.

Let y=y^1y^2y^Ty=\hat{y}^{1}\circ\hat{y}^{2}\circ\cdots\circ\hat{y}^{T} be a partition of yy such that

𝖤𝖣(x,y)=i=1T𝖤𝖣(xi,y^i).\mathsf{ED}(x,y)=\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},\hat{y}^{i}\big{)}.

We now show that d¯\bar{d} is a 2O(1/δ)2^{O(1/\delta)} approximation of d=𝖤𝖣(x,y)d=\mathsf{ED}(x,y). Similarly, we let y~=y[p1:q1]y[p2:q2]y[pT:qT]\tilde{y}=y[p_{1}:q_{1}]\circ y[p_{2}:q_{2}]\circ\cdots\circ y[p_{T}:q_{T}]. We have

𝖤𝖣(x,y)\displaystyle\mathsf{ED}(x,y) 𝖤𝖣(x,y~)+𝖤𝖣(y~,y)\displaystyle\leq\mathsf{ED}(x,\tilde{y})+\mathsf{ED}(\tilde{y},y) By triangle inequality
d~+i=1Tdi\displaystyle\leq\tilde{d}+\sum_{i=1}^{T}d_{i}
=d¯\displaystyle=\bar{d}

Let y[pi:qi]y[p^{*}_{i}:q^{*}_{i}] be the substring of yy that is closest to xix^{i} in edit distance. By Lemma 6.4, we know

𝖤𝖣(xi,y[pi:qi])𝖤𝖣(xi,y[pi:qi])c𝖤𝖣(xi,y[pi:qi])\mathsf{ED}(x^{i},y[p^{*}_{i}:q^{*}_{i}])\leq\mathsf{ED}(x^{i},y[p_{i}:q_{i}])\leq c\mathsf{ED}(x^{i},y[p^{*}_{i}:q^{*}_{i}]) (32)

where c=2O(logs(k1δ))=2O(1/δ)c=2^{O(\log_{s}(k^{1-\delta}))}=2^{O(1/\delta)}. Thus, we have

𝖤𝖣(xi,y[pi:qi])c𝖤𝖣(xi,y[pi:qi])c𝖤𝖣(xi,y^i).\mathsf{ED}\big{(}x^{i},y[p_{i}:q_{i}]\big{)}\leq c\mathsf{ED}(x^{i},y[p^{*}_{i}:q^{*}_{i}])\leq c\mathsf{ED}\big{(}x^{i},\hat{y}^{i}\big{)}. (33)

Thus, we can get a similar upper bound of d¯\bar{d} by

d¯\displaystyle\bar{d} =d~+i=1Tdi\displaystyle=\tilde{d}+\sum_{i=1}^{T}d_{i}
(1+ε)𝖤𝖣(y,y~)+i=1T𝖤𝖣(xi,y[pi:qi])\displaystyle\leq(1+\varepsilon)\mathsf{ED}(y,\tilde{y})+\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},y[p_{i}:q_{i}]\big{)}
(1+ε)(𝖤𝖣(y,x)+𝖤𝖣(y~,x))+i=1T𝖤𝖣(xi,y[pi:qi])\displaystyle\leq(1+\varepsilon)\Big{(}\mathsf{ED}(y,x)+\mathsf{ED}(\tilde{y},x)\Big{)}+\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},y[p_{i}:q_{i}]\big{)}
(1+ε)(1+2c)i=1T𝖤𝖣(xi,y^i)\displaystyle\leq(1+\varepsilon)(1+2c)\sum_{i=1}^{T}\mathsf{ED}\big{(}x^{i},\hat{y}^{i}\big{)} By 33
=2O(1/δ)𝖤𝖣(x,y).\displaystyle=2^{O(1/\delta)}\mathsf{ED}(x,y).

This finishes the proof. ∎

6.2 Algorithm for LCS

We show that the algorithm presented in [RS20] for approximating 𝖫𝖢𝖲\mathsf{LCS} to (1/2+ε)(1/2+\varepsilon) factor can be slightly modified to work in the asymmetric streaming model. The following is a restatement of Theorem 6

Theorem 17 (Restatement of Theorem 6).

Given two strings x,y{0,1}nx,y\in\{0,1\}^{n}, for any constant δ(0,1/2)\delta\in(0,1/2), there exists a constant ε>0\varepsilon>0, such that there is a one-pass deterministic algorithm that outputs a 2ε2-\varepsilon approximation of 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) with O~(nδ/δ)\tilde{O}(n^{\delta}/\delta) bits of space in the asymmetric streaming model in polynomial time.

The algorithm from [RS20] uses four algorithms as ingredients 𝖬𝖺𝗍𝖼𝗁\mathsf{Match}, 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁\mathsf{BestMatch}, 𝖦𝗋𝖾𝖾𝖽𝗒\mathsf{Greedy}, 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣\mathsf{ApproxED}. We give a description here and show why they can be modified to work in the asymmetric streaming model.

Algorithm 𝖬𝖺𝗍𝖼𝗁\mathsf{Match} takes three inputs: two strings x,yΣx,y\in\Sigma^{*} and a symbol σΣ\sigma\in\Sigma. Let σ(x)\sigma(x) be the number of symbol σ\sigma in string xx and we similarly define σ(y)\sigma(y). 𝖬𝖺𝗍𝖼𝗁(x,y,σ)\mathsf{Match}(x,y,\sigma) computes the length of longest common subsequence between xx and yy that consists of only σ\sigma symbols. Thus, 𝖬𝖺𝗍𝖼𝗁(x,y,σ)=min(σ(x),σ(y))\mathsf{Match}(x,y,\sigma)=\min(\sigma(x),\sigma(y)).

Algorithm 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁\mathsf{BestMatch} takes two strings x,yΣx,y\in\Sigma^{*} as inputs. It is defined as 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x,y)=maxσΣ𝖬𝖺𝗍𝖼𝗁(x,y,σ)\mathsf{BestMatch}(x,y)=\max_{\sigma\in\Sigma}\mathsf{Match}(x,y,\sigma).

Algorithm 𝖦𝗋𝖾𝖾𝖽𝗒\mathsf{Greedy} takes three strings x1,x2,yΣx^{1},x^{2},y\in\Sigma^{*} as inputs. It finds the optimal partition y=y1y2y=y^{1}\circ y^{2} that maximizes 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x1,y1)+𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x2,y2)\mathsf{BestMatch}(x^{1},y^{1})+\mathsf{BestMatch}(x^{2},y^{2}). The output is 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x1,y1)+𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x2,y2)\mathsf{BestMatch}(x^{1},y^{1})+\mathsf{BestMatch}(x^{2},y^{2}) and y1,y2y^{1},y^{2}.

Algorithm 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣\mathsf{ApproxED} takes two strings x,yΣnx,y\in\Sigma^{n} as inputs. Here we require the input strings have equal length. 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣\mathsf{ApproxED} first computes a constant approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y), denoted by 𝖤𝖣~(x,y)\tilde{\mathsf{ED}}(x,y). The output is n𝖤𝖣~(x,y)n-\tilde{\mathsf{ED}}(x,y).

In the following, we assume Σ={0,1}\Sigma=\{0,1\} and input strings to the main algorithm x,yx,y both have length nn. All functions are normalized with respect to nn. Thus, we have 1(x)1(x),0(x)0(x),𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y), 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣(x,y)(0,1)\mathsf{ApproxED}(x,y)\in(0,1).

The algorithm first reduce the input to the perfectly unbalanced case.

We first introduce a few parameters.

α=min{1(x),1(y),0(x),0(y)}\alpha=\min\{1(x),1(y),0(x),0(y)\}.

β=θ(α)\beta=\theta(\alpha) is a constant. It can be smaller than α\alpha by an arbitrary constant factor.

γ(0,1)\gamma\in(0,1) is a parameter that depends on the accuracy of the approximation algorithm for 𝖤𝖣(x,y)\mathsf{ED}(x,y) we assume.

Definition 6.1 (Perfectly unbalanced).

We say two string x,yΣnx,y\in\Sigma^{n} are perfectly unbalanced if

|1(x)0(y)|δα,\lvert 1(x)-0(y)\rvert\leq\delta\alpha, (34)

and

0(x)[1/2β,1/2+β].0(x)\notin[1/2-\beta^{\prime},1/2+\beta^{\prime}]. (35)

Here, we require δ\delta to be a sufficiently small constant such that δαβ\delta\alpha\leq\beta and β=10β\beta^{\prime}=10\beta.

To see why we only need to consider the perfectly unbalanced case, [RS20] proved the following two Lemmas.

Lemma 6.9.

If |1(x)0(y)|δδα\lvert 1(x)-0(y)\rvert\delta\leq\delta\alpha, then

𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x,y)(1/2+δ/2)𝖫𝖢𝖲(x,y).\mathsf{BestMatch}(x,y)\geq(1/2+\delta/2)\mathsf{LCS}(x,y).
Lemma 6.10.

Let β,γ>0\beta^{\prime},\gamma>0 be sufficiently small constants. If 0(x)[1/2β,1/2+β]0(x)\in[1/2-\beta^{\prime},1/2+\beta^{\prime}], then

max{𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x,y),𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣(x,y)}(1/2+γ)𝖫𝖢𝖲(x,y).\max\{\mathsf{BestMatch}(x,y),\mathsf{ApproxED}(x,y)\}\leq(1/2+\gamma)\mathsf{LCS}(x,y).

If the two input string are not perfectly unbalanced, we can compute 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x,y)\mathsf{BestMatch}(x,y) and 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣\mathsf{ApproxED} to get a 1/2+ε1/2+\varepsilon approximation fo 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) for some small constant ε>0\varepsilon>0.

Given two strings in the perfectly unbalanced case, without loss of generality, we assume 1(y)=α1(y)=\alpha. The algorithm first both strings x,yx,y into three parts such that x=LxMxRxx=L_{x}\circ M_{x}\circ R_{x} and y=LyMyRyy=L_{y}\circ M_{y}\circ R_{y} where |Lx|=|Rx|=|Ly|=|Ry|=αn\lvert L_{x}\rvert=\lvert R_{x}\rvert=\lvert L_{y}\rvert=\lvert R_{y}\rvert=\alpha n. Then, the inputs are divided into six cases according to the first order statistics (number of 0’s and 1’s) of LxL_{x}, RxR_{x}, LyL_{y}, RyR_{y}. For each case, we can use the four ingredient algorithms to get a (1/2+ε)(1/2+\varepsilon) approximation of 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) for some small constant ε\varepsilon. We refer readers to [RS20] for the pseudocode and analysis of the algorithm. We omit the details here.

We now prove Theorem 17.

Proof of Theorem 17.

As usual, we assume xx is the online string and yy is the offline string. If the two input strings are not perfectly unbalanced, we can compute 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(x,y)\mathsf{BestMatch}(x,y) in O(logn)O(\log n) space in the asymmetric streaming model since we only need to compare the first order statistics of xx and yy. Also, for any constant δ\delta we can compute a constant approximation (dependent on δ\delta) of 𝖤𝖣(x,y)\mathsf{ED}(x,y) using O~(nδ)\tilde{O}(n^{\delta}) space by Lemma 6.8. Thus, we only need to consider the case where xx and yy are perfectly balanced.

Notice that the algorithm from [RS20] needs to compute 𝖬𝖺𝗍𝖼𝗁\mathsf{Match}, 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁\mathsf{BestMatch}, 𝖦𝗋𝖾𝖾𝖽𝗒\mathsf{Greedy}, 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣\mathsf{ApproxED} with input strings chosen from xx, LxL_{x}, LxMxL_{x}\circ M_{x}, RxR_{x}, MxRxM_{x}\circ R_{x} and yy, LyL_{y}, LyMyL_{y}\circ M_{y}, RyR_{y}, MyRy.M_{y}\circ R_{y}.

If we know the number of 1’s and 0’s in Lx,MxL_{x},M_{x}, and RxR_{x}, then we can compute 𝖬𝖺𝗍𝖼𝗁\mathsf{Match} and 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁\mathsf{BestMatch} with any pair of input strings from xx, LxL_{x}, LxMxL_{x}\circ M_{x}, RxR_{x}, MxRxM_{x}\circ R_{x} and yy, LyL_{y}, LyMyL_{y}\circ M_{y}, RyR_{y}, MyRy.M_{y}\circ R_{y}..

For 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣\mathsf{ApproxED}, according to the algorithm in [RS20], we only need to compute 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣(x,y)\mathsf{ApproxED}(x,y), 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣(Lx,Ly)\mathsf{ApproxED}(L_{x},L_{y}), and 𝖠𝗉𝗉𝗋𝗈𝗑𝖤𝖣(Rx,Ry)\mathsf{ApproxED}(R_{x},R_{y}). For any constant δ>0\delta>0, we can get a constant approximation (dependent on δ\delta) of edit distance with O~(nδ)\tilde{O}(n^{\delta}) space in the asymmetric streaming model by Lemma 6.8.

For 𝖦𝗋𝖾𝖾𝖽𝗒\mathsf{Greedy}, there are two cases. For the first case, the online string xx is divided into two parts and the input strings are x1,x2,yx^{1},x^{2},y where x=x1x2x=x^{1}\circ x^{2}. Notice that x1x^{1} can only be LxL_{x} or LxMxL_{x}\circ M_{x}. In this case, we only need to remember 1(Lx)1(L_{x}), 1(Mx)1(M_{x}), and 1(Rx)1(R_{x}). Since the length of LxL_{x}, MxM_{x}, and RxR_{x} are all fixed. We know 0(Lx)=|Lx|1(Lx)0(L_{x})=\lvert L_{x}\rvert-1(L_{x}), and similar for MxM_{x} and RxR_{x}. We know for l[n]l\in[n]

𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(y[1:l],x1)+𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(y[l+1:n],x2)\displaystyle\mathsf{BestMatch}(y[1:l],x^{1})+\mathsf{BestMatch}(y[l+1:n],x^{2})
=\displaystyle= maxσ{0,1}𝖬𝖺𝗍𝖼𝗁(y[1:l],x1,σ)+maxσ{0,1}𝖬𝖺𝗍𝖼𝗁(y[l+1:n],x2,σ)\displaystyle\max_{\sigma\in\{0,1\}}\mathsf{Match}(y[1:l],x^{1},\sigma)+\max_{\sigma\in\{0,1\}}\mathsf{Match}(y[l+1:n],x^{2},\sigma)
=\displaystyle= maxσ{0,1}(min{σ(y[1:l]),σ(x1)})+maxσ{0,1}(min{σ(y[l+1:n]),σ(x2)})\displaystyle\max_{\sigma\in\{0,1\}}\big{(}\min\{\sigma(y[1:l]),\sigma(x^{1})\}\big{)}+\max_{\sigma\in\{0,1\}}\big{(}\min\{\sigma(y[l+1:n]),\sigma(x^{2})\}\big{)}

Given α=1(y)\alpha=1(y), we know 1(y[l+1:n])=α1(y[1:l])1(y[l+1:n])=\alpha-1(y[1:l]), 0(y[1:l])=l/n0(y[1:l])0(y[1:l])=l/n-0(y[1:l]), and 0(y[l+1:n])=(nl)/n0(y[l+1:n])0(y[l+1:n])=(n-l)/n-0(y[l+1:n]). Thus we only need to read yy from left to right once and remember the index ll that maximizes 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(y[1:l],x1)+𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(y[l+1:n],x2)\mathsf{BestMatch}(y[1:l],x^{1})+\mathsf{BestMatch}(y[l+1:n],x^{2}).

For the case when the input strings are y1,y2,xy^{1},y^{2},x, if we know 0(x)0(x), similarly, we can compute 𝖦𝗋𝖾𝖾𝖽𝗒(y1,y1,x)\mathsf{Greedy}(y^{1},y^{1},x) by reading xx from left to right once with O(logn)O(\log n) bits of space. Here, 0(x)0(x) is not known to us before computation. However, in the perfectly unbalanced case, we assume |1(y)0(x)|<δ|1(y)-0(x)|<\delta is a sufficiently small constant. We can simply assume 0(x)=1(y)=α0(x)=1(y)=\alpha and run 𝖡𝖾𝗌𝗍𝖬𝖺𝗍𝖼𝗁(y1,y2,x)\mathsf{BestMatch}(y^{1},y^{2},x) in the asymmetric streaming model. This will add an error of at most δ\delta. The algorithm still outputs a (1/2+ε)(1/2+\varepsilon) approximation of 𝖫𝖢𝖲(x,y)\mathsf{LCS}(x,y) for some small constant ε>0\varepsilon>0.

References

  • [ABW15] Amir Abboud, Arturs Backurs, and Virginia Vassilevska Williams. Tight hardness results for lcs and other sequence similarity measures. In Foundations of Computer Science (FOCS), 2015 IEEE 56th Annual Symposium on. IEEE, 2015.
  • [AJP10] Alexandr Andoni, T.S. Jayram, and Mihai Patrascu. Lower bounds for edit distance and product metrics via poincare type inequalities. In Proceedings of the twenty first annual ACM-SIAM symposium on Discrete algorithms, pages 184–192, 2010.
  • [AK10] Alexandr Andoni and Robert Krauthgamer. The computational hardness of estimating edit distance. SIAM Journal on Discrete Mathematics, 39(6):2398–2429, 2010.
  • [AKO10] Alexandr Andoni, Robert Krauthgamer, and Krzysztof Onak. Polylogarithmic approximation for edit distance and the asymmetric query complexity. In Foundations of Computer Science (FOCS), 2010 IEEE 51st Annual Symposium on. IEEE, 2010.
  • [AN20] Alexandr Andoni and Negev Shekel Nosatzki. Edit distance in near-linear time: it’s a constant factor. In Proceedings of the 61st Annual Symposium on Foundations of Computer Science (FOCS), 2020.
  • [BI15] Arturs Backurs and Piotr Indyk. Edit distance cannot be computed in strongly subquadratic time (unless seth is false). In Proceedings of the forty-seventh annual ACM symposium on Theory of computing (STOC). IEEE, 2015.
  • [BR20] Joshua Brakensiek and Aviad Rubinstein. Constant-factor approximation of near-linear edit distance in near-linear time. In Proceedings of the 52nd annual ACM symposium on Theory of computing (STOC), 2020.
  • [BZ16] Djamal Belazzougui and Qin Zhang. Edit distance: Sketching, streaming, and document exchange. In Proceedings of the 57th IEEE Annual Symposium on Foundations of Computer Science, pages 51–60. IEEE, 2016.
  • [CDG+19] Diptarka Chakraborty, Debarati Das, Elazar Goldenberg, Michal Koucky, and Michael Saks. Approximating edit distance within constant factor in truly sub-quadratic time. In Foundations of Computer Science (FOCS), 2018 IEEE 59th Annual Symposium on. IEEE, 2019.
  • [CFH+21] Kuan Cheng, Alireza Farhadi, MohammadTaghi Hajiaghayi, Zhengzhong Jin, Xin Li, Aviad Rubinstein, Saeed Seddighin, and Yu Zheng. Streaming and small space approximation algorithms for edit distance and longest common subsequence. In International Colloquium on Automata, Languages, and Programming. Springer, 2021.
  • [CGK16a] Diptarka Chakraborty, Elazar Goldenberg, and Michal Koucký. Low distortion embedding from edit to hamming distance using coupling. In Proceedings of the 48th IEEE Annual Annual ACM SIGACT Symposium on Theory of Computing. ACM, 2016.
  • [CGK16b] Diptarka Chakraborty, Elazar Goldenberg, and Michal Koucký. Streaming algorithms for computing edit distance without exploiting suffix trees. arXiv preprint arXiv:1607.03718, 2016.
  • [CJLZ20] Kuan Cheng, Zhengzhong Jin, Xin Li, and Yu Zheng. Space efficient deterministic approximation of string measures. arXiv preprint arXiv:2002.08498, 2020.
  • [EJ08] Funda Ergun and Hossein Jowhari. On distance to monotonicity and longest increasing subsequence of a data stream. In Proceedings of the nineteenth annual ACM-SIAM symposium on Discrete algorithms, pages 730–736, 2008.
  • [FHRS20] Alireza Farhadi, MohammadTaghi Hajiaghayi, Aviad Rubinstein, and Saeed Seddighin. Streaming with oracle: New streaming algorithms for edit distance and lcs. arXiv preprint arXiv:2002.11342, 2020.
  • [GG10] Anna Gál and Parikshit Gopalan. Lower bounds on streaming algorithms for approximating the length of the longest increasing subsequence. SIAM Journal on Computing, 39(8):3463–3479, 2010.
  • [GJKK07] Parikshit Gopalan, TS Jayram, Robert Krauthgamer, and Ravi Kumar. Estimating the sortedness of a data stream. In Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, pages 318–327. Society for Industrial and Applied Mathematics, 2007.
  • [HSSS19] MohammadTaghi Hajiaghayi, Masoud Seddighin, Saeed Seddighin, and Xiaorui Sun. Approximating lcs in linear time: beating the n\sqrt{n} barrier. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1181–1200. Society for Industrial and Applied Mathematics, 2019.
  • [IPZ01] Russell Impagliazzo, Ramamohan Paturi, and Francis Zane. Which problems have strongly exponential complexity. Journal of Computer and System Sciences, 63(4):512–530, 2001.
  • [KN97] Eyal Kushilevitz and Noam Nisan. Communication Complexity. Cambridge Press, 1997.
  • [KS92] Bala Kalyanasundaram and Georg Schintger. The probabilistic communication complexity of set intersection. SIAM Journal on Discrete Mathematics, 5(4):545–557, 1992.
  • [KS20] Michal Kouckỳ and Michael E Saks. Constant factor approximations to edit distance on far input pairs in nearly linear time. In Proceedings of the 52nd annual ACM symposium on Theory of computing (STOC), 2020.
  • [LNVZ05] David Liben-Nowell, Erik Vee, and An Zhu. Finding longest increasing and common subsequences in streaming data. In COCOON, 2005.
  • [Raz90] Alexander A Razborov. On the distributional complexity of disjointness. In International Colloquium on Automata, Languages, and Programming, pages 249–253. Springer, 1990.
  • [RS20] Aviad Rubinstein and Zhao Song. Reducing approximate longest common subsequence to approximate edit distance. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1591–1600. SIAM, 2020.
  • [RSSS19] Aviad Rubinstein, Saeed Seddighin, Zhao Song, and Xiaorui Sun. Approximation algorithms for lcs and lis with truly improved running times. In Foundations of Computer Science (FOCS), 2019 IEEE 60th Annual Symposium on. IEEE, 2019.
  • [Sah17] Barna Saha. Fast & space-efficient approximations of language edit distance and RNA folding: An amnesic dynamic programming approach. In FOCS, 2017.
  • [SS13] Michael Saks and C Seshadhri. Space efficient streaming algorithms for the distance to monotonicity and asymmetric edit distance. In Proceedings of the twenty-fourth annual ACM-SIAM symposium on Discrete algorithms, pages 1698–1709. SIAM, 2013.
  • [SW07] Xiaoming Sun and David P Woodruff. The communication and streaming complexity of computing the longest common and increasing subsequences. In Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, pages 336–345, 2007.
  • [SZ99] Leonard J Schulman and David Zuckerman. Asymptotically good codes correcting insertions, deletions, and transpositions. IEEE transactions on information theory, 45(7):2552–2557, 1999.

Appendix A Lower Bound for ED in the Standard Streaming Model

Theorem 18.

There exists a constant ε>0\varepsilon>0 such that for strings x,y{0,1}nx,y\in\{0,1\}^{n}, any deterministic RR pass streaming algorithm achieving an εn\varepsilon n additive approximation of 𝖤𝖣(x,y)\mathsf{ED}(x,y) needs Ω(n/R)\Omega(n/R) space.

Proof.

Consider an asymptotically good insertion-deletion code C{0,1}nC\subseteq\{0,1\}^{n} over a binary alphabet (See [SZ99] for example). Assume CC has rate α\alpha and distance β\beta. Both α\alpha and β\beta are some constants larger than 0, and we have |C|=2αn|C|=2^{\alpha n}. Also, for any x,yCx,y\in C with xyx\neq y, we have 𝖤𝖣(x,y)βn\mathsf{ED}(x,y)\geq\beta n. Let ε=β/2\varepsilon=\beta/2 and consider the two party communication problem where player 1 holds xCx\in C and player 2 holds yCy\in C. The goal is to decide whether x=yx=y. Any deterministic protocol has communication complexity at least log|C|=Ω(n)\log|C|=\Omega(n). Note that any algorithm that approximates 𝖤𝖣(x,y)\mathsf{ED}(x,y) within an εn\varepsilon n additive error can decide whether x=yx=y. Thus the theorem follows. ∎

We note that the same bound holds for Hamming distance by the same argument.