From f2f5130ec84f6a0fc81dbfec9a287909500aa80d Mon Sep 17 00:00:00 2001 From: Jerry Jiaheng Chen <80299683+CubeJerry@users.noreply.github.com> Date: Sat, 14 Nov 2026 00:53:16 +1100 Subject: [PATCH] Implement literal fixed-rank positive native service with a joint column guard --- .../CHECKSUMS.sha256 | 46 + .../FREEZE.json | 309 +++ .../PR-DESCRIPTION.md | 71 + .../PR-TITLE.txt | 1 + .../README.md | 98 + .../SOURCES.json | 98 + .../TASK.json | 93 + .../VERIFY.json | 45 + .../implementation/CHECKPOINT.md | 18 + .../implementation/ENVIRONMENT.json | 9 + .../implementation/FREEZE.json | 191 ++ .../implementation/NOTICE.md | 30 + .../implementation/OVERLAP.md | 46 + .../implementation/PR-DESCRIPTION.md | 38 + .../implementation/PROOF.md | 219 +++ .../implementation/README.md | 57 + .../implementation/RESULT.json | 1722 +++++++++++++++++ .../implementation/SOURCE-BINDING.json | 65 + .../implementation/SOURCES.json | 143 ++ .../implementation/adapter.py | 117 ++ .../implementation/bind_sources.py | 61 + .../implementation/join.py | 159 ++ .../implementation/machine.py | 129 ++ .../implementation/reference/pr6978-PROOF.md | 380 ++++ .../reference/rank2/FREEZE.json | 179 ++ .../implementation/reference/rank2/PROOF.md | 316 +++ .../reference/rank2/RECIPE.json | 490 +++++ .../reference/rank2/SOURCES.json | 232 +++ .../implementation/reference/rank2/machine.py | 129 ++ .../implementation/reference/rank2/rank2.py | 200 ++ .../reference/rank2/reference/home/NOTICE.md | 35 + .../rank2/reference/home/parent_adapter.py | 131 ++ .../rank2/reference/home/tape_graph.py | 281 +++ .../reference/rank2/reference/leaf/NOTICE.md | 34 + .../leaf/inputs/controller_reference.py | 112 ++ .../reference/rank2/reference/leaf/leaf.py | 564 ++++++ .../rank2/reference/linear/NOTICE.md | 36 + .../linear/inputs/controller_reference.py | 112 ++ .../rank2/reference/linear/linear.py | 435 +++++ .../reference/rank2/reference/phase/NOTICE | 11 + .../phase/inputs/controller_reference.py | 112 ++ .../reference/rank2/reference/phase/phase.py | 335 ++++ .../rank2/reference/source/clifford_exact.py | 149 ++ .../rank2/reference/source/native_verify.py | 277 +++ .../implementation/verify.py | 209 ++ .../review/root/RESULT.json | 46 + .../review/root/ROOT-REVIEW.md | 112 ++ .../review/root/check_positive_root.py | 123 ++ 48 files changed, 8805 insertions(+) create mode 100644 research/literal-fixed-rank-positive-native/CHECKSUMS.sha256 create mode 100644 research/literal-fixed-rank-positive-native/FREEZE.json create mode 100644 research/literal-fixed-rank-positive-native/PR-DESCRIPTION.md create mode 100644 research/literal-fixed-rank-positive-native/PR-TITLE.txt create mode 100644 research/literal-fixed-rank-positive-native/README.md create mode 100644 research/literal-fixed-rank-positive-native/SOURCES.json create mode 100644 research/literal-fixed-rank-positive-native/TASK.json create mode 100644 research/literal-fixed-rank-positive-native/VERIFY.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/CHECKPOINT.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/ENVIRONMENT.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/FREEZE.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/NOTICE.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/OVERLAP.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/PR-DESCRIPTION.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/PROOF.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/README.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/RESULT.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/SOURCE-BINDING.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/SOURCES.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/adapter.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/bind_sources.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/join.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/machine.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/pr6978-PROOF.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/FREEZE.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/PROOF.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/RECIPE.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/SOURCES.json create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/machine.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/rank2.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/home/NOTICE.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/home/parent_adapter.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/home/tape_graph.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/NOTICE.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/inputs/controller_reference.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/leaf.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/NOTICE.md create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/inputs/controller_reference.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/linear.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/NOTICE create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/inputs/controller_reference.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/phase.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/source/clifford_exact.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/source/native_verify.py create mode 100644 research/literal-fixed-rank-positive-native/implementation/verify.py create mode 100644 research/literal-fixed-rank-positive-native/review/root/RESULT.json create mode 100644 research/literal-fixed-rank-positive-native/review/root/ROOT-REVIEW.md create mode 100644 research/literal-fixed-rank-positive-native/review/root/check_positive_root.py diff --git a/research/literal-fixed-rank-positive-native/CHECKSUMS.sha256 b/research/literal-fixed-rank-positive-native/CHECKSUMS.sha256 new file mode 100644 index 0000000000..0172ef494b --- /dev/null +++ b/research/literal-fixed-rank-positive-native/CHECKSUMS.sha256 @@ -0,0 +1,46 @@ +3fc3fe24da851856c157c489ee82ee209250ebca9d9f53a9ae65f4efb5d52b91 PR-DESCRIPTION.md +31add7fd3c4cf546c62e05477b4cc293df1691366ded5c880ab599578ef82611 PR-TITLE.txt +237a35366b06242e4873e9156732a92eed5327ed6ae825bb8dd221a6f45709dc README.md +b5dec08bb4c4ddf160267a7a2ab3c236d9ee51fd6dcf3f54f7e1439fee38e434 SOURCES.json +554e4b8f0d1dd015c1bb480ce6a3893a5e25df803edff1e9b116d3d986ffaf68 TASK.json +5198029a989688ee0d982042259f67372f8d7eed095b208795e41bba88f47ce5 VERIFY.json +ae52c89420cbc468543b35bb41a258a39359328e3686e2b845a6b65e21209baa implementation/CHECKPOINT.md +77869ff81b59231e03707b857a5b0336c3ea3561e3894dc7e8132a6a12549c7b implementation/ENVIRONMENT.json +5735c401ba981a7af4d3a146eb047d04fa0c87dbf7ed49bd82dc57df8d6cb2ef implementation/FREEZE.json +4b90ab2e285248e040eb497a518c91de76075bee805a44d7f864483a5fa0a940 implementation/NOTICE.md +d25f870593857f4355838107b9e474190098d06f57dc658403f07e6643d4271c implementation/OVERLAP.md +794daab8467df555f4891249d664487210137434d408ce11566efc3a2dab5885 implementation/PR-DESCRIPTION.md +48899c607452daccd0998f4005ae2a6ed85a723969f474bf796496303ad4d4bb implementation/PROOF.md +7317240902788d46180bf9fea949197b66853c462a5f81d6598b603d085a748c implementation/README.md +95c830d899981e4bb56174d1eebeff72e55629170c55b1f045f990218b4f86a3 implementation/RESULT.json +ce90103e2981238badcb8adba444808c785af91ca4092b3390abdc989de03232 implementation/SOURCE-BINDING.json +496948cd8d2b5134ceed6b48b870be73f6415b5f70e97ab35b744ded5a2a3c03 implementation/SOURCES.json +e7247705c4440b09b71a4a460fc169fc29e1bfbe36de2320ee3a09c9582c8534 implementation/adapter.py +c4613ea17767bf8e82251d36cea9023b1436dc6e602c9378e456652598e816b6 implementation/bind_sources.py +971080f6254cfaf44b01a412533818ffdff78ea925452c76a02524092b3ccff6 implementation/join.py +ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee implementation/machine.py +2943afc32745929374e8e55daff82b5fa78baa8a557d82b231d04b936c63c10d implementation/reference/pr6978-PROOF.md +072dfea997d4db796d492eaf746e0bd99630964741b88862d0f10f5fc1e00275 implementation/reference/rank2/FREEZE.json +93e1ad8a92c3624df064e4f39119ccbb5c96391ea8dd5f7af58edc7ca9638352 implementation/reference/rank2/PROOF.md +b1386ad613213a01f736bc2e7fc7de5a25d2c700c3d577dfb396a266278ae702 implementation/reference/rank2/RECIPE.json +659ff7da20d16ece71aabbe240986e884fcaa6f53b5b0f082151e541e0534641 implementation/reference/rank2/SOURCES.json +ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee implementation/reference/rank2/machine.py +3ca027f80b6cb973fa064612b8fb18b1306498e064a01e97ff7f9b6aa40b301a implementation/reference/rank2/rank2.py +b51b8fd0773a1bbe988c8a98d951dc34b175bf56bac772ef65997f1df7ed3842 implementation/reference/rank2/reference/home/NOTICE.md +04462e141548c6a86c500d40b4aee8c446c539bd9269098d7516fa13400ef099 implementation/reference/rank2/reference/home/parent_adapter.py +7d3cee3e79ba5fe410e1a6b5f4cf6a2fbe5e274f838b798cd8860344ff258b54 implementation/reference/rank2/reference/home/tape_graph.py +773921ac301cf7e37de97ed8a0066e6bbb69ec1150cc2b5f74a12cb20103f3cf implementation/reference/rank2/reference/leaf/NOTICE.md +e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73 implementation/reference/rank2/reference/leaf/inputs/controller_reference.py +bb46c1a55f1119957a52cd61f2cd957f3f7ad1e9b818c54a852bde09a0773744 implementation/reference/rank2/reference/leaf/leaf.py +2ac2051c0fbedfd9d11348493456bf479dbdd3104a4e106c8bf36251a72b6a50 implementation/reference/rank2/reference/linear/NOTICE.md +e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73 implementation/reference/rank2/reference/linear/inputs/controller_reference.py +d56704082b82e37d4a360b8aad7e0af63499f4160c6bbcfd338804453c46fa33 implementation/reference/rank2/reference/linear/linear.py +5654eeb7fdc1acd6a6d246ef87b1155812efdcd0949f54be78e048fe905fbae0 implementation/reference/rank2/reference/phase/NOTICE +e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73 implementation/reference/rank2/reference/phase/inputs/controller_reference.py +2be149aa1be504509bb480f85396f0be302082d638e81422f747daee5a3c1ce7 implementation/reference/rank2/reference/phase/phase.py +2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962 implementation/reference/rank2/reference/source/clifford_exact.py +3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38 implementation/reference/rank2/reference/source/native_verify.py +b83d5cc25712b08c67061de8262d2abe7c5872387ceb62b202b8207c9b117471 implementation/verify.py +54cc712bd8d87d2e00ea46dfa66f63927c493135a123645a1f2760e31278d1cc review/root/RESULT.json +7a34c4e28b3c606c3167759214e061e39058e28f9a247708af4d6c9922614b7d review/root/ROOT-REVIEW.md +9d116702099776b64d5f90c408846710e502d237f6cecd99418c84abe6dddd28 review/root/check_positive_root.py diff --git a/research/literal-fixed-rank-positive-native/FREEZE.json b/research/literal-fixed-rank-positive-native/FREEZE.json new file mode 100644 index 0000000000..3be5a198b7 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/FREEZE.json @@ -0,0 +1,309 @@ +{ + "schema": "publication-candidate-freeze/1", + "status": "FROZEN", + "canonical_main": "e54523517d0f03e58352e647c403a5af3e525a57", + "scope": "Fixed positive central C service for construction-time native ranks 1..9 with arbitrary encoded f; no all-source MOVE/caller/nonleaf/assumption/kappa admission.", + "author_implementation_freeze_sha256": "5735c401ba981a7af4d3a146eb047d04fa0c87dbf7ed49bd82dc57df8d6cb2ef", + "root_review_sha256": "7a34c4e28b3c606c3167759214e061e39058e28f9a247708af4d6c9922614b7d", + "verification": { + "environment": "Python 3.12.14, standard library only", + "registered_commands": [ + { + "argv": [ + "{python}", + "-B", + "-W", + "error", + "{package}/implementation/verify.py" + ], + "timeout_seconds": 240, + "checks": "Author verification: all nine fixed-r tables, all 233 joint-guard cases including large cutoff syntax, rank-three f=1 exact actual-axis packet, output/cleanup/history bounds and negative controls." + }, + { + "argv": [ + "{python}", + "-O", + "-B", + "-W", + "error", + "{package}/implementation/verify.py" + ], + "timeout_seconds": 240, + "checks": "The same author verification under optimized Python; explicit require checks must preserve the exact scientific receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-W", + "error", + "{package}/review/root/check_positive_root.py", + "{package}/implementation" + ], + "timeout_seconds": 300, + "checks": "Independent sparse CPU executes every emitted rank-four HOME graph transition for a fresh complete f=1 packet; a separately written closed Hamming-kernel Gaussian oracle checks all entries, all spectators and output, plus all35 head/private/exterior restoration and actual runtime/history bounds." + } + ], + "results": { + "author_result_sha256": "95c830d899981e4bb56174d1eebeff72e55629170c55b1f045f990218b4f86a3", + "root_result_sha256": "54cc712bd8d87d2e00ea46dfa66f63927c493135a123645a1f2760e31278d1cc", + "author_normal_replay": "PASS; parsed output exactly equals implementation/RESULT.json", + "author_optimized_replay": "PASS; parsed output exactly equals implementation/RESULT.json", + "root_replay": "PASS; output exactly equals review/root/RESULT.json", + "root_execution": { + "rank": 4, + "transitions": 24105820, + "HOME_writes": 10256, + "historical_increment": 138402 + } + } + }, + "files": [ + { + "path": "PR-DESCRIPTION.md", + "bytes": 3520, + "sha256": "3fc3fe24da851856c157c489ee82ee209250ebca9d9f53a9ae65f4efb5d52b91" + }, + { + "path": "PR-TITLE.txt", + "bytes": 101, + "sha256": "31add7fd3c4cf546c62e05477b4cc293df1691366ded5c880ab599578ef82611" + }, + { + "path": "README.md", + "bytes": 4887, + "sha256": "237a35366b06242e4873e9156732a92eed5327ed6ae825bb8dd221a6f45709dc" + }, + { + "path": "SOURCES.json", + "bytes": 3907, + "sha256": "b5dec08bb4c4ddf160267a7a2ab3c236d9ee51fd6dcf3f54f7e1439fee38e434" + }, + { + "path": "TASK.json", + "bytes": 7731, + "sha256": "554e4b8f0d1dd015c1bb480ce6a3893a5e25df803edff1e9b116d3d986ffaf68" + }, + { + "path": "VERIFY.json", + "bytes": 1402, + "sha256": "5198029a989688ee0d982042259f67372f8d7eed095b208795e41bba88f47ce5" + }, + { + "path": "implementation/CHECKPOINT.md", + "bytes": 1877, + "sha256": "ae52c89420cbc468543b35bb41a258a39359328e3686e2b845a6b65e21209baa" + }, + { + "path": "implementation/ENVIRONMENT.json", + "bytes": 468, + "sha256": "77869ff81b59231e03707b857a5b0336c3ea3561e3894dc7e8132a6a12549c7b" + }, + { + "path": "implementation/FREEZE.json", + "bytes": 6301, + "sha256": "5735c401ba981a7af4d3a146eb047d04fa0c87dbf7ed49bd82dc57df8d6cb2ef" + }, + { + "path": "implementation/NOTICE.md", + "bytes": 1756, + "sha256": "4b90ab2e285248e040eb497a518c91de76075bee805a44d7f864483a5fa0a940" + }, + { + "path": "implementation/OVERLAP.md", + "bytes": 2859, + "sha256": "d25f870593857f4355838107b9e474190098d06f57dc658403f07e6643d4271c" + }, + { + "path": "implementation/PR-DESCRIPTION.md", + "bytes": 2398, + "sha256": "794daab8467df555f4891249d664487210137434d408ce11566efc3a2dab5885" + }, + { + "path": "implementation/PROOF.md", + "bytes": 12196, + "sha256": "48899c607452daccd0998f4005ae2a6ed85a723969f474bf796496303ad4d4bb" + }, + { + "path": "implementation/README.md", + "bytes": 3479, + "sha256": "7317240902788d46180bf9fea949197b66853c462a5f81d6598b603d085a748c" + }, + { + "path": "implementation/RESULT.json", + "bytes": 28741, + "sha256": "95c830d899981e4bb56174d1eebeff72e55629170c55b1f045f990218b4f86a3" + }, + { + "path": "implementation/SOURCE-BINDING.json", + "bytes": 1772, + "sha256": "ce90103e2981238badcb8adba444808c785af91ca4092b3390abdc989de03232" + }, + { + "path": "implementation/SOURCES.json", + "bytes": 5445, + "sha256": "496948cd8d2b5134ceed6b48b870be73f6415b5f70e97ab35b744ded5a2a3c03" + }, + { + "path": "implementation/adapter.py", + "bytes": 4845, + "sha256": "e7247705c4440b09b71a4a460fc169fc29e1bfbe36de2320ee3a09c9582c8534" + }, + { + "path": "implementation/bind_sources.py", + "bytes": 2850, + "sha256": "c4613ea17767bf8e82251d36cea9023b1436dc6e602c9378e456652598e816b6" + }, + { + "path": "implementation/join.py", + "bytes": 6778, + "sha256": "971080f6254cfaf44b01a412533818ffdff78ea925452c76a02524092b3ccff6" + }, + { + "path": "implementation/machine.py", + "bytes": 6041, + "sha256": "ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee" + }, + { + "path": "implementation/reference/pr6978-PROOF.md", + "bytes": 20312, + "sha256": "2943afc32745929374e8e55daff82b5fa78baa8a557d82b231d04b936c63c10d" + }, + { + "path": "implementation/reference/rank2/FREEZE.json", + "bytes": 5633, + "sha256": "072dfea997d4db796d492eaf746e0bd99630964741b88862d0f10f5fc1e00275" + }, + { + "path": "implementation/reference/rank2/PROOF.md", + "bytes": 16634, + "sha256": "93e1ad8a92c3624df064e4f39119ccbb5c96391ea8dd5f7af58edc7ca9638352" + }, + { + "path": "implementation/reference/rank2/RECIPE.json", + "bytes": 4468, + "sha256": "b1386ad613213a01f736bc2e7fc7de5a25d2c700c3d577dfb396a266278ae702" + }, + { + "path": "implementation/reference/rank2/SOURCES.json", + "bytes": 10337, + "sha256": "659ff7da20d16ece71aabbe240986e884fcaa6f53b5b0f082151e541e0534641" + }, + { + "path": "implementation/reference/rank2/machine.py", + "bytes": 6041, + "sha256": "ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee" + }, + { + "path": "implementation/reference/rank2/rank2.py", + "bytes": 8253, + "sha256": "3ca027f80b6cb973fa064612b8fb18b1306498e064a01e97ff7f9b6aa40b301a" + }, + { + "path": "implementation/reference/rank2/reference/home/NOTICE.md", + "bytes": 2093, + "sha256": "b51b8fd0773a1bbe988c8a98d951dc34b175bf56bac772ef65997f1df7ed3842" + }, + { + "path": "implementation/reference/rank2/reference/home/parent_adapter.py", + "bytes": 5353, + "sha256": "04462e141548c6a86c500d40b4aee8c446c539bd9269098d7516fa13400ef099" + }, + { + "path": "implementation/reference/rank2/reference/home/tape_graph.py", + "bytes": 12069, + "sha256": "7d3cee3e79ba5fe410e1a6b5f4cf6a2fbe5e274f838b798cd8860344ff258b54" + }, + { + "path": "implementation/reference/rank2/reference/leaf/NOTICE.md", + "bytes": 1900, + "sha256": "773921ac301cf7e37de97ed8a0066e6bbb69ec1150cc2b5f74a12cb20103f3cf" + }, + { + "path": "implementation/reference/rank2/reference/leaf/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "implementation/reference/rank2/reference/leaf/leaf.py", + "bytes": 17526, + "sha256": "bb46c1a55f1119957a52cd61f2cd957f3f7ad1e9b818c54a852bde09a0773744" + }, + { + "path": "implementation/reference/rank2/reference/linear/NOTICE.md", + "bytes": 2180, + "sha256": "2ac2051c0fbedfd9d11348493456bf479dbdd3104a4e106c8bf36251a72b6a50" + }, + { + "path": "implementation/reference/rank2/reference/linear/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "implementation/reference/rank2/reference/linear/linear.py", + "bytes": 13102, + "sha256": "d56704082b82e37d4a360b8aad7e0af63499f4160c6bbcfd338804453c46fa33" + }, + { + "path": "implementation/reference/rank2/reference/phase/NOTICE", + "bytes": 808, + "sha256": "5654eeb7fdc1acd6a6d246ef87b1155812efdcd0949f54be78e048fe905fbae0" + }, + { + "path": "implementation/reference/rank2/reference/phase/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "implementation/reference/rank2/reference/phase/phase.py", + "bytes": 11734, + "sha256": "2be149aa1be504509bb480f85396f0be302082d638e81422f747daee5a3c1ce7" + }, + { + "path": "implementation/reference/rank2/reference/source/clifford_exact.py", + "bytes": 6824, + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + { + "path": "implementation/reference/rank2/reference/source/native_verify.py", + "bytes": 12323, + "sha256": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38" + }, + { + "path": "implementation/verify.py", + "bytes": 9469, + "sha256": "b83d5cc25712b08c67061de8262d2abe7c5872387ceb62b202b8207c9b117471" + }, + { + "path": "review/root/RESULT.json", + "bytes": 1298, + "sha256": "54cc712bd8d87d2e00ea46dfa66f63927c493135a123645a1f2760e31278d1cc" + }, + { + "path": "review/root/ROOT-REVIEW.md", + "bytes": 6240, + "sha256": "7a34c4e28b3c606c3167759214e061e39058e28f9a247708af4d6c9922614b7d" + }, + { + "path": "review/root/check_positive_root.py", + "bytes": 6763, + "sha256": "9d116702099776b64d5f90c408846710e502d237f6cecd99418c84abe6dddd28" + } + ], + "checksums_file": { + "path": "CHECKSUMS.sha256", + "bytes": 4814, + "sha256": "d6ffeaaabe48af8f85ac7aa5e19d1f3f8aba79bca5393517d54c5f804f937ee4" + }, + "publication_edits": { + "by": "root", + "previous_bundle_freeze_sha256": "b4c10bbae4ec39a036cc3e31e0828c14d0c1e5f033577df72c350b4e50e7acd0", + "changes": [ + "Correct repository-relative README reproduction paths", + "Expand publication title, reproduction, remaining obligations and predecessor credit" + ], + "scientific_implementation_unchanged": true, + "root_scientific_review_unchanged": true + } +} diff --git a/research/literal-fixed-rank-positive-native/PR-DESCRIPTION.md b/research/literal-fixed-rank-positive-native/PR-DESCRIPTION.md new file mode 100644 index 0000000000..43388d0fac --- /dev/null +++ b/research/literal-fixed-rank-positive-native/PR-DESCRIPTION.md @@ -0,0 +1,71 @@ +## Summary + +Add a literal fixed-rank positive central service for every construction-time +native rank `rho=1..9` and arbitrary encoded column count `f` in the existing +Gamma6/HOME ABI. The wrapper preserves the original `f` header and complete +nine-slot geometry, and checks the joint guard `rho*f <= cutoff`. + +Each actual C prefix must remain integral on the supplied common grid and fit +signed width `w`; final fit alone is not an entry promise. The package states a +simple sufficient input reserve and the complete direct-leaf bill, including +incremental history and the separate HOME adapter charge. + +## Evidence + +- The original A implementation and all source receipts are retained unchanged + under `implementation/`, including its freeze manifest. +- The registered author verifier checks nine fixed-r tables, 233 guard cases, + rank-three exact payload output and negative controls in normal and optimized + Python. +- `review/root/` contains the separate sparse CPU and Hamming-kernel arithmetic + check. It executes a fresh rank-four `f=1` packet through 24,105,820 literal + transitions, checks 10,256 late HOME writes and verifies restoration of all + 35 heads, private bodies and exteriors. +- The canonical base is `e54523517d0f03e58352e647c403a5af3e525a57`. The selected + result remains conditional on its five inherited assumptions. + +## Novelty boundary + +PR #6978 at head `12e58dfdad9371a26f9978c814779da344fd80b4` already supplies +rank-rf algebra, the positive coded child and the joint cutoff; section 7 item 3 +leaves literal numerical lifecycle export open. This package claims the +Gamma6/HOME fixed-r literal lifecycle and its paid direct-leaf bounds. It does +not claim new algebra, complete selected MOVE monomial dispatch, an actual +selected producer or receiver, the faster nonleaf tariff, any inherited +assumption discharge, or a new `kappa`. + +## Costs and entry promises + +For `V=2PSc2^(9f)w`, six-Gamma header length `E`, and `F=E+V`, the 31-tape +core is bounded by `2^24(fV+E+1)` transitions and an incremental history bound +of `2048(V+E+1)`. The 35-tape HOME adapter adds `128(F+1)` transitions and +`64(F+1)` backing. B1 full-bank movement, `Setup_rho`, table/origin storage, +typed owner reservation and caller placement remain separately charged. +Older backing is retained and receives no refund for retired cells. + +## Reproduce and remaining obligations + +From the repository root: + +```sh +python3 -B scripts/research_package.py --package research/literal-fixed-rank-positive-native +``` + +The registered replay runs the author verifier in normal and optimized Python, +then the separate rank-four machine and arithmetic check. Expected result: all +three commands pass and reproduce their checked output. Full commands and +receipts are in `VERIFY.json`, `implementation/RESULT.json` and +`review/root/RESULT.json`. The source-bound producer, monomial joins, complete +caller invoice and faster nonleaf service remain open. No new kappa. + +The retained numerical, linear, phase and HOME source modules are credited and +pinned in `implementation/SOURCES.json` and their `NOTICE` files, including +predecessor work in #7426, #7428, #7429 and #7430. The fixed-r service extends +the separately reviewed literal rank-two lifecycle without changing those +source modules. + +## Credit + +Prepared for @CubeJerry with substantial OpenAI ChatGPT/Codex assistance. The +root review and its independent packet execution are disclosed in the package; +they are not blind or human review and are not a formal proof check. diff --git a/research/literal-fixed-rank-positive-native/PR-TITLE.txt b/research/literal-fixed-rank-positive-native/PR-TITLE.txt new file mode 100644 index 0000000000..a2f26c3c6c --- /dev/null +++ b/research/literal-fixed-rank-positive-native/PR-TITLE.txt @@ -0,0 +1 @@ +Implement the literal positive central service for every fixed native rank with a joint column guard diff --git a/research/literal-fixed-rank-positive-native/README.md b/research/literal-fixed-rank-positive-native/README.md new file mode 100644 index 0000000000..2ebc871f84 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/README.md @@ -0,0 +1,98 @@ +# Literal positive central service for fixed native rank + +## Result + +For each construction time rank `rho=1..9`, the retained program implements positive +`C` on the first `rho` native slots and every encoded column, in the original +six-Gamma/HOME ABI. It checks the actual joint guard `rho*f <= cutoff` while +keeping the caller's original nine-slot geometry and `f` header. It returns the +complete operand, its spectators and opaque exteriors, with all 35 HOME heads +restored and private fields retired on success. + +Here + +`C = (1/2) [[1+i, 1-i], [1-i, 1+i]]`. + +The entry contract supplies the common grid, positive `f,c,P,S,cutoff`, signed +width `w>=2`, complete header and payload, a reserved owner, valid origin and +blank required private work. Every actual intermediate C prefix must be integral +on the supplied grid and fit signed `w` bits. Final fit alone is not enough. One +simple sufficient reserve is initial component divisibility by `2^(rho*f)`, +absolute components at most `M`, and `2^(rho*f) M <= 2^(w-1)-1`. This is a +sufficient condition, not a claim that a selected producer supplies it. + +## Complete stated costs + +Let `E` be the six Gamma header length, `V = 2 P S c 2^(9f) w` be the complete +payload length, and `F=E+V`. With the fixed table, entry reservation, origins, +and setup already supplied, the 31-tape core has + +- time `T_core <= 2^24 (fV+E+1)`; +- historical backing `K_final <= K_entry + 2048 (V+E+1)`. + +The 35-tape Gamma6/HOME adapter adds at most `128(F+1)` transitions and +`64(F+1)` backing. A B1 full-bank scatter/return has its separate +`O(R_bank K_bank (F+1))` charge. Fixed `Setup_rho`, table storage, origin +provisioning, typed owner reservation and caller placement are separate entry +charges when they are not already supplied. Prior history is retained; retired +cells do not refund old backing. + +This is a direct leaf bound. It does not establish the selected faster nonleaf +rate, a complete caller invoice, or any of the five inherited assumptions. + +## Evidence and overlap + +`implementation/` is the exact A freeze, preserved byte for byte, with freeze +SHA-256 `5735c401ba981a7af4d3a146eb047d04fa0c87dbf7ed49bd82dc57df8d6cb2ef`. +The author receipt covers all nine fixed-r tables, 233 guard cases including +large cutoff syntax, and a dense rank-three `f=1` packet. `review/root/` contains +the independent review and a separate rank-four execution: its sparse CPU +executed 24,105,820 literal transitions for one fresh rank-four `f=1` packet, +and a closed Hamming-distance tensor kernel checked the exact output including +all spectators. It restored all 35 heads, private bodies and opaque exteriors. +The rank-four receipt is a finite execution, not a numerical replay for every +rank or arbitrary large `f`. + +PR #6978 (head +`12e58dfdad9371a26f9978c814779da344fd80b4`) already proves the rank-times-column +algebra, positive orientation, joint cutoff and a coded numerical child. Its +section 7 item 3 leaves the literal numerical lifecycle export open. This +package addresses that physical Gamma6/HOME lifecycle for fixed positive rank. +It does not claim new tensor algebra, all-source MOVE coverage, a monomial join, +or actual selected caller admission. The exact #6978 proof is retained at +`implementation/reference/pr6978-PROOF.md` and pinned by +`implementation/SOURCES.json`. + +## Reproduce + +From the repository root, the registered commands are: + +```sh +python3 -B -W error research/literal-fixed-rank-positive-native/implementation/verify.py +python3 -O -B -W error research/literal-fixed-rank-positive-native/implementation/verify.py +python3 -I -B -W error research/literal-fixed-rank-positive-native/review/root/check_positive_root.py research/literal-fixed-rank-positive-native/implementation +``` + +The first two commands compare the frozen author receipt in normal and optimized +Python. The third runs the independent root checker against the preserved +implementation. The checks use the Python standard library only. They do not +write result files by default. + +## Open next questions + +- Bind an actual selected producer output to the full header, owner and every + C-prefix integrality/range promise. +- Compile the complete source-specific affine, linear, quadratic, global-phase + and event-owner recipes around this central service with a literal paid join. +- Price typed creation, B1 bank delivery, receiver/return and historical backing + in the enclosing caller, then compare a complete bill to the selected + nonleaf tariff. + +## Credit and review scope + +Prepared for @CubeJerry with substantial OpenAI ChatGPT/Codex assistance. The +root review is disclosed and is not blind, human peer review, or formal-kernel +verification. No new `kappa` claim is made. See [TASK.json](TASK.json), +[SOURCES.json](SOURCES.json), [VERIFY.json](VERIFY.json), and +[PR-DESCRIPTION.md](PR-DESCRIPTION.md) for provenance, verification and the +publication draft. diff --git a/research/literal-fixed-rank-positive-native/SOURCES.json b/research/literal-fixed-rank-positive-native/SOURCES.json new file mode 100644 index 0000000000..55c3f2dcba --- /dev/null +++ b/research/literal-fixed-rank-positive-native/SOURCES.json @@ -0,0 +1,98 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md", + "usage": "provenance", + "git_blob": "3dd1af2285e597676725e85ad4f65e7ad326d695", + "sha256": "4501502c2ceb9759b20372435fe4beb51082c5a5e2910c1fd5dbe6edca415055" + } + ], + "external_primary_provenance": "implementation/SOURCES.json authenticates retained upstream source modules and the exact #6978 head proof; implementation/FREEZE.json authenticates the immutable author package. The independent root review files are separately listed below and byte-pinned.", + "upstream_proof": { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "12e58dfdad9371a26f9978c814779da344fd80b4", + "path": "research/current-coded-all-source-leaf/PROOF.md", + "git_blob": "5d619cfc2d3b7bc51e6fcc8e7a46ecd1e313e23d", + "sha256": "2943afc32745929374e8e55daff82b5fa78baa8a557d82b231d04b936c63c10d", + "local_copy": "implementation/reference/pr6978-PROOF.md", + "relevance": "Section 7 item 3 leaves literal numerical lifecycle export open; its rank-scaled coded child/algebra are prior work." + }, + "root_review_source": { + "canonical_main": "e54523517d0f03e58352e647c403a5af3e525a57", + "author_freeze_sha256": "5735c401ba981a7af4d3a146eb047d04fa0c87dbf7ed49bd82dc57df8d6cb2ef", + "root_review_sha256": "7a34c4e28b3c606c3167759214e061e39058e28f9a247708af4d6c9922614b7d", + "independent_checker": "review/root/check_positive_root.py", + "independent_receipt": "review/root/RESULT.json" + }, + "local_scientific_artifacts": [ + { + "path": "implementation/FREEZE.json", + "bytes": 6301, + "sha256": "5735c401ba981a7af4d3a146eb047d04fa0c87dbf7ed49bd82dc57df8d6cb2ef" + }, + { + "path": "implementation/PROOF.md", + "bytes": 12196, + "sha256": "48899c607452daccd0998f4005ae2a6ed85a723969f474bf796496303ad4d4bb" + }, + { + "path": "implementation/SOURCES.json", + "bytes": 5445, + "sha256": "496948cd8d2b5134ceed6b48b870be73f6415b5f70e97ab35b744ded5a2a3c03" + }, + { + "path": "implementation/RESULT.json", + "bytes": 28741, + "sha256": "95c830d899981e4bb56174d1eebeff72e55629170c55b1f045f990218b4f86a3" + }, + { + "path": "implementation/SOURCE-BINDING.json", + "bytes": 1772, + "sha256": "ce90103e2981238badcb8adba444808c785af91ca4092b3390abdc989de03232" + }, + { + "path": "implementation/verify.py", + "bytes": 9469, + "sha256": "b83d5cc25712b08c67061de8262d2abe7c5872387ceb62b202b8207c9b117471" + }, + { + "path": "implementation/adapter.py", + "bytes": 4845, + "sha256": "e7247705c4440b09b71a4a460fc169fc29e1bfbe36de2320ee3a09c9582c8534" + }, + { + "path": "implementation/join.py", + "bytes": 6778, + "sha256": "971080f6254cfaf44b01a412533818ffdff78ea925452c76a02524092b3ccff6" + }, + { + "path": "review/root/check_positive_root.py", + "bytes": 6763, + "sha256": "9d116702099776b64d5f90c408846710e502d237f6cecd99418c84abe6dddd28" + }, + { + "path": "review/root/RESULT.json", + "bytes": 1298, + "sha256": "54cc712bd8d87d2e00ea46dfa66f63927c493135a123645a1f2760e31278d1cc" + }, + { + "path": "review/root/ROOT-REVIEW.md", + "bytes": 6240, + "sha256": "7a34c4e28b3c606c3167759214e061e39058e28f9a247708af4d6c9922614b7d" + } + ] +} diff --git a/research/literal-fixed-rank-positive-native/TASK.json b/research/literal-fixed-rank-positive-native/TASK.json new file mode 100644 index 0000000000..5b686efa7a --- /dev/null +++ b/research/literal-fixed-rank-positive-native/TASK.json @@ -0,0 +1,93 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "task_id": "uniform-transfer-audit", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Choose one assumption ID (native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery), one quantified implication and exact dependency closure. Check current handoffs, including #5625 row reentry and #5707 root-prefix lowering, without treating their partial scope as the whole theorem. Prove or falsify that implication with a caller-bound argument; stop at the chosen obligation. Finite tests or root digits do not discharge an all-size statement.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "scope_change_reason": "The inherited-assumption card was narrowed to one constructive physical sublemma: a literal fixed-r positive central Gamma6/HOME lifecycle under explicit supplied numerical and owner-entry promises. This package does not prove any selected assumption at its actual caller.", + "actual_scope": "For each construction-time native rank rho in 1..9 and arbitrary encoded column count f, emit and verify a positive C service on the first rho native slots in the complete nine-slot Gamma6/HOME ABI, with the actual guard rho*f<=cutoff, all intermediate prefix promises explicit, complete direct-leaf cost and history bounds, and no caller or nonleaf admission.", + "bottleneck_link": "A bounded literal central-lifecycle sublemma touching native_all_columns, owned_erasure and precision_tape. It supplies a fixed-r positive child at the stated ABI boundary; it does not install selected monomial joins, producers, receivers or the enclosing caller.", + "stop_rule": "Stop after the nine fixed-r tables, guard and numerical entry contract, rank-three author packet, rank-four independent root packet, and complete local direct-leaf/HOME bills. Do not infer source-wide MOVE coverage, an end-to-end selected call, a recursive supplier or a changed kappa.", + "evidence": "implementation/PROOF.md; implementation/FREEZE.json; implementation/SOURCE-BINDING.json; implementation/RESULT.json; review/root/ROOT-REVIEW.md; review/root/RESULT.json; the registered commands in VERIFY.json.", + "author": "@CubeJerry", + "ai_assistance": "Substantial OpenAI ChatGPT/Codex assistance. The fixed-r construction and author checks were prepared with AI assistance; root separately reviewed the proof and ran a distinct rank-four sparse interpreter with a closed Hamming-kernel arithmetic oracle. The proposed construction is shared across roles. This is not blind review, human peer review or formal-kernel verification.", + "outcome": "completed", + "open_questions": [ + { + "question": "Can an actual selected producer deliver a valid common-grid packet satisfying every intermediate positive-C prefix integrality and signed-range promise for this fixed-r service?", + "why_it_matters": "The primitive begins after an owned packet and numerical prefix are supplied; its result alone does not establish precision_tape at a selected caller.", + "first_step": "Bind one actual selected producer output to the complete Gamma6 header, ownership, width and every C-prefix row for a concrete source event.", + "blocked_by": "No actual selected producer/receiver or source-specific numerical join is included." + }, + { + "question": "Can all selected affine, binary-linear, quadratic, constant-phase and owner recipes be joined around this positive central service with a source-bound literal dispatch?", + "why_it_matters": "The selected MOVE family requires monomial work and chronology beyond a central positive C table.", + "first_step": "Start from the authenticated selected MOVE recipe census and specify a single complete Gamma6/HOME recipe entry with its orientation, offsets, phases and paid transformation.", + "blocked_by": "This package implements only the central factor and does not bind any complete source MOVE or event owner." + }, + { + "question": "Can an enclosing supplier meet the selected nonleaf tariff while creating, placing and closing the owned bank around repeated calls?", + "why_it_matters": "A direct fixed-r leaf does not establish the selected faster movement rate, actual B1 bank invoice or global ownership closure.", + "first_step": "Write a full selected caller bill with explicit B1 bank size/history, setup, reservation, producer, primitive and return terms before building a recursive supplier.", + "blocked_by": "No nonleaf recurrence, complete caller, typed creation/placement or global assumption discharge is proved." + } + ] +} diff --git a/research/literal-fixed-rank-positive-native/VERIFY.json b/research/literal-fixed-rank-positive-native/VERIFY.json new file mode 100644 index 0000000000..5d4063ac74 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/VERIFY.json @@ -0,0 +1,45 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "-W", + "error", + "{package}/implementation/verify.py" + ], + "timeout_seconds": 240, + "checks": "Author verification: all nine fixed-r tables, all 233 joint-guard cases including large cutoff syntax, rank-three f=1 exact actual-axis packet, output/cleanup/history bounds and negative controls." + }, + { + "argv": [ + "{python}", + "-O", + "-B", + "-W", + "error", + "{package}/implementation/verify.py" + ], + "timeout_seconds": 240, + "checks": "The same author verification under optimized Python; explicit require checks must preserve the exact scientific receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-W", + "error", + "{package}/review/root/check_positive_root.py", + "{package}/implementation" + ], + "timeout_seconds": 300, + "checks": "Independent sparse CPU executes every emitted rank-four HOME graph transition for a fresh complete f=1 packet; a separately written closed Hamming-kernel Gaussian oracle checks all entries, all spectators and output, plus all35 head/private/exterior restoration and actual runtime/history bounds." + } + ] +} diff --git a/research/literal-fixed-rank-positive-native/implementation/CHECKPOINT.md b/research/literal-fixed-rank-positive-native/implementation/CHECKPOINT.md new file mode 100644 index 0000000000..6f83792ca0 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/CHECKPOINT.md @@ -0,0 +1,18 @@ +Wave13 gate started13:11 UTC, bound about13:55 UTC. + +Prior #6978 already proves rank-rf positive algebra/cutoff in23-value coded ABI; no novelty there. Its explicit remaining item3 is literal numerical lifecycle export. New scoped target: one fixed Gamma6/HOME graph per fixed rank1..9, first r slots, r positive first-slot passes,6(r-1) literal CNOTs for swaps, one rank-times-f guard, one original-owner transaction. Retain9f geometry and explicit integral/range prefix promises. No all-source MOVE or caller/rate claim. + +Optimistic complete bound: guard65536(V+E+1); r leaves65536r(fV+E+1);2(r-1) swap words of3 gates each, cost1024*6(r-1)f(V+1)+8192*2(r-1)(V+E+1); outer31V+27. For1<=r<=9 the sum is <2^22(fV+E+1), and a2^24 envelope leaves margin. History: guard64+64r+128(r-1)+8 <=1672 times(V+E+1); register2048. HOME adds128(F+1) time64(F+1) backing, general bank gathering separately. Source helper files copied byte-exact from frozen rank2 package; no edits to old packages. + +Completion13:30 UTC: full rank3 f1 nonzero dense HOME replay passes exact +actual-axis oracle; normal/-O receipts agree. All233 guard cases and all9 +table structures pass; wrong joint cutoff preserves HOME, weak old-f guard +accepts it, omitted-third-C graph returns distinct rank2 answer, actual +retained-source corruption rejects. All35 heads/private bodies/exteriors +restore on success; old guide history remains. Source-binding checks21 +retained pins,15 original Git blobs and exact canonical #6978 proof. Root's +separate microcount review identified3q extra parser rewind steps; PROOF.md +explicitly charges them within64(n+q+1). No known defect remains; independent +root numerical/routing review is pending. Exact all-source monomials and +actual caller remain outside this central leaf interface. Freeze manifest +and SOURCE-BINDING.json record final sources and all emitted graph hashes. diff --git a/research/literal-fixed-rank-positive-native/implementation/ENVIRONMENT.json b/research/literal-fixed-rank-positive-native/implementation/ENVIRONMENT.json new file mode 100644 index 0000000000..f541f5cbfe --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/ENVIRONMENT.json @@ -0,0 +1,9 @@ +{ + "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", + "normal_runtime": "elapsed_seconds 10.636", + "cache": "fresh required-absent prefix before retained imports; no bytecode writes", + "review": "author checks; parent independent review pending", + "optimized_runtime": "elapsed_seconds 10.474", + "normal_optimized_receipts": "identical; optimized command compared RESULT.json successfully" +} diff --git a/research/literal-fixed-rank-positive-native/implementation/FREEZE.json b/research/literal-fixed-rank-positive-native/implementation/FREEZE.json new file mode 100644 index 0000000000..b440dc0dec --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/FREEZE.json @@ -0,0 +1,191 @@ +{ + "status": "FROZEN", + "utc": "2026-11-13 13:30 UTC", + "canonical_main": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "CHECKPOINT.md", + "bytes": 1877, + "sha256": "ae52c89420cbc468543b35bb41a258a39359328e3686e2b845a6b65e21209baa" + }, + { + "path": "ENVIRONMENT.json", + "bytes": 468, + "sha256": "77869ff81b59231e03707b857a5b0336c3ea3561e3894dc7e8132a6a12549c7b" + }, + { + "path": "NOTICE.md", + "bytes": 1756, + "sha256": "4b90ab2e285248e040eb497a518c91de76075bee805a44d7f864483a5fa0a940" + }, + { + "path": "OVERLAP.md", + "bytes": 2859, + "sha256": "d25f870593857f4355838107b9e474190098d06f57dc658403f07e6643d4271c" + }, + { + "path": "PR-DESCRIPTION.md", + "bytes": 2398, + "sha256": "794daab8467df555f4891249d664487210137434d408ce11566efc3a2dab5885" + }, + { + "path": "PROOF.md", + "bytes": 12196, + "sha256": "48899c607452daccd0998f4005ae2a6ed85a723969f474bf796496303ad4d4bb" + }, + { + "path": "README.md", + "bytes": 3479, + "sha256": "7317240902788d46180bf9fea949197b66853c462a5f81d6598b603d085a748c" + }, + { + "path": "RESULT.json", + "bytes": 28741, + "sha256": "95c830d899981e4bb56174d1eebeff72e55629170c55b1f045f990218b4f86a3" + }, + { + "path": "SOURCE-BINDING.json", + "bytes": 1772, + "sha256": "ce90103e2981238badcb8adba444808c785af91ca4092b3390abdc989de03232" + }, + { + "path": "SOURCES.json", + "bytes": 5445, + "sha256": "496948cd8d2b5134ceed6b48b870be73f6415b5f70e97ab35b744ded5a2a3c03" + }, + { + "path": "adapter.py", + "bytes": 4845, + "sha256": "e7247705c4440b09b71a4a460fc169fc29e1bfbe36de2320ee3a09c9582c8534" + }, + { + "path": "bind_sources.py", + "bytes": 2850, + "sha256": "c4613ea17767bf8e82251d36cea9023b1436dc6e602c9378e456652598e816b6" + }, + { + "path": "join.py", + "bytes": 6778, + "sha256": "971080f6254cfaf44b01a412533818ffdff78ea925452c76a02524092b3ccff6" + }, + { + "path": "machine.py", + "bytes": 6041, + "sha256": "ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee" + }, + { + "path": "reference/pr6978-PROOF.md", + "bytes": 20312, + "sha256": "2943afc32745929374e8e55daff82b5fa78baa8a557d82b231d04b936c63c10d" + }, + { + "path": "reference/rank2/FREEZE.json", + "bytes": 5633, + "sha256": "072dfea997d4db796d492eaf746e0bd99630964741b88862d0f10f5fc1e00275" + }, + { + "path": "reference/rank2/PROOF.md", + "bytes": 16634, + "sha256": "93e1ad8a92c3624df064e4f39119ccbb5c96391ea8dd5f7af58edc7ca9638352" + }, + { + "path": "reference/rank2/RECIPE.json", + "bytes": 4468, + "sha256": "b1386ad613213a01f736bc2e7fc7de5a25d2c700c3d577dfb396a266278ae702" + }, + { + "path": "reference/rank2/SOURCES.json", + "bytes": 10337, + "sha256": "659ff7da20d16ece71aabbe240986e884fcaa6f53b5b0f082151e541e0534641" + }, + { + "path": "reference/rank2/machine.py", + "bytes": 6041, + "sha256": "ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee" + }, + { + "path": "reference/rank2/rank2.py", + "bytes": 8253, + "sha256": "3ca027f80b6cb973fa064612b8fb18b1306498e064a01e97ff7f9b6aa40b301a" + }, + { + "path": "reference/rank2/reference/home/NOTICE.md", + "bytes": 2093, + "sha256": "b51b8fd0773a1bbe988c8a98d951dc34b175bf56bac772ef65997f1df7ed3842" + }, + { + "path": "reference/rank2/reference/home/parent_adapter.py", + "bytes": 5353, + "sha256": "04462e141548c6a86c500d40b4aee8c446c539bd9269098d7516fa13400ef099" + }, + { + "path": "reference/rank2/reference/home/tape_graph.py", + "bytes": 12069, + "sha256": "7d3cee3e79ba5fe410e1a6b5f4cf6a2fbe5e274f838b798cd8860344ff258b54" + }, + { + "path": "reference/rank2/reference/leaf/NOTICE.md", + "bytes": 1900, + "sha256": "773921ac301cf7e37de97ed8a0066e6bbb69ec1150cc2b5f74a12cb20103f3cf" + }, + { + "path": "reference/rank2/reference/leaf/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "reference/rank2/reference/leaf/leaf.py", + "bytes": 17526, + "sha256": "bb46c1a55f1119957a52cd61f2cd957f3f7ad1e9b818c54a852bde09a0773744" + }, + { + "path": "reference/rank2/reference/linear/NOTICE.md", + "bytes": 2180, + "sha256": "2ac2051c0fbedfd9d11348493456bf479dbdd3104a4e106c8bf36251a72b6a50" + }, + { + "path": "reference/rank2/reference/linear/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "reference/rank2/reference/linear/linear.py", + "bytes": 13102, + "sha256": "d56704082b82e37d4a360b8aad7e0af63499f4160c6bbcfd338804453c46fa33" + }, + { + "path": "reference/rank2/reference/phase/NOTICE", + "bytes": 808, + "sha256": "5654eeb7fdc1acd6a6d246ef87b1155812efdcd0949f54be78e048fe905fbae0" + }, + { + "path": "reference/rank2/reference/phase/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73" + }, + { + "path": "reference/rank2/reference/phase/phase.py", + "bytes": 11734, + "sha256": "2be149aa1be504509bb480f85396f0be302082d638e81422f747daee5a3c1ce7" + }, + { + "path": "reference/rank2/reference/source/clifford_exact.py", + "bytes": 6824, + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + { + "path": "reference/rank2/reference/source/native_verify.py", + "bytes": 12323, + "sha256": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38" + }, + { + "path": "verify.py", + "bytes": 9469, + "sha256": "b83d5cc25712b08c67061de8262d2abe7c5872387ceb62b202b8207c9b117471" + } + ], + "excluded_generated_paths": [], + "known_defects": [], + "independent_review": "parent proof/microcount inspected; separate numerical/routing review pending", + "scope": "fixed-rank1..9 positive central Gamma6/HOME direct leaf; no monomial/source-MOVE/caller/nonleaf admission" +} diff --git a/research/literal-fixed-rank-positive-native/implementation/NOTICE.md b/research/literal-fixed-rank-positive-native/implementation/NOTICE.md new file mode 100644 index 0000000000..1d452e3c19 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/NOTICE.md @@ -0,0 +1,30 @@ +# Credit and immutable dependencies + +Prepared for CubeJerry with substantial OpenAI assistance. Apache-2.0, +following the retained research sources. This is AI-assisted implementation +and mathematical review, not independent human or formal-kernel admission. + +Credit the rank-rf algebra, source-family binding and joint-cutoff mechanism +in #6978 (12e58dfdad9371a26f9978c814779da344fd80b4), and the source methods +credited there including #3087/#3091/#6293/#6901/#6930/#6030. Credit +`selected-native-tensor-closure` for the all-column selected algebra. + +Literal numerical code is retained byte-for-byte from: + +- #7430,39b40c465f7636a4bb6d70af28595fe8f70f4f3f: generic all-column CNOT body; +- #7429,1a555e469b89af70d309bc966f8f813ac11dc887: positive first-slot C leaf; +- #7426,172f4535ce8dcff79f626410af845f757c1563be: phase dependency imported by + the frozen parent module, though no phase body executes in this join; +- the frozen literal rank2 package (FREEZE SHA256 + 072dfea997d4db796d492eaf746e0bd99630964741b88862d0f10f5fc1e00275): + generic fixed-word emitter, relocation and whole-owner transaction; +- B's permanent HOME dispatcher b4fcc9d64971fdabd0b1d82cfb749d8aac920437 and + source-bound HOME bridge13c29e2df66ba46402d4da5f1d2489ebf333e5fe: + packed split/return pattern and dense literal interpreter. + +All original dependency notices remain under reference/rank2/. SOURCES.json +records exact bytes/SHA256 for every retained file; the nested immutable +manifest records original public Git paths/blobs and proof pins. The new +join.py and adapter.py construct fixed tables offline, without changing any +retained predecessor. New code supplies the fixed-rank multiplication guard, +uniform component schedule and this Gamma6/HOME central interface. diff --git a/research/literal-fixed-rank-positive-native/implementation/OVERLAP.md b/research/literal-fixed-rank-positive-native/implementation/OVERLAP.md new file mode 100644 index 0000000000..20e55aad29 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/OVERLAP.md @@ -0,0 +1,46 @@ +# Bounded overlap and usefulness gate + +Checked against canonical main e54523517d0f03e58352e647c403a5af3e525a57 and +the exact #6978 public head12e58dfdad9371a26f9978c814779da344fd80b4 on +2026-11-13 about13:12 UTC. The retained canonical #6978 proof is in +reference/pr6978-PROOF.md and authenticated by SOURCES.json. + +#6978 already supplies source-complete positive rank-rf geometry and actual +joint cutoff for1..8, a literal39-port descriptor multiplying f by fixed r, +and a388-port coded direct child. Its numerical bill is +O(rfV+(E+1)^4); source-monomial/ordinary premises remain in its protected +whole MOVE. Its own final obligations include supplier-free monomials and +literal numerical lifecycle export. This package does not claim its algebra, +source census, first rank-r leaf or first joint cutoff. It supplies a +different complete31/35-tape Gamma6/HOME central table by composing immutable +literal first-slot leaves and actual slot swaps without changing9f geometry. +The rank-aware guard is materialized in this different MSB Gamma format. + +The frozen literal selected/rank2 packages already establish one rank1 and +one actual selected rank2 whole MOVE. Their generic CNOT body and owned +transaction are reused byte-exact. The new emitter has a fixed construction- +time rank parameter1..9, r leaves, all-r cutoff multiplication, complete +central return and a nontrivial rank3 replay. It does not broaden their +source binding by changing a rank integer in an existing recipe. + +`selected-native-tensor-closure` already proves every all-f source operator +identity algebraically and leaves physical dispatcher/owned reset open. +No algebraic native_all_columns novelty is asserted here. + +The newest30 public open PRs sorted by update at the gate, #7499 down through +the returned page, had no matching generic literal Gamma6 central package. +A targeted public PR search for Gamma6 returned0; literal+rank returned1392, +of which only the first30 metadata items were inspected. These searches are +bounded reconnaissance, not exhaustive proof of literature priority. Their +relevant results included #7429 (the reused positive rank-one leaf) and +#7349 (rank-one recursion controller/hooks, not a complete positive payload). + +The independent current-source census reports all selected central ranks +positive1..8, so it identifies no central orientation/range obstruction for +this emitter. Its source-specific monomial census is a separate task. The +selected source needs affine offsets, arbitrary invertible binary words and +linear/quadratic/global phases that are absent from this central interface. +A larger generic MOVE must actually emit and pay those monomials, bind the +source orientation/owner, and establish numerical/caller premises. Thus the +new primitive closes one local literal interface and does not imply that +all source MOVEs are now implemented. diff --git a/research/literal-fixed-rank-positive-native/implementation/PR-DESCRIPTION.md b/research/literal-fixed-rank-positive-native/implementation/PR-DESCRIPTION.md new file mode 100644 index 0000000000..614b59012f --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/PR-DESCRIPTION.md @@ -0,0 +1,38 @@ +Title: Emit fixed-rank positive native central leaves in the literal Gamma6/HOME ABI + +The existing literal positive C body acts on only the first f-bit slot; +changing its f header to rho*f would incorrectly enlarge its hard-coded +nine-slot geometry. Emit a separate fixed table for each rho1..9 using rho +unchanged first-slot passes conjugated by explicit three-CNOT slot swaps. +A literal MSB binary fixed-carry guard enforces rho*f<=the actual encoded +cutoff while every numerical consumer retains original f and all9f bits. +One outer transaction stages every pass and commits to the original owner +only after complete success; all helpers return and retire on success. + +This extends the frozen literal rank2 composition to a uniform central +primitive. #6978 already proves rank-rf algebra/cutoff and source-complete +coded children; that work and selected-native-tensor-closure receive credit. +The new scope is the31-tape numerical lifecycle table and35-tape packed HOME +return in this explicit ABI. There is no new tensorization/source-census +claim, complete generic MOVE, kappa change or assumption discharge. + +Complete successful core time is bounded by2^24(fV+E+1), with incremental +historical backing2048(V+E+1). HOME adds128(F+1) time and64(F+1) backing; +general B1 bank routing, fixed setup/program storage, supplied ownership and +all numerical/grid/placement premises remain paid or explicit. Every actual +C prefix must be integral and fit signed w bits. This is direct-leaf work; +the faster selected nonleaf tariff is not claimed. + +Validation uses only the standard library in normal and optimized Python. +All nine tables pass port/PC/unit-move/no-early-public-write checks;233 +literal guard cases include ranks1..9, f through129 and4097-bit cutoff syntax. +One complete dense f1/rho3 packet matches an independent actual-axis oracle +and restores all35 heads/private bodies/exteriors. Genuine bad joint cutoff, +weak old-f guard, omitted-third-C and changed retained-source controls are +discriminating. Full large-f numerical execution and an independent root +review are not represented by these author checks. + +Remaining source-specific monomial work includes arbitrary affine offsets, +binary words and global/linear/quadratic phases, plus exact source/owner and +caller/precision admission. This primitive alone does not implement every +selected MOVE or admit a selected recursive caller. diff --git a/research/literal-fixed-rank-positive-native/implementation/PROOF.md b/research/literal-fixed-rank-positive-native/implementation/PROOF.md new file mode 100644 index 0000000000..3aa9caacf0 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/PROOF.md @@ -0,0 +1,219 @@ +# Literal fixed-rank positive central join + +## 1. Prior result, exact boundary and claim + +Canonical context is `e54523517d0f03e58352e647c403a5af3e525a57`. +PR #6978 at `12e58dfdad9371a26f9978c814779da344fd80b4`, retained canonically +as `research/current-coded-all-source-leaf/PROOF.md` (Git blob +`5d619cfc2d3b7bc51e6fcc8e7a46ecd1e313e23d`), already proves positive rank-rf +geometry, joint cutoff, exact phase and source-family equality in its23-value +coded ABI. Its388-port child and provider-relative whole MOVE retain the +ordinary-facing monomial premises. Section7 item3 explicitly leaves literal +numerical lifecycle export open. `selected-native-tensor-closure` already +proves the all-column selected algebra and excludes the physical dispatcher +and owned reset. No such algebra is claimed new here. + +Fix construction-time native rank `rho` in1..9. It is not a decoded runtime +rank. Supply positive `f,c,P,S,cutoff`, width `w>=2`, and canonical header +`Gamma(f) Gamma(c) Gamma(P) Gamma(S) Gamma(w) Gamma(cutoff)` of full length E. +c is Gaussian coefficient multiplicity, distinct from rho. DATA is the +complete lexicographic array `[P] x [2^f]^9 x [S]`, with c coefficients at +each address, real then imaginary, each component signed w-bit MSB-first. +Thus `V=2 P S c 2^(9f) w`, `F=E+V`. Its common quantum is supplied and fixed. + +Require `rho*f<=cutoff`, and require every intermediate result of the actual +rho*f positive C axes to be Gaussian-integral on that grid and fit signed +w bits. Owners are distinct, heads start at origins, required private +bodies/guards are blank, and opaque exteriors/old backing remain separately +supplied. Malformed streams are outside this entry contract. + +**Theorem.** One emitted31-tape four-symbol local program per fixed rho +returns exactly `product_(slot0, the three-CNOT word +`(0<-0 xor i),(i<-i xor0),(0<-0 xor i)` exchanges slots0 and i. The +unchanged generic `cnot_columns(target,control)` applies each gate to all +corresponding f columns. Its inherited proof covers any distinct fixed +pair in0..8. The word sends (a,b) to (b,a), preserving other coordinates, +and has no Gaussian phase. Write this permutation Si. Exactly `Si C0 Si=Ci`. + +Chronologically the program executes joint guard,C0, then Si,C0,Si for +i=1..rho-1, then commit/retirement. The Ci act on disjoint bits and commute. +This is positive C on all rho*f requested axes, including the factor1/2 +and absolute phase. It is not projective equality. Every factor uses the +original header for full prefix/middle/suffix/component strides; all P/S, +c coefficients and inactive native bits remain complete spectators. The +all-f tensor statement follows from these individual coordinate operators, +not by tensor-powering a register scalar sum. + +## 3. Literal rank-times-f guard + +Let n be f's bit length, `q=ceil(log2(rho))`, with q=0 at rho1. Prefix FBIN +with q zero digits before the unchanged Gamma parser appends f's canonical +n MSB-first bits. The same parser retains original unary F and n marks on +FLEN. The public header is read-only throughout. + +Clear FLEN and scan FBIN from its low end. Fixed carry a in0..rho-1 on +digit b writes `(rho*b+a) mod2` and changes to `floor((rho*b+a)/2)`. +Induction on processed low digits proves multiplication. Every new carry +stays in0..rho-1. Since rho<=2^q and f<2^n, the product fits n+q positions. +The carry at the original left marker is therefore zero. A nonzero carry +there rejects; no left guard or opaque neighbor is overwritten/crossed. + +Skip/erase leading product zeros; copy the positive canonical suffix to +PREFIX while rebuilding FLEN and erasing old FBIN. Return FBIN across its +now blank body and move PREFIX back into it, erasing PREFIX. FBIN/FLEN now +hold canonical rho*f and its length at the original origins. The product +has n..n+q digits, so at most q leading zeros are skipped. Unary F remains f. +The loops are literal fixed-state operations; no host decoding occurs. + +Decode c,P,S,w using the inherited parser. Read cutoff only as binary +digits/length. The retained length-first and lexicographic comparison now +tests rho*f<=cutoff, clears its binary guides, and returns. Restore HEADER +with its trace; clear all other guides and local markers. In particular, +an arbitrarily large encoded cutoff is charged by E, never its numeric value. + +## 4. Transaction and inherited-helper invariants + +The core clones original DATA once to WORK and restores its original head +using TRACE. Immutable rank2 `insert` maps component HEADER port0 to original +HEADER, component DATA port1 to WORK, and private t>=2 to t+2. Program +counters get disjoint fixed labels and successful halts become local gotos +to the next component. Every emitted operation is read/write/unit move/goto +or halt. Leaf port28 maps to30, so31 tapes suffice independently of rho/f. + +On successful return the new guard leaves module scratch blank at origins. +Each inherited leaf and swap word has the same invariant: original HEADER +and its DATA at their origins, module-private bodies/guards erased, opaque +exterior preserved. All components can therefore reuse the same27 private +owners. Their commits affect only WORK. No owner is created per column/slot. + +After every requested axis succeeds, one V-bit final commit writes original +DATA, erases WORK and records/restores heads. WORK/TRACE markers retire. +This is the frozen rank2 outer transaction. The table checker independently +confirms no original DATA WRITE before the final commit in all nine graphs. + +HOME splits exactly six Gamma codes and complete DATA onto native private +tapes at B-relative2, retaining a blank guard at1 and permanent^ at0. Ports +map injectively to3..33; GUIDE is34. On success header/data copy back to +the complete operand, split copies erase and all35 heads return to B origins. +B1 scatters exactly F bits to the same immutable HOME. The parked fixture +is preserved; the owned field gains no productive credit. Typed creation, +placement, later scalar services and full caller remain outside the module. + +## 5. Exact numerical promises + +Permutations preserve every signed component, including its minimum. The +concrete leaf uses w+2-bit temporary numerator rows and actual exact-half +and signed-range guards. Invoke that proved domain at every C stage: +intermediate integrality/fit, not merely final fit. No scale, widened header, +rounding, precision producer or promise checker is supplied here. + +One elementary sufficient reserve is that original components are divisible +by2^(rho*f), bounded by M, and `2^(rho*f) M <= 2^(w-1)-1`. A C row is a +four-term signed sum divided by2: each axis spends at most one divisibility +bit and grows component maximum by at most2. Induction proves all prefix +promises. The exact admitted domain is larger. This reserve is not a new +norm theorem or an assertion about an actual selected producer. + +## 6. Complete direct-leaf bill and historical backing + +All local reads/writes/unit moves/gotos/halts cost one. Let +`Z=f+c+P+S+w<=5V`. Inherited Gamma conversions, trace work and final clears +have the same envelopes as the frozen rank2 proof. The new multiplication, +including its q leading writes, clear, forward/backward scans, canonical +copy/length, move-back and every rewind, costs at most64(n+q+1). For example +expanding the loops gives at most43n+38q+27. Padding also lengthens Gamma's +final captured-FBIN rewind by3q transitions. Charging that explicitly gives +43n+41q+27, still below64(n+q+1). Since n<=E,q<=4 this fits128(E+1). +The total guard fits1024(E+Z+1), below the reserved +**65536(V+E+1)**. Its visited increment is below6V+10E+100, hence below +64(V+E+1) on this positive nine-slot domain; the extra product prefix is +at most E+4 cells and no opaque boundary is traversed. + +Complete inherited bounds, including descriptors, cloning/commit, seeks, +arithmetic and retirement, are + +`T_G(k)<=1024 k f(V+1)+8192(V+E+1)`, +`T_C<=65536(fV+E+1)`. + +There are rho leaves and2(rho-1) swap words of k=3. The outer transaction +costs31V+27. Adding everything gives + +`65536(V+E+1)+65536rho(fV+E+1)` +` +6144(rho-1)f(V+1)+16384(rho-1)(V+E+1)+31V+27`. + +Using f(V+1)<=2fV and V<=fV gives + +`(94208rho+36895)fV+(81920rho+49152)E+(81920rho+49179)`. + +At rho<=9 the coefficients are bounded by884767,786432,786459. The +registered2^24 envelope covers them separately. No child, swap, conversion, +return, full-body copy or helper retirement is paid implicitly. + +Guard and every leaf/word each have64(V+E+1) incremental visited backing; +WORK/TRACE adds8(V+E+1). Sum increments rather than refund retired factors: + +`[64+64rho+128(rho-1)+8](V+E+1)` +`=(192rho-56)(V+E+1)<=1672(V+E+1)<2048(V+E+1)`. + +Older history remains in K_entry. Smaller successful calls at fixed origins +can reuse blank bodies while retaining old maxima. Changed origins require +actual interval unions and paid corridors. Adapter128(F+1)/64(F+1), B1 +full-bank work and fixed setup/program storage remain separately charged. + +This is direct O_r(fV+E). At a genuinely fixed active-axis cutoff q, +rho*f<=q makes it O_q(F+1), while full E stays charged. No faster selected +nonleaf monomial tariff follows and the prior serial-column gate is intact. + +## 7. Evidence and remaining interface + +All nine tables are checked for alphabet, port/PC bounds, unit moves and +no early original DATA write. There are233 physical guard cases: ranks1..9, +f=1,2,3,5,16,65,129, cutoff immediately below/at/above rho*f when positive, +plus64/258/513/1025/4097-bit cutoff syntax at signed distinct origins. These +are header tests, not full large-f DATA runs. Every success restores all +guard private bytes/heads and preserves original header/exteriors. + +A complete f1,rho3 dense nonzero Gaussian packet spans all512 addresses. +The oracle applies the C formula directly to actual slot bits, without +simulating the emitted swaps. Exact output returns in13663028 steps, with +8206 HOME writes only after complete primitive return. All35 heads, private +bodies/guards/exteriors restore. An actually executed omitted-third-C graph +returns a different rank-two tensor answer. The legal-format cutoff f1,t2 +rejects in189419 steps with zero public writes; a weak old-f guard physically +accepts its header. An actually changed retained leaf byte fails source +authentication. Normal and optimized replay are required. + +This is a central primitive, not a complete MOVE. Surrounding arbitrary +affine translations, linear/quadratic/global phases, binary maps, exact +source/frame orientation, ownership, grid producers, nonleaf rates and +caller placement remain. No all-source MOVE family, recursive substitution, +owned lifetime or foundational assumption is discharged by this package. diff --git a/research/literal-fixed-rank-positive-native/implementation/README.md b/research/literal-fixed-rank-positive-native/implementation/README.md new file mode 100644 index 0000000000..98b3a96132 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/README.md @@ -0,0 +1,57 @@ +# Literal positive central join at each fixed native rank1..9 + +This package emits one complete fixed-tape positive central leaf for each +fixed rank rho=1..9 and arbitrary encoded column count f, in the existing +six-Gamma/HOME ABI. The actual joint guard is **rho*f<=cutoff**. Every leaf +and slot swap receives the original f and retains the complete9f geometry. +No width-changing view is supplied to a nine-slot numerical consumer. + +The central operator is positive C on all f bits of the first rho native +slots, with exact phase and unchanged quantum. One original-owner transaction +encloses rho first-slot C passes and6(rho-1) CNOTs implementing slot swaps. +All helpers, copying, descriptor scans, return and retirement are paid. +The core uses31 tapes; the supplied owned HOME layer uses35. For complete +bit lengths `V=2PSc2^(9f)w`, E and F=E+V, successful runtime satisfies + +`T_core<=2^24(fV+E+1)`, `K_final<=K_entry+2048(V+E+1)`. + +HOME adds128(F+1) time and64(F+1) backing. General B1 bank access, fixed +setup/program storage and caller creation/placement remain separate charges. +Every actual intermediate C prefix must be integral and fit the supplied +signed width; final fit alone is insufficient. No scale, width conversion +or rounding is installed. + +PR #6978 already proves the rank-times-column algebra, positive orientation, +cutoff and coded child; `selected-native-tensor-closure` proves the selected +all-column algebra. The contribution here is a literal uniform-rank +Gamma6/HOME numerical lifecycle export, extending the frozen literal rank2 +mechanism. It is a central primitive, not a complete generic MOVE. It does +not satisfy the faster nonleaf tariff, identify an actual caller, implement +all source monomials, or discharge a global assumption. See PROOF.md and +OVERLAP.md for the exact source/claim boundaries. + +Reproduce with the Python standard library, in about11 seconds per run: + +```sh +python -B /workspace/scratch/92c9920affc2/worker-a/research/generic-positive-native-join-gate/verify.py +python -O -B /workspace/scratch/92c9920affc2/worker-a/research/generic-positive-native-join-gate/verify.py +python -B /workspace/scratch/92c9920affc2/worker-a/research/generic-positive-native-join-gate/bind_sources.py --source-repo /workspace/scratch/92c9920affc2/repo +``` + +The checker authenticates immutable sources before retained imports, with +fresh bytecode-cache isolation. It checks all nine table families,233 literal +guard headers at signed distinct origins including4097-bit cutoff syntax, +and a complete nonzero f1/rho3 packet against direct actual-axis butterflies. +It verifies all35 heads/private bodies/exteriors, public safety on cutoff, +and an actually executed omitted-third-C graph. Large header cases do not +constitute full large-f numerical execution. `--write` refreshes RESULT.json. +The source-binding command checks21 retained pins,15 original Git blobs, +the canonical prior proof and all nine regenerated tables. SOURCE-BINDING.json +also pins the complete rank3 HOME graph by normalized JSON SHA256. + +Open next questions are the source-specific complete monomial/HOME join +(including affine offsets and nonzero global phases), actual typed source +binding/producer promises, endpoint format conversion where needed, and +separately the selected nonleaf rate. The fixed9-axis source census is being +reviewed independently; this package does not duplicate it or infer all-MOVE +coverage from its rank range. Earlier frozen packages are untouched. diff --git a/research/literal-fixed-rank-positive-native/implementation/RESULT.json b/research/literal-fixed-rank-positive-native/implementation/RESULT.json new file mode 100644 index 0000000000..e1ee257cc1 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/RESULT.json @@ -0,0 +1,1722 @@ +{ + "controls": [ + "joint cutoff versus weak f cutoff", + "actual omitted third C", + "actual retained source corruption", + "no early original-owner write" + ], + "core_tapes": 31, + "cutoff_rejection_steps": 189419, + "guard_cases": [ + { + "accepted": true, + "cutoff_bits": 1, + "f": 1, + "rank": 1, + "steps": 1244 + }, + { + "accepted": true, + "cutoff_bits": 2, + "f": 1, + "rank": 1, + "steps": 1274 + }, + { + "accepted": false, + "cutoff_bits": 1, + "f": 2, + "rank": 1, + "steps": 852 + }, + { + "accepted": true, + "cutoff_bits": 2, + "f": 2, + "rank": 1, + "steps": 1479 + }, + { + "accepted": true, + "cutoff_bits": 2, + "f": 2, + "rank": 1, + "steps": 1468 + }, + { + "accepted": false, + "cutoff_bits": 2, + "f": 3, + "rank": 1, + "steps": 924 + }, + { + "accepted": true, + "cutoff_bits": 2, + "f": 3, + "rank": 1, + "steps": 1503 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 3, + "rank": 1, + "steps": 1522 + }, + { + "accepted": false, + "cutoff_bits": 3, + "f": 5, + "rank": 1, + "steps": 1145 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 5, + "rank": 1, + "steps": 1792 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 5, + "rank": 1, + "steps": 1770 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 16, + "rank": 1, + "steps": 1858 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 16, + "rank": 1, + "steps": 2778 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 16, + "rank": 1, + "steps": 2767 + }, + { + "accepted": false, + "cutoff_bits": 7, + "f": 65, + "rank": 1, + "steps": 4473 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 65, + "rank": 1, + "steps": 5756 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 65, + "rank": 1, + "steps": 5734 + }, + { + "accepted": false, + "cutoff_bits": 8, + "f": 129, + "rank": 1, + "steps": 7608 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 129, + "rank": 1, + "steps": 9393 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 129, + "rank": 1, + "steps": 9371 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 1, + "steps": 4740 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 1, + "steps": 14246 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 1, + "steps": 26741 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 1, + "steps": 51829 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 1, + "steps": 202357 + }, + { + "accepted": false, + "cutoff_bits": 1, + "f": 1, + "rank": 2, + "steps": 760 + }, + { + "accepted": true, + "cutoff_bits": 2, + "f": 1, + "rank": 2, + "steps": 1370 + }, + { + "accepted": true, + "cutoff_bits": 2, + "f": 1, + "rank": 2, + "steps": 1359 + }, + { + "accepted": false, + "cutoff_bits": 2, + "f": 2, + "rank": 2, + "steps": 923 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 2, + "rank": 2, + "steps": 1605 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 2, + "rank": 2, + "steps": 1594 + }, + { + "accepted": false, + "cutoff_bits": 3, + "f": 3, + "rank": 2, + "steps": 1001 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 3, + "rank": 2, + "steps": 1629 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 3, + "rank": 2, + "steps": 1618 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 5, + "rank": 2, + "steps": 1222 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 5, + "rank": 2, + "steps": 1918 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 5, + "rank": 2, + "steps": 1907 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 16, + "rank": 2, + "steps": 1929 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 16, + "rank": 2, + "steps": 2904 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 16, + "rank": 2, + "steps": 2893 + }, + { + "accepted": false, + "cutoff_bits": 8, + "f": 65, + "rank": 2, + "steps": 4550 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 65, + "rank": 2, + "steps": 5882 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 65, + "rank": 2, + "steps": 5871 + }, + { + "accepted": false, + "cutoff_bits": 9, + "f": 129, + "rank": 2, + "steps": 7685 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 129, + "rank": 2, + "steps": 9519 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 129, + "rank": 2, + "steps": 9508 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 2, + "steps": 4806 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 2, + "steps": 14312 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 2, + "steps": 26807 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 2, + "steps": 51895 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 2, + "steps": 202423 + }, + { + "accepted": false, + "cutoff_bits": 2, + "f": 1, + "rank": 3, + "steps": 834 + }, + { + "accepted": true, + "cutoff_bits": 2, + "f": 1, + "rank": 3, + "steps": 1389 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 1, + "rank": 3, + "steps": 1408 + }, + { + "accepted": false, + "cutoff_bits": 3, + "f": 2, + "rank": 3, + "steps": 1003 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 2, + "rank": 3, + "steps": 1624 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 2, + "rank": 3, + "steps": 1613 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 3, + "rank": 3, + "steps": 1088 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 3, + "rank": 3, + "steps": 1755 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 3, + "rank": 3, + "steps": 1733 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 5, + "rank": 3, + "steps": 1246 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 5, + "rank": 3, + "steps": 1937 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 5, + "rank": 3, + "steps": 1934 + }, + { + "accepted": false, + "cutoff_bits": 6, + "f": 16, + "rank": 3, + "steps": 2027 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 16, + "rank": 3, + "steps": 2923 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 16, + "rank": 3, + "steps": 2912 + }, + { + "accepted": false, + "cutoff_bits": 8, + "f": 65, + "rank": 3, + "steps": 4574 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 65, + "rank": 3, + "steps": 5901 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 65, + "rank": 3, + "steps": 5868 + }, + { + "accepted": false, + "cutoff_bits": 9, + "f": 129, + "rank": 3, + "steps": 7709 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 129, + "rank": 3, + "steps": 9538 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 129, + "rank": 3, + "steps": 9505 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 3, + "steps": 4825 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 3, + "steps": 14331 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 3, + "steps": 26826 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 3, + "steps": 51914 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 3, + "steps": 202442 + }, + { + "accepted": false, + "cutoff_bits": 2, + "f": 1, + "rank": 4, + "steps": 831 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 1, + "rank": 4, + "steps": 1496 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 1, + "rank": 4, + "steps": 1485 + }, + { + "accepted": false, + "cutoff_bits": 3, + "f": 2, + "rank": 4, + "steps": 994 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 2, + "rank": 4, + "steps": 1731 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 2, + "rank": 4, + "steps": 1720 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 3, + "rank": 4, + "steps": 1078 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 3, + "rank": 4, + "steps": 1755 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 3, + "rank": 4, + "steps": 1744 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 5, + "rank": 4, + "steps": 1299 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 5, + "rank": 4, + "steps": 2044 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 5, + "rank": 4, + "steps": 2033 + }, + { + "accepted": false, + "cutoff_bits": 6, + "f": 16, + "rank": 4, + "steps": 2000 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 16, + "rank": 4, + "steps": 3030 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 16, + "rank": 4, + "steps": 3019 + }, + { + "accepted": false, + "cutoff_bits": 9, + "f": 65, + "rank": 4, + "steps": 4627 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 65, + "rank": 4, + "steps": 6008 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 65, + "rank": 4, + "steps": 5997 + }, + { + "accepted": false, + "cutoff_bits": 10, + "f": 129, + "rank": 4, + "steps": 7762 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 129, + "rank": 4, + "steps": 9645 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 129, + "rank": 4, + "steps": 9634 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 4, + "steps": 4872 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 4, + "steps": 14378 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 4, + "steps": 26873 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 4, + "steps": 51961 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 4, + "steps": 202489 + }, + { + "accepted": false, + "cutoff_bits": 3, + "f": 1, + "rank": 5, + "steps": 916 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 1, + "rank": 5, + "steps": 1515 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 1, + "rank": 5, + "steps": 1493 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 2, + "rank": 5, + "steps": 1085 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 2, + "rank": 5, + "steps": 1750 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 2, + "rank": 5, + "steps": 1739 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 3, + "rank": 5, + "steps": 1107 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 3, + "rank": 5, + "steps": 1774 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 5, + "steps": 1771 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 5, + "rank": 5, + "steps": 1328 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 5, + "rank": 5, + "steps": 2063 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 5, + "rank": 5, + "steps": 2041 + }, + { + "accepted": false, + "cutoff_bits": 7, + "f": 16, + "rank": 5, + "steps": 2109 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 16, + "rank": 5, + "steps": 3049 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 16, + "rank": 5, + "steps": 3038 + }, + { + "accepted": false, + "cutoff_bits": 9, + "f": 65, + "rank": 5, + "steps": 4656 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 65, + "rank": 5, + "steps": 6027 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 65, + "rank": 5, + "steps": 6005 + }, + { + "accepted": false, + "cutoff_bits": 10, + "f": 129, + "rank": 5, + "steps": 7791 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 129, + "rank": 5, + "steps": 9664 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 129, + "rank": 5, + "steps": 9642 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 5, + "steps": 4891 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 5, + "steps": 14397 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 5, + "steps": 26892 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 5, + "steps": 51980 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 5, + "steps": 202508 + }, + { + "accepted": false, + "cutoff_bits": 3, + "f": 1, + "rank": 6, + "steps": 911 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 1, + "rank": 6, + "steps": 1515 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 1, + "rank": 6, + "steps": 1504 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 2, + "rank": 6, + "steps": 1080 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 2, + "rank": 6, + "steps": 1750 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 2, + "rank": 6, + "steps": 1739 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 3, + "rank": 6, + "steps": 1165 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 6, + "steps": 1881 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 6, + "steps": 1870 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 5, + "rank": 6, + "steps": 1323 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 5, + "rank": 6, + "steps": 2063 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 5, + "rank": 6, + "steps": 2052 + }, + { + "accepted": false, + "cutoff_bits": 7, + "f": 16, + "rank": 6, + "steps": 2104 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 16, + "rank": 6, + "steps": 3049 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 16, + "rank": 6, + "steps": 3038 + }, + { + "accepted": false, + "cutoff_bits": 9, + "f": 65, + "rank": 6, + "steps": 4651 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 65, + "rank": 6, + "steps": 6027 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 65, + "rank": 6, + "steps": 6016 + }, + { + "accepted": false, + "cutoff_bits": 10, + "f": 129, + "rank": 6, + "steps": 7786 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 129, + "rank": 6, + "steps": 9664 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 129, + "rank": 6, + "steps": 9653 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 6, + "steps": 4891 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 6, + "steps": 14397 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 6, + "steps": 26892 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 6, + "steps": 51980 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 6, + "steps": 202508 + }, + { + "accepted": false, + "cutoff_bits": 3, + "f": 1, + "rank": 7, + "steps": 916 + }, + { + "accepted": true, + "cutoff_bits": 3, + "f": 1, + "rank": 7, + "steps": 1515 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 1, + "rank": 7, + "steps": 1523 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 2, + "rank": 7, + "steps": 1085 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 2, + "rank": 7, + "steps": 1750 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 2, + "rank": 7, + "steps": 1739 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 3, + "rank": 7, + "steps": 1170 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 7, + "steps": 1881 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 7, + "steps": 1859 + }, + { + "accepted": false, + "cutoff_bits": 6, + "f": 5, + "rank": 7, + "steps": 1391 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 5, + "rank": 7, + "steps": 2170 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 5, + "rank": 7, + "steps": 2137 + }, + { + "accepted": false, + "cutoff_bits": 7, + "f": 16, + "rank": 7, + "steps": 2109 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 16, + "rank": 7, + "steps": 3049 + }, + { + "accepted": true, + "cutoff_bits": 7, + "f": 16, + "rank": 7, + "steps": 3038 + }, + { + "accepted": false, + "cutoff_bits": 9, + "f": 65, + "rank": 7, + "steps": 4656 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 65, + "rank": 7, + "steps": 6027 + }, + { + "accepted": true, + "cutoff_bits": 9, + "f": 65, + "rank": 7, + "steps": 5983 + }, + { + "accepted": false, + "cutoff_bits": 10, + "f": 129, + "rank": 7, + "steps": 7791 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 129, + "rank": 7, + "steps": 9664 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 129, + "rank": 7, + "steps": 9620 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 7, + "steps": 4938 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 7, + "steps": 14444 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 7, + "steps": 26939 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 7, + "steps": 52027 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 7, + "steps": 202555 + }, + { + "accepted": false, + "cutoff_bits": 3, + "f": 1, + "rank": 8, + "steps": 902 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 1, + "rank": 8, + "steps": 1622 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 1, + "rank": 8, + "steps": 1611 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 2, + "rank": 8, + "steps": 1065 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 2, + "rank": 8, + "steps": 1857 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 2, + "rank": 8, + "steps": 1846 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 3, + "rank": 8, + "steps": 1155 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 8, + "steps": 1881 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 8, + "steps": 1870 + }, + { + "accepted": false, + "cutoff_bits": 6, + "f": 5, + "rank": 8, + "steps": 1376 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 5, + "rank": 8, + "steps": 2170 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 5, + "rank": 8, + "steps": 2159 + }, + { + "accepted": false, + "cutoff_bits": 7, + "f": 16, + "rank": 8, + "steps": 2071 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 16, + "rank": 8, + "steps": 3156 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 16, + "rank": 8, + "steps": 3145 + }, + { + "accepted": false, + "cutoff_bits": 10, + "f": 65, + "rank": 8, + "steps": 4704 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 65, + "rank": 8, + "steps": 6134 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 65, + "rank": 8, + "steps": 6123 + }, + { + "accepted": false, + "cutoff_bits": 11, + "f": 129, + "rank": 8, + "steps": 7839 + }, + { + "accepted": true, + "cutoff_bits": 11, + "f": 129, + "rank": 8, + "steps": 9771 + }, + { + "accepted": true, + "cutoff_bits": 11, + "f": 129, + "rank": 8, + "steps": 9760 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 8, + "steps": 4938 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 8, + "steps": 14444 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 8, + "steps": 26939 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 8, + "steps": 52027 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 8, + "steps": 202555 + }, + { + "accepted": false, + "cutoff_bits": 4, + "f": 1, + "rank": 9, + "steps": 998 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 1, + "rank": 9, + "steps": 1641 + }, + { + "accepted": true, + "cutoff_bits": 4, + "f": 1, + "rank": 9, + "steps": 1619 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 2, + "rank": 9, + "steps": 1167 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 2, + "rank": 9, + "steps": 1876 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 2, + "rank": 9, + "steps": 1865 + }, + { + "accepted": false, + "cutoff_bits": 5, + "f": 3, + "rank": 9, + "steps": 1189 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 9, + "steps": 1900 + }, + { + "accepted": true, + "cutoff_bits": 5, + "f": 3, + "rank": 9, + "steps": 1867 + }, + { + "accepted": false, + "cutoff_bits": 6, + "f": 5, + "rank": 9, + "steps": 1410 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 5, + "rank": 9, + "steps": 2189 + }, + { + "accepted": true, + "cutoff_bits": 6, + "f": 5, + "rank": 9, + "steps": 2167 + }, + { + "accepted": false, + "cutoff_bits": 8, + "f": 16, + "rank": 9, + "steps": 2191 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 16, + "rank": 9, + "steps": 3175 + }, + { + "accepted": true, + "cutoff_bits": 8, + "f": 16, + "rank": 9, + "steps": 3164 + }, + { + "accepted": false, + "cutoff_bits": 10, + "f": 65, + "rank": 9, + "steps": 4738 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 65, + "rank": 9, + "steps": 6153 + }, + { + "accepted": true, + "cutoff_bits": 10, + "f": 65, + "rank": 9, + "steps": 6131 + }, + { + "accepted": false, + "cutoff_bits": 11, + "f": 129, + "rank": 9, + "steps": 7873 + }, + { + "accepted": true, + "cutoff_bits": 11, + "f": 129, + "rank": 9, + "steps": 9790 + }, + { + "accepted": true, + "cutoff_bits": 11, + "f": 129, + "rank": 9, + "steps": 9768 + }, + { + "accepted": true, + "cutoff_bits": 64, + "f": 5, + "rank": 9, + "steps": 4957 + }, + { + "accepted": true, + "cutoff_bits": 258, + "f": 5, + "rank": 9, + "steps": 14463 + }, + { + "accepted": true, + "cutoff_bits": 513, + "f": 5, + "rank": 9, + "steps": 26958 + }, + { + "accepted": true, + "cutoff_bits": 1025, + "f": 5, + "rank": 9, + "steps": 52046 + }, + { + "accepted": true, + "cutoff_bits": 4097, + "f": 5, + "rank": 9, + "steps": 202574 + } + ], + "marker": "PASS_LITERAL_GENERIC_POSITIVE_HOME", + "omitted_child_steps": 12456520, + "rank_three": { + "E": 14, + "F": 8206, + "HOME_writes": 8206, + "V": 8192, + "core_return_steps": 13597300, + "output_sha256": "55bd574610defec258ca41ded3d8c7cc68ae3cd4b5bd144a1d9402d72e296b88", + "retained_old_guide_high": 24641, + "shape": [ + 1, + 1, + 1, + 1, + 8, + 3 + ], + "steps": 13663028, + "visited_increment": 110737 + }, + "scope": "fixed-rank positive central direct leaf only; no surrounding monomials/caller/nonleaf rate", + "tables": [ + { + "commit": 8191, + "locations": 8225, + "rank": 1, + "sha256": "538e1dc21b73c4e123d838bb0c01570db9811f5bc6963ff47a122d359e631da9" + }, + { + "commit": 25208, + "locations": 25242, + "rank": 2, + "sha256": "c4d8abeb423b1f094d813916331d1fd89a905536a24b9719d450296f1f1fcabb" + }, + { + "commit": 42225, + "locations": 42259, + "rank": 3, + "sha256": "7e6eed2526b464b330e2d7b8b1191505f8acbcbe286d4409ef98f4f52c391275" + }, + { + "commit": 59240, + "locations": 59274, + "rank": 4, + "sha256": "f99dbf917f6a1425fdbb578eeaae6aecd3f92d4487628309ecc1b7f493769921" + }, + { + "commit": 76257, + "locations": 76291, + "rank": 5, + "sha256": "477bebd1519f110e93d1f8c9f4c195d9148ba69690639c2144e3aae53b1b3c8b" + }, + { + "commit": 93272, + "locations": 93306, + "rank": 6, + "sha256": "562fea10655e71d195d17fc23bcff4d35b0ae43f817eccb4a13da06120b842dd" + }, + { + "commit": 110287, + "locations": 110321, + "rank": 7, + "sha256": "b86dbd635d8ad30b09ac3578f20f8b00fa463f94246b2ebe7b8ae729086f4618" + }, + { + "commit": 127302, + "locations": 127336, + "rank": 8, + "sha256": "48bc869765f4c115b06cb3e55c492f21261c83586efc894cb744bf0f9bd512be" + }, + { + "commit": 144319, + "locations": 144353, + "rank": 9, + "sha256": "ea01f37d6d43bf2e5266c0789a0049f15b041d339798b5d5036d1b9c51f55c0c" + } + ], + "tapes": 35 +} diff --git a/research/literal-fixed-rank-positive-native/implementation/SOURCE-BINDING.json b/research/literal-fixed-rank-positive-native/implementation/SOURCE-BINDING.json new file mode 100644 index 0000000000..39784ed133 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/SOURCE-BINDING.json @@ -0,0 +1,65 @@ +{ + "status": "PASS", + "retained_pins": 21, + "original_git_blobs": 15, + "canonical_prior_proof_checked": true, + "rank_three_HOME_states": 42436, + "rank_three_HOME_json_bytes": 2858241, + "rank_three_HOME_sha256": "5cb2c76e63c4ced7ab5500814e062e290272792b4631ad5da2e975fed014dc30", + "core_tables": [ + { + "commit": 8191, + "locations": 8225, + "rank": 1, + "sha256": "538e1dc21b73c4e123d838bb0c01570db9811f5bc6963ff47a122d359e631da9" + }, + { + "commit": 25208, + "locations": 25242, + "rank": 2, + "sha256": "c4d8abeb423b1f094d813916331d1fd89a905536a24b9719d450296f1f1fcabb" + }, + { + "commit": 42225, + "locations": 42259, + "rank": 3, + "sha256": "7e6eed2526b464b330e2d7b8b1191505f8acbcbe286d4409ef98f4f52c391275" + }, + { + "commit": 59240, + "locations": 59274, + "rank": 4, + "sha256": "f99dbf917f6a1425fdbb578eeaae6aecd3f92d4487628309ecc1b7f493769921" + }, + { + "commit": 76257, + "locations": 76291, + "rank": 5, + "sha256": "477bebd1519f110e93d1f8c9f4c195d9148ba69690639c2144e3aae53b1b3c8b" + }, + { + "commit": 93272, + "locations": 93306, + "rank": 6, + "sha256": "562fea10655e71d195d17fc23bcff4d35b0ae43f817eccb4a13da06120b842dd" + }, + { + "commit": 110287, + "locations": 110321, + "rank": 7, + "sha256": "b86dbd635d8ad30b09ac3578f20f8b00fa463f94246b2ebe7b8ae729086f4618" + }, + { + "commit": 127302, + "locations": 127336, + "rank": 8, + "sha256": "48bc869765f4c115b06cb3e55c492f21261c83586efc894cb744bf0f9bd512be" + }, + { + "commit": 144319, + "locations": 144353, + "rank": 9, + "sha256": "ea01f37d6d43bf2e5266c0789a0049f15b041d339798b5d5036d1b9c51f55c0c" + } + ] +} diff --git a/research/literal-fixed-rank-positive-native/implementation/SOURCES.json b/research/literal-fixed-rank-positive-native/implementation/SOURCES.json new file mode 100644 index 0000000000..0cf874beeb --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/SOURCES.json @@ -0,0 +1,143 @@ +{ + "canonical_main": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "local": "reference/rank2/rank2.py", + "bytes": 8253, + "sha256": "3ca027f80b6cb973fa064612b8fb18b1306498e064a01e97ff7f9b6aa40b301a", + "parent_local": "rank2.py" + }, + { + "local": "reference/rank2/SOURCES.json", + "bytes": 10337, + "sha256": "659ff7da20d16ece71aabbe240986e884fcaa6f53b5b0f082151e541e0534641", + "parent_local": "SOURCES.json" + }, + { + "local": "reference/rank2/RECIPE.json", + "bytes": 4468, + "sha256": "b1386ad613213a01f736bc2e7fc7de5a25d2c700c3d577dfb396a266278ae702", + "parent_local": "RECIPE.json" + }, + { + "local": "reference/rank2/reference/linear/linear.py", + "bytes": 13102, + "sha256": "d56704082b82e37d4a360b8aad7e0af63499f4160c6bbcfd338804453c46fa33", + "parent_local": "reference/linear/linear.py" + }, + { + "local": "reference/rank2/reference/linear/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73", + "parent_local": "reference/linear/inputs/controller_reference.py" + }, + { + "local": "reference/rank2/reference/linear/NOTICE.md", + "bytes": 2180, + "sha256": "2ac2051c0fbedfd9d11348493456bf479dbdd3104a4e106c8bf36251a72b6a50", + "parent_local": "reference/linear/NOTICE.md" + }, + { + "local": "reference/rank2/reference/phase/phase.py", + "bytes": 11734, + "sha256": "2be149aa1be504509bb480f85396f0be302082d638e81422f747daee5a3c1ce7", + "parent_local": "reference/phase/phase.py" + }, + { + "local": "reference/rank2/reference/phase/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73", + "parent_local": "reference/phase/inputs/controller_reference.py" + }, + { + "local": "reference/rank2/reference/phase/NOTICE", + "bytes": 808, + "sha256": "5654eeb7fdc1acd6a6d246ef87b1155812efdcd0949f54be78e048fe905fbae0", + "parent_local": "reference/phase/NOTICE" + }, + { + "local": "reference/rank2/reference/leaf/leaf.py", + "bytes": 17526, + "sha256": "bb46c1a55f1119957a52cd61f2cd957f3f7ad1e9b818c54a852bde09a0773744", + "parent_local": "reference/leaf/leaf.py" + }, + { + "local": "reference/rank2/reference/leaf/inputs/controller_reference.py", + "bytes": 5938, + "sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73", + "parent_local": "reference/leaf/inputs/controller_reference.py" + }, + { + "local": "reference/rank2/reference/leaf/NOTICE.md", + "bytes": 1900, + "sha256": "773921ac301cf7e37de97ed8a0066e6bbb69ec1150cc2b5f74a12cb20103f3cf", + "parent_local": "reference/leaf/NOTICE.md" + }, + { + "local": "reference/rank2/reference/source/clifford_exact.py", + "bytes": 6824, + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962", + "parent_local": "reference/source/clifford_exact.py" + }, + { + "local": "reference/rank2/reference/source/native_verify.py", + "bytes": 12323, + "sha256": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38", + "parent_local": "reference/source/native_verify.py" + }, + { + "local": "reference/rank2/reference/home/tape_graph.py", + "bytes": 12069, + "sha256": "7d3cee3e79ba5fe410e1a6b5f4cf6a2fbe5e274f838b798cd8860344ff258b54", + "parent_local": "reference/home/tape_graph.py" + }, + { + "local": "reference/rank2/machine.py", + "bytes": 6041, + "sha256": "ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee", + "parent_local": "machine.py" + }, + { + "local": "reference/rank2/reference/home/parent_adapter.py", + "bytes": 5353, + "sha256": "04462e141548c6a86c500d40b4aee8c446c539bd9269098d7516fa13400ef099", + "parent_local": "reference/home/parent_adapter.py" + }, + { + "local": "reference/rank2/reference/home/NOTICE.md", + "bytes": 2093, + "sha256": "b51b8fd0773a1bbe988c8a98d951dc34b175bf56bac772ef65997f1df7ed3842", + "parent_local": "reference/home/NOTICE.md" + }, + { + "local": "machine.py", + "bytes": 6041, + "sha256": "ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee", + "parent_local": "machine.py" + }, + { + "local": "reference/rank2/PROOF.md", + "bytes": 16634, + "sha256": "93e1ad8a92c3624df064e4f39119ccbb5c96391ea8dd5f7af58edc7ca9638352", + "parent_local": "PROOF.md", + "role": "frozen parent proof/manifest" + }, + { + "local": "reference/rank2/FREEZE.json", + "bytes": 5633, + "sha256": "072dfea997d4db796d492eaf746e0bd99630964741b88862d0f10f5fc1e00275", + "parent_local": "FREEZE.json", + "role": "frozen parent proof/manifest" + } + ], + "prior_proof": { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "path": "research/current-coded-all-source-leaf/PROOF.md", + "blob": "5d619cfc2d3b7bc51e6fcc8e7a46ecd1e313e23d", + "sha256": "2943afc32745929374e8e55daff82b5fa78baa8a557d82b231d04b936c63c10d", + "local": "reference/pr6978-PROOF.md" + }, + "pr6978_head": "12e58dfdad9371a26f9978c814779da344fd80b4", + "parent_rank2_freeze_sha256": "072dfea997d4db796d492eaf746e0bd99630964741b88862d0f10f5fc1e00275" +} diff --git a/research/literal-fixed-rank-positive-native/implementation/adapter.py b/research/literal-fixed-rank-positive-native/implementation/adapter.py new file mode 100644 index 0000000000..8c1f0bed31 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/adapter.py @@ -0,0 +1,117 @@ +"""Paid Gamma6/HOME adapter for fixed-rank positive central join. + +Derived from the frozen rank2 adapter; Apache-2.0; Codex-assisted. +""" +from functools import cache +from hashlib import sha256 +import importlib.util +from pathlib import Path +import sys +import json + +HERE=Path(__file__).resolve().parent +sys.dont_write_bytecode=True +sys.pycache_prefix=str(HERE/'_unwritten_bytecode_cache') +if Path(sys.pycache_prefix).exists(): + raise ValueError('bytecode isolation path must remain absent') +import join as C +B1=HERE/'reference/rank2/reference/home/tape_graph.py' +D=C.load('positive_home_dispatch', B1) +CORE_BASE,GUIDE,TAPES=3,34,35 + + +@cache +def core(rank,mutation=None): + code,alphabet,_=C.compile_join(rank,mutation) + if alphabet!=('_','0','1','|'): + raise ValueError('changed fixed alphabet') + return code + + +def steps(g,tape,count,target): + for _ in range(abs(count)): + target=g.jump(target,((tape,1 if count>0 else -1),)) + return target + + +def copy_out(g,source,target,after): + state=g.state('repack') + g.add(state,after,tests=((source,'_'),)) + for bit in '01': + g.add(state,state,tests=((source,bit),),writes=((target,bit),(source,'_')), + moves=((source,1),(target,1))) + return state + + +def embed(g,code,after,rank): + labels=[g.state('POSITIVE_R'+str(rank)) for _ in code] + for pc,(op,*args) in enumerate(code): + state=labels[pc];g.rules.setdefault(state,[]) + nxt=labels[pc+1] if pc+1budget:raise ValueError('finite execution budget') + return state + + def _general(self,state,rules): + tapes=state.tapes;heads=state.heads;lows=state.lows;highs=state.highs;writes=state.writes + found=None + for rule in rules: + if all(tapes[t][heads[t]]==symbol for t,symbol in rule[0]): + if found is not None:raise ValueError('nondeterministic emitted table') + found=rule + if found is None:raise Rejected('literal scanned-symbol rejection') + for t,value in found[1]: + if heads[t]==state.origins[t] and value!=SYMBOLS['^']: + raise MonitorViolation('attempted permanent B origin marker overwrite') + tapes[t][heads[t]]=value;writes[t]+=1 + for t,delta in found[2]: + if delta not in (-1,0,1):raise ValueError('nonunit emitted move') + heads[t]+=delta + if not 0<=heads[t] 0, 0<=rho=1 complex coefficients on one common quantum, with +h>=2 signed least-significant-first component bits and a delimiter after each +component. Each virtual symbol has the unchanged three-bit physical code: + + b=record_bits=6c(h+1), row_bits=2^a b, V=C_rows*2^a b. + +The complete V-bit public body and its frontier are preserved in format. +Signed width, coefficient order, quantum, row/outer labels and all spectator +coordinates stay fixed. Exact arithmetic and signed-prefix conditions are +retained below. + +For a fixed authenticated rank 1<=r<=8, construct a separate raw-binary view +that changes exactly + + child.f = r * parent.f. + +Every other one of the 22 values, including cutoff, stays unchanged. The +parent's complete bytes remain read-only and are returned to their origin. +This is a **LEAF-specific descriptor**. Its f has a different purpose from +the parent's native block count; it need not satisfy `(child.f-1)G<=H` or +`selected_axes=9*child.f+remainder`. No monomial, ordinary supplier, recursive +caller or general native adapter receives this view. Both monomials receive +the unchanged parent descriptor. + +The old positive leaf requires only positive outer,rows,f,K,cutoff, the +current record/row consistency, rho = i^p (-1)^(z dot a) |a xor x>. + +The checker independently propagates all 18 X_j/Z_j generators through both +circuits. An invertible binary permutation G sends (x,z,p) to +(Gx,G^(-T)z,p); translation b adds 2(z dot b) to p. For a diagonal phase +q(a)=sum alpha_j a_j+2 sum_(jj)Q_jk*x_k over GF(2). +For positive or negative C on mask v, a commuting Pauli stays fixed; an +anticommuting one has x replaced by x xor v and p increased by 3*sign modulo +four. These follow directly from the displayed normalized C matrix and +Pauli multiplication. A global i-phase cancels in conjugation. + +All primitive operators are unitary: permutations/translations are bijective, +diagonal entries have modulus one, and C^*C=I by its two exact coefficients. +The independent Gaussian elimination checks each needed binary inverse. + +**Separating-column lemma.** If two unitary matrices U,V have identical +conjugations of every X_j and Z_j, then U^*V commutes with these generators. +Commutation with every Z_j makes it diagonal in the computational basis; +commutation with every X_j makes all diagonal entries equal. Hence U^*V is +a scalar multiple of identity. Equality on one nonzero column fixes that +scalar to one. This proves equality on all 512 columns. + +The checker additionally evaluates the complete zero-input column of both +circuits using exact Gaussian integers and a power-of-two denominator. It +checks exact unit normalization, strips common factors of two, and compares +all 512 positions. Thus global phase is fixed, not identified projectively. +Across the complete family this gives 51,948 Pauli images and 1,477,632 +separating-column positions. Source-rank equality is independently checked +from the X parts of the images of Z generators. + +Two controls distinguish the lemma's premises. Changing the entrance's +constant phase preserves every Pauli image but changes the separating column. +Precomposing with input Z_0 preserves the zero-input column but changes a +Pauli image. A wrong middle rank is rejected too. Typed owner/rank/token +controls reject false source bindings. This is a finite exact check of the +fixed selected source family; the arbitrary-f conclusion follows from the +preceding coordinate/tensor argument and provider contracts. + +## 5. Literal metadata program, complete cost and historical backing + +The unchanged row Builder operates on physical alphabet 0/1, LEFT=2 and +BLANK=6. The descriptor is not a numeric CodedPort: its bits are already +physical bits. Roles 0..39 are fixed, with borrowed parent role 13, private +view role 14, and 38 other private roles. PREPARE consists only of local +read/write/unit-move, fixed goto and terminal states. Source authentication, +table construction and fixed cohort allocation are setup obligations, not +runtime shape oracles. There is no runtime conversion of f or E into host +integers and no input-dependent table expansion. + +After boundary/blank checks and canonical decoding of all 23 fields, +PREPARE multiplies the positive f body by the authenticated fixed r. Its +carry lies in 0..r-1. On input digit x and carry c it writes +`(r*x+c) mod 2` and changes c to `floor((r*x+c)/2)`. Induction on the +processed low digits proves the product; at most three fixed tail digits +remain for r<=8. The product is copied back to the f role and its scratch +is cleared. Canonical encoding then emits all 23 fields, after which every +decoded field is cleared. Only the view remains live at the returned origin. +These invariants prove correctness at every finite input bit length. + +Let n be the original f digit length, n' the product length, L the sum of +the 23 input lengths, and L' the output sum. Positivity gives + + n <= n' <= n+3, L' <= L+3, + E=2L+23, E'=2L'+23 <= E+6. + +The following conservative local-instruction bounds are inherited from the +literal Builder expansion proved in the published header-view package: + +| Primitive from stated origin/frontier | Instruction ceiling | +|---|---:| +| Rewind from n-digit frontier | 3n+5 | +| Rewind from origin | 5 | +| Clear n-digit body from origin | 7n+11 | +| Canonical check and origin return | 20n+20 | +| Copy n digits to blank role, return both origins | 11n+12 | +| Multiply positive n-digit body by fixed r<=8 | 31n+53 | +| Decode all 23 fields, return parent and retire guide | 27E+1064 | +| Encode all 23 fields of total physical length E' | 21E'+788 | + +The multiplication ceiling for fixed nine bounds our smaller carry/tail +graph as well. There are 159 initial boundary/blank-check instructions. +Adding decoding, the extra f check, multiplication, old-f clear, product +copy, product clear, encoding, all 23 final field clears and done gives + + 159+(27E+1064)+(20n+20)+(31n+53)+(7n+11) + +(11n'+12)+(7n'+11)+(21E'+788)+(7L'+253)+1 + <= 90E+2000. + +The numeric borrower returns the view head at origin. RELEASE clears all +39 roles and restores the parent, costing at most `7E'+435 <= 7E+477`. +The deliberately loose registered bound is therefore + + T_view <= 1000E+10000. + +Every counted physical read, write and unit move is an instruction; fixed +gotos are also included in the ceiling. This is a physical scan bound, +not a unit-price whole-header operation. Prepare graphs have 2607, 2619, +2633, 2647, 2663, 2679, 2695 and 2711 rows for ranks one through eight; +the shared release graph has 475 rows. + +During preparation all bodies are contiguous canonical digit prefixes and +the length guide. RELEASE erases the current live prefixes; it does not +search an old high-water mark. No interruption or foreign corrupted alphabet +is covered. The valid-format f=0 rejection is separately tested and safely +retired by the same mechanism. Successful numeric calls and named valid +numeric rejections return the view at its origin before RELEASE. + +At the numeric boundary this bank has just E' live view bits. A conservative +fresh-call peak is 5E+80 private body/frontier cells, plus supplied origins. +Across calls with M=max E, each of the 39 fixed roles visits at most 2M+1 +body/frontier cells. The retained bound is its supplied prefix backing plus +39(2M+1) and fixed program/setup storage. Different roles can reach their +maxima on different calls; the largest simultaneous live body does not bound +the retained backing. The original E-bit parent, numeric field and every +numeric work cohort remain separate charges. The sparse header checker +records all visited addresses, including reads and moves over blank cells. + +## 6. Whole invoices and relative MOVE contract + +Let F include fixed source authentication, catalog/record binding, finite +table construction and the charged creation of the fixed work banks. Let +T_C(V,h,w,E') be the complete unchanged positive-leaf bound, including +full-field ingress/egress, actual arithmetic, descriptor control, retirement +and source-specific fixed costs. The new positive child has + + T_child <= F + T_C(V,h,r*f,E') + 1000E+10000, + Q_child = 39+349 = 388 fixed private ports. + +The predecessor gives `T_C=O(w*V+(E'+1)^4+349)` on its admitted direct-leaf +domain, so this is `F+O(r*f*V+(E+1)^4+388)`. All transitive program constants +remain those of the actual source programs; this package does not extract a +new numerical all-input ceiling. In particular, it does not replace this +direct cost by an accelerated native tariff. There are no ordinary supplier +invocations in the standalone positive child. + +For the generic protected MOVE, let T_R and T_L be the complete right and +left monomial bills under the original parent descriptor, and let Q_R,Q_L +be their actual factory-dependent fixed port counts. The successful invoice +is + + F + T_R + T_C + T_L + T_view + 22V+35, + Q_MOVE = 1+Q_R+388+Q_L. + +For the documented q2/capacity64 ordinary factories the last expression is +4145, but it is not a universal constant across other factories. A named +valid returned failure replaces the administrative term by 13V+21 and +includes every executed provider action, failed scan and view cleanup. +These formulas include the original protected full-field stage. Child-local +rollback alone would not protect the original input after a successful +entrance; the whole-occurrence stage is essential. + +Space adds the stage body and its history, the new 39-role header bank, the +complete leaf and both complete monomial cohorts, the borrowed parent and +original field, caller ancestors, and fixed source/program storage. It sums +rolewise historical maxima even when cohorts have already been erased. The +monomial ordinary providers, their construction/cleanup, long-record access, +source placement and all inherited source-to-machine premises remain in this +relative MOVE theorem. The wrapper does not establish these services. + +## 7. Evidence, limitations and open questions + +The new source-family proof is finite and exact for the frozen selected +source, with no omitted charts. Its extension to all native column counts, +rows and spectators is the coordinate/tensor proof above, conditional on +the stated provider contracts and valid descriptor. It is not an inference +from random tests or a new proof of a general Clifford compiler. + +The physical header checker covers every rank one through eight, f in +{1,2,3,5,17}, a 1024-bit unused field, a separately labelled 257-bit f syntax +case, and long-then-short reuse. It checks every output byte and all 23 values, +parent preservation, translated ancestor prefixes, all visited private cells, +origin return and the instruction ceiling. Invalid rank, f=0 and unscaled-f +mutation controls reject. The large-f syntax case is not represented as an +admitted numerical parent. + +Completed full-packet numerical traces use every 4096 record in a valid +nine-coordinate parent with mandatory reservation bits and arbitrary tested +spectator patterns. Rank two and rank eight positive children return exact +independent Gaussian-character answers. The rank-two cutoff control has +parent f=1<=cutoff=1 but child width 2>1 and rejects. A final-pair parity +control also rejects, preserving the entire input and returning all headers +and work. The rank-eight fixture distinguishes individual axes by spectator +characters; it is not just a net phase-cancellation example. Numerical +primitive hardware is independently cross-checked against the unchanged +definitions; those finite checks alone are regression evidence, not a new +implementation theorem. + +These are complete child executions, not complete generic three-factor +MOVE executions. The predecessor's entrance/leaf-only partial evidence and +exit/whole timeouts remain labelled in that published package. This package +does not reclassify them or claim an uninterrupted full MOVE trace. + +The array hardware's role extents measure materialized backing, not every +visited blank address. Its saved receipts retain that label. A conservative +visited bound adds supplied initial regions and origins to the literal action +count: each unit move exposes at most one further address. The separate +source asymptotic space proof, and the sparse header tracker's actual visited +measure, are not inferred from those array extents. + +The immediate remaining obligations are: + +1. Join this rank-scaled positive child to a verified all-column monomial + construction with no ordinary numerical supplier premise, keeping the + complete cost and intermediate signed-phase domain. Serializing columns + can create a signed overflow that a cancelling batched phase avoids. +2. Bind actual enclosing caller placement, typed nested occurrences and + produced parent headers. A raw PAID/MOVE token is not a substituted + `source_ir.product` fragment. +3. Flatten the complete numeric adapters and protected control into literal + lifecycle tables with an independent equivalence proof. +4. Establish nonleaf supplier rates and global precision/stock/analytic + obligations for the full selected multiplication recurrence. + +This reduces one current `native_all_columns`/`precision_tape` interface to +an explicit direct-leaf construction. It discharges neither foundational +assumption in full. The selected multiplication bound remains conditional, +and there is no new kappa. diff --git a/research/literal-fixed-rank-positive-native/implementation/reference/rank2/FREEZE.json b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/FREEZE.json new file mode 100644 index 0000000000..f8b32e2611 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/FREEZE.json @@ -0,0 +1,179 @@ +{ + "schema": "literal-owned-rank2-freeze/1", + "canonical_main": "e54523517d0f03e58352e647c403a5af3e525a57", + "status": "author-frozen for independent review; no new scientific scope", + "core_graph": "6f440702d6d0b2428df1016f8006ae339699e8b9fe1cf9fe5dc0d2c111821adf", + "HOME_graph": "f2f957292847995587c2c269a19a72876e7f74a52f26b07f807eb50f09816e5f", + "files": [ + { + "path": "CHECKPOINT.md", + "bytes": 891, + "sha256": "096e7a8a1551ae6b9887ab5010a8f4026b6de78d97322c00a5380a0c9a72349c" + }, + { + "path": "ENVIRONMENT.json", + "bytes": 353, + "sha256": "41bebc6ecaf5e64b7d1075c62c30fead6efbd24e930933efa5095ad60554b660" + }, + { + "path": "GRAPH.json", + "bytes": 552, + "sha256": "d5b676671717a930bbc5796904e424f40a3aabbcaeebb61d84cdab6b4d30bd53" + }, + { + "path": "NOTICE.md", + "bytes": 3215, + "sha256": "8e4464c37453cede80b45ca5735a1aab22acd15d8796a78ba48713cc4717313a" + }, + { + "path": "OVERLAP.md", + "bytes": 2767, + "sha256": "43aeda8f27c34eafc18b2c93b25a8128eefed7cf7b152dd13eaf925a7cc8ac34" + }, + { + "path": "PR-DESCRIPTION.md", + "bytes": 4206, + "sha256": "be862b0e585a1d74bb70369489358b21a0ec3ca06946977b839401a3bc6cef8b" + }, + { + "path": "PR-TITLE.txt", + "bytes": 73, + "sha256": "43e1c0e57941afc23d29d877488440eccfee1b4ec8a0c908ade46361543957a3" + }, + { + "path": "PROOF.md", + "bytes": 16634, + "sha256": "93e1ad8a92c3624df064e4f39119ccbb5c96391ea8dd5f7af58edc7ca9638352" + }, + { + "path": "README.md", + "bytes": 5822, + "sha256": "90d9ed2f26ade3fed562f7b930fd60fe56b75cef1b43cb2a24a0e99a52150210" + }, + { + "path": "RECIPE.json", + "bytes": 4468, + "sha256": "b1386ad613213a01f736bc2e7fc7de5a25d2c700c3d577dfb396a266278ae702" + }, + { + "path": "REMOTE-BINDINGS.json", + "bytes": 967, + "sha256": "c3b16896601fc024e832ed7abb3266e16de170ed72a93f702a1a5e98e0f24694" + }, + { + "path": "RESULT.json", + "bytes": 5098, + "sha256": "1673bf5ca1d1d46762a67085e5dfc1d72d5e31a211bc2f56f8946efc6b07f127" + }, + { + "path": "SOURCE-BINDING.json", + "bytes": 515, + "sha256": "6eb220b27c95f6d104e1b51dfd79314905cb6dc84a81ca8d115b709d9416a945" + }, + { + "path": "SOURCES.json", + "bytes": 10337, + "sha256": "659ff7da20d16ece71aabbe240986e884fcaa6f53b5b0f082151e541e0534641" + }, + { + "path": "adapter.py", + "bytes": 5777, + "sha256": "b0d60256c88ce106d3463a5f5b3cc6f7d1d11d3fad8f0fcb332bfcca3cdb1dcc" + }, + { + "path": "bind_source.py", + "bytes": 5125, + "sha256": "b4feddf21f9c693d8537218ed28c073d7a5d18e7d0cd9d35b0d9333e3386e76a" + }, + { + "path": "machine.py", + "bytes": 6041, + "sha256": "ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee" + }, + { + "path": "oracle.py", + "bytes": 2460, + "sha256": "93c7964163fe0b9f7977703a78a456e81117d9d3f63e64ce213407a963c7b6ff" + }, + { + "path": "rank2.py", + "bytes": 8253, + "sha256": "3ca027f80b6cb973fa064612b8fb18b1306498e064a01e97ff7f9b6aa40b301a" + }, + { + "path": "reference/home/NOTICE.md", + "bytes": 2093, + "sha256": "b51b8fd0773a1bbe988c8a98d951dc34b175bf56bac772ef65997f1df7ed3842" + }, + { + "path": "reference/home/parent_adapter.py", + "bytes": 5353, + "sha256": "04462e141548c6a86c500d40b4aee8c446c539bd9269098d7516fa13400ef099" + }, + { + "path": "reference/home/tape_graph.py", + "bytes": 12069, + "sha256": "7d3cee3e79ba5fe410e1a6b5f4cf6a2fbe5e274f838b798cd8860344ff258b54" + }, + { + "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": "verify.py", + "bytes": 12019, + "sha256": "c023806283adf2e1aec156b6a909a7620a0a6db70898baa0b3926a1f90a7cf83" + } + ] +} diff --git a/research/literal-fixed-rank-positive-native/implementation/reference/rank2/PROOF.md b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/PROOF.md new file mode 100644 index 0000000000..627e54e031 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/PROOF.md @@ -0,0 +1,316 @@ +# Actual owned rank-two MOVE28141 on the complete Gamma6/HOME boundary + +## 1. Source, orientation and quantified statement + +Canonical main is e54523517d0f03e58352e647c403a5af3e525a57. The actual +selected #7000 record at zero-based index28141 is +`[MOVE,1526,601,470,true]`. Its complete frames are `[137]` and +`[75,137,265]` in nine coordinates. The Boolean marks owned/private +storage. The operator is determined by the ordered frame pair: + +`U=T_470 T_601^*`, `U=L (C_0 C_1) R`. + +Here `C=(1/2)[[1+i,1-i],[1-i,1+i]]` is positive. The rank is two. +No inverse orientation is inferred from the Boolean. The retained owned +recipe has the same pair but old role1421/event19592; these are not the +current event/owner. `bind_source.py --source-repo` authenticates the whole +350722-byte archive and canonical word, extracts current28141, reconstructs +the lowering and checks full signed Pauli action and exact Gaussian phase. +The independent engine's separating-column argument determines the entire +512-column operator. All1024 columns of the two binary maps are also checked. + +Supply positive f,r,P,S,cutoff and w>=2, the exact six positive canonical +Gamma codes `(f,r,P,S,w,cutoff)`, and the complete lexicographic packed array + +`[P] x [2^f]^9 x [S]`, `V=2PSr2^(9f)w`, `F=E+V`. + +E counts every header bit, including a potentially enormous cutoff code. +At each address there are r Gaussian coefficients, real then imaginary, +each signed w-bit MSB-first. Their common caller quantum Delta is unchanged. +r is coefficient multiplicity. The native rank two changes neither r nor +the nine f-bit slots. The direct entry condition is **2f<=cutoff**. + +Require the right and left phase rotations to fit signed w bits, and every +output of each of the actual2f central C axes to be Gaussian-integral on +the same grid and fit signed w bits. Final fit alone does not supply these +prefix conditions. All complete spectators and coefficient fields remain. +The native local boundary supplies distinct owners, heads at their origins, +blank required private windows/guards and preserved opaque exteriors, as in +the retained factors. Existing historical backing remains charged. + +**Theorem.** One fixed115776-location,31-tape four-symbol local program +returns `U^(tensor f)` on the original DATA owner, restores HEADER, all heads, +private bodies/guards and opaque exteriors, under these promises. It checks +2f against the actual cutoff. A valid-format cutoff or numerical rejection +precedes every original DATA write; failure cleanup/retry is unclaimed. +Its complete successful direct bounds are + +`T_core<=2^24(fV+E+1)`, +`K_final<=K_entry+1024(V+E+1)`. + +The supplied packed HOME adapter emits115953 states on35 fixed tapes. It +returns the identical Gamma6 header and transformed DATA to the same owned +HOME1526, with + +`T_HOME<=128(F+1)+2^24(fV+E+1)`, +`K_final<=K_entry+1088(F+1)`. + +B1's general full-bank gathering/return is separately charged at its +`O(R K(F+1))` invoice. The test graph uses an already-reserved typed owned +entry. It constructs neither INIT1526 nor a complete enclosing caller. + +## 2. Exact nontrivial factors and all-column geometry + +The complete matrices, alpha/Q fields and80 retained records are in +RECIPE.json. In the source convention a monomial sends +`|x> -> i^q(x) |Gx>`; both offsets and constant phases are zero. The rows are + +``` +G_R=(258,11,321,66,4,328,16,32,128), +G_L=(6,11,16,34,64,128,3,256,1). +``` + +Its right phase is + +`q_R=x0+2x1+x3+2x6` +` +2(x0x1+x0x3+x0x6+x0x8+x1x3+x1x6+x1x8+x3x6+x3x8) mod4`. + +Its left phase is `q_L=2x0+3x1 mod4`. Q's diagonal is already encoded in +alpha and is not added twice. The left36 records consist of five S records +and31 CNOTs. The right44 consist of six S, nine CZ and29 CNOTs. The literal +phase compiler handles each complete phase in one body pass, retaining the +actual simultaneous residue and signed range guards. It does not serially +negate an intermediate component just to realize that record list. + +For columns x_j the phase is `sum_j q(x_j)` (the constant term is zero). +Each binary row addition acts on the matching bit j in its two complete +f-bit slots. The retained CNOT routine derives every prefix/middle/suffix +length from the original header and executes all f columns. Fixed word +order is preserved. The generic fixed-word emitter in rank2.py changes +only which fixed source CNOTs call that unchanged routine. Its proof applies +to any distinct fixed slot pair in0..8; no runtime matrix loader is used. + +Let S01 exchange slots0 and1 through the fixed CNOT word +`(0<-0 xor1),(1<-1 xor0),(0<-0 xor1)`. It is an exact permutation with no +phase. The chronological factor list is + +| Order | Literal component | +|---:|---| +|1|Rank-aware entry guard, original header retained| +|2|Right complete phase| +|3|Right29-CNOT binary map| +|4|Unchanged positive first-slot C leaf on all f axes| +|5|S01, three CNOTs on every column| +|6|Unchanged positive first-slot C leaf again| +|7|S01 again| +|8|Left complete phase| +|9|Left31-CNOT binary map| + +Because S01 C0 S01=C1 and the two disjoint C blocks commute, the central +time sequence C0,S01,C0,S01 is exactly `C0 C1`. This retains all9f address +bits and implements the desired positive `C^(tensor2f)` on the first two +slots. Setting the existing leaf header's f to2f would instead change its +hard-coded nine-slot volume to2^(18f); that is not this construction. + +The independent source engine checks the exact interleaved central circuit, +including its phase, against C0 C1. Tensoring this fixed product proves the +all-f result, including arbitrary full spectators and r coefficients. No +tensor power is distributed over a sum or scalar ADD. + +## 3. Literal rank-aware entry and complete transaction + +The new guard uses the retained Gamma/unary/binary comparison routines on +their same29 ports. It decodes f and captures its canonical binary digits +and length. It appends one physical zero to the captured binary word and +one mark to its length. These are exactly the digits/length of2f. The +original unary F guide and public header are unchanged. It decodes the other +four bounded integers, reads cutoff only in binary, compares length then +lexicographic digits, and returns/clears its complete work. It never loops +over the numerical cutoff. Thus f<=cutoff<2f rejects even though both +unchanged single-slot leaves would individually accept. + +The whole core clones original DATA once onto WORK and uses TRACE to return +the original head. Every factor's public DATA port is WORK, its HEADER port +is original HEADER, and private port t>=2 maps to t+2. WORK and TRACE are +distinct from all reused module-private owners. The maximum module port28 +maps to30, so ports0..30 suffice. Each retained instruction's port and PC +are relocated; its successful halt is a one-step goto continuation. No +runtime callback, scalar oracle, size-specialized table or free return +implements a component. + +Every completed factor returns all its heads and clears its private work. +Consequently the same27 module-private tapes can be reused by the next +factor. An intermediate public commit of a retained module changes only +WORK. The original DATA receives no write until all nine components have +returned. The single final V-bit copy installs the complete result on the +same original owner, records its return trace, erases WORK and disposes +WORK/TRACE guards. No owner is replaced, relabelled or given productive credit. + +Rejection may leave private data/heads dirty. The core has no original-DATA +WRITE before its final commit location115742. The HOME adapter similarly +keeps all core activity private and scatters only after complete successful +return. This proves original public preservation on the stated finite +cutoff/numerical failures, including failure in the second C pass after a +completed first C and swap. It does not prove interruption rollback or retry. + +## 4. Exact numerical domain and sufficient reserve + +The retained leaf uses actual w+2-bit signed temporary numerators and exact +parity/range guards. Its four real rows have three plus signs and one minus, +so their actual values lie within the proved w+2 range for signed w-bit +inputs. Each retained phase rejects a requested negation of the unique +most-negative component. Copying or swapping that component without +negation is permitted. These concrete conditions, not an abstract fused +Gaussian primitive, are the numerical premises in section1. + +A useful sufficient caller condition is: all original components are +divisible by2^f, bounded in absolute value by M, and + +`2^f M <= 2^(w-1)-1`. + +The credited denominator/component-norm facts for a j-axis C prefix give +denominator dividing2^ceil(j/2) and component maximum norm2^ceil(j/2). +For j<=2f, both exponents are at most f. R preserves divisibility and +component magnitude, so every actual central prefix is integral and +symmetric-range bounded; permutations and L's unit phase remain safe. +This is a sufficient reserve, not a necessary domain or new norm theorem. + +No scale, width converter or rounding is installed. The original common +quantum, w and all header bits return unchanged. The selected application +review's common grid p+D and width p+h+2D+3 provide a conditional semantic +route, but this module does not emit its actual parameter/header producer +or assert that it supplies the sufficient divisibility condition above. +A caller may instead prove the precise correlated-prefix premises. + +## 5. Complete time and historical backing + +Every local read, write, unit move, goto and halt costs one step. All scans, +descriptor production, source copies, arithmetic, component seeks, history +returns and retirement below are included. Source helper prices are exact: +rewind3n+3, unary clear7n+4, unary copy +`(6+5t+z)n+5e+7`, doubling47n+18. Gamma prefix values sum to less than the +decoded value. Set Z=f+r+P+S+w<=5V. + +For the rank guard, five conversions including their trace/capture work +fit256(E+Z+1), the appended binary/length marks fit32(E+1), binary cutoff +decoding and the length/lexicographic comparison fit128(E+1), and all +remaining guide/guard returns and erasure fit128(E+Z+1). These follow by +the displayed helper prices and constant-depth prefix/tail loops; every +extra retained binary track is at most E+1. The larger envelope +`1024(E+Z+1)<=6144(V+E+1)` therefore covers the guard. Reserve +`65536(V+E+1)` to simplify the aggregate. + +The unchanged per-CNOT geometry/pass/retirement proof gives a bound for any +fixed k-gate nine-slot word: + +`T_G(k)<=1024 k f(V+1)+8192(V+E+1)`. + +The per-gate price does not depend on the old selected19/27-word counts. +The new four words have k=29,3,3,31, for a total66 CNOTs. Their shapes, +geometry construction, complete clone/commit and cleanup are all paid. +The other credited complete bounds are + +* two first-slot leaves: each65536(fV+E+1); +* each m=9 phase: at most65536(E+65V+1); +* outer whole-call transaction: exactly31V+27. + +Their sum, with f(V+1)<=2fV and V<=fV, is at most + +`8884255 fV +360448 E +360475 <=2^24(fV+E+1)`. + +This counts both active C blocks and every helper; no separately unpaid +recursive child is hidden in the bill. It is a direct-leaf rate. At a fixed +admitted active-axis cutoff q,2f<=q makes it O_q(F+1). Encoded cutoff value +and E are not made constants by that statement. No faster nonleaf tariff, +global kappa or complete selected dispatcher follows. + +For historical backing, the guard visits at most6V+7E+57 additional cells: +five decoded unary guides, DOUBLE, header trace/length, binary words and +lengths, all guard/end cells and public header positions. This is below +64(V+E+1). Each fixed binary word and each C leaf has credited complete +increment64(V+E+1), independent of its fixed word length. Each phase fits +256(V+E+1). The outer WORK/TRACE transaction adds8(V+E+1). Adding rather +than refunding successive increments gives + +`(64+4*64+2*64+2*256+8)(V+E+1)=968(V+E+1)<1024(V+E+1)`. + +K_entry includes every owner's complete earlier/opaque backing. At fixed +origins shorter successful calls scan only current live bodies and reuse +already blank tails, while earlier visited maxima remain. Changed origins +require actual interval unions and separately paid corridors; erasure or +new virtual names do not refund backing. + +## 6. Supplied owned HOME and following scalar contacts + +The retained B1 adapter copies/splits exactly six Gamma codes and complete +DATA onto private native HEADER/DATA. Its native origins are B-relative2, +leaving guard cell1 blank and preserving permanent B origin marker^ at0. +Core ports map injectively to3..33 and the header-length guide uses34. +Thus35 fixed tapes suffice. A larger consumer may reuse these after return; +the rank2 service does not allocate one tape per column or coefficient. + +On successful core return, it copies HEADER then DATA back to the complete +operand, erases copies and restores all heads/guards to B origins. The +unchanged scan/count proof gives adapter time128(F+1) and increment64(F+1). +B1 scatters exactly F bits to the same immutable HOME. Its general +full-bank delivery/return remains O(R K(F+1)); one local adapter is not an +unpriced complete source caller. The test's two homes contain one parked +productive input and the supplied live owned1526 packet. Entry is +graph.execution_start, after reservation, and productive_count=1 is fixture +bookkeeping. Owned1526 receives no productive credit or typed INIT here. + +Because the operation returns the exact original header, w/grid, geometry +and F, the existing signed HOME ADD can consume1526 after this return if +receiver1515 is supplied in frame470 with the identical header/common grid. +Frame/grid equality is a typed premise, not inferred from header bits. +That ADD preserves source1526 and costs4096(F+1), with increment8(F+2). +The four exterior SUBs at28041/28129/28135/28139 require matching frame601 +packets beforehand. Their coefficients stay-1 for every f; they are not +tensor-powered scalar signs. The ADD at28159 stays+1. + +For just these five arithmetic contacts and one MOVE, a conservative +standalone primitive bill is + +`20608(F+1)+2^24(fV+E+1)`, + +plus actual B1 delivery/reservation and all source/receiver production. +This is a boundary compatibility/ledger, not a six-event execution or the +full9582-event interval. INIT28037, receiver INIT28153, subsequent-1/4 SCALE, +dirty CLEAR37618, all intervening events and their producers remain separate. +No zero-at-CLEAR or free release theorem is asserted. + +## 7. Evidence, overlap and limits + +The full actual m=9,f=1 dense Gaussian packet returns on its owned HOME in +25854536 transitions, with5132 HOME writes only after complete primitive +return. A smaller nonzero packet reuses the same owners in20881778 steps +and retains the larger previous guide history. A wrong full-graph constant +phase returns exactly i times the expected image, so the oracle separates +the actual absolute phase. All35 heads, bodies/guards and opaque exteriors +return on successful cases. The forward oracle uses the original two frame +circuits and complete numerator accumulation, not the emitted factor word. + +The cutoff rejection f=1,cutoff=1 takes118370 transitions with no HOME write. +A source-constructed numerical case completes first C plus slot swap after +12601857 steps, has its complete intermediate WORK checked, then rejects +the second C at12803606 steps, again with no HOME write. Its failure cleanup +is deliberately unclaimed. Twenty-six guard-only header cases reach f129 +and4097-bit cutoff syntax at distinct signed origins; those are not full +f2/f129 DATA executions. Actual changed retained bytes, wrong source phase, +inverse quotient and a one-C substitute are rejected/separated. + +Source-complete positive rank-two leaves and their rank-scaled23-value +descriptor/cutoff already exist in #6978. Its protected whole MOVE retains +the two monomial/ordinary-provider premises and explicitly leaves their +supplier-free/literal join open. The present object is this actual owned +601→470 fixed-table join and unchanged Gamma6/HOME packet, not new C tensor +algebra, new rank-two factorization or first rank-two leaf. The prior selected +rank1 join, phase/G/leaf tables and HOME adapter retain their credit. Related +rank-two clean scalar conjugators/Pauli fusion macros do not supply these +complete stream tables. Bounded searches and exact pins are in OVERLAP.md. + +No endpoint scaling, full lifetime, format producer, arbitrary malformed +packet guarantee, rejection reuse, materialized uniform source word or +nonleaf supplier is supplied. All five selected assumptions and +kappa=.00363005817 remain. This is an AI-authored proof and finite replay, +not human or formal-kernel acceptance. diff --git a/research/literal-fixed-rank-positive-native/implementation/reference/rank2/RECIPE.json b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/RECIPE.json new file mode 100644 index 0000000000..04f5dc8367 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/RECIPE.json @@ -0,0 +1,490 @@ +{ + "source_event_index": 28141, + "source_event": [ + "MOVE", + 1526, + 601, + 470, + true + ], + "frames": { + "601": [ + 137 + ], + "470": [ + 75, + 137, + 265 + ] + }, + "retained_event": 19592, + "retained_role": 1421, + "rank": 2, + "left": { + "linear_Z4": [ + 2, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "matrix_rows": [ + 6, + 11, + 16, + 34, + 64, + 128, + 3, + 256, + 1 + ], + "offset": 0, + "phase": 0, + "quadratic_rows": [ + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + }, + "right": { + "linear_Z4": [ + 1, + 2, + 0, + 1, + 0, + 0, + 2, + 0, + 0 + ], + "matrix_rows": [ + 258, + 11, + 321, + 66, + 4, + 328, + 16, + 32, + 128 + ], + "offset": 0, + "phase": 0, + "quadratic_rows": [ + 331, + 329, + 0, + 331, + 0, + 0, + 11, + 0, + 11 + ] + }, + "left_records": [ + [ + "S", + 0 + ], + [ + "S", + 0 + ], + [ + "S", + 1 + ], + [ + "S", + 1 + ], + [ + "S", + 1 + ], + [ + "XROW", + 7, + 8 + ], + [ + "XROW", + 8, + 7 + ], + [ + "XROW", + 7, + 8 + ], + [ + "XROW", + 2, + 5 + ], + [ + "XROW", + 1, + 5 + ], + [ + "XROW", + 0, + 5 + ], + [ + "XROW", + 5, + 8 + ], + [ + "XROW", + 8, + 5 + ], + [ + "XROW", + 5, + 8 + ], + [ + "XROW", + 4, + 6 + ], + [ + "XROW", + 6, + 4 + ], + [ + "XROW", + 4, + 6 + ], + [ + "XROW", + 8, + 3 + ], + [ + "XROW", + 0, + 3 + ], + [ + "XROW", + 3, + 6 + ], + [ + "XROW", + 6, + 3 + ], + [ + "XROW", + 3, + 6 + ], + [ + "XROW", + 8, + 2 + ], + [ + "XROW", + 1, + 2 + ], + [ + "XROW", + 0, + 2 + ], + [ + "XROW", + 2, + 3 + ], + [ + "XROW", + 3, + 2 + ], + [ + "XROW", + 2, + 3 + ], + [ + "XROW", + 8, + 1 + ], + [ + "XROW", + 3, + 1 + ], + [ + "XROW", + 0, + 1 + ], + [ + "XROW", + 8, + 0 + ], + [ + "XROW", + 6, + 0 + ], + [ + "XROW", + 0, + 1 + ], + [ + "XROW", + 1, + 0 + ], + [ + "XROW", + 0, + 1 + ] + ], + "right_records": [ + [ + "S", + 0 + ], + [ + "S", + 1 + ], + [ + "S", + 1 + ], + [ + "S", + 3 + ], + [ + "S", + 6 + ], + [ + "S", + 6 + ], + [ + "CZ", + 0, + 1 + ], + [ + "CZ", + 0, + 3 + ], + [ + "CZ", + 0, + 6 + ], + [ + "CZ", + 0, + 8 + ], + [ + "CZ", + 1, + 3 + ], + [ + "CZ", + 1, + 6 + ], + [ + "CZ", + 1, + 8 + ], + [ + "CZ", + 3, + 6 + ], + [ + "CZ", + 3, + 8 + ], + [ + "XROW", + 6, + 8 + ], + [ + "XROW", + 3, + 8 + ], + [ + "XROW", + 1, + 8 + ], + [ + "XROW", + 7, + 8 + ], + [ + "XROW", + 8, + 7 + ], + [ + "XROW", + 7, + 8 + ], + [ + "XROW", + 3, + 6 + ], + [ + "XROW", + 0, + 6 + ], + [ + "XROW", + 5, + 7 + ], + [ + "XROW", + 7, + 5 + ], + [ + "XROW", + 5, + 7 + ], + [ + "XROW", + 4, + 6 + ], + [ + "XROW", + 6, + 4 + ], + [ + "XROW", + 4, + 6 + ], + [ + "XROW", + 5, + 3 + ], + [ + "XROW", + 0, + 3 + ], + [ + "XROW", + 3, + 4 + ], + [ + "XROW", + 4, + 3 + ], + [ + "XROW", + 3, + 4 + ], + [ + "XROW", + 2, + 4 + ], + [ + "XROW", + 4, + 2 + ], + [ + "XROW", + 2, + 4 + ], + [ + "XROW", + 3, + 1 + ], + [ + "XROW", + 2, + 1 + ], + [ + "XROW", + 0, + 1 + ], + [ + "XROW", + 2, + 0 + ], + [ + "XROW", + 0, + 1 + ], + [ + "XROW", + 1, + 0 + ], + [ + "XROW", + 0, + 1 + ] + ] +} diff --git a/research/literal-fixed-rank-positive-native/implementation/reference/rank2/SOURCES.json b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/SOURCES.json new file mode 100644 index 0000000000..0ea6091131 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/SOURCES.json @@ -0,0 +1,232 @@ +{ + "schema": "literal-rank2-source-pins/1", + "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/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": "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" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "b4fcc9d64971fdabd0b1d82cfb749d8aac920437", + "path": "research/compiler-permanent-home-dispatch/tape_graph.py", + "local": "reference/home/tape_graph.py", + "bytes": 12069, + "sha256": "7d3cee3e79ba5fe410e1a6b5f4cf6a2fbe5e274f838b798cd8860344ff258b54", + "blob": "f307133f2b0bba2e5969825cb814503d819322e7" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "13c29e2df66ba46402d4da5f1d2489ebf333e5fe", + "path": "research/source-bound-move-home-primitive/machine.py", + "local": "machine.py", + "bytes": 6041, + "sha256": "ffe2677bb5b82932873cb08b05f890a1218070215ebe670a0b05079518e8baee", + "blob": "fcd4ac01f03a4689fe9fa45d4ca5ea95950103da" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "13c29e2df66ba46402d4da5f1d2489ebf333e5fe", + "path": "research/source-bound-move-home-primitive/adapter.py", + "local": "reference/home/parent_adapter.py", + "bytes": 5353, + "sha256": "04462e141548c6a86c500d40b4aee8c446c539bd9269098d7516fa13400ef099", + "blob": "10606f87dcfa0781bcae900d95cb86925961d453" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "13c29e2df66ba46402d4da5f1d2489ebf333e5fe", + "path": "research/source-bound-move-home-primitive/NOTICE.md", + "local": "reference/home/NOTICE.md", + "bytes": 2093, + "sha256": "b51b8fd0773a1bbe988c8a98d951dc34b175bf56bac772ef65997f1df7ed3842", + "blob": "db83fd95e175c90a2f9e51545b4be4557fbb919e" + } + ], + "generated": [ + { + "local": "RECIPE.json", + "sha256": "b1386ad613213a01f736bc2e7fc7de5a25d2c700c3d577dfb396a266278ae702" + } + ], + "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", + "canonical_sha256": "91429a6b96729292a8764836e00c87a6f7cd3b76f05159033f4867f69a98d097" + } + ], + "proof_inputs": [ + { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "path": "research/owned-ascent-contract/RECIPES.json", + "bytes": 126616, + "sha256": "d6753d91211e7c919519835b1e3da04bb165674ab3c93cd74e4768ca0c7e444f", + "blob": "bde1249d259e8633c9a5eb6afceae12bfb3cd351", + "role": "exact retained36/44 record recipe and older identity" + }, + { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "path": "research/owned-ascent-contract/PROOF.md", + "bytes": 17222, + "sha256": "6479ac35c78a773adde421fdb1127472554c7687f038c4516d5ae8a962f4120d", + "blob": "32ff104fa88f7968ac5f66f804f28565bfcd84aa", + "role": "owned quotient/lifetime and dirty-return scope" + }, + { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "path": "research/owned-ascent-contract/verify.py", + "bytes": 12434, + "sha256": "748bcd3a4d78002ff065c67872650bf9bfae8f0ab87fef8af2bfda4d4a31d2e6", + "blob": "b3683d81a1b4b6f7468cf3cb52f6144375d3377f", + "role": "ownership flag source semantics" + }, + { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "path": "docs/research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md", + "bytes": 25533, + "sha256": "4501502c2ceb9759b20372435fe4beb51082c5a5e2910c1fd5dbe6edca415055", + "blob": "3dd1af2285e597676725e85ad4f65e7ad326d695", + "role": "current exact common grid, full factor and exterior scalar contract" + }, + { + "repository": "CrocSwap/integer-mult-bounds", + "commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "path": "research/current-coded-all-source-leaf/PROOF.md", + "bytes": 20312, + "sha256": "2943afc32745929374e8e55daff82b5fa78baa8a557d82b231d04b936c63c10d", + "blob": "5d619cfc2d3b7bc51e6fcc8e7a46ecd1e313e23d", + "role": "prior source-complete rank-two coded child and open supplier-free/literal join" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "39b40c465f7636a4bb6d70af28595fe8f70f4f3f", + "path": "research/literal-selected-linear-maps/PROOF.md", + "bytes": 17153, + "sha256": "217b6bbe9271aa5d5c0f0999a231d7386c7ba3fc432a88e3796d70ca283eb322", + "blob": "38f9adc04e3fb87d43dd92cfd3bd667a65d04238", + "role": "generic fixed CNOT geometry, per-gate cost and backing" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/PROOF.md", + "bytes": 17878, + "sha256": "55f0a575f618bf467d0e25a25802053455d701cee1f23fb8811a671a1bd59ff3", + "blob": "46a43bf214d828aa972db66ad35e41b9cd07a964", + "role": "generic fixed m9 phase and complete cost/backing" + }, + { + "repository": "CubeJerry/integer-mult-bounds", + "commit": "1a555e469b89af70d309bc966f8f813ac11dc887", + "path": "research/literal-positive-c-leaf/PROOF.md", + "bytes": 16608, + "sha256": "c99157c3c43ae490b858cdbce04d85f3661ca5d9752770506d18ec4876c4ed6c", + "blob": "a8ae6684d55e3a1aaa7f2aa432f15ae9db580b11", + "role": "first-slot C exact numerator/prefix/cutoff/cost/backing" + } + ] +} diff --git a/research/literal-fixed-rank-positive-native/implementation/reference/rank2/machine.py b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/machine.py new file mode 100644 index 0000000000..fcd4ac01f0 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/machine.py @@ -0,0 +1,129 @@ +"""Dense interpreter of literal Graphs; observers never drive control. Apache-2.0.""" +from dataclasses import dataclass +SYMBOLS={s:i for i,s in enumerate('_01^|$')} + + +class Rejected(ValueError):pass +class MonitorViolation(ValueError):pass + + +@dataclass +class State: + tapes:list + heads:list + origins:list + lows:list + highs:list + entry_lows:list + entry_highs:list + writes:list + steps:int=0 + + def clone(self): + return State([bytearray(t) for t in self.tapes],self.heads.copy(),self.origins.copy(), + self.lows.copy(),self.highs.copy(),self.entry_lows.copy(),self.entry_highs.copy(), + self.writes.copy(),self.steps) + + +def initial(payloads,tape_count,*,old_history=0): + if len(payloads)!=2 or len(payloads[0])!=len(payloads[1]) or not payloads[0]: + raise ValueError('two complete same-F source homes') + f=len(payloads[0]);capacity=16*(f+128)+256 + origins=[17+(t%7) for t in range(tape_count)] + text='^'+'|'.join(payloads)+'|$' + tapes=[bytearray(capacity) for _ in range(tape_count)] + for tape,o in zip(tapes,origins): + tape[o]=SYMBOLS['^'];tape[o-3:o]=bytes([2,1,4]);tape[-3:]=bytes([1,4,2]) + o=origins[0];tapes[0][o:o+len(text)]=bytes(SYMBOLS[s] for s in text) + lows=origins.copy();highs=origins.copy();highs[0]=o+len(text)-1 + if old_history:highs[-1]=origins[-1]+old_history + return State(tapes,origins.copy(),origins,lows.copy(),highs.copy(),lows,highs,[0]*tape_count) + + +class Program: + def __init__(self,graph): + names=list(graph.rules);self.labels={name:i for i,name in enumerate(names)} + self.labels['HALT']=-1;self.start=self.labels[graph.start];self.rows=[] + for name in names: + rules=[(tuple((t,SYMBOLS[s]) for t,s in r.tests), + tuple((t,SYMBOLS[s]) for t,s in r.writes),r.moves, + self.labels[r.target]) for r in graph.rules[name]] + if rules and all(len(r[0])==1 and not r[1] and not r[2] for r in rules) and len({r[0][0][0] for r in rules})==1: + branch=[-2]*6 + for r in rules:branch[r[0][0][1]]=r[3] + self.rows.append((0,rules[0][0][0][0],branch)) + elif len(rules)==1 and not rules[0][0]: + _,writes,moves,nxt=rules[0] + if len(writes)==1 and not moves:self.rows.append((1,writes[0][0],(writes[0][1],nxt))) + elif len(moves)==1 and not writes:self.rows.append((2,moves[0][0],(moves[0][1],nxt))) + elif not moves and not writes:self.rows.append((3,nxt,None)) + else:self.rows.append((4,rules,None)) + else:self.rows.append((4,rules,None)) + + def run(self,state,*,start=None,stop=None,budget=100000000): + pc=self.start if start is None else self.labels[start] + stop_pc=None if stop is None else self.labels[stop] + rows=self.rows;tapes=state.tapes;heads=state.heads + lows=state.lows;highs=state.highs;writes=state.writes + while pc!=-1 and pc!=stop_pc: + op,t,arg=rows[pc] + if op==0: + pc=arg[tapes[t][heads[t]]] + if pc==-2:raise Rejected('literal scanned-symbol rejection') + elif op==1: + value,pc=arg + if heads[t]==state.origins[t] and value!=3: + raise MonitorViolation('attempted permanent B origin marker overwrite') + tapes[t][heads[t]]=value;writes[t]+=1 + elif op==2: + delta,pc=arg + if delta not in (-1,0,1):raise ValueError('nonunit emitted move') + heads[t]+=delta + if not 0<=heads[t]budget:raise ValueError('finite execution budget') + return state + + def _general(self,state,rules): + tapes=state.tapes;heads=state.heads;lows=state.lows;highs=state.highs;writes=state.writes + found=None + for rule in rules: + if all(tapes[t][heads[t]]==symbol for t,symbol in rule[0]): + if found is not None:raise ValueError('nondeterministic emitted table') + found=rule + if found is None:raise Rejected('literal scanned-symbol rejection') + for t,value in found[1]: + if heads[t]==state.origins[t] and value!=SYMBOLS['^']: + raise MonitorViolation('attempted permanent B origin marker overwrite') + tapes[t][heads[t]]=value;writes[t]+=1 + for t,delta in found[2]: + if delta not in (-1,0,1):raise ValueError('nonunit emitted move') + heads[t]+=delta + if not 0<=heads[t]0 else -1),)) + return target + + +def copy_out(g,source,target,after): + state=g.state('repack') + g.add(state,after,tests=((source,'_'),)) + for bit in '01': + g.add(state,state,tests=((source,bit),),writes=((target,bit),(source,'_')), + moves=((source,1),(target,1))) + return state + + +def embed(g,code,after): + labels=[g.state('MOVE24472') for _ in code] + for pc,(op,*args) in enumerate(code): + state=labels[pc];g.rules.setdefault(state,[]) + nxt=labels[pc+1] if pc+1= len(self.cells): + self.cells.extend('_' for _ in range(self.head+1-len(self.cells))) + self.cells[self.head] = value + self.peak = max(self.peak, len(self.cells)) + + def move(self, delta): + if delta not in (-1,0,1): + raise ValueError('one physical transition moves at most one cell') + if self.head+delta < 0: + raise ValueError('head crossed permanent origin') + self.head += delta + self.visited.add(self.head) + self.peak = max(self.peak,self.head+1) + + def contents(self): + return ''.join(self.cells) + + +@dataclass(frozen=True) +class Rule: + tests: tuple + writes: tuple + moves: tuple + target: str + + +class Graph: + def __init__(self): + self.rules = {} + self.serial = 0 + self.start = None + self.execution_start = None + self.checkpoints = {} + + def state(self, stem): + result = f'{stem}.{self.serial}' + self.serial += 1 + return result + + def add(self, state, target, tests=(), writes=(), moves=()): + self.rules.setdefault(state, []).append(Rule(tuple(tests), tuple(writes), + tuple(moves), target)) + + def jump(self, target, moves=()): + state = self.state('jump') + self.add(state, target, moves=moves) + return state + + def rewind(self, tape, target, erase=False): + state = self.state('erase' if erase else 'rewind') + self.add(state, target, tests=((tape, '^'),)) + for symbol in ALPHABET.replace('^', ''): + self.add(state, state, tests=((tape, symbol),), + writes=((tape, '_'),) if erase else (), moves=((tape, -1),)) + return state + + def validate(self): + # Exact symbolic determinism: two patterns overlap iff every shared + # tested tape has the same symbol. No wildcard expansion is needed. + for state, rules in self.rules.items(): + for i, a in enumerate(rules): + if a.target not in self.rules and a.target != 'HALT': + raise ValueError('undefined graph continuation') + for b in rules[:i]: + left, right = dict(a.tests), dict(b.tests) + if all(left[t] == right[t] for t in left.keys() & right.keys()): + raise ValueError('nondeterministic graph state '+state) + + def run(self, tapes, limit=10000000, checkpoint=None, start=None): + state, steps = self.start if start is None else start, 0 + while state != 'HALT': + if checkpoint and state in self.checkpoints: + checkpoint(self.checkpoints[state], tapes) + if steps >= limit: + raise ValueError('literal graph execution capacity') + matches = [r for r in self.rules[state] + if all(tapes[t].read() == value for t, value in r.tests)] + if len(matches) != 1: + raise ValueError('malformed tape or nondeterministic transition '+state) + rule, = matches + for tape, value in rule.writes: + tapes[tape].write(value) + for tape, delta in rule.moves: + tapes[tape].move(delta) + state, steps = rule.target, steps+1 + if checkpoint and 'HALT' in self.checkpoints: + checkpoint(self.checkpoints['HALT'], tapes) + return steps + + +def service(graph, name, arity, target): + """Four small supplied primitive graphs used ONLY by finite fixtures. + + Real scientific scalar/route/leaf graphs are still premises of the theorem. + Tapes 1,2 are operands; tape 3 is retained private primitive scratch. + """ + if name == 'REV': + if arity != 1: + raise ValueError('unary reversal') + cleanup = graph.rewind(3, target, erase=True) + back_operand = graph.rewind(1, cleanup) + copy = graph.state('reverse-install') + graph.add(copy, back_operand, tests=((3, '|'),), writes=((1, '|'),)) + for bit in '01': + graph.add(copy, copy, tests=((3, bit),), writes=((1, bit),), + moves=((1, 1), (3, 1))) + install = graph.jump(copy, ((1, 1), (3, 1))) + rewind_scratch = graph.rewind(3, install) + reverse = graph.state('reverse-copy') + graph.add(reverse, rewind_scratch, tests=((1, '^'),), writes=((3, '|'),)) + for bit in '01': + graph.add(reverse, reverse, tests=((1, bit),), writes=((3, bit),), + moves=((1, -1), (3, 1))) + begin_reverse = graph.jump(reverse, ((1, -1), (3, 1))) + seek = graph.state('reverse-seek') + graph.add(seek, begin_reverse, tests=((1, '|'),)) + for bit in '01': + graph.add(seek, seek, tests=((1, bit),), moves=((1, 1),)) + return graph.jump(seek, ((1, 1),)) + if name == 'FIRST': + if arity != 1: + raise ValueError('unary leaf fixture') + at = graph.state('first-bit') + for bit in '01': + graph.add(at, target, tests=((1, bit),), writes=((1, str(1-int(bit))),), + moves=((1, -1),)) + return graph.jump(at, ((1, 1),)) + if name not in ('ZERO', 'NOT', 'XOR') or arity != (2 if name == 'XOR' else 1): + raise ValueError('missing supplied primitive graph') + cleanup = target + for tape in range(arity, 0, -1): + cleanup = graph.rewind(tape, cleanup) + loop = graph.state('primitive-'+name) + graph.add(loop, cleanup, tests=tuple((t, '|') for t in range(1, arity+1))) + if name == 'XOR': + for a in '01': + for b in '01': + graph.add(loop, loop, tests=((1, a), (2, b)), + writes=((2, str(int(a)^int(b))),), moves=((1, 1), (2, 1))) + else: + for bit in '01': + graph.add(loop, loop, tests=((1, bit),), + writes=((1, '0' if name == 'ZERO' else str(1-int(bit))),), + moves=((1, 1),)) + return graph.jump(loop, tuple((t, 1) for t in range(1, arity+1))) + + +def scan(graph, homes, selected, gather, target): + """Unroll finite home order; scan arbitrary F only by field delimiters.""" + next_state = graph.rewind(0, target) + for home in range(homes-1, -1, -1): + work = selected.get(home) + after = next_state + loop = graph.state('gather' if gather else 'return') + if work: + graph.add(loop, after, tests=((0, '|'),) if gather else ((0, '|'), (work, '|')), + writes=((work, '|'),) if gather else (), moves=((0, 1),)) + else: + graph.add(loop, after, tests=((0, '|'),), moves=((0, 1),)) + for bit in '01': + if not work: + graph.add(loop, loop, tests=((0, bit),), moves=((0, 1),)) + elif gather: + graph.add(loop, loop, tests=((0, bit),), writes=((work, bit),), + moves=((0, 1), (work, 1))) + else: + for output in '01': + graph.add(loop, loop, tests=((0, bit), (work, output)), + writes=((0, output),), moves=((0, 1), (work, 1))) + next_state = graph.jump(loop, ((work, 1),)) if work else loop + return graph.jump(next_state, ((0, 1),)) + + +def reserve(graph, extra_homes, target): + """Append full zero homes by copying first-field extent, without F arithmetic.""" + if not extra_homes: + return target + return_home = graph.rewind(0, target) + finish = graph.state('reserve-finish') + graph.add(finish, return_home, writes=((0, '$'),)) + next_state = graph.rewind(3, finish, erase=True) + for position in range(extra_homes-1,-1,-1): + loop = graph.state('reserve-zero-home') + graph.add(loop, loop, tests=((3, '0'),), writes=((0, '0'),), moves=((0, 1),(3, 1))) + graph.add(loop, next_state, tests=((3, '|'),), writes=((0, '|'),), moves=((0, 1),)) + begin = graph.jump(loop, ((3, 1),)) + next_state = graph.rewind(3, begin) if position else begin + seek = graph.state('reserve-seek-end') + graph.add(seek, next_state, tests=((0, '$'),)) + for symbol in '^01|': + graph.add(seek, seek, tests=((0, symbol),), moves=((0, 1),)) + rewind_template = graph.rewind(3, seek) + rewind_home = graph.rewind(0, rewind_template) + copy = graph.state('reserve-copy-extent') + for bit in '01': + graph.add(copy, copy, tests=((0, bit),), writes=((3, '0'),), moves=((0, 1),(3, 1))) + graph.add(copy, rewind_home, tests=((0, '|'),), writes=((3, '|'),)) + return graph.jump(copy, ((0, 1),(3, 1))) + + +def compile_graph(events, owners, primitive=service, productive_count=None): + """Return a real transition graph on four tapes for the fixture family. + + General theorem: replace primitive by supplied finite graphs using m + scratch tapes; tape count is 1+b+m, independently of Q,K,F. + """ + graph, next_state = Graph(), 'HALT' + home_index = {owner: i for i, owner in enumerate(owners)} + if len(home_index) != len(owners): + raise ValueError('permanent home owner identities must be distinct') + for index in range(len(events)-1, -1, -1): + event = events[index] + if not event.service: + continue + graph.checkpoints[next_state] = index + if not 1 <= len(event.owners) <= 2 or len(set(event.owners)) != len(event.owners): + raise ValueError('bounded distinct physical operands') + selected = {home_index[owner]: i+1 for i, owner in enumerate(event.owners)} + cleanup = next_state + for tape in range(len(event.owners), 0, -1): + cleanup = graph.rewind(tape, cleanup, erase=True) + scatter = scan(graph, len(owners), selected, False, cleanup) + invoke = primitive(graph, event.service, len(event.owners), scatter) + origin = invoke + for tape in range(len(event.owners), 0, -1): + origin = graph.rewind(tape, origin) + next_state = scan(graph, len(owners), selected, True, origin) + graph.execution_start = next_state + productive_count = len(owners) if productive_count is None else productive_count + if not 1 <= productive_count <= len(owners): + raise ValueError('positive productive count within permanent bank') + graph.start = reserve(graph,len(owners)-productive_count,next_state) + graph.validate() + return graph + + +def initial_tapes(payloads, home_count, preformatted=False): + if not payloads or len({len(x) for x in payloads}) != 1 or not payloads[0]: + raise ValueError('positive common full field format') + if len(payloads) > home_count or any(set(x)-set('01') for x in payloads): + raise ValueError('binary productive bank in declared homes') + # Only productive fields are supplied. New private extents are prepared + # by the literal reserve graph. Optional preformatting is for fault tests. + fields = list(payloads) + if preformatted: + fields += ['0'*len(payloads[0])]*(home_count-len(payloads)) + return [Tape('^'+'|'.join(fields)+'|$'), Tape(), Tape(), Tape()] + + +def decoded(tapes, home_count): + raw = tapes[0].contents() + if raw[0] != '^' or not raw.endswith('|$'): + raise ValueError('home boundaries changed') + fields = tuple(raw[1:-2].split('|')) + if len(fields) != home_count: + raise ValueError('permanent home count changed') + return fields diff --git a/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/NOTICE.md b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/NOTICE.md new file mode 100644 index 0000000000..71c5f6dae2 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/inputs/controller_reference.py b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/inputs/controller_reference.py new file mode 100644 index 0000000000..3ab6d0361f --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/leaf.py b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/leaf/leaf.py new file mode 100644 index 0000000000..bdcc80cbd8 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/NOTICE.md b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/NOTICE.md new file mode 100644 index 0000000000..3a3030f23d --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/inputs/controller_reference.py b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/inputs/controller_reference.py new file mode 100644 index 0000000000..3ab6d0361f --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/linear.py b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/linear/linear.py new file mode 100644 index 0000000000..6aad40a6c4 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/NOTICE b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/NOTICE new file mode 100644 index 0000000000..7a1f1da9c5 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/inputs/controller_reference.py b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/inputs/controller_reference.py new file mode 100644 index 0000000000..3ab6d0361f --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/phase.py b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/phase/phase.py new file mode 100644 index 0000000000..d489781458 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/reference/rank2/reference/source/clifford_exact.py b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/reference/source/clifford_exact.py new file mode 100644 index 0000000000..166841a037 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/reference/rank2/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-fixed-rank-positive-native/implementation/verify.py b/research/literal-fixed-rank-positive-native/implementation/verify.py new file mode 100644 index 0000000000..c7f1f5131a --- /dev/null +++ b/research/literal-fixed-rank-positive-native/implementation/verify.py @@ -0,0 +1,209 @@ +"""Source-bound literal uniform-rank Gamma6/HOME numerical replay.""" +from pathlib import Path +import atexit +from hashlib import sha256 +import importlib.util +import json +import random +import shutil +import subprocess +import sys +import tempfile +import time + +HERE = Path(__file__).resolve().parent +_cache = tempfile.TemporaryDirectory(prefix='positive-verify-') +atexit.register(_cache.cleanup) +sys.dont_write_bytecode = True +sys.pycache_prefix = str(Path(_cache.name) / 'required-absent') +import adapter as A +import join as C +from machine import Program, initial, fields, check_retired, Rejected + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def gamma(n): + if n < 1: + raise ValueError('positive Gamma integer') + b = bin(n)[2:] + return '0'*(len(b)-1)+b + + +def header(shape): + return ''.join(gamma(n) for n in shape) + + +def encode(values, width): + if any(not -(1 << (width-1)) <= x < 1 << (width-1) for z in values for x in z): + raise ValueError('oracle signed width') + return ''.join(format(x % (1 << width), '0'+str(width)+'b') for z in values for x in z) + + +def direct(values, rank, *, f=1, omit_last=False): + """Independent natural-address C butterflies on the complete array. + + This oracle indexes every actual active slot bit directly, without + conjugating the first-slot helper or simulating CNOT swaps. + """ + out = list(values) + count = rank-1 if omit_last else rank + for slot in range(count): + for column in range(f): + mask = 1 << (9*f-1-(slot*f+column)) + for i in range(len(out)): + if i & mask: + continue + ar, ai = out[i]; br, bi = out[i | mask] + rows = (ar-ai+br+bi, ar+ai-br+bi, + ar+ai+br-bi, -ar+ai+br+bi) + need(all(x % 2 == 0 for x in rows), 'independent oracle parity') + out[i], out[i | mask] = (rows[0]//2,rows[1]//2),(rows[2]//2,rows[3]//2) + return out + + +def guard_checks(): + from controller_reference import Machine, Tape + records = [] + for rank in range(1,10): + code, _ = C.compile_guard(rank) + cases = [(f, rank*f+delta) for f in (1,2,3,5,16,65,129) + for delta in (-1,0,1) if rank*f+delta > 0] + cases += [(5, 1 << bits) for bits in (63,257,512,1024,4096)] + for f, cutoff in cases: + text = header((f,2,3,2,5,cutoff)) + origins = [11*t-139 for t in range(29)] + tapes = [Tape({o-5:'0',o+1000000:'1'},o) for o in origins] + tapes[0].cells.update({origins[0]+i:b for i,b in enumerate(text)}) + before = [t.cells.copy() for t in tapes] + machine = Machine(code,tapes) + try: + machine.run(5000000); accepted = True + except ValueError as exc: + need(str(exc) == 'invalid scanned symbol', 'unexpected guard rejection') + accepted = False + need(accepted == (rank*f <= cutoff), 'literal rank-times-f cutoff') + need(tapes[0].cells == before[0], 'guard changed header') + if accepted: + need([t.head for t in tapes] == origins and [t.cells for t in tapes] == before, + 'guard private/head retirement') + records.append({'rank':rank,'f':f,'cutoff_bits':cutoff.bit_length(), + 'accepted':accepted,'steps':machine.steps}) + weak, _ = C.compile_guard(3,weak=True) + ts = [Tape({},0) for _ in range(29)] + ts[0] = Tape(dict(enumerate(header((1,1,1,1,8,2)))),0) + Machine(weak,ts).run() + return records + + +def tables(): + result=[] + for rank in range(1,10): + code, alphabet, entries = C.compile_join(rank) + need(alphabet == ('_','0','1','|'), 'core alphabet') + need(not any(op == 'write' and args[0] == C.DATA + for op,*args in code[:entries['commit']]), 'early public core write') + for op,*args in code: + if op in ('read','write','move'): + need(0 <= args[0] < C.TAPES, 'fixed port bound') + if op == 'read': + need(all(0 <= p < len(code) for p in args[1].values()), 'fixed read target') + if op == 'goto': + need(0 <= args[0] < len(code), 'fixed jump target') + if op == 'move': + need(args[1] in (-1,1), 'unit core move') + result.append({'rank':rank,'locations':len(code),'commit':entries['commit'], + 'sha256':sha256(repr(code).encode()).hexdigest()}) + return result + + +def corruption_control(): + with tempfile.TemporaryDirectory(prefix='positive-source-control-') as tmp: + dst = Path(tmp) + for name in ('join.py','SOURCES.json'): + shutil.copy2(HERE/name,dst/name) + for pin in json.loads((HERE/'SOURCES.json').read_text())['files']: + q=dst/pin['local'];q.parent.mkdir(parents=True,exist_ok=True) + shutil.copy2(HERE/pin['local'],q) + q=dst/'reference/rank2/reference/leaf/leaf.py' + q.write_bytes(q.read_bytes()+b'\n# changed actual helper byte\n') + launch=('import sys,tempfile;from pathlib import Path;' + 'd=tempfile.TemporaryDirectory();sys.dont_write_bytecode=True;' + 'sys.pycache_prefix=str(Path(d.name)/"absent");' + 'sys.path.insert(0,'+repr(str(dst))+');import join') + r=subprocess.run([sys.executable,'-I','-B','-c',launch],capture_output=True,text=True) + need(r.returncode != 0 and 'frozen source drift' in r.stderr, 'actual helper drift accepted') + + +def run(): + guard_records = guard_checks() + table_records = tables() + graph, stages = A.compile_home(3) + program = Program(graph) + rng = random.Random(130003) + shape = (1,1,1,1,8,3) + values = [(8*rng.randrange(-1,2),8*rng.randrange(-1,2)) for _ in range(512)] + h = header(shape); data = encode(values,8); bits = h+data + answer = direct(values,3) + expected = h+encode(answer,8) + need(expected != bits and direct(values,2) != answer, 'nontrivial rank-three tensor oracle') + parked = ''.join(str(rng.randrange(2)) for _ in bits) + state = initial((parked,bits),A.TAPES,old_history=3*len(bits)) + old_highs = state.highs.copy() + program.run(state,stop=stages['core_return']) + need(fields(state) == (parked,bits) and state.writes[0] == 0, 'early HOME write before core return') + core_steps = state.steps + program.run(state,start=stages['core_return'],stop=stages['primitive_return']) + need(fields(state) == (parked,bits) and state.writes[0] == 0, 'early HOME write before scatter') + program.run(state,start=stages['primitive_return']) + need(fields(state) == (parked,expected), 'complete literal rank-three output') + need(state.writes[0] == len(bits), 'sole complete owned HOME commit') + check_retired(state) + need(all(x >= y for x,y in zip(state.highs,old_highs)), 'old history refunded') + increment = sum((hi-lo)-(ehi-elo) for lo,hi,elo,ehi in + zip(state.lows,state.highs,state.entry_lows,state.entry_highs)) + need(increment <= 2112*(len(bits)+1), 'complete historical-backing increment') + need(state.steps <= (1 << 24)*(len(data)+len(h)+1)+128*(len(bits)+1), 'complete time bound') + first = {'shape':shape,'E':len(h),'V':len(data),'F':len(bits),'steps':state.steps, + 'core_return_steps':core_steps,'HOME_writes':state.writes[0], + 'visited_increment':increment,'retained_old_guide_high':state.highs[-1], + 'output_sha256':sha256(expected.encode()).hexdigest()} + # Legal packet, wrong joint cutoff: f<=2 but 3*f>2. Public HOME unchanged. + bad = header((1,1,1,1,8,2))+data + rejected = initial(('0'*len(bad),bad),A.TAPES) + before = bytes(rejected.tapes[0]) + try: + program.run(rejected) + except Rejected: + pass + else: + raise ValueError('rank-three joint cutoff accepted') + need(rejected.writes[0] == 0 and bytes(rejected.tapes[0]) == before, 'cutoff changed public HOME') + # Actually execute omitted-third-C mutant; same ABI returns a different tensor. + wrong_graph,_ = A.compile_home(3,mutation='omit_last_C') + wrong = initial((parked,bits),A.TAPES) + Program(wrong_graph).run(wrong) + need(fields(wrong) == (parked,h+encode(direct(values,2),8)) and fields(wrong)[1] != expected, + 'omitted third active slot control') + check_retired(wrong) + corruption_control() + return {'marker':'PASS_LITERAL_GENERIC_POSITIVE_HOME','tapes':A.TAPES,'core_tapes':C.TAPES, + 'rank_three':first,'tables':table_records,'guard_cases':guard_records, + 'cutoff_rejection_steps':rejected.steps,'omitted_child_steps':wrong.steps, + 'controls':['joint cutoff versus weak f cutoff','actual omitted third C', + 'actual retained source corruption','no early original-owner write'], + 'scope':'fixed-rank positive central direct leaf only; no surrounding monomials/caller/nonleaf rate'} + + +if __name__ == '__main__': + start = time.monotonic() + result = run() + if '--write' in sys.argv: + (HERE/'RESULT.json').write_text(json.dumps(result,indent=2,sort_keys=True)+'\n') + elif (HERE/'RESULT.json').exists(): + need(json.loads((HERE/'RESULT.json').read_text()) == json.loads(json.dumps(result)), 'receipt changed') + print(json.dumps(result,sort_keys=True)) + print('elapsed_seconds',round(time.monotonic()-start,3)) diff --git a/research/literal-fixed-rank-positive-native/review/root/RESULT.json b/research/literal-fixed-rank-positive-native/review/root/RESULT.json new file mode 100644 index 0000000000..855a912621 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/review/root/RESULT.json @@ -0,0 +1,46 @@ +{ + "F": 10256, + "controls": [ + "missing fourth slot gives different output", + "negative direction gives different output" + ], + "core_instructions": 59274, + "core_sha256": "f99dbf917f6a1425fdbb578eeaae6aecd3f92d4487628309ecc1b7f493769921", + "input_sha256": "9e9200286bec9c65588efadebce33c6f110947ce6d1386d3407fafab07cf1ed7", + "oracle": "Independent direct Hamming-distance tensor kernel with integer Gaussian numerators, not emitted swaps or author oracle", + "output_sha256": "8f5b5e4c023fd56531b105b3ee2c9e107f0a821824d9e075ff5b854e4f27f3c4", + "rank": 4, + "receipt": { + "HOME_writes": 10256, + "checkpoints": { + "POSITIVE_R4.71": { + "home_writes": 0, + "steps": 82147 + }, + "jump.5": { + "home_writes": 0, + "steps": 24054530 + }, + "jump.70": { + "home_writes": 0, + "steps": 24023692 + } + }, + "early_HOME_writes": 0, + "entry_head_history": 120553, + "final_head_history": 258955, + "steps": 24105820 + }, + "scope": "One complete nontrivial rank4 f1 call plus static embedding audit; universal proof is separate and no caller or nonleaf tariff is admitted.", + "shape": [ + 1, + 1, + 1, + 1, + 10, + 4 + ], + "states": 59451, + "status": "PASS_ROOT_RANK4_POSITIVE_HOME", + "tapes": 35 +} diff --git a/research/literal-fixed-rank-positive-native/review/root/ROOT-REVIEW.md b/research/literal-fixed-rank-positive-native/review/root/ROOT-REVIEW.md new file mode 100644 index 0000000000..9e47332d83 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/review/root/ROOT-REVIEW.md @@ -0,0 +1,112 @@ +# Root review of the fixed-rank positive native join + +Canonical base: e54523517d0f03e58352e647c403a5af3e525a57. +Original implementation freeze SHA-256: +5735c401ba981a7af4d3a146eb047d04fa0c87dbf7ed49bd82dc57df8d6cb2ef. +Status: mathematical/code review and a separate complete rank-four execution +passed. Publication metadata and frozen-package replay are separate gates. + +## Claim and novelty boundary + +For each construction-time rho in1..9, the program implements positive C +on the first rho native slots, each with f columns, keeping all9f slots, +all external row/component/spectator coordinates and the supplied common +grid. It checks rho*f<=cutoff while leaving the original f header intact. +The entry promises include all actual C-prefix integrality and signed +range, valid complete fields, distinct owners and blank required work. + +The root read the exact canonical #6978 proof, especially section7. It +already supplies rank-rf algebra and complete coded numerical children; +its item3 leaves flattening numeric adapters/control to literal lifecycle +tables open. The new result is the literal Gamma6/HOME central lifecycle, +not new tensor algebra or a first rank-scaled leaf. Arbitrary surrounding +monomials, actual source MOVE/caller substitution, the parameter producer +and the faster selected nonleaf tariff remain separate obligations. + +## Independent review of the new binary guard + +Let n be the positive f bit length, q=ceil(log2(rho)), L=n+q, z the number +of leading product zeros, and m=L-z. Prefix q zeros before unchanged +Gamma capture. The fixed carry recurrence writes (rho*b+a) mod2 and sets +carry floor((rho*b+a)/2). Induction gives exact multiplication; the carry +stays in0..rho-1. Since rho*f<2^(n+q), it vanishes at the left marker. +The result is positive, so skipping leading zeros terminates at a one. +The program then copies its canonical bits and length, erases the old +buffer and moves the result back to the original origin. Original unary F +and public HEADER are unchanged. + +Root separately counted the emitted new loops. Clearing the old length +costs7n+4. The end scan, carry pass, zero skip, canonical copy, rewinds, +move-back and final rewinds sum to an additional +10L+26m+4z+23. Thus multiply_capture costs +43n+36q-22z+27. The q initial zero writes/moves cost2q. The padded FBIN +also adds3q to Gamma's capture rewind. Total added work is at most +43n+41q+27, bounded by64(n+q+1). This extra parser charge was identified +during review and explicitly included before the author freeze. The much +larger65536(V+E+1) guard allowance covers it together with all inherited +parameter decoding/cleanup. Cutoff is decoded as bits/length, not unary +numeric value. + +## Composition and complete cost + +Each three-CNOT swap exchanges slot0 and a fixed slot i, columnwise, +without phase. Therefore swap_i C0 swap_i equals Ci. The chronological +sequence C0 followed by those conjugated passes is exactly positive C on +all rho*f active axes; no header is changed to pretend rho*f columns fit +inside a9f layout. Disjoint axes commute, and every full spectator remains. + +Every inherited helper returns its private tapes blank at the same origins, +so successive helpers can reuse the fixed private set. They operate on +WORK; original DATA is written only by the final outer commit. The HOME +embedding maps every literal instruction to the corresponding local Rule +without adding host arithmetic. Failure protects original DATA/HOME but +does not promise private cleanup, rollback or retry. + +Root independently summed the stated complete helper bounds. After using +f(V+1)<=2fV and V<=fV, the coefficients are +(94208rho+36895)fV+(81920rho+49152)E+(81920rho+49179). +For rho<=9 these are at most884767,786432,786459, all below2^24. +Summed incremental historical extents are at most +(192rho-56)(V+E+1)<=1672(V+E+1)<2048(V+E+1). +This sums extents even after erasure and does not refund old backing. +HOME separately adds128(F+1) transitions and64(F+1) backing; B1 full-bank +work, fixed program/setup and supplied entry remain explicit charges. + +## Separate numerical and physical challenge + +check_positive_root.py imports the emitted graph through adapter.py but +imports neither the author's machine interpreter nor its numerical oracle. +Its sparse Graph CPU separately selects transitions, enforces unique rule +matches/unit moves, and measures actual heads, writes and historical bounds. +It checks the complete literal embedding instruction by instruction. + +Expected values come from the closed tensor matrix: the entry at active +indices x,y is (1+i)^(rho-h)*(1-i)^h/2^rho, h=popcount(x xor y). +This is evaluated by integer Gaussian arithmetic for every inactive +spectator. It does not simulate the emitted slot swaps or sequential +butterflies. The first native slots are the most-significant stream bits. + +A fresh dense rank-four f1 packet has512 Gaussian coefficients, width10, +and component values in{-16,0,16}. Divisibility16 and the symmetric reserve +ensure all four prefixes fit. Its actual output differs from the input, +from the missing-fourth-slot transform and from the negative-direction +transform. The source/destination and parked HOME are checked bitwise. + +The complete run passes24,105,820 transitions and10,256 HOME writes, all +after primitive return. All35 heads, permanent origins, private bodies and +opaque exteriors restore. Historical backing rises from120553 to258955, +with a pre-existing large guide extent still charged. The frozen rank-four +core has59274 instructions and SHA-256 +f99dbf917f6a1425fdbb578eeaae6aecd3f92d4487628309ecc1b7f493769921. +The result receipt records exact input/output hashes and checkpoints. + +## Evidence limits + +The author separately executed rank three, every rank's structural table +and233 guard cases, including large encoded syntax and actual negative +controls. Root executed rank four. Complete f>1 payloads and complete +rank5..9 payloads were not executed here; the all-f/all-fixed-rank claim +rests on the written helper invariants and composition proof. Guard cases +are not relabelled as complete numerical calls. This coordinated AI review +is not blind, human or formal-kernel acceptance. No selected assumption is +discharged, and no new kappa or faster nonleaf rate is claimed. diff --git a/research/literal-fixed-rank-positive-native/review/root/check_positive_root.py b/research/literal-fixed-rank-positive-native/review/root/check_positive_root.py new file mode 100644 index 0000000000..08be764625 --- /dev/null +++ b/research/literal-fixed-rank-positive-native/review/root/check_positive_root.py @@ -0,0 +1,123 @@ +"""Independent sparse Graph CPU and closed Hamming-kernel oracle for rank-four positive central join.""" +from pathlib import Path +from fractions import Fraction +import hashlib,json,sys,time +P=Path(sys.argv[1]).resolve() if len(sys.argv)>1 else Path(__file__).with_name('source').resolve() +sys.path.insert(0,str(P)) +import adapter as a +def require(ok,why): + if not ok:raise ValueError(why) +def word(x,w):return format(x%(1<