diff --git a/research/raw-crt-binary-shuttle-bridge/FULL.json b/research/raw-crt-binary-shuttle-bridge/FULL.json new file mode 100644 index 0000000000..7fce3bc3bd --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/FULL.json @@ -0,0 +1,26 @@ +{ + "case": { + "calls": [ + { + "backing": 3146057, + "geometry": [ + 2, + 1, + 1024, + 12 + ], + "mode": "u", + "output_sha256": "d5883b3a403ebc5b88d8b9b74d9ace9295bc2b79481fe44acb5bbd263bab7ae3", + "steps": 336273602, + "volume": 196608 + } + ], + "close_steps": 389, + "control_factor": 4, + "init_steps": 281, + "instructions": 119059, + "roles": 29, + "total_steps": 336274272 + }, + "status": "PASS_ACTUAL_RAW_BINARY_SHUTTLE" +} diff --git a/research/raw-crt-binary-shuttle-bridge/PROOF.md b/research/raw-crt-binary-shuttle-bridge/PROOF.md new file mode 100644 index 0000000000..411ee9d287 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/PROOF.md @@ -0,0 +1,212 @@ +# Paid raw-CRT to binary-interchange call boundary + +## 1. Exact source, model and result + +The retained `standalone-elementary-crt-raw/raw.py` has a single data owner +and two persistent descriptor tuples: + + u=(H,A,G,S)=(2,1,1024,12), t=(2,4,256,12), V=A·4^H·G·S=196608. + +`Raw.shuttle` calls its elementary interchange, clears the old data body, +transfers the returned body into that same object, and clears the return. +This package supplies a **literal replacement call boundary** for that +permutation/ownership contract. It does not replace the remaining raw rotations, +ROM queries, full twelve-call schedule or repair. Original `Raw.shuttle` is not +patched and the host `Raw` class is not executed by the new machine. + +Use the source five-symbol alphabet ZERO=0, ONE=1, LEFT=2, RIGHT=3, BLANK=4. +RAW is a borrowed/installed owner: LEFT at0, V arbitrary bits, blank tail, head1. +There are two banks of four canonical LSB-first raw descriptors, each LEFT, +bits, RIGHT, blank tail, head1. H≥0, A,G,S≥1; zero has one zero bit. All29 +roles are disjoint. The20 encoded child roles are owned, entirely blank, head0, +with arbitrary finite already-allocated blank backing. Unused caller tapes, +including any ROM, are outside these roles and are untouched. Correct input +shape and disjointness are premises, not a promised global validator/rollback. + +Each u/t entry returns the exchanged payload in the **same RAW array**, with +LEFT/head1 and all four fields/spectators in their original order: + + out[a,y,g,x,s] = in[a,x,g,y,s], x,y∈[0,2^H). + +Both raw descriptor banks are unchanged/head1. Every encoded cell, including +markers, is blank and all20 owned heads are0. Array backing is retained. +A subsequent entry may reuse exactly those banks. The separately supplied +literal `init_descriptors` and `close_descriptors` entries produce and retire +both actual source descriptor banks, including their markers and all motion. +They are not free fixture construction. RAW payload production remains the +upstream caller's obligation. + +The call-entry proof holds for any admitted descriptor values at these ports; +only the optional descriptor initializer contains the two compiled tuples. +The actual initializer constants are AST-extracted from the authenticated Raw +source. Reduced geometries in finite tests replace only these initialization +constants; they are labelled calibrations, not actual CRT payload executions. + +## 2. Binary embedding and finite dispatch + +The consumed binary program is generated by the unchanged +`binary-elementary-interchange.binary_machine.lower` from the unchanged +4589-instruction source program. Its established encoding is + + ZERO→001, ONE→010, LEFT→011, RIGHT→100, BLANK→000. + +The raw machine's unallocated cells are4, while the binary machine's are0. +Use the injective renaming ρ(0)=4 and ρ(1)=1 on every binary test/write. +All binary moves and control edges remain unchanged. An unallocated binary0 +then corresponds to an unallocated raw4. A binary head at h is still at h; +this is symbol renaming, not an unpriced address transformation. Instruction +induction preserves contents, heads, allocation lengths and instruction counts. +The child uses the two-symbol subalphabet {4,1}, but the **complete caller +is five-symbol**, not a purported whole two-symbol raw CRT implementation. + +The assembler emits only local test/write, unit move, fixed jump and halt. +It places two static copies of the child word for the two fixed caller port +sets; both use the same20 encoded banks. This is fixed program memory, not +runtime data allocation. Child status halts are replaced by single jumps: + + initialized→run, returned→install, installed→close, closed→decode/retire. + +Each replacement costs one instruction, just like the replaced halt. No +runtime callback, numerical PC computation, Python method, decoded geometry +or host transposition survives. The existing static admission check verifies +every opcode/role/target and excludes jump-only cycles; the resulting control +factor is recorded. The old consume entry is unreachable in this path; +install consumes the returned output before close. + +## 3. Literal codecs and owner induction + +At an encode-loop boundary raw head j and encoded head3j refer to the same +source cell. The encoder explicitly writes encoded LEFT at0. For each raw +bit it tests the scanned symbol, writes the corresponding three-cell code, +advances three unit steps on the encoded bank and one on the raw bank. +Payload ends at raw BLANK; numerical words end at RIGHT, whose encoded +block is also written. A paired backward loop moves the raw head by-1 and +the encoded head by-3 until the raw LEFT, then restores both to1 and3. +Thus all borrowed raw bytes/heads survive and every child input has exactly +its required encoded framing. Destinations are tested blank before writing. +The five input banks are owned by the bridge, despite being borrowed by the +child. The fifteen private child banks receive paid three-cell blank origin +initialization, establishing block alignment before child init. + +By the inherited all-width callee theorem and binary refinement, run returns +an encoded exchanged output; install overwrites its encoded SOURCE and +consumes output; close erases private markers and leaves their heads3. The +bridge then decodes that **installed encoded SOURCE**, not a reconstructed +oracle stream. A literal depth-three decision tree reads a block and restores +alignment. Codes001/010 write the corresponding bit to the original RAW +owner and erase the encoded block. Code000 terminates and checks the raw +blank tail; all other complete codes reject at this boundary. The paired +rewind restores RAW head1; the encoded LEFT is erased and its head becomes0. +This proves same-owner installation, not a returned replacement object. + +Each encoded descriptor is retired by advancing along the unchanged raw +word in aligned pairs, erasing its corresponding blocks including RIGHT, +then rewinding the raw word and erasing encoded LEFT. The raw word is never +written. The other descriptor bank is never accessed. Finally three paid +left moves return each child-private head from3 to0. All erased tails remain +allocated. This establishes the complete entry/return invariant, so induction +covers arbitrary successful u/t sequences on the same physical bank. + +The initializer writes every raw descriptor cell through a blank check, +including LEFT/RIGHT, then rewinds. For eight words of total bit length J +its exact cost is6J+65. Terminal descriptor retirement costs7J+137. The +actual source tuples have J=36, hence281 and389 instructions. Their initial +backing is supplied blank and charged below. Reinitializing occupied +raw descriptors is not an admitted entry. + +## 4. Complete instruction invoice + +Let I=b(H)+b(A)+b(G)+b(S), where b(n)=max(1,bit_length(n)), and +L=H+I+8. The inherited binary complete init/run/consume/close bound is + + 2^23 (H+1)(V+1)(L+1)^2. + +To avoid relying on whether an earlier prose bound included installation, +charge install separately. In the source word, each clear of a V-bit payload +uses7V+7 instructions, and its copy uses at most15V+7. Install therefore +costs at most29V+22 plus its halt, below32(V+1). Its binary lowering costs +at most256(V+1). Charging this on top of the inherited consumption bound +overcounts the omitted consume, which is safe. + +A three-cell write/return costs7 instructions, or10 with blank checks. +Encoding one n-bit raw port costs at most32(n+2), including its marker, +terminator when numerical, all alignment motion and raw-head restoration. +Decoding/installing/retiring encoded payload costs at most32(V+2). +Descriptor retirement costs at most32(n+2) per word. These bounds follow +from at most17 encode instructions per bit, at most24 decode/erase instructions +per bit, at most13 descriptor-retirement instructions per bit, and paired +rewind cost5(n+1)+4. Origin erasure costs10. Fifteen blank triplets cost150; +returning their heads costs45. Boundary jumps/halt fit the remaining slack. +Consequently the complete single shuttle, from blank encoded banks through +same-owner return and full encoded retirement, is bounded by + + 2^23(H+1)(V+1)(L+1)^2 + 256(V+1) + 128(V+I+16). + +Add6J+65 for descriptor production and7J+137 for terminal descriptor disposal, +once per caller descriptor-bank lifetime. Input payload creation/replacement, +ROM and other raw operations remain separate. Every test, zero write, unit +move and jump is charged; this is an intentionally conservative literal +instruction bound, not a runtime fit or a claimed speedup. No recursive +profile is repriced and no signed gain or new κ is asserted. + +## 5. Retained backing of all banks + +A read/move beyond the explicit array does not allocate; a write does, even +when it writes BLANK. Neither erasure nor close shrinks an array. The retained +source per-private-role capacity c_r(g) is the table in +`interchange-retained-backing/PROOF.md`; its proof is an explicit dependency. +The binary refinement gives3c_r(g) for each of the15 child-private banks. +Bridge blank initialization is within their three-cell origin allowance. +All codec writes are aligned complete blocks, so their exact requirements are + + E_SOURCE: 3(V+1), E_X: 3(b(X)+2), X=H,A,G,S. + +The RAW owner needs V+1 cells. The two persistent raw descriptor banks each +need b(X)+2 cells per word. They are initialized even when only one mode is +used. Byte-for-byte retained private storage is therefore determined by +**separate per-role maxima** of these quantities and each role's old backing. +This also bounds every intermediate write, because arrays never shrink. +Source install does not exceed the encoded SOURCE prefix already produced. + +For arbitrary finite successful histories let Vmax bound all call volumes, +and w=b(Vmax). Each active descriptor's bit length≤w, and the retained +source-private grant is4Vmax+8w+23. Thus20 owned encoded banks have the +conservative fresh grant + + 3(4Vmax+8w+23) + 3(Vmax+1) + 12(w+2) + = 15Vmax + 36w + 96. + +When both persistent descriptor tuples also have volume≤Vmax, adding RAW +and all eight raw words yields16Vmax+44w+113 cells. With arbitrary preexisting +backing, add its total K0; this loose sum safely retains old blank tails. +If an unused initialized descriptor tuple has larger volume, its actual eight +raw-word extents must instead be added separately; call-only Vmax cannot +bound an unrelated unused descriptor. External input replacement may not +allocate unaccounted padding or retain additional old objects for free. +These are logical retained cells, not CPython heap/RSS or a global allocator. + +For the two actual source tuples, each separate fresh shuttle (with both raw +banks initialized) retains3,146,057 total cells. A u→t history on one bank +retains3,146,075: encoded PRE/OUTER add12 cells and encoded A adds6, while +older GAP/BETWEEN/G backing remains. The extra18 cells falsify max-of-total +accounting. The shared original RAW owner is counted once, encoded SOURCE +and child OUTPUT separately. This is an arithmetic application to t if only +the source-sized u case was executed; exact observed coverage is in FULL.json. + +## 6. Evidence, scope and credit + +Small complete rectangles, all16 independent H2 input columns, H0 identity, +shrinking/growing histories, exact per-role backing and two separately written +interpreters corroborate the proof. Wrong decoded writes and skipping install +are falsifying controls. The source-sized actual u case uses all196608 bits; +its execution is recorded separately, never inferred from a calibration. +No full twelve-shuttle/ROM/rotation/repair composition, binary lowering of +that whole caller, current native supplier, precision/outer multiplication or +selected-frontier change is claimed. Failed-input rollback is excluded. + +Jose Manuel and retained PR2809/2753 authors supply the elementary lineage; +JoyboyBrian/PR5162 and PR5188 supply the actual raw owner and literal callee; +Ali Romman supplies binary lowering; Hiroki KUMAZAKI/PR5286 supplies retained +backing. Cinna Davis, Hiroki KUMAZAKI, Douglas Colkitt/OpenAI and retained +notices retain CRT attribution. New bridge/proof/controls: JoyboyBrian with +substantial OpenAI Codex assistance, Apache-2.0. No human/kernel acceptance. diff --git a/research/raw-crt-binary-shuttle-bridge/README.md b/research/raw-crt-binary-shuttle-bridge/README.md new file mode 100644 index 0000000000..b1d41a13a7 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/README.md @@ -0,0 +1,70 @@ +# Literal raw CRT shuttle to the binary callee + +The actual `Raw.shuttle` owner uses numeric LEFT/BLANK framing, while the +completed binary elementary interchange expects aligned three-bit ports. +This package supplies the paid literal bridge: encode payload and descriptors, +initialize and dispatch the existing binary program, install its output, +decode into the same raw owner, and retire every encoded bank. + +The29 fixed roles include RAW, both actual u/t descriptor banks and20 encoded +callee roles. Runtime instructions are only local tests/writes, unit moves, +fixed jumps and halts. No host encoder, decoder, transpose or allocation callback +survives. The binary child uses {raw BLANK4,ONE1}; the enclosing caller remains +explicitly five-symbol. [PROOF.md](PROOF.md) states the all-width port contract, +complete instruction tariff and retained-bank proof. + +The source initializer constants are extracted from unchanged Raw code: +u=(2,1,1024,12), t=(2,4,256,12), each196608 payload bits. Their eight raw +words are literally initialized/retired at costs281/389 instructions. +Each separate actual call has3,146,057 retained cells including raw input and +both descriptor banks. A shared u→t history requires3,146,075 cells: the extra18 +falsify max-of-standalone-total accounting. The t history figure is derived +from the source per-role theorem; FULL.json records the historical actual u execution; the publication refresh +replays only the light checks and preserves that receipt unchanged. + +Small tests include H0 identity, growing/shrinking histories, all16 independent +H2 columns, a separately written sparse interpreter, exact retained capacities, +wrong decoded-bit and missing-install controls. Default replay is read-only; +`--write` authors only a missing typed receipt. Source and receipt corruption +controls remain effective with assertions disabled. + +```sh +python3.12 -B scripts/research_package.py --package research/raw-crt-binary-shuttle-bridge --check-only +python3.12 -I -B research/raw-crt-binary-shuttle-bridge/verify.py +python3.12 -I -O -B research/raw-crt-binary-shuttle-bridge/verify.py +# Source-sized science needs a reserved heavy slot: +python3.12 -I -B research/raw-crt-binary-shuttle-bridge/verify.py --full +``` + +This is an executable replacement call boundary, not a patch to the original +Raw class or a complete twelve-shuttle/rotation/ROM/repair execution. Upstream +payload production, full binary caller lowering, global allocation, native +supplier, precision and outer multiplication remain outside scope. No recursive +invoice/frontier changes or new κ. Error rollback is not promised. + +## Open next questions + +Compose one remaining literal raw rotation/current-y ROM boundary on these +actual owners, with complete production and restoration costs. The current +source raw word is not fully lowered. A whole two-symbol implementation also +needs its upstream raw/ROM representation and stock invoice; the child-only +binary theorem does not provide those. Structured questions are in TASK.json. + +## Credit + +JoyboyBrian with substantial OpenAI Codex assistance; Apache-2.0. +Jose Manuel and retained PR2809/2753 authors supply the elementary lineage; +JoyboyBrian/PR5162/5188 supply raw and literal sources; Ali Romman supplies +binary lowering; Hiroki KUMAZAKI/PR5286 supplies retained backing. Cinna Davis, +Hiroki KUMAZAKI, Douglas Colkitt/OpenAI and retained notices retain CRT credit. +All original sources remain unchanged. No human or formal-kernel acceptance. + +[Resumed canonical claim](https://github.com/CrocSwap/integer-mult-bounds/discussions/4709#discussioncomment-19233740); +[original released claim](https://github.com/CrocSwap/integer-mult-bounds/discussions/4709#discussioncomment-19173365). + +Publication was resumed on canonical main +`721c03822c421b7f7fcbb2598993b947c4d88419`, priority revision8, selected +PR6030. All eight live scientific inputs are unchanged. The original revision7 +card and source pins remain frozen; this result makes no claim about the new +selected construction. The registered hook includes the source-sized `--full` +command and will require its separate resource budget when run in hosted CI. diff --git a/research/raw-crt-binary-shuttle-bridge/RESULT.json b/research/raw-crt-binary-shuttle-bridge/RESULT.json new file mode 100644 index 0000000000..2620d6d36a --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/RESULT.json @@ -0,0 +1,382 @@ +{ + "actual_bank_invoice": { + "borrowed_raw_payload": 196609, + "caller_descriptors": 52, + "owned_history_ut": 2949414, + "owned_t": 2949396, + "owned_u": 2949396 + }, + "actual_geometry": { + "t": [ + 2, + 4, + 256, + 12 + ], + "u": [ + 2, + 1, + 1024, + 12 + ] + }, + "basis": { + "calls": [ + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "7ff83a37d63f77b8efa2115f88b6e1c33f2246eb4c45ad9c9c6dcd3d2f9ea0ad", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "1dc0dd8069fcfaf5e0bb576cc9dbcef90883a9080537631fba7aebe0f851a9bc", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "e37032397810865b2df9ed3a51c119a9b0e4ebc9a6110f3f3f07bd4486297801", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "23c50ec105c389ca255e089307e6731fcc61af103e39dcd3f60b9bcf448c5e7e", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "c61a0b47d3b31f558d15b574a52615b0e9a98c1cb72421d8f24afe83da66a5aa", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "ac0265fb6f028d84161028237669b2bdc9ed2cfbf49a36361f67fed4fa19ccbb", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "1bfa3f7fd42575ce0215d7ffbf4ed313bbc27997394da35bacf167a8f71e5079", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "9b962762fb0c56be9d4a74dd288b31e2379c9f7b3c8940eddb9859479c527dc7", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "ab9e756d6e6289d9f8f8f86be66aa3a5119a3c6c3cb47bfc244bbece0cb16ae2", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "05f5e9e0484fd9318f2464ee8e98de8829db95edb83ea3353daf95b616d9bfed", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "a547d249b62eced2677a08047d2378433c3ff36770fee6914ba99a283a488904", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "64bc7881dcda51ec52f56127b2e7630e345e1b2e35d26b4ddae0592f10cdbec2", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "7bc3a73cd24f3007ea093af88996d56423777620b7e9c4959357ef576afb5bbd", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "c735d553c0f2f889749f6794f29c3dc3f90bb555e7d72242546d0fdd835de2b9", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "98e6a4c21b1cf1d006743faf5de1877b87375b85e3ef201ec8ae53a31a18bdf7", + "steps": 51799, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "6b81d1cfb3d86a4b94cf949bee72f31de44768dfe75f2fba35409696d82eba6e", + "steps": 51799, + "volume": 16 + } + ], + "close_steps": 207, + "control_factor": 4, + "init_steps": 125, + "instructions": 118981, + "roles": 29, + "total_steps": 829116 + }, + "cases": [ + { + "calls": [ + { + "backing": 147, + "geometry": [ + 0, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "25dfd29c09617dcc9852281c030e5b3037a338a4712a42a21c907f259c6412a0", + "steps": 3185, + "volume": 1 + }, + { + "backing": 160, + "geometry": [ + 0, + 2, + 1, + 1 + ], + "mode": "t", + "output_sha256": "9463926d4640a53a0cf1ac00657361f5a6d64fbc554df30721cdacf503aebc2b", + "steps": 3579, + "volume": 2 + }, + { + "backing": 160, + "geometry": [ + 0, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "63321aa837b08a6a669882f700ab5084bf1dabb73eca1dae0d67919ed580010b", + "steps": 3185, + "volume": 1 + } + ], + "close_steps": 200, + "control_factor": 4, + "init_steps": 119, + "instructions": 118978, + "roles": 29, + "total_steps": 10268 + }, + { + "calls": [ + { + "backing": 387, + "geometry": [ + 1, + 1, + 2, + 2 + ], + "mode": "u", + "output_sha256": "904ba98fe92456f221e9ec6e59cf457dce49b8bd2068309d609f2289837d33f0", + "steps": 26401, + "volume": 16 + }, + { + "backing": 396, + "geometry": [ + 1, + 2, + 1, + 2 + ], + "mode": "t", + "output_sha256": "443e02e4d3530ce5aac5d216f0261eac730536d05db5e205ce9ec67ef9c4af02", + "steps": 27610, + "volume": 16 + }, + { + "backing": 396, + "geometry": [ + 1, + 1, + 2, + 2 + ], + "mode": "u", + "output_sha256": "06daa39e918d9113c948cc6d633ee9f1bdc675bcca22bded3b58e1b2593e5df0", + "steps": 26371, + "volume": 16 + } + ], + "close_steps": 221, + "control_factor": 4, + "init_steps": 137, + "instructions": 118987, + "roles": 29, + "total_steps": 80740 + }, + { + "calls": [ + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "u", + "output_sha256": "74fa5ea5244d4d8f59ef7a29c51ac358a4d2a00c2a43a87cd9d9e425cd85f522", + "steps": 51904, + "volume": 16 + }, + { + "backing": 442, + "geometry": [ + 2, + 1, + 1, + 1 + ], + "mode": "t", + "output_sha256": "fd14693f93642281ef11c18b4214c7bca496ea64238ee859917716634c2df1a9", + "steps": 51919, + "volume": 16 + } + ], + "close_steps": 207, + "control_factor": 4, + "init_steps": 125, + "instructions": 118981, + "roles": 29, + "total_steps": 104155 + } + ], + "rejecting_controls": [ + "wrong_decoded_bit", + "omitted_child_install" + ], + "status": "PASS_RAW_BINARY_SHUTTLE_BRIDGE" +} diff --git a/research/raw-crt-binary-shuttle-bridge/SOURCES.json b/research/raw-crt-binary-shuttle-bridge/SOURCES.json new file mode 100644 index 0000000000..eae3eb7820 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/SOURCES.json @@ -0,0 +1,66 @@ +{ + "schema_version": 1, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "fc3d4ba105e1f097d0d7d051a308281e86ab1446", + "sha256": "66974efdced4083c00025f97d95d83909a226cdf801edb9301c195c6641f6903" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + }, + { + "path": "research/binary-elementary-interchange/README.md", + "usage": "input", + "git_blob": "3f842f16ca03605e421cf82ed6acf787c56b991e", + "sha256": "e365cb661cef3bce9d7bfc9b88d610f43e0a6e22eae762c4c991b233ce4592e7" + }, + { + "path": "research/binary-elementary-interchange/binary_machine.py", + "usage": "input", + "git_blob": "91a9cb6921342fccc6276e51c58532b8ac8518e4", + "sha256": "3fe87e8919d99ea2767db0a468e11668e337e71b7074216de756d0a4a967c977" + }, + { + "path": "research/interchange-retained-backing/PROOF.md", + "usage": "input", + "git_blob": "791811562d25a1ac1950122e1c5ba3046dfd0e0e", + "sha256": "5dff1777bedbdd5bc16843b77e8fb47a30810f27cdbd60497906c1a526b1ef73" + }, + { + "path": "research/literal-elementary-interchange/PROOF.md", + "usage": "input", + "git_blob": "d4e14bba3fe10e0f269b0891b0e196b723b651cf", + "sha256": "507684173bde7865161d641bbffc6862c1e825407c42efa70747c763dadd03af" + }, + { + "path": "research/literal-elementary-interchange/machine.py", + "usage": "input", + "git_blob": "78dc14bf1c995b5ea348d2e753cf9f56dbdb480b", + "sha256": "66b5c371ff4aebd4391d71b95c59769a067e0a04910521b4881f074f986327bf" + }, + { + "path": "research/literal-elementary-interchange/program.py", + "usage": "input", + "git_blob": "c606ed51a06409a648d3fd385b0dfdaa5e096720", + "sha256": "3b83fbe3451000b00030ff3156222def23ce15d17d00c7d09a324aea5fd92e72" + }, + { + "path": "research/standalone-elementary-crt-raw/README.md", + "usage": "input", + "git_blob": "8c3f0f2e7c1b7808b87004cb8c517134fbb9e4b3", + "sha256": "13cdc0078cc048f6e8931ee596e930d43ea07e87cc937f9726ae0e2443805c96" + }, + { + "path": "research/standalone-elementary-crt-raw/raw.py", + "usage": "input", + "git_blob": "6e1bca04003aa0e3b40d2493f1982a4c4c9ed91b", + "sha256": "a9ffd3b53f457003d482dd7bd419f3cedfed4afc3d89ffe4d338956679a5656d" + } + ] +} diff --git a/research/raw-crt-binary-shuttle-bridge/TASK.json b/research/raw-crt-binary-shuttle-bridge/TASK.json new file mode 100644 index 0000000000..3286ec9940 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/TASK.json @@ -0,0 +1,98 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "priority_revision": 7, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Does one quantified step of the proposed #4100 all-size construction hold at its actual caller?", + "starting_points": [ + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "research/unconditional-batched-crt/README.md" + ], + "methods": [ + "Prove one missing implication with explicit quantified hypotheses.", + "Find an exact counterexample at the claimed interface boundary." + ], + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read PROOF.md and AUDIT.md in #4100. Select one distinct obligation: CRT total repair, native/free-algebra lifting, precision/conditioning, or complete fixed-tape cost. This is an author-submitted proof, not an accepted unconditional theorem.", + "scope": "Source-binding orientation only; no scientific replay, theorem acceptance or supplier admission. Budget any heavy replay separately." + }, + "first_experiment": "Check live handoffs; name one proposition, its caller, quantified domain and dependency closure. Independently prove the implication or exhibit a precise gap/counterexample. Prioritize CRT.md total repair or COMPLEX.md free-algebra lift only if unclaimed. Stop at the chosen obligation; do not substitute finite samples or root arithmetic for an all-size proof, or launch the complete package by default.", + "bottleneck_link": "Finite supplier improvements are useful only under the retained transfer obligations.", + "allowed_variations": [ + "One CRT repair, native lift, precision/conditioning or tape-cost proposition, with its exact caller." + ], + "scope_change_triggers": [ + "Replacing a quantified obligation with another finite smoke test.", + "Treating archive intake, an author PASS receipt or a finite composed fixture as discharge of the universal hypotheses." + ], + "overlap_terms": [ + "uniform transfer", + "all-size", + "precision", + "4100", + "unconditional-batched-crt" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Literal paid numeric-marker raw owner codecs, static dispatch into completed binary interchange, same-owner return and all29-role retirement/backing invoice.", + "scope_change_reason": "Explicit released caller-port handoff and director assignment; this is one raw CRT binary callee boundary, not the default #4100 complete theorem audit.", + "bottleneck_link": "Completed binary callee previously required encoded input ports supplied without a paid actual raw caller adapter.", + "budget_minutes": 60, + "stop_rule": "20minute gate requires real ABI, no host encoder/decoder or unpaid backing; do not expand into complete rotations/ROM/repair.", + "outcome": "completed", + "evidence": "PROOF.md, RESULT.json, FULL.json, independent interpreter and integrity controls", + "author": "JoyboyBrian with substantial OpenAI Codex assistance", + "ai_assistance": "Substantial OpenAI Codex assistance for proof/code/source analysis; separate AI peer review. No human/kernel verification.", + "open_questions": [ + { + "question": "Can the remaining actual raw rotations and current-y ROM calls be lowered and composed with this shuttle on one bank?", + "why_it_matters": "The twelve-call raw endpoint remains source-operation code outside this single call replacement.", + "first_step": "Select one existing literal rotation/ROM caller contract and account every port; do not rerun this interchange algorithm.", + "blocked_by": "Remaining rotation/ROM literal control, descriptor/ROM producer and full lifecycle." + }, + { + "question": "Can the complete five-symbol raw caller be uniformly binary-lowered with actual input production and global stock?", + "why_it_matters": "A binary child subalphabet inside a five-symbol caller is not a whole two-symbol system.", + "first_step": "Bind an explicit representation for the actual upstream raw/ROM producer and charge it.", + "blocked_by": "Upstream input and complete caller representation/stock." + } + ], + "coordination": { + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/4709#discussioncomment-19233740", + "coverage": "Root refreshed359openPR/4760Discussion/7402localnotes before claim; unpublished work excluded.", + "previous_claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/4709#discussioncomment-19173365", + "publication_refresh": { + "main": "721c03822c421b7f7fcbb2598993b947c4d88419", + "priority_revision": 8, + "selected_pr": 6030, + "checked_at": "2026-10-28T04:54:38Z", + "coverage": "341 open PR bodies, 5722 Discussion records, 8348 tracked local notes; complete pagination and tracked note inventory. No exact successor found; closed PRs, unpublished work and changes after the snapshot remain outside coverage.", + "source_compatibility": "Eight live scientific input hashes unchanged; original card and provenance pins retained.", + "validation_scope": "Fresh light normal/optimized and integrity checks; historical FULL.json preserved without local full-u replay." + } + }, + "invoice": { + "recursive_profile_changed": false, + "boundary": "No speedup/signed gain/kappa; complete local instruction and per-role backing invoices only." + } +} diff --git a/research/raw-crt-binary-shuttle-bridge/VALIDATION.md b/research/raw-crt-binary-shuttle-bridge/VALIDATION.md new file mode 100644 index 0000000000..4c683b438c --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/VALIDATION.md @@ -0,0 +1,39 @@ +# Exact validation scope + +## Preserved source-sized evidence (original session) + +Python3.12, standard library, macOS. Individual final commands passed; the +aggregate hook was not redundantly replayed. + +- Normal and optimized `verify.py`:24 small/history/basis calls, two literal interpreters,1,024,279 instructions including lifecycle, exact retained capacities and two semantic mutants. +- `test_integrity.py` under `-I -O -B`: Git-free light replay with no Git on PATH; missing/changed source and typed receipt substitution reject. +- `research_package.py --check-only`: final metadata/source pins PASS. +- `verify.py --full --write`: root-authorized actual u=(2,1,1024,12),196608 payload bits, 336273602 shuttle instructions, 3146057 retained cells including raw owner and both descriptor banks. Actual init/close costs281/389 are separately recorded. + +FULL.json is a source-sized normal replay, not an optimized/cold full rerun. +The source-sized t call and complete12-call raw word were not rerun; its tariff +and18-cell shared-history increment are source-bound theorem applications. +A separate AI reviewer checked alphabet renaming, codec/dispatch/ownership, +all29-role backing and tariffs and reran optimized light controls; no blocking +findings. This is not human or formal-kernel acceptance. Exact final commit, +proof hash, publication-byte/source-history and export/cold-light results are +bound in the external delivery record, avoiding a self-referential commit. + + +## Publication refresh (28 October 2026 UTC) + +The two original commits were cherry-picked onto canonical main +`721c03822c421b7f7fcbb2598993b947c4d88419`; all executable, proof and receipt +bytes and all eight scientific input hashes remain unchanged. The original +revision7 card and source pins are retained as historical provenance. + +Fresh Python3.12 normal and optimized light replays, optimized integrity +controls and package metadata checks passed. The final publication delivery +record separately binds its exact commit, source-history, committed-byte and +Git-free exported-light checks. Earlier external delivery records are historical +and are not evidence of these fresh checks. + +`FULL.json` remains the original actual-u receipt, not a new source-sized replay. +No local full-u, actual-t or twelve-call replay was run in this refresh. The +registered hook still includes `--full` with a180-second timeout; a hosted run +is a separate execution and its result must be read independently. diff --git a/research/raw-crt-binary-shuttle-bridge/VERIFY.json b/research/raw-crt-binary-shuttle-bridge/VERIFY.json new file mode 100644 index 0000000000..707a1c9b61 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/VERIFY.json @@ -0,0 +1,61 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/binary-elementary-interchange/README.md", + "research/binary-elementary-interchange/binary_machine.py", + "research/interchange-retained-backing/PROOF.md", + "research/literal-elementary-interchange/PROOF.md", + "research/literal-elementary-interchange/machine.py", + "research/literal-elementary-interchange/program.py", + "research/standalone-elementary-crt-raw/README.md", + "research/standalone-elementary-crt-raw/raw.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 30, + "checks": "Complete small basis/history cases, dual literal interpreters, retained capacities and semantic controls" + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 30, + "checks": "Optimized light proof controls and typed receipt" + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py", + "--full" + ], + "timeout_seconds": 180, + "checks": "Actual196608-bit raw u/back shuttle through literal binary callee and same-owner return" + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/test_integrity.py" + ], + "timeout_seconds": 30, + "checks": "Git-free optimized light replay and source/typed receipt rejection" + } + ] +} diff --git a/research/raw-crt-binary-shuttle-bridge/bridge.py b/research/raw-crt-binary-shuttle-bridge/bridge.py new file mode 100644 index 0000000000..b7b2284171 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/bridge.py @@ -0,0 +1,111 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Literal five-symbol caller; binary callee uses subalphabet {BLANK,ONE}. +JoyboyBrian with substantial OpenAI Codex assistance. No runtime codec callback. +""" +from sources import PROGRAM,BINARY,ACTUAL,need +ZERO,ONE,LEFT,RIGHT,BLANK=range(5) +RAW='RAW' +DESCRIPTORS=('H','A','G','S') +ROLES=(RAW,)+tuple(mode+'_'+r for mode in ('u','t') for r in DESCRIPTORS)+tuple('E_'+r for r in PROGRAM.ROLES) + +def assemble(geometry=None): + geometry=ACTUAL if geometry is None else geometry + need(set(geometry)=={'u','t'},'two fixed caller modes') + for g in geometry.values():need(len(g)==4 and all(type(x)is int for x in g) and g[0]>=0 and min(g[1:])>=1,'admitted fixed geometry') + source,source_entries=PROGRAM.assemble() + binary,child_entries=BINARY.lower(source,source_entries,PROGRAM.ROLES) + b=PROGRAM.Builder();entries={};checkpoints={} + def move(role,n): + for _ in range(abs(n)):b.move(role,1 if n>0 else -1) + def block(role,bits,empty=False): + for i,x in enumerate(bits): + if empty:b.require(role,BLANK) + b.write(role,ONE if x else BLANK) + if i<2:b.move(role,1) + move(role,-2) + def paired_rewind(raw,encoded): + loop,done=b.fresh(),b.fresh();b.mark(loop) + b.move(raw,-1);move(encoded,-3) + b.test(raw,LEFT,done,loop);b.mark(done) + b.move(raw,1);move(encoded,3) + def erase_origin(encoded): + move(encoded,-3);block(encoded,(0,0,0)) + def encode(raw,encoded,numeric): + block(encoded,BINARY.ENCODING[LEFT],True);move(encoded,3) + loop,z,o,end,other=b.fresh(),b.fresh(),b.fresh(),b.fresh(),b.fresh() + b.mark(loop);b.test(raw,ZERO,z,other);b.mark(other);b.test(raw,ONE,o,end) + for label,value in ((z,ZERO),(o,ONE)): + b.mark(label);block(encoded,BINARY.ENCODING[value],True);move(encoded,3);b.move(raw,1);b.jump(loop) + b.mark(end);b.require(raw,RIGHT if numeric else BLANK) + if numeric:block(encoded,BINARY.ENCODING[RIGHT],True) + paired_rewind(raw,encoded) + def read_block(role,targets): + def descend(prefix): + if len(prefix)==3: + move(role,-2);b.jump(targets.get(prefix,'reject'));return + z,o=b.fresh(),b.fresh();b.test(role,ONE,o,z) + for label,x in ((z,0),(o,1)): + b.mark(label) + if x==0:b.require(role,BLANK) + if len(prefix)<2:b.move(role,1) + descend(prefix+(x,)) + descend(()) + def decode_install(): + loop,z,o,end=b.fresh(),b.fresh(),b.fresh(),b.fresh();b.mark(loop) + read_block('E_SOURCE',{BINARY.ENCODING[ZERO]:z,BINARY.ENCODING[ONE]:o,BINARY.ENCODING[BLANK]:end}) + for label,value in ((z,ZERO),(o,ONE)): + b.mark(label);b.write(RAW,value);block('E_SOURCE',(0,0,0));move('E_SOURCE',3);b.move(RAW,1);b.jump(loop) + b.mark(end);b.require(RAW,BLANK);paired_rewind(RAW,'E_SOURCE');erase_origin('E_SOURCE') + def retire_descriptor(raw,encoded): + loop,end,body=b.fresh(),b.fresh(),b.fresh();b.mark(loop) + b.test(raw,RIGHT,end,body);b.mark(body);block(encoded,(0,0,0));move(encoded,3);b.move(raw,1);b.jump(loop) + b.mark(end);block(encoded,(0,0,0));paired_rewind(raw,encoded);erase_origin(encoded) + # Paid production of both actual descriptor banks; no fixture conversion. + entries['init_descriptors']=len(b.code) + for mode,g in geometry.items(): + for name,value in zip(DESCRIPTORS,g): + role=mode+'_'+name;b.require(role,BLANK);b.write(role,LEFT);b.move(role,1) + for i in range(max(1,value.bit_length())): + b.require(role,BLANK);b.write(role,(value>>i)&1);b.move(role,1) + b.require(role,BLANK);b.write(role,RIGHT);b.rewind(role) + b.emit('halt','initialized') + for mode in ('u','t'): + entries[mode]=len(b.code) + encode(RAW,'E_SOURCE',False) + for name in DESCRIPTORS:encode(mode+'_'+name,'E_'+name,True) + # Establish exact block-aligned blank initial private banks, also charged. + for name in PROGRAM.PRIVATE:block('E_'+name,(0,0,0),True) + b.jump((mode,'child',child_entries['init'])) + continuations={'initialized':(mode,'child',child_entries['run']), + 'returned':(mode,'child',child_entries['install']), + 'installed':(mode,'child',child_entries['close']), + 'closed':(mode,'decode')} + for pc,row in enumerate(binary): + b.mark((mode,'child',pc));op=row[0] + if op=='test':b.test('E_'+row[1],ONE if row[2] else BLANK,(mode,'child',row[3]),(mode,'child',row[4])) + elif op=='write':b.write('E_'+row[1],ONE if row[2] else BLANK) + elif op=='move':b.move('E_'+row[1],row[2]) + elif op=='jump':b.jump((mode,'child',row[1])) + elif row[1] in continuations:b.jump(continuations[row[1]]) + else:b.jump('reject') + b.mark((mode,'decode'));decode_install() + for name in DESCRIPTORS:retire_descriptor(mode+'_'+name,'E_'+name) + for name in PROGRAM.PRIVATE:move('E_'+name,-3) + b.emit('halt','returned') + checkpoints[mode]={name:b.labels[(mode,'child',pc)] for name,pc in child_entries.items()} + entries['close_descriptors']=len(b.code) + for mode in ('u','t'): + for name in DESCRIPTORS: + role=mode+'_'+name;b.clear(role);b.move(role,-1);b.require(role,LEFT);b.write(role,BLANK) + b.emit('halt','closed');b.mark('reject');b.emit('halt','rejected') + code=b.finish();factor=BINARY.admit(code,entries,ROLES,range(5)) + return code,entries,checkpoints,factor + +def capacities(g): + """Proof/fixture ledger only; never called by the literal machine.""" + H,A,G,S=g;V=A*4**H*G*S;bits=lambda n:max(1,n.bit_length());d=max(H-1,0) + c={'PRE':bits(A)+d+2,'GAP':bits(G)+d+2,'TAIL':bits(S)+d+2,'SCAN':bits(H)+2,'REMAIN':bits(H)+2} + c.update({name:bits(n)+H+1 if H else 1 for name,n in [('OUTER',A),('BETWEEN',G),('BITS',S)]}) + c.update({name:V//4+1 if H else 1 for name in ('Q00','Q01','Q10','Q11')}) + c.update(B0=V+1 if H else 1,B1=V+1 if H>=2 else 1,OUTPUT=V+1) + return {'E_'+name:3*n for name,n in c.items()}|{'E_SOURCE':3*(V+1)}|{'E_'+name:3*(bits(n)+2) for name,n in zip(DESCRIPTORS,g)} diff --git a/research/raw-crt-binary-shuttle-bridge/independent.py b/research/raw-crt-binary-shuttle-bridge/independent.py new file mode 100644 index 0000000000..1057088215 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/independent.py @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Separately written sparse interpreter; retains allocation lengths explicitly.""" +def execute(code,initial,entry,cap): + cells={r:{i:x for i,x in enumerate(a) if x!=4} for r,(a,h) in initial.items()} + lengths={r:len(a) for r,(a,h) in initial.items()};heads={r:h for r,(a,h) in initial.items()} + pc=entry;counts=dict(steps=0,reads=0,writes=0,moves=0) + for _ in range(cap): + instruction=code[pc];op=instruction[0];counts['steps']+=1 + if op=='halt':return cells,lengths,heads,dict(counts,status=instruction[1]) + if op=='jump':pc=instruction[1];continue + role=instruction[1];at=heads[role] + if op=='test': + counts['reads']+=1 + pc=instruction[3] if cells[role].get(at,4)==instruction[2] else instruction[4] + continue + if op=='move': + heads[role]+=instruction[2];counts['moves']+=1 + if heads[role]<0:raise ValueError('negative independent head') + elif op=='write': + counts['writes']+=1;lengths[role]=max(lengths[role],at+1) + if instruction[2]==4:cells[role].pop(at,None) + else:cells[role][at]=instruction[2] + else:raise ValueError('unknown independent instruction') + pc+=1 + raise ValueError('independent watchdog') diff --git a/research/raw-crt-binary-shuttle-bridge/sources.py b/research/raw-crt-binary-shuttle-bridge/sources.py new file mode 100644 index 0000000000..02ffa19da7 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/sources.py @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Authenticated source bytes and exact Raw descriptor constants.""" +import ast +import builtins +import hashlib +import json +from pathlib import Path +import types +HERE=Path(__file__).resolve().parent +ROOT=HERE.parents[1] + +def need(ok,why): + if not ok:raise ValueError(why) + +def authenticate(): + values={} + for row in json.loads((HERE/'SOURCES.json').read_text())['files']: + if row['usage']=='input': + raw=(ROOT/row['path']).read_bytes() + need(hashlib.sha256(raw).hexdigest()==row['sha256'],'source changed: '+row['path']) + values[row['path']]=raw + return values + +def load(): + raw=authenticate();prefix='research/literal-elementary-interchange/' + program=types.ModuleType('retained_program') + exec(compile(raw[prefix+'program.py'],'','exec'),program.__dict__) + machine=types.ModuleType('retained_machine') + def imports(name,*a,**k): + need(name=='program','declared machine import');return program + machine.__dict__['__builtins__']=dict(vars(builtins),__import__=imports) + exec(compile(raw[prefix+'machine.py'],'','exec'),machine.__dict__) + binary=types.ModuleType('retained_binary') + exec(compile(raw['research/binary-elementary-interchange/binary_machine.py'],'','exec'),binary.__dict__) + tree=ast.parse(raw['research/standalone-elementary-crt-raw/raw.py']) + cls=next(n for n in tree.body if isinstance(n,ast.ClassDef) and n.name=='Raw') + init=next(n for n in cls.body if isinstance(n,ast.FunctionDef) and n.name=='__init__') + geometry={} + for node in init.body: + if isinstance(node,ast.Assign) and isinstance(node.targets[0],ast.Attribute) and node.targets[0].attr in ('u','t'): + geometry[node.targets[0].attr]=ast.literal_eval(node.value.args[0].generators[0].iter) + need(geometry=={'u':(2,1,1024,12),'t':(2,4,256,12)},'actual source shuttle geometries') + return program,machine,binary,geometry +PROGRAM,MACHINE,BINARY,ACTUAL=load() diff --git a/research/raw-crt-binary-shuttle-bridge/test_integrity.py b/research/raw-crt-binary-shuttle-bridge/test_integrity.py new file mode 100644 index 0000000000..61c4383166 --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/test_integrity.py @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 +import json,os,shutil,subprocess,sys,tempfile +from pathlib import Path +HERE=Path(__file__).resolve().parent;ROOT=HERE.parents[1];PACKAGE=HERE.relative_to(ROOT) +def need(ok,why): + if not ok:raise ValueError(why) +def main(): + with tempfile.TemporaryDirectory(prefix='raw-binary-cold-') as directory: + root=Path(directory);out=root/PACKAGE + shutil.copytree(HERE,out,ignore=shutil.ignore_patterns('__pycache__','*.pyc')) + for row in json.loads((HERE/'SOURCES.json').read_text())['files']: + if row['usage']=='input': + target=root/row['path'];target.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(ROOT/row['path'],target) + env=dict(os.environ,PATH=str(root/'no-git')) + def run(expect,marker): + result=subprocess.run([sys.executable,'-I','-O','-B',str(out/'verify.py')],cwd=root,env=env,capture_output=True,text=True,timeout=25) + need((result.returncode==0)==expect and marker in result.stdout+result.stderr,'CLI control '+marker) + run(True,'PASS_RAW_BINARY_SHUTTLE_BRIDGE') + target=root/'research/binary-elementary-interchange/binary_machine.py';raw=target.read_bytes();target.unlink() + run(False,'FileNotFoundError');target.write_bytes(raw+b'\n# changed input\n');run(False,'source changed');target.write_bytes(raw) + receipt=out/'RESULT.json';value=json.loads(receipt.read_text());value['actual_bank_invoice']['caller_descriptors']=True;receipt.write_text(json.dumps(value)) + run(False,'typed receipt') + print('PASS_RAW_BINARY_INTEGRITY Git-free light replay, missing/changed source and typed receipt') +if __name__=='__main__':main() diff --git a/research/raw-crt-binary-shuttle-bridge/verify.py b/research/raw-crt-binary-shuttle-bridge/verify.py new file mode 100644 index 0000000000..9a8c99e9dc --- /dev/null +++ b/research/raw-crt-binary-shuttle-bridge/verify.py @@ -0,0 +1,92 @@ +# SPDX-License-Identifier: Apache-2.0 +import sys,json,random,hashlib,argparse +from pathlib import Path +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from sources import MACHINE,ACTUAL,PROGRAM,need,authenticate +from independent import execute as independent_execute +from bridge import assemble,capacities,ROLES,RAW,DESCRIPTORS,BLANK,LEFT + +def canonical(x):return json.dumps(x,sort_keys=True,separators=(',',':')) +def oracle(payload,g): + H,A,G,S=g;Q=1<>i)&1 for i in range(max(1,value.bit_length()))]+[3]) + need(bytes(tapes[mode+'_'+name])==expected and heads[mode+'_'+name]==1,'exact raw descriptor source constants') + descriptors={r:(bytes(tapes[r]),heads[r]) for r in ROLES if r.startswith(('u_','t_'))} + for call_index,mode in enumerate(modes): + g=geometry[mode];H,A,G,S=g;V=A*4**H*G*S + payload=payloads[call_index] if payloads is not None else [rng.randrange(2) for _ in range(V)] + need(len(payload)==V,'complete supplied raw payload') + # External raw payload is supplied. This observer loading is not a codec. + target=tapes[RAW] + incoming=bytes([LEFT]+payload) + if len(target)max(sum(cap_u.values()),sum(cap_t.values())),'max-of-totals falsifier') + result['actual_bank_invoice']={'owned_u':sum(cap_u.values()),'owned_t':sum(cap_t.values()),'owned_history_ut':sum(max(cap_u[r],cap_t[r]) for r in cap_u),'borrowed_raw_payload':196609,'caller_descriptors':52} + if args.full:result={'status':'PASS_ACTUAL_RAW_BINARY_SHUTTLE','case':run_history(ACTUAL,['u'])} + path=HERE/('FULL.json' if args.full else 'RESULT.json') + if args.write:need(not path.exists(),'new receipt only');path.write_text(json.dumps(result,indent=2,sort_keys=True)+'\n') + else:need(canonical(result)==canonical(json.loads(path.read_text())),'typed receipt') + authenticate();print(canonical(result)) +if __name__=='__main__':main()