Finished implementing @atri Element 112420 suggestions.

This commit is contained in:
Aaron Huber 2020-11-25 16:35:05 -05:00
parent ca2ef2b233
commit 28c45f3770
2 changed files with 65 additions and 9 deletions

View file

@ -90,22 +90,67 @@ which is indeed linear in the size of the output polynomial as the number of ope
Now, consider the query
\begin{equation*}
\poly^2() := \left(\rel(A), E(A, B), R(B)\right) \times \left(\rel(A), E(A, B), R(B)\right),
\poly^2() := \rel(A), E(A, B), R(B)\rel(C), E(C, D), R(D),
\end{equation*}
whose factorized output polynomial is
For an arbitrary polynomial, it is known that there may exist equivalent compressed representations of the polynomial. One such compression is known as the factorized polynomial, where the polynomial can be broken up into separate factors, and this is generally smaller than the expanded polynomial. Another equivalent form of the polynomial is the SOP, which is the expansion of the factorized polynomial by multiplying out all terms, and in general is exponentially larger (in the number of products) than the factorized version.
A factorized polynomial of $\poly^2$ is
\begin{equation*}
\poly^2(W_a, W_b, W_c) = \left(W_aW_b + W_bW_c + W_cW_a\right) \cdot \left(W_aW_b + W_bW_c + W_cW_a\right),
\end{equation*}
, whose SOP equivalent representation is
%\[W_a^2W_b^2 + W_aW_b^2W_c + W_a^2W_bW_c + W_aW_b^2W_c + W_b^2W_c^2 + W_aW_bW_c^2 + W_a^2W_bW_c + W_aW_bW_c^2 + W_c^2W_a^2 =\]
\poly^2(W_a, W_b, W_c) = \left(W_aW_b + W_bW_c + W_cW_a\right) \cdot \left(W_aW_b + W_bW_c + W_cW_a\right).
\end{equation*}
This factorized expression can be easily modeled as an expression tree as depicted by ~\cref{fig:intro-q2-etree}.
\begin{figure}[h!]
\begin{tikzpicture}[thick, level distance=0.9cm,level 1/.style={sibling distance=4.55cm}, level 2/.style={sibling distance=1.5cm}, level 3/.style={sibling distance=0.7cm}]% level/.style={sibling distance=6cm/(#1 * 1.5)}]
\node[tree_node](root){$\boldsymbol{\times}$}
child{node[tree_node]{$\boldsymbol{+}$}
child{node[tree_node]{$\boldsymbol{\times}$}
child{node[tree_node]{$W_a$}}
child{node[tree_node]{$W_b$}}
}
child{node[tree_node]{$\boldsymbol{\times}$}
child{node[tree_node]{$W_b$}}
child{node[tree_node]{$W_c$}}
}
child{node[tree_node]{$\boldsymbol{\times}$}
child{node[tree_node]{$W_c$}}
child{node[tree_node]{$W_a$}}
}
}
child{node[tree_node]{$\boldsymbol{+}$}
child{node[tree_node]{$\boldsymbol{\times}$}
child{node[tree_node]{$W_a$}}
child{node[tree_node]{$W_b$}}
}
child{node[tree_node]{$\boldsymbol{\times}$}
child{node[tree_node]{$W_b$}}
child{node[tree_node]{$W_c$}}
}
child{node[tree_node]{$\boldsymbol{\times}$}
child{node[tree_node]{$W_c$}}
child{node[tree_node]{$W_a$}}
}
};
\end{tikzpicture}
\caption{Expression tree for query $\poly^2$.}
\label{fig:intro-q2-etree}
\end{figure}
In contrast, the SOP equivalent representation is
\begin{equation*}
W_a^2W_b^2 + W_b^2W_c^2 + W_c^2W_a^2 + 2W_a^2W_bW_c + 2W_aW_b^2W_c + 2W_aW_bW_c^2.
\end{equation*}
The expectation then is
\begin{align*}
&\expct\pbox{\poly^2(W_a, W_b, W_c)} = \expct\pbox{W_a^2}\expct\pbox{W_b^2} + \expct\pbox{W_b^2}\expct\pbox{W_c^2} + \expct\pbox{W_c^2}\expct\pbox{W_a^2} + \\
&\qquad \expct\pbox{2W_a^2}\expct\pbox{W_b}\expct\pbox{W_c} + \expct\pbox{2W_a}\expct\pbox{W_b^2}\expct\pbox{W_c} + \expct\pbox{2W_a}\expct\pbox{W_b}\expct\pbox{W_c^2}\\
&\expct\pbox{\poly^2(W_a, W_b, W_c)}\\
&= \expct\pbox{W_a^2}\expct\pbox{W_b^2} + \expct\pbox{W_b^2}\expct\pbox{W_c^2} + \expct\pbox{W_c^2}\expct\pbox{W_a^2} +\\
&\qquad \expct\pbox{2W_a^2}\expct\pbox{W_b}\expct\pbox{W_c} + \expct\pbox{2W_a}\expct\pbox{W_b^2}\expct\pbox{W_c} +\\
&\qquad \expct\pbox{2W_a}\expct\pbox{W_b}\expct\pbox{W_c^2}\\
= &\prob^2 + \prob^2 + \prob^2 + 2\prob^3 + 2\prob^3 + 2\prob^3\\
= & 3\prob^2(1 + 2\prob) \neq \poly(\prob, \prob, \prob).
\end{align*}
@ -116,7 +161,17 @@ Define $\rpoly(\vct{X})$ to be the resulting polynomial when all exponents $e >
As seen in the example, a compressed polynomial can be exponentially smaller in $k$ for $k$-products. It is also always the case that computing the expectation of an output polynomial in SOP is always linear in the size of the polynomial, since expecation can be pushed through addition.
This works seeks to explore the complexity landscape for compressed representations of polynomials. Up to this point the message seems consistent that bags are always easy, but is it always the case that bags are easy in the size of the polynomial? We prove that bags are not always linear via a reduction to known hardness results in graph theory. We then introduce an approximation algorithm with confidence guarantees to compute $\rpoly(\vct{X})$ in linear time. Further, our apporximation algorithm generalizes to the $\bi$ model as well.
This works seeks to explore the complexity landscape for compressed representations of polynomials. We use the term 'easy' to mean linear time, and the term 'hard' to mean superlinear time. Up to this point the message seems consistent that bags are always easy, but
\begin{Question}
Is it always the case that bags are easy in the size of the polynomial?
\end{Question}
If bags \textit{are} always easy for any compressed version of the polynomial, then there is no need for improvement. But, if proveably not, then the option to approximate the computation over a compressed polynomial in linear time is desirable.
When we consider the query
\begin{equation*}
\poly^3() := \rel(A), E(A, B), R(B), \rel(C), E(C, D), R(D), \rel(F), E(F, G), R(G),
\end{equation*}
the answer is no in the general case. Upon inspection one can see that the factorized output polynomial consists of three terms, while the SOP version consists of $3^3$ terms. We show in this paper that this particular query is hard given a factorized polynomial as input. We show this via a reduction to known hardness results in graph theory. The fact that bags are not easy in the general case when considering compressed polynomials necessitates an approximation algorithm that computes the expected multiplicity of the output in linear time when the output polynomial is in factorized form. We introduce such an approximation algorithm with confidence guarantees to compute $\rpoly(\vct{X})$ in linear time. Further, our apporximation algorithm generalizes to the $\bi$ model as well.
%\[\poly^3() := \left(\rel(A), E(A, B), R(B)\right) \times \left(\rel(A), E(A, B), R(B)\right)\times \left(\rel(A), E(A, B), R(B)\right),\]
%it is then the case that output polynomial in a compressed version is

View file

@ -482,6 +482,7 @@
\newtheorem{Claim}{Claim}
\newtheorem{Example}{Example}
\newtheorem{Axiom}{Axiom}
\newtheorem{Question}{Question}
\definecolor{db}{RGB}{23,20,119}
\definecolor{dg}{RGB}{2,101,15}
%\newtheoremstyle{assumption}{}{}{\color{blue}\itshape}{}{\color{blue}\bfseries}{:}{\newline}{}