A reusable Light procedure for exact hits, misses and overflow in a grouped 3SUM row
ProvedThreeSumFuture.light_grouped_row_verdict3sumlinear-algebraword-ram
For each fixed support cap H, there is one finite read-only Light statement and a fixed step bound. It can be installed at any entry of any enclosing program. Given the signed target and a pointer to physical moments zero through 2H of a positive integer measure on distinct pair-sum values, the statement returns 2 for oversized support, 1 for target membership on a small support and 0 for absence on a small support. It preserves the entire memory. The word requirement is a fixed polynomial in a bound for the moments and target.
Preamble
import Definitions.Def_Submission_ThreeSum_LightMomentZeroDetector import Theorems.Thm_Light_Meets_of_body import Theorems.Thm_Light_Ends_iteLast import Theorems.Thm_Light_Ends_set import Theorems.Thm_Light_Ends_mono import Theorems.Thm_ThreeSum_LightMomentZeroDetector_atoms_moment import Theorems.Thm_ThreeSum_LightMomentZeroDetector_atoms_abs import Theorems.Thm_ThreeSum_LightMomentZeroDetector_atoms_safe import Theorems.Thm_ThreeSum_LightMomentZeroDetector_leading_memory import Theorems.Thm_ThreeSum_LightMomentZeroDetector_modified_memory import Theorems.Thm_ThreeSum_LightFixedArithmetic_Circuit_compile_safe import Theorems.Thm_ThreeSum_LightFixedArithmetic_Circuit_compile_val import Theorems.Thm_ThreeSum_LightMomentDeterminant_eval_leading import Theorems.Thm_ThreeSum_LightMomentDeterminant_wordBound_polynomial import Theorems.Thm_ThreeSum_LightMomentDeterminant_body_ends import Theorems.Thm_ThreeSumFuture_hankel_support_threshold open ThreeSum Light LightFixedArithmetic LightMomentDeterminant open scoped BigOperators set_option maxHeartbeats 450000
Formal statement
theorem ThreeSumFuture.light_grouped_row_verdict (H : ℕ) :
∃ (stmt : Stmt) (steps : ℕ), ∀ (P : Program) (entry depth : ℕ), P[entry]? = some stmt →
∀ (A : Finset ℤ) (w : ℤ → ℤ), (∀ s ∈ A, 0 < w s) →
∀ (base : ℕ) (a : ℤ) (mem : ℕ → ℤ) (lim : Limits) (U : ℤ), 0 ≤ U → |a| ≤ U →
base+(2*H+1) ≤ lim.space → (lim.space : ℤ) ≤ lim.word →
max 2 (wordCoefficient (H+1)*(U+1)^wordDegree (H+1)) ≤ lim.word →
(∀ k ≤ 2*H, |mem (base+k)| ≤ U) →
(∀ k ≤ 2*H, mem (base+k) = ∑ s ∈ A, w s * s^k) →
Meets lim P entry depth [base,a] mem steps
(fun r out => r = (if H < A.card then 2 else if a ∈ A then 1 else 0 : ℤ) ∧ out = mem) := by sorrySource
Physical row classifier for the open three-color implementation https://prove2.me/theorems/f98029a3-e8e7-5572-8594-9afb4763886b. It combines the positive Hankel support theorem https://prove2.me/theorems/f3d02372-09c9-532b-a04d-761eae1d6570 with the finite small-support determinant program from the inherited 3SUM library, https://github.com/Wang-jiong-han/3sum-weighted-cache/blob/e1ae71db2231f172c6541820e2ce0a54aa14fc64/Submission/ThreeSum/LightMomentZeroDetector.lean.