Proofs: Scalable Bloom filter
These are the human proofs of Scalable Bloom filter, at full length.
A scalable Bloom filter has no false negatives and a bounded rate full
This proof shows: correctness, invariant, termination.
Fix the sequence of operations. Each operation does a constant number of steps for each part of each slice it reads, so it ends. Write for the number of slices after the operations, and for the multiset of keys inserted into slice .
Lemma 1 (invariant (S)). After each operation, every slice except the last has count , the last has count between 1 and , the count of slice is , and exactly when some has .
Proof. By induction over the operations. A QUERY changes nothing. Consider INSERT. If there is no slice, or the last slice has count , line L4 appends slice with count 0 and all bits 0; the old last slice now has count exactly , as required for a slice that is not last. Note , since gives , and the code takes in the case . Now the last slice has count below its capacity. Lines L5 and L6 add to , set exactly the bits , and add 1 to the count, which then is between 1 and . No other slice and no other bit changes, and no bit is set to 0.
Theorem 1 (no false negatives). If was inserted, QUERY returns true.
Proof. Let be a slice with . By Lemma 1, for each , so line L8 returns true when the loop reaches slice , unless it returned true before.
Model. For Theorem 2 assume ideal hashing: the values for all slices , parts and keys are independent, and is uniform on . Fix the sequence of inserted keys. Since INSERT does not read any hash value to decide where a key goes, the multisets do not depend on the hash values. Let be a key that is not inserted.
Lemma 2. If and , then .
Proof. For we have , since . So .
Theorem 2 (rate). Slice accepts with probability at most , and QUERY returns true with probability at most .
Proof. Fix and let be the set of distinct keys of , so by Lemma 1. For part let be the number of 1 bits of . By Lemma 1, is a function of the values for only. So are independent, and they are independent of the values , since . Given the , slice accepts with probability . Hence
Each bit of is 0 with probability by Lemma 2, since when , and for the capacity 1 gives the fraction directly. So , and the product is at most . By the choice , .
QUERY returns true only if some slice accepts . The union bound over the slices and the sum of the geometric series give