Relative Hamming distance and Hamming distance one #
The coordinates where two functions agree and those where they differ make up all the coordinates
(card_filter_eq_add_hammingDist), so the Hamming distance is the number of coordinates times one
minus the density of the coordinates of agreement (hammingDist_eq_card_mul_one_sub_dens). The
relative Hamming distance is the probability that the two functions differ at a uniformly random
coordinate (hammingDist_div_eq_expect). A distance of at most r + s splits into one of at
most r followed by one of at most s (exists_hammingDist_le_and_hammingDist_le).
Two functions are at Hamming distance one when they differ at exactly one coordinate
(hammingDist_eq_one_iff); changing one coordinate of a function to a new value moves it to
distance one (hammingDist_update_of_ne), and two functions at distance at most one that differ
at a coordinate differ only there (update_eq_of_hammingDist_le_one). Updating two functions at
the same coordinate changes their distance only through that coordinate
(hammingDist_update_update). The pairs of A × B at Hamming distance one are the edges of the
Hamming graph between A and B (hammingEdges); counting them from either side gives the same
number (card_hammingEdges_comm, card_hammingEdges_eq_sum_card_filter).
Main definitions #
hammingEdges: the pairs ofA × Bat Hamming distance one.
Main results #
card_filter_eq_add_hammingDist,hammingDist_eq_card_mul_one_sub_dens: the coordinates of agreement and of disagreement.hammingDist_div_eq_expect: the relative Hamming distance is a probability.exists_hammingDist_le_and_hammingDist_le: splitting a distance.hammingDist_eq_one_iff: Hamming distance one.update_eq_of_hammingDist_le_one,update_not_eq_of_hammingDist_le_one: functions at distance at most one differ at most at one coordinate.hammingDist_update_update: updating two functions at the same coordinate.card_hammingEdges_eq_sum_card_filter: counting the edges of the Hamming graph.
Relative Hamming distance #
The coordinates where two functions agree and those where they differ make up all the coordinates.
The Hamming distance is the number of coordinates times one minus the density of the coordinates where the functions agree.
The relative Hamming distance is a probability: that of the two functions differing at a uniformly random coordinate.
Splitting a distance: between two functions at Hamming distance at most r + s lies a
function at distance at most r from the first and at most s from the second. It takes the
values of the second on at most r of the coordinates where the two differ, and the values of the
first elsewhere.
Hamming distance one #
Two functions are at Hamming distance one when they differ at exactly one coordinate.
Changing one coordinate to a new value moves to Hamming distance one.
Two functions at Hamming distance at most one that differ at i differ only at i: changing
the i-th coordinate of the first to that of the second gives the second.
Two Boolean functions at Hamming distance at most one that differ at i differ only at i:
the second is the first with its i-th bit flipped.
Updating two functions at the same coordinate changes their Hamming distance only through that coordinate.
The pairs of A × B at Hamming distance one: the edges of the Hamming graph between A and
B.
Instances For
A pair is an edge between A and B exactly when its first entry is in A, its second entry
is in B, and they are at Hamming distance one.
There are as many edges from A to B as from B to A.
Splitting B splits the edges.
The number of edges is the sum over A of the numbers of neighbors in B.