"""Exact finite scan of C271 positive triples through the fixed C268 charts.""" from pathlib import Path from fractions import Fraction as Q from collections import Counter import argparse, csv, hashlib, json ROOT=Path(__file__).resolve().parents[1] parser=argparse.ArgumentParser() parser.add_argument('--output',type=Path,default=ROOT/'evidence') OUT=parser.parse_args().output OUT.mkdir(parents=True,exist_ok=True) checks=[] def check(name,condition): if not condition: raise AssertionError(name) checks.append(name) def sha(path): return hashlib.sha256(path.read_bytes()).hexdigest() def read(name): return json.loads((ROOT/'sources'/name).read_text()) def dump(name,value): (OUT/name).write_text(json.dumps(value,indent=2,ensure_ascii=False,default=str)+'\n') manifest=json.loads((ROOT/'SOURCE_MANIFEST.json').read_text()) for name,row in manifest.items(): p=ROOT/'sources'/name check('frozen source '+name,sha(p)==row['sha256'] and p.stat().st_size==row['bytes']) for step,expected in [('C271','57c44ea4bd81a4507d55626ecdf9631301941ade3ab6a662898e59e3db6eefd7'),('C268','dd081b556118711b9e8aef97a329f8d3f688664b3dd5f6aa523bc6fca804a34f')]: check(step+' certificate identity',sha(ROOT/'sources'/f'{step}_CERTIFICATE.json')==expected) cert=read(step+'_CERTIFICATE.json') for suffix,field in [('REPORT.md','report_sha256'),('RESULTS.json','results_sha256')]: check(step+' certified '+suffix,sha(ROOT/'sources'/f'{step}_{suffix}')==cert[field]) check('C271 certified checkpoint',sha(ROOT/'sources/C271_CHECKPOINT.md')==read('C271_CERTIFICATE.json')['checkpoint_sha256']) for name,expected in [('FILE_18.md','68301ab760bfbe2e874aedc5c8d943ced7a6219d34bc2859332a70713f9630d5'),('FILE_09.md','45851004c5864229ebf6a896f9099819a08d8926715d3e97e4bc3985c4a3876e')]: check('controlling source '+name,sha(ROOT/'sources'/name)==expected) prior=read('C268_CORRESPONDENCE.json') anchors={r['chain']:r['anchor'] for r in prior} scales=sorted(set(Q(r['scale']) for r in prior)) check('held anchors',anchors=={'N02':-4419,'N04':-4417}) check('held scales',scales==[1196,1300]) check('scale ratio E',scales[1]/scales[0]==Q(25,23)) events=read('C01_RESULTS.json')['events'] check('held target register',len(events)==48 and len(set(e['BC_Nisan'] for e in events))==48) check('reflected target orientation',all(e['BC_Nisan']>0 and e['reflected_pair'].startswith('AD ') for e in events)) check('target role domain',all(e['role'].split()[0] in ('Noah','Shem','Flood') for e in events)) chains=read('C01_RESULTS.json')['complete_three_stage_chains'] check('retained Creation anchors',sorted(-c['Creation_BC_Nisan'] for c in chains)==sorted(anchors.values())) families=read('C271_MATCHES.json') register={r['id']:r for r in read('C271_REGISTER.json')} check('six inherited families',sorted(Q(r['radius']) for r in families)==list(range(1,7))) check('target register bounds',min(e['BC_Nisan'] for e in events)==1956 and max(e['BC_Nisan'] for e in events)==3710) inputs=[] for family in sorted(families,key=lambda r:Q(r['radius'])): radius=Q(family['radius']) source=register[family['Noah']] center=Q(source['center']) check('rho'+str(radius)+' source selector',center==radius+1==family['cumulative_index'] and source['branch']=='Noah') check('rho'+str(radius)+' source phase pair',sorted(Q(p['local_coordinate']) for p in source['phases'])==[center-Q(1,4),center+Q(1,4)]) for role,delta in [('inner',-Q(1,4)),('center',Q(0)),('outer',Q(1,4))]: x=center+delta phase=None if delta==0 else next(p for p in source['phases'] if Q(p['local_coordinate'])==x) inputs.append({'id':f'rho{radius}_{role}','radius':radius,'local_x':x,'local_role':'pair center' if delta==0 else 'seasonal component','position':role,'source_Noah_id':family['Noah'],'source_Flood_partner_id':family['Flood'],'cumulative_index':family['cumulative_index'],'cumulative_Flood_BC_base':family['cumulative_Flood_BC_base'],'seasonal_provenance':phase}) check('finite input triple count',len(inputs)==18) rows=[] for chain,a in anchors.items(): for s in scales: for point in inputs: x=point['local_x'] y=Q(a)+s*(x-1) matches=[e for e in events if Q(e['BC_Nisan'])==y] row_id=f'{chain}_{s}_{point["id"]}' check(row_id+' integral target center',y.denominator==1) check(row_id+' exact source match condition',all(Q(e['BC_Nisan'])==y for e in matches) and len(matches)<=1) rows.append({'id':row_id,'input_id':point['id'],'radius':point['radius'],'position':point['position'],'input_geometric_role':point['local_role'],'chain':chain,'anchor':a,'scale':s,'local_x':x,'target_center':y,'width_from_anchor':y-a,'target_role':'pair center','target_matches':matches,'status':'source-qualified in held reflected register' if matches else 'generated; absent from held reflected register','target_source_phase_display':matches[0]['reflected_pair'] if matches else None}) check('complete fixed-chart domain',len(rows)==72) hits=[r for r in rows if r['target_matches']] generated=[r for r in rows if not r['target_matches']] check('complete classifications',len(hits)==10 and len(generated)==62) check('matches only outer family',set(r['radius'] for r in hits)=={6}) check('no inner-family matches',all(not r['target_matches'] for r in rows if r['radius']<6)) check('distinct image count',len(set(r['target_center'] for r in rows))==70) check('distinct source hits',len(set(r['target_center'] for r in hits))==8) check('distinct generated images',len(set(r['target_center'] for r in generated))==62) check('signed image counts',sum(r['target_center']<0 for r in rows)==36 and sum(r['target_center']>0 for r in rows)==36) check('generated midpoint status',set(r['target_center'] for r in generated if r['radius']==6)=={3381,3383}) # Every outer image reproduces the previously published role and status, not only its number. outer=[r for r in rows if r['radius']==6] check('inherited outer triple',read('C268_LOCAL_PROVENANCE.json')['positive_triple']==['27/4','7','29/4']) for old in prior: match=[r for r in outer if r['chain']==old['chain'] and r['scale']==Q(old['scale']) and r['local_x']==Q(old['local_x'])] check('C268 row recovered '+old['chain']+' '+old['scale']+' '+old['local_x'],len(match)==1 and match[0]['target_center']==Q(old['target_center']) and match[0]['target_matches']==([old['target_source']] if old['target_source'] else [])) # The same fixed formulas determine whether the two intervals meet at a common endpoint. stages=[] for chain,a in anchors.items(): for radius in range(1,7): selected=[r for r in rows if r['chain']==chain and r['radius']==radius] triples={s:[next(r['target_center'] for r in selected if r['scale']==s and r['position']==p) for p in ['inner','center','outer']] for s in scales} first,second=triples[scales[0]],triples[scales[1]] gap=second[0]-first[2] overlap=max(Q(0),min(first[2],second[2])-max(first[0],second[0])) check(chain+' rho'+str(radius)+' fixed interval widths',first[2]-first[0]==598 and second[2]-second[0]==650) check(chain+' rho'+str(radius)+' midpoint steps',first[1]-first[0]==first[2]-first[1]==299 and second[1]-second[0]==second[2]-second[1]==325) check(chain+' rho'+str(radius)+' endpoint gap',gap==104*(radius-6)) check(chain+' rho'+str(radius)+' interval overlap',overlap==104*(6-radius)) check(chain+' rho'+str(radius)+' center separation',second[1]-first[1]==104*radius) check(chain+' rho'+str(radius)+' expansion intertwining',all(second[k]==a+Q(25,23)*(first[k]-a) for k in range(3))) stages.append({'chain':chain,'radius':radius,'scale1196_triple':first,'scale1300_triple':second,'endpoint_gap_second_inner_minus_first_outer':gap,'overlap_length':overlap,'shared_endpoint':gap==0,'shared_endpoint_center':first[2] if gap==0 else None,'outer_inner_radius_ratio':Q(4*radius+1,4*radius-1)}) check('shared endpoint only rho6',all(s['shared_endpoint']==(s['radius']==6) for s in stages)) check('shared endpoint matches only MT Noah births',sorted(s['shared_endpoint_center'] for s in stages if s['shared_endpoint'])==[3056,3058]) duplicates={str(y):[r['id'] for r in rows if r['target_center']==y] for y,c in Counter(r['target_center'] for r in rows).items() if c>1} check('only repeated images are stage junctions',set(duplicates)=={'3056','3058'} and all(len(v)==2 for v in duplicates.values())) for r in [r for r in rows if r['chain']=='N02']: other=next(z for z in rows if z['chain']=='N04' and z['scale']==r['scale'] and z['input_id']==r['input_id']) check('anchor separation '+r['id'],other['target_center']-r['target_center']==2) # Transparent exclusion diagnostic, strictly within the same finite target register. below=[r for r in rows if r['target_center']<1956] inside=[r for r in rows if 1956<=r['target_center']<=3710] inside_misses=[r for r in inside if not r['target_matches']] check('range classification',len(below)==56 and len(inside)==16 and len(inside_misses)==6) check('within-range generated list',sorted(r['target_center'] for r in inside_misses)==[2081,2083,2406,2408,3381,3383]) check('inner scale1196 upper bound',max(r['target_center'] for r in rows if r['radius']<6 and r['scale']==1196)==1862) check('radii1to4 upper bound',max(r['target_center'] for r in rows if r['radius']<=4)==1108) family_counts=[] for radius in range(1,7): subset=[r for r in rows if r['radius']==radius] family_counts.append({'radius':radius,'image_instances':len(subset),'source_hit_instances':sum(bool(r['target_matches']) for r in subset),'generated_instances':sum(not r['target_matches'] for r in subset)}) dump('SCAN.json',{'input_points':inputs,'images':rows,'target_orientation':'exact signed reflected pair centers; no absolute-value or opposite-side matching'}) dump('MATCH_CLASSIFICATION.json',{'family_counts':family_counts,'source_hits':hits,'hit_instances':10,'distinct_target_records':8,'generated_instances':62,'distinct_generated_centers':62,'distinct_image_centers':70,'duplicates':duplicates,'all_hits_inherited_from_C268':True}) dump('STAGE_RELATIONS.json',{'rows':stages,'endpoint_gap_formula':'104(rho−6)','shared_endpoint_condition':'rho=6','scale_ratio':'25/23','source_claim':'endpoint equality is inherited algebra under fixed fitted charts, not a new witness'}) dump('LIMITS.json',{'target_register_size':48,'target_min':1956,'target_max':3710,'below_register_instances':56,'inside_register_range_instances':16,'inside_range_generated_centers':[2081,2083,2406,2408,3381,3383],'negative_image_instances':36,'positive_image_instances':36,'no_absolute_value_matching':True,'input_components_become_target_centers':True,'target_phases_are_source_display_not_raw_scaled_input_seasons':True,'new_anchors_scales_offsets':False,'absence_scope':'held48-record reflected Noah/Shem/Flood register only; no claim of global historical absence','selection_dependence':'scales were originally fitted to rho6; finite uniqueness does not independently establish intentionality or probability'}) dump('RESULTS.json',{'step':'C272','status':'passed','check_count':len(checks),'checks':checks,'image_instances':72,'source_hit_instances':10,'distinct_hit_records':8,'generated_instances':62,'all_hits_radius':6,'new_target_source_records':0,'maps_changed':False,'graph_modified':False,'canonical_sources_modified':False}) with (OUT/'SCAN.csv').open('w',newline='') as handle: writer=csv.writer(handle) fields=['chain','anchor','scale','radius','position','local_x','input_geometric_role','target_center','status'] writer.writerow(fields+['target_source']) for r in rows: writer.writerow([r[k] for k in fields]+[json.dumps(r['target_matches'],ensure_ascii=False)]) print(json.dumps({'step':'C272','status':'passed','checks':len(checks),'outputs':6,'image_instances':72,'hit_instances':10,'distinct_hit_records':8,'generated_instances':62}))