Fine-Grained Complexity of Analyzing Compressed Data: Quantifying Improvements over Decompress-And-Solve
Amir Abboud, Arturs Backurs, Karl Bringmann, Marvin K\"unnemann

TL;DR
This paper investigates the complexity of analyzing compressed data directly, establishing bounds and optimality results for various problems under common compression schemes, and introduces a framework for conditional lower bounds.
Contribution
It provides a unified framework for proving lower bounds on analyzing compressed data and determines the optimality of decompress-and-solve for several fundamental problems.
Findings
LCS and Pattern Matching with Wildcards bounds are optimal under ETH.
Decompress-and-solve is optimal for Grammar Parsing and RNA Folding under the k-Clique conjecture.
Decompress-and-solve is not optimal for Disjointness, with a new algorithm.
Abstract
Can we analyze data without decompressing it? As our data keeps growing, understanding the time complexity of problems on compressed inputs, rather than in convenient uncompressed forms, becomes more and more relevant. Suppose we are given a compression of size of data that originally has size , and we want to solve a problem with time complexity . The naive strategy of "decompress-and-solve" gives time , whereas "the gold standard" is time : to analyze the compression as efficiently as if the original data was small. We restrict our attention to data in the form of a string (text, files, genomes, etc.) and study the most ubiquitous tasks. While the challenge might seem to depend heavily on the specific compression scheme, most methods of practical relevance (Lempel-Ziv-family, dictionary methods, and others) can be unified under the elegant notion of…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Fine-Grained Complexity of Analyzing Compressed Data:
Quantifying Improvements over Decompress-And-Solve
Amir Abboud IBM Almaden Research Center, [email protected]. Work done while at Stanford University.
Arturs Backurs MIT, [email protected]
Karl Bringmann Max Planck Institute for Informatics, Saarland Informatics Campus, Germany, [email protected]
Marvin Künnemann Max Planck Institute for Informatics, Saarland Informatics Campus, Germany, [email protected]
Abstract
Can we analyze data without decompressing it? As our data keeps growing, understanding the time complexity of problems on compressed inputs, rather than in convenient uncompressed forms, becomes more and more relevant. Suppose we are given a compression of size of data that originally has size , and we want to solve a problem with time complexity . The naïve strategy of “decompress-and-solve” gives time , whereas “the gold standard” is time : to analyze the compression as efficiently as if the original data was small.
We restrict our attention to data in the form of a string (text, files, genomes, etc.) and study the most ubiquitous tasks. While the challenge might seem to depend heavily on the specific compression scheme, most methods of practical relevance (Lempel-Ziv-family, dictionary methods, and others) can be unified under the elegant notion of Grammar-Compressions. A vast literature, across many disciplines, established this as an influential notion for Algorithm design.
We introduce a framework for proving (conditional) lower bounds in this field, allowing us to assess whether decompress-and-solve can be improved, and by how much. Our main results are:
- •
The bound for LCS and the bound for Pattern Matching with Wildcards are optimal up to factors, under the Strong Exponential Time Hypothesis. (Here, denotes the uncompressed length of the compressed pattern.)
- •
Decompress-and-solve is essentially optimal for Context-Free Grammar Parsing and RNA Folding, under the -Clique conjecture.
- •
We give an algorithm showing that decompress-and-solve is not optimal for Disjointness.
Contents
1 Introduction
Computer Science is often called the science of processing digital data. A central goal of theoretical CS is to understand the time complexity of the tasks we want to perform on data. Data compression has been one of the most important notions in CS and Information Theory for decades, and it is increasingly relevant in our current age of “Big Data” where it is hard to think of reasons why not to compress our data: smaller data can be stored more efficiently, transmitting it takes less resources such as energy and bandwidth, and perhaps it can even be processed faster. Since nowadays and for years to come nearly all of our data comes in compressed form, a central question becomes:
What is the time complexity of analyzing compressed data?
Say we have a piece of data of size given in a compressed form of size . For a problem with time complexity , the naïve strategy of “decompress and solve” takes time, while the “gold standard” is time: we want to solve the problem on the compression as efficiently as if the original data was small. To provide meaningful statements we need to decide on three things: What type of data is it? What problem do we want to solve? Which compression scheme is being used?
For the first two questions, the focus of this paper will be on the most basic setting. We consider data that comes as strings, i.e. sequences of symbols such as text, computer code, genomes, and so on. And we study natural and basic questions one could ask about strings such as Pattern Matching, Language Membership, Longest Common Subsequence, Parsing, and Disjointness.
For the third question, we restrict our attention to lossless compression and, even then, there are multiple natural settings that we do not find to be the most relevant. We could consider Kolmogorov complexity, giving us the best possible compression of our data: assume that a string is given by a short bitstring which is a pair of Turing machine and input such that running on outputs , i.e. such that . The issue with Kolmogorov-compressions is that none of our data comes in this form, for two good reasons: First, it is computationally intractable to compute given , not even approximately. And second, analyzing arbitrary Turing machines without just running them is an infamously hopeless task. Thus, while studying the time complexity of analyzing Kolmogorov-compressed strings is natural, it might not be the most relevant for computer science applications. Another option is to consider the mathematically simplest forms of compression such as Run-Length Encoding (RLE): we compress consecutive letters into , so the compression has the form , and we only need bits to describe the potentially exponentially longer string of length . This compression is at the other extreme of the spectrum: it is trivial to compute and easy to analyze, but it is far less “compressing” than popular schemes like Lempel-Ziv-compressions.
Instead, we consider what has proven to be one of the most influential kinds of compression for Algorithm design, namely Grammar-Compressions, a notion that has all the right properties. First, it is mathematically elegant and quite fun to reason about for theoreticians (as evidenced by the many pages of our paper). Second, it is equivalent [64] up to low order terms (moderate constants and log factors) to popular schemes like the Lempel-Ziv-family (LZ77, LZ78, LZW, etc.) [48, 81, 75], Byte-Pair Encoding [68], dictionary methods, and others [57, 50]. These compressions are used in ubiquitous applications such as the built-in Unix utility compress, zip, GIF, PNG, and even in PDF. Third, it is generic and likely to capture compression schemes that will be engineered in the future (after all, there is a whole industry on the topic and the quest might never be over). Fourth, we can compute the optimal such compression (up to log factors) in linear time [64, 23, 44]. And last but not least, ingenious algorithmic techniques have shown that it is possible to computationally analyze grammar-compressed data, beating the “decompress and solve” bound for many important problems.
A grammar compression of a string is simply a context-free grammar, whose language is exactly , that is, the only string the grammar can produce is . For the purposes of this paper, it is enough to focus on a restricted form of grammars, known as Straight Line Programs (SLP). An SLP is defined over some alphabet , say , and it is a set of replacement rules (or productions) of a very simple form: a rule is either a symbol in or it is the concatenation of two previous rules (under some fixed ordering of the rules). The last replacement rule is the sequence defined by the SLP. For example, we can compress the sequence with the rules S_{1}\to 0;\ \ S_{2}\to 1;\ \ S_{3}\to S_{1}\,S_{2};\ \ S_{4}\to S_{3}\,S_{3};\ \ S_{5}\to S_{4}\,S_{2}\ and corresponds to the sequence . For some strings this can give an exponential compression. A more formal definition and a figure are given in Section 2.
To learn more about the remarkable success of grammar-compressions, we refer the reader to the surveys [77, 47, 34, 67, 36, 63, 65, 53, 66]. As a side remark, one of the exciting developments in this context was the surprising observation that a “compress and solve” strategy could actually lead to theoretically new algorithms for some problems, e.g. [60, 45].
Thus, we focus on what we find the most important interpretation of the central question above:
What is the time complexity of basic problems on grammar-compressed strings?
1.1 Previous Work
As a motivating example, consider the Longest Common Subsequence (LCS) problem. Given two uncompressed strings of length we can find the length of the longest common (not necessarily contiguous) subsequence in time using dynamic programming, and there are almost-matching conditional lower bounds [2, 17, 3]. Throughout the paper we mostly ignore log factors, and so we think of LCS as a problem with time complexity (on uncompressed data). Now, assume our sequences are given in compressed form of size . A natural setting to keep in mind is where . How much time do we need to solve LCS on these compressed strings? The naïve upper bound gives and the gold standard is , so which is it?
Besides being a very basic question, LCS and the closely related Edit Distance are a popular theoretical modeling of sequence alignment problems that are of great importance in Bioinformatics111The heuristic algorithm BLAST for a generalized version of the problem has received sixty-thousand citations.. Thus, this is a relatively faithful modeling of the question whether “compress-and-solve” can speed up genome analysis tasks, a question which has received extensive attention throughout the years [39, 57, 50, 38, 36].
A long line of work [18, 54, 7, 8, 27, 69, 70, 40] has shown that we can do much better than . The current best algorithm has the curious runtime [35] which is tantalizingly close to a conjectured bound of from the seminal paper of Lifshits [49]. In our candidate setting of , this is . This is major speedup over the decompress-and-solve bound, but is still far away from the gold standard of which in this case would be . Can we do better? For example, an bound could lead to major real-world improvements.
While there is a huge literature on the topic, both from the Algorithms community and from applied areas, in addition to the potential for real-world impact, studying these questions has not become a mainstream topic in the top algorithms conferences. In one of the only STOC/FOCS papers on the topic, Charikar et al. [23] write “In short, the smallest grammar problem has been considered by many authors in many disciplines for many reasons over a span of decades. Given this level of interest, it is remarkable that the problem has not attracted greater attention in the general algorithms community.”
We believe that one key reason for this is the lack of a relevant complexity theory and tools for proving lower bounds, leaving a confusing state of the art in which it is hard to distinguish algorithms providing fundamental new insights from ad hoc solutions. Most importantly, previous work has not given us the tools to know, when we encounter a data analysis problem in the real-world, what kind of upper bound we should expect. Instead, researchers have been proving P vs. NP-hard results, classifying problems into ones solvable in time and ones that probably require time . In fact, even LCS is NP-hard [49]. This means that even if we have a compression of very small size then we cannot solve LCS in time, unless . Dozens of such negative results have been proven (see [53]), and it has long been clear that almost any task of interest is “NP-hard”, including the basic time solvable problems we discuss in this paper. However, this is hardly relevant to the questions we ask in this paper since it does not address the possibility of highly desirable bounds such as . What we would really like to know is whether the bound should be , or , or even higher: could it be that decompress-and-solve is impossible to beat for some problems?
1.2 Our Work
In this work, we introduce a framework for showing lower bounds on the time complexity of problems on grammar-compressed strings. Our lower bounds are based on popular conjectures from Hardness in P and Fine-Grained Complexity. This is perhaps surprising since the problems we consider are technically NP-hard. Our new complexity theoretic study of this field leads to three exciting developments: First, we resolve the exact time complexity up to factors of some of the most classical problems such as LCS on compressed data. Second, we discover problems that cannot be solved faster than the decompress-and-solve bound by any factor. Third, we fail at proving tight lower bounds for some classical problems, which hints to us that known algorithms might be suboptimal. Indeed, in this paper we also find new algorithms for fundamental problems. We hope that our work will inspire increased interest in this important topic.
Longest Common Subsequence
Our first result is a resolution of the time complexity of LCS on compressed data, up to factors, under the Strong Exponential Time Hypothesis222SETH is the pessimistic version of , stating that we cannot solve -SAT in time, for some independent of and for all constant [42, 19]. (SETH). We complement the upper bound of Gawrychowski [35] with an lower bound. Thus, in the natural setting from above, we should indeed be content with the upper bound since we will not be able to get much closer to the gold standard, unless SETH fails. Assuming SETH, our result confirms the conjecture of Lifshits, up to factors. See Theorem 3.12 in Section 3.3 for the formal statement.
One way to view this result is as an Instance Optimality result for LCS. The exact complexity of LCS on two strings is precisely proportional to the product of the decompressed size and the instance-inherent measure of how compressible they are.
RNA Folding and CFG Parsing
Next, we turn our attention to two other fundamental problems: Context-Free Grammar Recognition (aka Parsing) and RNA Folding. Parsing is the core computer science problem in which we want to decide whether a given string (e.g. computer code) can be derived from a given grammar (e.g. the grammar of a programming language). Having the ability to efficiently parse a compressed file is certainly desirable. In RNA Folding we are given a string over some alphabet (e.g. ) with a fixed pairing between its symbols (e.g. match and match), and the goal is to compute the maximum number of non-crossing arcs between matching letters that one can draw above the string (which corresponds to the minimum energy folding in two dimensions). RNA Folding is one of the most central problems in bioinformatics, and as we have discussed above, the ability to analyze compressed data is important in this field. How fast can we solve these problems?
Given an uncompressed string of size , classical dynamic programming algorithms, such as the CYK parser [25, 80, 46], solve RNA Folding in time and Parsing in time if the grammar has size . Wikipedia lists twenty-four parsing algorithms designed throughout the years, all of which take cubic time in the worst case. A theoretical breakthrough of Leslie Valiant [72] in 1975 showed that there are truly sub-cubic parsing algorithms, where is the fast matrix multiplication (FMM) exponent. However, Valiant’s algorithm has not been used in practice due the inefficiency of FMM algorithms, and obtaining a combinatorial333For the purposes of this paper, “combinatorial” should be interpreted as any practically efficient algorithm that does not suffer from the issues of FMM such as large constants and inefficient memory usage. sub-cubic time algorithm would be of major interest. Alas, it was recently proved [1] that any improvement over these bounds implies breakthrough -Clique algorithms: either finding such a combinatorial subcubic algorithm or getting any time algorithm, for any , would refute the -Clique Conjecture444Given a graph on nodes, the -Clique conjecture [1] is in fact two independent conjectures: The first one states that we cannot solve -clique in , for any . The second one states that we cannot solve -Clique combinatorially in time, for any .. The situation for RNA is even more interesting since Valiant’s sub-cubic algorithm does not generalize to this case. Under the -Clique conjecture, the same lower bounds still apply [1, 22], implying that any improvement will have to use FMM. Indeed, an algorithm using FMM was recently achieved [15].
Cubic time is a real bottleneck when analyzing large genomic data. One would hope that if we are able to compress the data down to size we could solve problems like RNA Folding and Parsing in time that is much faster than the lower bounds (to simplify the discussion we focus on combinatorial algorithms), such as or at least , in certain analogy the LCS case. No such algorithms were found to date, and we provide an explanation: Decompress-and-solve cannot be beaten for Parsing and (essentially) for RNA Folding, under the -Clique Conjecture. For both problems we prove a conditional lower bound of for any kind of algorithm, and for combinatorial algorithms, even restricted to for any . See Theorem 4.4 in Section 4.2 for CFG Parsing and Theorem 4.10 in Section 4.3 for RNA Folding.
Approximate Pattern Matching
We continue our quest for quantifying the possible improvements over decompress-and-solve for basic problems. Consider the following compressed versions of important primitives in text analysis known as Approximate Pattern Matching problems. In all these problems we assume that we are given a compressed text of size (and decompressed size ), and a compressed pattern of size (and decompressed size ), both over some constant size alphabet.
- •
Pattern Matching with Wildcards: In this problem, the strings contain wildcard symbols that can be replaced by any letter, and our goal is to decide if appears in .
- •
Substring Hamming Distance: Compute the smallest Hamming distance of any substring of to .
And a problem that generalizes both is:
- •
Generalized Pattern Matching: Given some cost function on pairs of alphabet symbols, find the length- substring of minimizing the total cost of all pairs .
The above problems have been extensively studied both in the uncompressed (see [24]) and in the compressed [49, 13, 32] settings. All three problems can be solved in time (see Section 3.2). Note that this bound beats the decompress-and-solve bound when the pattern is small, but can we avoid decompressing the pattern? We show a completely tight SETH-based lower bound of for all three problems, even for constant size alphabets and in all settings where the parameters are polynomially related. See Theorems 3.9 and 3.10 in Section 3.2.
Language Membership
Consider the compressed version of the most basic language membership problems. Assume we are given a compressed string (again, from size to ).
- •
DFA Acceptance: Given and a DFA with states, decide whether accepts .
- •
NFA Acceptance: Given and a NFA with states, decide whether accepts .
Classic algorithms solve the DFA Acceptance problem in time [61, 41], and we prove a matching SETH-based lower bound of . See Theorem 3.2 in Section 3.1.
For the NFA problem, the classic algorithms give [55, 61, 41]. For combinatorial algorithms, we prove a matching lower bound of , under the (combinatorial) -Clique conjecture. See Theorem 4.2 in Section 4.1. Our lower bounds hold for constant size alphabets, and in all settings of , even restricted to instances with and for any and .
Disjointness, Hamming Distance, and Subsequence
Could it be that for other, even more basic problems the decompress-and-solve bound cannot be beaten? One candidate might be Disjointness, the canonical hard problem in Communication Complexity.
- •
Disjointness: Given two equal-length bit-strings, is there a coordinate in which both are ?
The following two natural problems are at least as hard as Disjointness (see Section 5).
- •
Hamming Distance: Compute the Hamming Distance of two strings.
- •
Subsequence: Decide if a pattern of length is a subsequence of a text of length .
Note that all these problems can be solved trivially in time if our strings are uncompressed. Could it be that we cannot solve them without decompressing our data? We are not aware of any known algorithms solving any of these problems in time, for any , even when our strings are compressed into size for some small constant . The only exceptions are the known time algorithms [28, 20, 69, 79, 71, 12] for the Subsequence problem, which beat the decompress-and-solve bound when the pattern is significantly smaller than the text. However, in the case no improvements seem to be known.
In Section 5 we present our attempts at proving a matching lower bound. We prove the following: for Subsequence in the setting and (Theorem 5.9). for Disjointness (and thus also for the other two problems) in the setting and for any , and constant alphabet size, assuming the -SUM conjecture (Theorem 5.10). Similarly: for Disjointness under Strong -SUM conjecture (Theorem 5.11).
Motivated by our inability to prove tight lower bounds for these basic problems, despite seemingly having the right framework, we have turned our attention to upper bounds. In Section 5 we obtain the first improvement over the decompress-and-solve bound for Disjointness, Hamming Distance, and Subsequence. In particular, we obtain the first improvement over the decompress-and-solve bound for Disjointness, Hamming Distance, and Subsequence. Our algorithms solve all these problems in time. As a side result, we also design a very simple algorithm for the Subsequence problem with runtime (Theorem 5.4), which is comparable to the known but more involved algorithms [12].
One of the biggest benefits of having complexity theoretic results is that algorithm designers know what to focus on. We believe that these upper bounds can be improved further and suggest it as an interesting open question: What is the time complexity of computing Disjointness on two grammar-compressed strings?
1.3 Technical Overview
From a technical perspective, our paper is most related to the conditional lower bounds for sequence similarity measures on strings and curves that have been shown in recent years, specifically, the SETH-based lower bounds for edit distance [10], longest common subsequence [2, 17], Fréchet distance [14], and others [4, 11, 16, 62].
These results all proceed as follows. Let be a given -SAT instance on variables and clauses . We can assume that by the Sparsification Lemma [43]. Split the variables into two halves and of size . Enumerate all assignments of the variables in . For any assignment and any clause , denote by whether satisfies , i.e., whether some variable in appears in (negated or unnegated) and is set by so that is satisfied. Similarly, consider the assignments of . By construction, we can solve the -SAT instance by testing whether there are such that holds for all . Making use of this fact, all previous conditional lower bounds for sequence similarity measures essentially construct the following natural sequence:
[TABLE]
One typical variation of this string is to replace the bits , indicating whether holds, by two short strings . Other typical variations are to add appropriate padding strings around the substrings or around the whole sequence . These paddings typically only depend on and . Constructing a second sequence with replaced by , one can then try to emulate the search for the half-assignments by a similarity measure on . All previous reductions follow this recipe, and thus construct a sequence like .
Is compressible?
For our purposes we need to construct compressible strings. Considering the entropy, the string is very well compressible, since it only depends on the input bits of the sparse -SAT instance . This entropy is extremely small compared to the length of . However, considering grammar-compression, the sequence is a bad representation, since is not generated by any SLP of size in general! To see this, first observe that all substrings of can potentially be different, meaning that can have different substrings of length . This happens e.g. if for each variable there is a clause consisting only of (which makes the -SAT instance trivial, but shows that may have many different substrings in general). Second, observe that for any SLP consisting of non-terminals and for any length the generated string has at most different substrings of length . Indeed, a rule can only create a new substring, that is not already contained in or , if this substring overlaps the boundary between and in . Hence, the rule can contribute at most new substrings of length , amounting to at most different substrings overall. Combining these two facts, with , we see that in general has no SLP of size .
Hence, the standard approach to conditional lower bounds for sequence similarity measures fails in the compressed setting, and it might seem like (SETH-based) conditional lower bounds are not applicable here.
A compressible sequence
On the contrary, we show that by simply inverting the ordering we obtain a very well compressible string:
[TABLE]
The difference between and might seem negligible, but it greatly changes the game of emulating -SAT by a sequence similarity measure: In we are looking for a local structure (a small substring) that “fits together” with a local structure in a different string . In we have to ensure the choice of a consistent offset and “read” the symbols , which seems much more complicated.
is compressible to an SLP of size , which is much smaller than the bound for . Indeed, consider a substring . We may assume that no variable appears more than once in . Consider the following SLP rules, for ,
[TABLE]
[TABLE]
We clearly have . Moreover, if appears in , then for , no matter what we choose for , we have , and thus we may write . For we note that the value only depends on the remaining variables , and thus we may write . Along these lines, one can check that . Creating such an SLP for each and constructing their concatenation, we obtain an SLP of size generating .
Example Lower Bound: Pattern Matching with Wildcards
In the remainder of this section, we present an easy example for a conditional lower bound on compressed strings, namely for the problem Pattern Matching with Wildcards. Here we consider an alphabet and we say that symbols match if or or . We say that two equal-length strings (over alphabet ) match if and match for all . Given a text of length and a pattern of length , the task is to decide whether matches some length- substring of .
Let be a -SAT instance as above, but this time let be all the assignments of the variables in . We define the text and pattern by
[TABLE]
Note that matches some substring of if and only if there is an offset such that , which happens if and only if is a satisfying assignment of . Hence, we constructed an equivalent instance of Pattern Matching with Wildcards.
Analogously to above, one can show that is generated by an SLP of size that can be computed in time . Similarly, it is easy to see that is generated by an SLP of size that can be computed in time . Hence, the reduction runs in time . We stress that we define strings of exponential length in , but in the reduction we never explicitly write down any such string, but we simply construct compressed representations. Since the resulting strings have length , any time algorithm for Pattern Matching with Wildcards would imply an algorithm for -SAT in time , contradicting the Strong Exponential Time Hypothesis (SETH). Note that this conditional lower bound of holds even for strings compressible to size .
In Section 3.2 we analyze Pattern Matching with Wildcards in more detail and show that the optimal running time, conditional on SETH, is , and this holds for all settings of the text length , the compressed text size , the pattern length , and the compressed pattern size .
In Pattern Matching with Wildcards, we got a consistent choice of an offset for free. It is much more complicated to achieve this for other problems such as Longest Common Subsequence, CFG Parsing, or RNA Folding. This overview summarized the main technical contributions of this paper, but left out many problem-specific tricks that can be found in the subsequent proofs, and that we think will find more applications for analyzing problems on compressed strings.
2 Preliminaries
Here we give general preliminaries on strings, straight-line programs, and hardness assumptions. Problem definitions and additional problem specific preliminaries will be given in the corresponding sections. For a positive integer we let , while for a proposition we let be 1 if is true and 0 otherwise.
Strings
Let be a finite alphabet. In most parts of this paper we assume that , but in exceptional cases we allow the alphabet to grow with the input size. For a string over alphabet , we write for its length, for its -th symbol, and for the substring from position to position . For two strings we write , or simply , for their concatenation. For we let .
Straight-Line Programs (SLPs)
An SLP is a set of non-terminals , each equipped with a rule of the form (1) for some or (2) with . The string generated by SLP is recursively defined as follows. For a rule we let , and for a rule we let . Then is the string generated by SLP . Note that an SLP is a context-free grammar describing a unique string; so is a grammar-compressed representation of . We call the size of . See Figure 1 for the depiction of an SLP; in particular note the difference between the directed acyclic graph that is the compressed representation and the parse tree that we obtain by decompressing to a tree whose leaves spell the decompressed text .
For an SLP with non-terminals , we recursively define the depth as follows. For a rule we set . For a rule we set . The depth of is defined as . The SLP is called an AVL-grammar [64] if it is balanced: for any rule in the SLP we have . This implies that the depth of is , where .
Theorem 2.1** ([64]).**
Given a text of length by an SLP of size , in time we can construct an AVL-grammar for with size and depth .
Observation 2.2**.**
For any string and , there is an SLP of size generating the string .
In all problems considered in this paper, the input contains a text given by a grammar-compressed representation , such that . We always denote by the length of the text and by the size of its representation. Sometimes we are additionally given a pattern by a grammar-compressed representation , and we denote the pattern length by and its representation size by .
2.1 Hardness Assumptions
SETH and OV
The Strong Exponential Time Hypothesis (SETH) was introduced by Impagliazzo, Paturi, and Zane [43] and asserts that the central NP-hard satisfiability problem has no algorithms that are much faster than exhaustive search.
Conjecture 2.3** (SETH).**
There is no such that for all , -SAT on variables can be solved in time .
Effectively all known SETH-based lower bounds for polynomial-time problems use reductions via the Orthogonal Vectors problem (OV): Given sets , of size , , determine whether there exist vectors , with . Simple algorithms solve OV in time and . For and the fastest known algorithm runs in time [5], which is only slightly subquadratic for . This has led to the following conjecture, which follows from SETH [76].
Conjecture 2.4** (OV).**
For any and , on instances with OV has no time algorithm.
It is known that if this conjecture holds for some then it holds for all , see e.g. [17].
More generally, for we say that a tuple with is orthogonal if for all there exists an such that . In the -OV problem we are given a set of size and want to determine whether there is an orthogonal tuple with . The fastest known algorithm for -OV is to run an easy reduction to OV and then solve OV. The following conjecture follows from SETH.
Conjecture 2.5** (-OV).**
For any and , -OV is not in time .
-Clique
The fundamental -Clique problem asks whether a given (undirected, unweighted) graph contains nodes that are pairwise adjacent. -Clique is among the most well-studied problems in theoretical computer science, and it is the canonical intractable (W[1]-complete) problem in parameterized complexity. With slight abuse of notation, we will denote the number of vertices and edges of by and , respectively. The naive algorithm for -Clique takes time . If is divisible by 3, the fastest known algorithm runs in time , where is the exponent of matrix multiplication [58]. See [31] for the case that is not divisible by 3. To improve this bound is a longstanding open problem [78, 56]. Since fast matrix multiplication is considered impractical, researchers also studied combinatorial algorithms, that avoid fast matrix multiplication555Combinatorial algorithms are a notion without agreed upon definition; finding a formal definition is considered an open problem.. The fastest combinatorial algorithm runs in time [73]. The following conjectures assert that these bounds are close to optimal, and have been used e.g. in [1, 16].
Conjecture 2.6** (-Clique).**
For any and , -Clique has no algorithm.
Conjecture 2.7** (Combinatorial -Clique).**
For any and , -Clique has no combinatorial algorithm.
-SUM
In the -SUM problem, we are given integers and a set of integers, and the task is to decide whether there are (not necessarily distinct) integers that sum to , i.e., . This problem has well-known algorithms in time and , and it is conjectured that no much faster algorithms exist. The following conjectures, which generalize the more popular 3-SUM conjecture [33, 59] and Strong 3-SUM conjecture [6], remain believable despite recent algorithmic progress [9, 21, 37, 74].
Conjecture 2.8** (-SUM).**
For any and , the -SUM problem is not in time for any .
Conjecture 2.9** (Strong -SUM).**
For any and , the -SUM problem is not in time for any .
3 Tight Bounds Assuming SETH
In this section we prove matching conditional lower bounds based on the Strong Exponential Time Hypothesis (SETH, see Conjecture 2.3) for the following problems:
- •
DFA Acceptance, i.e., deciding whether a given deterministic finite automaton accepts a given string,
- •
Substring Hamming Distance, i.e., determining the minimum Hamming distance that can be achieved by aligning a given pattern sequence with a substring of a given text sequence,
- •
Pattern Matching with Wildcards, i.e., deciding whether the given pattern sequence (containing wildcards that match any symbol) matches a substring of the given text,
- •
Longest Common Subsequence, i.e., computing the length of the longest common subsequence of two given strings.
See the respective subsections for precise problem definitions. In all our proofs, instead of using SETH directly, we use the more convenient OV conjecture (Conjecture 2.4) or -OV conjecture (Conjecture 2.5), which are implied by SETH.
For DFA Acceptance, the compression used in our reduction from the given OV instance is extremely simple, in that we only rely on the fact that any repetition can be generated by an SLP of size (Observation 2.2).
For Substring Hamming Distance, Pattern Matching with Wildcards and Longest Common Subsequence, however, our construction are more subtle. We crucially use the following idea: consider a -OV instance on vectors in dimensions. There is a length- text representing this instance so that (1) is succinctly described by an SLP of size and (2) testing whether the -OV instance has a solution corresponds to determining whether there is some such that all bits are equal to zero. Intuitively, denotes the -th -tuple of vectors in , and holds if and only if the vectors in the -th -tuple are orthogonal in the st coordinate. In general, for , holds if and only if the vectors are orthogonal in the -th coordinate. More formally, we set to be
[TABLE]
where is the Kronecker symbol, i.e., and . For any , the sequence is generated by an SLP of size : if , then for all , the vectors will be orthogonal in this coordinate and we can write , which is well compressible by Observation 2.2. Otherwise, if , we recurse on and the following symbols do not depend on anymore.
A modification of the above construction of gives SETH hardness for Substring Hamming Distance and Pattern Matching with Wildcards. Showing hardness for Longest Common Subsequence requires more ideas. In particular, to be able to show tight hardness we extend the framework of [17].
We stress that if the sequence would enumerate all -tuples one after another (instead of iterating over the coordinates in the outer loop over ), then it would not be compressible using SLPs, see Section 1.3. This makes our reductions quite different from all previously known hardness results where the sequences are concatenations of vector gadgets one after another.
Known Lower Bounds from Classic Complexity Theory
We observe that the Substring Hamming Distance problem is a generalization of the Hamming Distance problem which asks to output the Hamming distance between a compressed text and a compressed pattern of equal length. The latter problem is known to be -complete and thus the Substring Hamming Distance problem is -hard (see the discussion at the beginning of Section 5.2). Similarly, Longest Common Subsequence is a generalization of the problem of deciding whether a given pattern is a subsequence of a given text. The latter problem is known to be -hard (see the aforementioned discussion) and this yields -hardness for Longest Common Subsequence.
The DFA Acceptance problem can be solved in polynomial time (see Section 3.1) and no conditional lower bounds were known for this problem. Finally, our reduction in Theorem 3.9 below shows that Pattern Matching with Wildcards is -hard.
3.1 DFA Acceptance
Recall that a finite-state automaton over an alphabet consists of a set of states of size , a starting state , a set of accepting states , and a set of transitions with and . We lift this notation to strings by writing whenever there are states and transitions . Furthermore, for a set we write whenever for all . The automaton is deterministic if for any and there is at most one with transition , and is non-determinisitic otherwise. The automaton accepts a given string if holds for some accepting state .
Throughout this section, we assume the alphabet size to be constant. If is a deterministic finite-state automaton (DFA), we may assume without loss of generality that for every state and symbol , there always exists a (uniquely defined) state with .666Note that we can always define an absorbing non-accepting state with and set, for any undefined transition from under , , which increases the number of states only by one. We fix the input description of to a list of transitions of as well as a list of accepting states. Observe that any DFA on constant alphabet has an input size of .
Consider the compressed variant of the acceptance problem of DFAs.
Problem 3.1** (DFA Acceptance).**
Given a text of length by a grammar-compressed representation of size as well as a DFA with states, decide whether is accepted by .
The naive solution decompresses to obtain and runs the obvious acceptance algorithm for DFAs, which takes time . Exploiting the compressed setting, one can obtain an -time algorithm [61]: Recall that is a set of rules of the form or , with and , for . We compute, for increasing , the state transition function (we denote states using integers ) that satisfies . For we can compute as , where is function composition. For we simply have for the unique transition . Hence, can be computed in time for every . The text is then accepted by if and only if is an accepting state, where is the starting state of . Hence, the best-known algorithm takes time .
We prove that DFA Acceptance takes time assuming SETH, thus providing a conditional lower bound matching the known algorithmic results. It is straightforward to see that any algorithm must read the complete input description of to always correctly decide the problem, yielding a lower bound of . In the remainder, we provide the remaining conditional lower bound of .
Theorem 3.2**.**
Assuming the OV conjecture, for no there is an -time algorithm for DFA Acceptance. This holds even restricted to instances with and for any and .
Proof.
Let be a given OV instance in dimensions. We construct a string of length with a representation of size and a DFA with . An -time algorithm for DFA Acceptance would then imply an algorithm for OV in time , contradicting the OV conjecture. At the end of this proof we show that this also holds for all restrictions and with and .
Constructing the Text
We cast any vector to a string by simply concatenating its coordinates. We define the text over the alphabet as
[TABLE]
Here, we think of and as “new group” and “new vector within group” indicators, respectively. Intuitively, the -th repetition of is supposed to lead to an accepting state of if and are an orthogonal pair.
Constructing the DFA
For an illustration of the DFA construction see Figure 2. We start by defining “vector gadgets”: For any vector we construct a DFA over alphabet with states and . The initial state is . For any we have the transitions and
[TABLE]
We let be an accepting state with transition . Furthermore, we have . It is easy to see that after reading a string , is in either or , and it is in if and only if and are orthogonal.
We combine these smaller DFAs to our final DFA over the slightly larger alphabet as follows. We define additional states and let be the initial state of . We define the following additional transitions:
[TABLE]
In this way, each is an absorbing accepting state, and the symbols and satisfy the semantics of jumping to the next vector in and , respectively. This finishes the definition of the reduction.
Correctness
We claim that the constructed DFA accepts if and only if contains an orthogonal pair. By structure of and , as well as the properties argued for , it is straightforward to show that after reading any prefix of ending on , is in the initial state of , where is the number of !’s in – this holds until has encountered an accepting state for the first and final time. Thus, if is accepted by , then some prefix of that ends on for some has led an accepting state of . This can only happen if is orthogonal to , where is the number of !’s in , i.e., contain an orthogonal pair. Conversely, if contains an orthogonal pair, let the smallest such pair in terms of the lexicographic order on . Then the prefix that ends on and contains !’s leads to the accepting state .
Size Bounds
We count that . Since consists of repetitions of a string of length , we can compute an SLP of size by Observation 2.2. The number of states of is . This satisfies the claimed size bounds. Note that the reduction can be implemented in linear time in the output size.
Strengthening the Statement
In the remainder, we verify that our construction proves the desired lower bound even restricted to instances with and for any and . Note that the number of states, the size of the SLP, and the text length can all three be increased by easy padding. E.g., to increase the text length we introduce a garbage symbol “” that can be read at any state of the automaton, not changing the current state, and add a suitable number of copies of “” to the text.
We now set and only consider OV instances with . Note that the OV conjecture asserts a lower bound of in this setting. Note that the above construction yields , and we can pad to equality. Moreover, we have , since , and we can pad to equality to obtain . Similarly, we have , since , and we can pad to equality to obtain . Finally, an -time algorithm for DFA Acceptance restricted to and would imply an algorithm for OV in time , contradicting the OV conjecture. This finishes the proof. ∎
3.2 Approximate Pattern Matching and Substring Hamming Distance
We study the following generalization of pattern matching.
Problem 3.3** (Generalized Pattern Matching).**
Given a text of length by an SLP of size , a pattern of length by an SLP of size , both over some alphabet , and given a cost function , compute , i.e., the minimum total cost of any alignment.
In other words, we want to compute the length- substring of minimizing the total cost of aligned symbols in and . This problem has two important special cases: (1) We obtain Substring Hamming Distance when for any . (2) We obtain Pattern Matching with Wildcards when is over alphabet and is over alphabet , we have for any and for any , and the task is to decide whether the minimum total cost of any alignment is 0.
Problem 3.4** (Substring Hamming Distance).**
Given a text of length by an SLP of size and a pattern of length by an SLP of size , both over some alphabet , compute \min_{0\leq i\leq N-M}\sum_{j=1}^{M}\big{[}P[j]\neq T[i+j]\big{]}, i.e., the minimum Hamming distance of any alignment.
Problem 3.5** (Pattern Matching with Wildcards).**
For some alphabet , we are given a text of length by an SLP of size over alphabet and a pattern of length by an SLP of size over alphabet . We say that and match if or . Decide whether for some offset all pairs match for .
In this section, for all three problems we show an upper bound of and a SETH-based lower bound of . This yields a tight bound in case of constant alphabet size, as the lower bound constructs constant-alphabet strings. We leave it as an open problem to get tight bounds for larger alphabet size.
Note that it suffices to prove the upper bound for Generalized Pattern Matching and the lower bound for the special cases Substring Hamming Distance and Pattern Matching with Wildcards. We start with the following two upper bounds, which follow standard arguments.
Lemma 3.6**.**
Generalized Pattern Matching can be solved in time .
Proof.
Decompress both the text and the pattern . For each symbol , build the vector with and the vector with . Compute their convolution with . Using FFT, can be computed in time . Finally, compute the vector with and return the minimal entry of . Note that
[TABLE]
which proves correctness. ∎
Lemma 3.7**.**
Generalized Pattern Matching can be solved in time .
Proof Sketch.
Let be the non-terminals of the SLP that generates the text . In this proof, for simplicity we write . We decompress the pattern . For we define
[TABLE]
or , if . This solves the Generalized Pattern Matching problem restricted to the substring of . Clearly, we can solve the given Generalized Pattern Matching instance by calling . Moreover, for any offset and any we define
[TABLE]
In other words, is equal to the total cost between and a shifted pattern (by symbols to the right, or symbols to the left), where we consider only the symbols that have an aligned counterpart.
In the remainder we show how to compute these functions by simple recursive algorithms. We precompute all lengths in time . For , observe that for a rule we have
[TABLE]
since the offset with respect to the first symbol of differs to the offset with respect to the first symbol of by . Moreover, for a rule we can compute in constant time. Note that whenever the offset is such that no symbols get aligned, we can immediately return [math]. This completes our algorithm for .
Now consider . For a rule , the optimal alignment of the pattern in is either completely contained in or completely contained in or it has a non-empty intersection with both of them, in which case it has an offset with respect to the starting symbol of , or equivalently an offset with respect to the starting symbol of . Hence, we have
[TABLE]
Again, for a rule we can compute in constant time. This completes the algorithm for .
To obtain the claimed running time, we use memoization to ensure that each argument is called at most once. Clearly, there are possible arguments for , and each call takes time , resulting in time . Note that only calls for offsets such that the pattern crosses the left or right boundary of . This property also holds as an invariant in the recursive subproblems of . Hence, there are less than possible offsets (i.e., less than offsets for the left and right boundary). As there are possible values for , and each call to takes time , we obtain the claimed total running time of . ∎
This completes the upper bound for Generalized Pattern Matching. It remains to prove the SETH-based lower bound of for Substring Hamming Distance and Pattern Matching with Wildcards.
We now make the intuition given at the beginning of Section 3 formal, by designing a text that enumerates all combinations of vectors in a given -OV instance, while still being well compressible. We give a slightly more general construction that will also be useful later for our SETH-based lower bounds for LCS, see Section 3.3. As usual, we consider as a constant.
Lemma 3.8**.**
Consider a -OV instance . Let be an additional vector, and let be strings of length ( is a sequence that represents an entry that is equal to ). We define the tuplified representation as follows:
[TABLE]
where the second goes over all tuples in lexicographic order. This representation satisfies the following properties.
We can compute, in linear time in the output size, an SLP generating of size or, when given SLPs generating , of size . 2. 2.
Write with . Then there exist such that is orthogonal if and only if there is an offset such that
[TABLE]
Proof.
For the second property, note that by definition are all equal to for if and only if the -th tuple in the lexicographic ordering of satisfies
[TABLE]
This condition is equivalent to being an orthogonal pair, so the claim follows.
It remains to construct a short SLP generating . We construct non-terminals with by an SLP of size as in Observation 2.2, or of size by using given SLPs . We can extend this, using Observation 2.2, to a slightly larger SLP of size that includes, for every , a non-terminal with .
The crucial observation is the following: for any tuple , let . Then for any and , we have that implies for all . We now define the final SLP using the starting non-terminal and the following productions
[TABLE]
It is straight-forward to verify that . Note that the size of this SLP, i.e., the total number of non-terminals on the right hand side of the above rules, is bounded by . Moreover, the SLP can be constructed in linear time in its size. ∎
After this preparation, we can prove our conditional lower bounds.
Theorem 3.9**.**
Assuming the -OV conjecture, Pattern Matching with Wildcards over alphabet (plus wildcards ) takes time . This holds even restricted to instances with , and for any and .
Before we prove Theorem 3.9, let us sketch the main idea by providing a simple -time conditional lower bound in the setting and . Let of size be an arbitrary -OV instance with , and assume for simplicity . Using Lemma 3.8 on , , and , we compute an SLP for
[TABLE]
We define the pattern as
[TABLE]
Note that Pattern Matching with Wildcards on instance checks whether for some offset we have . Hence, by Lemma 3.8, pattern matches if and only if there is an orthogonal tuple , showing correctness of the reduction.
Note that we have . By Lemma 3.8, has an SLP of size , and by Observation 2.2, has an SLP of size . By and , we are indeed in the setting and . An algorithm for Pattern Matching with Wildcards would now imply an for -OV, contradicting the -OV conjecture.
We now give the slightly more involved general construction.
Proof of Theorem 3.9.
For , let be a -OV instance in dimensions, and let with . We will construct an equivalent instance of Pattern Matching with Wildcards with , , , and . Any algorithm for Pattern Matching with Wildcards would then imply an algorithm for -OV in time for , contradicting the -OV conjecture. Below we strengthen this statement to hold restricted to instances with , and for any and .
To give such a reduction, we define the text as
[TABLE]
where denotes the component-wise minimum of .
We define the pattern as
[TABLE]
Correctness
Observe that cannot overlap any -block, since never more than wildcards are followed by a 0 in . Thus, matches if and only if there is a tuple such that matches . By the structure of the pattern, matches any string if and only if there is an offset such that . Thus, by Lemma 3.8, matches if and only if there are vectors for which is an orthogonal tuple. The latter condition is equivalent to being an orthogonal tuple. Since and contains for all , this proves that matches if and only if there is an orthogonal -tuple in the instance .
Size Bounds
Note that . By Lemma 3.8 and Observation 2.2, we can compute an SLP of size generating , in linear time. Similarly, note that . By Observation 2.2, we can compute an SLP of length generating , in linear time. This proves the claimed bounds.
Strengthening the Statement
We now prove the lower bound restricted to instances with , and for any and . Let and set . We choose such that and and . Note that are restricted to be integers, however, for sufficiently large depending only on , we can ensure and . Note that for the dimension we can assume , since otherwise an algorithm clearly exists. In particular, for sufficiently large we have . This yields
[TABLE]
Standard padding777Add a prefix of wildcards to the pattern and a prefix of 1’s to the text, and partially decompress the SLPs. of these four parameters allows us to achieve equality, up to constant factors, in the above inequalities, which yields the desired , and . Any algorithm for Pattern Matching with Wildcards in this setting would now imply an algorithm for -OV in time , where we used the definition of and . This contradicts the -OV conjecture, finishing the proof. ∎
We next prove a lower bound similar to Theorem 3.9 for another special case of generalized pattern matching, namely Substring Hamming Distance. Instead of a direct reduction from -OV, we present a linear-time reduction from Pattern Matching with Wildcards over alphabet to Substring Hamming Distance.
Theorem 3.10**.**
Assuming the -OV conjecture, Substring Hamming Distance on constant-size alphabet takes time . This holds even restricted to instances with , and for any and .
Proof.
For short, we write for the Hamming distance of strings . We prove the result by reducing any Pattern Matching with Wildcards instance over alphabet to an instance of Substring Hamming Distance. We first define coordinate strings
[TABLE]
Observe that these strings are defined in such a way that for , for , and if , .
We introduce the guarding for length-3 strings . This allows us to reduce , to the following instance, using alphabet ,
[TABLE]
Note that for any ,
[TABLE]
where is the number of mismatches of and .
We now observe that for all with , we have , as no two symbols in are aligned, so that each contributes at least 3 to the Hamming distance. Since for all , the substring with smallest Hamming distance has thus a Hamming distance of . This value is equal to if and only if matches , proving correctness.
The corresponding reduction of the compressed problems is straightforward: We can augment the SLP for by -sized productions to obtain an SLP for , by replacing each terminal by a non-terminal evaluating to . Analogously, we can compute an SLP for of size in linear time. Overall, since also , all parameters are preserved up to constant factors. By this linear-time parameter-preserving reduction, the lower bound of Theorem 3.9 translates to Substring Hamming Distance, yielding the claim. ∎
3.3 Longest Common Subsequence
In this section, we study the Longest Common Subsequence (LCS) problem. Recall that a string of length is a substring of a string if there are with for any . In the LCS problem, given two strings , the task is to determine the longest string that is a subsequence of both and . We denote the length of the LCS by , and more precisely consider the problem of computing . In the whole section, the alphabet has constant size.
Problem 3.11** (LCS).**
Given strings of length at most by grammar-compressed representations of size at most , compute the length of the LCS of and .
As discussed in the introduction, the time algorithm by Gawrychowski [35] is the fastest known. Here we prove a matching lower bound of , assuming the -OV conjecture.
Theorem 3.12**.**
Assuming the -OV conjecture, there is no -time algorithm for LCS for any . This even holds restricted to instances with for any , and an alphabet of constant size.
The general approach is very similar to the lower bound for Pattern Matching with Wildcards given in Section 3.2. In particular, we again use the tuplified representation of Lemma 3.8 for a -OV instance . Recall that this allows us to decide the -OV instance by testing whether there is a subsequence of substrings all equal to a certain 0-coordinate string. Finding a pattern to test this was quite simple for Pattern Matching with Wildcards, yielding an lower bound. For LCS, enforcing a coherent offset is much more complicated, since the “pattern” is matched as a subsequence not as a substring. Furthermore, the extension to a lower bound is more involved and relies on the quadratic-time nature of LCS. Fortunately, we can overcome the technical obstacles for LCS using (an extension of) alignment gadgets developed in [17]. We first redevelop and extend the corresponding alignment gadget tools in Section 3.3.1, then give the lower bound for compressed instances for general distance measures in Section 3.3.2 and then finish our LCS lower bound by designing an alignment gadget for LCS in Section 3.3.3.
3.3.1 Alignment Gadget Framework
We start by reviewing and adapting the definitions of [17]. In particular, we extend the alignment gadget definition for our purposes.
More generally than LCS, we consider an arbitrary similarity measure . For LCS, the set of inputs is the set of all strings over some sufficiently large constant-sized alphabet , and , where is the length of the LCS of and .
Any sequence is assigned an (abstract) type . For LCS, we use , where is the length of and the alphabet over which is defined. We define as the set of all inputs of type .
Alignments
Let . An alignment is a set with such that and . We say that are aligned. Any or that is not contained in any pair in is called unaligned. We denote the set of all alignments (with respect to ) by .
We call the alignment , with , a structured alignment. We denote the set of all structured alignments by .
Defining the cost of an alignment , we deviate from [17]: for any and , we define the cost of as
[TABLE]
where we set . In other words, (1) for any which is aligned to some , we “pay” the distance , (2) if is unstructured because it contains an unaligned , we “pay” a penalty of for each such unaligned (note that there are unaligned ) and (3) if is unstructured because it aligns all but leaves out some between the first and last aligned , then for any unaligned that is between the first aligned and last aligned , we also “pay” a penalty of (note that ). This means that we incur punishment for any deviation from a structured alignment.
In [17], the cost of an alignment was defined to be the smaller quantity , i.e., unstructured alignments (that still align all ) were punished less. For structured alignments both definitions coincide. Hence, the following extended alignment gadget is more powerful than the alignment gadget defined in [17].
Definition 3.13** (Extended alignment gadget).**
*The similarity measure admits an *extended alignment gadget, if the following conditions hold: given instances , with and types , we can construct new instances and and such that
[TABLE]
Moreover, , and only depend on . Finally, .
Definition 3.14** (Compressible alignment gadget).**
We call an extended alignment gadget compressible, if and are of the form and for some strings and functions and that satisfy the following properties:
* have SLPs of size , computable in linear time in the output.* 2. 2.
Given SLPs for , we can compute SLPs for of size in linear time in the output.
In Section 3.3.3, we provide a compressible extended alignment gadget for LCS.
At the lowest level of our construction, we need the following notion.
Definition 3.15**.**
The similarity measure admits coordinate values, if there exist satisfying
[TABLE]
and, moreover, and .
3.3.2 General Lower Bound
The following theorem proves a conditional lower bound of for any similarity measure admitting a compressible extended alignment gadget and coordinate values.
Theorem 3.16**.**
Let be a similarity measure admitting a compressible extended alignment gadget and coordinate values. Then unless the -OV conjecture fails, there is no -time algorithm for computing the value , given SLPs of size at most generating strings of length at most . This even holds restricted to instances with for any , and constant alphabet size.
We prove this theorem in the remainder of this section.
Let be a -OV instance in dimensions. We augment all vectors in by another dimension where all vectors are 0 to obtain , or where all vectors are 1 to obtain . For any we let , i.e., for each -tuple of vectors in the set contains the pointwise minimum of this -tuple. Note that is in general a multiset, it has size , and is naturally ordered by the lexicographic ordering on -tuples . Similarly, we define and for the augmented vectors. We split for some and set
[TABLE]
Observe that deciding the given -OV instance is equivalent to testing whether there are orthogonal vectors with , and . In particular, the additional dimension is irrelevant for orthogonality, since we choose at least one vector in and any such vector has the last coordinate equal to 0. For any , we denote by the -th vector in .
Tuple gadgets.
For any , , we define vectors and :
[TABLE]
In other words, for and we have as well as if and otherwise.
The key idea is as follows. Consider a structured alignment for the above vectors, where and . This chooses some tuple and aligns the pairs for all , additional to some trivial pairs where the coordinate of is 0. This allows us to determine whether is orthogonal.
To formalize this, create by replacing each 0- and 1-entry in by and (from Definition 3.15), and create by replacing each 0- and 1-entry in by and , respectively. Let and be the types of and , respectively. Set and . We define the tuple gadgets
[TABLE]
Let denote the types of , , and let be the number obtained from Definition 3.13 when creating , . Note that , and do not depend on the choice of .
Claim 3.17**.**
Let and set and . If there exists such that are orthogonal, then . Otherwise .
Proof.
If there is an for which are orthogonal, let be such that , where is the -th tuple in the lexicographic ordering of . The structured alignment satisfies
[TABLE]
Furthermore, for any , we have , since contains at least summands of value at least . Thus by Definition 3.13.
Otherwise, if no such exists, let be arbitrary. If is a structured alignment, then
[TABLE]
since there exists some with which contributes a value of .
If is unstructured, then either , in which case we have
[TABLE]
or and , and thus
[TABLE]
Thus by Definition 3.13, . ∎
Normalization.
As usual in these kinds of reductions, we need a normalization step. We define a normalization sequence as
[TABLE]
Claim 3.18**.**
For any , we have .
Proof.
Let and . Let be a structured alignment. Then by construction of and , the only pair corresponding to and possibly entries is the pair , since only the last entries of are , and the only possible -entry of that could be aligned with one of them is its final entry. Now we use that we constructed the vectors as , i.e., we augmented all vectors by a -th coordinate 1, which implies that the -th entry of is indeed . Hence, the pair contributes a distance of while all others contribute . This yields .
Let be an unstructured alignment. Then its cost is at least , since it contains at least summands of value and at least one punishment term for a deviation from a structured assignment. Thus by Definition 3.13, we have . ∎
We now define for any , the normalized tuple gadgets
[TABLE]
We let denote the resulting types of , and be the number obtained from Definition 3.13 when creating . Note that , and do not depend on the choice of . This definitions satisfies the following properties.
Claim 3.19**.**
Let . If there exists such that are orthogonal, then , otherwise we have , where
[TABLE]
Proof.
We check all possible alignments : If , then . If , we have . For the only unstructured alignment , we have . Thus by Definition 3.13, we have . The claim now follows from Claims 3.17 and 3.18. ∎
Final construction.
To obtain our final instance, we enumerate all and in an arbitrary fashion. We finally combine their corresponding normalized tuple gadgets by defining
[TABLE]
Let be the number obtained from Definition 3.13 when creating , .
Claim 3.20**.**
We have if and only if there are such that is orthogonal.
Proof.
Assume that there exists an orthogonal set of vectors and let , , be the vectors representing them. Let and . If , we consider the structured alignment . Then aligns , yielding cost by Claim 3.19. Since