Core Chan–He hashing and recursion data #
Direct adaptation of PaperStatements.lean, lines 1242–1365, from
anthropics/formal-math@16a5ce41304fcdaea4e0be7c132e1c361dc26da5.
These are finite mathematical constructions, not a native RAM implementation.
Main definitions #
coll,heavy: collision counts and elements sharing a residue class.firstP,secondP,modulus: deterministic minimum-prime searches.arrXY,arrZ: light-element convolution arrays with signed padding.nodes,reduction: a finite ternary recursion tree at explicit parameters.
References #
- T. M. Chan and Q. He, Reducing 3SUM to Convolution-3SUM, Theorem 5.1.
Collisions and heavy elements #
The arrays of one node #
The padding value 2U + 1. It is too large to take part in a solution among numbers of
absolute value at most U.
Instances For
The choice of the modulus #
The least element of a finite set of natural numbers, and 1 if the set is empty.
Instances For
The first prime: the least p in Q modulo which each of the three sets has at most
3Λ|S|²/|Q| colliding pairs. Here and below, Q is the set of candidate primes, and Λ bounds
how many of them divide a nonzero difference of two elements. reduction takes the primes up to
mPar n U for Q, and labelBits U for Λ.
Instances For
The recursion tree #
Instances For
The nodes on the first f levels of the recursion tree with root (S₁, S₂, S₃); for f = 0
there are none. A triple with an empty set is not a node and has no children. Any other triple is
a node, and each of its three children replaces one of the sets by its heavy elements.
Instances For
The parameters #
⌈log₂(⌊log₂ n⌋ + 2)⌉. In the recursion tree of reduction n U, for three sets of at most
n ≥ 1 elements each, all of absolute value at most U (the hypotheses of the library's lemma
ChanHe.reduction_correct), a set is empty after this many replacements by its heavy elements.
Instances For
The number of primes that we want to choose from.
Instances For
The bound m on the primes. There are at least wPar n U primes up to m (the library's
lemma ChanHe.wPar_le_card_primesLE).
Instances For
The reduction for three sets #
The reduction for three sets. Here n is an upper bound on the sizes of the three sets and
U on the absolute values of their elements; both stay fixed through the recursion. The result is
a list of nodes. The Convolution-3SUM instance of a node ν consists of the arrays
arrXY ν.S₁ ν.M U, arrXY ν.S₂ ν.M U and arrZ ν.S₃ ν.M U, read at any length
N ≥ 2 * mPar n U ^ 2.
Instances For
The three-array convolution instance attached to a recursion node.