"""Independent finite C312 check. No new endpoints are admitted. Uses the previously frozen C286 register and C301/C302 records. Run from any directory. Output is evidence in the review folder, not a root-packet mutation. """ from pathlib import Path from fractions import Fraction import argparse import hashlib import json parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--sources', type=Path, help='Directory containing C286_DATA.json, C301_DATA.json and C302_DATA.json') parser.add_argument('--out', type=Path, help='Path for the independent JSON result') args = parser.parse_args() BASE = Path(__file__).resolve().parents[1] INPUTS = { 'register': BASE / 'C302/sources/C286_DATA.json', 'coverage': BASE / 'C301/evidence/DATA.json', 'segments': BASE / 'C302/evidence/DATA.json', } if args.sources is not None: INPUTS = {key: args.sources / name for key, name in { 'register': 'C286_DATA.json', 'coverage': 'C301_DATA.json', 'segments': 'C302_DATA.json', }.items()} loaded = {k: json.loads(v.read_text()) for k, v in INPUTS.items()} register = loaded['register']['target_register'] coverage = loaded['coverage']['cumulative_coverage'] complete = loaded['segments']['complete_segments'] offset = 2832 def unique(tradition, gear, role, rail, terah, full430): rows = [x for x in register if x['tradition'] == tradition and x['gear'] == gear and x['role'] == role and x.get('rail') == rail and x['Cainan'] == 0 and x['Terah60'] == terah and x['full430'] == full430] assert len(rows) == 1 return rows[0]['center'] def source_pair(profile, index): rows = [x['source'] for x in coverage if x['source']['profile'] == profile and x['source']['index'] == index and x['source']['role'] in ('Shem','Flood')] if not rows: return None assert sorted(x['role'] for x in rows) == ['Flood', 'Shem'] return [next(x['BC'] for x in rows if x['role'] == role) for role in ['Shem', 'Flood']] rows = [] for gear in (3, 2, 1): mt = [unique('MT', gear, role, None, 0, 1) for role in ('Noah birth', 'Flood start')] assert mt[0] - mt[1] == 600 for rail, r in [('primary', 0), ('companion', 1)]: sp = [unique('SP', gear, role, rail, 1, 0) for role in ('Shem birth', 'Shem death')] delta = [s - m for s, m in zip(sp, mt)] assert delta == [-5-r, -5-r] assert sp[0] - sp[1] == 600 # Required indices solve the retained field formula, but are never # admitted merely because they are algebraically derivable. i = 5896 - (mt[0] + offset) j = 5890 - (sp[0] + offset) assert i == 5296 - (mt[1] + offset) assert j == 5290 - (sp[1] + offset) assert j == i - 1 + r c_mt, c_sp = source_pair('MT_ON', i), source_pair('LXX_OFF', j) source_admitted = c_mt is not None target_admitted = c_sp is not None if source_admitted: assert all(c-b == offset for c,b in zip(c_mt,mt)) if target_admitted: assert all(c-b == offset for c,b in zip(c_sp,sp)) if source_admitted and target_admitted: assert [a-b for a,b in zip(c_sp,c_mt)] == delta # Existing quarter-year test coordinates; their meaning is not inferred. assert all((m+e)+delta[0] == s+e for m,s in zip(mt,sp) for e in (Fraction(-1,4), Fraction(1,4))) rows.append(dict(gear=gear, rail=rail, mt_regular_pair=mt, sp_regular_pair=sp, BC_delta=delta[0], required_MT_ON_index=i, required_LXX_OFF_index=j, source_admitted=source_admitted, target_admitted=target_admitted, complete_transport=source_admitted and target_admitted)) assert len(rows) == 6 assert len({x['BC_delta'] for x in rows}) == 2 assert sum(x['complete_transport'] for x in rows) == 4 assert sum(x['target_admitted'] for x in rows) == 5 assert [(x['gear'],x['rail']) for x in rows if not x['complete_transport']] == [ (1, 'primary'), (1, 'companion')] assert {(x['gear'],x['rail'],x['required_LXX_OFF_index']) for x in rows if x['target_admitted']} == { (p['upper']['regular']['gear'],p['upper']['regular']['rail'],p['index']) for p in complete if p['profile']=='LXX_OFF' and p['upper']['regular']['tradition']=='SP'} result = dict( input_sha256={k: hashlib.sha256(v.read_bytes()).hexdigest() for k,v in INPUTS.items()}, finite_domain='Six source-labelled regular comparisons; existing cumulative indices 0..7', rows=rows, regular_transports=6, complete_cumulative_transports=4, target_only_boundary_cases=1, absent_source_and_target_cases=1, one_unconditioned_translation=False, uniform_rail_labelled_rule='B_SP = B_MT - 5 - r; j_LXX = i_MT - 1 + r', role_map='MT Noah birth/Flood start to SP Shem birth/Shem death', rail_encoding={'primary':0,'companion':1}, phase_scope='Same selected quarter-year offsets preserve translations and width; no new seasonal identification or expansion tested', interpretation='A source-derived labelled transport, not a prescribed C310 context selector', new_endpoints_admitted=False, ) out = args.out if args.out is not None else Path(__file__).with_name('C312_Independent_Math_Results.json') out.parent.mkdir(parents=True, exist_ok=True) out.write_text(json.dumps(result,indent=2)+'\n') print(json.dumps({k:result[k] for k in ['regular_transports','complete_cumulative_transports', 'target_only_boundary_cases','absent_source_and_target_cases','one_unconditioned_translation']}))