diff --git a/research/t74-joint-twelve/CLAIM-LOG.txt b/research/t74-joint-twelve/CLAIM-LOG.txt new file mode 100644 index 0000000000..37a3be9470 --- /dev/null +++ b/research/t74-joint-twelve/CLAIM-LOG.txt @@ -0,0 +1,9 @@ +LOCAL CLAIM: joint twelve-source reassignment beyond the PR2720 fixed-old-path contract. +Explicit donor assignment; retained seed2; last fetched base c22e42de697334df85337e005864773cdc2bc98b. New fetch and REST/GraphQL metadata refresh failed with network timeout/reset; latest verified comparison PR2733 head2761b52b17590b8cf94f2e410004a8252d5592dc. Recheck overlap before submission. +Candidates considered: (1) reassign old four lifted aliases together with eight new source-partner aliases; (2) optimize shared chart choices of the eight aliases under fixed paths, excluded as a centre improvement by PR2720; (3) new pre-life hosts after reassignment, no fixed-frame alias found and loose gap candidates appear inherited. Chosen(1). +Exact object: rebuild before lowfour with positive reconstruction of2462; recover source pairs33/49,55/101,74/83,85/98 after their last original uses; original four sources33,55,74,85 replace696,697,698,700, while2696eight remain680,681,682,684,688,689,690,692. Derive all target corrections from full arbitrary-input residual, transport through precondition/compensation, and lift targets to line45. Then six PR2679 pre-life substitutions and alias653<-563. +Bounded experiment: one deterministic assignment, both providers. No random search. Original and changed symbolic programs priced, forward/dual exact audits passed. Before implementing full admission, optimistic complete profile passes budget root approx0.001717141586348426338110, gain0.05834% over2733, all stock fixed at415helpers/72buffers. This is not yet a claimed conditional exponent. +Expected deliverable: complete source-bound construction, independent replay, negative controls, full native/supplier/outer checks and one focusedPR if it still improves latest. Finish target45minutes. Tekalign with substantial OpenAI Codex assistance; credits2436,2530,2679,2696,2733 and retained lineage. + +RESULT: Complete finite release passed. Public claim posting failed with integration403; this is a local claim. Public wrapper and latest-PR checks recorded separately. +Final public wrapper: PASS_T74_JOINT_TWELVE_COLD_COMPLETE_RELEASE, explicit pristine local source/authenticated native cache. Registered Python3.12 final replay and integrity controls passed. Exact comparison is above PR2745 as well as PR2733. diff --git a/research/t74-joint-twelve/CLAIM.json b/research/t74-joint-twelve/CLAIM.json new file mode 100644 index 0000000000..48ad23a430 --- /dev/null +++ b/research/t74-joint-twelve/CLAIM.json @@ -0,0 +1,24 @@ +{ + "status": "PASS_CONDITIONAL_FINITE_CONSTRUCTION_COMPLETE_RELEASE", + "complex_lower": "0.001717141586348426338109", + "complex_upper": "0.001717141586348426338110", + "kappa": "17171415863484263381089999999999999999999998999999999999999999999999/10000000000000000000000000000000000000000000000000000000000000000000000", + "profile": { + "1": 1593072, + "2": 430236, + "3": 204396, + "4": 79920, + "5": 22532, + "8": 5328, + "32": 1, + "48": 26558 + }, + "comparison_pr": 2733, + "comparison_head": "2761b52b17590b8cf94f2e410004a8252d5592dc", + "scope": "Conditional finite construction and complete strict supplier/modern outer release; inherited theorem assumptions remain.", + "latest_comparison": { + "pr": 2745, + "head": "4f485de05544884fa0f2edf6063bb9259decad30", + "exact_claim": "evidence/PR2745-CLAIM.json" + } +} diff --git a/research/t74-joint-twelve/DERIVATIVE-CODE.patch b/research/t74-joint-twelve/DERIVATIVE-CODE.patch new file mode 100644 index 0000000000..15b163674a --- /dev/null +++ b/research/t74-joint-twelve/DERIVATIVE-CODE.patch @@ -0,0 +1,137 @@ +--- a/audit_mixed.py ++++ b/audit_mixed.py +@@ -9,7 +9,7 @@ + for _nm,_mut in (('changed lifted target frame',lambda b_:b_['target_levels'].__setitem__('23',0)),): + _bad=copy.deepcopy(w);_mut(_bad) + try:A.local_inventory(_bad,r,None) +- except ValueError as _e:A.require(str(_e)=='target line30','target mutation rejection') ++ except ValueError as _e:A.require(str(_e)=='candidate exact source-partner target frames','target mutation rejection') + else:raise ValueError('accepted changed lifted target') + _pg=A.read(d/'LOCAL-PROGRAMS.json.gz');_bp=copy.deepcopy(_pg);_bp['forward'].remove(next(e for e in _bp['forward'] if e[0]=='center')) + try:A.local_inventory(w,r,_bp) +--- a/independent_core.py ++++ b/independent_core.py +@@ -69,8 +69,7 @@ + External ports/frames are independently checked by audit_mixed.py. + """ + levels = {int(t): f for t, f in word['target_levels'].items()} +- require(set(levels) == {11,23,29,32,34,35,45,48,50,59,63,71,73,76,81,84,87,90,92,108}, 'twenty source-partner target offsets') +- require(all(frames[f] in ((30,), (45,)) for f in levels.values()), 'target line30') ++ require({str(t): list(frames[f]) for t, f in levels.items()} == {'104': [45], '106': [45], '110': [45], '14': [45], '21': [45], '37': [45], '41': [45], '43': [45], '47': [45], '52': [45], '78': [45], '99': [45]}, 'candidate exact source-partner target frames') + require(all(current[V+t] == frames[levels.get(t, 0)] for t in range(V)), 'target centre level') + forward, backward = [], [] + for index, (register, frame_id) in enumerate(zip(word['centers'], word['center_frames'])): +@@ -90,7 +89,7 @@ + origin = destination + forward.extend(segments) + backward.extend(e[:2]+[e[3], e[2], e[4]] for e in reversed(segments)) +- require(Counter(e[4] for e in forward) == {1:8, 7:8}, 'sixteen centre children') ++ require(Counter(e[4] for e in forward) == {8:8}, 'candidate eight unsplit centre children') + return {'forward': forward, 'backward': backward} + + +--- a/new/borrow/lowfour_controls.py ++++ b/new/borrow/lowfour_controls.py +@@ -20,12 +20,13 @@ + ia=next(i for i,e in enumerate(pre) if e[0]=='add') + m=mut();m['A'][ia][3]=-m['A'][ia][3];expect('prelude correction sign flipped',m) + m=mut();m['A'][ia][3]*=2;expect('prelude correction coefficient doubled',m) +- m=mut();m['A'][ia][1],m['A'][ia+1][1]=m['A'][ia+1][1],m['A'][ia][1];expect('prelude correction targets swapped',m) ++ jb=next(j for j,e in enumerate(pre) if e[0]=='add' and e[1]!=pre[ia][1] and e[2:]!=pre[ia][2:] and e[-1]==pre[ia][-1]) ++ m=mut();m['A'][ia][1],m['A'][jb][1]=m['A'][jb][1],m['A'][ia][1];expect('prelude correction targets swapped',m) + iw=[i for i,e in enumerate(pre) if e[0]=='warp'];m=mut();del m['A'][iw[1]];m['prelude_events']-=1;expect('prelude return warp dropped',m) + m=mut();del m['A'][iw[0]];m['prelude_events']-=1;expect('prelude forward warp dropped',m) +- ids=[i for i,e in enumerate(pre) if e[0]=='add' and e[1]==135];m=mut() ++ target=pre[ia][1];ids=[i for i,e in enumerate(pre) if e[0]=='add' and e[1]==target];assert ids;m=mut() + for i in reversed(ids):del m['A'][i] +- m['prelude_events']-=len(ids);expect('all prelude corrections of target 135 dropped',m) ++ m['prelude_events']-=len(ids);expect('all prelude corrections of actual first target dropped',m) + m=mut();m['A'][0][-1]=[31];expect('prelude target scale at a different line',m) + m=mut();m['A'][iw[0]][2]=m['A'][iw[0]][2]+1 if abs(m['A'][iw[0]][2])i:r[0]-=1 + expect('source restoration gate dropped (cleanup re-derived)',rederive(m)) + # rewritten helper gate on the borrowed source removed +- j=next(i for i,g in enumerate(w0['B']) if g[0]=='add' and g[1]==33 and g[2]==250) ++ j=next(i for i,g in enumerate(w0['B']) if i>=w0['warps'][W33][0] and g[0]=='add' and g[1]==33) + m=mut();del m['B'][j] + for r in m['warps']: + if r[0]>j:r[0]-=1 +--- a/new/code/borrow/bw_audit_local.py ++++ b/new/code/borrow/bw_audit_local.py +@@ -179,6 +179,17 @@ + def phase_at(es,name):return es.index(['phase',name]) + def first_warp(es,sign=1,start=0):return ev_index(es,lambda e:e[0]=='warp' and (e[2]>0)==(sign>0),start) + def cleanup_warp(es):return first_warp(es,-1,phase_at(es,'full_frame_cleanup')) ++def incomplete_centre_descent(es): ++ # Split paths lose an intermediate step. An unsplit path is truncated at ++ # an actual nested rank-one frame, with its child rank repriced correctly. ++ # Thus the control cannot fail merely because a split no longer exists. ++ indices=[i for i,e in enumerate(es) if e[0]=='center' and e[3]!=0] ++ if indices: ++ es.pop(indices[0]);return ++ e=next(e for e in es if e[0]=='center') ++ stop=next(f for f in range(len(frames)) if len(frames[f])==1 and contains(frames[f],frames[e[2]])) ++ e[3]=stop;e[4]=len(frames[e[2]])-1 ++ + mutations=[ + ('wrong_scale',lambda es:next(e for e in es if e[0]=='scalar' and e[1][0]=='scale')[1].__setitem__(2,3)), + ('missing_center',lambda es:es.pop(next(i for i,e in enumerate(es) if e[0]=='center'))), +@@ -194,7 +205,7 @@ + ('wrapper_on_a_centre_register',lambda es:next(e for e in es if e[0]=='residual_adapter').__setitem__(2,['C',0])), + ] if entering else [])+([ + ('centre_step_not_nested',lambda es:next(e for e in es if e[0]=='center').__setitem__(3,next(f for f in range(len(frames)) if not contains(frames[f],frames[next(e for e in es if e[0]=='center')[2]]) and not contains(frames[next(e for e in es if e[0]=='center')[2]],frames[f])))), +- ('centre_descent_step_skipped',lambda es:es.pop(next(i for i,e in enumerate(es) if e[0]=='center' and e[3]!=0))), ++ ('centre_descent_incomplete',incomplete_centre_descent), + ] if levels else [])+([ + ('hpe_pre_wrapper_resolved_to_full_recipe',lambda es:next(e for e in es if e[0]=='residual_adapter' and e[1]=='pre' and len(e)==5).pop()), + ('hpe_post_wrapper_without_terminal_frame',lambda es:next(e for e in es if e[0]=='residual_adapter' and len(e)==5).pop()), +--- a/new/rebuild_borrow.py ++++ b/new/rebuild_borrow.py +@@ -74,10 +74,10 @@ + lf=D/'inputs'/f'lowfour_43{wt}.json';lpatch=None + if lf.exists(): # four low aliases through lifted-target compensation (PR2436 mechanism) on top of the entrance state + lpatch=json.loads(lf.read_text());prev_l=chain[-1];chain.append(word_patch.apply_lowfour(prev_l,lpatch));steps.append('lowfour') +- nw=chain[-1];kok&=word_patch.kernel_gate_edit(prev_l['B'],nw['B'])==lpatch['declared_gate_edit'] and sorted(set(nw['removed'])-set(prev_l['removed']))==[640,641,642,644]==lpatch['derived_removed_diff'] ++ nw=chain[-1];kok&=word_patch.kernel_gate_edit(prev_l['B'],nw['B'])==lpatch['declared_gate_edit'] and sorted(set(nw['removed'])-set(prev_l['removed']))==[696,697,698,700]==lpatch['derived_removed_diff'] + kok&=[x[1:] for x in nw['warps'][:len(prev_l['warps'])]]==[x[1:] for x in prev_l['warps']] and [x[1] for x in nw['warps'][-4:]]==[33,55,74,85] and len(nw['warps'])==len(prev_l['warps'])+4 + kok&=[g[:-1] for g in nw['A'][nw['prelude_events']:]]==[g[:-1] for g in prev_l['A']] and nw['restore']==prev_l['restore'] and nw['helper_final']==prev_l['helper_final'] +- kok&={k_:v_ for k_,v_ in prev_l['start_extra'].items() if k_ not in('640','641','642','644')}==nw['start_extra'] ++ kok&={k_:v_ for k_,v_ in prev_l['start_extra'].items() if k_ not in('696','697','698','700')}==nw['start_extra'] + af=D/'inputs'/f'alias637_43{wt}.json';apatch=None + if af.exists(): # alias 637 borrowing retired source 31 (PR2436 pair) stacked on the four lifted-target aliases + apatch=json.loads(af.read_text());prev_a=chain[-1];chain.append(word_patch.apply_lowfour(prev_a,apatch));steps.append('alias637');na=chain[-1] +@@ -102,10 +102,10 @@ + kok&=word_patch.kernel_gate_edit(prev_p['B'],npl['B'])==ppatch['declared_gate_edit'] + kok&=all(npl[k_]==prev_p[k_] for k_ in ('A','precondition','cut','start_extra','target_levels','centers','center_frames','ports','prelude_events')) + rf2=D/'inputs'/f'refit563_43{wt}.json';rpatch2=None +- if rf2.exists(): # one-gate exact frame lowering (B 894, add 515 += 563: dim 6 -> 5) so that 563 retires at the dimension of 653's entrance frame (this package) ++ if rf2.exists(): # one-gate exact frame lowering (B 904, add 515 += 563: dim 6 -> 5) so that 563 retires at the dimension of 653's entrance frame (this package) + rpatch2=json.loads(rf2.read_text());prev_r=chain[-1];chain.append(refit_apply(prev_r,rpatch2));steps.append('refit563');nr=chain[-1] +- kok&=len(rpatch2['frames'])==1 and rpatch2['frames'][0][:2]==['B',894] and prev_r['B'][894][:5]==['add',515,563,1,1] +- kok&=len(nr['B'][894][-1])==len(prev_r['B'][894][-1])-1 and all(x_==y_ for i_,(x_,y_) in enumerate(zip(nr['B'],prev_r['B'])) if i_!=894) ++ kok&=len(rpatch2['frames'])==1 and rpatch2['frames'][0][:2]==['B',904] and prev_r['B'][904][:5]==['add',515,563,1,1] ++ kok&=len(nr['B'][904][-1])==len(prev_r['B'][904][-1])-1 and all(x_==y_ for i_,(x_,y_) in enumerate(zip(nr['B'],prev_r['B'])) if i_!=904) + kok&=not({515,563}&({x_['L'] for x_ in ppatch['pairs']}|{x_['h'] for x_ in ppatch['pairs']}) if ppatch else set()) + xf=D/'inputs'/f'alias1_43{wt}.json';xpatch=None + if xf.exists(): # retired-lender alias 653<-563 on the refit state (this package) +@@ -141,9 +141,9 @@ + pw_=Path(tempfile.mkdtemp())/'orig.json.gz';pw_.write_bytes(gzip.compress(json.dumps(prev_p,separators=(',',':')).encode(),mtime=0)) + pc=subprocess.run([sys.executable,'-B',str(D/'prelife_controls.py'),str(shipped),str(pw_),str(RCP/f'CONTROLS-PRELIFE-43{wt}.json')],capture_output=True,text=True) + pc_ok=pc.returncode==0 and json.loads((RCP/f'CONTROLS-PRELIFE-43{wt}.json').read_text())['all_rejected_for_expected_reason'];ok&=pc_ok;res['prelife_controls_ok']=pc_ok +- if rpatch2: # control: the shipped word with the B 894 frame restored to its un-refitted (dim 6) frame must be rejected (the 653<-563 warp then starts from the wrong frame) ++ if rpatch2: # control: the shipped word with the B 904 frame restored to its un-refitted (dim 6) frame must be rejected (the 653<-563 warp then starts from the wrong frame) + import copy as cp6 +- m=cp6.deepcopy(final);m['B'][894][-1]=prev_r['B'][894][-1];bp=Path(tempfile.mkdtemp())/'refit563_undone.json.gz';bp.write_bytes(gzip.compress(json.dumps(m,separators=(',',':')).encode(),mtime=0)) ++ m=cp6.deepcopy(final);m['B'][904][-1]=prev_r['B'][904][-1];bp=Path(tempfile.mkdtemp())/'refit563_undone.json.gz';bp.write_bytes(gzip.compress(json.dumps(m,separators=(',',':')).encode(),mtime=0)) + br=run_audit(bp,None,bp.parent/'refit563_undone.out.json');ru=br.returncode!=0 and 'warp frame mismatch' in (br.stdout+br.stderr);res['refit563_undone_rejected_by_warp_frame_mismatch']=ru;ok&=ru + if xpatch: + xc=subprocess.run([sys.executable,'-B',str(D/'alias1_controls.py'),str(shipped),str(xf),str(RCP/f'CONTROLS-ALIAS1-43{wt}.json')],capture_output=True,text=True) diff --git a/research/t74-joint-twelve/DERIVATIVE-OVERLAY.tar.gz b/research/t74-joint-twelve/DERIVATIVE-OVERLAY.tar.gz new file mode 100644 index 0000000000..46f7ce76d8 Binary files /dev/null and b/research/t74-joint-twelve/DERIVATIVE-OVERLAY.tar.gz differ diff --git a/research/t74-joint-twelve/EVIDENCE.json b/research/t74-joint-twelve/EVIDENCE.json new file mode 100644 index 0000000000..625b5d292e --- /dev/null +++ b/research/t74-joint-twelve/EVIDENCE.json @@ -0,0 +1,65 @@ +{ + "status": "PASS_FINITE_CONSTRUCTION_AND_COMPLETE_RELEASE", + "environment": { + "native_and_full_python": "3.14.7", + "bounded_python": "3.12.14", + "platform": "Linux" + }, + "runs": { + "native_base": { + "receipt": "evidence/NATIVE-BASE.json", + "coverage": "Fresh five stages after incomplete-descent negative-control fix." + }, + "native_extra": { + "receipt": "evidence/NATIVE-EXTRA.json", + "coverage": "Fresh five stages." + }, + "full_admission": { + "receipt": "evidence/ADMISSION.json", + "release": "evidence/RELEASE.json", + "coverage": "Complete strict supplier and modern outer; authenticated reuse of both fresh candidate native runs and existing pinned retained-parent/native evidence. Not an all-fresh retained-parent run." + }, + "portable_generator": { + "status": "PASS_REGENERATED_JOINT_TWELVE_BOTH_WORDS", + "log_sha256": "a0bf3febcc6f652f96a58d6b68a330148cf33943e2c1743d870d78e56865250f", + "coverage": "Authenticated PR2679 source; positive complete2462 reconstruction; both full semantic words regenerated." + }, + "public_wrapper": { + "status": "PASS_T74_JOINT_TWELVE_COLD_COMPLETE_RELEASE", + "coverage": "Explicit local pristine source and exact prepared native cache. Default remote-download/all-fresh path not executed end to end.", + "receipt": "evidence/PUBLIC-WRAPPER.json", + "seconds": 543.6799636979995, + "note": "The literal-review stage ran before final exact PR2745 comparison and claim-binding controls were added. The stronger final bounded checker was separately rerun successfully; full wrapper/admission code is unchanged." + }, + "registered": { + "status": "PASS_REGISTERED_RESEARCH_PACKAGE", + "coverage": "Python3.12 verify, generic ceiling, relocated/integrity tests.", + "log_sha256": "7363b02edab58b3f679677fb1e5a867ae83917f6cc537533e2c1301a7426a012" + } + }, + "initial_failures": [ + { + "run": "Initial base native local replay", + "finding": "Mutation construction assumed a nonzero intermediate centre destination. All-H8 word has none, raising StopIteration after positive replay. Replaced with actual incomplete nested descent, correctly repriced; fresh native run passed." + }, + { + "run": "Initial full word rebuild", + "finding": "Lowfour controls assumed old target135 and old source33 gate; alias653 position metadata was stale. Controls now select actual changed gates; regenerated literal metadata and reran original checks." + } + ], + "source_reuse": "REUSE-PINS.json authenticates every cache file; SOURCE-FILES.json authenticates original491 source files; overlay gives exact changed files and complete derived manifest. No selected frontier or upstream files modified.", + "formal_proof": false, + "independent_human_review": false, + "receipt_hashes": { + "evidence/ADMISSION.json": "b85b5b339353ae2a1935afa2963fcde7db9f66b41f205ddd632210257a8be168", + "evidence/INDEPENDENT.json": "f9e4500e5cb1ab1b9e8189de6dfbcca8dd9f7e2ea1a9ffce6801d6530797c0d2", + "evidence/NATIVE-BASE.json": "658d1d341816ee5227c55977047354f3c26280b961d5c967eff0ef02fb1f0486", + "evidence/NATIVE-EXTRA.json": "5e1bac16f35af9fb4a6adbcf76d948052fbec016bb7e8740fc121b5754eecebb", + "evidence/OWNERS.json": "4df2066f097e4b59edf7d7af0e7e234413b9d2a09de4302d02adb3869972f672", + "evidence/PACKING-CAP.json": "59deb044b1b46953cbfd2fcedd3026a901d4524d7d05c592b8e1420501f6e652", + "evidence/PR2733-CLAIM.json": "8e08f71a18e6a30259c1e2ea19b4069b9d3e3b656b38c57065ec2b9db367282b", + "evidence/PR2745-CLAIM.json": "62b395b95322e0a6786e0193e312d67de6b664c8c79fcfaab5bc7effe775a7c3", + "evidence/PUBLIC-WRAPPER.json": "70acee53d90097edfa3e7c99ad68311f236bade5ee71a446bcc8935e9e7e3192", + "evidence/RELEASE.json": "5839b3b3448d67d7a936fe962298d7d77cb83ee489321343af7769166f5d0142" + } +} diff --git a/research/t74-joint-twelve/FRESHNESS.json b/research/t74-joint-twelve/FRESHNESS.json new file mode 100644 index 0000000000..0bd23fd199 --- /dev/null +++ b/research/t74-joint-twelve/FRESHNESS.json @@ -0,0 +1,38 @@ +{ + "checked_utc": "2026-10-15T20:02:00.353190+00:00", + "scientific_base": "c22e42de697334df85337e005864773cdc2bc98b", + "fetched_canonical_main": "7ef5f7150476fdf995b286b9cdbed262c631939c", + "guidance": "AGENTS, CONTRIBUTING, autoresearch, family status, task catalogue, selected result and current status unchanged from base; review ledger updated with unrelated incorporation rounds. Frozen scientific inputs retained.", + "open_prs": { + "count": 727, + "highest_number": 2748, + "snapshot_sha256": "be5216931a74c4908760fbd33f0e044e2a832ccacf0bdc7e87c3ea9add291e51", + "coverage": "All open PR titles and bodies fetched (limit1000,727 returned); relevant latest construction heads and exact claims inspected. Not every code diff independently reviewed." + }, + "comparisons": [ + { + "pr": 2733, + "original_head": "2761b52b17590b8cf94f2e410004a8252d5592dc", + "latest_head": "19af796d8c158a07041e936747c27901e49c0bd2", + "claim": "Exact rational and profile unchanged." + }, + { + "pr": 2745, + "head": "4f485de05544884fa0f2edf6063bb9259decad30", + "claim": "Exact downloaded rational is strictly smaller than candidate; check in verify.py." + }, + { + "pr": 2720, + "head": "813fae623dcf3181fb9f535852ae4c82b1b369b5", + "claim": "Fixed-old-path obstruction. Current experiment changes that premise." + } + ], + "discussions": { + "coverage": "30 most recently updated discussion bodies and last15 comments of2612. Older discussions and arbitrary nested replies not exhaustively refreshed. No pinned issues returned.", + "snapshot_sha256": "de8819666de4704121286d0ba198ee5430b2d92505d9ce7830e933e931016ea7", + "coordination_sha256": "c81d3c18da42cb6ef7ef01f16e5d2aaf07eb717c1cf22d92cc44339afe1b34f9", + "canonical_thread": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2612", + "result_comment": "pending publication" + }, + "limitations": "No metadata search proves novelty. Earlier shell network failures and connector403 kept new scope claim local until publication." +} diff --git a/research/t74-joint-twelve/GENERATOR-PINS.json b/research/t74-joint-twelve/GENERATOR-PINS.json new file mode 100644 index 0000000000..53cbe5b14d --- /dev/null +++ b/research/t74-joint-twelve/GENERATOR-PINS.json @@ -0,0 +1,12 @@ +{ + "pr2679_manifest": "db498ed7998397ef00501e037f10678e89ee113d57af4667c5c6978fc42e83ba", + "vendor": { + "vendor/generate_words.py": "340532e035fa3c4d7d2f92aeb80f0efbb44a53c4e3deeb0c6bf7d6ae2fccd0c7", + "vendor/gf_chart.py": "871936fa81af695d5bdc029803af81228300c405f5ff8d153e130530dddca4f6", + "vendor/target_transport.py": "9f92e1699167f46d0f0e59b540a9940ee1addcb5357ca65cf1dbf7acdbe7ad86", + "vendor/UPSTREAM-NOTICE": "a91b93a731f116ae55b3644c88232b4d996e58bb810e2559dec013f9788f5e4b", + "vendor/GENERATOR-NOTICE.txt": "d4cbc432b79ee2d54a83bcadf260bb89e910262b8c19e763e08b7eb3a5e8215c", + "vendor/UPSTREAM-VENDOR-SOURCES.json": "592a98f6a3bd7fbd0063d90c989e30c5cd534220797b5b0beb0388e1f8d498ec", + "vendor/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + } +} diff --git a/research/t74-joint-twelve/INPUT-PINS.json b/research/t74-joint-twelve/INPUT-PINS.json new file mode 100644 index 0000000000..3b928d7892 --- /dev/null +++ b/research/t74-joint-twelve/INPUT-PINS.json @@ -0,0 +1,17 @@ +{ + "inputs/DISPATCH.json.gz": "14fe756dcac93a0f3b2b7f38ba7b998dec89d56d5171b691af4fae45e5d83d11", + "inputs/FILL.json.gz": "9ce94578640b4927cb9c73244692b1f79ac2999179d309f6bf0c015c06f7a2f1", + "inputs/GLOBAL-TEMPLATE.json.gz": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "inputs/ORDER.json": "129e791d5b45c279443ff9e1edef5ac33d5abc51717ecbae8265abea5c247ae7", + "inputs/PLAN.json.gz": "afb3c5c8134fc2cfce0b50a21758490c225574994b2c3c5161e53e2355acc6fa", + "inputs/POSITIVE2462-base.json.gz": "3506c84203f126900326ff4d22aaceda819734e5f96fa4622d43fbb78b946ece", + "inputs/POSITIVE2462-extra.json.gz": "ec7103c196b32de7af79a6f43952cbe998c085a00f1a8e740f5556c774589099", + "inputs/PROVIDERS.json": "ec4802a33c0e1d41369da77b19b9b783dc812b2d3246e096fee13d29f226dd66", + "inputs/SOURCE-FILL.json.gz": "dc96598624ee49d368e1130ec2148734be0bbc68402cc181e1f02ae9ca8e3d06", + "inputs/SOURCE-ORDER.json": "aa7c53c188c90fd74421a804f4c6fb13aa1187c06dbac51fa147830a40e00667", + "inputs/SOURCE-PROVIDERS.json": "d8d90c3b906c66874f9fe07df67be24e53f3f3f9146565b56a272548108327b7", + "inputs/WORD-base.json.gz": "ae8b6b4d62a9da29331062fae1bd68b0341edf83152f5a5ef50c5109ba578f9a", + "inputs/WORD-extra.json.gz": "1bb44a73d5841afb954b49ae94dba2e0c536b1eea9436ae5d89de87d8a04e127", + "evidence/PR2733-CLAIM.json": "8e08f71a18e6a30259c1e2ea19b4069b9d3e3b656b38c57065ec2b9db367282b", + "evidence/PR2745-CLAIM.json": "62b395b95322e0a6786e0193e312d67de6b664c8c79fcfaab5bc7effe775a7c3" +} diff --git a/research/t74-joint-twelve/LICENSE b/research/t74-joint-twelve/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/t74-joint-twelve/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/t74-joint-twelve/OVERLAY-PINS.json b/research/t74-joint-twelve/OVERLAY-PINS.json new file mode 100644 index 0000000000..ec223bdbe2 --- /dev/null +++ b/research/t74-joint-twelve/OVERLAY-PINS.json @@ -0,0 +1,28 @@ +{ + "original_manifest_sha256": "db498ed7998397ef00501e037f10678e89ee113d57af4667c5c6978fc42e83ba", + "derived_manifest_sha256": "7980dbde79b63de4093cde89d1564a18c6bf16a2e35d810e38cf9797fe09e0cf", + "archive_sha256": "16468f7428c6e01522fcb15a8e3040d13de6cb8856428e32dcfbce8dbe46b8ec", + "files": { + "audit_mixed.py": "b8a319f580adf417384a13a996ca82ab674fae7917c2ae971aa4025bb2305e78", + "independent_core.py": "a747bf36a4c005398e71300005a5733bb9fa70fcdb0d00f306c894361c1b2a39", + "new/BORROW-PROVIDERS.json": "ec4802a33c0e1d41369da77b19b9b783dc812b2d3246e096fee13d29f226dd66", + "new/borrow-fill/FILL.json.gz": "9ce94578640b4927cb9c73244692b1f79ac2999179d309f6bf0c015c06f7a2f1", + "new/borrow-fill/ORDER.json": "129e791d5b45c279443ff9e1edef5ac33d5abc51717ecbae8265abea5c247ae7", + "new/borrow/inputs/alias1_43base.json": "20abad50afc6f75b01ba312687ef27c2ef3c41d8afc1429d8c8c8536384cf508", + "new/borrow/inputs/alias1_43extra.json": "df0739086556744574be9c574ae0cca3b1b7c1409d12647829999ffe9d3bed10", + "new/borrow/inputs/alias8_43base.json": "564a2576b3748847cbf5f0e9d22e4d96d159d65f654b5e02e317b05c186775dd", + "new/borrow/inputs/alias8_43extra.json": "9e437b3f6bd36f0e96bf41435a3698ffd42a17fb372492b144097bd59637d53c", + "new/borrow/inputs/lowfour_43base.json": "9f80e059f3b68eaf2682b162110a75091df98e73eb8d70fb442e5c6fad3363e7", + "new/borrow/inputs/lowfour_43extra.json": "9a726ea6bfd3c7d1452377e4be70ab986195ee184f82eb754906def0d08606fc", + "new/borrow/inputs/prelife_43base.json": "77a9a5e0fdfefe861171e46d370d0797356d99e1302d0b2c676d7a619804216d", + "new/borrow/inputs/prelife_43extra.json": "4b2a805cb82d0c8036d7217979ffe1ff984d29b399066585c6b2502597a386f9", + "new/borrow/inputs/refit563_43base.json": "2f4a008bae24f8112dcb8a2fe27bb3fdecbe9478675f19ffc5b662153c606061", + "new/borrow/inputs/refit563_43extra.json": "2f4a008bae24f8112dcb8a2fe27bb3fdecbe9478675f19ffc5b662153c606061", + "new/borrow/lowfour_controls.py": "157d05da7842ba3939290e874cc9f784f351cbfc897275aa1f19a500532ce89d", + "new/borrow/words/BORROW-WORD-43base.json.gz": "ae8b6b4d62a9da29331062fae1bd68b0341edf83152f5a5ef50c5109ba578f9a", + "new/borrow/words/BORROW-WORD-43extra.json.gz": "1bb44a73d5841afb954b49ae94dba2e0c536b1eea9436ae5d89de87d8a04e127", + "new/code/borrow/bw_audit_local.py": "08d5864d9b77902fc5ab5a062a8ea843fe1e572243b8c580abb0a421b2e46d07", + "new/rebuild_borrow.py": "2fa4035394be981d287a6e106a8af05d614704e6814fcebb9274b072a5cd03e2", + "MANIFEST.json": "7980dbde79b63de4093cde89d1564a18c6bf16a2e35d810e38cf9797fe09e0cf" + } +} diff --git a/research/t74-joint-twelve/PROFILE.json b/research/t74-joint-twelve/PROFILE.json new file mode 100644 index 0000000000..080d9e165d --- /dev/null +++ b/research/t74-joint-twelve/PROFILE.json @@ -0,0 +1,10 @@ +{ + "1": 1593072, + "2": 430236, + "3": 204396, + "4": 79920, + "5": 22532, + "8": 5328, + "32": 1, + "48": 26558 +} diff --git a/research/t74-joint-twelve/PROOF.md b/research/t74-joint-twelve/PROOF.md new file mode 100644 index 0000000000..d2b1a96ba8 --- /dev/null +++ b/research/t74-joint-twelve/PROOF.md @@ -0,0 +1,25 @@ +# Changed recovery contract and complete moment + +The exact object is the two finite T74 words reconstructed by `generate.py`. The experiment uses a single explicit assignment, not a search over all assignments. Starting before PR2462's lowfour transformation is essential: applying the old lowfour patch first is a positive control reproducing its complete original words. + +The new `(removed helper, recovered source, partner)` assignments are: + +``` +(696,33,49), (697,55,101), (698,74,83), (700,85,98), +(680,49,33), (681,83,74), (682,98,85), (684,101,55), +(688,68,4), (689,80,88), (690,88,80), (692,31,12). +``` + +The last eight are PR2696's assignment. For each of the pairs33/49,55/101,74/83,85/98, let `(x,y)` denote the values after their last original uses, in their shared frame. The two added gates are `x += y/2` followed by `y -= x`, hence the linear map is `(x+y/2, y/2-x)`. For the actual predecessor state these restore the two original source values. The proof of that word-specific premise is the full arbitrary-input exact symbolic replay, not a claim that this map is the identity on arbitrary `(x,y)`. + +These restorations precede the new alias handoffs. Original operator IDs remain stable; twelve new chart transformations are appended. Removed-helper echoes are deleted only where they are target additions. For each new source, the generator computes the complete symbolic residual, transports its negative through precondition/compensation, and emits explicit initial correction gates and inverse source warps. Every residual must consist of a single new operator applied to its recovered source. Independent forward/dual propagation checks the resulting arbitrary-input identity, including dirty registers, and separately checks inverse cleanup. + +All lifted targets have frame `[45]`; their offsets are14,21,37,41,43,47,52,78,99,104,106,110. None is a target read by any cut gate. Actual frame propagation therefore leaves all eight centre children rank8. This changes the old-four recovery/target paths fixed in PR2720; its obstruction is respected within its stated domain. + +Apply the six PR2679 pre-life substitutions to the actual resulting state, refit the unique `515 += 563` gate (now B904), then alias653 into563. The complete generator checks semantic equality of both resulting words. The source-bound original checks and negative controls are rerun. No helper saving is inferred solely from nominal register labels. + +The complete local profile is `{1:2366,2:646,3:297,4:120,5:26,8:8}`. Compared with the PR2733 composition it changes by `4*(H8-H7-H1)` per local word. The same415-helper inventory admits the explicit complete allocation; `independent_owners.py` checks276390 roles, strict temporal windows, every physical cell, family masks and all remainders. There are666 call equivalents, giving global delta `2664*(H8-H7-H1)` and rank mass4816512 unchanged. + +At exponent `0= 1, 'positive logarithm range') + power = 0 + while x >= 2: + x /= 2 + power += 1 + a, b = log_reduced(x) + c, d = log_reduced(F(2)) + return a + power * c, b + power * d + + +def exp_bounds(x): + """Taylor terms 0..15; later term ratios are bounded by x/17.""" + require(0 <= x < F(1, 100), 'exponential argument range') + term, lower = F(1), F(1) + for n in range(1, 16): + term = term * x / n + lower += term + tail = term * x / 16 / (1 - x / 17) + return lower, lower + tail + + +def moment_bounds(profile, exponent): + lower = upper = F(0) + for rank, count in sorted(profile.items()): + log_lo, log_hi = log_bounds(F(DIMENSION, rank)) + exp_lo, _ = exp_bounds(exponent * log_lo) + _, exp_hi = exp_bounds(exponent * log_hi) + weight = F(count * rank, DIMENSION) + lower += weight * exp_lo + upper += weight * exp_hi + return lower, upper diff --git a/research/t74-joint-twelve/full_replay.py b/research/t74-joint-twelve/full_replay.py new file mode 100644 index 0000000000..d9718b8b5b --- /dev/null +++ b/research/t74-joint-twelve/full_replay.py @@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +"""Cold reproduction of the joint twelve-source/pre-life composition. + +Default: authenticated source download, fresh native providers and retained +parent admission, then the complete original supplier/release verifier. An +explicit --prepared-native-cache must match every published reuse file hash. +All large/generated artifacts remain under a fresh external --work directory. +""" +import argparse +from concurrent.futures import ThreadPoolExecutor +from fractions import Fraction as Q +import gzip +import hashlib +import importlib +import json +import os +from pathlib import Path, PurePosixPath +import platform +import shutil +import subprocess +import sys +import tarfile +import threading +import time +from urllib.parse import quote +from urllib.request import Request, urlopen + +HERE = Path(__file__).resolve().parent +REPOSITORY = HERE.parents[1] +STEPS = ['native', 'ledgers', 'local-replay', 'wrappers', 'phases'] + + +def need(ok, why): + if not ok: + raise RuntimeError(why) + + +def sha(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def read(path): + data = path.read_bytes() + return json.loads(gzip.decompress(data) if path.suffix == '.gz' else data) + + +def write(path, value): + path.write_text(json.dumps(value, sort_keys=True, indent=2) + '\n') + + +def tree(root, exclude=()): + result = {} + for path in sorted(root.rglob('*')): + need(not path.is_symlink(), 'unauthenticated symlink: ' + str(path)) + name = path.relative_to(root).as_posix() + if path.is_file() and name not in exclude: + result[name] = sha(path) + return result + + +def safe(name): + path = PurePosixPath(name) + need(isinstance(name, str) and '\\' not in name and path.parts and not path.is_absolute() + and '..' not in path.parts and path.as_posix() == name, 'unsafe source path') + + +def download(url, expected): + for attempt in range(3): + try: + req = Request(url, headers={'User-Agent': 'integer-mult-prelife-priority/1', 'Accept-Encoding': 'identity'}) + with urlopen(req, timeout=90) as response: + body = response.read() + need(hashlib.sha256(body).hexdigest() == expected, 'download hash mismatch') + return body + except (OSError, RuntimeError): + if attempt == 2: + raise + time.sleep(attempt + 1) + + +def source_copy(source, destination, pins, jobs): + destination.mkdir() + entries = {'MANIFEST.json': pins['manifest_sha256'], **pins['files']} + need(len(pins['files']) == pins['count'] == 491, 'source file count') + + def copy(item): + name, digest = item + safe(name) + target = destination / name + target.parent.mkdir(parents=True, exist_ok=True) + if source: + need(not (source / name).is_symlink(), 'source symlink') + body = (source / name).read_bytes() + need(hashlib.sha256(body).hexdigest() == digest, 'source bytes: ' + name) + else: + body = download(pins['base_url'] + quote(name, safe='/'), digest) + target.write_bytes(body) + + with ThreadPoolExecutor(max_workers=min(jobs, 8)) as pool: + for _ in pool.map(copy, sorted(entries.items())): + pass + need(read(destination / 'MANIFEST.json') == pins['files'] + and tree(destination) == entries, 'complete source authentication') + + +def bind_native(entry, word): + need(gzip.decompress((entry / 'local/FULL-WORD.json.gz').read_bytes()) == gzip.decompress(word.read_bytes()), + 'native complete word binding') + stages = read(entry / 'STEPS.json') + need([s['step'] for s in stages] == STEPS and all(s['exit_code'] == 0 for s in stages), 'native stage coverage') + + +def main(): + ap = argparse.ArgumentParser(description=__doc__) + ap.add_argument('--source', type=Path, help='Exact original PR2679 package directory; otherwise download pinned files.') + ap.add_argument('--work', type=Path, required=True) + ap.add_argument('--prepared-native-cache', type=Path, help='Explicit reuse of the complete published pinned cache.') + ap.add_argument('--jobs', type=int, default=4) + a = ap.parse_args() + need(not sys.flags.optimize and a.jobs > 0, 'enabled assertions and positive jobs required') + versions = {} + for name in ('numpy', 'sympy', 'scipy', 'mpmath'): + try: + versions[name] = str(importlib.import_module(name).__version__) + except ImportError as exc: + raise RuntimeError('install requirements.txt in this Python environment before full replay') from exc + need(versions['sympy'] == '1.14.0', 'pinned predecessor evidence requires sympy==1.14.0') + work = a.work.resolve() + need(not work.exists() and not work.is_relative_to(REPOSITORY), 'fresh external work required') + for path in (a.source, a.prepared_native_cache): + need(path is None or (path.is_dir() and not work.is_relative_to(path.resolve())), 'input/work separation') + pins, reuse, claim = read(HERE / 'SOURCE-FILES.json'), read(HERE / 'REUSE-PINS.json'), read(HERE / 'CLAIM.json') + work.mkdir(parents=True) + env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', PYTHONUTF8='1', PYTHONINTMAXSTRDIGITS='0', + OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') + for name in ('PYTHONOPTIMIZE', 'WITNESS_SPEC', 'WITNESS_DISCOVER', 'WITNESS_RECORD'): + env.pop(name, None) + stages, lock = [], threading.Lock() + started = time.monotonic() + + def run(name, script, *args): + begin = time.monotonic() + log = work / (name + '.log') + command = [sys.executable, '-B', str(script), *map(str, args)] + with log.open('w') as output: + result = subprocess.run(command, env=env, cwd=work, stdin=subprocess.DEVNULL, + stdout=output, stderr=subprocess.STDOUT) + with lock: + stages.append(dict(name=name, command=command, exit_code=result.returncode, + script_sha256=sha(script), seconds=time.monotonic()-begin, log_sha256=sha(log))) + write(work / 'STAGES.json', stages) + need(result.returncode == 0, 'failed ' + name + '; see ' + str(log)) + print('PASS', name, flush=True) + + run('literal-review', HERE / 'verify.py') + source = work / 'source' + source_copy(a.source.resolve() if a.source else None, source, pins, a.jobs) + overlay = read(HERE / 'OVERLAY-PINS.json') + need(sha(source/'MANIFEST.json') == overlay['original_manifest_sha256'], 'overlay base manifest') + need(sha(HERE/'DERIVATIVE-OVERLAY.tar.gz') == overlay['archive_sha256'], 'overlay archive') + with tarfile.open(HERE/'DERIVATIVE-OVERLAY.tar.gz') as archive: + members=archive.getmembers() + need(set(m.name for m in members)==set(overlay['files']) and len(members)==len(overlay['files']), 'exact overlay paths') + for member in members: + safe(member.name);need(member.isfile(), 'regular overlay file') + body=archive.extractfile(member).read() + need(hashlib.sha256(body).hexdigest()==overlay['files'][member.name], 'overlay member hash') + (source/member.name).write_bytes(body) + need(sha(source/'MANIFEST.json')==overlay['derived_manifest_sha256'] and + tree(source,('MANIFEST.json',))==read(source/'MANIFEST.json'), 'complete derived source tree') + pins=dict(pins,commit='local-joint12-pr2733',manifest_sha256=overlay['derived_manifest_sha256']) + cache = work / 'native-cache' + if a.prepared_native_cache: + need(tree(a.prepared_native_cache.resolve()) == reuse['cache_files'], 'published complete cache pins') + shutil.copytree(a.prepared_native_cache.resolve(), cache) + native_receipt = reuse + else: + cache.mkdir() + layout = work / 'retained-layout' + layout.mkdir() + old = source / 'vendor/pr1297' + with tarfile.open(old / 'upstream-layout.tar.gz') as archive: + need(all(m.isfile() and not Path(m.name).is_absolute() and '..' not in Path(m.name).parts + for m in archive.getmembers()), 'retained archive paths') + archive.extractall(layout, filter='data') + retained_driver = layout / 'joint1148-round45/source/research/k8-eight-ends/replay_native.py' + words = {'base': source / 'new/borrow/words/BORROW-WORD-43base.json.gz', + 'extra': source / 'new/borrow/words/BORROW-WORD-43extra.json.gz', + 'retained-base': old / 'gauge44-word.json.gz', 'retained-extra': old / 'extra-word.json.gz'} + + def fresh_native(tag): + word = words[tag] + entry = cache / sha(word) + script = retained_driver if tag.startswith('retained-') else source / 'new/run_native_borrow.py' + run('native-' + tag, script, word, entry) + bind_native(entry, word) + write(entry / 'CACHE.json', dict(word_sha256=sha(word), files=tree(entry))) + + with ThreadPoolExecutor(max_workers=min(a.jobs, 4)) as pool: + for _ in pool.map(fresh_native, words): + pass + run('retained-parent', old / 'verify.py', '--work', work / 'retained-parent', + '--base-native-from', cache / sha(words['retained-base']), + '--extra-native-from', cache / sha(words['retained-extra'])) + parent = read(work / 'retained-parent/RESULT.json') + need(parent['status'] == 'PASS_GLOBAL_MIXED_X54_FUSIONS_NATIVE_AND_STRICT_ADMISSION' + and parent['kappa'] == read(old / 'CLAIM.json')['kappa'], 'fresh retained parent admission') + pm = sha(old / 'MANIFEST.json') + receipts = cache / '_receipts' / pm + receipts.mkdir(parents=True) + for name in ('RESULT.json', 'STAGES.json'): + shutil.copy2(work / 'retained-parent' / name, receipts / name) + write(receipts / 'RECEIPT.json', dict(schema='parent-receipt/1', vendor_manifest_sha256=pm, + claim_sha256=sha(old / 'CLAIM.json'), words={tag:sha(words['retained-'+tag]) for tag in ('base','extra')}, + files={name:sha(receipts / name) for name in ('RESULT.json','STAGES.json')})) + providers = {tag:dict(word_sha256=sha(words[tag]), complete_native_files=tree(cache / sha(words[tag]), ('CACHE.json',))) + for tag in ('base','extra')} + native_receipt = dict(status='PASS_COMPOSED_FRESH_NATIVE_PROVIDERS_AND_AUTHENTICATED_CACHE', + source_commit=pins['commit'], manifest_sha256=pins['manifest_sha256'], providers=providers, + retained_parent_receipt_sha256=sha(receipts / 'RECEIPT.json'), cache_files=tree(cache)) + write(work / 'NATIVE-RECEIPT.json', native_receipt) + run('complete-admission', HERE / 'workflow/admit.py', '--source', source, + '--fill', HERE / 'inputs/FILL.json.gz', '--order', HERE / 'inputs/ORDER.json', + '--native-cache', cache, '--native-receipt', work / 'NATIVE-RECEIPT.json', + '--work', work / 'admission', '--jobs', a.jobs) + result = read(work / 'admission/RESULT.json') + need(result['status'] == 'PASS_COMPOSED_ORDER_FILL_DERIVATIVE_COMPLETE_RELEASE' + and Q(result['kappa']) == Q(claim['kappa']) and Q(result['complex_lower']) == Q(claim['complex_lower']), + 'published complete claim binding') + need(result['profile'] == {str(k):v for k,v in read(HERE / 'CLAIM.json')['profile'].items()}, 'published complete profile binding') + result.update(status='PASS_T74_JOINT_TWELVE_COLD_COMPLETE_RELEASE', explicit_native_cache_reuse=bool(a.prepared_native_cache), + source_files_sha256=sha(HERE / 'SOURCE-FILES.json'), native_receipt_sha256=sha(work / 'NATIVE-RECEIPT.json'), + cold_stages=stages, cold_seconds=time.monotonic()-started, + environment=dict(python=platform.python_version(), executable=sys.executable, versions=versions)) + write(work / 'RESULT.json', result) + print(result['status'], result['kappa_decimal'], flush=True) + + +if __name__ == '__main__': + main() diff --git a/research/t74-joint-twelve/generate.py b/research/t74-joint-twelve/generate.py new file mode 100644 index 0000000000..82ca3d20a5 --- /dev/null +++ b/research/t74-joint-twelve/generate.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +"""Rebuild the changed twelve-alias word and PR2679 pre-life/refit composition. +Pristine source is authenticated; only a fresh output directory is written. +""" +from pathlib import Path +import argparse,copy,gzip,hashlib,json,sys +sys.dont_write_bytecode=True +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +import joint_engine as J +ASSIGNMENTS=[(696,33,49),(697,55,101),(698,74,83),(700,85,98),(680,49,33),(681,83,74),(682,98,85),(684,101,55),(688,68,4),(689,80,88),(690,88,80),(692,31,12)] +def need(ok,msg): + if not ok:raise ValueError(msg) +def rd(p): + b=p.read_bytes();return json.loads(gzip.decompress(b) if p.suffix=='.gz' else b) +def wr(p,w):p.write_bytes(gzip.compress((json.dumps(w,sort_keys=True,separators=(',',':'))+'\n').encode(),mtime=0)) +def main(): + need(__debug__,'assertions must be enabled') + ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('--source',type=Path,required=True);ap.add_argument('--out',type=Path,required=True);a=ap.parse_args() + source=a.source.resolve();out=a.out.resolve();pins=rd(HERE/'GENERATOR-PINS.json') + sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest() + need(sha(source/'MANIFEST.json')==pins['pr2679_manifest'],'PR2679 source manifest') + need(all(sha(source/k)==v for k,v in rd(source/'MANIFEST.json').items()),'complete source files') + need(all(sha(HERE/k)==v for k,v in pins['vendor'].items()),'vendor sources') + need(not out.exists() and not out.is_relative_to(source),'fresh separate output required');out.mkdir(parents=True) + S=source/'new/borrow';sys.path[:0]=[str(S),str(S/'prelife/search')] + import build_word,word_patch as W,prelife2 as P,repair2,alias_build as AB,audit_local as AU + for canon,tag,h in [('gauge44','base','eeb6a236'),('extra','extra','cd417b90')]: + f=out/f'canonical-{tag}.json.gz';build_word.main(str(S/f'inputs/{canon}.canonical.json.gz'),str(S/'inputs/blocks.json'),str(S/f'inputs/witness_43_{tag}.json'),str(f),h);w=rd(f) + patch=rd(S/f'inputs/refit_43{tag}.json') + for sec,i,frame in patch['frames']:w[sec][i][-1]=frame + w['report']['local_profile']=patch['local_profile'];w['cleanup']=W.derive_cleanup(w,W.restored_of(w)) + w=W.apply_kernel(w,rd(S/f'inputs/kernel_43{tag}.json')) + for name in ['handoff','entrance']:w=W.apply_handoff(w,rd(S/f'inputs/{name}_43{tag}.json')) + need(W.apply_lowfour(w,rd(S/f'inputs/lowfour_43{tag}.json'))==rd(HERE/f'inputs/POSITIVE2462-{tag}.json.gz'),'complete PR2462 positive reconstruction') + w['prelude_events']=0;w=J.make(source,out/'joint',tag,seed=w,assignments=ASSIGNMENTS) + patch=rd(S/f'inputs/prelife_43{tag}.json') + for pair in patch['pairs']: + host,borrower=pair['h'],pair['L'];E=next(x[4] for x in patch['fields']['warps'][58:] if x[1]==host) + P.TRACE,_=repair2.run(copy.deepcopy(w),None);w=P.build(w,borrower,host,E) + indices=[i for i,g in enumerate(w['B']) if g[:5]==['add',515,563,1,1]];need(len(indices)==1,'unique refit gate') + w['B'][indices[0]][-1]=rd(S/f'inputs/refit563_43{tag}.json')['frames'][0][-1] + w,_=AB.alias(w,653,563);lp,wi=AB.profile(w);w['report'].update(local_profile=lp,width_inventory=wi) + f=out/f'WORD-{tag}.json.gz';wr(f,w);AU.run(f,out/f'audit-{tag}.json') + need(rd(f)==rd(HERE/f'inputs/WORD-{tag}.json.gz'),'complete regenerated word equality') + print('PASS_REGENERATED_JOINT_TWELVE_BOTH_WORDS') +if __name__=='__main__':main() diff --git a/research/t74-joint-twelve/independent_local.py b/research/t74-joint-twelve/independent_local.py new file mode 100644 index 0000000000..e0b556adc3 --- /dev/null +++ b/research/t74-joint-twelve/independent_local.py @@ -0,0 +1,161 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Mason Hale/Codex PR2696 literal replay, extended by Tekalign/Codex. +Adds anticipatory corrections, checks six pre-life hosts and checks all twelve +source-recovery assertions at operator IDs47 through58. +""" +import json,gzip,hashlib +from collections import Counter,defaultdict +from fractions import Fraction as F +from functools import lru_cache +from pathlib import Path +@lru_cache(None) +def span(vs): + s={0} + for v in vs:s|={x^v for x in tuple(s)} + return frozenset(s) +def S(vs):return span(tuple(vs)) +def rank(vs):return len(S(vs)).bit_length()-1 +def dm(s):return len(s).bit_length()-1 +FULL=S([1<>i&1:a^=c + return a +def regs(g):return g[1:3] if g[0]=='add' else g[1:2] +def nt(r):return not 112<=r<224 +def load(p):return json.loads(gzip.decompress(p.read_bytes())) +def chronological(w): + d=defaultdict(list) + for op,(p,r,*_) in enumerate(w['warps'],1):d[p].append(['warp',r,op]) + b=[] + for i in range(len(w['B'])+1): + b+=d[i] + if i0 else (new,old) + assert frozenset(im(cols,x) for x in S(a))==S(b) + cur[r]=S(new) + for g in w['A']: + if g[0]=='warp':warp(*g[1:]) + else: + for r in regs(g):climb(r,g[-1]) + bysection['A']=dict(counts);prev=counts.copy() + lev={int(k):S(v) for k,v in w['target_levels'].items()} + assert all(cur[112+t]==lev.get(t,S([])) for t in range(112)) + paths=[] + for r,vs in zip(w['centers'],w['center_frames']): + s=S(vs);assert cur[r]==s + targets=[g[1]-112 for g in w['cut'] if g[2]==r] + frames=sorted({lev.get(t,S([])) for t in targets},key=lambda s:-len(s)) + ds=[] + for f in frames: + assert f<=s + d=dm(s)-dm(f) + if d:counts[d]+=1;ds.append(d) + s=f + paths.append({'center':r,'start_rank':rank(vs),'target_offsets':targets,'reader_lines':[sorted(f-{0}) for f in frames],'paid_degrees':ds}) + bysection['cut']=dict(counts-prev);prev=counts.copy() + ops=defaultdict(list) + for op,rec in enumerate(w['warps'],1):ops[rec[0]].append((op,rec)) + for i in range(len(w['B'])+1): + for op,(_,r,cols,old,new) in ops[i]:warp(r,op,old,new) + if i=224) + assert counts==Counter({int(k):v for k,v in w['report']['local_profile'].items()}) + assert inventory==Counter({int(k):v for k,v in w['report']['width_inventory'].items()}) + return {'profile':dict(sorted(counts.items())),'section_profiles':bysection,'inventory':dict(sorted(inventory.items())),'center_paths':paths},start,ends + +def check_cleanup(w): + restored=set(map(int,w['helper_final'])) + cold=lambda r:r+704 if r in restored else r + forward=w['A'][w['prelude_events']:]+chronological(w)+w['restore'] + expected=[] + for g in reversed(forward): + if g[0]=='warp':expected.append(['warp',cold(g[1]),-g[2]]) + elif nt(g[1]): + if g[0]=='add':expected.append(['add',cold(g[1]),cold(g[2]),-g[3],g[4]]) + else:expected.append(['scale',cold(g[1]),g[3],g[2]]) + assert expected==[g[:-1] for g in w['cleanup']] + assert all(S(g[-1])==FULL for g in w['cleanup']) + return len(expected) + +def algebra(w): + # A monomial records its operations oldest-first; appending an inverse + # cancels the newest symbol. No native/generator/audit modules imported. + live=set(range(704))-set(w['removed']);cold=set(map(int,w['helper_final'])) + assert all(112<=x['target']<224 and x['source'] in {273,275,289,291,305,321} for x in w['initial_corrections']) + program=[['correction',x] for x in w['initial_corrections']]+w['precondition']+w['compensation']+w['A']+w['cut']+chronological(w)+w['restore'] + result={} + for dual in [False,True]: + rows={r:{(r,()):F(1)} for r in live} + rows.update({704+r:{} for r in cold}) + def apply(g): + op=g[0] + if op=='correction': + x=g[1];t,s=x['target'],x['source'];q=F(x['coefficient']) + ops=list(reversed(x['operator_word'])) + if dual: + t,s,q=s,t,-q + ops=[-(abs(v)+1000)*(1 if v>0 else -1) for v in x['operator_word']] + for (r,word),c in list(rows[s].items()): + for v in ops:word=word[:-1] if word and word[-1]==-v else word+(v,) + key=(r,word);value=rows[t].get(key,F(0))+q*c + if value:rows[t][key]=value + else:rows[t].pop(key,None) + elif op=='add': + t,s=g[1:3];q=F(g[3],g[4]);assert t!=s + if dual:t,s,q=s,t,-q + for term,c in list(rows[s].items()): + v=rows[t].get(term,F(0))+q*c + if v:rows[t][term]=v + else:rows[t].pop(term,None) + elif op=='scale': + q=F(g[2],g[3]);q=1/q if dual else q + rows[g[1]]={term:q*c for term,c in rows[g[1]].items()} + elif op=='warp': + d=g[2] + if not dual and 460 else -1) + rows[g[1]]={(r,word[:-1] if word and word[-1]==-d else word+(d,)):c for (r,word),c in rows[g[1]].items()} + else:raise AssertionError(op) + for g in program:apply(g) + if not dual: + assert all(rows[112+t]=={(112+t,()):F(1),(t,()):F(1)} for t in range(112)) + assert all(rows[r]=={(r,()):F(1)} for r in cold) + assert all(not any(var in cold-{r} for (var,word) in rows[r]) for r in live) + for g in w['cleanup']:apply(g) + for r in live: + exp={(r,()):F(1)} + if dual and r<112:exp[(112+r,())]=F(-1) + if not dual and 112<=r<224:exp[(r-112,())]=F(1) + assert rows[r]==exp,(dual,r,rows[r]) + assert all(not rows[704+r] for r in cold) + result['dual' if dual else 'forward']='PASS' + return result diff --git a/research/t74-joint-twelve/independent_owners.py b/research/t74-joint-twelve/independent_owners.py new file mode 100644 index 0000000000..93270b725a --- /dev/null +++ b/research/t74-joint-twelve/independent_owners.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +"""Independent integer-time chronology and bit-mask whole-fill verification. + +No retained window code, donor generator, solver or native checker is imported. +Credit PR2679's pre-life/refit words, PR2673/PR2621 priority scheduling, +PR2588's swapped words, PR2559's evacuation, PR2530's source-partner +fill and the PR2462/PR2322/PR2436 lineage; +Hao Yan and the retained controller authors supply the underlying schedule. +This checks a finite hosting witness, not native circuitry or an exponent. +""" +import argparse +import sys +sys.dont_write_bytecode=True +import gzip +import hashlib +import json +from collections import Counter +from pathlib import Path + + +def need(ok, why): + if not ok: + raise RuntimeError(why) + + +def windows(template, order): + ranks={c['child']:c['rank'] for c in template['idle_children']} + pairs={e['stage']:e['pair'] for e in template['recipe'] if e['kind']=='local'} + blocks={};stage=None + for event in template['execution_schedule']: + if event['kind'] in ('bank_padding_cover_sweep','translate_every_live_family'): + continue + if event['kind']=='local_cover_sweep': + stage=event['stage'];blocks[stage]=[] + need(stage is not None,'event before first call') + blocks[stage].append(event) + progression=[0]*74;last={};result={} + for t,(stage,replica) in enumerate(order): + need(0<=replica<74 and stage==progression[replica],'order chronology') + progression[replica]+=1 + for j,event in enumerate(blocks[stage]): + kind=event['kind'] + if kind=='local_cover_sweep': + need(j==0,'local call position') + last[replica,pairs[stage]]=t + elif kind=='bridge': + last[replica,event['src']]=last[replica,event['dst']]=t + elif kind=='idle_cover_sweep': + need(j>0,'idle position') + start=last.get((replica,event['pair']),-1) + for child in event['child_indices']: + if child in ranks: + result[replica,child]=(ranks[child],start,t) + need(progression==[9]*74,'complete replica progression') + return result + + +def check(plan, template, order, fill, providers, initial_dispatch, expected_profile): + need(len(order)==666 and len(set(map(tuple,order)))==666,'call coverage') + win=windows(template,order) + dispatch=dict(initial_dispatch) + for s,r,pid in fill['dispatch_overrides']: + need((s,r) in dispatch and pid in providers,'dispatch override') + dispatch[s,r]=pid + need(set(dispatch)==set(map(tuple,order)),'dispatch coverage') + need(fill['columns']==['time','helper','owner_replica','child','port','offset'],'role columns') + need(len(fill['rows'])==666*415,'role count') + need(all(len(p['widths'])==415 for p in providers.values()),'helper widths') + helper_bits=[0]*666;family_bits=[0]*666;occupied={} + for row in fill['rows']: + need(len(row)==6 and all(type(v) is int for v in row),'role shape') + t,h,o,c,port,offset=row + need(0<=t<666 and 0<=h<415 and 0<=port<112,'role bounds') + cap,start,stop=win[o,c] + need(startlen(a):a.append(x) + for x in F: + if len(b)len(b):b.append(x) + assert len(a)==len(b)==4 + cols=C.gf_change(a,b,9);E=[C.gf_linear(cols,x) for x in U] if hasattr(C,'gf_linear') else [G.mapped(cols,x) for x in U] + op=len(w['warps'])+len(newrecords)+1;newrecords.append([first,r,cols,list(U),E]);replace[h]=r + nw['removed'].append(h);del nw['start_extra'][str(h)];nw['helper_final'].pop(str(h),None) + # Keep preexisting operator IDs stable; extra warps are appended to the table. + newB=[];position={} + for i in range(len(w['B'])+1): + newB.extend(before[i]);position[i]=len(newB) + if ilen(w['warps']),(t,r,op,q) + groups[r,op[0]][t]=-q + prelude=[];targetlines={} + for (r,op),coeff in groups.items(): + for g in nw['precondition']+nw['compensation']:coeff=step(coeff,g,set(range(112,224))) + record=nw['warps'][op-1];line=[G.mapped(record[2],w['ports'][r])] + for t in coeff: + assert t not in targetlines or targetlines[t]==line,(t,r,op,line,targetlines.get(t),dict(groups)) + targetlines[t]=line + prelude.append(['warp',r,op,[w['ports'][r]],line]) + for t,q in sorted(coeff.items()):prelude.append(['add',t,r,q.numerator,q.denominator,line]) + prelude.append(['warp',r,-op,line,[w['ports'][r]]]) + lifts=[] + for t,line in sorted(targetlines.items()): + key=str(t-112);old=nw['target_levels'].get(key,[]);assert not old or G.basis(old)==G.basis(line) + if not old:lifts.append(['scale',t,1,1,line]);nw['target_levels'][key]=line + nw['A']=lifts+prelude+nw['A'];nw['prelude_events']+=len(lifts)+len(prelude) + tmp=copy.deepcopy(nw);tmp['A']=tmp['A'][nw['prelude_events']:];nw['cleanup']=WP.derive_cleanup(tmp,WP.restored_of(w)) + pp,iv=paid_lifted(nw);nw['report']['local_profile']=pp;nw['report']['width_inventory']=iv + out=BASE/f'eight-alias-{tag}.json.gz';out.write_bytes(gzip.compress(json.dumps(nw,separators=(',',':')).encode())) + print('BUILT',tag,'newops',len(newrecords),'targets',targetlines,'file',out,flush=True) + AU2.run(out,BASE/f'eight-alias-{tag}-audit.json') + return nw diff --git a/research/t74-joint-twelve/packing_cap.py b/research/t74-joint-twelve/packing_cap.py new file mode 100644 index 0000000000..dd97566afb --- /dev/null +++ b/research/t74-joint-twelve/packing_cap.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Uses Douglas Colkitt's exact ceiling engine (Claude-assisted), pinned unchanged. +# Adapter by Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +"""Fixed-word coverage-law ceiling; separate from physical and outer admission.""" +import argparse, hashlib, importlib.util, json, sys +from fractions import Fraction as Q +from decimal import Decimal, localcontext +from pathlib import Path +HERE = Path(__file__).resolve().parent +sys.dont_write_bytecode = True +ENGINE_SHA = "86a1432870b3b21d8454106ec9162fddc0471472d9214c590a1420f2426cedfc" +IDLE = {1:17316,3:6594,5:5216,32:1,48:26558} +CANDIDATE = {1:1593072,2:430236,3:204396,4:79920,5:22532,8:5328,32:1,48:26558} +ENDPOINT = Q('0.001717141586348426338109') + +def need(ok, message): + if not ok: + raise ValueError(message) + +def calculate(profile_path=None): + path = HERE / 'vendor/ceiling.py' + need(hashlib.sha256(path.read_bytes()).hexdigest() == ENGINE_SHA, 'ceiling source pin') + spec = importlib.util.spec_from_file_location('packing_ceiling', path) + engine = importlib.util.module_from_spec(spec); spec.loader.exec_module(engine) + h = {int(r): n for r,n in json.loads((profile_path or HERE/'PROFILE.json').read_text()).items()} + need(h == CANDIDATE and sum(r*n for r,n in h.items()) == 4816512, + 'complete candidate histogram and rank mass') + local = {r: Q(h[r]-IDLE.get(r,0),666) for r in h if h[r] != IDLE.get(r,0)} + need(local == {1:2366,2:646,3:297,4:120,5:26,8:8}, 'complete local profile') + model = engine.model(local,73,896,9,64) + need(model['total_mass']*666 == 4816512 and model['local_mass'] == 5223, 'coverage identity') + lo,hi = engine.ceiling(local,73,896,9,64) + need(engine.relax(local,73,896,9,64,hi)[0] > 1, 'upper cap rejection') + c = Q(json.loads((HERE/'CLAIM.json').read_text())['complex_lower']) + need(c == ENDPOINT, 'certified candidate endpoint') + with localcontext() as ctx: + ctx.prec = 50 + dec = lambda x: str(Decimal(x.numerator)/Decimal(x.denominator)) + return dict(status='PASS_FIXED_WORD_PACKING_CEILING',source_sha256=ENGINE_SHA, + local_per_call={str(r):str(n) for r,n in local.items()}, + dimension=73,families=896,stages=9,centre_rank_per_call=64,max_idle_rank=model['R'], + complex_cap_bracket=[str(lo),str(hi)],complex_cap_upper_decimal=dec(hi), + realized_fraction_lower=str(c/hi),realized_fraction_decimal=dec(c/hi), + scope='Fixed joint-twelve local word and hosted nine-stage coverage law; all remaining mass is relaxed to fractional rank51 children. This generic coverage-law ceiling is weaker than a window-aware packing or lattice bound. It does not certify or import the predecessor advertised lattice ceiling. It bounds this complex model, not different words or coverage laws. Modern outer admission is separate; no historical a/(1+a) conversion is used.') + +def main(): + ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('--output',type=Path) + ap.add_argument('--profile',type=Path,default=HERE/'PROFILE.json');a=ap.parse_args() + text=json.dumps(calculate(a.profile),indent=2)+'\n' + if a.output: + a.output.parent.mkdir(parents=True,exist_ok=True);a.output.write_text(text) + print(text,end='') +if __name__=='__main__': main() diff --git a/research/t74-joint-twelve/requirements.txt b/research/t74-joint-twelve/requirements.txt new file mode 100644 index 0000000000..816d0c8e91 --- /dev/null +++ b/research/t74-joint-twelve/requirements.txt @@ -0,0 +1,4 @@ +numpy==2.5.4 +sympy==1.14.0 +scipy==1.18.1 +mpmath==1.3.0 diff --git a/research/t74-joint-twelve/test_integrity.py b/research/t74-joint-twelve/test_integrity.py new file mode 100644 index 0000000000..73c4e96005 --- /dev/null +++ b/research/t74-joint-twelve/test_integrity.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +"""Git-free read-only replay and fail-closed input/claim/optimization controls.""" +import hashlib,json,os,shutil,subprocess,sys,tempfile +from pathlib import Path +HERE=Path(__file__).resolve().parent +def need(ok,msg): + if not ok:raise RuntimeError(msg) +def hashes(root):return {str(p.relative_to(root)):hashlib.sha256(p.read_bytes()).hexdigest() for p in root.rglob('*') if p.is_file()} +def main(): + with tempfile.TemporaryDirectory(prefix='joint-twelve-controls-') as t: + p=Path(t)/'package';shutil.copytree(HERE,p);before=hashes(p) + def run(script='verify.py',flags=()): + return subprocess.run([sys.executable,'-I','-B',*flags,str(p/script)],cwd=t,env=dict(os.environ,PYTHONDONTWRITEBYTECODE='1'),text=True,capture_output=True,timeout=300) + r=run();need(r.returncode==0 and 'PASS_JOINT_TWELVE_FINITE_REPLAY' in r.stdout,'relocated positive: '+r.stderr);need(hashes(p)==before,'read-only replay') + r=run(flags=('-O',));need(r.returncode!=0 and 'run without -O' in r.stderr,'optimized verification refusal') + r=run('generate.py',('-O',));need(r.returncode!=0 and 'assertions must be enabled' in r.stderr,'optimized generator refusal') + f=p/'CLAIM.json';b=f.read_bytes();c=json.loads(b);c['kappa']='1';f.write_text(json.dumps(c));r=run();need(r.returncode!=0 and 'claim outer endpoint' in r.stderr,'claim corruption rejection');f.write_bytes(b) + f=p/'inputs/WORD-base.json.gz';b=f.read_bytes();f.write_bytes(b+b'corruption');r=run();need(r.returncode!=0 and 'input digest' in r.stderr,'word authentication rejection');f.write_bytes(b) + need(hashes(p)==before,'controls restore exact files') + print('PASS_JOINT_TWELVE_RELOCATED_READ_ONLY_AND_INTEGRITY_CONTROLS') +if __name__=='__main__':main() diff --git a/research/t74-joint-twelve/vendor/GENERATOR-NOTICE.txt b/research/t74-joint-twelve/vendor/GENERATOR-NOTICE.txt new file mode 100644 index 0000000000..b075f7180e --- /dev/null +++ b/research/t74-joint-twelve/vendor/GENERATOR-NOTICE.txt @@ -0,0 +1,129 @@ +Generator for PR2312 width exchange plus coherent four-handoff transformation +========================================================================== + +generate_words.py is new portable code prepared with substantial AI +assistance, under the repository Apache-2.0 license. It directly transforms +the pinned PR2312 width-exchange BORROW-WORDs and regenerates cleanup. The existing source +builder is not copied or imported at runtime. The independent native chain, +rather than the generator or its hashes, proves all-column circuit correctness +and exact physical Clifford phases. + +PR2312 width exchange is credited to Jeremy Kothe (@jeremykothe2), with +AI assistance: alias 651 is re-lent from lender 530 and alias 653 is dropped, +freeing register 554 for cold restoration and changing two width-8 helpers +to width 7. The exact frame re-solve of both borrowed words and the owner +fill for that source width inventory retain the source's credit to Jeremy +Kothe, with AI assistance. This generator consumes the resulting complete +source words; it does not reapply their kernels or width exchange. + +Consumed PR2312 source head: + fb76f799ccf078f51780076ebed3fd26b1db11c0 +Package: + research/gmx-t74-borrow43-width-exchange +Manifest SHA-256: + c545968fb8cf6e550b82ba631e92fd756484db75e621aee211347749cff55313 + +The two helper-donor kernels at pivots 518 and 506 are retained from +PR2302. Their kernel shape is credited to mdumitrean (PR1625); their search, +exact pricing and frame re-solve are credited to Jeremy Kothe +(@jeremykothe2), with AI assistance, as stated by the source. The PR2302 +source and this necessary derivative generator were prepared with AI +assistance. This generator composes the four block-616 handoffs after those +kernels, preserving all kernel scalar gates and their re-solved frames. + +Predecessor PR2302 source head: + d520b92d7bf18efcb7d84f12757face6fe9541f1 +Package: + research/gmx-t74-borrow43-k518-506 +Manifest SHA-256: + 74634d13d27026e2867973b58dfef5e31958d92c54454b29e52292b7fc2e1f0d + +WildIdeas is credited for the exact frame refits retained from PR2288. +The source's additional frame-solver credit to Jeremy Kothe, with AI +assistance, is retained. The predecessor's full credit and licensing notice +is reproduced below. + +Anticipatory dirty borrowing is credited first to Cinna Davis +(@1337isnot1337), PR2226, with substantial OpenAI Codex assistance. The +retired-register K_G handoff and inverse-reverse FULL cleanup with proper-ended +private zero buffers derive from that construction and its PR2288 realization. +PR2288 source head: 614c74a63b0f6d4a24c7740d7ddb90d37861b3c7. + +This code is licensed under Apache-2.0, inherited from the repository. +The original repository LICENSE and NOTICE remain in the predecessor source; +the consumed package NOTICE is reproduced verbatim below, along with the +additional PR2226 notice. The PR2312 and PR2302 package NOTICE files are byte-identical to the +PR2288 package NOTICE reproduced here. + +--- PR2288 package NOTICE (verbatim) --- + +Anticipatory dirty borrowing: PR2226 (Cinna Davis / 1337isnot1337, with substantial OpenAI Codex assistance) is credited first. Its alias rule, changed-reference K_G handoffs, initial compensation and exact free-operator replay (vendored under new/code/borrow/vendor, see new/code/borrow/NOTICE-PR2226.md) are applied here to the T74 pivot-566+554 words; the native lowering, window-exact owner fill and independent audit of the borrow words are new in this package. Bootstrap carried-cutoff repair: PR1956 (Josie Elliston); Lemma G label/adapter checks and X/Y/Z mutants: PR1964 (thakrarsagar), extended here with borrow warp/zero-buffer controls. + +New research prepared by Rohan Arun with substantial OpenAI Codex assistance. Apache-2.0. Parent words and build recipe method derive from Jeremy Kothe PR1274 and Rohan Arun PR1218, with lineage credited in README.md. All inherited mathematical qualifications are retained. +Additional pivot555 and567 composition by Rohan Arun with substantial OpenAI Codex assistance. + +T74 exact-fill owner construction by Rohan Arun with substantial OpenAI Codex assistance. + +PR1377 grid refinement credited to Jeremy Kothe. Outer witness refinement by Rohan Arun with OpenAI Codex assistance; construction unchanged. + +Pivot-566 kernel, words, edits, rebuild.py and rebind.py: PR1625 (mdumitrean). Endpoint/outer-witness stacking, fine_cache.py and oracle stage by jeremykothe2 with oh-my-pi assistance. + + +--- PR2226 native-chain notice (verbatim) --- + +# Credit: anticipatory dirty borrowing (PR2226) + +The construction realised by this native chain is **PR2226, "anticipatory dirty borrowing"**, by Cinna Davis +(@1337isnot1337), prepared with substantial OpenAI Codex assistance (Apache-2.0): the logical reference change +K_G of a lender register (a monomial Clifford: a permutation of the 512 columns with phase mod 4), the initial +compensation terms c K_G z, the early cold tail, the exact cold restoration and the private zero buffers of the +FULL-frame cleanup. `vendor/pr2226_operators.py`, `vendor/pr2226_replay.py` and `vendor/PR2226-NOTICE.md` are byte copies +of PR2226's `operators.py`, `replay.py` and `NOTICE.md`. `bw_gauss.py` is a port of `operators.py` (change, monomial, +apply_mono, coord, frame, check) and adds a decoder from a serialized `clifford_exact` monomial to its exact 512 x 512 +Gaussian matrix. + +What this chain adds (the P3 native realisation, with the Borrow campaign's explicit chronological BORROW-WORD as input): +warp events and zero buffers in `LOCAL-PROGRAMS`, warp recipes in `CLIFFORD-RECIPES.json` (lowered with the unchanged +`lower_child`, rank zero, then compared with the exact numpy column product), logical K_G recipes in +`RESIDUAL-ADAPTERS.json`, an independent local replay in both orientations that checks every warp product on all 512 +columns, and the negative controls listed in `INDEPENDENT-LOCAL-REPLAY.json`, `WRAPPER-CHECKS.json`, `WARP-RECIPE-CHECKS.json` +and `bw_tamper.py`. + +Lineage retained: icekylinx (PR425/433/514, scalar and wrapper machinery), DreamingOfClouds (PR458/484/593 hyperplane/cold-HPE +extensions), the clifford_exact compiler (vendor531), and the owners named in the package README. `vendor/clifford/clifford_exact.py` +is a byte copy. + + +Reproduction and equality +======================== + +Run: + python3 generate_words.py --source-root FETCHED_REPOSITORY --out NEW_DIRECTORY + +The generator checks the pinned source manifest and both consumed compressed +source-word hashes. It writes base.json.gz, extra.json.gz and GENERATION.json. +Canonical JSON hashes cover every output field, including frames, scalar +gates, operators, endpoints, cleanup and invoices. These hashes determine +regenerated circuit equality. The compressed container hashes are recorded +for provenance; Python/zlib changes can produce different gzip streams for +the same circuit. The OS header byte is normalized to 255. In the recorded generation +environment both output containers also exactly match the composed +word hashes. Recompression alone does not require repeating native phases. + +The four binary G maps are explicit construction constants, checked for +invertibility and the measured source-to-handoff chart identity on each run. +The native replay independently lowers their exact physical representatives. +Two old warp-basis representatives are rewritten only after verifying equal +GF(2) spans, preserving the frozen input serialization. No JSON patch file or +unrecorded local dependency is needed. + +Composition binding +=================== + +The source-manifest and source-word constants bind the consumed PR2312 +inputs. The canonical JSON target hashes cover every composed output field. +The literal base tag names PR2312 width exchange plus coherent joint616; +SOURCE_COMMIT and SOURCE_MANIFEST identify the consumed source. +This generation receipt does not establish native phases, owner admission, +or a new exponent; those require their separate independently replayed +native and global receipts. diff --git a/research/t74-joint-twelve/vendor/LICENSE b/research/t74-joint-twelve/vendor/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/t74-joint-twelve/vendor/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/t74-joint-twelve/vendor/UPSTREAM-NOTICE b/research/t74-joint-twelve/vendor/UPSTREAM-NOTICE new file mode 100644 index 0000000000..46411b80b2 --- /dev/null +++ b/research/t74-joint-twelve/vendor/UPSTREAM-NOTICE @@ -0,0 +1,10 @@ +Anticipatory dirty borrowing: PR2226 (Cinna Davis / 1337isnot1337, with substantial OpenAI Codex assistance) is credited first. Its alias rule, changed-reference K_G handoffs, initial compensation and exact free-operator replay (vendored under new/code/borrow/vendor, see new/code/borrow/NOTICE-PR2226.md) are applied here to the T74 pivot-566+554 words; the native lowering, window-exact owner fill and independent audit of the borrow words are new in this package. Bootstrap carried-cutoff repair: PR1956 (Josie Elliston); Lemma G label/adapter checks and X/Y/Z mutants: PR1964 (thakrarsagar), extended here with borrow warp/zero-buffer controls. + +New research prepared by Rohan Arun with substantial OpenAI Codex assistance. Apache-2.0. Parent words and build recipe method derive from Jeremy Kothe PR1274 and Rohan Arun PR1218, with lineage credited in README.md. All inherited mathematical qualifications are retained. +Additional pivot555 and567 composition by Rohan Arun with substantial OpenAI Codex assistance. + +T74 exact-fill owner construction by Rohan Arun with substantial OpenAI Codex assistance. + +PR1377 grid refinement credited to Jeremy Kothe. Outer witness refinement by Rohan Arun with OpenAI Codex assistance; construction unchanged. + +Pivot-566 kernel, words, edits, rebuild.py and rebind.py: PR1625 (mdumitrean). Endpoint/outer-witness stacking, fine_cache.py and oracle stage by jeremykothe2 with oh-my-pi assistance. diff --git a/research/t74-joint-twelve/vendor/UPSTREAM-VENDOR-SOURCES.json b/research/t74-joint-twelve/vendor/UPSTREAM-VENDOR-SOURCES.json new file mode 100644 index 0000000000..cd19eda259 --- /dev/null +++ b/research/t74-joint-twelve/vendor/UPSTREAM-VENDOR-SOURCES.json @@ -0,0 +1,26 @@ +{ + "vendor/gf_chart.py": { + "sha256": "871936fa81af695d5bdc029803af81228300c405f5ff8d153e130530dddca4f6", + "source_commit": "19d9366de79dc3125429c3912e4040331d125a27", + "source_path": "research/complex-structure-seed39/nonzero-lender-evidence/census.py", + "mode": "four unchanged gf_* functions" + }, + "vendor/target_transport.py": { + "sha256": "9f92e1699167f46d0f0e59b540a9940ee1addcb5357ca65cf1dbf7acdbe7ad86", + "source_commit": "19d9366de79dc3125429c3912e4040331d125a27", + "source_path": "research/complex-structure-seed39/nonzero-lender-evidence/target_transport.py", + "mode": "unchanged full file" + }, + "vendor/generate_words.py": { + "sha256": "340532e035fa3c4d7d2f92aeb80f0efbb44a53c4e3deeb0c6bf7d6ae2fccd0c7", + "source_commit": "002304ef01c4416a127916169ae6d94c1bee052b", + "source_path": "research/t74-joint-owner-hillclimb/generate_words.py", + "mode": "unchanged full file" + }, + "vendor/GENERATOR-NOTICE.txt": { + "sha256": "d4cbc432b79ee2d54a83bcadf260bb89e910262b8c19e763e08b7eb3a5e8215c", + "source_commit": "002304ef01c4416a127916169ae6d94c1bee052b", + "source_path": "research/t74-joint-owner-hillclimb/GENERATOR-NOTICE.txt", + "mode": "unchanged full file" + } +} diff --git a/research/t74-joint-twelve/vendor/ceiling.py b/research/t74-joint-twelve/vendor/ceiling.py new file mode 100644 index 0000000000..6c0f54527d --- /dev/null +++ b/research/t74-joint-twelve/vendor/ceiling.py @@ -0,0 +1,152 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Packing-independent ceiling for a complex local word under the hosted nine-stage coverage law. + +Model (all inputs explicit): + * per replica the template has `families` live data families and `stages` invocations, so + w = families / stages live families per call; on the selected T37/T16 line all helpers are + hosted on data families, so w = 2 * pairs * V / stages is fixed by the port count V; + * coverage identity (PR1012, re-checked here on the selected profile): paid rank mass equals + (m - 1) * W + centre * N, i.e. every live family keeps exactly one unpaid coordinate and every + call pays its centre path (`unpaid` > 1 is a what-if for a changed coverage law only); + * the local word fixes its own paid child profile `local` (per call); + * every remaining unit of mass is an idle/remainder child of rank at most R, where the outer + recipe's halving guard m^2 > 2 R^2 bounds R (R = 51 for m = 73). + +Lemma. For a >= 0, a child of rank r costs (r/m)^(1-a) = r * c(r), with c(r) = r^(-a) m^(a-1) +non-increasing in r. Hence, with idle mass M fixed and idle ranks <= R, every idle histogram has +moment >= the relaxation that puts all of M into (possibly fractional) rank-R children: + + relax(a) = [ sum_local n_r (r/m)^(1-a) + (M/R) (R/m)^(1-a) ] / w (per call). + +The moment is increasing in a. So relax(a*) > 1 certifies that no hosting, owner packing or +idle-remainder change of the given local word, template and outer recipe certifies a saving +>= a*. Under the retained reduction kappa < a/(1+a) when the complex side binds, so +a*/(1+a*) also bounds kappa. This is a bound for the stated model, not for other local words, +templates, coverage laws or outer recipes. + +Exact rational intervals: ln k from atanh chains, exp by Taylor with Lagrange remainder, +outward rounding to 2^-PREC. Standard library only. Douglas Colkitt, with Claude (Anthropic) +assistance. +""" +from fractions import Fraction as Q +from functools import lru_cache +from math import isqrt + +PREC = 256 + + +def require(ok, why): + if not ok: + raise ValueError(why) + + +def down(x): + return Q((x.numerator << PREC) // x.denominator, 1 << PREC) + + +def up(x): + return -down(-x) + + +@lru_cache(None) +def atanh(t): + """Enclosure of atanh(t) for rational 0 < t <= 1/3.""" + require(0 < t <= Q(1, 3), 'atanh range') + s, p, k = Q(0), t, 0 + while True: + term = p / (2 * k + 1) + s += term + p *= t * t + k += 1 + tail = p / ((2 * k + 1) * (1 - t * t)) + if tail < Q(1, 1 << (PREC + 8)): + return down(s), up(s + tail) + + +@lru_cache(None) +def ln(k): + """Enclosure of ln k for an integer k >= 1: ln k = ln(k-1) + 2 atanh(1/(2k-1)).""" + require(isinstance(k, int) and k >= 1, 'ln domain') + if k == 1: + return Q(0), Q(0) + lo, hi = ln(k - 1) + a, b = atanh(Q(1, 2 * k - 1)) + return down(lo + 2 * a), up(hi + 2 * b) + + +def exp(lo, hi): + """Enclosure of exp([lo, hi]) for 0 <= lo <= hi <= 1/2.""" + require(0 <= lo <= hi <= Q(1, 2), 'exp range') + def series(y, upper): + s, t, k = Q(1), Q(1), 0 + while True: + k += 1 + t = t * y / k + s += t + if t * y < Q(1, 1 << (PREC + 8)): + return up(s + 2 * t * y / (k + 1)) if upper else down(s) + return series(lo, False), series(hi, True) + + +def child_cost(r, m, a): + """Enclosure of (r/m)^(1-a) = (r/m) exp(a ln(m/r)).""" + lm, um = ln(m) + lr, ur = ln(r) + e = exp(max(Q(0), a * (lm - ur)), a * (um - lr)) + return down(Q(r, m) * e[0]), up(Q(r, m) * e[1]) + + +def max_idle_rank(m): + """Largest R with m^2 > 2 R^2 (outer halving guard).""" + R = isqrt((m * m - 1) // 2) + while 2 * (R + 1) ** 2 < m * m: + R += 1 + while 2 * R * R >= m * m: + R -= 1 + return R + + +def model(local, m, families, stages, centre, R=None, unpaid=1): + """Per-call quantities. local: {rank: count per call (Fraction ok)}.""" + R = max_idle_rank(m) if R is None else R + require(2 * R * R < m * m, 'idle rank cap violates the halving guard') + require(all(0 < r < m for r in local) and all(n >= 0 for n in local.values()), 'local profile') + w = Q(families, stages) + require(1 <= unpaid < m, 'unpaid coordinates per family') + total = (m - unpaid) * w + centre + local_mass = sum(r * Q(n) for r, n in local.items()) + idle = total - local_mass + require(idle >= 0, 'local word pays more mass than the coverage law allows') + return dict(R=R, w=w, total_mass=total, local_mass=local_mass, idle_mass=idle, deficit=unpaid * w - centre) + + +def relax(local, m, families, stages, centre, a, R=None, unpaid=1): + """Enclosure of the per-call relaxation moment at saving a.""" + q = model(local, m, families, stages, centre, R, unpaid) + lo = hi = Q(0) + for r, n in local.items(): + c = child_cost(r, m, a) + lo, hi = lo + Q(n) * c[0], hi + Q(n) * c[1] + c = child_cost(q['R'], m, a) + k = q['idle_mass'] / q['R'] + lo, hi = lo + k * c[0], hi + k * c[1] + return down(lo / q['w']), up(hi / q['w']) + + +def ceiling(local, m, families, stages, centre, grid=Q(1, 10 ** 15), R=None, unpaid=1): + """Grid bracket [a_lo, a_hi]: relax(a_lo) < 1 < relax(a_hi), certified. a_hi is the ceiling.""" + lo, hi = Q(0), Q(1, 20) + require(relax(local, m, families, stages, centre, hi, R, unpaid)[0] > 1, 'search window too small') + require(relax(local, m, families, stages, centre, lo, R, unpaid)[1] < 1, 'relaxation has no positive saving') + while hi - lo > grid: + mid = Q(int((lo + hi) / 2 / grid)) * grid + if mid <= lo: + mid = lo + grid + v = relax(local, m, families, stages, centre, mid, R, unpaid) + if v[1] < 1: + lo = mid + elif v[0] > 1: + hi = mid + else: + raise ValueError('enclosure too wide to separate the grid point') + return lo, hi diff --git a/research/t74-joint-twelve/vendor/generate_words.py b/research/t74-joint-twelve/vendor/generate_words.py new file mode 100644 index 0000000000..94bf0d8f29 --- /dev/null +++ b/research/t74-joint-twelve/vendor/generate_words.py @@ -0,0 +1,335 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Construct four coherent handoffs on the pinned PR2312 width-exchange words. + +This is a direct circuit transformation, using Python's standard library only. +It moves the twelve block-616 correction gates, replaces four retired helper +roles by the source lenders (1,4,6,12), installs their explicit invertible chart +maps, and derives inverse-reverse cleanup from the changed non-target word. +The source and resulting word content are hash-bound. Hash equality is a +reproduction check; the independent all-column native chain proves correctness. +The input retains PR2312's width exchange (alias 651 re-lent from 530 and +alias 653 dropped), exact frame re-solve and the pivot-518/506 kernels. +Width exchange and its source frame/owner work are credited to Jeremy Kothe +(jeremykothe2), with AI assistance. The helper-donor kernels retain credit: +PR1625 shape by mdumitrean; PR2302 search, exact pricing and frame re-solve +by Jeremy Kothe (jeremykothe2), with AI assistance. This derivative was also +prepared with substantial AI assistance. See GENERATOR-NOTICE.txt for +inherited attribution and licensing. +""" +import argparse +import copy +import gzip +import hashlib +import json +import platform +import zlib +from collections import Counter, defaultdict +from pathlib import Path + +HERE = Path(__file__).resolve().parent +PACKAGE = Path('research/gmx-t74-borrow43-width-exchange') +SOURCE_COMMIT = 'fb76f799ccf078f51780076ebed3fd26b1db11c0' +SOURCE_MANIFEST = 'c545968fb8cf6e550b82ba631e92fd756484db75e621aee211347749cff55313' +SOURCE_WORDS = { + 'base': '4244149b59b287344b0e91aa50c6fa2a2491ee6c7a76d61cd352684a8182d005', + 'extra': '01d510cc4ba912567f6b02ea50b6b0e741ed231a3608de9c36e7eeccbdaf6cda', +} +TARGET_WORDS = { + 'base': '93c32c9dc8ca18394b7f3afac2cb4fa8582a6cb77399441b5107b396e63ca0f9', + 'extra': 'aae6592eaa4cf8638f21d50c44d09d4f8a6bb079ddcf5e377711a10ee2ddb526', +} +TARGET_SEMANTICS = { + 'base': '3659c066d5cc2413a6f59bae8d5886e05feb8148333516f65365ad5235e14f2a', + 'extra': '9369702d158c34d594481a1789a2bddc029d03007253620cf3834ec60a88b1a5', +} +HIGH = (619, 621, 622, 623) +LOW = (616, 617, 618, 620) +LENDERS = (1, 4, 6, 12) +COMMON5 = (260, 132, 75, 42, 25) +COMMON4 = (260, 132, 75, 51) +# Literal G(e_i) columns of the four new rank-zero K_G handoffs. Each map is +# independently checked below, then physically lowered by the native auditor. +G_COLUMNS = ( + (1, 2, 4, 54, 72, 8, 130, 16, 284), + (1, 2, 4, 8, 16, 32, 64, 135, 263), + (1, 2, 4, 54, 72, 8, 130, 16, 284), + (1, 2, 4, 8, 57, 66, 143, 16, 272), +) +PROFILE = {1: 2335, 2: 512, 3: 426, 4: 120, 5: 38, 8: 8} +WIDTHS = {4: 33, 5: 9, 7: 38, 8: 114, 9: 240} + + +def require(ok, message): + if not ok: + raise RuntimeError(message) + + +def sha(data): + return hashlib.sha256(data).hexdigest() + + +def semantic_sha(value): + # JSON object keys are strings; normalize integer invoice keys before sorting. + value = json.loads(json.dumps(value)) + return sha(json.dumps(value, sort_keys=True, separators=(',', ':')).encode()) + + +def basis(vectors): + """Canonical reduced GF(2) row basis, independent of set iteration order.""" + piv = {} + for value in vectors: + while value: + bit = value.bit_length() - 1 + if bit in piv: + value ^= piv[bit] + else: + piv[bit] = value + break + for bit in sorted(piv): + for higher in piv: + if higher > bit and (piv[higher] >> bit) & 1: + piv[higher] ^= piv[bit] + return tuple(piv[bit] for bit in sorted(piv, reverse=True)) + + +def incident(gate): + return gate[1:3] if gate[0] == 'add' else gate[1:2] + + +def mapped(columns, vector): + result = 0 + for bit, column in enumerate(columns): + if (vector >> bit) & 1: + result ^= column + return result + + +def derive_cleanup(word): + """PR2226/PR2288 inverse-reverse cleanup, retaining proper-end buffers.""" + v = word['report']['v'] + n = 2 * v + word['report']['R'] + restored = set(map(int, word['helper_final'])) + full = list(basis(1 << bit for bit in range(word['report']['h']))) + buffer = lambda role: role + n if role in restored else role + by_position = defaultdict(list) + for operator, record in enumerate(word['warps'], 1): + by_position[record[0]].append((record[1], operator)) + forward = list(word['A']) + for position in range(len(word['B']) + 1): + forward.extend(['warp', role, operator] + for role, operator in by_position[position]) + if position < len(word['B']): + forward.append(word['B'][position]) + forward += word['restore'] + cleanup = [] + for gate in reversed(forward): + if gate[0] == 'warp': + cleanup.append(['warp', buffer(gate[1]), -gate[2], full]) + elif not v <= gate[1] < 2 * v: + if gate[0] == 'add': + cleanup.append(['add', buffer(gate[1]), buffer(gate[2]), + -gate[3], gate[4], full]) + else: + cleanup.append(['scale', buffer(gate[1]), gate[3], gate[2], full]) + return cleanup + + +def paid_profile(word): + """Recount literal native climbs, cut copies and retained helper widths.""" + v, h, helpers = (word['report'][key] for key in ('v', 'h', 'R')) + n = 2 * v + helpers + cur = [(port,) for port in word['ports']] + [()] * (v + helpers) + for role, frame in word['start_extra'].items(): + cur[int(role)] = basis(frame) + full = basis(1 << bit for bit in range(h)) + ends = [full] * v + [basis(x for x in range(1, 1 << h) + if (x & port).bit_count() % 2 == 0) + for port in word['ports']] + [full] * helpers + for role, frame in word['helper_final'].items(): + ends[int(role)] = basis(frame) + paid = Counter() + + def climb(role, frame): + frame = basis(frame) + require(basis(cur[role] + frame) == frame, 'Nonmonotone frame chain') + degree = len(frame) - len(cur[role]) + if degree: + paid[degree] += 1 + cur[role] = frame + + def gate(event): + for role in incident(event): + climb(role, event[-1]) + + for event in word['A']: + gate(event) + levels = {int(t): basis(frame) for t, frame in word['target_levels'].items()} + require(all(cur[v+t] == levels.get(t, ()) for t in range(v)), 'Cut target frame') + for role, frame in zip(word['centers'], word['center_frames']): + frame = basis(frame) + require(cur[role] == frame, 'Cut producer frame') + readers = {levels.get(event[1]-v, ()) for event in word['cut'] + if event[2] == role} + for reader in sorted(readers, key=lambda x: -len(x)): + require(basis(reader + frame) == frame, 'Unnested private copy') + if reader != frame: + paid[len(frame)-len(reader)] += 1 + frame = reader + by_position = defaultdict(list) + for record in word['warps']: + by_position[record[0]].append(record) + for position in range(len(word['B']) + 1): + for _, role, columns, old, new in by_position[position]: + require(cur[role] == basis(old), 'Handoff source frame') + require(len(basis(columns)) == h, 'Singular chart map') + require(basis(mapped(columns, x) for x in old) == basis(new), + 'Chart map does not carry the measured source frame') + cur[role] = basis(new) + if position < len(word['B']): + gate(word['B'][position]) + for event in word['restore']: + gate(event) + live = set(range(n)) - set(word['removed']) + for role in live: + climb(role, ends[role]) + widths = Counter(len(ends[role]) - len(basis(word['start_extra'].get(str(role), []))) + for role in live if role >= 2 * v) + return dict(sorted(paid.items())), dict(sorted(widths.items())) + + +def build(source): + word = copy.deepcopy(source) + require(word['report']['v'] == 112 and word['report']['h'] == 9 + and word['report']['R'] == 480, 'Unexpected source geometry') + roles = set(LOW + HIGH) + prep = [i for i, event in enumerate(word['B']) + if set(incident(event)) <= roles] + # The only internal gates before source acquisition are the twelve M gates. + first = next(i for i, event in enumerate(word['B']) + if event[0] == 'add' and event[1] in roles + and event[2] not in roles and len(event[-1]) >= 6) + prep = [i for i in prep if i < first] + require(len(prep) == 12 and prep == list(range(prep[0], prep[0]+12)), + 'Expected twelve consecutive block-616 correction gates') + lo, hi = prep[0], prep[-1] + 1 + require(all(not roles.intersection(incident(event)) + for event in word['B'][hi:first]), 'Block is not idle before relocation') + require(all(basis(word['B'][i][-1]) == basis(COMMON5) for i in prep), + 'Unexpected correction chart') + require(all(event[0] == 'add' and event[1] in LOW and event[2] in HIGH + for event in (word['B'][i] for i in prep)), 'Unexpected correction payload') + require(all(basis(word['start_extra'][str(role)]) == basis(COMMON5) + for role in HIGH), 'Unexpected removed helper entrance') + require(not any(record[0] in range(lo, hi+1) or record[0] == first + for record in word['warps']), 'Warp inside relocation boundary') + replace = dict(zip(HIGH, LENDERS)) + moved = [event[:-1] + [list(COMMON4)] for event in word['B'][lo:hi]] + word['B'] = word['B'][:lo] + word['B'][hi:first] + moved + word['B'][first:] + handoff = first - len(moved) + for event in word['B']: + for index in range(1, 3 if event[0] == 'add' else 2): + event[index] = replace.get(event[index], event[index]) + for record in word['warps']: + if hi <= record[0] < first: + record[0] -= len(moved) + # Preserve the already-audited literal basis representatives emitted by + # the original builder. These replacements span precisely the same U. + rewrite = {(384, 134, 120, 30): (384, 134, 102, 30), + (448, 56, 21, 11): (448, 38, 21, 11)} + old = tuple(record[3]) + if old in rewrite: + require(basis(old) == basis(rewrite[old]), 'Basis serialization changed U') + record[3] = list(rewrite[old]) + # Measure each retired source at the chronological handoff, without trusting + # a lender chart copied from a generated target artifact. + cur = [(port,) for port in word['ports']] + [()] * (112 + 480) + for role, frame in word['start_extra'].items(): + cur[int(role)] = basis(frame) + for event in source['A']: + for role in incident(event): + cur[role] = basis(event[-1]) + old_warps = defaultdict(list) + for record in source['warps']: + old_warps[record[0]].append(record) + for position in range(first): + for record in old_warps[position]: + cur[record[1]] = basis(record[4]) + for role in incident(source['B'][position]): + cur[role] = basis(source['B'][position][-1]) + for role, columns in zip(LENDERS, G_COLUMNS): + require(len(cur[role]) == 4, 'Retired lender must be rank 4') + require(max(i for i, event in enumerate(source['B']) + if role in incident(event)) < first, 'Source lender still live') + old_literal = (384, 131, 75, 51) if role == 4 else cur[role] + new_literal = (384, 132, 75, 51) + require(basis(old_literal) == cur[role] + and basis(new_literal) == basis(COMMON4), + 'Literal handoff representative changed its subspace') + word['warps'].append([handoff, role, list(columns), + list(old_literal), list(new_literal)]) + for role in HIGH: + del word['start_extra'][str(role)] + word['removed'] = sorted(set(word['removed']).union(HIGH)) + word['base'] = 'PR2312-width-exchange-plus-coherent-joint616' + profile, widths = paid_profile(word) + require(profile == PROFILE and widths == WIDTHS, 'Unexpected generated invoice') + word['report']['local_profile'] = profile + word['report']['width_inventory'] = widths + word['cleanup'] = derive_cleanup(word) + return word, dict(old_correction_interval=[lo, hi], old_first_input=first, + relocated_correction_interval=[handoff, handoff+12], + removed_roles=list(HIGH), lenders=list(LENDERS)) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--source-root', type=Path, required=True, + help='Repository root containing the pinned PR2312 package') + parser.add_argument('--out', '--output', type=Path, required=True, + help='Destination for base.json.gz, extra.json.gz and GENERATION.json') + args = parser.parse_args() + package = args.source_root.resolve() / PACKAGE + manifest_bytes = (package / 'MANIFEST.json').read_bytes() + require(sha(manifest_bytes) == SOURCE_MANIFEST, 'Unpinned upstream manifest') + manifest = json.loads(manifest_bytes) + args.out.mkdir(parents=True, exist_ok=True) + reports = {} + for kind in ('base', 'extra'): + relative = f'new/borrow/words/BORROW-WORD-43{kind}.json.gz' + raw = (package / relative).read_bytes() + require(sha(raw) == SOURCE_WORDS[kind] == manifest[relative], + 'Unpinned '+kind+' source word') + word, changes = build(json.loads(gzip.decompress(raw))) + content = json.dumps(word, separators=(',', ':')).encode() + canonical_hash = semantic_sha(word) + require(canonical_hash == TARGET_SEMANTICS[kind], + 'Generated '+kind+' circuit differs from the frozen audited input') + compressed = bytearray(gzip.compress(content, compresslevel=9, mtime=0)) + compressed[9] = 255 # Normalize the Python 3.11/3.12 gzip OS header byte. + compressed = bytes(compressed) + destination = args.out / (kind+'.json.gz') + destination.write_bytes(compressed) + reports[kind] = dict(source_word_sha256=sha(raw), output=destination.name, + output_sha256=sha(compressed), content_sha256=sha(content), + canonical_json_sha256=canonical_hash, + frozen_container_sha256=TARGET_WORDS[kind], + container_matches_frozen=sha(compressed) == TARGET_WORDS[kind], + local_profile=word['report']['local_profile'], + width_inventory=word['report']['width_inventory'], + changes=changes) + print('PASS_GENERATED_AUDITED_WORD_SEMANTICS', kind, canonical_hash, flush=True) + receipt = dict(status='PASS_SOURCE_BOUND_EXACT_WORD_GENERATION', + source_commit=SOURCE_COMMIT, source_manifest_sha256=SOURCE_MANIFEST, + generator_sha256=sha(Path(__file__).read_bytes()), words=reports, + compression_environment=dict(python=platform.python_version(), + zlib=zlib.ZLIB_RUNTIME_VERSION), + equality='Canonical JSON of every field; gzip container hashes are metadata', + scope='Exact source-bound reproduction of the independently audited words. ' + 'Circuit correctness, physical phases and the global owner invoice ' + 'are established by their separate native and global receipts.') + (args.out / 'GENERATION.json').write_text(json.dumps(receipt, indent=2)+'\n') + + +if __name__ == '__main__': + main() diff --git a/research/t74-joint-twelve/vendor/gf_chart.py b/research/t74-joint-twelve/vendor/gf_chart.py new file mode 100644 index 0000000000..11f5bfd882 --- /dev/null +++ b/research/t74-joint-twelve/vendor/gf_chart.py @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: Apache-2.0 +# Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +# Exact GF(2) chart utilities extracted from PR2436 census.py; unchanged functions. + +def gf_rank(xs): + b = {} + for x in xs: + while x: + j = x.bit_length() + if j not in b: + b[j] = x + break + x ^= b[j] + return len(b) + +def gf_extend(xs, h): + out = list(xs) + for j in range(h): + if gf_rank(out + [1 << j]) > len(out): + out.append(1 << j) + assert len(out) == h + return out + +def gf_linear(cols, x): + out = 0 + for j, c in enumerate(cols): + if x >> j & 1: + out ^= c + return out + +def gf_change(source, target, h): + a, b = gf_extend(source, h), gf_extend(target, h) + back = {gf_linear(a, x): x for x in range(1 << h)} + assert len(back) == 1 << h + return [gf_linear(b, back[1 << j]) for j in range(h)] diff --git a/research/t74-joint-twelve/vendor/target_transport.py b/research/t74-joint-twelve/vendor/target_transport.py new file mode 100644 index 0000000000..89ee0168c6 --- /dev/null +++ b/research/t74-joint-twelve/vendor/target_transport.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +"""Exact target-vector transport; no physical/native admission is implied. + +For a final correction c, compute the unique simultaneous correction at every +boundary of a target-affine gate word. Non-target source terms cancel from the +difference. Transport through target mixing, not only target scales. +""" +from fractions import Fraction as Q + + +def need(ok, msg): + if not ok: + raise RuntimeError(msg) + + +def step(c, gate, targets, inverse=False): + out=dict(c) + kind=gate[0] + if kind not in ('add','scale'): + return out + t=gate[1] + if kind=='add': + s=gate[2] + need(not (s in targets and t not in targets), 'non-target reads target') + if t in targets and s in targets: + a=Q(gate[3],gate[4])*(-1 if inverse else 1) + out[t]=out.get(t,Q(0))+a*out.get(s,Q(0)) + elif t in targets: + a=Q(gate[2],gate[3]);need(a!=0,'zero target scale') + out[t]=out.get(t,Q(0))*(1/a if inverse else a) + return {t:a for t,a in out.items() if a} + + +def suffix_corrections(gates, final, targets): + need(set(final)<=set(targets),'correction outside targets') + c={t:Q(a) for t,a in final.items() if a} + vectors=[c] + for g in reversed(gates): + c=step(c,g,targets,inverse=True) + vectors.append(c) + return list(reversed(vectors)) + + +def verify_transport(gates, final, targets): + vectors=suffix_corrections(gates,final,targets) + need(len(vectors)==len(gates)+1,'missing boundary') + for i,g in enumerate(gates): + need(step(vectors[i],g,targets)==vectors[i+1],f'transport boundary {i}') + need(vectors[-1]=={t:Q(a) for t,a in final.items() if a},'wrong final') + return vectors + + +def controls(): + # A correction on source target 11 is mixed into target 10 by an ADD; + # a scalar-only backward transport would miss this exact obstruction. + targets={10,11};gates=[['add',10,11,3,2,[]],['scale',11,-2,1,[]]] + final={10:Q(5),11:Q(4)} + v=verify_transport(gates,final,targets) + need(v[0]=={10:Q(8),11:Q(-2)},'known noncommuting two-target example') + wrong=dict(v[0]);wrong[10]=Q(5) + for g in gates:wrong=step(wrong,g,targets) + need(wrong!=final,'ignored-mixing control accepted') + try:step({10:Q(1)},['add',0,10,1,1,[]],targets) + except RuntimeError:pass + else:raise RuntimeError('target read into non-target not rejected') + return {'noncommuting_target_mix':'rejected_scalar_only_transport','non_target_read':'rejected'} + + +if __name__=='__main__': + need(__debug__,'assertions must remain enabled') + controls() + print('PASS_EXACT_TARGET_TRANSPORT_CONTROLS') diff --git a/research/t74-joint-twelve/verify.py b/research/t74-joint-twelve/verify.py new file mode 100644 index 0000000000..bae5b71ecc --- /dev/null +++ b/research/t74-joint-twelve/verify.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +"""Read-only finite replay: words, corrections, cleanup, hosting and exact moment. +No assertion-optimized execution; full native/outer release is separate. +""" +import copy,gzip,hashlib,json +from pathlib import Path +from fractions import Fraction as F +import sys +sys.path.insert(0,str(Path(__file__).resolve().parent)) +import composition as C +import independent_local as L +import independent_owners as I +import exact_moment as M +HERE=Path(__file__).resolve().parent +PROFILE={1:1593072,2:430236,3:204396,4:79920,5:22532,8:5328,32:1,48:26558} +LOW=F('0.001717141586348426338109') +def need(ok,msg): + if not ok:raise ValueError(msg) +def rd(name): + p=HERE/'inputs'/name;b=p.read_bytes();return json.loads(gzip.decompress(b) if p.suffix=='.gz' else b) +def run(): + need(__debug__,'run without -O: inherited independent local checker uses assertions') + pins=json.loads((HERE/'INPUT-PINS.json').read_text()) + for path,digest in pins.items():need(hashlib.sha256((HERE/path).read_bytes()).hexdigest()==digest,'input digest '+path) + claim=json.loads((HERE/'CLAIM.json').read_text()) + need({int(k):v for k,v in claim['profile'].items()}==PROFILE,'claim profile') + need(F(claim['complex_lower'])==LOW and F(claim['complex_upper'])==LOW+F(1,10**24),'claim bracket') + need(F(claim['kappa'])==LOW-F(1,10**46)-F(1,10**70),'claim outer endpoint') + for name in ('PR2733','PR2745'): + previous=json.loads((HERE/'evidence'/f'{name}-CLAIM.json').read_text()) + need(F(claim['kappa'])>F(previous['kappa']),'strict improvement over '+name) + words={} + for tag,pid in [('base','gauge44'),('extra','extra')]: + w=rd('WORD-'+tag+'.json.gz');words[pid]=w + L.check_frames(w);L.check_cleanup(w);L.algebra(w) + need(set(int(t)+112 for t in w['target_levels']).isdisjoint(g[1] for g in w['cut']),'lifted targets avoid every cut read') + for label in ['drop_anticipatory','reverse_anticipatory','reverse_recovery']: + bad=copy.deepcopy(w) + if label=='drop_anticipatory':bad['initial_corrections'].pop() + elif label=='reverse_anticipatory':bad['initial_corrections'][0]['coefficient']=str(-F(bad['initial_corrections'][0]['coefficient'])) + else: + j=next(i for i,g in enumerate(bad['B']) if g[:5]==['add',49,33,-1,1]);bad['B'][j][3]=1 + try:L.algebra(bad) + except AssertionError:pass + else:raise ValueError('accepted mutation '+label) + order,fill,providers=rd('ORDER.json'),rd('FILL.json.gz'),rd('PROVIDERS.json') + dispatch={(s,r):p for s,r,p in rd('DISPATCH.json.gz')} + need(order==rd('SOURCE-ORDER.json'),'source order') + constructed,_,_=C.transform(rd('SOURCE-PROVIDERS.json'),providers,rd('SOURCE-FILL.json.gz'),order,dispatch,words) + need(constructed==fill,'complete deterministic fill') + owner=I.check(rd('PLAN.json.gz'),rd('GLOBAL-TEMPLATE.json.gz'),order,fill,providers,dispatch,PROFILE) + bad=copy.deepcopy(fill);bad['rows'][0][5]=999 + try:I.check(rd('PLAN.json.gz'),rd('GLOBAL-TEMPLATE.json.gz'),order,bad,providers,dispatch,PROFILE) + except (ValueError,RuntimeError):pass + else:raise ValueError('accepted out-of-bin placement') + _,a=M.moment_bounds(PROFILE,LOW);b,_=M.moment_bounds(PROFILE,LOW+F(1,10**24));need(a<6630466304,'PR2733 rejects candidate endpoint') + return {'status':'PASS_JOINT_TWELVE_FINITE_REPLAY','roles':owner['roles'],'local_mutations_rejected':6,'owner_mutations_rejected':1,'complex_lower':str(LOW),'complex_upper':str(LOW+F(1,10**24)),'scope':'Independent local symbolic identity, actual frame bill, cleanup, exact hosting and moment only. Native/strict supplier/outer release is separate.'} +if __name__=='__main__':print(json.dumps(run(),indent=2)) diff --git a/research/t74-joint-twelve/workflow/admit.py b/research/t74-joint-twelve/workflow/admit.py new file mode 100644 index 0000000000..4606a5024e --- /dev/null +++ b/research/t74-joint-twelve/workflow/admit.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Tekalign (@tekuuu), with substantial OpenAI Codex assistance. +"""Prepare and fully admit a composed-word COMPOSED order/fill derivative. + +Research runtime only: native providers must already have passed freshly and +are authenticated by --native-receipt. --prepare-only stops before discovery. +Default complete admission preserves the original verify.py and release stages. +Source inputs and the native cache are read-only; all output uses fresh --work. +""" +import argparse +from fractions import Fraction as Q +import gzip +import hashlib +import json +import os +from pathlib import Path +import shutil +import subprocess +import sys +import tarfile +import time + +SOURCE_COMMIT = 'local-joint12-pr2733' +SOURCE_MANIFEST = '7980dbde79b63de4093cde89d1564a18c6bf16a2e35d810e38cf9797fe09e0cf' +PARENT_MANIFEST = 'e0eefc96567fbb45e19e6de0ca295381dbe0e686c08ddc783639b065c7c791d4' +PRECISION = dict(endpoint_digits=24, grid_digits=18, margin_digits=28, bootstrap_steps=12) +NATIVE_STAGES = ['native', 'ledgers', 'local-replay', 'wrappers', 'phases'] + + +def need(ok, why): + if not ok: + raise RuntimeError(why) + + +def sha(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def read(path): + body = path.read_bytes() + return json.loads(gzip.decompress(body) if path.suffix == '.gz' else body) + + +def write(path, value): + path.write_text(json.dumps(value, sort_keys=True, indent=2) + '\n') + + +def tree(root, exclude=()): + result = {} + for path in sorted(root.rglob('*')): + need(not path.is_symlink(), 'unbound symlink: ' + str(path)) + name = path.relative_to(root).as_posix() + if path.is_file() and name not in exclude: + result[name] = sha(path) + return result + + +def main(): + ap = argparse.ArgumentParser(description=__doc__) + for name in ('source', 'fill', 'order', 'native-cache', 'native-receipt', 'work'): + ap.add_argument('--' + name, type=Path, required=True) + ap.add_argument('--jobs', type=int, default=4) + ap.add_argument('--prepare-only', action='store_true') + a = ap.parse_args() + need(not sys.flags.optimize and a.jobs > 0, 'enabled assertions and positive jobs required') + source, cache, work = a.source.resolve(), a.native_cache.resolve(), a.work.resolve() + need(not work.exists() and not work.is_relative_to(source) and not work.is_relative_to(cache), + 'fresh external work required') + need(sha(source / 'MANIFEST.json') == SOURCE_MANIFEST, 'COMPOSED manifest pin') + source_files = read(source / 'MANIFEST.json') + need(len(source_files) == 491 and tree(source, ('MANIFEST.json',)) == source_files, + 'complete COMPOSED source inventory and hashes') + native_receipt = read(a.native_receipt) + need(native_receipt['status'] == 'PASS_COMPOSED_FRESH_NATIVE_PROVIDERS_AND_AUTHENTICATED_CACHE' + and native_receipt['source_commit'] == SOURCE_COMMIT + and native_receipt['manifest_sha256'] == SOURCE_MANIFEST, 'native receipt source binding') + need(tree(cache) == native_receipt['cache_files'], 'complete native/parent cache hashes') + old = source / 'vendor/pr1297' + need(sha(old / 'MANIFEST.json') == PARENT_MANIFEST, 'retained parent pin') + parent_receipt = cache / '_receipts' / PARENT_MANIFEST / 'RECEIPT.json' + need(sha(parent_receipt) == native_receipt['retained_parent_receipt_sha256'], 'parent receipt pin') + pr = read(parent_receipt) + need(pr['vendor_manifest_sha256'] == PARENT_MANIFEST and pr['claim_sha256'] == sha(old / 'CLAIM.json'), + 'parent receipt claim binding') + for name, digest in pr['files'].items(): + need(sha(parent_receipt.parent / name) == digest, 'parent receipt file') + parent_result = read(parent_receipt.parent / 'RESULT.json') + need(parent_result['status'] == 'PASS_GLOBAL_MIXED_X54_FUSIONS_NATIVE_AND_STRICT_ADMISSION' + and parent_result['kappa'] == read(old / 'CLAIM.json')['kappa'], 'retained parent completed admission') + natives = {} + for tag in ('base', 'extra'): + word = source / ('new/borrow/words/BORROW-WORD-43' + tag + '.json.gz') + entry = cache / sha(word) + binding = native_receipt['providers'][tag] + need(binding['word_sha256'] == sha(word) + and tree(entry, ('CACHE.json',)) == binding['complete_native_files'], 'native full-tree binding') + need(read(entry / 'local/FULL-WORD.json.gz') == read(word), 'native complete word') + stages = read(entry / 'STEPS.json') + need([s['step'] for s in stages] == NATIVE_STAGES and all(s['exit_code'] == 0 for s in stages), + 'native five-stage coverage') + checks = read(entry / 'local/LOCAL-CHECKS.json') + need(all(checks[o]['paid_profile'] == read(word)['report']['local_profile'] for o in ('forward', 'backward')), + 'native actual paid profiles') + natives[tag] = entry + work.mkdir(parents=True) + package = work / 'package' + shutil.copytree(source, package) + env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', PYTHONUTF8='1', PYTHONINTMAXSTRDIGITS='0', + OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1', AUDIT_FAST_SHARDS=str(a.jobs)) + for name in ('PYTHONOPTIMIZE', 'WITNESS_SPEC', 'WITNESS_DISCOVER', 'WITNESS_RECORD'): + env.pop(name, None) + stages, patches = [], [] + + def run(name, script, *args): + start = time.monotonic() + command = [sys.executable, '-B', str(script), *map(str, args)] + log = work / (name + '.log') + with log.open('w') as output: + result = subprocess.run(command, env=env, cwd=work, stdin=subprocess.DEVNULL, + stdout=output, stderr=subprocess.STDOUT) + stages.append(dict(name=name, exit_code=result.returncode, seconds=time.monotonic() - start, + script_sha256=sha(script), log_sha256=sha(log), command=command)) + write(work / 'STAGES.json', stages) + need(result.returncode == 0, 'failed ' + name + '; see ' + str(log)) + print('PASS', name, flush=True) + + def patch(name, replacements): + path = package / name + before = sha(path) + body = path.read_text() + for old_text, new_text in replacements: + need(body.count(old_text) == 1, 'exact patch preimage: ' + name + ': ' + old_text[:80]) + body = body.replace(old_text, new_text) + path.write_text(body) + patches.append(dict(path=name, before_sha256=before, after_sha256=sha(path), replacements=replacements)) + + # PR2530's already checked correction: restored zero buffers occupy physical + # rows. COMPOSED's shipped SPEC includes them; its rebound SPEC omitted them. + patch('new/rebind.py', [ + ("physical=spec['expected']['live'] + 8 + R + 2)", + "physical=spec['expected']['live'] + 8 + R + 2 + max(len(rd(d / 'CANONICAL-WORD.json.gz').get('zero_buffers', [])) for d in locs.values()))")]) + # Preserve the exact fixed-grid-maximum equality while deriving precision + # from the same SPEC read by both independent outer arithmetic checkers. + patch('verify_release.py', [ + ('Fraction(1, 10 ** 3046) - Fraction(1, 10 ** 3022)', + "Fraction(1, 10 ** (spec['outer_refinement']['endpoint_digits'] + 46)) - Fraction(1, 10 ** (spec['outer_refinement']['endpoint_digits'] + 22))"), + ('epsilon=1-(1025/1024)e-3080', "epsilon=1-(1025/1024)e-{spec['outer_refinement']['endpoint_digits']+80}"), + ('at the one 3000-digit rejection call', "at the one {spec['outer_refinement']['endpoint_digits']}-digit rejection call")]) + write(work / 'RUNTIME-PATCHES.json', patches) + shutil.copy2(a.fill, package / 'new/borrow-fill/FILL.json.gz') + shutil.copy2(a.order, package / 'new/borrow-fill/ORDER.json') + run('owners', package / 'reconstruct.py', '--out', work / 'owners') + run('parent-lift', package / 'lift_parent.py', '--owners', work / 'owners', '--out', work / 'parent-data') + for name in ('PLAN.json', 'OWNERS.json.gz', 'DISPATCH.json', 'PROFILE.json', 'CONSTRUCTION.json', + 'GLOBAL-TEMPLATE.json.gz', 'SPEC.json'): + shutil.copy2(work / 'parent-data' / name, package / name) + shutil.copy2(work / 'owners/ORDER.json', package / 'ORDER.json') + spec = read(package / 'SPEC.json') + spec['outer_refinement'] = PRECISION + spec['expected']['live'] = 66304 + # COMPOSED's pre-life mechanism changes which helper labels retain width8. + # Preserve its declared spot set; rebind and the original strict verifier + # still check the actual native widths, including every other helper. + source_spots = read(source / 'new/SPEC.json')['width_spot_helpers'] + need(source_spots == [278, 281, 284, 289], 'COMPOSED source spot-width pins') + spec['width_spot_helpers'] = source_spots + write(package / 'new/SPEC.json', spec) + run('rebind', package / 'new/rebind.py', package, natives['base'] / 'local', + natives['extra'] / 'local', work / 'rebound') + spec = read(work / 'rebound/SPEC.json') + need(spec['expected']['physical'] == 66801, 'complete physical cost including 72 buffers') + layout = work / 'layout' + layout.mkdir() + with tarfile.open(old / 'upstream-layout.tar.gz') as archive: + need(all(m.isfile() and not Path(m.name).is_absolute() and '..' not in Path(m.name).parts + for m in archive.getmembers()), 'retained archive paths') + archive.extractall(layout, filter='data') + runtime = layout / 'packing74' + runtime.mkdir() + for name in ('replay.py', 'freeze_spec.py', 'audit_mixed.py', 'independent_core.py', 'geometry_controls.py', 'audit_fast.py'): + shutil.copy2(package / name, runtime / name) + for name in ('code', 'construction', 'inputs'): + shutil.copytree(package / name, runtime / name) + shutil.copytree(work / 'rebound', runtime / 'candidate') + shutil.copytree(natives['extra'], runtime / 'native-extra') + data = runtime / 'candidate' + result = dict(status='PREPARED_COMPOSED_SAME_WORD_DERIVATIVE_NOT_ADMITTED', source_commit=SOURCE_COMMIT, + source_manifest_sha256=SOURCE_MANIFEST, native_receipt_sha256=sha(a.native_receipt), + fill_sha256=sha(package / 'new/borrow-fill/FILL.json.gz'), + order_sha256=sha(package / 'new/borrow-fill/ORDER.json'), profile=read(work / 'rebound/PROFILE.json'), + patches=patches, scope='Prepared only; source/native/parent inputs authenticated and literal owner fill reconstructed.') + write(work / 'RESULT.json', result) + if a.prepare_only: + print(result['status'], flush=True) + return + run('discovery', runtime / 'replay.py', '--data', data, '--work', work / 'discovery', + '--local', natives['base'] / 'local', '--discover') + supplier = read(work / 'discovery/RESULT.json') + for name in ('PLAN.json', 'PROFILE.json', 'SPEC.json'): + shutil.copy2(data / name, package / 'new' / name) + spec = read(package / 'new/SPEC.json') + original_claim = read(source / 'CLAIM.json') + claim = dict(status='CONDITIONAL_CANDIDATE_EXPECTED_BY_REPLAY', kappa=supplier['kappa'], + kappa_decimal=supplier['kappa_decimal'], baseline_pr=2679, baseline_head=SOURCE_COMMIT, + baseline_kappa=read(source / 'outer/OUTER-CLAIM.json')['kappa'], outer_refinement=PRECISION, + scope=original_claim['scope'], kappa_layers=original_claim['kappa_layers'], + headline_kappa_source='outer/OUTER-CLAIM.json', + verification='Candidate discovered from literal fill; full original verification must pass separately.') + write(package / 'CLAIM.json', claim) + C = Q(spec['expected']['complex_lower']) + write(package / 'outer/B.json', dict(b=str(C-Q(1,10**104)), b_above_endpoint=str(C+Q(1,10**24)), + profile=spec['expected']['global_profile'], live=spec['expected']['live'])) + for name in ('check_ledger.py', 'independent_check.py'): + run('outer-' + name, package / 'outer' / name) + ledger = read(package / 'outer/LEDGER.json') + row = ledger['rows']['struct_boundary_radix_union']['kappa'] + kappa = Q(row['rational']) + previous = Q('0.0017161404259974415161889999999999999999999998999999999999999999999999') + need(kappa == C-Q(1,10**70)-Q(1,10**46) and kappa > previous, + 'candidate must strictly improve pinned COMPOSED before full release') + outer_claim = read(source / 'outer/OUTER-CLAIM.json') + outer_claim.update(kappa=row['decimal'], kappa_rational=row['rational'], + baseline_head=SOURCE_COMMIT, baseline_kappa=str(previous), gain=str(kappa-previous), + b='certified complex_lower - 1e-104 (outer/B.json)', + retuned_slacks='Endpoint precision24; free gaps follow outer/check_ledger.py from the frozen SPEC.', + fixed_grid_maximum='kappa=C-10^-70-10^-46 exactly; same fixed-grid-maximum proof at precision24.') + write(package / 'outer/OUTER-CLAIM.json', outer_claim) + write(package / 'MANIFEST.json', tree(package, ('MANIFEST.json',))) + run('release', package / 'verify_release.py', '--main', source.parents[1], '--work', work / 'release', + '--native-cache', cache, '--jobs', a.jobs) + receipt = read(work / 'release/RELEASE-RECEIPT.json') + need(receipt['status'] == 'PASS_RELEASE' and Q(receipt['kappa_decimal']) == kappa + and receipt['manifest_sha256'] == sha(package / 'MANIFEST.json'), 'complete release binding') + need(sha(source / 'MANIFEST.json') == SOURCE_MANIFEST + and tree(source, ('MANIFEST.json',)) == source_files and tree(cache) == native_receipt['cache_files'], + 'read-only source/cache inputs changed') + result.update(status='PASS_COMPOSED_ORDER_FILL_DERIVATIVE_COMPLETE_RELEASE', + complex_lower=str(C), kappa=str(kappa), kappa_decimal=row['decimal'], + gain=str(kappa-previous), release_receipt_sha256=sha(work / 'release/RELEASE-RECEIPT.json'), + package_manifest_sha256=sha(package / 'MANIFEST.json'), stages=stages, + scope='Conditional finite construction and modern outer arithmetic. Exact inherited theorem obligations remain. Both native providers explicitly reused from authenticated fresh five-stage runs.') + write(work / 'RESULT.json', result) + print(result['status'], row['decimal'], flush=True) + + +if __name__ == '__main__': + main()