Buffered positive-moment reports for tripartite 3SUM
DefinitionThreeSumFuture_GroupedMomentReport3sumalgorithmslinear-algebra
Defines a memory certificate for a grouped 3SUM reporter. Each consecutive row records its target and the first 2H+1 moments of a positive measure on actual pair sums. Every positive request is covered. A leading Hankel determinant marks oversized rows, while ordinary and shifted determinants identify direct hits. The certificate records the Boolean after exact checks on distinct marked target values and a bound on their number.
Definition code
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
open scoped BigOperators
namespace ThreeSumFuture.GroupedMomentReport
noncomputable def rowDet (u : ℕ → ℤ) (d : ℕ) : ℤ :=
(Matrix.of (fun i j : Fin d => u (i.val+j.val))).det
def shifted (u : ℕ → ℤ) (a : ℤ) (k : ℕ) : ℤ :=
u (k+2) - 2*a*u (k+1) + a^2*u k
def owner (mem : ℕ → ℤ) (base cap i : ℕ) := mem (base+1+i*(2*cap+2))
def table (mem : ℕ → ℤ) (base cap i k : ℕ) := mem (base+2+i*(2*cap+2)+k)
def pairHit (left right : List ℤ) (z : ℤ) : Prop :=
∃ a ∈ left, ∃ b ∈ right, a+b=z
noncomputable def flagged (rows cap : ℕ) (own : Fin rows → ℤ) (read : Fin rows → ℕ → ℤ) : Finset ℤ := by
classical
exact (Finset.univ.filter (fun i => rowDet (read i) (cap+1) ≠ 0)).image own
noncomputable def reported (left right : List ℤ) (rows cap : ℕ)
(own : Fin rows → ℤ) (read : Fin rows → ℕ → ℤ) : Prop :=
(∃ i, ∃ d ≤ cap, rowDet (read i) d ≠ 0 ∧ rowDet (shifted (read i) (own i)) d = 0) ∨
∃ z ∈ flagged rows cap own read, pairHit left right z
noncomputable def Certificate (left right targets : List ℤ) (cap base space exceptionBound : ℕ)
(mem : ℕ → ℤ) (verdict : ℤ) : Prop := by
classical
exact ∃ (rows : ℕ) (S : Fin rows → Finset ℤ) (w : Fin rows → ℤ → ℤ),
let own (i : Fin rows) := owner mem base cap i.val
let read (i : Fin rows) := table mem base cap i.val
mem base = (rows : ℤ) ∧ base+1+rows*(2*cap+2) ≤ space ∧
(∀ i, own i ∈ targets) ∧ (∀ i, ∀ s ∈ S i, pairHit left right s) ∧
(∀ z ∈ targets, pairHit left right z → ∃ i, own i=z ∧ z∈S i) ∧
(∀ i, ∀ s ∈ S i, 0 < w i s) ∧
(∀ i, ∀ k ≤ 2*cap, read i k = ∑ s ∈ S i, w i s * s^k) ∧
(flagged rows cap own read).card ≤ exceptionBound ∧
verdict = (if reported left right rows cap own read then 1 else 0 : ℤ)
end ThreeSumFuture.GroupedMomentReport
Source
Grouped reporting interface for the 3SUM frontier, using the positive Hankel support theorem https://prove2.me/theorems/f3d02372-09c9-532b-a04d-761eae1d6570.