from itertools import product from collections import Counter def run(load,read,check): reg=load('C286_DATA.json')['target_register'];by={} for i,r in enumerate(reg):by.setdefault(r['center'],[]).append(i) centers=[r['points']['center'] for r in load('PREVIOUS_DATA.json')['cases'] if r['record_indices']['center']] check('four source-derived centers only',centers==[3188,3190,3248,3250]) trials=[];orbits=[];labelpairs=[];families=[] for c in centers: hit=[];pairs=[] for x in sorted(by): y=2*c-x;ok=y in by trials.append({'center':c,'input':x,'output':y,'sourced':ok,'input_indices':by[x],'output_indices':by.get(y,[])}) check(f'involution {c}/{x}',2*c-y==x) if ok: hit.append(x) if x<=y: pair={'center':c,'lower':x,'upper':y,'lower_indices':by[x],'upper_indices':by[y]};pairs.append(pair);orbits.append(pair) for i,j in product(by[x],by[y]): labelpairs.append({'center':c,'lower_record':i,'upper_record':j,'lower':x,'upper':y,'roles':sorted([reg[i]['role'],reg[j]['role']])}) lp=[r for r in labelpairs if r['center']==c] families.append({'center':c,'source_domain':hit,'domain_size':len(hit),'unoriented_coordinate_orbits':len(pairs),'labelled_unoriented_pairs':len(lp),'labelled_directed_pairs':2*len(lp)-1}) check(f'maximal source domain is closed under its own involution {c}',all(2*c-x in hit for x in hit)) check('complete1492 trial menu',len(trials)==4*373==1492) check('exact reflection source counts',[(r['domain_size'],r['unoriented_coordinate_orbits'],r['labelled_unoriented_pairs']) for r in families]==[(61,31,86),(67,34,91),(19,10,18),(61,31,63)]) check('106 coordinate orbits and258 label pairs',len(orbits)==106 and len(labelpairs)==258) check('512 directed label pairings',sum(r['labelled_directed_pairs'] for r in families)==512) roles=Counter(tuple(r['roles']) for r in labelpairs) check('known pivot and loop pairs retained',all(any(r['center']==3188 and (r['lower'],r['upper'])==pair for r in orbits) for pair in [(2756,3620),(3170,3206)])) return {'step':'C438','all_trials':trials,'families':families,'coordinate_orbits':orbits,'labelled_pairs':labelpairs, 'role_pair_counts':[{'roles':list(k),'count':v} for k,v in sorted(roles.items())], 'counts':{'trials':1492,'source_domain_memberships':208,'unoriented_coordinate_orbits':106,'fixed_coordinate_orbits':4,'labelled_unoriented_pairs':258,'labelled_directed_pairs':512}, 'limits':'Each reflection is partial on the373-coordinate register. These are local affine comparisons, not a newly licensed Mirror operator or a group action on the entire register.'}