"""Source packet preparation only; no numbered research step or canonical edit."""
from pathlib import Path
from itertools import accumulate
import json, hashlib
ROOT=Path('/workspace/scratch/1b40da62dcbd')
OUT=ROOT/'c732_c831/prep'
S51=ROOT/'project_sources/39-File_51a.Rounded_Scaffold_Mod5_Architecture.md'
S18=ROOT/'project_sources/38-File_18.Chronological_Data_Tables-20260919-141048-.md'
S52=ROOT/'upload/File_52c.Rounded_Whole_Span_Inverse_Detailed_Study_Draft (2)(1).md'
names=['Adam','Seth','Enosh','Kenan','Mahalalel','Jared','Enoch','Methuselah','Lamech','Noah','Shem','Arphaxad','Shelah','Eber','Peleg','Reu','Serug','Nahor','Terah','Abraham','Isaac','Jacob','Levi','Kohath','Amram','Moses']
mt_b=[130,105,90,70,65,162,65,187,182,500,100,35,30,34,30,32,30,29,70,100,60,91,None,None,None,None]
mt_L=[930,912,905,910,895,962,365,969,777,950,600,438,433,464,239,239,230,148,205,175,180,147,137,133,137,120]
mt_rndL_literal=[930,910,905,910,895,960,365,970,775,950,600,440,435,465,240,240,230,150,205,175,180,145,135,135,135,120]
mt_regular_roundedL_literal=[930,910,905,910,895,960,365,965,775,950,600,440,435,465,240,235,230,150,205,175,180,145]
mt_ActCum_literal=[14006,13076,12164,11259,10349,9454,8492,8127,7158,6381,5431,4831,4393,3960,3496,3257,3018,2788,2640,2435,2260,2080,1933,1796,1663,1526]
mt_RndCum_literal=[14006,13076,12166,11261,10351,9456,8496,8131,7161,6386,5436,4836,4396,3961,3496,3256,3016,2786,2636,2431,2256,2076,1931,1796,1661,1526]
def locator(path,start,end):
lines=path.read_text().splitlines()
return {'path':str(path),'line_start':start,'line_end':end,'text':'\n'.join(lines[start-1:end])}
sources={p.name:{'path':str(p),'sha256':hashlib.sha256(p.read_bytes()).hexdigest()} for p in [S51,S18,S52]}
source_excerpts=[locator(S51,202,212),locator(S51,392,416),locator(S51,448,486),locator(S51,1325,1403),locator(S51,1780,1848),locator(S18,1226,1257),locator(S18,1440,1490),locator(S18,1600,1624),locator(S18,1695,1734),locator(S18,2010,2073)]
def mkrows(trad):
B=mt_b.copy(); L=mt_L.copy(); N=names.copy()
if trad=='LXX_native_ON':
for i in [0,1,2,3,4,6,11,12,13,14,15,16]: B[i]+=100
B[17]+=50
for i,v in {8:753,11:465,12:460,13:504,14:339,15:339,16:330,17:208}.items():L[i]=v
N.insert(12,'2nd Cainan');B.insert(12,130);L.insert(12,460)
if trad=='SP_native_OFF':
for i,v in {5:62,7:67,8:53,11:135,12:130,13:134,14:130,15:132,16:130,17:79}.items():B[i]=v
for i,v in {5:847,7:720,8:653,13:404,18:145}.items():L[i]=v
rows=[]
for name,b,L in zip(N,B,L):
row={'name':name,'begetting':b,'lifespan':L,'remainder':None if b is None else L-b,'remainder_status':'unavailable' if b is None else 'calculated L minus b'}
if name=='Jacob':row['begetting_role']='narrative-derived age at Joseph birth; collateral to cumulative Levi continuation'
if b is None:row['begetting_role']='no source-admitted begetting input; do not invent a row remainder'
if trad=='SP_native_OFF' and name in ['Jared','Methuselah','Lamech']:
row['lifespan_status']='inclusive cap count; algebraic remainder is not an ordinary elapsed-year remainder'
if trad=='SP_native_OFF' and name=='Lamech':
row.update({'begetting_status':'53rd counted year; descriptive count 53, primary execution 52 completed','primary_completed_begetting':52,'primary_algebraic_remainder':601,'companion_full_begetting':53,'companion_algebraic_remainder':600})
if trad=='LXX_native_ON' and name=='Lamech':row['source_status']='182 operative; 753 attested selected lifespan; 571 calculated; 188 nonoperative; 777 appendix only'
rows.append(row)
return rows
packet={'purpose':'new source-owned row residual and boundary-support tests; preliminary preparation, not numbered execution','sources':sources,'source_excerpts':source_excerpts,'native_rows':{t:mkrows(t) for t in ['MT_native_OFF','LXX_native_ON','SP_native_OFF']},'MT_literal_checks':{'names':names,'rounded_cumulative_lifespans':mt_rndL_literal,'rounded_regular_theoretical_lifespans_Adam_to_Jacob':mt_regular_roundedL_literal,'actual_cumulative_dates':mt_ActCum_literal,'rounded_cumulative_dates':mt_RndCum_literal},'rules':{'nearest5':'R(n)=5 floor((n+2)/5), for nonnegative integer source measures','begetting':'R(b); propagate selected begetting intervals with declared anchors/boundary terms','theoretical_regular_life':'R(b)+R(L-b), explicitly source-adopted MT only; cross-tradition application is diagnostic','cumulative_life':'R(L), source-adopted MT; transfer to LXX/SP is derived comparison pending validation against a controlling rounded table','residual_sign':'rounded minus actual','commutator':'K=R(b)+R(r)-R(b+r)','boundary_residual':'D_i=sum_{j>=i}(R(L_j)-L_j), for common terminal anchor','SP_guard':'inclusive counts and completed intervals remain separately typed; no upstream Gear or invented death biography','Cainan':'130+330=460; native LXX ON, MT/SP OFF; leveling only explicit finite comparison','inverse':'no decimal inversion in this packet'},'source_discrepancies':[{'source':'File51a §3.4 Machine Guard [METHUSELAH BIFURCATION]','quote':'Both rules are applied uniformly to all patriarchs; Methuselah is the unique case where they diverge.','finding':'Own table Reu32+207→30+205=235 disagrees with cumulative239→240 too; literal values retained; uniqueness sentence requires qualification.'},{'source':'File51a §16.1 probability note','finding':'The literal lifespan list has14 nonmultiples and12 multiples of5, reversed from the prose note14 multiples/12 nonmultiples; no probability calculation undertaken.'}]}
(OUT/'rounded_transfer_inputs.json').write_text(json.dumps(packet,indent=2,ensure_ascii=False)+'\n')
R=lambda n:5*((n+2)//5)
analyses={}
for trad,rows in packet['native_rows'].items():
analysis=[]
for row in rows:
b,r,L=row['begetting'],row['remainder'],row['lifespan']
a={'name':row['name'],'L':L,'R_L':R(L),'e_L':R(L)-L}
if b is not None:a.update({'b':b,'r':r,'R_b':R(b),'R_r':R(r),'e_b':R(b)-b,'e_r':R(r)-r,'K':R(b)+R(r)-R(L)})
analysis.append(a)
for i,a in enumerate(analysis):
a.update({'actual_cumulative_boundary':1406+sum(x['L'] for x in analysis[i:]),'rounded_cumulative_boundary':1406+sum(x['R_L'] for x in analysis[i:]),'D_boundary':sum(x['e_L'] for x in analysis[i:])})
analyses[trad]={'rows':analysis,'actual_lifespan_total':sum(a['L'] for a in analysis),'rounded_lifespan_total':sum(a['R_L'] for a in analysis),'positive_residuals':sum(max(0,a['e_L']) for a in analysis),'negative_residuals':sum(min(0,a['e_L']) for a in analysis),'nonzero_K':[{k:a[k] for k in ['name','b','r','L','R_b','R_r','R_L','K']} for a in analysis if a.get('K',0)!=0]}
MT={x['name']:x for x in analyses['MT_native_OFF']['rows']}
for trad in ['LXX_native_ON','SP_native_OFF']:
analyses[trad]['delta_to_MT_common_rows']=[{'name':a['name'],'source_L_delta':a['L']-MT[a['name']]['L'],'rounding_residual_delta':a['e_L']-MT[a['name']]['e_L'],'boundary_residual_delta':a['D_boundary']-MT[a['name']]['D_boundary']} for a in analyses[trad]['rows'] if a['name'] in MT]
regular={}
for trad,rows in packet['native_rows'].items():
prefix=rows[:next(i for i,row in enumerate(rows) if row['name']=='Jacob')]
profiles=[]
for i,row in enumerate(prefix):
profiles.append({'name':row['name'],'b':row['begetting'],'R_b':R(row['begetting']),'e_b':R(row['begetting'])-row['begetting'],'strict_actual_birth':2006+sum(x['begetting'] for x in prefix[i:]),'rounded_birth_diagnostic':2006+sum(R(x['begetting']) for x in prefix[i:]),'D_birth':sum(R(x['begetting'])-x['begetting'] for x in prefix[i:])})
regular[trad]={'anchor':'Jacob2006; no Shem+2 or ordinal completion correction added','rows':profiles,'SP_status':'For SP this descriptive53 count route is diagnostic only; primary completed52 must remain separately typed.' if trad=='SP_native_OFF' else 'strict regular source comparison'}
if trad=='SP_native_OFF':
regular[trad]['primary_completed_52']={'strict_actual_head':profiles[0]['strict_actual_birth']-1,'rounded_head_diagnostic':profiles[0]['rounded_birth_diagnostic']-5,'rule':'replace only Lamech input53 by source completed52; no event or Gear transport'}
diag={'status':'preparatory diagnostics; root numbered steps remain authoritative','families':analyses,'regular_diagnostics':regular,'residue_K_table':[[R(a)+R(b)-R(a+b) for b in range(5)] for a in range(5)],'SP_interpretation_order':{'count_path_b':53,'completed_path_b':52,'R_count':R(53),'R_completed':R(52),'raw_gap':1,'rounded_gap':R(53)-R(52),'count_algebraic_row_K':R(53)+R(600)-R(653),'completed_algebraic_row_K':R(52)+R(601)-R(653)},'prior_scope':'C492 totals +6/+2; C493 MT aggregate cancellation; C491 cross-tradition row deltas. Full residual support and Reu commutator not found in C482–C731 journals.'}
(OUT/'rounded_transfer_diagnostics.json').write_text(json.dumps(diag,indent=2,ensure_ascii=False)+'\n')
print(json.dumps({'input_rows':{k:len(v) for k,v in packet['native_rows'].items()},'diagnostic_totals':{k:(v['actual_lifespan_total'],v['rounded_lifespan_total']) for k,v in analyses.items()},'files':['rounded_transfer_inputs.json','rounded_transfer_diagnostics.json']},indent=2))
Evidence
prepare rounded transfer.py
Linked sources and evidence
Edition and provenance
prepare_rounded_transfer.py
SHA-256 71bf7df431e4f64dab464aedae4b1d75fdb09f4ace57883c4b703a72203cdf67
C480–C1634/Research_Cycles/C0732_C0831/prep/prepare_rounded_transfer.py