1 fingerprinting techniques. 2 is x equal to y? = ? = ?
TRANSCRIPT
1
Fingerprinting techniques
2
Is X equal to Y?
=?
=?
3
Are Two Matrices Identical?
4
The problem
• Input: two n-by-n matrices A and B.• Output: determining whether A = B?
A B=?
5
Naïve approach
• Comparing all elements.• Needs n2 comparisons.
Can we reduce the number of comparisons if a small probability
of error is allowed?
6
Fingerprinting approach
1. Choose an n-element column vector r,– where each element of r is either 0 or 1
independently and equally likely.– Comment: As a matter of fact, 0 and 1 can
be any two distinct numbers.
2. Compare Ar and Br, and output whether they are identical.
7
Fingerprinting
A B=?
=?
A r B r
Only n comparisons.
8
Error Probability?
Observation
Theorem
9
Proof
Let . We show that
Under the condition , there is a row of that has non-zero elements. Let be the non-zero elements in row of , where . Clearly,
10
Bounding the probability
We can pretend that is the last random choice of . When all the other elements of are determined, at most one choice of can satisfy the equality
Note that it is possible that neither choice of can satisfy the equality. However, it is impossible that both choices do, since is nonzero.
11
Therefore, …
0.5
12
Criticism: Computing Ar takes Ω(n2) time.
A B=?
=?
A r B r
Only n comparisons.
13
More interesting example:Is AB = C?
• Input: three n-by-n matrices A, B, C.• Output: determining whether AB = C.
• Naïve approach takes O(n3) time for matrix multiplication and O(n2) time for comparison.– Or, the fast matrix multiplication takes O(n2.37)
time.
14
Fingerprinting approach
• Choose an n-element column vector r,– where each element of r is either 0 or 1
independently and equally likely.– Comment: As a matter of fact, 0 and 1 can
be any two distinct numbers.• Compare ABr and Cr, and output
whether they are identical.
15
Fingerprinting
A C=?
=?
B r C r
Only n comparisons.
B
A
Only O(n2) comparisons.Only O(n2) operations
16
Error Probability?
Observation
Theorem
Proof: Straightforward from the previous theorem.
17
Are two Polynomials Identical?
18
Is A(x)*B(x) = C(x)?
• Input: – A(x) and B(x) are two degree-n polynomials.– C(x) is a degree-2n polynomial.
• Output:– Determine whether the product of A(x) and
B(x) is equal to C(x).
19
Naïve approach
• Multiplying A(x) and B(x) takes Ω(n log n) time – e.g., using Fast Fourier Transform.
• Comparing A(x)*B(x) and C(x) takes Ω(n) time.
20
Fingerprinting approach
1. Let R consist of arbitrary 4n distinct numbers.
2. Choose a number r from R uniformly at random.
3. Evaluate A(r)*B(r) and C(r), and output whether they are identical.
• Time complexity– O(n) for computation;– O(1) for comparison.
21
Error Probability?
Observation
Theorem
22
Proof
Under the condition that when can ?
Yes, has to be a root of the degree-2n polynomial
Since has at most 2n roots, randomly choosing an from , no matter what is, has probability at most 0.5 to satisfy .
23
Are Two Strings Identical?
24
The problem
• Input: Two n bit strings A and B.• Output: determining whether A = B.
• Naïve approach requires comparing all n bits of both strings.
25
The story
• Each of Alice and Bob maintains a copy of the same n-bit database. They have to make sure that both copies are indeed identical.
• Can they discover inconsistency with high probability by comparing only poly-log number of bits?
26
Fingerprinting approach
• Let a (resp., b) be the n-bit number whose binary representation is A (resp., B).
• Randomly choose a polylog(n)-bit prime number p. – (For example, p 2≦ n2 log2 n.)
• Alice compute the remainder r of a divided by p.• Bob compute the remainder s of b divided by p.• Output whether r = s.
27
Error Probability?
Observation
Theorem:
where and .
28
Two Facts
• Prime Number Theorem– The number of primes smaller than m is
asymptotically m/ln m.• Observation
– The number of distinct prime divisors of an n-bit number is O(n). (Why?)
29
Proof
Under the condition that can ?
Yes, has to be a (prime) divisor of .
Since , by the well-known Prime Number Theorem, has choices. Since is an n-bit number prime divisors. As a result, the probability that the randomly chosen p happens to be one of those prime divisor of is .