from fractions import Fraction as Q def rat(x):return {'numerator':x.numerator,'denominator':x.denominator} def run(load,check): reg=load('C286_DATA.json')['target_register'];by={} for i,r in enumerate(reg):by.setdefault(r['center'],[]).append(i) cs=set(by);targets=[r for r in load('C429_DATA.json')['operator_trials'] if r['operator']=='E2' and r['source_record_indices']];rows=[];trials=[] for target in targets: h,x=target['held_upper'],target['input_lower'];y=Q(target['output']['numerator'],target['output']['denominator']);solutions=[] for p in sorted(cs): q=Q(48*h-25*p,23);mid=Q(p)+Q(25,23)*(x-p);out=q+Q(25,23)*(mid-q);check('same whole map '+str((h,p)),out==y and Q(25*p+23*q,48)==h);ok=q in cs;trials.append({'held_target':h,'first_pivot':p,'required_second_pivot':rat(q),'second_pivot_sourced':ok,'intermediate':rat(mid),'intermediate_sourced':mid in cs}) if ok:solutions.append({'first_pivot':p,'second_pivot':int(q),'first_pivot_record_indices':by[p],'second_pivot_record_indices':by[q],'intermediate':rat(mid),'intermediate_source_record_indices':by.get(mid,[]),'complete_source_path':mid in cs,'repeated_original_pivot':p==q==h}) rows.append({'target_held':h,'target_input':x,'target_output':rat(y),'original_fixed_pivot_path':target['two_sourced_E_steps'],'pivot_solutions':solutions,'any_source_path':any(z['complete_source_path'] for z in solutions)}) # A target slope625/529 has prime7 exponent0, prime13 exponent0 and prime5 exponent4. # E: (0,0,2), P: (1,0,1), J: (0,-1,2), ordered7/13/5. matrix={'E':[0,0,2],'P':[1,0,1],'J':[0,-1,2],'target':[0,0,4]};check('positive-word counts forced',matrix['P'][0]==1 and matrix['J'][1]==-1 and matrix['E'][2]*2==matrix['target'][2]) return {'step':'C431','target_maps':rows,'all_first_pivot_trials':trials,'slope_valuation_certificate':matrix,'integer_pivot_parameterization':'p=H+23t, q=H−25t; intermediate=H−1150−2t. Both pivots and the intermediate must already be sourced.','counts':{'target_E2_maps':len(rows),'first_pivot_trials':len(trials),'sourced_pivot_pair_solutions':sum(len(r['pivot_solutions']) for r in rows),'distinct_pivot_pair_solutions':sum(not s['repeated_original_pivot'] for r in rows for s in r['pivot_solutions']),'maps_with_sourced_path':sum(r['any_source_path'] for r in rows),'endpoint_only_maps_repaired':sum(r['any_source_path'] and not r['original_fixed_pivot_path'] for r in rows),'complete_coordinate_paths':sum(s['complete_source_path'] for r in rows for s in r['pivot_solutions'])},'interpretation':'The source menu for possible pivots is deliberately generous: all373 existing regular coordinates. Coordinate source membership alone is tested, not a newly prescribed pivot grammar. Slope valuations force every positive E/P/J word equal to a target whole map to exactly two E factors. Failure in this larger menu excludes a sourced repair in the narrower existing role rules. Different slopes at one input, inverses and new sources are outside the claim.'}