December 09, 2024
One fundamental question in database theory is the following: Given a Boolean Conjunctive Query (BCQ) \(Q\), what is the best complexity for computing the answer to \(Q\) in terms of the input database size \(N\)? When restricted to the class of combinatorial algorithms, the best known complexity for any query \(Q\) is captured by the submodular width of \(Q\) [1]–[3]. However, beyond combinatorial algorithms, certain queries are known to admit faster algorithms that often involve a clever combination of fast matrix multiplication and data partitioning. Nevertheless, there is no systematic way to derive and analyze the complexity of such algorithms for arbitrary queries \(Q\).
In this work, we introduce a general framework that captures the best complexity for answering any BCQ \(Q\) using matrix multiplication. Our framework unifies both combinatorial and non-combinatorial techniques under the umbrella of information theory. It generalizes the notion of submodular width to a new stronger notion called the \(\omega\)-submodular width that naturally incorporates the power of fast matrix multiplication. We describe a matching algorithm that computes the answer to any query \(Q\) in time corresponding to the \(\omega\)-submodular width of \(Q\). We show that our framework recovers the best known complexities for Boolean queries that have been studied in the literature, to the best of our knowledge, and also discovers new algorithms for some classes of queries that improve upon the best known complexities.
We focus on the problem of answering a Boolean Conjunctive Query (BCQ) \(Q\). In particular, we have a set \(\text{\sf vars}(Q)\) of variables (or attributes) and a set \(\mathsf{atoms}(Q)\) of relations where each relation \(R(\boldsymbol{X})\in\mathsf{atoms}(Q)\) is over a variable set \(\boldsymbol{X} \subseteq \text{\sf vars}(Q)\). In particular, each relation \(R(\boldsymbol{X})\) is a list of satisfying assignments to the variables \(\boldsymbol{X}\), and the query \(Q\) asks whether there exists an assignment to all variables \(\text{\sf vars}(Q)\) that simultaneously satisfies all relations in \(\mathsf{atoms}(Q)\): \[\begin{align} Q() \text{ :- }\bigwedge_{R(\boldsymbol{X}) \in \mathsf{atoms}(Q)} R(\boldsymbol{X}) \label{eq:bcq} \end{align}\tag{1}\] We assume the query to be fixed, hence its size is a constant, and we measure the runtime in terms of the total size of the input relations, denoted by \(N\), i.e., we use data complexity. For brevity, throughout the paper, we refer to a Boolean conjunctive query as just “query”.
Using only combinatorial algorithms, the best known complexity for any query \(Q\) is given by the submodular width [1]–[3]. However, when fast matrix multiplication is allowed, some isolated queries admit faster algorithms, but there is no general framework to derive such algorithms for any query. In this paper, we introduce such a framework that naturally unifies both combinatorial and non-combinatorial techniques under the umbrella of information theory. In particular, we generalize the submodular width to incorporate matrix multiplication and develop a matching algorithm. We show that our general algorithm matches or improves upon the best known custom algorithms for queries that have been studied in the literature.
A preliminary, short version of this paper appeared in [4]. That version described the algorithm only at an intuitive level. The current paper contains the full details of the algorithm, proves its runtime, and removes a polylogarithmic factor from the runtime by incorporating new techniques described in [5].
We start with some background on combinatorial algorithms for queries. When restricted to the class of combinatorial algorithms, there are only three basic techniques that are sufficient to recover the best-known complexity over this class of algorithms for any query \(Q\):
For-loops: Worst-case optimal join (WCOJ) algorithms [6], [7], like GenericJoin [8] or LeapFrog-TrieJoin [9], can be viewed as a sequence of nested for-loops, each of which iterates over possible assignments of one variable. For example, consider the Boolean triangle query: \[\begin{align} Q_\triangle() \text{ :- }R(X, Y) \wedge S(Y, Z) \wedge T(X, Z) \label{eq:intro:triangle} \end{align}\tag{2}\] One possible WCOJ algorithm consists of a for-loop over the intersection of \(X\)-values from \(R\) and \(T\), and for each such assignment, a for-loop over the intersection of \(Y\)-values from \(R\) and \(S\), and for each such assignment, a for-loop over the intersection of \(Z\)-values from \(S\) and \(T\). This simple algorithm gives a runtime of \(O(N^{3/2})\) for this query and \(O(N^{\rho^*(Q)})\) in general, where \(\rho^*(Q)\) is the fractional edge cover number of \(Q\), which is also an upper bound on the join size [10]–[12].
Tree Decompositions (TDs): Sometimes, two nested loops can be (conditionally) independent of one other. For example, consider the query: \[\begin{align} \label{eq:intro:triangletriangle} Q_{\triangle\triangle}() \text{ :- }R(X, Y) \wedge S(Y, Z) \wedge T(X, Z) \wedge S'(Y, Z') \wedge T'(X, Z') \end{align}\tag{3}\] We could solve it in time \(O(N^2)\) using 4 nested for-loops over \(X\), \(Y\), \(Z\), and \(Z'\) in order. However, note that once we fix the values of \(X\) and \(Y\), the two inner loops over \(Z\) and \(Z'\) become independent, hence can be unnested. One way to capture and utilize such conditional independence is using the framework of tree decompositions, which are a form of query plans. In this example, we could break down the query using a tree decomposition, or TD for short, consisting of two “bags” (i.e. two subqueries in the query plan) where one bag corresponds to a triangle query over \(\{X, Y, Z\}\) while the other bag is a triangle query over \(\{X, Y, Z'\}\), thus leading to a runtime of \(O(N^{3/2})\). Using TDs (alongside for-loops), we can answer any query \(Q\) in time \(O(N^{\textsf{fhtw}(Q)})\) where \(\textsf{fhtw}(Q)\) is the fractional hypertree width of \(Q\) [10], [13], [14].
Data Partitioning: For-loops and TDs alone are not sufficient to unleash the full power of combinatorial join algorithms for all queries. Consider the following 4-cycle query: \[\begin{align} Q_\square() \text{ :- }R(X, Y) \wedge S(Y, Z) \wedge T(Z, W) \wedge U(W, X) \label{eq:intro:4cycle} \end{align}\tag{4}\] \(Q_\square\) admits two TDs: one with two bags \(\{X, Y, Z\}\) and \(\{Z, W, X\}\), while the other with two bags \(\{Y, Z, W\}\) and \(\{W, X, Y\}\). However, using either TD alone, we cannot achieve a runtime better than \(O(N^2)\). On the other hand, if we partition the input relations carefully into multiple parts, and select a proper TD for each part, we could achieve a runtime of \(O(N^{3/2})\) [15]. Partitioning is done based on the “degrees” of relations where we think of a (binary) relation like \(R(X, Y)\) as a bipartite graph, and compute degrees of vertices accordingly. Taking the partitioning approach to the extreme2, the \(\mathsf{PANDA}\) algorithm [2], [3] can solve any query \(Q\) in time \(O(N^{\textsf{subw}(Q)}\cdot \text{\sf polylog}(N))\) where \(\textsf{subw}(Q)\) is the submodular width of \(Q\) [1]. An improved algorithm, called \(\textsf{PANDAExpress}\) [5], removes the polylogarithmic factor, achieving a runtime of \(O(N^{\textsf{subw}(Q)}\cdot \log N)\).
The submodular width is a single definition that combines the above three techniques, and the corresponding \(\mathsf{PANDA}\) algorithm achieves (up to a polylogarithmic factor) the best-known complexity for any query \(Q\) over combinatorial algorithms. The submodular width and \(\mathsf{PANDA}\) have a deep connection to information theory. At a very high level, the submodular width of a given query \(Q\) can be thought of as aiming to capture the best complexity of answering \(Q\) using the following meta-algorithm: Think of (binary) input relations, like \(R(X, Y)\) above, as bipartite graphs, and partition each of them into (a polylogarithmic number of) parts that are almost “uniform”, i.e. where all vertices within the same part have roughly the same degree. Now each part of the data can be described by its combination of degrees, called “degree configuration”. For each degree configuration, we pick the best TD, go over its bags, and solve the corresponding subqueries, using for-loops.3 Instead of reasoning about degree configurations directly, we model them as edge-dominated polymatroids, or ED-polymatroids for short, which is an information-theoretic concept. In particular, given a degree configuration, the corresponding polymatroid is roughly the entropy of a certain probability distribution over the join of input relations having the given degree configuration. (Formal Definition will be given in Sec. 3.) Using polymatroids as a proxy to degree configurations allows us to transform a database problem into an information-theoretic problem. To sum up, the submodular width has the following skeleton (the formal definition will be given later): \[\begin{align} \textsf{subw}(Q) \quad\stackrel{\mathrm{def}}{=}\quad \underbrace{\max_{\text{ED-polymatroid \boldsymbol{h}}}}_{\substack{\text{worst part}\\\text{of the data}}} \quad \underbrace{\min_{\text{tree decomposition T}}}_{\substack{\text{best query plan}\\\text{for this part}}} \quad \underbrace{\max_{\text{bag B\in T}}}_{\substack{\text{worst subquery}\\\text{in the plan}}} \quad \underbrace{h(B)}_{\substack{\text{subquery cost}\\\text{(using for-loops)}}} \label{eq:intro:subw} \end{align}\tag{5}\]
For certain queries, there are known non-combinatorial algorithms with lower complexity than the best known combinatorial algorithms. In addition to the three techniques mentioned above, these non-combinatorial algorithms typically involve a fourth technique, which is matrix multiplication, or MM for short. For background, given two \(n\times n\) matrices, there are algebraic algorithms that can multiply them in time \(o(n^3)\). The matrix multiplication exponent \(\omega\) is the smallest exponent \(\alpha\) where this multiplication can be done in time \(O(n^{\alpha})\). It was first discovered by Strassen [16] that \(\omega < 3\), and to date, the best known upper bound for \(\omega\) is \(2.371552\) [17]. For certain queries, incorporating MM can lead to faster algorithms by first partitioning the data based on degrees, and then for each part, choosing to either perform an MM or to use a traditional combinatorial algorithm (consisting of a TD and for-loops). Which choice is better depends on the degree configuration of the part. For parts with low degrees, combinatorial algorithms are typically better, while parts with high degrees tend to benefit from MM. The complexities of such algorithms typically involve \(\omega\). For example, for the triangle query \(Q_\triangle\), there is a non-combinatorial algorithm with complexity \(O(N^{\frac{2\omega}{\omega + 1}})\) [15].4 However, such non-combinatorial algorithms are only known for some isolated queries; see Table 1 for a summary of known results. There is no general framework for answering any query \(Q\) using MM.
| Query | Best Prior Algorithm | Our Algorithm |
|---|---|---|
| query \(Q\) | \(O(N^{\subw(Q)}\cdot\log N)\) [2], [3], [5] | \(O(N^{\osubw(Q)}\cdot \log^2 N)\) |
| Triangle \(Q_\triangle\) (Eq. [eq:intro:triangle]) | \(O\left(N^{\frac{2\omega}{\omega+1}}\right)\) [15] | same |
| 4-Clique | \(O\left(N^\frac{\omega+1}{2}\right)\) [19] | same |
| 5-Clique | \(O\left(N^{\frac{\omega}{2} + 1}\right)\) [19] | same |
| \(k\)-Clique (\(k\ge 6\)) | \(O\left(N^{\rectOmega(\frac{1}{2} \cdot \lceil \frac{k}{3}\rceil, \frac{1}{2} \cdot \lceil \frac{k-1}{3}\rceil, \frac{1}{2} \cdot \lfloor \frac{k}{3}\rfloor)}\right)\) [20] | \(O\left(N^{\frac{1}{2} \cdot \lceil \frac{k}{3}\rceil + \frac{1}{2} \cdot \lceil \frac{k-1}{3}\rceil + \frac{1}{2} \cdot \lfloor \frac{k}{3}\rfloor \cdot (\omega-2)}\right)\) |
| 4-Cycle \(Q_\square\) (Eq. [eq:intro:4cycle]) | \(O\left(N^{\frac{4\omega-1}{2\omega+1}}\right)\) [18], [21] | \(O\left(N^{\frac{4\omega-1}{2\omega+1}}\cdot\log^2 N\right)\) |
| \(k\)-Cycle | \(O\left(N^{\rectC_k}\cdot{\color{red}\polylog(N)}\right)\) [18], [21] | \(O\left(N^{\squareC_k}\cdot{\color{darkgreen}\log^2 N}\right)\) |
| (\(\rectC_k = \squareC_k\) for \(\omega = 2\)) | ||
| \(k\)-Pyramid (Eq. [eq:body:k-pyramid]) | \(O\left(N^{\color{red}2-\frac{1}{k}}\cdot \log N\right)\) [2], [3], [5] | \(O\left(N^{\color{darkgreen}2-\frac{2}{\omega(k-1)-k+3}}\cdot\log^2 N\right)\) |
In this paper, we make the following contributions: (Recall that a “query” refers to a Boolean conjunctive query.)
We introduce a generalization of the submodular width of a query \(Q\), called the \(\omega\)-submodular width of \(Q\), and denoted by \(\textsf{\omega-subw}(Q)\), that naturally incorporates the power of matrix multiplication. The \(\omega\)-submodular width is always upper bounded by the submodular width, and becomes identical when \(\omega = 3\).
We introduce a general framework to compute any query \(Q\) in time \(O(N^{\textsf{\omega-subw}(Q)}\cdot \log^2 N)\) for any rational5 value of \(\omega\). Our framework unifies known combinatorial and non-combinatorial techniques under the umbrella of information theory. (The extra \(\log^2 N\) factor is not needed for every query, e.g. \(k\)-Clique in Table1.)
We show that for any query \(Q\), our framework recovers the best known complexity for \(Q\) over both combinatorial and non-combinatorial algorithms. See Table 1.
We show that there are classes of queries where our framework discovers new algorithms with strictly lower complexity than the best-known ones. See highlighted cells in Table 1.
The intuition behind the connection between our framework and information theory is as follows: Information inequalities can be used to prove an upper bound on the size of every intermediate result in the query plan. At the same time, any algorithm, with a proven runtime, also leads to an upper bound on the size of all intermediate results, since these cannot be larger than the runtime of the algorithm. Hence, there is a connection between information inequalities and algorithms, namely both imply upper bounds on all intermediate results of the algorithm. What is non-obvious is how to convert the information inequalities into an algorithm: this is what the \(\mathsf{PANDA}\) algorithm did [2], [3], and what we extend in our paper to handle matrix multiplication. We give an overview of how to convert information inequalities into an algorithm in Section 2.
In Section 2, we present a high-level overview of our framework and illustrate it using the triangle query \(Q_\triangle\). In Section 3, we give formal definitions for background concepts. We formally define the \(\omega\)-submodular width in Section 4. We show in Section 5 the \(\omega\)-submodular width for several classes of queries, with proofs deferred to Appendix 11. In Sections 6, we give an algorithm for computing the \(\omega\)-submodular for any query \(Q\). Section 7 is the technical core of the paper where we present our algorithm for computing the answer to any query \(Q\) in \(\omega\)-subdmodular width time. We conclude in Section 9 with some extensions and open problems.
We give here a simplified overview of our framework. We start with how to generalize the subdmodular width to incorporate MM, and to that end, we need to answer two basic questions:
Q1: How can we express the complexity of MM in terms of polymatroids?
Q2: How can we develop a notion of query plans that naturally reconciles TDs with MM?
Given a query \(Q\) of the form 1 , a polymatroid is a function \(\boldsymbol{h}:2^{\text{\sf vars}(Q)}\to \mathbb{R}_+\) that satisfies the basic Shannon inequalities. By that, we mean \(\boldsymbol{h}\) is monotone (i.e. \(h(\boldsymbol{X})\leq h(\boldsymbol{Y})\) for all \(\boldsymbol{X}\subseteq \boldsymbol{Y}\subseteq \text{\sf vars}(Q)\)), submodular (i.e. \(h(\boldsymbol{X})+h(\boldsymbol{Y}) \geq h(\boldsymbol{X} \cup \boldsymbol{Y}) + h(\boldsymbol{X} \cap \boldsymbol{Y})\) for all \(\boldsymbol{X}, \boldsymbol{Y}\subseteq\text{\sf vars}(Q)\)), and satisfies \(h(\emptyset) = 0\). Given a query \(Q\), a polymatroid \(\boldsymbol{h}\) is edge-dominated if \(h(\boldsymbol{X})\leq 1\) for all \(R(\boldsymbol{X})\in\mathsf{atoms}(Q)\). The subdmodular width, given by Eq. 5 , uses edge-dominated polymatroids as a proxy for the degree configurations of different parts of the data.
Throughout the paper, we assume that \(\omega\) is a fixed constant within the range \([2, 3]\). Given two rectangular matrices of dimensions \(n^a\times n^b\) and \(n^b\times n^c\), we can multiply them by partitioning them into square blocks of dimensions \(n^d\times n^d\) where \(d \stackrel{\mathrm{def}}{=}\min(a, b, c)\) and then multiplying each pair of blocks using square matrix multiplication in time \(n^{d\cdot \omega}\). This is a folklore idea, e.g. [22]. It leads to an overall runtime of \(n^{ \omega^{\square} (a, b, c)}\) where \(\omega^{\square} (a, b, c)\) is defined below and \(\gamma \stackrel{\mathrm{def}}{=}\omega - 2\): (Proof is in Sec. 3.) \[\begin{align} \omega^{\square} (a, b, c) \stackrel{\mathrm{def}}{=}\max\{a + b + \gamma \cdot c,\quad a + \gamma \cdot b + c,\quad \gamma \cdot a + b + c\} \label{eq:rect-mat-mult} \end{align}\tag{6}\]
Now suppose we have two relations \(R(X, Y)\) and \(S(Y, Z)\), and we want to compute \(P(X, Z) \text{ :- }\) \(R(X, Y) \wedge S(Y, Z)\), by viewing \(R\) and \(S\) as two matrices of dimensions \(n^a\times n^b\) and \(n^b \times n^c\) respectively and multiplying them. In the polymatroid world, we can think of \(h(X)\), \(h(Y)\), and \(h(Z)\) as representing \(a\), \(b\), and \(c\), respectively. Motivated by this, we define the following new information measure: \[\begin{align} \mathsf{MM}(X; Y; Z) \stackrel{\mathrm{def}}{=}\max(h(X)+h(Y)+\gamma h(Z), \;\; h(X)+\gamma h(Y)+h(Z), \;\; \gamma h(X)+h(Y)+h(Z)) \label{eq:intro:mm} \end{align}\tag{7}\] And now, we can use \(\mathsf{MM}(X; Y; Z)\) to capture the complexity of the above MM, on log-scale. We also extend the \(\mathsf{MM}\) notation to allow treating multiple variables as a single dimension. For example, given the query \(Q_{\triangle\triangle}\) from Eq. 3 , we use \(\mathsf{MM}(X;Y;ZZ')\) to refer to the cost of MM where we treat \(Z\) and \(Z'\) as a single dimension. In particular, we view \(R(X, Y)\) as one matrix and \(S(Y, Z) \wedge S'(Y, Z')\) as another matrix, and multiply them to get \(P(X, Z, Z')\).
Variable Elimination [23]–[26] is a language for expressing query plans that is known to be equivalent to TDs [14] for combinatorial join algorithms. We show that variable elimination can be naturally extended to incorporate MM in its query plans. For background, given a query \(Q\), variable elimination refers to the process of picking an order \(\boldsymbol{\sigma}\) of the variables \(\text{\sf vars}(Q)\), known as variable elimination order, or VEO for short, and then going through the variables in order and “eliminating” them one-by-one. Eliminating a variable \(X\) from a query \(Q\) means transforming \(Q\) (along with the associated input data) into an equivalent query \(Q'\) (with new input data) that doesn’t contain \(X\), and this is done by removing all relations that contain \(X\) and creating a new relation with all variables that co-occurred with \(X\). (Formal Definition will be given in Sec. 3.) For example, given the 4-cycle query \(Q_\square\) from Eq. 4 , we can eliminate \(Y\) by computing a new relation \(P(X, Z) \text{ :- }R(X, Y) \wedge S(Y, Z)\) and now the remaining query becomes a triangle query: \[\begin{align} Q_\square'() \text{ :- }P(X, Z) \wedge T(Z, W) \wedge U(W, X) \end{align}\] We use \(U_Y^{\boldsymbol{\sigma}}\) to refer to the set of variables involved in the subquery that eliminates \(Y\), which is \(\{X, Y, Z\}\) in this example. Every VEO is equivalent to a TD, and vice versa [14]. In the 4-cycle example, any VEO that eliminates either \(X\) or \(Z\) first is equivalent to the TD with bags \(\{Y,Z,W\}\) and \(\{W, X, Y\}\), while any VEO that eliminates either \(Y\) or \(W\) first is equivalent to the TD with bags \(\{X, Y, Z\}\) and \(\{Z, W, X\}\).
In the presence of MM, VEOs become more expressive. For example, the triangle query \(Q_\triangle\) has only one trivial TD with a single bag \(\{X, Y, Z\}\). Now, suppose we have a VEO that eliminates \(Y\) first. There are two different ways to eliminate \(Y\):
Either compute the full join combinatorially using for-loops, and then project \(Y\) away. This computation costs \(h(XYZ)\) on log-scale.
Or view \(R(X, Y)\) and \(S(Y, Z)\) as matrices and multiply them to get \(P(X, Z)\). This costs \(\mathsf{MM}(X; Y; Z)\).
Alternatively, we could have eliminated either \(X\) or \(Z\) first. In this simple example, there is only a single way to eliminate a variable, say \(Y\), using MM, but in general, there could be several, and we can choose the best of them. For example, in the query \(Q_{\triangle\triangle}\) from Eq. 3 , \(Y\) occurs in three relations, and we can arrange them into two matrices in different ways. One way is to join \(S(Y,Z)\) and \(S'(Y,Z')\) into a single matrix \(S''(Y,ZZ')\) and multiply it with the matrix \(R(X,Y)\) leading to a cost of \(\mathsf{MM}(X;Y;ZZ')\). Alternatively, we could have obtained costs \(\mathsf{MM}(XZ;Y;Z')\) or \(\mathsf{MM}(XZ';Y;Z)\), and we will see later that there are even more options! 6 Given a VEO \(\boldsymbol{\sigma}\) and a variable \(Y\), we use \(\mathsf{EMM}_Y^{\boldsymbol{\sigma}}\) to denote the minimum cost of eliminating \(Y\) using MM. In contrast, \(h(U_Y^{\boldsymbol{\sigma}})\) is the cost of eliminating \(Y\) using for-loops. For example, in \(Q_\triangle\), \(\mathsf{EMM}_Y^{\boldsymbol{\sigma}}=\mathsf{MM}(X; Y; Z)\) and \(h(U_Y^{\boldsymbol{\sigma}}) = h(XYZ)\), whereas in \(Q_{\triangle\triangle}\), \(\mathsf{EMM}_Y^{\boldsymbol{\sigma}}=\) \(\min(\mathsf{MM}(X;Y;ZZ'),\mathsf{MM}(XZ;Y;Z'),\mathsf{MM}(XZ';Y;Z),\ldots)\) and \(h(U_Y^{\boldsymbol{\sigma}}) = h(XYZZ')\).
Putting pieces together, we are now ready to define our notion of \(\omega\)-subdmodular width of a query \(Q\). We take the maximum over all ED-polymatroids \(\boldsymbol{h}\), and for each polymatroid, we take the minimum over all VEOs \(\boldsymbol{\sigma}\). For each \(\boldsymbol{\sigma}\), we take the maximum elimination cost over all variables \(X\), where the elimination cost of \(X\) is the minimum over all possible ways to eliminate \(X\) using either for-loops or MM: \[\begin{align} \textsf{\omega-subw}(Q) \stackrel{\mathrm{def}}{=} \underbrace{\max_{\text{ED-polymatroid \boldsymbol{h}}}}_{\substack{\text{worst part}\\\text{of the data}}} \quad \underbrace{\min_{\text{VEO \boldsymbol{\sigma}}}}_{\substack{\text{best query plan}\\\text{for this part}}} \quad \underbrace{\max_{\text{variable X}}}_{\substack{\text{worst variable}\\\text{elimination cost}}} {\color{red}\min\bigl(} \underbrace{h(U_X^{\boldsymbol{\sigma}})}_{\substack{\text{cost of eliminating}\\\text{X using for-loops}}}{\color{red}, \quad \underbrace{\mathsf{EMM}_X^{\boldsymbol{\sigma}}}_{\substack{\text{cost of eliminating}\\\text{X using MM}}} \bigr)} \label{eq:intro:osubw} \end{align}\tag{8}\] To compare the above to the submodular width, we include below an alternative definition of the submodular width that is equivalent to Eq. 5 . The equivalence follows from the equivalence of VEOs and TDs [14]: \[\begin{align} \textsf{subw}(Q) \stackrel{\mathrm{def}}{=} \underbrace{\max_{\text{ED-polymatroid \boldsymbol{h}}}}_{\substack{\text{worst part}\\\text{of the data}}} \quad \underbrace{\min_{\text{VEO \boldsymbol{\sigma}}}}_{\substack{\text{best query plan}\\\text{for this part}}} \quad \underbrace{\max_{\text{variable X}}}_{\substack{\text{worst variable}\\\text{elimination cost}}}\quad \underbrace{h(U_X^{\boldsymbol{\sigma}})}_{\substack{\text{cost of eliminating}\\\text{X using for-loops}}} \label{eq:intro:subw:ve} \end{align}\tag{9}\] The only difference between Eq. 8 and Eq. 9 is the inclusion of \(\color{red}\mathsf{EMM}_X^{\boldsymbol{\sigma}}\) in the former. This shows that \(\textsf{\omega-subw}(Q)\) is always upper bounded by \(\textsf{subw}(Q)\). We show later that they become identical when \(\omega = 3\).
For example, \(Q_\triangle\) has 6 different VEOs. For a fixed VEO, the cost of eliminating the first variable dominates the other two, thus we ignore the two. We have seen before that the cost of eliminating \(Y\) is \(\min(h(XYZ), \mathsf{MM}(X;Y;Z))\), which also happens to be the cost of eliminating either \(X\) or \(Z\).7 Hence, the \(\omega\)-subdmodular width becomes: \[\begin{align} \textsf{\omega-subw}(Q_\triangle) = \max_{\text{ED-polymatroid \boldsymbol{h}}} {\color{red}\min\bigl(}h(XYZ){\color{red}, \mathsf{MM}(X;Y;Z)\bigr)} \label{eq:intro:osubw:triangle} \end{align}\tag{10}\]
Now that we have defined the \(\omega\)-submodular width, our next concern is how to compute it for a given query \(Q\). The \(\omega\)-submodular width is a deeply nested expression of min and max. (Recall that \(\mathsf{EMM}_X^{\boldsymbol{\sigma}}\) is a minimum of potentially many terms of the form \(\mathsf{MM}(X; Y; Z)\), each of which is a maximum of three terms in Eq. 7 .) To compute \(\textsf{\omega-subw}(Q)\), we first pull all \(\max\) operators outside by distributing \(\min\) over \(\max\)8, and then swap the order of the \(\max\) operators so that the max over \(\boldsymbol{h}\) is the inner most max. Applying this to Eq. 10 , we get: \[\begin{align} \textsf{\omega-subw}(Q_\triangle) = \max\bigl( & \max_{\text{ED-polymatroid \boldsymbol{h}}}\min(h(XYZ), h(X) + h(Y) + \gamma h(Z)),\nonumber\\ & \max_{\text{ED-polymatroid \boldsymbol{h}}}\min(h(XYZ), h(X) + \gamma h(Y) + h(Z)),\nonumber\\ & \max_{\text{ED-polymatroid \boldsymbol{h}}}\min(h(XYZ), \gamma h(X) + h(Y) + h(Z)) \bigr) \label{eq:intro:osubw:triangle:distributed} \end{align}\tag{11}\] Assume that \(\gamma\stackrel{\mathrm{def}}{=}\omega - 2\) is fixed, and consider the first term inside the outermost max above. We can turn this term into a linear program (LP) by introducing a new variable \(t\) and replacing the \(\min\) operator with a max of \(t\) subject to some upper bounds on \(t\): \[\begin{align} \max_{\substack{t \in \mathbb{R}\\ \text{ED-polymatroid \boldsymbol{h}}}} \left\{ t \quad\mid\quad t \leq h(XYZ), \quad t \leq h(X) + h(Y) + \gamma h(Z) \right\} \label{eq:intro:inner-lp:triangle} \end{align}\tag{12}\] Recall that the polymatroid \(\boldsymbol{h}\) is a function \(\boldsymbol{h}:2^{\{X,Y,Z\}}\to \mathbb{R}_+\) that satisfies the basic Shannon inequalities, or, equivalently, a vector in \(\mathbb{R}_+^{2^3}\) subject to certain linear constraints. Thus, Eq. 12 is linear program, and we will denote by \(\mathsf{opt}\) its optimal objective value. We will show that \(\mathsf{opt}= \frac{2\omega}{\omega+1}\). Since the other two LPs are similar, it follows that \(\textsf{\omega-subw}(Q_\triangle)=\frac{2\omega}{\omega+1}\).
First, we show that \(\mathsf{opt}\geq \frac{2\omega}{\omega+1}\). To that end, consider the following polymatroid (where \(h(\emptyset) = 0)\): \[\begin{align} h(X) = h(Y) = h(Z) = \frac{2}{\omega+1},\quad\quad h(XY) = h(YZ) = h(XZ) = 1,\quad\quad h(XYZ) = \frac{2\omega}{\omega+1}. \end{align}\] It can be verified that this is a valid polymatroid (for any \(\omega \in [2, 3]\)), it is edge-dominated, and forms a feasible (primal) solution to the LP (alongside \(t = \frac{2\omega}{\omega+1}\)), thus proving that \(\mathsf{opt}\geq \frac{2\omega}{\omega+1}\). In the next section, we will show a feasible dual solution that proves \(\mathsf{opt}\leq \frac{2\omega}{\omega+1}\).
We now give a simplified overview of our algorithm for computing the answer to a query \(Q\) in time \(O(N^{\textsf{\omega-subw}(Q)}\cdot \log^2 N)\). The extra factor of \(\log^2 N\) does not manifest in every query, and it doesn’t manifest in the triangle query \(Q_\triangle\), which we will use as an example. It should be noted however that this simple example of \(Q_\triangle\) is not sufficient to reveal the major technical challenges of designing the general algorithm. Many of these challenges are unique to matrix multiplication, and are not encountered in the original \(\mathsf{PANDA}\) algorithm [2], [3], or its improved version [5]. We explain our general algorithm in detail in Section 7.
A Shannon inequality is an inequality that holds over all polymatroids \(\boldsymbol{h}\). The following Shannon inequality corresponds to a feasible dual solution to the LP from Eq. 12 : \[\begin{align} \omega \underbrace{h(XYZ)}_{\substack{\rotatebox{90}{\leq}\\t \\\text{\color{red}(for-loop cost)}}} + \underbrace{h(X) + h(Y) + \gamma h(Z)}_{\substack{\rotatebox{90}{\leq}\\t \\\text{\color{red}(one term of MM cost)}}} \quad\leq\quad 2 \underbrace{h(XY)}_{\substack{\rotatebox{-90}{\leq}\\1\\\color{red}(R(X, Y))}} + (\omega-1) \underbrace{h(YZ)}_{\substack{\rotatebox{-90}{\leq}\\1\\\color{red}(S(Y, Z))}} + (\omega - 1) \underbrace{h(XZ)}_{\substack{\rotatebox{-90}{\leq}\\1\\\color{red}(T(X, Z))}} \label{eq:intro:shannon:triangle} \end{align}\tag{13}\] In particular, the above is a Shannon inequality because it is a sum of the following submodularities: \[\begin{align} h(XYZ) + h(X) &\leq h(XY) + h(XZ)\\ h(XYZ) + h(Y) &\leq h(XY) + h(YZ)\\ \gamma h(XYZ) + \gamma h(Z) &\leq \gamma h(XZ) + \gamma h(YZ) \end{align}\] Since \(\boldsymbol{h}\) is edge-dominated, each term on the RHS of Eq. 13 is upper bounded by 1, hence the RHS is \(\leq 2 \omega\). On the other hand, by Eq. 12 , the LHS is at least \((\omega + 1)t\). Therefore, Inequality 13 implies \(t \leq \frac{2\omega}{\omega + 1}\), hence \(\mathsf{opt}\leq\frac{2\omega}{\omega + 1}\). Each term on the RHS of Eq. 13 corresponds to one input relation, whereas each group of terms on the LHS corresponds to the cost of solving a subquery in the plan. In particular, the group \(h(XYZ)\) corresponds to the cost of solving the query using for-loops, whereas the group \(h(X) + h(Y) + \gamma h(Z)\) corresponds to one of three terms that capture the cost of solving the query using MM.
First, the algorithm constructs a proof sequence of the Shannon inequality 13 , which is a step-by-step proof of the inequality that transforms the RHS into the LHS. Figure 1 (left) shows the proof sequence for Eq. 13 . Then, the algorithm translates each proof step into a corresponding database operation. In particular, initially each term on the RHS of Eq. 13 corresponds to an input relation. Each time we apply a proof step replacing some terms on the RHS with some other terms, we simultaneously apply a database operation replacing the corresponding relations with some new relations. Figure 1 (right) shows the corresponding database operations, which together make the algorithm for answering \(Q_\triangle\). In this example, there are only two types of proof steps:
Decomposition Step of the form \(h(XY) \to h(X) + h(Y|X)\). Let \(R(X, Y)\) be the relation corresponding to \(h(XY)\). The corresponding database operation is to partition \(R(X, Y)\) into two parts based on the degree of \(X\), i.e. the number of matching \(Y\)-values for a given \(X\). In particular, \(X\)-values with degree \(> \Delta \stackrel{\mathrm{def}}{=}N^{\frac{\omega-1}{\omega+1}}\) go into in the “heavy” part \(R_h(X)\), whereas the remaining \(X\)-values (along with their matching \(Y\)-values) go into the “light” part \(R_\ell(X, Y)\). Note that \(|R_h|\) cannot exceed \(N/\Delta = N^{\frac{2}{\omega+1}}\).
Submodularity Step9 of the form \(h(XZ) + h(Y|X) \to h(XYZ)\). The corresponding database operation is to join the two corresponding relations, \(T(X, Z)\Join R_\ell(X, Y)\). Since \(R_\ell\) is the light part, this join takes time \(N\cdot N^{\frac{\omega-1}{\omega+1}}=\) \(N^{\frac{2\omega}{\omega+1}}\), as desired. The same goes for the other submodularity steps.
The three submodularity steps compute three relations \(Q_{\ell,1}, Q_{\ell,2}, Q_{\ell,3}\) covering triangles \((X, Y, Z)\) where either \(X\), \(Y\), or \(Z\) is light, and three unary relations \(R_h(X), S_h(Y), T_h(Z)\) containing all heavy elements. We use the latter to compute the triangles where all three nodes are heavy. For that, we use \(R_h(X)\), \(S_h(Y)\), and \(R(X,Y)\) to form a dense matrix \(M_1(X,Y)\), use \(S_h(Y), T_h(Z)\), and \(S(Y,Z)\) to form a matrix \(M_2(Y, Z)\), then multiply them to get \(M(X, Z)\). Since \(|R_h|, |S_h|, |T_h| \leq N^{\frac{2}{\omega+1}}\), this multiplication takes time \(N^{\frac{2\omega}{\omega+1}}\), as desired. Finally, we join \(M(X, Z)\) with \(T(X, Z)\) to get \(Q_h(X, Z)\). There exists a triangle if and only if either one of \(Q_{\ell,1}, Q_{\ell,2}, Q_{\ell,3}\) or \(Q_h\) is non-empty. In Section 7.6.1, we explain the general principle that leads to the above simple algorithm.
In this section, we present the formal definitions and notations for various background concepts that were introduced informally in the introduction. Given a number \(k\), we use \([k]\) to denote the set \(\{1, \ldots, k\}\).
A hypergraph \(\mathcal{H}\) is a pair \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\), where \(\mathcal{V}\) is a set of vertices, and \(\mathcal{E}\subseteq 2^{\mathcal{V}}\) is a set of hyperedges. Each hyperedge \(\boldsymbol{Z} \in \mathcal{E}\) is a subset of \(\mathcal{V}\). We typically use \(k\) to denote the number of vertices in \(\mathcal{V}\). Given a hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\) and a vertex \(X \in \mathcal{V}\), we define:
\(\partial_\mathcal{H}(X)\) is the set of hyperedges that contain \(X\), i.e. \(\partial_\mathcal{H}(X) \stackrel{\mathrm{def}}{=}\{{\boldsymbol{Z} \in \mathcal{E}}\mid{X \in \boldsymbol{Z}}\}\).
\(U_\mathcal{H}(X)\) is the union of all hyperedges that contain \(X\), i.e. \(U_\mathcal{H}(X) \stackrel{\mathrm{def}}{=}\bigcup_{\boldsymbol{Z} \in \partial_\mathcal{H}(X)} \boldsymbol{Z}\).
\(N_\mathcal{H}(X)\) is the set of neighbors of \(X\) (excluding \(X\)), i.e. \(N_\mathcal{H}(X) \stackrel{\mathrm{def}}{=}U_\mathcal{H}(X) \setminus \{X\}\).
When \(\mathcal{H}\) is clear from the context, we drop the subscript and simply write \(\partial(X)\), \(U(X)\), and \(N(X)\).
Example 1. Consider a hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\) with vertices \(\mathcal{V}= \{A, B, C, D, E\}\) and hyperedges \(\mathcal{E}= \{\{A, B, C\}, \{A, B, D\}, \{C, D, E\}\}\). Then: \[\begin{align} \partial(A) = \{\{A, B, C\}, \{A, B, D\}\}, \quad\quad U(A) = \{A, B, C, D\}, \quad\quad N(A) = \{B, C, D\}. \end{align}\]
Given a query \(Q\) of the form 1 , the hypergraph of \(Q\) is a hypergraph \(\mathcal{H}=(\mathcal{V}, \mathcal{E})\) where \(\mathcal{V}\stackrel{\mathrm{def}}{=}\text{\sf vars}(Q)\) and \(\mathcal{E}\stackrel{\mathrm{def}}{=}\{\boldsymbol{Z} \mid R(\boldsymbol{Z})\in\mathsf{atoms}(Q)\}\). We often use a query \(Q\) and its hypergraph \(\mathcal{H}\) interchangeably, e.g. in the contexts of tree decompositions, submodular width, etc.
Given a hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\) (or a query \(Q\) whose hypergraph is \(\mathcal{H}\)), a tree decomposition, or TD for short, is a pair \((T, \chi)\), where \(T\) is a tree, and \(\chi: \text{\sf nodes}(T) \to 2^\mathcal{V}\) is a map from the nodes of \(T\) to subsets of \(\mathcal{V}\), that satisfies the following properties:
For every hyperedge \(\boldsymbol{Z} \in \mathcal{E}\), there is a node \(t \in \text{\sf nodes}(T)\) such that \(\boldsymbol{Z} \subseteq \chi(t)\).
For every vertex \(X \in \mathcal{V}\), the set \(\{{t \in \text{\sf nodes}(T)}\mid{X \in \chi(t)}\}\) forms a connected sub-tree of \(T\).
Each set \(\chi(t)\) is called a bag of the tree decomposition. We use \(\mathcal{T}(\mathcal{H})\) to denote the set of all tree decompositions of \(\mathcal{H}\).
Given two sets of sets \(\mathcal{A}, \mathcal{B}\subseteq 2^\mathcal{V}\), we write \(\mathcal{A}\sqsubseteq \mathcal{B}\) if \(\forall \boldsymbol{A} \in \mathcal{A}, \exists \boldsymbol{B} \in \mathcal{B}: \boldsymbol{A} \subseteq \boldsymbol{B}\). The relation \(\sqsubseteq\) is a preorder, and we write \(\mathcal{A}\equiv \mathcal{B}\) when \(\mathcal{A}\sqsubseteq \mathcal{B}\) and \(\mathcal{B}\sqsubseteq \mathcal{A}\). We identify a tree decomposition with the set of its bags, and extend \(\sqsubseteq\) to a preorder on tree decompositions: \((T_1,\chi_1) \sqsubseteq (T_2,\chi_2)\) if \(\{{\chi_1(t)}\mid{t \in \text{\sf nodes}(T_1)}\}\sqsubseteq \{{\chi_2(t)}\mid{t \in \text{\sf nodes}(T_2)}\}\). The trivial tree decomposition, which consists of a single bag containing all vertices, is a maximal element of the preorder. A tree decomposition \((T,\chi)\) is redundant if it contains two different bags \(\chi(t_1) \subsetneq \chi(t_2)\). It is well-known that every tree decomposition is equivalent to a unique non-redundant one, obtained by removing bags that are contained in other bags.
Example 2. Consider the following hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\) that represents a 4-cycle: \[\begin{align} \mathcal{V}= \{A, B, C, D\}, \quad\quad \mathcal{E}= \{\{A, B\}, \{B, C\}, \{C, D\}, \{D, A\}\} \label{eq:4-cycle} \end{align}\tag{14}\] This hypergraph has the following two (non-trivial and non-redundant) tree decompositions:
A tree decomposition \((T_1, \chi_1)\) with two nodes \(t_{11}\) and \(t_{12}\) corresponding to two bags, \(\chi_1(t_{11}) = \{A, B, C\}\) and \(\chi_1(t_{12}) = \{C, D, A\}\).
A tree decomposition \((T_2, \chi_2)\) with two nodes \(t_{21}\) and \(t_{22}\) corresponding to two bags, \(\chi_2(t_{21}) = \{B, C, D\}\) and \(\chi_2(t_{22}) = \{D, A, B\}\).
Let \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\) be a hypergraph, \(k\stackrel{\mathrm{def}}{=}|\mathcal{V}|\), and \(\pi(\mathcal{V})\) denote the set of all permutations of \(\mathcal{V}\). Given a fixed permutation \(\boldsymbol{\sigma} = (X_1, \ldots, X_k) \in \pi(\mathcal{V})\), we define a sequence of hypergraphs \(\mathcal{H}_1^{\boldsymbol{\sigma}}, \ldots, \mathcal{H}_{k+1}^{\boldsymbol{\sigma}}\), called an elimination hypergraph sequence, as follows: \(\mathcal{H}_1^{\boldsymbol{\sigma}} \stackrel{\mathrm{def}}{=}\mathcal{H}\), and for \(i = 1, ... , k\), the hypergraph \(\mathcal{H}_{i+1}^{\boldsymbol{\sigma}} = (\mathcal{V}_{i+1}^{\boldsymbol{\sigma}},\mathcal{E}_{i+1}^{\boldsymbol{\sigma}})\) is defined recursively in terms of the previous hypergraph \(\mathcal{H}_{i}^{\boldsymbol{\sigma}} = (\mathcal{V}_{i}^{\boldsymbol{\sigma}},\mathcal{E}_{i}^{\boldsymbol{\sigma}})\) using: \[\begin{align} \mathcal{V}_{i+1}^{\boldsymbol{\sigma}} \stackrel{\mathrm{def}}{=}\mathcal{V}_{i}^{\boldsymbol{\sigma}} \setminus \{X_{i}\},\quad\quad\quad \mathcal{E}_{i+1}^{\boldsymbol{\sigma}} \stackrel{\mathrm{def}}{=}\mathcal{E}_{i}^{\boldsymbol{\sigma}} \setminus \partial_{\mathcal{H}_{i}^{\boldsymbol{\sigma}}}(X_{i}) \cup \{N_{\mathcal{H}_{i}^{\boldsymbol{\sigma}}}(X_i)\}. \end{align}\] In words, \(\mathcal{H}_{i+1}^{\boldsymbol{\sigma}}\) results from \(\mathcal{H}_{i}^{\boldsymbol{\sigma}}\) by removing the vertex \(X_i\) and replacing all hyperedges that contain \(X_i\) with a single hyperedge which is their union minus \(X_i\). We refer to the permutation \(\boldsymbol{\sigma}\) as a variable elimination order, or VEO for short. For convenience, for any \(i\in[k]\), we define \(\partial^{\boldsymbol{\sigma}}_i \stackrel{\mathrm{def}}{=}\partial_{\mathcal{H}_{i}^{\boldsymbol{\sigma}}}(X_i)\) and also define \(U^{\boldsymbol{\sigma}}_i\), and \(N^{\boldsymbol{\sigma}}_i\) analogously.
Example 3. Consider the 4-cycle hypergraph \(\mathcal{H}\) from Example 2 and the variable elimination order \(\boldsymbol{\sigma}_1 = (B, C, D, A)\). This elimination order results in the following sequence of hypergraphs: \[\begin{align} \mathcal{H}_1^{\boldsymbol{\sigma}_1} &= (\{A, B, C, D\}, \{\{A, B\}, \{B, C\}, \{C, D\}, \{D, A\}\}) \\ \mathcal{H}_2^{\boldsymbol{\sigma}_1} &= (\{A, C, D\}, \{\{A, C\}, \{C, D\}, \{D, A\}\}) \\ \mathcal{H}_3^{\boldsymbol{\sigma}_1} &= (\{A, D\}, \{\{D, A\}\}) \\ \mathcal{H}_4^{\boldsymbol{\sigma}_1} &= (\{A\}, \{\{A\}\}) \\ \mathcal{H}_5^{\boldsymbol{\sigma}_1} &= (\{\}, \{\{\}\}) \end{align}\] In contrast, the order \(\boldsymbol{\sigma}_2 = (A, B, C, D)\) results in the following sequence: \[\begin{align} \mathcal{H}_1^{\boldsymbol{\sigma}_2} &= (\{A, B, C, D\}, \{\{A, B\}, \{B, C\}, \{C, D\}, \{D, A\}\}) \\ \mathcal{H}_2^{\boldsymbol{\sigma}_2} &= (\{B, C, D\}, \{\{D, B\}, \{B, C\}, \{C, D\}\}) \\ \mathcal{H}_3^{\boldsymbol{\sigma}_2} &= (\{C, D\}, \{\{C, D\}\}) \\ \mathcal{H}_4^{\boldsymbol{\sigma}_2} &= (\{D\}, \{\{D\}\}) \\ \mathcal{H}_5^{\boldsymbol{\sigma}_2} &= (\{\}, \{\{\}\}) \end{align}\]
As with tree decompositions, we identify a VEO \(\sigma\) with the set \(\{{U^\sigma_i}\mid{i\in[k]}\}\) where \(k \stackrel{\mathrm{def}}{=}|\mathcal{V}|\), and we use the preorder \(\sqsubseteq\) to compare tree decompositions and VEOs:
Proposition 1 (Equivalence of TDs and VEOs [14]). Given \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\):
For every TD \((T, \chi) \in \mathcal{T}(\mathcal{H})\), there exists a VEO \(\boldsymbol{\sigma} \in \pi(\mathcal{V})\) such that \(\boldsymbol{\sigma} \sqsubseteq (T,\chi)\).
For every VEO \(\boldsymbol{\sigma} \in \pi(\mathcal{V})\), there exists a TD \((T, \chi) \in \mathcal{T}(\mathcal{H})\) such that \((T,\chi) \sqsubseteq \boldsymbol{\sigma}\).
Example 4. Continuing with Example 3, consider the 4-cycle hypergraph in Eq. 14 . The variable elimination order \(\boldsymbol{\sigma}_1 = (B, C, D, A)\) results in: \[\begin{align} U^{\boldsymbol{\sigma}_1}_1 = \{A, B, C\}, \quad U^{\boldsymbol{\sigma}_1}_2 = \{C, D, A\},\quad U^{\boldsymbol{\sigma}_1}_3 = \{D, A\}, \quad U^{\boldsymbol{\sigma}_1}_4 = \{A\}. \end{align}\] Note that \(\boldsymbol{\sigma}_1 \sqsubseteq (T_1, \chi_1)\) and \((T_1, \chi_1) \sqsubseteq \boldsymbol{\sigma}_1\), hence \(\boldsymbol{\sigma}_1\equiv(T_1, \chi_1)\).
In contrast, the variable order \(\boldsymbol{\sigma}_2 = (A, B, C, D)\) results in: \[\begin{align} U^{\boldsymbol{\sigma}_2}_1 = \{D, A, B\}, \quad U^{\boldsymbol{\sigma}_2}_2 = \{B, C, D\},\quad U^{\boldsymbol{\sigma}_2}_3 = \{C, D\}, \quad U^{\boldsymbol{\sigma}_2}_4 = \{D\}. \end{align}\] In particular, \(\boldsymbol{\sigma}_2\equiv(T_2, \chi_2)\).
Given a set \(\mathcal{V}\), a function \(\boldsymbol{h}:2^{\mathcal{V}} \to \mathbb{R}_+\) is called a polymatroid if it satisfies the following properties: \[\begin{align} h(\boldsymbol{X}) + h(\boldsymbol{Y}) &\geq h(\boldsymbol{X} \cup \boldsymbol{Y}) + h(\boldsymbol{X} \cap \boldsymbol{Y}) &\forall \boldsymbol{X}, \boldsymbol{Y} \subseteq \mathcal{V}\quad &\text{(submodularity)}\tag{15} \\ h(\boldsymbol{X}) &\leq h(\boldsymbol{Y}) &\forall \boldsymbol{X} \subset \boldsymbol{Y} \subseteq \mathcal{V}\quad &\text{(monotonicity)}\tag{16} \\ h(\emptyset) &= 0 & &\text{(strictness)}\tag{17} \end{align}\] The above properties are also known as basic Shannon inequalities. We use \(\Gamma_{\mathcal{V}}\) to denote the set of all polymatroids over \(\mathcal{V}\). When \(\mathcal{V}\) is clear from the context, we drop \(\mathcal{V}\) and simply write \(\Gamma\). Given a polymatroid \(\boldsymbol{h}\) and sets \(\boldsymbol{X}, \boldsymbol{Y} , \boldsymbol{Z}\subseteq \mathcal{V}\), we use \(\boldsymbol{X}\boldsymbol{Y}\) as a shorthand for \(\boldsymbol{X} \cup \boldsymbol{Y}\), and we define: \[\begin{align} h(\boldsymbol{Y}|\boldsymbol{X}) &\stackrel{\mathrm{def}}{=}h(\boldsymbol{X} \boldsymbol{Y}) - h(\boldsymbol{X}) \tag{18}\\ h(\boldsymbol{Y} ; \boldsymbol{Z} |\boldsymbol{X}) &\stackrel{\mathrm{def}}{=}h(\boldsymbol{X}\boldsymbol{Y}) + h(\boldsymbol{X} \boldsymbol{Z}) - h(\boldsymbol{X}) - h(\boldsymbol{X} \boldsymbol{Y}\boldsymbol{Z})\tag{19} \end{align}\] Using the above notation, we can rewrite Eq. 16 as \(h(\boldsymbol{Y}|\boldsymbol{X}) \geq 0\), and Eq. 15 as \(h(\boldsymbol{X} ; \boldsymbol{Y} |\boldsymbol{X}\cap\boldsymbol{Y}) \geq 0\). A term \(h(\boldsymbol{Y}|\boldsymbol{X})\) is called unconditional if \(\boldsymbol{X} = \emptyset\).
Given a hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\), a function \(\boldsymbol{h}:2^{\mathcal{V}} \to \mathbb{R}_+\) is called edge-dominated if it satisfies \(h(\boldsymbol{X}) \leq 1\) for all \(\boldsymbol{X} \in \mathcal{E}\). We use \(\mathsf{ED}_\mathcal{H}\) to denote the set of all edge-dominated functions over \(\mathcal{H}\). When \(\mathcal{H}\) is clear from the context, we drop \(\mathcal{H}\) and simply write \(\mathsf{ED}\).
Given a hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\), the submodular width [1] of \(\mathcal{H}\) is defined as follows: \[\begin{align} \textsf{subw}(\mathcal{H}) \quad\stackrel{\mathrm{def}}{=}\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{(T,\chi) \in \mathcal{T}(\mathcal{H})}\quad \max_{t \in \text{\sf nodes}(T)}\quad h(\chi(t)) \label{eq:subw} \end{align}\tag{20}\] Based on Proposition 1 along with the fact that a polymatroid \(\boldsymbol{h}:2^{\mathcal{V}}\to\mathbb{R}_+\) is monotone (Eq. 16 ), we can equivalently define the submodular width using Eq. 9 , which we repeat here: \[\begin{align} \textsf{subw}(\mathcal{H}) \quad\stackrel{\mathrm{def}}{=}\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{\boldsymbol{\sigma} \in \pi(\mathcal{V})}\quad \max_{i \in [k]}\quad h(U^{\boldsymbol{\sigma}}_i) \label{eq:subw:vo} \end{align}\tag{21}\] Appendix 10 summarizes how to compute the submodular width of a given hypergraph \(\mathcal{H}\).
We show here how to multiply two rectangular matrices \(A\) and \(B\) of dimensions \(n^a\times n^b\) and \(n^b\times n^c\) in the runtime \(n^{ \omega^{\square} (a, b, c)}\), as defined by Eq. 6 . This is a folklore result; see e.g. [22]. Let \(d = \min(a, b, c)\). We partition \(A\) into \(\frac{n^a}{n^d}\times \frac{n^b}{n^d}\) blocks and \(B\) into \(\frac{n^b}{n^d}\times \frac{n^c}{n^d}\) blocks. Therefore, we have to perform \(n^{a+b+c-3d}\) block multiplications, each of which takes time \(O(n^{d\cdot\omega})\). The overall complexity, on \((\log n)\)-scale, is \(a + b + c -(3 - \omega) \min(a, b, c)\), which gives Eq. 6 . When \(\omega = 2\), this algorithm for rectangular matrix multiplication is already optimal because the complexity from Eq. 6 becomes linear in the sizes of the input and output matrices. However, when \(\omega > 2\), there could be faster algorithms that are not based on square matrix multiplication; see e.g. [27]. We define \(\overline{\omega} (a, b, c)\) as the smallest exponent for multiplying two rectangular matrices of sizes \(n^a\times n^b\) and \(n^b\times n^c\) within \(O(n^{ \overline{\omega} (a, b, c)})\) time. Based on the above discussion, we have \(\overline{\omega} (a, b, c) \leq \omega^{\square} (a, b, c)\) and this becomes an equality when \(\omega = 2\) or when \(a = b = c\).
In order to evaluate a BCQ \(Q\) (Eq. 1 ) in submodular width time \(O(N^{\textsf{subw}(Q)})\), the original \(\mathsf{PANDA}\) algorithm [2], [3], [5] reduces the problem of evaluating \(Q\) into evaluating a collection of Disjunctive Datalog Rules, which we review in this section. To that end, we need some preliminaries.
Let \(\mathcal{V}\) be a set of variables. An atom is an expression of the form \(R(\boldsymbol{X})\), where \(R\) is a relation symbol, and \(\boldsymbol{X} \subseteq \mathcal{V}\) is a set of variables. A schema \(\Sigma\) is a set of atoms.
Given a finite domain \(\textsf{Dom}\) and variables \(\boldsymbol{X} \subseteq \mathcal{V}\), let \(\textsf{Dom}^{\boldsymbol{X}}\) denote the set of all tuples over the variables in \(\boldsymbol{X}\) with values from \(\textsf{Dom}\). Given a tuple \(\boldsymbol{t} \in \textsf{Dom}^{\mathcal{V}}\), we use \(\boldsymbol{t}_{\boldsymbol{X}}\) to denote the projection of \(\boldsymbol{t}\) onto the variables in \(\boldsymbol{X}\). A database instance \(D\) over schema \(\Sigma\) is a mapping that assigns each atom \(R(\boldsymbol{X}) \in \Sigma\) to a finite relation \(R^{D} \subseteq \textsf{Dom}^{\boldsymbol{X}}\). Usually the database instance is clear from the context, so we simply write \(R\) instead of \(R^D\). Given a relation \(R\subseteq \textsf{Dom}^{\boldsymbol{X}}\), we use \(\text{\sf vars}(R)\) to denote the set of variables \(\boldsymbol{X}\). Given a tuple \(\boldsymbol{t}\in\textsf{Dom}^{\mathcal{V}}\) and a relation \(R(\boldsymbol{X})\) for \(\boldsymbol{X}\subseteq \mathcal{V}\), we say that \(\boldsymbol{t}\) is covered by \(R\) if \(\boldsymbol{t}_{\boldsymbol{X}} \in R\).
Given a database instance over schema \(\Sigma\), the full natural join of the instance is the set of tuples \(\boldsymbol{t} \in \textsf{Dom}^{\mathcal{V}}\) that satisfy all atoms in \(\Sigma\): \[\begin{align} \mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma & \stackrel{\mathrm{def}}{=}\{{\boldsymbol{t} \in \textsf{Dom}^{\mathcal{V}}}\mid{ \boldsymbol{t}_{\boldsymbol{X}} \in R, \text{ for all } R(\boldsymbol{X}) \in \Sigma }\} \label{eq:full:join} \end{align}\tag{22}\] In other words, \(\mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma\) is the set of tuples \(\boldsymbol{t} \in \textsf{Dom}^{\mathcal{V}}\) that are covered by all relations in \(\Sigma\).
Definition 1 (DDR and its model). Given two schemas \(\Sigma_{\text{\sf in}}\) and \(\Sigma_{\text{\sf out}}\), a Disjunctive Datalog Rule (DDR) is the expression \[\begin{align} \bigvee_{Q(\boldsymbol{Z}) \in \Sigma_{\text{\sf out}}} Q(\boldsymbol{Z}) &\text{ :- }\bigwedge_{R(\boldsymbol{X})\in \Sigma_{\text{\sf in}}} R(\boldsymbol{X}) \label{eq:ddr} \end{align}\tag{23}\] Given a database instance over the input schema \(\Sigma_{\text{\sf in}}\), an output instance (or model) of the DDR 23 is a database instance over the output schema \(\Sigma_{\text{\sf out}}\) such that for every tuple \(\boldsymbol{t} \in \mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma_{\text{\sf in}}\), there exists at least one atom \(Q(\boldsymbol{Z}) \in \Sigma_{\text{\sf out}}\) such that \(\boldsymbol{t}_{\boldsymbol{Z}} \in Q(\boldsymbol{Z})\). In other words, every tuple \(\boldsymbol{t} \in \mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma_\text{\sf in}\) is covered by at least one relation in the output instance.
Notice that the output instance is not unique. For example, consider the DDR: \[\begin{align} Q_1(X) \vee Q_2(Y) &\text{ :- }R(X,Y) \end{align}\] One output instance is \(Q_1 = \emptyset\), \(Q_2 = \Pi_Y(R)\) (the projection of \(R\) on \(Y\)), another instance is \(Q_1 = \Pi_X(R), Q_2 = \emptyset\). Many other instances exists: it suffices to ensure that, for every \((x,y) \in R\), at least one of \(x \in Q_1\) or \(y \in Q_2\) holds.
The size of an output instance to a DDR is the total number of tuples in all its relations: \[\begin{align} \|\Sigma_{\text{\sf out}}\| \stackrel{\mathrm{def}}{=}\sum_{Q(\boldsymbol{Z}) \in \Sigma_{\text{\sf out}}} |Q|. \label{eqn:ddr:size} \end{align}\tag{24}\] An output instance of a DDR is minimal if no proper subset of it is also an output instance. Note that a conjunctive query (CQ) is a special case of DDR where the output schema \(\Sigma_{\text{\sf out}}\) contains only one atom. The answer to a CQ is its unique minimal output instance.
The \(\mathsf{PANDA}\) algorithm [2], [3], [5] relies heavily on the concept of degrees in a relation, which generalizes degrees in a graph. We review the definition below.
Consider a database instance \(D\) over schema \(\Sigma\). If \(R \in \Sigma\) is a relation name, and \(\boldsymbol{Z}\) is a set of variables, then we denote by10 \(R^D_{|\boldsymbol{Z}} \stackrel{\mathrm{def}}{=}\textsf{Dom}^{\boldsymbol{Z}} \ltimes R^D\) the restriction of \(R^D\) to the variables \(\boldsymbol{Z}\). Notice that \(\boldsymbol{Z}\) is not necessarily a subset of \(\text{\sf vars}(R)\), in which case \(R^D_{|\boldsymbol{Z}}\) may be an infinite relation (assuming the domain \(\textsf{Dom}\) is infinite), but, when \(\boldsymbol{Z} \subseteq \text{\sf vars}(R)\), then \(R^D_{|\boldsymbol{Z}}=R^D\). Let \(\boldsymbol{X}, \boldsymbol{Y}\) be two disjoint subsets of variables, and \(\boldsymbol{x} \in \textsf{Dom}^{\boldsymbol{X}}\) be a data tuple. We associate three quantities: the degree \(\text{\sf deg}_{R^D}(\boldsymbol{Y} | \boldsymbol{X} = \boldsymbol{x})\) in \(R^D\) of \(\boldsymbol{x}\) w.r.t. \(\boldsymbol{Y}\), the degree \(\text{\sf deg}_{R^D}(\boldsymbol{Y}|\boldsymbol{X})\) in \(R^D\) of the pair \((\boldsymbol{Y}|\boldsymbol{X})\), and the degree \(\text{\sf deg}_{\Sigma^D}(\boldsymbol{Y}|\boldsymbol{X})\) of \((\boldsymbol{Y}|\boldsymbol{X})\) in the \(\Sigma\)-instance \(\Sigma^D\) (\(=D\)): \[\begin{align} \text{\sf deg}_{R^D}(\boldsymbol{Y} | \boldsymbol{X} = \boldsymbol{x}) &\stackrel{\mathrm{def}}{=}|\{{\boldsymbol{y} \in \textsf{Dom}^{\boldsymbol{Y}}}\mid{ (\boldsymbol{x}, \boldsymbol{y}) \in R^D_{|\boldsymbol{X} \cup \boldsymbol{Y}} }\}| \tag{25} \\ \text{\sf deg}_{R^D}(\boldsymbol{Y}|\boldsymbol{X}) &\stackrel{\mathrm{def}}{=}\max_{\boldsymbol{x} \in \textsf{Dom}^{\boldsymbol{X}}} \text{\sf deg}_{R^D}(\boldsymbol{Y}|\boldsymbol{X} = \boldsymbol{x}) \tag{26} \\ \text{\sf deg}_{\Sigma^D}(\boldsymbol{Y}|\boldsymbol{X}) &\stackrel{\mathrm{def}}{=}\min_{R \in \Sigma}\text{\sf deg}_{R^D}(\boldsymbol{Y}|\boldsymbol{X}). \tag{27} \end{align}\] As usual, we drop the superscript \(D\) when clear from the context, and write simply \(\text{\sf deg}_R(\boldsymbol{Y}|\boldsymbol{X})\), \(\text{\sf deg}_{\Sigma}(\boldsymbol{Y}|\boldsymbol{X})\).
The original \(\mathsf{PANDA}\) algorithm [2], [3] had an extra polylog factor in the runtime, which was later removed in [5] by a more refined algorithm called \(\textsf{PANDAExpress}\). This refined algorithm relies on the concept of sub-probability measures, which we review in this section. The goal of this paper is to generalize \(\textsf{PANDAExpress}\) to incorporate fast matrix multiplication and achieve the \(\omega\)-submodular width runtime.
Let \(\Omega\) be a finite set. A function \(p : 2^\Omega \to R_+\) is called a measure on \(\Omega\) if \(p(\emptyset)=0\) and \(p(A) = \sum_{x \in A} p(x)\) for any \(A \subseteq \Omega\). In particular, to define a measure on \(\Omega\), it is sufficient to define the values of \(p(x)\) for all \(x \in \Omega\). It is called a sub-probability measure if \(p(\Omega) \leq 1\), and a probability measure if \(p(\Omega) = 1\).
Let \(p\) be a measure on \(\Omega\). If \(\Omega = \Omega_1 \times \Omega_2\) is a Cartesian product of two domains, then the measure \(p_1(x_1) \stackrel{\mathrm{def}}{=}\sum_{x_2 \in \Omega_2} p(x_1, x_2), \forall x_1 \in \Omega_1\) is called the marginal measure of \(p\) on \(\Omega_1\). Let \(A \subseteq \Omega\) with positive measure \(p(A) > 0\), then the measure \(p_{|A}(B) \stackrel{\mathrm{def}}{=}\frac{p(B \cap A)}{p(A)}\) for any \(B \subseteq \Omega\) is called the conditional measure of \(p\) on \(A\). Typically we write \(p(B|A)\) instead of \(p_{|A}(B)\). It is easy to see that, if \(p\) is a sub-probability measure then any of its marginals is also a sub-probability measure, and any of its conditional measures is a probability measure.
In this paper, we will deal with domains \(\Omega = \textsf{Dom}^{\boldsymbol{X}}\) where \(\boldsymbol{X}\) is some set of variables, and \(\textsf{Dom}\) is a finite set. A sub-probability measure \(p\) on \(\textsf{Dom}^{\boldsymbol{X}}\) will be denoted by \(p_{\boldsymbol{X}}\). The aforementioned facts are specialized as follows.
Proposition 2. Given a sub-probability measure \(p_{\boldsymbol{X} \boldsymbol{Y}}\), the following hold:
The following marginal measure is a sub-probability measure: \[\begin{align} p_{\boldsymbol{X}}(\boldsymbol{x}) \stackrel{\mathrm{def}}{=}\sum_{\boldsymbol{y} \in \textsf{Dom}^{\boldsymbol{Y}}} p_{\boldsymbol{X} \boldsymbol{Y}}(\boldsymbol{x}, \boldsymbol{y}) \label{eqn:marginal} \end{align}\qquad{(1)}\]
Given \(\boldsymbol{x} \in \textsf{Dom}^{\boldsymbol{X}}\) the following conditional measure is a sub-probability measure: \[\begin{align} p_{\boldsymbol{Y} | \boldsymbol{X} = \boldsymbol{x}}(\boldsymbol{y}) &\stackrel{\mathrm{def}}{=} \begin{cases} \frac{p_{\boldsymbol{X} \boldsymbol{Y}}(\boldsymbol{x}, \boldsymbol{y})}{p_{\boldsymbol{X}}(\boldsymbol{x})} & \text{if } p_{\boldsymbol{X}}(\boldsymbol{x}) > 0 \\ 0 & \text{otherwise} \end{cases} \label{eqn:conditional} \end{align}\qquad{(2)}\]
As is customary in probability theory, we write \(p_{\boldsymbol{Y} | \boldsymbol{X}}(\boldsymbol{y} | \boldsymbol{x})\) instead of \(p_{\boldsymbol{Y} | \boldsymbol{X} = \boldsymbol{x}}(\boldsymbol{y})\), with the implicit understanding that there is a measure for each \(\boldsymbol{x} \in \textsf{Dom}^{\boldsymbol{X}}\).
Definition 2. Given \(k\) sub-probability measures \(p_1, p_2, \ldots, p_k\) on the same domain \(\Omega\), their geometric mean is a sub-probability measure \(p\) defined by \(p(x) \stackrel{\mathrm{def}}{=}\left(\prod_{i=1}^k p_i(x)\right)^{\frac{1}{k}}, \forall x \in \Omega\).
Proposition 3. The geometric mean of sub-probability measures is also a sub-probability measure.
Proof. This follows trivially from the AM-GM inequality: \[\begin{align} p(\Omega) = \sum_{x \in \Omega} \left(\prod_{i=1}^k p_i(x)\right)^{\frac{1}{k}} \leq \sum_{x \in \Omega} \frac{1}{k} \sum_{i=1}^k p_i(x) = \frac{1}{k} \sum_{i=1}^k \sum_{x \in \Omega} p_i(x) \leq 1 \end{align}\] ◻
Given a sub-probability measure \(p_{\boldsymbol{Y}|\boldsymbol{X}}\) and a tuple \(\boldsymbol{t} \in \textsf{Dom}^{\mathcal{V}}\) where \(\boldsymbol{X}\cup\boldsymbol{Y}\subseteq \mathcal{V}\), we define \[\begin{align} p_{\boldsymbol{Y}|\boldsymbol{X}}(\boldsymbol{t}) \stackrel{\mathrm{def}}{=}p_{\boldsymbol{Y}|\boldsymbol{X}}(\boldsymbol{t}_{\boldsymbol{Y}}|\boldsymbol{t}_{\boldsymbol{X}}) \end{align}\]
While Eq. 8 gives a high-level sketch of our definition of the \(\omega\)-submodular width, we aim here to provide the full formal definition. To that end, we start with some auxiliary definitions.
In the traditional submodular width (Eq. 9 or 21 ), it was sufficient to consider variable elimination orders that eliminate only one variable at a time. However, once we allow using MM to eliminate variables, there could be situations where eliminating multiple variables at once using a single MM might be cheaper than eliminating the same set of variables one at a time using multiple MMs. For example, suppose we want to compute the query: \[Q(X, Z) \text{ :- }R(X, Y_1, Y_2) \wedge S(Y_1, Y_2, Z)\] There are at least two options to evaluate this query using MM:
Option 1: For each value \(y_1\) of \(Y_1\), treat \(\sigma_{Y_1 = y_1}R\) and \(\sigma_{Y_1 = y_1}S\) as two matrices and multiply them. Finally, put together the resulting matrices for all \(y_1\) and project \(Y_1\) away.
Option 2: Combine \(Y_1\) and \(Y_2\) into a single attribute \((Y_1Y_2)\), view \(R\) and \(S\) as two matrices with dimensions \(X \times (Y_1Y_2)\) and \((Y_1Y_2) \times Z\) respectively, and multiply them.
Depending on the relations \(R\) and \(S\), either option could be cheaper. Motivated by this observation, our first task is to generalize the notion of a VEO and an elimination hypergraph sequence to allow eliminating multiple variables at once.
First, we lift the definitions of \(\partial_\mathcal{H}(X)\), \(U_\mathcal{H}(X)\), and \(N_\mathcal{H}(X)\) from a single variable \(X\) to a set of variables \(\boldsymbol{X}\). Given a hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\) and a non-empty set of variables \(\boldsymbol{X}\subseteq\mathcal{V}\), we define \(\partial_\mathcal{H}(\boldsymbol{X})\) as the set of hyperedges in \(\mathcal{H}\) that overlap with \(\boldsymbol{X}\): \[\begin{align} \partial_\mathcal{H}(\boldsymbol{X}) \stackrel{\mathrm{def}}{=}\{{\boldsymbol{Z} \in \mathcal{E}}\mid{\boldsymbol{X} \cap \boldsymbol{Z} \neq \emptyset}\},\quad\quad U_\mathcal{H}(\boldsymbol{X}) \stackrel{\mathrm{def}}{=}\bigcup_{\boldsymbol{Z} \in \partial_\mathcal{H}(\boldsymbol{X})} \boldsymbol{Z},\quad\quad N_\mathcal{H}(\boldsymbol{X}) \stackrel{\mathrm{def}}{=}U_\mathcal{H}(\boldsymbol{X}) \setminus \boldsymbol{X}. \end{align}\]
Definition 3 (Generalized Variable Elimination Order (GVEO)). Given a hypergraph \(\mathcal{H}=(\mathcal{V},\mathcal{E})\), let \(\overline{\pi}(\mathcal{V})\) denote the set of all ordered partitions of \(\mathcal{V}\). Namely, each element \(\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})\) is a tuple \((\boldsymbol{X}_1, \boldsymbol{X}_2, \ldots, \boldsymbol{X}_{|\overline{\boldsymbol{\sigma}}|})\) of non-empty and pairwise disjoint sets \(\boldsymbol{X}_1, \ldots, \boldsymbol{X}_{|\overline{\boldsymbol{\sigma}}|}\) whose union is \(\mathcal{V}\). We refer to each \(\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})\) as a generalized variable elimination order, or GVEO for short. Given \(\overline{\boldsymbol{\sigma}}\in \overline{\pi}(\mathcal{V})\), we define a generalized elimination hypergraph sequence \(\mathcal{H}^{\overline{\boldsymbol{\sigma}}}_1, \ldots, \mathcal{H}^{\overline{\boldsymbol{\sigma}}}_{|\overline{\boldsymbol{\sigma}}|+1}\) as follows: \(\mathcal{H}_1^{\overline{\boldsymbol{\sigma}}} \stackrel{\mathrm{def}}{=}\mathcal{H}\), and for \(i = 1, ... , |\overline{\boldsymbol{\sigma}}|\): \[\mathcal{V}_{i+1}^{\overline{\boldsymbol{\sigma}}} \stackrel{\mathrm{def}}{=}\mathcal{V}_{i}^{\overline{\boldsymbol{\sigma}}} \setminus \boldsymbol{X}_i, \quad\quad\quad \mathcal{E}_{i+1}^{\overline{\boldsymbol{\sigma}}} \stackrel{\mathrm{def}}{=}\mathcal{E}_{i}^{\overline{\boldsymbol{\sigma}}} \setminus \partial_{\mathcal{H}_{i}^{\overline{\boldsymbol{\sigma}}}}(\boldsymbol{X}_{i}) \cup \{N_{\mathcal{H}_{i}^{\overline{\boldsymbol{\sigma}}}}(\boldsymbol{X}_i)\}.\] For any \(i \in [|\overline{\boldsymbol{\sigma}}|]\), we define \(\partial^{\overline{\boldsymbol{\sigma}}}_i\stackrel{\mathrm{def}}{=}\partial_{\mathcal{H}^{\overline{\boldsymbol{\sigma}}}_i}(\boldsymbol{X}_i)\), just like before, and the same goes for \(U^{\overline{\boldsymbol{\sigma}}}_i\) and \(N^{\overline{\boldsymbol{\sigma}}}_i\).
We now give the formal definition of the MM expression that generalizes the special case \(\mathsf{MM}(X; Y; Z)\) that was given earlier in Eq. 7 . Recall that \(\omega\) is a constant in the range \([2, 3]\) and \(\gamma \stackrel{\mathrm{def}}{=}\omega - 2\).
Definition 4 (Matrix multiplication expression, \(\mathsf{MM}\)). Let \(\boldsymbol{h}:2^{\mathcal{V}}\to\mathbb{R}_+\) be a polymatroid. Given four pairwise disjoint subsets, \(\boldsymbol{X}, \boldsymbol{Y}, \boldsymbol{Z}, \boldsymbol{G}\subseteq \mathcal{V}\), we define the matrix multiplication expression \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z} |\boldsymbol{G})\) as follows: \[\begin{align} \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z} |\boldsymbol{G}) \stackrel{\mathrm{def}}{=}\max\bigl(&h(\boldsymbol{X} | \boldsymbol{G}) + h(\boldsymbol{Y} | \boldsymbol{G}) + \gamma h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G}),\nonumber\\ &h(\boldsymbol{X} | \boldsymbol{G}) + \gamma h(\boldsymbol{Y} | \boldsymbol{G}) + h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G}),\nonumber\\ &\gamma h(\boldsymbol{X} | \boldsymbol{G}) + h(\boldsymbol{Y} | \boldsymbol{G}) + h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G})\bigr) \label{eq:mm} \end{align}\tag{28}\] When \(\boldsymbol{G}\) is empty, we write \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z})\) as a shorthand for \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z} |\emptyset)\).
The following proposition intuitively says that the MM runtime is at least linear in the sizes of the two input matrices and the output matrix.
Proposition 4. \(\max(h(\boldsymbol{X} \boldsymbol{Y} \boldsymbol{G}), h(\boldsymbol{Y} \boldsymbol{Z} \boldsymbol{G}), h(\boldsymbol{X} \boldsymbol{Z} \boldsymbol{G})) \quad\leq\quad \mathsf{MM}(\boldsymbol{X} ;\boldsymbol{Y}; \boldsymbol{Z} | \boldsymbol{G})\)
Proof. \(h(\boldsymbol{X} \boldsymbol{Y} \boldsymbol{G}) \leq h(\boldsymbol{X} | \boldsymbol{G}) + h(\boldsymbol{Y} | \boldsymbol{G}) + h(\boldsymbol{G}) \leq h(\boldsymbol{X} | \boldsymbol{G}) + h(\boldsymbol{Y} | \boldsymbol{G}) + \gamma h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G}).\) ◻
Proposition 5. If \(\omega = 3\), then \(h(\boldsymbol{X}\boldsymbol{Y}\boldsymbol{Z}\boldsymbol{G}) \leq \mathsf{MM}(\boldsymbol{X}; \boldsymbol{Y}; \boldsymbol{Z} | \boldsymbol{G})\).
Proof. When \(\omega = 3\), \(h(\boldsymbol{X} \boldsymbol{Y} \boldsymbol{Z}\boldsymbol{G}) \leq h(\boldsymbol{X} | \boldsymbol{G}) + h(\boldsymbol{Y} | \boldsymbol{G}) + h (\boldsymbol{Z}|\boldsymbol{G}) + h(\boldsymbol{G}) = \mathsf{MM}(\boldsymbol{X}; \boldsymbol{Y}; \boldsymbol{Z} | \boldsymbol{G}).\) ◻
Here we present the formal definition of the quantity \(\mathsf{EMM}\) introduced earlier in Section 2.2, which captures the cost of eliminating a variable (or set of variables) using matrix multiplication. Given a hypergraph \(\mathcal{H}=(\mathcal{V},\mathcal{E})\) and a set of vertices \(\boldsymbol{X} \subseteq \mathcal{V}\), in order to eliminate \(\boldsymbol{X}\) using a multiplication of two matrices, we take the neighboring hyperedges \(\partial_\mathcal{H}(\boldsymbol{X})\) of \(\boldsymbol{X}\) and assign them to two (potentially overlapping) sets of hyperedges \(\mathcal{A}\) and \(\mathcal{B}\), each of which will form a matrix. Since every neighboring hyperedge needs to participate in this multiplication, we need \(\mathcal{A}\) and \(\mathcal{B}\) to cover \(\partial_\mathcal{H}(\boldsymbol{X})\), i.e. \(\mathcal{A}\cup\mathcal{B}= \partial_\mathcal{H}(\boldsymbol{X})\). Let \(\boldsymbol{A}\) and \(\boldsymbol{B}\) be the sets of vertices in \(\mathcal{A}\) and \(\mathcal{B}\) respectively, i.e. \(\boldsymbol{A} = \cup \mathcal{A}\) and \(\boldsymbol{B} = \cup\mathcal{B}\). In order to eliminate \(\boldsymbol{X}\) using matrix multiplication, we require that \(\boldsymbol{X}\) is a subset of \(\boldsymbol{A} \cap \boldsymbol{B}\). Additionally, we are allowed to choose a set \(\boldsymbol{G} \subseteq \boldsymbol{A} \cup \boldsymbol{B}\) of “group-by variables”: These are variables that do not participate in the matrix multiplication. Instead, for every assignment \(\boldsymbol{g} \in \textsf{Dom}^{\boldsymbol{G}}\) of \(\boldsymbol{G}\), we perform a matrix multiplication over the remaining variables (hence the name “group-by variables”). Given \(\boldsymbol{G}\), denote by \(\boldsymbol{A}^{\boldsymbol{G}} \stackrel{\mathrm{def}}{=}\boldsymbol{A} \setminus \boldsymbol{G}\), \(\boldsymbol{B}^{\boldsymbol{G}} \stackrel{\mathrm{def}}{=}\boldsymbol{B}\setminus \boldsymbol{G}\); for the choice of \(\boldsymbol{G}\) to be meaningful we require that \(\boldsymbol{X} = \boldsymbol{A}^{\boldsymbol{G}} \cap \boldsymbol{B}^{\boldsymbol{G}}\). Then, for every assignment of the variables in \(\boldsymbol{G}\), we perform a multiplication of a matrix with dimensions \((\boldsymbol{A}^{\boldsymbol{G}} \setminus \boldsymbol{X}) \times \boldsymbol{X}\) with a matrix with dimensions \(\boldsymbol{X} \times (\boldsymbol{B}^{\boldsymbol{G}} \setminus \boldsymbol{X})\). The cost of this multiplication is given by \(\mathsf{MM}(\boldsymbol{A}^G\setminus \boldsymbol{X}, \boldsymbol{B}^G\setminus \boldsymbol{X}, \boldsymbol{X} \mid \boldsymbol{G})\); see Figure 2. Finally, \(\mathsf{EMM}_\mathcal{H}(\boldsymbol{X})\) is the minimum cost over all valid assignments of \(\mathcal{A}\), \(\mathcal{B}\), and \(\boldsymbol{G}\).
Definition 5 (Variable elimination expression via matrix multiplication, \(\mathsf{EMM}\)). Let \(\mathcal{H}=(\mathcal{V},\mathcal{E})\) be a hypergraph and \(\boldsymbol{h}:2^{\mathcal{V}}\to\mathbb{R}_+\) be a polymatroid. Given a non-empty set of vertices \(\boldsymbol{X} \in \mathcal{V}\), we define the variable elimination expression via matrix multiplication, denoted by \(\mathsf{EMM}_\mathcal{H}(\boldsymbol{X})\), as: \[\begin{align} \mathsf{EMM}_\mathcal{H}(\boldsymbol{X}) \stackrel{\mathrm{def}}{=}\min\biggl\{& \mathsf{MM}\bigl( \boldsymbol{A}^{\boldsymbol{G}}\setminus \boldsymbol{X}\quad;\quad \boldsymbol{B}^{\boldsymbol{G}}\setminus \boldsymbol{X}\quad;\quad \boldsymbol{X}\quad|\quad \boldsymbol{G} \bigr) \quad\mid\nonumber\\ &\quad \exists \mathcal{A}, \mathcal{B}\subseteq \partial_\mathcal{H}(\boldsymbol{X}),\quad \mathcal{A}\cup \mathcal{B}= \partial_\mathcal{H}(\boldsymbol{X}),\quad \boldsymbol{A} = \cup \mathcal{A},\quad \boldsymbol{B} = \cup \mathcal{B},\nonumber\\ &\quad\boldsymbol{G}\subseteq N_{\mathcal{H}}(\boldsymbol{X}),\quad \boldsymbol{A}^{\boldsymbol{G}}=\boldsymbol{A}\setminus \boldsymbol{G},\quad \boldsymbol{B}^{\boldsymbol{G}} = \boldsymbol{B}\setminus \boldsymbol{G}, \quad \boldsymbol{X} = \boldsymbol{A}^{\boldsymbol{G}} \cap \boldsymbol{B}^{\boldsymbol{G}} \biggr\} \label{eq:emm} \end{align}\tag{29}\]
We can simplify the above expression further by excluding trivial combinations where either one of the two sets \(\boldsymbol{A}^{\boldsymbol{G}}\setminus \boldsymbol{X}\), or \(\boldsymbol{B}^{\boldsymbol{G}}\setminus \boldsymbol{X}\) is empty.
Example 5. Consider the following hypergraph representing a 4-clique: \[\begin{align} \mathcal{H}= (\{X, Y, Z, W\},\quad \{\{X, Y\}, \{X, Z\}, \{X, W\}, \{Y, Z\}, \{Y, W\}, \{Z, W\}\}) \label{eq:H:4clique} \end{align}\tag{30}\] Here we have \(\partial_\mathcal{H}(X) = \{\{X, Y\}, \{X, Z\}, \{X, W\}\}\), and there are 6 different and non-trivial ways to assign them to \(\mathcal{A}\) and \(\mathcal{B}\), resulting in 6 different MM expressions: \[\begin{align} \mathsf{EMM}_{\mathcal{H}}(X) = \min\bigl( &\mathsf{MM}(YZ; W; X),\quad \mathsf{MM}(YW; Z; X),\quad \mathsf{MM}(ZW; Y; X), \nonumber\\ &\mathsf{MM}(Y; Z; X | W),\quad \mathsf{MM}(Y; W; X | Z),\quad \mathsf{MM}(Z; W; X | Y) \bigr) \label{eq:emm95X:4clique} \end{align}\tag{31}\] The first three expressions above correspond to cases where \(\mathcal{A}\) and \(\mathcal{B}\) are disjoint, while the last three correspond to cases where \(\mathcal{A}\) and \(\mathcal{B}\) overlap. For example, the fourth expression \(\mathsf{MM}(Y; Z; X | W)\) results from taking \(\mathcal{A}=\{\{X, Y\}, \{X, W\}\}\), \(\mathcal{B}=\{\{X, Z\}, \{X, W\}\}\), and \(\boldsymbol{G} = \{W\}\).
Let \(\overline{\boldsymbol{\sigma}}=(\boldsymbol{X}_1, \ldots, \boldsymbol{X}_{|\overline{\boldsymbol{\sigma}}|})\) be a generalized variable elimination order and \(\mathcal{H}^{\overline{\boldsymbol{\sigma}}}_1, \ldots, \mathcal{H}^{\overline{\boldsymbol{\sigma}}}_{|\overline{\boldsymbol{\sigma}}|+1}\) be the corresponding generalized hypergraph sequence (Definition 3). For any \(i \in [|\overline{\boldsymbol{\sigma}}|]\), we use \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i\) to denote \(\mathsf{EMM}_{\mathcal{H}^{\overline{\boldsymbol{\sigma}}}_i}(\boldsymbol{X}_i)\).
We now have all the components in place to formally define the \(\omega\)-submodular width.
Definition 6 (\(\omega\)-submodular width). Given a hypergraph \(\mathcal{H}=(\mathcal{V},\mathcal{E})\), the \(\omega\)-submodular width of \(\mathcal{H}\), denoted by \(\textsf{\omega-subw}(\mathcal{H})\), is defined as follows: \[\begin{align} {\color{red}\textsf{\omega-subw}}(\mathcal{H}) \quad\stackrel{\mathrm{def}}{=}\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})}\quad \max_{i \in [|\overline{\boldsymbol{\sigma}}|]}\quad {\color{red}\min(}h(U^{\overline{\boldsymbol{\sigma}}}_i){\color{red}, \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i)} \label{eq:osubw} \end{align}\tag{32}\]
To compare the \(\omega\)-submodular width with the traditional submodular width, we include below a definition of the submodular width that is equivalent to Eq. 21 , except that it uses GVEOs:
Proposition 6. The following is an equivalent definition of the submodular width of \(\mathcal{H}\): \[\begin{align} \textsf{subw}(\mathcal{H}) \quad\stackrel{\mathrm{def}}{=}\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})}\quad \max_{i \in [|\overline{\boldsymbol{\sigma}}|]}\quad h(U^{\overline{\boldsymbol{\sigma}}}_i) \label{eq:subw:gvo} \end{align}\qquad{(3)}\]
Proof. The above definition is obviously upper bounded by Eq. 21 since \(\overline{\pi}(\mathcal{V})\) is a superset of \(\pi(\mathcal{V})\). In order to show the opposite direction, consider an arbitrary \(\overline{\boldsymbol{\sigma}}=(\boldsymbol{X}_1, \ldots, \boldsymbol{X}_{|\overline{\boldsymbol{\sigma}}|}) \in \overline{\pi}(\mathcal{V})\). Consider the non-negative quantity \(\varphi(|\overline{\boldsymbol{\sigma}}|) \stackrel{\mathrm{def}}{=}\sum_{i \in [|\overline{\boldsymbol{\sigma}}|]}(|\boldsymbol{X}_i| - 1)\). As long as \(\overline{\boldsymbol{\sigma}}\) contains some \(\boldsymbol{X}_i\) whose size it at least 2, this quantity will be positive, and we will construct another generalized variable elimination order \(\overline{\boldsymbol{\sigma}'}\) that reduces this quantity and where every \(U_j^{\overline{\boldsymbol{\sigma}'}}\) is a subset of some \(U_i^{\overline{\boldsymbol{\sigma}}}\). WLOG assume that \(|\boldsymbol{X}_1| > 1\). Let \(Y\) be an arbitrary element of \(\boldsymbol{X}_1\), and define \(\overline{\boldsymbol{\sigma}'}=(\{Y\}, \boldsymbol{X}\setminus \{Y\}, \boldsymbol{X}_2, \ldots, \boldsymbol{X}_{|\overline{\boldsymbol{\sigma}}|})\). Clearly, both \(U_1^{\overline{\boldsymbol{\sigma}'}}\) and \(U_2^{\overline{\boldsymbol{\sigma}'}}\) are subsets of \(U_1^{\overline{\boldsymbol{\sigma}}}\). Moreover, \(\mathcal{H}_3^{\overline{\boldsymbol{\sigma}'}}\) is identical to \(\mathcal{H}_2^{\overline{\boldsymbol{\sigma}}}\), hence by induction, every \(U_j^{\overline{\boldsymbol{\sigma}'}}\) is a subset of some \(U_i^{\overline{\boldsymbol{\sigma}}}\). ◻
Proposition 7. For any hypergraph \(\mathcal{H}\), \(\textsf{\omega-subw}(\mathcal{H}) \leq \textsf{subw}(\mathcal{H})\).
Proposition 8. If \(\omega = 3\), then for any hypergraph \(\mathcal{H}\), \(\textsf{\omega-subw}(\mathcal{H}) = \textsf{subw}(\mathcal{H})\).
Proposition 7 holds by comparing Eq. 32 to ?? . Proposition 8 holds because Proposition 5 implies that when \(\omega = 3\), \(h(U^{\overline{\boldsymbol{\sigma}}}_i) \leq \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i\).
For the purpose of computing the \(\omega\)-submodular width, we propose an equivalent form of Eq. 32 that is easier to compute.
Proposition 9. The \(\omega\)-submodular width of a hypergraph can be equivalently defined as follows: \[\begin{align} {\textsf{\omega-subw}}(\mathcal{H}) \quad\stackrel{\mathrm{def}}{=}\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})}\quad \max_{\substack{i \in [|\overline{\boldsymbol{\sigma}}|]\\ {\color{red}\forall j < i, U_i^{\overline{\boldsymbol{\sigma}}} \not\subseteq U_j^{\overline{\boldsymbol{\sigma}}}}}}\quad {\min(}h(U^{\overline{\boldsymbol{\sigma}}}_i){, \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i)} \label{eq:osubw:trimmed} \end{align}\qquad{(4)}\]
The only difference between Eq. ?? and Eq. 32 is that \(\max_{i \in [|\overline{\boldsymbol{\sigma}}|]}\) is more restricted in Eq. ?? . In particular, we only need to consider \(i\) where \(U_i^{\overline{\boldsymbol{\sigma}}}\) is not contained in any previous \(U_j^{\overline{\boldsymbol{\sigma}}}\). For example, given the hypergraph of the triangle query \(Q_\triangle\) from Eq. 2 , Eq. ?? allows us to only consider the first variable elimination step, thus simplifying the \(\omega\)-submodular width to become Eq. 10 .
Proof of Proposition 9. Consider an arbitrary polymatroid \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\) and a generalized elimination order \(\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})\). It suffices to show that for any pair \((j,i)\) where \(j < i\) and \(U^{\overline{\boldsymbol{\sigma}}}_i \subseteq U^{\overline{\boldsymbol{\sigma}}}_j\), we must have \(h(U^{\overline{\boldsymbol{\sigma}}}_i) \le \min\left\{h(U^{\overline{\boldsymbol{\sigma}}}_j), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_j\right\}\). In this case, we further notice that \(\boldsymbol{X}_j \cap U^{\overline{\boldsymbol{\sigma}}}_i = \emptyset\) since \(j < i\) hence the variables \(\boldsymbol{X}_j\) must have been eliminated before \(U^{\overline{\boldsymbol{\sigma}}}_i\) was created. This implies that \(U^{\overline{\boldsymbol{\sigma}}}_i \subseteq U^{\overline{\boldsymbol{\sigma}}}_j \setminus \boldsymbol{X}_j\). By the monotonicity of \(\boldsymbol{h}\) (Eq. 16 ), \(h(U^{\overline{\boldsymbol{\sigma}}}_i) \le h(U^{\overline{\boldsymbol{\sigma}}}_j \setminus \boldsymbol{X}_j) \le h(U^{\overline{\boldsymbol{\sigma}}}_j)\). Moreover, by Proposition 4, we have \(h(U_j^{\overline{\boldsymbol{\sigma}}}\setminus \boldsymbol{X}_j) \leq \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_j\). ◻
Example 6. Let’s take the 4-clique hypergraph from Eq. 30 . By Proposition 9, for any \(\overline{\boldsymbol{\sigma}}\in \overline{\pi}(\mathcal{V})\), we only need to consider \(U^{\overline{\boldsymbol{\sigma}}}_1\). Hence, the \(\omega\)-submodular width becomes: \[\begin{align} \textsf{\omega-subw}(\mathcal{H}) = \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \min\bigl( &h(XYZW),\quad \mathsf{MM}(XY;Z;W),\quad \mathsf{MM}(XZ;Y;W),\nonumber\\ &\mathsf{MM}(XW;Y;Z),\quad \mathsf{MM}(YZ;X;W),\quad \mathsf{MM}(YW;X;Z),\nonumber\\ &\mathsf{MM}(ZW;X;Y),\quad \mathsf{MM}(Y;Z;W|X),\quad \mathsf{MM}(X;Z;W|Y),\nonumber\\ &\mathsf{MM}(X;Y;W|Z),\quad \mathsf{MM}(X;Y;Z|W) \bigr) \label{eq:osubw:4clique} \end{align}\tag{33}\]
We show in Table 2 the \(\omega\)-submodular width for several classes of queries and compare it with the submodular width for each of them. Proofs can be found in Appendix 11. They use a variety of techniques to obtain both upper and lower bounds on the \(\omega\)-submodular width. Below are the hypergraphs for these query classes: \[\begin{align} \text{k-Clique:}\quad &\mathcal{H}= \left(\{X_1,X_2,\cdots,X_k\},\;\{\{X_i,X_j\}: i,j \in [k], i \neq j\}\right)\tag{34}\\ \text{k-Cycle:}\quad &\mathcal{H}= \left(\{X_1,X_2,\cdots,X_k\},\;\{\{X_i,X_{i+1}\}: i \in [k-1]\}\cup\{\{X_k, X_1\}\}\right)\tag{35}\\ \text{k-Pyramid:}\quad &\mathcal{H}= \left(\{Y, X_1, X_2,\cdots, X_k\}, \;\{\{Y,X_1,\}, \{Y,X_2\}, \cdots, \{Y, X_k\}, \{X_1,X_2,\cdots,X_k\}\}\right)\tag{36} \end{align}\] Our main result, Theorem [thm:panda:osubw], says that any query \(Q\) can be evaluated in time \(O(N^{\textsf{\omega-subw}(Q)}\cdot \log^2 N)\). Combined with Table 2, this implies the results in Table 1 for the corresponding queries.
| Queries | Submodular Width | \(\omega\)-Submodular Width |
|---|---|---|
| Triangle \(Q_\triangle\) (Eq.[eq:intro:triangle]) | \(1.5\) | \(\frac{2\omega}{\omega+1}\) |
| 4-Clique | \(2\) | \(\frac{\omega+1}{2}\) |
| 5-Clique | \(2.5\) | \(\frac{\omega}{2} + 1\) |
| \(k\)-Clique (Eq. [eq:body:k-clique]) | \(\frac{k}{2}\) | \(\frac{1}{2} \cdot \lceil \frac{k}{3}\rceil + \frac{1}{2} \cdot \lceil \frac{k-1}{3}\rceil + \frac{1}{2} \cdot \lfloor \frac{k}{3}\rfloor \cdot (\omega-2)\) |
| 4-Cycle \(Q_\square\) (Eq.[eq:intro:4cycle]) | \(1.5\) | \(2 - \frac{3}{2\cdot \min\{\omega,\frac{5}{2}\}+1}\) |
| \(k\)-Cycle (Eq. [eq:body:k-cycle]) | \(2 - \frac{1}{\lceil k/2 \rceil}\) | \(\le \squareC_k\) |
| \(3\)-Pyramid | \(\frac{5}{3}\) | \(2 - \frac{1}{\omega}\) |
| \(k\)-Pyramid (Eq. [eq:body:k-pyramid]) | \(2-\frac{1}{k}\) | \(\le 2 - \frac{2}{\omega \cdot (k-1) -k + 3}\) |
We present in this section an algorithm for computing the value of the \(\omega\)-submodular width for any given hypergraph. This algorithm is a crucial component in our algorithm for computing the answer to a query \(Q\) in \(\omega\)-submodular width time, as we will see in Section 7. The algorithm in this section can also be viewed as a generalization of the algorithm for computing the submodular width of a hypergraph, which is summarized in Appendix 10.
Using Eq. ?? alone, it is not immediately clear how to compute the \(\omega\)-submodular width of a hypergraph \(\mathcal{H}\) because the outer \(\max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\) ranges over an infinite set. Nevertheless, every other \(\max\) and \(\min\) in Eq. ?? ranges over a finite set whose cardinality only depends on \(\mathcal{H}\). Note that by Eq. 29 , \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i\) is a minimum of a collection of terms, each of which has the form \(\mathsf{MM}(\boldsymbol{X}; \boldsymbol{Y}; \boldsymbol{Z} | \boldsymbol{G})\). Note also that each term \(\mathsf{MM}(\boldsymbol{X}; \boldsymbol{Y}; \boldsymbol{Z} | \boldsymbol{G})\) is by itself a maximum of 3 terms, as described by Eq. 28 .
In order to compute the \(\omega\)-submodular width, the first step is to distribute every \(\min\) over \(\max\) in Eq. ?? , thus pulling all \(\max\) operators to the top level. To formally describe this distribution, we need some notation. Given an expression \(e\) which is either a minimum or a maximum of a collection of terms, we use \(\mathsf{args}(e)\) to denote the collection of terms over which the minimum or maximum is taken. Let \(k\) be the number of vertices in \(\mathcal{H}\). Let \(f:\overline{\pi}(\mathcal{V})\to [k]\) be a function that maps every generalized variable elimination order \(\overline{\boldsymbol{\sigma}}\in\overline{\pi}(\mathcal{V})\) to a number \(i\) between 1 and \(|\overline{\boldsymbol{\sigma}}|\) that satisfies \(U^{\overline{\boldsymbol{\sigma}}}_i \not\subseteq U^{\overline{\boldsymbol{\sigma}}}_j\) for all \(j \in [i-1]\). (Note that \(|\overline{\boldsymbol{\sigma}}|\leq k\) for every \(\overline{\boldsymbol{\sigma}}\).) Let \(\mathcal{F}\) be the set of all such functions \(f\). For a fixed function \(f \in\mathcal{F}\), let \(g_f\) be a function that maps every pair \((\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))\) where \(\overline{\boldsymbol{\sigma}}\in\overline{\pi}(\mathcal{V})\) and \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G})\) is a term in \(\mathsf{args}(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})})\) to one of the three terms in \(\mathsf{args}(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))\) from Eq. 28 . Let \(\mathcal{G}_f\) be the set of all such functions \(g_f\) for a fixed \(f\). Then, by distributing the min over the max in Eq. ?? , we get: \[\begin{align} &{\textsf{\omega-subw}}(\mathcal{H}) \quad\nonumber\\ &\stackrel{\mathrm{def}}{=} \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})}\quad \max_{\substack{i \in [|\overline{\boldsymbol{\sigma}}|]\\ {\forall j < i, U_i^{\overline{\boldsymbol{\sigma}}} \not\subseteq U_j^{\overline{\boldsymbol{\sigma}}}}}}\quad \min(h(U^{\overline{\boldsymbol{\sigma}}}_i), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i) \nonumber\\&= \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \max_{f \in \mathcal{F}}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})}\quad \min\left(h(U^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}\right) \nonumber\\&= \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \max_{f \in \mathcal{F}}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})}\quad \min\left( h(U^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}), \min_{\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}) \in \mathsf{args}\left(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}\right)} \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}) \right) \nonumber\\&= \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \max_{f \in \mathcal{F}}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})}\quad \min\left( h(U^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}), \min_{\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}) \in \mathsf{args}\left(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}\right)} \quad \max_{e \in \mathsf{args}(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))} e \right) \nonumber\\&= \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \max_{f \in \mathcal{F}}\quad \max_{g_f \in \mathcal{G}_f}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})} \min\left( h(U^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}), \min_{\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}) \in \mathsf{args}\left(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}\right)} g_f(\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G})) \right) \nonumber\\&= \max_{f \in \mathcal{F}}\quad \max_{g_f \in \mathcal{G}_f}\quad\nonumber\\ &\quad\quad\underbrace{\max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})}\quad \min\left( h(U^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}), \min_{\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}) \in \mathsf{args}\left(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})}\right)} g_f(\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G})) \right)}_{\text{Equivalent to an LP}} \label{eq:osubw:distributed:swapped:raw} \end{align}\tag{37}\] The above expression can be rewritten into the following form: \[\begin{align} &\textsf{\omega-subw}(\mathcal{H}) = \max_{i \in [\mathcal{I}]}\nonumber\\ &\quad\quad\quad\underbrace{ \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min\bigl( \min_{\ell \in [L_i]} h(\boldsymbol{U}_{i \ell}),\quad \min_{j \in [J_i]} h(\boldsymbol{X}_{ij}|\boldsymbol{G}_{ij}) + h(\boldsymbol{Y}_{ij}|\boldsymbol{G}_{ij}) + \gamma h(\boldsymbol{Z}_{ij}|\boldsymbol{G}_{ij}) + h(\boldsymbol{G}_{ij}) \bigr) }_{\text{Equivalent to LP~\eqref{eq:osubw:inner-lp} {\em assuming} \gamma is fixed}} \label{eq:osubw:distributed:swapped} \end{align}\tag{38}\] In the above expression, \(\mathcal{I}\) is the number of \(\max\) terms at the top level. For every \(i \in [\mathcal{I}]\), the \(i\)-th term is a maximum over \(\boldsymbol{h} \in \Gamma\cap\mathsf{ED}\) of a minimum of \(L_i + J_i\) terms that are divided into two sets:
\(L_i\) terms of the form \(h(\boldsymbol{U})\) corresponding to \(h(U_i^{\overline{\boldsymbol{\sigma}}})\) from Eq. ?? .
\(J_i\) terms of the form \(h(\boldsymbol{X} | \boldsymbol{G}) + h(\boldsymbol{Y} | \boldsymbol{G}) + \gamma h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G})\) corresponding to terms in Eq. 28 .
Suppose that \(\omega\) (and by extension \(\gamma\)) is a fixed constant. For a fixed \(i \in [\mathcal{I}]\), the inner expression in Eq. 38 is equivalent to an LP, as we now show. The condition \(\boldsymbol{h} \in \Gamma\cap\mathsf{ED}\) is a finite collection of linear constraints. The objective function is a minimum of \(L_i+J_i\) linear functions of \(\boldsymbol{h}\). To convert it to a linear objective function, we introduce a fresh variable \(t\) that is lower bounded by each of these \(L_i+J_i\) linear functions, and we set the objective to maximize \(t\) as follows:
\[\begin{align} \max_{t, \boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \bigl\{ t \quad\mid\quad &\forall \ell \in [L_i],\quad t\leq h(\boldsymbol{U}_{i\ell}),\nonumber\\ &\forall j \in [J_i],\quad t \leq h(\boldsymbol{X}_{ij}|\boldsymbol{G}_{ij})+ h(\boldsymbol{Y}_{ij}|\boldsymbol{G}_{ij}) + \gamma h(\boldsymbol{Z}_{ij}|\boldsymbol{G}_{ij}) +h(\boldsymbol{G}_{ij}) \bigr\} \label{eq:osubw:inner-lp} \end{align}\tag{39}\]
Hence, computing the \(\omega\)-submodular width of a hypergraph \(\mathcal{H}\) reduces to solving \(\mathcal{I}\) linear programs of the form in Eq. 39 , and taking the maximum of their optimal values.11 Section 2.4 exemplifies the above using the hypergraph of the triangle query \(Q_\triangle\) (Eq. 2 ).
Example 7. Consider the 4-clique hypergraph from Eq. 30 . The \(\omega\)-submodular width of this hypergraph is given by Eq. 33 . Inside the \(\min\), we have 10 different terms \(\mathsf{MM}\), each of which is a maximum of 3 terms. By distributing the \(\min\) over the \(\max\), we get \(\mathcal{I}= 3^{10} = 59049\) terms. Our mechanical algorithm for computing the \(\omega\)-submodular width of this hypergraph consists of exhaustively solving an LP for each one of these \(\mathcal{I}\) terms and takeing their maximum optimal objective value, which turns out to be \(\frac{\omega+1}{2}\) in this example. There are smarter but non-algorithmic ways to reach the same conclusion, as shown in Lemma 5.
We show below our main result about evaluating a BCQ of the form 1 in \(\omega\)-submodular width time. The runtime is measured in terms of \(N\), which is the size of the input database instance, i.e., \(N\stackrel{\mathrm{def}}{=}\sum_{R(\boldsymbol{Z})\in\mathsf{atoms}(Q)} |R|\).
theoremThmMainResult Assume \(\omega\) is a rational number.12 Given a Boolean Conjunctive Query (BCQ) \(Q\) and a corresponding input database instance \(D\), \(\omega\)-BCQSolver(Algorithm 3) computes the answer to \(Q\) over \(D\) in time \(O(N^{\textsf{\omega-subw}(Q)}\cdot \log^2 N)\) in data complexity, where \(N\) is the size of \(D\).
We will see later that the extra \(\log^2 N\) factor in the runtime of \(\omega\)-BCQSolver comes from Lemma 2, which will be described in Section 7.5. We note, however, that this extra \(\log^2 N\) factor does not manifest in every query. See Table 1 for examples of some queries, e.g. \(k\)-Clique, where the runtime of \(\omega\)-BCQSolver becomes tighter.
Our \(\textsf{\omega-BCQSolver}\) algorithm is given in Algorithm 3. We give a high-level overview of the algorithm here, and then we spend the rest of this section zooming in on one technical component at a time.
Our algorithm is a huge generalization of the original \(\mathsf{PANDA}\) algorithm [2], [3], [5], where we have to deal with many technical challenges that are not encountered in the original \(\mathsf{PANDA}\). Nevertheless, there are still some similarities between the structures of the two algorithms in hind sight. The original \(\mathsf{PANDA}\) algorithm [2], [3], [5] evaluates a BCQ \(Q\) in two phases:
In the first phase, we construct and solve a collection of Disjunctive Datalog Rules, or DRRs (Section 3.6). In particular, there is one DDR for every “bag selector”, where a bag selector is a collection of bags that is obtained by picking one bag from each tree decomposition of \(Q\).
In the second phase, we take the outputs of these DDRs, and we use them to construct a collection of acyclic queries. We then use the Yannakakis algorithm [28] to evaluate each one of these queries, and return the union of the answers.
In contrast, our \(\textsf{\omega-BCQSolver}\) algorithm also has two phases:
In the first phase (the loop in line [alg:omega-panda-express:outer:loop1] of Algorithm 3), we construct a collection of \(\omega\)-Disjunctive Datalog Rules, or \(\omega\)-DDRs. These are generalizations of DDRs that are specifically tailored to deal with fast matrix multiplication. The formal definition will be given in Section 7.5. In particular, mirroring the formulation of \(\textsf{\omega-subw}(Q)\) from Eq. 37 , where there is an LP 39 for every \(f\in\mathcal{F}\) and \(g\in\mathcal{G}_f\), we construct an \(\omega\)-DDR for every such pair \((f,g)\). We will see shortly how to evaluate these \(\omega\)-DDRs.
In the second phase (the loop in line [alg:omega-panda-express:outer:loop2] of Algorithm 3), assuming we already evaluated the \(\omega\)-DDRs, we take their outputs and use them to construct the inputs to a collection of \(\omega\)-query plans, which generalize tree decompositions. In particular, an \(\omega\)-query plan is a generalized variable elimination order (Definition 3) that is also amended with a specification of how each variable elimination step is executed, i.e., whether it is executed using a join or a fast matrix multiplication, and if so, specifically which matrix multiplication to use (Definition 13). We execute these \(\omega\)-query plans one by one, and return the union of the answers. This process is explained in detail in Section 7.7.
We now explain at high level how we evaluate an \(\omega\)-DDR in the first phase of our \(\textsf{\omega-BCQSolver}\) algorithm. To that end, we first go back to the original \(\mathsf{PANDA}\) algorithm [2], [3], [5] and recap how it evaluates a DDR within the desired runtime bound. The original \(\mathsf{PANDA}\) algorithm starts from a Shannon-flow inequality [2], [3], [5], which is a Shannon inequality of the following form: \[\begin{align} \sum_{\ell \in [L]} \lambda_\ell h(\boldsymbol{U}_{\ell}) \quad\leq\quad \sum_{i \in [I]} w_i h(\boldsymbol{Y}_i |\boldsymbol{X}_i), \label{eq:shannon-flow} \end{align}\tag{40}\] where the coefficients \(\lambda_\ell\) and \(w_i\) are non-negative. \(\mathsf{PANDA}\) then constructs a proof sequence for inequality 40 , which is a sequence of steps that proves the inequality by transforming the RHS into the LHS. Finally, \(\mathsf{PANDA}\) translates each proof step into an algorithmic operation. Mirroring this process, in order to evaluate an \(\omega\)-DDR in our \(\textsf{\omega-BCQSolver}\) algorithm, we use the following steps:
We construct an \(\omega\)-Shannon-flow inequality, which is a generalization of inequality 40 that we will formally define in Section 7.2. This \(\omega\)-Shannon-flow inequality is constructed from an optimal dual solution to the LP 39 , as we will see in Section 7.7.
We construct a proof sequence for this \(\omega\)-Shannon-flow inequality, as we will describe in Section 7.4.
We evaluate the \(\omega\)-DDR by translating each step of the proof sequence into an algorithmic operation. This translation is described in Section 7.6. Some operations might exceed our time budget, in which case, we will have to skip them, and modify the inequality and the proof sequence accordingly, in order to obtain a new inequality/sequence without the expensive operation. This is achieved by what we call the reset lemma, which will be described in Section 7.3.
This section is organized as follows. Section 7.1 introduces some upper bounds on the matrix multiplication expression, which are needed to define the class of \(\omega\)-Shannon-flow inequalities in Section 7.2. Sections 7.3 and 7.4 present, respectively, the reset lemma and the proof sequence construction for \(\omega\)-Shannon-flow inequalities. In Section 7.5, we introduce \(\omega\)-DDRs, and we explain how to evaluate them in Section 7.6. Finally, in Section 7.7, we explain how to evaluate a BCQ \(Q\) in \(\textsf{\omega-subw}(Q)\) time, thus proving Theorem [thm:panda:osubw]. While most of the section uses the triangle query \(Q_\triangle\) from Eq. 2 as a running example, Section 7.8 presents a more advanced example of the 4-cycle query \(Q_\square\) from Eq. 4 .
We start by introducing some upper bounds on the matrix multiplication expression from Definition 4. We will use these upper bounds in Section 7.2 to define our \(\omega\)-Shannon-flow inequalities.
As a warmup example, note that the following upper bound on \(\mathsf{MM}(X; Y; Z)\) always holds: \[\begin{align} \mathsf{MM}(X; Y; Z) \quad\leq\quad \omega \cdot\max(h(X), h(Y), h(Z)) \label{eq:mm:upper-bound:example} \end{align}\tag{41}\] In particular, to prove the above inequality, assume WLOG that \(h(X) \geq h(Y) \geq h(Z)\). Then, \(\mathsf{MM}(X; Y; Z) = h(X) + h(Y) + \gamma h(Z)\), but the latter is upper bounded by \(\omega h(X)\). Inequality 41 is just one example of an upper bound on \(\mathsf{MM}(X; Y; Z)\). Here is another example that can be proved analogously: \[\begin{align} \mathsf{MM}(X; Y; Z) \quad\leq\quad \frac{\omega}{2}\cdot\max( h(X) + h(Y), h(Y) + h(Z), h(X) + h(Z)) \end{align}\] We introduce below a general way to derive such upper bounds.
Definition 7 (\(\omega\)-dominant triple \((\alpha, \beta, \zeta)\)). A triple of numbers \((\alpha, \beta, \zeta)\) is called \(\omega\)-dominant if it satisfies the following conditions: \[\begin{align} \alpha, \beta &\geq 1, \tag{42}\\ \zeta &\geq 0, \tag{43}\\ \alpha+\beta +\zeta &\geq \omega \tag{44} \end{align}\]
Proposition 10 (Upper bound on \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z} |\boldsymbol{G})\)). Let the triples \((\alpha_1, \beta_1, \zeta_1)\), \((\alpha_2, \beta_2, \zeta_2)\), and \((\alpha_3, \beta_3, \zeta_3)\) be \(\omega\)-dominant. For any polymatroid \(\boldsymbol{h}:2^\mathcal{V}\to \mathbb{R}_+\) and pairwise-disjoint subsets \(\boldsymbol{X}, \boldsymbol{Y}, \boldsymbol{Z}, \boldsymbol{G} \subseteq \mathcal{V}\), the following inequality holds: \[\begin{align} \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z} |\boldsymbol{G}) \leq \max\bigl( &\alpha_1 h(\boldsymbol{X} | \boldsymbol{G}) + \beta_1 h(\boldsymbol{Y} | \boldsymbol{G}) + \zeta_1 h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G}),\nonumber\\ &\alpha_2 h(\boldsymbol{X} | \boldsymbol{G}) + \zeta_2 h(\boldsymbol{Y} | \boldsymbol{G}) + \beta_2 h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G}),\nonumber\\ &\zeta_3 h(\boldsymbol{X} | \boldsymbol{G}) + \alpha_3 h(\boldsymbol{Y} | \boldsymbol{G}) + \beta_3 h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G})\bigr) \label{eq:mm:upper-bound} \end{align}\qquad{(5)}\]
Proof. WLOG suppose that \(h(\boldsymbol{Z}|\boldsymbol{G})\) is the minimum among the three terms \(h(\boldsymbol{X}|\boldsymbol{G})\), \(h(\boldsymbol{Y}|\boldsymbol{G})\) and \(h(\boldsymbol{Z}|\boldsymbol{G})\). Then, \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z} |\boldsymbol{G})\) becomes identical to \(h(\boldsymbol{X}|\boldsymbol{G}) + h(\boldsymbol{Y}|\boldsymbol{G}) + \gamma h(\boldsymbol{Z}|\boldsymbol{G}) + h(\boldsymbol{G})\), and the following inequality holds: \[\begin{align} h(\boldsymbol{X}|\boldsymbol{G}) + h(\boldsymbol{Y}|\boldsymbol{G}) + \gamma h(\boldsymbol{Z}|\boldsymbol{G}) + h(\boldsymbol{G}) \leq \alpha_1 h(\boldsymbol{X} | \boldsymbol{G}) + \beta_1 h(\boldsymbol{Y} | \boldsymbol{G}) + \zeta_1 h(\boldsymbol{Z} | \boldsymbol{G}) + h(\boldsymbol{G}) \end{align}\] ◻
As explained earlier, our query evaluation algorithm relies on the idea of deriving a Shannon inequality of a certain form, called \(\omega\)-Shannon-flow inequality, constructing a proof sequence of this inequality, and then translating each proof step into an algorithmic operation. In this section, we formally define the class of \(\omega\)-Shannon-flow inequalities.
Definition 8 (\(\omega\)-Shannon-flow inequality). A Shannon inequality is called an \(\omega\)-Shannon-flow inequality if it has the following form: \[\begin{align} \sum_{\ell \in [L]} \lambda_\ell h(\boldsymbol{U}_{\ell}) + \sum_{j \in [J]} \left(\alpha_j h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \beta_j h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \zeta_j h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \kappa_j h(\boldsymbol{G}_j)\right) \quad\leq\quad \sum_{i \in [I]} w_i h(\boldsymbol{Y}_i |\boldsymbol{X}_i) \label{eq:omega-shannon} \end{align}\tag{45}\] where
all sets \(\boldsymbol{U}_\ell, \boldsymbol{X}_j, \boldsymbol{Y}_j, \boldsymbol{Z}_j\) are non-empty (whereas \(\boldsymbol{G}_j\) can be empty),
all coefficients \(\lambda_\ell, \alpha_j, \beta_j, \zeta_j\) and \(w_i\) are non-negative,
all coefficients \(\kappa_j\) are positive,
and all triples \(\left(\frac{\alpha_j}{\kappa_j}, \frac{\beta_j}{\kappa_j}, \frac{\zeta_j}{\kappa_j}\right)\) are \(\omega\)-dominant.
Note that \(\omega\)-Shannon-flow inequalities generalize Shannon-flow inequalities [2], [3], [5], which were given in Eq. 40 .
Example 8. Eq. 13 is an \(\omega\)-Shannon-flow inequality. To be fully consistent with Eq. 45 , we can rewrite Eq. 13 as follows: \[\begin{align} \omega h(XYZ) + (h(X|\emptyset) + h(Y|\emptyset) + (\omega-2)h(Z|\emptyset) + h(\emptyset)) \leq 2h(XY) + (\omega-1) h(YZ) + (\omega-1)h(XZ) \label{eq:intro:shannon:triangle:explicit} \end{align}\tag{46}\]
Following [3], the following proposition follows immediately from Farkas’ Lemma. Recall the notation for \(h(\boldsymbol{Y}; \boldsymbol{Z}|\boldsymbol{X})\) from Eq. 19 .
Proposition 11. Given an \(\omega\)-Shannon-flow inequality of the form 45 , there must exist non-negative vectors \(\boldsymbol{m} \stackrel{\mathrm{def}}{=}(m_p)_{p \in [P]}\) and \(\boldsymbol{s} \stackrel{\mathrm{def}}{=}(s_q)_{q \in [Q]}\) such that the following equality is an identity over symbolic variables \(h(\boldsymbol{X})\) for \(\boldsymbol{X} \subseteq \mathcal{V}\) where \(h(\emptyset) = 0\): \[\begin{align} \sum_{\ell \in [L]} \lambda_\ell h(\boldsymbol{U}_{\ell}) + \sum_{j \in [J]} \left(\alpha_j h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \beta_j h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \zeta_j h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \kappa_j h(\boldsymbol{G}_j)\right) \quad=\quad \sum_{i \in [I]} w_i h(\boldsymbol{Y}_i |\boldsymbol{X}_i)\nonumber\\ - \sum_{p \in [P]} m_p h(\boldsymbol{Y}_p |\boldsymbol{X}_p) - \sum_{q \in [Q]} s_q h(\boldsymbol{Y}_q;\boldsymbol{Z}_q |\boldsymbol{X}_q) \label{eq:omega-shannon:identity} \end{align}\qquad{(6)}\]
Example 9. As an example of the above proposition, the following is the identity form ?? of the \(\omega\)-Shannon-flow inequality in Eq. 13 : \[\begin{align} \omega h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \quad=\quad& 2h(XY) + (\omega-1) h(YZ) + (\omega-1)h(XZ)\nonumber\\ &-h(Y;Z|X) - h(X;Z|Y) - (\omega-2)h(X;Y|Z) \label{eq:intro:shannon:triangle:identity} \end{align}\tag{47}\] By substituting \(h(\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{X})\) from Eq. 19 , the above identity takes the following form: \[\begin{align} \omega h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \quad=\quad& 2h(XY) + (\omega-1) h(YZ) + (\omega-1)h(XZ)\nonumber\\ &-[h(XY) + h(XZ) - h(X) - h(XYZ)]\nonumber\\ &-[h(XY) + h(YZ) - h(Y) - h(XYZ)]\nonumber\\ &-(\omega-2)[h(XZ) + h(YZ) - h(Z) - h(XYZ)] \label{eq:intro:shannon:triangle:identity:explicit} \end{align}\tag{48}\] Note that Eq. 48 is indeed an identity in the sense that every term \(h(\boldsymbol{W})\) for \(\boldsymbol{W} \subseteq \{X, Y, Z\}\) cancels out on both sides of the equation. Hence, the above equation holds no matter what values we assign to the symbolic variables \(h(X), h(Y), h(Z), h(XY), h(XZ), h(YZ)\) and \(h(XYZ)\) (even if these values don’t represent a valid polymatroid).
We use the standard notation \(\|\boldsymbol{\lambda}\|_1\) to denote \(\sum_{\ell \in [L]} |\lambda_\ell|\).
Proposition 12. Given any \(\omega\)-Shannon-flow inequality of the form 45 , the following inequality holds: \[\begin{align} \|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1 \leq \sum_{i \in [I] \mid \boldsymbol{X}_i = \emptyset} w_i \label{eq:omega-shannon:unconditional} \end{align}\qquad{(7)}\]
Example 10. The \(\omega\)-Shannon-flow inequality in Eq. 46 has \(\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1 = \omega + 1\), while the RHS of Eq. ?? is \(2\omega\). Hence, inequality ?? becomes \(\omega+1 \leq 2\omega\), which holds since \(\omega \in [2, 3]\).
Proof of Proposition 12. Every \(\omega\)-Shannon-flow inequality 45 must hold for the following polymatroid: \[\begin{align} h(\boldsymbol{W}) = \begin{cases} 0 &\text{if \boldsymbol{W} = \emptyset}\\ 1 &\text{otherwise} \end{cases} \end{align}\] When evaluated over the above polymatroid, the RHS of identity ?? is at most \(\sum_{i \in [I] \mid \boldsymbol{X}_i = \emptyset} w_i\), while the LHS is at least \(\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1\). Note that for every \(j \in [J]\), we must have \(\alpha_j \geq \kappa_j\) because the triple \(\left(\frac{\alpha_j}{\kappa_j}, \frac{\beta_j}{\kappa_j}, \frac{\zeta_j}{\kappa_j}\right)\) is \(\omega\)-dominant. Hence, when \(\boldsymbol{G}_j = \emptyset\), the term \(\alpha_j h(\boldsymbol{X}_j|\boldsymbol{G}_j)\) contributes at least \(\kappa_j\) to the LHS of ?? . ◻
Definition 9 (An integral \(\omega\)-Shannon-flow inequality). An \(\omega\)-Shannon-flow inequality of the form 45 is called integral if
all coefficients \(\lambda_\ell, \alpha_j, \beta_j, \zeta_j, \kappa_j\) and \(w_i\) are integers,
and there exist non-negative integers \((m_p)_{p \in [P]}\) and \((s_q)_{q \in [Q]}\) such that the identity in Eq. ?? holds.
The \(\omega\)-Shannon-flow inequality in Eq. 13 is an example of an integral \(\omega\)-Shannon-flow inequality.
Our query evaluation algorithm relies on translating a proof sequence of an \(\omega\)-Shannon-flow inequality into a sequence of algorithmic operations, as exemplified in Figure 1. However, some operations might be too expensive to fit within our time budget, e.g., performing the join \(T(X, Z)\Join R(X, Y)\) over heavy values \(X\), which takes time \(O(N^2)\) exceeding our budget of \(O(N^{3/2})\) in this example. Whenever we encounter such an expensive operation, we have to give up on performing it while guaranteeing that the skipped tuples will still be produced later by some future operation, e.g., by the matrix multiplication \(M_1(X, Y)\times M_2(Y, Z)\) in Figure 1. In the language of \(\omega\)-Shannon-flow inequalities, this “giving up” corresponds to dropping some terms \(h(XZ) + h(Y|X)\) on the RHS of the inequality corresponding to the expensive operation \(T(X, Z)\Join R(X, Y)\). However, when we drop those terms from the RHS, we have to fix the inequality without losing too many terms on the LHS, in order to guarantee that the skipped tuples will still be produced later by some future operation. This idea of dropping terms and repairing the resulting Shannon-flow inequality goes back to what was known as the reset lemma in the original \(\mathsf{PANDA}\) algorithm [2], [3].
We present here a highly non-trivial generalization of the reset lemma from Shannon-flow inequalities 40 to \(\omega\)-Shannon-flow inequalities 45 . In particular, given an integral \(\omega\)-Shannon-flow inequality 45 , this lemma allows us to sacrifice any unconditional term \(h(\boldsymbol{Y}_i|\emptyset)\) on the RHS while losing at most one unit from the quantity \(\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1\) on the LHS. Unlike the original Reset Lemma [2], [3] which was restricted to Shannon-flow inequalities 40 , our new lemma has to support proper conditionals \(h(\boldsymbol{X}_j|\boldsymbol{G}_j)\) on the LHS of the \(\omega\)-Shannon-flow inequality. Moreover, this lemma has to maintain the \(\omega\)-dominance property of the triples \(\left(\frac{\alpha_j}{\kappa_j}, \frac{\beta_j}{\kappa_j}, \frac{\zeta_j}{\kappa_j}\right)\), which will be crucial for our query evaluation algorithm.
Lemma 1 (Generalized Reset Lemma). Given an integral \(\omega\)-Shannon-flow inequality of the form 45 , suppose that for some \(i_0 \in [I]\), we have \(\boldsymbol{X}_{i_0} = \emptyset\) and \(w_{i_0}>0\). Then, there exist non-negative integers \(\lambda_\ell', \alpha_j', \beta_j', \zeta_j', \kappa_j', w_i'\) for which the following is also an integral \(\omega\)-Shannon-flow inequality: \[\begin{align} \sum_{\ell \in [L]} \lambda_\ell' h(\boldsymbol{U}_{\ell}) + \sum_{j \in [J]} \left(\alpha_j' h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \beta_j' h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \zeta_j' h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \kappa_j' h(\boldsymbol{G}_j)\right) \quad\leq\quad \sum_{i \in [I]} w_i' h(\boldsymbol{Y}_i |\boldsymbol{X}_i) \end{align}\] and the coefficients satisfy the following conditions: \[\begin{align} w_{i_0}' &\leq w_{i_0}-1,\nonumber\\ w_{i}' &\leq w_{i} &\forall i \in [I]\setminus\{i_0\},\nonumber\\ \|\boldsymbol{\lambda}'\|_1 + \|\boldsymbol{\kappa}'\|_1 &\geq \|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1-1\label{eq:reset:mass} \end{align}\tag{49}\]
Before proving the lemma, we give some examples.
Example 11. Consider the \(\omega\)-Shannon-flow inequality in Eq. 13 (or equivalently Eq. 46 ). Suppose we want to drop one unit of \(h(XY)\) on the RHS of the inequality. The lemma says that it suffices to sacrifice at most one unit from the quantity \(\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1\) on the LHS. In this case, we can sacrifice one unit of \(h(XYZ)\) on the LHS, to obtain a valid \(\omega\)-Shannon-flow inequality: \[\begin{align} (\omega-1) h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \quad\leq\quad& h(XY) + (\omega-1) h(YZ) + (\omega-1)h(XZ) \end{align}\] The above is indeed a valid \(\omega\)-Shannon-flow inequality since it can be rewritten as the following identity of the form ?? : \[\begin{align} (\omega-1) h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \quad=\quad& h(XY) + (\omega-1) h(YZ) + (\omega-1)h(XZ)\nonumber\\ &-h(Z|X)-h(X;Z|Y) - (\omega-2)h(X;Y|Z) \end{align}\]
Example 12. Consider the following \(\omega\)-Shannon-flow inequality: \[\begin{align} h(X|\emptyset) + h(Y|\emptyset) + \gamma h(Z|\emptyset) + h(\emptyset) \quad\leq\quad h(X) + h(Y) + \gamma h(Z) \end{align}\] Recall that \(\gamma\stackrel{\mathrm{def}}{=}\omega - 2\), hence \(\gamma \in [0, 1]\). Suppose we want to drop \(\gamma h(Z)\) from the RHS. We can only afford to reduce \(\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1\) by at most \(\gamma\). If \(\gamma = 1\), then we can simply replace the original inequality with the trivial inequality \(0\leq 0\). Otherwise, we replace the original inequality with the following one: \[\begin{align} h(X|\emptyset) + h(Y|\emptyset) + 0\cdot h(Z|\emptyset) + (1-\gamma) h(\emptyset) \quad\leq\quad h(X) + h(Y) \end{align}\] The above is indeed a valid \(\omega\)-Shannon-flow inequality. In particular, note that the triple \((\frac{1}{1-\gamma}, \frac{1}{1-\gamma}, 0)\) is \(\omega\)-dominant, namely satisfies Eq. 42 44 . Eq. 44 holds because \[\frac{2}{1-\gamma} = 2 + \frac{2\gamma}{1-\gamma}\geq 2 + 2\gamma \geq 2 + \gamma = \omega.\]
Proof of Lemma 1. Let \(\boldsymbol{W} \stackrel{\mathrm{def}}{=}\boldsymbol{Y}_{i_0}\). We recognize the following cases:
If \(\boldsymbol{W} = \boldsymbol{U}_\ell\) for some \(\ell \in [L]\) where \(\lambda_\ell > 0\), we set \(\lambda_\ell' \stackrel{\mathrm{def}}{=}\lambda_\ell - 1\) and \(w_{i_0}'\stackrel{\mathrm{def}}{=}w_{i_0}-1\). All other coefficients \(\lambda_\ell', \alpha_j', \beta_j', \zeta_j', \kappa_j', w_i'\) remain the same as the original \(\lambda_\ell, \alpha_j, \beta_j, \zeta_j, \kappa_j, w_i\). The new inequality remains a valid integral \(\omega\)-Shannon-flow inequality since we dropped \(h(\boldsymbol{W}|\emptyset)\) from both sides.
If \(\boldsymbol{W} = \boldsymbol{G}_j\boldsymbol{X}_j\) for some \(j \in [J]\) where \(\alpha_j, \kappa_j>0\), then we set \(\alpha_j' \stackrel{\mathrm{def}}{=}\alpha_j-1\), \(\kappa_j' \stackrel{\mathrm{def}}{=}\kappa_j - 1\), and \(w_{i_0}'\stackrel{\mathrm{def}}{=}w_{i_0}-1\). The inequality still holds since we dropped \(h(\boldsymbol{W}|\emptyset)\) from both sides. If \(\kappa_j' = 0\), then we drop \(j\) from \([J]\). Otherwise, the triple \(\left(\frac{\alpha_j'}{\kappa_j'}, \frac{\beta_j}{\kappa_j'}, \frac{\zeta_j}{\kappa_j'}\right)\) is still \(\omega\)-dominant (Definition 7). In particular, inequality 42 continues to hold because: \[\begin{align} \frac{\alpha_j'}{\kappa_j'} &= \frac{\alpha_j-1}{\kappa_j-1} \geq \frac{\kappa_j-1}{\kappa_j-1}=1. \end{align}\] Moreover, inequality 44 continues to hold because of the following: \[\begin{align} \frac{\alpha_j'+\beta_j+\zeta_j}{\kappa_j'} &= \frac{\alpha_j+\beta_j+\zeta_j-1}{\kappa_j-1}\nonumber\\ &\geq \frac{\kappa_j\omega-1}{\kappa_j-1} &\text{(Inductively by Eq.~\eqref{eq:omega-dominant:3})}\nonumber\\ &= \omega + \underbrace{\frac{\omega-1}{\kappa_j-1}}_{\geq 0}\label{eq:omega-dominant:preserve} \end{align}\tag{50}\]
If \(\boldsymbol{W} = \boldsymbol{G}_j \boldsymbol{Y}_j\) for some \(j \in [J]\) where \(\beta_j, \kappa_j>0\), then this is symmetric to the previous case. Namely, we set \(\beta_j' \stackrel{\mathrm{def}}{=}\beta_j-1\), \(\kappa_j' \stackrel{\mathrm{def}}{=}\kappa_j - 1\), and \(w_{i_0}'\stackrel{\mathrm{def}}{=}w_{i_0}-1\).
If \(\boldsymbol{W} = \boldsymbol{G}_j \boldsymbol{Z}_j\) for some \(j \in [J]\) where \(\zeta_j, \kappa_j>0\), then we set \(\zeta_j' \stackrel{\mathrm{def}}{=}\zeta_j-1\), \(\kappa_j' \stackrel{\mathrm{def}}{=}\kappa_j - 1\), and \(w_{i_0}'\stackrel{\mathrm{def}}{=}w_{i_0}-1\). If \(\kappa_j' = 0\), then we drop \(j\) from \([J]\). Otherwise, the triple \(\left(\frac{\alpha_j}{\kappa_j'}, \frac{\beta_j}{\kappa_j'}, \frac{\zeta_j'}{\kappa_j'}\right)\) is still \(\omega\)-dominant. In particular, similar to above, inequality 44 continues to hold as follows: \[\begin{align} \frac{\alpha_j+\beta_j+\zeta_j'}{\kappa_j'} &= \frac{\alpha_j+\beta_j+\zeta_j-1}{\kappa_j-1}\geq \omega \end{align}\] The last inequality follows from Eq. 50 .
If \(\boldsymbol{W} = \boldsymbol{G}_j\) for some \(j \in [J]\) where \(\kappa_j > 0\), note that by Eq. 42 , \(\alpha_j\geq\kappa_j\), hence the term \(\kappa_j h(\boldsymbol{G}_j)\) on the LHS is already getting canceled with the term \(\alpha_j h(\boldsymbol{X}_j|\boldsymbol{G}_j)\) on the same side. Hence, the term \(h(\boldsymbol{W})\) on the RHS must be getting canceled with something else. Therefore, this case falls under the next one.
In all other cases, \(h(\boldsymbol{W}|\emptyset)\) must cancel out with some term on the RHS of the identity ?? , just like in the original Reset Lemma [2], [3]. Here we recognize the same three cases from the original Reset Lemma, which we repeat below for self-containment:
\(h(\boldsymbol{W})\) cancels out with some other term \(h(\boldsymbol{Y}_i|\boldsymbol{X}_i)\) for some \(i \in [I]\setminus \{i_0\}\) where \(\boldsymbol{X}_i = \boldsymbol{W}\). In this case, we apply the following rewrite to the RHS of the identity ?? : \[\begin{align} h(\boldsymbol{W}) + h(\boldsymbol{Y}_i|\boldsymbol{W}) = h(\boldsymbol{Y}_i\boldsymbol{W}) \label{eq:reset:composition} \end{align}\tag{51}\] And now inductively, our target is to cancel out the newly added term \(h(\boldsymbol{Y}_i\boldsymbol{W})\).
\(h(\boldsymbol{W})\) cancels out with some term \(-h(\boldsymbol{Y}_p|\boldsymbol{X}_p)\) from some \(p \in [P]\) where \(\boldsymbol{W} = \boldsymbol{X}_p\boldsymbol{Y}_p\). In this case, we apply the following rewrite to the RHS of the identity ?? : \[\begin{align} h(\boldsymbol{W})-h(\boldsymbol{Y}_p|\boldsymbol{X}_p) = h(\boldsymbol{W})-h(\boldsymbol{X}_p\boldsymbol{Y}_p) + h(\boldsymbol{X}_p) = h(\boldsymbol{X}_p) \label{eq:reset:monotonicity} \end{align}\tag{52}\] And now, we proceed inductively to eliminate the new term \(h(\boldsymbol{X}_p)\).
\(h(\boldsymbol{W})\) cancels out with some term \(-h(\boldsymbol{Y}_q;\boldsymbol{Z}_q|\boldsymbol{X}_q)\) for some \(q \in [Q]\) where \(\boldsymbol{W} = \boldsymbol{X}_q\boldsymbol{Y}_q\). In this case, we apply the rewrite: \[\begin{align} h(\boldsymbol{W}) -h(\boldsymbol{Y}_q;\boldsymbol{Z}_q|\boldsymbol{X}_q) &= h(\boldsymbol{W}) -h(\boldsymbol{X}_q\boldsymbol{Y}_q) -h(\boldsymbol{X}_q\boldsymbol{Z}_q)+h(\boldsymbol{X}_q) + h(\boldsymbol{X}_q\boldsymbol{Y}_q\boldsymbol{Z}_q)\nonumber\\ &= h(\boldsymbol{X}_q\boldsymbol{Y}_q\boldsymbol{Z}_q) - h(\boldsymbol{Z}_q|\boldsymbol{X}_q) \label{eq:reset:submodularity} \end{align}\tag{53}\] And now we inductively eliminate \(h(\boldsymbol{X}_q\boldsymbol{Y}_q\boldsymbol{Z}_q)\).
By applying each one of the above three cases, the following integral quantity always decreases by at least one, thus proving that this process must terminate: \[\begin{align} \|\boldsymbol{w}\|_1 + \|\boldsymbol{m}\|_1 + 2\|\boldsymbol{s}\|_1 \label{eq:reset:potential} \end{align}\tag{54}\] In particular, Case [case:reset:composition] decreases \(\|\boldsymbol{w}\|_1\) by 1, Case [case:reset:monotonicity] decreases \(\|\boldsymbol{m}\|_1\) by 1, and Case [case:reset:submodularity] increases \(\|\boldsymbol{m}\|_1\) by 1 and decreases \(\|\boldsymbol{s}\|_1\) by
◻
The original \(\mathsf{PANDA}\) algorithm is based on constructing a proof sequence for a given Shannon-flow inequality (Eq. 40 ). We present here a highly non-trivial generalization of the proof sequence construction that works for \(\omega\)-Shannon-flow inequalities (Eq. 45 ). Out of the box, the original proof sequence construction does not work for \(\omega\)-Shannon-flow inequalities because, unlike Shannon-flow inequalities, the \(\omega\)-Shannon-flow ones can have proper conditionals, i.e., terms \(h(\boldsymbol{X}_j|\boldsymbol{G}_j)\) where \(\boldsymbol{G}_j\neq\emptyset\), on the LHS. The other challenge here is maintaining the \(\omega\)-dominance property of the triples \(\left(\frac{\alpha_j}{\kappa_j}, \frac{\beta_j}{\kappa_j}, \frac{\zeta_j}{\kappa_j}\right)\), which is needed later to get a corresponding evaluation algorithm that uses matrix multiplication.
Theorem 13 (Generalized Proof Sequence Construction). Given an integral \(\omega\)-Shannon-flow inequality of the form 45 , there exists a finite sequence of steps that transforms the terms on the RHS of the inequality into (a superset of) the terms on the LHS. Each step in the sequence replaces some terms on the RHS with smaller terms, thus the full sequence proves that the LHS is smaller than the RHS. Moreover, each step has either one of the following forms:
Decomposition Step: \(h(\boldsymbol{X} \boldsymbol{Y}) \to h(\boldsymbol{X}) + h(\boldsymbol{Y}|\boldsymbol{X})\).
Composition Step: \(h(\boldsymbol{X}) + h(\boldsymbol{Y}|\boldsymbol{X}) \to h(\boldsymbol{X} \boldsymbol{Y})\).
Monotonicity Step: \(h(\boldsymbol{X}\boldsymbol{Y}) \to h(\boldsymbol{X})\).
Submodularity Step: \(h(\boldsymbol{Y}|\boldsymbol{X}) \to h(\boldsymbol{Y}|\boldsymbol{X}\boldsymbol{Z})\).
Note that by Shannon inequalities, each one of the above steps replaces one or two terms with smaller terms. In particular, \[\begin{align} h(\boldsymbol{X} \boldsymbol{Y}) &= h(\boldsymbol{X}) + h(\boldsymbol{Y}|\boldsymbol{X}) &\text{(by Eq.~\eqref{eq:conditional})}\\ h(\boldsymbol{X}\boldsymbol{Y}) &\geq h(\boldsymbol{X}) &\text{(by Eq.~\eqref{eq:monotone})}\\ h(\boldsymbol{Y}|\boldsymbol{X}) &\geq h(\boldsymbol{Y}|\boldsymbol{X}\boldsymbol{Z}) &\text{(by Eq.~\eqref{eq:submod})}\\ \end{align}\]
\[\small \begin{array}{|l|l|} \hline \rowcolor{lightgray}\text{\bf Identity~\eqref{eq:omega-shannon:identity}} & \text{\bf Proof Steps}\\\hline \begin{aligned}[c] &\omega h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \\ &= 2\positiveterm{h(XY)} + (\omega-1) h(YZ) + (\omega-1)h(XZ)\nonumber\\ &-[\negativeterm{h(XY)} + h(XZ) - h(X) - h(XYZ)]\nonumber\\ &-[h(XY) + h(YZ) - h(Y) - h(XYZ)]\nonumber\\ &-(\omega-2)[h(XZ) + h(YZ) - h(Z) - h(XYZ)] \end{aligned}& \begin{aligned}[c] \positiveterm{h(XY)} &\to h(X) + h(Y|X)\\ h(Y|X) &\to h(Y|XZ) \end{aligned}\\\hline \begin{aligned}[c] &\omega h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \\ &= h(XY) + h(X) + \negativeterm{h(Y|XZ)} + (\omega-1) h(YZ) + (\omega-1)\positiveterm{h(XZ)}\nonumber\\ &-[h(XY) + h(YZ) - h(Y) - h(XYZ)]\nonumber\\ &-(\omega-2)[h(XZ) + h(YZ) - h(Z) - h(XYZ)] \end{aligned}& \begin{aligned}[c] \positiveterm{h(XZ)} + \negativeterm{h(Y|XZ)} &\to h(XYZ) \end{aligned}\\\hline \begin{aligned}[c] &\omega \negativeterm{h(XYZ)} + h(X) + h(Y) + (\omega-2)h(Z) \\ &= h(XY) + h(X) + \positiveterm{h(XYZ)} + (\omega-1) h(YZ) + (\omega-2)h(XZ)\nonumber\\ &-[h(XY) + h(YZ) - h(Y) - h(XYZ)]\nonumber\\ &-(\omega-2)[h(XZ) + h(YZ) - h(Z) - h(XYZ)] \end{aligned}& \begin{aligned}[c] \text{Cancel $h(XYZ)$ on both sides} \end{aligned}\\\hline \begin{aligned}[c] &(\omega-1) h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \\ &= h(XY) + h(X) + (\omega-1) \positiveterm{h(YZ)} + (\omega-2)h(XZ)\nonumber\\ &-[h(XY) + \negativeterm{h(YZ)} - h(Y) - h(XYZ)]\nonumber\\ &-(\omega-2)[h(XZ) + h(YZ) - h(Z) - h(XYZ)] \end{aligned}& \begin{aligned}[c] \positiveterm{h(YZ)} &\to h(Y) + h(Z|Y)\\ h(Z|Y) &\to h(Z|XY) \end{aligned}\\\hline \begin{aligned}[c] &(\omega-1) h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \\ &= \positiveterm{h(XY)} + h(X) + (\omega-2) h(YZ) + h(Y) + \negativeterm{h(Z|XY)}+ (\omega-2)h(XZ)\nonumber\\ &-(\omega-2)[h(XZ) + h(YZ) - h(Z) - h(XYZ)] \end{aligned}& \begin{aligned}[c] \positiveterm{h(XY)} + \negativeterm{h(Z|XY)} &\to h(XYZ) \end{aligned}\\\hline \begin{aligned}[c] &(\omega-1) \negativeterm{h(XYZ)} + h(X) + h(Y) + (\omega-2)h(Z) \\ &= \positiveterm{h(XYZ)} + h(X) + (\omega-2) h(YZ) + h(Y)+ (\omega-2)h(XZ)\nonumber\\ &-(\omega-2)[h(XZ) + h(YZ) - h(Z) - h(XYZ)] \end{aligned}& \begin{aligned}[c] \text{Cancel $h(XYZ)$ on both sides} \end{aligned}\\\hline \begin{aligned}[c] &(\omega-2) h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \\ &= h(X) + (\omega-2) h(YZ) + h(Y)+ (\omega-2)\positiveterm{h(XZ)}\nonumber\\ &-(\omega-2)[\negativeterm{h(XZ)} + h(YZ) - h(Z) - h(XYZ)] \end{aligned}& \begin{aligned}[c] \gamma\positiveterm{h(XZ)} &\to \gamma h(Z) + \gamma h(X|Z)\\ \gamma h(X|Z) &\to \gamma h(X|YZ) \end{aligned}\\\hline \begin{aligned}[c] &(\omega-2) h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \\ &= h(X) + \positiveterm{(\omega-2) h(YZ)} + h(Y)+ (\omega-2)h(Z) + \negativeterm{(\omega-2)h(X|YZ)} \end{aligned}& \begin{aligned}[c] \positiveterm{\gamma h(YZ)} + \negativeterm{\gamma h(X|YZ)} &\to \gamma h(XYZ) \end{aligned}\\\hline \begin{aligned}[c] &\negativeterm{(\omega-2) h(XYZ)} + h(X) + h(Y) + (\omega-2)h(Z) \\ &= h(X) + \positiveterm{(\omega-2) h(XYZ)} + h(Y)+ (\omega-2)h(Z) \end{aligned}& \begin{aligned}[c] \text{Cancel $(\omega-2)h(XYZ)$ on both sides} \end{aligned}\\\hline \begin{aligned}[c] &\negativeterm{h(X) + h(Y) + (\omega-2)h(Z)}\\ &= \positiveterm{h(X) + h(Y)+ (\omega-2)h(Z)} \end{aligned}& \begin{aligned}[c] &\text{Cancel $h(X) + h(Y)+ (\omega-2)h(Z)$}\\ &\text{on both sides} \end{aligned}\\\hline \begin{aligned}[c] 0=0 \end{aligned}& \begin{aligned}[c] \end{aligned}\\\hline \end{array}\]
Before proving the theorem, we give an example. Figure 1 shows a compact form of the proof sequence for the \(\omega\)-Shannon-flow inequality in Eq. 13 . In particular, the proof sequence in Figure 1 combines two steps \(h(Y|X) \to h(Y|XZ)\) and \(h(XZ) + h(Y|XZ)\to h(XYZ)\) into a single step \(h(XZ) + h(Y|X) \to h(XYZ)\). Table ¿tbl:table:ps? shows the detailed proof steps for the same \(\omega\)-Shannon-flow inequality, as well as how we come up with these steps in the first place. In particular, Proposition 12 tells us that as long as \(\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1 > 0\), there must exist some unconditional term \(h(\boldsymbol{Y}_i|\emptyset)\) on the RHS of the \(\omega\)-Shannon-flow inequality. We repeatedly rely on the existence of such unconditional term on the RHS. In particular, we start from the identity form 48 of the \(\omega\)-Shannon-flow inequality in Eq. 13 . We pick such unconditional term on the RHS, say \(h(XY)\). Since 48 is an identity and \(h(XY)\) does not appear on the LHS, it must be getting canceled with some other term on the RHS. In this case, it is being canceled by \(-h(XY)\) coming from \(-h(Y;Z|X)\). We apply the two proof steps \(h(XY) \to h(X) + h(Y|X)\) and \(h(Y|X) \to h(Y|XZ)\) to the RHS of the identity 48 and we also drop \(-h(Y;Z|X)\) from the RHS, thus resulting in a new identity. This new identity is depicted in the second row of Table ¿tbl:table:ps?. We repeat the same process until we end up with the trivial identity \(0=0\).
For the purpose of proving the Theorem 13 in general, we will represent an \(\omega\)-Shannon-flow inequality slightly differently from Eq. 45 . In particular, some terms on the LHS of Eq. 45 might already occur on the RHS, therefore we could decompose the RHS into two parts: One part which is a subset of terms on the LHS, and another part containing the remaining RHS terms. Formally, we can represent an \(\omega\)-Shannon-flow inequality as follows: \[\begin{align} \sum_{\ell \in [L]} \lambda_\ell h(\boldsymbol{U}_{\ell}) +& \sum_{j \in [J]} \left(\alpha_j h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \beta_j h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \zeta_j h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \kappa_j h(\boldsymbol{G}_j)\right) \quad\leq\quad\nonumber\\ &\sum_{j \in [J]} \left(\hat{\alpha}_j h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \hat{\beta}_j h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \hat{\zeta}_j h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \hat{\kappa}_j h(\boldsymbol{G}_j)\right) +\sum_{i \in [I]} \hat{w}_i h(\boldsymbol{Y}_i |\boldsymbol{X}_i) \label{eq:omega-shannon-ps} \end{align}\tag{55}\] where in addition to the conditions from Definition 8, we also require that
For all \(j \in [J]\), we have \(0\leq\hat{\alpha}_j \leq \alpha_j\), \(0\leq\hat{\beta}_j \leq \beta_j\), \(0\leq\hat{\zeta}_j \leq \zeta_j\), and \(0\leq\hat{\kappa}_j \leq \kappa_j\).
For all \(i \in [I]\), we have \(0\leq \hat{w}_i \leq w_i\).
Finally, we assume, for all \(j \in [J]\), \[\begin{align} \kappa_j - \hat{\kappa}_j = 0 \quad\quad\Rightarrow\quad\quad \alpha_j - \hat{\alpha}_j= \beta_j - \hat{\beta}_j= \zeta_j - \hat{\zeta}_j = 0 \label{eq:cond:well-behaved} \end{align}\tag{56}\]
By Proposition 11, for every inequality of the form 55 , there exist non-negative vectors \(\boldsymbol{m} \stackrel{\mathrm{def}}{=}(m_p)_{p \in [P]}\) and \(\boldsymbol{s} \stackrel{\mathrm{def}}{=}(s_q)_{q \in [Q]}\) such that the following identity holds over symbolic variables \(h(\boldsymbol{X})\) for \(\boldsymbol{X} \subseteq \mathcal{V}\) where \(h(\emptyset) = 0\):
\[\begin{align} \sum_{\ell \in [L]} \lambda_\ell h(\boldsymbol{U}_{\ell}) +& \sum_{j \in [J]} \left(\alpha_j h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \beta_j h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \zeta_j h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \kappa_j h(\boldsymbol{G}_j)\right) \quad=\quad\nonumber\\ &\sum_{j \in [J]} \left(\hat{\alpha}_j h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \hat{\beta}_j h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \hat{\zeta}_j h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \hat{\kappa}_j h(\boldsymbol{G}_j)\right) +\sum_{i \in [I]} \hat{w}_i h(\boldsymbol{Y}_i |\boldsymbol{X}_i)\nonumber\\ - &\sum_{p \in [P]} m_p h(\boldsymbol{Y}_p |\boldsymbol{X}_p) - \sum_{q \in [Q]} s_q h(\boldsymbol{Y}_q;\boldsymbol{Z}_q |\boldsymbol{X}_q) \label{eq:omega-shannon-ps:identity} \end{align}\tag{57}\]
Proof of Theorem 13. An inequality of the form 45 can be converted to the from 55 by initializing \(\hat{w}_i = w_i\) for all \(i \in [I]\) and \(\hat{\alpha}_j = \hat{\beta}_j = \hat{\zeta}_j = \hat{\kappa}_j = 0\) for all \(j \in [J]\). Consider an inequality of the form 55 and the corresponding identity 57 . Define the quantity: \[\begin{align} \Lambda \stackrel{\mathrm{def}}{=}\|\boldsymbol{\lambda}\|_1 + \sum_{\substack{j \in [J]\\\boldsymbol{G}_j \neq \emptyset}} (\kappa_j - \hat{\kappa}_j)+ \sum_{\substack{j \in [J]\\\boldsymbol{G}_j = \emptyset}} (\alpha_j - \hat{\alpha}_j) + (\beta_j - \hat{\beta}_j) + (\zeta_j - \hat{\zeta}_j) \end{align}\] If \(\Lambda = 0\), then by Condition 56 , we have \(\hat{\alpha}_j=\alpha_j\), \(\hat{\beta}_j=\beta_j\), \(\hat{\zeta}_j=\zeta_j\) and \(\hat{\kappa}_j=\kappa_j\) for all \(j\) and we are done. Now assume that \(\Lambda > 0\). Similar to the proof of Proposition 12, we have \[\sum_{i \in [I]\mid\boldsymbol{X}_i = \emptyset} \hat{w}_i \geq \Lambda > 0.\] Hence, there exists some \(i_0 \in [I]\) such that \(\boldsymbol{X}_{i_0} = \emptyset\) and \(\hat{w}_{i_0} > 0\). Define \(\boldsymbol{W}\stackrel{\mathrm{def}}{=}\boldsymbol{Y}_{i_0}\). We recognize the following cases:
If there exists \(\ell\in[L]\) where \(\boldsymbol{U}_\ell = \boldsymbol{W}\) and \(\lambda_\ell > 0\), then we reduce both \(\lambda_\ell\) and \(\hat{w}_{i_0}\) by one thus canceling out the term \(h(\boldsymbol{W})\) from both sides of the identity 57 .
If there exists \(j \in [J]\) where \(\boldsymbol{G}_j\boldsymbol{X}_j = \boldsymbol{W}\) and \(\alpha_j > \hat{\alpha}_j\), then we apply the following decomposition step to the term \(h(\boldsymbol{Y}_{i_0}|\boldsymbol{X}_{i_0}) = h(\boldsymbol{W} |\emptyset)\) on the RHS of 57 : \[\begin{align} h(\boldsymbol{W}) \to h(\boldsymbol{G}_j) + h(\boldsymbol{X}_j|\boldsymbol{G}_j) \end{align}\] and now we have \(h(\boldsymbol{X}_j|\boldsymbol{G}_j)\) on both sides of the identity 57 . We increase \(\hat{\alpha}_j\) by one thus pairing the two terms \(h(\boldsymbol{X}_j|\boldsymbol{G}_j)\) with one another. Condition 56 continues to hold.
If there exists \(j \in [J]\) where either \(\boldsymbol{G}_j\boldsymbol{Y}_j = \boldsymbol{W}\) and \(\beta_j > \hat{\beta}_j\), or \(\boldsymbol{G}_j\boldsymbol{Z}_j = \boldsymbol{W}\) and \(\zeta_j > \hat{\zeta}_j\), then this is similar to the previous case.
If there exists \(j \in [J]\) where \(\boldsymbol{G}_j = \boldsymbol{W}\) and \(\kappa_j - \hat{\kappa}_j > (\alpha_j - \hat{\alpha}_j) + (\beta_j - \hat{\beta}_j) + (\zeta_j - \hat{\zeta}_j)\), then we have \(h(\boldsymbol{W})\) on both sides of identity 57 . We increase \(\hat{\kappa}_j\) by one thus pairing the two terms \(h(\boldsymbol{G}_j)\) with one another. Condition 56 continues to hold.
If for every \(j \in [J]\) where \(\boldsymbol{G}_j = \boldsymbol{W}\) we have \(\kappa_j - \hat{\kappa}_j \leq (\alpha_j - \hat{\alpha}_j) + (\beta_j - \hat{\beta}_j) + (\zeta_j - \hat{\zeta}_j)\), then \(h(\boldsymbol{G}_j)\) on the LHS already cancels out with one of the three terms \(h(\boldsymbol{X}_j|\boldsymbol{G}_j)\), \(h(\boldsymbol{Y}_j|\boldsymbol{G}_j)\), and \(h(\boldsymbol{Z}_j|\boldsymbol{G}_j)\) on the LHS of 57 . Therefore, \(h(\boldsymbol{W})\) on the RHS must be getting canceled with some other term, and this case falls under the next one.
In all other cases, the term \(h(\boldsymbol{W})\) must cancel out with some other term on the RHS of the identity 57 . We recognize three cases similar to the original proof sequence construction from [2], [3]:
\(h(\boldsymbol{W})\) cancels out with some other term \(h(\boldsymbol{Y}_i|\boldsymbol{X}_i)\) for some \(i \in [I]\) on the RHS where \(\boldsymbol{X}_i = \boldsymbol{W}\). In this case, we can compose the two terms using the rewrite from Eq. 51 , which corresponds to a composition step: \[\begin{align} h(\boldsymbol{W}) + h(\boldsymbol{Y}_i | \boldsymbol{W}) \to h(\boldsymbol{Y}_i \boldsymbol{W}) & &\text{(Composition Step)} \end{align}\]
\(h(\boldsymbol{W})\) cancels out with some term \(-h(\boldsymbol{Y}_p|\boldsymbol{X}_p)\) for some \(p \in [P]\) where \(\boldsymbol{W} = \boldsymbol{X}_p\boldsymbol{Y}_p\). In this case, we can apply the rewrite from Eq. 52 , which corresponds to a monotonicity step: \[\begin{align} h(\boldsymbol{W}) \to h(\boldsymbol{X}_p) & &\text{(Monotonicity Step)} \end{align}\]
\(h(\boldsymbol{W})\) cancels out with some term \(-h(\boldsymbol{Y}_q;\boldsymbol{Z}_q|\boldsymbol{X}_q)\) for some \(q \in [Q]\) where \(\boldsymbol{W} = \boldsymbol{X}_q\boldsymbol{Y}_q\). In this case, instead of applying the rewrite from Eq. 53 , we apply the following rewrite: \[\begin{align} h(\boldsymbol{W}) -h(\boldsymbol{Y}_q;\boldsymbol{Z}_q|\boldsymbol{X}_q) &= h(\boldsymbol{W}) -h(\boldsymbol{X}_q\boldsymbol{Y}_q) -h(\boldsymbol{X}_q\boldsymbol{Z}_q)+h(\boldsymbol{X}_q) + h(\boldsymbol{X}_q\boldsymbol{Y}_q\boldsymbol{Z}_q)\nonumber\\ &= h(\boldsymbol{X}_q) + h(\boldsymbol{Y}_q|\boldsymbol{X}_q\boldsymbol{Z}_q) \label{eq:ps:submodularity} \end{align}\tag{58}\] The above rewrite corresponds to applying a decomposition step followed by a submodularity step: \[\begin{align} h(\boldsymbol{W}) \to h(\boldsymbol{X}_q) + h(\boldsymbol{Y}_q|\boldsymbol{X}_q) & & \text{(Decomposition Step)}\\ h(\boldsymbol{Y}_q|\boldsymbol{X}_q) \to h(\boldsymbol{Y}_q|\boldsymbol{X}_q\boldsymbol{Z}_q) & & \text{(Submodularity Step)} \end{align}\]
In each one of the above cases, the following integral quantity always decreases by at least one, thus proving that this process must terminate: \[\begin{align} \|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\alpha}-\hat{\boldsymbol{\alpha}}\|_1 + \|\boldsymbol{\beta}-\hat{\boldsymbol{\beta}}\|_1 + \|\boldsymbol{\zeta}-\hat{\boldsymbol{\zeta}}\|_1 + \|\boldsymbol{\kappa}-\hat{\boldsymbol{\kappa}}\|_1 + \|\hat{\boldsymbol{w}}\|_1 + \|\boldsymbol{m}\|_1 + 2\|\boldsymbol{s}\|_1 \label{eq:ps:potential} \end{align}\tag{59}\] In particular,
Case [case:ps:cancel-lambda] decreases \(\|\boldsymbol{\lambda}\|_1\) by 1.
Cases [case:ps:cancel-alpha] and [case:ps:cancel-beta-or-zeta] decrease \(\|\boldsymbol{\alpha}-\hat{\boldsymbol{\alpha}}\|_1 + \|\boldsymbol{\beta}-\hat{\boldsymbol{\beta}}\|_1 + \|\boldsymbol{\zeta}-\hat{\boldsymbol{\zeta}}\|_1\) by 1. Note that \(\|\hat{\boldsymbol{w}}\|_1\) remains unchanged here despite the decomposition step. This is because one of the two terms resulting from the decomposition step was paired with a term on the LHS of the identity 57 , hence it no longer contributes to \(\|\hat{\boldsymbol{w}}\|_1\).
Case [case:ps:cancel-kappa] decreases both \(\|\boldsymbol{\kappa}-\hat{\boldsymbol{\kappa}}\|_1\) and \(\|\hat{\boldsymbol{w}}\|_1\) by 1.
Case [case:ps:kappa-unchanged] falls under the remaining cases.
Case [case:ps:composition] decreases \(\|\hat{\boldsymbol{w}}\|_1\) by 1.
Case [case:ps:monotonicity] decreases \(\|\boldsymbol{m}\|_1\) by
Case [case:ps:submodularity] increases \(\|\hat{\boldsymbol{w}}\|_1\) by 1 and decreases \(\|\boldsymbol{s}\|_1\) by 1.
◻
The original \(\mathsf{PANDA}\) algorithm from [2], [3], [5] evaluates a BCQ in submodular width time by reducing the problem to evaluating a collection of Disjunctive Datalog rules (DDRs), which were reviewed in Section 3.6. For the purpose of designing a general algorithm for evaluating a BCQ in \(\omega\)-submodular width time, we will need to generalize the concept of DDRs. In this section, we present our generalization of DDRs, called \(\omega\)-DDRs. In Section 7.6, we present an algorithm for evaluating \(\omega\)-DDRs. Finally, in Section 7.7, we show how to evaluate a BCQ \(Q\) in \(\omega\)-submodular width time by reducing the problem to evaluating a collection of \(\omega\)-DDRs, each of which is evaluated using the algorithm from Section 7.6.
Definition 10 (\(\omega\)-DDR and its model). Let \(\mathcal{V}\) be a set of variables, and \(\Sigma_{\text{\sf in}}\) be an input schema. Let \(L\) and \(J\) be two natural numbers, and \(\Sigma_{\text{\sf out}}\) be an output schema consisting of two types of atoms:
An atom \(P_\ell(\boldsymbol{U}_\ell)\) for every \(\ell \in [L]\), where \(\boldsymbol{U}_\ell\) is a subset of \(\mathcal{V}\).
Three atoms \(S_j(\boldsymbol{X}_j\boldsymbol{G}_j), T_j(\boldsymbol{Y}_j\boldsymbol{G}_j), W_j(\boldsymbol{Z}_j\boldsymbol{G}_j)\) for every \(j \in [J]\), where \(\boldsymbol{G}_j, \boldsymbol{X}_j, \boldsymbol{Y}_j, \boldsymbol{Z}_j\) are disjoint subsets of \(\mathcal{V}\).
An \(\omega\)-Disjunctive Datalog Rule (\(\omega\)-DDR) with input and output schemas \(\Sigma_{\text{\sf in}}\) and \(\Sigma_{\text{\sf out}}\) respectively is an expression of the form: \[\begin{align} \bigvee_{\ell\in[L]} P_\ell(\boldsymbol{U}_\ell) \vee \bigvee_{j \in [J]}\left(S_j(\boldsymbol{X}_j\boldsymbol{G}_j)\wedge T_j(\boldsymbol{Y}_j\boldsymbol{G}_j)\wedge W_j(\boldsymbol{Z}_j\boldsymbol{G}_j) \right) \quad\text{ :- }\quad \bigwedge_{R(\boldsymbol{Z}) \in \Sigma_{\text{\sf in}}} R(\boldsymbol{Z}) \label{eq:disjunctive-omega} \end{align}\tag{60}\] Given a database instance \(D\) over schema \(\Sigma_{\text{\sf in}}\), a model (or output instance) for the \(\omega\)-DDR 60 is a collection of output tables \(P_\ell(\boldsymbol{U}_\ell)\) for \(\ell \in [L]\), and tables \((S_j(\boldsymbol{X}_j \boldsymbol{G}_j), T_j(\boldsymbol{Y}_j \boldsymbol{G}_j), W_j(\boldsymbol{Z}_j \boldsymbol{G}_j))\) for \(j \in [J]\) such that for every tuple \(\boldsymbol{t} \in \mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma_{\text{\sf in}}\):
either there exists \(\ell \in [L]\) where \(\boldsymbol{t}_{\boldsymbol{U}_\ell}\in P_\ell\),
or there exists \(j \in [J]\) where \(\boldsymbol{t}_{\boldsymbol{X}_j\boldsymbol{G}_j}\in S_j\), \(\boldsymbol{t}_{\boldsymbol{Y}_j\boldsymbol{G}_j}\in T_j\), and \(\boldsymbol{t}_{\boldsymbol{Z}_j\boldsymbol{G}_j}\in W_j\).
For the purpose of evaluating an \(\omega\)-DDR in our target runtime bounds, we need a different notion of a model for an \(\omega\)-DDR, where the model is described through sub-probability measures rather than relations. This follows the \(\textsf{PANDAExpress}\) approach [5] in order to avoid unnecessary \(\text{\sf polylog}\)-factors in the runtime. See Section 3.8 for some background on sub-probability measures.
Definition 11 (Targets of an \(\omega\)-DDR). Consider an \(\omega\)-DDR of the form 60 . For each \(\ell \in [L]\), we refer to the atom \(P_\ell(\boldsymbol{U}_\ell)\) as a join target of the \(\omega\)-DDR, and its variable are \(\text{\sf vars}(P_\ell(\boldsymbol{U}_\ell)) \stackrel{\mathrm{def}}{=}\boldsymbol{U}_\ell\). For each \(j \in [J]\), we think of the three conjuncts \(S_j(\boldsymbol{X}_j\boldsymbol{G}_j)\), \(T_j(\boldsymbol{Y}_j\boldsymbol{G}_j)\), and \(W_j(\boldsymbol{Z}_j\boldsymbol{G}_j)\) as being partially ordered, where \(S_j\) and \(T_j\) are interchangeable with one another, whereas \(W_j\) is not interchangeable with either one of them. This partial order relationship is captured by the tuple \((\{S_j(\boldsymbol{X}_j \boldsymbol{G}_j), T_j(\boldsymbol{Y}_j \boldsymbol{G}_j)\}, W_j(\boldsymbol{Z}_j\boldsymbol{G}_j))\), which we refer to as an MM target of the \(\omega\)-DDR, and its variables are \[\text{\sf vars}(\{S_j(\boldsymbol{X}_j \boldsymbol{G}_j), T_j(\boldsymbol{Y}_j \boldsymbol{G}_j)\}, W_j(\boldsymbol{Z}_j\boldsymbol{G}_j)) \stackrel{\mathrm{def}}{=}\boldsymbol{X}_j \cup \boldsymbol{Y}_j \cup \boldsymbol{Z}_j \cup \boldsymbol{G}_j.\] We refer to either kinds of targets as a target of the \(\omega\)-DDR.
Recall from Section 3.8 that we use \(p_{\boldsymbol{Y}|\boldsymbol{X}}(\boldsymbol{t})\) as a shorthand for \(p_{\boldsymbol{Y}|\boldsymbol{X}}(\boldsymbol{t}_{\boldsymbol{Y}}|\boldsymbol{t}_{\boldsymbol{X}})\).
Definition 12 (A \(B\)-probabilistic model for an \(\omega\)-DDR). Consider an \(\omega\)-DDR of the form 60 , and let \(D\) be an input database instance over schema \(\Sigma_{\text{\sf in}}\), and \(B \in \mathbb{R}_+\) be a constant. Given a join target \(P_\ell(\boldsymbol{U}_\ell)\), a probabilistic interpretation of this target is a sub-probability measure \(p_{\boldsymbol{U}_\ell}\) over \(\textsf{Dom}^{\boldsymbol{U}_\ell}\). The \(B\)-support of \(p_{\boldsymbol{U}_\ell}\) is the set of tuples \(\boldsymbol{t} \in \textsf{Dom}^{\boldsymbol{U}_\ell}\) that satisfy: \[\begin{align} p_{\boldsymbol{U}_\ell}(\boldsymbol{t}) \geq \frac{1}{B} \end{align}\] Given an MM target \((\{S_j(\boldsymbol{X}_j \boldsymbol{G}_j), T_j(\boldsymbol{Y}_j \boldsymbol{G}_j)\}, W_j(\boldsymbol{Z}_j\boldsymbol{G}_j))\), a probabilistic interpretation of this target is a pair \(((p_{\boldsymbol{G}_j}, p_{\boldsymbol{X}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}), (\alpha_j, \beta_j, \zeta_j))\) where \(p_{\boldsymbol{G}_j}, p_{\boldsymbol{X}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}\) are sub-probability measures, and \((\alpha_j, \beta_j, \zeta_j)\) is an \(\omega\)-dominant triple. The \(B\)-support of this probabilistic interpretation is the set of tuples \(\boldsymbol{t} \in \textsf{Dom}^{\boldsymbol{X}_j\boldsymbol{Y}_j\boldsymbol{Z}_j\boldsymbol{G}_j}\) that satisfy: \[\begin{align} p_{\boldsymbol{G}_j}(\boldsymbol{t}) \cdot \left(p_{\boldsymbol{X}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\alpha_j} \cdot \left(p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\beta_j} \cdot \left(p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\zeta_j} \geq \frac{1}{B} \label{eq:omega-ddr:mm-target-support} \end{align}\tag{61}\] A \(B\)-probabilistic model for an \(\omega\)-DDR over the input database \(D\) is a collection of probabilistic interpretations, one for each target of the \(\omega\)-DDR, that satisfy the following:
In other words, a \(B\)-probabilistic model for an \(\omega\)-DDR is valid iff every tuple \(\boldsymbol{t}\in\mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma\) is covered13 by the \(B\)-support of the probabilistic interpretation of some target of the \(\omega\)-DDR.
Proposition 14. Every \(B\)-probabilistic model for an \(\omega\)-DDR is also a \(B'\)-probabilistic model for the same \(\omega\)-DDR for every \(B' > B\).
In order to evaluate a BCQ \(Q\) in \(\omega\)-submodular width time, we will describe in Section 7.7 a reduction from evaluating \(Q\) to evaluating a collection of \(\omega\)-DDRs. After we evaluate these \(\omega\)-DDRs, we will need to perform some fast matrix multiplication operations on the outputs (models) of these \(\omega\)-DDRs. We describe below how to do that efficiently. The extra \(\log^2\) factor in our main theorem, Theorem [thm:panda:osubw], is inherited from the following lemma.
Lemma 2 (Performing fast matrix multiplication over \(B\)-probabilistic models of \(\omega\)-DDRs in time \(O(B\cdot \log^2 N)\)). Let \(\boldsymbol{X}, \boldsymbol{Y}, \boldsymbol{Z}, \boldsymbol{G}\) be disjoint sets of variables. Suppose we have three MM targets (which could belong to different \(\omega\)-DDRs): \[\begin{align} &(\{S_1(\boldsymbol{X}\boldsymbol{G}), T_1(\boldsymbol{Y}\boldsymbol{G})\}, W_1(\boldsymbol{Z}\boldsymbol{G})),\nonumber\\ &(\{S_2(\boldsymbol{X}\boldsymbol{G}), T_2(\boldsymbol{Z}\boldsymbol{G})\}, W_2(\boldsymbol{Y}\boldsymbol{G})),\nonumber\\ &(\{S_3(\boldsymbol{Y}\boldsymbol{G}), T_3(\boldsymbol{Z}\boldsymbol{G})\}, W_3(\boldsymbol{X}\boldsymbol{G})). \end{align}\] Suppose that each of the above targets has a probabilistic interpretation. Let \(B \in \mathbb{R}_+\) be a constant, and \(E \subseteq \textsf{Dom}^{\boldsymbol{X}\boldsymbol{Y}\boldsymbol{Z}\boldsymbol{G}}\) be the intersection of the \(B\)-supports of the probabilistic interpretations of the three targets. Then, there exists a superset \(\overline{E} \supseteq E\) such that for any two relations \(M_1(\boldsymbol{G}\boldsymbol{Y}\boldsymbol{X})\) and \(M_2(\boldsymbol{G}\boldsymbol{X}\boldsymbol{Z})\), the following query can be evaluated in time \(O(B\cdot \log^2 N)\): \[\begin{align} Q(\boldsymbol{G}\boldsymbol{Y}\boldsymbol{Z}) \quad\text{ :- }\quad \overline{E}(\boldsymbol{G}\boldsymbol{X}\boldsymbol{Y}\boldsymbol{Z}) \wedge M_1(\boldsymbol{G}\boldsymbol{Y}\boldsymbol{X}) \wedge M_2(\boldsymbol{G}\boldsymbol{X}\boldsymbol{Z}) \label{eq:omega-join-matrix-mult:q} \end{align}\tag{62}\] Moreover, the relations \(M_1\) and \(M_2\) don’t need to be materialized explicitly. Instead, it suffices to have lookup oracles for \(M_1\) and \(M_2\) that can answer membership queries in time \(O(1)\).
Proof. The three targets have three probabilistic interpretations, respectively: \[\begin{align} &((p_{\boldsymbol{G}}^{(1)}, p_{\boldsymbol{X}|\boldsymbol{G}}^{(1)}, p_{\boldsymbol{Y}|\boldsymbol{G}}^{(1)}, p_{\boldsymbol{Z}|\boldsymbol{G}}^{(1)}), (\alpha_1, \beta_1, \zeta_1)),\\ &((p_{\boldsymbol{G}}^{(2)}, p_{\boldsymbol{X}|\boldsymbol{G}}^{(2)}, p_{\boldsymbol{Z}|\boldsymbol{G}}^{(2)}, p_{\boldsymbol{Y}|\boldsymbol{G}}^{(2)}), (\alpha_2, \beta_2, \zeta_2)),\\ &((p_{\boldsymbol{G}}^{(3)}, p_{\boldsymbol{Y}|\boldsymbol{G}}^{(3)}, p_{\boldsymbol{Z}|\boldsymbol{G}}^{(3)}, p_{\boldsymbol{X}|\boldsymbol{G}}^{(3)}), (\alpha_3, \beta_3, \zeta_3)). \end{align}\] Let \(\boldsymbol{W} \stackrel{\mathrm{def}}{=}\boldsymbol{X} \boldsymbol{Y} \boldsymbol{Z} \boldsymbol{G}\). The set \(E\) is the set of tuples \(\boldsymbol{w} \in \textsf{Dom}^{\boldsymbol{W}}\) that satisfy the following: \[\begin{align} p_{\boldsymbol{G}}^{(1)}(\boldsymbol{w}) \cdot \left(p_{\boldsymbol{X}|\boldsymbol{G}}^{(1)}(\boldsymbol{w})\right)^{\alpha_1} \cdot \left(p_{\boldsymbol{Y}|\boldsymbol{G}}^{(1)}(\boldsymbol{w})\right)^{\beta_1} \cdot \left(p_{\boldsymbol{Z}|\boldsymbol{G}}^{(1)}(\boldsymbol{w})\right)^{\zeta_1} &\geq \frac{1}{B}\\ p_{\boldsymbol{G}}^{(2)}(\boldsymbol{w}) \cdot \left(p_{\boldsymbol{X}|\boldsymbol{G}}^{(2)}(\boldsymbol{w})\right)^{\alpha_2} \cdot \left(p_{\boldsymbol{Z}|\boldsymbol{G}}^{(2)}(\boldsymbol{w})\right)^{\beta_2} \cdot \left(p_{\boldsymbol{Y}|\boldsymbol{G}}^{(2)}(\boldsymbol{w})\right)^{\zeta_2} &\geq \frac{1}{B}\\ p_{\boldsymbol{G}}^{(3)}(\boldsymbol{w}) \cdot \left(p_{\boldsymbol{Y}|\boldsymbol{G}}^{(3)}(\boldsymbol{w})\right)^{\alpha_3} \cdot \left(p_{\boldsymbol{Z}|\boldsymbol{G}}^{(3)}(\boldsymbol{w})\right)^{\beta_3} \cdot \left(p_{\boldsymbol{X}|\boldsymbol{G}}^{(3)}(\boldsymbol{w})\right)^{\zeta_3} &\geq \frac{1}{B} \end{align}\] We define a sub-probability measure \(p_{\boldsymbol{G}}\) as the mean of the three sub-probability measures \(p_{\boldsymbol{G}}^{(1)}\), \(p_{\boldsymbol{G}}^{(2)}\), and \(p_{\boldsymbol{G}}^{(3)}\). Note that \(p_{\boldsymbol{G}} \geq \frac{1}{3} p_{\boldsymbol{G}}^{(i)}\) for every \(i \in [3]\). Similarly, we define \(p_{\boldsymbol{X}|\boldsymbol{G}}\), \(p_{\boldsymbol{Y}|\boldsymbol{G}}\), and \(p_{\boldsymbol{Z}|\boldsymbol{G}}\) as the mean of the corresponding sub-probability measures from the three probabilistic interpretations. Let \(E'\) be the set of tuples \(\boldsymbol{w} \in \textsf{Dom}^{\boldsymbol{W}}\) that satisfy the following: \[\begin{align} p_{\boldsymbol{G}}(\boldsymbol{w}) \cdot \left(p_{\boldsymbol{X}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\alpha_1} \cdot \left(p_{\boldsymbol{Y}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\beta_1} \cdot \left(p_{\boldsymbol{Z}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\zeta_1} &\geq \frac{1}{81B} \tag{63}\\ p_{\boldsymbol{G}}(\boldsymbol{w}) \cdot \left(p_{\boldsymbol{X}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\alpha_2} \cdot \left(p_{\boldsymbol{Z}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\beta_2} \cdot \left(p_{\boldsymbol{Y}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\zeta_2} &\geq \frac{1}{81B} \tag{64}\\ p_{\boldsymbol{G}}(\boldsymbol{w}) \cdot \left(p_{\boldsymbol{Y}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\alpha_3} \cdot \left(p_{\boldsymbol{Z}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\beta_3} \cdot \left(p_{\boldsymbol{X}|\boldsymbol{G}}(\boldsymbol{w})\right)^{\zeta_3} &\geq \frac{1}{81B} \tag{65} \end{align}\] Note that \(E'\) is a super set of \(E\). Later on, we will construct \(\overline{E}\) to be a super set of \(E'\).
Fix a tuple \(\boldsymbol{g} \in \textsf{Dom}^{\boldsymbol{G}}\). We will show that \(\sigma_{\boldsymbol{G} = \boldsymbol{g}}Q\) can be computed in time \(O(p_{\boldsymbol{G}}(\boldsymbol{g})\cdot B\cdot \log^2 N)\). This in turn implies that the total time for computing \(Q\) is \(O(B\cdot \log^2 N)\), since \(p_{\boldsymbol{G}}\) is a sub-probability measure.
To that end, we partition \(p_{\boldsymbol{X}|\boldsymbol{G}=\boldsymbol{g}}\) into \(O(\log B) = O(\log N)\) buckets where bucket \(i\) contains all values \(\boldsymbol{x} \in \textsf{Dom}^{\boldsymbol{X}}\) that satisfy: \[\frac{1}{2^{i+1}} \quad<\quad p_{\boldsymbol{X}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{x}) \quad\leq\quad \frac{1}{2^i}\] Similarly, we partition \(p_{\boldsymbol{Y}|\boldsymbol{G}=\boldsymbol{g}}\) into \(O(\log N)\) buckets where bucket \(j\) contains all values \(\boldsymbol{y} \in \textsf{Dom}^{\boldsymbol{Y}}\) that satisfy: \[\frac{1}{2^{j+1}} \quad<\quad p_{\boldsymbol{Y}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{y}) \quad\leq\quad \frac{1}{2^j}\] There are \(O(\log^2 N)\) pairs of buckets \((i, j)\). Fix one pair \((i, j)\) (in addition to the fixed \(\boldsymbol{g}\) at the beginning). Let \(E_{\boldsymbol{g}}^{ij}\) be the subset of \(E'\) containing all tuples \(\boldsymbol{w}\in\textsf{Dom}^{\boldsymbol{W}}\) that satisfy Eq 63 –65 and \[\begin{align} \boldsymbol{w}_{\boldsymbol{G}} = \boldsymbol{g}, \quad\quad \frac{1}{2^{i+1}} < p_{\boldsymbol{X}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{w}) \leq \frac{1}{2^i}, \quad\quad \frac{1}{2^{j+1}} < p_{\boldsymbol{Y}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{w}) \leq \frac{1}{2^j} \end{align}\] Let \(m\) and \(n\) be the total number of \(\boldsymbol{x}\) and \(\boldsymbol{y}\) values in the selected buckets \(i\) and \(j\) respectively. Note that \(m \leq 2^{i+1}\) and \(n \leq 2^{j+1}\). Let \(\overline{p}\) be the smallest value of \(p_{\boldsymbol{Z}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{z})\) over all \(\boldsymbol{z} \in \textsf{Dom}^{\boldsymbol{Z}}\) that satisfies: \[\begin{align} p_{\boldsymbol{G}}(\boldsymbol{g}) \cdot \left(\frac{1}{2^{i}}\right)^{\alpha_1} \cdot \left(\frac{1}{2^{j}}\right)^{\beta_1} \cdot \left(\overline{p}\right)^{\zeta_1} &\quad\geq\quad \frac{1}{81B}\tag{66}\\ p_{\boldsymbol{G}}(\boldsymbol{g}) \cdot \left(\frac{1}{2^{i}}\right)^{\alpha_2} \cdot \left(\frac{1}{2^{j}}\right)^{\zeta_2} \cdot \left(\overline{p}\right)^{\beta_2} &\quad\geq\quad \frac{1}{81B}\tag{67}\\ p_{\boldsymbol{G}}(\boldsymbol{g}) \cdot \left(\frac{1}{2^{i}}\right)^{\zeta_3} \cdot \left(\frac{1}{2^{j}}\right)^{\alpha_3} \cdot \left(\overline{p}\right)^{\beta_3} &\quad\geq\quad \frac{1}{81B}\tag{68} \end{align}\] Let \(\overline{E}_{\boldsymbol{g}}^{ij}\) be the set of all tuples \(\boldsymbol{w} \in \textsf{Dom}^{\boldsymbol{W}}\) that satisfy the following: \[\begin{align} \boldsymbol{w}_{\boldsymbol{G}} = \boldsymbol{g}, \quad\quad \frac{1}{2^{i+1}} < p_{\boldsymbol{X}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{w}) \leq \frac{1}{2^i}, \quad\quad \frac{1}{2^{j+1}} < p_{\boldsymbol{Y}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{w}) \leq \frac{1}{2^j}, \quad\quad p_{\boldsymbol{Z}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{w}) \geq \overline{p} \end{align}\] Note that \(\overline{E}_{\boldsymbol{g}}^{ij} \supseteq E_{\boldsymbol{g}}^{ij}\). Let \(o\) be the number of different \(\boldsymbol{z}\) values where \(p_{\boldsymbol{Z}|\boldsymbol{G}=\boldsymbol{g}}(\boldsymbol{z}) \geq \overline{p}\). Note that \(o \leq 1/\overline{p}\). From inequalities 66 –68 along with \(m \leq 2^{i+1}\) and \(n \leq 2^{j+1}\), there exists a constant \(C\) that satisfies:14 \[\begin{align} m^{\alpha_1} \cdot n^{\beta_1} \cdot o^{\zeta_1} &\quad\leq\quad C\cdot B\cdot p_{\boldsymbol{G}}(\boldsymbol{g})\\ m^{\alpha_2} \cdot n^{\zeta_2} \cdot o^{\beta_2} &\quad\leq\quad C\cdot B\cdot p_{\boldsymbol{G}}(\boldsymbol{g})\\ m^{\zeta_3} \cdot n^{\alpha_3} \cdot o^{\beta_3} &\quad\leq\quad C\cdot B\cdot p_{\boldsymbol{G}}(\boldsymbol{g}) \end{align}\] Let \(Q_{\boldsymbol{g}}^{ij}\) be the same as \(Q\) in Eq. 62 but where \(\overline{E}\) is replaced by \(\overline{E}_{\boldsymbol{g}}^{ij}\). In order to answer \(Q_{\boldsymbol{g}}^{ij}\), we can perform a matrix multiplication between \(M_1\) and \(M_2\) after filtering them by \(\overline{E}_{\boldsymbol{g}}^{ij}\). The filtered matrices have dimensions \((n\times m)\) and \((m\times o)\) respectively. The first matrix can be populated in time \(O(n\cdot m)\) by iterating over all pairs of \((\boldsymbol{y}, \boldsymbol{x})\) values, and then using the membership oracle for \(M_1\). The same holds for the second matrix, which can be populated in time \(O(m\cdot o)\). The multiplication of matrices of dimensions \((n\times m)\) and \((m\times o)\) takes the following time, which also upper bounds the sizes of both matrices, i.e., it also upper bounds \(n\cdot m\) and \(m\cdot o\): \[\begin{gather} \max(m\cdot n \cdot o^{\gamma},\quad m\cdot n^{\gamma} \cdot o,\quad m^{\gamma}\cdot n \cdot o) \leq \\ \max(m^{\alpha_1} \cdot n^{\beta_1} \cdot o^{\zeta_1},\quad m^{\alpha_2} \cdot n^{\zeta_2} \cdot o^{\beta_2},\quad m^{\zeta_3} \cdot n^{\alpha_3} \cdot o^{\beta_3}) \leq C\cdot B\cdot p_{\boldsymbol{G}}(\boldsymbol{g}) \end{gather}\] The first inequality above is proved similarly to the proof of Proposition 10. This proves that \(Q_{\boldsymbol{g}}^{ij}\) can be evaluated in time \(O(B\cdot p_{\boldsymbol{G}}(\boldsymbol{g}))\). Since the total number of pairs of buckets \((i, j)\) is \(O(\log^2 N)\), we conclude that \(\sigma_{\boldsymbol{G} = \boldsymbol{g}}Q\) can be computed in time \(O(B\cdot p_{\boldsymbol{G}}(\boldsymbol{g})\cdot \log^2 N)\) as claimed. ◻
In the previous section, we introduced a generalization of DDRs, called \(\omega\)-DDRs. We now present an algorithm for evaluating these \(\omega\)-DDRs. This algorithm will be used as a building block for our final algorithm for evaluating a BCQ \(Q\) in \(\omega\)-submodular width time in Section 7.7.
Theorem 15 (Evaluating an \(\omega\)-DDR). Suppose we are given the following:
An \(\omega\)-DDR of the form 60 with input schema \(\Sigma_{\text{\sf in}}\) and output schema \(\Sigma_{\text{\sf out}}\).
An input database instance \(D\) over schema \(\Sigma_{\text{\sf in}}\) of size \(N\).
An integral \(\omega\)-Shannon-flow inequality of the form 45 that satisfies \(\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1 > 0\).
Define the quantity: \[\begin{align} B \stackrel{\mathrm{def}}{=}\left(\prod_{i \in [I]} \deg_{\Sigma_\text{\sf in}}(\boldsymbol{Y}_i|\boldsymbol{X}_i)^{w_i}\right)^{\frac{1}{\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1}} \label{eq:omega-DDR:B} \end{align}\tag{69}\] Then, \(\omega\)-PANDAExpress(Algorithm 4) computes a \(B\)-probabilistic model to the \(\omega\)-DDR (Definition 12) in time \(O(B\cdot \log N)\).
\[\small \begin{array}{|l|l|} \hline \rowcolor{lightgray}\text{\bf $\omega$-Shannon-flow Inequality and Steps} & \text{\bf Probabilistic Inequality and Steps}\\\hline \rowcolor{lightergray} \begin{aligned}[t] &\omega h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \\ &\leq{\color{blue}2h(XY) + (\omega-1) h(YZ) + (\omega-1)h(XZ)}\\ & {\color{blue}\leq 2\omega} \end{aligned}& \begin{aligned}[t] {\color{red}p_{XY}(xy)^2\cdot p_{YZ}(yz)^{\omega-1} \cdot p_{XZ}(xz)^{\omega-1} \geq \frac{1}{N^{2\omega}}} = \frac{1}{B^{\omega+1}}\\ p_{XY}(xy) \defeq \frac{1}{N},\quad p_{YZ}(yz) \defeq \frac{1}{N},\quad p_{XZ}(xz) \defeq \frac{1}{N} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}h(XY) \to h(X) + h(Y|X) \end{aligned}& \begin{aligned}[t] &{\color{red} p_{XY}(xy) \to p_X(x) \cdot p_{Y|X}(y|x)}\\ &p_X(x) \defeq \sum_{y} p_{XY}(xy) = \frac{\deg_R(Y|X=x)}{N}\\ &p_{Y|X}(y|x) \defeq \frac{p_{XY}(xy)}{p_X(x)} = \frac{1}{\deg_R(Y|X=x)} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}h(Y|X) \to h(Y|XZ) \end{aligned}& \begin{aligned}[t] &{\color{red} p_{Y|X}(y|x) \to p_{Y|XZ}(y|xz)}\\ &p_{Y|XZ}(y|xz) \defeq p_{Y|X}(y|x) = \frac{1}{\deg_R(Y|X=x)} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}h(XZ) + h(Y|XZ) \to h(XYZ) \end{aligned}& \begin{aligned}[t] &{\color{red} p_{XZ}(xz) \cdot p_{Y|XZ}(y|xz) \to p'_{XYZ}(xyz)}\\ &p'_{XYZ}(xyz) \defeq p_{XZ}(xz) \cdot p_{Y|XZ}(y|xz) = \frac{1}{N\cdot\deg_R(Y|X=x)} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}h(YZ) \to h(Y) + h(Z|Y) \end{aligned}& \begin{aligned}[t] &{\color{red} p_{YZ}(yz) \to p_Y(y) \cdot p_{Z|Y}(z|y)}\\ &p_Y(y) \defeq \sum_{z} p_{YZ}(yz) = \frac{\deg_S(Z|Y=y)}{N}\\ &p_{Z|Y}(z|y) \defeq \frac{p_{YZ}(yz)}{p_Y(y)} = \frac{1}{\deg_S(Z|Y=y)} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}h(Z|Y) \to h(Z|XY) \end{aligned}& \begin{aligned}[t] &{\color{red} p_{Z|Y}(z|y) \to p_{Z|XY}(z|xy)}\\ &p_{Z|XY}(z|xy) \defeq p_{Z|Y}(z|y) = \frac{1}{\deg_S(Z|Y=y)} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}h(XY) + h(Z|XY) \to h(XYZ) \end{aligned}& \begin{aligned}[t] &{\color{red} p_{XY}(xy) \cdot p_{Z|XY}(z|xy) \to p''_{XYZ}(xyz)}\\ &p''_{XYZ}(xyz) \defeq p_{XY}(xy) \cdot p_{Z|XY}(z|xy) = \frac{1}{N\cdot\deg_S(Z|Y=y)} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}\gamma h(XZ) \to \gamma h(Z) + \gamma h(X|Z) \end{aligned}& \begin{aligned}[t] &{\color{red}p_{XZ}(xz)^\gamma \to p_Z(z)^\gamma \cdot p_{X|Z}(x|z)^\gamma}\\ &p_Z(z) \defeq \sum_{x} p_{XZ}(xz) = \frac{\deg_T(X|Z=z)}{N}\\ &p_{X|Z}(x|z) \defeq \frac{p_{XZ}(xz)}{p_Z(z)} = \frac{1}{\deg_T(X|Z=z)} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}\gamma h(X|Z) \to \gamma h(X|YZ) \end{aligned}& \begin{aligned}[t] &{\color{red}p_{X|Z}(x|z)^\gamma \to p_{X|YZ}(x|yz)^\gamma}\\ &p_{X|YZ}(x|yz) \defeq p_{X|Z}(x|z) = \frac{1}{\deg_T(X|Z=z)} \end{aligned}\\\hline \begin{aligned}[t] &\color{blue}\gamma h(YZ) + \gamma h(X|YZ) \to \gamma h(XYZ) \end{aligned}& \begin{aligned}[t] &{\color{red}p_{YZ}(yz)^\gamma \cdot p_{X|YZ}(x|yz)^\gamma \to p'''_{XYZ}(xyz)^\gamma}\\ &p'''_{XYZ}(xyz) \defeq p_{YZ}(yz) \cdot p_{X|YZ}(x|yz) = \frac{1}{N\cdot\deg_T(X|Z=z)} \end{aligned}\\\hline \rowcolor{lightergray} \begin{aligned}[t] &\omega h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z) \\ &\leq{\color{blue}h(XYZ) + h(X) + h(Y) + (\omega-2)h(Z)} \\ & {\color{blue}\leq 2\omega} \end{aligned}& \begin{aligned}[t] &\color{red}p'_{XYZ}(xyz) \cdot p''_{XYZ}(xyz) \cdot p'''_{XYZ}(xyz)^{\omega-2}\cdot p_X(x) \cdot p_Y(y) \cdot p_Z(z)^{\omega-2} \\ & {\color{red}\geq \frac{1}{N^{2\omega}}} = \frac{1}{B^{\omega+1}} \end{aligned}\\\hline \end{array}\]
Before describing the general \(\textsf{\omega-PANDAExpress}\) algorithm and proving the associated Theorem 15, we start in this section with an example that illustrates the main ideas behind the algorithm and its analysis. Consider the following \(\omega\)-DDR, whose body is the same as \(Q_\triangle\) from Eq. 2 , and whose head consists of one join target and one MM target: \[\begin{align} P_1(X, Y, Z) \vee (S_1(X) \wedge T_1(Y) \wedge W_1(Z)) \quad\text{ :- }\quad R(X, Y) \wedge S(Y, Z) \wedge T(X, Z) \label{eq:pandaexpress:ddr} \end{align}\tag{70}\] Suppose that \(|R| = |S| = |T| = N\). Consider the \(\omega\)-Shannon-flow inequality 13 (or equivalently 46 ). The quantity \(B\) from Eq. 69 becomes: \[\begin{align} B \stackrel{\mathrm{def}}{=}N^{\frac{2\omega}{\omega+1}} \end{align}\] Note that \(\frac{2\omega}{\omega+1}\) is the optimal objective value of the LP 12 , which gave us the \(\omega\)-Shannon-flow inequality 13 in the first place. This is not a coincidence, as we will see later (Lemma 3). We explain here how we can utilize the \(\omega\)-Shannon-flow inequality 13 in order to compute a \(B\)-probabilistic model to the \(\omega\)-DDR 70 in time \(O(B)\). (The extra \(\log N\) is not needed in this example.)
The RHS of inequality 13 is as follows: \[\begin{align} 2h(XY) + (\omega-1) h(YZ) + (\omega-1)h(XZ) \quad\leq\quad 2\omega \label{eq:opnadaexpress:shannon:ineq} \end{align}\tag{71}\] We initialize three probability distribution \(p_{XY}(xy)\), \(p_{YZ}(yz)\), and \(p_{XZ}(xz)\) to be uniform, i.e., equal to \(1/N\) over the relations \(R\), \(S\), and \(T\), respectively. Now, we have the following probabilistic inequality, which we think of as the probabilistic interpretation of inequality 71 : \[\begin{align} p_{XY}(xy)^2\cdot p_{YZ}(yz)^{\omega-1} \cdot p_{XZ}(xz)^{\omega-1} \quad\geq\quad \frac{1}{N^{2\omega}} = \frac{1}{B^{\omega+1}} \label{eq:opnadaexpress:prob:ineq} \end{align}\tag{72}\] The proof sequence given earlier in Table ¿tbl:table:ps? transforms the RHS of the \(\omega\)-Shannon-flow inequality 13 into the LHS. Every time we apply a proof step, we mirror it in the probabilistic world by applying a corresponding transformation on inequality 72 . The process is illustrated in Table ¿tbl:table:opandaexpress?. For example, to mirror the step \(h(XY) \to h(X) + h(Y|X)\), we replace the term \(p_{XY}(xy)\) in inequality 72 with the product \(p_X(x) \cdot p_{Y|X}(y|x)\), where \(p_X(x)\) and \(p_{Y|X}(y|x)\) are the marginal and conditional measures from Eq. ?? and Eq. ?? , respectively. By Eq. ?? and ?? , this replacement preserves inequality 72 .
At the end of the above process, we would have constructed distributions \(p'_{XYZ}\), \(p''_{XYZ}\), \(p'''_{XYZ}\), \(p_X\), \(p_Y\), and \(p_Z\) that satisfy inequality 72 which now takes the following form: \[\begin{align} p'_{XYZ}(xyz) \cdot p''_{XYZ}(xyz) \cdot p'''_{XYZ}(xyz)^{\omega-2}\cdot p_X(x) \cdot p_Y(y) \cdot p_Z(z)^{\omega-2} \geq \frac{1}{N^{2\omega}} = \frac{1}{B^{\omega+1}} \label{eq:opnadaexpress:prob:ineq:final} \end{align}\tag{73}\] The \(\textsf{\omega-PANDAExpress}\) algorithm works by going through the sequence of probability distributions defined in Table ¿tbl:table:opandaexpress? and actually computing them one by one (by materializing their supports along with the associated probabilities). But there is a catch: For the distributions \(p'_{XYZ}\), \(p''_{XYZ}\), and \(p'''_{XYZ}\), we cannot afford to materialize their full supports, since their sizes could exceed \(B\). Instead, we truncate them by keeping only the tuples that have probability at least \(1/B\). This guarantees that, after truncation, each one of these distributions will have support size of at most \(B\). But what about tuples that were truncated away in the above process? This is were inequality 73 comes to the rescue. These tuples \(xyz\) that were truncated away must have \(p'_{XYZ}(xyz)\), \(p''_{XYZ}(xyz)\), \(p'''_{XYZ}(xyz) < 1/B\). Substituting this into inequality 73 , we get \[\begin{align} p_X(x)\cdot p_Y(y) \cdot p_Z(z)^{\omega-2} \quad\geq\quad \frac{B^\omega}{B^{\omega+1}} = \frac{1}{B} \end{align}\] Therefore, we can report the distributions \((p_X, p_Y, p_Z)\) along with the \(\omega\)-dominant triple \((1, 1, \gamma)\) as a probabilistic interpretation of the MM target \((\{S_1(X), T_1(Y)\}, W_1(Z))\) of the \(\omega\)-DDR 70 . By Eq. 61 , the \(B\)-support covers all tuples \(xyz\) that were truncated away. Therefore, if we return a \(B\)-probabilistic model that contains this probabilistic interpretation of the MM target, along with the (geometric mean of the) truncated distributions \(p'_{XYZ}\), \(p''_{XYZ}\), and \(p'''_{XYZ}\) as the probabilistic interpretation of the join target \(P_1(X, Y, Z)\), then this is indeed a valid \(B\)-probabilistic model of the \(\omega\)-DDR 70 (Definition 12).
Earlier in Section 2.5, we have seen a simpler algorithm, depicted in Figure 1, where there was no mentioning of probability distributions. Instead, we just performed a join, say \(T(X,Z) \Join R_\ell(X, Y)\), over all \(X\)-values that are light, i.e., have degree \(\leq \Delta \stackrel{\mathrm{def}}{=}N^{\frac{\omega-1}{\omega+1}}\). But how are the two algorithms related? The answer is that they are one and the same! In particular, in the above \(\textsf{\omega-PANDAExpress}\) algorithm, the truncation condition \(p'_{XYZ}(xyz) \geq 1/B\) corresponds to: \[\begin{align} \frac{1}{N\cdot\deg_R(Y|X=x)} \geq \frac{1}{B} = \frac{1}{N^{\frac{2\omega}{\omega+1}}} \end{align}\] which is equivalent to \(\deg_R(Y|X=x) \leq N^{\frac{\omega-1}{\omega+1}} = \Delta\). In general, the \(\textsf{\omega-PANDAExpress}\) algorithm is a generic way to come up with the right partitioning strategies based on degrees, in order to achieve the desired runtime bounds.
Now that we have seen an example of the \(\textsf{\omega-PANDAExpress}\) algorithm for a specific \(\omega\)-DDR, we are ready to describe the general algorithm for any \(\omega\)-DDR. The \(\omega\)-PANDAExpress algorithm generalizes the \(\textsf{PANDAExpress}\) algorithm from [5], and it is given in Algorithm 4. We describe it here in detail. It is a recursive algorithm that takes two input arguments:
An integral \(\omega\)-Shannon-flow inequality \(\mathcal{I}\) of the form 45 .
A collection, \(\mathcal{P}\), of sub-probability measures: one measure \(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}\) for each term \(w_i h(\boldsymbol{Y}_i|\boldsymbol{X}_i)\) on the RHS of inequality \(\mathcal{I}\).
For the outer-most call to \(\textsf{\omega-PANDAExpress}\), the inequality \(\mathcal{I}\) is set to be the integral \(\omega\)-Shannon-flow inequality from the statement of Theorem 15. Also, for this outer-most call, the collection \(\mathcal{P}\) is initialized from the input database instance \(D\) with schema \(\Sigma_\text{\sf in}\) from Theorem 15 as follows: For each term \(w_i h(\boldsymbol{Y}_i|\boldsymbol{X}_i)\) on the RHS of inequality 45 , let \(R_i\in\Sigma_\text{\sf in}\) be a relation that minimizes the degree \(\deg_{R_i}(\boldsymbol{Y}_i|\boldsymbol{X}_i)\), i.e., where \(\deg_{R_i}(\boldsymbol{Y}_i|\boldsymbol{X}_i) = \deg_{\Sigma_\text{\sf in}}(\boldsymbol{Y}_i|\boldsymbol{X}_i)\). Then, the associated sub-probability measure \(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i} \in \mathcal{P}\) is initialized as follows: (Recall the notation \({R}_{|\boldsymbol{X}\cup\boldsymbol{Y}}\) from Section 3.7.) \[\begin{align} p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}(\boldsymbol{y}_i | \boldsymbol{x}_i) \stackrel{\mathrm{def}}{=} \begin{cases} \frac{1}{\deg_{R_i}(\boldsymbol{Y}_i|\boldsymbol{X}_i=\boldsymbol{x}_i)} & \text{if }(\boldsymbol{x}_i, \boldsymbol{y}_i) \in {R_i}_{|\boldsymbol{X}_i\cup\boldsymbol{Y}_i} \\ 0 & \text{otherwise} \end{cases} \label{eq:initial:measure} \end{align}\tag{74}\]
Remark 16 (Distinction from [5] regarding how \(\mathcal{P}\) is defined). The original \(\textsf{PANDAExpress}\) algorithm from [5] assumes that each term \(w_i h(\boldsymbol{Y}_i|\boldsymbol{X}_i)\) on the RHS of the Shannon inequality 45 (where \(w_i\) is a natural number) has \(w_i\) distinct sub-probability measures \(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}^{(1)}, \ldots, p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}^{(w_i)}\), one for each unit of \(w_i\). In contrast, in our \(\omega\)-version of the algorithm, \(\textsf{\omega-PANDAExpress}\), we assume that the term \(w_i h(\boldsymbol{Y}_i|\boldsymbol{X}_i)\) has only one sub-probability measure \(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}\). This is because whenever we have more than one, we can take their geometric mean; see Proposition 3. We will show later that this is sufficient to maintain all invariants of the algorithm, most importantly inequality 77 below.
The algorithm proceed as follows:
If there is no term left on the LHS of the inequality \(\mathcal{I}\), i.e., if we end up with \(\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1 = 0\) (line [line:opanda-express:no-targets] of Algorithm 4), then we return immediately with an empty \(B\)-probabilistic model to the \(\omega\)-DDR.
If there is one term \(h(\boldsymbol{U}_\ell)\) on the LHS of \(\mathcal{I}\) that also appears on the RHS as a term \(h(\boldsymbol{Y}_i|\boldsymbol{X}_i)\) (which means \(\boldsymbol{X}_i = \emptyset\) and \(\boldsymbol{Y}_i=\boldsymbol{U}_\ell\)), then we return a \(B\)-probabilistic model containing only the corresponding sub-probability measure \(p_{\boldsymbol{U}_\ell}\). This measure \(p_{\boldsymbol{U}_\ell}\) serves as a probabilistic interpretation of the join target \(P_\ell(\boldsymbol{U}_\ell)\) of the \(\omega\)-DDR 60 .
If there is a sum \(\alpha_j h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \beta_j h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \zeta_j h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \kappa_j h(\boldsymbol{G}_j)\) on the LHS of \(\mathcal{I}\) that appears in full on the RHS, then we construct a \(B\)-probabilistic model \(\Sigma_\text{\sf out}^l\) containing only the tuple \(((p_{\boldsymbol{G}_j}, p_{\boldsymbol{X}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}), (\alpha_j/\kappa_j, \beta_j/\kappa_j, \zeta_j/\kappa_j))\). This tuple serves as a probabilistic interpretation of the MM target \((\{S_j(\boldsymbol{X}_j \boldsymbol{G}_j), T_j(\boldsymbol{Y}_j \boldsymbol{G}_j)\}, W_j(\boldsymbol{Z}_j\boldsymbol{G}_j))\) of the \(\omega\)-DDR 60 . We do not immediately return \(\Sigma_\text{\sf out}^l\) in this case. Instead, we also drop \(\alpha_j h(\boldsymbol{X}_j|\boldsymbol{G}_j) + \beta_j h(\boldsymbol{Y}_j|\boldsymbol{G}_j) + \zeta_j h(\boldsymbol{Z}_j|\boldsymbol{G}_j) + \kappa_j h(\boldsymbol{G}_j)\) from both sides of \(\mathcal{I}\), and recursively call the algorithm on the resulting \(\mathcal{I}\) to compute another \(B\)-probabilistic model \(\Sigma_\text{\sf out}^h\). We return the union of the two models.
Otherwise, we proceed very similarly to the original \(\textsf{PANDAExpress}\) algorithm from [5]. In particular, by Theorem 13, \(\mathcal{I}\) must have a proof sequence. Let \(s\) be the first step in the sequence. We use a sub-routine called \(\textsf{apply-step}\) from [5] (reviewed below) to apply the proof step \(s\) to update the RHS of the inequality \(\mathcal{I}\) and also mirror these changes into \(\mathcal{P}\). (Recall that each term on the RHS of \(\mathcal{I}\) is associated with a sub-probability measure in \(\mathcal{P}\), hence when we update the first, we have to update the second.) Let \(\mathcal{I}^l\) and \(\mathcal{P}^l\) be the new \(\mathcal{I}\) and \(\mathcal{P}\) after \(\textsf{apply-step}\), respectively. We call the algorithm recursively on \(\mathcal{I}^l\) and \(\mathcal{P}^l\) to compute a \(B\)-probabilistic model \(\Sigma_\text{\sf out}^l\). Now we recognize two cases:
If the proof step \(s\) is not a composition step, then we return \(\Sigma_\text{\sf out}^l\).
Otherwise, i.e., if \(s\) has the form \(h(\boldsymbol{X}) + h(\boldsymbol{Y}|\boldsymbol{X})\to h(\boldsymbol{X}\boldsymbol{Y})\), then applying this step to the RHS of \(\mathcal{I}\) must have resulted in an inequality \(\mathcal{I}^l\) whose RHS contains \(h(\boldsymbol{X}\boldsymbol{Y})\). We use the reset lemma (Lemma 1) to drop this term \(h(\boldsymbol{X}\boldsymbol{Y})\) from the RHS of \(\mathcal{I}^l\) and also drop the corresponding sub-probability measure from \(\mathcal{P}^l\), resulting in \(\mathcal{I}^h\) and \(\mathcal{P}^h\) respectively. Now, we recursively call the algorithm on \(\mathcal{I}^h\) and \(\mathcal{P}^h\) to compute another \(B\)-probabilistic model \(\Sigma_\text{\sf out}^h\), and we return the union of \(\Sigma_\text{\sf out}^h\) and the previously computed \(\Sigma_\text{\sf out}^l\).
For sake of completeness, we describe here the \(\textsf{apply-step}\) sub-routine, which goes back to the original \(\textsf{PANDAExpress}\) algorithm [5]:
If \(s\) is a decomposition step \(h(\boldsymbol{X} \boldsymbol{Y}) \to h(\boldsymbol{X}) + h(\boldsymbol{Y} | \boldsymbol{X})\), then let \(p_{\boldsymbol{X}}\) be the marginal measure ?? of \(p_{\boldsymbol{X} \boldsymbol{Y}}\) on \(\boldsymbol{X}\) and \(p_{\boldsymbol{Y} | \boldsymbol{X}}\) be the conditional measure ?? of \(p_{\boldsymbol{X} \boldsymbol{Y}}\) on \(\boldsymbol{Y}\) given \(\boldsymbol{X}\). The new inequality \(\mathcal{I}^\ell\) results from \(\mathcal{I}\) by replacing the term \(h(\boldsymbol{X} \boldsymbol{Y})\) on the RHS of \(\mathcal{I}\) with the two terms \(h(\boldsymbol{X})\) and \(h(\boldsymbol{Y} | \boldsymbol{X})\). The new set of sub-probability measures \(\mathcal{P}^\ell\) results from \(\mathcal{P}\) by replacing \(p_{\boldsymbol{X}\boldsymbol{Y}}\) with the two measures \(p_{\boldsymbol{X}}\) and \(p_{\boldsymbol{Y} | \boldsymbol{X}}\).
If \(s\) is a submodularity step \(h(\boldsymbol{Y} | \boldsymbol{X}) \to h(\boldsymbol{Y} | \boldsymbol{X} \boldsymbol{Z})\), then define \(p_{\boldsymbol{Y} | \boldsymbol{X} \boldsymbol{Z}} \stackrel{\mathrm{def}}{=}p_{\boldsymbol{Y} | \boldsymbol{X}}\). The new \(\mathcal{I}^\ell\) results from \(\mathcal{I}\) by replacing \(h(\boldsymbol{Y} | \boldsymbol{X})\) with \(h(\boldsymbol{Y} | \boldsymbol{X} \boldsymbol{Z})\) on the RHS, whereas the new \(\mathcal{P}^\ell\) results from \(\mathcal{P}\) by replacing \(p_{\boldsymbol{Y} | \boldsymbol{X}}\) with \(p_{\boldsymbol{Y} | \boldsymbol{X} \boldsymbol{Z}}\).
If \(s\) is a monotonicity step \(h(\boldsymbol{X} \boldsymbol{Y}) \to h(\boldsymbol{X})\), then define \(p_{\boldsymbol{X}}\) as the marginal measure ?? of \(p_{\boldsymbol{X} \boldsymbol{Y}}\) on \(\boldsymbol{X}\). The new \(\mathcal{I}^\ell\) results from \(\mathcal{I}\) by replacing \(h(\boldsymbol{X} \boldsymbol{Y})\) with \(h(\boldsymbol{X})\) on the RHS, whereas the new \(\mathcal{P}^\ell\) results from \(\mathcal{P}\) by replacing \(p_{\boldsymbol{X}\boldsymbol{Y}}\) with \(p_{\boldsymbol{X}}\).
If \(s\) is a composition step \(h(\boldsymbol{X}) + h(\boldsymbol{Y} | \boldsymbol{X}) \to h(\boldsymbol{X} \boldsymbol{Y})\), then let \(p_{\boldsymbol{X}\boldsymbol{Y}}\) be the truncated product measure: \[\begin{align} p_{\boldsymbol{X} \boldsymbol{Y}}(\boldsymbol{x}, \boldsymbol{y}) \stackrel{\mathrm{def}}{=} \begin{cases} p_{\boldsymbol{X}}(\boldsymbol{x}) \cdot p_{\boldsymbol{Y} | \boldsymbol{X}}(\boldsymbol{y} | \boldsymbol{x}), & \text{if } p_{\boldsymbol{X}}(\boldsymbol{x}) \cdot p_{\boldsymbol{Y} | \boldsymbol{X}}(\boldsymbol{y} | \boldsymbol{x}) \geq 1/B \\ 0, & \text{otherwise} \end{cases} \label{eqn:truncated:product} \end{align}\tag{75}\] The new \(\mathcal{I}^\ell\) results from \(\mathcal{I}\) by replacing the two terms \(h(\boldsymbol{X})\) and \(h(\boldsymbol{Y} | \boldsymbol{X})\) on the RHS of \(\mathcal{I}\) with the single term \(h(\boldsymbol{X} \boldsymbol{Y})\), whereas the new \(\mathcal{P}^\ell\) results from \(\mathcal{P}\) by replacing the two measures \(p_{\boldsymbol{X}}\) and \(p_{\boldsymbol{Y} | \boldsymbol{X}}\) with the truncated product measure \(p_{\boldsymbol{X}\boldsymbol{Y}}\).
We now prove Theorem 15 by proving both correctness and the runtime bound of \(\textsf{\omega-PANDAExpress}\).
Proof of Theorem 15. The algorithm is recursive where every recursive call is characterized by a pair \((\mathcal{I}, \mathcal{P})\). Every recursive call makes at most two recursive calls. Hence, at any point in time, the execution of the algorithm can be modeled by a binary tree, where each node is a recursive call. The algorithm satisfies the following invariants:
Every inequality \(\mathcal{I}\) is a valid integral \(\omega\)-Shannon-flow inequality of the form 45 .
Every \(p_{\boldsymbol{Y}|\boldsymbol{X}}\) in \(\mathcal{P}\) is a valid sub-probability measure.
Every unconditional measure \(p_{\boldsymbol{Y}}\) in \(\mathcal{P}\) satisfies: \(p_{\boldsymbol{Y}}(\boldsymbol{y}) > 0 \Rightarrow p_{\boldsymbol{Y}}(\boldsymbol{y}) \geq 1/B\) for all \(\boldsymbol{y} \in \textsf{Dom}^{\boldsymbol{Y}}\).
For every tuple \(\boldsymbol{t} \in\Sigma_\text{\sf in}\), there must exist:
either an internal (i.e., non-leaf) node where the \(B\)-support of \(((p_{\boldsymbol{G}_j}, p_{\boldsymbol{X}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}),\) \((\alpha_j/\kappa_j, \beta_j/\kappa_j, \zeta_j/\kappa_j))\) from line [line:opanda-express:mm-target:output] contains \(\boldsymbol{t}_{\boldsymbol{X}_j\boldsymbol{Y}_j\boldsymbol{Z}_j\boldsymbol{G}_j}\),
or a leaf node \((\mathcal{I}, \mathcal{P})\) that satisfies the following two conditions: \[\begin{align} \|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1 &\quad>\quad 0\tag{76}\\ \prod_{i \in [I]} \left(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}(\boldsymbol{t})\right)^{w_i} &\quad\geq\quad \frac{1}{B^{\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1}} \tag{77} \end{align}\]
Invariants (a) and (b) initially hold trivially. Similar to [5], we can assume that invariant (c) initially holds as well. It is straightforward to verify that the three invariants (a), (b), and (c) continue to be maintained throughout the execution of Algorithm 4. Hence, we focus on invariant (d). Initially, inequality 76 holds by the statement of Theorem 15. Moreover by definition of \(B\) from Eq. 69 and by Eq. 74 , inequality 77 also holds initially as an equality.
We now prove that invariant (d) holds inductively. Every time a recursive call makes a recursive call, a leaf node in the recursion tree becomes an internal node with one or two new children as leaves. Note that every internal node \((\mathcal{I}, \mathcal{P})\) must necessarily satisfy Inequality 76 ; otherwise, the algorithm would have already returned at line [line:opanda-express:no-targets:return]. For invariant (d) to continue to hold inductively, we need to prove the following two claims:
Claim 17 (Invariant (d) holds indutively for the recursive call in line [line:opanda-express:recursive:h:1] of Algorithm 4). Consider an arbitrary node \((\mathcal{I}, \mathcal{P})\) that makes a recursive call to node \((\mathcal{I}^h, \mathcal{P}^h)\) in line [line:opanda-express:recursive:h:1] of Algorithm 4. Then, every tuple \(\boldsymbol{t} \in \Sigma_\text{\sf in}\) that satisfies Inequalities 76 and 77 for the node \((\mathcal{I}, \mathcal{P})\) must satisfy either one of the following:
either \(\boldsymbol{t}\) must be covered by the \(B\)-support of \(((p_{\boldsymbol{G}_j}, p_{\boldsymbol{X}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}),\) \((\alpha_j/\kappa_j, \beta_j/\kappa_j, \zeta_j/\kappa_j))\) from line [line:opanda-express:mm-target:output],
or \(\boldsymbol{t}\) must satisfy Inequalities 76 and 77 for the new leaf \((\mathcal{I}^h, \mathcal{P}^h)\).
Proof of Claim 17. Consider a tuple \(\boldsymbol{t} \in \Sigma_\text{\sf in}\) that satisfies Inequalities 76 and 77 for the node \((\mathcal{I}, \mathcal{P})\), but is not covered by the \(B\)-support of \(((p_{\boldsymbol{G}_j}, p_{\boldsymbol{X}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}, p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}),\) \((\alpha_j/\kappa_j, \beta_j/\kappa_j, \zeta_j/\kappa_j))\). By definition of \(B\)-support, this means that \(\boldsymbol{t}\) must satisfy: \[\begin{align} \left(p_{\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\kappa_j} \cdot \left(p_{\boldsymbol{X}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\alpha_j} \cdot \left(p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\beta_j} \cdot \left(p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\zeta_j} \quad<\quad \frac{1}{B^{\kappa_j}} \label{eq:not-in-B-support} \end{align}\tag{78}\] We show that \(\boldsymbol{t}\) must satisfy Inequalities 76 and 77 for the new leaf \((\mathcal{I}^h, \mathcal{P}^h)\), which are as follows: \[\begin{align} \|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1-\kappa_j &\quad>\quad 0\tag{79}\\ \frac{\prod_{i \in [I]} \left(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}(\boldsymbol{t})\right)^{w_i}}{\left(p_{\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\kappa_j} \cdot \left(p_{\boldsymbol{X}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\alpha_j} \cdot \left(p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\beta_j} \cdot \left(p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\zeta_j}} &\quad\geq\quad \frac{1}{B^{\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1-\kappa_j}} \tag{80} \end{align}\] We prove Inequality 80 first as follows: \[\begin{align} 1&\geq\frac{\prod_{i \in [I]} \left(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}(\boldsymbol{t})\right)^{w_i}}{\left(p_{\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\kappa_j} \cdot \left(p_{\boldsymbol{X}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\alpha_j} \cdot \left(p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\beta_j} \cdot \left(p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\zeta_j}}\tag{81}\\ &\geq \frac{1}{B^{\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1} \cdot \left(p_{\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\kappa_j} \cdot \left(p_{\boldsymbol{X}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\alpha_j} \cdot \left(p_{\boldsymbol{Y}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\beta_j} \cdot \left(p_{\boldsymbol{Z}_j|\boldsymbol{G}_j}(\boldsymbol{t})\right)^{\zeta_j}}\tag{82}\\ &> \frac{1}{B^{\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1-\kappa_j}} \tag{83} \end{align}\] Inequality 81 holds by definition of sub-probability measures. Inequality 82 holds by the inductive hypothesis that node \((\mathcal{I}, \mathcal{P})\) satisfies 77 . Finally, inequality 83 holds by Inequality 78 . This proves Inequality 80 . Moreover, the above (strict) chain of inequalities also implies that Inequality 79 holds. ◻
Claim 18 (Invariant (d) holds inductively for the recursive calls in lines [line:opanda-express:recursive:l:2] and [line:opanda-express:recursive:h:2]). Consider an arbitrary node \((\mathcal{I}, \mathcal{P})\) that makes two recursive calls to nodes \((\mathcal{I}^l, \mathcal{P}^l)\) and \((\mathcal{I}^h, \mathcal{P}^h)\) in lines [line:opanda-express:recursive:l:2] and [line:opanda-express:recursive:h:2] of Algorithm 4. Then, every tuple \(\boldsymbol{t} \in \Sigma_\text{\sf in}\) that satisfies Inequalities 76 and 77 for the node \((\mathcal{I}, \mathcal{P})\) must satisfy either one of the following:
Proof of Claim 18. Consider a tuple \(\boldsymbol{t} \in \Sigma_\text{\sf in}\) that satisfies Inequalities 76 and 77 for the node \((\mathcal{I}, \mathcal{P})\) but not for the new leaf \((\mathcal{I}^l, \mathcal{P}^l)\). We show that \(\boldsymbol{t}\) must satisfy Inequalities 76 and 77 for the new leaf \((\mathcal{I}^h, \mathcal{P}^h)\).
If \(\boldsymbol{t}\) does not satisfy Inequality 77 for the new leaf \((\mathcal{I}^l, \mathcal{P}^l)\), then by Eq. 75 , this means: \[\begin{align} p_{\boldsymbol{X}}(\boldsymbol{t}) \cdot p_{\boldsymbol{Y}|\boldsymbol{X}}(\boldsymbol{t}) < \frac{1}{B} \label{eq:not-in-B-support:composition} \end{align}\tag{84}\] Inequalities 76 and 77 for the node \((\mathcal{I}^h, \mathcal{P}^h)\) are implied by the following two inequalities, which we prove next: \[\begin{align} \|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1-1 &\quad>\quad 0\tag{85}\\ \frac{\prod_{i \in [I]} \left(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}(\boldsymbol{t})\right)^{w_i}}{p_{\boldsymbol{X}}(\boldsymbol{t}) \cdot p_{\boldsymbol{Y}|\boldsymbol{X}}(\boldsymbol{t})} &\quad\geq\quad \frac{1}{B^{\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1-1}} \tag{86} \end{align}\] First, we prove Inequality 86 as follows: \[\begin{align} 1 &\geq \frac{\prod_{i \in [I]} \left(p_{\boldsymbol{Y}_i|\boldsymbol{X}_i}(\boldsymbol{t})\right)^{w_i}}{p_{\boldsymbol{X}}(\boldsymbol{t}) \cdot p_{\boldsymbol{Y}|\boldsymbol{X}}(\boldsymbol{t})} \tag{87}\\ &\geq\frac{1}{B^{\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1}\cdot p_{\boldsymbol{X}}(\boldsymbol{t}) \cdot p_{\boldsymbol{Y}|\boldsymbol{X}}(\boldsymbol{t})}\tag{88}\\ &>\frac{1}{B^{\|\boldsymbol{\lambda}\|_1 + \|\boldsymbol{\kappa}\|_1-1}} \tag{89} \end{align}\] Inequality 87 holds by definition of sub-probability measures. Inequality 88 holds by the inductive hypothesis that node \((\mathcal{I}, \mathcal{P})\) satisfies 77 . Finally, inequality 89 holds by Inequality 84 . This proves Inequality 86 . Moreover, the above (strict) chain of inequalities also implies that Inequality 85 holds. ◻
We now prove correctness and the runtime bound of the algorithm.
Claim 19 (Algorithm 4 is correct). Algorithm 4 returns a valid \(B\)-probabilistic model of the input \(\omega\)-DDR over the input database instance \(D\).
Proof of Claim 19. This follows from invariant (d). In particular, consider the completed recursion tree of Algorithm 4, i.e., after all recursive calls have been made and the algorithm has terminated. The invariant says that for every tuple \(\boldsymbol{t}\in\Sigma_\text{\sf in}\):
Either \(\boldsymbol{t}\) is already covered by the \(B\)-support of some probabilistic interpretation of an MM target in line [line:opanda-express:mm-target:output]. This probabilistic interpretation is eventually returned by the outer most recursive call as part of the final \(B\)-probabilistic model.
Or there exists some leaf that satisfies Inequalities 76 and 77 for the leaf. By 76 , this leaf cannot return in line [line:opanda-express:no-targets:return]. Moreover, because the recursion tree is completed, this leaf cannot make any recursive calls. Hence, it must return in line [line:opanda-express:join-target:return]. By Eq. 77 , \(\boldsymbol{t}\) must be covered by the support of \(p_{\boldsymbol{U}_\ell}\) in line [line:opanda-express:join-target:return]. Moreover, by invariant (c), this implies that \(\boldsymbol{t}\) is covered by the \(B\)-support of \(p_{\boldsymbol{U}_\ell}\).
◻
Claim 20 (Runtime). Algorithm 4 runs in time \(O(B\cdot \log N)\) in data complexity.
Proof of Claim 20. Just like in the original PANDAExpress algorithm [5], the depth of the recursion tree does not depend on the data, hence it is a constant in data complexity. Since the branching factor is at most 2, the entire size of the recursion tree is also a constant.
The runtime of the algorithm is dominated by the runtime of data dependent operations at every node. These data dependent operations are all inside the \(\textsf{apply-step}\) sub-routine, and they are of the following types
Given a sub-probability measure \(p_{\boldsymbol{X}\boldsymbol{Y}}\), compute its marginal \(p_{\boldsymbol{X}}\) and/or conditional \(p_{\boldsymbol{X}|\boldsymbol{Y}}\) from Eq. ?? and ?? respectively.
Given two sub-probability measures \(p_{\boldsymbol{X}}\) and \(p_{\boldsymbol{Y}|\boldsymbol{X}}\), compute their truncated product measure \(p_{\boldsymbol{X}\boldsymbol{Y}}\) from Eq. 75 .
Invariant (c) implies that every unconditional measure \(p_{\boldsymbol{X}}\) and \(p_{\boldsymbol{X}\boldsymbol{Y}}\) above has a support whose size is at most \(B\). Hence, marginals and conditionals can be computed in time \(O(B)\). Moreover, by Eq. 75 , the output of the truncated product also has support of size at most \(B\), and can be computed in time \(O(B \cdot \log N)\), where the extra \(\log N\) factor is needed to sort the input measure \(p_{\boldsymbol{Y}|\boldsymbol{X}}\) for every \(\boldsymbol{x}\). ◻
◻
We are now ready to prove Theorem [thm:panda:osubw] about answering Boolean conjunctive queries in \(\omega\)-submodular width time.
In order to prove Theorem [thm:panda:osubw], we will need some further preliminaries. The following lemma is very similar to a lemma in [2], [3]. Its proof relies on the observation that every feasible dual solution to the linear program 39 corresponds to an \(\omega\)-Shannon-flow inequality 45 of a certain structure. By strong duality, if we pick an optimal dual solution, we can match the optimal objective value of the (primal) LP 39 .
Lemma 3 (From LP 39 to an \(\omega\)-Shannon-flow Inequality 45 ). Given a hypergraph \(\mathcal{H}=(\mathcal{V},\mathcal{E})\), let \(\mathsf{ED}\stackrel{\mathrm{def}}{=}\mathsf{ED}_{\mathcal{H}}\), and consider a linear program of the following form (which is the same as LP 39 but where we drop the index \(i\in [\mathcal{I}]\) to reduce clutter): \[\begin{align} \max_{t, \boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \bigl\{ t \quad\mid\quad &\forall \ell \in [L],\quad t\leq h(\boldsymbol{U}_{\ell}),\nonumber\\ &\forall j \in [J],\quad t \leq h(\boldsymbol{X}_{j}|\boldsymbol{G}_{j})+ h(\boldsymbol{Y}_{j}|\boldsymbol{G}_{j}) + \gamma h(\boldsymbol{Z}_{j}|\boldsymbol{G}_{j}) +h(\boldsymbol{G}_{j}) \bigr\} \label{eq:osubw:inner-lp:simplified} \end{align}\tag{90}\] Let \(\mathsf{opt}\) be the optimal objective value of the above LP. Then, there must exist an \(\omega\)-Shannon-flow inequality of the form 45 that satisfies the following:
For each \(i \in [I]\), we have \(\boldsymbol{X}_i = \emptyset\) and \(\boldsymbol{Y}_i \in \mathcal{E}\).
For each \(j \in [J]\), we have \(\alpha_j = \beta_j = \kappa_j\) and \(\zeta_j = \kappa_j\cdot \gamma\).
The coefficients of the inequality satisfy \(\|\boldsymbol{\lambda}\|_1+\|\boldsymbol{\kappa}\|_1 > 0\) and: \[\begin{align} \frac{\|\boldsymbol{w}\|_1}{\|\boldsymbol{\lambda}\|_1+\|\boldsymbol{\kappa}\|_1} = \mathsf{opt}. \end{align}\]
Moreover, if \(\omega\) is rational, then the above \(\omega\)-Shannon-flow inequality can be chosen to be integral (Definition 9).
Example 13. As an example of Lemma 3, the LP 12 has an optimal objective value of \(\frac{2\omega}{\omega+1}\), and it results from the \(\omega\)-Shannon-flow inequality 13 .
Given a hypergraph \(\mathcal{H}=(\mathcal{V},\mathcal{E})\) and a generalized variable elimination order \(\overline{\boldsymbol{\sigma}} =\) \((\boldsymbol{X}_1, \boldsymbol{X}_2, \ldots, \boldsymbol{X}_{|\overline{\boldsymbol{\sigma}}|})\) \(\in\overline{\pi}(\mathcal{V})\), each set of vertices \(\boldsymbol{X}_i\) can be eliminated by either a join algorithm or some matrix multiplication. The concept of an \(\omega\)-query plan, that we define below, amends a generalized variable elimination order with a mapping that specifies how to eliminate each variable.
Definition 13 (\(\omega\)-Query Plan). Given a hypergraph \(\mathcal{H}=(\mathcal{V},\mathcal{E})\), an \(\omega\)-query plan is a pair \((\overline{\boldsymbol{\sigma}}, e)\) where:
\(\overline{\boldsymbol{\sigma}}\in\overline{\pi}(\mathcal{V})\) is a generalized variable elimination order.
\(e\) is a function that maps every index \(i \in [|\overline{\boldsymbol{\sigma}}|]\) (that satisfies \(U_i^{\overline{\boldsymbol{\sigma}}}\not\subseteq U_j^{\overline{\boldsymbol{\sigma}}}, \forall j \in [i-1]\)) to a term \(e(i)\in\{h(U^{\overline{\boldsymbol{\sigma}}}_i)\} \cup \mathsf{args}(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i)\).
Note that, for a given hypergraph \(\mathcal{H}\), the number of \(\omega\)-query plans is finite.
Proof of Theorem [thm:panda:osubw]. The algorithm is given in Algorithm 3. Let \(\mathcal{H}=(\mathcal{V},\mathcal{E})\) be the query hypergraph. Consider the \(\omega\)-submodular width of \(\mathcal{H}\) written in the form of Eq. 37 . Let \(k\) be the number of vertices of \(\mathcal{H}\). Recall from Section 6 that \(\mathcal{F}\) is the set of functions \(f:\overline{\pi}(\mathcal{V})\to [k]\) that map every generalized variable elimination order \(\overline{\boldsymbol{\sigma}}\in\overline{\pi}(\mathcal{V})\) to a number \(i\) between 1 and \(|\overline{\boldsymbol{\sigma}}|\) that satisfies \(U^{\overline{\boldsymbol{\sigma}}}_i \not\subseteq U^{\overline{\boldsymbol{\sigma}}}_j\) for all \(j \in [i-1]\). For a fixed function \(f \in\mathcal{F}\), let \(\mathcal{G}_f\) be the set of functions \(g_f\) that map every pair \((\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))\) where \(\overline{\boldsymbol{\sigma}}\in\overline{\pi}(\mathcal{V})\) and \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G})\in\mathsf{args}(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_{f(\overline{\boldsymbol{\sigma}})})\) to one of the three terms in \(\mathsf{args}(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))\) from Eq. 28 . In particular, \(g_f(\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))\) is equal to either one of the following: \[\begin{align} &h(\boldsymbol{X}|\boldsymbol{G})+h(\boldsymbol{Y}|\boldsymbol{G})+\gamma\cdot h(\boldsymbol{Z}|\boldsymbol{G})+h(\boldsymbol{G}),\quad\\ &h(\boldsymbol{X}|\boldsymbol{G})+\gamma\cdot h(\boldsymbol{Y}|\boldsymbol{G})+h(\boldsymbol{Z}|\boldsymbol{G})+h(\boldsymbol{G}),\quad\\ &\gamma\cdot h(\boldsymbol{X}|\boldsymbol{G})+h(\boldsymbol{Y}|\boldsymbol{G})+h(\boldsymbol{Z}|\boldsymbol{G})+h(\boldsymbol{G}) \end{align}\] For each \(f \in \mathcal{F}, g_f \in \mathcal{G}_f\), we construct an \(\omega\)-DDR of the form 60 : \[\begin{align} \bigvee_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})} P(U_{f(\overline{\boldsymbol{\sigma}})}^{\boldsymbol{\overline{\sigma}}}) \vee \bigvee_{\substack{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})\\ \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G})\in\mathsf{args}(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_{f(\boldsymbol{\overline{\sigma}})})\\ (\{\boldsymbol{X}', \boldsymbol{Y}'\}, \boldsymbol{Z}'):\;\;g_f(\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))=\\ h(\boldsymbol{X}'|\boldsymbol{G})+h(\boldsymbol{Y}'|\boldsymbol{G})+\gamma\cdot h(\boldsymbol{Z}'|\boldsymbol{G})+h(\boldsymbol{G})}}\left(S(\boldsymbol{X}'\boldsymbol{G})\wedge T(\boldsymbol{Y}'\boldsymbol{G})\wedge W(\boldsymbol{Z}'\boldsymbol{G}) \right) \text{ :- }\bigwedge_{R(\boldsymbol{Z}) \in \Sigma_{\text{\sf in}}} R(\boldsymbol{Z}) \label{eq:omega-ddr:subw:raw} \end{align}\tag{91}\] In particular, \((\{\boldsymbol{X}', \boldsymbol{Y}'\}, \boldsymbol{Z}')\) in Eq. 91 is a partial order of \((\boldsymbol{X}, \boldsymbol{Y}, \boldsymbol{Z})\) that is picked according to \(g_f(\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))\). In this partial order, \(\boldsymbol{X}'\) and \(\boldsymbol{Y}'\) are interchangeable, but \(\boldsymbol{Z}'\) is not interchangeable with either one of them. This mirrors the way MM targets of an \(\omega\)-DDR are defined in Definition 11, where we think of the conjunction \(S(\boldsymbol{X}'\boldsymbol{G}) \wedge T(\boldsymbol{Y}'\boldsymbol{G}) \wedge W(\boldsymbol{Z}'\boldsymbol{G})\) as being partially ordered \((\{S(\boldsymbol{X}'\boldsymbol{G}) \wedge T(\boldsymbol{Y}'\boldsymbol{G})\}, W(\boldsymbol{Z}'\boldsymbol{G}))\) such that \(S(\boldsymbol{X}'\boldsymbol{G})\) and \(T(\boldsymbol{Y}'\boldsymbol{G})\) are interchangeable but \(W(\boldsymbol{Z}'\boldsymbol{G})\) is not interchangeable with either one of them.
Just like going from Eq. 37 to Eq. 38 , we can re-index the above \(\omega\)-DDRs so that we have one \(\omega\)-DDR for each \(i \in [\mathcal{I}]\): \[\begin{align} \bigvee_{\ell \in [L_i]} P(\boldsymbol{U}_{i\ell}) \vee \bigvee_{j \in [J_i]}\left(S(\boldsymbol{X}_{ij}\boldsymbol{G}_{ij})\wedge T(\boldsymbol{Y}_{ij}\boldsymbol{G}_{ij})\wedge W(\boldsymbol{Z}_{ij}\boldsymbol{G}_{ij}) \right) \text{ :- }\bigwedge_{R(\boldsymbol{Z}) \in \Sigma_{\text{\sf in}}} R(\boldsymbol{Z}) \label{eq:omega-ddr:subw} \end{align}\tag{92}\] By Eq. 38 , for each \(i \in [\mathcal{I}]\), the corresponding LP 39 has an optimal objective value that is upper bounded by \(\textsf{\omega-subw}(\mathcal{H})\). Consider a fixed LP 39 , written in the form of Eq. 90 (where we drop the index \(i\) to reduce clutter), and let \(\mathsf{opt}\) be its optimal objective value. By Lemma 3, there exists an \(\omega\)-Shannon-flow inequality of the form 45 that satisfies: \[\begin{align} \frac{\|\boldsymbol{w}\|_1}{\|\boldsymbol{\lambda}\|_1+\|\boldsymbol{\kappa}\|_1} = \mathsf{opt}\leq \textsf{\omega-subw}(\mathcal{H}). \end{align}\] Moreover, for each \(i \in [I]\), the above inequality satisfies \(\boldsymbol{X}_i = \emptyset\) and \(\boldsymbol{Y}_i \in \mathcal{E}\), hence \(\deg_{\Sigma_\text{\sf in}}(\boldsymbol{Y}_i|\boldsymbol{X}_i)\leq N\). Define \(B \stackrel{\mathrm{def}}{=}N^{\mathsf{opt}}\). Then by Theorem 15, we can, in time \(O(B\cdot \log N) = O(N^{\textsf{\omega-subw}(\mathcal{H})}\cdot \log N)\), compute a \(B\)-probabilistic model for the corresponding \(\omega\)-DDR 92 , or equivalently the \(\omega\)-DDR 91 . We repeat the above for every \(i \in [\mathcal{I}]\), or equivalently for every \(f \in \mathcal{F}, g_f \in \mathcal{G}_f\). The value of \(B\) depends on the specific \(\omega\)-DDR, but it is always upper bounded by \(\overline{B}\) defined as: \[\begin{align} \overline{B} \stackrel{\mathrm{def}}{=}N^{\textsf{\omega-subw}(\mathcal{H})}. \end{align}\] This is because \(\mathsf{opt}\leq \textsf{\omega-subw}(\mathcal{H})\). Therefore, we by Proposition 14, we can assume that all the computed probabilistic models are \(\overline{B}\)-probabilistic models.
Example 14. For the triangle query \(Q_\triangle\) from Eq. 2 , the submodular width formulation from Eq. 37 takes the form 11 , which is a maximum of three LPs. These three LPs correspond to the following three \(\omega\)-DDRs of the form 91 , respectively: \[\begin{align} P_1(X, Y, Z) \vee (S_1(X) \wedge T_1(Y) \wedge W_1(Z)) \quad\text{ :- }\quad R(X, Y) \wedge S(Y, Z) \wedge T(Z, X)\tag{93}\\ P_2(X, Y, Z) \vee (S_2(X) \wedge T_2(Z) \wedge W_2(Y)) \quad\text{ :- }\quad R(X, Y) \wedge S(Y, Z) \wedge T(Z, X)\tag{94}\\ P_3(X, Y, Z) \vee (S_3(Y) \wedge T_3(Z) \wedge W_3(X)) \quad\text{ :- }\quad R(X, Y) \wedge S(Y, Z) \wedge T(Z, X)\tag{95} \end{align}\] Consider the first \(\omega\)-DDR in Eq. 93 (which is the same as Eq. 70 from Section 7.6.1). The corresponding LP is given more explicitly in Eq. 12 , and it has an optimal objective value of \(\frac{2\omega}{\omega+1}\), which also happens to be the value of \(\textsf{\omega-subw}(Q_\triangle)\). By Lemma 3, we can derive the \(\omega\)-Shannon-flow inequality in Eq. 13 from the LP in Eq. 12 . Guided by this \(\omega\)-Shannon-flow inequality, we can use Theorem 15 to compute a \(B\)-probabilistic model for the \(\omega\)-DDR in Eq. 93 in time \(O(B\cdot \log N)\), where \(B = N^{\frac{2\omega}{\omega+1}}\). This process is explained in detail in Section 7.6.1. We can do the same for the other two \(\omega\)-DDRs.
Recall from Definition 11 that every \(\omega\)-DDR of the form 91 has two types of targets:
Join targets of the form \(P(\boldsymbol{U}_{f(\overline{\boldsymbol{\sigma}})}^{\boldsymbol{\overline{\sigma}}})\).
MM targets of the form \((\{S(\boldsymbol{X}'\boldsymbol{G}), T(\boldsymbol{Y}'\boldsymbol{G})\}, W(\boldsymbol{Z}'\boldsymbol{G}))\). In these targets, \(S\) and \(T\) are interchangeable, but \(W\) is not interchangeable with either of them.
Definition 14 (Target Selector). A target selector \(\mathcal{T}\) is a set of targets consisting of one target from each \(\omega\)-DDR of the form 91 .
Definition 15 (\(\omega\)-query plan supported by a target selector). Given an \(\omega\)-query plan \((\overline{\boldsymbol{\sigma}}, e)\), a target selector \(\mathcal{T}\) is said to support \((\overline{\boldsymbol{\sigma}}, e)\) iff for every \(i \in [|\overline{\boldsymbol{\sigma}}|]\) that satisfies \(U_i^{\overline{\boldsymbol{\sigma}}}\not\subseteq U_j^{\overline{\boldsymbol{\sigma}}}, \forall j \in [i-1]\), we have:
If \(e(i) = h(U_i^{\overline{\boldsymbol{\sigma}}})\), then \(\mathcal{T}\) contains a join target \(P(U_{i}^{\overline{\boldsymbol{\sigma}}})\).
If \(e(i) = \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}) \in \mathsf{args}(\mathsf{EMM}_i^{\overline{\boldsymbol{\sigma}}})\), then \(\mathcal{T}\) contains three MM targets of the forms: \[\begin{align} &(\{S_1(\boldsymbol{X}\boldsymbol{G}), T_1(\boldsymbol{Y}\boldsymbol{G})\}, W_1(\boldsymbol{Z}\boldsymbol{G})),\nonumber\\ &(\{S_2(\boldsymbol{X}\boldsymbol{G}), T_2(\boldsymbol{Z}\boldsymbol{G})\}, W_2(\boldsymbol{Y}\boldsymbol{G})),\nonumber\\ &(\{S_3(\boldsymbol{Y}\boldsymbol{G}), T_3(\boldsymbol{Z}\boldsymbol{G})\}, W_3(\boldsymbol{X}\boldsymbol{G})). \label{eq:mm:targets} \end{align}\tag{96}\]
The following proposition is the core of this section, and it is the key to proving Theorem [thm:panda:osubw].
Proposition 21. Every target selector \(\mathcal{T}\) must support at least one \(\omega\)-query plan \((\overline{\boldsymbol{\sigma}}, e)\).
Example 15. Before proving Proposition 21, we give a quick example. Consider the \(\omega\)-DDRs in Eq. 93 , 94 , and 95 for the triangle query \(Q_\triangle\). Each one of these \(\omega\)-DDRs has two targets: one join target and one MM target. Hence, there are \(2^3=8\) possible target selectors:
There are 7 target selectors that contain at least one join target \(P_i(X, Y, Z)\). Consider any one of them. Such a target selector does indeed support an \(\omega\)-query plan \((\overline{\boldsymbol{\sigma}}, e)\). For example, we could pick \(\overline{\boldsymbol{\sigma}} = (X, Y, Z)\), and define \(e(X)\) to be \(h(X Y Z)\). We don’t need to define \(e(Y)\) and \(e(Z)\) since \(U_2^{\overline{\boldsymbol{\sigma}}}\) and \(U_3^{\overline{\boldsymbol{\sigma}}}\) are subsets of \(U_1^{\overline{\boldsymbol{\sigma}}}\).
Finally, consider the target selector \(\mathcal{T}\) that contains no join target, hence contains all three MM targets. This target selector also supports an \(\omega\)-query plan \((\overline{\boldsymbol{\sigma}}, e)\). For example, we could pick \(\overline{\boldsymbol{\sigma}} = (X, Y, Z)\), and define \(e(X)\) to be \(\mathsf{MM}(X; Y; Z)\). Just like above, we don’t need to define \(e(Y)\) and \(e(Z)\).
Section 7.8 gives a more complicated example of Proposition 21 for the 4-cycle query \(Q_\square\) from Eq. 4 .
Proof of Proposition 21. Let \(\mathcal{T}\) be a target selector, and assume for the sake of contradiction that \(\mathcal{T}\) does not support any \(\omega\)-query plan \((\overline{\boldsymbol{\sigma}}, e)\). What this means is that for every generalized variable elimination order \(\overline{\boldsymbol{\sigma}}\in\overline{\pi}(\mathcal{V})\), there is no function \(e\) that makes this \(\omega\)-query plan \((\overline{\boldsymbol{\sigma}}, e)\) supported by \(\mathcal{T}\). In other words:
Claim 22. Assuming Proposition 21 is false, for every generalized variable elimination order \(\overline{\boldsymbol{\sigma}}\in\overline{\pi}(\mathcal{V})\), there must exist some \(i \in [|\overline{\boldsymbol{\sigma}}|]\) that satisfies \(U_i^{\overline{\boldsymbol{\sigma}}}\not\subseteq U_j^{\overline{\boldsymbol{\sigma}}}, \forall j \in [i-1]\) and:
\(\mathcal{T}\) does not contain a join target \(P(U_{i}^{\overline{\boldsymbol{\sigma}}})\), and
for every \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y}; \boldsymbol{Z}|\boldsymbol{G})\in\mathsf{args}(\mathsf{EMM}_i^{\overline{\boldsymbol{\sigma}}})\), \(\mathcal{T}\) is missing at least one of the three MM targets from Eq. 96 .
We use the above claim to construct functions \(f^*\in \mathcal{F}\) and \(g^*\in\mathcal{G}_{f^*}\) as follows: (Recall the definitions of \(\mathcal{F}\) and \(\mathcal{G}_f\) for \(f \in \mathcal{F}\) from Section 6.) For every \(\overline{\boldsymbol{\sigma}}\in\overline{\pi}(\mathcal{V})\), let \(f^*(\overline{\boldsymbol{\sigma}})\) be equal to \(i \in [|\overline{\boldsymbol{\sigma}}|]\) that is assumed in Claim 22, breaking ties arbitrarily if more than one choice for \(i\) is possible. Moreover, for every \(\mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G})\in \mathsf{args}(\mathsf{EMM}_{f^*(\overline{\boldsymbol{\sigma}})}^{\overline{\boldsymbol{\sigma}}})\), let \(g^*(\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G}))\) be equal to one of the following three terms, depending on which of the three MM targets from Eq. 96 is missing from \(\mathcal{T}\): \[\begin{gather} g^*(\overline{\boldsymbol{\sigma}}, \mathsf{MM}(\boldsymbol{X};\boldsymbol{Y};\boldsymbol{Z}|\boldsymbol{G})) \stackrel{\mathrm{def}}{=}\\ \begin{cases} h(\boldsymbol{X}|\boldsymbol{G})+h(\boldsymbol{Y}|\boldsymbol{G})+\gamma h(\boldsymbol{Z}|\boldsymbol{G})+h(\boldsymbol{G}),& \text{if (\{S_1(\boldsymbol{X}\boldsymbol{G}), T_1(\boldsymbol{Y}\boldsymbol{G})\}, W_1(\boldsymbol{Z}\boldsymbol{G})) is missing from \mathcal{T}}\\ h(\boldsymbol{X}|\boldsymbol{G})+\gamma h(\boldsymbol{Y}|\boldsymbol{G})+h(\boldsymbol{Z}|\boldsymbol{G})+h(\boldsymbol{G}),& \text{else if (\{S_2(\boldsymbol{X}\boldsymbol{G}), T_2(\boldsymbol{Z}\boldsymbol{G})\}, W_2(\boldsymbol{Y}\boldsymbol{G})) is missing from \mathcal{T}}\\ \gamma h(\boldsymbol{X}|\boldsymbol{G})+h(\boldsymbol{Y}|\boldsymbol{G})+h(\boldsymbol{Z}|\boldsymbol{G})+h(\boldsymbol{G}),& \text{else if (\{S_3(\boldsymbol{Y}\boldsymbol{G}), T_3(\boldsymbol{Z}\boldsymbol{G})\}, W_3(\boldsymbol{X}\boldsymbol{G})) is missing from \mathcal{T}} \end{cases} \end{gather}\] But then by construction, there must exist an \(\omega\)-DDR of the form 91 that is associated with \(f:=f^*\) and \(g_f:=g^*\). Hence, the target selector \(\mathcal{T}\) must contain a target from this \(\omega\)-DDR. This contradicts Claim 22. ◻
As explained before, we use Theorem 15 to compute a \(B\)-probabilistic model for each \(\omega\)-DDR of the form 91 , where the value of \(B\) depends on the \(\omega\)-DDR. However, \(B \leq (\overline{B} \stackrel{\mathrm{def}}{=}N^{\textsf{\omega-subw}(Q)})\), hence, by Proposition 14, we can assume that we have computed a \(\overline{B}\)-probabilistic model for each \(\omega\)-DDR of the form 91 . As a result, every target in every \(\omega\)-DDR of the form 91 now has a probabilistic interpretation. Hence, every target in every target selector also has a probabilistic interpretation. Those interpretations form a probabilistic interpretation for the target selector, as defined below.
Definition 16 (Probabilistic interpretation of a target selector). Given a target selector \(\mathcal{T}\), a probabilistic interpretation \(\mathcal{P}_\mathcal{T}\) for \(\mathcal{T}\) consists of a probabilistic interpretation of each target in \(\mathcal{T}\) (which could be either a join target or an MM target).
Definition 17 (\(\overline{B}\)-support of a probabilistic interpretation of a target selector). Given a probabilistic interpretation \(\mathcal{P}_\mathcal{T}\) of a target selector \(\mathcal{T}\) and a number \(\overline{B} \in \mathbb{R}_+\), we define the \(\overline{B}\)-support of \(\mathcal{P}_\mathcal{T}\) to be the set of tuples \(\boldsymbol{t} \in\mathlarger{\mathlarger{\mathlarger{\Join}}}{\Sigma_\text{\sf in}}\) that are covered15 by the \(\overline{B}\)-support of the probabilistic interpretation of every target in \(\mathcal{T}\).
Proposition 23. Every tuple \(\boldsymbol{t} \in \mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma_\text{\sf in}\) must occur in the \(\overline{B}\)-support of the probabilistic interpretation \(\mathcal{P}_\mathcal{T}\) of some target selector \(\mathcal{T}\).
Example 16. Suppose we computed a \(\overline{B}\)-probabilistic model for each of the three \(\omega\)-DDRs in Eqs. 93 , 94 , and 95 for the triangle query \(Q_\triangle\). By definition of a \(\overline{B}\)-probabilistic model, for each tuple \((x, y, z) \in R \Join S\Join T\) and for each one of the three \(\omega\)-DDRs, \((x, y, z)\) must be accounted for by either the join target or the MM target of this \(\omega\)-DDR. Hence, \((x, y, z)\) must be accounted for by at least one of the eight target selectors that were mentioned before.
Proof of Proposition 23. Fix an arbitrary tuple \(\boldsymbol{t} \in \mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma_\text{\sf in}\). By definition of a \(\overline{B}\)-probabilistic model, for every \(\omega\)-DDR of the form 91 , \(\boldsymbol{t}\) must be covered by the \(\overline{B}\)-support of the probabilistic interpretation of at least one target of this \(\omega\)-DDR. If we pick those targets, we obtain a target selector \(\mathcal{T}\) satisfying the proposition for \(\boldsymbol{t}\). ◻
Proposition 21 says that every target selector \(\mathcal{T}\) supports at least one \(\omega\)-query plan \((\overline{\boldsymbol{\sigma}}, e)\). The following proposition roughly says that we can use this \(\omega\)-query plan to evaluate the original query \(Q\) filtered by (the \(\overline{B}\)-supports of the probabilistic interpretations of) the targets that appear in this particular query plan. These targets are a subset of the targets in \(\mathcal{T}\).
Proposition 24 (Evaluating \(Q\) filtered by a target selector \(\mathcal{T}\)). Given a target selector \(\mathcal{T}\) with a probabilistic interpretation \(\mathcal{P}_\mathcal{T}\), let \(\mathcal{S}_\mathcal{T}\) be the \(\overline{B}\)-support of \(\mathcal{P}_\mathcal{T}\). Then, there exists a superset \(\overline{\mathcal{S}}_\mathcal{T}\supseteq \mathcal{S}_\mathcal{T}\) where the following BCQ \(Q_\mathcal{T}\) can be computed in time \(O(\overline{B} \cdot \log^2 N)\) in data complexity: \[\begin{align} Q_\mathcal{T}() \quad\text{ :- }\quad \overline{\mathcal{S}}_\mathcal{T}(\mathcal{V}) \wedge \bigwedge_{R(\boldsymbol{X}) \in \mathsf{atoms}(Q)} R(\boldsymbol{X}) \label{eq:bcq:target-selector} \end{align}\qquad{(8)}\]
Proof of Proposition 24. By Proposition 21, there must exist an \(\omega\)-query plan \((\overline{\boldsymbol{\sigma}}, e)\) that is supported by \(\mathcal{T}\). Let \(\overline{\boldsymbol{\sigma}} = (\boldsymbol{X}_1, \ldots, \boldsymbol{X}_{|\overline{\boldsymbol{\sigma}}|})\). Let \(\mathcal{H}=(\mathcal{V},\mathcal{E})\) be the hypergraph of the original query \(Q\). Initially, each hyperedge \(\boldsymbol{Z}\in\mathcal{E}\) has a corresponding atom \(R(\boldsymbol{Z})\in\mathsf{atoms}(Q)\). We use the generalized variable elimination order \(\overline{\boldsymbol{\sigma}}\) to eliminate the variable sets \(\boldsymbol{X}_1, \ldots, \boldsymbol{X}_{|\overline{\boldsymbol{\sigma}}|}\) and generate the corresponding hypergraph sequence \(\mathcal{H}^{\overline{\boldsymbol{\sigma}}}_1\stackrel{\mathrm{def}}{=}\mathcal{H}, \ldots, \mathcal{H}^{\overline{\boldsymbol{\sigma}}}_{|\overline{\boldsymbol{\sigma}}|+1}\), as described in Definition 3. Each time we eliminate a variable set \(\boldsymbol{X}_i\), we remove adjacent hyperedges \(\partial^{\overline{\boldsymbol{\sigma}}}_i\) and add a new hyperedge \(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i\). Our target below is to create a new corresponding atom \(R(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i)\) in time \(O(\overline{B}\cdot \log^2 N)\), and use this new atom \(R(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i)\) to replace old atoms \(R(\boldsymbol{Z})\) for \(\boldsymbol{Z} \in \partial_i^{\overline{\boldsymbol{\sigma}}}\). Mirroring the hypergraph sequence \(\mathcal{H}^{\overline{\boldsymbol{\sigma}}}_1, \ldots, \mathcal{H}^{\overline{\boldsymbol{\sigma}}}_{|\overline{\boldsymbol{\sigma}}|+1}\), this atom replacement process will create a sequence of full conjunctive queries \(Q_1^{\overline{\boldsymbol{\sigma}}}, \ldots, Q_{|\overline{\boldsymbol{\sigma}}|+1}^{\overline{\boldsymbol{\sigma}}}\) (i.e. conjunctive queries where all variables are free) that are defined as follows, for every \(i \in [|\overline{\boldsymbol{\sigma}}|+1]\): \[\begin{align} Q_i^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}_i^{\overline{\boldsymbol{\sigma}}}) \quad\text{ :- }\quad \bigwedge_{\boldsymbol{Z} \in \mathcal{E}_i^{\overline{\boldsymbol{\sigma}}}} R(\boldsymbol{Z}) \end{align}\] Note that \(Q_1^{\overline{\boldsymbol{\sigma}}}\) is the full version of the Boolean CQ \(Q\). Our target is to inductively maintain the following invariant for every \(i \in [|\overline{\boldsymbol{\sigma}}|+1]\):
Invariant: There exists a superset \(\mathcal{S}_i^{\overline{\boldsymbol{\sigma}}} \supseteq \mathcal{S}_\mathcal{T}\) such that \(Q_i^{\overline{\boldsymbol{\sigma}}}\) is equivalent to the following query: \[\begin{align} Q_i^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}_i^{\overline{\boldsymbol{\sigma}}}) \quad\text{ :- }\quad \mathcal{S}_i^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}) \wedge \bigwedge_{R(\boldsymbol{X}) \in \mathsf{atoms}(Q)} R(\boldsymbol{X}) \label{eq:invariant:support-superset} \end{align}\tag{97}\]
Assuming that the above invariant holds for \(i = |\overline{\boldsymbol{\sigma}}|+1\), note that by choosing \(\overline{\mathcal{S}}_T\) to be \(\mathcal{S}_{|\overline{\boldsymbol{\sigma}}|+1}^{\overline{\boldsymbol{\sigma}}}\), \(Q_\mathcal{T}\) becomes equivalent to \(Q_{|\overline{\boldsymbol{\sigma}}|+1}^{\overline{\boldsymbol{\sigma}}}\), thus proving the proposition. We now prove the invariant by induction on \(i\). The invariant initially holds for \(i=1\) because \(\mathcal{S}_1^{\overline{\boldsymbol{\sigma}}}\) can be chosen to be \(\textsf{Dom}^{\mathcal{V}}\). The elimination process proceeds as follows for \(i=1, 2, \ldots, |\overline{\boldsymbol{\sigma}}|\):
If \(U_i^{\overline{\boldsymbol{\sigma}}}\not\subseteq U_j^{\overline{\boldsymbol{\sigma}}}, \forall j \in [i-1]\), we recognize two cases:
If \(e(i) = h(U_i^{\overline{\boldsymbol{\sigma}}})\), then we create the new atom \(R(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i)\) as follows. By Definition 15, the target selector \(\mathcal{T}\) must contain a join target \(P(U_i^{\overline{\boldsymbol{\sigma}}})\). We initialize a corresponding table \(P(U_i^{\overline{\boldsymbol{\sigma}}})\) by taking the \(\overline{B}\)-support of the probabilistic interpretation of \(P(U_i^{\overline{\boldsymbol{\sigma}}})\). By definition of \(\overline{B}\)-support, the size of \(P(U_i^{\overline{\boldsymbol{\sigma}}})\) is at most \(\overline{B}\). We then compute the new atom \(R(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i)\) as follows: \[\begin{align} R(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i) \quad\text{ :- }\quad P(U_i^{\overline{\boldsymbol{\sigma}}}) \wedge \bigwedge_{\boldsymbol{Z}\in\partial_i^{\overline{\boldsymbol{\sigma}}}} R(\boldsymbol{Z}) \end{align}\] Computing \(R(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i)\) above takes time proportional to the size of \(P(U_i^{\overline{\boldsymbol{\sigma}}})\), which is \(O(\overline{B})\). Note that \(Q_{i+1}^{\overline{\boldsymbol{\sigma}}}\) is equivalent to: \[\begin{align} Q_{i+1}^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}_{i+1}^{\overline{\boldsymbol{\sigma}}}) \quad\text{ :- }\quad Q_{i}^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}_{i}^{\overline{\boldsymbol{\sigma}}}) \wedge P(U_i^{\overline{\boldsymbol{\sigma}}}) \end{align}\] Therefore, invariant 97 is inductively maintained by choosing \(\mathcal{S}_{i+1}^{\overline{\boldsymbol{\sigma}}}\) to be \(\mathcal{S}_i^{\overline{\boldsymbol{\sigma}}}\) filtered by \(P(U_i^{\overline{\boldsymbol{\sigma}}})\): \[\begin{align} \mathcal{S}_{i+1}^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}) \quad\text{ :- }\quad \mathcal{S}_i^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}) \wedge P(U_i^{\overline{\boldsymbol{\sigma}}}) \end{align}\]
If \(e(i) = \mathsf{MM}(\boldsymbol{Y};\boldsymbol{Z}; \boldsymbol{X}_i|\boldsymbol{G})\) where \(\mathsf{MM}(\boldsymbol{Y};\boldsymbol{Z};\boldsymbol{X}_i|\boldsymbol{G})\in \mathsf{args}(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i)\), then by Eq. 29 , there must exist \(\mathcal{A}, \mathcal{B}\subseteq \partial^{\overline{\boldsymbol{\sigma}}}_i\) such that \(\mathcal{A}\cup \mathcal{B}= \partial^{\overline{\boldsymbol{\sigma}}}_i\) where \(\boldsymbol{A}\stackrel{\mathrm{def}}{=}\cup \mathcal{A}, \boldsymbol{B}\stackrel{\mathrm{def}}{=}\cup \mathcal{B}, \boldsymbol{A}^{\boldsymbol{G}}\stackrel{\mathrm{def}}{=}\boldsymbol{A} \setminus \boldsymbol{G}, \boldsymbol{B}^{\boldsymbol{G}}\stackrel{\mathrm{def}}{=}\boldsymbol{B} \setminus \boldsymbol{G}\) satisfy: \[\begin{align} \boldsymbol{X}_i = \boldsymbol{A}^{\boldsymbol{G}} \cap \boldsymbol{B}^{\boldsymbol{G}},\qquad \boldsymbol{Y} = \boldsymbol{A}^{\boldsymbol{G}}\setminus \boldsymbol{X}_i,\qquad \boldsymbol{Z} = \boldsymbol{B}^{\boldsymbol{G}}\setminus \boldsymbol{X}_i. \end{align}\] Define two queries \(M_1\) and \(M_2\) without materializing their outputs: \[\begin{align} M_1(\boldsymbol{G} \boldsymbol{Y}\boldsymbol{X}_i) &\text{ :- } \bigwedge_{\boldsymbol{Z}'\in\mathcal{A}} R(\boldsymbol{Z}'),\\ M_2(\boldsymbol{G} \boldsymbol{X}_i\boldsymbol{Z}) &\text{ :- } \bigwedge_{\boldsymbol{Z}'\in\mathcal{B}} R(\boldsymbol{Z}'). \end{align}\] Note that even without materializing the outputs of \(M_1\) and \(M_2\), we can still support membership queries in \(O(1)\) time by querying the underlying relations \(R(\boldsymbol{Z}')\). By Definition 15, the target selector \(\mathcal{T}\) must contain three MM targets of the form: \[\begin{align} &(\{S_1(\boldsymbol{X}_i\boldsymbol{G}), T_1(\boldsymbol{Y}\boldsymbol{G})\}, W_1(\boldsymbol{Z}\boldsymbol{G})),\\ &(\{S_2(\boldsymbol{X}_i\boldsymbol{G}), T_2(\boldsymbol{Z}\boldsymbol{G})\}, W_2(\boldsymbol{Y}\boldsymbol{G})),\\ &(\{S_3(\boldsymbol{Y}\boldsymbol{G}), T_3(\boldsymbol{Z}\boldsymbol{G})\}, W_3(\boldsymbol{X}_i\boldsymbol{G})). \end{align}\] Let \(E \subseteq \textsf{Dom}^{\boldsymbol{X}_i\boldsymbol{Y}\boldsymbol{Z}\boldsymbol{G}}\) be the intersection of the \(\overline{B}\)-supports of the probabilistic interpretations of the above three MM targets. Now we use Lemma 2 to compute the following, for some superset \(\overline{E} \supseteq E\): \[\begin{align} R(\underbrace{\boldsymbol{G}\boldsymbol{Y}\boldsymbol{Z}}_{U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i}) \quad\text{ :- }\quad \overline{E}(\boldsymbol{G}\boldsymbol{X}_i\boldsymbol{Y}\boldsymbol{Z}) \wedge M_1(\boldsymbol{G}\boldsymbol{Y}\boldsymbol{X}_i) \wedge M_2(\boldsymbol{G}\boldsymbol{X}_i\boldsymbol{Z}) \end{align}\] By Lemma 2, \(R(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i)\) above can be computed in time \(O(\overline{B} \cdot \log^2 N)\). Note that \(Q_{i+1}^{\overline{\boldsymbol{\sigma}}}\) is equivalent to: \[\begin{align} Q_{i+1}^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}_{i+1}^{\overline{\boldsymbol{\sigma}}}) \quad\text{ :- }\quad Q_{i}^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}_{i}^{\overline{\boldsymbol{\sigma}}}) \wedge \overline{E}(\boldsymbol{G}\boldsymbol{X}_i\boldsymbol{Y}\boldsymbol{Z}) \end{align}\] Hence, invariant 97 is inductively maintained by choosing \(\mathcal{S}_{i+1}^{\overline{\boldsymbol{\sigma}}}\) to be \(\mathcal{S}_i^{\overline{\boldsymbol{\sigma}}}\) filtered by \(\overline{E}\): \[\begin{align} \mathcal{S}_{i+1}^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}) \quad\text{ :- }\quad \mathcal{S}_i^{\overline{\boldsymbol{\sigma}}}(\mathcal{V}) \wedge \overline{E}(\boldsymbol{G}\boldsymbol{X}_i\boldsymbol{Y}\boldsymbol{Z}) \end{align}\]
If \(U^{\overline{\boldsymbol{\sigma}}}_i \subseteq U^{\overline{\boldsymbol{\sigma}}}_j\) for some \(j \in [i-1]\), then \(U^{\overline{\boldsymbol{\sigma}}}_i \subseteq U^{\overline{\boldsymbol{\sigma}}}_j \setminus \boldsymbol{X}_j\). Hence, we can obtain \(R(U^{\overline{\boldsymbol{\sigma}}}_i\setminus \boldsymbol{X}_i)\) by projecting \(R(U^{\overline{\boldsymbol{\sigma}}}_j\setminus \boldsymbol{X}_j)\). The cost of this operation can be charged to computing \(R(U^{\overline{\boldsymbol{\sigma}}}_j\setminus \boldsymbol{X}_j)\). Invariant 97 is maintained trivially.
◻
Proposition 25 (Algorithm 3 is correct). The answer to \(Q\) is equivalent to \(\bigvee_\mathcal{T}Q_\mathcal{T}\).
Proof of Proposition 25. By definition of \(Q_\mathcal{T}\) from Eq. ?? , if \(Q_\mathcal{T}\) evaluates to for some \(\mathcal{T}\), then \(Q\) must also evaluate to . Now, we prove the opposite direction. Suppose that \(Q\) evaluates to . This means that there must exist a tuple \(\boldsymbol{t} \in \mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma_\text{\sf in}\). By Proposition 23, there must exist a target selector \(\mathcal{T}\) such that \(\boldsymbol{t}\) belongs to the \(\overline{B}\)-support, \(\mathcal{S}_\mathcal{T}\), of the probabilistic interpretation \(\mathcal{P}_\mathcal{T}\) of \(\mathcal{T}\). This means \(Q_\mathcal{T}\) must evaluate to . ◻
Proposition 26 (Algorithm 3 runs in the claimed time). Algorithm 3 runs in time \(O(N^{\textsf{\omega-subw}(Q)}\cdot \log^2 N)\) in data complexity.
We will see below that the extra \(\log^2 N\) factor in the runtime of Algorithm 3 is inherited from Proposition 24, which in turn inherits it from Lemma 2.
Proof of Proposition 26. The algorithm has two consecutive loops:
The first loop (Line [alg:omega-panda-express:outer:loop1] of Algorithm [alg:omega-panda-express:outer:loop1]) iterates over every \(f \in \mathcal{F}\) and \(g_f \in \mathcal{G}_f\), where the sizes of \(\mathcal{F}\) and \(\mathcal{G}_f\) are constant in data complexity. The only data-dependant operation in this loop is computing a \(B\)-probabilistic model for an \(\omega\)-DDR of the form 91 using Theorem 15, which takes time \(O(B \cdot \log N) = O(\overline{B} \cdot \log N)= O(N^{\textsf{\omega-subw}(Q)}\cdot \log N)\).
The second loop (Line [alg:omega-panda-express:outer:loop2] of Algorithm 3) iterates over every target selector \(\mathcal{T}\), where the number of target selectors is also a constant in data complexity. For each target selector \(\mathcal{T}\), we compute \(Q_\mathcal{T}\) from Eq. ?? using Proposition 24 in time \(O(\overline{B} \cdot \log^2 N) = O(N^{\textsf{\omega-subw}(Q)}\cdot \log^2 N)\).
◻
◻
None
Figure 5: The \(\omega\)-submodular width of the 4-cycle query \(Q_{\square}\) (Eq. 4 ), expanded by distributing \(\min\) over \(\max\) in Eq. 99 ..
None
Figure 6: The \(\omega\)-DDRs of the form 91 for the 4-cycle query \(Q_{\square}\) from Eq. 4 . All the \(\omega\)-DDRs have the same body \(R(X, Y) \wedge S(Y, Z) \wedge T(Z, W) \wedge U(W, X)\), which is abbreviated as \(\cdots\). Note that each one of the 36 \(\omega\)-DDRs mirrors one the 36 \(\max\)-terms in the expression for \(\textsf{\omega-subw}(\mathcal{H}_{\square})\) from Figure 5. There are \(4^{36}\) target selectors, one of them is . See the discussion in Section 7.8 for how this target selector supports an \(\omega\)-query plan..
Consider the 4-cycle BCQ \(Q_\square\) from Eq. 4 . As explained earlier in Table 2, the \(\omega\)-submodular width of \(Q_\square\) is exactly \(2 - \frac{3}{2\cdot \min\{\omega,\frac{5}{2}\}+1}\). See Lemma 8 in the Appendix for a proof. When \(\omega \leq 5/2\), this expression simplifies to \(\frac{4\omega-1}{2\omega+1}\), thus matching the exponent in the runtime \(O\left(N^{\frac{4\omega-1}{2\omega+1}}\right)\) from prior work [18], [21], as shown in Table 1. In contrast, when \(\omega \geq 5/2\), the expression simplifies to \(3/2\), thus matching the exponent in the well-known runtime \(O\left(N^{3/2}\right)\) from [5], [15].
The hypergraph of \(Q_\square\) is as follows: \[\begin{align} \mathcal{H}_{\square}= (\{X,Y,Z,W\},\quad \{\{X,Y\}, \{Y,Z\}, \{Z,W\}, \{W,X\}\}) \label{eq:4cycle:H} \end{align}\tag{98}\] The corresponding \(\omega\)-submodular width expression from Eq. ?? is: \[\begin{align} \textsf{\omega-subw}(\mathcal{H}_{\square}) = \max_{h \in \Gamma \cap \mathsf{ED}} \min \bigl(& \max(\min(h(XYZ), \mathsf{MM}(X; Y; Z)), \min(h(ZWX), \mathsf{MM}(Z; W; X))),\nonumber\\ &\max(\min(h(YZW), \mathsf{MM}(Y; Z; W)), \min(h(WXY), \mathsf{MM}(W; X; Y))) \bigr)& \label{eq:osubw:4cycle} \end{align}\tag{99}\] In particular, Eq. 99 suggests that the 4-cycle query \(Q_{\square}\) admits basically two kinds of \(\omega\)-query plans:
\(\omega\)-query plans that start by eliminating either \(Y\) or \(W\):
Eliminating \(Y\) involves the variables \(X, Y, Z\) and can be done by either a join or an MM.
Eliminating \(W\) involves the variables \(Z, W, X\) and can also be done by either a join or an MM.
\(\omega\)-query plans that start by eliminating either \(X\) or \(Z\):
Eliminating \(Z\) involves the variables \(Y, Z, W\) and can be done by either a join or an MM.
Eliminating \(X\) involves the variables \(W, X, Y\) and can also be done by either a join or an MM.
By distributing every \(\min\) over inner \(\max\) in Eq. 99 following Eq. 37 , we get the expression for \(\textsf{\omega-subw}(\mathcal{H}_{\square})\) given in Figure 5, which has 36 terms of the form \(\max_{h \in \Gamma \cap \mathsf{ED}}\cdots\). Each one of these 36 terms is upper bounded by \(\textsf{\omega-subw}(\mathcal{H}_{\square})\). Moreover, each one of these terms corresponds to an \(\omega\)-DDR of the form 91 . The 36 \(\omega\)-DDRs are depicted in Figure 6. Each \(\omega\)-DDR has four targets: two join targets and two MM targets. Recall that in an MM target, e.g., \((S_1(X) \wedge T_1(Y) \wedge W_1(Z))\), the relations \(S_1\) and \(T_1\) are interchangeable whereas \(W_1\) plays a distinct role in the definition of a \(B\)-probabilistic model for this MM target (Definition 12). A target selector \(\mathcal{T}\) picks one target from each of the 36 \(\omega\)-DDRs, hence the total number of target selectors is \(4^{36}\). Proposition 21 guarantees that if we pick any of those target selectors, then at least one of the above \(\omega\)-query plans will be supported. For example, consider the highlighted target selector in Figure 6. This target selector is chosen carefully to avoid supporting any \(\omega\)-query plan that starts with eliminating \(Y\) or \(W\). However, while constructing such a target selector, eventually we run out of options and we end up being cornered into supporting some other \(\omega\)-query plan. In this particular case, we end up supporting the \(\omega\)-query plan that starts with eliminating \(Z\) by a join \(h(YZW)\) and eliminating \(X\) by an MM \(\mathsf{MM}(W; X; Y)\). This is the only supported \(\omega\)-query plan for this target selector.
Suppose for now that we already evaluated the \(\omega\)-DDRs from Figure 6; we will come back shortly to explain how to evaluate them. In order to evaluate the original BCQ \(Q_{\square}\), the algorithm is to go over the target selectors, and for each one, to use the supported \(\omega\)-query plan to evaluate \(Q_{\square}\) filtered by the targets in this \(\omega\)-query plan, which are a subset of the targets in the target selector. Completeness follows from Proposition 23, which guarantees that if we compute a \(\overline{B}\)-probabilistic model for each of the 36 \(\omega\)-DDRs, then every tuple \(\boldsymbol{t} \in \mathlarger{\mathlarger{\mathlarger{\Join}}}\Sigma_\text{\sf in}\) is accounted for by some target selector.
We now explain briefly how to evaluate the \(\omega\)-DDRs from Figure 6. Let’s pick the eighth \(\omega\)-DDR as an example: \[\begin{gather} P_{8}(XYZ) \quad\vee\quad (S_{8}(X) \wedge T_{8}(Z) \wedge W_{8}(Y)) \quad\vee\quad P'_{8}(YZW) \quad\vee\quad (S'_{8}(Y) \wedge T'_{8}(W) \wedge W'_{8}(Z)) \text{ :- }\\ R(X, Y) \wedge S(Y, Z) \wedge T(Z, W) \wedge U(W, X) \label{eq:omega-ddr:4cycle:example} \end{gather}\tag{100}\] The corresponding term from Figure 5 is \(\text{highlighted}\). We repeat it below: \[\begin{align} \max_{h \in \Gamma \cap \mathsf{ED}}\quad\min(h(XYZ),\quad h(X) + \gamma h(Y) + h(Z),\quad h(YZW),\quad h(Y) + \gamma h(Z) + h(W)) \label{eq:osubw:4cycle:example} \end{align}\tag{101}\] By the equation from Figure 5, we know that the quantity in Eq. 101 is upper bounded by \(\textsf{\omega-subw}(\mathcal{H}_{\square})\), which is \(\frac{4\omega-1}{2\omega+1}\) assuming \(\omega \leq 5/2\). In this particular case, the quantity from Eq. 101 is exactly the \(\omega\)-submodular width. This quantity is equivalent to the optimal objective value of the following linear program of the form 39 : \[\begin{align} \max_{t, \boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \bigl\{ t \quad\mid\quad &t \leq h(XYZ),\nonumber\\ &t \leq h(X) + \gamma h(Y) + h(Z),\nonumber\\ &t \leq h(YZW),\nonumber\\ &t \leq h(Y) + \gamma h(Z) + h(W) \bigr\} \label{eq:osubw:4cycle:lp} \end{align}\tag{102}\] Lemma 3 suggests that the optimal dual solution to the above LP corresponds to the following \(\omega\)-Shannon-flow inequality: \[\begin{gather} (\omega-1) h(XYZ) + \omega h(YZW) + (h(X) + \gamma h(Y) + h(Z)) + (h(Y) + \gamma h(Z) + h(W)) \leq\\ \omega h(XY) + (2\omega-2) h(YZ) + \omega h(ZW) + h(WX) \label{eq:osubw:4cycle:shannon-flow} \end{gather}\tag{103}\] Note that the RHS of the above inequality is upper bounded by \(4\omega-1\) because \(\boldsymbol{h}\in\mathsf{ED}\). Moreover, the LHS is lower bounded by \((2\omega+1)t\). Hence, this inequality proves that \(t\) is upper bounded by \(\frac{4\omega-1}{2\omega+1}\), which is the optimal objective value of the LP from 102 . Inequality 103 is a Shannon inequality specifically because it is a sum of the following basic Shannon inequalities: \[\begin{align} &h(XY) + h(WX) - h(X) - h(XYW) \geq 0\\ &h(XYW) - h(YW) \geq 0\\ &h(YW) + h(ZW) - h(W) - h(YZW) \geq 0\\ &(\omega-1)h(XY) + (\omega-1)h(YZ) - (\omega-1)h(Y) - (\omega-1)h(XYZ) \geq 0\\ &(\omega-1)h(YZ) + (\omega-1)h(ZW) - (\omega-1)h(Z) - (\omega-1)h(YZW) \geq 0 \end{align}\] By Theorem 15, the \(\textsf{\omega-PANDAExpress}\) algorithm (Algorithm 4) takes inequality 103 along with the collection \(\mathcal{P}\) of sub-probability measures from Eq. 74 which correspond to the RHS of 103 , and computes a \(B\)-probabilistic model for the \(\omega\)-DDR from Eq. 100 , where \(B = N^{\frac{4\omega-1}{2\omega+1}}=N^{\textsf{\omega-subw}(Q_{\square})}\), in time \(O(B \cdot \log N)\). The other \(\omega\)-DDRs from Figure 6 are evaluated similarly.
Fast matrix multiplication has recently attracted a lot of attention in the database community for processing join-project queries. Let \(\textsf{OUT}\) be the number of query results. Note that for Boolean conjunctive queries that we study in this paper, the output is a Boolean value, hence \(\textsf{OUT}= 1\). Let \(\overline{\omega} (a,b,c)\) be the smallest exponent for multiplying two rectangular matrices of dimensions \(n^a \times n^b\) and \(n^b \times n^c\) within \(O\left(n^{ \overline{\omega} (a,b,c)}\right)\) time. For the purpose of analyzing the complexity of rectangular matrix multiplication, several constants have been defined, namely, \(\alpha \le 1\) defined as the largest constant such that \(\overline{\omega} (1,\alpha,1)=2\), and \(\mu\) defined as the (unique) solution to the equation \(\overline{\omega} (\mu, 1, 1) = 2\mu + 1\). Note that \(\alpha = 1\) if and only if \(\omega=2\), and the current best bounds on \(\alpha\) are \({0.321334 <} \alpha \le 1\) [29]. Moreover, \(\mu = \frac{1}{2}\) if \(\omega=2\), and the current best bounds on \(\mu\) are \(\frac{1}{2} \le \mu {< 0.527661}\) [29]. Amossen and Pagh [30] first proposed an algorithm for the Boolean matrix multiplication by using fast matrix multiplication techniques, which runs in \(\tilde{O}\left(N^{\frac{2}{3}}\cdot \textsf{OUT}^{\frac{2}{3}} + N^{\frac{(2-\alpha)\omega -2}{(1+\omega)(1-\alpha)}} \cdot \textsf{OUT}^{\frac{2-\alpha \omega}{(1+\omega)(1-\alpha)}} +\textsf{OUT}\right)\) time when \(\textsf{OUT}\ge N\), and \(\tilde{O}\left(N \cdot \textsf{OUT}^{\frac{\omega-1}{\omega+1}}\right)\) time when \(\textsf{OUT}< N\), where \(\tilde{O}\) hides a factor of \(O(N^{o(1)})\). If \(\omega = 2\), this result degenerates to \(\tilde{O}\left(N^{\frac{2}{3}}\cdot \textsf{OUT}^{\frac{2}{3}} + N\cdot \textsf{OUT}^{\frac{1}{3}}\right)\). Very recently, Abboud et al. [31] have completely improved this to \(O\left(N \cdot \textsf{OUT}^{\frac{\mu}{1+\mu}} + \textsf{OUT}+ N^{\frac{(2+\alpha)\mu}{1+\mu}} \cdot \textsf{OUT}^{\frac{1-\alpha \mu}{1+\mu}}\right)\). If \(\omega = 2\), this complexity can be simplified to \(O\left(N \cdot \textsf{OUT}^{\frac{1}{3}} + \textsf{OUT}\right)\). On the other hand, improving this result for any value of \(\textsf{OUT}\) is rather difficult, assuming the hardness of the all-edge-triangle problem [31]. Many algorithms have been proposed for Boolean matrix multiplication, whose complexity is also measured by the domain size of attributes; we refer readers to [31] for details. Deep et al. [32] and Huang et al. [33] also investigated the efficient implementation of these algorithms on sparse matrix multiplication in practice. Very recently, Hu [34] first applied fast matrix multiplication to speed up acyclic join-project queries and showed a large polynomial improvement over the combinatorial Yannakakis algorithm [28]. As an independent line of research, fast matrix multiplication has been extensively used in the algorithm community to speed up detecting, counting, and listing subgraph patterns, such as cliques [15], [19], [35] and cycles [36]. In addition, this technique has been used to approximately count triangles [37] and cycles [38], k-centering in graphs [39], etc.
We proposed a general framework for evaluating Boolean conjunctive queries that naturally subsumes both combinatorial and non-combinatorial techniques under the umbrella of information theory. Our framework generalizes the notion of submodular width by incorporating matrix multiplication, and provides a matching algorithm for evaluating queries in the corresponding time complexity. Using this framework, we show how to recover the best known complexity for various classes of queries as well as improve the complexity for some of them.
Our framework can be straightforwardly extended from Boolean conjunctive queries to count and sum queries, albeit without free variables. In particular, in the combinatorial world, the transition from Boolean to count/sum queries (and more generally to aggregate queries over any semiring) is done by adapting the submodular width to become the Sharp-submodular width [40]. The latter is a variant of the submodular width that is obtained by relaxing the notion of polymatroids. In the presence of matrix multiplication, a similar transition from Boolean to count/sum queries is possible by adapting the \(\omega\)-submodular width to become the Sharp-\(\omega\)-submodular width. Nevertheless, this transition only applies to count/sum queries, i.e., aggregate queries over the semiring of real numbers \((\mathbb{R}, +, \times)\), and does not extend to aggregate queries over other semirings like the tropical semiring \((\mathbb{R}_+, \min, +)\), since fast matrix multiplication does not apply in the latter.
It is not clear how to extend our framework to full conjunctive queries due to the use of fast matrix multiplication. For example, consider the full version of the triangle query from Eq. 2 where we replace the head \(Q_\triangle()\) with \(Q_\triangle(X, Y, Z)\). While we could use matrix multiplication between \(S\) and \(T\) to compute the number of triangles containing every edge \((X, Y)\) in \(R\), the multiplication result cannot help us recover a list of those triangles. Nevertheless, we could still use this multiplication result to answer the version of the query where the head is \(Q_\triangle(X, Y)\). Prior results from Table 1 are not known to apply to the corresponding full conjunctive queries with an additional \(+O(\textsf{OUT})\) factor in the runtime where \(\textsf{OUT}\) is the output size. We leave characterizing (non-full) conjunctive queries that can benefit from fast matrix multiplication as an open problem.
We summarize here how to compute the submodular width of a given hypergraph \(\mathcal{H}=(\mathcal{V},\mathcal{E})\), as defined in Eq. 20 . To that end, we need to apply a couple of tricks. Let \(\mathcal{T}(\mathcal{H}) =\) \(\{(T_1, \chi_1), (T_2, \chi_2), \ldots,\) \((T_K, \chi_K)\}\) be the list of all tree decompositions of \(\mathcal{H}\). Let \(\boldsymbol{t} = (t_1, t_2, \ldots, t_K) \in \text{\sf nodes}(T_1)\times\ldots\times \text{\sf nodes}(T_K)\) denote a tuple of nodes, one from each tree decomposition. (Note that \(t_1, \ldots, t_K\) are not nodes from the same tree decomposition.) By distributing16 the min over the max in Eq. 20 , we can equivalently write (where \([K]\) denotes \(\{1, \ldots, K\}\)): \[\begin{align} \textsf{subw}(\mathcal{H}) &\quad\stackrel{\mathrm{def}}{=}\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{(T,\chi) \in \mathcal{T}(\mathcal{H})}\quad \max_{t \in \text{\sf nodes}(T)}\quad h(\chi(t))\nonumber\\ &\quad=\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \max_{\substack{(t_1, \ldots, t_K)\in\\\text{\sf nodes}(T_1)\times\ldots\times\text{\sf nodes}(T_K)}}\quad \min_{i \in [K]}\quad h(\chi_i(t_i))\tag{104}\\ &\quad=\quad \max_{\substack{(t_1, \ldots, t_K)\in\\\text{\sf nodes}(T_1)\times\ldots\times\text{\sf nodes}(T_K)}}\quad \underbrace{\max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{i \in [K]}\quad h(\chi_i(t_i))}_{\text{Equivalent to LP~\eqref{eq:subw:lp}}}\tag{105} \end{align}\] Eq. 105 follows by swapping the two max operators in Eq. 104 . Now for a fixed tuple \((t_1, \ldots, t_K)\), consider the inner optimization problem: \[\begin{align} \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad \min_{i \in [K]}\quad h(\chi_i(t_i)) \label{eq:subw:pre-lp} \end{align}\tag{106}\] Although the constraints \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\) are linear, Eq. 106 is still not a linear program (LP) because the objective is a minimum of linear functions. However, we can convert 106 into an LP by introducing a new variable \(w\) that is upper bounded by each term in the minimum: \[\begin{align} \max_{w, \boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\{ w\mid w \leq h(\chi_1(t_1)), \ldots, w \leq h(\chi_K(t_K)) \} \label{eq:subw:lp} \end{align}\tag{107}\] As a result, computing the submodular width can be reduced to taking the maximum solution of a finite number of LPs, one for each tuple \((t_1, \ldots, t_K) \in \text{\sf nodes}(T_1)\times\ldots\times\text{\sf nodes}(T_K)\).
Example 17. Consider the 4-cycle hypergraph from Example 2. The submodular width of this hypergraph can be computed by considering the two tree decompositions \((T_1, \chi_1)\) and \((T_2,\chi_2)\) from Example 2. Applying Eq. 20 , we get: \[\begin{align} \textsf{subw}(\mathcal{H}) = \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \min( \max(h(ABC), h(CDA)), \max(h(BCD), h(DAB)) ) \end{align}\] By distributing the min over the inner max and then swapping the two max operators, we get: \[\begin{align} \textsf{subw}(\mathcal{H}) = \max\biggl( &\max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \min(h(ABC), h(BCD)),\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \min(h(ABC), h(DAB)),\\ &\max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \min(h(CDA), h(BCD)),\quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \min(h(CDA), h(DAB))\biggr) \end{align}\] Let’s take the first term inside the max as an example \(\max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}} \min(h(ABC), h(BCD))\). This term is equivalent to the following LP: \[\begin{align} \max_{w, \boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\{ w\mid w \leq h(ABC), w \leq h(BCD) \} \end{align}\] The above LP has an optimal objective value of \(3/2\). The other three terms inside the max are similar. Therefore, the submodular width of the 4-cycle hypergraph is \(3/2\).
We show here how to compute the \(\omega\)-submodular width for the classes of queries that are given by Table 2 in Section 5. We start with some preliminaries:
Definition 18 (Fractional Edge Covering Number). For a hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\), a fractional edge covering is a function \(W:\mathcal{E}\to [0,1]\) such that \(\sum_{e \in \mathcal{E}: X \in e} W(e) \ge 1\) holds for each vertex \(X \in \mathcal{V}\). The fractional edge covering number of \(\mathcal{H}\), denoted as \(\rho^*(\mathcal{H})\), is defined as the minimum weight assigned to hyperedges over all possible fractional edge covering, i.e., \(\rho^*(\mathcal{H}) = \min_{W} \sum_{e \in \mathcal{E}} W(e)\).
Proposition 27. In any hypergraph \(\mathcal{H}=(\mathcal{V},\mathcal{E})\), for any polymatroid \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\), \(h(\mathcal{V}) \le \rho^*(\mathcal{H})\).
Proposition 28. In a \(k\)-clique hypergraph \(\mathcal{H}= (\{X_1,X_2,\cdots,X_k\}, \{\{X_i,X_j\}: i,j \in [k], i \neq j\})\), for any generalized elimination ordering \(\overline{\boldsymbol{\sigma}} \in \pi(\mathcal{V})\) and any \(i \in[\overline{\boldsymbol{\sigma}}]\), \(U^{\overline{\boldsymbol{\sigma}}}_i \subseteq \mathcal{V}= U^{\overline{\boldsymbol{\sigma}}}_1\).
From Proposition 28 and Definition 6, we can simplify \(\textsf{\omega-subw}\) for clique hypergraphs \(\mathcal{H}\) as below: \[\begin{align} {\textsf{\omega-subw}}(\mathcal{H}) \quad = \quad \max_{\boldsymbol{h} \in \Gamma \cap \mathsf{ED}}\quad {\min\left(h(\mathcal{V}), \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1\right)} \label{eq:osubw:trimmed:clique} \end{align}\tag{108}\]
Proposition 29. In a clique hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\), with a polymatroid \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\) such that \(h(\boldsymbol{A} | \boldsymbol{B}) = h(\boldsymbol{A})\) for arbitrary \(\boldsymbol{A}, \boldsymbol{B}\subseteq \mathcal{V}\) with \(\boldsymbol{A} \cap \boldsymbol{B} = \emptyset\), for any generalized elimination ordering \(\overline{\boldsymbol{\sigma}} \in \pi(\mathcal{V})\), \[{\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \min_{(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}) \textsf{ is a partition of } \mathcal{V}} \mathsf{MM}(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C})}\]
Proof. The direction \(\displaystyle{\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \ge \min_{(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}) \textsf{ is a partition of } \mathcal{V}} \mathsf{MM}(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C};\emptyset)}\) follows (5). Below, we focus on: \[\begin{align} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 & = \min_{(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}, \boldsymbol{D}) \textsf{ is a partition of } \mathcal{V}} \mathsf{MM}(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}|\boldsymbol{D})\\ & = \min_{(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}, \boldsymbol{D}) \textsf{ is a partition of } \mathcal{V}} \min \begin{cases} \gamma h(\boldsymbol{A}|\boldsymbol{D}) + h(\boldsymbol{B}|\boldsymbol{D}) + h(\boldsymbol{C}|\boldsymbol{D}) + h(\boldsymbol{D}) & \\ h(\boldsymbol{A}|\boldsymbol{D}) + \gamma h(\boldsymbol{B}|\boldsymbol{D}) + h(\boldsymbol{C}|\boldsymbol{D}) + h(\boldsymbol{D}) & \\ h(\boldsymbol{A}|\boldsymbol{D}) + h(\boldsymbol{B}|\boldsymbol{D}) + \gamma h(\boldsymbol{C}|\boldsymbol{D}) + h(\boldsymbol{D}) & \\ \end{cases} \\ & = \min_{(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}, \boldsymbol{D}) \textsf{ is a partition of } \mathcal{V}} \min \begin{cases} \gamma h(\boldsymbol{A}) + h(\boldsymbol{B}) + h(\boldsymbol{C}) + h(\boldsymbol{D}) & \\ h(\boldsymbol{A}) + \gamma h(\boldsymbol{B}) + h(\boldsymbol{C}) + h(\boldsymbol{D}) & \\ h(\boldsymbol{A}) + h(\boldsymbol{B}) + \gamma h(\boldsymbol{C}) + h(\boldsymbol{D}) & \\ \end{cases} \\ &\le \min_{(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}, \boldsymbol{D}) \textsf{ is a partition of } \mathcal{V}} \min \begin{cases} \gamma h(\boldsymbol{A}) + h(\boldsymbol{B}) + h(\boldsymbol{C}\boldsymbol{D})& \\ h(\boldsymbol{A}) + \gamma h(\boldsymbol{B}) + h(\boldsymbol{C} \boldsymbol{D}) & \\ h(\boldsymbol{A}) + h(\boldsymbol{B}) + \gamma h(\boldsymbol{C} \boldsymbol{D}) & \\ \end{cases} \\ & = \min_{(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}) \textsf{ is a partition of } \mathcal{V}} \mathsf{MM}(\boldsymbol{A}, \boldsymbol{B}, \boldsymbol{C}) \end{align}\] Together, we have completed the proof. ◻
Lemma 4. For the 3-clique hypergraph as defined in (2 ), \(\textsf{\omega-subw}(\mathcal{H}) =\frac{2\omega}{\omega+1}\).
Proof. Direction \(\textsf{\omega-subw}(\mathcal{H}) \le \frac{2\omega}{\omega+1}\). We partition all polymatroids \(h \in \Gamma \cap \mathsf{ED}\) into the following two cases:
Case 1: there exists a pair of vertices with their conditional entropy is smaller than \(\frac{\omega-1}{\omega+1}\), say \(h(Y|X)\le \frac{\omega-1}{\omega+1}\). In this case, we have \(h(XYZ) = h(ZX) + h(Y|ZX) \le h(ZX) + h(Y|X) \le 1 + \frac{\omega-1}{\omega+1} = \frac{2\omega}{\omega+1}\), where \(h(Y|ZX) \le h(Y|X)\) follows the sub-modularity of \(h\) and \(h(ZX) \le 1\) follows the edge-domination of \(h\).
Case 2: None of the above, i.e., for each pair of vertices, their conditional entropy is larger than \(\frac{\omega-1}{\omega+1}\). As \(h(Y|X) > \frac{\omega-1}{\omega+1}\) and \(h(XY) \le 1\), we have \(h(X) = h(XY) - h(Y|X) \le 1 - \frac{\omega-1}{\omega+1} = \frac{2}{\omega+1}\). Similarly, we have \(h(Y), h(Z) \le \frac{2}{\omega+1}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}}= (\{X\},\{Y\},\{Z\})\). We have \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(Y;Z;X) = \frac{2\omega}{\omega+1}\) by choosing \(\mathcal{A}= \{\{X,Y\}\}\) and \(\mathcal{B}= \{\{X,Z\}\}\).
Direction \(\textsf{\omega-subw}(\mathcal{H}) \ge \frac{2\omega}{\omega+1}\). We identify a polymatroid \(\boldsymbol{h}\) below. Let \(a,b,c,d\) be independently random variables with \(h(a)=h(b)=h(c) =\frac{\omega-1}{\omega+1}\) and \(h(d)=\frac{3-\omega}{\omega+1}\). Let \(X = (ad), Y =(bd), Z=(cd)\).
\(h(X) = h(Y) = h(Z) =\frac{2}{\omega+1}\);
\(h(XY) = h(XZ) = h(YZ)= 1\);
\(h(XYZ) = \frac{2\omega}{\omega+1}\).
Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} = (\{X\}, \{Y\}, \{Z\})\), \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \mathsf{MM}(Y,Z,X) = \frac{2\omega}{\omega+1}\). Hence, \(\displaystyle{{\min\left(h(\mathcal{V}), \min_{\overline{\boldsymbol{\sigma}} \in \overline{\pi}(\mathcal{V})} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1\right)}}=\) \(\frac{2\omega}{\omega+1}\) holds for \(\boldsymbol{h}\). From (108 ), we conclude \(\textsf{\omega-subw}(\mathcal{H}) \ge \frac{2\omega}{\omega+1}\). The other generalized elimination orderings are the same. ◻
Lemma 5. For the 4-clique hypergraph as defined in (30 ), \(\textsf{\omega-subw}(\mathcal{H}) = \frac{\omega+1}{2}\).
Proof. Direction \(\textsf{\omega-subw}(\mathcal{H}) \le \frac{\omega+1}{2}\). We partition all polymatroids \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\) into the following two cases:
Case 1: there exists a vertex such that its all conditional entropies are smaller than \(\frac{1}{2}\), say, \(W\) is such a vertex with \(h(X|W), h(Y|W), h(Z|W) \le \frac{1}{2}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}}= (\{X\},\{Y\},\{Z\},\{W\})\). By choosing \(\mathcal{A}= \{\{X,W\}, \{Y,W\}\}\) and \(\mathcal{B}= \{\{X,W\}, \{Z,W\}\}\),
\[\begin{align} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(Y; Z; X|W) &= \max\begin{cases} \gamma h(Y|W) + h(X|W) + h(Z|W) +h(W)&\\ h(Y|W) + \gamma h(Z|W) + h(X|W) +h(W)&\\ h(Y|W) + h(Z|W) + \gamma h(X|W) + h(W)&\end{cases} \le \frac{\gamma}{2} + \frac{1}{2} +1 = \frac{\omega+1}{2}. \end{align}\] Case 2: None of the above, i.e., each vertex has at least one conditional entropy larger than \(\frac{1}{2}\). Wlog, suppose \(h(Y|X) > \frac{1}{2}\). As \(h(XY) \le 1\), we have \(h(X) = h(XY) - h(Y|X) < 1 - \frac{1}{2} = \frac{1}{2}\). Similarly, we have \(h(Y), h(Z), h(W) < \frac{1}{2}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}}=(\{X\},\{Y\},\{Z\},\{W\})\). We have \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(Y; Z; X|W) =\frac{\omega+1}{2}\).
Direction \(\textsf{\omega-subw}(\mathcal{H}) \ge \frac{\omega+1}{2}\). We identify a polymatroid \(\boldsymbol{h}\in \Gamma \cap \mathsf{ED}\) as follows: let \(X,Y,Z,W\) be independently random variables with \(h(X) = h(Y) = h(Z) = h(W) =\frac{1}{2}\). Then, we have \(h(\mathcal{V}) = 2\). From Proposition 29, for an arbitrary generalized elimination ordering \(\overline{\boldsymbol{\sigma}} \in \pi(\mathcal{V})\), \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \frac{\omega+1}{2}\). From (108 ), we conclude \(\textsf{\omega-subw}(\mathcal{H}) \ge \frac{\omega+1}{2}\). ◻
Lemma 6. For the following 5-clique hypergraph \(\mathcal{H}\), \(\textsf{\omega-subw}(\mathcal{H}) =\frac{\omega}{2} + 1\). \[\begin{align} \mathcal{H}= (\{X, Y, Z, W, L\}, \{\{X, Y\}, \{X, Z\}, \{X, W\}, \{X, L\}, \{Y, Z\}, \{Y, W\}, \{Y, L\}, \{Z, W\}, \{Z, L\}, \{W, L\}\}) \label{eq:H:5clique} \end{align}\tag{109}\]
Proof. Direction \(\textsf{\omega-subw}(\mathcal{H}) \le \frac{\omega}{2}+1\). We partition all polymatroids \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\) into the following five cases:
Case 1: there exists a vertex such that all its conditional entropies are smaller than \(\frac{1}{2}\), say, \(L\) is such a vertex with \(h(X|L), h(Y|L), h(Z|L), h(W|L) \le \frac{1}{2}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}}= (\{X\},\{YZ\},\{W\},\{L\})\). By choosing \(\mathcal{A}= \{\{X,W\}, \{Y,W\}, \{X,L\}\}\) and \(\mathcal{B}= \{\{X,W\}, \{Z,W\}\}\), \[\begin{align} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(YZ, W, X|L) & = h(YZ) + \gamma \cdot \min\{h(W|L), h(X|L)\} + \max\{h(W|L), h(X|L)\} + h(L)\\ & \le 1 +\frac{\gamma}{2} + 1 = \frac{\omega}{2}+1. \end{align}\]
Case 2: None of the above, i.e., each vertex has at least one conditional entropy larger than \(\frac{1}{2}\). Suppose \(h(Y|X) > \frac{1}{2}\) for vertex \(x\). As \(h(XY) \le 1\), we have \(h(X) = h(XY) - h(Y|X) < 1 - \frac{1}{2} = \frac{1}{2}\). Similarly, we have \(h(Y), h(Z), h(W), h(L) < \frac{1}{2}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}}= (\{X\},\{Y\},\{Z\},\{W\},\{L\})\). We have \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(YZ; WL; X) \le \frac{\omega}{2}+1\).
Direction \(\textsf{\omega-subw}(\mathcal{H}) \ge \frac{\omega}{2}+1\). We identify a polymatroid \(\boldsymbol{h}\in \Gamma \cap \mathsf{ED}\) as follows: let \(X,Y,Z,W,L\) be independently random variables with \(h(X) = h(Y) = h(Z) = h(W) = h(L) = \frac{1}{2}\). Then, we have \(h(\mathcal{V}) = \frac{5}{2}\). From Proposition 29, for an arbitrary generalized elimination ordering \(\overline{\boldsymbol{\sigma}} \in \pi(\mathcal{V})\), \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \frac{\omega}{2} + 1\). ◻
Lemma 7. For a \(k\)-clique hypergraph \(\mathcal{H}=(\mathcal{V}, \mathcal{E})\) for \(k \ge 6\), where \(\mathcal{V}= \{X_1,X_2,\cdots, X_k\}\) and \(\mathcal{E}= \{\{X_i, X_j\}: i,j \in [k], i \neq j\}\), \(\textsf{\omega-subw}(\mathcal{H}) = \frac{1}{2} \cdot \lceil \frac{k}{3}\rceil + \frac{1}{2} \cdot \lceil \frac{k-1}{3}\rceil + \frac{1}{2} \cdot \lfloor \frac{k}{3}\rfloor \cdot (\omega-2)\).
Proof. Direction \(\textsf{\omega-subw}(\mathcal{H}) \le \frac{1}{2} \cdot \lceil \frac{k}{3}\rceil + \frac{1}{2} \cdot \lceil \frac{k-1}{3}\rceil + \frac{1}{2} \cdot \lfloor \frac{k}{3}\rfloor \cdot (\omega-2)\). Let \(i= \lfloor \frac{k}{3}\rfloor\) and \(j = \lceil \frac{k-1}{3}\rceil\). Let \(\boldsymbol{X} = \{X_1,\cdots,X_i\}\), \(\boldsymbol{Y} = \{X_{i+1}, \cdots, X_{i+j}\}\) and \(\boldsymbol{Z} = \{X_{i+j+1},\cdots, X_k\}\). we consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}}=(\boldsymbol{X}, \boldsymbol{Y}, \boldsymbol{Z})\). Implied by Proposition 27, \(h(\boldsymbol{X}) \le \frac{1}{2} \cdot \lfloor \frac{k}{3} \rfloor\), \(h(\boldsymbol{Y}) \le \frac{1}{2} \cdot \lceil \frac{k-1}{3} \rceil\), and \(h(\boldsymbol{Z}) \le \frac{1}{2} \cdot \lceil \frac{k}{3} \rceil\). \[\begin{align} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(\boldsymbol{Y}; \boldsymbol{Z}; \boldsymbol{X}) = h(\boldsymbol{Y}) + h(\boldsymbol{Z}) + \gamma h(\boldsymbol{X}) = \frac{1}{2} \cdot \lceil \frac{k}{3}\rceil + \frac{1}{2} \cdot \lceil \frac{k-1}{3}\rceil + \frac{1}{2} \cdot \lfloor \frac{k}{3}\rfloor \cdot (\omega-2) \end{align}\]
Direction \(\textsf{\omega-subw}(\mathcal{H}) \ge \frac{1}{2} \cdot \lceil \frac{k}{3}\rceil + \frac{1}{2} \cdot \lceil \frac{k-1}{3}\rceil + \frac{1}{2} \cdot \lfloor \frac{k}{3}\rfloor \cdot (\omega-2)\). We identify a polymatroid \(\boldsymbol{h}\) as follows: let \(X_1,X_2,\cdots, X_k\) be independently random variables with \(h(X_i) = \frac{1}{2}\) for \(i \in [k]\). Then, we have \(h(\mathcal{V}) = \frac{k}{2}\). From Proposition 29, for an arbitrary generalized elimination ordering \(\overline{\boldsymbol{\sigma}} \in \pi(\mathcal{V})\), \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \frac{1}{2} \cdot \lceil \frac{k}{3}\rceil + \frac{1}{2} \cdot \lceil \frac{k-1}{3}\rceil + \frac{1}{2} \cdot \lfloor \frac{k}{3}\rfloor \cdot (\omega-2)\). From (108 ), we conclude \(\textsf{\omega-subw}(\mathcal{H}) \ge \frac{\omega}{2} + 1\). ◻
Lemma 8. For the following hypergraph representing a \(4\)-cycle \(\mathcal{H}\), \(\textsf{\omega-subw}(\mathcal{H}) = 2 -\frac{3}{2 \cdot \min\{\omega, \frac{5}{2}\} + 1}\). \[\begin{align} \mathcal{H}= (\{X,Y,Z,W\},\quad \{\{X,Y\}, \{Y,Z\}, \{Z,W\}, \{W,X\}\}) \label{eq:H:4cycle} \end{align}\tag{110}\]
Proof. Direction \(\textsf{\omega-subw}(\mathcal{H}) \le 2 -\frac{3}{2 \cdot \min\{\omega, \frac{5}{2}\} + 1}\). For simplicity, for vertex \(X\), we denote \(h(Y|X)\), \(h(W|X)\) as the neighboring conditional entropy of \(X\). Similar denotations apply to \(Y,Z,W\). We partition all polymatroids \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\) into the following four cases:
Case 1: each vertex has some neighboring conditional entropy larger than \(\Delta\). Wlog, assume vertex \(X\) has \(h(Y|X) > \Delta\). As \(h(XY) \le 1\), we have \(h(X) = h(XY) - h(Y|X) \le 1 - \Delta\). Similarly, we can show \(h(Y), h(Z), h(W) < 1- \Delta\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} = (\{X\},\{Z\}, \{Y\}, \{W\})\). By choosing \(\mathcal{A}= \{\{X,Y\}\}\) and \(\mathcal{B}= \{\{X,W\}\}\), we have \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(Y;W;X) \le \omega(1-\Delta)\). Meanwhile, \(h\left(U^{\overline{\boldsymbol{\sigma}}}_1\right) = h(XYW) \le h(XY)+ h(W) \le 2 - \Delta\). By choosing \(\mathcal{A}= \{\{Z,Y\}\}\) and \(\mathcal{B}= \{\{Z,W\}\}\), we have \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_2 \le \mathsf{MM}(Y;W;Z) \le \omega(1-\Delta)\). Meanwhile, \(h\left(U^{\overline{\boldsymbol{\sigma}}}_2\right) = h(YZW) \le h(YZ)+ h(W) \le 2 - \Delta\). As \(U^{\overline{\boldsymbol{\sigma}}}_3, U^{\overline{\boldsymbol{\sigma}}}_4\subseteq U^{\overline{\boldsymbol{\sigma}}}_1\), we have \(\displaystyle{\max_{i \in [|\overline{\boldsymbol{\sigma}}|]} \min\left(h(U^{\overline{\boldsymbol{\sigma}}}_i) ,\mathsf{EMM}_i^{\overline{\boldsymbol{\sigma}}}\right) \le \min\left\{\omega(1-\Delta), 2 - \Delta\right\}}\).
Case 2: one vertex has all neighboring conditional entropies smaller than \(\Delta\), and the other three vertices have some neighboring conditional entropies larger than \(\Delta\). Wlog, assume \(Z\) is the vertex with \(h(Y|Z), h(W|Z) \le \Delta\). Similar to Case 1, we can have \(h(X), h(Y), h(W) < 1- \Delta\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} = (\{X\},\{Z\},\{Y\},\{W\})\). By choosing \(\mathcal{A}= \{\{X,Y\}\}\) and \(\mathcal{B}= \{\{X,W\}\}\), we have \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(Y;W;X) \le \omega(1-\Delta)\). Meanwhile, \(h\left(U^{\overline{\boldsymbol{\sigma}}}_1\right) = h(XYW) \le h(XY)+ h(W) \le 2 - \Delta\). We have \(h(U^{\overline{\boldsymbol{\sigma}}}_2) = h(YZW) \le h(Y|ZW) + h(ZW) \le h(Y|Z) + h(ZW) \le 1+ \Delta\). As \(U^{\overline{\boldsymbol{\sigma}}}_3, U^{\overline{\boldsymbol{\sigma}}}_4\subseteq U^{\overline{\boldsymbol{\sigma}}}_1\), we have: \[\max_{i \in [|\overline{\boldsymbol{\sigma}}|]} \min\left(h(U^{\overline{\boldsymbol{\sigma}}}_i) ,\mathsf{EMM}_i^{\overline{\boldsymbol{\sigma}}}\right) \le \max\left\{\min\left\{\omega(1-\Delta), 2 - \Delta\right\}, 1+ \Delta\right\}.\]
Case 3: two non-tangent vertices have all their neighboring conditional entropies smaller than \(\Delta\). Suppose \(X, Z\) are two non-tangent vertices with all their neighboring conditional entropies smaller than \(\Delta\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} = (\{X\},\{Z\},\{Y\},\{W\})\). We have \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(XYW) \le h(W|XY) + h(XY) \le h(W|X) + h(XY) \le 1 + \Delta\). Similarly, \(h(U^{\overline{\boldsymbol{\sigma}}}_2) = h(ZYW) \le h(W|ZY) + h(ZY) \le h(W|Z) + h(ZY) \le 1 + \Delta\). As \(U^{\overline{\boldsymbol{\sigma}}}_3, U^{\overline{\boldsymbol{\sigma}}}_4\subseteq U^{\overline{\boldsymbol{\sigma}}}_1\), we have \(\displaystyle{\max_{i \in [|\overline{\boldsymbol{\sigma}}|]} \min\left(h(U^{\overline{\boldsymbol{\sigma}}}_i) ,\mathsf{EMM}_i^{\overline{\boldsymbol{\sigma}}}\right) \le 1+ \Delta}\).
Case 4: two tangent vertices have all their neighboring conditional entropies smaller than \(\Delta\), and the other two have some neighboring conditional entropy larger than \(\Delta\). Wlog, assume \(Z,W\) are two tangent vertices with all their neighboring conditional entropies smaller than \(\Delta\). Similar as above, we have \(h(X), h(Y) \le 1-\Delta\). We also further distinguish two more cases:
If \(h(Y|Z) \le \frac{\Delta}{2}\) and \(h(X|W) \le \frac{\Delta}{2}\), we have \(h(XYZW) \le h(X|YZW) + h(Y|ZW) + h(ZW) \le h(X|W) + h(Y|Z) + h(ZW) \le 1 + \Delta\).
Otherwise, either \(h(Y|Z) > \frac{\Delta}{2}\) or \(h(X|W) > \frac{\Delta}{2}\). Wlog, assume \(h(Y|Z) > \frac{\Delta}{2}\). Similar as above, we have \(h(Z)\ge 1 -\frac{\Delta}{2}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}}= (\{Y\},\{W\},\{Z\},\{X\})\). By choosing \(\mathcal{A}= \{\{X,Y\}\}\) and \(\mathcal{B}= \{\{Y,Z\}\}\), we have \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(X;Z;Y|\emptyset) = (\omega-1)(1-\Delta) + (1-\frac{\Delta}{2})\) and \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(XYZ)\le h(X)+ h(YZ) \le 2-\Delta\). Moreover, \(h(U^{\overline{\boldsymbol{\sigma}}}_2) = h(ZWX) \le h(Z|WX)+ h(WX) \le h(Z|W) + h(WX) \le 1 + \Delta\). As \(U^{\overline{\boldsymbol{\sigma}}}_3, U^{\overline{\boldsymbol{\sigma}}}_4\subseteq U^{\overline{\boldsymbol{\sigma}}}_1\), we have: \[\max_{i \in [|\overline{\boldsymbol{\sigma}}|]} \min\left(h(U^{\overline{\boldsymbol{\sigma}}}_i) ,\mathsf{EMM}_i^{\overline{\boldsymbol{\sigma}}}\right) \le \max\left\{1+\Delta, \min\left\{ (\omega-1)(1-\Delta) + \left(1-\frac{\Delta}{2}\right), 2-\Delta\right\}\right\}.\]
Putting all cases together, we obtain the upper bound: \[\max\left\{1 + \Delta, \min\left\{(\omega-1)(1-\Delta) + 1-\frac{\Delta}{2}, 2-\Delta\right\}\right\}\] If \(\frac{5}{2} \le \omega \le 3\), we set \(\Delta = \frac{1}{2}\) to obtain the upper bound as \(\frac{3}{2}\). If \(2\le \omega \le \frac{5}{2}\), we set \(\Delta = \frac{2(\omega-1)}{2\omega+1}\) to obtain the upper bound as \(\frac{4\omega-1}{2\omega+1}\). Putting two cases together, we obtain the desired upper bound.
Direction \(\textsf{\omega-subw}(\mathcal{H}) \ge 2 -\frac{3}{2 \cdot \min\{\omega, \frac{5}{2}\} + 1}\). Correspondingly, we identify a polymatroid \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\) by distinguishing the following two cases:
Case 1: \(\frac{5}{2} \le \omega \le 3\). Let \(a,b,c,d,e\) be independently random variables with \(h(a)=h(b) =h(c) =h(d) =\frac{1}{4}\) and \(h(e) = \frac{1}{2}\). Let \(h(X) = (ab)\), \(h(Y) = (cd)\), \(h(Z) = (de)\) and \(h(W) =(ae)\). We have
\(h(X) = h(Y) = \frac{1}{2}\), \(h(Z) = h(W) = \frac{3}{4}\);
\(h(XY) = h(YZ) = h(ZW) = h(WX) = 1\) and \(h(XZ) = h(YW) = \frac{5}{4}\);
\(h(XZW) =h(YZW) = \frac{5}{4}\) and \(h(XYZ) = h(XYW) = \frac{3}{2}\);
\(h(XYZW) = \frac{3}{2}\);
Consider any generalized elimination ordering \(\overline{\boldsymbol{\sigma}} \in \pi(\mathcal{V})\). We distinguish the following cases:
\(\overline{\boldsymbol{\sigma}}[1] = \{X\}\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(XYW)=\frac{3}{2}\) and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \mathsf{MM}(Y,W,X) = \frac{\omega}{2} + \frac{1}{4} \ge \frac{3}{2}\) when \(\omega \ge \frac{5}{2}\). The case with \(\overline{\boldsymbol{\sigma}}[1] = \{W\}\) is the same.
\(\overline{\boldsymbol{\sigma}}[1] = \{W\}\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(XZW)=\frac{5}{4}\) and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \mathsf{MM}(X,Z,W) = \frac{\omega}{2} + \frac{1}{4} \ge \frac{3}{2}\) when \(\omega \ge \frac{5}{2}\). The case with \(\overline{\boldsymbol{\sigma}}[1] = \{Z\}\) is the same.
\(|\boldsymbol{\boldsymbol{\sigma}}[1]|=2\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(\mathcal{V}) = \frac{3}{2}\) and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \ge \mathsf{MM}(X,W,Z) = \frac{\omega}{2} + \frac{1}{4} \ge \frac{3}{2}\).
Case 2: \(\omega < \frac{5}{2}\). Let \(a,b,c,d,e,f\) be independently random variables with \(h(a) = \frac{2(\omega-1)}{2\omega+1}\), \(h(b)=h(c) = h(d) = h(e) =\frac{\omega-1}{2\omega+1}\) and \(h(f) = \frac{5-2\omega}{2\omega+1}\). Let \(X=(bcf), Y=(def), Z =(aef), W=(abf)\). We have
\(h(W)= h(Z) = \frac{\omega+2}{2\omega+1}\) and \(h(X) = h(Y) = \frac{3}{2\omega+1}\);
\(h(WX) = h(XY) = h(YZ) = h(ZW) = 1\), \(h(WY) = h(XZ) = \frac{3\omega}{2\omega+1}\);
\(h(WXY) = h(XYZ)= \frac{4\omega-1}{2\omega+1}\), \(h(XZW) = h(YZW) = \frac{3\omega}{2\omega+1}\);
\(h(XYZW) = \frac{4\omega-1}{2\omega+1}\);
Consider any generalized elimination ordering \(\overline{\boldsymbol{\sigma}} \in \pi(\mathcal{V})\). We distinguish the following cases:
\(\overline{\boldsymbol{\sigma}}[1] = \{X\}\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(XYW)=\frac{4\omega-1}{2\omega+1}\) and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \mathsf{MM}(Y,W,X) = \frac{\omega+2}{2\omega+1} + \frac{3(\omega-1)}{2\omega+1} = \frac{4\omega-1}{2\omega+1}\). The case with \(\overline{\boldsymbol{\sigma}}[1] = \{Y\}\) is the same.
\(\overline{\boldsymbol{\sigma}}[1] = \{W\}\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(XZW)=\frac{3\omega}{2\omega+1}\) and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \mathsf{MM}(X,Z,W) = \frac{2(\omega+2)}{2\omega+1} + \frac{3(\omega-2)}{2\omega+1} = \frac{5\omega-2}{2\omega+1}> \frac{4\omega-1}{2\omega+1}\). The case with \(\overline{\boldsymbol{\sigma}}[1] = \{Z\}\) is the same.
\(|\overline{\boldsymbol{\sigma}}[1]| = 2\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(\mathcal{V})=\frac{4\omega-1}{2\omega+1}\) and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \ge \mathsf{MM}(Y,W,X) = \frac{4\omega-1}{2\omega+1}\).
◻
[18] defines an exponent \(\overline{c} _k\) for detecting a \(k\)-cycle in a graph, and the definition is based on rectangular matrix multiplication. We define below an upper bound, \(c^{\square} _k\), on \(\overline{c} _k\) that uses only square matrix multiplication and show that \(\textsf{\omega-subw}(\mathcal{H}) \le c^{\square} _k\) for any \(k\)-cycle graph \(\mathcal{H}\). In particular, \(\overline{c} _k \leq c^{\square} _k\) and this becomes an equality when \(\omega = 2\). Moreover, [18] shows that \(\overline{c} _k = c^{\square} _k\) when \(k\) is odd as well as \(k=4\) or \(6\). More details can be found in [18].
First, we recall the definition of \(\overline{c} _k\) from [18]. Recall from Table 1 that \(\overline{\omega} (a,b,c)\) is the smallest exponent for multiplying two rectangular matrices of sizes \(n^a \cdot n^b\) and \(n^b \cdot n^c\) within \(O\left(n^{ \overline{\omega} (a,b,c)}\right)\) time, whereas \(\omega^{\square} (a,b,c)\) is the smallest upper bound on \(\overline{\omega} (a,b,c)\) that is obtained through square matrix multiplication, i.e. \(\omega^{\square} (a, b, c) \stackrel{\mathrm{def}}{=}\max\{a + b+(\omega-2)c, a+(\omega-2)b + c, (\omega-2)a + b + c\}\). In particular, \(\overline{\omega} (a,b,c) \leq \omega^{\square} (a, b, c)\), and this becomes an equality when \(\omega = 2\) or when \(a=b=c\). Given a graph of size \(N\), let \(\mathbf{D} = \{0,\log_N 2, 2\log_N 2, \cdots, 1\}^{2k}\). For each vector \(\vec{d}\), [18] defines a function \(\overline{P} ^{\vec{d}}_{i,j}\) (for \(i < j\)) in a recursive way as follows: \[\label{eq:rect-ck-pij} \overline{P} ^{\vec{d}}_{i,j} = \min\left\{ \overline{P} ^{\vec{d}}_{i,j-1} + d^+_{j-1}, \overline{P} ^{\vec{d}}_{i+1,j} + d^{-}_{i+1}, \min_{i<r < j}\left\{ \overline{P} ^{\vec{d}}_{i,r}, \overline{P} ^{\vec{d}}_{r,j}, \overline{\omega} (1-d_i, 1-d_r, 1-d_j)\right\}\right\}\tag{111}\] with \(\overline{P} ^{\vec{d}}_{i,i+1} = 1\). Finally, [18] defines \(\overline{c} _k\) as follow: \[\label{eq:rect-ck} \overline{c} _k = \max_{\vec{d} =\left(d^-_1, d^+_1, d^-_2, d^+_2, \cdots, d^-_k, d^+_k\right) \in \mathbf{D}}\min\left\{\min_{i \in [k]} 2 - d_i, \min_{i,j \in [k]: i<j} \max\left\{ \overline{P} ^{\vec{d}}_{i,j}, \overline{P} ^{\vec{d}}_{j,i}\right\}\right\}\tag{112}\]
In contrast, by replacing \(\overline{\omega} (1-d_i, 1-d_r, 1-d_j)\) with \(\omega^{\square} (1-d_i, 1-d_r, 1-d_j)\) in Eq. 111 , we obtain our variants \(P^{\vec{d}}_{i,j}\) and \(c^{\square} _k\) defined below (with \(P^{\vec{d}}_{i,i+1} = 1\)):
\[\label{eq:square-ck-pij} P^{\vec{d}}_{i,j} = \min\left\{P^{\vec{d}}_{i,j-1} + d^+_{j-1}, P^{\vec{d}}_{i+1,j} + d^{-}_{i+1}, \min_{i<r < j}\left\{P^{\vec{d}}_{i,r}, P^{\vec{d}}_{r,j}, \omega^{\square} (1-d_i, 1-d_r, 1-d_j)\right\}\right\}\tag{113}\] \[\label{eq:square-ck} c^{\square} _k = \max_{\vec{d} =\left(d^-_1, d^+_1, d^-_2, d^+_2, \cdots, d^-_k, d^+_k\right) \in \mathbf{D}}\min\left\{\min_{i \in [k]} 2 - d_i, \min_{i,j \in [k]: i<j} \max\left\{P^{\vec{d}}_{i,j}, P^{\vec{d}}_{j,i}\right\}\right\}\tag{114}\]
Lemma 9. For the following hypergraph representing a \(k\)-cycle: \[\begin{align} \mathcal{H}= (\{X_1,X_2,\cdots,X_k\},\quad \{\{X_1,X_2\}, \{X_2,X_3\}, \cdots, \{X_{k-1},X_k\}, \{X_k,X_1\}\}) \label{eq:H:cycle} \end{align}\tag{115}\] \(\textsf{\omega-subw}(\mathcal{H}) \le c^{\square} _k\) as defined in Eq. 114 .
Proof of Lemma 9. We partition all polymatroids \(\boldsymbol{h}\) into the following \((1+ \log N)^{|\mathcal{V}|}\) cases. For simplicity, let \(X_1 = X_{k+1}\). Each polymatroid \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\) is associated with a \(k\)-tuple vector \(\vec{d} = (d^-_1, d^+_1, d^-_2, d^+_2, \cdots, d^-_k, d^+_k) \in \mathbf{D}\) such that \(d^{-}_i \le h(X_{i-1}|X_i)< d^-_{i} + \log_N 2\) and \(d^{+}_i \le h(X_{i+1}|X_i) < d^+_{i}+ \log_N 2\). We have the following two observations:
For each \(i \in [k]\), consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} =(\{X_{i-1}\}, \cdots, \{X_1\},\) \(\{X_k\}, \cdots, \{X_{i}\}).\) As \(h(X_{i-1}|X_i) \ge d^-_i\) and \(h(X_{i-1}X_i) \le 1\), we have \(h(X_i)= h(X_{i-1}X_i) - h(X_{i-1}|X_i) < 1- d^{-}_i\). Similarly, we have \(h(X_i) < 1 - d^{+}_i\). For simplicity, we define \(d_i = \max\{d^{-}_i, d^{+}_i\}\). For each \(i \in [k]\), we have \(h\left(X_iX_{j}X_{j+1}\right) \le h(X_i) + h(X_jX_{j+1}) < \min\{1 - d^-_{i}, 1 - d^+_{i}\} + 1 = 2 - d_i\). So, \(h\left(U^{\overline{\boldsymbol{\sigma}}}_{j}\right) \le 2 - d_i\) for any \(j \in [|\overline{\boldsymbol{\sigma}}|]\), i.e., \(\displaystyle{\max_{j \in [|\overline{\boldsymbol{\sigma}}|]} h\left(U^{\overline{\boldsymbol{\sigma}}}_{j}\right) \le 2 - d_i}\).
For each pair of distinct values \(i,j \in [k]\) (wlog assume \(i < j\)), we define \(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j}\) as an ordering of \(\{X_{i+1},X_{i+2},\cdots,X_{j-1}\}\) as follows: \[\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j} = \left\{ \begin{array}{rl} \left(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j-1}, \;X_{j-1}\right) & \text{if } P^{\vec{d}}_{i,j} = P^{\vec{d}}_{i,j-1} + d^+_{j-1},\\ \left(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i+1,j}, \;X_{i+1}\right) & \text{if } P^{\vec{d}}_{i,j} = P^{\vec{d}}_{i+1,j} + d^-_{i+1},\\ \left(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,r}, \;\overline{\boldsymbol{\sigma}}^{\vec{d}}_{r,j}, \;X_{r}\right) & \text{if } P^{\vec{d}}_{i,j} = \min\left\{P^{\vec{d}}_{i,r}, P^{\vec{d}}f_{r,j}, \omega^{\square} (1-d_i, 1-d_r, 1-d_j)\right\}, \end{array} \right.\] and \(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,i+1} = \emptyset\). At last, we construct a generalized elimination order \(\overline{\boldsymbol{\sigma}}^{\vec{d}} = \left(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j}, \overline{\boldsymbol{\sigma}}^{\vec{d}}_{j,i}, X_i, X_j\right)\). It can be proved that \(\displaystyle{\max_{\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}\right|\right]} \min\left\{h\left({U^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_\ell}\right), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_\ell\right\} \le P^{\vec{d}}_{i,j}}\). In the base case when \(j = i+1\), \(h(\emptyset) = 0 \le 1\) trivially holds. In general, we distinguish three cases:
If \(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j} = \left(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j-1}, \;X_{j-1}\right)\): by hypothesis, assume this claim holds for \(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,{j-1}}\), i.e., \[\displaystyle{\max_{\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{i,j-1}^{\vec{d}}\right|\right]} \min\left\{h\left({U^{\overline{\boldsymbol{\sigma}}_{i,j-1}^{\vec{d}}}_\ell}\right), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,j-1}^{\vec{d}}}_\ell\right\} \le P^{\vec{d}}_{i,j-1}}\] For any \(\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}\right|-1\right]\), \(U^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_{\ell} = U^{\overline{\boldsymbol{\sigma}}_{i,j-1}^{\vec{d}}}_{\ell}\), and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,j-1}^{\vec{d}}}_\ell = \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_\ell\). For \(\ell = \left|\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}\right|\), \(h(U_\ell^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}) = h(X_iX_{j-1}X_j) \le h(X_iX_{j-1}) + h(X_j|X_{j_1}) \le P^{\vec{d}}_{i,j-1} + d^+_{j-1}\). Together, we have: \[\displaystyle{\max_{\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}\right|\right]} \min\left\{h\left({U^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_\ell}\right), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_\ell\right\} \le P^{\vec{d}}_{i,j-1}} + d^+_{j-1}\]
If \(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j} = \left(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i+1,j}, \;X_{j-1}\right)\): the case is similar as above.
If \(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j} =\left(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,r}, \;\overline{\boldsymbol{\sigma}}^{\vec{d}}_{r,j}, \;X_{r}\right)\): by hypothesis, assume this claim holds for \(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,r}\) and \(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{r,j}\), i.e., \[\displaystyle{\max_{\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{i,r}^{\vec{d}}\right|\right]} \min\left\{h\left({U^{\overline{\boldsymbol{\sigma}}_{i,r}^{\vec{d}}}_\ell}\right), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,r}^{\vec{d}}}_\ell\right\} \le P^{\vec{d}}_{i,r}}\] \[\displaystyle{\max_{\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{r,j}^{\vec{d}}\right|\right]} \min\left\{h\left({U^{\overline{\boldsymbol{\sigma}}_{r,j}^{\vec{d}}}_\ell}\right), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{r,j}^{\vec{d}}}_\ell\right\} \le P^{\vec{d}}_{r,j}}\] For any \(\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{i,r}^{\vec{d}}\right|\right]\), \(U^{\overline{\boldsymbol{\sigma}}_{i,r}^{\vec{d}}}_{\ell} = U^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_{\ell}\), and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,r}^{\vec{d}}}_\ell = \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_\ell\). For any \(\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{r,j}^{\vec{d}}\right|\right]\), \(U^{\overline{\boldsymbol{\sigma}}_{r,j}^{\vec{d}}}_{\ell} = U^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_{\ell+ \left|\overline{\boldsymbol{\sigma}}_{i,r}^{\vec{d}}\right|}\), and \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{r,j}^{\vec{d}}}_\ell = \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_{\ell+ \left|\overline{\boldsymbol{\sigma}}_{i,r}^{\vec{d}}\right|}\). For \(\ell = \left|\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}\right|\), \(\mathsf{EMM}_\ell^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}} = \mathsf{MM}(X_i, X_r, X_j) \le \omega^{\square} (1-d_i, 1-d_r, 1-d_j)\), since \(h(X_i) \le 1- d_i\), \(h(X_r) \le 1- d_r\) and \(h(X_j) \le 1- d_j\). Together, we have: \[\displaystyle{\max_{\ell \in \left[\left|\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}\right|\right]} \min\left\{h\left({U^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_\ell}\right), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}_{i,j}^{\vec{d}}}_\ell\right\} \le \min\left\{P^{\vec{d}}_{i,r}, P^{\vec{d}}_{r,j}, \omega^{\square} (1-d_i, 1-d_r, 1-d_j)\right\}}\]
We define a generalized elimination ordering \(\overline{\boldsymbol{\sigma}}^{\vec{d}} = \left(\overline{\boldsymbol{\sigma}}^{\vec{d}}_{i,j},\overline{\boldsymbol{\sigma}}^{\vec{d}}_{j,i}, X_i, X_j\right)\). Hence, \[\displaystyle{\max_{\ell \in \left[\left|\overline{\boldsymbol{\sigma}}^{\vec{d}}\right|\right]} \min\left\{h\left({U^{\overline{\boldsymbol{\sigma}}^{\vec{d}}}_\ell}\right), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}^{\vec{d}}}_\ell\right\} \le \max\left\{P^{\vec{d}}_{i,j}, P^{\vec{d}}_{j,i}\right\}}.\]
Combining these two cases and applying these arguments to all possible \(\vec{d}\), we have \[\textsf{\omega-subw}(\mathcal{H}) \le \min_{\vec{d} = (d^-_1, d^+_1, d^-_2, d^+_2, \cdots, d^-_k, d^+_k)}\min\left\{\min_{i \in [k]} 2 - d_i, \min_{i,j \in [k]: i<j} \max\left\{P^{\vec{d}}_{i,j}, P^{\vec{d}}_{j,i}\right\}\right\} = c^{\square} _k.\] ◻
Definition 19 (Clustered Hypergraph). A hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\) is clustered if for any pair of vertices \(X_i,X_j\in \mathcal{V}\), there exists some hypergraph \(e\in \mathcal{E}\) such that \(X_i, X_j \in e\).
Lemma 10. A clustered hypergraph \(\mathcal{H}= (\mathcal{V}, \mathcal{E})\) satisfies the following properties:
\(\textsf{subw}(\mathcal{H}) = \rho^*(\mathcal{H})\).
for any generalized elimination ordering \(\overline{\boldsymbol{\sigma}} \in \pi(\mathcal{V})\), \(U^{\overline{\boldsymbol{\sigma}}}_1 = \mathcal{V}\); and therefore \(U^{\overline{\boldsymbol{\sigma}}}_i \subseteq U^{\overline{\boldsymbol{\sigma}}}_1\) for any \(i \in [|\overline{\boldsymbol{\sigma}}|]\).
Lemma 11. For the following hypergraph representing a 3-pyramid: \[\begin{align} \mathcal{H}= \left(\{Y, X_1, X_2,X_3\},\quad \{\{Y,X_1\}, \{Y,X_2\}, \{Y, X_3\}, \{X_1,X_2,X_3\}\}\right) \label{eq:H:pyramid-3} \end{align}\tag{116}\] \(\textsf{\omega-subw}(\mathcal{H}) = 2 - \frac{1}{\omega}\).
Proof of Lemma 11. Direction \(\textsf{\omega-subw}(\mathcal{H}) \le 2 - \frac{1}{\omega}\). We partition all polymatroids \(\boldsymbol{h}\) into the following cases:
Case 1: there exists some \(i \in [3]\) such that \(h(Y|X_i) \le \Delta\). In this case, \(h(\mathcal{V}) \le h(Y|X_1X_2X_3) + h(X_1X_2X_3) \le h(Y|X_i) + h(X_1X_2X_3) \le \Delta + 1\);
Case 2: \(h(X_i|Y) \le \frac{\Delta}{2}\) for each \(i \in [3]\). In this case, \(h(\mathcal{V}) \le h(X_1|Y) + h(X_2|Y) + h(X_3Y) \le \Delta + 1\).
Case 3: none of the cases above, i.e., \(h(Y|X_i) > \Delta\) for each \(i \in [3]\). As \(h(X_iY) \le 1\) and \(h(Y|X_i) > \Delta\), we have \(h(X_i) = h(X_iY) - h(Y|X_i) \le 1-\Delta\). As \(h(X_iY) \le 1\) and \(h(X_i|Y) > \frac{\Delta}{k-1}\), we have \(h(Y) = h(X_iY) - h(X_i|Y) \le 1- \frac{\Delta}{2}\). Let \(\boldsymbol{A} = \left\{X_2\right\}\) and \(\boldsymbol{B} = \left\{X_3\right\}\). Note that \(h(\boldsymbol{A}) \le (1-\Delta)\) and \(h(\boldsymbol{B}) \le (1-\Delta)\). We assume that \(\Delta\) is a parameter such that \(\Delta \ge (1-\Delta)\) holds, i.e., \(\Delta \ge \frac{1}{2}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} = (\{Y\},\boldsymbol{A}, \boldsymbol{B}, \{X_1\})\). We have \[\begin{align} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(\boldsymbol{A}; \boldsymbol{B}; Y|X_1) & \le \gamma h(\boldsymbol{A}) + h(\boldsymbol{B}) + h(X_1Y) \le \gamma (1-\Delta) + (1-\Delta) + 1 \end{align}\] Combining all the cases, we obtain the desired upper bound \(\displaystyle{1+ \displaystyle{\max\left\{\Delta,\gamma(1-\Delta)+ (1-\Delta)\right\}} = 2 - \displaystyle{\frac{1}{\omega}}}\), by setting \(\Delta = 1 - \frac{1}{\omega}\) (note that \(\Delta \ge \frac{1}{2}\)).
Direction \(\textsf{\omega-subw}(\mathcal{H}) \ge 2 - \frac{1}{\omega}\). We identify the following polymatroid \(\boldsymbol{h} \in \Gamma \cap \mathsf{ED}\):
\(h(X_1) = h(X_2) = h(X_3) =\frac{1}{\omega}\);
\(h(Y) = 1- \frac{1}{\omega}\);
\(h(X_1X_2) = h(X_1X_3) = h(X_2X_3) = \frac{2}{\omega}\);
\(h(X_1Y) = h(X_2Y) = h(X_3Y)=1\);
\(h(X_1X_2X_3) = 1\);
\(h(X_1X_2Y) = h(X_1X_3Y) = h(X_2X_3Y) = \frac{\omega+1}{\omega}\);
\(h(X_1X_2X_3Y) = 2 - \frac{1}{\omega}\);
We distinguish an arbitrary generalized elimination ordering \(\overline{\boldsymbol{\sigma}}\) into the following cases:
\(\overline{\boldsymbol{\sigma}}[1] = \{Y\}\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(\mathcal{V}) = 2 - \frac{1}{\omega}\). \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \min\left\{\mathsf{MM}(X_1, X_2, Y; X_3), \mathsf{MM}(X_1,X_2X_3,Y)\right\} = 2 - \frac{1}{\omega}\);
\(\overline{\boldsymbol{\sigma}}[1] = \{X_1\}\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(\mathcal{V}) = 2 - \frac{1}{\omega}\). \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \min\{\mathsf{MM}(X_2,Y,X_1|X_3),\) \(\mathsf{MM}(X_2X_3, Y ,X_1),\) \(\mathsf{MM}(X_2,X_3Y,X_1)\} =\)
The case with \(\overline{\boldsymbol{\sigma}}[1] = \{X_2\}\) or \(\overline{\boldsymbol{\sigma}}[1] = \{X_3\}\) is the same.
\(\overline{\boldsymbol{\sigma}}[1] = \{X_1, Y\}\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(\mathcal{V}) = 2 - \frac{1}{\omega}\). \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \mathsf{MM}(X_2,X_3,X_1Y) = 2 - \frac{1}{\omega}\). The case with \(\overline{\boldsymbol{\sigma}}[1] = \{X_2, Y\}\) or \(\overline{\boldsymbol{\sigma}}[1] = \{X_3, Y\}\) is the same.
\(\overline{\boldsymbol{\sigma}}[1] = \{X_1, X_2\}\). \(h(U^{\overline{\boldsymbol{\sigma}}}_1) = h(\mathcal{V}) = 2 - \frac{1}{\omega}\). \(\mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 = \mathsf{MM}(X_3,Y,X_1X_2) = 2 - \frac{1}{\omega}\). The case with \(\overline{\boldsymbol{\sigma}}[1] = \{X_1, X_3\}\) or \(\overline{\boldsymbol{\sigma}}[1] = \{X_2, X_3\}\) is the same.
Hence, for such \(\boldsymbol{h}\), we have \(\displaystyle{\max_{i \in [|\overline{\boldsymbol{\sigma}}|]} \min\left(h\left(U^{\overline{\boldsymbol{\sigma}}}_i\right), \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_i\right)} \ge 2 - \frac{1}{\omega}\). ◻
Lemma 12. For the following hypergraph representing a \(k\)-pyramid: \[\begin{align} \mathcal{H}= \left(\{Y, X_1, X_2,\cdots, X_k\}, \;\{\{Y,X_1\}, \{Y,X_2\}, \cdots, \{Y, X_k\}, \{X_1,X_2,\cdots,X_k\}\}\right) \label{eq:H:pyramid-k} \end{align}\tag{117}\] for \(k \ge 3\), \(\textsf{\omega-subw}(\mathcal{H}) \le \displaystyle{2 - \frac{2}{\omega \cdot (k-1) -k + 3}}\).
Proof of Lemma 12. We partition all polymatroids \(\boldsymbol{h}\) into the following two cases:
Case 1: there exists some \(i \in [k]\) such that \(h(Y|X_i) \le \Delta\). In this case, \(h(\mathcal{V}) \le h(Y|X_1X_2\cdots X_k) + h(X_1X_2\cdots X_k) \le h(Y|X_i) + h(X_1X_2\cdots X_k) \le \Delta + 1\);
Case 2: \(h(X_i|Y) \le \frac{\Delta}{k-1}\) for each \(i \in [k]\). In this case, \(h(\mathcal{V}) \le \sum_{i\in [k-1]}h(X_1|Y) + h(X_kY) \le \Delta + 1\).
Case 3: none of the cases above, i.e., \(h(Y|X_i) > \Delta\) for each \(i \in [k]\). As \(h(X_iY) \le 1\) and \(h(Y|X_i) > \Delta\), we have \(h(X_i) = h(X_iY) - h(Y|X_i) \le 1-\Delta\). As \(h(X_iY) \le 1\) and \(h(X_i|Y) > \frac{\Delta}{k-1}\), we have \(h(Y) = h(X_iY) - h(X_i|Y) \le 1- \frac{\Delta}{k-1}\).
We further distinguish two more cases depending on whether \(k\) is even or odd.
When \(k\) is odd. Let \(\boldsymbol{A} = \left\{X_2, X_3, \cdots, X_{\frac{k+1}{2}}\right\}\) and \(\boldsymbol{B} = \left\{X_{\frac{k+1}{2}+1}, X_{\frac{k+1}{2}+2}, \cdots, X_k \right\}\). Note that \(h(\boldsymbol{A}) \le (1-\Delta) \cdot \frac{k-1}{2}\) and \(h(\boldsymbol{B}) \le (1-\Delta) \cdot \frac{k-1}{2}\). In this case, we assume that \(\Delta > (1-\Delta) \cdot\frac{k-1}{2}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} = (\{Y\},\boldsymbol{A}, \boldsymbol{B}, \{X_1\})\). We have \[\begin{align} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(\boldsymbol{A}; \boldsymbol{B}; Y|X_1) & \le \gamma h(\boldsymbol{A}) + h(\boldsymbol{B}) + h(X_1Y) \le (\gamma+1)(1-\Delta) \cdot \frac{k-1}{2} + 1 \end{align}\] Combining all the cases, we obtain the desired upper bound: \[1+ \displaystyle{\max\left\{\Delta, (\gamma+1)(1-\Delta) \cdot \frac{k-1}{2} \right\}} = \displaystyle{2 - \displaystyle{\frac{2}{\omega \cdot (k-1) - k + 3}}}.\]
When \(k\) is even. We partition all polymatroids \(\boldsymbol{h}\) into the following two cases: Let \(\boldsymbol{A} = \left\{X_1, X_2, X_3, \cdots, X_{\frac{k}{2}}\right\}\) and \(\boldsymbol{B} = \left\{X_{\frac{k}{2}+1}, X_{\frac{k}{2}+1}, \cdots, X_k \right\}\). Note that \(h(\boldsymbol{A}) \le (1-\Delta) \cdot \frac{k}{2}\) and \(h(\boldsymbol{B}) \le (1-\Delta) \cdot \frac{k}{2}\). We assume that \(\Delta\) is a parameter such that \(1-\frac{\Delta}{k-1} > (1-\Delta) \cdot\frac{k}{2}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} = (\{Y\}, \boldsymbol{A}, \boldsymbol{B})\). We have \[\begin{align} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(\boldsymbol{A}; \boldsymbol{B}; Y) & \le \gamma h(\boldsymbol{A}) + h(\boldsymbol{B}) + h(Y) \le \gamma (1-\Delta) \cdot \frac{k}{2} + (1-\Delta) \cdot \frac{k}{2} + 1 -\frac{\Delta}{k-1} \end{align}\] Combining all the cases, we obtain the desired upper bound: \[1+ \displaystyle{\max\left\{\Delta,\gamma (1-\Delta) \cdot \frac{k}{2} + (1-\Delta) \cdot \frac{k}{2} - \frac{\Delta}{k-1}\right\}} \ge \displaystyle{2 - \displaystyle{\frac{2}{\omega \cdot (k-1) - k + 3}}}\]
◻
Lemma 13. For the following hypergraph \[\mathcal{H}= \left(\{X,Y,Z,W,L\},\quad \{\{X,Y,W\},\{X,Y, L\},\{X,Z\}, \{Y,Z\}, \{Z,W,L\}\}\right)\] \(\textsf{\omega-subw}(\mathcal{H}) \le 2- \frac{1}{2(\omega -2) +3}\).
For the hypergraph \(\mathcal{H}\) in Lemma 13, \(\textsf{subw}(\mathcal{H}) = \frac{9}{5}\). If \(\omega =3\), \(\textsf{\omega-subw}(\mathcal{H}) \le 2 - \frac{1}{2 \omega -1} = \textsf{subw}(\mathcal{H}) = \frac{9}{5}\). If \(\omega < 3\), \(\textsf{\omega-subw}(\mathcal{H}) < \textsf{subw}(\mathcal{H})\).
Proof. Let \(\Delta = \frac{2(\omega-1)}{2\omega -1}\). We partition all polymatroids \(\boldsymbol{h}\) into the following cases:
Case 1: \(h(XY|W) \le \Delta\) or \(h(ZL|W) \le \Delta\). wlog, suppose \(h(XY|W) \le \Delta\). We have \(h(XYZWL) \le h(XY|ZWL) + h(ZWL) \le h(XY|W) + h(ZWL) \le 1 + \Delta\).
Case 2: \(h(XY|L) \le \Delta\) or \(h(ZW|L) \le \Delta\). This case is similar to Case 1.
Case 3: \(h(X|Z) \le \frac{\Delta}{2}\) and \(h(Y|Z) \le \frac{\Delta}{2}\). We have \(h(XYZWL) \le h(X|ZWL) + h(Y|ZWL) + h(ZWL) \le h(X|Z) + h(Y|Z) + h(ZWL) \le 1 + \Delta\).
Case 4: either \(h(L|XY) \le \frac{2\Delta-1}{3}\) or \(h(W|XY) \le \frac{2\Delta-1}{3}\), and either \(h(Z|X) \le \frac{1+\Delta}{3}\) or \(h(Z|Y) \le \frac{1+\Delta}{3}\). Wlog, suppose \(h(L|XY) \le \frac{2\Delta-1}{3}\) and \(h(Z|X) \le \frac{1+\Delta}{3}\). In this case, we have \(h(XYZWL)\le h(L|XYW) + h(Z|XYW) + h(XYW) \le 1 + \Delta\).
Case 5: none of the cases above. As \(h(XY|W) > \Delta\) and \(h(XYW) \le 1\), we have \(h(W) = h(XYW) - h(XY|W) < 1- \Delta\). As \(h(XY|L) > \Delta\) and \(h(XYL) \le 1\), we have \(h(L) < 1 -\Delta\). As \(h(X|Z) > \frac{\Delta}{2}\) and \(h(XZ) \le 1\), we have \(h(Z) < 1- \frac{\Delta}{2}\). If either \(h(L|XY) \le \frac{2\Delta-1}{3}\) or \(h(W|XY) \le \frac{2\Delta-1}{3}\), but \(h(Z|X) \le \frac{1+\Delta}{3}\) and \(h(Z|Y) \le \frac{1+\Delta}{3}\), we have \(h(X) \le 1 -\frac{1+\Delta}{3} = \frac{2-\Delta}{3}\) and \(h(Y) \le 1 -\frac{1+\Delta}{3} = \frac{2-\Delta}{3}\). Hence, \(h(XY)\le \frac{2(2-\Delta)}{3}\). If both \(h(L|XY) > \frac{2\Delta-1}{3}\) and \(h(W|XY) > \frac{2\Delta-1}{3}\), we have \(h(XY) \le 1 -\frac{2\Delta-1}{3} = \frac{2(2-\Delta)}{3}\). Consider a generalized elimination ordering \(\overline{\boldsymbol{\sigma}} = (\{XY\}, \{Z\}, \{W\}, \{L\})\).
\[\begin{align} \mathsf{EMM}^{\overline{\boldsymbol{\sigma}}}_1 \le \mathsf{MM}(Z;W;XY|L) &\le\max\begin{cases} \gamma h(Z) + h(W) + h(XYL)&\\ h(Z) + \gamma h(W) + h(XYL) &\\ h(Z) + h(W) + \gamma h(XYL)&\end{cases} \le (\omega-2) \cdot (1-\Delta) + 1 - \frac{\Delta}{2} + 1 \end{align}\]
Putting everything together, we obtain the desired upper bound \[\max\left\{1+\Delta, (\omega-2) \cdot (1-\Delta) + 2 - \frac{\Delta}{2}\right\} = 2- \frac{1}{2(\omega -2) +3}.\] ◻
This work was partially supported by NSF-BSF 2109922, NSF-IIS 2314527, NSF-SHF 2312195, and by the Natural Sciences and Engineering Research Council of Canada – Discovery Grant, and was initiated while the authors participated in the Fall 2023 Simons Program on Logic and Algorithms in Databases and AI.↩︎
By that, we mean partitioning not just the input relations but also intermediate relations that result from the join of (input or intermediate) relations. This “multi-level” partitioning can indeed lower the complexity further than one-level partitioning, for some classes of queries.↩︎
Note that this algorithm uses the three techniques mentioned above in reverse order.↩︎
Note that for \(\omega = 3\), this complexity collapses back to \(O(N^{3/2})\) which is the same as the combinatorial algorithm.↩︎
If \(\omega\) is irrational, we can use any rational upper bound on \(\omega\) instead.↩︎
In particular, later we will extend the notion of \(\mathsf{MM}\) to allow for group-by variables, and we will also generalize the concept of VEOs to allow eliminating multiple variables at once.↩︎
Note that \(\mathsf{MM}(X;Y;Z)\) is symmetric.↩︎
Note that \(\min(a, \max(b, c)) = \max(\min(a, b), \min(a, c))\)↩︎
Note that \(h(XZ) + h(Y|X) \geq h(XYZ)\) is just another form of the submodularity \(h(XZ) + h(XY) \geq h(X) + h(XYZ)\), hence the name.↩︎
\(S \ltimes T\) denotes the semi-join reduce operator defined by \(S \ltimes T \stackrel{\mathrm{def}}{=}\pi_{\text{\sf vars}(S)}(S \Join T)\).↩︎
If \(\omega\) is not fixed, then Eq. 39 is not an LP because the coefficient \(\gamma\) depends on \(\omega\). Hence, we end up having constraints that are quadratic in terms of \(\omega\) and \(\boldsymbol{h}\).↩︎
If \(\omega\) is irrational, we can use any rational upper bound on \(\omega\) instead.↩︎
The constant \(C\) can be assumed to be independent of the specific values of the \(\omega\)-dominant triples \((\alpha_i, \beta_i, \zeta_i)\). This is because every \(\omega\)-dominant triple \((\alpha_i, \beta_i, \zeta_i)\) can be replaced with another \((\alpha_i', \beta_i', \zeta_i') \leq (\alpha_i, \beta_i, \zeta_i)\) where inequality 44 is tight, i.e., where \(\alpha_i' + \beta_i' + \zeta_i' = \omega\). Such replacement can only expand the \(B\)-support of the probabilistic interpretation of the MM target, and thus it can only expand the set \(E\).↩︎
Note that \((\mathbb{R}, \max, \min)\) is a commutative semiring.↩︎