Exact overflow and membership tests from positive integer 3SUM moments
ProvedThreeSumFuture.hankel_support_threshold3sumalgorithmslinear-algebra
For a finite set A of distinct integer modes with positive integer weights, the order-d leading Hankel determinant of their moments is nonzero exactly when A has at least d elements. Weighting each mode s by an additional factor (s−a)^2 gives the same threshold for the modes other than a. The two tests permit a reporter to identify groups exceeding a fixed support cap and to decide membership on every other group, including the empty group.
Preamble
module public import Mathlib.LinearAlgebra.Vandermonde public import Mathlib.LinearAlgebra.Matrix.Rank public import Mathlib.LinearAlgebra.Matrix.ToLinearEquiv public import Mathlib.Tactic.Ring public import Mathlib.Algebra.Order.BigOperators.Ring.Finset public section open Matrix open scoped BigOperators Matrix set_option maxHeartbeats 200000
Formal statement
theorem ThreeSumFuture.hankel_support_threshold (A : Finset ℤ) (w : ℤ → ℤ) (hw : ∀ s ∈ A, 0 < w s)
(a : ℤ) (d : ℕ) :
let H (u : ℤ → ℤ) : Matrix (Fin d) (Fin d) ℤ :=
fun i j => ∑ s ∈ A, u s * s ^ (i.val + j.val)
((H w).det ≠ 0 ↔ d ≤ A.card) ∧
((H (fun s => w s * (s-a)^2)).det ≠ 0 ↔ d ≤ (A.erase a).card) := by sorrySource
Positive-weight refinement of the integer Hankel reporter in ThreeSum.FiniteMomentZeroDetector. The Vandermonde and weighted Gram identities are classical. Application to detecting overflow without an a priori support cap in weighted-cache 3SUM. See https://github.com/Wang-jiong-han/3sum-weighted-cache/blob/e1ae71db2231f172c6541820e2ce0a54aa14fc64/Submission/ThreeSum/FiniteMomentZeroDetector.lean .