"""C434: one source-derived factorization and its fixed six-case family. All arithmetic is rational. Membership means the frozen C286 Noah/Shem/Flood register, not every date mentioned anywhere in the repository. """ from fractions import Fraction as F from itertools import product from math import prod import hashlib def run(load, read, check): register = load('C286_DATA.json')['target_register'] by = {} for i, row in enumerate(register): by.setdefault(row['center'], []).append(i) check('frozen domain: 528 labels and 373 coordinates', len(register) == 528 and len(by) == 373) specs = [ ('MT_PERSONS', 'File_02.md', 659, 716), ('PERSON_BASES', 'File_18.md', 1253, 1282), ('SP_FIELD', 'File_18.md', 1571, 1596), ('VARIANTS', 'File_18.md', 620, 627), ('SP_LOCALITY', 'File_18.md', 433, 435), ('LXX_REMOVAL', 'File_18.md', 1140, 1147), ('FLOOD_GEAR_SCOPE', 'File_18.md', 1540, 1552), ('E_RATIO_CORRECTED', 'File_46.md', 117, 133), ('DUAL100', 'File_18.md', 755, 771), ] cards = [] for ident, source, start, end in specs: excerpt = '\n'.join(read(source).splitlines()[start-1:end]) cards.append(dict(id=ident, source=source, line_start=start, line_end=end, text=excerpt, excerpt_sha256=hashlib.sha256(excerpt.encode()).hexdigest())) text = {c['id']: c['text'] for c in cards} check('E is supported by the actual 25/23 passage', 'Priestly Ratio (25/23)' in text['E_RATIO_CORRECTED'] and '4830 × 25/23 = 5250' in text['E_RATIO_CORRECTED']) oldcard = next(c for c in load('C432_DATA.json')['source_excerpt_cards'] if c['id'] == 'E_RULE') check('C432 locator correction is identified precisely', oldcard['line_start'] == 97 and oldcard['line_end'] == 113 and 'Prophetic Ratio (70/69)' in oldcard['text'] and '25/23' not in oldcard['text']) check('source explicitly retains Noah 950 and matched births 500', 'Noah `950`' in text['SP_FIELD'] and 'births preserve `500`' in text['SP_FIELD']) check('source explicitly retains local companion and variant amounts', 'primary minus one for Noah/Shem person-stations only' in text['SP_LOCALITY'] and all(token in text['VARIANTS'] for token in ['+215', '+60', '+130'])) # Read the SP G1 source row, rather than fit a first pivot to the target map. cells = next(s for s in text['SP_FIELD'].splitlines() if s.startswith('| G1 |')).split('|') source_bases = {} for role, cell in zip(['Noah birth', 'Noah death', 'Shem birth', 'Shem death'], cells[2:6]): source_bases[role] = dict(zip(['primary', 'companion'], map(int, cell.strip().split('/')))) check('source birth-to-death interval is 950', source_bases['Noah birth']['primary'] - source_bases['Noah death']['primary'] == 950) check('source Noah-to-Shem birth interval is 500', source_bases['Noah birth']['primary'] - source_bases['Shem birth']['primary'] == 500) check('source primary-to-companion difference is one', source_bases['Noah birth']['primary'] - source_bases['Noah birth']['companion'] == 1) check('source SP base is 3491', source_bases['Noah birth']['primary'] == 3491) delta = 130 - 215 - 1 check('context change gives -86', delta == -86) check('weighted source identity gives effective Shem birth', 25*(-delta) + 23*950 == 48*500) check('first and second pivot offsets have parameter 18', 500 + delta == 23*18 and 500-950 == -25*18) check('gap partition yields 128 plus 64', (1058 + 500 + delta, 1250 + 500 - 950) == (64*23, 32*25)) def E(h, x): return h - F(25, 23)*(h-x) def select(**kwargs): return [i for i, row in enumerate(register) if all(row.get(k) == v for k, v in kwargs.items())] def one(**kwargs): result = select(**kwargs) assert len(result) == 1, kwargs return result[0] def formal_mt_death(g, c, t, f=1): # Out-of-domain g or t here is diagnostic algebra, never a source record. return 1741 + 2*(g-1) + 130*c + 60*t + 215*f cases = [] used = set() for terah, gear in product([0, 1], [1, 2, 3]): tag = f'G{gear}/T{terah}' common = dict(tradition='SP', gear=gear, Terah60=terah) ids = { 'N': one(**common, role='Noah birth', rail='primary', Cainan=0, full430=1), 'H': one(**common, role='Shem birth', rail='primary', Cainan=0, full430=1), 'P': one(**common, role='Noah birth', rail='companion', Cainan=1, full430=0), 'Q': one(**common, role='Noah death', rail='primary', Cainan=0, full430=1), 'P_own_death': one(**common, role='Noah death', rail='companion', Cainan=1, full430=0), } N, H, P, Q = [register[ids[k]]['center'] for k in ['N', 'H', 'P', 'Q']] check(tag+' actual source roles derive the reference and pivots', N == 3706+2*(gear-1)+60*terah and H == N-500 and P == N+delta and Q == N-950) check(tag+' both actual Noah biographies keep 950', N-Q == P-register[ids['P_own_death']]['center'] == 950 and P-Q == 864) check(tag+' whole affine map has the same coefficients', F(25,23)**2 == F(625,529) and -F(50*P+46*Q,529) == -F(96*H,529)) x = H-1058 mid, out = E(P, x), E(Q, E(P, x)) check(tag+' two exact E gap expansions', (P-x, P-mid, Q-mid, Q-out) == (1472,1600,736,800)) check(tag+' exact stations and gains', mid == N-1686 and out == N-1750 and x-mid == 128 and mid-out == 64 and out == E(H,E(H,x))) values = dict(N=N, H=H, P=P, Q=Q, input=x, intermediate=int(mid), output=int(out)) memberships = {k: by.get(v, []) for k, v in values.items()} check(tag+' sourced pivot counts keep distinct SP/LXX labels', [len(memberships[k]) for k in ['N','H','P','Q']] == [2,2,1,2]) for k in ['N','H','Q']: check(tag+' theoretical LXX OFF alias '+k, {register[i]['tradition'] for i in memberships[k]} == {'SP','LXX'} and all(register[i]['Cainan'] == 0 for i in memberships[k])) check(tag+' formal MT station formulas match generated coordinates', [formal_mt_death(gear+1,1,terah+1), formal_mt_death(gear+2,0,terah+1), formal_mt_death(gear,0,terah)] == [x,mid,out]) check(tag+' endpoint output retains the selected MT Shem-death context', memberships['output'] == select(tradition='MT',role='Shem death',gear=gear, Cainan=0,Terah60=terah,full430=1)) valid_input = terah == 0 and gear <= 2 valid_mid = terah == 0 and gear == 1 check(tag+' full-register membership equals finite boundary prediction', bool(memberships['input']) == valid_input and bool(memberships['intermediate']) == valid_mid) complete = all(memberships[k] for k in ['P','Q','input','intermediate','output']) labelled_paths = prod(len(memberships[k]) for k in ['P','Q','input','intermediate','output']) check(tag+' two actual-pivot labels only in the completed case', labelled_paths == (2 if (gear,terah)==(1,0) else 0)) missing = [k for k in ['input','intermediate','output'] if not memberships[k]] cases.append(dict(gear=gear,Terah60=terah,coordinates=values, source_record_indices=memberships,selected_SP_support_records=ids, gains=[128,64],gaps=[1472,1600,736,800], affine_slope=[625,529],affine_intercept=[-96*H,529], whole_map_identity=True,complete_source_path=bool(complete), labelled_actual_pivot_paths=labelled_paths,missing_in_fixed_register=missing, formal_MT_station_states={ 'input':dict(gear=gear+1,Cainan=1,Terah60=terah+1,full430=1), 'intermediate':dict(gear=gear+2,Cainan=0,Terah60=terah+1,full430=1), 'output':dict(gear=gear,Cainan=0,Terah60=terah,full430=1)}, inadmissible_formal_states_are_not_source_records=True)) used.update(ids.values()) used.update(i for js in memberships.values() for i in js) check('six sourced pivot comparisons but only one complete 2K coordinate path', len(cases)==6 and sum(c['complete_source_path'] for c in cases)==1) check('only two complete actual-pivot label realizations', sum(c['labelled_actual_pivot_paths'] for c in cases)==2) prior = load('C432_DATA.json')['path'] check('the surviving path is exactly the previously authenticated one', [cases[0]['coordinates'][k] for k in ['input','intermediate','output','P','Q','H']] == [prior['input'],prior['intermediate'],prior['output'],*prior['pivots'],prior['effective_pivot']]) # Small necessity controls: changing source rail or modal binding changes the map. no_companion_effective_offset = F(25*(-215+130)-23*950,48) check('dropping SP companion fails held-Shem whole-map equality', no_companion_effective_offset == -500+F(25,48)) required_502_displacement = F(23*950-48*502,25) check('500 result cannot be relabelled as the 502 binding with second pivot fixed', required_502_displacement == F(-2246,25) and required_502_displacement.denominator != 1) check('fixed-H first intermediate differs by 36 from the sourced intermediate', E(3206,2148)==2056 and 2056-2020==36 and 2056 not in by) return dict( step='C434',source_excerpt_cards=cards,source_G1_SP_bases=source_bases, domain=dict(labelled_records=len(register),coordinate_count=len(by), meaning_of_absent='Absent only from the frozen regular Noah/Shem/Flood register; not a repository-wide negative.'), source_formula=dict(N='3706+2(g-1)+60T',H='N-500',P='N+130-215-1=N-86',Q='N-950', exact_identity='25(215-130+1)+23(950)=48(500)=24000', factorization='E_Q composed with E_P equals E_H squared', integer_parameter='P=H+23*18; Q=H-25*18', input='H-1058',intermediate='H-1186',output='H-1250'), cases=cases,used_source_records=[dict(record_index=i,record=register[i]) for i in sorted(used)], counts=dict(pivot_comparisons=6,whole_map_identities=6,sourced_inputs=2,sourced_intermediates=1, sourced_outputs=6,complete_coordinate_paths=1,labelled_actual_pivot_paths=2), boundary_proof=dict(input='S_MT(g+1, C1, T+1, F1)',intermediate='S_MT(g+2, C0, T+1, F1)', output='S_MT(g, C0, T, F1)',allowed_gear=[1,2,3],allowed_T=[0,1], consequence='T=0 and g=1; full-register membership shows no alternative role/alias rescue.'), controls=dict(companion_removed_effective_H_error=[25,48], displacement_required_for_502_with_Q_fixed=[-2246,25], fixed_H_intermediate_2056_absent=True,source_midpoint_shift=36, modal_502_is_not_rejected=True), provenance_correction=dict(prior='C432 E_RULE card pointed to File_46 lines97-113: P=70/69.', corrected='File_46 L3, lines117-133: E=25/23.', effect='Excerpt locator correction only. Earlier E calculations already used25/23.'), limits=['Source-qualified affine comparison, not a combined chronology prescription.', 'SP primary Noah-death retains the inclusive/harmonic qualification.', 'P and Q cross contexts; their864 gap is not one Noah lifespan.', 'Regular Gears remain Noah/Shem/Flood only; formal G4/G5 and T2 are rejected.', 'LXX OFF aliases are theoretical, not native-Cainan dates or independent witnesses.', 'Existing phase/component limits are inherited; no new seasonal claim.', 'SKL supplement retained for awareness only.', 'No wider-input census is performed: C435 remains unexecuted.'])