From 3a27ab1d302d13b1ce52411f8a174e7a32baab77 Mon Sep 17 00:00:00 2001 From: Jerry Jiaheng Chen <80299683+CubeJerry@users.noreply.github.com> Date: Fri, 13 Nov 2026 19:03:50 +1100 Subject: [PATCH 1/3] Implement selected MOVE24472 with literal factor composition and paid public commit --- .../ENVIRONMENT.json | 35 ++ .../literal-selected-move-join/FREEZE.json | 195 ++++++ research/literal-selected-move-join/NOTES.md | 5 + research/literal-selected-move-join/NOTICE.md | 47 ++ .../literal-selected-move-join/OVERLAP.md | 43 ++ .../PR-DESCRIPTION.md | 83 +++ .../literal-selected-move-join/PR-TITLE.txt | 1 + research/literal-selected-move-join/PROOF.md | 283 +++++++++ research/literal-selected-move-join/README.md | 94 +++ .../literal-selected-move-join/RESULT.json | 400 +++++++++++++ .../SOURCE-BINDING.json | 14 + .../literal-selected-move-join/SOURCES.json | 161 +++++ .../literal-selected-move-join/VERIFY.json | 14 + .../literal-selected-move-join/bind_source.py | 88 +++ research/literal-selected-move-join/move.py | 148 +++++ .../reference/RECIPE.json | 130 ++++ .../reference/SOURCE-FRAMES.json | 16 + .../reference/leaf/NOTICE.md | 34 ++ .../leaf/inputs/controller_reference.py | 112 ++++ .../reference/leaf/leaf.py | 564 ++++++++++++++++++ .../reference/linear/NOTICE.md | 36 ++ .../linear/inputs/controller_reference.py | 112 ++++ .../reference/linear/linear.py | 435 ++++++++++++++ .../reference/phase/NOTICE | 11 + .../phase/inputs/controller_reference.py | 112 ++++ .../reference/phase/phase.py | 335 +++++++++++ .../reference/source/clifford_exact.py | 149 +++++ .../reference/source/native_verify.py | 277 +++++++++ .../reference/translation/NOTICE.md | 20 + .../reference/inputs/controller_reference.py | 112 ++++ .../translation/reference/reverse.py | 207 +++++++ .../reference/translation/translate.py | 221 +++++++ .../review/AUTHOR-REPLAY.json | 400 +++++++++++++ .../review/RESULT.json | 139 +++++ .../review/REVIEW.md | 53 ++ .../review/SOURCE-BINDING.json | 14 + .../review/check_join.py | 71 +++ research/literal-selected-move-join/verify.py | 316 ++++++++++ 38 files changed, 5487 insertions(+) create mode 100644 research/literal-selected-move-join/ENVIRONMENT.json create mode 100644 research/literal-selected-move-join/FREEZE.json create mode 100644 research/literal-selected-move-join/NOTES.md create mode 100644 research/literal-selected-move-join/NOTICE.md create mode 100644 research/literal-selected-move-join/OVERLAP.md create mode 100644 research/literal-selected-move-join/PR-DESCRIPTION.md create mode 100644 research/literal-selected-move-join/PR-TITLE.txt create mode 100644 research/literal-selected-move-join/PROOF.md create mode 100644 research/literal-selected-move-join/README.md create mode 100644 research/literal-selected-move-join/RESULT.json create mode 100644 research/literal-selected-move-join/SOURCE-BINDING.json create mode 100644 research/literal-selected-move-join/SOURCES.json create mode 100644 research/literal-selected-move-join/VERIFY.json create mode 100644 research/literal-selected-move-join/bind_source.py create mode 100644 research/literal-selected-move-join/move.py create mode 100644 research/literal-selected-move-join/reference/RECIPE.json create mode 100644 research/literal-selected-move-join/reference/SOURCE-FRAMES.json create mode 100644 research/literal-selected-move-join/reference/leaf/NOTICE.md create mode 100644 research/literal-selected-move-join/reference/leaf/inputs/controller_reference.py create mode 100644 research/literal-selected-move-join/reference/leaf/leaf.py create mode 100644 research/literal-selected-move-join/reference/linear/NOTICE.md create mode 100644 research/literal-selected-move-join/reference/linear/inputs/controller_reference.py create mode 100644 research/literal-selected-move-join/reference/linear/linear.py create mode 100644 research/literal-selected-move-join/reference/phase/NOTICE create mode 100644 research/literal-selected-move-join/reference/phase/inputs/controller_reference.py create mode 100644 research/literal-selected-move-join/reference/phase/phase.py create mode 100644 research/literal-selected-move-join/reference/source/clifford_exact.py create mode 100644 research/literal-selected-move-join/reference/source/native_verify.py create mode 100644 research/literal-selected-move-join/reference/translation/NOTICE.md create mode 100644 research/literal-selected-move-join/reference/translation/reference/inputs/controller_reference.py create mode 100644 research/literal-selected-move-join/reference/translation/reference/reverse.py create mode 100644 research/literal-selected-move-join/reference/translation/translate.py create mode 100644 research/literal-selected-move-join/review/AUTHOR-REPLAY.json create mode 100644 research/literal-selected-move-join/review/RESULT.json create mode 100644 research/literal-selected-move-join/review/REVIEW.md create mode 100644 research/literal-selected-move-join/review/SOURCE-BINDING.json create mode 100644 research/literal-selected-move-join/review/check_join.py create mode 100644 research/literal-selected-move-join/verify.py diff --git a/research/literal-selected-move-join/ENVIRONMENT.json b/research/literal-selected-move-join/ENVIRONMENT.json new file mode 100644 index 0000000000..494d1db31c --- /dev/null +++ b/research/literal-selected-move-join/ENVIRONMENT.json @@ -0,0 +1,35 @@ +{ + "python": "3.12.14 (main, Aug 25 2026, 14:00:49) [Clang 22.1.3 ]", + "platform": "Linux-6.18.57-x86_64-with-glibc2.41", + "checks": [ + { + "mode": "normal", + "command": [ + "/opt/codex/runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "/workspace/scratch/92c9920affc2/worker-a/research/literal-selected-move-join/verify.py" + ], + "seconds": 20.231750348997593, + "marker": "PASS_LITERAL_SELECTED_MOVE_JOIN", + "matches_frozen_result": true + }, + { + "mode": "optimized", + "command": [ + "/opt/codex/runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-W", + "error", + "-B", + "/workspace/scratch/92c9920affc2/worker-a/research/literal-selected-move-join/verify.py" + ], + "seconds": 16.437340857999516, + "marker": "PASS_LITERAL_SELECTED_MOVE_JOIN", + "matches_frozen_result": true + } + ] +} diff --git a/research/literal-selected-move-join/FREEZE.json b/research/literal-selected-move-join/FREEZE.json new file mode 100644 index 0000000000..3fae950b2c --- /dev/null +++ b/research/literal-selected-move-join/FREEZE.json @@ -0,0 +1,195 @@ +{ + "stage": "wave-1 core verified and independently reviewed; no wave-2 extension included", + "graph_sha256": "14f38b15157a9c9cd2828861f6904701a29b1e27507a7e43d60030e1ae4d9238", + "core_frozen": [ + "move.py", + "verify.py" + ], + "files": [ + { + "path": "ENVIRONMENT.json", + "bytes": 1020, + "sha256": "edda53850c6b32f7831c8d822cd1c6b8df5ec3ac9872a6b0d2a8b1d737b259ef" + }, + { + "path": "NOTES.md", + "bytes": 976, + "sha256": "1bf9d3ddf9a518255ee0f7440e92a947e4dd78bbe30c25284b1c2b51d312f444" + }, + { + "path": "NOTICE.md", + "bytes": 2852, + "sha256": "7271c647d2d1e7f0f3ef80a6923ff194247eec1a4d8fd7dee4be626310e2026a" + }, + { + "path": "OVERLAP.md", + "bytes": 2629, + "sha256": "b49b99d1a1627b55f44496fd7040a3ffdabbad9eb3b16f605a1231b20d038c6b" + }, + { + "path": "PR-DESCRIPTION.md", + "bytes": 4604, + "sha256": "4b09e90fd9403cd88c3b94bc87f371f3ee3875ddbbba93cbdb0a864dd8b29ee3" + }, + { + "path": "PR-TITLE.txt", + "bytes": 101, + "sha256": "7d8c1af58a51f538568733e4d8f95b9e9a7fc8818c9672626fbe6928463d5970" + }, + { + "path": "PROOF.md", + "bytes": 16091, + "sha256": "aa7897029c9761fdf96c3336ab37c2827f08b0df29c868e3b2257ecc661ac7b6" + }, + { + "path": "README.md", + "bytes": 5159, + "sha256": "d58ea57cd74c904e3e629871b7cebb2e17d96e2e9ba2d75b764a02d3b35c9875" + }, + { + "path": "RESULT.json", + "bytes": 5595, + "sha256": "64494621fdfc0811651a28ef45a8bdfa951910a3e7377a26d8c7cd6df9818f63" + }, + { + "path": "SOURCE-BINDING.json", + "bytes": 237, + "sha256": "5598ca91f7bd6992d71a0c3a5a18f3f49bca8a9b4256568bbc400ed415908be5" + }, + { + "path": "SOURCES.json", + "bytes": 7341, + "sha256": "26d0ef51dda5fa599381f7f31dec4ba3a37f14f63ff9055ad1661dec2d02610c" + }, + { + "path": "VERIFY.json", + "bytes": 704, + "sha256": "361c7659873e019f2c6c5c84222dfae6794a46dce1fb1ae20a1bafe46b3e3542" + }, + { + "path": "bind_source.py", + "bytes": 4281, + "sha256": "5b75ebfea1563a8525438a03262900b1ecbfdd762d5d1aaced3faddfa3b23a8c" + }, + { + "path": "move.py", + "bytes": 5497, + "sha256": "42e4293ab59ffa1c99e0dbbd5fded0833a5d726e1e794f0f263ae9a4686587a5" + }, + { + "path": "reference/RECIPE.json", + "bytes": 1798, + "sha256": "96fadb44c3316be93c6c02f50cd2c841a9541d67b98fd94fc47b73fa64dd404c" + }, + { + "path": "reference/SOURCE-FRAMES.json", + "bytes": 151, + "sha256": "58f784587d1f21d6aaa1f6a14932779ff1f24d232496b042240e832939c9010d" + }, + { + "path": "reference/leaf/NOTICE.md", + "bytes": 1900, + "sha256": "773921ac301cf7e37de97ed8a0066e6bbb69ec1150cc2b5f74a12cb20103f3cf" + }, + { + "path": "reference/leaf/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "reference/leaf/leaf.py", + "bytes": 17526, + "sha256": "bb46c1a55f1119957a52cd61f2cd957f3f7ad1e9b818c54a852bde09a0773744" + }, + { + "path": "reference/linear/NOTICE.md", + "bytes": 2180, + "sha256": "2ac2051c0fbedfd9d11348493456bf479dbdd3104a4e106c8bf36251a72b6a50" + }, + { + "path": "reference/linear/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "reference/linear/linear.py", + "bytes": 13102, + "sha256": "d56704082b82e37d4a360b8aad7e0af63499f4160c6bbcfd338804453c46fa33" + }, + { + "path": "reference/phase/NOTICE", + "bytes": 808, + "sha256": "5654eeb7fdc1acd6a6d246ef87b1155812efdcd0949f54be78e048fe905fbae0" + }, + { + "path": "reference/phase/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "reference/phase/phase.py", + "bytes": 11734, + "sha256": "2be149aa1be504509bb480f85396f0be302082d638e81422f747daee5a3c1ce7" + }, + { + "path": "reference/source/clifford_exact.py", + "bytes": 6824, + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + { + "path": "reference/source/native_verify.py", + "bytes": 12323, + "sha256": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38" + }, + { + "path": "reference/translation/NOTICE.md", + "bytes": 1201, + "sha256": "24f5e9957fcd8f6cfdc021ff5bc91bf89e50587997e2a2cb18053949c0e0d205" + }, + { + "path": "reference/translation/reference/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "reference/translation/reference/reverse.py", + "bytes": 6649, + "sha256": "4b516d85baf3303db809bc1174394009b1fc71a8f7d17fb6c729ec8bb6aba245" + }, + { + "path": "reference/translation/translate.py", + "bytes": 7703, + "sha256": "e2750fef8c2b9c8019d67285df3ca0d04340cd241782c7845665b7de621ca3bd" + }, + { + "path": "review/AUTHOR-REPLAY.json", + "bytes": 5595, + "sha256": "64494621fdfc0811651a28ef45a8bdfa951910a3e7377a26d8c7cd6df9818f63" + }, + { + "path": "review/RESULT.json", + "bytes": 2200, + "sha256": "8d7a6151840b4935144161f6436c61396c82a54bfe49067f5771be49ce7d6a7a" + }, + { + "path": "review/REVIEW.md", + "bytes": 2825, + "sha256": "d58de92549aca453ba842c1baaf43111b41c1005b885e503046936f0e52c4427" + }, + { + "path": "review/SOURCE-BINDING.json", + "bytes": 237, + "sha256": "5598ca91f7bd6992d71a0c3a5a18f3f49bca8a9b4256568bbc400ed415908be5" + }, + { + "path": "review/check_join.py", + "bytes": 4383, + "sha256": "7a8c41ac983902efa14cf0604269e87018399fc2abdd86fbfbba913a53788b33" + }, + { + "path": "verify.py", + "bytes": 12622, + "sha256": "372eaf92353add7b7ce9a9513469408a341176aef749bcf3b0f60918c90630ca" + } + ] +} diff --git a/research/literal-selected-move-join/NOTES.md b/research/literal-selected-move-join/NOTES.md new file mode 100644 index 0000000000..ac19330dae --- /dev/null +++ b/research/literal-selected-move-join/NOTES.md @@ -0,0 +1,5 @@ +Claim checkpoint: compose exact selected MOVE24472 on the supplied six-Gamma packed ABI by literal table concatenation, with one private whole-call bank and one trace. No old-codec/strided caller producer, global precision, recursive speedup, or native_all_columns discharge. Selected kappa remains conditional. + +The four pinned source modules share HEADER=0, DATA=1 and clean private tails on successful return. Left phase is a construction-time specialization (2,0,0,0,0,0,0,0,0), zero quadratic rows, constant zero. Source order is right phase, right G, offset, positive C tensor, left phase, left G. + +Whole-call source clone prevents earlier factor commits from changing the public owner on a later arithmetic rejection. Failure cleanup/retry remains unclaimed. Sufficient admission: w>=2, f<=cutoff, source components divisible by 2^f and bounded in absolute value by M with 2^f M <=2^(w-1)-1. This deliberately loose reserve gives integral and symmetric-range prefixes. diff --git a/research/literal-selected-move-join/NOTICE.md b/research/literal-selected-move-join/NOTICE.md new file mode 100644 index 0000000000..0a756baa4d --- /dev/null +++ b/research/literal-selected-move-join/NOTICE.md @@ -0,0 +1,47 @@ +# Attribution and license + +Apache-2.0, following the source project. The new fixed-table composition, +whole-call transaction, composition proof, direct inverse-address kernel +oracle, compact source-extraction check and research documentation were +prepared for the integer-multiplication research project with substantial +OpenAI Codex assistance. Independent human and formal proof-kernel acceptance +are not claimed. + +The unchanged small retained sources are CubeJerry / Jerry Chen's proposals: + +* #7430, `39b40c465f7636a4bb6d70af28595fe8f70f4f3f`: both literal binary + maps, exact CNOT words, all-column geometry and complete lifecycle/cost. +* #7426, `172f4535ce8dcff79f626410af845f757c1563be`: literal Gaussian phase, + generic fixed phase compiler, Gamma ABI, recipe and machine source; + the credited exact Clifford compiler and independent Gaussian interpreter + are retained from this same package for source binding. +* #7428, `1dbdaa414cfe4a4a0f015e88a04b52e146566786`: literal translation + descriptor producer and complete source translation. +* #7429, `1a555e469b89af70d309bc966f8f813ac11dc887`: literal positive C + tensor leaf, signed arithmetic and prefix/range guards. +* #7427, `7662d01d827c95d90032579c168cae78aa531f2f`: literal row reversal, + retained transitively and unchanged by #7428. + +Their original notices are retained beside each module. They credit Ali +Romman/#5375 for incremental multicounter phases and the native/P104 lineage; +Jose Manuel Barranco/#3091 and alejandrozu for the C tensor, reserve and +physical-axis methods; #6967 for the distinct old coded leaf; the source +#7000 authors DreamingOfClouds, Ali Romman, Cinna Davis, zxv, unpaidmoon, +icekylinx and earlier native/Gaussian contributors; #7349 and the literal +phase/egress work for the fixed machine, Gamma acquisition and owner staging; +and #3834/#5188/#6992 and the physical affine/shear lineage for the maps. +All additional retained predecessor NOTICE attributions remain effective. + +Classical Gaussian elimination, tensor-product algebra, two-stack reversal, +Gamma coding, finite-state signed arithmetic, table relocation and staged +commit methods are credited prior methods, not new mathematical inventions. +The selected all-column algebra and `i^(phase*f)` convention were already +established, including the selected-native-tensor-closure lineage and its +#5442/#5974/#6043/#6293/#6331/#6635/#6878 predecessors. The new claim is the +source-specific literal physical join on an explicit supplied boundary. + +Nick Petalas's #7462 CNOT cancellation, #7468 sharp endpoint-prefix scale, +and #7477 reversal rejection cleanup are related open follow-ups. Their +results are not installed by this package, and no competing improvement +over their exact objects is asserted. Source proposals remain open; +this package does not represent canonical scientific admission. diff --git a/research/literal-selected-move-join/OVERLAP.md b/research/literal-selected-move-join/OVERLAP.md new file mode 100644 index 0000000000..1002240ff2 --- /dev/null +++ b/research/literal-selected-move-join/OVERLAP.md @@ -0,0 +1,43 @@ +# Scope and overlap checkpoint + +The assignment was the exact physical join from the recent literal modules +to one complete source-selected native MOVE, not another local monomial +identity, C scalar identity, algebraic all-width theorem or kappa search. +The stop test was the first failed literal interface implication. The shared +five/six-code ABI and clean-success contracts permit the join, with an +explicit prefix/range predicate and a supplied packed entry. + +Canonical main was pinned to +`e54523517d0f03e58352e647c403a5af3e525a57`. The root coordinator checked +#1163/#1166 Discussion guidance and supplied exact predecessor heads. No +Discussion write capability was available; this checkpoint and the root's +swarm manifest are local-only evidence. This worker posted no claim or PR. + +On 2026-11-13, the public GitHub pulls endpoint +`https://api.github.com/repos/CrocSwap/integer-mult-bounds/pulls?state=open&sort=created&direction=desc&per_page=40` +was inspected. Its 40 latest open proposals through #7480 were reduced to +metadata and checked for this exact MOVE/composition. The root also retained +the latest 50 public proposals plus account-specific recent proposals. +This is bounded coverage, not all old bodies, unpublished branches or diffs. + +Relevant newer proposals were read at these exact heads: + +| PR | Head | Relationship | +|---|---|---| +| #7462 | `060749f4000e71dba9b1cfcc12a6b91c887e2cb3` | two fewer left CNOTs; no updated literal graph or complete MOVE | +| #7468 | `8b0dd714d30e9c1574387587eb6418ae99ac34e1` | sharp endpoint-prefix scale; physical conversion/range/owner costs open | +| #7471 | `d3220b9d9c3748e560e23768556b095217ffb21a` | rounded affine-lattice hull; no physical source caller or complete MOVE | +| #7477 | `4fffa69c79ead4eb92e862daec4015b05c12d622` | reversal rejection retirement; does not transform #7428 or a complete join | + +The source modules themselves name complete MOVE composition as open. +Canonical `research/selected-native-tensor-closure/README.md` was read for +prior selected #6030 all-column algebra and complete-caller scope; it leaves +physical dispatcher/owned reset separate. The selected #7000 review already +applies all-f algebra. Neither is claimed new here. No newer exact complete +literal MOVE was visible in this inspected coverage. This is a scoped +novelty assessment, not proof of universal novelty. + +No new kappa, frontier change, recursive-rate invoice or foundational +assumption discharge is asserted. The stronger endpoint-scale physical +wrapper is separate follow-up; the present join retains exact prefix/range +conditions and proves a sufficient all-f reserve. diff --git a/research/literal-selected-move-join/PR-DESCRIPTION.md b/research/literal-selected-move-join/PR-DESCRIPTION.md new file mode 100644 index 0000000000..834ccd9b04 --- /dev/null +++ b/research/literal-selected-move-join/PR-DESCRIPTION.md @@ -0,0 +1,83 @@ +The selected MOVE24472 previously had literal phase, binary-map, translation +and positive C-child programs on compatible supplied packed interfaces, but +no emitted complete physical join. This adds one 82,813-location, 31-tape +local-symbol graph that executes all six factors in exact source order, +including the left phase and repeated right constant `i^f`. + +The original owner is cloned once into a distinct whole-call bank. Every +component commit remains private; only the completed MOVE reaches public +DATA. Successful calls restore every head, private body/guard and opaque +exterior, and finite component rejection preserves public DATA/HEADER +values even after earlier factors completed privately. Failure cleanup/retry +is intentionally outside this contract. + +The theorem covers every positive f on the supplied complete +`[P] x [2^f]^9 x [S]` array with r Gaussian coefficients, signed MSB width w, +six Gamma parameters and `f<=cutoff`. It retains the explicit C-prefix +integrality/range predicate and proves the sufficient all-f reserve: +input numerators divisible by `2^f`, component magnitude <=M, and +`2^f M<=2^(w-1)-1`. No scale/grid/width conversion is assumed free. + +The complete direct bound is `T<=2^24(fV+E+1)` and historical backing is +`K_final<=K_entry+1024(V+E+1)`, with `V=2PSr2^(9f)w` and E the actual +six-code length. New wrapper cost is exactly `31V+27`; PROOF.md section 6 +derives the total from unchanged predecessor complete bills. Descriptor +creation, signed arithmetic, every column/axis, staging, return, reset, +erasure and retained history are included. This is a direct compiler +base-case reference, not an inherited recursive `f^sigma` tariff. + +Exact source dependencies are CubeJerry #7430 at +`39b40c465f7636a4bb6d70af28595fe8f70f4f3f`, #7426 at +`172f4535ce8dcff79f626410af845f757c1563be`, #7428 at +`1dbdaa414cfe4a4a0f015e88a04b52e146566786`, and #7429 at +`1a555e469b89af70d309bc966f8f813ac11dc887`, with #7427 reversal retained +transitively. Sixteen unchanged small source files and notices are pinned by +commit:path/blob/bytes/SHA256. The source archive was authenticated and +event 24472/frames []->[239] re-extracted; only its 151-byte frame witness +is retained. The exact compiler and retained independent Gaussian engine +reproduce the recipe and all 512 complete source columns. + +Validation is stdlib-only. Warning-strict normal and optimized replays +match RESULT.json. A full nonzero actual m=9,f=1 packet matches a direct +inverse-address Gaussian kernel oracle in 14,429,950 local transitions; +shorter same-owner reuse with a 258-bit cutoff value succeeds in 7,499,800. +A nonintegral child rejection after three completed factors preserves both +public owners with zero public writes. Four actual whole-table mutants +detect missing absolute phase, swapped right order, omitted offset and +corrupt commit. All one/two-column binary addresses and 1,025 three-column +addresses are checked. No full joined f=2 tape run is claimed. + +From the package directory: + +```sh +python3 -I -W error -B bind_source.py +python3 -I -W error -B verify.py +python3 -I -O -W error -B verify.py +``` + +Related #7462/#7468/#7477 improve separate sublemmas and are credited, not +installed. The selected all-column algebra is prior work. The new result is +the physical fixed-table transaction and join on one exact source boundary. +The bounded live overlap coverage is documented in OVERLAP.md. + +Still open: selected caller packing/old-codec and owner/transport producer; +common-grid, signed reserve and cutoff admission; faster nonleaf work and +recursive invoice; global stock/owned reset, compiler, precision and analytic +recovery. All five selected assumptions remain. No new kappa, supplier +admission, selected-frontier change, catalogue/cold replay, hosted CI, +independent human review or formal proof-kernel acceptance is claimed. + +The change is an isolated research package with reversible local files. +Shared code, frozen predecessors, upstream files and selected records are +unchanged. Prepared with substantial OpenAI Codex assistance; exact notices +and prior mathematical attribution are preserved. + +## Independent orchestration check + +A separate exact-integer forward-address oracle and instruction-by-instruction +relocation review passed on a new full f=1 packet; see `review/REVIEW.md` and +`review/RESULT.json`. This is independent reasoning and an independent algebra +oracle within an AI-assisted run, not independent human review. + +Credit: @CubeJerry for the predecessor literal programs and project research; +all exact source notices and originating PR references are retained. diff --git a/research/literal-selected-move-join/PR-TITLE.txt b/research/literal-selected-move-join/PR-TITLE.txt new file mode 100644 index 0000000000..29e8ce0435 --- /dev/null +++ b/research/literal-selected-move-join/PR-TITLE.txt @@ -0,0 +1 @@ +Implement the selected MOVE24472 as a literal fixed-tape program with paid transactional composition diff --git a/research/literal-selected-move-join/PROOF.md b/research/literal-selected-move-join/PROOF.md new file mode 100644 index 0000000000..8cdce2234c --- /dev/null +++ b/research/literal-selected-move-join/PROOF.md @@ -0,0 +1,283 @@ +# One complete selected native MOVE on the packed direct-leaf boundary + +## 1. Exact claim, source and scope + +Canonical main is `e54523517d0f03e58352e647c403a5af3e525a57`. +The selected #7000 source event at zero-based index 24472 is +`["MOVE",415,3,99,false]`. Its complete source frames are `[]` and `[239]`. +The retained exact compiler lowers their quotient to rank one and the two +monomial records in `reference/RECIPE.json`. The retained independent +Gaussian interpreter verifies the complete kernel, including absolute phase; +`bind_source.py` also compares all 512 source basis columns with an explicit +two-term formula. The compact frame witness is 151 bytes. It was re-extracted +from the complete exact 350,722-byte source archive using +`bind_source.py --source-repo ...`; the archive is not vendored. +SOURCES.json records its exact commit:path/blob/length/hash and all sixteen +retained small files. The four module PRs are open proposals, not canonical +admissions. This package proves their scoped physical join, using their +published graph invariants and complete bounds as credited predecessor lemmas. + +**Theorem.** For every positive `f,r,P,S,cutoff`, every `w>=2`, and every +complete legal entry described below, if `f<=cutoff` and the numerical +condition in section 4 holds, `compile_move()` is a single fixed local tape +program that replaces the original public DATA by the exact source MOVE +tensorized over all f columns, preserves every complete spectator and +coefficient address, returns all 31 heads, and restores every private +body/guard and opaque exterior. It uses 82,813 locations, 31 fixed tapes, +the four symbols `{blank,0,1,|}`, and only read, write, unit move, fixed goto +and halt. There is no runtime child callback, integer oracle, supplied stride, +replacement owner, or omitted Fourier axis. + +With `N=P S r 2^(9f)`, `V=2Nw`, and E the actual length of the first six Gamma +codes, its complete successful cost and historical backing satisfy + +`T <= 2^24 (fV+E+1)`, + +`K_final <= K_entry + 1024 (V+E+1)`. + +K_entry includes the actual earlier history of all 31 owners, public inputs +and opaque regions. Erasure never releases that history. These are loose +direct-reference bounds. This is **O(fV+E)**, not a recursive selected-rate +supplier. At a fixed compiler base-case cutoff q, accepted calls have f<=q +and the local bill is O_q(V+E). This theorem supplies neither a nonleaf +recurrence nor an `f^sigma` tariff. All five selected framework assumptions +remain; there is no new kappa or multiplier theorem. + +## 2. Supplied complete physical entry + +HEADER is a distinct public owner containing six positive canonical binary +Gamma codes in the exact order `f,r,P,S,w,cutoff`. The first five agree with +#7426/#7428/#7430. Those modules consume only those five codes and preserve +the opaque sixth and all following symbols. #7429 consumes six codes and +preserves the following opaque tail. DATA is exactly the lexicographic +packed array `[P] x [2^f]^9 x [S]`, with r Gaussian coefficients per address +and w two's-complement MSB-first bits for each real then imaginary component, +followed by a blank. Every coefficient has the same fixed common grid; the +program changes neither that grid nor its interpretation. The first native +coordinate a0 is the slow selected block. + +Supply 29 genuinely distinct private owners, disjoint from HEADER and DATA. +Their entry heads and the public heads are at their respective origins, +which may be different or negative. Private cells from origin-1 through the +predecessor bounds and the two whole-call V-bit windows are physically blank. +The fixed program discovers ends only by local scans. Opaque exteriors are +outside these windows. Whole-tail blankness is not inferred from a few local +cells. The old 23-field coded descriptor, LSB/delimiter conversion, gapped or +interleaved placement, public occurrence emission, transport corridors and +the actual caller's numerical producer remain separately paid caller work. + +The abstract source owner 415 is represented by the supplied public DATA +owner. This is an exact MOVE boundary for that source event, not an emitted +full-word dispatcher that locates owner 415 in an enclosing implementation. + +## 3. Relocation, source order and complete tensor addresses + +The public ports are HEADER=0 and DATA=1. WORK=2 is one whole-call private +payload bank and TRACE=3 is its public-owner return trace. Every retained +module's HEADER port maps to 0, DATA maps to WORK, and private port t>=2 maps +to t+2. The largest private port is #7429's 28, so the global ports are +exactly 0,...,30. The map is injective within each retained module and does +not identify a private port with WORK, TRACE or a public owner. + +`insert()` copies every retained instruction, renames its fixed PC labels +and tape numbers, and changes its successful halt to one fixed goto. Its +alphabet, scanned-symbol branches, writes and unit moves are unchanged. +An empty branch remains empty. A retained execution is literally simulated +with equal step count through its successful terminal instruction, whose +replacement has the same unit cost. Construction-time loops produce a +fixed table; they perform no runtime size or scalar work. + +The six factor graphs execute in this order: + +| Order | Complete factor | Literal implementation | +|---|---|---| +| 1 | right input-coordinate phase | #7426, actual right recipe | +| 2 | right binary G | #7430, 19 fixed CNOTs on all f columns | +| 3 | right offset 1, after G | #7428, complete a0 reversal | +| 4 | positive central `C^(tensor f)` | #7429, all f low-bit-first axes | +| 5 | left input-coordinate phase | #7426 fixed specialization below | +| 6 | left binary G | #7430, 27 fixed CNOTs on all f columns | + +The left phase is explicitly present. Its source linear coefficients are +`(2,0,0,0,0,0,0,0,0)`, its quadratic rows are zero and its constant is zero. +#7426's `compile_phase` accepts precisely such fixed recipes; its generic +counter/geometry proof applies with m=9. The extra factor is +`(-1)^popcount(a0)`. The right constant is one, so its tensor phase is `i^f`; +the graph initializes that repeated constant using f, not once per call or +once per coefficient. + +For a native monomial `(G,b,Q,l,c)`, its action on complete column-address +tuples is the source convention + +`e_a -> i^[fc+sum_i l_i popcount(ai)+2sum_(i=0 every real and +imaginary input numerator is divisible by `2^f`, has absolute value <=M, and + +`2^f M <= 2^(w-1)-1`. + +The entrance phase is a Gaussian unit and G/offset are permutations, so the +divisibility and component bound M survive the right boundary. After j C +axes the numerators are divisible by `2^(f-j)`: each next row is a signed +sum of four incoming integers, divided by two. This proves every integrality +guard through j=f. The four-term formula also bounds each next component +by twice the preceding component maximum. The j-axis maximum is therefore +`2^j M<=2^f M`, inside the symmetric signed interval +`[-(2^(w-1)-1),2^(w-1)-1]`. The exit Gaussian-unit phase and final permutation +also fit. This proves success for every positive f with arbitrary joint +inputs and complete spectators. It is sufficient and not claimed sharp. + +This is a supplied numerator reserve. No scale, widening, grid conversion or +unscaling is installed. A caller obtaining it by changing its common grid or +width must implement and pay that conversion and the larger V. #7468 proves +a sharper endpoint-dependent arithmetic scale while leaving physical +conversion/range/owner costs open; it is relevant follow-up, not a dependency +used here. Integral final endpoints alone remain insufficient for the +current unwrapped leaf. + +## 5. Whole-call ownership, transaction and failure boundary + +The wrapper installs guards on WORK and TRACE, copies the entire original +DATA body onto WORK, and records each source advance on TRACE. At the blank +endpoint it returns the original DATA head by consuming TRACE, then returns +the WORK head by its own guard. Public DATA has received no write. Public +HEADER is never written by either wrapper or factors. + +All six module commits target WORK. Each successful graph restores all its +private cells/guards and heads. The same 27 module-private owners can +therefore be reused serially across graphs even when their role names +differ. WORK's outer guard persists and is neither identified with a module +private guard nor retired by an intermediate module. TRACE remains blank +while factors execute. Induction over completed graphs establishes each +next graph's physical entry. Algebraic concatenation alone would not prove +this shared-bank lifecycle premise. + +Only after successful factor 6 does the wrapper copy WORK to the original +public DATA owner, erase WORK and rebuild TRACE. It returns the public head +using TRACE, returns the blank WORK head, erases both outer guards and halts. +Exactly V public DATA writes occur, all in this sole final commit. No owner +object or backing interval is replaced. Every private body and opaque +exterior is restored on success. + +For any finite component rejection before the final commit, public DATA and +HEADER values remain original, even if earlier factors already committed +on WORK. The checker explicitly reaches a central nonintegral rejection +after the first three factors completed and observes zero public writes. +Rejection need not restore heads or retire private work, and rejecting +banks are not promised reusable. Interruption, nontermination, arbitrary +malformed-tail costs and post-failure retry are unclaimed. #7477 transforms +a reversal's rejection cleanup; it does not already transform this complete +joined program. + +## 6. Complete time, storage and the cutoff gate + +All instructions, including fixed jumps and terminal instructions, cost one. +There is one initial wrapper clone and one final wrapper commit. The clone +plus source/WORK returns costs `15V+13` instructions. The final commit, +returns, guard retirement and halt cost `16V+14`. Thus new wrapper overhead +is exactly `31V+27` on a successful legal packet. Module halts become +unit-cost gotos; call/return is not free or omitted. + +Use the complete credited bounds at unchanged source bytes: + +| Graph | Complete instruction upper bound | +|---|---| +| two linear factors and central leaf | each `65536(fV+E+1)` | +| each phase, m=9 | `65536[E+10f+r+P+S+w+100P2^(9f)+V+1]` | +| translation, descriptor producer and reversal | `4096(V+E+1)` | +| new outer wrapper | `31V+27` | + +The predecessors' five-field E is <=the present six-field E. Since +`P2^(9f)<=V/2` and `f,r,P,S,w<=V`, each phase is at most +`65536(E+65V+1)`. Bound translation by `65536(V+E+1)` and wrapper by +`65536(V+1)`. Summing gives + +`T <=65536[3fV+132V+6E+7] <=2^24(fV+E+1)`. + +This includes all Gamma decoding, actual descriptor arithmetic, constant +phase repetition, coefficient loops, every signed scalar row, C axis, CNOT +column, source read, staging, intermediate commit, head return, guide reset, +guard initialization and erasure. No common-grid conversion is hidden in +this bill. No recursive child work is omitted: the direct child graph is one +summand. For f>cutoff the child guard rejects; this gives no nonleaf supplier. + +For history, each linear factor and leaf has complete additional bound +`64(V+E+1)`; translation has `32(V+E+1)`. Each phase has credited bound + +`2V+4E+13f+4(r+P+S)+8w+256 <=256(V+E+1)`. + +The new wrapper visits only the original DATA interval `[0,V]` and private +WORK/TRACE intervals `[-1,V]`, relative to their own origins. It adds at most +`3V+5<=8(V+E+1)`. Adding successive historical increases, never subtracting +erased cells, gives `(512+128+64+32+8)(V+E+1)=744(V+E+1)`, below the declared +1024 bound. It counts all 31 owners, including HEADER and WORK positions +also visited by other graphs. Double counting is harmless. No owned field +earns productive credit. + +At fixed origins successful reuse retains each owner's visited interval +union, or per-owner maximum span before summing. Prior successful retirement +supplies blank tails and restored heads; a shorter call scans only its actual +current body, not old capacity. Its current time bound is independent of old +high-water marks. Changed origins require actual absolute interval unions +and separately paid transport corridors. Renaming an origin releases no +history. Public packet replacement in fixtures is supplied work, not free +caller acquisition. + +## 7. Evidence and remaining obligations + +The independent stdlib dense CPU executes the complete table. The direct +oracle inverts the two address matrices and evaluates sparse Gaussian tensor +entries. It uses no CNOT word, incremental counter, butterfly implementation +or tape arithmetic. The full nonzero actual m=9,f=1 packet has 512 addresses +and 4096 bits and takes 14,429,950 transitions. Shorter same-owner reuse has +a 258-bit cutoff value and 2048 payload bits, taking 7,499,800 transitions. +All successful header/head/private/exterior, owner and complete-write checks +pass. Central rejection after three completed factors takes 4,723,409 +transitions and preserves both publics. Four whole-program mutants delete +absolute phase, exchange right-factor order, omit offset or corrupt final +commit, and all fail the direct kernel. The address oracle checks all 512 +one-column and 262,144 two-column addresses plus 1,025 three-column addresses. +Finite evidence corroborates the universal predecessor invariants and +composition proof. No full f=2 joined tape execution is claimed. + +Still unproved here are the selected caller's old-codec/packing bridge and +entry producer; actual owner lookup/emission and transport; its common-grid, +divisibility, headroom and cutoff admission; global owned reset and stock; +a faster nonleaf supplier and complete recursive invoice; enclosing compiler, +precision and analytic-recovery applications. All five selected assumptions +and the selected conditional bound remain unchanged. The source archive was +authenticated and its exact event/frames re-extracted, but no complete +catalogue, selected cold replay, Lean or Docker run is claimed. Independent +human and formal proof-kernel review remain unclaimed. diff --git a/research/literal-selected-move-join/README.md b/research/literal-selected-move-join/README.md new file mode 100644 index 0000000000..b9c080c855 --- /dev/null +++ b/research/literal-selected-move-join/README.md @@ -0,0 +1,94 @@ +# A complete selected native MOVE as one literal direct program + +**Scoped physical composition; no new kappa.** One fixed 31-tape, +82,813-location program executes actual selected #7000 MOVE24472 +`["MOVE",415,3,99,false]` on the supplied packed six-Gamma boundary, for +every positive column count f meeting the explicit cutoff and numerical +admission. It executes right phase, right G, right offset, the entire +positive `C^(tensor f)` child, left phase and left G, with absolute `i^f`, +complete native/spectator/coefficient addresses and original-owner return. + +The original public payload is cloned once into a distinct whole-call bank. +Every intermediate component commit is private. Only the completed MOVE +writes the original owner, so a finite component rejection preserves public +DATA/HEADER values. Successful calls restore all 31 heads, private bodies, +guards and opaque exteriors. Rejection cleanup/retry is not claimed. + +For `V=2PSr2^(9f)w` and actual six-code header length E, the complete bounds +are `T<=2^24(fV+E+1)` and `K_final<=K_entry+1024(V+E+1)`. Every descriptor, +signed scalar operation, C axis, copy, staging, return and erasure is paid. +This is a direct O(fV+E) reference, suitable at a fixed compiler leaf cutoff; +it supplies no recursive selected-rate tariff or global native supplier. + +The accepted domain retains the exact phase/range and C-prefix conditions. +A proved sufficient all-f reserve is input numerator divisibility by `2^f`, +component magnitude <=M and `2^f M<=2^(w-1)-1`. The grid/width producer and +any physical scale conversion are supplied caller work. Complete details, +source transfer, shared-bank lifecycle and derivations are in PROOF.md. + +## Reproduce + +Python 3.11+ and standard library only, from this directory: + +```sh +python3 -I -W error -B bind_source.py +python3 -I -W error -B verify.py +python3 -I -O -W error -B verify.py +``` + +The source check takes about 0.2 seconds. The complete verifier took 20.23 +seconds normally and 16.44 seconds optimized in this executor; durations +depend on the CPU. ENVIRONMENT.json records the commands and environment. +It writes nothing unless `--write` is explicit. `--quick` performs assembly, +source-byte and address checks only and cannot write accepted evidence. +`RESULT.json` records the executed complete author corpus. Optional exact +archive re-extraction is read-only: + +```sh +python3 -I -W error -B bind_source.py --source-repo /path/to/existing/source/repository +``` + +Expected markers are `PASS_COMPLETE_MOVE_SOURCE_BINDING` and +`PASS_LITERAL_SELECTED_MOVE_JOIN`. No package registration or hosted CI is +claimed. A complete nonzero m=9,f=1 packet takes 14,429,950 literal transitions; +the public-preserving child rejection follows three completed private +factors. Four whole-table mutants detect phase/order/offset/commit faults. +No joined full f=2 tape execution is claimed; the all-f statement rests on +the written composition and the retained universal graph lemmas. + +## Source and novelty + +Canonical base is `e54523517d0f03e58352e647c403a5af3e525a57`. The exact selected +frames are `[]` and `[239]`. The complete kernel and all 512 exact columns +are checked with the retained independent Gaussian engine, separately from +the inverse-address oracle used for literal execution. All sixteen retained +small files are authenticated by byte length, SHA256 and Git blob. +The large source archive is represented by a 151-byte deterministic frame +extraction and exact archive pins, and was re-extracted locally. + +This joins CubeJerry's open #7426/#7428/#7429/#7430 at their exact recorded +heads. It does not modify their sources. #7462's shorter left word, #7468's +sharper endpoint-prefix scale and #7477's reversal rejection cleanup are +credited related follow-ups, not claimed here or silently installed. +The selected all-column algebra was already established; the new result is +the actual source-specific fixed-table physical join and complete transaction. +OVERLAP.md records the bounded live overlap check. All five global selected +assumptions and the selected conditional kappa remain unchanged. + +## Open next questions + +1. Install paid literal scale/widen/unscale graphs around this child using + the sharp endpoint-prefix theorem, with a proved endpoint producer and + complete signed width, owner and history accounting. The initial step is + a fixed local width-changing stream transducer; no such oracle is assumed. +2. Produce this exact packed six-code entry at an actual selected occurrence, + preserving the complete external factor. The blockers are old-codec and + strided packing, owner lookup/transport, grid/headroom and actual cutoff. +3. Compose a faster nonleaf implementation with the same complete boundary + and a paid recurrence. The direct fV cost cannot establish that tariff. +4. Add failure retirement if a caller needs same-bank retry after arithmetic + rejection. Successful reuse is already covered; #7477 alone transforms + only its reversal source, not this full joined program. + +Prepared with substantial OpenAI Codex assistance. Apache-2.0. NOTICE.md and +the unchanged predecessor notices retain source and mathematical credit. diff --git a/research/literal-selected-move-join/RESULT.json b/research/literal-selected-move-join/RESULT.json new file mode 100644 index 0000000000..1a9dab6e4a --- /dev/null +++ b/research/literal-selected-move-join/RESULT.json @@ -0,0 +1,400 @@ +{ + "alphabet": [ + "_", + "0", + "1", + "|" + ], + "controls": [ + "drop_absolute_phase", + "swap_right_order", + "omit_offset", + "corrupt_commit" + ], + "finite_address_checks": 263681, + "graph_sha256": "14f38b15157a9c9cd2828861f6904701a29b1e27507a7e43d60030e1ae4d9238", + "locations": 82813, + "marker": "PASS_LITERAL_SELECTED_MOVE_JOIN", + "receipts": [ + { + "bits": 4096, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "highs": [ + 13, + 4099, + 4099, + 4099, + 4099, + 4099, + 15, + 4099, + 5, + 4099, + 2051, + 2051, + 15, + 4099, + 2051, + 4099, + 12, + 131, + 2051, + 1027, + 2051, + 2051, + 2051, + 2051, + 2051, + 1027, + 1027, + 1027, + 4099, + 9, + 4099 + ], + "history": 67823, + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "milestones": { + "commit": 14364400, + "left_linear_": 7015778, + "left_phase_": 6704950, + "positive_child_": 6051691, + "right_linear_": 373391, + "right_offset_": 5587558, + "right_phase_": 61453 + }, + "name": "complete_nonzero_f1", + "rejected": false, + "shape": [ + 1, + 1, + 1, + 1, + 4, + 1 + ], + "steps": 14429950, + "writes": 4096 + }, + { + "bits": 2048, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "highs": [ + 525, + 2051, + 2051, + 2051, + 2051, + 2051, + 14, + 2051, + 260, + 2051, + 1027, + 1027, + 14, + 2051, + 1027, + 2051, + 10, + 261, + 1027, + 515, + 1027, + 1027, + 1027, + 1027, + 1027, + 515, + 515, + 515, + 2051, + 7, + 2051 + ], + "history": 34922, + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "milestones": { + "commit": 7467018, + "left_linear_": 3726419, + "left_phase_": 3521214, + "positive_child_": 3132012, + "right_linear_": 237048, + "right_offset_": 2899352, + "right_phase_": 30733 + }, + "name": "shorter_reuse_huge_cutoff", + "rejected": false, + "shape": [ + 1, + 1, + 1, + 1, + 2, + 231584178474632390847141970017375815706539969331281128078915168015826259279872 + ], + "steps": 7499800, + "writes": 2048 + }, + { + "bits": 3072, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3075, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 9, + 9, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "highs": [ + 11, + 3075, + 3075, + 3075, + 3075, + 3075, + 14, + 3075, + 4, + 3075, + 1539, + 1539, + 14, + 3075, + 1539, + 3075, + 10, + 131, + 1539, + 771, + 1539, + 1539, + 1539, + 1539, + 1539, + 771, + 771, + 771, + 3075, + 8, + 3075 + ], + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "milestones": { + "positive_child_": 4591628, + "right_linear_": 305168, + "right_offset_": 4243352, + "right_phase_": 46093 + }, + "name": "child_nonintegral_after_three_completed_factors", + "rejected": true, + "shape": [ + 1, + 1, + 1, + 1, + 3, + 1 + ], + "steps": 4723409, + "writes": 0 + } + ], + "source_event": [ + "MOVE", + 415, + 3, + 99, + false + ], + "source_index": 24472, + "tapes": 31 +} diff --git a/research/literal-selected-move-join/SOURCE-BINDING.json b/research/literal-selected-move-join/SOURCE-BINDING.json new file mode 100644 index 0000000000..698bd303a6 --- /dev/null +++ b/research/literal-selected-move-join/SOURCE-BINDING.json @@ -0,0 +1,14 @@ +{ + "basis_columns": 512, + "frames": [ + 3, + 99 + ], + "full_archive_reextracted": true, + "marker": "PASS_COMPLETE_MOVE_SOURCE_BINDING", + "negative_controls": [ + "absolute phase" + ], + "owner": 415, + "source_index": 24472 +} diff --git a/research/literal-selected-move-join/SOURCES.json b/research/literal-selected-move-join/SOURCES.json new file mode 100644 index 0000000000..8a2db1259a --- /dev/null +++ b/research/literal-selected-move-join/SOURCES.json @@ -0,0 +1,161 @@ +{ + "canonical_main": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "39b40c465f7636a4bb6d70af28595fe8f70f4f3f", + "path": "research/literal-selected-linear-maps/linear.py", + "local": "reference/linear/linear.py", + "bytes": 13102, + "sha256": "d56704082b82e37d4a360b8aad7e0af63499f4160c6bbcfd338804453c46fa33", + "blob": "6aad40a6c47ed4415917c86fabbd5227a3819a41" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "39b40c465f7636a4bb6d70af28595fe8f70f4f3f", + "path": "research/literal-selected-linear-maps/inputs/controller_reference.py", + "local": "reference/linear/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73", + "blob": "3ab6d0361f35038ffcdf0cf81a157f7a17b40e72" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "39b40c465f7636a4bb6d70af28595fe8f70f4f3f", + "path": "research/literal-selected-linear-maps/NOTICE.md", + "local": "reference/linear/NOTICE.md", + "bytes": 2180, + "sha256": "2ac2051c0fbedfd9d11348493456bf479dbdd3104a4e106c8bf36251a72b6a50", + "blob": "3a3030f23df347c1e45ddf92d2083f89ed16cc67" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/phase.py", + "local": "reference/phase/phase.py", + "bytes": 11734, + "sha256": "2be149aa1be504509bb480f85396f0be302082d638e81422f747daee5a3c1ce7", + "blob": "d48978145821fc4a62d534bef2bef9449bda883a" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/inputs/controller_reference.py", + "local": "reference/phase/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73", + "blob": "3ab6d0361f35038ffcdf0cf81a157f7a17b40e72" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/RECIPE.json", + "local": "reference/RECIPE.json", + "bytes": 1798, + "sha256": "96fadb44c3316be93c6c02f50cd2c841a9541d67b98fd94fc47b73fa64dd404c", + "blob": "ea2bc6909e02d8aa61e170d65bb707da7279d0ab" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/NOTICE", + "local": "reference/phase/NOTICE", + "bytes": 808, + "sha256": "5654eeb7fdc1acd6a6d246ef87b1155812efdcd0949f54be78e048fe905fbae0", + "blob": "7a1f1da9c59d40b1e72905fee5344a8db9ca4353" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "1a555e469b89af70d309bc966f8f813ac11dc887", + "path": "research/literal-positive-c-leaf/leaf.py", + "local": "reference/leaf/leaf.py", + "bytes": 17526, + "sha256": "bb46c1a55f1119957a52cd61f2cd957f3f7ad1e9b818c54a852bde09a0773744", + "blob": "bdcc80cbd8b64c601e6d69b7d25ece444b8b1ae2" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "1a555e469b89af70d309bc966f8f813ac11dc887", + "path": "research/literal-positive-c-leaf/inputs/controller_reference.py", + "local": "reference/leaf/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73", + "blob": "3ab6d0361f35038ffcdf0cf81a157f7a17b40e72" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "1a555e469b89af70d309bc966f8f813ac11dc887", + "path": "research/literal-positive-c-leaf/NOTICE.md", + "local": "reference/leaf/NOTICE.md", + "bytes": 1900, + "sha256": "773921ac301cf7e37de97ed8a0066e6bbb69ec1150cc2b5f74a12cb20103f3cf", + "blob": "71c5f6dae2c799ce5d76c544e98d1ee7c52ef76c" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "1dbdaa414cfe4a4a0f015e88a04b52e146566786", + "path": "research/native-translation-descriptor/translate.py", + "local": "reference/translation/translate.py", + "bytes": 7703, + "sha256": "e2750fef8c2b9c8019d67285df3ca0d04340cd241782c7845665b7de621ca3bd", + "blob": "5e1149f8ab45e0d5b4ecd963674ff8659d7f014b" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "1dbdaa414cfe4a4a0f015e88a04b52e146566786", + "path": "research/native-translation-descriptor/reference/reverse.py", + "local": "reference/translation/reference/reverse.py", + "bytes": 6649, + "sha256": "4b516d85baf3303db809bc1174394009b1fc71a8f7d17fb6c729ec8bb6aba245", + "blob": "60fce51dd8c3336e2bcf2873df254190e2203e14" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "1dbdaa414cfe4a4a0f015e88a04b52e146566786", + "path": "research/native-translation-descriptor/reference/inputs/controller_reference.py", + "local": "reference/translation/reference/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73", + "blob": "3ab6d0361f35038ffcdf0cf81a157f7a17b40e72" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "1dbdaa414cfe4a4a0f015e88a04b52e146566786", + "path": "research/native-translation-descriptor/NOTICE.md", + "local": "reference/translation/NOTICE.md", + "bytes": 1201, + "sha256": "24f5e9957fcd8f6cfdc021ff5bc91bf89e50587997e2a2cb18053949c0e0d205", + "blob": "903e332da2844843fbb1ad716b6d470f175e8de9" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/reference/clifford_exact.py", + "local": "reference/source/clifford_exact.py", + "bytes": 6824, + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962", + "blob": "166841a037f069249f6f7f6dedb89248812f59e2" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/reference/native_verify.py", + "local": "reference/source/native_verify.py", + "bytes": 12323, + "sha256": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38", + "blob": "2c209dfa9cfade3bc20ac5fc9d876b433a147f8c" + } + ], + "upstream_artifacts": [ + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/reference/selected-native.json.gz", + "bytes": 350722, + "sha256": "2b94953dc14a122e3ef089633f05b58ec689ec5156feb7c784ed3e137dc01883", + "blob": "74563a7867d9d762b6588f65362369668841bb3e", + "derived_local": "reference/SOURCE-FRAMES.json", + "extraction": "event 24472; complete frames named by event[2:4]; canonical JSON word hash is recorded in RECIPE.json; source archive is not vendored" + } + ] +} diff --git a/research/literal-selected-move-join/VERIFY.json b/research/literal-selected-move-join/VERIFY.json new file mode 100644 index 0000000000..b3e4a24461 --- /dev/null +++ b/research/literal-selected-move-join/VERIFY.json @@ -0,0 +1,14 @@ +{ + "standalone_only": true, + "registered_package_claimed": false, + "commands": [ + ["python3", "-I", "-W", "error", "-B", "bind_source.py"], + ["python3", "-I", "-W", "error", "-B", "verify.py"], + ["python3", "-I", "-O", "-W", "error", "-B", "verify.py"] + ], + "optional_exact_source_reextraction": ["python3", "-I", "-W", "error", "-B", "bind_source.py", "--source-repo", "/path/to/existing/source/repository"], + "receipt_regeneration": ["python3", "-I", "-W", "error", "-B", "verify.py", "--write"], + "quick_is_not_full_evidence": true, + "expected_markers": ["PASS_COMPLETE_MOVE_SOURCE_BINDING", "PASS_LITERAL_SELECTED_MOVE_JOIN"], + "no_network_required_for_standalone_commands": true +} diff --git a/research/literal-selected-move-join/bind_source.py b/research/literal-selected-move-join/bind_source.py new file mode 100644 index 0000000000..fbd9305a02 --- /dev/null +++ b/research/literal-selected-move-join/bind_source.py @@ -0,0 +1,88 @@ +"""Rebuild the retained lowering and match every exact source column. + +SOURCE-FRAMES.json is the 151-byte extraction of the pinned archive, whose +350,722 bytes are deliberately not vendored. --source-repo re-extracts it +read-only from the exact commit:path and authenticates the complete archive. +""" +from pathlib import Path +import argparse +import copy +import gzip +import hashlib +import json +import subprocess +import sys + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import move as m + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def verify_source(repo=None): + m.authenticate() + record = json.loads((HERE / 'reference/RECIPE.json').read_text()) + witness = json.loads((HERE / 'reference/SOURCE-FRAMES.json').read_text()) + need(witness['event_index'] == record['native_event_index'] == 24472, 'event index') + need(witness['event'] == record['event'] == ['MOVE', 415, 3, 99, False], 'actual MOVE') + if repo is not None: + pin = json.loads((HERE / 'SOURCES.json').read_text())['upstream_artifacts'][0] + raw = subprocess.check_output(['git', 'show', pin['commit'] + ':' + pin['path']], cwd=repo) + need(len(raw) == pin['bytes'] and hashlib.sha256(raw).hexdigest() == pin['sha256'], + 'complete selected archive binding') + word = json.loads(gzip.decompress(raw)) + canonical = json.dumps(word, separators=(',', ':'), sort_keys=True).encode() + need(hashlib.sha256(canonical).hexdigest() == record['native_canonical_sha256'], + 'complete selected canonical word') + extracted = dict(event_index=24472, event=word['program'][24472], + frames={str(i): word['frames'][i] for i in word['program'][24472][2:4]}) + need(extracted == witness, 'compact frame extraction') + compiler = m.load('move_join_source_compiler', 'source/clifford_exact.py') + independent = m.load('move_join_source_independent', 'source/native_verify.py') + before, after = witness['event'][2:4] + a, b = (compiler.canonical_frame(9, tuple(witness['frames'][str(i)])) for i in (before, after)) + recipe, _ = compiler.lower_child(a.adjoint().then(b)) + recipe = json.loads(json.dumps(recipe)) + need(recipe == record['lowered_recipe'] and recipe['rank'] == 1, 'source lowering') + target = independent.adjoint(independent.frame(witness['frames'][str(before)], 9)) + target += independent.frame(witness['frames'][str(after)], 9) + independent.equal(independent.recipe(recipe), target, 'complete selected MOVE kernel') + # Compare all 512 columns, including Gaussian normalization and phase, + # with a separate explicit two-term formula for the joined recipe. + from verify import linear, phase, rotate + right, left = recipe['right'], recipe['left'] + for source in range(512): + x = tuple((source >> i) & 1 for i in range(9)) + t = tuple(a ^ ((right['offset'] >> i) & 1) + for i, a in enumerate(linear(right['matrix_rows'], x))) + expected = {} + for bit in (0, 1): + z = (bit,) + t[1:] + out = linear(left['matrix_rows'], z) + address = sum(a << i for i, a in enumerate(out)) + expected[address] = rotate((1, 1 if bit == t[0] else -1), + phase(right, x, 1) + phase(left, z, 1)) + values, denominator = independent.state(target, source) + need(denominator == 1 and values == expected, 'source column ' + str(source)) + wrong = copy.deepcopy(recipe) + wrong['right']['phase'] = (wrong['right']['phase'] + 1) % 4 + try: + independent.equal(independent.recipe(wrong), target, 'absolute phase mutation') + except ValueError: + pass + else: + raise ValueError('source phase mutation missed') + return dict(marker='PASS_COMPLETE_MOVE_SOURCE_BINDING', source_index=24472, + owner=415, frames=[before, after], basis_columns=512, + full_archive_reextracted=repo is not None, negative_controls=['absolute phase']) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--source-repo', type=Path) + args = parser.parse_args() + print(json.dumps(verify_source(args.source_repo), indent=2, sort_keys=True)) diff --git a/research/literal-selected-move-join/move.py b/research/literal-selected-move-join/move.py new file mode 100644 index 0000000000..3c11397a02 --- /dev/null +++ b/research/literal-selected-move-join/move.py @@ -0,0 +1,148 @@ +"""One fixed literal direct implementation of selected #7000 MOVE24472. + +The source modules are retained byte for byte. Construction-time relabeling +joins their local-symbol graphs; no runtime callback implements a factor. +Apache-2.0. Prepared with substantial OpenAI Codex assistance. +""" +from pathlib import Path +import hashlib +import importlib.util +import json +import sys + +HERE = Path(__file__).resolve().parent + + +def authenticate(): + for pin in json.loads((HERE / 'SOURCES.json').read_text())['files']: + raw = (HERE / pin['local']).read_bytes() + if len(raw) != pin['bytes'] or hashlib.sha256(raw).hexdigest() != pin['sha256']: + raise ValueError('source drift: ' + pin['local']) + blob = hashlib.sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() + if blob != pin['blob']: + raise ValueError('Git blob drift: ' + pin['local']) + + +def load(name, path): + spec = importlib.util.spec_from_file_location(name, HERE / 'reference' / path) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +authenticate() +LINEAR = load('move_join_linear', 'linear/linear.py') +PHASE = load('move_join_phase', 'phase/phase.py') +LEAF = load('move_join_leaf', 'leaf/leaf.py') +TRANSLATION = load('move_join_translation', 'translation/translate.py') +Builder, Tape, Machine = LINEAR.Builder, LINEAR.Tape, LINEAR.Machine +BLANK, ONE, MARK = LINEAR.BLANK, LINEAR.ONE, LINEAR.MARK +HEADER, DATA, WORK, TRACE = range(4) +TAPES = 31 +BITS = ('0', ONE) + + +def return_source(a): + """Erase the paid trace and return the original DATA head.""" + a.op('move', TRACE, -1) + a.mark('return_' + str(len(a.code))) + loop = 'return_' + str(len(a.code)) + # mark() does not append code, so loop is the label just installed. + a.op('read', TRACE, {ONE: loop + '_bit', MARK: loop + '_done'}) + a.mark(loop + '_bit') + a.op('write', TRACE, BLANK) + a.op('move', TRACE, -1) + a.op('move', DATA, -1) + a.op('goto', loop) + a.mark(loop + '_done') + a.op('move', TRACE, 1) + + +def insert(a, name, code, alphabet, after): + """Only fixed jump addresses and fixed tape ports are renamed.""" + if alphabet != (BLANK, '0', ONE, MARK): + raise ValueError('module alphabet') + ports = lambda t: HEADER if t == 0 else WORK if t == 1 else t + 2 + for pc, (op, *args) in enumerate(code): + a.mark(name + str(pc)) + if op == 'read': + a.op(op, ports(args[0]), {s: name + str(dst) for s, dst in args[1].items()}) + elif op in ('write', 'move'): + a.op(op, ports(args[0]), args[1]) + elif op == 'goto': + a.op(op, name + str(args[0])) + elif op == 'halt': + a.op('goto', after) + else: + raise ValueError('nonlocal retained opcode') + + +def _compile_move(mutation=None): + recipe = json.loads((HERE / 'reference/RECIPE.json').read_text())['lowered_recipe'] + right = recipe['right'] + left = recipe['left'] + factors = [ + ('right_phase_', PHASE.compile_phase(right['linear_Z4'], right['quadratic_rows'], + 0 if mutation == 'drop_absolute_phase' else right['phase'])), + ('right_linear_', LINEAR.compile_linear('right')), + ('right_offset_', TRANSLATION.compile_translation()), + ('positive_child_', LEAF.compile_leaf()), + ('left_phase_', PHASE.compile_phase(left['linear_Z4'], left['quadratic_rows'], left['phase'])), + ('left_linear_', LINEAR.compile_linear('left')), + ] + if mutation == 'swap_right_order': + factors[0], factors[1] = factors[1], factors[0] + if mutation == 'omit_offset': + factors = [item for item in factors if item[0] != 'right_offset_'] + a = Builder() + for tape in (WORK, TRACE): + a.op('move', tape, -1) + a.op('write', tape, MARK) + a.op('move', tape, 1) + a.mark('clone') + a.op('read', DATA, {'0': 'clone0', ONE: 'clone1', BLANK: 'cloned'}) + for bit in BITS: + a.mark('clone' + bit) + a.op('write', WORK, bit) + a.op('move', WORK, 1) + a.op('move', DATA, 1) + a.op('write', TRACE, ONE) + a.op('move', TRACE, 1) + a.op('goto', 'clone') + a.mark('cloned') + return_source(a) + a.rewind(WORK, BITS) + entries = {} + for index, (name, (code, alphabet)) in enumerate(factors): + entries[name] = len(a.code) + after = factors[index + 1][0] + '0' if index + 1 < len(factors) else 'commit' + insert(a, name, code, alphabet, after) + a.mark('commit') + entries['commit'] = len(a.code) + a.op('read', WORK, {'0': 'commit0', ONE: 'commit1', BLANK: 'committed'}) + for bit in BITS: + a.mark('commit' + bit) + a.op('write', DATA, '1' if mutation == 'corrupt_commit' else bit) + a.op('write', WORK, BLANK) + a.op('move', WORK, 1) + a.op('move', DATA, 1) + a.op('write', TRACE, ONE) + a.op('move', TRACE, 1) + a.op('goto', 'commit') + a.mark('committed') + return_source(a) + a.rewind(WORK, (BLANK,)) + for tape in (WORK, TRACE): + a.op('move', tape, -1) + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('halt') + code, alphabet = a.finish((BLANK, '0', ONE, MARK)) + return code, alphabet, entries + + +def compile_move(): + """Fixed science table: no runtime size, scalar, child or recipe argument.""" + code, alphabet, _ = _compile_move() + return code, alphabet diff --git a/research/literal-selected-move-join/reference/RECIPE.json b/research/literal-selected-move-join/reference/RECIPE.json new file mode 100644 index 0000000000..ea2bc6909e --- /dev/null +++ b/research/literal-selected-move-join/reference/RECIPE.json @@ -0,0 +1,130 @@ +{ + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "native_event_index": 24472, + "event": [ + "MOVE", + 415, + 3, + 99, + false + ], + "side": "right", + "rank": 1, + "recipe": { + "matrix_rows": [ + 239, + 129, + 130, + 132, + 136, + 16, + 160, + 192, + 256 + ], + "offset": 1, + "quadratic_rows": [ + 111, + 111, + 111, + 111, + 0, + 111, + 111, + 0, + 0 + ], + "linear_Z4": [ + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 2, + 0 + ], + "phase": 1 + }, + "lowered_recipe": { + "rank": 1, + "left": { + "matrix_rows": [ + 3, + 5, + 9, + 17, + 32, + 65, + 129, + 1, + 256 + ], + "offset": 0, + "quadratic_rows": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "linear_Z4": [ + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "phase": 0 + }, + "right": { + "matrix_rows": [ + 239, + 129, + 130, + 132, + 136, + 16, + 160, + 192, + 256 + ], + "offset": 1, + "quadratic_rows": [ + 111, + 111, + 111, + 111, + 0, + 111, + 111, + 0, + 0 + ], + "linear_Z4": [ + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 2, + 0 + ], + "phase": 1 + } + }, + "catalogue_pairs_examined": 1, + "native_compressed_sha256": "2b94953dc14a122e3ef089633f05b58ec689ec5156feb7c784ed3e137dc01883", + "native_canonical_sha256": "91429a6b96729292a8764836e00c87a6f7cd3b76f05159033f4867f69a98d097" +} diff --git a/research/literal-selected-move-join/reference/SOURCE-FRAMES.json b/research/literal-selected-move-join/reference/SOURCE-FRAMES.json new file mode 100644 index 0000000000..478d9eddde --- /dev/null +++ b/research/literal-selected-move-join/reference/SOURCE-FRAMES.json @@ -0,0 +1,16 @@ +{ + "event_index": 24472, + "event": [ + "MOVE", + 415, + 3, + 99, + false + ], + "frames": { + "3": [], + "99": [ + 239 + ] + } +} diff --git a/research/literal-selected-move-join/reference/leaf/NOTICE.md b/research/literal-selected-move-join/reference/leaf/NOTICE.md new file mode 100644 index 0000000000..71c5f6dae2 --- /dev/null +++ b/research/literal-selected-move-join/reference/leaf/NOTICE.md @@ -0,0 +1,34 @@ +# Attribution and license + +Prepared for Jerry Chen / @CubeJerry with substantial OpenAI assistance. +New material is Apache-2.0; copied predecessors retain their original notices. + +Jose Manuel (jmbarrancoml), CrocSwap/integer-mult-bounds#3091, supplies the +Gaussian C numerator rows, exact carry/parity/signed-fit argument, physical +complete-axis strategy and direct tensor tariff. Credit its #3055/#3087 +physical lineage, Alejandro Zarzuelo Urdiales's #45 Gaussian tensor reserve +and norm results, James Chang's #1869 ripple arithmetic, AAAmirinu's #2327 +prefix audit, and Nick Petalas's #2772/#3089 prefix/capacity work. + +@CubeJerry's #6967 current-coded leaf supplies the earlier source/format/ +lifecycle binding and explicitly leaves literal numerical export open. +#6978, #6986 and #6989 provide distinct all-source, cutoff-transport and +rounded wrappers. Their stronger failure-retirement and old coded interfaces +are not silently inherited by this packed component. + +The actual #7000 source, Clifford compiler and retained independent Gaussian +verifier are credited to DreamingOfClouds, Ali Romman, Cinna Davis, zxv, +unpaidmoon, icekylinx, CubeJerry and the earlier authors named by the retained +sources. The construction, lowering and matrix identities are not claimed anew. + +The packed ABI is published at +`172f4535ce8dcff79f626410af845f757c1563be`. Unary/Gamma/trace patterns follow +literal-layer-phase at `8b549ca6557ccbb3017b104b27ea35051f990416`, which credits +literal-layer-egress at `51ab0539059214fcfa044938c36a0b6017232be5`. The exact +Builder/Machine originates in #7349, head +`9dfe6747b8553fd11b408f2b045c5954ef1e6eaa`. + +The parent's dense execution/oracle and literal_layer_boundary's independent +source/Gaussian/universal-cost review are separately attributed in REVIEW.md. +Their artifacts are unchanged. Independent AI work is not human approval or +formal proof-kernel acceptance. diff --git a/research/literal-selected-move-join/reference/leaf/inputs/controller_reference.py b/research/literal-selected-move-join/reference/leaf/inputs/controller_reference.py new file mode 100644 index 0000000000..3ab6d0361f --- /dev/null +++ b/research/literal-selected-move-join/reference/leaf/inputs/controller_reference.py @@ -0,0 +1,112 @@ +"""Finite three-tape online rank-recursion control; Apache-2.0. +Only PC and local symbols affect execution. Metrics/event logs are observers. +""" +from dataclasses import dataclass, field +BLANK, ONE, MARK = '_', '1', '|' +WIDTH, CHILD, STACK = range(3) + +class Builder: + def __init__(self): self.code, self.labels, self.serial = [], {}, 0 + def mark(self,n): + if n in self.labels: raise ValueError('duplicate label') + self.labels[n]=len(self.code) + def op(self,*x): self.code.append(x) + def rewind(self,t,symbols): + self.serial+=1; loop=f'rw{self.serial}'; done=loop+'done' + self.op('move',t,-1); self.mark(loop) + self.op('read',t,{s:loop+'step' for s in symbols}|{MARK:done}) + self.mark(loop+'step'); self.op('move',t,-1); self.op('goto',loop) + self.mark(done); self.op('move',t,1) + def finish(self,alphabet): + result=[] + for op,*a in self.code: + if op=='goto': a[0]=self.labels[a[0]] + elif op=='read': a[1]={s:self.labels[n] for s,n in a[1].items()} + result.append((op,*a)) + return tuple(result),tuple(alphabet) + +def compile_controller(m,ranks): + """Parameters are compile-time constants, absent from run-time state.""" + if type(m) is not int or m<2 or not ranks: raise ValueError('bad fixed profile') + if any(type(r) is not int or not 1<=r=budget: raise ValueError('finite verifier budget') + self.step() + return self + +def initial_tapes(width,origins=(0,0,0),ancestor=('0','1','t0','_','|','0')): + if width<1: raise ValueError('positive width') + u,c,p=origins + return [Tape({u-1:MARK,**{u+i:ONE for i in range(width)}},u),Tape({c-1:MARK},c), + Tape({p-1:MARK,**{p-2-i:s for i,s in enumerate(ancestor) if s!=BLANK}},p)] diff --git a/research/literal-selected-move-join/reference/leaf/leaf.py b/research/literal-selected-move-join/reference/leaf/leaf.py new file mode 100644 index 0000000000..bdcc80cbd8 --- /dev/null +++ b/research/literal-selected-move-join/reference/leaf/leaf.py @@ -0,0 +1,564 @@ +"""Literal positive rank-one Gaussian C tensor leaf on a packed m=9 field. + +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. C arithmetic and tensor algebra are credited #3091 predecessors. +Only fixed local instructions execute; encoded inputs do not specialize code. +""" +from pathlib import Path +import hashlib +import sys + +HERE = Path(__file__).resolve().parent +MACHINE = HERE / 'inputs' / 'controller_reference.py' +EXPECTED_MACHINE = 'e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73' +if hashlib.sha256(MACHINE.read_bytes()).hexdigest() != EXPECTED_MACHINE: + raise ValueError('frozen literal machine source drift') +sys.path.insert(0, str(MACHINE.parent)) +from controller_reference import Builder, Machine, Tape, BLANK, ONE, MARK + +(HEADER, DATA, A, B, MODE, HTRACE, LENGTH, DOUBLE, F, R, P, S, WIDTH, + FBIN, FLEN, TBIN, TLEN, PREFIX, SUFFIX, LEFT, RIGHT, LOUT, ROUT, + AR, AI, BR, BI, NUM, DTRACE) = range(29) +PRIVATE = tuple(range(2, 29)) +BITS = ('0', ONE) +INPUTS = (AR, AI, BR, BI) +ROWS = ((1, -1, 1, 1), (1, 1, -1, 1), + (1, 1, 1, -1), (-1, 1, 1, 1)) +NATIVE_DIMENSION = 9 + + +def fresh(a, stem): + a.serial += 1 + return stem + str(a.serial) + + +def clear(a, tape, symbols=(ONE,)): + k = fresh(a, 'clear') + a.mark(k) + a.op('read', tape, {s: k+'bit' for s in symbols} | {BLANK: k+'done'}) + a.mark(k+'bit') + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(tape, (BLANK,)) + + +def unary_copy(a, source, target, *, repeat=1, extra=0, erase=False): + k = fresh(a, 'copy') + a.mark(k) + a.op('read', source, {ONE: k+'bit', BLANK: k+'done'}) + a.mark(k+'bit') + for _ in range(repeat): + a.op('write', target, ONE) + a.op('move', target, 1) + if erase: + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('goto', k) + a.mark(k+'done') + for _ in range(extra): + a.op('write', target, ONE) + a.op('move', target, 1) + a.rewind(source, (BLANK,) if erase else (ONE,)) + a.rewind(target, (ONE,)) + + +def trace_return(a, tape, trace): + k = fresh(a, 'return') + a.op('move', trace, -1) + a.mark(k) + a.op('read', trace, {ONE: k+'bit', MARK: k+'done'}) + a.mark(k+'bit') + a.op('write', trace, BLANK) + a.op('move', trace, -1) + a.op('move', tape, -1) + a.op('goto', k) + a.mark(k+'done') + a.op('move', trace, 1) + + +def header_step(a): + a.op('write', HTRACE, ONE) + a.op('move', HTRACE, 1) + a.op('move', HEADER, 1) + + +def gamma(a, target, capture=None): + """Unary decode for parameters bounded by the actual field volume.""" + k = fresh(a, 'gamma') + a.mark(k+'prefix') + a.op('read', HEADER, {'0': k+'zero', ONE: k+'one'}) + a.mark(k+'zero') + a.op('write', LENGTH, ONE) + a.op('move', LENGTH, 1) + header_step(a) + a.op('goto', k+'prefix') + a.mark(k+'one') + header_step(a) + a.op('write', target, ONE) + if capture: + for tape, bit in ((capture[0], ONE), (capture[1], ONE)): + a.op('write', tape, bit) + a.op('move', tape, 1) + a.op('move', LENGTH, -1) + a.mark(k+'tail') + a.op('read', LENGTH, {ONE: k+'tailbit', MARK: k+'done'}) + a.mark(k+'tailbit') + a.op('write', LENGTH, BLANK) + a.op('read', HEADER, {str(b): k+'digit'+str(b) for b in (0, 1)}) + for bit in (0, 1): + a.mark(k+'digit'+str(bit)) + unary_copy(a, target, DOUBLE, repeat=2, extra=bit) + clear(a, target) + unary_copy(a, DOUBLE, target, erase=True) + if capture: + for tape, symbol in ((capture[0], str(bit)), (capture[1], ONE)): + a.op('write', tape, symbol) + a.op('move', tape, 1) + header_step(a) + a.op('move', LENGTH, -1) + a.op('goto', k+'tail') + a.mark(k+'done') + a.op('move', LENGTH, 1) + if capture: + a.rewind(capture[0], BITS) + a.rewind(capture[1], (ONE,)) + + +def gamma_binary(a): + """Keep cutoff in binary: its represented value can exceed V arbitrarily.""" + k = fresh(a, 'threshold') + a.mark(k+'prefix') + a.op('read', HEADER, {'0': k+'zero', ONE: k+'one'}) + a.mark(k+'zero') + a.op('write', LENGTH, ONE) + a.op('move', LENGTH, 1) + header_step(a) + a.op('goto', k+'prefix') + a.mark(k+'one') + a.op('write', TBIN, ONE) + a.op('move', TBIN, 1) + a.op('write', TLEN, ONE) + a.op('move', TLEN, 1) + header_step(a) + a.op('move', LENGTH, -1) + a.mark(k+'tail') + a.op('read', LENGTH, {ONE: k+'read', MARK: k+'done'}) + a.mark(k+'read') + a.op('write', LENGTH, BLANK) + a.op('read', HEADER, {str(b): k+str(b) for b in (0, 1)}) + for bit in ('0', ONE): + a.mark(k+bit) + a.op('write', TBIN, bit) + a.op('move', TBIN, 1) + a.op('write', TLEN, ONE) + a.op('move', TLEN, 1) + header_step(a) + a.op('move', LENGTH, -1) + a.op('goto', k+'tail') + a.mark(k+'done') + a.op('move', LENGTH, 1) + a.rewind(TBIN, BITS) + a.rewind(TLEN, (ONE,)) + + +def cutoff_guard(a): + k = fresh(a, 'compare') + a.mark(k+'length') + a.op('read', FLEN, {ONE: k+'fmore', BLANK: k+'fend'}) + a.mark(k+'fmore') + a.op('read', TLEN, {ONE: k+'step', BLANK: 'reject'}) + a.mark(k+'step') + a.op('move', FLEN, 1) + a.op('move', TLEN, 1) + a.op('goto', k+'length') + a.mark(k+'fend') + a.op('read', TLEN, {ONE: k+'done', BLANK: k+'equal_length'}) + a.mark(k+'equal_length') + a.rewind(FLEN, (ONE,)) + a.rewind(TLEN, (ONE,)) + a.mark(k+'lex') + a.op('read', FBIN, {'0': k+'f0', ONE: k+'f1', BLANK: k+'equal'}) + a.mark(k+'f0') + a.op('read', TBIN, {'0': k+'same', ONE: k+'done'}) + a.mark(k+'f1') + a.op('read', TBIN, {'0': 'reject', ONE: k+'same'}) + a.mark(k+'same') + a.op('move', FBIN, 1) + a.op('move', TBIN, 1) + a.op('goto', k+'lex') + a.mark(k+'equal') + a.op('read', TBIN, {BLANK: k+'done'}) + a.mark(k+'done') + for tape, symbols in ((FLEN, (ONE,)), (TLEN, (ONE,)), (FBIN, BITS), (TBIN, BITS)): + a.rewind(tape, symbols) + clear(a, tape, symbols) + + +def double(a, tape): + unary_copy(a, tape, DOUBLE, repeat=2) + clear(a, tape) + unary_copy(a, DOUBLE, tape, erase=True) + + +def halve(a, tape): + k = fresh(a, 'halve') + a.mark(k) + a.op('read', tape, {ONE: k+'first', BLANK: k+'done'}) + a.mark(k+'first') + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('read', tape, {ONE: k+'second', BLANK: 'reject'}) + a.mark(k+'second') + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('write', DOUBLE, ONE) + a.op('move', DOUBLE, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(tape, (BLANK,)) + a.rewind(DOUBLE, (ONE,)) + unary_copy(a, DOUBLE, tape, erase=True) + + +def product(a, left, right, target): + k = fresh(a, 'product') + a.mark(k+'outer') + a.op('read', left, {ONE: k+'inner', BLANK: k+'done'}) + a.mark(k+'inner') + a.op('read', right, {ONE: k+'bit', BLANK: k+'row'}) + a.mark(k+'bit') + a.op('write', target, ONE) + a.op('move', target, 1) + a.op('move', right, 1) + a.op('goto', k+'inner') + a.mark(k+'row') + a.rewind(right, (ONE,)) + a.op('move', left, 1) + a.op('goto', k+'outer') + a.mark(k+'done') + a.rewind(left, (ONE,)) + a.rewind(target, (ONE,)) + + +def geometry(a): + product(a, S, R, SUFFIX) + unary_copy(a, P, PREFIX) + k = fresh(a, 'geometry') + a.mark(k+'suffix') + a.op('read', F, {ONE: k+'block', BLANK: k+'suffix_done'}) + a.mark(k+'block') + for _ in range(NATIVE_DIMENSION-1): + double(a, SUFFIX) + a.op('move', F, 1) + a.op('goto', k+'suffix') + a.mark(k+'suffix_done') + a.rewind(F, (ONE,)) + a.op('move', F, 1) + a.mark(k+'prefix') + a.op('read', F, {ONE: k+'more', BLANK: k+'done'}) + a.mark(k+'more') + double(a, PREFIX) + a.op('move', F, 1) + a.op('goto', k+'prefix') + a.mark(k+'done') + a.rewind(F, (ONE,)) + for tape in (P, R, S): + clear(a, tape) + + +def copy_width(a, source, target, *, rewind_target=False): + k = fresh(a, 'widthcopy') + a.mark(k) + a.op('read', WIDTH, {ONE: k+'read', BLANK: k+'done'}) + a.mark(k+'read') + a.op('read', source, {str(b): k+str(b) for b in (0, 1)}) + for bit in ('0', ONE): + a.mark(k+bit) + a.op('write', target, bit) + a.op('move', target, 1) + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('move', WIDTH, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(WIDTH, (ONE,)) + if rewind_target: + a.rewind(target, BITS) + + +def load_suffix(a, source, target): + k = fresh(a, 'suffix') + a.mark(k) + a.op('read', SUFFIX, {ONE: k+'pair', BLANK: k+'done'}) + a.mark(k+'pair') + for _ in range(2): + copy_width(a, source, target) + a.op('move', SUFFIX, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(SUFFIX, (ONE,)) + a.rewind(target, BITS) + + +def emit_stream(a, source, target): + k = fresh(a, 'stream') + a.mark(k) + a.op('read', source, {str(b): k+str(b) for b in (0, 1)} | {BLANK: k+'done'}) + for bit in ('0', ONE): + a.mark(k+bit) + a.op('write', target, bit) + a.op('move', target, 1) + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(source, (BLANK,)) + + +def tuple_branch(a, label, emit, prefix=()): + """Compile the fixed sixteen branches of a four-symbol read.""" + name = label+''.join(map(str, prefix)) + a.mark(name) + if len(prefix) == 4: + emit(prefix) + else: + a.op('read', INPUTS[len(prefix)], {str(b): name+str(b) for b in (0, 1)}) + for bit in (0, 1): + tuple_branch(a, label, emit, prefix+(bit,)) + + +def c_component(a, signs, output): + """Exact four-input numerator, two sign extensions, halving and fit.""" + k = fresh(a, 'C') + a.mark(k+'seek') + a.op('read', WIDTH, {ONE: k+'seekbit', BLANK: k+'seekend'}) + a.mark(k+'seekbit') + for tape in INPUTS: + a.op('move', tape, 1) + a.op('move', WIDTH, 1) + a.op('goto', k+'seek') + a.mark(k+'seekend') + a.rewind(WIDTH, (ONE,)) + for tape in INPUTS: + a.op('move', tape, -1) + a.op('goto', k+'digit0') + for carry in (-1, 0, 1, 2): + label = k+'digit'+str(carry) + a.mark(label) + a.op('read', WIDTH, {ONE: label+'read', BLANK: k+'extend'+str(carry)}) + def digit(bits, carry=carry): + total = carry+sum(s*b for s, b in zip(signs, bits)) + a.op('write', NUM, str(total % 2)) + a.op('move', NUM, 1) + for tape in INPUTS: + a.op('move', tape, -1) + a.op('move', WIDTH, 1) + a.op('goto', k+'digit'+str(total//2)) + tuple_branch(a, label+'read', digit) + a.mark(k+'extend'+str(carry)) + for tape in INPUTS: + a.op('move', tape, 1) + a.rewind(WIDTH, (ONE,)) + a.op('goto', k+'sign1c'+str(carry)) + for stage in (1, 2): + for carry in (-1, 0, 1, 2): + def extension(bits, carry=carry, stage=stage): + total = carry+sum(s*b for s, b in zip(signs, bits)) + a.op('write', NUM, str(total % 2)) + a.op('move', NUM, 1) + a.op('goto', k+'sign2c'+str(total//2) if stage == 1 else k+'check') + tuple_branch(a, k+'sign'+str(stage)+'c'+str(carry), extension) + a.mark(k+'check') + a.rewind(NUM, BITS) + a.op('read', NUM, {'0': k+'even', ONE: 'reject'}) + a.mark(k+'even') + a.op('write', NUM, BLANK) + a.op('move', NUM, 1) + a.mark(k+'highseek') + a.op('read', NUM, {'0': k+'highstep', ONE: k+'highstep', BLANK: k+'highend'}) + a.mark(k+'highstep') + a.op('move', NUM, 1) + a.op('goto', k+'highseek') + a.mark(k+'highend') + a.op('move', NUM, -1) + a.op('read', NUM, {str(b): k+'top'+str(b) for b in (0, 1)}) + for bit in ('0', ONE): + a.mark(k+'top'+bit) + a.op('write', NUM, BLANK) + a.op('move', NUM, -1) + a.op('read', NUM, {bit: k+'emit'}) + a.mark(k+'emit') + a.op('read', WIDTH, {ONE: k+'emitread', BLANK: k+'done'}) + a.mark(k+'emitread') + a.op('read', NUM, {str(b): k+'emit'+str(b) for b in (0, 1)}) + for bit in ('0', ONE): + a.mark(k+'emit'+bit) + a.op('write', output, bit) + a.op('move', output, 1) + a.op('write', NUM, BLANK) + a.op('move', NUM, -1) + a.op('move', WIDTH, 1) + a.op('goto', k+'emit') + a.mark(k+'done') + a.rewind(WIDTH, (ONE,)) + + +def clone_source(a): + """Clone exactly the generated volume; reject short/excess cardinality.""" + k = fresh(a, 'clone') + a.mark(k+'prefix') + a.op('read', PREFIX, {ONE: k+'blocks', BLANK: k+'done'}) + a.mark(k+'blocks') + for side in range(2): + name = k+'side'+str(side) + a.mark(name) + a.op('read', SUFFIX, {ONE: name+'coefficient', BLANK: name+'done'}) + a.mark(name+'coefficient') + for component in range(2): + field = name+'field'+str(component) + a.mark(field) + a.op('read', WIDTH, {ONE: field+'read', BLANK: field+'done'}) + a.mark(field+'read') + a.op('read', DATA, {str(b): field+str(b) for b in (0, 1)}) + for bit in ('0', ONE): + a.mark(field+bit) + a.op('write', A, bit) + a.op('move', A, 1) + a.op('move', DATA, 1) + a.op('write', DTRACE, ONE) + a.op('move', DTRACE, 1) + a.op('move', WIDTH, 1) + a.op('goto', field) + a.mark(field+'done') + a.rewind(WIDTH, (ONE,)) + a.op('move', SUFFIX, 1) + a.op('goto', name) + a.mark(name+'done') + a.rewind(SUFFIX, (ONE,)) + a.op('move', PREFIX, 1) + a.op('goto', k+'prefix') + a.mark(k+'done') + a.rewind(PREFIX, (ONE,)) + a.op('read', DATA, {BLANK: k+'verified'}) + a.mark(k+'verified') + trace_return(a, DATA, DTRACE) + a.rewind(A, BITS) + + +def commit(a, source): + k = fresh(a, 'commit') + a.mark(k) + a.op('read', source, {str(b): k+str(b) for b in (0, 1)} | {BLANK: k+'done'}) + for bit in ('0', ONE): + a.mark(k+bit) + a.op('write', DATA, bit) + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('move', DATA, 1) + a.op('write', DTRACE, ONE) + a.op('move', DTRACE, 1) + a.op('goto', k) + a.mark(k+'done') + trace_return(a, DATA, DTRACE) + a.rewind(source, (BLANK,)) + + +def compile_leaf(): + a = Builder() + for tape in PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, MARK) + a.op('move', tape, 1) + gamma(a, F, (FBIN, FLEN)) + for tape in (R, P, S, WIDTH): + gamma(a, tape) + gamma_binary(a) + trace_return(a, HEADER, HTRACE) + cutoff_guard(a) + for i in range(2): + a.op('read', WIDTH, {ONE: 'width'+str(i)}) + a.mark('width'+str(i)) + a.op('move', WIDTH, 1) + a.rewind(WIDTH, (ONE,)) + geometry(a) + clone_source(a) + a.op('write', MODE, '0') + a.mark('prefix') + a.op('read', PREFIX, {ONE: 'load_select', BLANK: 'axis_end'}) + a.mark('load_select') + a.op('read', MODE, {'0': 'loadA', ONE: 'loadB'}) + for mode, source in enumerate((A, B)): + a.mark('load'+('A' if mode == 0 else 'B')) + load_suffix(a, source, LEFT) + load_suffix(a, source, RIGHT) + a.op('goto', 'pairs') + a.mark('pairs') + a.op('read', SUFFIX, {ONE: 'pair', BLANK: 'pairs_done'}) + a.mark('pair') + for source, target in ((LEFT, AR), (LEFT, AI), (RIGHT, BR), (RIGHT, BI)): + copy_width(a, source, target, rewind_target=True) + for signs, output in zip(ROWS, (LOUT, LOUT, ROUT, ROUT)): + c_component(a, signs, output) + for tape in INPUTS: + clear(a, tape, BITS) + a.op('move', SUFFIX, 1) + a.op('goto', 'pairs') + a.mark('pairs_done') + a.rewind(SUFFIX, (ONE,)) + for tape in (LEFT, RIGHT): + a.rewind(tape, (BLANK,)) + for tape in (LOUT, ROUT): + a.rewind(tape, BITS) + a.op('read', MODE, {'0': 'mergeB', ONE: 'mergeA'}) + for name, target in (('mergeB', B), ('mergeA', A)): + a.mark(name) + emit_stream(a, LOUT, target) + emit_stream(a, ROUT, target) + a.op('goto', 'prefix_done') + a.mark('prefix_done') + a.op('move', PREFIX, 1) + a.op('goto', 'prefix') + a.mark('axis_end') + a.op('read', MODE, {'0': 'endA', ONE: 'endB'}) + for mode, source, target in ((0, A, B), (1, B, A)): + name = 'end'+('A' if mode == 0 else 'B') + a.mark(name) + a.op('read', source, {BLANK: name+'valid'}) + a.mark(name+'valid') + a.rewind(source, (BLANK,)) + a.rewind(target, BITS) + a.op('write', MODE, str(1-mode)) + a.op('goto', 'axis_done') + a.mark('axis_done') + a.rewind(PREFIX, (ONE,)) + a.op('move', F, 1) + a.op('read', F, {ONE: 'next_axis', BLANK: 'finish'}) + a.mark('next_axis') + double(a, SUFFIX) + halve(a, PREFIX) + a.op('goto', 'prefix') + a.mark('finish') + a.op('read', MODE, {'0': 'commitA', ONE: 'commitB'}) + for name, source in (('commitA', A), ('commitB', B)): + a.mark(name) + commit(a, source) + a.op('goto', 'retire') + a.mark('retire') + a.rewind(F, (ONE,)) + for tape in (F, WIDTH, PREFIX, SUFFIX): + clear(a, tape) + clear(a, MODE, BITS) + for tape in PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('halt') + a.mark('reject') + a.op('read', HEADER, {}) + return a.finish((BLANK, '0', ONE, MARK)) + + + + diff --git a/research/literal-selected-move-join/reference/linear/NOTICE.md b/research/literal-selected-move-join/reference/linear/NOTICE.md new file mode 100644 index 0000000000..3a3030f23d --- /dev/null +++ b/research/literal-selected-move-join/reference/linear/NOTICE.md @@ -0,0 +1,36 @@ +# Attribution and scope + +New construction, source binding, uniform complete-cost proof, author checks +and packaging were prepared for Jerry Chen (@CubeJerry), with substantial +OpenAI assistance. Independent receipts identify the separate executing +reviewer and distinct methods. No human or proof-kernel verification of the +multiplication theorem is claimed. New work is Apache-2.0. + +Credit Matarener's #3825 controlled reversal and #3834's finite identity +check; David Arias's #2776/fixed-tape-ordered-shear split/merge, unary conversion +and local return method; the fixed-tape-affine-shear runtime-coefficient +extension and its credited Charles Bethin unit-carry predecessor; JoyboyBrian's +#5188 complete literal interchange and binary-alphabet successor; Jose Manuel's +physical Gaussian monomial and #3087/#4172 lineage; the selected monomial +record lift; and #6992's current serial-column implication and conditional +bill. These algebraic and routing methods are not new claims here. + +The #7000 selected native/compiler/application-review authors supply the +actual word, exact Clifford lowering, signed Gaussian interpreter and phase +conventions. Their retained source notices are unchanged. + +The published controller `9dfe6747b8553fd11b408f2b045c5954ef1e6eaa` supplies +Builder/Machine/Tape. The literal layer phase +`8b549ca6557ccbb3017b104b27ea35051f990416`, selected quadratic phase +`172f4535ce8dcff79f626410af845f757c1563be`, and positive C leaf +`1a555e469b89af70d309bc966f8f813ac11dc887` supply the shared packed interface +and reusable local acquisition/copy/return patterns. Exact reference copies +and source pins are retained. The new `fresh` adds a label delimiter to avoid +decimal label collisions in the larger compile-time word. + +C4's dense author-test interpreter is retained as a source reference. This +package changes its fixed inventory from 29 to 27 and raises only its external +watchdog. That reuse is not presented as independently written review. Root's +independent interpreter/oracle were written separately and are retained +unchanged. No invented PR number is used for newly published fork branches; +they are identified by exact commits until a PR exists. diff --git a/research/literal-selected-move-join/reference/linear/inputs/controller_reference.py b/research/literal-selected-move-join/reference/linear/inputs/controller_reference.py new file mode 100644 index 0000000000..3ab6d0361f --- /dev/null +++ b/research/literal-selected-move-join/reference/linear/inputs/controller_reference.py @@ -0,0 +1,112 @@ +"""Finite three-tape online rank-recursion control; Apache-2.0. +Only PC and local symbols affect execution. Metrics/event logs are observers. +""" +from dataclasses import dataclass, field +BLANK, ONE, MARK = '_', '1', '|' +WIDTH, CHILD, STACK = range(3) + +class Builder: + def __init__(self): self.code, self.labels, self.serial = [], {}, 0 + def mark(self,n): + if n in self.labels: raise ValueError('duplicate label') + self.labels[n]=len(self.code) + def op(self,*x): self.code.append(x) + def rewind(self,t,symbols): + self.serial+=1; loop=f'rw{self.serial}'; done=loop+'done' + self.op('move',t,-1); self.mark(loop) + self.op('read',t,{s:loop+'step' for s in symbols}|{MARK:done}) + self.mark(loop+'step'); self.op('move',t,-1); self.op('goto',loop) + self.mark(done); self.op('move',t,1) + def finish(self,alphabet): + result=[] + for op,*a in self.code: + if op=='goto': a[0]=self.labels[a[0]] + elif op=='read': a[1]={s:self.labels[n] for s,n in a[1].items()} + result.append((op,*a)) + return tuple(result),tuple(alphabet) + +def compile_controller(m,ranks): + """Parameters are compile-time constants, absent from run-time state.""" + if type(m) is not int or m<2 or not ranks: raise ValueError('bad fixed profile') + if any(type(r) is not int or not 1<=r=budget: raise ValueError('finite verifier budget') + self.step() + return self + +def initial_tapes(width,origins=(0,0,0),ancestor=('0','1','t0','_','|','0')): + if width<1: raise ValueError('positive width') + u,c,p=origins + return [Tape({u-1:MARK,**{u+i:ONE for i in range(width)}},u),Tape({c-1:MARK},c), + Tape({p-1:MARK,**{p-2-i:s for i,s in enumerate(ancestor) if s!=BLANK}},p)] diff --git a/research/literal-selected-move-join/reference/linear/linear.py b/research/literal-selected-move-join/reference/linear/linear.py new file mode 100644 index 0000000000..6aad40a6c4 --- /dev/null +++ b/research/literal-selected-move-join/reference/linear/linear.py @@ -0,0 +1,435 @@ +"""Literal selected nine-coordinate linear maps on a packed Gaussian field. + +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. Split/merge, unary clocks and CNOT decomposition are credited +predecessor methods; this is their exact encoded all-column selected join. +""" +from pathlib import Path +import hashlib +import sys + +HERE = Path(__file__).resolve().parent +MACHINE = HERE/'inputs/controller_reference.py' +EXPECTED_MACHINE = 'e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73' +if hashlib.sha256(MACHINE.read_bytes()).hexdigest() != EXPECTED_MACHINE: + raise ValueError('frozen local machine source drift') +sys.path.insert(0, str(MACHINE.parent)) +from controller_reference import Builder, Machine, Tape, BLANK, ONE, MARK + +(HEADER, DATA, A, B, MODE, HTRACE, LENGTH, DOUBLE, F, R, P, S, WIDTH, + VOLUME, AUX, PREFIX, MIDDLE, BLOCK, LEFT, RIGHT, LOUT, ROUT, + Q0, Q1, Q2, Q3, DTRACE) = range(27) +PRIVATE = tuple(range(2, 27)) +BITS = ('0', ONE) +CHUNKS = (Q0, Q1, Q2, Q3) +MATRICES = { + 'right': (239,129,130,132,136,16,160,192,256), + 'left': (3,5,9,17,32,65,129,1,256), +} +DIMENSION = 9 + + +def cnot_word(rows): + """Fixed-data Gaussian elimination; no input header is consulted.""" + if len(rows) != DIMENSION or any(type(x) is not int or not 0 <= x < 1 << DIMENSION for x in rows): + raise ValueError('fixed nine-coordinate matrix') + choices = [] + for order in (range(DIMENSION), range(DIMENSION-1, -1, -1)): + a, eliminated, word = list(rows), set(), [] + def add(target, control): + a[target] ^= a[control] + word.append((target, control)) + for j in order: + if not (a[j] >> j) & 1: + candidates = [i for i in range(DIMENSION) if i not in eliminated and (a[i] >> j) & 1] + if not candidates: + raise ValueError('singular fixed matrix') + k = candidates[0] + add(j, k); add(k, j); add(j, k) + for i in range(DIMENSION): + if i != j and (a[i] >> j) & 1: + add(i, j) + eliminated.add(j) + if a != [1 << i for i in range(DIMENSION)]: + raise ValueError('fixed elimination invariant') + choices.append(tuple(reversed(word))) + return min(choices, key=lambda x: (len(x), x)) + + +def fresh(a, stem): + a.serial += 1 + return stem + str(a.serial) + '_' + + + +def clear(a, tape, symbols=(ONE,)): + k = fresh(a, 'clear') + a.mark(k) + a.op('read', tape, {s: k+'bit' for s in symbols} | {BLANK: k+'done'}) + a.mark(k+'bit') + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(tape, (BLANK,)) + + + +def unary_copy(a, source, target, *, repeat=1, extra=0, erase=False): + k = fresh(a, 'copy') + a.mark(k) + a.op('read', source, {ONE: k+'bit', BLANK: k+'done'}) + a.mark(k+'bit') + for _ in range(repeat): + a.op('write', target, ONE) + a.op('move', target, 1) + if erase: + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('goto', k) + a.mark(k+'done') + for _ in range(extra): + a.op('write', target, ONE) + a.op('move', target, 1) + a.rewind(source, (BLANK,) if erase else (ONE,)) + a.rewind(target, (ONE,)) + + + +def header_step(a): + a.op('write', HTRACE, ONE) + a.op('move', HTRACE, 1) + a.op('move', HEADER, 1) + + + +def gamma(a, target): + """Actual positive Gamma code to unary, using only literal operations.""" + k = fresh(a, 'gamma') + a.mark(k+'prefix') + a.op('read', HEADER, {'0': k+'zero', ONE: k+'one'}) + a.mark(k+'zero') + a.op('write', LENGTH, ONE) + a.op('move', LENGTH, 1) + header_step(a) + a.op('goto', k+'prefix') + a.mark(k+'one') + header_step(a) + a.op('write', target, ONE) + a.op('move', LENGTH, -1) + a.mark(k+'tail') + a.op('read', LENGTH, {ONE: k+'tailbit', MARK: k+'done'}) + a.mark(k+'tailbit') + a.op('write', LENGTH, BLANK) + a.op('read', HEADER, {str(b): k+'digit'+str(b) for b in (0, 1)}) + for b in (0, 1): + a.mark(k+'digit'+str(b)) + unary_copy(a, target, DOUBLE, repeat=2, extra=b) + clear(a, target) + unary_copy(a, DOUBLE, target, erase=True) + header_step(a) + a.op('move', LENGTH, -1) + a.op('goto', k+'tail') + a.mark(k+'done') + a.op('move', LENGTH, 1) + + + +def trace_return(a, tape, trace): + k = fresh(a, 'return') + a.op('move', trace, -1) + a.mark(k) + a.op('read', trace, {ONE: k+'bit', MARK: k+'done'}) + a.mark(k+'bit') + a.op('write', trace, BLANK) + a.op('move', trace, -1) + a.op('move', tape, -1) + a.op('goto', k) + a.mark(k+'done') + a.op('move', trace, 1) + + + +def double(a, tape): + unary_copy(a, tape, DOUBLE, repeat=2) + clear(a, tape) + unary_copy(a, DOUBLE, tape, erase=True) + + + +def halve(a, tape): + k = fresh(a, 'halve') + a.mark(k) + a.op('read', tape, {ONE: k+'first', BLANK: k+'done'}) + a.mark(k+'first') + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('read', tape, {ONE: k+'second', BLANK: 'reject'}) + a.mark(k+'second') + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('write', DOUBLE, ONE) + a.op('move', DOUBLE, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(tape, (BLANK,)) + a.rewind(DOUBLE, (ONE,)) + unary_copy(a, DOUBLE, tape, erase=True) + + + +def product(a, left, right, target): + k = fresh(a, 'product') + a.mark(k+'outer') + a.op('read', left, {ONE: k+'inner', BLANK: k+'done'}) + a.mark(k+'inner') + a.op('read', right, {ONE: k+'bit', BLANK: k+'row'}) + a.mark(k+'bit') + a.op('write', target, ONE) + a.op('move', target, 1) + a.op('move', right, 1) + a.op('goto', k+'inner') + a.mark(k+'row') + a.rewind(right, (ONE,)) + a.op('move', left, 1) + a.op('goto', k+'outer') + a.mark(k+'done') + a.rewind(left, (ONE,)) + a.rewind(target, (ONE,)) + + + +def emit_stream(a, source, target): + k = fresh(a, 'stream') + a.mark(k) + a.op('read', source, {str(b): k+str(b) for b in (0, 1)} | {BLANK: k+'done'}) + for bit in ('0', ONE): + a.mark(k+bit) + a.op('write', target, bit) + a.op('move', target, 1) + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(source, (BLANK,)) + + + +def commit(a, source): + k = fresh(a, 'commit') + a.mark(k) + a.op('read', source, {str(b): k+str(b) for b in (0, 1)} | {BLANK: k+'done'}) + for bit in ('0', ONE): + a.mark(k+bit) + a.op('write', DATA, bit) + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('move', DATA, 1) + a.op('write', DTRACE, ONE) + a.op('move', DTRACE, 1) + a.op('goto', k) + a.mark(k+'done') + trace_return(a, DATA, DTRACE) + a.rewind(source, (BLANK,)) + + + +def multiply_guide(a, target, factor): + product(a, target, factor, AUX) + clear(a, target) + unary_copy(a, AUX, target, erase=True) + + +def column_doublings(a, target, times): + """times is fixed construction data; the actual F loop survives.""" + k = fresh(a, 'column_double') + a.mark(k) + a.op('read', F, {ONE: k+'more', BLANK: k+'done'}) + a.mark(k+'more') + for _ in range(times): + double(a, target) + a.op('move', F, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(F, (ONE,)) + + +def volume(a): + unary_copy(a, P, VOLUME) + for factor in (R, S, WIDTH): + multiply_guide(a, VOLUME, factor) + column_doublings(a, VOLUME, DIMENSION) + double(a, VOLUME) + + +def geometry(a, high, low): + # At j=0: A=P*2^((high+1)f-1), M=2^((low-high)f-1), + # B=2wrS*2^((8-low)f). Temporary doubles are also paid. + unary_copy(a, P, PREFIX) + column_doublings(a, PREFIX, high+1) + halve(a, PREFIX) + a.op('write', MIDDLE, ONE) + column_doublings(a, MIDDLE, low-high) + halve(a, MIDDLE) + product(a, R, S, BLOCK) + multiply_guide(a, BLOCK, WIDTH) + double(a, BLOCK) + column_doublings(a, BLOCK, DIMENSION-1-low) + + +def clone(a): + k = fresh(a, 'clone') + a.mark(k) + a.op('read', VOLUME, {ONE: k+'read', BLANK: k+'done'}) + a.mark(k+'read') + a.op('read', DATA, {str(b): k+str(b) for b in (0, 1)}) + for bit in BITS: + a.mark(k+bit) + a.op('write', A, bit) + a.op('move', A, 1) + a.op('move', DATA, 1) + a.op('write', DTRACE, ONE) + a.op('move', DTRACE, 1) + a.op('move', VOLUME, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(VOLUME, (ONE,)) + a.op('read', DATA, {BLANK: k+'valid'}) + a.mark(k+'valid') + trace_return(a, DATA, DTRACE) + a.rewind(A, BITS) + + +def copy_block(a, source, target, *, return_target=False): + k = fresh(a, 'block_copy') + a.mark(k) + a.op('read', BLOCK, {ONE: k+'read', BLANK: k+'done'}) + a.mark(k+'read') + a.op('read', source, {str(b): k+str(b) for b in (0, 1)}) + for bit in BITS: + a.mark(k+bit) + a.op('write', target, bit) + a.op('move', target, 1) + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('move', BLOCK, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(BLOCK, (ONE,)) + if return_target: + a.rewind(target, BITS) + + +def load_half(a, source, target): + k = fresh(a, 'half') + a.mark(k) + a.op('read', MIDDLE, {ONE: k+'two', BLANK: k+'done'}) + a.mark(k+'two') + for _ in range(2): + copy_block(a, source, target) + a.op('move', MIDDLE, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(MIDDLE, (ONE,)) + a.rewind(target, BITS) + + +def cnot_columns(a, target, control): + """All encoded F columns of one fixed CNOT, both physical directions.""" + high, low = min(target, control), max(target, control) + permutation = (0, 1, 3, 2) if control == high else (0, 3, 2, 1) + geometry(a, high, low) + k = fresh(a, 'cnot') + a.mark(k+'prefix') + a.op('read', PREFIX, {ONE: k+'load_select', BLANK: k+'end'}) + a.mark(k+'load_select') + a.op('read', MODE, {'0': k+'loadA', ONE: k+'loadB'}) + for source, label in ((A, 'A'), (B, 'B')): + a.mark(k+'load'+label) + load_half(a, source, LEFT) + load_half(a, source, RIGHT) + a.op('goto', k+'middle') + a.mark(k+'middle') + a.op('read', MIDDLE, {ONE: k+'chunks', BLANK: k+'middle_done'}) + a.mark(k+'chunks') + for source, chunk in ((LEFT, Q0), (LEFT, Q1), (RIGHT, Q2), (RIGHT, Q3)): + copy_block(a, source, chunk, return_target=True) + for i, index in enumerate(permutation): + emit_stream(a, CHUNKS[index], LOUT if i < 2 else ROUT) + a.op('move', MIDDLE, 1) + a.op('goto', k+'middle') + a.mark(k+'middle_done') + a.rewind(MIDDLE, (ONE,)) + for tape in (LEFT, RIGHT): + a.rewind(tape, (BLANK,)) + for tape in (LOUT, ROUT): + a.rewind(tape, BITS) + a.op('read', MODE, {'0': k+'mergeB', ONE: k+'mergeA'}) + for label, destination in (('mergeB', B), ('mergeA', A)): + a.mark(k+label) + emit_stream(a, LOUT, destination) + emit_stream(a, ROUT, destination) + a.op('goto', k+'prefix_done') + a.mark(k+'prefix_done') + a.op('move', PREFIX, 1) + a.op('goto', k+'prefix') + a.mark(k+'end') + a.op('read', MODE, {'0': k+'endA', ONE: k+'endB'}) + for mode, source, destination in ((0, A, B), (1, B, A)): + label = k+'end'+('A' if mode == 0 else 'B') + a.mark(label) + a.op('read', source, {BLANK: label+'valid'}) + a.mark(label+'valid') + a.rewind(source, (BLANK,)) + a.rewind(destination, BITS) + a.op('write', MODE, str(1-mode)) + a.op('goto', k+'column_done') + a.mark(k+'column_done') + a.rewind(PREFIX, (ONE,)) + a.op('move', F, 1) + a.op('read', F, {ONE: k+'next_column', BLANK: k+'finished'}) + a.mark(k+'next_column') + double(a, BLOCK) + halve(a, PREFIX) + a.op('goto', k+'prefix') + a.mark(k+'finished') + a.rewind(F, (ONE,)) + for tape in (PREFIX, MIDDLE, BLOCK): + clear(a, tape) + + +def compile_linear(side): + """side is fixed construction data: exactly 'left' or 'right'.""" + if side not in MATRICES: + raise ValueError('one of the two selected fixed linear maps is required') + word = cnot_word(MATRICES[side]) + a = Builder() + for tape in PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, MARK) + a.op('move', tape, 1) + for target in (F, R, P, S, WIDTH): + gamma(a, target) + trace_return(a, HEADER, HTRACE) + volume(a) + clone(a) + a.op('write', MODE, '0') + for target, control in word: + cnot_columns(a, target, control) + a.op('read', MODE, {'0': 'commitA', ONE: 'commitB'}) + for label, source in (('commitA', A), ('commitB', B)): + a.mark(label) + commit(a, source) + a.op('goto', 'retire') + a.mark('retire') + for tape in (F, R, P, S, WIDTH, VOLUME): + clear(a, tape) + clear(a, MODE, BITS) + for tape in PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('halt') + a.mark('reject') + a.op('read', HEADER, {}) + return a.finish((BLANK, '0', ONE, MARK)) diff --git a/research/literal-selected-move-join/reference/phase/NOTICE b/research/literal-selected-move-join/reference/phase/NOTICE new file mode 100644 index 0000000000..7a1f1da9c5 --- /dev/null +++ b/research/literal-selected-move-join/reference/phase/NOTICE @@ -0,0 +1,11 @@ +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. New contribution: literal local lowering, scoped proof and package. +Ali Romman/#5375 supplies the incremental phase and repeated constant. +The retained reference files preserve original source text. +#7000 and its native/Gaussian lineage supply the selected source and engines; +credit DreamingOfClouds, Ali Romman, Cinna Davis, zxv, unpaidmoon, icekylinx, +CubeJerry and earlier authors named by the retained source. +C2 literal-layer-phase supplies Gamma and signed staging/return. B1 literal- +layer-egress supplies owner staging, and #7349 the retained literal machine. +Exact original/copy source pins are in SOURCES.json. No predecessor identity, +compiler, source construction or general monomial theorem is claimed as new. diff --git a/research/literal-selected-move-join/reference/phase/inputs/controller_reference.py b/research/literal-selected-move-join/reference/phase/inputs/controller_reference.py new file mode 100644 index 0000000000..3ab6d0361f --- /dev/null +++ b/research/literal-selected-move-join/reference/phase/inputs/controller_reference.py @@ -0,0 +1,112 @@ +"""Finite three-tape online rank-recursion control; Apache-2.0. +Only PC and local symbols affect execution. Metrics/event logs are observers. +""" +from dataclasses import dataclass, field +BLANK, ONE, MARK = '_', '1', '|' +WIDTH, CHILD, STACK = range(3) + +class Builder: + def __init__(self): self.code, self.labels, self.serial = [], {}, 0 + def mark(self,n): + if n in self.labels: raise ValueError('duplicate label') + self.labels[n]=len(self.code) + def op(self,*x): self.code.append(x) + def rewind(self,t,symbols): + self.serial+=1; loop=f'rw{self.serial}'; done=loop+'done' + self.op('move',t,-1); self.mark(loop) + self.op('read',t,{s:loop+'step' for s in symbols}|{MARK:done}) + self.mark(loop+'step'); self.op('move',t,-1); self.op('goto',loop) + self.mark(done); self.op('move',t,1) + def finish(self,alphabet): + result=[] + for op,*a in self.code: + if op=='goto': a[0]=self.labels[a[0]] + elif op=='read': a[1]={s:self.labels[n] for s,n in a[1].items()} + result.append((op,*a)) + return tuple(result),tuple(alphabet) + +def compile_controller(m,ranks): + """Parameters are compile-time constants, absent from run-time state.""" + if type(m) is not int or m<2 or not ranks: raise ValueError('bad fixed profile') + if any(type(r) is not int or not 1<=r=budget: raise ValueError('finite verifier budget') + self.step() + return self + +def initial_tapes(width,origins=(0,0,0),ancestor=('0','1','t0','_','|','0')): + if width<1: raise ValueError('positive width') + u,c,p=origins + return [Tape({u-1:MARK,**{u+i:ONE for i in range(width)}},u),Tape({c-1:MARK},c), + Tape({p-1:MARK,**{p-2-i:s for i,s in enumerate(ancestor) if s!=BLANK}},p)] diff --git a/research/literal-selected-move-join/reference/phase/phase.py b/research/literal-selected-move-join/reference/phase/phase.py new file mode 100644 index 0000000000..d489781458 --- /dev/null +++ b/research/literal-selected-move-join/reference/phase/phase.py @@ -0,0 +1,335 @@ +"""Literal selected native quadratic phase, with complete owner commit. + +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. The multi-counter phase algorithm is credited to #5375. Header, +signed staging and return helpers are retained from the frozen C2 phase. +Only fixed-table read/write/unit-move/goto/halt instructions execute. +""" +from pathlib import Path +import hashlib +import sys + +HERE = Path(__file__).resolve().parent +MACHINE = HERE / 'inputs' / 'controller_reference.py' +EXPECTED_MACHINE = 'e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73' +if hashlib.sha256(MACHINE.read_bytes()).hexdigest() != EXPECTED_MACHINE: + raise ValueError('frozen literal machine source drift') +sys.path.insert(0, str(MACHINE.parent)) +from controller_reference import Builder, Machine, Tape, BLANK, ONE, MARK + +(HEADER, DATA, OUTPUT, HTRACE, LENGTH, DOUBLE, COLUMNS, COEFF, OUTER, + SPECTATOR, WIDTH, REAL, IMAG, DTRACE) = range(14) +COUNTERS = tuple(range(14, 23)) +PRIVATE = tuple(range(2, 23)) +BITS = ('0', ONE) +SELECTED_LINEAR = (3, 3, 3, 3, 0, 3, 3, 2, 0) +SELECTED_ROWS = (111, 111, 111, 111, 0, 111, 111, 0, 0) +SELECTED_CONSTANT = 1 + + +def fresh(a, stem): + a.serial += 1 + return stem + str(a.serial) + + +def clear(a, tape, symbols=(ONE,)): + k = fresh(a, 'clear') + a.mark(k) + a.op('read', tape, {s: k+'bit' for s in symbols} | {BLANK: k+'done'}) + a.mark(k+'bit') + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(tape, (BLANK,)) + + +def unary_copy(a, source, target, *, repeat=1, extra=0, erase=False): + k = fresh(a, 'copy') + a.mark(k) + a.op('read', source, {ONE: k+'bit', BLANK: k+'done'}) + a.mark(k+'bit') + for _ in range(repeat): + a.op('write', target, ONE) + a.op('move', target, 1) + if erase: + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('goto', k) + a.mark(k+'done') + for _ in range(extra): + a.op('write', target, ONE) + a.op('move', target, 1) + a.rewind(source, (BLANK,) if erase else (ONE,)) + a.rewind(target, (ONE,)) + + +def header_step(a): + a.op('write', HTRACE, ONE) + a.op('move', HTRACE, 1) + a.op('move', HEADER, 1) + + +def gamma(a, target): + """Actual positive Gamma code to unary, using only literal operations.""" + k = fresh(a, 'gamma') + a.mark(k+'prefix') + a.op('read', HEADER, {'0': k+'zero', ONE: k+'one'}) + a.mark(k+'zero') + a.op('write', LENGTH, ONE) + a.op('move', LENGTH, 1) + header_step(a) + a.op('goto', k+'prefix') + a.mark(k+'one') + header_step(a) + a.op('write', target, ONE) + a.op('move', LENGTH, -1) + a.mark(k+'tail') + a.op('read', LENGTH, {ONE: k+'tailbit', MARK: k+'done'}) + a.mark(k+'tailbit') + a.op('write', LENGTH, BLANK) + a.op('read', HEADER, {str(b): k+'digit'+str(b) for b in (0, 1)}) + for b in (0, 1): + a.mark(k+'digit'+str(b)) + unary_copy(a, target, DOUBLE, repeat=2, extra=b) + clear(a, target) + unary_copy(a, DOUBLE, target, erase=True) + header_step(a) + a.op('move', LENGTH, -1) + a.op('goto', k+'tail') + a.mark(k+'done') + a.op('move', LENGTH, 1) + + +def trace_return(a, tape, trace): + k = fresh(a, 'return') + a.op('move', trace, -1) + a.mark(k) + a.op('read', trace, {ONE: k+'bit', MARK: k+'done'}) + a.mark(k+'bit') + a.op('write', trace, BLANK) + a.op('move', trace, -1) + a.op('move', tape, -1) + a.op('goto', k) + a.mark(k+'done') + a.op('move', trace, 1) + + +def load_component(a, target): + k = fresh(a, 'load') + a.mark(k) + a.op('read', WIDTH, {ONE: k+'bit', BLANK: k+'done'}) + a.mark(k+'bit') + a.op('read', DATA, {str(b): k+str(b) for b in (0, 1)}) + for b in (0, 1): + a.mark(k+str(b)) + a.op('write', target, str(b)) + a.op('move', target, 1) + a.op('move', DATA, 1) + a.op('write', DTRACE, ONE) + a.op('move', DTRACE, 1) + a.op('move', WIDTH, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(WIDTH, (ONE,)) + a.rewind(target, BITS) + + +def negate(a, tape): + """Exact w-bit integer negation; reject the unrepresentable minimum.""" + k = fresh(a, 'neg') + a.mark(k+'seek') + a.op('read', tape, {'0': k+'step', ONE: k+'step', BLANK: k+'last'}) + a.mark(k+'step') + a.op('move', tape, 1) + a.op('goto', k+'seek') + a.mark(k+'last') + a.op('move', tape, -1) + a.op('goto', k+'c1x0y0') + for carry in (0, 1): + for old_sign in (0, 1): + for new_sign in (0, 1): + name = k+f'c{carry}x{old_sign}y{new_sign}' + a.mark(name) + a.op('read', tape, {str(b): name+'b'+str(b) for b in (0, 1)} | + {MARK: 'reject' if old_sign and new_sign else k+'done'}) + for bit in (0, 1): + total = 1-bit+carry + digit, nxt = total % 2, total//2 + a.mark(name+'b'+str(bit)) + a.op('write', tape, str(digit)) + a.op('move', tape, -1) + a.op('goto', k+f'c{nxt}x{bit}y{digit}') + a.mark(k+'done') + a.op('move', tape, 1) + + +def stage_component(a, tape): + k = fresh(a, 'stage') + a.mark(k) + a.op('read', tape, {str(b): k+str(b) for b in (0, 1)} | {BLANK: k+'done'}) + for b in (0, 1): + a.mark(k+str(b)) + a.op('write', OUTPUT, str(b)) + a.op('move', OUTPUT, 1) + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(tape, (BLANK,)) + + +def initialize(a, counters, constant): + """Generate f zero bits on each counter and retain constant*f mod 4.""" + a.op('goto', 'initialize0') + for mode in range(4): + name = 'initialize'+str(mode) + a.mark(name) + a.op('read', COLUMNS, {ONE: name+'bit', BLANK: name+'done'}) + a.mark(name+'bit') + for tape in counters: + a.op('write', tape, '0') + a.op('move', tape, 1) + a.op('move', COLUMNS, 1) + a.op('goto', 'initialize'+str((mode+constant) % 4)) + a.mark(name+'done') + a.rewind(COLUMNS, (ONE,)) + for tape in counters: + a.rewind(tape, BITS) + a.op('goto', 'record'+str(mode)) + + +def advance(a, counters, linear, rows): + """Fixed finite lowering of the credited synchronized counter updater.""" + m = len(counters) + for i in range(m): + neighbors = tuple(j for j in range(m) if j != i and + (rows[min(i, j)] >> max(i, j)) & 1) + for mode in range(4): + name = f'advance{i}q{mode}' + a.mark(name) + a.op('read', counters[i], {str(b): name+'b'+str(b) for b in (0, 1)} | + {BLANK: name+'overflow'}) + for bit in (0, 1): + stem = name+'b'+str(bit) + a.mark(stem) + nxt = (mode+(1-2*bit)*linear[i]) % 4 + a.op('goto', stem+f'n0q{nxt}') + for k, j in enumerate(neighbors): + for value in range(4): + label = stem+f'n{k}q{value}' + a.mark(label) + a.op('read', counters[j], { + str(b): stem+f'n{k+1}q{(value+2*b) % 4}' + for b in (0, 1)}) + for value in range(4): + a.mark(stem+f'n{len(neighbors)}q{value}') + a.op('write', counters[i], str(1-bit)) + for tape in counters: + a.op('move', tape, 1) + a.op('goto', f'advance{i}q{value}' if bit else + 'advanced'+str(value)) + a.mark(name+'overflow') + for tape in counters: + target = fresh(a, 'all_end') + a.op('read', tape, {BLANK: target}) + a.mark(target) + for tape in counters: + a.rewind(tape, BITS) + if i: + a.op('goto', f'advance{i-1}q{mode}') + else: + a.op('move', OUTER, 1) + a.op('read', OUTER, {ONE: 'record'+str(mode), BLANK: 'finish'}) + for mode in range(4): + a.mark('advanced'+str(mode)) + for tape in counters: + a.rewind(tape, BITS) + a.op('goto', 'record'+str(mode)) + + +def compile_phase(linear=SELECTED_LINEAR, rows=SELECTED_ROWS, + constant=SELECTED_CONSTANT): + """Recipe is finite construction-time data; no runtime size is an argument.""" + m = len(linear) + if not 1 <= m <= len(COUNTERS) or len(rows) != m: + raise ValueError('fixed recipe dimension') + if type(constant) is not int or not 0 <= constant < 4: + raise ValueError('fixed constant phase') + if any(type(x) is not int or not 0 <= x < 4 for x in linear): + raise ValueError('fixed linear phase') + if any(type(x) is not int or not 0 <= x < 1 << m for x in rows): + raise ValueError('fixed quadratic rows') + if any(((rows[i] >> j) ^ (rows[j] >> i)) & 1 + for i in range(m) for j in range(m)): + raise ValueError('symmetric source quadratic matrix') + if any((linear[i] ^ (rows[i] >> i)) & 1 for i in range(m)): + raise ValueError('source diagonal parity') + counters = COUNTERS[:m] + a = Builder() + for tape in PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, MARK) + a.op('move', tape, 1) + # Supplied local ABI: Gamma(f), Gamma(r), Gamma(P), Gamma(S), Gamma(w). + for target in (COLUMNS, COEFF, OUTER, SPECTATOR, WIDTH): + gamma(a, target) + trace_return(a, HEADER, HTRACE) + initialize(a, counters, constant) + for mode in range(4): + a.mark('record'+str(mode)) + a.op('read', SPECTATOR, {ONE: 'coefficient'+str(mode), BLANK: 'record_end'+str(mode)}) + a.mark('coefficient'+str(mode)) + a.op('read', COEFF, {ONE: 'payload'+str(mode), BLANK: 'coefficient_end'+str(mode)}) + a.mark('payload'+str(mode)) + load_component(a, REAL) + load_component(a, IMAG) + if mode in (2, 3): + negate(a, REAL) + if mode in (1, 2): + negate(a, IMAG) + order = (IMAG, REAL) if mode % 2 else (REAL, IMAG) + for tape in order: + stage_component(a, tape) + a.op('move', COEFF, 1) + a.op('goto', 'coefficient'+str(mode)) + a.mark('coefficient_end'+str(mode)) + a.rewind(COEFF, (ONE,)) + a.op('move', SPECTATOR, 1) + a.op('goto', 'record'+str(mode)) + a.mark('record_end'+str(mode)) + a.rewind(SPECTATOR, (ONE,)) + a.op('goto', f'advance{m-1}q{mode}') + advance(a, counters, linear, rows) + a.mark('finish') + a.op('read', DATA, {BLANK: 'verified', '0': 'reject', ONE: 'reject'}) + a.mark('verified') + trace_return(a, DATA, DTRACE) + a.rewind(OUTPUT, BITS) + a.mark('commit') + a.op('read', OUTPUT, {str(b): 'commit'+str(b) for b in (0, 1)} | {BLANK: 'committed'}) + for bit in ('0', ONE): + a.mark('commit'+bit) + a.op('write', DATA, bit) + a.op('write', OUTPUT, BLANK) + a.op('move', OUTPUT, 1) + a.op('move', DATA, 1) + a.op('write', DTRACE, ONE) + a.op('move', DTRACE, 1) + a.op('goto', 'commit') + a.mark('committed') + trace_return(a, DATA, DTRACE) + a.rewind(OUTPUT, (BLANK,)) + a.rewind(OUTER, (ONE,)) + for tape in (COLUMNS, OUTER, COEFF, SPECTATOR, WIDTH): + clear(a, tape) + for tape in counters: + clear(a, tape, BITS) + for tape in PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('halt') + a.mark('reject') + a.op('read', HEADER, {}) + return a.finish((BLANK, '0', ONE, MARK)) diff --git a/research/literal-selected-move-join/reference/source/clifford_exact.py b/research/literal-selected-move-join/reference/source/clifford_exact.py new file mode 100644 index 0000000000..166841a037 --- /dev/null +++ b/research/literal-selected-move-join/reference/source/clifford_exact.py @@ -0,0 +1,149 @@ +"""Small exact Gaussian-dyadic Clifford compiler, independent of gx internals. +Paulis use i^p X^x Z^z. State vectors use integer Gaussian numerators / 2^d. +The tableau is supplemented by a literal circuit, so global phases are kept. +""" +from dataclasses import dataclass + +def parity(x):return x.bit_count()&1 +def rank(rows): + p={} + for x in rows: + while x: + b=x.bit_length()-1 + if b not in p:p[b]=x;break + x^=p[b] + return len(p) +def transpose(rows,n):return tuple(sum(((rows[j]>>i)&1)<>j&1);a[j],a[k]=a[k],a[j] + for i in range(n): + if i!=j and a[i]>>j&1:a[i]^=a[j] + assert [r&((1<>n for r in a) +def basis_extend(cols,n): + out=[] + for x in list(cols)+[1<len(out):out.append(x) + assert len(out)==n + return tuple(out) +def nullspace(rows,n): + a=list(rows);p=[];k=0 + for j in range(n): + t=next((i for i in range(k,len(a)) if a[i]>>j&1),None) + if t is None:continue + a[t],a[k]=a[k],a[t] + for i in range(len(a)): + if i!=k and a[i]>>j&1:a[i]^=a[k] + p.append(j);k+=1 + return tuple((1<>j)&1)<>i&1:out=pmul(out,T[i]) + for i in range(n): + if z>>i&1:out=pmul(out,T[n+i]) + return out +def compose(A,B):return tuple(apply(A,p) for p in B) +def inverse(T): + n=len(T)//2;cols=[x|(z<>n;u,v,p=apply(T,(x,z,0));assert (u,v)==identity(n)[j][:2];out.append((x,z,(-p)%4)) + return tuple(out) +def qvalue(Q,alpha,x,n): + return (sum(alpha[i] for i in range(n) if x>>i&1)+2*sum(parity((Q[i]>>(i+1))&(x>>(i+1))) for i in range(n) if x>>i&1))%4 +def mul_i(a,p): + x,y=a;p%=4 + return [(x,y),(-y,x),(-x,-y),(y,-x)][p] +@dataclass +class Op: + n:int + tab:tuple + circuit:list + def then(self,b): + assert self.n==b.n + return Op(self.n,compose(b.tab,self.tab),self.circuit+b.circuit) + def adjoint(self): + circ=[] + for e in reversed(self.circuit): + if e[0]=='P':circ.append(('P',inv(e[1],self.n))) + elif e[0]=='D':circ.append(('D',e[1],tuple((-x)%4 for x in e[2]))) + elif e[0]=='C':circ.append(('C',e[1],-e[2])) + elif e[0]=='phase':circ.append(('phase',(-e[1])%4)) + else:circ.append(e) + return Op(self.n,inverse(self.tab),circ) + def zero_state(self,basis=0): + N=1<>i)&1 for i in range(n)) + assert all(alpha[i]%2==(Q[i]>>i)&1 for i in range(n)) + return Op(n,tuple([(1<>i&1 else 0,1<>i&1 else 0) for i in range(n)]),[('C',q,sgn)]) +def xgate(n,b):return Op(n,tuple([(1<>i)&1)) for i in range(n)]),[('X',b)]) +def fourier(n,axes=None): + out=ident(n) + for i in range(n) if axes is None else axes:out=out.then(cgate(n,1<len(selected):picks.append(j);selected.append(x) + assert len(picks)==r and all(x>>r==0 for x in Bcols) + Br=transpose(selected,r);Bi=inv(Br,r);Dr=transpose([Dcols[j]&((1<> j) & 1) << i for i, row in enumerate(matrix)) for j in range(len(matrix))) + + +def inverse(matrix): + n = len(matrix) + rows = [row | (1 << (n+i)) for i, row in enumerate(matrix)] + for j in range(n): + pivot = next((i for i in range(j, n) if rows[i] >> j & 1), None) + require(pivot is not None, 'singular binary chart') + rows[j], rows[pivot] = rows[pivot], rows[j] + for i in range(n): + if i != j and rows[i] >> j & 1: + rows[i] ^= rows[j] + require([row & ((1 << n)-1) for row in rows] == [1 << i for i in range(n)], 'binary inverse') + return tuple(row >> n for row in rows) + + +def extend(vectors, n): + columns, pivots = [], {} + for value in tuple(vectors) + tuple(1 << i for i in range(n)): + reduced = value + while reduced: + j = reduced.bit_length()-1 + if j not in pivots: + pivots[j] = reduced + columns.append(value) + break + reduced ^= pivots[j] + require(len(columns) == n, 'frame basis extension') + return tuple(columns) + + +def adjoint(circuit): + out = [] + for gate in reversed(circuit): + if gate[0] == 'P': + out.append(('P', inverse(gate[1]))) + elif gate[0] == 'D': + out.append(('D', gate[1], tuple(-a % 4 for a in gate[2]))) + elif gate[0] == 'C': + out.append(('C', gate[1], -gate[2])) + elif gate[0] == 'phase': + out.append(('phase', -gate[1] % 4)) + else: + require(gate[0] == 'X', 'adjoint gate type') + out.append(gate) + return tuple(out) + + +def fourier(rank): + return tuple(('C', 1 << i, 1) for i in range(rank)) + + +def frame(vectors, n): + rank = len(vectors) + if rank == 0: + return () + if rank == n: + return fourier(n) + matrix = transpose(extend(vectors, n)) + columns = transpose(inverse(matrix)) + quadratic = tuple((1 << i) ^ sum(parity(a & b) << j for j, b in enumerate(columns)) for i, a in enumerate(columns)) + diagonal = tuple((row >> i) & 1 for i, row in enumerate(quadratic)) + chart = (('P', matrix), ('D', quadratic, diagonal)) + return adjoint(chart) + fourier(rank) + chart + + +def monomial(record): + matrix = tuple(record['matrix_rows']) + quadratic = tuple(record['quadratic_rows']) + linear = tuple(record['linear_Z4']) + require(transpose(quadratic) == quadratic, 'quadratic symmetry') + require(len(matrix) == len(quadratic) == len(linear) == 9, 'monomial dimension') + require(all(a % 2 == (quadratic[i] >> i) & 1 for i, a in enumerate(linear)), 'diagonal parity') + inverse(matrix) + return (('D', quadratic, linear), ('P', matrix), ('X', record['offset']), ('phase', record['phase'])) + + +def recipe(record): + rank = record['rank'] + require(isinstance(rank, int) and 0 <= rank <= 9, 'child rank') + if rank == 0: + require(record['right'] is None, 'rank zero right factor') + return monomial(record['left']) + return monomial(record['right']) + fourier(rank) + monomial(record['left']) + + +def tableau(circuit, n=9): + rows = [(1 << i, 0, 0) for i in range(n)] + [(0, 1 << i, 0) for i in range(n)] + for gate in circuit: + tag = gate[0] + out = [] + inverse_transpose = transpose(inverse(gate[1])) if tag == 'P' else None + for x, z, phase in rows: + if tag == 'P': + x, z = mul(gate[1], x), mul(inverse_transpose, z) + elif tag == 'X': + phase += 2 * parity(z & gate[1]) + elif tag == 'C': + if parity(z & gate[1]): + x ^= gate[1] + phase += 3 * gate[2] + elif tag == 'D': + quadratic, linear = gate[1:] + phase += sum(linear[i] for i in range(n) if x >> i & 1) + phase += 2 * sum(parity((quadratic[i] >> (i+1)) & (x >> (i+1))) for i in range(n) if x >> i & 1) + z ^= mul(quadratic, x) + else: + require(tag == 'phase', 'tableau gate type') + out.append((x, z, phase % 4)) + rows = out + return tuple(rows) + + +@lru_cache(maxsize=512) +def action(gate): + if gate[0] == 'P': + return tuple(mul(gate[1], x) for x in range(512)) + require(gate[0] == 'D', 'state action type') + quadratic, linear = gate[1:] + return tuple((sum(linear[i] for i in range(9) if x >> i & 1) + + 2 * sum(parity((quadratic[i] >> (i+1)) & (x >> (i+1))) for i in range(9) if x >> i & 1)) % 4 for x in range(512)) + + +def rotate(pair, power): + a, b = pair + return ((a, b), (-b, a), (-a, -b), (b, -a))[power % 4] + + +def state(circuit, basis=0): + value, denominator = {basis: (1, 0)}, 0 + for gate in circuit: + tag = gate[0] + result = {} + if tag == "C": + direction, sign = gate[1:] + for address, (a, b) in value.items(): + for target, pair in ((address, (a - sign*b, b + sign*a)), + (address ^ direction, (a + sign*b, b - sign*a))): + old = result.get(target, (0, 0)) + result[target] = (old[0] + pair[0], old[1] + pair[1]) + denominator += 1 + else: + for address, pair in value.items(): + if tag == "P": + target = mul(gate[1], address) + elif tag == "X": + target = address ^ gate[1] + else: + target = address + if tag == "D": + pair = rotate(pair, action(gate)[address]) + else: + require(tag == "phase", "Unknown Gaussian state gate") + pair = rotate(pair, gate[1]) + require(target not in result, "A monomial address map is not injective") + result[target] = pair + value = {address: pair for address, pair in result.items() if pair != (0, 0)} + while denominator and all((a | b) % 2 == 0 for a, b in value.values()): + denominator -= 1 + value = {address: (a//2, b//2) for address, (a, b) in value.items()} + return value, denominator + + +def equal(actual, expected, label): + require(tableau(actual) == tableau(expected), label + ": signed Pauli action") + require(state(actual) == state(expected), label + ": exact global phase") + + +def verify(data, certificate): + word = data["word"] + original, clean = data["programs"], data["clean_programs"] + source_recipes = data["recipes"] + residuals = data["residuals"]["recipes"] + native_tags = {"climb", "adapter", "residual_adapter"} + for orientation in ("forward", "backward"): + native = [event for event in clean[orientation] if event[0] in native_tags] + require(native == [event for event in original[orientation] if event[0] in native_tags], + "A retained native event changed") + require(len(native) == 5056, "The retained native event count changed") + frames = [frame(tuple(vectors), 9) for vectors in word["frames"]] + used = {(event[3], event[4]) for program in clean.values() + for event in program if event[0] == "climb"} + children = {(record["old"], record["new"]): record for record in source_recipes["children"]} + require(len(children) == len(source_recipes["children"]) and used <= set(children), + "The retained child recipe coverage is incomplete") + for old, new in sorted(used): + record = children[old, new] + require(record["rank"] == len(word["frames"][new]) - len(word["frames"][old]), + "A retained child has the wrong rank") + equal(recipe(record), adjoint(frames[old]) + frames[new], "Retained child") + endpoints = {(record["role"], record["port"]): record + for record in source_recipes["endpoint_adapters"]} + require(len(endpoints) == len(source_recipes["endpoint_adapters"]) + and set(endpoints) == {(role, p) for role in ("source", "target") for p in range(112)}, + "The endpoint adapter coverage is incomplete") + for (role, port), record in endpoints.items(): + direction = word["ports"][port] + conventional = (("C", direction, 1),) if role == "source" else ( + ("C", direction, -1),) + fourier(9) + index = word["start"][port] if role == "source" else word["final"][112 + port] + require(record["frame"] == index and record["rank"] == 0, "An endpoint frame changed") + equal(recipe(record), adjoint(conventional) + frames[index], "Endpoint adapter") + used_residuals = set() + for program in clean.values(): + for event in program: + if event[0] != "residual_adapter": + continue + _, position, register, entry, *tail = event + terminal = tail[0] if tail else 1 + key = str(entry) if terminal == 1 else str(entry) + ":" + str(terminal) + require(key in residuals and position in ("pre", "post"), "A residual binding changed") + require(entry == word["start"][register] and terminal == word["final"][register], + "A residual endpoint changed") + used_residuals.add(key) + for key in sorted(used_residuals): + record = residuals[key] + equal(recipe(record), adjoint(frames[record["frame"]]) + frames[record.get("terminal", 1)], + "Residual adapter") + records = certificate["input_recipes"] + ports = certificate["compensation_ports"] + require([record["port"] for record in records] == ports and len(records) == 8, + "The eight input recipes changed") + columns = 0 + for item in records: + port, label = item["port"], item["label"] + require(label == word["ports"][port] and item["canonical_start_frame_id"] == word["start"][port], + "An input recipe has the wrong supplier label") + record = item["recipe"] + require(record["rank"] == 1, "An input copy has the wrong child rank") + for side in ("left", "right"): + factor = record[side] + require(factor["quadratic_rows"] == [0] * 9 and factor["linear_Z4"] == [0] * 9 + and factor["offset"] == factor["phase"] == 0, + "An input factor is not an address permutation") + actual, expected = recipe(record), (("C", label, 1),) + equal(actual, expected, "Positive inherited input line") + for basis in range(512): + require(state(actual, basis) == state(expected, basis), "A complete input Gaussian column differs") + columns += 1 + negative = monomial(record["right"]) + (("C", 1, -1),) + monomial(record["left"]) + require(tableau(negative) != tableau(expected) or state(negative) != state(expected), + "An inverse input child was not detected") + phased = actual + (("phase", 1),) + require(tableau(phased) == tableau(actual) and state(phased) != state(expected), + "An input phase-only error was not detected") + return {"status": "PASS_EXACT_INPUT_NATIVE_FRAMES", "retained_native_events_per_orientation": 5056, + "retained_child_recipes": len(used), "endpoint_adapter_recipes": len(endpoints), + "residual_adapter_recipes": len(used_residuals), "new_input_recipes": len(records), + "new_exact_gaussian_columns": columns, "inverse_input_child_controls": len(records), + "phase_only_controls": len(records), "address_permutation_factors": 2 * len(records), + "method": "Independent signed Pauli and exact Gaussian interpretation; no compiler import", + "scope": "Positive inherited input frames before every retained adapter. No recursive hosting claim."} diff --git a/research/literal-selected-move-join/reference/translation/NOTICE.md b/research/literal-selected-move-join/reference/translation/NOTICE.md new file mode 100644 index 0000000000..903e332da2 --- /dev/null +++ b/research/literal-selected-move-join/reference/translation/NOTICE.md @@ -0,0 +1,20 @@ +# Credit and assistance + +Prepared for Jerry Chen / @CubeJerry with substantial OpenAI assistance. +New work is Apache-2.0. Exact retained sources preserve their original notices. + +The selected #7000 source, its application and predecessor native/Clifford +contributors supply the actual event and operator decomposition. The published +literal-native-quadratic-phase package supplies the exact current recipe +binding and five-Gamma/raw packed ABI. The published literal-row-reversal +package supplies the unchanged literal record-reversal graph, classical +two-stack implementation and exact cost/history theorem. The phase lineage +supplies the retained Gamma/unary helpers, and #7349 supplies the finite +machine grammar and builder. The earlier serial monomial descriptor iterator +is a distinct predecessor, not a solved numerical join on this ABI. + +This package contributes literal collapsed-descriptor production and the +actual fixed-graph join for one source-bound post-matrix translation. It does +not claim the source recipe, tensor translation identity, reversal algorithm, +or classical unary/binary conversion as new. Independent AI review, where +recorded, is not human or formal-kernel acceptance. diff --git a/research/literal-selected-move-join/reference/translation/reference/inputs/controller_reference.py b/research/literal-selected-move-join/reference/translation/reference/inputs/controller_reference.py new file mode 100644 index 0000000000..3ab6d0361f --- /dev/null +++ b/research/literal-selected-move-join/reference/translation/reference/inputs/controller_reference.py @@ -0,0 +1,112 @@ +"""Finite three-tape online rank-recursion control; Apache-2.0. +Only PC and local symbols affect execution. Metrics/event logs are observers. +""" +from dataclasses import dataclass, field +BLANK, ONE, MARK = '_', '1', '|' +WIDTH, CHILD, STACK = range(3) + +class Builder: + def __init__(self): self.code, self.labels, self.serial = [], {}, 0 + def mark(self,n): + if n in self.labels: raise ValueError('duplicate label') + self.labels[n]=len(self.code) + def op(self,*x): self.code.append(x) + def rewind(self,t,symbols): + self.serial+=1; loop=f'rw{self.serial}'; done=loop+'done' + self.op('move',t,-1); self.mark(loop) + self.op('read',t,{s:loop+'step' for s in symbols}|{MARK:done}) + self.mark(loop+'step'); self.op('move',t,-1); self.op('goto',loop) + self.mark(done); self.op('move',t,1) + def finish(self,alphabet): + result=[] + for op,*a in self.code: + if op=='goto': a[0]=self.labels[a[0]] + elif op=='read': a[1]={s:self.labels[n] for s,n in a[1].items()} + result.append((op,*a)) + return tuple(result),tuple(alphabet) + +def compile_controller(m,ranks): + """Parameters are compile-time constants, absent from run-time state.""" + if type(m) is not int or m<2 or not ranks: raise ValueError('bad fixed profile') + if any(type(r) is not int or not 1<=r=budget: raise ValueError('finite verifier budget') + self.step() + return self + +def initial_tapes(width,origins=(0,0,0),ancestor=('0','1','t0','_','|','0')): + if width<1: raise ValueError('positive width') + u,c,p=origins + return [Tape({u-1:MARK,**{u+i:ONE for i in range(width)}},u),Tape({c-1:MARK},c), + Tape({p-1:MARK,**{p-2-i:s for i,s in enumerate(ancestor) if s!=BLANK}},p)] diff --git a/research/literal-selected-move-join/reference/translation/reference/reverse.py b/research/literal-selected-move-join/reference/translation/reference/reverse.py new file mode 100644 index 0000000000..60fce51dd8 --- /dev/null +++ b/research/literal-selected-move-join/reference/translation/reference/reverse.py @@ -0,0 +1,207 @@ +"""Literal complete-record reversal from three encoded binary descriptors. + +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. The two-stack algorithm is classical and already in 02-streams; +the unary/trace helper patterns come from the credited literal S_D package. +This zero-argument compiler emits one fixed local-symbol instruction graph. +""" +from pathlib import Path +import hashlib +import sys + +HERE = Path(__file__).resolve().parent +MACHINE = HERE / 'inputs' / 'controller_reference.py' +EXPECTED_MACHINE = 'e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73' +if hashlib.sha256(MACHINE.read_bytes()).hexdigest() != EXPECTED_MACHINE: + raise ValueError('frozen literal machine source drift') +sys.path.insert(0, str(MACHINE.parent)) +from controller_reference import Builder, Machine, Tape, BLANK, ONE, MARK + +(PDESC, RDESC, BDESC, DATA, OUTPUT, PTR, RTR, BTR, DOUBLE, + HTRACE, GROUP, RECORD, DTRACE) = range(13) +PRIVATE = tuple(range(4, 13)) +BITS = ('0', ONE) + + +def fresh(a, stem): + a.serial += 1 + return stem + str(a.serial) + + +def clear(a, tape, symbols=(ONE,)): + k = fresh(a, 'clear') + a.mark(k) + a.op('read', tape, {s: k+'bit' for s in symbols} | {BLANK: k+'done'}) + a.mark(k+'bit') + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(tape, (BLANK,)) + + +def unary_copy(a, source, target, *, repeat=1, extra=0, erase=False): + k = fresh(a, 'copy') + a.mark(k) + a.op('read', source, {ONE: k+'bit', BLANK: k+'done'}) + a.mark(k+'bit') + for _ in range(repeat): + a.op('write', target, ONE) + a.op('move', target, 1) + if erase: + a.op('write', source, BLANK) + a.op('move', source, 1) + a.op('goto', k) + a.mark(k+'done') + for _ in range(extra): + a.op('write', target, ONE) + a.op('move', target, 1) + a.rewind(source, (BLANK,) if erase else (ONE,)) + a.rewind(target, (ONE,)) + + +def trace_return(a, tape, trace): + k = fresh(a, 'return') + a.op('move', trace, -1) + a.mark(k) + a.op('read', trace, {ONE: k+'bit', MARK: k+'done'}) + a.mark(k+'bit') + a.op('write', trace, BLANK) + a.op('move', trace, -1) + a.op('move', tape, -1) + a.op('goto', k) + a.mark(k+'done') + a.op('move', trace, 1) + + +def descriptor_step(a, descriptor): + a.op('write', HTRACE, ONE) + a.op('move', HTRACE, 1) + a.op('move', descriptor, 1) + + +def binary_descriptor(a, descriptor, target): + """A positive canonical MSB-first binary word to a unary guide.""" + k = fresh(a, 'binary') + a.op('read', descriptor, {ONE: k+'first'}) + a.mark(k+'first') + a.op('write', target, ONE) + descriptor_step(a, descriptor) + a.mark(k+'digit') + a.op('read', descriptor, {str(b): k+str(b) for b in (0, 1)} | + {BLANK: k+'done'}) + for bit in (0, 1): + a.mark(k+str(bit)) + unary_copy(a, target, DOUBLE, repeat=2, extra=bit) + clear(a, target) + unary_copy(a, DOUBLE, target, erase=True) + descriptor_step(a, descriptor) + a.op('goto', k+'digit') + a.mark(k+'done') + trace_return(a, descriptor, HTRACE) + + +def compile_reverse(): + """Compile once; no descriptor, shape, payload or origin argument.""" + a = Builder() + for tape in PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, MARK) + a.op('move', tape, 1) + for descriptor, target in ((PDESC, PTR), (RDESC, RTR), (BDESC, BTR)): + binary_descriptor(a, descriptor, target) + a.mark('prefix') + a.op('read', PTR, {ONE: 'load_record', BLANK: 'finish'}) + a.mark('load_record') + a.op('read', RTR, {ONE: 'load_bit', BLANK: 'group_loaded'}) + a.mark('load_bit') + a.op('read', BTR, {ONE: 'read_bit', BLANK: 'record_loaded'}) + a.mark('read_bit') + a.op('read', DATA, {str(b): 'load'+str(b) for b in (0, 1)}) + for bit in ('0', ONE): + a.mark('load'+bit) + a.op('write', GROUP, bit) + a.op('move', GROUP, 1) + a.op('move', DATA, 1) + a.op('write', DTRACE, ONE) + a.op('move', DTRACE, 1) + a.op('move', BTR, 1) + a.op('goto', 'load_bit') + a.mark('record_loaded') + a.rewind(BTR, (ONE,)) + a.op('move', RTR, 1) + a.op('goto', 'load_record') + a.mark('group_loaded') + a.rewind(RTR, (ONE,)) + a.op('move', GROUP, -1) + a.mark('pop_record') + a.op('read', RTR, {ONE: 'pop_bit', BLANK: 'group_popped'}) + a.mark('pop_bit') + a.op('read', BTR, {ONE: 'pop_read', BLANK: 'record_popped'}) + a.mark('pop_read') + a.op('read', GROUP, {str(b): 'pop'+str(b) for b in (0, 1)}) + for bit in ('0', ONE): + a.mark('pop'+bit) + a.op('write', RECORD, bit) + a.op('move', RECORD, 1) + a.op('write', GROUP, BLANK) + a.op('move', GROUP, -1) + a.op('move', BTR, 1) + a.op('goto', 'pop_bit') + a.mark('record_popped') + a.rewind(BTR, (ONE,)) + a.op('move', RECORD, -1) + a.mark('emit_record') + a.op('read', RECORD, {str(b): 'emit'+str(b) for b in (0, 1)} | + {MARK: 'record_emitted'}) + for bit in ('0', ONE): + a.mark('emit'+bit) + a.op('write', OUTPUT, bit) + a.op('move', OUTPUT, 1) + a.op('write', RECORD, BLANK) + a.op('move', RECORD, -1) + a.op('goto', 'emit_record') + a.mark('record_emitted') + a.op('move', RECORD, 1) + a.op('move', RTR, 1) + a.op('goto', 'pop_record') + a.mark('group_popped') + a.op('read', GROUP, {MARK: 'prefix_done'}) + a.mark('prefix_done') + a.op('move', GROUP, 1) + a.rewind(RTR, (ONE,)) + a.op('move', PTR, 1) + a.op('goto', 'prefix') + a.mark('finish') + # Exact cardinality is derived from descriptor guides before DATA writes. + a.op('read', DATA, {BLANK: 'verified', '0': 'reject', ONE: 'reject'}) + a.mark('verified') + trace_return(a, DATA, DTRACE) + a.rewind(OUTPUT, BITS) + a.mark('commit') + a.op('read', OUTPUT, {str(b): 'commit'+str(b) for b in (0, 1)} | + {BLANK: 'committed'}) + for bit in ('0', ONE): + a.mark('commit'+bit) + a.op('write', DATA, bit) + a.op('write', OUTPUT, BLANK) + a.op('move', OUTPUT, 1) + a.op('move', DATA, 1) + a.op('write', DTRACE, ONE) + a.op('move', DTRACE, 1) + a.op('goto', 'commit') + a.mark('committed') + trace_return(a, DATA, DTRACE) + a.rewind(OUTPUT, (BLANK,)) + a.rewind(PTR, (ONE,)) + for tape in (PTR, RTR, BTR): + clear(a, tape) + for tape in PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('halt') + a.mark('reject') + a.op('read', DATA, {}) + return a.finish((BLANK, '0', ONE, MARK)) + diff --git a/research/literal-selected-move-join/reference/translation/translate.py b/research/literal-selected-move-join/reference/translation/translate.py new file mode 100644 index 0000000000..5e1149f8ab --- /dev/null +++ b/research/literal-selected-move-join/reference/translation/translate.py @@ -0,0 +1,221 @@ +"""Literal descriptor production and selected post-matrix X_1 translation. + +Prepared for Jerry Chen / CubeJerry with substantial OpenAI assistance. +Apache-2.0. Gamma/unary patterns are credited to the retained native phase; +the complete-record permutation is the unchanged retained row-reversal graph. +All integer arithmetic below is fixed-table construction, never runtime work. +""" +from pathlib import Path +import hashlib +import importlib.util +import sys + +HERE = Path(__file__).resolve().parent +PINS = { + 'reference/reverse.py': '4b516d85baf3303db809bc1174394009b1fc71a8f7d17fb6c729ec8bb6aba245', + 'reference/inputs/controller_reference.py': 'e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73', +} +for path, expected in PINS.items(): + if hashlib.sha256((HERE / path).read_bytes()).hexdigest() != expected: + raise ValueError('frozen source bytes: ' + path) +spec = importlib.util.spec_from_file_location('translation_retained_reverse', HERE / 'reference/reverse.py') +REV = importlib.util.module_from_spec(spec) +sys.modules[spec.name] = REV +spec.loader.exec_module(REV) +Builder, BLANK, ONE, MARK = REV.Builder, REV.BLANK, REV.ONE, REV.MARK +clear, unary_copy, trace_return, fresh = REV.clear, REV.unary_copy, REV.trace_return, REV.fresh +BITS = ('0', ONE) + +HEADER, DATA, PDESC, RDESC, BDESC = range(5) +# The retained reversal's nine private ports become 5,...,13. +HTRACE, LENGTH, DOUBLE, F, COEFF, OUTER, SPECTATOR, WIDTH, PRODUCT, HALF, DIGITS = range(14, 25) +PRODUCER_PRIVATE = (PDESC, RDESC, BDESC) + tuple(range(14, 25)) +ALL_PRIVATE = tuple(range(2, 25)) +REVERSE_PORTS = (PDESC, RDESC, BDESC, DATA) + tuple(range(5, 14)) + + +def header_step(a): + a.op('write', HTRACE, ONE) + a.op('move', HTRACE, 1) + a.op('move', HEADER, 1) + + +def gamma(a, target): + """Retained five-Gamma decoding pattern on this fixed private inventory.""" + k = fresh(a, 'gamma') + a.mark(k+'prefix') + a.op('read', HEADER, {'0': k+'zero', ONE: k+'one'}) + a.mark(k+'zero') + a.op('write', LENGTH, ONE) + a.op('move', LENGTH, 1) + header_step(a) + a.op('goto', k+'prefix') + a.mark(k+'one') + header_step(a) + a.op('write', target, ONE) + a.op('move', LENGTH, -1) + a.mark(k+'tail') + a.op('read', LENGTH, {ONE: k+'tailbit', MARK: k+'done'}) + a.mark(k+'tailbit') + a.op('write', LENGTH, BLANK) + a.op('read', HEADER, {str(b): k+'digit'+str(b) for b in (0, 1)}) + for bit in (0, 1): + a.mark(k+'digit'+str(bit)) + unary_copy(a, target, DOUBLE, repeat=2, extra=bit) + clear(a, target) + unary_copy(a, DOUBLE, target, erase=True) + header_step(a) + a.op('move', LENGTH, -1) + a.op('goto', k+'tail') + a.mark(k+'done') + a.op('move', LENGTH, 1) + + +def power_descriptor(a): + """Write the canonical descriptor 1 followed by f zeroes, not unary 2^f.""" + a.op('write', RDESC, ONE) + a.op('move', RDESC, 1) + k = fresh(a, 'power') + a.mark(k) + a.op('read', F, {ONE: k+'bit', BLANK: k+'done'}) + a.mark(k+'bit') + a.op('write', RDESC, '0') + a.op('move', RDESC, 1) + a.op('move', F, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(F, (ONE,)) + a.rewind(RDESC, BITS) + + +def product_guide(a): + """Generate exactly 2*S*r*w unary marks by actual nested local scans.""" + k = fresh(a, 'product') + a.mark(k+'s') + a.op('read', SPECTATOR, {ONE: k+'r', BLANK: k+'done'}) + a.mark(k+'r') + a.op('read', COEFF, {ONE: k+'w', BLANK: k+'r_done'}) + a.mark(k+'w') + a.op('read', WIDTH, {ONE: k+'bit', BLANK: k+'w_done'}) + a.mark(k+'bit') + for _ in range(2): + a.op('write', PRODUCT, ONE) + a.op('move', PRODUCT, 1) + a.op('move', WIDTH, 1) + a.op('goto', k+'w') + a.mark(k+'w_done') + a.rewind(WIDTH, (ONE,)) + a.op('move', COEFF, 1) + a.op('goto', k+'r') + a.mark(k+'r_done') + a.rewind(COEFF, (ONE,)) + a.op('move', SPECTATOR, 1) + a.op('goto', k+'s') + a.mark(k+'done') + a.rewind(SPECTATOR, (ONE,)) + a.rewind(PRODUCT, (ONE,)) + + +def suffix_power(a): + """Multiply the PRODUCT guide by 2^(8f), in eight fixed doublings per mark.""" + k = fresh(a, 'suffix') + a.mark(k) + a.op('read', F, {ONE: k+'bit', BLANK: k+'done'}) + a.mark(k+'bit') + for _ in range(8): + unary_copy(a, PRODUCT, DOUBLE, repeat=2) + clear(a, PRODUCT) + unary_copy(a, DOUBLE, PRODUCT, erase=True) + a.op('move', F, 1) + a.op('goto', k) + a.mark(k+'done') + a.rewind(F, (ONE,)) + + +def unary_binary(a, source, destination): + """Consume positive unary n; emit canonical MSB-first binary n in O(n). + + source, HALF, DIGITS and destination are distinct guarded physical roles. + Every parity, quotient and termination choice is a local scanned branch. + """ + k = fresh(a, 'encode') + a.op('goto', k+'p0q0') + for phase, (current, quotient) in enumerate(((source, HALF), (HALF, source))): + for parity in (0, 1): + name = k+f'p{phase}q{parity}' + a.mark(name) + a.op('read', current, {ONE: name+'bit', BLANK: name+'done'}) + a.mark(name+'bit') + a.op('write', current, BLANK) + if parity: + a.op('write', quotient, ONE) + a.op('move', quotient, 1) + a.op('move', current, 1) + a.op('goto', k+f'p{phase}q{1-parity}') + a.mark(name+'done') + a.rewind(current, (BLANK,)) + a.rewind(quotient, (ONE,)) + a.op('write', DIGITS, str(parity)) + a.op('move', DIGITS, 1) + a.op('read', quotient, {ONE: k+f'p{1-phase}q0', BLANK: k+'emit_start'}) + a.mark(k+'emit_start') + a.op('move', DIGITS, -1) + a.mark(k+'emit') + a.op('read', DIGITS, {str(b): k+'emit'+str(b) for b in (0, 1)} | {MARK: k+'done'}) + for bit in (0, 1): + a.mark(k+'emit'+str(bit)) + a.op('write', destination, str(bit)) + a.op('move', destination, 1) + a.op('write', DIGITS, BLANK) + a.op('move', DIGITS, -1) + a.op('goto', k+'emit') + a.mark(k+'done') + a.op('move', DIGITS, 1) + a.rewind(destination, BITS) + + +def retained_reversal(a, after): + """Construction-only relabeling; every retained runtime instruction remains local.""" + code, alphabet = REV.compile_reverse() + if alphabet != (BLANK, '0', ONE, MARK): + raise ValueError('retained alphabet') + for pc, instruction in enumerate(code): + a.mark('reverse_'+str(pc)) + op, *args = instruction + if op == 'read': + a.op(op, REVERSE_PORTS[args[0]], {s: 'reverse_'+str(dst) for s, dst in args[1].items()}) + elif op in ('write', 'move'): + a.op(op, REVERSE_PORTS[args[0]], args[1]) + elif op == 'goto': + a.op(op, 'reverse_'+str(args[0])) + elif op == 'halt': + a.op('goto', after) + else: + raise ValueError('nonlocal retained opcode') + + +def compile_translation(): + """One fixed 25-tape program; no runtime integer or recipe argument.""" + a = Builder() + for tape in PRODUCER_PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, MARK) + a.op('move', tape, 1) + for target in (F, COEFF, OUTER, SPECTATOR, WIDTH): + gamma(a, target) + trace_return(a, HEADER, HTRACE) + power_descriptor(a) + product_guide(a) + suffix_power(a) + unary_binary(a, OUTER, PDESC) + unary_binary(a, PRODUCT, BDESC) + retained_reversal(a, 'retire_descriptors') + a.mark('retire_descriptors') + for tape in PRODUCER_PRIVATE: + clear(a, tape, BITS) + for tape in PRODUCER_PRIVATE: + a.op('move', tape, -1) + a.op('write', tape, BLANK) + a.op('move', tape, 1) + a.op('halt') + return a.finish((BLANK, '0', ONE, MARK)) diff --git a/research/literal-selected-move-join/review/AUTHOR-REPLAY.json b/research/literal-selected-move-join/review/AUTHOR-REPLAY.json new file mode 100644 index 0000000000..1a9dab6e4a --- /dev/null +++ b/research/literal-selected-move-join/review/AUTHOR-REPLAY.json @@ -0,0 +1,400 @@ +{ + "alphabet": [ + "_", + "0", + "1", + "|" + ], + "controls": [ + "drop_absolute_phase", + "swap_right_order", + "omit_offset", + "corrupt_commit" + ], + "finite_address_checks": 263681, + "graph_sha256": "14f38b15157a9c9cd2828861f6904701a29b1e27507a7e43d60030e1ae4d9238", + "locations": 82813, + "marker": "PASS_LITERAL_SELECTED_MOVE_JOIN", + "receipts": [ + { + "bits": 4096, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "highs": [ + 13, + 4099, + 4099, + 4099, + 4099, + 4099, + 15, + 4099, + 5, + 4099, + 2051, + 2051, + 15, + 4099, + 2051, + 4099, + 12, + 131, + 2051, + 1027, + 2051, + 2051, + 2051, + 2051, + 2051, + 1027, + 1027, + 1027, + 4099, + 9, + 4099 + ], + "history": 67823, + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "milestones": { + "commit": 14364400, + "left_linear_": 7015778, + "left_phase_": 6704950, + "positive_child_": 6051691, + "right_linear_": 373391, + "right_offset_": 5587558, + "right_phase_": 61453 + }, + "name": "complete_nonzero_f1", + "rejected": false, + "shape": [ + 1, + 1, + 1, + 1, + 4, + 1 + ], + "steps": 14429950, + "writes": 4096 + }, + { + "bits": 2048, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "highs": [ + 525, + 2051, + 2051, + 2051, + 2051, + 2051, + 14, + 2051, + 260, + 2051, + 1027, + 1027, + 14, + 2051, + 1027, + 2051, + 10, + 261, + 1027, + 515, + 1027, + 1027, + 1027, + 1027, + 1027, + 515, + 515, + 515, + 2051, + 7, + 2051 + ], + "history": 34922, + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "milestones": { + "commit": 7467018, + "left_linear_": 3726419, + "left_phase_": 3521214, + "positive_child_": 3132012, + "right_linear_": 237048, + "right_offset_": 2899352, + "right_phase_": 30733 + }, + "name": "shorter_reuse_huge_cutoff", + "rejected": false, + "shape": [ + 1, + 1, + 1, + 1, + 2, + 231584178474632390847141970017375815706539969331281128078915168015826259279872 + ], + "steps": 7499800, + "writes": 2048 + }, + { + "bits": 3072, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3075, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 9, + 9, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "highs": [ + 11, + 3075, + 3075, + 3075, + 3075, + 3075, + 14, + 3075, + 4, + 3075, + 1539, + 1539, + 14, + 3075, + 1539, + 3075, + 10, + 131, + 1539, + 771, + 1539, + 1539, + 1539, + 1539, + 1539, + 771, + 771, + 771, + 3075, + 8, + 3075 + ], + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "milestones": { + "positive_child_": 4591628, + "right_linear_": 305168, + "right_offset_": 4243352, + "right_phase_": 46093 + }, + "name": "child_nonintegral_after_three_completed_factors", + "rejected": true, + "shape": [ + 1, + 1, + 1, + 1, + 3, + 1 + ], + "steps": 4723409, + "writes": 0 + } + ], + "source_event": [ + "MOVE", + 415, + 3, + 99, + false + ], + "source_index": 24472, + "tapes": 31 +} diff --git a/research/literal-selected-move-join/review/RESULT.json b/research/literal-selected-move-join/review/RESULT.json new file mode 100644 index 0000000000..3e05cbefdf --- /dev/null +++ b/research/literal-selected-move-join/review/RESULT.json @@ -0,0 +1,139 @@ +{ + "status": "PASS_ROOT_NATIVE_COMPOSITION_REVIEW", + "relocated_instructions": 82748, + "total_instructions": 82813, + "tapes": 31, + "graph_sha256": "14f38b15157a9c9cd2828861f6904701a29b1e27507a7e43d60030e1ae4d9238", + "fixture": { + "name": "root_independent_forward_address_full_f1", + "shape": [ + 1, + 1, + 1, + 1, + 4, + 1 + ], + "bits": 4096, + "steps": 14429950, + "rejected": false, + "writes": 4096, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "highs": [ + 13, + 4099, + 4099, + 4099, + 4099, + 4099, + 15, + 4099, + 5, + 4099, + 2051, + 2051, + 15, + 4099, + 2051, + 4099, + 12, + 131, + 2051, + 1027, + 2051, + 2051, + 2051, + 2051, + 2051, + 1027, + 1027, + 1027, + 4099, + 9, + 4099 + ], + "milestones": { + "right_phase_": 61453, + "right_linear_": 373391, + "right_offset_": 5587558, + "positive_child_": 6051691, + "left_phase_": 6704950, + "left_linear_": 7015778, + "commit": 14364400 + }, + "history": 67823 + }, + "oracle_scope": "exact integer Gaussian forward-address oracle; all-f proof remains written factor-composition proof", + "files": { + "move.py": "42e4293ab59ffa1c99e0dbbd5fded0833a5d726e1e794f0f263ae9a4686587a5", + "verify.py": "372eaf92353add7b7ce9a9513469408a341176aef749bcf3b0f60918c90630ca", + "SOURCES.json": "26d0ef51dda5fa599381f7f31dec4ba3a37f14f63ff9055ad1661dec2d02610c", + "reference/RECIPE.json": "96fadb44c3316be93c6c02f50cd2c841a9541d67b98fd94fc47b73fa64dd404c" + } +} diff --git a/research/literal-selected-move-join/review/REVIEW.md b/research/literal-selected-move-join/review/REVIEW.md new file mode 100644 index 0000000000..ef7f4ccaf1 --- /dev/null +++ b/research/literal-selected-move-join/review/REVIEW.md @@ -0,0 +1,53 @@ +# Independent orchestration review + +This is a separate AI-assisted review of the frozen graph, not independent +human review or proof-assistant acceptance. It checks the contribution on +canonical base `e54523517d0f03e58352e647c403a5af3e525a57`; every predecessor +source pin remains in SOURCES.json. + +## Critical checks + +1. Every one of the 82,748 retained instructions is compared against the + unchanged predecessor table under the explicit injective port/PC map. + Module order, all targets, port bounds and absence of factor writes to + public DATA are checked. The 65 new wrapper instructions remain the only + composition logic. +2. A separate forward-address exact Gaussian-integer oracle uses dense binary + matrices and integer component arithmetic, rather than the author's inverse + addresses/CNOT words/butterfly implementation. A new full nonzero f=1 packet + agrees, with exactly 4,096 public writes, all after the final commit boundary. + The execution interpreter is the author's bytearray runner; this is not an + independent implementation of that interpreter. +3. The all-f proof was checked separately: the port map has disjoint public, + whole-call and module roles; success restores the next module's entry; + Gaussian-unit phases and permutations preserve the reserve; each central + axis consumes one power of two and grows the component bound by at most two. + The exact outer overhead 31V+27 and conservative sum + 65536(3fV+132V+6E+7) are below 2^24(fV+E+1). Historical backing is added, + never released by erasure. These universal statements inherit the cited + unchanged predecessor graph lemmas; the finite replay is corroboration. +4. The original complete source archive was re-extracted through the pinned + existing source repository, independently passing the source binding check. + +No issue was found within the stated supplied packed entry, numerical reserve +and fixed leaf cutoff. This does not prove the selected caller supplies that +entry, a nonleaf recursive tariff, all five retained assumptions, or a new +multiplication bound. Rejection preserves public values but need not retire +private banks; the package states this limitation explicitly. + +## Reproduce + +From the package directory: + +```sh +python3 -I -W error -B review/check_join.py +``` + +Expected marker: `PASS_ROOT_NATIVE_COMPOSITION_REVIEW`. The checked instruction +count is 82,813, graph SHA256 is recorded in RESULT.json, and the full fixture +uses 14,429,950 local transitions. `review/RESULT.json` records this execution. +Author regression checks and their mutations are documented separately. + +Prepared by the Astra orchestration agent with substantial OpenAI Codex +assistance. Original implementation and mathematical lineage credit to +@CubeJerry and the exact predecessor authors is preserved in NOTICE.md. diff --git a/research/literal-selected-move-join/review/SOURCE-BINDING.json b/research/literal-selected-move-join/review/SOURCE-BINDING.json new file mode 100644 index 0000000000..698bd303a6 --- /dev/null +++ b/research/literal-selected-move-join/review/SOURCE-BINDING.json @@ -0,0 +1,14 @@ +{ + "basis_columns": 512, + "frames": [ + 3, + 99 + ], + "full_archive_reextracted": true, + "marker": "PASS_COMPLETE_MOVE_SOURCE_BINDING", + "negative_controls": [ + "absolute phase" + ], + "owner": 415, + "source_index": 24472 +} diff --git a/research/literal-selected-move-join/review/check_join.py b/research/literal-selected-move-join/review/check_join.py new file mode 100644 index 0000000000..9ffbd21bcb --- /dev/null +++ b/research/literal-selected-move-join/review/check_join.py @@ -0,0 +1,71 @@ +from pathlib import Path +import hashlib, importlib.util, json, sys +P=Path(__file__).resolve().parents[1] +sys.path.insert(0,str(P)) +import move as m +import verify as v + +def require(x,s): + if not x:raise ValueError(s) +code,alphabet,starts=m._compile_move() +r=json.loads((P/'reference/RECIPE.json').read_text())['lowered_recipe'] +modules=[('right_phase_',m.PHASE.compile_phase(r['right']['linear_Z4'],r['right']['quadratic_rows'],r['right']['phase'])),('right_linear_',m.LINEAR.compile_linear('right')),('right_offset_',m.TRANSLATION.compile_translation()),('positive_child_',m.LEAF.compile_leaf()),('left_phase_',m.PHASE.compile_phase(r['left']['linear_Z4'],r['left']['quadratic_rows'],r['left']['phase'])),('left_linear_',m.LINEAR.compile_linear('left'))] +checked=0 +for k,(name,(old,alph)) in enumerate(modules): + start=starts[name];end=starts[modules[k+1][0]] if k+1>(8-j))&1 for j in range(9)] + phase=r['right']['phase']+sum(r['right']['linear_Z4'][j]*coords[j] for j in range(9)) + phase+=2*sum(coords[j]*coords[k] for j in range(9) for k in range(j+1,9) if r['right']['quadratic_rows'][j]>>k&1) + y=[(sum(coords[k] for k in range(9) if r['right']['matrix_rows'][j]>>k&1)%2)^((r['right']['offset']>>j)&1) for j in range(9)] + dest=sum(y[j]<<(8-j) for j in range(9)) + z[dest]=rotate(a,phase) + t=[(0,0)]*512 + for lo in range(256): + for ob in (0,1): + re=im=0 + for ib in (0,1): + ar,ai=z[(ib<<8)|lo];sgn=1 if ob==ib else -1 + re+=ar-sgn*ai;im+=ai+sgn*ar + require(re%2==0 and im%2==0,'reference integrality') + t[(ob<<8)|lo]=(re//2,im//2) + out=[(0,0)]*512 + for idx,a in enumerate(t): + coords=[(idx>>(8-j))&1 for j in range(9)] + phase=r['left']['phase']+sum(r['left']['linear_Z4'][j]*coords[j] for j in range(9)) + phase+=2*sum(coords[j]*coords[k] for j in range(9) for k in range(j+1,9) if r['left']['quadratic_rows'][j]>>k&1) + y=[sum(coords[k] for k in range(9) if r['left']['matrix_rows'][j]>>k&1)%2 for j in range(9)] + dest=sum(y[j]<<(8-j) for j in range(9));out[dest]=rotate(a,phase) + return out +values=[(2*((i*7)%3-1),2*((i*11+1)%3-1)) for i in range(512)] +expected_values=transform(values) +# This independent forward oracle uses only exact Python integer arithmetic. +expected=v.encode(expected_values,4) +require(expected==v.oracle(values,(1,1,1,1,4,1)),'forward versus inverse oracle disagreement') +receipt,_=v.run_case('root_independent_forward_address_full_f1',(1,1,1,1,4,1),values,expected=expected) +require(receipt['early']==0 and receipt['writes']==4096,'transactional public writes') +result={'status':'PASS_ROOT_NATIVE_COMPOSITION_REVIEW','relocated_instructions':checked,'total_instructions':len(code),'tapes':31,'graph_sha256':hashlib.sha256(repr(code).encode()).hexdigest(),'fixture':receipt,'oracle_scope':'exact integer Gaussian forward-address oracle; all-f proof remains written factor-composition proof','files':{str(f.relative_to(P)):hashlib.sha256(f.read_bytes()).hexdigest() for f in [P/'move.py',P/'verify.py',P/'SOURCES.json',P/'reference/RECIPE.json']}} +print(json.dumps(result,indent=2)) diff --git a/research/literal-selected-move-join/verify.py b/research/literal-selected-move-join/verify.py new file mode 100644 index 0000000000..1aa0ba169c --- /dev/null +++ b/research/literal-selected-move-join/verify.py @@ -0,0 +1,316 @@ +"""Stdlib-only, independent dense CPU and direct Gaussian kernel checks. + +The oracle uses sparse tensor matrix entries and inverse addresses. It does +not execute CNOT words, incremental phase counters or C butterfly rows. +""" +from pathlib import Path +import argparse +import hashlib +import json +import random +import sys + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import move as m + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def gamma(n): + bits = bin(n)[2:] + return '0' * (len(bits) - 1) + bits + + +def header(shape): + return ''.join(map(gamma, shape)) + + +def signed(n, w): + require(-(1 << (w - 1)) <= n < (1 << (w - 1)), 'fixture signed range') + return format(n % (1 << w), '0' + str(w) + 'b') + + +def encode(values, w): + return ''.join(signed(a, w) + signed(b, w) for a, b in values) + + +def mul(a, b): + return a[0] * b[0] - a[1] * b[1], a[0] * b[1] + a[1] * b[0] + + +def rotate(z, q): + return (z, (-z[1], z[0]), (-z[0], -z[1]), (z[1], -z[0]))[q % 4] + + +def unpack(address, f): + mask = (1 << f) - 1 + return tuple((address >> ((8 - i) * f)) & mask for i in range(9)) + + +def pack(coordinates, f): + out = 0 + for coordinate in coordinates: + out = (out << f) | coordinate + return out + + +def linear(rows, coordinates): + result = [] + for row in rows: + value = 0 + for i, coordinate in enumerate(coordinates): + if row >> i & 1: + value ^= coordinate + result.append(value) + return tuple(result) + + +def inverse(rows): + aug = [row | (1 << (9 + i)) for i, row in enumerate(rows)] + for i in range(9): + pivot = next(j for j in range(i, 9) if aug[j] >> i & 1) + aug[i], aug[pivot] = aug[pivot], aug[i] + for j in range(9): + if j != i and aug[j] >> i & 1: + aug[j] ^= aug[i] + require([row & 511 for row in aug] == [1 << i for i in range(9)], 'inverse') + return tuple(row >> 9 for row in aug) + + +def phase(recipe, coordinates, f): + value = f * recipe['phase'] + for i in range(9): + value += recipe['linear_Z4'][i] * coordinates[i].bit_count() + for j in range(i + 1, 9): + if recipe['quadratic_rows'][i] >> j & 1: + value += 2 * (coordinates[i] & coordinates[j]).bit_count() + return value % 4 + + +RECIPE = json.loads((HERE / 'reference/RECIPE.json').read_text()) +RIGHT, LEFT = RECIPE['lowered_recipe']['right'], RECIPE['lowered_recipe']['left'] +IRIGHT, ILEFT = inverse(RIGHT['matrix_rows']), inverse(LEFT['matrix_rows']) + + +def oracle(values, shape, *, omit_constant=False, first_axis=False): + f, r, p, s, w, _ = shape + q, tail = 1 << f, s * r + block = 1 << (9 * f) + weights = [] + for x in range(q): + z = (1, 0) + for j in range(f): + z = mul(z, (1, -1 if x >> j & 1 else 1)) + weights.append(z) + result = [] + for outer in range(p): + for output in range(block): + z = linear(ILEFT, unpack(output, f)) + for suffix in range(tail): + total = (0, 0) + for t0 in range(q): + t = (t0,) + z[1:] + translated = tuple(a ^ (q - 1 if RIGHT['offset'] >> i & 1 else 0) + for i, a in enumerate(t)) + source = linear(IRIGHT, translated) + exponent = phase(RIGHT, source, f) + phase(LEFT, z, f) + if omit_constant: + exponent -= f * RIGHT['phase'] + coeff = rotate(weights[z[0] ^ t0], exponent) + original = values[(outer * block + pack(source, f)) * tail + suffix] + term = mul(coeff, original) + total = total[0] + term[0], total[1] + term[1] + require(total[0] % q == total[1] % q == 0, 'oracle nonintegral final image') + result.append((total[0] // q, total[1] // q)) + return encode(result, w) + + +SYMBOLS = {'_': 0, '0': 1, '1': 2, '|': 3} + + +def numeric(code): + result = [] + for op, *args in code: + if op == 'read': + branch = [-1] * 4 + for symbol, target in args[1].items(): + branch[SYMBOLS[symbol]] = target + result.append((0, args[0], branch)) + elif op == 'write': + result.append((1, args[0], SYMBOLS[args[1]])) + elif op == 'move': + require(args[1] in (-1, 1), 'nonunit move') + result.append((2, args[0], args[1])) + elif op == 'goto': + result.append((3, args[0], None)) + elif op == 'halt': + result.append((4, 0, None)) + else: + raise ValueError('nonliteral opcode') + return tuple(result) + + +def packet(shape, word, *, tapes=None): + e, v = len(header(shape)), len(word) + capacity = 4 * (e + v + 10) + if tapes is None: + tapes = [bytearray(capacity + 7) for _ in range(m.TAPES)] + for tape in tapes: + tape[0:2] = b'\x02\x03' + tape[-2:] = b'\x01\x03' + for tape in tapes: + require(len(tape) >= e + v + 20, 'fixture allocation') + for index, text in enumerate((header(shape) + '|01|', word)): + # Opaque tail starts after six codes. Only DATA's exact blank endpoint + # belongs to packet geometry. + tapes[index][2] = 2 + tapes[index][3:3 + len(text)] = bytes(SYMBOLS[x] for x in text) + tapes[index][3 + len(text)] = 0 + return tapes + + +def execute(code, tapes, entries, *, budget): + code = numeric(code) + heads, lows, highs = [3] * m.TAPES, [3] * m.TAPES, [3] * m.TAPES + milestones = sorted((pc, name) for name, pc in entries.items()) + next_mark, marked, cursor = milestones[0][0], {}, 0 + pc = steps = writes = early = 0 + rejected = False + while True: + if pc == next_mark: + marked[milestones[cursor][1]] = steps + cursor += 1 + next_mark = milestones[cursor][0] if cursor < len(milestones) else -1 + op, tape, arg = code[pc] + steps += 1 + if steps > budget: + raise ValueError('finite verifier budget') + if op == 0: + pc = arg[tapes[tape][heads[tape]]] + if pc < 0: + rejected = True + break + elif op == 1: + tapes[tape][heads[tape]] = arg + if tape == m.DATA: + writes += 1 + early += pc < entries['commit'] + pc += 1 + elif op == 2: + heads[tape] += arg + if heads[tape] < lows[tape]: + lows[tape] = heads[tape] + if heads[tape] > highs[tape]: + highs[tape] = heads[tape] + require(0 <= heads[tape] < len(tapes[tape]), 'fixture boundary escaped') + pc += 1 + elif op == 3: + pc = tape + else: + break + return dict(steps=steps, rejected=rejected, writes=writes, early=early, + heads=heads, lows=lows, highs=highs, milestones=marked) + + +def run_case(name, shape, values, *, accept=True, mutation=None, expected=None, tapes=None): + word = encode(values, shape[4]) + tapes = packet(shape, word, tapes=tapes) + owners = tuple(map(id, tapes)) + before = tuple(bytes(tape) for tape in tapes) + code, _, entries = m._compile_move(mutation) + f, e, v = shape[0], len(header(shape)), len(word) + receipt = execute(code, tapes, entries, budget=(1 << 24) * (f * v + e + 1)) + require(receipt['rejected'] != accept, name + ': unexpected acceptance') + require(tuple(map(id, tapes)) == owners, name + ': owner replacement') + require(bytes(tapes[0]) == before[0], name + ': public HEADER value changed') + require(receipt['early'] == 0, name + ': early public DATA write') + if accept: + expected = oracle(values, shape) if expected is None else expected + target = bytearray(before[1]) + target[3:3 + v] = bytes(SYMBOLS[x] for x in expected) + require(tapes[1] == target, name + ': complete direct kernel mismatch') + require(receipt['writes'] == v, name + ': incomplete public commit') + require(receipt['heads'] == [3] * m.TAPES, name + ': head return') + require(all(bytes(tape) == before[i] for i, tape in enumerate(tapes) if i != 1), + name + ': private/header/exterior not restored') + history = sum(hi - lo + 1 for lo, hi in zip(receipt['lows'], receipt['highs'])) + require(history <= m.TAPES + 1024 * (v + e + 1), name + ': historical charge') + receipt['history'] = history + else: + require(bytes(tapes[1]) == before[1], name + ': rejection changed original DATA') + require(receipt['writes'] == 0, name + ': rejecting public commit') + return dict(name=name, shape=shape, bits=v, **receipt), tapes + + +def verify(quick=False): + m.authenticate() + require(RECIPE['base_commit'] == 'e54523517d0f03e58352e647c403a5af3e525a57', 'base pin') + require(RECIPE['event'] == ['MOVE', 415, 3, 99, False] and RECIPE['native_event_index'] == 24472, + 'selected source event') + require(RECIPE['rank'] == RECIPE['lowered_recipe']['rank'] == 1, 'positive child rank') + code, alphabet, entries = m._compile_move() + numeric(code) + require(alphabet == ('_', '0', '1', '|'), 'alphabet') + require(max(args[0] for op, *args in code if op in ('read', 'write', 'move')) == 30, + 'fixed owner inventory') + for f in (1, 2, 3): + q = 1 << f + for address in range(1 << (9 * f)) if f < 3 else range(0, 1 << (9 * f), 131071): + x = unpack(address, f) + require(linear(IRIGHT, linear(RIGHT['matrix_rows'], x)) == x, 'right inverse address') + require(linear(ILEFT, linear(LEFT['matrix_rows'], x)) == x, 'left inverse address') + require(pack(x, f) == address and all(a < q for a in x), 'complete packing') + rng = random.Random(24472) + shape = (1, 1, 1, 1, 4, 1) + values = [(2 * rng.randrange(-1, 2), 2 * rng.randrange(-1, 2)) for _ in range(512)] + expected = oracle(values, shape) + require(expected != oracle(values, shape, omit_constant=True), 'absolute phase control') + require(len(expected) == 4096, 'complete m=9 field') + summary = dict(marker='PASS_LITERAL_SELECTED_MOVE_JOIN', locations=len(code), tapes=m.TAPES, + alphabet=alphabet, graph_sha256=hashlib.sha256(repr(code).encode()).hexdigest(), + source_event=RECIPE['event'], source_index=24472, + finite_address_checks=512 + 262144 + 1025, receipts=[], controls=[]) + if quick: + summary['marker'] = 'PASS_LITERAL_SELECTED_MOVE_JOIN_QUICK_ONLY' + return summary + receipt, tapes = run_case('complete_nonzero_f1', shape, values, expected=expected) + summary['receipts'].append(receipt) + # Same fixed physical owners, shorter signed fields, huge binary cutoff, + # and a following opaque tail. Historical capacities are retained. + short = (1, 1, 1, 1, 2, 1 << 257) + # Restore the clean previous DATA origin before replacing its supplied body. + tapes[1][3:3 + len(expected)] = bytes(len(expected)) + receipt, _ = run_case('shorter_reuse_huge_cutoff', short, [(0, 0)] * 512, tapes=tapes) + summary['receipts'].append(receipt) + bad = [(0, 0)] * 512 + bad[0] = (1, 0) + receipt, _ = run_case('child_nonintegral_after_three_completed_factors', (1, 1, 1, 1, 3, 1), + bad, accept=False) + require('positive_child_' in receipt['milestones'], 'child rejection coverage') + summary['receipts'].append(receipt) + for mutation in ('drop_absolute_phase', 'swap_right_order', 'omit_offset', 'corrupt_commit'): + try: + run_case(mutation, shape, values, mutation=mutation, expected=expected) + except ValueError as exc: + require('complete direct kernel mismatch' in str(exc), 'unexpected mutation failure: ' + str(exc)) + summary['controls'].append(mutation) + else: + raise ValueError('undetected mutation: ' + mutation) + return summary + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--quick', action='store_true', help='assembly/address checks only; not full replay') + parser.add_argument('--write', action='store_true', help='explicitly replace RESULT.json') + args = parser.parse_args() + require(not (args.quick and args.write), 'quick mode cannot write accepted evidence') + result = verify(args.quick) + rendered = json.dumps(result, indent=2, sort_keys=True) + '\n' + if args.write: + (HERE / 'RESULT.json').write_text(rendered) + print(rendered, end='') From dffe132bbe16d830e2aa7367ed40a540f5c7fd64 Mon Sep 17 00:00:00 2001 From: Jerry Jiaheng Chen <80299683+CubeJerry@users.noreply.github.com> Date: Fri, 13 Nov 2026 19:35:18 +1100 Subject: [PATCH 2/3] Implement sharp endpoint scaling and paid signed-width conversion around the verified MOVE --- .../ENDPOINT-ENVIRONMENT.json | 35 ++ .../ENDPOINT-PROOF.md | 327 ++++++++++++ .../ENDPOINT-RESULT.json | 213 ++++++++ .../ENDPOINT-SOURCES.json | 17 + .../literal-selected-move-join/FREEZE.json | 118 +++- research/literal-selected-move-join/NOTES.md | 2 + research/literal-selected-move-join/NOTICE.md | 16 +- .../literal-selected-move-join/OVERLAP.md | 17 +- .../PR-DESCRIPTION.md | 156 +++--- .../literal-selected-move-join/PR-TITLE.txt | 2 +- research/literal-selected-move-join/PROOF.md | 17 + research/literal-selected-move-join/README.md | 58 +- .../literal-selected-move-join/VERIFY.json | 83 ++- .../endpoint-prefix-PROOF.md | 145 +++++ .../endpoint-review/README.md | 55 ++ .../endpoint-review/ROOT-COST-REVIEW.md | 27 + .../endpoint-review/math/PROOF-CANDIDATE.md | 44 ++ .../endpoint-review/math/RESULT.json | 6 + .../endpoint-review/math/REVIEW.md | 56 ++ .../endpoint-review/math/independent_check.py | 201 +++++++ .../physical/PUBLICATION-REPLAY.json | 213 ++++++++ .../endpoint-review/physical/RESULT.json | 90 ++++ .../physical/check_endpoint.py | 83 +++ .../literal-selected-move-join/endpoint.py | 504 ++++++++++++++++++ .../endpoint_verify.py | 253 +++++++++ 25 files changed, 2627 insertions(+), 111 deletions(-) create mode 100644 research/literal-selected-move-join/ENDPOINT-ENVIRONMENT.json create mode 100644 research/literal-selected-move-join/ENDPOINT-PROOF.md create mode 100644 research/literal-selected-move-join/ENDPOINT-RESULT.json create mode 100644 research/literal-selected-move-join/ENDPOINT-SOURCES.json create mode 100644 research/literal-selected-move-join/endpoint-reference/endpoint-prefix-PROOF.md create mode 100644 research/literal-selected-move-join/endpoint-review/README.md create mode 100644 research/literal-selected-move-join/endpoint-review/ROOT-COST-REVIEW.md create mode 100644 research/literal-selected-move-join/endpoint-review/math/PROOF-CANDIDATE.md create mode 100644 research/literal-selected-move-join/endpoint-review/math/RESULT.json create mode 100644 research/literal-selected-move-join/endpoint-review/math/REVIEW.md create mode 100644 research/literal-selected-move-join/endpoint-review/math/independent_check.py create mode 100644 research/literal-selected-move-join/endpoint-review/physical/PUBLICATION-REPLAY.json create mode 100644 research/literal-selected-move-join/endpoint-review/physical/RESULT.json create mode 100644 research/literal-selected-move-join/endpoint-review/physical/check_endpoint.py create mode 100644 research/literal-selected-move-join/endpoint.py create mode 100644 research/literal-selected-move-join/endpoint_verify.py diff --git a/research/literal-selected-move-join/ENDPOINT-ENVIRONMENT.json b/research/literal-selected-move-join/ENDPOINT-ENVIRONMENT.json new file mode 100644 index 0000000000..1e9f6f2514 --- /dev/null +++ b/research/literal-selected-move-join/ENDPOINT-ENVIRONMENT.json @@ -0,0 +1,35 @@ +{ + "python": "3.12.14 (main, Aug 25 2026, 14:00:49) [Clang 22.1.3 ]", + "platform": "Linux-6.18.57-x86_64-with-glibc2.41", + "checks": [ + { + "mode": "normal", + "command": [ + "/opt/codex/runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-W", + "error", + "-B", + "/workspace/scratch/92c9920affc2/worker-a/research/literal-selected-move-join/endpoint_verify.py" + ], + "seconds": 3.3879678990015236, + "marker": "PASS_LITERAL_ENDPOINT_WIDTH_WRAPPER", + "matches_frozen_result": true + }, + { + "mode": "optimized", + "command": [ + "/opt/codex/runtimes/codex-primary-runtime/dependencies/python/bin/python3", + "-I", + "-O", + "-W", + "error", + "-B", + "/workspace/scratch/92c9920affc2/worker-a/research/literal-selected-move-join/endpoint_verify.py" + ], + "seconds": 2.934343663000618, + "marker": "PASS_LITERAL_ENDPOINT_WIDTH_WRAPPER", + "matches_frozen_result": true + } + ] +} diff --git a/research/literal-selected-move-join/ENDPOINT-PROOF.md b/research/literal-selected-move-join/ENDPOINT-PROOF.md new file mode 100644 index 0000000000..af0948aa44 --- /dev/null +++ b/research/literal-selected-move-join/ENDPOINT-PROOF.md @@ -0,0 +1,327 @@ +# Literal endpoint-promised scale and width around the complete MOVE + +## 1. Exact strengthened boundary + +The byte-frozen core in move.py is the direct complete MOVE proved in +PROOF.md. Its graph hash is +`14f38b15157a9c9cd2828861f6904701a29b1e27507a7e43d60030e1ae4d9238`; +neither move.py, verify.py nor a retained source byte is changed here. +The new endpoint.py embeds all 82,813 core instructions in a fixed +84,803-location graph on 52 tapes with the same four-symbol local language. + +Let U be actual selected MOVE24472, and write its complete tensor factors +as `U=L F R`, with `F=C^(tensor f)` and L,R the source monomials. Supply +the same complete packed `[P] x [2^f]^9 x [S]` array with r Gaussian +coefficients and original signed MSB component width w>=2. HEADER still +contains `Gamma(f,r,P,S,w,cutoff)` and may have an opaque tail. Require +positive parameters, `f<=cutoff`, and a common grid on which both the input +x and intended complete output y=Ux have Gaussian-integral numerators in +the symmetric endpoint range + +`[-M,M]`, where `M=2^(w-1)-1`. + +This is the **supplied endpoint promise**. It does not assert that an actual +selected caller produces those endpoints. Put + +`k=floor((f+2)/4)=ceil(floor(f/2)/2)`, `w'=w+2k`, + +`N=PSr2^(9f)`, `V=2Nw`, `V'=2Nw'`. + +The new fixed program returns exactly y on the original public DATA owner +and the original grid/width, with all 52 heads, private bodies/guards and +opaque exteriors restored on success. It physically supplies scaling, +width/header conversion, the unchanged literal core, exact unscaling, +whole-call staging, sole final public commit and retirement. Its complete +direct bounds are + +`T<=2^26(fV'+E+1)`, + +`K_final<=K_entry+4096(V'+E+1)`, + +where E is the actual original six-code length. All public and private +history is included in K_entry, and erasure never subtracts it. The grid +is unchanged: the temporary semantic numerator is multiplied by `2^k`, +then divided exactly. V', rather than the smaller V, is paid. This remains +a direct reference/leaf implementation, not a recursive `f^sigma` supplier, +caller admission, global assumption discharge, new kappa or multiplier. + +## 2. Credited sharp integral scale and endpoint width + +Nick Petalas #7468 at `8b0dd714d30e9c1574387587eb6418ae99ac34e1` proves the +sharp integral prefix scale for endpoint-integral C tensors. Its unchanged +proof is retained in endpoint-reference and pinned in ENDPOINT-SOURCES.json. +For `pi=1+i`, `pi C` and `pi C^-1` are Gaussian integral. If b and Fb are +Gaussian integral and S contains j axes, then C_S b belongs to both +`pi^-j O` and `pi^-(f-j) O`, coordinatewise, where O=Z[i]. Their intersection +is `pi^-d O` with `d=min(j,f-j)`. Therefore `2^k C_S b` is integral for all S. +The common binary scale and its matching lower bounds are credited #7468, +not reproved or claimed new by this physical wrapper. + +The induced real/imaginary component maximum norm of `C^(tensor j)` and +its inverse is `2^ceil(j/2)`. This is known norm lineage, including +#7211/#2772/#3089/#3091. To check the normalization directly, each tensor +coefficient is a Gaussian unit times `(1+i)^j/2^j`. When j=2t each real row +has `2^j` nonzero real-component coefficients of magnitude `2^-t`; when +j=2t+1 it has `2*2^j` coefficients of magnitude `2^-(t+1)`. The row absolute +sums give the stated component norms; conjugation gives the same inverse +norm. Consequently, if both b and Fb have component magnitude <=M, + +`|C_S b|_component <= min(2^ceil(j/2),2^ceil((f-j)/2)) M + =2^ceil(d/2) M`. + +The second bound uses `C_S b=C_(S-complement)^(-1) Fb`. Thus all scaled +prefix components have magnitude at most `2^(2k)M`. They fit the symmetric +signed width w+2k, since + +`2^(2k)(2^(w-1)-1) <= 2^(w+2k-1)-1`. + +The crucial transfer direction for this actual MOVE is **b=R x and +Fb=L^-1 y**. L,R and their inverses are address permutations times unit +Gaussian phases, including their complete f-column constants. They preserve +Gaussian integrality and component maximum. The supplied x,y endpoint +promise therefore supplies exactly the two central endpoints needed above. +Scaling by `2^k` commutes with every factor of the complex-linear MOVE. +The frozen core's phase/range and all C-prefix predicates follow at width +w', so it accepts and returns exactly `2^k y`. No stronger original +`2^f` input divisibility assumption is used by this wrapper. + +The common width is sharp for the fixed common scale `2^k` under this +symmetric endpoint promise. At a cut with d=min(j,f-j), choose d axes in S +and d outside. On those 2d axes let z be `2^ceil(d/2)` times the zero-address +impulse, and put the all-ones tensor factor on every unused axis. Set +`b=C_S^-1 z`, `Fb=C_(S-complement) z`. Both endpoints have Gaussian-integral +components in {0,+/-1,+/-i,+/-1+/-i}, with component maximum one. At a middle +cut the scaled prefix reaches positive `2^(2k)M` after multiplication by M; +one fewer signed bit cannot hold it for w>=2. Monomial inverses transfer this +witness to x,y. This is optimal common width for this fixed common scale, +not an optimality claim over adaptive grids, input-specific scales, different +algorithms or variable-width schedules. + +## 3. Literal header, scale count and generated complete geometry + +Public ports are HEADER=0 and DATA=1. Wrapper-private ports 2,...,22 are +WH, WD, OUTPUT, traces and a fixed set of metadata roles. The core's 31 +ports are relocated injectively to `(WH,WD,23,24,...,51)`. Its public +HEADER/DATA thus become private WH/WD; all 29 core-private owners are +disjoint from every wrapper role and the real public owners. Its fixed +jumps are relocated and its successful halt becomes one unit-cost goto. + +The wrapper installs guards only on its own 21 roles. Its Gamma decoder +copies the original first four complete codes into WH while decoding +f,r,P,S to unary guides. It decodes the fifth, w, without copying it. Every +public header advance records HTRACE. The original w>=2 is checked locally. +No decoded number is held in the machine control. + +The actual unary F loop runs a four-state remainder counter initialized +at state two. Each F mark advances the remainder, and crossing 3->0 writes +one K mark. On completion K has exactly `(f+2)//4` marks, including zero +marks for f=1; F and K return to origin. The graph appends w unary marks and +twice k unary marks to form WIDE=w'. This is an input-size-independent +finite graph with a runtime loop, not unrolling in f. + +To emit Gamma(w'), WIDE is copied to TMP. Alternating TMP and HALF, each +floor-halving pass consumes pairs of unary marks, leaves the quotient on +the other tape and pushes one parity digit on DIGITS. The geometric sum +of consumed lengths is <=2w'. When the quotient is zero, popping DIGITS +emits the canonical MSB binary word on BINARY and retires both unary work +roles and DIGITS. Its exact helper census is + +`19w'-12popcount(w')+19ell(w')+7`, + +or one more with the unit-test halt. Scanning this binary word makes a +unary bit-length guide BLEN. The graph writes ell(w')-1 zeroes followed by +the canonical binary word to WH, retiring BINARY. This is Gamma(w') in +O(w') local steps, not a quadratic repeated full-width increment. + +The sixth original code is copied by counting its leading zeroes and then +copying exactly that many trailing bits after its first one. The represented +cutoff is never expanded to unary. A very large cutoff costs its encoded +length in E. HTRACE returns the public header head, and WH rewinds to its +private guard. WH now contains exactly Gamma(f,r,P,S,w',cutoff), followed by +a blank; the original public six codes and opaque tail are unchanged. + +The component clock COUNT is physically generated as `2PSr2^(9f)`: two +ordinary unary guide products, nine actual doublings for every F mark and +one final doubling. It is exactly the number of real/imaginary components, +not the number of Gaussian coefficients. Products, doubling, F control, +head return and temporary guide retirement are literal instructions. +There is no supplied collapsed volume or host arithmetic service. + +## 4. Literal signed ingress and exact egress + +For each of COUNT components, ingress reads its original sign bit, emits k +copies of that bit, copies all w original bits, then emits k zeroes. The +complete w'=w+2k bit string is the two's-complement representation of +`2^k` times the original signed integer. This follows by sign extension to +w+k bits, which preserves its value, then shifting left k bits into width +w+2k. The loops use the actual K and WIDTH guides and return both after +each component. Every public DATA advance writes TRACE. After exactly +COUNT components, the graph requires DATA's next cell to be blank, returns +its original head by consuming TRACE and rewinds WD to its guard. + +The transformation changes only component format. The order remains real +then imaginary, coefficient, S spectator, all nine complete native axes, +then P outer row. WD is exactly the original complete packed array with +width w', not a strided view or a selection of active coefficients. All +tensor/spectator addresses are preserved. HEADER and DATA values remain +original throughout conversion and core execution. + +The literal core now has its actual legal private packet. WH and WD are at +their origins; all 29 core-private owners are blank with distinct supplied +windows, untouched by the wrapper. Section 2 supplies its exact numerical +predicate at w'. Its sixth cutoff remains the original cutoff. The core +returns WH unchanged and WD=`2^k y`, every head restored and every mapped +core-private body/guard blank. The wrapper guides were not core ports and +remain live, unchanged and at origin. + +Egress again runs COUNT components. It remembers the first widened sign +bit in finite control, checks k leading bits all equal it, then checks the +first retained middle bit equals the same sign. It copies the next w bits +into OUTPUT and checks the final k bits are zero. Thus it accepts precisely +the redundant k-bit sign extension of a w-bit integer followed by k zeroes. +These checks are necessary and sufficient for exact division by `2^k` +whose result fits signed w bits. They handle negative values, not merely +unsigned dropping; when k=0 they become the identity conversion. +The extra symmetric endpoint promise was used to prove core admission; +the egress guard itself accepts the ordinary signed w-bit representable +range. No rounding, truncation or signed overflow is hidden in this step. + +Every WD advance records TRACE. After all complete components, the next +cell must be blank; TRACE returns WD to origin, OUTPUT rewinds to its guard, +and COUNT returns. All numerical and cardinality guards occur before any +public DATA write. The wide source is retained until cleanup rather than +silently deallocated or aliased with OUTPUT. + +## 5. Original-owner commit, rejection and successful reuse + +Only after complete egress does the graph copy OUTPUT to original public +DATA, erase OUTPUT, record public advances on TRACE, return the public head +and rewind the blank OUTPUT. It writes precisely V public bits. The table +contains no earlier write to public DATA and no write to public HEADER. +Every wrapper role is then explicitly cleared using its local guard; its +guard is erased and its head returned. The core's 29 private roles were +already cleared by the unchanged core. All 52 owners, public opaque tails +and private exteriors are retained. + +Finite acquisition/conversion/core rejection before that final commit +preserves both original public values, including when WD or OUTPUT contain +partial work. Failure heads, private retirement, interruption rollback and +same-bank retry after rejection are not claimed. A valid endpoint-promised +packet does not take these rejecting paths. A later smaller successful +packet can reuse the same physical owners because every private cell is +blank on success and every head is restored. It scans only current guide +and body lengths. Historical backing and older blank tails remain charged; +they are not scanned merely because a larger prior call used them. + +## 6. Complete conversion/core time and retained history + +Let E' be the actual private six-code header length. Only the width code +changes. Since `ell(w')<=w'` and `w'<=V'`, + +`E'<=E+2w'<=E+2V'`. + +All costs count every local instruction, including branches, fixed jumps, +head returns, guard setup, copying, erasure and terminal replacements. +The core's halt is replaced by one goto of the same unit cost. Its complete +bill is the unchanged `2^24(fV'+E'+1)`; its internal transaction, complete +child and every enlarged signed scalar row are included at V'. There is +no uncounted recursive child or numeric callback. + +Here are conservative allowances for **all additional** wrapper work: + +| Additional operation | Complete allowance | +|---|---| +| guard setup, six-code acquisition/return, k and w', Gamma(w') | `2^14(V'+E+1)` | +| generated COUNT, products, all doublings and resets | `2^14(V'+1)` | +| complete signed ingress, public return, WD and guide returns | `256(V'+1)` | +| complete exact egress, WD/OUTPUT and guide returns | `256(V'+1)` | +| public commit, all wrapper clearing/guards and halt | `4096(V'+E+1)` | + +The allowances can be checked directly from the emitted loops. A Gamma +field of value n takes <256(n+1) steps, including the optional encoded copy: +strict binary prefix values sum to 2v+b` round uses only +constantly many scans of v and 2v+b. The b=1 append in this implementation +scans its actual unary DOUBLE, not a host append. All five decoded values +are <=V'. k takes <16(f+1) steps. WIDE/TMP copies are linear in w'; the exact +floor-halving census above is <38w'+8, and Gamma prefix/binary emission is +<64(ell(w')+1). Encoded cutoff copy and HTRACE return are linear in E. +These bounds are far below the first allowance. + +For COUNT, unary products have the same fixed nested scan/return pattern as +the credited module. Both product results are <=N. The sum of old lengths +over its `9f+1` doublings is =2. +Their full source/output/clock returns add O(V') with explicit trace/rewind +prices `5n+3` and `3n+3`. The stated 256 allowances therefore include every +component, trace cell and guide reset. No full address word or descriptor +is rescanned per payload bit. Commit plus its returns costs `16V+7`. +Finally, every wrapper-private role's current visited cap is <=`2V'+E`; +there are 21 roles, and clear costs `7n+4`, followed by three guard-retirement +instructions per role. This is below the last allowance. The generous sum +of all five rows is <`2^20(V'+E+1)`. + +Combining this with the core, using f>=1, gives + +`T<=2^24(fV'+E'+1)+2^20(V'+E+1)` + +` <=2^24(3fV'+E+1)+2^20(V'+E+1)` + +` <=2^26(fV'+E+1)`. + +The widened representation is material: V' is used in the core's copy, +scalar and full-axis work as well as in these conversion rows. The original +cutoff is not replaced by f or expanded into unary. This direct bill is +O(fV'+E). A fixed leaf cutoff makes f bounded; no recursive selected-rate +tariff follows from this inequality. + +For backing, WH has length E'; WD has V' bits, OUTPUT has V<=V', TRACE has +at most V', HTRACE has E, COUNT/DOUBLE/AUX at most V', every unary width or +size guide at most V', and binary/code guides at most V'+E. With endpoints +and guards, the 21 wrapper roles add at most `42V'+21E+42` visited positions. +The original public head intervals add at most V'+E+2. These are below +`64(V'+E+1)`. Add the core's full additional history bound +`1024(V'+E'+1)<=3072(V'+E+1)`. Hence the complete increase is less than +`3136(V'+E+1)`, below the declared 4096 allowance. All 52 owners and actual +earlier backing remain in K_entry. Overlap is conservatively double counted, +never erased from the ledger. No private field earns productive credit. + +At fixed origins successful reuse keeps per-owner interval unions. Changed +origins require absolute historical unions and separately paid transport +corridors; the wrapper does not make those free. Supplied private blank +windows, the public packet and opaque entry backing are included in actual +entry storage. Test-fixture creation is not a runtime allocation theorem. + +## 7. Executed coverage and limits + +endpoint_verify.py is standard-library only and does not alter the frozen +core verifier. It executes the emitted fixed graphs with a dense local CPU. +Forty-one complete header producers through f=1023 reproduce the exact +widened header and live guide state, preserving public opaque tails. All +copy a cutoff whose value has 258 bits without unary expansion. The 135 +literal binary encoders through unary 1024 match the exact instruction +census. One hundred small-stream ingress/egress executions cover k=0,1,2,3,4,8,16 +at selected f values and original widths 2,3,4,7,17, including negative +endpoints, the most-negative signed value, zero and positive maxima. +Ninety changed low-zero or retained-sign inputs reject before public writes. +These are tests of the actual shared converter subgraphs at their explicitly +supplied unary WIDTH/K/COUNT boundary, not complete native f>=2 executions. + +The complete full-field f=1 wrapper runs 14,784,628 local transitions on +4096 bits. A direct Gaussian native kernel oracle agrees; exactly V public +writes occur only after egress, all 52 heads/private/exteriors are restored, +and observed visited-span history is 82,251. f=1 has k=0. Nonzero-k evidence +comes from the explicit converter/header boundaries; no full f=2 joined +tape replay is claimed. The universal statement rests on sections 2--6, +not on replacing a full array by a reduced native dimension or sampled prefix. + +No selected producer has been shown to satisfy the exact endpoint promise, +and old-codec/strided packing, actual source occurrence emission/owner +transport, global stock/reset, faster nonleaf work, the complete compiler, +precision and analytic recovery applications remain open. All five selected +assumptions and conditional kappa are unchanged. No cold selected replay, +formal proof-kernel or independent human acceptance is claimed. diff --git a/research/literal-selected-move-join/ENDPOINT-RESULT.json b/research/literal-selected-move-join/ENDPOINT-RESULT.json new file mode 100644 index 0000000000..71f295e7aa --- /dev/null +++ b/research/literal-selected-move-join/ENDPOINT-RESULT.json @@ -0,0 +1,213 @@ +{ + "converters": { + "arithmetic_rejections": 90, + "cases": 100, + "component_widths": [ + 2, + 3, + 4, + 7, + 17 + ], + "max_k": 16, + "transitions": 151380 + }, + "encoder": { + "cases": 135, + "max_unary": 1024, + "transitions": 241111 + }, + "entries": { + "commit": 84523, + "core": 1594, + "egress": 84407 + }, + "full_f1": { + "bits": 4096, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "highs": [ + 13, + 4099, + 13, + 4099, + 4099, + 13, + 4099, + 5, + 1027, + 4, + 4, + 4, + 4, + 7, + 3, + 7, + 1027, + 4, + 7, + 5, + 6, + 6, + 6, + 4099, + 4099, + 4099, + 4099, + 15, + 4099, + 5, + 4099, + 2051, + 2051, + 15, + 4099, + 2051, + 4099, + 12, + 131, + 2051, + 1027, + 2051, + 2051, + 2051, + 2051, + 2051, + 1027, + 1027, + 1027, + 4099, + 9, + 4099 + ], + "history": 82251, + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "rejected": false, + "shape": [ + 1, + 1, + 1, + 1, + 4, + 1 + ], + "steps": 14784628, + "writes": 4096 + }, + "graph_sha256": "ce283ce96dae83a69609076b4a41efe5b44c465bedbd932eed2ad5c668cf63c6", + "header": { + "cases": 41, + "cutoff_bits": 258, + "max_f": 1023, + "transitions": 697608 + }, + "locations": 84803, + "marker": "PASS_LITERAL_ENDPOINT_WIDTH_WRAPPER", + "tapes": 52 +} diff --git a/research/literal-selected-move-join/ENDPOINT-SOURCES.json b/research/literal-selected-move-join/ENDPOINT-SOURCES.json new file mode 100644 index 0000000000..0cd604872f --- /dev/null +++ b/research/literal-selected-move-join/ENDPOINT-SOURCES.json @@ -0,0 +1,17 @@ +{ + "canonical_main": "e54523517d0f03e58352e647c403a5af3e525a57", + "core_commit": "3a27ab1d302d13b1ce52411f8a174e7a32baab77", + "core_graph_sha256": "14f38b15157a9c9cd2828861f6904701a29b1e27507a7e43d60030e1ae4d9238", + "files": [ + { + "repository": "petalas/integer-mult-bounds", + "commit": "8b0dd714d30e9c1574387587eb6418ae99ac34e1", + "path": "research/native-c-endpoint-prefix-scale/PROOF.md", + "local": "endpoint-reference/endpoint-prefix-PROOF.md", + "bytes": 5445, + "sha256": "8d1ee50bc8c80660646fb325d6b8ad32ca472249e70608b70273400cf124a1a9", + "blob": "6e257715bff2da3cd2a0d14433696a534e6b9400" + } + ], + "credit": "Nick Petalas #7468 supplies sharp integral scale; known component norms retain #7211/#2772/#3089/#3091 credit." +} diff --git a/research/literal-selected-move-join/FREEZE.json b/research/literal-selected-move-join/FREEZE.json index 3fae950b2c..a8573c7ea2 100644 --- a/research/literal-selected-move-join/FREEZE.json +++ b/research/literal-selected-move-join/FREEZE.json @@ -1,11 +1,33 @@ { - "stage": "wave-1 core verified and independently reviewed; no wave-2 extension included", - "graph_sha256": "14f38b15157a9c9cd2828861f6904701a29b1e27507a7e43d60030e1ae4d9238", + "stage": "complete core plus endpoint width wrapper, independently reviewed publication snapshot", + "core_commit": "3a27ab1d302d13b1ce52411f8a174e7a32baab77", + "core_graph_sha256": "14f38b15157a9c9cd2828861f6904701a29b1e27507a7e43d60030e1ae4d9238", + "endpoint_graph_sha256": "ce283ce96dae83a69609076b4a41efe5b44c465bedbd932eed2ad5c668cf63c6", "core_frozen": [ "move.py", "verify.py" ], "files": [ + { + "path": "ENDPOINT-ENVIRONMENT.json", + "bytes": 1045, + "sha256": "8a81d29e1e827225da7b0f4b2aabe93f6afa15603293b786679e772b8fd3a75f" + }, + { + "path": "ENDPOINT-PROOF.md", + "bytes": 18376, + "sha256": "a3f098aa810a67260bcfa8e6c457b74df484b117eefd739f2366f0a59ba2c5b1" + }, + { + "path": "ENDPOINT-RESULT.json", + "bytes": 2420, + "sha256": "8d596c65be95e95e02135852574e7fd9efb19b958272bbab64c00e5467df0b30" + }, + { + "path": "ENDPOINT-SOURCES.json", + "bytes": 776, + "sha256": "8619b9339e9b56f1899612b508afe9896eaa89d31a5b76423226976b361d5b0a" + }, { "path": "ENVIRONMENT.json", "bytes": 1020, @@ -13,38 +35,38 @@ }, { "path": "NOTES.md", - "bytes": 976, - "sha256": "1bf9d3ddf9a518255ee0f7440e92a947e4dd78bbe30c25284b1c2b51d312f444" + "bytes": 1405, + "sha256": "af9e930ed7c8951a0625da41359fd72c3b1c348a0a5efec32768982aedc2eb8e" }, { "path": "NOTICE.md", - "bytes": 2852, - "sha256": "7271c647d2d1e7f0f3ef80a6923ff194247eec1a4d8fd7dee4be626310e2026a" + "bytes": 3200, + "sha256": "5b708636e2aa0fe5fbcc5e51ce0fc3287617698f13d235ed9d6771a5b07c1e44" }, { "path": "OVERLAP.md", - "bytes": 2629, - "sha256": "b49b99d1a1627b55f44496fd7040a3ffdabbad9eb3b16f605a1231b20d038c6b" + "bytes": 3357, + "sha256": "3b984204261fca3c7bc484f99a4a4a4a1e8250c804f2a96c2b153b17abf8fbe3" }, { "path": "PR-DESCRIPTION.md", - "bytes": 4604, - "sha256": "4b09e90fd9403cd88c3b94bc87f371f3ee3875ddbbba93cbdb0a864dd8b29ee3" + "bytes": 6499, + "sha256": "228af8a4300640a1441fbff0dd1e10037d8483802fa7d583ff1c758d703af5ca" }, { "path": "PR-TITLE.txt", - "bytes": 101, - "sha256": "7d8c1af58a51f538568733e4d8f95b9e9a7fc8818c9672626fbe6928463d5970" + "bytes": 104, + "sha256": "02b657c08bc70a481f5b37c775b37d7c8eefef792f8f1d8cb54bd1ac8c21982e" }, { "path": "PROOF.md", - "bytes": 16091, - "sha256": "aa7897029c9761fdf96c3336ab37c2827f08b0df29c868e3b2257ecc661ac7b6" + "bytes": 17089, + "sha256": "b6604cdba74a093c89603a5197ef2ed1146364ffbb718a731087bfaf392e505e" }, { "path": "README.md", - "bytes": 5159, - "sha256": "d58ea57cd74c904e3e629871b7cebb2e17d96e2e9ba2d75b764a02d3b35c9875" + "bytes": 7404, + "sha256": "8d270ece93788a2050cb64186645d33d9f39165b6db1f94aab0a0d089640f489" }, { "path": "RESULT.json", @@ -63,14 +85,74 @@ }, { "path": "VERIFY.json", - "bytes": 704, - "sha256": "361c7659873e019f2c6c5c84222dfae6794a46dce1fb1ae20a1bafe46b3e3542" + "bytes": 1327, + "sha256": "50c71e702b569a3fcc7953c0f07e3c5bae8d4b3e0b566bf0ca21145d725b37b5" }, { "path": "bind_source.py", "bytes": 4281, "sha256": "5b75ebfea1563a8525438a03262900b1ecbfdd762d5d1aaced3faddfa3b23a8c" }, + { + "path": "endpoint-reference/endpoint-prefix-PROOF.md", + "bytes": 5445, + "sha256": "8d1ee50bc8c80660646fb325d6b8ad32ca472249e70608b70273400cf124a1a9" + }, + { + "path": "endpoint-review/README.md", + "bytes": 2776, + "sha256": "ee46a4429b332018b71813ef7dd2074cca2a901716eb2ae67acd761809dc0224" + }, + { + "path": "endpoint-review/ROOT-COST-REVIEW.md", + "bytes": 1680, + "sha256": "76dbe782e3cd1f7ffbb21d7112ed232a14332b941314e6229803f732e20636ae" + }, + { + "path": "endpoint-review/math/PROOF-CANDIDATE.md", + "bytes": 2586, + "sha256": "964bd6d2251f839998713337352affb224749b110830172dac0eb7bdbf969a05" + }, + { + "path": "endpoint-review/math/RESULT.json", + "bytes": 545, + "sha256": "ed2931c9712248831f645dcfe2627cd2a0556ced1cc0661c00179a02bad14892" + }, + { + "path": "endpoint-review/math/REVIEW.md", + "bytes": 4506, + "sha256": "62d32e8598e3d74c239bbb1288dd50d3b5545b5cb2ce931f389079722556f09b" + }, + { + "path": "endpoint-review/math/independent_check.py", + "bytes": 7342, + "sha256": "c6b0a3e93082a06ab5a3a05433cfbbe7c974c59ba771b0e8e1562c3ccfa03f94" + }, + { + "path": "endpoint-review/physical/PUBLICATION-REPLAY.json", + "bytes": 2420, + "sha256": "8d596c65be95e95e02135852574e7fd9efb19b958272bbab64c00e5467df0b30" + }, + { + "path": "endpoint-review/physical/RESULT.json", + "bytes": 2049, + "sha256": "ebf0cb306e4582bf88e8bd5631efe1c7afac3660df64590bc1c2edb82c8fa48f" + }, + { + "path": "endpoint-review/physical/check_endpoint.py", + "bytes": 5034, + "sha256": "5896284caf2ec62257ba693307dca569e12ba5e8092288db20a5496149fd2230" + }, + { + "path": "endpoint.py", + "bytes": 15743, + "sha256": "1c7f02fd1bb6ce547f8a646c6632e2a481f9a54a5b02e09128aef9cccfd666f0" + }, + { + "path": "endpoint_verify.py", + "bytes": 11277, + "sha256": "99dc8fb0d4f74fdeaf017ecbcb0ceff338f146bd934761c82988526c237dd86b" + }, { "path": "move.py", "bytes": 5497, diff --git a/research/literal-selected-move-join/NOTES.md b/research/literal-selected-move-join/NOTES.md index ac19330dae..556ead4b6d 100644 --- a/research/literal-selected-move-join/NOTES.md +++ b/research/literal-selected-move-join/NOTES.md @@ -3,3 +3,5 @@ Claim checkpoint: compose exact selected MOVE24472 on the supplied six-Gamma pac The four pinned source modules share HEADER=0, DATA=1 and clean private tails on successful return. Left phase is a construction-time specialization (2,0,0,0,0,0,0,0,0), zero quadratic rows, constant zero. Source order is right phase, right G, offset, positive C tensor, left phase, left G. Whole-call source clone prevents earlier factor commits from changing the public owner on a later arithmetic rejection. Failure cleanup/retry remains unclaimed. Sufficient admission: w>=2, f<=cutoff, source components divisible by 2^f and bounded in absolute value by M with 2^f M <=2^(w-1)-1. This deliberately loose reserve gives integral and symmetric-range prefixes. + +Wave 2 completed: endpoint.py physically installs k=floor((f+2)/4), width w+2k, private canonical header, signed scale, frozen complete core, exact unscale/fit, staged original-owner commit and full success retirement under a supplied integral symmetric input/output promise. See ENDPOINT-PROOF.md, ENDPOINT-RESULT.json and endpoint-review for final scope and independently reviewed evidence. The frozen core remains unchanged. diff --git a/research/literal-selected-move-join/NOTICE.md b/research/literal-selected-move-join/NOTICE.md index 0a756baa4d..07b9f44dcb 100644 --- a/research/literal-selected-move-join/NOTICE.md +++ b/research/literal-selected-move-join/NOTICE.md @@ -40,8 +40,14 @@ established, including the selected-native-tensor-closure lineage and its #5442/#5974/#6043/#6293/#6331/#6635/#6878 predecessors. The new claim is the source-specific literal physical join on an explicit supplied boundary. -Nick Petalas's #7462 CNOT cancellation, #7468 sharp endpoint-prefix scale, -and #7477 reversal rejection cleanup are related open follow-ups. Their -results are not installed by this package, and no competing improvement -over their exact objects is asserted. Source proposals remain open; -this package does not represent canonical scientific admission. +Nick Petalas's #7468 sharp endpoint-prefix integral scale is explicitly +installed by endpoint.py and retained as an unchanged attributed proof. +The component norms retain #7211/#2772/#3089/#3091 lineage. The two-endpoint +width consequence, fixed-common-scale scope and physical application are +proved in ENDPOINT-PROOF.md. Independent AI mathematical/physical reviews +retain their precise targets and coverage in endpoint-review. + +Nick Petalas's #7462 CNOT cancellation and #7477 reversal rejection cleanup +remain related work not installed. No competing improvement over their +exact objects is asserted. Source proposals remain open; this package +does not represent canonical scientific admission. diff --git a/research/literal-selected-move-join/OVERLAP.md b/research/literal-selected-move-join/OVERLAP.md index 1002240ff2..bde37fd7c6 100644 --- a/research/literal-selected-move-join/OVERLAP.md +++ b/research/literal-selected-move-join/OVERLAP.md @@ -38,6 +38,17 @@ literal MOVE was visible in this inspected coverage. This is a scoped novelty assessment, not proof of universal novelty. No new kappa, frontier change, recursive-rate invoice or foundational -assumption discharge is asserted. The stronger endpoint-scale physical -wrapper is separate follow-up; the present join retains exact prefix/range -conditions and proves a sufficient all-f reserve. +assumption discharge is asserted. The initial core retains exact +prefix/range conditions and proves a sufficient all-f reserve. + +The coherent extension physically installs the credited #7468 scale with +literal widened headers, signed conversion, exact drop and owner commit. +At the root's 2026-11-13 07:52 refresh, canonical main and #7468's head were +unchanged and no new overlapping PR was found. The scope changes from the +core's prefix predicate to a supplied integral, symmetric signed input/output +promise; it does not claim the actual selected producer supplies that promise. +#7468 supplies the integral scale, while its open physical conversions and +complete local bill are implemented in endpoint.py and ENDPOINT-PROOF.md. +The known component norms and precise fixed-common-scale width scope are +credited, with independent agent reviews retained. No arbitrary-input +rounded trajectory is claimed by this extension. diff --git a/research/literal-selected-move-join/PR-DESCRIPTION.md b/research/literal-selected-move-join/PR-DESCRIPTION.md index 834ccd9b04..fa5ecfc5b9 100644 --- a/research/literal-selected-move-join/PR-DESCRIPTION.md +++ b/research/literal-selected-move-join/PR-DESCRIPTION.md @@ -1,51 +1,78 @@ -The selected MOVE24472 previously had literal phase, binary-map, translation -and positive C-child programs on compatible supplied packed interfaces, but -no emitted complete physical join. This adds one 82,813-location, 31-tape -local-symbol graph that executes all six factors in exact source order, -including the left phase and repeated right constant `i^f`. +The selected MOVE24472 now has a complete literal direct implementation and +an actual scale/width boundary for integral, bounded input/output endpoints. +The 82,813-location, 31-tape core executes right phase, right G, right offset, +all positive C axes, left phase and left G, including the absolute i^f. +A separate 84,803-location, 52-tape graph embeds that byte-frozen core and +physically installs the credited sharp endpoint scale, widened private +header, signed ingress, exact unscale/fit and sole original-owner commit. -The original owner is cloned once into a distinct whole-call bank. Every -component commit remains private; only the completed MOVE reaches public -DATA. Successful calls restore every head, private body/guard and opaque -exterior, and finite component rejection preserves public DATA/HEADER -values even after earlier factors completed privately. Failure cleanup/retry -is intentionally outside this contract. +For every positive f on the supplied complete [P] x [2^f]^9 x [S] packet, +with r Gaussian coefficients, original signed MSB width w>=2 and f<=cutoff, +the endpoint wrapper assumes x and its intended complete MOVE output Ux +have Gaussian-integral numerators in the symmetric signed-w range. It +computes k=floor((f+2)/4) and w'=w+2k from the actual header, emits k sign +bits, w original bits and k zeroes per component, then executes the unchanged +core on the complete widened field. Egress validates all leading sign copies +and low zeroes before staging the exact original-width output. The central +endpoint transfer is R x and L^-1 Ux. No actual selected producer is claimed +to supply this promise, and no scale/header/grid conversion is assumed free. -The theorem covers every positive f on the supplied complete -`[P] x [2^f]^9 x [S]` array with r Gaussian coefficients, signed MSB width w, -six Gamma parameters and `f<=cutoff`. It retains the explicit C-prefix -integrality/range predicate and proves the sufficient all-f reserve: -input numerators divisible by `2^f`, component magnitude <=M, and -`2^f M<=2^(w-1)-1`. No scale/grid/width conversion is assumed free. +Only the final public commit writes the original DATA owner. Component, +conversion and core commits remain private, and public HEADER is never +written. Success restores every head, private body/guard and opaque exterior. +Finite conversion/core rejection before final commit preserves both original +public values. Failure retirement/retry and interruption rollback are outside +this contract. -The complete direct bound is `T<=2^24(fV+E+1)` and historical backing is -`K_final<=K_entry+1024(V+E+1)`, with `V=2PSr2^(9f)w` and E the actual -six-code length. New wrapper cost is exactly `31V+27`; PROOF.md section 6 -derives the total from unchanged predecessor complete bills. Descriptor -creation, signed arithmetic, every column/axis, staging, return, reset, -erasure and retained history are included. This is a direct compiler -base-case reference, not an inherited recursive `f^sigma` tariff. +With V'=2PSr2^(9f)(w+2k) and E the actual original six-code length, complete +endpoint-wrapper bounds are T<=2^26(fV'+E+1) and +K_final<=K_entry+4096(V'+E+1). ENDPOINT-PROOF.md derives every new allowance, +including Gamma decoding, actual scale count, a linear floor-halving binary +encoder, encoded-only cutoff copying, component-clock construction, complete +signed conversion, staging, returns, cleanup and retained history. The entire +core is charged at enlarged V'. The frozen core retains its separate +T<=2^24(fV+E+1) and K_entry+1024(V+E+1) theorem, including the exact new +transaction overhead 31V+27. Both are direct base-case references; no +recursive f^sigma tariff or complete recursive invoice is inferred. -Exact source dependencies are CubeJerry #7430 at -`39b40c465f7636a4bb6d70af28595fe8f70f4f3f`, #7426 at -`172f4535ce8dcff79f626410af845f757c1563be`, #7428 at -`1dbdaa414cfe4a4a0f015e88a04b52e146566786`, and #7429 at -`1a555e469b89af70d309bc966f8f813ac11dc887`, with #7427 reversal retained -transitively. Sixteen unchanged small source files and notices are pinned by -commit:path/blob/bytes/SHA256. The source archive was authenticated and -event 24472/frames []->[239] re-extracted; only its 151-byte frame witness -is retained. The exact compiler and retained independent Gaussian engine -reproduce the recipe and all 512 complete source columns. +Exact core dependencies are CubeJerry #7430 at +39b40c465f7636a4bb6d70af28595fe8f70f4f3f, #7426 at +172f4535ce8dcff79f626410af845f757c1563be, #7428 at +1dbdaa414cfe4a4a0f015e88a04b52e146566786 and #7429 at +1a555e469b89af70d309bc966f8f813ac11dc887, with #7427 retained transitively. +Sixteen unchanged small files/notices are pinned by commit:path/blob/hash. +The exact selected source archive was authenticated and event 24472/frames +[]->[239] re-extracted; only its 151-byte witness is retained. The compiler +and retained independent Gaussian engine reproduce the complete recipe and +all 512 exact source columns. Nick Petalas #7468 at +8b0dd714d30e9c1574387587eb6418ae99ac34e1 supplies the sharp integral scale; +its attributed proof is retained and pinned. Known component norms retain +#7211/#2772/#3089/#3091 credit. Width optimality is only for this fixed common +scale 2^k and symmetric endpoint promise, not adaptive grids or algorithms. -Validation is stdlib-only. Warning-strict normal and optimized replays -match RESULT.json. A full nonzero actual m=9,f=1 packet matches a direct -inverse-address Gaussian kernel oracle in 14,429,950 local transitions; -shorter same-owner reuse with a 258-bit cutoff value succeeds in 7,499,800. -A nonintegral child rejection after three completed factors preserves both -public owners with zero public writes. Four actual whole-table mutants -detect missing absolute phase, swapped right order, omitted offset and -corrupt commit. All one/two-column binary addresses and 1,025 three-column -addresses are checked. No full joined f=2 tape run is claimed. +Validation uses Python's standard library. Normal and optimized author +replays reproduce their receipts. The full core nonzero m=9,f=1 packet takes +14,429,950 transitions; shorter same-owner reuse and a late child rejection +pass. Four core graph mutants detect phase/order/offset/commit errors. +The full endpoint graph executes 14,784,628 transitions with all 52 owners +restored and exactly 4,096 final public writes. Its converter/header corpus +has 41 actual header producers through f=1023, 135 encoders through unary1024, +100 small-stream ingress/egress cases including nonzero k and negative signed +endpoints, and 90 leading-sign/low-zero rejection controls. All one/two-column +binary addresses and 1,025 three-column addresses are checked by the core. +No full joined f=2 tape execution is claimed; nonzero-k evidence is explicitly +at the supplied converter boundaries and the all-f conclusion has a written +proof. + +Separate AI mathematical review passes the two-endpoint norm/width +consequence assuming the credited integral-scale theorem. Its exact rational +tensor checker imports no author code but shares pairwise axis factorization; +it explicitly refuses -O because its checks use assert. Separate AI physical +review checks all 82,813 embedded instructions with absolute-PC relocation, +uses a fresh sparse local CPU at distinct signed origins, enumerates complete +small signed ranges and tests late narrowing faults and 512-bit cutoff headers. +Coverage, target hashes, portability adaptation and receipts are retained in +endpoint-review. These are not human or proof-kernel acceptance. From the package directory: @@ -53,31 +80,28 @@ From the package directory: python3 -I -W error -B bind_source.py python3 -I -W error -B verify.py python3 -I -O -W error -B verify.py +python3 -I -W error -B endpoint_verify.py +python3 -I -O -W error -B endpoint_verify.py ``` -Related #7462/#7468/#7477 improve separate sublemmas and are credited, not -installed. The selected all-column algebra is prior work. The new result is -the physical fixed-table transaction and join on one exact source boundary. -The bounded live overlap coverage is documented in OVERLAP.md. - -Still open: selected caller packing/old-codec and owner/transport producer; -common-grid, signed reserve and cutoff admission; faster nonleaf work and -recursive invoice; global stock/owned reset, compiler, precision and analytic -recovery. All five selected assumptions remain. No new kappa, supplier -admission, selected-frontier change, catalogue/cold replay, hosted CI, -independent human review or formal proof-kernel acceptance is claimed. - -The change is an isolated research package with reversible local files. -Shared code, frozen predecessors, upstream files and selected records are -unchanged. Prepared with substantial OpenAI Codex assistance; exact notices -and prior mathematical attribution are preserved. +The endpoint author replay took 3.39 s normally and 2.93 s optimized in this +executor. Source, numerical, ownership and time claims remain separately +scoped. #7462's shorter left word and #7477's reversal failure cleanup are +credited related work, not installed. The selected all-column algebra is +prior work. OVERLAP.md records the bounded live checks and scope extension. -## Independent orchestration check +Still open: actual selected endpoint/grid/cutoff admission, old-codec and +strided packing, occurrence emission/owner transport, faster nonleaf work, +complete recursive invoice and global stock/reset, compiler, precision and +analytic recovery. All five selected assumptions and conditional kappa remain. +No new kappa, selected-frontier change, complete catalogue/cold replay, +hosted CI, independent human or formal-kernel acceptance is claimed. -A separate exact-integer forward-address oracle and instruction-by-instruction -relocation review passed on a new full f=1 packet; see `review/REVIEW.md` and -`review/RESULT.json`. This is independent reasoning and an independent algebra -oracle within an AI-assisted run, not independent human review. +This isolated package changes no shared code, frozen predecessor, upstream +file or selected record. Prepared with substantial OpenAI Codex assistance; +exact notices and prior mathematical attribution are retained. -Credit: @CubeJerry for the predecessor literal programs and project research; -all exact source notices and originating PR references are retained. +Canonical base: `e54523517d0f03e58352e647c403a5af3e525a57`. The separately +reviewed core stage was published at `3a27ab1d302d13b1ce52411f8a174e7a32baab77`; +its exact source and independent forward-oracle review remain in `review/`. +Credit: @CubeJerry and the originating predecessor authors named in NOTICE.md. diff --git a/research/literal-selected-move-join/PR-TITLE.txt b/research/literal-selected-move-join/PR-TITLE.txt index 29e8ce0435..816128240e 100644 --- a/research/literal-selected-move-join/PR-TITLE.txt +++ b/research/literal-selected-move-join/PR-TITLE.txt @@ -1 +1 @@ -Implement the selected MOVE24472 as a literal fixed-tape program with paid transactional composition +Implement the selected MOVE24472 with literal endpoint scaling, sharp signed width and paid restoration diff --git a/research/literal-selected-move-join/PROOF.md b/research/literal-selected-move-join/PROOF.md index 8cdce2234c..f3173c7a67 100644 --- a/research/literal-selected-move-join/PROOF.md +++ b/research/literal-selected-move-join/PROOF.md @@ -281,3 +281,20 @@ and the selected conditional bound remain unchanged. The source archive was authenticated and its exact event/frames re-extracted, but no complete catalogue, selected cold replay, Lean or Docker run is claimed. Independent human and formal proof-kernel review remain unclaimed. + +## 8. Literal endpoint scale/width extension + +The frozen core theorem above remains unchanged. endpoint.py supplies a +separate literal wrapper that physically installs the sharp endpoint scale +from #7468 and sufficient common signed width. Under the supplied promise +that original input x and complete output Ux are Gaussian integral and in +the symmetric signed-w component range, it computes +`k=floor((f+2)/4)`, builds a private width `w'=w+2k` header, emits actual +signed scaling, executes the unchanged complete core, validates exact +unscale/fit into staged original-width output and performs the sole public +original-owner commit. The transfer uses central endpoints `R x` and +`L^-1 Ux`. ENDPOINT-PROOF.md states and proves the full extension, its +52-tape lifecycle and complete direct `2^26(fV'+E+1)` time and +`K_entry+4096(V'+E+1)` historical bounds. V' includes the actual widening. +This supplies local conversion; actual selected producer admission and +the global assumptions remain open. diff --git a/research/literal-selected-move-join/README.md b/research/literal-selected-move-join/README.md index b9c080c855..9ca124669e 100644 --- a/research/literal-selected-move-join/README.md +++ b/research/literal-selected-move-join/README.md @@ -8,23 +8,38 @@ admission. It executes right phase, right G, right offset, the entire positive `C^(tensor f)` child, left phase and left G, with absolute `i^f`, complete native/spectator/coefficient addresses and original-owner return. -The original public payload is cloned once into a distinct whole-call bank. +A separate **endpoint.py** wrapper physically installs the credited sharp +endpoint scale and sufficient common signed width around that frozen core. +If input x and complete output Ux are Gaussian integral in the symmetric +original signed-w range, it computes `k=floor((f+2)/4)`, widens to `w'=w+2k`, +scales by `2^k`, executes the unchanged core and validates exact unscale/fit +before the sole original-owner commit. This is one 84,803-location, 52-tape +literal graph, with complete direct bounds `T<=2^26(fV'+E+1)` and +`K_final<=K_entry+4096(V'+E+1)`, where `V'=2PSr2^(9f)(w+2k)`. The endpoint +promise remains supplied. ENDPOINT-PROOF.md gives the transfer via `R x` +and `L^-1 Ux`, literal header/conversion lifecycle, costs, and the precise +fixed-common-scale width scope. + +Within the frozen 31-tape core, the original public payload is cloned once +into a distinct whole-call bank. Every intermediate component commit is private. Only the completed MOVE writes the original owner, so a finite component rejection preserves public DATA/HEADER values. Successful calls restore all 31 heads, private bodies, guards and opaque exteriors. Rejection cleanup/retry is not claimed. -For `V=2PSr2^(9f)w` and actual six-code header length E, the complete bounds +For that core, `V=2PSr2^(9f)w` and actual six-code header length E give bounds are `T<=2^24(fV+E+1)` and `K_final<=K_entry+1024(V+E+1)`. Every descriptor, signed scalar operation, C axis, copy, staging, return and erasure is paid. This is a direct O(fV+E) reference, suitable at a fixed compiler leaf cutoff; it supplies no recursive selected-rate tariff or global native supplier. -The accepted domain retains the exact phase/range and C-prefix conditions. +The core's accepted domain retains exact phase/range and C-prefix conditions. A proved sufficient all-f reserve is input numerator divisibility by `2^f`, component magnitude <=M and `2^f M<=2^(w-1)-1`. The grid/width producer and any physical scale conversion are supplied caller work. Complete details, -source transfer, shared-bank lifecycle and derivations are in PROOF.md. +source transfer, shared-bank lifecycle and derivations are in PROOF.md. The +endpoint wrapper discharges those local prefix conditions under its stated +endpoint promise and pays its actual physical scale/width conversions. ## Reproduce @@ -34,6 +49,8 @@ Python 3.11+ and standard library only, from this directory: python3 -I -W error -B bind_source.py python3 -I -W error -B verify.py python3 -I -O -W error -B verify.py +python3 -I -W error -B endpoint_verify.py +python3 -I -O -W error -B endpoint_verify.py ``` The source check takes about 0.2 seconds. The complete verifier took 20.23 @@ -56,6 +73,25 @@ factors. Four whole-table mutants detect phase/order/offset/commit faults. No joined full f=2 tape execution is claimed; the all-f statement rests on the written composition and the retained universal graph lemmas. +ENDPOINT-RESULT.json records the extended wrapper corpus. It includes 41 +actual header producers through f=1023, 135 literal floor-halving encoders, +100 zero/nonzero-scale small-stream conversions and 90 arithmetic rejection +controls. Full f=1 integration takes 14,784,628 literal transitions and +restores all 52 owners; f=1 has k=0. Nonzero-k evidence is from the explicitly +supplied converter boundaries, not a full f=2 native execution. Its marker +is `PASS_LITERAL_ENDPOINT_WIDTH_WRAPPER`; `--quick` is explicitly unit-only +and cannot write the complete receipt. +The endpoint replay took 3.39 seconds normally and 2.93 seconds optimized; +ENDPOINT-ENVIRONMENT.json records the exact commands and environment. + +Independent agent mathematical review and a separate physical +relocation/converter review are retained in endpoint-review with exact +coverage and portable commands. The mathematical review checks the +two-endpoint norm/width consequence assuming the credited integral scale. +The physical review checks all 82,813 embedded instructions and complete +small signed ranges at distinct origins. These are AI reviews with finite +corroboration, not human or proof-kernel acceptance. + ## Source and novelty Canonical base is `e54523517d0f03e58352e647c403a5af3e525a57`. The exact selected @@ -67,9 +103,10 @@ The large source archive is represented by a 151-byte deterministic frame extraction and exact archive pins, and was re-extracted locally. This joins CubeJerry's open #7426/#7428/#7429/#7430 at their exact recorded -heads. It does not modify their sources. #7462's shorter left word, #7468's -sharper endpoint-prefix scale and #7477's reversal rejection cleanup are -credited related follow-ups, not claimed here or silently installed. +heads. It does not modify their sources. The wrapper explicitly installs +#7468's sharp integral scale and retains its exact attributed proof and pin. +Known norm lineage #7211/#2772/#3089/#3091 is credited. #7462's shorter left +word and #7477's reversal rejection cleanup remain related work not installed. The selected all-column algebra was already established; the new result is the actual source-specific fixed-table physical join and complete transaction. OVERLAP.md records the bounded live overlap check. All five global selected @@ -77,10 +114,9 @@ assumptions and the selected conditional kappa remain unchanged. ## Open next questions -1. Install paid literal scale/widen/unscale graphs around this child using - the sharp endpoint-prefix theorem, with a proved endpoint producer and - complete signed width, owner and history accounting. The initial step is - a fixed local width-changing stream transducer; no such oracle is assumed. +1. Admit the exact endpoint promise at an actual selected producer, on its + real common grid and signed format. The local scale/header/unscale work + is literal; source-reachable endpoints and full precision remain open. 2. Produce this exact packed six-code entry at an actual selected occurrence, preserving the complete external factor. The blockers are old-codec and strided packing, owner lookup/transport, grid/headroom and actual cutoff. diff --git a/research/literal-selected-move-join/VERIFY.json b/research/literal-selected-move-join/VERIFY.json index b3e4a24461..540015994d 100644 --- a/research/literal-selected-move-join/VERIFY.json +++ b/research/literal-selected-move-join/VERIFY.json @@ -2,13 +2,82 @@ "standalone_only": true, "registered_package_claimed": false, "commands": [ - ["python3", "-I", "-W", "error", "-B", "bind_source.py"], - ["python3", "-I", "-W", "error", "-B", "verify.py"], - ["python3", "-I", "-O", "-W", "error", "-B", "verify.py"] + [ + "python3", + "-I", + "-W", + "error", + "-B", + "bind_source.py" + ], + [ + "python3", + "-I", + "-W", + "error", + "-B", + "verify.py" + ], + [ + "python3", + "-I", + "-O", + "-W", + "error", + "-B", + "verify.py" + ], + [ + "python3", + "-I", + "-W", + "error", + "-B", + "endpoint_verify.py" + ], + [ + "python3", + "-I", + "-O", + "-W", + "error", + "-B", + "endpoint_verify.py" + ] + ], + "optional_exact_source_reextraction": [ + "python3", + "-I", + "-W", + "error", + "-B", + "bind_source.py", + "--source-repo", + "/path/to/existing/source/repository" + ], + "receipt_regeneration": [ + "python3", + "-I", + "-W", + "error", + "-B", + "verify.py", + "--write" ], - "optional_exact_source_reextraction": ["python3", "-I", "-W", "error", "-B", "bind_source.py", "--source-repo", "/path/to/existing/source/repository"], - "receipt_regeneration": ["python3", "-I", "-W", "error", "-B", "verify.py", "--write"], "quick_is_not_full_evidence": true, - "expected_markers": ["PASS_COMPLETE_MOVE_SOURCE_BINDING", "PASS_LITERAL_SELECTED_MOVE_JOIN"], - "no_network_required_for_standalone_commands": true + "expected_markers": [ + "PASS_COMPLETE_MOVE_SOURCE_BINDING", + "PASS_LITERAL_SELECTED_MOVE_JOIN", + "PASS_LITERAL_ENDPOINT_WIDTH_WRAPPER" + ], + "no_network_required_for_standalone_commands": true, + "endpoint_receipt_regeneration": [ + "python3", + "-I", + "-W", + "error", + "-B", + "endpoint_verify.py", + "--write" + ] } diff --git a/research/literal-selected-move-join/endpoint-reference/endpoint-prefix-PROOF.md b/research/literal-selected-move-join/endpoint-reference/endpoint-prefix-PROOF.md new file mode 100644 index 0000000000..6e257715bf --- /dev/null +++ b/research/literal-selected-move-join/endpoint-reference/endpoint-prefix-PROOF.md @@ -0,0 +1,145 @@ +# Sharp scale for endpoint-integral native C tensors + +This proof was produced by Nick Petalas. Apache-2.0. + +Put `O=Z[i]`, `pi=1+i`, and + +```text +C = [[1+i,1-i],[1-i,1+i]]/2 + = pi^-1 [[i,1],[1,i]]. +``` + +For `f>=1`, let `C_a` apply C on binary address bit a, and set +`F=C_0 ... C_(f-1)`. Let `C_S=product_(a in S) C_a`. Distinct axes +commute. The endpoint-promised input domain is + +```text +L_f = {x in O^(2^f) : F x in O^(2^f)}. +``` + +Both the input and final output are exact Gaussian integers. No assumption +about intermediate integrality is made. Arbitrary signs, imaginary parts +and independent spectator fibres are allowed. + +## Theorem + +For every `S subset {0,...,f-1}`, put `j=|S|` and `d=min(j,f-j)`. +The least nonnegative integer e such that + +```text +pi^e C_S L_f is contained in O^(2^f) +``` + +is exactly `d`. The least nonnegative integer s such that +`2^s C_S L_f` is integral is exactly `ceil(d/2)`. + +Consequently the least common Gaussian scale for every partial axis product +is `pi^floor(f/2)`, and the least common binary scale is + +```text +2^ceil(floor(f/2)/2). +``` + +The same common scales are minimal for the prefixes of any single fixed +axis ordering. They suffice for every ordering simultaneously. Minimality +is over all inputs in `L_f`, rather than for each individual input. + +## Upper bound from the two endpoints + +Direct multiplication gives + +```text +pi C = [[i,1],[1,i]], +pi C^-1 = [[1,i],[i,1]], +C^2 = [[0,1],[1,0]], +C (1,1)^T = (1,1)^T. +``` + +In particular, `pi C` and `pi C^-1` are Gaussian integral. If `x in L_f` +and `y=F x`, then + +```text +C_S x is in pi^-j O^(2^f), +C_S x = C_(S complement)^-1 y is in pi^-(f-j) O^(2^f). +``` + +For nonnegative a,b, the two fractional modules are nested and their +intersection is `pi^-min(a,b) O^(2^f)`. This proves the bound d, using +only the two endpoint promises. Since `pi^2=2i`, multiplying by +`2^ceil(d/2)` clears those denominators. + +## Matching input at every cut + +Pair d distinct axes in S with d distinct axes outside S. On each pair +use the integer array + +```text +v = e_00 + e_11. +``` + +On every unpaired axis use `u=e_0+e_1`. Let x be their tensor product, +with factors placed on the specified axes. This has only zero/one real +entries and zero imaginary parts. + +The complete transform fixes u and sends each v to `e_01+e_10`. +Indeed C is symmetric and `C^2` is the bit swap, so this identity follows +by multiplying the displayed two-by-two matrices. Thus both x and F x +are Gaussian integral, and x belongs to `L_f`. + +At the chosen cut, exactly one axis in each pair has been transformed. +Its four entries, in address order, are + +```text +(C tensor I) v = pi^-1 (i,1,1,i). +``` + +The same identity holds with the pair's axes exchanged. The unpaired u +factors remain fixed. Every coordinate of `C_S x` is therefore a Gaussian +unit times `pi^-d`. A Gaussian unit is not divisible by pi. Hence no +smaller exponent e can clear the Gaussian denominator. + +Multiplication by `2^s` increases pi divisibility by exactly `2s`, because +`2=-i pi^2`. The same example is integral after that multiplication if +and only if `2s>=d`. This proves the binary lower bound. At a middle cut +of any fixed ordering, `d=floor(f/2)`, proving both common-scale minima. + +## Arithmetic interface consequence + +Suppose a supplied array x and its intended `F x` are Gaussian integral. +Scale the input by the theorem's common binary factor, apply the ordinary +axis sequence, then divide the completed output by the same factor. +Every axis output is integral, and the final division is exact. The +returned mathematical output is exactly `F x`. + +This statement is an arithmetic composition. It supplies neither a +literal scaling program nor a signed-range bound. An implementation must +still pay both conversions, preserve ownership, allocate sufficient +intermediate signed width and scratch, and admit its actual producer's +endpoint promise. The argument applies independently to every spectator +fibre of the positive rank-one native leaf, so it covers arbitrary f in +the stated tensor model without asserting physical implementation. + +## Relation to earlier work and scope + +Jerry Chen / CubeJerry's PR7429 defines this positive C tensor at selected +MOVE24472 and requires every axis output to be integral and fit the signed +width. Its f=2 example already distinguishes final and intermediate +integrality. That distinction and the machine implementation are credited +premises, not new findings or replay targets here. + +Jose Manuel / jmbarrancoml's PR3091 supplies the physical axis method and +retains Alejandro Zarzuelo Urdiales's sharp `ceil(f/2)` binary reserve for +arbitrary inputs. The new bound uses the additional *integral final +output* premise, so it does not replace that unrestricted-input reserve. + +Clear1nsight's PR3382 characterizes the integral entrance on which every +partial coordinate product is already integral. That maximal exactness +lattice is an established result. The proof here does not reconstruct +or use its characterization. The new result is the exact scalar needed +to move the larger endpoint-promised domain into every partial-product +integrality domain, with a matching input at every cut. + +No denominator theorem for arbitrary Clifford words, intervening +noncommuting maps, nonintegral final outputs or rounded trajectories is +asserted. The statement concerns exactly the commuting coordinate C +tensors defined above. All five selected framework assumptions remain. diff --git a/research/literal-selected-move-join/endpoint-review/README.md b/research/literal-selected-move-join/endpoint-review/README.md new file mode 100644 index 0000000000..25516109e0 --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/README.md @@ -0,0 +1,55 @@ +# Independent agent review provenance + +These are AI agent reviews, not independent human or proof-kernel acceptance. +They have different targets and coverage from the author's full wrapper +replay. All original core and retained predecessor code bytes remain frozen. + +## Mathematical review + +`math/REVIEW.md` reviews the exact `math/PROOF-CANDIDATE.md` whose SHA256 is +recorded in that review. It accepts the joint endpoint component bound, +all-cut sharp witness and w+2k common width **assuming** the credited #7468 +integral-scale theorem. It does not review that scale theorem or physical +conversion, accumulator sizing, movement, ownership or costs. + +Its checker is a code-independent exact rational tensor implementation, +sharing the pairwise C-axis factorization with the candidate. It imports +no author code. It is not a different dense-kernel acceptance algorithm. +The reviewer corrected an earlier overstated description before these files +were frozen. The checker uses assert and therefore explicitly refuses -O; +an optimized refusal is recorded, not misreported as optimized verification. + +```sh +python3 -I -W error -B endpoint-review/math/independent_check.py +``` + +The executed receipt in math/RESULT.json records 63 norm matrices, 255 cut +witnesses, 32 width witnesses and three controls, plus the intentional -O +exit. The proof is universal; this finite range is corroboration. + +## Physical graph/converter review + +`physical/check_endpoint.py` is the root reviewer's separate absolute-PC +relocation check and sparse local-instruction interpreter. It checks all +82,813 embedded core instructions and no earlier public write, and runs +complete small signed ranges at distinct negative/positive origins, late +sign/low-zero failures and encoded 512-bit cutoff headers. It does not +replace the author's full f=1 integration or the written all-f cost proof. + +For portability, the copied script's single hardcoded package path was +changed to `Path(__file__).resolve().parents[2]`. The scientific code is +otherwise unchanged. The original root review at root-work/endpoint-review +was not modified. The adapted copy was executed, and physical/RESULT.json +records its current target hashes and unchanged graph/transition results. +The endpoint verifier gained only source-pin/full-header-exterior checks +after the original review receipt; replay captured its current file hash. +The graph and endpoint.py bytes did not change. + +```sh +python3 -I -W error -B endpoint-review/physical/check_endpoint.py +``` + +The physical replay can also run with -O because its scientific checks +use explicit conditions. No such optimized physical-review replay is +claimed here; normal and optimized **author** endpoint replays are separate +in ENDPOINT-ENVIRONMENT.json and ENDPOINT-RESULT.json. diff --git a/research/literal-selected-move-join/endpoint-review/ROOT-COST-REVIEW.md b/research/literal-selected-move-join/endpoint-review/ROOT-COST-REVIEW.md new file mode 100644 index 0000000000..e1021f2cc2 --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/ROOT-COST-REVIEW.md @@ -0,0 +1,27 @@ +# Orchestration cost and composition check + +The complete endpoint proof was reviewed on the frozen graph +ce283ce96dae83a69609076b4a41efe5b44c465bedbd932eed2ad5c668cf63c6. +The central endpoints are R x and L^-1 Ux; the C axes form one uninterrupted +block, so the separate mathematical review's outside-monomial condition holds. +The tensor norm and integral-scale premises imply every retained core phase +and C-axis range/parity guard at w+2k, on the declared endpoint domain. + +Every embedded core instruction was checked under the injective port/PC map. +Wrapper acquisition and all conversion loops preserve the original public +values until the sole commit, and successful cleanup returns every private +port to its supplied blank window. The root sparse-CPU checks corroborate +nonzero-k conversion at all small signed values and late narrowing rejection. +The original header's cutoff is copied by encoded length rather than value. + +The current component clock is 2PSr2^(9f), never a reduced native fibre. +The 47n+18 unary-doubling census and 16V+7 final commit census agree with +instruction counting; geometric doubling scans and all guide clear/return +costs fit the conservative wrapper allowances. E'<=E+2V' and the enlarged +core bill imply 2^26(fV'+E+1). The added interval counts fit the 4096(V'+E+1) +allowance while retaining all entry history. No old blank backing is released. + +The publication snapshot's complete endpoint replay exactly matched the +worker receipt; the source and core files remain byte-identical to the first +published stage. This is a scoped AI-assisted review, not a selected caller +admission, faster recursive tariff, independent human or kernel proof. diff --git a/research/literal-selected-move-join/endpoint-review/math/PROOF-CANDIDATE.md b/research/literal-selected-move-join/endpoint-review/math/PROOF-CANDIDATE.md new file mode 100644 index 0000000000..2e3d743585 --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/math/PROOF-CANDIDATE.md @@ -0,0 +1,44 @@ +# Candidate endpoint-bounded width bridge for the literal C leaf + +Status: root derivation plus finite corroboration; not yet independently reviewed. +Pin: Nick Petalas, CrocSwap/integer-mult-bounds#7468, head +8b0dd714d30e9c1574387587eb6418ae99ac34e1. Its sharp integral scale is credited +input. The C component row norms are known (#7211 and credited +#2772/#3089/#3091 lineage). The joint two-endpoint consequence and physical +application are investigated here, not the standalone known norm. + +Write C=[[1+i,1-i],[1-i,1+i]]/2, F=C^(tensor f), and let |x|_c be the +largest absolute real or imaginary component. Suppose x and Fx are Gaussian +integral and |x|_c,|Fx|_c <= M. For any subset S of j axes, d=min(j,f-j), + + |C_S x|_c <= 2^ceil(d/2) M. + +Proof: every coefficient of C^(tensor j) is a Gaussian unit times +(1+i)^j/2^j. For j=2t, each real output uses 2^j input real/imaginary +components with coefficient magnitude 2^-t. For j=2t+1, each uses 2*2^j +components with coefficient magnitude 2^-(t+1). The induced component norms +are 2^t and 2^(t+1); the inverse has the same norm. Apply the first bound to +x and the second to C_(S-complement)^(-1) Fx, and take the minimum. + +Sharpness: choose d axes in S and d outside S. On those 2d axes put +z=2^ceil(d/2) times the all-zero-address impulse. On every other axis use +the tensor factor u=(1,1). Put x=C_S^(-1)z, y=C_(S-complement)z. The +nonzero components of x,y are Gaussian units for even d, and Gaussian +integers whose real/imaginary components are each +/-1 for odd d. Hence +both endpoints are integral with component norm one, Fx=y, and prefix z +attains the bound. Scale by integer M to attain it at M. + +Put k=ceil(floor(f/2)/2)=floor((f+2)/4). Credited #7468 proves that +2^k C_S x is integral for every S. The bound above gives maximum scaled +component <=2^(2k) M, attained by a middle-cut witness. For symmetric +signed-w endpoint range [-(2^(w-1)-1),2^(w-1)-1], w>=2, every scaled +prefix fits symmetric signed width w+2k. This width is sharp uniformly: +choose the middle-cut witness with M=2^(w-1)-1; one fewer signed bit +cannot hold 2^(2k)M. Literal kernel numerator storage remains separate. + +Monomial permutations and unit Gaussian phases preserve this norm and +integrality. The endpoint promise therefore passes through the selected +MOVE monomial factors. This does not implement scaling, widened headers, +layout conversion, exact unscaling or owner commit: that is the next task. +No recursive f^sigma tariff, selected caller admission, global assumption +discharge or new kappa is asserted. Direct leaf cost remains O(f V). diff --git a/research/literal-selected-move-join/endpoint-review/math/RESULT.json b/research/literal-selected-move-join/endpoint-review/math/RESULT.json new file mode 100644 index 0000000000..5e11f2e301 --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/math/RESULT.json @@ -0,0 +1,6 @@ +{ + "normal_stdout": "PASS_ENDPOINT_WIDTH_REVIEW norm_matrices=63 cut_witnesses=255 width_witnesses=32 controls=3\nceil_to_floor_exponent_mutant_rejected=True\nwrong_inverse_direction_mutant_rejected=True\none_fewer_signed_bit_mutant_rejected=True\n", + "optimized_exit": 1, + "optimized_stderr": "optimized Python is unsupported: exact-check assertions would be disabled\n", + "scope": "AI mathematical review; code-independent exact rational tensor implementation sharing pairwise axis factorization; not a physical or scale-theorem review" +} diff --git a/research/literal-selected-move-join/endpoint-review/math/REVIEW.md b/research/literal-selected-move-join/endpoint-review/math/REVIEW.md new file mode 100644 index 0000000000..571eb01a3b --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/math/REVIEW.md @@ -0,0 +1,56 @@ +# Independent review: endpoint-bounded C-leaf width + +Target: /workspace/scratch/92c9920affc2/root-work/endpoint-width/PROOF-CANDIDATE.md + +Target SHA-256: 964bd6d2251f839998713337352affb224749b110830172dac0eb7bdbf969a05. + +## Decision + +**Mathematical pass** for the two-endpoint bound, the all-cut sharp witness, and the w+2k component-width claim at the fixed common scale 2^k, assuming the stated #7468 integrality premise. I found no counterexample to those three claims. + +This is an independent proof review with exact small-matrix corroboration, not a review of the credited scale theorem or of the physical wrapper. The w+2k result bounds scaled prefix components only; it does not bound literal kernel numerators, temporary accumulators, or the cost of scaling/unscaling. + +## Proof checks + +Write C_j=C^(tensor j). Every complex entry of C_j has magnitude 2^(-j/2). For even j, each entry is real or purely imaginary, so each real (and imaginary) output component has one coefficient of magnitude 2^(-j/2) per address. The component-row absolute sum is + + 2^j * 2^(-j/2) = 2^(j/2). + +For odd j, both the real and imaginary parts of each entry have magnitude 2^(-(j+1)/2). Each input address contributes two real components to an output component, giving row sum + + 2^(j+1) * 2^(-(j+1)/2) = 2^((j+1)/2). + +The inverse tensor has the same absolute row sums. Thus its exact induced component-infinity norm is 2^ceil(j/2). + +For a cut S, C_S x is bounded first by applying this norm to x. Since F=C_S C_(S-complement) and the factors commute, + + C_S x = C_(S-complement)^(-1) F x. + +Applying the inverse norm to the second endpoint gives the second bound. Taking the minimum is exactly 2^ceil(min(|S|, f-|S|)/2) M. + +For sharpness, put d=min(|S|,f-|S|) active axes on each side of the cut. Let u=(1,1), which obeys Cu=C^(-1)u=u, and let z be 2^ceil(d/2) times the zero-address impulse on the 2d active axes, tensored with u on the remaining axes. Set x=C_S^(-1)z and y=C_(S-complement)z. Then Fx=y and C_Sx=z. On the d transformed active axes, each nonzero coefficient is a Gaussian unit times 2^(-d/2) for even d, or has real and imaginary parts of magnitude 2^(-(d+1)/2) for odd d. The chosen impulse scale makes x and y Gaussian integral with component norm one, while z has component norm 2^ceil(d/2). This works for every cut; d=0 is the invariant all-ones case. + +Let r=floor(f/2) and k=ceil(r/2)=floor((f+2)/4). For every cut, ceil(d/2)<=k, so the scaled prefix has component magnitude at most 2^(2k)M. The credited premise says these scaled components are integers. At M=2^(w-1)-1, + + 2^(2k) M = 2^(w+2k-1) - 2^(2k) <= 2^(w+2k-1)-1, + +which fits the stated symmetric signed w+2k range. For a middle cut, the witness above, multiplied by M, attains the positive value 2^(2k)M at the impulse component after scaling. The positive maximum of a symmetric signed w+2k-1-bit field is 2^(w+2k-2)-1; the witness exceeds it by + + 2^(2k)(2^(w-2)-1)+1 > 0 + +for every w>=2. Thus the width is sufficient and uniformly minimal **at the fixed common scale 2^k**. This does not establish that the common scale itself is minimal. + +## Independent corroboration + +independent_check.py uses a separate exact rational matrix/tensor implementation and imports no author code. It applies the 2-by-2 factor pairwise along axes, so it shares the candidate’s tensor-axis factorization. + + PASS_ENDPOINT_WIDTH_REVIEW norm_matrices=63 cut_witnesses=255 width_witnesses=32 controls=3 + ceil_to_floor_exponent_mutant_rejected=True + wrong_inverse_direction_mutant_rejected=True + one_fewer_signed_bit_mutant_rejected=True + +The exact matrix checks cover every subset for f<=5; the all-cut witnesses cover every subset for f<=7; width witnesses cover f<=7 and w=2..5. The finite range corroborates, but does not replace, the algebraic proof above. + +## Physical-application boundary + +The final sentence about MOVE factors is valid for factors applied outside the cut, or for a proved factorization that leaves only a monomial isometry between the cut transform and complementary transform: such an isometry preserves the component norm and Gaussian integrality. The proof as written establishes the endpoint lemma for the bare F=C^(tensor f). If the literal leaf interleaves MOVE factors among individual C-axis operations, the wrapper proof must state how those factors are regrouped or prove the corresponding cut factorization; norm preservation by itself does not identify the actual intermediate prefix with C_Sx. diff --git a/research/literal-selected-move-join/endpoint-review/math/independent_check.py b/research/literal-selected-move-join/endpoint-review/math/independent_check.py new file mode 100644 index 0000000000..55f1dc2063 --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/math/independent_check.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python3 +"""Independent exact checks for PROOF-CANDIDATE.md. + +Uses direct two-by-two matrix multiplication over Gaussian rationals. It does +not import or use the candidate's butterfly checker. +""" + +from __future__ import annotations + +from fractions import Fraction +from itertools import combinations +import sys + +if not __debug__: + raise SystemExit("optimized Python is unsupported: exact-check assertions would be disabled") + +Gaussian = tuple[Fraction, Fraction] + + +def q(re: int | Fraction = 0, im: int | Fraction = 0) -> Gaussian: + return Fraction(re), Fraction(im) + + +def c_pair(a: Gaussian, b: Gaussian, inverse: bool = False) -> tuple[Gaussian, Gaussian]: + # Directly multiply by C or C^-1, where + # C = [[1+i, 1-i], [1-i, 1+i]] / 2 and C^-1 = C^3. + ar, ai = a + br, bi = b + sr, si = ar + br, ai + bi + dr, di = ar - br, ai - bi + if inverse: + return q((sr + di) / 2, (si - dr) / 2), q((sr - di) / 2, (si + dr) / 2) + return q((sr - di) / 2, (si + dr) / 2), q((sr + di) / 2, (si - dr) / 2) + + +def apply_axis(v: list[Gaussian], f: int, axis: int, inverse: bool = False) -> list[Gaussian]: + out = list(v) + bit = 1 << axis + for lo in range(1 << f): + if lo & bit: + continue + a, b = c_pair(v[lo], v[lo | bit], inverse) + out[lo], out[lo | bit] = a, b + return out + + +def apply_subset(v: list[Gaussian], f: int, axes: set[int], inverse: bool = False) -> list[Gaussian]: + out = list(v) + ordered = sorted(axes) + if inverse: + ordered = list(reversed(ordered)) + for axis in ordered: + out = apply_axis(out, f, axis, inverse) + return out + + +def max_component(v: list[Gaussian]) -> Fraction: + return max(max(abs(re), abs(im)) for re, im in v) + + +def integral(v: list[Gaussian]) -> bool: + return all(re.denominator == 1 and im.denominator == 1 for re, im in v) + + +def witness(f: int, subset: set[int], endpoint_scale: int = 1) -> tuple[list[Gaussian], list[Gaussian], list[Gaussian], int]: + comp = set(range(f)) - subset + d = min(len(subset), len(comp)) + left_active = set(sorted(subset)[:d]) + right_active = set(sorted(comp)[:d]) + active_mask = sum(1 << axis for axis in left_active | right_active) + lam = 1 << ((d + 1) // 2) + z = [q(endpoint_scale * lam if (address & active_mask) == 0 else 0) for address in range(1 << f)] + x = apply_subset(z, f, subset, inverse=True) + y = apply_subset(z, f, comp) + return x, y, z, d + + +def check_induced_norms(max_f: int = 5) -> int: + cases = 0 + for f in range(max_f + 1): + n = 1 << f + all_axes = set(range(f)) + for j in range(f + 1): + for axes_tuple in combinations(range(f), j): + axes = set(axes_tuple) + columns = [] + for col in range(n): + e = [q(int(i == col)) for i in range(n)] + columns.append(apply_subset(e, f, axes)) + max_row_sum = Fraction(0) + for row in range(n): + row_sum = sum(abs(columns[col][row][0]) + abs(columns[col][row][1]) for col in range(n)) + max_row_sum = max(max_row_sum, row_sum) + expected = Fraction(1 << ((j + 1) // 2)) + assert max_row_sum == expected, (f, axes, max_row_sum, expected) + # The complementary inverse has the same exact row norm. + inv_columns = [] + for col in range(n): + e = [q(int(i == col)) for i in range(n)] + inv_columns.append(apply_subset(e, f, all_axes - axes, inverse=True)) + inv_row_sum = max( + sum(abs(inv_columns[col][row][0]) + abs(inv_columns[col][row][1]) for col in range(n)) + for row in range(n) + ) + comp_j = f - j + assert inv_row_sum == Fraction(1 << ((comp_j + 1) // 2)) + cases += 1 + return cases + + +def check_witnesses(max_f: int = 7) -> tuple[int, int]: + cut_cases = 0 + width_cases = 0 + for f in range(max_f + 1): + axes = set(range(f)) + for j in range(f + 1): + for subset_tuple in combinations(range(f), j): + subset = set(subset_tuple) + x, y, z, d = witness(f, subset) + pref = apply_subset(x, f, subset) + whole = apply_subset(x, f, axes) + assert integral(x) and integral(y) and integral(pref) + assert whole == y + assert pref == z + assert max_component(x) == 1 + assert max_component(y) == 1 + assert max_component(pref) == 1 << ((d + 1) // 2) + cut_cases += 1 + + # Middle cut saturates the common-scale bound and the one-bit-lower + # signed width counterexample for several input widths. + mid = set(range(floor_half(f))) + d = min(len(mid), f - len(mid)) + k = (floor_half(f) + 1) // 2 + for w in range(2, 6): + m = (1 << (w - 1)) - 1 + x, y, z, d = witness(f, mid, endpoint_scale=m) + pref = apply_subset(x, f, mid) + scaled_pref = [q(re * (1 << k), im * (1 << k)) for re, im in pref] + assert max_component(x) == m and max_component(y) == m + assert integral(scaled_pref) + sharp = (1 << (2 * k)) * m + assert max_component(scaled_pref) == sharp + max_wide = (1 << (w + 2 * k - 1)) - 1 + max_narrow = (1 << (w + 2 * k - 2)) - 1 + assert sharp <= max_wide + assert sharp > max_narrow + width_cases += 1 + return cut_cases, width_cases + + +def floor_half(n: int) -> int: + return n // 2 + + +def check_negative_controls() -> dict[str, bool]: + # d=1 is exactly where floor(d/2) is too small. + f, subset = 2, {0} + x, y, z, d = witness(f, subset) + pref = apply_subset(x, f, subset) + assert d == 1 and max_component(pref) == 2 + rejected_floor_exponent = max_component(pref) > (1 << (d // 2)) + + # Applying C instead of C^-1 on the S axes fails the joint endpoint. + comp = set(range(f)) - subset + bad_x = apply_subset(z, f, subset) + bad_y = apply_subset(bad_x, f, set(range(f))) + expected_y = apply_subset(z, f, comp) + rejected_wrong_inverse = bad_y != expected_y + + # For w=2, f=2, k=1, the sharp output is 4; a 3-bit symmetric signed + # field only holds through 3. + w, k = 2, 1 + sharp = (1 << (2 * k)) * ((1 << (w - 1)) - 1) + rejected_one_fewer_bit = sharp > ((1 << (w + 2 * k - 2)) - 1) + + assert rejected_floor_exponent + assert rejected_wrong_inverse + assert rejected_one_fewer_bit + return { + "ceil_to_floor_exponent_mutant_rejected": rejected_floor_exponent, + "wrong_inverse_direction_mutant_rejected": rejected_wrong_inverse, + "one_fewer_signed_bit_mutant_rejected": rejected_one_fewer_bit, + } + + +def main() -> None: + norm_cases = check_induced_norms() + cut_cases, width_cases = check_witnesses() + controls = check_negative_controls() + print( + "PASS_ENDPOINT_WIDTH_REVIEW " + f"norm_matrices={norm_cases} cut_witnesses={cut_cases} " + f"width_witnesses={width_cases} controls={len(controls)}" + ) + for key, value in controls.items(): + print(f"{key}={value}") + + +if __name__ == "__main__": + main() diff --git a/research/literal-selected-move-join/endpoint-review/physical/PUBLICATION-REPLAY.json b/research/literal-selected-move-join/endpoint-review/physical/PUBLICATION-REPLAY.json new file mode 100644 index 0000000000..71f295e7aa --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/physical/PUBLICATION-REPLAY.json @@ -0,0 +1,213 @@ +{ + "converters": { + "arithmetic_rejections": 90, + "cases": 100, + "component_widths": [ + 2, + 3, + 4, + 7, + 17 + ], + "max_k": 16, + "transitions": 151380 + }, + "encoder": { + "cases": 135, + "max_unary": 1024, + "transitions": 241111 + }, + "entries": { + "commit": 84523, + "core": 1594, + "egress": 84407 + }, + "full_f1": { + "bits": 4096, + "early": 0, + "heads": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "highs": [ + 13, + 4099, + 13, + 4099, + 4099, + 13, + 4099, + 5, + 1027, + 4, + 4, + 4, + 4, + 7, + 3, + 7, + 1027, + 4, + 7, + 5, + 6, + 6, + 6, + 4099, + 4099, + 4099, + 4099, + 15, + 4099, + 5, + 4099, + 2051, + 2051, + 15, + 4099, + 2051, + 4099, + 12, + 131, + 2051, + 1027, + 2051, + 2051, + 2051, + 2051, + 2051, + 1027, + 1027, + 1027, + 4099, + 9, + 4099 + ], + "history": 82251, + "lows": [ + 3, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "rejected": false, + "shape": [ + 1, + 1, + 1, + 1, + 4, + 1 + ], + "steps": 14784628, + "writes": 4096 + }, + "graph_sha256": "ce283ce96dae83a69609076b4a41efe5b44c465bedbd932eed2ad5c668cf63c6", + "header": { + "cases": 41, + "cutoff_bits": 258, + "max_f": 1023, + "transitions": 697608 + }, + "locations": 84803, + "marker": "PASS_LITERAL_ENDPOINT_WIDTH_WRAPPER", + "tapes": 52 +} diff --git a/research/literal-selected-move-join/endpoint-review/physical/RESULT.json b/research/literal-selected-move-join/endpoint-review/physical/RESULT.json new file mode 100644 index 0000000000..f26f976a58 --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/physical/RESULT.json @@ -0,0 +1,90 @@ +{ + "marker": "PASS_ROOT_LITERAL_ENDPOINT_REVIEW", + "locations": 84803, + "relocated_core_instructions": 82813, + "graph_sha256": "ce283ce96dae83a69609076b4a41efe5b44c465bedbd932eed2ad5c668cf63c6", + "converters": [ + { + "w": 2, + "k": 0, + "all_signed_values": 4, + "ingress_steps": 248, + "egress_steps": 252 + }, + { + "w": 3, + "k": 1, + "all_signed_values": 8, + "ingress_steps": 820, + "egress_steps": 892 + }, + { + "w": 4, + "k": 2, + "all_signed_values": 16, + "ingress_steps": 2300, + "egress_steps": 2572 + }, + { + "w": 5, + "k": 3, + "all_signed_values": 32, + "ingress_steps": 5932, + "egress_steps": 6732 + }, + { + "w": 6, + "k": 5, + "all_signed_values": 64, + "ingress_steps": 15948, + "egress_steps": 18572 + }, + { + "w": 7, + "k": 9, + "all_signed_values": 128, + "ingress_steps": 45708, + "egress_steps": 55052 + } + ], + "late_rejection_controls": 10, + "headers": [ + { + "f": 2, + "w": 2, + "cutoff_bits": 512, + "steps": 19148 + }, + { + "f": 6, + "w": 5, + "cutoff_bits": 512, + "steps": 19826 + }, + { + "f": 18, + "w": 33, + "cutoff_bits": 512, + "steps": 23690 + }, + { + "f": 34, + "w": 65, + "cutoff_bits": 512, + "steps": 28067 + }, + { + "f": 66, + "w": 129, + "cutoff_bits": 512, + "steps": 36672 + } + ], + "independence": "separate sparse signed-origin local-instruction interpreter and exact-integer complete small signed-range oracle", + "scope": "modular converter/header and exact whole-core relocation; author integrated f1 replay and written all-f proof are separate evidence", + "files": { + "endpoint.py": "1c7f02fd1bb6ce547f8a646c6632e2a481f9a54a5b02e09128aef9cccfd666f0", + "move.py": "42e4293ab59ffa1c99e0dbbd5fded0833a5d726e1e794f0f263ae9a4686587a5", + "endpoint_verify.py": "99dc8fb0d4f74fdeaf017ecbcb0ceff338f146bd934761c82988526c237dd86b" + } +} diff --git a/research/literal-selected-move-join/endpoint-review/physical/check_endpoint.py b/research/literal-selected-move-join/endpoint-review/physical/check_endpoint.py new file mode 100644 index 0000000000..aa16ae6ab4 --- /dev/null +++ b/research/literal-selected-move-join/endpoint-review/physical/check_endpoint.py @@ -0,0 +1,83 @@ +"""Separate instruction relocation and exact integer converter review.""" +from pathlib import Path +import hashlib,json,sys +P=Path(__file__).resolve().parents[2] +sys.path.insert(0,str(P)) +import endpoint as e + +def require(x,s): + if not x:raise ValueError(s) + +def machine(code,words,limit=1000000): + origins=[-13+3*t for t in range(e.TAPES)] + tapes=[{o+i:c for i,c in enumerate(words.get(t,''))} for t,o in enumerate(origins)] + for t in e.WRAPPER_PRIVATE:tapes[t][origins[t]-1]='|' + heads=origins.copy();visits=[{o} for o in origins] + pc=steps=writes=0;rejected=False + while True: + op,*a=code[pc];steps+=1 + require(steps<=limit,'bounded unit review exhausted') + if op=='read': + symbol=tapes[a[0]].get(heads[a[0]],'_') + if symbol not in a[1]:rejected=True;break + pc=a[1][symbol] + elif op=='write': + tapes[a[0]][heads[a[0]]]=a[1];pc+=1;writes+=a[0]==e.DATA + elif op=='move': + require(a[1] in (-1,1),'nonunit move') + heads[a[0]]+=a[1];visits[a[0]].add(heads[a[0]]);pc+=1 + elif op=='goto':pc=a[0] + elif op=='halt':break + else:raise ValueError('nonlocal opcode') + return tapes,heads,origins,steps,writes,rejected,visits + +def get(tapes,origins,t,n):return ''.join(tapes[t].get(origins[t]+i,'_') for i in range(n)) +def word(x,w):return format(x%(1< limit: + raise ValueError('finite wrapper verifier budget') + if op == 0: + pc = arg[tapes[tape][heads[tape]]] + if pc < 0: + rejected = True + break + elif op == 1: + tapes[tape][heads[tape]] = arg + if tape == e.DATA: + writes += 1 + early += commit is None or pc < commit + pc += 1 + elif op == 2: + heads[tape] += arg + if heads[tape] < lows[tape]: + lows[tape] = heads[tape] + if heads[tape] > highs[tape]: + highs[tape] = heads[tape] + need(0 <= heads[tape] < len(tapes[tape]), 'fixture window escaped') + pc += 1 + elif op == 3: + pc = tape + else: + break + return dict(steps=steps, rejected=rejected, writes=writes, early=early, + heads=heads, lows=lows, highs=highs, + history=sum(hi - lo + 1 for lo, hi in zip(lows, highs))) + + +def header_cases(): + code, _ = e.compile_header() + total = 0 + fs = list(range(1, 33)) + [63, 64, 65, 127, 128, 255, 257, 511, 1023] + for f in fs: + w = 2 + (f % 17) + shape = (f, 1 + f % 3, 1 + f % 5, 1 + f % 7, w, 1 << 257) + k, wp = (f + 2) // 4, w + 2 * ((f + 2) // 4) + expected = v.header(shape[:4] + (wp, shape[5])) + original = v.header(shape) + '|001|' + tapes = blank_tapes(4 * (f + wp + len(original) + 30)) + put(tapes, e.HEADER, original) + before = [bytes(t) for t in tapes] + result = run(code, tapes) + need(not result['rejected'] and not result['writes'], 'header producer rejected') + need(bytes(tapes[e.HEADER]) == before[e.HEADER], 'original header changed') + wh_target = bytearray(before[e.WH]) + wh_target[2] = 3 + wh_target[3:3 + len(expected)] = bytes(v.SYMBOLS[x] for x in expected) + need(tapes[e.WH] == wh_target, 'widened Gamma header/exterior') + expected_guides = {e.F: f, e.R: shape[1], e.P: shape[2], e.S: shape[3], + e.WIDTH: w, e.K: k, e.WIDE: wp, e.BLEN: wp.bit_length()} + for tape, count in expected_guides.items(): + target = bytearray(before[tape]) + target[2] = 3 + target[3:3 + count] = bytes([2]) * count + need(tapes[tape] == target, 'header guide/exterior ' + str(tape)) + need(result['heads'] == [3] * e.TAPES, 'header unit heads not returned') + for i, tape in enumerate(tapes): + if i not in expected_guides and i not in (e.WH, e.HEADER): + target = bytearray(before[i]) + if i in e.WRAPPER_PRIVATE: + target[2] = 3 + need(tape == target, 'unexpected live header helper ' + str(i)) + need(result['steps'] <= (1 << 20) * (f + wp + len(original) + 1), 'header linear bound') + total += result['steps'] + return dict(cases=len(fs), transitions=total, max_f=max(fs), cutoff_bits=258) + + +def conversion_cases(): + ingress, _ = e.compile_converter('ingress') + egress, _ = e.compile_converter('egress') + rng = random.Random(746824472) + total = cases = rejected = 0 + widths = (2, 3, 4, 7, 17) + for f in (1, 2, 3, 5, 6, 9, 10, 17, 31, 65): + k = (f + 2) // 4 + for w in widths: + values = [-(1 << (w - 1)), (1 << (w - 1)) - 1, -1, 0, 1, + rng.randrange(-(1 << (w - 1)), 1 << (w - 1))] + word = ''.join(v.signed(x, w) for x in values) + wide = ''.join(v.signed(x << k, w + 2 * k) for x in values) + tapes = blank_tapes(4 * (len(wide) + 50)) + for tape in e.WRAPPER_PRIVATE: + tapes[tape][2] = 3 + for tape, count in ((e.WIDTH, w), (e.K, k), (e.COUNT, len(values))): + put(tapes, tape, '1' * count) + put(tapes, e.DATA, word) + before = [bytes(t) for t in tapes] + result = run(ingress, tapes) + need(not result['rejected'] and not result['writes'], 'ingress rejection') + expected = bytearray(before[e.WD]) + expected[3:3 + len(wide)] = bytes(v.SYMBOLS[x] for x in wide) + need(tapes[e.WD] == expected, 'ingress signed scale/width') + need(all(bytes(t) == before[i] for i, t in enumerate(tapes) if i != e.WD), + 'ingress public/guides/trace/exterior') + need(result['heads'] == [3] * e.TAPES, 'ingress helper return') + need(result['steps'] <= (1 << 12) * (len(wide) + 1), 'ingress complete bound') + total += result['steps'] + before = [bytes(t) for t in tapes] + result = run(egress, tapes) + target = bytearray(before[e.OUTPUT]) + target[3:3 + len(word)] = bytes(v.SYMBOLS[x] for x in word) + need(not result['rejected'] and tapes[e.OUTPUT] == target, 'egress exact drop') + need(all(bytes(t) == before[i] for i, t in enumerate(tapes) if i != e.OUTPUT), + 'egress public/guides/source/trace/exterior') + need(result['heads'] == [3] * e.TAPES and not result['writes'], 'egress helper return') + total += result['steps'] + cases += 2 + if k: + for label, index in (('low_nonzero', w + 2 * k - 1), ('leading_mismatch', k)): + bad = [bytearray(t) for t in tapes] + # Retire prior unit output only; the tested source and guides remain live. + bad[e.OUTPUT][3:3 + len(word)] = bytes(len(word)) + bad[e.WD][3 + index] = 1 if bad[e.WD][3 + index] == 2 else 2 + before_bad = [bytes(t) for t in bad] + result = run(egress, bad) + need(result['rejected'] and not result['writes'], label + ' not rejected') + need(bytes(bad[e.DATA]) == before_bad[e.DATA], label + ' public changed') + rejected += 1 + return dict(cases=cases, transitions=total, arithmetic_rejections=rejected, + max_k=(65 + 2) // 4, component_widths=widths) + + +def encoder_cases(): + a = e.Builder() + e.unary_binary(a) + a.op('halt') + code, _ = a.finish((e.BLANK, '0', e.ONE, e.MARK)) + total = 0 + values = list(range(1, 129)) + [255, 256, 257, 511, 512, 1023, 1024] + for n in values: + tapes = blank_tapes(4 * n + 100) + for tape in e.WRAPPER_PRIVATE: + tapes[tape][2] = 3 + put(tapes, e.TMP, '1' * n) + result = run(code, tapes) + need(not result['rejected'], 'literal floor-halving rejected') + need(body(tapes[e.BINARY]) == bytes(v.SYMBOLS[x] for x in bin(n)[2:]), 'literal binary width') + need(body(tapes[e.TMP]) == body(tapes[e.HALF]) == body(tapes[e.DIGITS]) == b'', + 'encoder scratch not retired') + need(result['steps'] == 19 * n - 12 * n.bit_count() + 19 * n.bit_length() + 8, + 'exact encoder instruction census') + total += result['steps'] + return dict(cases=len(values), transitions=total, max_unary=max(values)) + + +def full_case(): + shape = (1, 1, 1, 1, 4, 1) + rng = random.Random(748024472) + values = [(2 * rng.randrange(-1, 2), 2 * rng.randrange(-1, 2)) for _ in range(512)] + word, expected = v.encode(values, shape[4]), v.oracle(values, shape) + tapes = blank_tapes(4 * (len(word) + len(v.header(shape)) + 30)) + put(tapes, e.HEADER, v.header(shape) + '|010|') + put(tapes, e.DATA, word) + before = [bytes(t) for t in tapes] + owners = tuple(map(id, tapes)) + code, alphabet, entries = e._compile_endpoint() + result = run(code, tapes, commit=entries['commit']) + need(not result['rejected'], 'full endpoint wrapper rejected') + target = bytearray(before[e.DATA]) + target[3:3 + len(expected)] = bytes(v.SYMBOLS[x] for x in expected) + need(tapes[e.DATA] == target, 'full endpoint kernel') + need(all(bytes(t) == before[i] for i, t in enumerate(tapes) if i != e.DATA), + 'full endpoint private/header/exterior retirement') + need(result['heads'] == [3] * e.TAPES and result['writes'] == len(word) and not result['early'], + 'full endpoint original-owner transaction') + need(tuple(map(id, tapes)) == owners, 'full endpoint replaced owner') + need(result['steps'] <= (1 << 26) * (len(word) + len(v.header(shape)) + 1), 'full complete time') + need(result['history'] <= e.TAPES + 4096 * (len(word) + len(v.header(shape)) + 1), + 'full retained history') + return dict(shape=shape, bits=len(word), **result) + + +def verify(quick=False): + for pin in json.loads((HERE / 'ENDPOINT-SOURCES.json').read_text())['files']: + raw = (HERE / pin['local']).read_bytes() + need(len(raw) == pin['bytes'] and hashlib.sha256(raw).hexdigest() == pin['sha256'], + 'endpoint source hash') + blob = hashlib.sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() + need(blob == pin['blob'], 'endpoint source Git blob') + code, alphabet, entries = e._compile_endpoint() + v.numeric(code) + need(alphabet == ('_', '0', '1', '|'), 'four-symbol wrapper') + need(max(args[0] for op, *args in code if op in ('read', 'write', 'move')) == e.TAPES - 1, + 'fixed wrapper owner inventory') + result = dict(marker='PASS_LITERAL_ENDPOINT_WIDTH_WRAPPER', locations=len(code), tapes=e.TAPES, + graph_sha256=hashlib.sha256(repr(code).encode()).hexdigest(), entries=entries, + header=header_cases(), encoder=encoder_cases(), converters=conversion_cases()) + if quick: + result['marker'] += '_UNIT_ONLY' + else: + result['full_f1'] = full_case() + return result + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--quick', action='store_true') + parser.add_argument('--write', action='store_true') + args = parser.parse_args() + need(not (args.quick and args.write), 'unit-only checks cannot write accepted full receipt') + result = verify(args.quick) + text = json.dumps(result, indent=2, sort_keys=True) + '\n' + if args.write: + (HERE / 'ENDPOINT-RESULT.json').write_text(text) + print(text, end='') From 5dd80e8ab9c989336b5e448e14147c2ba29da89b Mon Sep 17 00:00:00 2001 From: Jerry Jiaheng Chen <80299683+CubeJerry@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:37:31 +1100 Subject: [PATCH 3/3] Clarify standalone archive replay and remove accidental malformed hook registration --- research/literal-selected-move-join/FREEZE.json | 6 +++--- research/literal-selected-move-join/README.md | 2 ++ .../{VERIFY.json => REPRODUCTION.json} | 0 3 files changed, 5 insertions(+), 3 deletions(-) rename research/literal-selected-move-join/{VERIFY.json => REPRODUCTION.json} (100%) diff --git a/research/literal-selected-move-join/FREEZE.json b/research/literal-selected-move-join/FREEZE.json index a8573c7ea2..ffdd76ce97 100644 --- a/research/literal-selected-move-join/FREEZE.json +++ b/research/literal-selected-move-join/FREEZE.json @@ -65,8 +65,8 @@ }, { "path": "README.md", - "bytes": 7404, - "sha256": "8d270ece93788a2050cb64186645d33d9f39165b6db1f94aab0a0d089640f489" + "bytes": 7751, + "sha256": "4557683f187bbad9ce543b44f5a8a5e6c6d7e14b357355d00c5d66304032611d" }, { "path": "RESULT.json", @@ -84,7 +84,7 @@ "sha256": "26d0ef51dda5fa599381f7f31dec4ba3a37f14f63ff9055ad1661dec2d02610c" }, { - "path": "VERIFY.json", + "path": "REPRODUCTION.json", "bytes": 1327, "sha256": "50c71e702b569a3fcc7953c0f07e3c5bae8d4b3e0b566bf0ca21145d725b37b5" }, diff --git a/research/literal-selected-move-join/README.md b/research/literal-selected-move-join/README.md index 9ca124669e..f0a03b2e92 100644 --- a/research/literal-selected-move-join/README.md +++ b/research/literal-selected-move-join/README.md @@ -43,6 +43,8 @@ endpoint promise and pays its actual physical scale/width conversions. ## Reproduce +This archive uses [REPRODUCTION.json](REPRODUCTION.json) as a standalone replay guide. It is not a registered `research//VERIFY.json` manifest, and the generic research-package hook does not validate or run it. The commands below replay the archive directly; accepted receipts are read-only unless an explicit `--write` option is supplied. + Python 3.11+ and standard library only, from this directory: ```sh diff --git a/research/literal-selected-move-join/VERIFY.json b/research/literal-selected-move-join/REPRODUCTION.json similarity index 100% rename from research/literal-selected-move-join/VERIFY.json rename to research/literal-selected-move-join/REPRODUCTION.json