Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 9 additions & 33 deletions latex/hashing.tex
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,6 @@ \subsection{Multiplicative Hashing}
as required.
\end{proof}

Now, we want to prove \lemref{universal-hashing}, but first we need a
result from number theory. In the following proof, we use the notation
$(b_r,\ldots,b_0)_2$ to denote $\sum_{i=0}^r b_i2^i$, where each $b_i$
is a bit, either 0 or 1. In other words, $(b_r,\ldots,b_0)_2$ is
the integer whose binary representation is given by $b_r,\ldots,b_0$.
We use $\star$ to denote a bit of unknown value.

\begin{lem}\lemlabel{hashing-mapping}
Let $S$ be the set of odd integers in $\{1,\ldots,2^{#w#}-1\}$; let $q$
and $i$ be any two elements in $S$. Then there is exactly one value
Expand All @@ -215,32 +208,8 @@ \subsection{Multiplicative Hashing}
\begin{equation}
(#z#-#z#')q = k 2^{#w#} \eqlabel{factors}
\end{equation}
for some integer $k$. Thinking in terms of binary numbers, we have
\[
(#z#-#z#')q = k\cdot(1,\underbrace{0,\ldots,0}_{#w#})_2 \enspace ,
\]
so that the #w# trailing bits in the binary representation of
$(#z#-#z#')q$ are all 0's.

Furthermore $k\neq 0$, since $q\neq 0$ and $#z#-#z#'\neq 0$. Since $q$
is odd, it has no trailing 0's in its binary representation:
\[
q = (\star,\ldots,\star,1)_2 \enspace .
\]
Since $|#z#-#z#'| < 2^{#w#}$, $#z#-#z#'$ has fewer than #w# trailing
0's in its binary representation:
\[
#z#-#z#' = (\star,\ldots,\star,1,\underbrace{0,\ldots,0}_{<#w#})_2
\enspace .
\]
Therefore, the product $(#z#-#z#')q$ has fewer than #w# trailing 0's in
its binary representation:
\[
(#z#-#z#')q = (\star,\cdots,\star,1,\underbrace{0,\ldots,0}_{<#w#})_2
\enspace .
\]
Therefore $(#z#-#z#')q$ cannot satisfy \myeqref{factors}, yielding a
contradiction and completing the proof.
for some integer $k$. Since $z$ is in $S$, $k$ is necessarily zero,
which means that $z=z'$, a contradiction. This completes the proof.
\end{proof}

The utility of \lemref{hashing-mapping} comes from the following
Expand All @@ -249,6 +218,13 @@ \subsection{Multiplicative Hashing}
to think of the binary representation of #z#, which consists of $#w#-1$
random bits followed by a 1.

Now, we want to prove \lemref{universal-hashing}, but first we need a
result from number theory. In the following proof, we use the notation
$(b_r,\ldots,b_0)_2$ to denote $\sum_{i=0}^r b_i2^i$, where each $b_i$
is a bit, either 0 or 1. In other words, $(b_r,\ldots,b_0)_2$ is
the integer whose binary representation is given by $b_r,\ldots,b_0$.
We use $\star$ to denote a bit of unknown value.

\begin{proof}[Proof of \lemref{universal-hashing}]
First we note that the condition $#hash(x)#=#hash(y)#$ is equivalent to
the statement ``the highest-order #d# bits of $#z# #x#\bmod2^{#w#}$
Expand Down