% -*- root: main.tex -*-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%RA-to-Poly Notation
\newcommand{\polyinput}[2]{\left(#1,\ldots, #2\right)}
\newcommand{\numvar}{n}
\newcommand{\rel}{R}
\newcommand{\prel}{\mathcal{\rel}}
\newcommand{\reli}{S}
\newcommand{\relii}{T}
\newcommand{\db}{D}
\newcommand{\idb}{\Omega}
\newcommand{\nxdb}{D(\vct{X})}%\mathbb{N}[\vct{X}] db
\newcommand{\tset}{\mathcal{T}}%the set of tuples in a database
\newcommand{\pd}{P}%pd for probability distribution
\newcommand{\eval}[1]{\llbracket #1 \rrbracket}%evaluation double brackets
\newcommand{\query}{Q}
\newcommand{\join}{\Join}
\newcommand{\select}{\sigma}
\newcommand{\project}{\pi}
\newcommand{\union}{\cup}
\newcommand{\sch}{sch}
\newcommand{\rw}{\textbf{W}}%\rw for random world
\newcommand{\graph}[1]{G^{(#1)}}
\newcommand{\eset}[1]{S^{(#1)}} %edge set for arbitrary subgraph
\newcommand{\linsys}[1]{LS(\graph{#1})}
\newcommand{\lintime}[1]{LT^{\graph{#1}}}
\newcommand{\aug}[1]{AUG^{\graph{#1}}}
\newcommand{\mtrix}[1]{M_{#1}}
\newcommand{\dtrm}[1]{Det\left(#1\right)}

%Approx Alg
\newcommand{\randvar}{Y}
\newcommand{\coeffset}{S}
\newcommand{\distinctvars}{d}
\newcommand{\coeffitem}[1]{c_{#1}\cdot\prob^{\distinctvars_{#1}}}
\newcommand{\unidist}[1]{Uniform\left(#1\right)}
\newcommand{\samplesize}{N}
\newcommand{\setsize}{m}
\newcommand{\empmean}{\overline{\vct{\randvar}}}
\newcommand{\setsum}{SUM}
\newcommand{\ave}[1]{AVG(#1)}
\newcommand{\hoeffestsum}{EST_{\setsum}}
\newcommand{\error}{\epsilon}
\newcommand{\conf}{\delta}


%Pseudo Code Notation
\newcommand{\plus}{\texttt{+}}
\newcommand{\mult}{\texttt{\times}}
\newcommand{\algname}[1]{\textsc{#1}}
\newcommand{\approxq}{\algname{Approximate$\rpoly$}}
\newcommand{\onepass}{\algname{OnePass}}
\newcommand{\sampmon}{\algname{SampleMonomial}}
\newcommand{\ceil}[1]{\left\lceil #1 \right\rceil}
\newcommand{\vari}[1]{\texttt{#1}}
\newcommand{\accum}{\vari{acc}}
\newcommand{\numsamp}{\vari{N}}
\newcommand{\numedge}{m}
%expression tree T
\newcommand{\etree}{\vari{T}}
\newcommand{\stree}{\vari{S}}
\newcommand{\lchild}{\vari{L}}
\newcommand{\rchild}{\vari{R}}
%members of T
\newcommand{\val}{\vari{val}}
\newcommand{\type}{\vari{type}}
\newcommand{\wght}{\vari{weight}}
%types of T
\newcommand{\var}{var}
\newcommand{\tnum}{num}
%%%%%%%
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\newcommand{\smb}{\poly\left(\vct{X}\right)}%smb for standard monomial basis
\newcommand{\etreeset}[1]{\vari{ET}\left(#1\right)}
\newcommand{\expandtree}[1]{\vari{E}(#1)}
%expandtree tuple elements:
\newcommand{\monom}{\vari{v}}
\newcommand{\coef}{\vari{c}}
%----------------------------------
\newcommand{\abs}[1]{\left|#1\right|}
\newcommand{\func}[1]{\textsc{#1}}
\newcommand{\polyf}{\func{poly}}
\newcommand{\evalmp}{\func{eval}}
\newcommand{\degree}{\func{deg}}
\newcommand{\treesize}{\func{size}}
\newcommand{\sign}{\func{sgn}}


%PDBs
\newcommand{\ti}{TIDB}

%Polynomial Reformulation
\newcommand{\wbit}{w}
\newcommand{\expct}{\mathop{\mathbb{E}}}
\newcommand{\pbox}[1]{\left[#1\right]}
\newcommand{\pbrace}[1]{\left\{#1\right\}}
\newcommand{\vct}[1]{\textbf{#1}}
%using \wVec for world bit vector notation
\newcommand{\poly}{Q}
\newcommand{\rpoly}{\widetilde{Q}}%r for reduced as in reduced 'Q'
\newcommand{\out}{output}%output aggregation over the output vector
\newcommand{\numocc}[2]{\#\left(#1, #2\right)}
	%Graph Symbols
	%Global styles
	\tikzset{
		default_node/.style={align=center, inner sep=0pt},
		pattern_node/.style={fill, draw, inner sep=0pt, minimum size = 2pt, circle},
		tree_node/.style={default_node, draw=black, black, circle, text width=0.3cm, font=\bfseries, minimum size=0.65cm}
		}
	%Subgraph patterns
	\newcommand{\ed}{
					\begin{tikzpicture}%[baseline=0.00005cm]
					%\begin{scope}[yshift=-0.1cm]
						\node at (0, 0)[pattern_node](bottom){};
						\node [above=0.07cm of bottom, pattern_node] (top){};
						\draw[semithick] (top) -- (bottom);
					%\end{scope}
					\end{tikzpicture}
				}
	\newcommand{\twodis}{
						\begin{tikzpicture}
							\node at (0, 0) [pattern_node] (bottom1) {};
							\node[above=0.07cm of bottom1, pattern_node] (top1) {} edge [semithick] (bottom1);
							\node at (0.14, 0) [pattern_node] (bottom2) {};
							\node [above=0.07cm of bottom2, pattern_node] (top2) {} edge [semithick] (bottom2);
						\end{tikzpicture}
						}
	\newcommand{\twopath}{
						\begin{tikzpicture}
							\node at (0, 0.08) [pattern_node] (top){};
							\node [below left=0.08cm and 0.01cm of top, pattern_node](left){};
							\node[below right=0.08cm and 0.01cm of top, pattern_node](right){};
							\draw[semithick](top) -- (left);
							\draw[semithick](top) -- (right);
						\end{tikzpicture}
					}
	\newcommand{\threedis}{
						\begin{tikzpicture}
							\node at (0, 0) [pattern_node] (bottom1) {};
							\node[above=0.07cm of bottom1, pattern_node] (top1) {} edge [semithick] (bottom1);
							\node at (0.14, 0) [pattern_node] (bottom2) {};
							\node [above=0.07cm of bottom2, pattern_node] (top2) {} edge [semithick] (bottom2);
							\node at (0.28, 0) [pattern_node] (bottom3) {};
							\node [above=0.07cm of bottom3, pattern_node] (top3) {} edge [semithick] (bottom3);
						\end{tikzpicture}
					}
	\newcommand{\tri}{
						\begin{tikzpicture}
							\node at (0, 0.08) [pattern_node] (top){};
							\node [below left=0.08cm and 0.01cm of top, pattern_node](left){} edge [semithick] (top);
							\node[below right=0.08cm and 0.01cm of top, pattern_node](right){} edge [semithick] (top) edge [semithick] (left);
						\end{tikzpicture}
					}
	\newcommand{\twopathdis}{\ed~\twopath}
	\newcommand{\threepath}{
						\begin{tikzpicture}
							\node at (0, 0) [pattern_node] (node1a) {};
							\node [above=0.07cm of node1a, pattern_node] (node1b) {} edge [semithick] (node1a);
							\node [right=0.099cm of node1a, pattern_node] (node2b) {}; %edge [semithick] (node1b);
							\node [above=0.07cm of node2b, pattern_node] (node3b) {} edge [semithick] (node2b) edge [semithick] (node1b);
						\end{tikzpicture}
					}
	\newcommand{\oneint}{
						\begin{tikzpicture}[level/.style={sibling distance=0.14cm, level distance=0.15cm}]
							\node at (0, 0) [pattern_node] {} [grow=down, semithick]
								child{node [pattern_node]{}}
								child [thick] {node [pattern_node] {}}
								child{node [pattern_node] {}};
						\end{tikzpicture}
					}

%%%%%%%%%%%%%%%%%%%
%Pretty much everything below is from the old Sketching paper
%%%%%%%%%%%%%%%%%%%
%David's Scheme
\newcommand{\vecform}[1]{\textbf{#1}}%auxiliary cmd to use only with macros, so that we can change the format easily if need be
\newcommand{\sone}{\vecform{x}}
\newcommand{\stwo}{\vecform{y}}
\newcommand{\veclen}{n}%vector length
\newcommand{\hp}{HP}%hadamard product notation
%
%Sum of Products
%
\newcommand{\sop}{SOP}
\newcommand{\sopsize}{p}
\newcommand{\sopind}{h}
\newcommand{\sopest}[1]{\sop_{\est_{#1}}}

%
%SKETCH
%
\newcommand{\surj}{f}
\newcommand{\surjSet}{\textbf{F}}
\newcommand{\mtupSet}{\wSet^{\prec}_{\dist}}
\newcommand{\disttup}{\boldsymbol{\dw}}
\newcommand{\kdisttup}[1]{\disttup_{#1}}
\newcommand{\ftup}{\surj_{tup}}
\newcommand{\vect}[1][v]{\textbf{#1}}
\newcommand{\wElem}{w}
\newcommand{\dw}{\widetilde{\wElem}}
\newcommand{\wSet}{\Omega}
\newcommand{\sine}{s}
\newcommand{\hfunc}{h}
\newcommand{\est}{est}
\newcommand{\conj}[1]{\overline{#1}}
\newcommand{\ind}[1]{\underset{#1}{\mathbbold{1}}}
\newcommand{\had}{\circ}
\newcommand{\pos}{POS}
\newcommand{\sketchCols}{B}
\newcommand{\sketchRows}{M}
\newcommand{\buck}{j}

%
%many of these are outdated and need to be cleaned up
%
\newcommand{\cvar}{\lambda}

\newcommand{\sk}{\mathcal{S}}
\newcommand{\sketch}{\mathcal{S}_t}
\newcommand{\sketchIj}{\sketch[i][j]}
\newcommand{\sketchJParam}[1]{\sketch\paramBox{i}\paramBox{#1}}
\newcommand{\sCom}[2]{\mathcal{S}_{#1}\paramBox{i}\paramBox{#2}}
\newcommand{\hash}[1][i]{h_{#1}}
\newcommand{\hashP}[1]{\hash\paramBox{#1}}
\newcommand{\pol}[1][i]{s_{#1}}
\newcommand{\polP}[1]{\pol\paramBox{#1}}
\newcommand{\polI}[2]{s_{#1}\paramBox{#2}}
\newcommand{\gIJ}{\gamma\paramBox{i}\paramBox{j}}

\newcommand{\kvec}{k}
\newcommand{\jVec}{\textbf{j}}
\newcommand{\lenB}{b}
\newcommand{\hVec}{\textbf{h}_{i,k}}
\newcommand{\matrixH}{H}
\newcommand{\hVecMatrix}{\begin{pmatrix*}[l]
		h_{i, 0, 0}&\cdots &h_{0, \numTup} \\
		\vdots \\
		h_{i, \lenB-1, 0} &\cdots &h_{\lenB-1, \numTup}
		\end{pmatrix*}}
\newcommand{\vecCol}[2]{\begin{pmatrix}
					{#1}_0 \\
					\vdots \\
					{#1}_{#2}
					\end{pmatrix}}
\newcommand{\jpbit}[1]{\buck^{(#1)}}
\newcommand{\polSum}{Bias(j, \hash, \pol)}

%
%proof symbols
%
\newcommand{\rou}{\omega}
%
%functions
%
\newcommand{\match}[2]{#1 \simeq #2}
\newcommand{\dist}{m}
\newcommand{\dupSize}{j}
\newcommand{\dMap}[1]{\widetilde{#1}}

\newcommand{\order}{O}

%
%number of joins/products
%
\newcommand{\prodsize}{k}

%
%terms
%
\newcommand{\term}{T}

%
%TIDB
%

%
%many of these are outdated and need to be cleaned up
%
\newcommand{\paramBox}[1]{\left({#1}\right)}
\newcommand{\bigParamBox}[1]{\big[{#1}\big]}
\newcommand{\st}{~|~}
\newcommand{\pw}{W}
\newcommand{\numWorlds}{2^N}
\newcommand{\prob}{p}
\newcommand{\numWorldsP}{\numWorlds\prob}
\newcommand{\numWorldsSum}{\sum_{\wVec \in \pw}\kMap{t}[\wVec]}
\newcommand{\numTup}{N}
%\newcommand{\kMap}{v_t}
\newcommand{\kMap}[1]{v_{#1}}
\newcommand{\kMapParam}[1]{\kMap{t}\paramBox{#1}}
\newcommand{\genV}{v}
\newcommand{\gVP}[2]{\genV_{#1}\paramBox{#2}}
\newcommand{\genVParam}[1]{\genV\paramBox{#1}}
\newcommand{\genKMap}[1]{v\paramBox{#1}}
\newcommand{\gVt}[1]{\textcolor{blue}{#1}}
\newcommand{\wVec}[1][w]{\textbf{#1}}
\newcommand{\wVecPrime}{\wVec[w']}
%%%%%%%%%%%%%%%%
%maybe easier this way:
%WVector Notation
%%%%%%%%%%%%%%%%

%
%many of these are outdated and need to be cleaned up
%
\newcommand{\w}{\wVec}
\newcommand{\wa}{\wVec_a}
\newcommand{\wb}{\wVec_b}
\newcommand{\wc}{\wVec_c}
\newcommand{\wVecD}{\wVec_d}
\newcommand{\wOneP}{\wVecPrime_1}
\newcommand{\wOne}{\wVec_1}
\newcommand{\wTwoP}{\wVecPrime_2}
\newcommand{\wTwo}{\wVec_2}
\newcommand{\wThree}{\wVec_3}
\newcommand{\wFour}{\wVec_4}
%%%%%%%%%%%%%%%%
%4-way cases
%%%%%%%%%%%%%%%%

%
%many of these are outdated and need to be cleaned up
%
\newcommand{\polarProdNEq}{\polP{\wOne}\cdot\polP{\wOneP}\cdot\polP{\wTwo}\cdot\polP{\wTwoP}}%
\newcommand{\polarProdEq}{\polP{\wa}\cdot\polP{\wb}\cdot\polP{\wc}\cdot\polP{\wVecD}}%
\newcommand{\elems}{\wa, \wb, \wc, \wVecD}
\newcommand{\nElems}{\wOne, \wOneP, \wTwo, \wTwoP}
\newcommand{\forAllW}[1]{\forall (\elems) \in {#1}}
\newcommand{\forAllNW}[1]{\forall (\nElems) \in {#1}}
\newcommand{\lab}[1]{#1}
\newcommand{\distPattern}[1]{\lab{S_{#1}}}
\newcommand{\vCase}[1]{\lab{Variant }{#1}}
\newcommand{\forElems}[1]{\{~(\elems~)\st {#1}, \elems \in \pw\}}
\newcommand{\forNElems}[1]{\{~(\nElems~)\st {#1}, \nElems \in \pw\}}
\newcommand{\cOne}{\wOne= \wOneP = \wTwo = \wTwoP}
\newcommand{\cTwo}{\wa = \wb \neq \wc = \wVecD}
\newcommand{\cThree}{\wa = \wb = \wc \neq \wVecD}
\newcommand{\cFour}{\wa = \wb \neq \wc \neq \wVecD}
\newcommand{\cFive}{\wOne \neq \wOneP \neq \wTwo \neq \wTwoP}
\newcommand{\cTwoV}[4]{{#1} =  {#2} \neq {#3} = {#4}}

\newcommand{\relation}{R}
\newcommand{\expect}[1]{\mathop{\mathbb{E}}\bigParamBox{#1}}
\newcommand{\ex}[1]{\mathop{\mathbb{E}}\left[{#1}\right]}
\newcommand{\multLineExpect}{\mathop{\mathbb{E}}}
\newcommand{\sigsq}{\sigma^2}
%\newcommand{\var}{Var}
\newcommand{\varParam}[1]{Var\bigParamBox{#1}}
\newcommand{\varSym}{\sd^2}
\newcommand{\sd}{\sigma}
\newcommand{\sdEq}{\numWorlds\big(\sqrt{\frac{2\prob}{\sketchCols}}\big)}
\newcommand{\sdRelVar}{\sqrt{\frac{2}{\sketchCols\prob}}}
\newcommand{\sdRel}{\sd_{rel}}
\newcommand{\errB}{\epsilon}
%%%%%%%%%%%%%%%%%
%Chebyshev
%%%%%%%%%%%%%%%%%

%
%many of these are outdated and need to be cleaned up
%
\newcommand{\pr}[2]{Pr\big[|X - \mu| > {#1}\big] < {#2}}
\newcommand{\cheby}{\pr{\Delta}{\frac{1}{3}}}
\newcommand{\chebyK}{\pr{k\sd}{\frac{2}{\prob\errB^2\sketchCols}}}

%%%%%%%%%%%%%%%%%
% Equations
%%%%%%%%%%%%%%%%%

%
%many of these are outdated and need to be cleaned up
%
\newcommand{\polarFuncSum}[1][]{\sum_{\substack{\wVecPrime ~|~ \\
													\hash\left[\wVecPrime\right] = j\\
													{#1}}}\polP{\wVecPrime}}
\newcommand{\estimate}{\sum_{j \in \sketchCols} \sketchIj \cdot \polarFuncSum }
\newcommand{\estExpOne}{\sum_{\substack{j \in \sketchCols, \\
								\wVec \in \pw ~|~\hash\left[\wVec\right] = j}} \kMap{t} \cdot\polP{\wVec} \cdot \polarFuncSum}
\newcommand{\estTwo}{\sum_{\substack{j \in [B],\\
			 \wVec \in \pw~|~ \hash{[\wVec]} = j,\\
			 \wVec[w']\in \pw~|~ \hash{[\wVec[w']]} = j} } v_t[\wVec] \cdot s_i[\wVec] \cdot s_i[\wVec[w']]}
\newcommand{\estExp}{ \sum_{\substack{j \in [B],\\
				\wVec~|~\hashP{\wVec}= j,\\}} \kMapParam{\wVec}}
\newcommand{\distPatOne}{\sum_{\wVec \in \pw}\expect{ \kMapParam{\wVec}^2}}
\newcommand{\variantOne}{\sum_{\wOne \neq \wTwo}\kMapParam{\wOne} \cdot \kMapParam{\wTwo}}
\newcommand{\variantTwo}{\sum_{\substack{\wVec \neq \wVecPrime,\\
											\hashP{\wVec} = \hashP{\wVecPrime}}} \big| \hashP{\wVec} = \hashP{\wVecPrime} \big|\cdot \kMapParam{\wVec}^2}
\newcommand{\variantThree}{\sum_{\substack{\wOne \neq \wTwo,\\
							\hashP{\wOne} = \hashP{\wTwo}}} \kMapParam{\wOne} \cdot \kMapParam{\wTwo}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COMMENTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\BG}[1]{\todo[inline]{\textbf{Boris says:$\,$} #1}}
\newcommand{\SF}[1]{\todo[inline]{\textbf{Su says:$\,$} #1}}
\newcommand{\OK}[1]{\todo[inline]{\textbf{Oliver says:$\,$} #1}}
\newcommand{\AH}[1]{\todo[inline, backgroundcolor=cyan]{\textbf{Aaron says:$\,$} #1}}
\newcommand{\SR}[1]{\todo[inline, backgroundcolor=white]{\textbf{Note to self:$\,$} #1}}
\newcommand{\AR}[1]{\todo[inline, color=green]{\textbf{Atri says:$\,$} #1}}

%
%many of these are outdated and need to be cleaned up
%
\newcommand{\startOld}[1]{\textcolor{purple}{-------------------------\newline\textbf{Old}\textit{ #1 \newline} }------------------------------\newline}
\newcommand{\finOld}{\newline\textcolor{purple}{------------------------------\newline\textbf{END}\text{ Old}\newline ------------------------------\newline}}
%\newcommand{\comment}[1]{}


%
%borrowed from Su and Boris; Ihave them here for reference purposes.
%needs to be cleaned up
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DETAILED PROOFS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newbool{ShowDetailedProofs}
\newcommand{\detailedproof}[2]{\ifbool{ShowDetailedProofs}{
\begin{proof}
#2
\end{proof}
}{\noindent\textit{Proof Sketch:}#1\qed}\smallskip}
\newcommand{\ifnotdetailedproof}[1]{\ifbool{ShowDetailedProofs}{}{#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% STRUCTURE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\mypar}[1]{\smallskip\noindent\textbf{{#1}.}}
\newcommand{\bfcaption}[1]{\caption{\textbf{#1}}}
\newcommand{\trimfigurespacing}{\vspace*{-5mm}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% THEOREM LIKE ENVIRONMENTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareMathAlphabet{\mathbbold}{U}{bbold}{m}{n}

\newtheorem{Theorem}{Theorem}[section]
\newtheorem{Definition}{Definition}
\newtheorem{Lemma}{Lemma}
\newtheorem{Proposition}{Proposition}
\newtheorem{Property}{Property}
\newtheorem{Corollary}{Corollary}
\newtheorem{Claim}{Claim}
\newtheorem{Example}{Example}
\newtheorem{Axiom}{Axiom}
\definecolor{db}{RGB}{23,20,119}
\definecolor{dg}{RGB}{2,101,15}
%\newtheoremstyle{assumption}{}{}{\color{blue}\itshape}{}{\color{blue}\bfseries}{:}{\newline}{}
%\theoremstyle{assumption}
\newtheorem{Assumption}{Assumption}
\newtheoremstyle{justification}{}{}{\color{green}\itshape}{}{\color{green}\bfseries}{:}{\newline}{}
\theoremstyle{justification}
\newtheorem{Justification}{Justification}
\newcommand{\eq}[1]{Equation {#1}}
\newcommand{\norm}[1]{\|{#1}\|}


\newcommand{\proofpara}[1]{\medskip\noindent\underline{{#1}:}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% MATH UTILS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\mathtext}[1]{\ensuremath{\,\text{#1}\,}}
\newcommand{\card}[1]{\vert{#1}\vert}

% allow for more bb math symbols:
\DeclareMathAlphabet{\mathbbold}{U}{bbold}{m}{n}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Rel model
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\schema}{\mathbf{D}}
\newcommand{\relschema}{\mathbf{R}}
\newcommand{\schemaOf}{\textsc{Sch}}
\newcommand{\arity}[1]{arity({#1})}
%\newcommand{\rel}{R}
%\newcommand{\query}{Q}
\newcommand{\qClass}{\mathcal{C}}
% \newcommand{\uDom}{\mathcal{U}}
\newcommand{\tup}{t}
\newcommand{\multip}{n}
\newcommand{\aDom}{\mathbb{D}}
\newcommand{\aVal}{d}
\newcommand{\tupDom}{\textsc{TupDom}}
\newcommand{\tuple}[1]{\left<\;\textsf{\upshape #1}\;\right>}
\newcommand{\comprehension}[2]{\left\{\;#1\;|\;#2\;\right\}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Algebra
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\intersection}{\cap}
\newcommand{\rename}{\rho}
\newcommand{\aggregation}[2]{{}_{#1}\gamma_{#2}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Query Languages and Classes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\raPlus}{\mathcal{RA}^{+}}
\newcommand{\raFull}{\mathcal{RA}}
\newcommand{\raAgg}{\mathcal{RA}^{agg}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ABBREVIATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\abbrPDB}{PDB\xspace}
\newcommand{\abbrPDBs}{PDBs\xspace}
\newcommand{\abbrIDB}{IDB\xspace}
\newcommand{\abbrPQP}{PQP\xspace}
\newcommand{\abbrPQPs}{PQPs\xspace}
\newcommand{\abbrUQP}{UQP\xspace}
\newcommand{\abbrBGQP}{BGQP\xspace}
\newcommand{\abbrBGQPs}{BGQPs\xspace}
\newcommand{\abbrCAQP}{CAQP\xspace}
\newcommand{\abbrCAQPs}{CAQPs\xspace}
\newcommand{\abbrUADB}{UA-DB\xspace}
\newcommand{\abbrUADBs}{UA-DBs\xspace}
\newcommand{\abbrTI}{TI-DB\xspace}
\newcommand{\abbrTIs}{TI-DBs\xspace}
\newcommand{\abbrCoddTable}{Codd-table\xspace}
\newcommand{\abbrCoddTables}{Codd-tables\xspace}
\newcommand{\abbrVtable}{V-table\xspace}
\newcommand{\abbrVtables}{V-tables\xspace}
\newcommand{\abbrCtable}{C-table\xspace}
\newcommand{\abbrCtables}{C-tables\xspace}
\newcommand{\abbrPCtable}{PC-table\xspace}
\newcommand{\abbrPCtables}{PC-tables\xspace}
\newcommand{\abbrVCtable}{Virtual C-table\xspace}
\newcommand{\abbrVCtables}{Virtual C-tables\xspace}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COMPLEXITY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\ptime}{\texttt{PTIME}\xspace}
\newcommand{\npcomplete}{NP-complete\xspace}
\newcommand{\conpcomplete}{coNP-complete\xspace}
\newcommand{\conphard}{coNP-hard\xspace}
\newcommand{\sharpP}{\texttt{\#P}\xspace}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% UNCERTAINTY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\cSet}{certain}
\newcommand{\pSet}{possible}
\newcommand{\cMult}{certainMult}
\newcommand{\pMult}{possibleMult}
\newcommand{\cMatches}{certainMatchMult}
\newcommand{\pMatches}{possibleMatchMult}
\newcommand{\pdb}{\mathcal{D}}
\newcommand{\bestG}[1]{BestGuess(#1)}
\newcommand{\uadb}{\db_{UA}}
\newcommand{\bgdb}{D_{bg}}
%\newcommand{\prob}{P}
\newcommand{\probOf}[1]{\prob(#1)}
\newcommand{\pTupMult}[2]{\prob({#1}, \geq {#2})}
\newcommand{\rowsmr}{\mathcal{K}_{uncert}}
\newcommand{\tmatches}{\simeq}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% UNCERTAINTY LABELINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\redL}[1]{\textcolor{red}{{#1}}}
\newcommand{\tcMarker}{T}
\newcommand{\tuMarker}{\textcolor{red}{F}}
\newcommand{\uMarker}[1]{\ensuremath{{#1}{}^{\tuMarker}}}
\newcommand{\cMarker}[1]{\ensuremath{{#1}{}^{\tcMarker}}}
\newcommand{\notHere}{\ensuremath{\bot}}
\newcommand{\uLabels}{\mathcal{U}}
\newcommand{\labelOf}{\textsc{label}}
\newcommand{\uDom}{{\aDom_{\uLabels}}}
\newcommand{\typeTI}{TI}
\newcommand{\typePC}{pc}
\newcommand{\TUL}{\mathcal{L}}
\newcommand{\TULDom}{\mathbb{L}}
\newcommand{\doTUL}{\textsf{label}}
\newcommand{\TULscheme}{\textsc{Lab}}

\newcommand{\TULschemeTI}{\TULscheme_{\abbrTI}}

\newcommand{\TULschemeCtable}{\TULscheme_{\abbrCtable}}

\newcommand{\TULtype}[1]{\mathcal{L}_{#1}}
\newcommand{\TULTI}{\TULtype{\typeTI}}
\newcommand{\TULC}{\TULtype{\typePC}}
\newcommand{\AUL}{\mathcal{L}_{A}}
\newcommand{\AULtype}[1]{\mathcal{L}_{#1}}
\newcommand{\aLabel}{l}
\newcommand{\lVal}{{d^{\aLabel}}}
\newcommand{\ldb}{\db_{\aLabel}}
\newcommand{\ltupDom}{\textsc{TupDom}_{\uLabels}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SEMIRINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\semN}{\mathbb{N}}
\newcommand{\semB}{\mathbb{B}}
\newcommand{\semNX}{\mathbb{N}[X]}

\newcommand{\semK}{\mathcal{K}}

\newcommand{\onesymbol}{\mathbbold{1}}
\newcommand{\zerosymbol}{\mathbbold{0}}
\newcommand{\multsymb}{\otimes}
\newcommand{\addsymbol}{\oplus}
\newcommand{\addormultsymbol}{\bigcdot}
\newcommand{\monsymbol}{\ominus}

\newcommand{\kDom}{K}
\newcommand{\addK}{\addsymbol_{\semK}}
\newcommand{\multK}{\multsymb_{\semK}}
\newcommand{\genopK}{\odot_{\semK}}
\newcommand{\monK}{\monsymbol_{\semK}}
\newcommand{\oneK}{\onesymbol_{\semK}}
\newcommand{\zeroK}{\zerosymbol_{\semK}}
\newcommand{\addOf}[1]{\addsymbol_{#1}}
\newcommand{\multOf}[1]{\multsymb_{#1}}
\newcommand{\monOf}[1]{\monsymbol_{#1}}
\newcommand{\oneOf}[1]{\onesymbol_{#1}}
\newcommand{\zeroOf}[1]{\zerosymbol_{#1}}

\newcommand{\dbDomK}[1]{\mathcal{DB}_{#1}}

%%%%% natural order
\newcommand{\ordersymbol}{\preceq}
\newcommand{\geqsymbol}{\succeq}
\newcommand{\ordK}{\ordersymbol_{\semK}}
\newcommand{\gordK}{\geqsymbol_{\semK}}
\newcommand{\geqK}{\geqsymbol_{\semK}}
\newcommand{\ordOf}[1]{\ordersymbol_{#1}}

\newcommand{\aHom}{h}

%%%%% natural order lattice
\newcommand{\lub}{\sqcup}
\newcommand{\glb}{\sqcap}

\newcommand{\glbKof}[1]{\sqcap{#1}}
%\newcommand{\glbKof}[1]{\left(\bigsqcap_{k\in #1}k\right)}
\newcommand{\glbK}{\glbKof{\semK}}
\newcommand{\lubKof}[1]{\sqcup_{#1}}
%\newcommand{\lubKof}[1]{\left(\bigsqcup_{k\in #1}k\right)}
\newcommand{\lubK}{\lubKof{\semK}}
\newcommand{\LubK}{\sqcup_{\semK}}
\newcommand{\GlbK}{\sqcap_{\semK}}

\newcommand{\minK}{min_{\semK}}
\newcommand{\maxK}{max_{\semK}}
\newcommand{\minOf}[1]{min_{#1}}
\newcommand{\maxOf}[1]{max_{#1}}
\newcommand{\setK}{\vec k}

%%%%%Minima Worlds Semiring
\newcommand{\mwBool}[1]{\mathbb{B}_{#1}}
\newcommand{\mwIfElse}[1]{\mwBool{#1}?\mu_{#1}}
\newcommand{\muMult}{\otimes_{\mu}}
\newcommand{\boolMult}{\otimes_{\mathbb{B}}}
\newcommand{\zeroMW}{\zerosymbol_{mw}}
\newcommand{\oneMW}{\onesymbol_{mw}}
\newcommand{\mwAdd}{\addsymbol_{mw}}
\newcommand{\mwMult}{\multsymb_{mw}}
\newcommand{\hgood}{h_{good}}

%%%%% Sum of Products Proof
\newcommand{\productClauseMin}[1]{\sqcap_{\otimes}{#1}}
\newcommand{\productClauseWorlds}[1]{\productClauseMin{#1}_{worlds}}

%%%%% N-way direct product
\newcommand{\dpK}[2]{{#1}^{#2}}
\newcommand{\dpDom}[2]{{#1}^{#2}}
\newcommand{\doubleK}[1]{\dpK{#1}{2}}
\newcommand{\doubleDom}[1]{\dpDom{#1}{2}}

%%%%% UA-semiring
\newcommand{\uaName}{UA}
\newcommand{\uaK}[1]{{#1}_{\uaName}}
\newcommand{\uaDom}[1]{\kDom{#1_{\uaName}}}
\newcommand{\uaAdd}[1]{\addOf{\uaK{#1}}}
\newcommand{\uaMult}[1]{\multOf{\uaK{#1}}}
\newcommand{\uaZero}[1]{\zeroOf{\uaK{#1}}}
\newcommand{\uaOne}[1]{\oneOf{\uaK{#1}}}

\newcommand{\uae}[2]{[#1,#2]}

\newcommand{\uaN}{\uaK{\semN}}
\newcommand{\uanAdd}{\uaAdd{\semN}}
\newcommand{\uanMult}{\uaMult{\semN}}



%%%%% POSSIBLE WORLD SEMIRINGS
\newcommand{\pwIndicator}{W}
\newcommand{\pwDom}{W}
\newcommand{\pwkDom}{\kDom^{\pwDom}}
\newcommand{\pwK}{\semK_{\pwIndicator}}
\newcommand{\pwKof}[1]{{#1}_{\pwIndicator}}
\newcommand{\pwAdd}{{\addOf{\pwK}}}
\newcommand{\pwMult}{{\multOf{\pwK}}}
\newcommand{\pwZero}{{\zeroOf{\pwK}}}
\newcommand{\pwOne}{{\oneOf{\pwK}}}
\newcommand{\pwWorld}[1]{\textsc{pw}_{{#1}}}
\newcommand{\pwe}[1]{\vec{{#1}}}
\newcommand{\pwHaveCoMinima}[2]{#1 \stackrel{\sqcap}{\sim} #2}
\newcommand{\pwNotHaveCoMinima}[2]{#1 \not \stackrel{\sqcap}{\sim} #2}
\newcommand{\pwHaveGlobalMinima}[1]{\stackrel{\sqcap}{\sim} #1}
\newcommand{\pwNotHaveGlobalMinima}[1]{\not \stackrel{\sqcap}{\sim} #1}

\newcommand{\pwN}{\pwKof{\semN}}
\newcommand{\pwB}{\pwKof{\semB}}

\newcommand{\certainName}{\textsc{cert}}
\newcommand{\possibleName}{\textsc{poss}}
\newcommand{\uncertainName}{\textsc{uncert}}
\newcommand{\pwCertain}{{\certainName}_{\semK}}
\newcommand{\pwUncertain}{{\uncertainName}_{\semK}}
\newcommand{\pwPossible}{{\possibleName}_{\semK}}
\newcommand{\pwCertOf}[1]{{\certainName}_{#1}}
\newcommand{\pwUncertOf}[1]{{\uncertainName}_{#1}}
\newcommand{\pwPossOf}[1]{{\possibleName}_{#1}}
\newcommand{\pwCertainN}{{\certainName}_{\semN}}
\newcommand{\pwUncertainN}{{\uncertainName}_{\semN}}
\newcommand{\pwPossibleN}{{\possibleName}_{\semN}}
\newcommand{\pwCertainB}{{\certainName}_{\semB}}
\newcommand{\pwUncertainB}{{\uncertainName}_{\semB}}
\newcommand{\pwPossibleB}{{\possibleName}_{\semB}}

%%%% K-possible labeling
%\newcommand{\kpossLab}{{\semK}{-}{\Poss}}

%%%% UA-DBS
\newcommand{\uIndicator}{U}
\newcommand{\uK}{\ensuremath{\semK_{\uIndicator}}}
\newcommand{\uKDom}{\ensuremath{\kDom_{\uIndicator}}}

\newcommand{\lCert}{certain}
\newcommand{\Poss}{possible}
\newcommand{\uOfName}{uncert}
\newcommand{\uOf}[1]{h_{\uOfName}({#1})}
\newcommand{\cOfName}{cert}
\newcommand{\cOf}[1]{h_{\cOfName}({#1})}
\newcommand{\dOfName}{det}
\newcommand{\dOf}[1]{h_{\dOfName}({#1})}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ENCODING
\newcommand{\bagEnc}{\textsc{Enc}}
\newcommand{\rewrN}{\textsf{uRewr}}
\newcommand{\uAttr}{U}


\DeclareMathSymbol{\mlq}{\mathord}{operators}{``}
\DeclareMathSymbol{\mrq}{\mathord}{operators}{`'}



%%% Local Variables:
%%% mode: latex
%%% TeX-master: "attrprov"
%%% End:

%%%Adding stuff below so that long chain of display equatoons can be split across pages
\allowdisplaybreaks
