Random-vector fingerprints of matrices #
Freivalds' technique compares two matrices M and N through M *ᵥ x and N *ᵥ x for a
random vector x. This module proves the counting bound behind it. The coordinates of x are
drawn uniformly from a finite set S and encoded in the ring by e : S → R. If every nonzero
d : R makes s ↦ d * e s injective, distinct matrices agree on at most a 1/|S| fraction of
the vectors, and on k independent vectors simultaneously with probability at most 1/|S|^k.
The encoding hypothesis covers the two standard instances. S = Bool with e = bit works
over every ring, giving the bound 1/2 of [MitzenmacherUpfal2017], Theorem 1.4; Section 1.3
there works with square matrices over the integers modulo 2 for convenience. Over a finite
field, e = id gives 1/|F|. [MotwaniRaghavan95], Section 7.1, presents this technique as
fingerprinting.
The proof fixes an entry (i, j) with (M - N) i j ≠ 0. Once the coordinates of x other
than j are fixed, at most one value of x j satisfies row i of (M - N) *ᵥ x = 0. This is
the argument of [MitzenmacherUpfal2017], Theorem 1.4, stated here for rectangular matrices,
arbitrary encodings and an arbitrary non-unital ring.
Main definitions #
Main results #
card_filter_mulVec_eq_mul_card_le:#{x | M *ᵥ (e ∘ x) = N *ᵥ (e ∘ x)} * |S| ≤ |S|^n.card_filter_forall_mulVec_eq_le: thek-vector count#{xs | ∀ t, M *ᵥ (e ∘ xs t) = N *ᵥ (e ∘ xs t)} * |S|^k ≤ |S|^(n*k).toOuterMeasure_mulVec_eq_le,toOuterMeasure_forall_mulVec_eq_le: the uniform-probability forms, at most1/|S|and1/|S|^k.isUniversalHash_mulVec:M ↦ M *ᵥ (e ∘ x)is a1/|S|-universal hash family on matrices with uniform seedx, in the sense ofIsUniversalHash.injective_mul_bit: the0/1encoding satisfies the encoding hypothesis over every ring.
References #
Distinct matrices agree on at most a 1/|S| fraction of the encoded vectors.
Distinct matrices agree on card κ independent encoded vectors for at most a
1/|S|^(card κ) fraction of the tuples.
Distinct matrices agree on a uniform encoded vector with probability at most 1/|S|
([MitzenmacherUpfal2017], Theorem 1.4, for S = Bool).
Distinct matrices agree on all of card κ independent uniform encoded vectors with
probability at most 1/|S|^(card κ).
Random-vector fingerprints form a 1/|S|-universal hash family on matrices. This swaps the
roles in isDeltaUniversalHash_mulVec (Probability.HashFamily.Matrix), where a uniform matrix
is the seed and the vector is the hashed input: here the vector is the seed and the matrix the
input.
The 0/1 encoding of bits satisfies the encoding hypothesis over every ring.