Recovering exact 3SUM multiplicities from the boundaries of two translated sets
ProvedThreeSumFuture.sparse_translation_pair_counts3sumadditive-combinatoricsalgorithms
Let X and Y be finite sets of integers and let d be a positive integer. For a finite set A write E_A for the elements of A outside A+d and L_A for the elements of A+d outside A. These boundaries have the same size. Give E_A sign +1 and L_A sign −1. For each integer t set K_d(t)=1+t/d at nonnegative multiples of d and zero elsewhere. For every integer target z, the number of ordered representations from X and Y is
This identity allows all target counts to be recovered from signed boundary sums, including when the sets have long interleaved arithmetic progressions and translations of arbitrary magnitude.
Preamble
import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathlib.Data.Int.Basic import Mathlib.Tactic.Ring open scoped BigOperators
Formal statement
theorem ThreeSumFuture.sparse_translation_pair_counts (X Y : Finset ℤ) (d : ℤ) (hd : 0 < d) :
let shift (A : Finset ℤ) := A.image (fun x => x+d)
let enter (A : Finset ℤ) := A \ shift A
let leave (A : Finset ℤ) := shift A \ A
let difference (A : Finset ℤ) (f : ℤ → ℤ) :=
(∑ x ∈ enter A, f x) - ∑ x ∈ leave A, f x
let ramp (t : ℤ) := if d ∣ t then max 0 (t/d+1) else 0
(∀ A : Finset ℤ, (enter A).card = (leave A).card) ∧
∀ z : ℤ, difference X (fun a => difference Y (fun b => ramp (z-a-b))) =
∑ x ∈ X, ∑ y ∈ Y, (if x+y=z then 1 else 0 : ℤ) := by sorrySource
Finite-difference identity and its application to the open grouped 3SUM construction https://prove2.me/theorems/f98029a3-e8e7-5572-8594-9afb4763886b. The proof uses elementary discrete differences and finite sums. The exact representation counts supply cap-one rows for the verified certificate https://prove2.me/theorems/85b716d1-867b-581f-9705-80754517d350.