diff --git a/.github/workflows/w3-restore.yml b/.github/workflows/w3-restore.yml new file mode 100644 index 0000000000..732c59e4c2 --- /dev/null +++ b/.github/workflows/w3-restore.yml @@ -0,0 +1,29 @@ +name: W3 complete construction +on: + push: + branches: [codex/w3-restore] + paths: ['research/w3-restore/**', '.github/workflows/w3-restore.yml'] + pull_request: + paths: ['research/w3-restore/**', '.github/workflows/w3-restore.yml'] +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - run: sudo apt-get update && sudo apt-get install -y g++ libboost-dev + - run: python -m pip install -r research/w3-restore/requirements.txt + - run: python -B research/w3-restore/verify.py --output "$RUNNER_TEMP/w3-replay" --cxx g++ + - uses: actions/upload-artifact@v4 + if: always() + with: + name: w3-proof-receipts + path: | + ${{ runner.temp }}/w3-replay/*.json + ${{ runner.temp }}/w3-replay/logs + ${{ runner.temp }}/w3-replay/baseline/verification.json diff --git a/certificates/joint-dual-kappa.json b/certificates/joint-dual-kappa.json index b7f7b89bc2..1f35b89221 100644 --- a/certificates/joint-dual-kappa.json +++ b/certificates/joint-dual-kappa.json @@ -842,7 +842,7 @@ "scripts/experiments/pin_joint_dual_sources.py": "4d31cc0e38b7902709ca5f8f714cba109760d2592346dd7f8dc0b900a2d9fe00", "scripts/experiments/verify_joint_dual.py": "7a31bba1e9c0ded32ae285df2ca9bc91ef20c330f6789fdba361876f3c7a1985" }, - "source_manifest_sha256": "4f3c15b82a2d97335d4fe95fb8bcb96bd2a921087da289d9da16c68213a17f17", + "source_manifest_sha256": "698fe862a620e5b80b85fbc6034c9456fa0fa9aea638dbbbcb3f9edd24c0415e", "sources": [ { "files": { diff --git a/certificates/joint-dual-validation.json b/certificates/joint-dual-validation.json index 194861d3c3..61a8d41622 100644 --- a/certificates/joint-dual-validation.json +++ b/certificates/joint-dual-validation.json @@ -226,7 +226,7 @@ } }, "bit_saving": "2382370177/50000000000000", - "certificate_sha256": "9801147b1502cf1e43d5fa39aa37f5291f03b48c30c4dd4f272e0877894a1c24", + "certificate_sha256": "6f684fa7f747073a132e8d0b5652cf12a8afa389f2a16ff6ade8e080d786dd22", "kappa": "4764513337/100000000000000", "margins": 7, "producer_words_regenerated_and_matched": true, diff --git a/research/joint-dual/SOURCE.json b/research/joint-dual/SOURCE.json index e3a8386b17..e1fbf9c5aa 100644 --- a/research/joint-dual/SOURCE.json +++ b/research/joint-dual/SOURCE.json @@ -3,9 +3,9 @@ "base_pr57_commit": "cd350f76c9bc01489ec83568bded532cb69be938", "base_pr58_commit": "bc2f7ed4c20dc18898305ab17165c0c995cbb804", "files": { - "Makefile": "768131bd4ce18433f6abccdc9812a38c92e11220e3a1019c6d95334b42f529d1", + "Makefile": "cd0fb59dc078d1fdf54a163ea13bb3660d03c8fe69c1a7f99fc8e5f476a3d5c2", "NOTICE": "b49022cb4104d90b182e4c335f670faf45529025b15db77bf0291835083c28bd", - "README.md": "d104c31d5b7e0d3a8d011a0e3517ab615e5b499b3dc05684f7ad3cadcd28bdae", + "README.md": "b81f8035b859007add6693c6d860371c9100a6766e494045495a28a457a5fcb9", "certificates/joint-dual-compiler.json": "516c4d85158553dabd0a98216a064b2a7397957a9d5dd0df1d6e5aec53a4e805", "certificates/joint-dual-profiles-23.json": "159fa8fee175fc1d24f63e72d3c2f1dc9f4fcd78b938c5e7d2f735fd0fd37209", "certificates/joint-dual-profiles-25.json": "8d190ce42d097e828c5756918c52f2963df576cf4c6600b0fc7f2b7fdb6ad223", diff --git a/research/w3-restore/.gitattributes b/research/w3-restore/.gitattributes new file mode 100644 index 0000000000..fa1385d99a --- /dev/null +++ b/research/w3-restore/.gitattributes @@ -0,0 +1 @@ +* -text diff --git a/research/w3-restore/LICENSE b/research/w3-restore/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/w3-restore/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/research/w3-restore/MANIFEST.json b/research/w3-restore/MANIFEST.json new file mode 100644 index 0000000000..8483088c4a --- /dev/null +++ b/research/w3-restore/MANIFEST.json @@ -0,0 +1,273 @@ +{ + "files": { + ".gitattributes": "705fd4d6451a31d36b3df7de96f83f30ac976c9b4a6d1e51671d8e2f33e2d0da", + "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "NOTICE.md": "ab1114bf1c51bbef871f4306ebd6e10fce12be35dd8738f5700d879fddde88ac", + "PROOF-PR310.md": "eb4e853945b0937ef39cf88d6f2a03fd62a4404c715838c142eaae274a8800e3", + "PROOF-PR311.md": "9990ed308c17f3da2f82435e38d098ad597dc75c9510e20b2bed2e9ca075744a", + "PROOF.md": "a28a1ddc08759fb17aa3ea756652d32d5085cbc15b3885dcb0042a45e815d808", + "README-PR310.md": "6e79475c3279b4c5850a369d8a6c98bbe415d6cc2edfcf31dda536e702f466e4", + "README-PR311.md": "c1cb4921e126dc20705bbd620de2929229c4893a222e4d09f8a7582d0287e02b", + "README.md": "146c6d23242978368e9271720356dcc203975bb916db5587d1759ad31eefcfe4", + "SOURCE.json": "27f057dd13bb21f0c33611c3f362f892a32b81f6996527743672042dbe412779", + "code/admit_geometry.py": "16433a6e77fa0c131e9522464fd25ddd5854ee45eaf30833f42422821c6a16e8", + "code/changed-charts.cpp": "40576d17ff335e61c2669f93a096df1b961ab5a3546f85e778670bd2fcc20ac6", + "code/cleanup.py": "e095506a5f57bb9fb3c1e2b6c4ad3a1c35c7b56efad4a99c08f1df6946ba3403", + "code/cleanup_emit.py": "7b21d4bcae40c88446b1df65bb4620c7f353771e586e7d5481b0c4ec615f619d", + "code/cleanup_reference.py": "a368d184558c660b07da63fd3727181c69fc48ba493a39c465a7b556e34558da", + "code/cleanup_screen.py": "6b690ff90b3c86e6b186c518e8e32b2168b5197e986e5a3d14756b12b353bd12", + "code/cohort-bank-review.cpp": "8c8b0610afcc205677aa8fc5986640fb8cd21b360102c1a8eb0f4372600457c6", + "code/cohort-finite-invoice.cpp": "814181e25f6e238f02f2692c57487f20f3a2787b454d120cb3968c6cc15f9894", + "code/compact-columns.cpp": "a7432be590e68bac9e48df432c5f22767bce6af1c237499280e4e3bce09e5131", + "code/complex_guard.py": "8d20ebb301750d8de22ae8064ccaaaa04edebc1cba79bce7476a122826d9dbb0", + "code/complex_labels.py": "76cea4f596830189991f792e8e76d63c5f6f1cace564a93362a14f112b58c290", + "code/complex_scalars.py": "ef653d66a3c5ca96fd1237378e0cf6faf568c27f174f4e5208931fa0d5244eab", + "code/complex_splice.py": "10d47480194dff9d2617db1f7198508a275dc31a8873936ee63515f22ab91d69", + "code/export249.py": "6c9aedb8fb4f2d560aca6cfc32ec967e003c0e623cc345040f108101ec1b442f", + "code/finish.py": "5844de7120bb2e5ef07dfd3a9293195cd0b65ee351f93ab716857fb0f951c6e4", + "code/prepare_candidate.py": "2f29221fa827806ef7f6fc723bc68819868c5464b6b07ca7a7f454d84556e335", + "code/price.py": "44c673a7ba24570a0a610bfa2991eea605e6221ebf9702e5f5f3374195594170", + "code/recompact.py": "2aa4f37b7a85b07196cdcc5962ec06f338d2563f748cc8d7aaa822e09a68d252", + "code/target_prefix.py": "e22803ac3c000295b48cf154469bde5eb876e833c08dc436a2db5c95adfc0a51", + "inputs/bank-plan.json": "4db161de1c58be88d4885b0986bc6a2e214b1f21d9334a944178d94609095d5e", + "inputs/target-selection.json": "80e50a4e3d0f70b9188e1cf1f5b8955b9183b4fd341a69ae13032b439a4c5561", + "requirements.txt": "348271c294c722c853ecbc2f77bc408d926485deb844b8ed342932b9eba4d3e9", + "supplied/README.md": "23d6f6303c6187eac4a036b7f3c6c233214f40bfc1c8336374a740c00a9900e3", + "supplied/SHA256SUMS": "915b4add4e9e89bacc0f9c0653f12c19d552b4cb84100d05a049b953d35237ed", + "supplied/base/249-DONOR-OWNERSHIP.json": "ab96904508a21ddd0c3d4d779974e5dcfdb1f19a3938ade647724cc317c3270b", + "supplied/base/249-records.bin.gz": "ded35ac806ab0f478265ef65d629ab3760771c84e44d00c7ec9995037e11960d", + "supplied/base/249-states.json.gz": "c5f6d78de1a3b279ab05a263b80d1b25a587f20f39e1540134f4542e89e5530c", + "supplied/base/PR249-SOURCE-MANIFEST.json": "f68fa82180cd352421b8bc3f7a5c89d51bde74e74cd8d62c222c28b0f23fcf31", + "supplied/base/frames.json.gz": "0e92416f9525a6c6c14add4c73923916e6866aaf118180880e6cc5a2b7aa7d18", + "supplied/builders/agentA_designT/addcats.py": "b9b33b797601d70d766b2d0ab86c95b36a8246ca10bbafd5ff40058daff3918d", + "supplied/builders/agentA_designT/addcomp.py": "82e5ef0c7b6cf84c53bf6039330930242c9a5c8e8ea13183b2805cf9577f7129", + "supplied/builders/agentA_designT/build.py": "c55810a88f223c6853e67d7c021d7cd3c38b2c5837c751954c56d83d92762d88", + "supplied/builders/agentA_designT/build_v5.py": "a74a58cc3ffc6f9d173ebafbb8536bae27cb0e0a225a048b0423a65640998bf8", + "supplied/builders/agentA_designT/checks.py": "8006cd7a70b290b8a6a6a49a75aa1104e0a601f13e5af16a0d0fd78ff23e225c", + "supplied/builders/agentA_designT/gather.py": "5ebcd626fadefd548a4392eae07fde6f6513ae908e463eaa56cb468ad6ae1651", + "supplied/builders/agentA_designT/interface.py": "c0dec403eea5c23d3032a15af659eb44d01197894957e6e43c0247434ba1e703", + "supplied/builders/agentA_designT/lpmod.py": "1195c34795e1434782b2c0b64058969cf0ab39a604740a3325cf4f6da08a8151", + "supplied/builders/agentA_designT/modules.py": "3565c79f1c526f894b6f088fba01852e13fa26871db3bf5b7ec3b28bd6258bc2", + "supplied/builders/agentA_designT/names.py": "3a474d872095f87183a6e9207577c9643803fd4150ccfc890de0770ce43e6a57", + "supplied/builders/agentA_designT/upper.py": "7e6cb8b2b27aa2ad626056e585e325d49aa289fb9111077e3f3ebd7343987c66", + "supplied/builders/agentA_designT/verify.cpp": "43a768d7de0837a353694e060d8a43cd9ed8e0e4e1e8bb7b28ef8de9db2c04cc", + "supplied/builders/agentA_twin/twin.py": "c580e23f98d532d96cb71db5063f7d55402a2ff081cc43a1b6338b3be8d6ff50", + "supplied/builders/agentA_twin/twinscan.py": "5c2a423702d8d8b642be98962b113c814b06e5a6aaa8d3b6970b7466374b4da8", + "supplied/builders/agentB_lp/addcomp.py": "82e5ef0c7b6cf84c53bf6039330930242c9a5c8e8ea13183b2805cf9577f7129", + "supplied/builders/agentB_lp/build_lp.py": "6a92fd618ccd262a067af58bcc82b6ff661533b03a8f9bf804af344d992af0bd", + "supplied/builders/agentB_lp/rebuild.sh": "39fb15f83560431124488906b9f3669a2104cad7b2c5224d77667ea150bdd5e3", + "supplied/builders/agentB_lp/sat/checkdesign.py": "532d27121ba3054e92a3d6a0a27ff8262a6b01e39c00f460876d6423ac43af47", + "supplied/builders/agentB_lp/sat/checkdesign4.py": "6d9c993acf3a73a417058190f338af08faef22bf47d7ec4b42c4442ef392c919", + "supplied/builders/agentB_lp/sat/meet3.py": "7bd98981ab8d70f21fa8618b9d2b48edde43f00f9e66e98ccf73d416afe41fcf", + "supplied/builders/agentB_lp/sat/meet4.py": "fc00cb231198c6ff4ce8e3c75e1d722fc11c93138c364c4f723efd7fcdc0af47", + "supplied/builders/agentB_lp/sat/plan4.py": "4e94c22f361acef1e516cd92f8ecea5a375ad3051246960d4133fed4312a533b", + "supplied/builders/agentB_lp/sat/sol_z5_m3t6.json": "b9afc590d84ee8959dca3eb9ab0c1708df28368319e45733c0e91dead77aef91", + "supplied/builders/agentB_lp/tools/base.py": "067af2d04f545e8b989aa2c13ce1d84c3f1f698fc29cf356e812930af0b1eb18", + "supplied/builders/agentB_lp/tools/deliv.py": "0d853403960c09fa8ba208c5f951788c52583950149180bd88e67bbebf88cfed", + "supplied/builders/agentB_lp/tools/extract_lines.py": "de7502ef4ec2b331ae7efc261152de36c75517bee6cf3fa0e43ddcf96c3c1892", + "supplied/builders/agentB_lp/tools/frames.py": "7c5c781c8bb82b310583ad2bcd638039f33fd96f77c12941764619967d3989fb", + "supplied/builders/agentB_lp/tools/idcheck.py": "151fde05c5b3e1759e6392ab32dd27c2b16a339a9a7a15bba488047445771fac", + "supplied/builders/agentB_lp/tools/idlestops.py": "41ad425ea75af2243870c6cdb55d6a8269e6ca13b2c09a2210511661147b670e", + "supplied/builders/agentB_lp/tools/lattice.py": "40dbcd7500aa1cf3f7267cde0612ad119c0ab9f4262630724c83ec24b1316a88", + "supplied/builders/agentB_lp/tools/localD.py": "87c0115a919f54b9348581c6f4c2a76958c80bfe4cfff12a82972ae6c734d55f", + "supplied/builders/agentB_lp/tools/lpcensus.py": "d3750e7c2fce5c4e4071b1f849b3aaa201aa0df4bbffc1946653dbf101f723c7", + "supplied/builders/agentB_lp/tools/lpframes.py": "d26d87f8af9d3dc07fb45e01f5a6ffb04204d406daa2ac0398274425d26a9d19", + "supplied/builders/agentB_lp/tools/lpmod.py": "2267dbe7044513125dc819144cc63ffbcfc24314c143c6d50716db88cc28be29", + "supplied/builders/agentB_lp/tools/lpout.py": "4bded36d92820b88fc1294390bdcbc1b37bde18e940eeba3063ec74e575a0821", + "supplied/builders/agentB_lp/tools/lptemplate.py": "6d779ccd2c7e6b7168bd441e8299b07916ae55349d5221e09478c5cbe616a020", + "supplied/builders/agentB_lp/tools/lptiming.py": "32156405931d878022dbc71347994433e4ffaf16bb18948d501af404af0c80d6", + "supplied/builders/agentB_lp/tools/moduleD.py": "ddf210d935ef20580cb645814ceea6f87c0956083040812ed30daea4c6e2ff54", + "supplied/builders/agentB_lp/tools/regrecs.py": "66790e522c90b47f7434a821ec1bdd5a3126239be74baa82c2d25867cbef1ef8", + "supplied/builders/agentB_lp/tools/regtrace.py": "f8f633a48bec0882245d65339a0d50c072f0b0386539deca4c62791f7597df42", + "supplied/builders/agentB_lp/tools/ystats.py": "8097c39bb73e3a3fc006c3c05dc09292b079e2f56f7a565730deeed10209de78", + "supplied/builders/agentB_lp/tools/ytrace.py": "37df777ae1f76d8b03621fb60cd8960c77e1cefca21ced6b53f5a74c991d46ee", + "supplied/builders/agentB_lp/verify.cpp": "43a768d7de0837a353694e060d8a43cd9ed8e0e4e1e8bb7b28ef8de9db2c04cc", + "supplied/checkers/independent/checkT.cpp": "dd011bb4262536d61ed339649c053e759487657aa0712ba13d2bc2a4031dd298", + "supplied/checkers/independent/exactnd.py": "45199ca15293d5f01dd9280e118aa97c64d1a5c03cbc5fc4cda5d27b1ededb1c", + "supplied/checkers/independent/exactprice.py": "9df22ffe7d89e3b907ad0a44ab84e7a6cd2edbff8b965631436d767d604eea57", + "supplied/checkers/independent/sub.hpp": "eeffaff81f4a3a49a4cfa937a9a44718eead51fb530b22b315e64419c8c2edd2", + "supplied/checkers/official/cohort-five-stage-columns.cpp": "cf9657e2407264120673f34659df79362dc132886d6e62dda96e44d085b61ed1", + "supplied/checkers/official/cohort-legality-independent.cpp": "4230ce06b6563f1902e9d6f6698dfffa4d31fe13a31b5cb7edb9a811f865bb53", + "supplied/checkers/official/export249.py": "6c9aedb8fb4f2d560aca6cfc32ec967e003c0e623cc345040f108101ec1b442f", + "supplied/checkers/official/json.hpp": "aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63", + "supplied/pricing/base_two_moment.py": "aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098", + "supplied/pricing/cost.py": "d55d2b865d1c3d35e343e1a38c592b9172ed8e2596d1107e34d92e2a80c7d03f", + "supplied/pricing/fixed_prime_math.py": "fb8f2cf17eec6e9996200f01d4f11e2d4f45a2d98d96105c7113ff5c58108125", + "supplied/pricing/kappa_w.py": "973b9c86dc90945293f720ed43c0f2b89c85cc24beb8511991353dc3f5fab574", + "supplied/pricing/moment.py": "9d465c716c6b910ff66e1453e3bf0057608a787b5f5361be93781f42cb3370f7", + "supplied/pricing/outer.py": "c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c", + "supplied/pricing/simf2.py": "506d059fc2d4e7dfbe64c09708c964c1f603f79782db5a9887120b2ec266f2ae", + "supplied/receipts/checkT.txt": "f9fb463a0687e29c4f333ae8941f3f411a77b393973730087725807f5fe4684d", + "supplied/receipts/cost.txt": "bcff618c1a0926756e089ed9e9dd0e79e19b931858fec11233ff7351c1508ac8", + "supplied/receipts/kappa_pr193.txt": "2966e1eb48f6eb3b26a6b023704e23990bfd10ef473a05bd6f4860860ca5f813", + "supplied/receipts/kappa_pr233.txt": "48668ea856c6030ff816a95c0007b9575adb54fea1d51dca9b176370454beff8", + "supplied/receipts/kappa_pr304.txt": "814d31c13477b3b5d8e625b3ebf14d8b8bea93760f30fbd0966c197e486eea93", + "supplied/receipts/official-five-stage-columns.json": "5bfcdb98a4b69ade96e9942bbcc83a39275fd11517b1a634f4120b4e279f23f8", + "supplied/receipts/official-legality.json": "89e7a0494917c61087fac77470e6274c18cdfc205e01327648f5e979db4fabc4", + "supplied/receipts/pr256-complex233-verify.log": "f7b8a595c4d40caad361ccf8b622583b110b7398265993f052f6613023b1be13", + "supplied/reconstruct.py": "fb4b6e2c84eb88bf800548bd46bacee848908bc38440cf3c8e0905ac7fc0c23d", + "supplied/verify.sh": "0ecbbb197fc9f6cb88ae51be3accb30e7238114c7ae12395feea9485d93e9a07", + "supplied/word/COHORT249-FRAMES.json.gz": "21d7e762ce50c5f364adac714b98d831b7a5b444fe1d3648794f6c866f6c0d4e", + "supplied/word/COHORT249-INITIAL.json.gz": "cd7482ca65e84cef851ff207979f72b794491533ae43aa2fce9b12c98412e620", + "supplied/word/COHORT249-RECORDS.bin.gz": "c5c2039a5fc6a29c3e1337b19cd59d3173c5a7d849988c072f75a1e223593e68", + "supplied/word/COHORT249-SELECTION.json": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945", + "supplied/word/w3-249-states.json.gz": "67a2d632e1b2c91f3d599f36d8b63c5811d7f8924f74537c72f57384a5462728", + "supplied/word/w3-frames.txt.gz": "d3ec8449d608351b62b0b9865e0bf02e6867b67e76665fec359890a723b38898", + "supplied/word/w3-states.txt.gz": "da66524b57ece03ece930e050368b7fc531ab9cf6a5976eaf72f4c9b99f1af87", + "vendor/bits/stdc++.h": "3c9b0c098e13a5c698a8528ec23ca00471195b10683753b74e27b95422b7e877", + "vendor/json.hpp": "aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63", + "vendor/pr249/BANK-PROOF.md": "e75edfcb4efe4cad1bd38a5e18a6c5fd323e6e2b34840e9ed09863da85ec37cc", + "vendor/pr249/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "vendor/pr249/MANIFEST.json": "86e8bc5182079c00877077c8e4c7b2690ba2486bec385c0857f1794cd2e6bedb", + "vendor/pr249/NOTICE.md": "9a659cc2f96ae7e0eda99954941c42a4529bc885fb1de161c44ea801ff36e480", + "vendor/pr249/PR-STATEMENT.md": "fbb2b3cda4d6030c09162a87aee7c9c4473a2d3ac8fd9aa5ec0332ab6880bd08", + "vendor/pr249/PROOF.md": "69c3066adbe1664aacb03744328c79738649d576529a25f962035d4e479faf81", + "vendor/pr249/README.md": "571bb4d1b658eceb4f692c2746ffff9817ac57f8cbac2ae38034adb698192866", + "vendor/pr249/UPSTREAM-PR234-NOTICE.md": "ce978c8dfc8a2b36eed7a53014b1a792248b22ef4cee3edd8adab825a571c429", + "vendor/pr249/UPSTREAM-PR234-PROOF.md": "c9722b07256758cd3b307dd46689f99984c66e16c3dd934f9c34e551620bfc0f", + "vendor/pr249/bank_check.py": "3fb3ac24c3d671d0bc97a526996c760d5d63e3f8e0478155135c813bf1e162cc", + "vendor/pr249/bank_template.py": "60af020ddacc634d284aa54b7ac2db7894369fa96b4878cac60cda1ce748f64d", + "vendor/pr249/base_two_moment.py": "aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098", + "vendor/pr249/code/complex_basis.py": "52d68781eaf6d9decf02446a532a7336fcf15924a9f6781ba0833d038decb9f8", + "vendor/pr249/code/complex_labels.py": "ff5d5e914ef1be0f0cc30283a1ee39089b77e4b572f09543e7313d126bd26256", + "vendor/pr249/code/complex_scalars.py": "fa035447c1f3a5e878dfc18a900942aa180d8bfde03cdce2d21d9bf8b8409429", + "vendor/pr249/code/complex_splice.py": "ed8f7f55530bab64e25b98ee614e1152ded8a6259c48d32b3ae26bab4b93848c", + "vendor/pr249/code/geometry527.py": "bff96140e93c0cea01ed618b49b913f913c12d99ebb0e4e4342336cf5a102800", + "vendor/pr249/code/global_lowering.py": "3a851ce132e4b08127c4f51b3d10c91ea24d0140260306cfccee9e6206225a3d", + "vendor/pr249/code/physical527.py": "1723a5c53ec236529e46980c8eb2c45134c61275ac7fb85c8ad92223784de07c", + "vendor/pr249/finite_check.py": "286618567a721052b6fde92d6742c3a43784e7b2994770ac3f9807cafacd55b0", + "vendor/pr249/inputs/complex/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "vendor/pr249/inputs/complex/NOTICE": "9419dd03a2f52cf8bdfc4d18216ce29f263ab583b27f01ced8e420985bcb7c81", + "vendor/pr249/inputs/complex/gcert1-p11-pr193.json.gz": "15251deb0c11e0504d7b297c9786818888a93f08b92b03c6c122784b70488633", + "vendor/pr249/inputs/complex/retained/FINITE_BRIDGE.txt": "66d8f4ea8752abd89952d6674a636575a0db16e18b1c16e293f48f64242f0c46", + "vendor/pr249/inputs/complex/retained/compact-control-layout.tex": "2bc28e50f3eb092195294cafa81213e520f6d42e7935e9905ad8a6199e2a7c87", + "vendor/pr249/inputs/complex/retained/compact-control-movement.tex": "b963c3d2f4e1b7059aa289bb4b4ac89b688920bcf42f5b20d7698cdef0132cc6", + "vendor/pr249/inputs/complex/retained/copied-centers-assembly.tex": "00117892971ae766188ace0af03030c44164fda105e42b70d84f52c3339a7dcb", + "vendor/pr249/inputs/complex/retained/copied-centers-lemma.tex": "d0ce6d3d504996aadb098227885224e48df46101daec8893523a0a8b7364d8fe", + "vendor/pr249/inputs/complex/retained/endpoint-gauge-complex.tex": "dfee33b0281e5551bb6927f757ff0240abade60ae1800f715afd88853ae0191e", + "vendor/pr249/inputs/complex/retained/general-clifford-frames.tex": "c9bb9655b594583c6b4bab8cb485233f1d1e588f83858cf1e4c3530cee8fed54", + "vendor/pr249/inputs/complex/retained/stopped-product-complex.tex": "4738089103a4b263b3b0ef458f5ef35519c696f1ea871ae79e508d3720f5870a", + "vendor/pr249/inputs/complex/source-pins.json": "de0daf6847185d7a6911535e3012c1a91de1e32b5da8204beec26b37523ad569", + "vendor/pr249/inputs/complex/sources/Work__Bridge__Cert.lean": "5c24746a6330907b9b37d6064095035a58575d64ce793d6d7c9881121fdc3980", + "vendor/pr249/inputs/complex/sources/Work__Bridge__Net.lean": "cf7d7d330b1bffe2e66712c873e647b13dc32db1ccfc0e0f4cd62ee6caf584f0", + "vendor/pr249/inputs/complex/sources/Work__Carrier__Live.lean": "6d0649eb62589e66057f044e1e2103fc42f3f57a1498f82a26565bd8eb4026d0", + "vendor/pr249/inputs/complex/sources/Work__Carrier__Phases.lean": "71dc3dda23dfe510d5d53cbada3a6c540cd1dc2825503fda618a5bd6cfc3e812", + "vendor/pr249/inputs/complex/sources/Work__Fourier__Main.lean": "2e8e88efd4dcbdf0b1a6e39ce7eea8c5fd5ffee2faf360a8c0c9cba84c0e4ef3", + "vendor/pr249/inputs/complex/sources/Work__GCert__Chain__Geom.lean": "c302f5834287421f11f3b0da7112fcde876cbc702896f2af4145b2d72ee393a2", + "vendor/pr249/inputs/complex/sources/Work__GCert__Chain__InvThm.lean": "ade7e7873da75ca63a4b5ce2f562dde9c12bfbb69d87d7ae831039ff790e5adb", + "vendor/pr249/inputs/complex/sources/Work__GCert__Chain__NetCert.lean": "22ae34809466b4ac2a2c5cdde526f51ff246f5189f7c142b38aa4c0dcffb04a4", + "vendor/pr249/inputs/complex/sources/Work__GCert__Chain__NetDef.lean": "6e17a68b1e988969f6eb77000028f7ed877e687b8ad3976ec1707fcfe1d2f520", + "vendor/pr249/inputs/complex/sources/Work__GCert__Chain__NetStage.lean": "c122bc01392a6fdcc0bee918fed81804d3c9b1d3e071016dab65a4ed804ef0b6", + "vendor/pr249/inputs/complex/sources/Work__GCert__Chain__Phased.lean": "0de429c80231334f1ce92575c1e8ac382ca2d5e7d956767b547639a8941d9a8c", + "vendor/pr249/inputs/complex/sources/Work__GCert__Chain__WinB.lean": "c33ec3fce09c0971c32ddcbb86d9383ffbe4c6d05cf36f20460005e6547bb845", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__B2Gp193Main.lean": "cb61f304da51f1dd0a2ec25bca4b63eb095eeb2863289e1e2bdee7c82beff48b", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__Glue.lean": "d5314f2b93a7f0e1c949fb502331825bfc6d9d8762d35f865443e7c95b6c7ef7", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__InstB2Gp193.lean": "9587ddb9961f44938032b609307ab91c0b0e757e3991f1ad95480dd50fd4f72b", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__P193Cert.lean": "d92ee6889be4753fc99f467bd84039743325123a1165128378b9c906a04f2703", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__P193Price.lean": "0299bcd0fe255960eec682eef0f045f7e5cb1e4711af2aab4393526eae2caea3", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__P193ScalOK.lean": "479434815822e98f015e335361089c3788d00dc3dd39c2944f75410aa0c158fe", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__RateB2Gp193x.lean": "6b40cac1481c931d47b1a092e382d04716ede0e785c492a2f2983e886a257c3f", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__Raw.lean": "aba94a004c94dcae7cf3047c88a6da9561555f4ebe8ab92e299e6ce09ee7aa66", + "vendor/pr249/inputs/complex/sources/Work__GCert__Data__SolutionB2Gp193x.lean": "45c768c9d71a7cc18bd6db74cb036db880d89580ca60557bb4a492280296b169", + "vendor/pr249/inputs/complex/sources/Work__GFrame__Engine__Adapt.lean": "feec0a3828867968a5c7c2c30b86ed70449abc3c660a60ada67203a75bae2ef7", + "vendor/pr249/inputs/complex/sources/Work__GFrame__Engine__Letters.lean": "34906dbf5ae16b5174db00b4881a5cc1d2e583b8c8806db6523a5e2f86565f09", + "vendor/pr249/inputs/complex/sources/Work__GFrame__Engine__Level.lean": "80fb3daa9a45de0ed6da570eb4476b9104734be65d0116f58bcfcbcd67f771d0", + "vendor/pr249/inputs/complex/sources/tools__gx__ORIGIN.md": "6ba897a9495ddadcf8558b93133fdfaf66fc35ce7fa2c53e2d5667335c315e0b", + "vendor/pr249/inputs/complex/sources/tools__gx__gxbind.py": "9c9dcfac47f0535bf3aa8ebf7c662cdef0ebda50a9f0a9282b8f3cf34809f835", + "vendor/pr249/inputs/complex/sources/tools__gx__gxconv.py": "dab7fec9f44c2d368ed334055d7126e202017feb46e41a8d86e2d998720f67c2", + "vendor/pr249/inputs/complex/sources/tools__gx__gxcore.py": "eb972c06fe8c322db2d9a8d9a7d05596e8f40c4ca8e5f42eb6df3c7361b5d517", + "vendor/pr249/loader/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "vendor/pr249/loader/MANIFEST.json": "a1b6da7191f3bc0109dac63ae96122dd9f5174743909daf5e0bdcc8e9cfbbffc", + "vendor/pr249/loader/NOTICE.md": "ee632728cc4d89565292d288f8289f483ac794b5d02cc6e42c2b2c43c43ff1d8", + "vendor/pr249/loader/README.md": "4c36794b0f702ed521c0a7eaeacb1b7cc258760d59193cc8eb29be590e709dcd", + "vendor/pr249/loader/SOURCE_PINS.json": "5a4fa413ea0ecc74050359329e90521723151e421cc0c19f774b92bd608a3ac9", + "vendor/pr249/loader/expected_ledger.json": "4910004287e016f7f2db10f0a54eed24bf1912aa148b347b3cb4795fa3ac63f5", + "vendor/pr249/loader/expected_semantics.json": "b7de3178436c824b6be6d99842270a82e1821b8008dda66d8b18519ad347da2d", + "vendor/pr249/loader/raw_ledger.py": "89ba53114488a77a12b941db2787850c2c41612ad0332c47699a011c0c596b32", + "vendor/pr249/loader/source_inputs/base_bit/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "vendor/pr249/loader/source_inputs/base_bit/NOTICE": "c9850418622aea8d1382a230306c940947b5da818f4854b4b272ed60cf239f6c", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/bit/base_word.py": "9fe3a81b7561d2b09c086f63fac4626e88a32369ef8bc5579c94878de1218a89", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/bit/word.py": "85822e9cca5b1b2335c3704a3df2f3c6ef01e42d8328daacb33701d30cee80ab", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/references/pr168-v4/research/paired-cube-bit/check_paired_cube_bit.py": "4d7c86cd999a1519e0dfb6dcf33a8f26e442a353c3665a0f06881216a260fbf3", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/frames_p12.json.gz": "ad8e2705652b68476713d7647a8592505e222f2b3ccd1728dedce153aac6d462", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/graph_p12.json": "31a09a55920e64c8bfbac8b845dc01754c112aa6e207812e2fd1f4939d8f64cb", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/kchron_p12.json": "0fab548e84cf5ca7c04e8bd19b5810850463f36e0f92180efe73aeff17105e39", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/profile_p12.json": "c44ef8640cbcbcc9bac3a30e13373bd79efddde55d7cea514354ca2cdb60d66d", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/sinks.json": "c00ff70c564829d4b97740f92796fc6ce14fbcd5ca519663828650552b80249d", + "vendor/pr249/loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/word_p12.json.gz": "1cb7e8ed45cf542e304fddc4b12247dbb248a0dc84dedbd832f336b2d172793a", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/NOTICE": "9fc5561c0995892dbdde777c713899486920c32d3562392f5f72377a4953bf98", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/borrow/selection.json": "6932749407e14b199651f0a7deff02c6de74e2c1be0a1300263f1e164927fb8b", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/frames/opframe-bases.json": "687496f3c15818e7cad1beb5fdf3812b8e38825ea302bfd60aea7ac23f3516b4", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/gaugeb/selection.json": "b0f9f0e67f94a3c21069f393ea27f9483d315bff2f53f77270163065a6345d1c", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/joint/joint-selection.json": "13f6420d6c341c22235c9d136d5f7c32896974bb165a893fecd7e583b790d133", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/joint/joint_word.py": "de37cbed753fc6f13a7e5dc25c8346279cfee5f1868df8c12a5fcb6ca8f631c0", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/joint/pairs.json": "da54b863601b5cbc21d27fc5cd623bf805f974a3e47b81ed29a85aa5bad0fa05", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/newg/replay.py": "0cbec81a11e758156e9303f63dc8c617601da69523073fdf2a77394d76acf56a", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/newg/schedule.json": "ab39d61fff7a2cfcb13e2c10d65f2c603e76a91013d197260d6c7b645ccb27a1", + "vendor/pr249/loader/source_inputs/pr210/research/coordinated-crossover-pr200/newg/selection.json": "d94ef4e0b8ca98a7385b364cf245816a7cad08f850a60ce8b67aab4c3a89f3f4", + "vendor/pr249/loader/source_loader.py": "e5e19ee6d6899fce8273d0f06a49caf7cd8bfe940a2a9a103dbc9d3a62b6b291", + "vendor/pr249/loader/test_public.py": "2103c953b37cf447d1a2bbb86c26f96fa5569a3ab018567e93884c12ebde8a2d", + "vendor/pr249/math_check.py": "33dba4c0d203212cf5731a2094237774443725e832d419dc89c528187e52d671", + "vendor/pr249/moment.py": "9d465c716c6b910ff66e1453e3bf0057608a787b5f5361be93781f42cb3370f7", + "vendor/pr249/outer.py": "c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c", + "vendor/pr249/parity_transform.py": "ef6f5224b91c409c30fc0886143787a0839a13cc6b148e42ca5db858d502ec4d", + "vendor/pr249/portable_bit.py": "2bdf814013e46c3245fc67c5d152c3b13245d562a247410671575008f2007af1", + "vendor/pr249/portable_complex.py": "797e144c0040d78a4731a6eaa61c0edb9803a08462f885ed014cbca9d9991d82", + "vendor/pr249/prepare.py": "fc109fe81d7d9d3f53483ce7d648dc9fcf6d9fb71b8fde1c867ece5283fadbcc", + "vendor/pr249/prime_check.py": "22df1899dfb3b61e394bf1bca178b2a8846e1434ce12df3bf58fdee77f3283cf", + "vendor/pr249/prime_witnesses.py": "98cd03bc9582e7bd0ab194c191ea8eea940539e510051443ab9fd3e572a364ab", + "vendor/pr249/proof/FINITE_BIT_ACCOUNTING.md": "602923520af184670170bf159fde7b4c72e79a72570eddd7746b7c97bc51fc5b", + "vendor/pr249/proof/INTEGRATED_PROOF.md": "cff22391e71a50bad27a1e832d5c0a2c8b2446df55adb1297c8b1485b3761257", + "vendor/pr249/proof/PARITY-CONTRACT.md": "a9246be656e31f1a21d5ec714e002f51be0aa07c36e1528066a25b2c7a02db91", + "vendor/pr249/proof/copied-centers-lemma.tex": "d0ce6d3d504996aadb098227885224e48df46101daec8893523a0a8b7364d8fe", + "vendor/pr249/proof/primary/03-motifs.tex": "ed76761194988a01af77ead0ea6469cb5dcd29690ab985a0b5a4006b0f2b69bb", + "vendor/pr249/proof/primary/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "vendor/pr249/proof/primary/PROVENANCE.md": "dd9054c58aa92c44b0ef5f691ad4dc52b8ead2f20a9843d4399d6c300d616023", + "vendor/pr249/proof/primary/UPSTREAM-README.md": "8d1ceff898a4e0e681679f91c4def485820be9e99f04e4861f2ce601a364723e", + "vendor/pr249/proof/three-stage-cover-bit.tex": "47123a756f823c83a0d48cca2bf5add6472cd88410b13aed345e70c8834fb511", + "vendor/pr249/proof/three-stage-cover-rows.tex": "6ad97a5cd7d6aecf978a81226e1c2763d37840caca130c61f3bf5c4ac111c5c8", + "vendor/pr249/raw_ledger.py": "d5dae7b56d403adb778251e4b42903695632d522c1392505723e2125162cef78", + "vendor/pr249/regauge-selection.json": "135e314f37bd611a021776991c9d786377b3829f84ca576d5006696c2d8bfbed", + "vendor/pr249/regauge_transform.py": "baa1c7390f449722e7e700fa1ce9afc3d00cd4c0f7faa5f41693ff88ec02fd61", + "vendor/pr249/requirements.txt": "25f9f1fb1988b230147a1d3092d34e09c069eb7a6c6d6df46b3973b9f2d36efc", + "vendor/pr249/retiming-selection.json": "b173080a2884d5bfb28e35ed5b4256e233cafc6275cbfe5a76619b406f2ce989", + "vendor/pr249/retiming_transform.py": "483cb8da83a1444cbc8b1bbe60473e571a27e6e589fa64f9a26910ca0d678407", + "vendor/pr249/scalar_check.py": "d87c3cd39313d37cc1403a24e01ad383c146c295968fd41a68c345a4b5adba80", + "vendor/pr249/source527/echelon/selection.json": "8e6ce5e257aa7656898ab46bc3421df4a619497b1e9f5956d2c546b3014050a7", + "vendor/pr249/source527/extra/selection.json": "791f6ddeb19add7026ba37461256c13efe3d35bba0bccf1cb9787a01fc16f0f2", + "vendor/pr249/source527/extra/upstream_setup.py": "a7789d13eda75e78108cee84206692c913f63aafdb9e3e633fddd14640e4678a", + "vendor/pr249/source527/fresh/selection.json": "4df5f96064349415882ece4ac9abd19cc778f18c0306a27b3d65027dcb04b6c7", + "vendor/pr249/source527/fresh/upstream_setup.py": "dba4e53f235ca446095eb834313c59f80b5aa0e4fdfb24c5c2eebc26ac11d412", + "vendor/pr249/source527/paired-selection.json": "67a24896e5ff6a16735efdff57fbb875aa411aba00cbabb22c43a91cdf63e084", + "vendor/pr249/source527/pr230/NOTICE": "7dfbad087ee49b74fd5075d517eaa263c5dd3d4fbd4c69bfba34ee1cb55e837f", + "vendor/pr249/source527/pr230/PROVENANCE.json": "19957e28a8ad26281bfe8bfaf8ae16191be53e729a8870a6154671b3384959d4", + "vendor/pr249/source527/pr230/active-opframe-bases.json": "9a2bba5c72aebc9ee4f21e59b10ce810b2da98a1fa1748fbc44c50a080e584ff", + "vendor/pr249/source527/rank/selection.json": "5c97c6413f1eb56c7b8f9ba9e839329d212fae7ac3a08c29e9efdee42f5048a0", + "vendor/pr249/source527/targetagg/selection.json": "b7a4d5eb2a6d2f7df867f9be5af7da1d1aa99cfbd5214195967b0ff60642d77a", + "vendor/pr249/source527/targetagg/upstream_setup.py": "fd7adf0b12d0769e06438b2ee4322bfcb180d8f73a1104a3eb805ab88c5cc393", + "vendor/pr249/source527/word.py": "e675d4eb9d90ff0b44279fae0b46f1a8b39f65421cc38454b70a6b75d0e10b42", + "vendor/pr249/verify.py": "4fc103389c1c62bd0ea5b39f9d41128db30dde4475370394bab600a0acd52e9a", + "vendor/pr256/NOTICE": "c1c95d22cfb0f455aca64b4bee4cab900829641b8f041280e7aa88034491c87d", + "vendor/pr256/PROOF.md": "c878c1a32e9a26bc3965b8843688d6e039094fb9c6b7fa1ea10579d727e70947", + "vendor/pr256/README.md": "00ab1525204b8130177658dfcb1acc201986c5ee06db27525ba80d57fb8edffe", + "vendor/pr256/SOURCE.json": "9ce463476af549c04de4705b1bf0c8f7f18d473dc0817883066ad5e2136d90b5", + "vendor/pr256/certificate/expected.json": "c0e3d245bf7e458ff86288eb47672491c9efee28181b570f1a3f17c8d915f766", + "vendor/pr256/certificates/gcert1-p11-pr194-flow.json.gz": "27c5b436af4b0683dd161e7f1253661427c45a1493c8dc90fcf0136fbba063ae", + "vendor/pr256/certificates/gcert1-p11-pr233-flow.json.gz": "09ceba1c0ea17282da155b937c8463669b913443c20f45fe2a7e6e024cb2d33a", + "vendor/pr256/gcert_emit.py": "10d2fc3f1f3d8cda5f0b07720f51b5a6fd40cfc1490d361939ff93e5470805d3", + "vendor/pr256/gx/gx.py": "6f3dc8bb639933227a8dae181ec4a542e85c7276be9c9e330f49518e7b630b95", + "vendor/pr256/references/pr233-layer/NOTICE": "5826b9f155b70d496d729cbaddeadb881abfb68da77f82dfc1746ddfc753313b", + "vendor/pr256/references/pr233-layer/SOURCE.json": "9ad0549ba2403e8d84d7c0c8e71e5ca952a0604ad626f403426164bd4bc2982c", + "vendor/pr256/references/pr233-layer/baseline-pr202.tar.gz": "5d08386f71c421d2b83b21020e3b74198e9d0c75884d7d81987307740d98883f", + "vendor/pr256/references/pr233-layer/certificate.json": "691cb0aaeb0d6b993e1e1e5116ae7a5c57af058a8c413249016347d1b40d3b90", + "vendor/pr256/references/pr233-layer/verify.py": "cd61a8c61462b4eee95c0858335a9a11bdf1ff8e8e63ebb1e488da29f061ca71", + "vendor/pr256/references/pr233-layer/witness/kernel-pairs.json": "e33b753fc4519170373207b0527b9cb53e0b552e2a27f48f72381a881c7a227f", + "vendor/pr256/references/pr233-layer/witness/physical-frames.json": "1a6c215cdc58216f7ec96fb898a471e25d094fd86de085f6c06e86fd8997bfad", + "vendor/pr256/references/pr233-layer/witness/physical-pairs.json": "e6409fffbf5f3b1ac6434acf2e426503de3a8a18537b8fee761fc4fc931fb896", + "vendor/pr256/references/sussman/pr193-blocks.json": "4049d066f71119fa72bbc37f7db753ce1e79ae5a69aef9cd2651d618bea5c855", + "vendor/pr256/scripts/moment.py": "0c7c68122cea18503e973ccf0d244adf8fa0edab95f104393528c6c57f24863a", + "vendor/pr256/verify.py": "7c4e140a41f9cb1e3bd7ca4eb06e5bb811f583250063ae53a48d39826796261f", + "verify.py": "c2f80a91c817e1f30c7db2ea674672e864b348434a8c57f7890d0b4b649b8688" + } +} \ No newline at end of file diff --git a/research/w3-restore/NOTICE.md b/research/w3-restore/NOTICE.md new file mode 100644 index 0000000000..46d6dcc375 --- /dev/null +++ b/research/w3-restore/NOTICE.md @@ -0,0 +1,38 @@ +# Attribution and scope + +`w3-restore` is rohanarun's PR #311 package (utcorvusvolat-dotcom's PR #310 w3 word and admission chain with eumemic's +target-prefix squares) with one more native stage: utcorvusvolat-dotcom's PR #280 early-restoration screen and emitter +(`code/cleanup*.py`, re-pinned to this word, 438 of 440 helpers), PR #280's endpoint-aware bank accounting carried into +#310's `code/cohort-bank-review.cpp` (endpoint residuals, a plan-driven tiling verified in full), `inputs/bank-plan.json` +and the re-pinned chart/price/finish literals. Prepared by Rohan Arun (rohanarun) with Anthropic Claude assistance, +Apache-2.0; no exclusive priority is claimed. #311's notice follows unchanged. + +--- + +# Attribution and scope + +`w3-target-prefix` is utcorvusvolat-dotcom's PR #310 package (the supplied w3 word and its complete admission chain, +on the PR249/source527 lineage) with one added native transcript stage: eumemic's PR268 target-prefix compression in +the native-transcript form of rohanarun's PR #273/#281 (`code/target_prefix.py`), a frozen 209-square selection +(`inputs/target-selection.json`), `code/recompact.py`, and the re-pinned chart/price/finish literals. Prepared by +Rohan Arun (rohanarun) with Anthropic Claude assistance, Apache-2.0; no exclusive priority is claimed. #310's notice +follows unchanged. + +--- + +# Attribution and provenance + +Publication and admission prepared for **utcorvusvolat-dotcom** with substantial OpenAI Codex assistance. The finite w3 word and its cube-layer/twin/line-pair redesign were supplied in `w3-bitword.zip`; their original README, frozen data, diagnostic checkers, receipts and builder provenance are retained in `supplied/`. The provided builders identify Agent A and Agent B; no additional personal authorship or priority is inferred. + +This package adds complete source binding, active-role deletion, concrete completed-bank allocation, changed-projector and annihilator admission, the full finite invoice, the stronger complex supplier's scalar/precision interface, and the source-bound orchestration. Original upstream license and assistance notices are preserved; credits do not imply endorsement or review. + +- eumemic: PR249/source527 word and machinery, the paired-cube physical emitter, transported dirty entries, exact arithmetic engines and prior PR168 lineage. The full unchanged PR249 package is in `vendor/pr249`. +- Dugongue: the multicut/cohort native checker and bank-admission lineage in PR254/259. Rohan Arun and Chafik Boukhalfa: subsequent PR263/266 composition and source-bound native packages. The supplied official legality and five-stage checkers are retained unchanged. +- Evan McKinney: completed-bank method (PR197); Rohan Arun: width-120 five-stage application (PR237). +- Henry Grant (hcg890) and Jacob Sussman: five-stage construction and certificate interfaces. Jacob Sussman's gcert reference checker is preserved within PR256. +- Chafik Boukhalfa with Anthropic Claude/OpenAI Codex assistance: PR256 explicit PR233 complex program and regeneration package. Its full `NOTICE`, proof and source pins are retained in `vendor/pr256`. +- icekylinx: paired-cube and flow/lift framework; Avi Eisenberg (ikeboy): complex supplier lineage; eumemic: modules and frame design. See the unchanged PR249/PR256 notices for their complete chains. +- utcorvusvolat-dotcom with OpenAI Codex assistance: PR270 source-bound connected-block work and PR280 changed-projector/finite-admission tools reused and adapted here. +- Niels Lohmann: `vendor/json.hpp`, MIT license in its header. The small `vendor/bits/stdc++.h` file is a portability include list. + +Apache-2.0 applies to the inherited Apache code and these admission additions, subject to the preserved third-party notices. Generated Python bytecode from the supplied archive is deliberately omitted; the supplied original SHA256SUMS remains provenance for the archive, while the root MANIFEST.json is the executable package's complete file manifest. diff --git a/research/w3-restore/PROOF-PR310.md b/research/w3-restore/PROOF-PR310.md new file mode 100644 index 0000000000..4e2e1e6766 --- /dev/null +++ b/research/w3-restore/PROOF-PR310.md @@ -0,0 +1,47 @@ +# w3 construction and admission argument + +## Finite word and geometry + +The supplied w3 word has 20,107 logical roles, 1,760 sources, 1,760 targets and 16,587 logical helper positions. It redesigns PR249's cube and line-pair layers while retaining the paired-cube decoder and five-stage interface. The original builders describe the design; this admission directly checks the frozen word and does not require missing discovery pickles. + +The official chronological checker replays every MOVE, common-frame ADD and copied-center lifetime. Initial source/target frames and source covectors equal those of the regenerated prerequisite. Changed helpers are disjoint from source-owned and donor roles. Each new frame has an integer full-rank basis B, an exact full-rank ordinary annihilator A, and B A^T = 0. Full rank modulo the auxiliary prime proves full rank over Q. Exact rational Gram inverses establish nondegeneracy for G = I − J/9. Thus the tested nested forward inclusions also give the reflected annihilator inclusions. + +The complete F₂ all-column identity is checked both on the logical word and on its compact physical word. The signed-integer endpoint of the parity word is not asserted to equal the original integer producer: the F₂ payload identity supplies the bit contract, as in source527. Signed coefficients are retained for exact inverse semantics and cancellation-free finite prefix bounds. The original producer's independent integer-decoder proof is freshly rerun as a prerequisite. + +For each helper whose initial frame is FULL24, no MOVE, ADD, COPY or ERASE may reference it. All 1,455 such positions satisfy this condition. Removing them by an explicit order-preserving register map preserves the entire active scalar map and chronology. The compact five-stage replay then checks all 22,172 physically present formal inputs; these deleted positions are not charged as live banks or selector assignments. + +## Exact bank packing + +The active residual ranks and populations are 4:2200, 6:22, 7:5, 11:24, 12:13, 23:810 and 24:12058. At 40 replicas per stage, use these width-120 patterns: + +| Pattern | Banks per stage | +| --- | ---: | +| four rank-23 blocks and seven rank-4 blocks | 8,100 | +| eight rank-11 blocks and eight rank-4 blocks | 120 | +| four rank-7 blocks and twenty-three rank-4 blocks | 50 | +| twenty rank-6 blocks | 44 | +| ten rank-12 blocks | 52 | +| thirty rank-4 blocks | 973 | +| five rank-24 blocks | 96,464 | + +These sum to 105,803 banks per stage. Every active role and replica receives exactly one slot of its residual width; every coordinate is covered once. Five separate stage inventories are enumerated. The literal stock is 4·1760·40 + 5·105803 = 810615, normalized by five to 162123. No divisibility heuristic or fractional bank is substituted for this allocation. + +The projector charts of all new frames are constructed exactly. The changed connector set is derived from the actual baseline and candidate words; every changed helper endpoint is included, including zero residuals used only to certify deletion. For each required projector E, the checker verifies E² = E, its exact rank, and an explicit invertible C with C⁻¹EC = diag(I,0). All 20,844 distinct changed projectors pass. At most 342 row factors are required; the retained conservative normalizer 787 dominates 342 + 119 + 120. All enumerated bank patterns are independently replayed on endpoint columns, with nonzero omitted and repeated block controls. + +## Stronger complex supplier and scalar costs + +PR256 regenerates both its control and the PR233 complex word from pinned source, runs gx.check1 including the exact scalar identity, reproduces the committed certificates byte for byte and certifies the PR233 five-stage saving 7547/10^7. We separately rerun the source527 label, scalar and splice interface on this actual replacement certificate. The live and physical stocks remain 14692 and 24127, with dimension 110, helper count 9412 and maximum child 46. + +The replacement contains coefficients beyond the original finite scalar lowerer's numerator bound of two. For q = a/b, 1 ≤ |a| ≤ 5 and b in {1,2,3,6}, the literal expansion copies the source to one disjoint work stream, halves and/or divides by three, performs |a| signed accumulations into the target, then clears the work stream. This preserves the source and uses no additional recursive child or odd divisor. Its exact Gaussian primitive count is 2 + |a| + [2 divides b] + [3 divides b]. Both orientations and every scratch lifetime are recounted, and forty exact recipe evaluations verify the identity and independent primitive counts. + +The newly counted local bound is below 2^48, global logical groups below 2^6050, routing below 2^30000, literal charge below 2^100000 and the semantic bound below 2^210000. The physical row coefficient 16171 fits the retained 20161 reserve. The original coefficients' stale numerical bill is not reused. + +## Finite bit invoice and exact assembly + +The normalized histogram equals 40 copies of the actual local MOVE/COPY histogram plus 28160 copies of each idle rank 4,23,46,50. It has 3,678,640 recursive calls, rank mass 19,419,560, stock 162,123, deficit 35,200 and maximum child 50. Literal counts are five times normalized counts. + +The invoice uses the 15,132 active helpers and actual banks, expands every signed ADD by its absolute integer coefficient, charges the full routing, primitive, coefficient, wrapper and selector costs, and retains the computed 94-bit signed prefix bound. The selector charge is 571950677600 < 2^40. The counted primitive coefficient is 58246212755400601 < 2^80. The source-owned selectors, new-frame and changed-projector finite bounds are all checked against the retained prime guard. + +The verifier proves q = 2^127 − 1 by its Lucas–Lehmer test, uses exact rare density 2·120^3/q with the full retained rank-one fallback, and evaluates the actual histogram with both unchanged rational moment engines. Eight positive-gap ordinary levels attain the 10^-27 grid cap. The exact assembly with the admitted PR233 supplier satisfies all 47 strict constraints and seven margins; the adjacent grid point fails for both the finite saving and coarse cap. + +For each positive minimum gap δ, the counted cutoff satisfies log₂ N ≥ max(1, ceil(36/δ²), ceil(2(4+ceil(log₂ C))/δ)). The all-size claim uses the same formula with C_full dominating the counted coefficient and every inherited primitive, wrapper, setup, row, routing and earlier-level constant. No recursive child is absorbed into a finite constant. The inherited uniform interfaces remain explicit assumptions. diff --git a/research/w3-restore/PROOF-PR311.md b/research/w3-restore/PROOF-PR311.md new file mode 100644 index 0000000000..77f17e401d --- /dev/null +++ b/research/w3-restore/PROOF-PR311.md @@ -0,0 +1,47 @@ +# w3 word with 209 target-prefix squares — verification chain + +**Conditional κ = 753508664880762517753401 / 10²⁷ = 0.000753508664880762517753401**, +0.0817% over PR #310's +0.000752893499605334868002344 (the w3 word's own admission), +0.268% over PR #309. + +This package is PR #310's `w3-bitword` package (utcorvusvolat-dotcom's supplied cube-layer/twin/line-pair word on the +PR249/source527 lineage, with its complete source binding, inert-role deletion, bank, chart, finite and complex +admission) with **one transcript stage inserted after the source binding**: eumemic's PR268 exact F₂ target-prefix +compression as the native-transcript stage of PR #273/#281 (`code/target_prefix.py`, rohanarun), applied to the w3 +word with a frozen selection of 209 squares (`inputs/target-selection.json`, found by the same screen as on gen4/gen5: +squares of four data targets whose rank-20 entrance helpers are each read by exactly two of the four, so the +dependent target's frame-20 prefix response is the F₂ sum of its three square-mates'). Its 1,057 frame-20 reads are +omitted; it receives `t −= p_j` at the zero frame at the cut and `t += p_j` at the square's common nondegenerate +21-dimensional frame at the close (1,254 setup/restore additions), so ZERO →(20)→(1)→ 21 becomes ZERO →(21)→ 21: +local histogram delta {1: −209, 2: −7, 3: −1, 4: −4, 8: −2, 9: −4, 12: −2, 13: +4, 17: −1, 18: −7, 20: −199, 21: +209}, +223 fewer local calls at unchanged rank mass 398,897 and unchanged endpoints, entrances and banks. + +The stage recomputes every literal prefix dependency from the actual transcript, rebuilds every MOVE, checks nested +chains, fixed endpoints, COPY lifetimes, nondegenerate endpoint bases, both reflected ledgers and the forward/inverse +all-column F₂ replays with an omitted-setup negative control; `code/recompact.py` then rebuilds the compact record +stream with the same freed-role map. Everything downstream is #310's own checker chain run fresh on the new word: +legality, all 23,627 global and 22,172 compact F₂ columns, the bank allocation (unchanged: 3,026,400 assignments, +stock 810,615 / 162,123), the changed projector charts (21,054 now, 342 factors), geometry admission, the exact price +(two rational moment engines, eight ordinary levels, 47 strict constraints, adjacent 10⁻²⁷ grid point rejected) and +the finite invoice (coefficient 58,167,289,165,918,601 < 2⁸⁰, selector charge 571,950,677,600 < 2⁴⁰). The changed +pins in `code/price.py`, `code/admit_geometry.py` and `code/finish.py` are the word hash +`de63e0a340759bea616e830dfecbd708a1899546d9db2d7da04dc32bde035a84`, 934,582 ADDs, 3,669,720 five-stage calls, the +chart count, the coefficient and κ. + +## Reproduce + +Python 3.11+ (NumPy/SciPy/SymPy per `requirements.txt`), a C++17 compiler and Boost headers: + +```sh +python3 -m pip install -r research/w3-target-prefix/requirements.txt +python3 -B research/w3-target-prefix/verify.py --output /tmp/w3-target-prefix-proof --cxx g++ --boost-include /usr/include +``` + +About 10 minutes; both prerequisite source verifiers (PR249, PR256) rerun fresh. Prints `PASS conditional kappa = …`. + +## Scope + +Exactly #310's conditional interfaces (all-size compiler, common weighted charts, restored rows, selectors, routing, +prime supply, complex dirty lifting, precision/recovery, analytic transfer); not a Lean certificate, an unconditional +theorem or a benchmark. Not composed yet on w3: the restoration, kernel, sink, descent and reorder stages of the +gen5b lineage. #310's README/PROOF are kept as `README-PR310.md`, `PROOF-PR310.md`. Prepared by Rohan Arun with +Anthropic Claude assistance; Apache-2.0; see `NOTICE.md`. diff --git a/research/w3-restore/PROOF.md b/research/w3-restore/PROOF.md new file mode 100644 index 0000000000..bec81cf276 --- /dev/null +++ b/research/w3-restore/PROOF.md @@ -0,0 +1,51 @@ +# w3 word with squares and 438 early restorations — verification chain + +**Conditional κ = 754077687633330234295251 / 10²⁷ = 0.000754077687633330234295251**, +0.0755% over PR #311 +(0.000753508664880762517753401), +0.157% over PR #310's w3 word, +0.343% over PR #309. + +This package is PR #311's (`w3-target-prefix`: utcorvusvolat-dotcom's PR #310 w3 word and admission chain with the 209 +exact F₂ target-prefix squares) with **one more native transcript stage after the squares: PR #280's early +restoration of cleanup helpers**, with its screen and emitter (`code/cleanup_screen.py`, `code/cleanup_emit.py`, +`code/cleanup_reference.py`, utcorvusvolat-dotcom's PR #280 scripts re-pinned to this word) and PR #280's +endpoint-aware bank accounting carried into #310's bank review. + +* **The stage.** At the first `cleanup_gate` ADD (record 962,945) every data target already has its scalar + endpoints; the screen reproduces this on the exact F₂ prefix, then finds the helpers `a` whose only later scalar + incidence is one write `a −= b` with a donor `b` unwritten in between, both at rank-22 frames whose rational span is + a nondegenerate 23-dimensional frame: 440 of PR #280's shape (and 477 multi-incidence candidates at dimension 3 that + are not moved). With 40 physical replicas the restored width-3 slots must tile width-120 banks, so **438** are moved + (438 · 40 = 146 · 120; #280 kept the same 438/440 distinction under its own replica count): the write commutes over + the integers with every crossed gate, `a` and `b` advance to the span `E`, the ADD runs there and `a` retires at + `E`. The emitter checks every new frame's full-rank annihilator and nonzero cleared Gram determinant mod 2¹²⁷ − 1, + the commutation conditions, the forward/inverse/roundtrip F₂ replays and an omitted-restoration control. Local + histogram delta {1: +1314, 2: −876}, local rank mass 398,897 → 398,459, helper endpoint residual 317,409 → 316,971. +* **Admission of endpoints below the full frame.** `code/cohort-bank-review.cpp` now takes the candidate's + `COHORT249-FINAL.json` and a tiling plan: each helper's residual width is dim(endpoint) − dim(entrance) (24 − dim + entrance for every helper that still retires at the full frame, so #310's census is reproduced when nothing is + restored), the pattern list and the expected width census come from `inputs/bank-plan.json` (an exact integer + tiling found by a small ILP over patterns of at most three widths: 105,657 banks per stage, every bank a full + 120-coordinate partition; the C++ still verifies the census, the collision-free full tiling of all 3,026,400 + role/replica/stage slots, the per-pattern endpoint and omission/repetition controls, and the exact charts), and the + bank-stock invariant is the generic one (all slot coordinates fill the banks exactly). Literal stock 810,615 → + 809,885, normalized 162,123 → 161,977; 438 new exact frame charts (3,911 in all, ≤ 320 factors); 22,806 changed + projector charts (2,703 retired endpoints, ≤ 342 factors). Legality is checked against the candidate's declared + endpoints with the export's base frame table. +* **Price and invoice.** `code/price.py` re-pinned (word hash `8f05b2af…`, rank mass 398,459, residual 316,971, + 3,687,240 five-stage calls, mass 19,402,040, deficit 35,200, nine ordinary levels); finite coefficient + 58,322,299,353,183,001 < 2⁸⁰; selector charge 571,950,385,600 < 2⁴⁰; `code/finish.py` re-pinned accordingly. + +## Reproduce + +```sh +python3 -m pip install -r research/w3-restore/requirements.txt +python3 -B research/w3-restore/verify.py --output /tmp/w3-restore-proof --cxx g++ --boost-include /usr/include +``` + +About 10 minutes (both prerequisite source verifiers fresh); prints `PASS conditional kappa = …`. + +## Scope + +Exactly #310/#311's conditional interfaces; not a Lean certificate, an unconditional theorem or a benchmark. Not yet +composed on w3: the kernel, sink, descent and reorder stages. #311's and #310's README/PROOF are kept as +`README-PR311.md`, `PROOF-PR311.md`, `README-PR310.md`, `PROOF-PR310.md`. Prepared by Rohan Arun with Anthropic +Claude assistance; Apache-2.0; see `NOTICE.md`. diff --git a/research/w3-restore/README-PR310.md b/research/w3-restore/README-PR310.md new file mode 100644 index 0000000000..b1dc1f861e --- /dev/null +++ b/research/w3-restore/README-PR310.md @@ -0,0 +1,37 @@ +# w3 bit word: source-bound completed-bank admission + +**Conditional κ = 94111687450666858500293 / 125000000000000000000000000 = 0.000752893499605334868002344.** + +This is **0.18551765% above PR309** (`0.000751499335697559705920828`), the leading public construction claim checked during preparation, and **3.96366336% above PR280**. These compare conditional asymptotic exponents, not measured multiplication speed. The frontier observation is separate from this offline certificate; no priority or global-optimality claim is made. + +The candidate is the supplied `w3-bitword.zip`: a cube-layer redesign, twin condensation and SAT-derived line-pair module on the PR249/source527 word. Its exact supplied word is preserved, SHA256 `a9501525563d3ec656ebf01aea9f2c9839e033563ea4a022500d68b12756ae86`. This package completes the missing source binding, bank allocation, endpoint/connector charts, finite invoice and stronger-complex-supplier admission. The retained original README and builders in `supplied/` describe the design and its initial partial-verification state; the builders are provenance only and are not required to verify the frozen word. + +## Reproduce + +Python 3.11+, a C++17 compiler and Boost headers are required. On Ubuntu: + +```sh +sudo apt-get install -y g++ libboost-dev +python3 -m pip install -r research/w3-bitword/requirements.txt +python3 -B research/w3-bitword/verify.py --output /tmp/w3-proof +``` + +Use a fresh output outside the package. The verifier is network-free. For a nonstandard Boost installation, add `--boost-include /path/to/boost/include`; select a compiler with `--cxx clang++` or `--cxx g++`. A small standard-header compatibility file supports the inherited `bits/stdc++.h` includes on macOS. + +Every mandatory proof stage executes. The two prerequisite source verifiers run concurrently in separate output directories. No saved PASS receipt or authenticated reuse option replaces execution. `CERTIFICATE.json` contains the mathematical admission; `VERIFICATION.json` binds it to all package source hashes and the actual fresh stages. Assertions must remain enabled, and the immutable source manifest is checked before and after the replay. + +## What is admitted + +- The complete eight-stage PR249/source527 prerequisite is rerun. Its actual raw word and frame table are regenerated and compared with the supplied base snapshot; the only ignored comparison field is nondeterministic elapsed seconds. The final w3 state word hash is recomputed. +- All 23,627 original global F₂ columns pass. The 1,455 freed helpers are proved absent from every actual record and are then deleted with an explicit register map; all 22,172 compact physical columns pass independently. The active helper count is 15,132. Sources and arbitrary remaining helper dirt are restored, 120 five-stage copies close, and six omitted-bridge controls are nonzero. +- All 3,473 new frame bases and ordinary annihilators have full rank and exact orthogonality. Their rational Gram inverses and complementary projector charts are computed. All 20,844 changed connector/endpoint projector charts are also constructed and checked; the maximum factor count is 342. All charged chart pivots and coefficients are below the retained 2^80 prime guard. +- Every one of the 3,026,400 active helper/replica/stage occurrences is assigned to a concrete width-120 bank slot without collision or padding. There are 105,803 banks per stage, 810,615 literal stock families and 162,123 normalized stock families. Bank endpoint tests and omission/repetition controls each cover 3,360 columns. +- The conservative normalizer remains 787. The complete bit-side selector charge is 571,950,677,600; the counted finite primitive coefficient is 58,246,212,755,400,601; the signed payload bound is 94 bits. Recursive children remain explicit. +- PR256 freshly regenerates and reference-checks the PR233 complex supplier at saving 7547/10^7. The complex label, forward/backward scalar, scratch-lifecycle, splice, router, precision and row guards are rechecked on that actual certificate. Coefficients with numerator up to five are expanded into paid repeated signed additions, with no new odd divisor. Forty exact coefficient recipes are checked. The resulting local bill is 238,393,708,927,310 < 2^48 and the physical row coefficient is 16,171 < the retained 20,161 reserve. +- The exact fixed prime q = 2^127 − 1, full rare-branch fallback, two independent rational moment engines, eight positive-gap ordinary levels, all 47 strict assembly inequalities and rejection of the adjacent 10^-27 grid point are admitted. + +## Scope + +This is a finite construction under the inherited all-size compiler, common weighted charts, restored rows, selectors, routing, prime supply, complex dirty-lifting, precision/recovery and analytic transfer interfaces. The checks do not establish these all-size hypotheses, a new Lean proof, an unconditional integer-multiplication theorem or a practical runtime result. + +The PR249 source package is pinned to `96495746c786d6d0339dbb38c7f553d4af3f88ed`; its manifest is `86e8bc5182079c00877077c8e4c7b2690ba2486bec385c0857f1794cd2e6bedb`. PR256 is pinned to `db3f75cdc5f03f3131d48fb220f6bf1958404ff3`. Original source, notices and licenses are retained. See `PROOF.md`, `SOURCE.json` and `NOTICE.md`. diff --git a/research/w3-restore/README-PR311.md b/research/w3-restore/README-PR311.md new file mode 100644 index 0000000000..2c4aba4eb7 --- /dev/null +++ b/research/w3-restore/README-PR311.md @@ -0,0 +1,47 @@ +# w3 word with 209 exact F₂ target-prefix squares + +**Conditional κ = 753508664880762517753401 / 10²⁷ = 0.000753508664880762517753401**, +0.0817% over PR #310's +0.000752893499605334868002344 (the w3 word's own admission), +0.268% over PR #309. + +This package is PR #310's `w3-bitword` package (utcorvusvolat-dotcom's supplied cube-layer/twin/line-pair word on the +PR249/source527 lineage, with its complete source binding, inert-role deletion, bank, chart, finite and complex +admission) with **one transcript stage inserted after the source binding**: eumemic's PR268 exact F₂ target-prefix +compression as the native-transcript stage of PR #273/#281 (`code/target_prefix.py`, rohanarun), applied to the w3 +word with a frozen selection of 209 squares (`inputs/target-selection.json`, found by the same screen as on gen4/gen5: +squares of four data targets whose rank-20 entrance helpers are each read by exactly two of the four, so the +dependent target's frame-20 prefix response is the F₂ sum of its three square-mates'). Its 1,057 frame-20 reads are +omitted; it receives `t −= p_j` at the zero frame at the cut and `t += p_j` at the square's common nondegenerate +21-dimensional frame at the close (1,254 setup/restore additions), so ZERO →(20)→(1)→ 21 becomes ZERO →(21)→ 21: +local histogram delta {1: −209, 2: −7, 3: −1, 4: −4, 8: −2, 9: −4, 12: −2, 13: +4, 17: −1, 18: −7, 20: −199, 21: +209}, +223 fewer local calls at unchanged rank mass 398,897 and unchanged endpoints, entrances and banks. + +The stage recomputes every literal prefix dependency from the actual transcript, rebuilds every MOVE, checks nested +chains, fixed endpoints, COPY lifetimes, nondegenerate endpoint bases, both reflected ledgers and the forward/inverse +all-column F₂ replays with an omitted-setup negative control; `code/recompact.py` then rebuilds the compact record +stream with the same freed-role map. Everything downstream is #310's own checker chain run fresh on the new word: +legality, all 23,627 global and 22,172 compact F₂ columns, the bank allocation (unchanged: 3,026,400 assignments, +stock 810,615 / 162,123), the changed projector charts (21,054 now, 342 factors), geometry admission, the exact price +(two rational moment engines, eight ordinary levels, 47 strict constraints, adjacent 10⁻²⁷ grid point rejected) and +the finite invoice (coefficient 58,167,289,165,918,601 < 2⁸⁰, selector charge 571,950,677,600 < 2⁴⁰). The changed +pins in `code/price.py`, `code/admit_geometry.py` and `code/finish.py` are the word hash +`de63e0a340759bea616e830dfecbd708a1899546d9db2d7da04dc32bde035a84`, 934,582 ADDs, 3,669,720 five-stage calls, the +chart count, the coefficient and κ. + +## Reproduce + +Python 3.11+ (NumPy/SciPy/SymPy per `requirements.txt`), a C++17 compiler and Boost headers: + +```sh +python3 -m pip install -r research/w3-target-prefix/requirements.txt +python3 -B research/w3-target-prefix/verify.py --output /tmp/w3-target-prefix-proof --cxx g++ --boost-include /usr/include +``` + +About 10 minutes; both prerequisite source verifiers (PR249, PR256) rerun fresh. Prints `PASS conditional kappa = …`. + +## Scope + +Exactly #310's conditional interfaces (all-size compiler, common weighted charts, restored rows, selectors, routing, +prime supply, complex dirty lifting, precision/recovery, analytic transfer); not a Lean certificate, an unconditional +theorem or a benchmark. Not composed yet on w3: the restoration, kernel, sink, descent and reorder stages of the +gen5b lineage. #310's README/PROOF are kept as `README-PR310.md`, `PROOF-PR310.md`. Prepared by Rohan Arun with +Anthropic Claude assistance; Apache-2.0; see `NOTICE.md`. diff --git a/research/w3-restore/README.md b/research/w3-restore/README.md new file mode 100644 index 0000000000..d343d40ff3 --- /dev/null +++ b/research/w3-restore/README.md @@ -0,0 +1,51 @@ +# w3 word with 209 target-prefix squares and 438 early restorations + +**Conditional κ = 754077687633330234295251 / 10²⁷ = 0.000754077687633330234295251**, +0.0755% over PR #311 +(0.000753508664880762517753401), +0.157% over PR #310's w3 word, +0.343% over PR #309. + +This package is PR #311's (`w3-target-prefix`: utcorvusvolat-dotcom's PR #310 w3 word and admission chain with the 209 +exact F₂ target-prefix squares) with **one more native transcript stage after the squares: PR #280's early +restoration of cleanup helpers**, with its screen and emitter (`code/cleanup_screen.py`, `code/cleanup_emit.py`, +`code/cleanup_reference.py`, utcorvusvolat-dotcom's PR #280 scripts re-pinned to this word) and PR #280's +endpoint-aware bank accounting carried into #310's bank review. + +* **The stage.** At the first `cleanup_gate` ADD (record 962,945) every data target already has its scalar + endpoints; the screen reproduces this on the exact F₂ prefix, then finds the helpers `a` whose only later scalar + incidence is one write `a −= b` with a donor `b` unwritten in between, both at rank-22 frames whose rational span is + a nondegenerate 23-dimensional frame: 440 of PR #280's shape (and 477 multi-incidence candidates at dimension 3 that + are not moved). With 40 physical replicas the restored width-3 slots must tile width-120 banks, so **438** are moved + (438 · 40 = 146 · 120; #280 kept the same 438/440 distinction under its own replica count): the write commutes over + the integers with every crossed gate, `a` and `b` advance to the span `E`, the ADD runs there and `a` retires at + `E`. The emitter checks every new frame's full-rank annihilator and nonzero cleared Gram determinant mod 2¹²⁷ − 1, + the commutation conditions, the forward/inverse/roundtrip F₂ replays and an omitted-restoration control. Local + histogram delta {1: +1314, 2: −876}, local rank mass 398,897 → 398,459, helper endpoint residual 317,409 → 316,971. +* **Admission of endpoints below the full frame.** `code/cohort-bank-review.cpp` now takes the candidate's + `COHORT249-FINAL.json` and a tiling plan: each helper's residual width is dim(endpoint) − dim(entrance) (24 − dim + entrance for every helper that still retires at the full frame, so #310's census is reproduced when nothing is + restored), the pattern list and the expected width census come from `inputs/bank-plan.json` (an exact integer + tiling found by a small ILP over patterns of at most three widths: 105,657 banks per stage, every bank a full + 120-coordinate partition; the C++ still verifies the census, the collision-free full tiling of all 3,026,400 + role/replica/stage slots, the per-pattern endpoint and omission/repetition controls, and the exact charts), and the + bank-stock invariant is the generic one (all slot coordinates fill the banks exactly). Literal stock 810,615 → + 809,885, normalized 162,123 → 161,977; 438 new exact frame charts (3,911 in all, ≤ 320 factors); 22,806 changed + projector charts (2,703 retired endpoints, ≤ 342 factors). Legality is checked against the candidate's declared + endpoints with the export's base frame table. +* **Price and invoice.** `code/price.py` re-pinned (word hash `8f05b2af…`, rank mass 398,459, residual 316,971, + 3,687,240 five-stage calls, mass 19,402,040, deficit 35,200, nine ordinary levels); finite coefficient + 58,322,299,353,183,001 < 2⁸⁰; selector charge 571,950,385,600 < 2⁴⁰; `code/finish.py` re-pinned accordingly. + +## Reproduce + +```sh +python3 -m pip install -r research/w3-restore/requirements.txt +python3 -B research/w3-restore/verify.py --output /tmp/w3-restore-proof --cxx g++ --boost-include /usr/include +``` + +About 10 minutes (both prerequisite source verifiers fresh); prints `PASS conditional kappa = …`. + +## Scope + +Exactly #310/#311's conditional interfaces; not a Lean certificate, an unconditional theorem or a benchmark. Not yet +composed on w3: the kernel, sink, descent and reorder stages. #311's and #310's README/PROOF are kept as +`README-PR311.md`, `PROOF-PR311.md`, `README-PR310.md`, `PROOF-PR310.md`. Prepared by Rohan Arun with Anthropic +Claude assistance; Apache-2.0; see `NOTICE.md`. diff --git a/research/w3-restore/SOURCE.json b/research/w3-restore/SOURCE.json new file mode 100644 index 0000000000..47e6bc87ee --- /dev/null +++ b/research/w3-restore/SOURCE.json @@ -0,0 +1,25 @@ +{ + "comparison": { + "candidate_kappa": "94111687450666858500293/125000000000000000000000000", + "gain_percent": 0.1855176500563458, + "head": "19d148bd7aa199378816cf1fb9ff746eb4d815da", + "kappa": "187874833924389926480207/250000000000000000000000000", + "note": "Public frontier checked during preparation on2026-10-10; separate from offline admission.", + "pull_request": 309 + }, + "input_archive": { + "name": "w3-bitword.zip", + "sha256": "c04c9987f30c7fe1a0d73d4d5cc2dff46cd6ecd916e7408d7020dd54f81c7afc" + }, + "pr249": { + "head": "96495746c786d6d0339dbb38c7f553d4af3f88ed", + "manifest_sha256": "86e8bc5182079c00877077c8e4c7b2690ba2486bec385c0857f1794cd2e6bedb", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/249" + }, + "pr256": { + "head": "db3f75cdc5f03f3131d48fb220f6bf1958404ff3", + "source_sha256": "9ce463476af549c04de4705b1bf0c8f7f18d473dc0817883066ad5e2136d90b5", + "url": "https://github.com/CrocSwap/integer-mult-bounds/pull/256" + }, + "word_sha256": "a9501525563d3ec656ebf01aea9f2c9839e033563ea4a022500d68b12756ae86" +} diff --git a/research/w3-restore/code/admit_geometry.py b/research/w3-restore/code/admit_geometry.py new file mode 100644 index 0000000000..47f12f11be --- /dev/null +++ b/research/w3-restore/code/admit_geometry.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Bind exact new-frame and changed-projector audits to the complete word.""" +import sys +if not __debug__:raise SystemExit('Assertions required') +sys.dont_write_bytecode=True +from pathlib import Path +from fractions import Fraction as Q +import argparse,json,hashlib,struct + +def read(p):return json.loads(Path(p).read_text()) +def rank_mod(rows): + if not rows:return 0 + p=2147483647;M=[[x%p for x in r] for r in rows];r=0 + for c in range(24): + pivot=next((i for i in range(r,len(M)) if M[i][c]),None) + if pivot is None:continue + M[r],M[pivot]=M[pivot],M[r];iv=pow(M[r][c],-1,p);M[r]=[(x*iv)%p for x in M[r]] + for i in range(r+1,len(M)): + if M[i][c]: + k=M[i][c];M[i]=[(a-k*b)%p for a,b in zip(M[i],M[r])] + r+=1 + if r==len(M):break + return r + +def frame(f): + d=f['dim'];B=f['B'];A=f['A'];assert len(B)==d and len(A)==24-d + assert all(len(r)==24 and all(isinstance(x,int) for x in r) for r in B+A) + # Full rank modulo a prime proves full rank over Q; exact orthogonality then proves A=B-perp. + assert rank_mod(B)==d and rank_mod(A)==24-d + assert all(sum(x*y for x,y in zip(a,b))==0 for a in A for b in B) + +def run(base,candidate,bank_dir,charts_dir,output): + base,candidate,bank_dir,charts_dir=map(Path,(base,candidate,bank_dir,charts_dir));nf=read(candidate/'COHORT249-FRAMES.json') + for f in nf.values():frame(f) + assert len(nf)==3911 + negative=[] + f=json.loads(json.dumps(next(iter(nf.values()))));f['A'][0]=[0]*24 + try:frame(f) + except AssertionError:negative.append('zero annihilator row rejected') + else:raise AssertionError('Bad annihilator accepted') + old=read(base/'249-states.json');ini=read(candidate/'COHORT249-INITIAL.json');fin=read(candidate/'COHORT249-FINAL.json');fs=read(base/'frames.json')['frames'];fs.update(nf) + def pairs(path):return {(b,c,r) for op,a,b,c,r,z in struct.iter_unpack('<6i',path.read_bytes()) if op==0 and r} + required=pairs(candidate/'COHORT249-RECORDS.bin')-pairs(base/'249-records.bin') + endpoints=0 + for i in range(3520,20107): + role=str(i) + if ini[role]!=old['initial'][role] or fin[role]!=old['final'][role]: + before,after=ini[role],fin[role];required.add((before,after,fs[str(after)]['dim']-fs[str(before)]['dim']));endpoints+=1 + audit=read(charts_dir/'COMBINED-CHART-AUDIT.json');charts=read(charts_dir/'COMBINED-CHARTS.json');bank=read(bank_dir/'BANK-REVIEW.json');full=read(bank_dir/'BANK-CHARTS.json') + assert {(x['before'],x['after'],x['rank']) for x in charts}==required and len(charts)==len(required)==22806 + assert audit['retired_endpoints']==endpoints==2703 and audit['unique_projectors_checked']==len(required) + assert audit['all_entries_below_two_to_80'] and audit['max_factors']==342 + assert int(audit['max_numerator'])<2**80 and int(audit['max_denominator'])<2**80 + assert {x['frame'] for x in full}=={int(k) for k in nf} and len(full)==3911 + assert bank['new_exact_charts']==3911 and bank['max_new_chart_factors']==320 + assert bank['actual_role_replica_stage_assignments']==3026400 and bank['actual_helper_roles']==15132 + assert bank['literal_stock']==809885 and bank['normalized_stock']==161977 + bank['new_frame_chart_max']=bank['max_new_chart_factors'];bank['max_new_chart_factors']=max(bank['max_new_chart_factors'],audit['max_factors']) + assert bank['max_new_chart_factors']+119+120<=bank['normalizer_factor_ceiling']==787 + bank.update(changed_projector_charts=22806,changed_helper_endpoints=2703,all_new_ordinary_annihilators_full_rank=True,geometry_controls=negative) + bank['geometry_input_hashes']={str(p.resolve()):hashlib.sha256(p.read_bytes()).hexdigest() for p in [candidate/'COHORT249-RECORDS.bin',candidate/'COHORT249-FRAMES.json',charts_dir/'COMBINED-CHART-AUDIT.json',charts_dir/'COMBINED-CHARTS.json',bank_dir/'BANK-REVIEW.json',bank_dir/'BANK-CHARTS.json']} + Path(output).write_text(json.dumps(bank,sort_keys=True,indent=2)+'\n');print('PASS all new frame ranks, exact annihilators and20844 changed charts',flush=True) +if __name__=='__main__': + ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--bank',required=True);ap.add_argument('--charts',required=True);ap.add_argument('--output',required=True);a=ap.parse_args();run(a.base,a.candidate,a.bank,a.charts,a.output) diff --git a/research/w3-restore/code/changed-charts.cpp b/research/w3-restore/code/changed-charts.cpp new file mode 100644 index 0000000000..3b2c4ce776 --- /dev/null +++ b/research/w3-restore/code/changed-charts.cpp @@ -0,0 +1,35 @@ +// Exact projector charts derived from the actual candidate and baseline words. +// Prepared with substantial OpenAI Codex assistance; Apache-2.0. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std;using J=nlohmann::json;using Q=boost::multiprecision::cpp_rational;using Z=boost::multiprecision::cpp_int;using M=vector>; +J ld(string p){ifstream f(p);if(!f)throw runtime_error("missing "+p);J j;f>>j;return j;} +Q rat(J j){return j.is_string()?Q(j.get()):Q(j.get());}M eye(int n){M a(n,vector(n));for(int i=0;i(a.size()));for(int i=0;i(b[0].size()));for(int i=0;i=(Z(1)<<80)||d>=(Z(1)<<80))throw runtime_error("finite prime guard exceeded");} +M inverse(M a,int &ops,Q &det){int n=a.size();M b=eye(n);det=1;ops=0;for(int k=0;kpiv;for(int col=0;colv(n);v[free]=1;for(int i=0;i piv;M copy=a;for(int c=0;cpiv;for(int col=0;colv(n);v[free]=1;for(int i=0;iprojectors;auto proj=[&](int f)->M{if(projectors.count(f))return projectors[f];int d=fs.at(to_string(f))["dim"];if(d==24)return projectors[f]=eye(24);if(!d)return projectors[f]=M(24,vector(24));M B;for(auto row:fs.at(to_string(f))["B"]){vectorr;for(auto x:row)r.push_back(rat(x));B.push_back(r);}int ops;Q det;M BG=mul(B,G), gram=mul(BG,tr(B)), inv=inverse(gram,ops,det);return projectors[f]=mul(mul(tr(B),inv),BG);};set>pairs,oldpairs;int endpoints=0; +auto events=[&](string path){ifstream f(path,ios::binary);if(!f)throw runtime_error("missing word");f.seekg(0,ios::end);size_t size=f.tellg();f.seekg(0);if(size%sizeof(Ev))throw runtime_error("word shape");vectorv(size/sizeof(Ev));f.read((char*)v.data(),size);return v;}; +for(auto e:events(base+"/COHORT249-RECORDS.bin"))if(e.op==0&&e.r)oldpairs.insert({e.b,e.c,e.r}); +for(auto e:events(candidate+"/COHORT249-RECORDS.bin"))if(e.op==0&&e.r&&!oldpairs.count({e.b,e.c,e.r}))pairs.insert({e.b,e.c,e.r}); +J oldstate=ld(base+"/249-states.json");int v=oldstate["v"],n=oldstate["n"]; +for(int a=2*v;a()||after!=oldstate["final"][role].get()){int rank=fs.at(to_string(after))["dim"].get()-fs.at(to_string(before))["dim"].get();pairs.insert({before,after,rank});endpoints++;}} + +int maxops=0,checked=0;J charts=J::array();for(auto[before,after,r]:pairs){M E=sub(proj(after),proj(before));if(mul(E,E)!=E)throw runtime_error("not projector");M C=independent_columns(E);if(C[0].size()!=r)throw runtime_error("rank mismatch");M K=kernel_general(E);if(K.size()!=24-r)throw runtime_error("nullity mismatch");for(int i=0;i<24;i++)for(auto&v:K)C[i].push_back(v[i]);int ops;Q det;M inv=inverse(C,ops,det),want=eye(24);for(int i=r;i<24;i++)want[i][i]=0;if(mul(mul(inv,E),C)!=want||mul(C,inv)!=eye(24))throw runtime_error("chart identity");maxops=max(maxops,ops);charts.push_back({{"before",before},{"after",after},{"rank",r},{"basis",mj(C)},{"inverse",mj(inv)},{"factors",ops},{"determinant",det.str()}});checked++;if(checked%50==0)cout<<"checked "<548)throw runtime_error("factor budget exceeded");J receipt={{"status","PASS_EXACT_CHANGED_ENDPOINT_AND_MOVE_CHARTS"},{"retired_endpoints",endpoints},{"unique_projectors_checked",checked},{"max_factors",maxops},{"max_numerator",maxnum.str()},{"max_denominator",maxden.str()},{"all_entries_below_two_to_80",true}};ofstream(output+"/COMBINED-CHART-AUDIT.json")<idx +new=array('i');cols=[1<=0 + new.extend((0,role,before,f,rank,0));state[role]=f +def emit(r): + op,a,b,c,f,z=r + if op==1: + move(a,f);move(b,f) + if c%2:cols[a]^=cols[b] + elif op==2: + move(a,c);assert b==n and cols[b]==0;cols[b]=cols[a];state[b]=f + elif op==3: + assert cols[a]==cols[b] and state[a]==c and state[b]==f;cols[b]=0;del state[b] + else:raise AssertionError(r) + new.extend(r) +movedkeys={(e['role'],e['donors'][0],e['frame'])for e in edits} +for i in range(len(old)//6): + if i==cut: + for e in edits: + emit((1,e['role'],e['donors'][0],old[6*e['incidences'][0][0]+3],e['frame'],MOVED));assert cols[e['role']]==1< +#include +#include +using namespace std;using J=nlohmann::json;using Q=boost::multiprecision::cpp_rational;using Z=boost::multiprecision::cpp_int;using M=vector>; +J ld(string p){ifstream f(p);if(!f)throw runtime_error("missing "+p);J j;f>>j;return j;} +Q rat(J j){return j.is_string()?Q(j.get()):Q(j.get());}M eye(int n){M a(n,vector(n));for(int i=0;i(a.size()));for(int i=0;i(b[0].size()));for(int i=0;i=(Z(1)<<80)||d>=(Z(1)<<80))throw runtime_error("finite prime guard exceeded");} +M inverse(M a,int &ops,Q &det){int n=a.size();M b=eye(n);det=1;ops=0;for(int k=0;kpiv;for(int col=0;colv(n);v[free]=1;for(int i=0;iw;int count;}; +int main(int ac,char**av){if(ac!=8)throw runtime_error("args: baseline_export initial_json new_frames_json output_dir label plan_json final_json");string inp=av[1],out=av[4];auto st=ld(inp+"/249-states.json"),fj=ld(inp+"/frames.json")["frames"],ini=ld(av[2]),nf=ld(av[3]),plan=ld(av[6]),fin=ld(av[7]);int n=st["n"],v=st["v"];mapdims;for(auto it=fj.begin();it!=fj.end();it++)dims[stoi(it.key())]=it.value()["dim"];for(auto it=nf.begin();it!=nf.end();it++)dims[stoi(it.key())]=it.value()["dim"]; +M G=eye(24);for(auto&r:G)for(auto&q:r)q-=Q(1)/9;J charts=J::array();int maxops=0;for(auto it=nf.begin();it!=nf.end();it++){int d=it.value()["dim"];M U;for(auto row:it.value()["B"]){vectorr;for(auto x:row)r.push_back(rat(x));U.push_back(r);}if(U.size()!=d)throw runtime_error("dim");auto UG=mul(U,G);auto V=nullspace(UG);M B=tr(V);for(int i=0;i<24;i++)for(int j=0;j548)throw runtime_error("inherited factor budget exceeded"); +map>fam;int sumdim=0,changed=0,deleted=0; +for(int i=0;iexpected;for(auto it=plan["census"].begin();it!=plan["census"].end();it++)expected[stoi(it.key())]=it.value();if(int(plan["replicas"])!=40)throw runtime_error("replicas"); +if(fam.size()!=expected.size()||deleted!=1455||sumdim!=35280)throw runtime_error("actual residual census or saved rank"); +for(auto[r,k]:expected)if(fam[r].size()!=k)throw runtime_error("actual residual count"); +vectorpat;auto add=[&](vectorw,int count){if(count<0||accumulate(w.begin(),w.end(),0)!=120)throw runtime_error("pattern");if(count)pat.push_back({w,count});}; +auto rep=[](int r,int k){return vector(k,r);};auto mix=[&](int r,int k,int four){auto w=rep(r,k);w.insert(w.end(),four,4);return w;}; +for(auto&pp:plan["patterns"]){vectorw;for(int x:pp["widths"])w.push_back(x);add(w,pp["count"]);} +struct Slot{int bank,off,r,block;};map>slots;int banks=0;J pj=J::array();for(auto pp:pat){pj.push_back({{"widths",pp.w},{"count",pp.count}});for(int b=0;b>(8*j))&255;hash*=1099511628211ull;}};long long assignments=0,mass=0,columns=0,controls=0;for(int stage=0;stage<5;stage++){vector>occ(banks);for(auto[r,rows]:fam)for(int i=0;is{};s[col]=1;vector>bl;int o=0;for(int r:pp.w){bl.push_back({o,r});o+=r;}if(rev)reverse(bl.begin(),bl.end());for(auto[o,r]:bl)for(int j=o;js{};s[col]=1;int o=0;for(int b=0;b +#include "json.hpp" +#include +#include +#include +#include +#include +#include +using namespace std;using namespace boost::multiprecision;using J=nlohmann::json;using I=cpp_int;using Q=cpp_rational; +void need(bool x,const char*s){if(!x)throw runtime_error(s);}J load(string p){ifstream f(p);need(bool(f),"missing input");J j;f>>j;return j;} +Q rat(string s){auto p=s.find('/');return p==string::npos?Q(I(s)):Q(I(s.substr(0,p)))/I(s.substr(p+1));}I ceilQ(Q x){return (numerator(x)+denominator(x)-1)/denominator(x);}struct E{int op,a,b,c,f,z;}; +int main(int argc,char**argv){try{need(argc==6,"usage RECORDS ROOT_PRICE BANK_RECEIPT FIVE_STAGE_RECEIPT OUTPUT");ifstream f(argv[1],ios::binary|ios::ate);size_t bytes=f.tellg();need(bytes%sizeof(E)==0,"ABI");vectorev(bytes/sizeof(E));f.seekg(0);f.read((char*)ev.data(),bytes);J price=load(argv[2])["cohort_candidate"],bank=load(argv[3]),global=load(argv[4]);mapH;I adds=0,units=0,copies=0;for(auto e:ev){if(e.op==0&&e.f)H[e.f]++;else if(e.op==1){adds++;units+=abs(e.c);}else if(e.op==2){H[e.z]++;copies++;}}need(copies==24&&adds>0&&units>=adds,"actualword inventory");int m=120,v=1760,R=15132,T=40,N=2*m,d=m*m,stock=bank["literal_stock"];need(stock==bank["normalized_stock"].get()*5&&bank["actual_role_replica_stage_assignments"]==3026400,"actualbanks");need(bank["new_exact_charts"].get()>0&&bank["max_new_chart_factors"]<=548&&I(bank["max_intermediate_denominator"].get())<(I(1)<<80)&&I(bank["max_intermediate_numerator"].get())<(I(1)<<80),"newchart invoice");mapL;for(auto[r,n]:H)L[r]+=200*n;for(int r:{4,23,46,50})L[r]+=40*2*v;I Ecount=0,mass=0;J hh=J::object();for(auto[r,n]:L){Ecount+=n;mass+=r*n;need(r<60,"half-shrink");hh[to_string(r)]=n.convert_to();need(n==5*price["histogram"][to_string(r)].get(),"fullH versusnormalizedprice");}need(m*I(stock)-mass==176000,"physicaldeficit");need(price["stock"].get()*5==stock,"literalstock notnormalized");Q mu=rat(price["moment_upper"]);need(mu<1,"strict moment");Q c=rat(price["coarse"]),deltaTau=1-mu,deltaLin=1-Q(mass)/(m*stock)-Q(32*m)*Ecount/(I("10000000000000000")*stock);need(deltaLin>0,"linear fallback");I Jroute=T*(24*v+10*R),good=8*m*m+8,high=16*I(d+1)*(d+1),K=2*5*T*(I(stock-1)+I(R)*120*787),weighted=T*(5*adds+6*v),unit=T*(5*units+6*v);need(K==bank["selector_charge"].get()&&K<(I(1)<<40),"all selector factors");I F=I(global["signed_lift_prefix"][0]["cancellation_free_signed_row_l1_upper"].get()),B=I(global["signed_lift_prefix"][1]["cancellation_free_signed_row_l1_upper"].get()),payload=64*F*F*F*B*B;need(payload<(I(1)<<104),"payload prefix");I coeff=unit+Jroute*high+Jroute*(stock+24)+Ecount*good+Ecount*(128*I(N)*N*N)+16*I(m)*m*m+120*T+Ecount+K+1;need(coeff<(I(1)<<80)&&2*I(m)*m*m*I("10000000000000000")<(I(1)<<80),"fixed coefficient below prime threshold");need(I(stock+24)<(I(1)<<80),"stocklessprime");Q previous=rat("384599/10000000000");J cuts=J::array();for(int stage=0;stage<8;stage++){Q a=(1-c)*c+c*previous;vectorgaps={c-a,1-a-c,1-a-c*(1-previous),1-c};Q gap=*min_element(gaps.begin(),gaps.end());need(gap>0,"ordinary cutoff gap");I L1=ceilQ(36/(gap*gap)),L2=ceilQ(2*(4+msb(coeff)+1)/gap),cut=max(I(1),max(L1,L2));need(Q(cut)*gap*gap>=36&&Q(cut)*gap>=2*(4+msb(coeff)+1),"cutoff inequality");cuts.push_back({{"stage",stage+1},{"minimum_gap",gap.str()},{"counted_coefficient_cutoff_log2",cut.convert_to()},{"general_rule","For full inherited constants C_full>=counted coefficient, replace C by C_full in max(1,ceil(36/delta^2),ceil(2*(4+ceil(log2 C))/delta))."}});previous=a;} +J out={{"status","PASS_COHORT_LITERAL_FIVE_STAGE_FINITE_INVOICE_AND_POSITIVE_CUTOFFS"},{"physical_replicas",T},{"literal_stock",stock},{"normalized_stock",price["stock"]},{"positive_rank_children",Ecount.convert_to()},{"literal_rank_mass",mass.convert_to()},{"literal_deficit",176000},{"literal_histogram",hh},{"global_weighted_additions",weighted.convert_to()},{"global_unit_expanded_additions",unit.convert_to()},{"route_families",Jroute.convert_to()},{"normalizer_factor_bound",787},{"new_chart_factor_max",bank["max_new_chart_factors"]},{"extra_selector_calls",K.convert_to()},{"full_counted_primitive_coefficient",coeff.convert_to()},{"primitive_coefficient_bits",msb(coeff)+1},{"payload_signed_prefix_upper",payload.convert_to()},{"payload_bits",msb(payload)+1},{"internal_row_coefficient",14401},{"external_complex_row_coefficient",20161},{"simultaneous_extra_work_streams",1},{"strict_moment_slack",deltaTau.str()},{"linear_moment_slack",deltaLin.str()},{"ordinary_cutoffs",cuts},{"scope","Sufficient finite invoice for the literal new cohort word, 40 physical replicas and fully admitted bank stock; original 48dim route, retained odd-prime rational address grid, common-ancestor compiler and complex recovery interfaces are inherited unchanged. No Lean or independent certification of those underlying public theorems asserted."}};ofstream(argv[5])< +#include +using boost::multiprecision::cpp_int; +#include +#include +#include +#include +#include +#include +#include +using J=nlohmann::json; +struct E{int kind,dst,src,c;}; +void need(bool x,const char*s){if(!x)throw std::runtime_error(s);} +int main(int argc,char**argv){try{ +need(argc==5,"usage RAW6_RECORDS OUTPUT V HELPERS");std::string pre=argv[1];int v=std::stoi(argv[3]),r=std::stoi(argv[4]),loc=2*v+r,global=4*v+r,temp=global;need(v>0 && r>=0,"dimensions"); +struct Raw{int op,a,b,c,f,z;};std::ifstream f(pre,std::ios::binary|std::ios::ate);size_t sz=f.tellg();need(sz%sizeof(Raw)==0,"stream alignment");std::vectorp(sz/sizeof(Raw));f.seekg(0);f.read((char*)p.data(),sz);std::vectore;std::mapH;for(auto q:p){if(q.op==0){if(q.f)H[q.f]++;}else if(q.op==1)e.push_back({0,q.a,q.b,q.c});else if(q.op==2){H[q.z]++;e.push_back({1,loc,q.a,0});}else if(q.op==3)e.push_back({2,loc,q.a,0});else need(false,"opcode");} +J prefix=J::array();cpp_int largestF=0,largestB=0;for(int rev=0;rev<2;rev++){std::vectornorms(loc+1,1);cpp_int maxrow=1;bool isopen=false;for(size_t z=0;zmaxrow)maxrow=norms[q.dst];}else if(k==1){need(!isopen,"boundcopy");norms[loc]=norms[q.src];isopen=true;}else {need(isopen,"bounderase");norms[loc]=0;isopen=false;}}need(!isopen,"prefix copy closure");if(rev)largestB=maxrow;else largestF=maxrow;prefix.push_back({{"reverse",bool(rev)},{"cancellation_free_signed_row_l1_upper",maxrow.convert_to()},{"bits",boost::multiprecision::msb(maxrow)+1}});} +cpp_int payload=64*largestF*largestF*largestF*largestB*largestB;need(payload>0,"positive finite prefix"); // Exact width is reported and must be included in the separate finite invoice. +long long copies=0,adds=0,odd=0;bool open=false;int center=-1;long long reverseCopies=0; +for(auto q:e){need(q.kind>=0&&q.kind<=2,"kind");need(q.dst>=0&&q.dst<=loc,"local dst");if(q.kind==0){need(q.src>=0&&q.src<=loc&&q.dst!=q.src,"source distinct");need(q.dst!=loc,"copy immutable");need(q.src!=loc||open,"temp not open");if(open)need(q.dst!=center,"source changes inside copied-center block");adds++;odd+=q.c&1;} +else if(q.kind==1){need(!open&&q.dst==loc&&q.src>=0&&q.srca((size_t)(global+1)*words);auto row=[&](int i){return a.data()+(size_t)i*words;};for(int i=0;i=v&&i<2*v&&w==(size_t)(i-v)/64)want^=1ull<<((i-v)%64);need(x[w]==want,"local defining-decoder full formal column");}}} +if(stage==1||stage==2||stage==4){int b=stage==1?0:stage==2?1:2;for(auto q:bridges[b])for(int i=0;i(std::chrono::steady_clock::now()-t0).count()<<"s\n";} +for(int bank=0;bank<4;bank+=2)for(int i=0;i()},{"payload_prefix_bits",boost::multiprecision::msb(payload)+1},{"new_Q_categories",{28,29}},{"local_raw_H",H},{"negative_controls",controls},{"seconds",std::chrono::duration(std::chrono::steady_clock::now()-t0).count()}};std::ofstream(argv[2])<0,'row reserve gap') + need(2*(dim*(dim-1)+3*dim+dim+3*dim*(dim-1)//2+dim+1)+2*dim0 for o in ['forward','backward']),'fresh scalar expansion') + b['scratch_lifecycle_checks']=life;b['template_tests']=scalar.toy_checks() + b['five_invocation_scalar_primitives_per_vertex']=3*b['forward']['totals']['real_component_primitive_steps']+2*b['backward']['totals']['real_component_primitive_steps'] + b['scratch']=dict(live_roles=W,physical_roles_per_cover=W+R+h+1,additional_recursive_calls=0,extra_external_row_coordinate=False) + progress('Merging scalar events, exact frames and all final climbs.') + programs={};controls=[] + for orientation in ['forward','backward']: + events=list(splice.emit(c,orientation));programs[orientation]=splice.validate(events,c,orientation,m,b) + controls.extend(splice.controls(events,c,orientation,m,b)) + g=splice.global_contract(m);splice.validate_global(g,m) + mutations=[('wrong_helper_owner',lambda x:x['stage_recipe'][1].__setitem__('helper_owner','s1^(-1)(d)')), + ('rank_only_frame',lambda x:x['exact_frame_bindings']['x23'].__setitem__('declaration_line','same rank only')), + ('scratch_alias',lambda x:x['scratch_namespace'].__setitem__('centers',[14691,14713])), + ('wrong_live_normalization',lambda x:x.__setitem__('recursive_volume_denominator',24127)), + ('free_RAM',lambda x:x.__setitem__('primitive_policy','free_RAM')), + ('missing_tableau',lambda x:x.__setitem__('physical',14715))] + for name,fn in mutations: + bad=deepcopy(g);fn(bad) + try:splice.validate_global(bad,m) + except ValueError as error:controls.append(dict(name=name,rejected=True,reason=str(error))) + else:raise ValueError('global mutation accepted: '+name) + progress('Recomputing complex cover, router, precision and row inequalities.') + # Independently execute each literal coefficient expansion on exact rationals. + checked=0 + for a in range(-5,6): + if a==0:continue + for den in (1,2,3,6): + q=Q(a,den);event=splice.add(('L',0),('L',1),q) + values={('L',0):Q(3),('L',1):Q(7),('W',0):Q(11)} + ops=splice.lower_scalar(event) + for op in ops: + if op[0]=='copy':values[op[1]]=values[op[2]] + elif op[0]=='halve':values[op[1]]/=2 + elif op[0]=='divide3':values[op[1]]/=3 + elif op[0]=='accumulate':values[op[1]]+=op[3]*values[op[2]] + elif op[0]=='clear':values[op[1]]=Q(0) + else:raise ValueError('Unknown coefficient primitive') + need(values=={('L',0):3+7*q,('L',1):Q(7),('W',0):Q(0)},'exact scalar coefficient expansion') + need(len(ops)==scalar.coeff_steps(q),'two independent scalar primitive counters') + checked+=1 + precision=finite_guard(m,b,basis) + precision['new_coefficient_recipes_checked']=checked + precision['numerator_bound']=5 + + need(labels.scalar_word([(1,0,1),(0,1,-1),(0,2,1),(3,1,-1),(1,0,1),(3,1,1),(0,2,-1),(2,3,-1),(3,2,1),(1,3,-1),(2,0,1)])==[[0,-1,0,0],[1,0,0,0],[0,0,0,-1],[0,0,1,0]],'global scalar signed exchange') + return dict(status='PASS_FRESH_COMPLEX_LABEL_SCALAR_SPLICE_PRECISION',five_stage_histogram=ledger['histogram'], + label_checks=checks,ledger=ledger,scalar_bill=b, + splice=dict(program=programs,global_contract=g,controls=controls,source_pin=PIN,certificate_sha256=cp['compressed_sha256']), + precision_guard=precision,input_pins=verified, + inherited_theorem_dependencies=[ + 'PR256 freshly regenerates the pinned PR233 gcert certificate and its complete gx.check1 scalar identity; no new Lean build is claimed.', + 'Pinned Lab.inv dirty lifting, exact gwinB/G0..G4 geometry, owner bijections and NetCert composition are inherited source theorems.', + 'Retained general Clifford synthesis, compact complete-stream tape primitives, common-grid precision and complete-row proofs remain analytic dependencies.', + 'The finite operational recipe is regenerated and checked; no astronomical cover enumeration or universal tape-machine execution is claimed.']) + +if __name__=='__main__': + result=run(package_root=Path(__file__).resolve().parents[1]/'vendor/pr249',progress=lambda text:print(text,file=sys.stderr)) + print(json.dumps(result,indent=2)) diff --git a/research/w3-restore/code/complex_labels.py b/research/w3-restore/code/complex_labels.py new file mode 100644 index 0000000000..ce18a1e5cc --- /dev/null +++ b/research/w3-restore/code/complex_labels.py @@ -0,0 +1,174 @@ +"""Portable pure functions extracted from the reviewed complex checks; no historical receipt readers.""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction +Q=Fraction +from hashlib import sha256 +from pathlib import Path +from math import prod +import gzip,json,sys + +BASE = dict(h=22, v=1320, R=9412, cst=440, N=262944) +EXPECTED_H = {20: 22, 1: 29178, 10: 805, 11: 353, 12: 1141, 13: 168, 14: 725, 15: 605, 16: 81, 17: 39, 19: 1441, 2: 12667, 3: 9988, 4: 3839, 5: 1976, 6: 1491, 7: 642, 8: 1478, 9: 404, 18: 2640} +class Reject(ValueError): + pass + +def need(ok, msg): + if not ok: + raise Reject(msg) + +def digest(obj): + return sha256(json.dumps(obj, separators=(",",":"), sort_keys=True).encode()).hexdigest() + +def hist(counter): + return {str(k):v for k,v in sorted(counter.items()) if v} + +def role(r,v): + return "x" if r < v else "y" if r < 2*v else "s" + +def reduce_binary(x, frame): + for b in frame: + if x & (1 << (b.bit_length()-1)): + x ^= b + return x + +def coeff(a,b, where): + need(type(a) is int and type(b) is int and b>0, f"{where}: coefficient shape") + q=Fraction(a,b) + odd=q.denominator + while odd%2==0: + odd//=2 + need(odd in (1,3), f"{where}: literal coefficient outside dyadic/divisor-three grid") + return q + +def replay_label_counts(c): + """Full finite LABEL walk only. Never multiplies the 12,052-square scalar map.""" + need(c.get("format")=="gcert/1", "format") + need(all(c.get(k)==v for k,v in BASE.items()), "baseline parameter/count mismatch") + h,v,R=c["h"],c["v"],c["R"]; n=2*v+R + need(c.get("ext")==[], "baseline has no exterior-gauged helper inputs") + frames=c["frames"]; dim=list(map(len,frames)) + need(len(frames)==18248, "baseline frame-table count") + need(frames[0]==[] and frames[1]==[1<piv[i+1] for i in range(len(piv)-1)), "frame pivot order") + need(all(not(b>>p&1) for i,b in enumerate(f) for j,p in enumerate(piv) if i!=j), + "frame is not reduced echelon") + ports=c["ports"] + need(len(ports)==v==len(set(ports)), "port count/uniqueness") + need(all(type(p) is int and 0=4 and g[0] in ("out","in"), where+": gate shape") + tag,f,pivot,terms=g[:4] + need(len(g)==(5 if tag=="out" else 4), where+": gate arity") + need(type(f) is int and 0<=f{tr}"]+=1 + totals[phase]["scalar_additions"]+=1 + if sr==tr=="y": + ybracket[(source,target)]+=q;ypiv.add(source);ytarget.add(target) + for r in regs: + climb(r,f,phase) + if phase=="A": + cut=cur.copy() + need(all(cur[v+t]==0 for t in range(v)), "scatter: Y role moved too early") + for k,r,f in c["ret"]: + need(type(r) is int and 2*v<=r>k&1 else c["scat"]["outside"]),"scatter")) + for p in ports for k in range(22)) + return { + "frame_count":len(frames),"tested_distinct_nested_pairs":len(pairs), + "live_registers_per_invocation":n,"temporary_centers":22, + "ranked_live_transitions":transitions, + "phase_stats":totals,"role_histograms":measured, + "phase_histograms":{p:hist(x) for p,x in by_phase.items()}, + "invocation_histogram":hist(combined),"invocation_calls":sum(combined.values()), + "invocation_rank_mass":mass,"retained_centers":c["ret"], + "phase_state_sha256":{"start":digest(start),"after_A":digest(cut), + "after_B":digest(before_final),"final":digest(final)}, + "literal_gate_coefficients":dict(sorted(literal.items())), + "scalar_role_directions":dict(sorted(kind.items())), + "scatter_coefficients":dict(sorted(scatter.items())), + "scatter_additions":sum(scatter.values()),"Cc_copy_additions":22, + "two_hosts_metadata_count":len(c.get("two_hosts",[])), + "two_hosts_note":"Metadata only; not an independent allocator or host-use proof.", + "Y_bracket_pairs":len(ybracket), + "literal_inverse":"Each nonself additive shear inverts by negating its coefficient; inverse phase reverses order; inverse transpose keeps chronological order and swaps source/target with negation.", + "limits":["No scalar all-column replay","No old-response or cleanup matrix formed", + "No generated Lean data comparison or kernel build","No physical stream compiler"] + } + +def scalar_word(ops): + matrix=[[int(i==j) for j in range(4)] for i in range(4)] + for target,source,q in ops: + matrix[target]=[a+q*b for a,b in zip(matrix[target],matrix[source])] + return matrix diff --git a/research/w3-restore/code/complex_scalars.py b/research/w3-restore/code/complex_scalars.py new file mode 100644 index 0000000000..c209381078 --- /dev/null +++ b/research/w3-restore/code/complex_scalars.py @@ -0,0 +1,217 @@ +"""Portable pure functions extracted from the reviewed complex checks; no historical receipt readers.""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction +Q=Fraction +from hashlib import sha256 +from pathlib import Path +from math import prod +import gzip,json,sys + +V,R,H=1320,9412,22 +def need(x,msg): + if not x:raise ValueError(msg) + +def kind(r):return "X" if r>k&1 else c["scat"]["outside"])) + yield add(live(V+t),tmp(r),q) + yield from part(B) + +def old_word(orientation,K): + if orientation=="forward": + yield from (copy(("T",q),live(2*V+q)) for q in range(R)) + for e in K: + op,t,s,a,b=e + yield add(t,s,Q(-a if t[0]=="L" else a,b)) + else: + yield from (clear(("T",q)) for q in range(R)) + for op,t,s,a,b in reversed(K): + yield add(s,t,Q(a,b)) + yield from (add(live(2*V+q),("T",q),Q(1)) for q in range(R)) + yield from (clear(("T",q)) for q in range(R)) + +def cleanup(orientation,AB): + for t,s,q in reversed(AB): + if kind(t)=="Y":continue + if orientation=="forward":yield add(live(t),live(s),-q) + else:yield add(live(s),live(t),q) + +def main_scalar(orientation,A,B,c): + def phase(gs): + for t,s,q in gs: + if orientation=="forward":yield add(live(t),live(s),q) + else:yield add(live(s),live(t),-q) + yield from phase(A) + # Every center is a complete temporary stream and one rank20 child, + # initialized/read/discarded before the next center uses the work stock. + for k,r,_ in c["ret"]: + yield clear(center(k)) + if orientation=="forward":yield add(center(k),live(r),Q(1)) + for t,p in enumerate(c["ports"]): + q=Q(*(c["scat"]["inside"] if p>>k&1 else c["scat"]["outside"])) + if orientation=="backward":yield add(center(k),live(V+t),q) + yield ("recursive_center",k,20) + if orientation=="forward": + for t,p in enumerate(c["ports"]): + q=Q(*(c["scat"]["inside"] if p>>k&1 else c["scat"]["outside"])) + yield add(live(V+t),center(k),q) + else:yield add(live(r),center(k),Q(-1)) + yield clear(center(k)) + yield from phase(B) + +def inv_schedule(orientation,A,B,c): + K=list(old_positive(A,B,c)) + yield from ((p,e) for p,es in [ + ("old_response",old_word(orientation,K)), + ("main",main_scalar(orientation,A,B,c)), + ("cleanup",cleanup(orientation,A+B))] for e in es) + +def coeff_steps(q): + """Non-destructive coefficient expansion using one complete work stream. + Copy source, halve/divide by3, repeat signed accumulation for the numerator, clear. + Counts Gaussian operations; multiply by2 for real/imag component primitives.""" + a,b=abs(q.numerator),q.denominator + need(1<=a<=5 and b in (1,2,3,6),"unsupported new coefficient") + return 2+a+int(b%2==0)+int(b%3==0) + +def bill(schedule): + phases={p:Counter() for p in ("old_response","main","cleanup")} + coeffs={p:Counter() for p in phases} + tape=sha256() + for p,e in schedule: + tape.update((json.dumps((p,e),separators=(",",":"))+"\n").encode()) + phases[p]["all_macros"]+=1 + if e[0]=="recursive_center": + phases[p]["recursive_centers"]+=1 + phases[p]["recursive_rank_mass"]+=e[2] + continue + phases[p]["scalar_macros"]+=1 + phases[p][e[0]]+=1 + if e[0]=="add": + q=Q(e[3],e[4]);coeffs[p][str(q)]+=1 + phases[p]["Gaussian_primitive_steps"]+=coeff_steps(q) + phases[p]["scalar_log2_magnitude_charge"]+=1+(abs(q.numerator)-1).bit_length() + phases[p]["halving_exposure"]+=int(q.denominator%2==0) + phases[p]["divisor3_exposure"]+=int(q.denominator%3==0) + else:phases[p]["Gaussian_primitive_steps"]+=1 + for p in phases:phases[p]["real_component_primitive_steps"]=2*phases[p]["Gaussian_primitive_steps"] + total=sum((Counter({k:v for k,v in x.items() if k not in ["recursive_rank_mass"]}) for x in phases.values()),Counter()) + return {"phases":{p:dict(x) for p,x in phases.items()},"coefficient_histograms":{p:dict(x) for p,x in coeffs.items()}, + "totals":dict(total),"schedule_sha256":tape.hexdigest(), + "other_main_recursive_calls":"Actual independently replayed live-label transitions; not scalar macros"} + +def mm(A,B):return [[sum((x*y for x,y in zip(row,col)),Q(0)) for col in zip(*B)] for row in A] + +def lifecycle(schedule): + """Verify that new scalar-only work stock never survives into a child.""" + initialized=set();dirty=set();active_centers=set();seen_main=False;children=0 + for phase,e in schedule: + if phase=="main" and not seen_main: + need(not dirty,"old-response tableau survives into recursive main phase") + seen_main=True + need(e[0] in ("add","copy","clear","recursive_center"),"unknown or unpaid recursive operation") + if e[0]=="recursive_center": + k=e[1] + need(type(k) is int and 0<=k<22 and e[2]==20,"new temporary entered uncharged child") + need(phase=="main" and not dirty,"old-response temporary used during child") + need(active_centers<=set([k]),"other center was not discarded before next child") + children+=1 + continue + target=e[1] + source=e[2] if e[0] in ("add","copy") else None + if source and source[0]=="T":need(source[1] in initialized,"uninitialized temporary read") + if target[0]=="T": + need(phase=="old_response","scalar-only tableau touched after recursive phase begins") + initialized.add(target[1]) + if e[0]=="clear":dirty.discard(target[1]) + else:dirty.add(target[1]) + if target[0]=="C": + if e[0]=="clear":active_centers.discard(target[1]) + else:active_centers.add(target[1]) + if e[0]=="add": + # Coefficient expansion is deliberately local: copy into W, + # optionally double/halve/divide3, accumulate, and clear W. + expanded=["copy_work"]+["halve"]*int(e[4]%2==0)+["divide3"]*int(e[4]%3==0)+["accumulate"]*abs(e[3])+["clear_work"] + need(len(expanded)==coeff_steps(Q(e[3],e[4])),"literal expansion count") + need(expanded[-1]=="clear_work","coefficient work survived scalar macro") + need(not dirty and not active_centers,"temporary stock not erased at invocation end") + need(children==22,"center child count changed") + return {"tableau_cleared_before_entire_main_phase":True,"tableau_absent_from_all_children":True, + "coefficient_work_cleared_per_add":True,"center_children":children, + "new_recursive_children":0,"moment_live_width":14692, + "new_work_stock_only":9413,"complete_stream_fraction":"1/(14692*|Orth(110,2)|)"} + +def ident(n):return [[Q(int(i==j)) for j in range(n)] for i in range(n)] + +def matrix(n,gs): + a=ident(n) + for t,s,q in gs:a[t]=[x+q*y for x,y in zip(a[t],a[s])] + return a + +def toy_checks(): + # 2 X, 3 S, 2 Y. Explicit nontrivial X mixing is undone; helper map + # and K are otherwise arbitrary. Exact Fraction checks cover every column + # of THIS TINY TEMPLATE, not of the published 12052-register source. + n=7;X={0,1};S={2,3,4};Y={5,6} + gs=[(2,0,Q(1)),(3,2,Q(2)),(5,3,Q(-1,6)),(0,1,Q(1,2)), + (4,0,Q(2)),(2,4,Q(1,2)),(6,2,Q(1,3)),(0,1,Q(-1,2)), + (3,1,Q(-1)),(5,4,Q(1)),(6,0,Q(1))] + M=matrix(n,gs) + need(all(M[i]==ident(n)[i] for i in X),"toy source rows not restored") + Ugs=[e for e in gs if e[0] not in Y] + U=matrix(n,Ugs) + Uinv=matrix(n,[(t,s,-q) for t,s,q in reversed(Ugs)]) + need(mm(Uinv,U)==ident(n),"restricted inverse identity") + Mi=matrix(n,[(t,s,-q) for t,s,q in reversed(gs)]) + g8=[Mi[i] if i in S else ident(n)[i] for i in range(n)] + h8=[M[i] if i in S else ident(n)[i] for i in range(n)] + need(g8==Uinv and h8==U,"cleanup projection identities") + Ut=matrix(n,[(s,t,q) for t,s,q in reversed(Ugs)]) + need(Ut==[list(x) for x in zip(*U)],"backward cleanup transpose") + Kgs=[e for e in gs if e[1] not in X] + Kmat=matrix(n,Kgs) + need(all(Kmat[i][j]==M[i][j] for i in Y for j in S),"zero-source old response") + Kt=matrix(n,[(s,t,q) for t,s,q in reversed(Kgs)]) + need(all(Kt[i][j]==M[j][i] for i in S for j in Y),"old response adjoint") + bad=matrix(n,[(t,s,q) for t,s,q in reversed(Ugs)]) + need(bad!=g8,"wrong inverse sign must fail") + bad_order=matrix(n,[(s,t,q) for t,s,q in Ugs]) + need(bad_order!=Ut,"unreversed transpose must fail") + return {"tiny_exact_template_columns_checked":7,"checks_passed":7, + "wrong_inverse_sign_rejected":True,"unreversed_transpose_rejected":True, + "published_full_scalar_replay":False} diff --git a/research/w3-restore/code/complex_splice.py b/research/w3-restore/code/complex_splice.py new file mode 100644 index 0000000000..9300ef3af3 --- /dev/null +++ b/research/w3-restore/code/complex_splice.py @@ -0,0 +1,276 @@ +"""Portable pure functions extracted from the reviewed complex checks; no historical receipt readers.""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction +Q=Fraction +from hashlib import sha256 +from pathlib import Path +from math import prod +import gzip,json,sys + +V,R,H,N,W=1320,9412,22,12052,14692 +PHASES=["old_response","ad0","A","centers","B","final","adF","cleanup","done"] +def need(x,s): + if not x:raise ValueError(s) + +def blobhash(p):return sha256(p.read_bytes()).hexdigest() + +def digest(x):return sha256(json.dumps(x,separators=(',',':'),sort_keys=True).encode()).hexdigest() + +def role(r):return 'X' if r0 else -1)]*abs(a)+[clear(work)] + +def emit(c,ori): + """Construct the complete local parametric invocation, before cover routing. + One role stream is its full complete address rectangle. Frame labels denote + exact canonical representatives, never just rank or binary matrices. + """ + A=list(flat(c['A']));B=list(flat(c['B']));cur=c['start'].copy() + K=[] + for part in (A,None,B): + if part is None: + for t,p in enumerate(c['ports']): + for k,r,f in c['ret']: + K.append(add(L(V+t),T(r),Q(*(c['scat']['inside'] if p>>k&1 else c['scat']['outside'])))) + else: + for t,s,q in part: + if role(s)=='X':continue + K.append(add(T(t) if role(t)=='S' else L(t),T(s),q)) + yield ('phase','old_response') + if ori=='forward': + for q in range(R):yield scal('old_response',copy(('T',q),L(2*V+q)),'old0') + for _,t,s,a,b in K:yield scal('old_response',add(t,s,Q(-a if t[0]=='L' else a,b)),'old0') + else: + for q in range(R):yield scal('old_response',clear(('T',q)),'old0') + for _,t,s,a,b in reversed(K):yield scal('old_response',add(s,t,Q(a,b)),'old0') + for q in range(R):yield scal('old_response',add(L(2*V+q),('T',q),Q(1)),'old0') + for q in range(R):yield scal('old_response',clear(('T',q)),'old0') + yield ('phase','ad0') + for r,f in enumerate(c['start']):yield ('adapter','old_to_new',r,f) + for part in ['A','centers','B','final']: + yield ('phase',part) + if part in ['A','B']: + for g in c[part]: + regs=[g[2]]+[x[0] for x in g[3]]+(g[4] if g[0]=='out' else []) + for r in regs: + if cur[r]!=g[1]: + old=cur[r];cur[r]=g[1] + yield ('climb',part,r,old,g[1],len(c['frames'][g[1]])-len(c['frames'][old])) + for t,s,q in flat([g]): + e=add(L(t),L(s),q) if ori=='forward' else add(L(s),L(t),-q) + yield scal('main',e,g[1]) + elif part=='centers': + for k,r,f in c['ret']: + yield scal('main',clear(C(k)),f if ori=='forward' else 0) + if ori=='forward':yield scal('main',add(C(k),L(r),Q(1)),f) + else: + for t,p in enumerate(c['ports']): + yield scal('main',add(C(k),L(V+t),Q(*(c['scat']['inside'] if p>>k&1 else c['scat']['outside']))),0) + yield ('center',k,f if ori=='forward' else 0,0 if ori=='forward' else f,20) + if ori=='forward': + for t,p in enumerate(c['ports']): + yield scal('main',add(L(V+t),C(k),Q(*(c['scat']['inside'] if p>>k&1 else c['scat']['outside']))),0) + else:yield scal('main',add(L(r),C(k),Q(-1)),f) + yield scal('main',clear(C(k)),0 if ori=='forward' else f) + else: + for r,f in enumerate(c['final']): + if cur[r]!=f: + old=cur[r];cur[r]=f + yield ('climb','final',r,old,f,len(c['frames'][f])-len(c['frames'][old])) + yield ('phase','adF') + for r,f in enumerate(c['final']):yield ('adapter','new_to_old',r,f) + yield ('phase','cleanup') + for t,s,q in reversed(A+B): + if role(t)=='Y':continue + e=add(L(t),L(s),-q) if ori=='forward' else add(L(s),L(t),q) + yield scal('cleanup',e,'old1') + yield ('phase','done') + +def contains(U,V): + for u in U: + for v in V: + if u>>(v.bit_length()-1)&1:u^=v + if u:return False + return True + +def validate(events,c,ori,manifest,bill): + phase=None;seen=[];cur=c['start'].copy();cent={};dirty=set();initialized=set() + climbed=Counter();hist=Counter();projection=sha256();whole=sha256();counts=Counter();ad0=[];adF=[] + pairs=set();states={};all_frame_incidence=0;primitive=sha256();primitive_count=0 + for ev in events: + whole.update((json.dumps(ev,separators=(',',':'))+'\n').encode()) + tag=ev[0];counts[tag]+=1 + if tag=='phase': + if phase=='A':states['after_A']=digest(cur) + if phase=='B':states['after_B']=digest(cur) + if phase=='final':states['final']=digest(cur) + phase=ev[1];seen.append(phase) + need(seen==PHASES[:len(seen)],'strict old/A/copy/B/final/adapter/cleanup chronology') + if phase=='ad0':need(not dirty,'old-response tableau survived before label recursion') + if phase=='A':need(ad0==list(enumerate(c['start'])),'missing or reordered exact entry adapter') + if phase=='adF':need(cur==c['final'],'final climbs omitted before cleanup') + if phase=='cleanup':need(adF==list(enumerate(c['final'])),'missing or reordered exact final adapter') + continue + if tag=='adapter': + _,which,r,f=ev + if which=='old_to_new':need(phase=='ad0','entry adapter position');ad0.append((r,f)) + else:need(which=='new_to_old' and phase=='adF','final adapter position');adF.append((r,f)) + elif tag=='climb': + _,p,r,old,new,d=ev + need(phase==p and p in ['A','B','final'],'live child outside source label walk') + need(not dirty and not cent,'new work stock or center active during live child') + need(cur[r]==old and d==len(c['frames'][new])-len(c['frames'][old]) and d>0,'wrong exact child endpoints/rank') + pair=(old,new) + if pair not in pairs:need(contains(c['frames'][old],c['frames'][new]),'nonnested child');pairs.add(pair) + cur[r]=new;climbed[p]+=1;hist[d]+=1 + elif tag=='center': + _,k,old,new,d=ev + need(phase=='centers' and not dirty and set(cent)=={k},'center child ownership') + need(cent[k]==old and (k,c['ret'][k][1],c['ret'][k][2])==tuple(c['ret'][k]),'center input frame') + f=c['ret'][k][2] + need((old,new,d)==((f,0,20) if ori=='forward' else (0,f,20)),'center child direction/rank') + cent[k]=new;hist[d]+=1 + projection.update((json.dumps(('main',('recursive_center',k,d)),separators=(',',':'))+'\n').encode()) + elif tag=='scalar': + _,p,e,f=ev + need(p==('main' if phase in ['A','centers','B'] else phase),'scalar phase binding') + need(e[0] in ['add','copy','clear'],'unpaid scalar operation') + target=e[1];source=e[2] if e[0] in ['add','copy'] else None + for x in [target]+([source] if source else []): + bank,r=x + if bank=='T':need(phase=='old_response' and 0<=r1 and Q(price['second_next'][0])>1 + assert price['prime_lucas_lehmer_residue']==0 and price['prime_lucas_lehmer_steps']==125 + gaps=[];bits=(coefficient-1).bit_length() + for row in price['ordinary_gaps']: + gap=min(map(Q,row.values()));assert gap>0 + cutoff=max(1,ceilq(Q(36)/gap**2),ceilq(Q(2*(4+bits))/gap)) + assert cutoff*gap**2>=36 and cutoff*gap>=2*(4+bits) + gaps.append({'minimum_gap':str(gap),'counted_log2_cutoff':str(cutoff)}) + assert len(gaps)==9 and len(price['assembly']['strict_constraints'])==47 + assert min(map(Q,price['assembly']['strict_constraints'].values()))>0 and price['adjacent_rejected'] + result={'status':'PASS_SOURCE_BOUND_W3_TARGET_PREFIX_RESTORATION_CONDITIONAL_FINITE_CONSTRUCTION','kappa':price['kappa'],'word_sha256':binding['word_sha256'],'compact_word_sha256':binding['compact_word_sha256'],'source_regenerated':True,'complex_supplier_regenerated':True,'active_helpers':15132,'normalized_stock':162123,'bank_assignments':3026400,'new_frame_charts':3473,'changed_projector_charts':20844,'new_chart_factor_max':342,'normalizer':787,'finite_coefficient':coefficient,'selector_charge':selectors,'payload_bits':94,'finite_cutoffs':gaps,'complex_guard':cg,'full_constant_rule':'Replace the counted coefficient by C_full dominating every inherited primitive, wrapper, row, setup, routing and earlier-level constant in the same positive-gap cutoff formula. No recursive child is absorbed.','scope':'Conditional on inherited all-size compiler, weighted charts, restored rows, selectors, routing, prime supply, complex dirty lifting, precision/recovery and analytic interfaces. No unconditional multiplication theorem, new Lean build or runtime benchmark is claimed.'} + receipts=['baseline/verification.json','COMPLEX-GUARD.json','BANK.json','PRICE.json','INVOICE.json','COLUMNS.json','COMPACT-COLUMNS.json','LEGALITY.json','candidate/SOURCE-BINDING.json','logs/complex-source.log'] + result['fresh_receipt_hashes']={name:sha(out/name) for name in receipts} + (out/'CERTIFICATE.json').write_text(json.dumps(result,sort_keys=True,indent=2)+'\n');print('PASS integrated construction',price['kappa'],flush=True) +if __name__=='__main__': + ap=argparse.ArgumentParser();ap.add_argument('output',type=Path);a=ap.parse_args();finish(a.output) diff --git a/research/w3-restore/code/prepare_candidate.py b/research/w3-restore/code/prepare_candidate.py new file mode 100644 index 0000000000..fe049111b3 --- /dev/null +++ b/research/w3-restore/code/prepare_candidate.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +"""Bind the supplied w3 data to freshly regenerated PR249 source; delete inert roles.""" +import sys +if not __debug__: raise SystemExit('Assertions required') +sys.dont_write_bytecode=True +import argparse, gzip, hashlib, json, shutil, struct +from pathlib import Path +from collections import Counter +ROOT=Path(__file__).resolve().parents[1] +def read(p): return json.loads(p.read_text()) +def sha(p): return hashlib.sha256(p.read_bytes()).hexdigest() +def norm(x): + if isinstance(x,dict):return {k:norm(v) for k,v in x.items() if k!='seconds'} + if isinstance(x,list):return list(map(norm,x)) + return x +def save(p,x):p.write_text(json.dumps(x,sort_keys=True,indent=2)+'\n') +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--export',type=Path,required=True);ap.add_argument('--output',type=Path,required=True);a=ap.parse_args() + out=a.output.resolve();out.mkdir(parents=True,exist_ok=False);base=a.export.resolve();src=ROOT/'supplied' + for name in ('249-records.bin','249-states.json','frames.json'): + supplied=gzip.decompress((src/'base'/(name+'.gz')).read_bytes()) + assert (norm(json.loads(supplied))==norm(read(base/name))) if name.endswith('.json') else supplied==(base/name).read_bytes(), name + own=read(src/'base/249-DONOR-OWNERSHIP.json');assert sorted(own['donor_keys'])==read(base/'REGENERATED-DONORS.json')['donor_keys'] + shutil.copyfile(src/'base/249-DONOR-OWNERSHIP.json',base/'249-DONOR-OWNERSHIP.json') + shutil.copyfile(base/'249-records.bin',base/'COHORT249-RECORDS.bin') + for name in ('COHORT249-RECORDS.bin','COHORT249-FRAMES.json','COHORT249-INITIAL.json'):(out/name).write_bytes(gzip.decompress((src/'word'/(name+'.gz')).read_bytes())) + shutil.copyfile(src/'word/COHORT249-SELECTION.json',out/'COHORT249-SELECTION.json') + assert read(out/'COHORT249-SELECTION.json')==[] + wordsha=sha(out/'COHORT249-RECORDS.bin');assert wordsha=='a9501525563d3ec656ebf01aea9f2c9839e033563ea4a022500d68b12756ae86' + st=json.loads(gzip.decompress((src/'word/w3-249-states.json.gz').read_bytes()));old=read(base/'249-states.json');ini=read(out/'COHORT249-INITIAL.json');nf=read(out/'COHORT249-FRAMES.json');fs=read(base/'frames.json')['frames'] + assert not set(nf)&set(fs);fs.update(nf) + assert st['n']==old['n']==20107 and st['v']==old['v']==1760 + assert st['initial']==ini and st['final']==old['final'] + assert len(set(old['regs']))==16587 + changed={old['regs'][i-3520] for i in range(3520,20107) if ini[str(i)]!=old['initial'][str(i)]} + assert not changed & (set(old['source_owned_roles']) | set(own['donor_keys'])), 'Source owner or donor changed' + for k in ('ZERO','FULL','regs','source_owned_roles','source_covectors'):assert st[k]==old[k],k + assert all(ini[str(i)]==old['initial'][str(i)] for i in range(3520)) + ev=list(struct.iter_unpack('<6i',(out/'COHORT249-RECORDS.bin').read_bytes()));assert len(ev)==1026620 + freed={r for r in range(3520,20107) if ini[str(r)]==st['FULL']};assert len(freed)==1455 + for op,a,b,c,f,z in ev: + assert a not in freed and (op==0 or b not in freed),'Freed role still used by the actual word' + live=[r for r in range(20107) if r not in freed];mapping={r:i for i,r in enumerate(live)};mapping[20107]=len(live) + compact=[] + for op,a,b,c,f,z in ev:compact.append((op,mapping[a],b if op==0 else mapping[b],c,f,z)) + (out/'COMPACT-RECORDS.bin').write_bytes(b''.join(struct.pack('<6i',*r) for r in compact)) + assert len(live)==18652 + st['record_sha256']=wordsha;st['record_count']=len(ev) + save(out/'249-states.json',st);save(out/'COHORT249-FINAL.json',st['final']);save(out/'frames.json',{'h':24,'frames':fs}) + shutil.copyfile(out/'COHORT249-RECORDS.bin',out/'249-records.bin') + save(out/'SOURCE-BINDING.json',{'status':'PASS_FRESH_SOURCE_BINDING_AND_INERT_ROLE_DELETION','word_sha256':wordsha,'base_word_sha256':sha(base/'249-records.bin'),'freed_roles':sorted(freed),'active_helpers':15132,'active_local_registers':len(live),'compact_word_sha256':sha(out/'COMPACT-RECORDS.bin'),'baseline_unchanged_fields_verified':True,'saved_state_hash_recomputed':True}) + print('PASS source binding and1455 inert role deletions',flush=True) +if __name__=='__main__':main() diff --git a/research/w3-restore/code/price.py b/research/w3-restore/code/price.py new file mode 100644 index 0000000000..4e19e74e35 --- /dev/null +++ b/research/w3-restore/code/price.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +"""Exact fixed-prime w3 price and positive finite-level cutoff checks.""" +import sys +if not __debug__:raise SystemExit('Assertions required') +sys.dont_write_bytecode=True +sys.set_int_max_str_digits(0) +from pathlib import Path +from fractions import Fraction as Q +from collections import Counter +import argparse,hashlib,json,struct +ROOT=Path(__file__).resolve().parents[1] +sys.path.insert(0,str(ROOT/'supplied/pricing')) +import fixed_prime_math as R + +def run(candidate,bank_path,output): + candidate=Path(candidate);bank=json.loads(Path(bank_path).read_text());st=json.loads((candidate/'249-states.json').read_text());fs=json.loads((candidate/'frames.json').read_text())['frames'] + H=Counter();adds=0;units=0;copies=0 + raw=(candidate/'COHORT249-RECORDS.bin').read_bytes() + assert hashlib.sha256(raw).hexdigest()==st['record_sha256']=='8f05b2af07ac295d1ab11bdbf964ea422a4cdc64587b12fb5b497b92a0b889bb' + for op,a,b,c,f,z in struct.iter_unpack('<6i',raw): + if op==0 and f:H[f]+=1 + elif op==2:H[z]+=1;copies+=1 + elif op==1:adds+=1;units+=abs(c) + assert copies==24 and adds==934582 and sum(r*n for r,n in H.items())==398459 + residual=sum(fs[str(st['final'][str(i)])]['dim']-fs[str(st['initial'][str(i)])]['dim'] for i in range(3520,20107)) + assert residual==316971 + hist={r:40*n for r,n in H.items()} + for r in (4,23,46,50):hist[r]=hist.get(r,0)+28160 + stock=bank['normalized_stock'];assert stock==161977 and bank['literal_stock']==5*stock and bank['banks_per_stage']==105657 + assert Q(4*1760*40)+Q(5*40*residual,120)==5*stock + calls=sum(hist.values());mass=sum(r*n for r,n in hist.items());assert calls==3687240 and mass==19402040 and 120*stock-mass==35200 + cost=R.load('w3_moment',ROOT/'vendor/pr249/moment.py');other=R.load('w3_other',ROOT/'vendor/pr249/base_two_moment.py');outer=R.load('w3_outer',ROOT/'vendor/pr249/outer.py') + q=(1<<127)-1;res=4 + for _ in range(125):res=(res*res-2)%q + assert res==0 and q==R.PRIME and R.RHO==Q(3456000,q) + coarse,nxt,first,first_next,second,second_next=R.certify_coarse(hist,120,stock,calls,cost,other) + cap=R.grid_kappa(coarse);chain=[R.INITIAL_LEAF];gaps=[] + for level in range(1,21): + old=chain[-1];new=(1-coarse)*coarse+coarse*old + row={'atom':coarse-new,'borrowing':1-new-coarse,'remainder':1-new-coarse*(1-old),'stock':1-coarse} + assert old0 + chain.append(new);gaps.append(row) + if R.grid_kappa(new)==cap:break + else:raise AssertionError('No finite cap') + complex_saving=Q(7547,10**7) + assembly=outer.assembly(chain[-1],complex_saving,R.bridge_template(),cap,eta=R.ETA,beta=R.BETA) + assert len(assembly['strict_constraints'])==47 and min(assembly['strict_constraints'].values())>0 and min(assembly['margins'].values())>cap + for saving in (chain[-1],coarse): + try:outer.assembly(saving,complex_saving,R.bridge_template(),cap+Q(1,R.GRID),eta=R.ETA,beta=R.BETA) + except AssertionError:pass + else:raise AssertionError('Adjacent grid point admitted') + assert cap==Q(754077687633330234295251,1000000000000000000000000000) and level==9 + result={'status':'PASS_EXACT_W3_PRICE_TWO_ENGINES_47_CONSTRAINTS','source_word_sha256':st['record_sha256'],'complex_saving':complex_saving,'cohort_candidate':{'stock':stock,'calls':calls,'rank_mass':mass,'deficit':35200,'histogram':hist,'coarse':coarse,'moment_upper':first[1],'kappa':cap},'local_histogram':dict(H),'prime':q,'prime_lucas_lehmer_steps':125,'prime_lucas_lehmer_residue':res,'rare_density':R.RHO,'full_fallback_retained':True,'coarse_bracket':[coarse,nxt],'first_interval':first,'first_next':first_next,'second_interval':second,'second_next':second_next,'ordinary_chain':chain,'ordinary_gaps':gaps,'assembly':assembly,'kappa':cap,'adjacent_rejected':True,'scope':'Exact arithmetic; source, geometry, bank and finite invoice admission required separately.'} + Path(output).write_text(json.dumps(R.serial(result),sort_keys=True,indent=2)+'\n');print('PASS exact price',cap,float(cap),flush=True) +if __name__=='__main__': + ap=argparse.ArgumentParser();ap.add_argument('candidate',type=Path);ap.add_argument('--bank',type=Path,required=True);ap.add_argument('--output',type=Path,required=True);a=ap.parse_args();run(a.candidate,a.bank,a.output) diff --git a/research/w3-restore/code/recompact.py b/research/w3-restore/code/recompact.py new file mode 100644 index 0000000000..8b122aaf79 --- /dev/null +++ b/research/w3-restore/code/recompact.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""Recompute the compact record stream and the candidate's binding receipts after a transcript stage (same freed-role map as prepare_candidate.py).""" +import hashlib,json,struct,sys +from pathlib import Path +if not __debug__:raise SystemExit('Assertions required') +out=Path(sys.argv[1]);read=lambda p:json.loads(Path(p).read_text());sha=lambda p:hashlib.sha256(Path(p).read_bytes()).hexdigest() +if '--merge-frames' in sys.argv: + fs=read(out/'frames.json');nf=read(out/'COHORT249-FRAMES.json');fs['frames'].update(nf);(out/'frames.json').write_text(json.dumps(fs,sort_keys=True,separators=(',',':'))+'\n') +st=read(out/'249-states.json');ini=read(out/'COHORT249-INITIAL.json');FULL=st['FULL'];n=st['n'];assert n==20107 +freed={r for r in range(3520,n) if ini[str(r)]==FULL};assert len(freed)==1455 +ev=list(struct.iter_unpack('<6i',(out/'COHORT249-RECORDS.bin').read_bytes())) +for op,a,b,c,f,z in ev:assert a not in freed and (op==0 or b not in freed),'Freed role used after the stage' +live=[r for r in range(n) if r not in freed];mapping={r:i for i,r in enumerate(live)};mapping[n]=len(live);assert len(live)==18652 +compact=[(op,mapping[a],b if op==0 else mapping[b],c,f,z) for op,a,b,c,f,z in ev] +(out/'COMPACT-RECORDS.bin').write_bytes(b''.join(struct.pack('<6i',*r) for r in compact)) +wordsha=sha(out/'COHORT249-RECORDS.bin');st['record_sha256']=wordsha;st['record_count']=len(ev) +final=dict(st['final']) +for op,a,b,c,f,z in ev: + if op==0:final[str(a)]=c +assert all(final[str(i)]==st['final'][str(i)] for i in range(2*1760)),'data endpoints unchanged';st['final']=final;(out/'COHORT249-FINAL.json').write_text(json.dumps(final,sort_keys=True)+'\n') +(out/'249-states.json').write_text(json.dumps(st,sort_keys=True,separators=(',',':'))+'\n');(out/'249-records.bin').write_bytes((out/'COHORT249-RECORDS.bin').read_bytes()) +b=read(out/'SOURCE-BINDING.json');b.update(word_sha256=wordsha,compact_word_sha256=sha(out/'COMPACT-RECORDS.bin'),record_count=len(ev),stage_after_binding='target-prefix (209 exact F2 squares) then early restoration (438 helpers, code/cleanup.py)');(out/'SOURCE-BINDING.json').write_text(json.dumps(b,sort_keys=True,indent=1)+'\n') +print('PASS recompaction after target prefix:',wordsha,len(ev),'records',flush=True) diff --git a/research/w3-restore/code/target_prefix.py b/research/w3-restore/code/target_prefix.py new file mode 100644 index 0000000000..e9772efd19 --- /dev/null +++ b/research/w3-restore/code/target_prefix.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python3 +"""Exact F2 target-prefix compression (PR268's mechanism) on the cohort-rewritten native transcript. + +A group is one dependent target t with retained targets p_1..p_k, a cut and a close record, and a common close +frame F inside every member's cap. The dependent's reads in (cut, close] are omitted; at the cut it receives +t -= p_j at the zero frame, and at the close t += p_j at F, after moving every member to F. The transform +recomputes each member's literal prefix response from the actual transcript and requires the F2 dependency +R_t = sum_j R_pj before emitting anything; it then rebuilds every MOVE from the actual needs and checks nested +chains, fixed endpoints, COPY lifetimes, nondegenerate endpoint bases and forward/inverse all-column replays. +Prepared by Rohan Arun with Anthropic Claude assistance; Apache-2.0. +""" +from array import array +from collections import Counter, defaultdict +from fractions import Fraction +from pathlib import Path +import hashlib, json, sys +if not __debug__: raise SystemExit('assertions required') +X, LEAD, SEL = Path(sys.argv[1]), Path(sys.argv[2]), Path(sys.argv[3]) +H = 24 +def dot(x, y): return sum(p*q for p, q in zip(x, y)) +def rank(rows): + M = [[Fraction(x) for x in r] for r in rows]; r = 0 + for c in range(len(M[0]) if M else 0): + p = next((i for i in range(r, len(M)) if M[i][c]), None) + if p is None: continue + M[r], M[p] = M[p], M[r]; pv = M[r][c]; M[r] = [x/pv for x in M[r]] + for i in range(len(M)): + if i != r and M[i][c]: + m = M[i][c]; M[i] = [x-m*y for x, y in zip(M[i], M[r])] + r += 1 + if r == len(M): break + return r +def _introw(r): + from fractions import Fraction as _F + from math import lcm as _lcm + q = [_F(str(x)) for x in r]; d = 1 + for x in q: d = _lcm(d, x.denominator) + return [int(x*d) for x in q] +frames = {} +for name in (X/'frames.json', LEAD/'COHORT249-FRAMES.json'): + j = json.loads(name.read_text()); j = j.get('frames', j) + for k, rec_ in j.items(): frames[int(k)] = dict(B=[_introw(r) for r in rec_['B']], A=[_introw(r) for r in rec_['A']], d=int(rec_['dim'])) +for f, fr in frames.items(): assert len(fr['B']) == fr['d'] and len(fr['A']) + fr['d'] == H and all(dot(a, b) == 0 for a in fr['A'] for b in fr['B']) +subcache = {} +def sub(f, g): + if f == g: return True + k = (f, g) + if k not in subcache: subcache[k] = frames[f]['d'] <= frames[g]['d'] and all(dot(a, b) == 0 for a in frames[g]['A'] for b in frames[f]['B']) + return subcache[k] +def nondeg(f): + B, A = frames[f]['B'], frames[f]['A'] + if not B or len(B) == H: return True + if len(B) <= len(A): + s = [sum(b) for b in B]; return rank([[9*dot(B[i], B[j]) - s[i]*s[j] for j in range(len(B))] for i in range(len(B))]) == len(B) + s = [sum(a) for a in A]; return rank([[(9-H)*dot(A[i], A[j]) + s[i]*s[j] for j in range(len(A))] for i in range(len(A))]) == len(A) +st = json.loads((X/'249-states.json').read_text()); n, v = st['n'], st['v']; ZERO, FULL = st['ZERO'], st['FULL'] +cov = [list(map(int, c)) for c in st['source_covectors']] +initial = {int(k): f for k, f in json.loads((LEAD/'COHORT249-INITIAL.json').read_text()).items()} +sel = json.loads(SEL.read_text()); cut = sel['cut_record'] +old = array('i'); old.frombytes((LEAD/'COHORT249-RECORDS.bin').read_bytes()); assert old.itemsize == 4 and len(old) % 6 == 0 +assert hashlib.sha256(old.tobytes()).hexdigest() == sel['input_record_sha256'] and len(old)//6 == sel['input_record_count'] +final = dict(initial) +for k in range(0, len(old), 6): + if old[k] == 0: final[old[k+1]] = old[k+3] +groups = []; owner = {}; atclose = defaultdict(list); dep_of = {} +for j, g in enumerate(sel['groups']): + t, ps, close, F = g['dependent'], list(g['retained']), g['close_after_record'], g['frame'] + assert close > cut and len(ps) >= 1 and t not in ps and len(set(ps)) == len(ps) + assert frames[F]['d'] == g['close_rank'] and nondeg(F) + for m in [t] + ps: + assert m not in owner; owner[m] = j + assert initial[v+m] == ZERO and all(dot(cov[m], b) == 0 for b in frames[F]['B']), 'close frame outside a member cap' + dep_of[t] = j; atclose[close].append(j); groups.append(dict(dependent=t, retained=ps, close=close, frame=F)) +assert len(groups) == sel['selected_groups'] > 0 +# literal prefix responses and member states from the actual transcript +cols = [1 << i for i in range(n)]; center = None; responses = {m: 0 for m in owner}; state = dict(initial); state_at_close = {} +for k in range(0, len(old), 6): + op, a, b, c, f, z = old[k:k+6]; i = k//6 + if op == 0: state[a] = c + elif op == 1: + src = center if b == n else b; assert src is not None + if i > cut: + if src - v in owner: assert i > groups[owner[src-v]]['close'], 'active group target used as a source' + if a - v in owner and i <= groups[owner[a-v]]['close']: + assert not (v <= src < 2*v), 'target source inside an active prefix'; responses[a-v] ^= cols[src] + assert c % 2; cols[a] ^= cols[src] + elif op == 2: assert center is None; center = a; state[b] = f + elif op == 3: assert center == a; center = None; del state[b] + for j in atclose.get(i, []): + g = groups[j]; R = responses[g['dependent']] + for p in g['retained']: R ^= responses[p] + assert R == 0, ('literal prefix dependency fails', j) + for m in [g['dependent']] + g['retained']: assert sub(state[v+m], g['frame']), ('member frame not inside close frame', j, m) +assert center is None +# emit +zmax = max(old[k+5] for k in range(0, len(old), 6) if old[k] == 1); SETUP, RESTORE = zmax + 1, zmax + 2 +state = dict(initial); out = array('i'); center = None; deleted = []; inserted = 0 +def move(s, f): + before = state[s] + if before == f: return + assert sub(before, f), ('nonnested actual use', s, before, f) + gap = frames[f]['d'] - frames[before]['d']; assert gap >= 0; out.extend((0, s, before, f, gap, 0)); state[s] = f +def add(a, b, c, f, z): move(a, f); move(b, f); out.extend((1, a, b, c, f, z)) +for k in range(0, len(old), 6): + op, a, b, c, f, z = old[k:k+6]; i = k//6 + if op == 1: + j = dep_of.get(a - v) + if j is not None and cut < i <= groups[j]['close']: assert not (v <= b < 2*v); deleted.append(i) + else: add(a, b, c, f, z) + elif op == 2: assert center is None; move(a, c); out.extend((op, a, b, c, f, z)); state[b] = f; center = (a, b, c) + elif op == 3: assert center == (a, b, c) and state[a] == c and state[b] == f; out.extend((op, a, b, c, f, z)); del state[b]; center = None + if i == cut: + assert center is None and all(state[v+m] == ZERO for m in owner) + for g in groups: + for p in g['retained']: add(v+g['dependent'], v+p, -1, ZERO, SETUP); inserted += 1 + for j in atclose.get(i, []): + g = groups[j] + for m in [g['dependent']] + g['retained']: move(v+m, g['frame']) + for p in g['retained']: add(v+g['dependent'], v+p, 1, g['frame'], RESTORE); inserted += 1 +for s in sorted(final): move(s, final[s]) +assert center is None and state == final +# census from needs, independent of emitted MOVEs +needs = {i: [] for i in initial}; copies = Counter(); copy = None +for k in range(0, len(out), 6): + op, a, b, c, f, z = out[k:k+6] + if op == 1: + assert c % 2; needs[a].append(f) + if b != n: needs[b].append(f) + else: assert copy is not None and f == ZERO + elif op == 2: assert copy is None; copy = (a, b, c); needs[a].append(c); copies[frames[c]['d']] += 1 + elif op == 3: assert copy == (a, b, c); copy = None +assert copy is None and copies == {22: 24} +census = Counter(copies); pairs = set() +for s, before in initial.items(): + for f in needs[s] + [final[s]]: + assert sub(before, f); r = frames[f]['d'] - frames[before]['d'] + if r: census[r] += 1 + pairs.add((before, f)); before = f +for f in {f for pair in pairs for f in pair}: assert nondeg(f) +for a, b in pairs: assert len(frames[b]['A']) <= len(frames[a]['A']) and all(dot(x, y) == 0 for x in frames[b]['A'] for y in frames[a]['B']) +for t in range(v): + f = final[v+t]; assert frames[f]['d'] == 23 and all(dot(cov[t], b) == 0 for b in frames[f]['B']) +hist = Counter(); state = dict(initial); copy = None; count = 0 +for k in range(0, len(out), 6): + op, a, b, c, f, z = out[k:k+6] + if op == 0: + assert state[a] == b and sub(b, c) and frames[c]['d'] - frames[b]['d'] == f; state[a] = c + if f: hist[f] += 1 + elif op == 1: assert state[a] == state[b] == f and a != b; count += 1 + elif op == 2: assert copy is None and state[a] == c and f == ZERO and z == 22; state[b] = f; hist[z] += 1; copy = (a, b, c) + else: assert copy == (a, b, c) and state[a] == c and state[b] == f == ZERO; del state[b]; copy = None +assert state == final and hist == census and copy is None +# forward and inverse all-column replays with arbitrary dirty contents +def replay(records, reverse=False, omit=None): + columns = [1 << i for i in range(n)]; wanted = columns[:]; center = None; cnt = 0 + for t in range(v): wanted[v+t] ^= 1 << t + for k in (range(len(records)-6, -1, -6) if reverse else range(0, len(records), 6)): + op, a, b, c, f, z = records[k:k+6] + if op == 1: + if b == n: assert center is not None; b = center + if k//6 == omit: continue + assert c % 2 and a != b; columns[a] ^= columns[b]; cnt += 1 + elif op == (3 if reverse else 2): assert center is None; center = a + elif op == (2 if reverse else 3): assert center == a; center = None + assert center is None and columns == wanted, 'all-column endpoint failure' + return cnt +assert replay(out) == replay(out, True) == count +first_setup = next(k//6 for k in range(0, len(out), 6) if out[k] == 1 and out[k+5] == SETUP) +try: replay(out, omit=first_setup) +except AssertionError: negative = 'omitted target-prefix setup rejected' +else: raise AssertionError('missing setup admitted') +replay_path = LEAD/'COHORT249-REPLAY.json' +if replay_path.exists(): + replay_json = json.loads(replay_path.read_text()); oldH = Counter({int(r): c for r, c in replay_json['histogram'].items()}) +else: + replay_json = None; oldH = Counter({22: 24}) + for k in range(0, len(old), 6): + if old[k] == 0 and old[k+4]: oldH[old[k+4]] += 1 +delta = Counter(hist); delta.subtract(oldH); delta = {r: c for r, c in delta.items() if c} +assert delta == {int(r): c for r, c in sel['expected_local_histogram_delta'].items()}, ('histogram delta', delta) +assert sum(r*c for r, c in hist.items()) == sum(r*c for r, c in oldH.items()) and (replay_json is None or sum(r*c for r, c in hist.items()) == replay_json['new_rank_mass']) +assert (len(deleted), inserted, count) == (sel["expected_deleted_reads"], sel["expected_inserted_additions"], sel["expected_scalar_additions"]), ("counts", len(deleted), inserted, count) +(LEAD/'COHORT249-PRE-TARGET-RECORDS.bin').write_bytes(old.tobytes()) +(LEAD/'COHORT249-RECORDS.bin').write_bytes(out.tobytes()) +if replay_json is not None: + combined = Counter({int(r): c for r, c in replay_json['delta'].items()}); combined.update(delta); combined = {r: c for r, c in combined.items() if c} + replay_json.update(status='PASS_FULL_CURRENT249_COHORT_REWRITE_AND_TARGET_PREFIX_COMPRESSION', pre_target_records=len(old)//6, new_records=len(out)//6, + pre_target_histogram=replay_json['histogram'], pre_target_delta=replay_json['delta'], histogram={str(r): c for r, c in sorted(hist.items())}, + delta={str(r): c for r, c in sorted(combined.items())}, target_prefix_delta={str(r): c for r, c in sorted(delta.items())}, + target_prefix_groups=len(groups), target_prefix_deleted_reads=len(deleted), target_prefix_setup_restore_additions=inserted) + (LEAD/'COHORT249-REPLAY.json').write_text(json.dumps(replay_json, indent=2) + '\n') +receipt = dict(status='PASS_EXACT_F2_TARGET_PREFIX_COMPRESSION', selected_groups=len(groups), targets=len(owner), cut_record=cut, deleted_prefix_adds=len(deleted), + inserted_setup_restore_adds=inserted, literal_prefix_dependencies_checked=True, remaining_payload_additions=count, + local_histogram_delta={str(r): c for r, c in sorted(delta.items())}, rank_mass=sum(r*c for r, c in hist.items()), paid_calls=sum(hist.values()), + both_reflected_ledgers=True, unchanged_all_input_output_frames=True, unchanged_copy_lifetimes=True, forward_and_inverse_all_columns=True, + negative_control=negative, unique_required_frame_pairs=len(pairs), setup_category=SETUP, restore_category=RESTORE, + input_record_sha256=sel['input_record_sha256'], output_record_sha256=hashlib.sha256(out.tobytes()).hexdigest(), selection_sha256=hashlib.sha256(SEL.read_bytes()).hexdigest()) +(LEAD/'TARGET-PREFIX.json').write_text(json.dumps(receipt, indent=2) + '\n') +print('PASS target prefix', len(groups), 'groups', count, 'ADDs', sum(hist.values()), 'paid calls', len(out)//6, 'records', flush=True) diff --git a/research/w3-restore/inputs/bank-plan.json b/research/w3-restore/inputs/bank-plan.json new file mode 100644 index 0000000000..7931294e65 --- /dev/null +++ b/research/w3-restore/inputs/bank-plan.json @@ -0,0 +1,333 @@ +{ + "replicas": 40, + "census": { + "3": 438, + "4": 1762, + "6": 22, + "7": 5, + "11": 24, + "12": 13, + "23": 810, + "24": 12058 + }, + "patterns": [ + { + "widths": [ + 4, + 4, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "count": 1 + }, + { + "widths": [ + 7, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "count": 7 + }, + { + "widths": [ + 7, + 7, + 4, + 4, + 4, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "count": 1 + }, + { + "widths": [ + 7, + 7, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 4 + ], + "count": 50 + }, + { + "widths": [ + 11, + 11, + 11, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 3 + ], + "count": 1 + }, + { + "widths": [ + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 7, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "count": 91 + }, + { + "widths": [ + 23, + 23, + 11, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "count": 320 + }, + { + "widths": [ + 23, + 23, + 23, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 4, + 3 + ], + "count": 5792 + }, + { + "widths": [ + 23, + 23, + 23, + 12, + 12, + 12, + 12, + 3 + ], + "count": 130 + }, + { + "widths": [ + 23, + 23, + 23, + 23, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "count": 2 + }, + { + "widths": [ + 24, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6, + 6 + ], + "count": 1 + }, + { + "widths": [ + 24, + 24, + 23, + 23, + 23, + 3 + ], + "count": 4662 + }, + { + "widths": [ + 24, + 24, + 24, + 24, + 24 + ], + "count": 94599 + } + ] +} \ No newline at end of file diff --git a/research/w3-restore/inputs/target-selection.json b/research/w3-restore/inputs/target-selection.json new file mode 100644 index 0000000000..8eb4d7efeb --- /dev/null +++ b/research/w3-restore/inputs/target-selection.json @@ -0,0 +1,2326 @@ +{ + "status": "FROZEN_TARGET_PREFIX_SELECTION", + "cut_record": 876399, + "input_record_sha256": "a9501525563d3ec656ebf01aea9f2c9839e033563ea4a022500d68b12756ae86", + "input_record_count": 1026620, + "selected_groups": 209, + "expected_local_histogram_delta": { + "1": -209, + "2": -7, + "3": -1, + "4": -4, + "8": -2, + "9": -4, + "12": -2, + "13": 4, + "17": -1, + "18": -7, + "20": -199, + "21": 209 + }, + "expected_deleted_reads": 1057, + "expected_inserted_additions": 1254, + "expected_scalar_additions": 934582, + "provenance": "tp_search2.py on the w3 word (PR310): squares of four targets whose rank-20 entrance helpers are read by exactly two of the four; the dependent target's frame-20 reads are the F2 sum of its three square-mates'; restore at the square's common nondegenerate 21-dimensional frame. Prepared by Rohan Arun with Anthropic Claude assistance.", + "groups": [ + { + "dependent": 12, + "retained": [ + 13, + 14, + 15 + ], + "close_after_record": 882760, + "frame": 25215, + "close_rank": 21 + }, + { + "dependent": 20, + "retained": [ + 21, + 22, + 23 + ], + "close_after_record": 882750, + "frame": 25237, + "close_rank": 21 + }, + { + "dependent": 28, + "retained": [ + 29, + 30, + 31 + ], + "close_after_record": 882744, + "frame": 25259, + "close_rank": 21 + }, + { + "dependent": 36, + "retained": [ + 37, + 38, + 39 + ], + "close_after_record": 882756, + "frame": 25281, + "close_rank": 21 + }, + { + "dependent": 52, + "retained": [ + 53, + 54, + 55 + ], + "close_after_record": 882758, + "frame": 25325, + "close_rank": 21 + }, + { + "dependent": 60, + "retained": [ + 61, + 62, + 63 + ], + "close_after_record": 882752, + "frame": 25347, + "close_rank": 21 + }, + { + "dependent": 68, + "retained": [ + 69, + 70, + 71 + ], + "close_after_record": 882762, + "frame": 25369, + "close_rank": 21 + }, + { + "dependent": 84, + "retained": [ + 85, + 86, + 87 + ], + "close_after_record": 882712, + "frame": 25413, + "close_rank": 21 + }, + { + "dependent": 92, + "retained": [ + 93, + 94, + 95 + ], + "close_after_record": 882694, + "frame": 25435, + "close_rank": 21 + }, + { + "dependent": 100, + "retained": [ + 101, + 102, + 103 + ], + "close_after_record": 882686, + "frame": 25457, + "close_rank": 21 + }, + { + "dependent": 108, + "retained": [ + 109, + 110, + 111 + ], + "close_after_record": 882708, + "frame": 25479, + "close_rank": 21 + }, + { + "dependent": 116, + "retained": [ + 117, + 118, + 119 + ], + "close_after_record": 882690, + "frame": 25501, + "close_rank": 21 + }, + { + "dependent": 124, + "retained": [ + 125, + 126, + 127 + ], + "close_after_record": 882710, + "frame": 25523, + "close_rank": 21 + }, + { + "dependent": 132, + "retained": [ + 133, + 134, + 135 + ], + "close_after_record": 882698, + "frame": 25545, + "close_rank": 21 + }, + { + "dependent": 140, + "retained": [ + 141, + 142, + 143 + ], + "close_after_record": 882720, + "frame": 25567, + "close_rank": 21 + }, + { + "dependent": 148, + "retained": [ + 149, + 150, + 151 + ], + "close_after_record": 882692, + "frame": 25589, + "close_rank": 21 + }, + { + "dependent": 156, + "retained": [ + 157, + 158, + 159 + ], + "close_after_record": 882610, + "frame": 25611, + "close_rank": 21 + }, + { + "dependent": 164, + "retained": [ + 165, + 166, + 167 + ], + "close_after_record": 882594, + "frame": 25633, + "close_rank": 21 + }, + { + "dependent": 172, + "retained": [ + 173, + 174, + 175 + ], + "close_after_record": 882626, + "frame": 25655, + "close_rank": 21 + }, + { + "dependent": 180, + "retained": [ + 181, + 182, + 183 + ], + "close_after_record": 882600, + "frame": 25677, + "close_rank": 21 + }, + { + "dependent": 188, + "retained": [ + 189, + 190, + 191 + ], + "close_after_record": 882628, + "frame": 25699, + "close_rank": 21 + }, + { + "dependent": 196, + "retained": [ + 197, + 198, + 199 + ], + "close_after_record": 882616, + "frame": 25721, + "close_rank": 21 + }, + { + "dependent": 204, + "retained": [ + 205, + 206, + 207 + ], + "close_after_record": 882644, + "frame": 25743, + "close_rank": 21 + }, + { + "dependent": 212, + "retained": [ + 213, + 214, + 215 + ], + "close_after_record": 882602, + "frame": 25765, + "close_rank": 21 + }, + { + "dependent": 228, + "retained": [ + 229, + 230, + 231 + ], + "close_after_record": 882512, + "frame": 25809, + "close_rank": 21 + }, + { + "dependent": 236, + "retained": [ + 237, + 238, + 239 + ], + "close_after_record": 882478, + "frame": 25831, + "close_rank": 21 + }, + { + "dependent": 244, + "retained": [ + 245, + 246, + 247 + ], + "close_after_record": 882516, + "frame": 25853, + "close_rank": 21 + }, + { + "dependent": 252, + "retained": [ + 253, + 254, + 255 + ], + "close_after_record": 882502, + "frame": 25875, + "close_rank": 21 + }, + { + "dependent": 260, + "retained": [ + 261, + 262, + 263 + ], + "close_after_record": 882536, + "frame": 25897, + "close_rank": 21 + }, + { + "dependent": 268, + "retained": [ + 269, + 270, + 271 + ], + "close_after_record": 882480, + "frame": 25919, + "close_rank": 21 + }, + { + "dependent": 276, + "retained": [ + 277, + 278, + 279 + ], + "close_after_record": 882374, + "frame": 25941, + "close_rank": 21 + }, + { + "dependent": 284, + "retained": [ + 285, + 286, + 287 + ], + "close_after_record": 882332, + "frame": 25963, + "close_rank": 21 + }, + { + "dependent": 292, + "retained": [ + 293, + 294, + 295 + ], + "close_after_record": 882378, + "frame": 25985, + "close_rank": 21 + }, + { + "dependent": 300, + "retained": [ + 301, + 302, + 303 + ], + "close_after_record": 882362, + "frame": 26007, + "close_rank": 21 + }, + { + "dependent": 308, + "retained": [ + 309, + 310, + 311 + ], + "close_after_record": 882400, + "frame": 26029, + "close_rank": 21 + }, + { + "dependent": 316, + "retained": [ + 317, + 318, + 319 + ], + "close_after_record": 882334, + "frame": 26051, + "close_rank": 21 + }, + { + "dependent": 324, + "retained": [ + 325, + 326, + 327 + ], + "close_after_record": 882164, + "frame": 26073, + "close_rank": 21 + }, + { + "dependent": 332, + "retained": [ + 333, + 334, + 335 + ], + "close_after_record": 882214, + "frame": 26095, + "close_rank": 21 + }, + { + "dependent": 340, + "retained": [ + 341, + 342, + 343 + ], + "close_after_record": 882196, + "frame": 26117, + "close_rank": 21 + }, + { + "dependent": 348, + "retained": [ + 349, + 350, + 351 + ], + "close_after_record": 882238, + "frame": 26139, + "close_rank": 21 + }, + { + "dependent": 356, + "retained": [ + 357, + 358, + 359 + ], + "close_after_record": 882166, + "frame": 26161, + "close_rank": 21 + }, + { + "dependent": 364, + "retained": [ + 365, + 366, + 367 + ], + "close_after_record": 882032, + "frame": 26183, + "close_rank": 21 + }, + { + "dependent": 372, + "retained": [ + 373, + 374, + 375 + ], + "close_after_record": 882012, + "frame": 26205, + "close_rank": 21 + }, + { + "dependent": 380, + "retained": [ + 381, + 382, + 383 + ], + "close_after_record": 882058, + "frame": 26227, + "close_rank": 21 + }, + { + "dependent": 388, + "retained": [ + 389, + 390, + 391 + ], + "close_after_record": 881978, + "frame": 26249, + "close_rank": 21 + }, + { + "dependent": 396, + "retained": [ + 397, + 398, + 399 + ], + "close_after_record": 881812, + "frame": 26271, + "close_rank": 21 + }, + { + "dependent": 404, + "retained": [ + 405, + 406, + 407 + ], + "close_after_record": 881862, + "frame": 26293, + "close_rank": 21 + }, + { + "dependent": 412, + "retained": [ + 413, + 414, + 415 + ], + "close_after_record": 881776, + "frame": 26315, + "close_rank": 21 + }, + { + "dependent": 420, + "retained": [ + 421, + 422, + 423 + ], + "close_after_record": 881652, + "frame": 26337, + "close_rank": 21 + }, + { + "dependent": 428, + "retained": [ + 429, + 430, + 431 + ], + "close_after_record": 881564, + "frame": 26359, + "close_rank": 21 + }, + { + "dependent": 436, + "retained": [ + 437, + 438, + 439 + ], + "close_after_record": 881348, + "frame": 26381, + "close_rank": 21 + }, + { + "dependent": 444, + "retained": [ + 445, + 446, + 447 + ], + "close_after_record": 882714, + "frame": 26403, + "close_rank": 21 + }, + { + "dependent": 452, + "retained": [ + 453, + 454, + 455 + ], + "close_after_record": 882696, + "frame": 26425, + "close_rank": 21 + }, + { + "dependent": 460, + "retained": [ + 461, + 462, + 463 + ], + "close_after_record": 882700, + "frame": 26447, + "close_rank": 21 + }, + { + "dependent": 468, + "retained": [ + 469, + 470, + 471 + ], + "close_after_record": 882706, + "frame": 26469, + "close_rank": 21 + }, + { + "dependent": 476, + "retained": [ + 477, + 478, + 479 + ], + "close_after_record": 882718, + "frame": 26491, + "close_rank": 21 + }, + { + "dependent": 484, + "retained": [ + 485, + 486, + 487 + ], + "close_after_record": 882702, + "frame": 26513, + "close_rank": 21 + }, + { + "dependent": 492, + "retained": [ + 493, + 494, + 495 + ], + "close_after_record": 882688, + "frame": 26535, + "close_rank": 21 + }, + { + "dependent": 500, + "retained": [ + 501, + 502, + 503 + ], + "close_after_record": 882716, + "frame": 26557, + "close_rank": 21 + }, + { + "dependent": 508, + "retained": [ + 509, + 510, + 511 + ], + "close_after_record": 882722, + "frame": 26579, + "close_rank": 21 + }, + { + "dependent": 516, + "retained": [ + 517, + 518, + 519 + ], + "close_after_record": 882614, + "frame": 26601, + "close_rank": 21 + }, + { + "dependent": 524, + "retained": [ + 525, + 526, + 527 + ], + "close_after_record": 882618, + "frame": 26623, + "close_rank": 21 + }, + { + "dependent": 532, + "retained": [ + 533, + 534, + 535 + ], + "close_after_record": 882624, + "frame": 26645, + "close_rank": 21 + }, + { + "dependent": 540, + "retained": [ + 541, + 542, + 543 + ], + "close_after_record": 882642, + "frame": 26667, + "close_rank": 21 + }, + { + "dependent": 548, + "retained": [ + 549, + 550, + 551 + ], + "close_after_record": 882620, + "frame": 26689, + "close_rank": 21 + }, + { + "dependent": 556, + "retained": [ + 557, + 558, + 559 + ], + "close_after_record": 882596, + "frame": 26711, + "close_rank": 21 + }, + { + "dependent": 564, + "retained": [ + 565, + 566, + 567 + ], + "close_after_record": 882638, + "frame": 26733, + "close_rank": 21 + }, + { + "dependent": 572, + "retained": [ + 573, + 574, + 575 + ], + "close_after_record": 882646, + "frame": 26755, + "close_rank": 21 + }, + { + "dependent": 580, + "retained": [ + 581, + 582, + 583 + ], + "close_after_record": 882504, + "frame": 26777, + "close_rank": 21 + }, + { + "dependent": 588, + "retained": [ + 589, + 590, + 591 + ], + "close_after_record": 882510, + "frame": 26799, + "close_rank": 21 + }, + { + "dependent": 596, + "retained": [ + 597, + 598, + 599 + ], + "close_after_record": 882530, + "frame": 26821, + "close_rank": 21 + }, + { + "dependent": 604, + "retained": [ + 605, + 606, + 607 + ], + "close_after_record": 882506, + "frame": 26843, + "close_rank": 21 + }, + { + "dependent": 612, + "retained": [ + 613, + 614, + 615 + ], + "close_after_record": 882474, + "frame": 26865, + "close_rank": 21 + }, + { + "dependent": 620, + "retained": [ + 621, + 622, + 623 + ], + "close_after_record": 882526, + "frame": 26887, + "close_rank": 21 + }, + { + "dependent": 628, + "retained": [ + 629, + 630, + 631 + ], + "close_after_record": 882538, + "frame": 26909, + "close_rank": 21 + }, + { + "dependent": 636, + "retained": [ + 637, + 638, + 639 + ], + "close_after_record": 882372, + "frame": 26931, + "close_rank": 21 + }, + { + "dependent": 644, + "retained": [ + 645, + 646, + 647 + ], + "close_after_record": 882392, + "frame": 26953, + "close_rank": 21 + }, + { + "dependent": 652, + "retained": [ + 653, + 654, + 655 + ], + "close_after_record": 882368, + "frame": 26975, + "close_rank": 21 + }, + { + "dependent": 660, + "retained": [ + 661, + 662, + 663 + ], + "close_after_record": 882326, + "frame": 26997, + "close_rank": 21 + }, + { + "dependent": 668, + "retained": [ + 669, + 670, + 671 + ], + "close_after_record": 882388, + "frame": 27019, + "close_rank": 21 + }, + { + "dependent": 676, + "retained": [ + 677, + 678, + 679 + ], + "close_after_record": 882402, + "frame": 27041, + "close_rank": 21 + }, + { + "dependent": 684, + "retained": [ + 685, + 686, + 687 + ], + "close_after_record": 882230, + "frame": 27063, + "close_rank": 21 + }, + { + "dependent": 692, + "retained": [ + 693, + 694, + 695 + ], + "close_after_record": 882204, + "frame": 27085, + "close_rank": 21 + }, + { + "dependent": 700, + "retained": [ + 701, + 702, + 703 + ], + "close_after_record": 882156, + "frame": 27107, + "close_rank": 21 + }, + { + "dependent": 708, + "retained": [ + 709, + 710, + 711 + ], + "close_after_record": 882226, + "frame": 27129, + "close_rank": 21 + }, + { + "dependent": 716, + "retained": [ + 717, + 718, + 719 + ], + "close_after_record": 882240, + "frame": 27151, + "close_rank": 21 + }, + { + "dependent": 724, + "retained": [ + 725, + 726, + 727 + ], + "close_after_record": 882020, + "frame": 27173, + "close_rank": 21 + }, + { + "dependent": 732, + "retained": [ + 733, + 734, + 735 + ], + "close_after_record": 881968, + "frame": 27195, + "close_rank": 21 + }, + { + "dependent": 740, + "retained": [ + 741, + 742, + 743 + ], + "close_after_record": 882046, + "frame": 27217, + "close_rank": 21 + }, + { + "dependent": 748, + "retained": [ + 749, + 750, + 751 + ], + "close_after_record": 882060, + "frame": 27239, + "close_rank": 21 + }, + { + "dependent": 756, + "retained": [ + 757, + 758, + 759 + ], + "close_after_record": 881766, + "frame": 27261, + "close_rank": 21 + }, + { + "dependent": 764, + "retained": [ + 765, + 766, + 767 + ], + "close_after_record": 881850, + "frame": 27283, + "close_rank": 21 + }, + { + "dependent": 772, + "retained": [ + 773, + 774, + 775 + ], + "close_after_record": 881864, + "frame": 27305, + "close_rank": 21 + }, + { + "dependent": 780, + "retained": [ + 781, + 782, + 783 + ], + "close_after_record": 881640, + "frame": 27327, + "close_rank": 21 + }, + { + "dependent": 788, + "retained": [ + 789, + 790, + 791 + ], + "close_after_record": 881656, + "frame": 27349, + "close_rank": 21 + }, + { + "dependent": 796, + "retained": [ + 797, + 798, + 799 + ], + "close_after_record": 881440, + "frame": 27371, + "close_rank": 21 + }, + { + "dependent": 804, + "retained": [ + 805, + 806, + 807 + ], + "close_after_record": 882640, + "frame": 27393, + "close_rank": 21 + }, + { + "dependent": 812, + "retained": [ + 813, + 814, + 815 + ], + "close_after_record": 882608, + "frame": 27415, + "close_rank": 21 + }, + { + "dependent": 820, + "retained": [ + 821, + 822, + 823 + ], + "close_after_record": 882636, + "frame": 27437, + "close_rank": 21 + }, + { + "dependent": 828, + "retained": [ + 829, + 830, + 831 + ], + "close_after_record": 882598, + "frame": 27459, + "close_rank": 21 + }, + { + "dependent": 836, + "retained": [ + 837, + 838, + 839 + ], + "close_after_record": 882604, + "frame": 27481, + "close_rank": 21 + }, + { + "dependent": 844, + "retained": [ + 845, + 846, + 847 + ], + "close_after_record": 882634, + "frame": 27503, + "close_rank": 21 + }, + { + "dependent": 852, + "retained": [ + 853, + 854, + 855 + ], + "close_after_record": 882612, + "frame": 27525, + "close_rank": 21 + }, + { + "dependent": 860, + "retained": [ + 861, + 862, + 863 + ], + "close_after_record": 882606, + "frame": 27547, + "close_rank": 21 + }, + { + "dependent": 924, + "retained": [ + 925, + 926, + 927 + ], + "close_after_record": 882386, + "frame": 27723, + "close_rank": 21 + }, + { + "dependent": 932, + "retained": [ + 933, + 934, + 935 + ], + "close_after_record": 882330, + "frame": 27745, + "close_rank": 21 + }, + { + "dependent": 940, + "retained": [ + 941, + 942, + 943 + ], + "close_after_record": 882336, + "frame": 27767, + "close_rank": 21 + }, + { + "dependent": 948, + "retained": [ + 949, + 950, + 951 + ], + "close_after_record": 882384, + "frame": 27789, + "close_rank": 21 + }, + { + "dependent": 956, + "retained": [ + 957, + 958, + 959 + ], + "close_after_record": 882356, + "frame": 27811, + "close_rank": 21 + }, + { + "dependent": 964, + "retained": [ + 965, + 966, + 967 + ], + "close_after_record": 882342, + "frame": 27833, + "close_rank": 21 + }, + { + "dependent": 972, + "retained": [ + 973, + 974, + 975 + ], + "close_after_record": 882162, + "frame": 27855, + "close_rank": 21 + }, + { + "dependent": 980, + "retained": [ + 981, + 982, + 983 + ], + "close_after_record": 882168, + "frame": 27877, + "close_rank": 21 + }, + { + "dependent": 988, + "retained": [ + 989, + 990, + 991 + ], + "close_after_record": 882220, + "frame": 27899, + "close_rank": 21 + }, + { + "dependent": 996, + "retained": [ + 997, + 998, + 999 + ], + "close_after_record": 882190, + "frame": 27921, + "close_rank": 21 + }, + { + "dependent": 1004, + "retained": [ + 1005, + 1006, + 1007 + ], + "close_after_record": 882176, + "frame": 27943, + "close_rank": 21 + }, + { + "dependent": 1012, + "retained": [ + 1013, + 1014, + 1015 + ], + "close_after_record": 881980, + "frame": 27965, + "close_rank": 21 + }, + { + "dependent": 1020, + "retained": [ + 1021, + 1022, + 1023 + ], + "close_after_record": 882040, + "frame": 27987, + "close_rank": 21 + }, + { + "dependent": 1028, + "retained": [ + 1029, + 1030, + 1031 + ], + "close_after_record": 882004, + "frame": 28009, + "close_rank": 21 + }, + { + "dependent": 1036, + "retained": [ + 1037, + 1038, + 1039 + ], + "close_after_record": 881988, + "frame": 28031, + "close_rank": 21 + }, + { + "dependent": 1044, + "retained": [ + 1045, + 1046, + 1047 + ], + "close_after_record": 881844, + "frame": 28053, + "close_rank": 21 + }, + { + "dependent": 1052, + "retained": [ + 1053, + 1054, + 1055 + ], + "close_after_record": 881804, + "frame": 28075, + "close_rank": 21 + }, + { + "dependent": 1060, + "retained": [ + 1061, + 1062, + 1063 + ], + "close_after_record": 881786, + "frame": 28097, + "close_rank": 21 + }, + { + "dependent": 1068, + "retained": [ + 1069, + 1070, + 1071 + ], + "close_after_record": 881594, + "frame": 28119, + "close_rank": 21 + }, + { + "dependent": 1076, + "retained": [ + 1077, + 1078, + 1079 + ], + "close_after_record": 881574, + "frame": 28141, + "close_rank": 21 + }, + { + "dependent": 1084, + "retained": [ + 1085, + 1086, + 1087 + ], + "close_after_record": 881358, + "frame": 28163, + "close_rank": 21 + }, + { + "dependent": 1092, + "retained": [ + 1093, + 1094, + 1095 + ], + "close_after_record": 882514, + "frame": 28185, + "close_rank": 21 + }, + { + "dependent": 1100, + "retained": [ + 1101, + 1102, + 1103 + ], + "close_after_record": 882532, + "frame": 28207, + "close_rank": 21 + }, + { + "dependent": 1108, + "retained": [ + 1109, + 1110, + 1111 + ], + "close_after_record": 882534, + "frame": 28229, + "close_rank": 21 + }, + { + "dependent": 1116, + "retained": [ + 1117, + 1118, + 1119 + ], + "close_after_record": 882498, + "frame": 28251, + "close_rank": 21 + }, + { + "dependent": 1124, + "retained": [ + 1125, + 1126, + 1127 + ], + "close_after_record": 882494, + "frame": 28273, + "close_rank": 21 + }, + { + "dependent": 1132, + "retained": [ + 1133, + 1134, + 1135 + ], + "close_after_record": 882484, + "frame": 28295, + "close_rank": 21 + }, + { + "dependent": 1140, + "retained": [ + 1141, + 1142, + 1143 + ], + "close_after_record": 882488, + "frame": 28317, + "close_rank": 21 + }, + { + "dependent": 1148, + "retained": [ + 1149, + 1150, + 1151 + ], + "close_after_record": 882396, + "frame": 28339, + "close_rank": 21 + }, + { + "dependent": 1156, + "retained": [ + 1157, + 1158, + 1159 + ], + "close_after_record": 882398, + "frame": 28361, + "close_rank": 21 + }, + { + "dependent": 1164, + "retained": [ + 1165, + 1166, + 1167 + ], + "close_after_record": 882358, + "frame": 28383, + "close_rank": 21 + }, + { + "dependent": 1172, + "retained": [ + 1173, + 1174, + 1175 + ], + "close_after_record": 882354, + "frame": 28405, + "close_rank": 21 + }, + { + "dependent": 1180, + "retained": [ + 1181, + 1182, + 1183 + ], + "close_after_record": 882338, + "frame": 28427, + "close_rank": 21 + }, + { + "dependent": 1188, + "retained": [ + 1189, + 1190, + 1191 + ], + "close_after_record": 882348, + "frame": 28449, + "close_rank": 21 + }, + { + "dependent": 1196, + "retained": [ + 1197, + 1198, + 1199 + ], + "close_after_record": 882236, + "frame": 28471, + "close_rank": 21 + }, + { + "dependent": 1204, + "retained": [ + 1205, + 1206, + 1207 + ], + "close_after_record": 882192, + "frame": 28493, + "close_rank": 21 + }, + { + "dependent": 1212, + "retained": [ + 1213, + 1214, + 1215 + ], + "close_after_record": 882188, + "frame": 28515, + "close_rank": 21 + }, + { + "dependent": 1220, + "retained": [ + 1221, + 1222, + 1223 + ], + "close_after_record": 882172, + "frame": 28537, + "close_rank": 21 + }, + { + "dependent": 1228, + "retained": [ + 1229, + 1230, + 1231 + ], + "close_after_record": 882182, + "frame": 28559, + "close_rank": 21 + }, + { + "dependent": 1236, + "retained": [ + 1237, + 1238, + 1239 + ], + "close_after_record": 882006, + "frame": 28581, + "close_rank": 21 + }, + { + "dependent": 1244, + "retained": [ + 1245, + 1246, + 1247 + ], + "close_after_record": 882002, + "frame": 28603, + "close_rank": 21 + }, + { + "dependent": 1252, + "retained": [ + 1253, + 1254, + 1255 + ], + "close_after_record": 881984, + "frame": 28625, + "close_rank": 21 + }, + { + "dependent": 1260, + "retained": [ + 1261, + 1262, + 1263 + ], + "close_after_record": 881994, + "frame": 28647, + "close_rank": 21 + }, + { + "dependent": 1268, + "retained": [ + 1269, + 1270, + 1271 + ], + "close_after_record": 881802, + "frame": 28669, + "close_rank": 21 + }, + { + "dependent": 1276, + "retained": [ + 1277, + 1278, + 1279 + ], + "close_after_record": 881782, + "frame": 28691, + "close_rank": 21 + }, + { + "dependent": 1284, + "retained": [ + 1285, + 1286, + 1287 + ], + "close_after_record": 881794, + "frame": 28713, + "close_rank": 21 + }, + { + "dependent": 1292, + "retained": [ + 1293, + 1294, + 1295 + ], + "close_after_record": 881570, + "frame": 28735, + "close_rank": 21 + }, + { + "dependent": 1300, + "retained": [ + 1301, + 1302, + 1303 + ], + "close_after_record": 881584, + "frame": 28757, + "close_rank": 21 + }, + { + "dependent": 1308, + "retained": [ + 1309, + 1310, + 1311 + ], + "close_after_record": 881368, + "frame": 28779, + "close_rank": 21 + }, + { + "dependent": 1316, + "retained": [ + 1317, + 1318, + 1319 + ], + "close_after_record": 882328, + "frame": 28801, + "close_rank": 21 + }, + { + "dependent": 1324, + "retained": [ + 1325, + 1326, + 1327 + ], + "close_after_record": 882344, + "frame": 28823, + "close_rank": 21 + }, + { + "dependent": 1332, + "retained": [ + 1333, + 1334, + 1335 + ], + "close_after_record": 882346, + "frame": 28845, + "close_rank": 21 + }, + { + "dependent": 1340, + "retained": [ + 1341, + 1342, + 1343 + ], + "close_after_record": 882340, + "frame": 28867, + "close_rank": 21 + }, + { + "dependent": 1348, + "retained": [ + 1349, + 1350, + 1351 + ], + "close_after_record": 882394, + "frame": 28889, + "close_rank": 21 + }, + { + "dependent": 1356, + "retained": [ + 1357, + 1358, + 1359 + ], + "close_after_record": 882364, + "frame": 28911, + "close_rank": 21 + }, + { + "dependent": 1364, + "retained": [ + 1365, + 1366, + 1367 + ], + "close_after_record": 882178, + "frame": 28933, + "close_rank": 21 + }, + { + "dependent": 1372, + "retained": [ + 1373, + 1374, + 1375 + ], + "close_after_record": 882180, + "frame": 28955, + "close_rank": 21 + }, + { + "dependent": 1380, + "retained": [ + 1381, + 1382, + 1383 + ], + "close_after_record": 882174, + "frame": 28977, + "close_rank": 21 + }, + { + "dependent": 1388, + "retained": [ + 1389, + 1390, + 1391 + ], + "close_after_record": 882232, + "frame": 28999, + "close_rank": 21 + }, + { + "dependent": 1396, + "retained": [ + 1397, + 1398, + 1399 + ], + "close_after_record": 882200, + "frame": 29021, + "close_rank": 21 + }, + { + "dependent": 1404, + "retained": [ + 1405, + 1406, + 1407 + ], + "close_after_record": 881992, + "frame": 29043, + "close_rank": 21 + }, + { + "dependent": 1412, + "retained": [ + 1413, + 1414, + 1415 + ], + "close_after_record": 881986, + "frame": 29065, + "close_rank": 21 + }, + { + "dependent": 1420, + "retained": [ + 1421, + 1422, + 1423 + ], + "close_after_record": 882052, + "frame": 29087, + "close_rank": 21 + }, + { + "dependent": 1428, + "retained": [ + 1429, + 1430, + 1431 + ], + "close_after_record": 882016, + "frame": 29109, + "close_rank": 21 + }, + { + "dependent": 1436, + "retained": [ + 1437, + 1438, + 1439 + ], + "close_after_record": 881784, + "frame": 29131, + "close_rank": 21 + }, + { + "dependent": 1444, + "retained": [ + 1445, + 1446, + 1447 + ], + "close_after_record": 881856, + "frame": 29153, + "close_rank": 21 + }, + { + "dependent": 1452, + "retained": [ + 1453, + 1454, + 1455 + ], + "close_after_record": 881816, + "frame": 29175, + "close_rank": 21 + }, + { + "dependent": 1460, + "retained": [ + 1461, + 1462, + 1463 + ], + "close_after_record": 881646, + "frame": 29197, + "close_rank": 21 + }, + { + "dependent": 1468, + "retained": [ + 1469, + 1470, + 1471 + ], + "close_after_record": 881606, + "frame": 29219, + "close_rank": 21 + }, + { + "dependent": 1476, + "retained": [ + 1477, + 1478, + 1479 + ], + "close_after_record": 881390, + "frame": 29241, + "close_rank": 21 + }, + { + "dependent": 1484, + "retained": [ + 1485, + 1486, + 1487 + ], + "close_after_record": 882242, + "frame": 29263, + "close_rank": 21 + }, + { + "dependent": 1492, + "retained": [ + 1493, + 1494, + 1495 + ], + "close_after_record": 882170, + "frame": 29285, + "close_rank": 21 + }, + { + "dependent": 1500, + "retained": [ + 1501, + 1502, + 1503 + ], + "close_after_record": 882158, + "frame": 29307, + "close_rank": 21 + }, + { + "dependent": 1508, + "retained": [ + 1509, + 1510, + 1511 + ], + "close_after_record": 882198, + "frame": 29329, + "close_rank": 21 + }, + { + "dependent": 1516, + "retained": [ + 1517, + 1518, + 1519 + ], + "close_after_record": 882224, + "frame": 29351, + "close_rank": 21 + }, + { + "dependent": 1524, + "retained": [ + 1525, + 1526, + 1527 + ], + "close_after_record": 881982, + "frame": 29373, + "close_rank": 21 + }, + { + "dependent": 1532, + "retained": [ + 1533, + 1534, + 1535 + ], + "close_after_record": 881970, + "frame": 29395, + "close_rank": 21 + }, + { + "dependent": 1540, + "retained": [ + 1541, + 1542, + 1543 + ], + "close_after_record": 882014, + "frame": 29417, + "close_rank": 21 + }, + { + "dependent": 1548, + "retained": [ + 1549, + 1550, + 1551 + ], + "close_after_record": 882044, + "frame": 29439, + "close_rank": 21 + }, + { + "dependent": 1556, + "retained": [ + 1557, + 1558, + 1559 + ], + "close_after_record": 881768, + "frame": 29461, + "close_rank": 21 + }, + { + "dependent": 1564, + "retained": [ + 1565, + 1566, + 1567 + ], + "close_after_record": 881814, + "frame": 29483, + "close_rank": 21 + }, + { + "dependent": 1572, + "retained": [ + 1573, + 1574, + 1575 + ], + "close_after_record": 881848, + "frame": 29505, + "close_rank": 21 + }, + { + "dependent": 1580, + "retained": [ + 1581, + 1582, + 1583 + ], + "close_after_record": 881604, + "frame": 29527, + "close_rank": 21 + }, + { + "dependent": 1588, + "retained": [ + 1589, + 1590, + 1591 + ], + "close_after_record": 881638, + "frame": 29549, + "close_rank": 21 + }, + { + "dependent": 1596, + "retained": [ + 1597, + 1598, + 1599 + ], + "close_after_record": 881422, + "frame": 29571, + "close_rank": 21 + }, + { + "dependent": 1604, + "retained": [ + 1605, + 1606, + 1607 + ], + "close_after_record": 882024, + "frame": 29593, + "close_rank": 21 + }, + { + "dependent": 1612, + "retained": [ + 1613, + 1614, + 1615 + ], + "close_after_record": 881998, + "frame": 29615, + "close_rank": 21 + }, + { + "dependent": 1620, + "retained": [ + 1621, + 1622, + 1623 + ], + "close_after_record": 882008, + "frame": 29637, + "close_rank": 21 + }, + { + "dependent": 1628, + "retained": [ + 1629, + 1630, + 1631 + ], + "close_after_record": 882036, + "frame": 29659, + "close_rank": 21 + }, + { + "dependent": 1636, + "retained": [ + 1637, + 1638, + 1639 + ], + "close_after_record": 881798, + "frame": 29681, + "close_rank": 21 + }, + { + "dependent": 1644, + "retained": [ + 1645, + 1646, + 1647 + ], + "close_after_record": 881808, + "frame": 29703, + "close_rank": 21 + }, + { + "dependent": 1652, + "retained": [ + 1653, + 1654, + 1655 + ], + "close_after_record": 881840, + "frame": 29725, + "close_rank": 21 + }, + { + "dependent": 1660, + "retained": [ + 1661, + 1662, + 1663 + ], + "close_after_record": 881598, + "frame": 29747, + "close_rank": 21 + }, + { + "dependent": 1668, + "retained": [ + 1669, + 1670, + 1671 + ], + "close_after_record": 881630, + "frame": 29769, + "close_rank": 21 + }, + { + "dependent": 1676, + "retained": [ + 1677, + 1678, + 1679 + ], + "close_after_record": 881414, + "frame": 29791, + "close_rank": 21 + }, + { + "dependent": 1684, + "retained": [ + 1685, + 1686, + 1687 + ], + "close_after_record": 881788, + "frame": 29813, + "close_rank": 21 + }, + { + "dependent": 1692, + "retained": [ + 1693, + 1694, + 1695 + ], + "close_after_record": 881830, + "frame": 29835, + "close_rank": 21 + }, + { + "dependent": 1700, + "retained": [ + 1701, + 1702, + 1703 + ], + "close_after_record": 881824, + "frame": 29857, + "close_rank": 21 + }, + { + "dependent": 1708, + "retained": [ + 1709, + 1710, + 1711 + ], + "close_after_record": 881620, + "frame": 29879, + "close_rank": 21 + }, + { + "dependent": 1716, + "retained": [ + 1717, + 1718, + 1719 + ], + "close_after_record": 881614, + "frame": 29901, + "close_rank": 21 + }, + { + "dependent": 1724, + "retained": [ + 1725, + 1726, + 1727 + ], + "close_after_record": 881398, + "frame": 29923, + "close_rank": 21 + }, + { + "dependent": 1732, + "retained": [ + 1733, + 1734, + 1735 + ], + "close_after_record": 881654, + "frame": 29945, + "close_rank": 21 + }, + { + "dependent": 1740, + "retained": [ + 1741, + 1742, + 1743 + ], + "close_after_record": 881578, + "frame": 29967, + "close_rank": 21 + }, + { + "dependent": 1748, + "retained": [ + 1749, + 1750, + 1751 + ], + "close_after_record": 881362, + "frame": 29989, + "close_rank": 21 + }, + { + "dependent": 1756, + "retained": [ + 1757, + 1758, + 1759 + ], + "close_after_record": 881336, + "frame": 30011, + "close_rank": 21 + } + ] +} \ No newline at end of file diff --git a/research/w3-restore/requirements.txt b/research/w3-restore/requirements.txt new file mode 100644 index 0000000000..d084b095fb --- /dev/null +++ b/research/w3-restore/requirements.txt @@ -0,0 +1,4 @@ +sympy==1.14.0 +numpy==2.3.5 +scipy==1.17.0 +mpmath==1.3.0 diff --git a/research/w3-restore/supplied/README.md b/research/w3-restore/supplied/README.md new file mode 100644 index 0000000000..8fdcb1e422 --- /dev/null +++ b/research/w3-restore/supplied/README.md @@ -0,0 +1,83 @@ +# w3: cube-layer and line-pair redesign of the PR249 bit word + +**Conditional κ = 94111687450666858500293 / 1.25·10²⁶ ≈ 7.528935·10⁻⁴.** +- That is **+5.824 %** over #270 (7.11457853376510·10⁻⁴). +- It is **+0.19 %** over the best open PR at packaging time: #309 at 7.51499·10⁻⁴; #308 is at 7.51472·10⁻⁴ and #306 at 7.51459·10⁻⁴. + +The bit coarse saving is c = 7.5346077·10⁻⁴. The bit side binds with the complex supplier of PR #233 (7547/10⁷) and with that of PR #304 (7635/10⁷); both give the same κ. With the old #193 supplier (7.47455·10⁻⁴), the complex side binds and κ = 7.46897·10⁻⁴ (+4.98 %). + +## What changed + +The base is the PR249 / source527 local word: 20,107 roles, the five-stage layout of PR234, m = 120. Only the local bit word changes. The deficit stays at 4,400 per set (35,200 in the normalized 40-replica units). + +1. **Design T (cube layer).** + - The four 011 X-mixes of each cube happen at 2-dim mix frames M. + - Each of the 8 non-mix tetra edges {a,b} gets a new 2-dim frame T = span(χa, χb). Its Gram matrix under G = I − J/9 is 2I. + - At T, two line registers and one starter make the two block copies directly. The starter ends up holding x_a, which is exactly the K4 "partner single". So singles ride on registers that are needed anyway. + - This covers all 220 cubes and frees 795 cube-layer helpers. +2. **Twin condensation of plane leftovers.** + - At 810 planes whose two arrivals are both mix-frame starters, the rank-forced leftover enters at the 1-dim intersection line of the two mix frames (entrance rank σ = 1) and is absorbed by the block holder. + - This adds 480 new 1-dim frames. +3. **Line-pair / all-but-one module template, found by SAT.** + - It uses 20 registers per line: 10 plane block holders plus 10 fresh registers, with two copies per block. + - The rounds are copies at s{X} (dim 3) → 5 triple frames (dim 7) → 5 six-block frames (dim 13) → final merge at F_Z (dim 21). + - This adds 1,320 new frames (dims 7 and 13) and frees 660 helpers. + +**Totals** +- 1,455 helpers are freed. They are encoded as entrance FULL (σ = 24) with no records. +- New entrance rank relative to PR249 = 35,280 = 3 · 11,760. That matches the stock drop of 11,760. It is not 795·24 + 810 + 660·24, because 36 of the 660 LP helpers already had σ > 0. +- There are 3,473 new frames, and every one is exactly nondegenerate. +- Local D per stage goes from 1,138,396 to 1,068,458.6 (−6.1 %). +- Normalized stock (40 replicas): 173,883 → 162,123. + +## Verify (about 1 minute) + + apt-get install -y g++ libboost-dev ; pip install numpy mpmath + bash verify.sh /tmp/w3-verify-work + +`verify.sh` runs these steps: +1. Rebuild the word and the PR249 base snapshot from the gzipped files (`reconstruct.py`). +2. Compile the **unmodified** official PR266 checkers (`checkers/official/*.cpp`, copied byte for byte from research/multicut-kernel-condensation-883/code). +3. Run `cohort-legality-independent`. Expected: PASS, ADD 934,385, rank mass 398,897, 24 COPY / 24 ERASE. +4. Run `cohort-five-stage-columns`. Expected: PASS on 23,627 formal F₂ columns, payload prefix 2⁹⁴ < 2¹⁰⁴. +5. Run the independent checker `checkT`, which replays legality, checks nondegeneracy mod p for all 22,228 used frames and replays formal F₂ over all 20,107 columns. Expected: all zeros. +6. Run `exactnd.py` for exact rational nondegeneracy (Bareiss) and exact annihilators of all 3,473 new frames. +7. Price with `cost.py` (moment root). +8. Run `kappa_w.py`: PR265/#270's fixed-prime engine (`fixed_prime_math.py` with the retained moment, base_two_moment and outer engines), η = 10⁻²⁴, β = 10⁻⁹, grid 10⁻²⁷, all 47 outer constraints, and rejection of the adjacent grid point. It runs once per complex supplier. + +The output of every step is recorded in `receipts/`. `receipts/pr256-complex233-verify.log` is a fresh PASS of PR #256's verifier, which re-checks PR #233's complex word at 7547/10⁷. + +Word SHA-256 (COHORT249-RECORDS.bin): `a9501525563d3ec656ebf01aea9f2c9839e033563ea4a022500d68b12756ae86`. + +## Files + +- `word/`: COHORT249-RECORDS.bin, COHORT249-FRAMES.json (new frames only, with B and exact annihilator A), COHORT249-INITIAL.json and an empty COHORT249-SELECTION.json (no kernel cohorts are selected). It also has the full w3 249-states.json and the frames.txt / states.txt exports used by checkT. +- `base/`: the PR249 snapshot (249-records.bin, 249-states.json, frames.json, donor ownership). The same snapshot is produced by `checkers/official/export249.py` from PR266's vendored pr249-source.zip. +- `checkers/official/`: the unmodified PR266 native checkers, plus json.hpp and export249.py. +- `checkers/independent/`: checkT.cpp + sub.hpp, exactnd.py, and exactprice.py (the PR234 certify() engine). +- `pricing/`: cost.py, kappa_w.py and the retained #270 engines. +- `builders/`: provenance only. + - Agent A's Design T builder (`build_v5.py`, `gather.py`, `addcomp.py`, `verify.cpp`) and twin step (`twin.py`). + - Agent B's LP builder (`build_lp.py`, `rebuild.sh`), the SAT design `sat/sol_z5_m3t6.json` with its models, and the census tools. + - The builders were written against local scratch paths and intermediate pickles that are not included. They show how the word was made; they are not needed to check it. + +## What is NOT done yet (for whoever publishes) + +The word-level checks pass with the unmodified official tools. The later native stages of the #270 pipeline hard-code facts about the PR249-derived word and must be generalized before an official replay. The exact items: + +1. **Bank review (`cohort-bank-review.cpp`).** + - It hard-codes the base residual census {4:2200, 6:22, 7:5, 11:48, 12:23, 15:2, 24:…} and expects the r = 24 count to be 14,287 minus the changed roles. + - w3's residual multiset is {0:1,455 (freed), 4:2,200, 6:22, 7:5, 11:24, 12:13, 23:810, 24:12,058}, with total residual 317,409, which is divisible by 3. + - A feasible width-120 tiling exists: mix(23,4,7)×8,100, rep(4,30)×973, rep(24,5)×96,464, and so on. Freed (r = 0) roles must be deleted rather than banked. +2. **Native price (`cohort-price.cpp`).** + - It hard-codes the old complex supplier 747454944651775/10¹⁸ and the PR266 baseline regression. + - Run it with w3's histogram and new_entrance_rank = 35,280, using the PR #233 or #304 complex constant. +3. **Finite invoice (`cohort-finite-invoice.cpp`).** + - It hard-codes R = 16,587 and `actual_role_replica_stage_assignments == 3,317,400`. + - With 1,455 freed roles these become 15,132 roles and 3,026,400 assignments. The bounds only shrink. +4. **Source binding.** + - Write a `verify.py` in the style of #270 that regenerates the base from the PR249 source. + - The w3 word itself can be shipped as data, as most open PRs do. Note that the `record_sha256` field inside 249-states.json is stale (inherited) and should be recomputed. +5. **Optional stacking.** The community's stage transforms (kernel entries, descent, target squares, restorations, sinks, reorder) were developed on PR249/gen5b words. Re-deriving them on w3 should add further small gains. + +The result is conditional on the same retained all-size interfaces as #270, #299 and the other open PRs: compiler, charts, selectors, routing, prime supply, precision/recovery and complex correctness. It is not a Lean certificate. diff --git a/research/w3-restore/supplied/SHA256SUMS b/research/w3-restore/supplied/SHA256SUMS new file mode 100644 index 0000000000..fc84e1db99 --- /dev/null +++ b/research/w3-restore/supplied/SHA256SUMS @@ -0,0 +1,86 @@ +23d6f6303c6187eac4a036b7f3c6c233214f40bfc1c8336374a740c00a9900e3 ./README.md +ab96904508a21ddd0c3d4d779974e5dcfdb1f19a3938ade647724cc317c3270b ./base/249-DONOR-OWNERSHIP.json +ded35ac806ab0f478265ef65d629ab3760771c84e44d00c7ec9995037e11960d ./base/249-records.bin.gz +c5f6d78de1a3b279ab05a263b80d1b25a587f20f39e1540134f4542e89e5530c ./base/249-states.json.gz +f68fa82180cd352421b8bc3f7a5c89d51bde74e74cd8d62c222c28b0f23fcf31 ./base/PR249-SOURCE-MANIFEST.json +0e92416f9525a6c6c14add4c73923916e6866aaf118180880e6cc5a2b7aa7d18 ./base/frames.json.gz +b9b33b797601d70d766b2d0ab86c95b36a8246ca10bbafd5ff40058daff3918d ./builders/agentA_designT/addcats.py +82e5ef0c7b6cf84c53bf6039330930242c9a5c8e8ea13183b2805cf9577f7129 ./builders/agentA_designT/addcomp.py +c55810a88f223c6853e67d7c021d7cd3c38b2c5837c751954c56d83d92762d88 ./builders/agentA_designT/build.py +a74a58cc3ffc6f9d173ebafbb8536bae27cb0e0a225a048b0423a65640998bf8 ./builders/agentA_designT/build_v5.py +8006cd7a70b290b8a6a6a49a75aa1104e0a601f13e5af16a0d0fd78ff23e225c ./builders/agentA_designT/checks.py +5ebcd626fadefd548a4392eae07fde6f6513ae908e463eaa56cb468ad6ae1651 ./builders/agentA_designT/gather.py +c0dec403eea5c23d3032a15af659eb44d01197894957e6e43c0247434ba1e703 ./builders/agentA_designT/interface.py +1195c34795e1434782b2c0b64058969cf0ab39a604740a3325cf4f6da08a8151 ./builders/agentA_designT/lpmod.py +3565c79f1c526f894b6f088fba01852e13fa26871db3bf5b7ec3b28bd6258bc2 ./builders/agentA_designT/modules.py +3a474d872095f87183a6e9207577c9643803fd4150ccfc890de0770ce43e6a57 ./builders/agentA_designT/names.py +7e6cb8b2b27aa2ad626056e585e325d49aa289fb9111077e3f3ebd7343987c66 ./builders/agentA_designT/upper.py +43a768d7de0837a353694e060d8a43cd9ed8e0e4e1e8bb7b28ef8de9db2c04cc ./builders/agentA_designT/verify.cpp +c580e23f98d532d96cb71db5063f7d55402a2ff081cc43a1b6338b3be8d6ff50 ./builders/agentA_twin/twin.py +5c2a423702d8d8b642be98962b113c814b06e5a6aaa8d3b6970b7466374b4da8 ./builders/agentA_twin/twinscan.py +82e5ef0c7b6cf84c53bf6039330930242c9a5c8e8ea13183b2805cf9577f7129 ./builders/agentB_lp/addcomp.py +6a92fd618ccd262a067af58bcc82b6ff661533b03a8f9bf804af344d992af0bd ./builders/agentB_lp/build_lp.py +39fb15f83560431124488906b9f3669a2104cad7b2c5224d77667ea150bdd5e3 ./builders/agentB_lp/rebuild.sh +532d27121ba3054e92a3d6a0a27ff8262a6b01e39c00f460876d6423ac43af47 ./builders/agentB_lp/sat/checkdesign.py +6d9c993acf3a73a417058190f338af08faef22bf47d7ec4b42c4442ef392c919 ./builders/agentB_lp/sat/checkdesign4.py +7bd98981ab8d70f21fa8618b9d2b48edde43f00f9e66e98ccf73d416afe41fcf ./builders/agentB_lp/sat/meet3.py +fc00cb231198c6ff4ce8e3c75e1d722fc11c93138c364c4f723efd7fcdc0af47 ./builders/agentB_lp/sat/meet4.py +4e94c22f361acef1e516cd92f8ecea5a375ad3051246960d4133fed4312a533b ./builders/agentB_lp/sat/plan4.py +b9afc590d84ee8959dca3eb9ab0c1708df28368319e45733c0e91dead77aef91 ./builders/agentB_lp/sat/sol_z5_m3t6.json +067af2d04f545e8b989aa2c13ce1d84c3f1f698fc29cf356e812930af0b1eb18 ./builders/agentB_lp/tools/base.py +0d853403960c09fa8ba208c5f951788c52583950149180bd88e67bbebf88cfed ./builders/agentB_lp/tools/deliv.py +de7502ef4ec2b331ae7efc261152de36c75517bee6cf3fa0e43ddcf96c3c1892 ./builders/agentB_lp/tools/extract_lines.py +7c5c781c8bb82b310583ad2bcd638039f33fd96f77c12941764619967d3989fb ./builders/agentB_lp/tools/frames.py +151fde05c5b3e1759e6392ab32dd27c2b16a339a9a7a15bba488047445771fac ./builders/agentB_lp/tools/idcheck.py +41ad425ea75af2243870c6cdb55d6a8269e6ca13b2c09a2210511661147b670e ./builders/agentB_lp/tools/idlestops.py +40dbcd7500aa1cf3f7267cde0612ad119c0ab9f4262630724c83ec24b1316a88 ./builders/agentB_lp/tools/lattice.py +87c0115a919f54b9348581c6f4c2a76958c80bfe4cfff12a82972ae6c734d55f ./builders/agentB_lp/tools/localD.py +d3750e7c2fce5c4e4071b1f849b3aaa201aa0df4bbffc1946653dbf101f723c7 ./builders/agentB_lp/tools/lpcensus.py +d26d87f8af9d3dc07fb45e01f5a6ffb04204d406daa2ac0398274425d26a9d19 ./builders/agentB_lp/tools/lpframes.py +2267dbe7044513125dc819144cc63ffbcfc24314c143c6d50716db88cc28be29 ./builders/agentB_lp/tools/lpmod.py +4bded36d92820b88fc1294390bdcbc1b37bde18e940eeba3063ec74e575a0821 ./builders/agentB_lp/tools/lpout.py +6d779ccd2c7e6b7168bd441e8299b07916ae55349d5221e09478c5cbe616a020 ./builders/agentB_lp/tools/lptemplate.py +32156405931d878022dbc71347994433e4ffaf16bb18948d501af404af0c80d6 ./builders/agentB_lp/tools/lptiming.py +ddf210d935ef20580cb645814ceea6f87c0956083040812ed30daea4c6e2ff54 ./builders/agentB_lp/tools/moduleD.py +66790e522c90b47f7434a821ec1bdd5a3126239be74baa82c2d25867cbef1ef8 ./builders/agentB_lp/tools/regrecs.py +f8f633a48bec0882245d65339a0d50c072f0b0386539deca4c62791f7597df42 ./builders/agentB_lp/tools/regtrace.py +8097c39bb73e3a3fc006c3c05dc09292b079e2f56f7a565730deeed10209de78 ./builders/agentB_lp/tools/ystats.py +37df777ae1f76d8b03621fb60cd8960c77e1cefca21ced6b53f5a74c991d46ee ./builders/agentB_lp/tools/ytrace.py +43a768d7de0837a353694e060d8a43cd9ed8e0e4e1e8bb7b28ef8de9db2c04cc ./builders/agentB_lp/verify.cpp +dd011bb4262536d61ed339649c053e759487657aa0712ba13d2bc2a4031dd298 ./checkers/independent/checkT.cpp +45199ca15293d5f01dd9280e118aa97c64d1a5c03cbc5fc4cda5d27b1ededb1c ./checkers/independent/exactnd.py +9df22ffe7d89e3b907ad0a44ab84e7a6cd2edbff8b965631436d767d604eea57 ./checkers/independent/exactprice.py +eeffaff81f4a3a49a4cfa937a9a44718eead51fb530b22b315e64419c8c2edd2 ./checkers/independent/sub.hpp +cf9657e2407264120673f34659df79362dc132886d6e62dda96e44d085b61ed1 ./checkers/official/cohort-five-stage-columns.cpp +4230ce06b6563f1902e9d6f6698dfffa4d31fe13a31b5cb7edb9a811f865bb53 ./checkers/official/cohort-legality-independent.cpp +6c9aedb8fb4f2d560aca6cfc32ec967e003c0e623cc345040f108101ec1b442f ./checkers/official/export249.py +aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63 ./checkers/official/json.hpp +afcc5fd3421a7f7a6496677b5a34a77c132c7d981134692042c3e42f0a9cddd6 ./pricing/__pycache__/base_two_moment.cpython-313.pyc +c33ff82930bab8d133d610bc2bd541d06fafe5565a9e65b6f5358a36b8fb9c58 ./pricing/__pycache__/cost.cpython-313.pyc +c8eb1393f582dd2c92b16209a83ad8e0f91dac9840acf52a7d5eeb1b9236d6fc ./pricing/__pycache__/fixed_prime_math.cpython-313.pyc +3160d85a77990368636065438cef8616b47a146b61959fb75b6f24c2509a5688 ./pricing/__pycache__/moment.cpython-313.pyc +bfd9058c094d4db858ffdc4e5a1c0287941bd6299563ac882b47a2179b0a7a60 ./pricing/__pycache__/outer.cpython-313.pyc +aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098 ./pricing/base_two_moment.py +d55d2b865d1c3d35e343e1a38c592b9172ed8e2596d1107e34d92e2a80c7d03f ./pricing/cost.py +fb8f2cf17eec6e9996200f01d4f11e2d4f45a2d98d96105c7113ff5c58108125 ./pricing/fixed_prime_math.py +973b9c86dc90945293f720ed43c0f2b89c85cc24beb8511991353dc3f5fab574 ./pricing/kappa_w.py +9d465c716c6b910ff66e1453e3bf0057608a787b5f5361be93781f42cb3370f7 ./pricing/moment.py +c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c ./pricing/outer.py +506d059fc2d4e7dfbe64c09708c964c1f603f79782db5a9887120b2ec266f2ae ./pricing/simf2.py +f9fb463a0687e29c4f333ae8941f3f411a77b393973730087725807f5fe4684d ./receipts/checkT.txt +bcff618c1a0926756e089ed9e9dd0e79e19b931858fec11233ff7351c1508ac8 ./receipts/cost.txt +2966e1eb48f6eb3b26a6b023704e23990bfd10ef473a05bd6f4860860ca5f813 ./receipts/kappa_pr193.txt +48668ea856c6030ff816a95c0007b9575adb54fea1d51dca9b176370454beff8 ./receipts/kappa_pr233.txt +814d31c13477b3b5d8e625b3ebf14d8b8bea93760f30fbd0966c197e486eea93 ./receipts/kappa_pr304.txt +5bfcdb98a4b69ade96e9942bbcc83a39275fd11517b1a634f4120b4e279f23f8 ./receipts/official-five-stage-columns.json +89e7a0494917c61087fac77470e6274c18cdfc205e01327648f5e979db4fabc4 ./receipts/official-legality.json +f7b8a595c4d40caad361ccf8b622583b110b7398265993f052f6613023b1be13 ./receipts/pr256-complex233-verify.log +fb4b6e2c84eb88bf800548bd46bacee848908bc38440cf3c8e0905ac7fc0c23d ./reconstruct.py +0ecbbb197fc9f6cb88ae51be3accb30e7238114c7ae12395feea9485d93e9a07 ./verify.sh +21d7e762ce50c5f364adac714b98d831b7a5b444fe1d3648794f6c866f6c0d4e ./word/COHORT249-FRAMES.json.gz +cd7482ca65e84cef851ff207979f72b794491533ae43aa2fce9b12c98412e620 ./word/COHORT249-INITIAL.json.gz +c5c2039a5fc6a29c3e1337b19cd59d3173c5a7d849988c072f75a1e223593e68 ./word/COHORT249-RECORDS.bin.gz +4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945 ./word/COHORT249-SELECTION.json +67a2d632e1b2c91f3d599f36d8b63c5811d7f8924f74537c72f57384a5462728 ./word/w3-249-states.json.gz +d3ec8449d608351b62b0b9865e0bf02e6867b67e76665fec359890a723b38898 ./word/w3-frames.txt.gz +da66524b57ece03ece930e050368b7fc531ab9cf6a5976eaf72f4c9b99f1af87 ./word/w3-states.txt.gz diff --git a/research/w3-restore/supplied/base/249-DONOR-OWNERSHIP.json b/research/w3-restore/supplied/base/249-DONOR-OWNERSHIP.json new file mode 100644 index 0000000000..ef11092685 --- /dev/null +++ b/research/w3-restore/supplied/base/249-DONOR-OWNERSHIP.json @@ -0,0 +1,1770 @@ +{ + "status": "PASS_EXACT_ACTUAL_PHYSICAL_OWNERS_EXCLUDE_ALL_DONOR_KEYS", + "pairs_sha256": "da54b863601b5cbc21d27fc5cd623bf805f974a3e47b81ed29a85aa5bad0fa05", + "donor_keys": [ + 17148, + 17149, + 17150, + 17151, + 17152, + 17153, + 17154, + 17155, + 17156, + 17157, + 17158, + 17159, + 17160, + 17161, + 17162, + 17163, + 17164, + 17165, + 17166, + 17167, + 17168, + 17169, + 17170, + 17171, + 17172, + 17173, + 17174, + 17175, + 17176, + 17177, + 17178, + 17179, + 17180, + 17181, + 17182, + 17183, + 17184, + 17185, + 17186, + 17187, + 17188, + 17189, + 17190, + 17191, + 17192, + 17193, + 17194, + 17195, + 17196, + 17197, + 17198, + 17199, + 17200, + 17201, + 17202, + 17203, + 17204, + 17205, + 17206, + 17207, + 17208, + 17209, + 17210, + 17211, + 17212, + 17213, + 17214, + 17215, + 17216, + 17217, + 17218, + 17219, + 17220, + 17221, + 17222, + 17223, + 17224, + 17225, + 17226, + 17227, + 17228, + 17229, + 17230, + 17231, + 17232, + 17233, + 17234, + 17235, + 17236, + 17237, + 17238, + 17239, + 17240, + 17241, + 17242, + 17243, + 17244, + 17245, + 17246, + 17247, + 17248, + 17249, + 17250, + 17251, + 17252, + 17253, + 17254, + 17255, + 17256, + 17257, + 17258, + 17259, + 17260, + 17261, + 17262, + 17263, + 17264, + 17265, + 17266, + 17267, + 17268, + 17269, + 17270, + 17271, + 17272, + 17273, + 17274, + 17275, + 17276, + 17277, + 17278, + 17279, + 17280, + 17281, + 17282, + 17283, + 17284, + 17285, + 17286, + 17287, + 17288, + 17289, + 17290, + 17291, + 17292, + 17293, + 17294, + 17295, + 17296, + 17297, + 17298, + 17299, + 17300, + 17301, + 17302, + 17303, + 17304, + 17305, + 17306, + 17307, + 17308, + 17309, + 17310, + 17311, + 17312, + 17313, + 17314, + 17315, + 17316, + 17317, + 17318, + 17319, + 17320, + 17321, + 17322, + 17323, + 17324, + 17325, + 17326, + 17327, + 17328, + 17329, + 17330, + 17331, + 17332, + 17333, + 17334, + 17335, + 17336, + 17337, + 17338, + 17339, + 17340, + 17341, + 17342, + 17343, + 17344, + 17345, + 17346, + 17347, + 17348, + 17349, + 17350, + 17351, + 17352, + 17353, + 17354, + 17355, + 17356, + 17357, + 17358, + 17359, + 17360, + 17361, + 17362, + 17363, + 17364, + 17365, + 17366, + 17367, + 17368, + 17369, + 17370, + 17371, + 17372, + 17373, + 17374, + 17375, + 17376, + 17377, + 17378, + 17379, + 17380, + 17381, + 17382, + 17383, + 17384, + 17385, + 17386, + 17387, + 17388, + 17389, + 17390, + 17391, + 17392, + 17393, + 17394, + 17395, + 17396, + 17397, + 17398, + 17399, + 17400, + 17401, + 17402, + 17403, + 17404, + 17405, + 17406, + 17407, + 17408, + 17409, + 17410, + 17411, + 17412, + 17413, + 17414, + 17415, + 17416, + 17417, + 17418, + 17419, + 17420, + 17421, + 17422, + 17423, + 17424, + 17425, + 17426, + 17427, + 17428, + 17429, + 17430, + 17431, + 17432, + 17433, + 17434, + 17435, + 17436, + 17437, + 17438, + 17439, + 17440, + 17441, + 17442, + 17443, + 17444, + 17445, + 17446, + 17447, + 17448, + 17449, + 17450, + 17451, + 17452, + 17453, + 17454, + 17455, + 17456, + 17457, + 17458, + 17459, + 17460, + 17461, + 17462, + 17463, + 17464, + 17465, + 17466, + 17467, + 17468, + 17469, + 17470, + 17471, + 17472, + 17473, + 17474, + 17475, + 17476, + 17477, + 17478, + 17479, + 17480, + 17481, + 17482, + 17483, + 17484, + 17485, + 17486, + 17487, + 17488, + 17489, + 17490, + 17491, + 17492, + 17493, + 17494, + 17495, + 17496, + 17497, + 17498, + 17499, + 17500, + 17501, + 17502, + 17503, + 17504, + 17505, + 17506, + 17507, + 17508, + 17509, + 17510, + 17511, + 17512, + 17513, + 17514, + 17515, + 17516, + 17517, + 17518, + 17519, + 17520, + 17521, + 17522, + 17523, + 17524, + 17525, + 17526, + 17527, + 17528, + 17529, + 17530, + 17531, + 17532, + 17533, + 17534, + 17535, + 17536, + 17537, + 17538, + 17539, + 17540, + 17541, + 17542, + 17543, + 17544, + 17545, + 17546, + 17547, + 17548, + 17549, + 17550, + 17551, + 17552, + 17553, + 17554, + 17555, + 17556, + 17557, + 17558, + 17559, + 17560, + 17561, + 17562, + 17563, + 17564, + 17565, + 17566, + 17567, + 17568, + 17569, + 17570, + 17571, + 17572, + 17573, + 17574, + 17575, + 17576, + 17577, + 17578, + 17579, + 17580, + 17581, + 17582, + 17583, + 17584, + 17585, + 17586, + 17587, + 17588, + 17589, + 17590, + 17591, + 17592, + 17593, + 17594, + 17595, + 17596, + 17597, + 17598, + 17599, + 17600, + 17601, + 17602, + 17603, + 17604, + 17605, + 17606, + 17607, + 17608, + 17609, + 17610, + 17611, + 17612, + 17613, + 17614, + 17615, + 17616, + 17617, + 17618, + 17619, + 17620, + 17621, + 17622, + 17623, + 17624, + 17625, + 17626, + 17627, + 17628, + 17629, + 17630, + 17631, + 17632, + 17633, + 17634, + 17635, + 17636, + 17637, + 17638, + 17639, + 17640, + 17641, + 17642, + 17643, + 17644, + 17645, + 17646, + 17647, + 17648, + 17649, + 17650, + 17651, + 17652, + 17653, + 17654, + 17655, + 17656, + 17657, + 17658, + 17659, + 17660, + 17661, + 17662, + 17663, + 17664, + 17665, + 17666, + 17667, + 17668, + 17669, + 17670, + 17671, + 17672, + 17673, + 17674, + 17675, + 17676, + 17677, + 17678, + 17679, + 17680, + 17681, + 17682, + 17683, + 17684, + 17685, + 17686, + 17687, + 17688, + 17689, + 17690, + 17691, + 17692, + 17693, + 17694, + 17695, + 17696, + 17697, + 17698, + 17699, + 17700, + 17701, + 17702, + 17703, + 17704, + 17705, + 17706, + 17707, + 17708, + 17709, + 17710, + 17711, + 17712, + 17713, + 17714, + 17715, + 17716, + 17717, + 17718, + 17719, + 17720, + 17721, + 17722, + 17723, + 17724, + 17725, + 17726, + 17727, + 17728, + 17729, + 17730, + 17731, + 17732, + 17733, + 17734, + 17735, + 17736, + 17737, + 17738, + 17739, + 17740, + 17741, + 17742, + 17743, + 17744, + 17745, + 17746, + 17747, + 17748, + 17749, + 17750, + 17751, + 17752, + 17753, + 17754, + 17755, + 17756, + 17757, + 17758, + 17759, + 17760, + 17761, + 17762, + 17763, + 17764, + 17765, + 17766, + 17767, + 17768, + 17769, + 17770, + 17771, + 17772, + 17773, + 17774, + 17775, + 17776, + 17777, + 17778, + 17779, + 17780, + 17781, + 17782, + 17783, + 17784, + 17785, + 17786, + 17787, + 17788, + 17789, + 17790, + 17791, + 17792, + 17793, + 17794, + 17795, + 17796, + 17797, + 17798, + 17799, + 17800, + 17801, + 17802, + 17803, + 17804, + 17805, + 17806, + 17807, + 17808, + 17809, + 17810, + 17811, + 17812, + 17813, + 17814, + 17815, + 17816, + 17817, + 17818, + 17819, + 17820, + 17821, + 17822, + 17823, + 17824, + 17825, + 17826, + 17827, + 17828, + 17829, + 17830, + 17831, + 17832, + 17833, + 17834, + 17835, + 17836, + 17837, + 17838, + 17839, + 17840, + 17841, + 17842, + 17843, + 17844, + 17845, + 17846, + 17847, + 17848, + 17849, + 17850, + 17851, + 17852, + 17853, + 17854, + 17855, + 17856, + 17857, + 17858, + 17859, + 17860, + 17861, + 17862, + 17863, + 17864, + 17865, + 17866, + 17867, + 17868, + 17869, + 17870, + 17871, + 17872, + 17873, + 17874, + 17875, + 17876, + 17877, + 17878, + 17879, + 17880, + 17881, + 17882, + 17883, + 17884, + 17885, + 17886, + 17887, + 17888, + 17889, + 17890, + 17891, + 17892, + 17893, + 17894, + 17895, + 17896, + 17897, + 17898, + 17899, + 17900, + 17901, + 17902, + 17903, + 17904, + 17905, + 17906, + 17907, + 17908, + 17909, + 17910, + 17911, + 17912, + 17913, + 17914, + 17915, + 17916, + 17917, + 17918, + 17919, + 17920, + 17921, + 17922, + 17923, + 17924, + 17925, + 17926, + 17927, + 17928, + 17929, + 17930, + 17931, + 17932, + 17933, + 17934, + 17935, + 17936, + 17937, + 17938, + 17939, + 17940, + 17941, + 17942, + 17943, + 17944, + 17945, + 17946, + 17947, + 17948, + 17949, + 17950, + 17951, + 17952, + 17953, + 17954, + 17955, + 17956, + 17957, + 17958, + 17959, + 17960, + 17961, + 17962, + 17963, + 17964, + 17965, + 17966, + 17967, + 17968, + 17969, + 17970, + 17971, + 17972, + 17973, + 17974, + 17975, + 17976, + 17977, + 17978, + 17979, + 17980, + 17981, + 17982, + 17983, + 17984, + 17985, + 17986, + 17987, + 17988, + 17989, + 17990, + 17991, + 17992, + 17993, + 17994, + 17995, + 17996, + 17997, + 17998, + 17999, + 18000, + 18001, + 18002, + 18003, + 18004, + 18005, + 18006, + 18007, + 18008, + 18009, + 18010, + 18011, + 18012, + 18013, + 18014, + 18015, + 18016, + 18017, + 18018, + 18019, + 18020, + 18021, + 18022, + 18023, + 18024, + 18025, + 18026, + 18027, + 18028, + 18029, + 18030, + 18031, + 18032, + 18033, + 18034, + 18035, + 18036, + 18037, + 18038, + 18039, + 18040, + 18041, + 18042, + 18043, + 18044, + 18045, + 18046, + 18047, + 18048, + 18049, + 18050, + 18051, + 18052, + 18053, + 18054, + 18055, + 18056, + 18057, + 18058, + 18059, + 18060, + 18061, + 18062, + 18063, + 18064, + 18065, + 18066, + 18067, + 18068, + 18069, + 18070, + 18071, + 18072, + 18073, + 18074, + 18075, + 18076, + 18077, + 18078, + 18079, + 18080, + 18081, + 18082, + 18083, + 18084, + 18085, + 18086, + 18087, + 18088, + 18089, + 18090, + 18091, + 18092, + 18093, + 18094, + 18095, + 18096, + 18097, + 18098, + 18099, + 18100, + 18101, + 18102, + 18103, + 18104, + 18105, + 18106, + 18107, + 18108, + 18109, + 18110, + 18111, + 18112, + 18113, + 18114, + 18115, + 18116, + 18117, + 18118, + 18119, + 18120, + 18121, + 18122, + 18123, + 18124, + 18125, + 18126, + 18127, + 18128, + 18129, + 18130, + 18131, + 18132, + 18133, + 18134, + 18135, + 18136, + 18137, + 18138, + 18139, + 18140, + 18141, + 18142, + 18143, + 18144, + 18145, + 18146, + 18147, + 18148, + 18149, + 18150, + 18151, + 18152, + 18153, + 18154, + 18155, + 18156, + 18157, + 18158, + 18159, + 18160, + 18161, + 18162, + 18163, + 18164, + 18165, + 18166, + 18167, + 18168, + 18169, + 18170, + 18171, + 18172, + 18173, + 18174, + 18175, + 18176, + 18177, + 18178, + 18179, + 18180, + 18181, + 18182, + 18183, + 18184, + 18185, + 18186, + 18187, + 18188, + 18189, + 18190, + 18191, + 18192, + 18193, + 18194, + 18195, + 18196, + 18197, + 18198, + 18199, + 18200, + 18201, + 18202, + 18203, + 18204, + 18205, + 18206, + 18207, + 18208, + 18209, + 18210, + 18211, + 18212, + 18213, + 18214, + 18215, + 18216, + 18217, + 18218, + 18219, + 18220, + 18221, + 18222, + 18223, + 18224, + 18225, + 18226, + 18227, + 18228, + 18229, + 18230, + 18231, + 18232, + 18233, + 18234, + 18235, + 18236, + 18237, + 18238, + 18239, + 18240, + 18241, + 18242, + 18243, + 18244, + 18245, + 18246, + 18247, + 18248, + 18249, + 18250, + 18251, + 18252, + 18253, + 18254, + 18255, + 18256, + 18257, + 18258, + 18259, + 18260, + 18261, + 18262, + 18263, + 18264, + 18265, + 18266, + 18267, + 18268, + 18269, + 18270, + 18271, + 18272, + 18273, + 18274, + 18275, + 18276, + 18277, + 18278, + 18279, + 18280, + 18281, + 18282, + 18283, + 18284, + 18285, + 18286, + 18287, + 18288, + 18289, + 18290, + 18291, + 18292, + 18293, + 18294, + 18295, + 18296, + 18297, + 18298, + 18299, + 18300, + 18301, + 18302, + 18303, + 18304, + 18305, + 18306, + 18307, + 18308, + 18309, + 18310, + 18311, + 18312, + 18313, + 18314, + 18315, + 18316, + 18317, + 18318, + 18319, + 18320, + 18321, + 18322, + 18323, + 18324, + 18325, + 18326, + 18327, + 18328, + 18329, + 18330, + 18331, + 18332, + 18333, + 18334, + 18335, + 18336, + 18337, + 18338, + 18339, + 18340, + 18341, + 18342, + 18343, + 18344, + 18345, + 18346, + 18347, + 18348, + 18349, + 18350, + 18351, + 18352, + 18353, + 18354, + 18355, + 18356, + 18357, + 18358, + 18359, + 18360, + 18361, + 18362, + 18363, + 18364, + 18365, + 18366, + 18367, + 18368, + 18369, + 18370, + 18371, + 18372, + 18373, + 18374, + 18375, + 18376, + 18377, + 18378, + 18379, + 18380, + 18381, + 18382, + 18383, + 18384, + 18385, + 18386, + 18387, + 18388, + 18389, + 18390, + 18391, + 18392, + 18393, + 18394, + 18395, + 18396, + 18397, + 18398, + 18399, + 18400, + 18401, + 18402, + 18403, + 18404, + 18405, + 18406, + 18407, + 18408, + 18409, + 18410, + 18411, + 18412, + 18413, + 18414, + 18415, + 18416, + 18417, + 18418, + 18419, + 18420, + 18421, + 18422, + 18423, + 18424, + 18425, + 18426, + 18427, + 18428, + 18429, + 18430, + 18431, + 18432, + 18433, + 18434, + 18435, + 18436, + 18437, + 18438, + 18439, + 18440, + 18441, + 18442, + 18443, + 18444, + 18445, + 18446, + 18447, + 18448, + 18449, + 18450, + 18451, + 18452, + 18453, + 18454, + 18455, + 18456, + 18457, + 18458, + 18459, + 18460, + 18461, + 18462, + 18463, + 18464, + 18465, + 18466, + 18467, + 18468, + 18469, + 18470, + 18471, + 18472, + 18473, + 18474, + 18475, + 18476, + 18477, + 18478, + 18479, + 18480, + 18481, + 18482, + 18483, + 18484, + 18485, + 18486, + 18487, + 18488, + 18489, + 18490, + 18491, + 18492, + 18493, + 18494, + 18495, + 18496, + 18497, + 18498, + 18499, + 18500, + 18501, + 18502, + 18503, + 18504, + 18505, + 18506, + 18507, + 18508, + 18509, + 18510, + 18511, + 18512, + 18513, + 18514, + 18515, + 18516, + 18517, + 18518, + 18519, + 18520, + 18521, + 18522, + 18523, + 18524, + 18525, + 18526, + 18527, + 18528, + 18529, + 18530, + 18531, + 18532, + 18533, + 18534, + 18535, + 18536, + 18537, + 18538, + 18539, + 18540, + 18541, + 18542, + 18543, + 18544, + 18545, + 18546, + 18547, + 18548, + 18549, + 18550, + 18551, + 18552, + 18553, + 18554, + 18555, + 18556, + 18557, + 18558, + 18559, + 18560, + 18561, + 18562, + 18563, + 18564, + 18565, + 18566, + 18567, + 18568, + 18569, + 18570, + 18571, + 18572, + 18573, + 18574, + 18575, + 18576, + 18577, + 18578, + 18579, + 18580, + 18581, + 18582, + 18583, + 18584, + 18585, + 18586, + 18587, + 18588, + 18589, + 18590, + 18591, + 18592, + 18593, + 18594, + 18595, + 18596, + 18597, + 18598, + 18599, + 18600, + 18601, + 18602, + 18603, + 18604, + 18605, + 18606, + 18607, + 18608, + 18609, + 18610, + 18611, + 18612, + 18613, + 18614, + 18615, + 18616, + 18617, + 18618, + 18619, + 18620, + 18621, + 18622, + 18623, + 18624, + 18625, + 18626, + 18627, + 18628, + 18629, + 18630, + 18631, + 18632, + 18633, + 18634, + 18635, + 18636, + 18637, + 18638, + 18639, + 18640, + 18641, + 18642, + 18643, + 18644, + 18645, + 18646, + 18647, + 18648, + 18649, + 18650, + 18651, + 18652, + 18653, + 18654, + 18655, + 18656, + 18657, + 18658, + 18659, + 18660, + 18661, + 18662, + 18663, + 18664, + 18665, + 18666, + 18667, + 18668, + 18669, + 18670, + 18671, + 18672, + 18673, + 18674, + 18675, + 18676, + 18677, + 18678, + 18679, + 18680, + 18681, + 18682, + 18683, + 18684, + 18685, + 18686, + 18687, + 18688, + 18689, + 18690, + 18691, + 18692, + 18693, + 18694, + 18695, + 18696, + 18697, + 18698, + 18699, + 18700, + 18701, + 18702, + 18703, + 18704, + 18705, + 18706, + 18707, + 18708, + 18709, + 18710, + 18711, + 18712, + 18713, + 18714, + 18715, + 18716, + 18717, + 18718, + 18719, + 18720, + 18721, + 18722, + 18723, + 18724, + 18725, + 18726, + 18727, + 18728, + 18729, + 18730, + 18731, + 18732, + 18733, + 18734, + 18735, + 18736, + 18737, + 18738, + 18739, + 18740, + 18741, + 18742, + 18743, + 18744, + 18745, + 18746, + 18747, + 18748, + 18749, + 18750, + 18751, + 18752, + 18753, + 18754, + 18755, + 18756, + 18757, + 18758, + 18759, + 18760, + 18761, + 18762, + 18763, + 18764, + 18765, + 18766, + 18767, + 18768, + 18769, + 18770, + 18771, + 18772, + 18773, + 18774, + 18775, + 18776, + 18777, + 18778, + 18779, + 18780, + 18781, + 18782, + 18783, + 18784, + 18785, + 18786, + 18787, + 18788, + 18789, + 18790, + 18791, + 18792, + 18793, + 18794, + 18795, + 18796, + 18797, + 18798, + 18799, + 18800, + 18801, + 18802, + 18803, + 18804, + 18805, + 18806, + 18807, + 18808, + 18809, + 18810, + 18811, + 18812, + 18813, + 18814, + 18815, + 18816, + 18817, + 18818, + 18819, + 18820, + 18821, + 18822, + 18823, + 18824, + 18825, + 18826, + 18827, + 18828, + 18829, + 18830, + 18831, + 18832, + 18833, + 18834, + 18835, + 18836, + 18837, + 18838, + 18839, + 18840, + 18841, + 18842, + 18843, + 18844, + 18845, + 18846, + 18847, + 18848, + 18849, + 18850, + 18851, + 18852, + 18853, + 18854, + 18855, + 18856, + 18857, + 18858, + 18859, + 18860, + 18861, + 18862, + 18863, + 18864, + 18865, + 18866, + 18867, + 18868, + 18869, + 18870, + 18871, + 18872, + 18873, + 18874, + 18875, + 18876, + 18877, + 18878, + 18879, + 18880, + 18881, + 18882, + 18883, + 18884, + 18885, + 18886, + 18887, + 18888, + 18889, + 18890, + 18891, + 18892, + 18893, + 18894, + 18895, + 18896, + 18897, + 18898, + 18899, + 18900, + 18901, + 18902, + 18903, + 18904, + 18905, + 18906, + 18907 + ], + "actual_roles": 16587, + "donor_keys_count": 1760, + "actual_intersection": [], + "explanation": "JointWord fixes self.donor=dict(pairs), phys maps each alias donor key to its owner. Actual regs exclude every donor key. W.gauge roles have nonzero initial frames, so the dynamic screen initial==ZERO excludes retained gauges." +} diff --git a/research/w3-restore/supplied/base/249-records.bin.gz b/research/w3-restore/supplied/base/249-records.bin.gz new file mode 100644 index 0000000000..e0de636832 Binary files /dev/null and b/research/w3-restore/supplied/base/249-records.bin.gz differ diff --git a/research/w3-restore/supplied/base/249-states.json.gz b/research/w3-restore/supplied/base/249-states.json.gz new file mode 100644 index 0000000000..1d85263092 Binary files /dev/null and b/research/w3-restore/supplied/base/249-states.json.gz differ diff --git a/research/w3-restore/supplied/base/PR249-SOURCE-MANIFEST.json b/research/w3-restore/supplied/base/PR249-SOURCE-MANIFEST.json new file mode 100644 index 0000000000..ffc0219425 --- /dev/null +++ b/research/w3-restore/supplied/base/PR249-SOURCE-MANIFEST.json @@ -0,0 +1,140 @@ +{ + "repository": "https://github.com/CrocSwap/integer-mult-bounds", + "pull_request": 249, + "head": "96495746c786d6d0339dbb38c7f553d4af3f88ed", + "path": "research/five-stage-source527-banks", + "files": { + "BANK-PROOF.md": "e75edfcb4efe4cad1bd38a5e18a6c5fd323e6e2b34840e9ed09863da85ec37cc", + "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "MANIFEST.json": "86e8bc5182079c00877077c8e4c7b2690ba2486bec385c0857f1794cd2e6bedb", + "NOTICE.md": "9a659cc2f96ae7e0eda99954941c42a4529bc885fb1de161c44ea801ff36e480", + "PR-STATEMENT.md": "fbb2b3cda4d6030c09162a87aee7c9c4473a2d3ac8fd9aa5ec0332ab6880bd08", + "PROOF.md": "69c3066adbe1664aacb03744328c79738649d576529a25f962035d4e479faf81", + "README.md": "571bb4d1b658eceb4f692c2746ffff9817ac57f8cbac2ae38034adb698192866", + "UPSTREAM-PR234-NOTICE.md": "ce978c8dfc8a2b36eed7a53014b1a792248b22ef4cee3edd8adab825a571c429", + "UPSTREAM-PR234-PROOF.md": "c9722b07256758cd3b307dd46689f99984c66e16c3dd934f9c34e551620bfc0f", + "bank_check.py": "3fb3ac24c3d671d0bc97a526996c760d5d63e3f8e0478155135c813bf1e162cc", + "bank_template.py": "60af020ddacc634d284aa54b7ac2db7894369fa96b4878cac60cda1ce748f64d", + "base_two_moment.py": "aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098", + "code/complex_basis.py": "52d68781eaf6d9decf02446a532a7336fcf15924a9f6781ba0833d038decb9f8", + "code/complex_labels.py": "ff5d5e914ef1be0f0cc30283a1ee39089b77e4b572f09543e7313d126bd26256", + "code/complex_scalars.py": "fa035447c1f3a5e878dfc18a900942aa180d8bfde03cdce2d21d9bf8b8409429", + "code/complex_splice.py": "ed8f7f55530bab64e25b98ee614e1152ded8a6259c48d32b3ae26bab4b93848c", + "code/geometry527.py": "bff96140e93c0cea01ed618b49b913f913c12d99ebb0e4e4342336cf5a102800", + "code/global_lowering.py": "3a851ce132e4b08127c4f51b3d10c91ea24d0140260306cfccee9e6206225a3d", + "code/physical527.py": "1723a5c53ec236529e46980c8eb2c45134c61275ac7fb85c8ad92223784de07c", + "finite_check.py": "286618567a721052b6fde92d6742c3a43784e7b2994770ac3f9807cafacd55b0", + "inputs/complex/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "inputs/complex/NOTICE": "9419dd03a2f52cf8bdfc4d18216ce29f263ab583b27f01ced8e420985bcb7c81", + "inputs/complex/gcert1-p11-pr193.json.gz": "15251deb0c11e0504d7b297c9786818888a93f08b92b03c6c122784b70488633", + "inputs/complex/retained/FINITE_BRIDGE.txt": "66d8f4ea8752abd89952d6674a636575a0db16e18b1c16e293f48f64242f0c46", + "inputs/complex/retained/compact-control-layout.tex": "2bc28e50f3eb092195294cafa81213e520f6d42e7935e9905ad8a6199e2a7c87", + "inputs/complex/retained/compact-control-movement.tex": "b963c3d2f4e1b7059aa289bb4b4ac89b688920bcf42f5b20d7698cdef0132cc6", + "inputs/complex/retained/copied-centers-assembly.tex": "00117892971ae766188ace0af03030c44164fda105e42b70d84f52c3339a7dcb", + "inputs/complex/retained/copied-centers-lemma.tex": "d0ce6d3d504996aadb098227885224e48df46101daec8893523a0a8b7364d8fe", + "inputs/complex/retained/endpoint-gauge-complex.tex": "dfee33b0281e5551bb6927f757ff0240abade60ae1800f715afd88853ae0191e", + "inputs/complex/retained/general-clifford-frames.tex": "c9bb9655b594583c6b4bab8cb485233f1d1e588f83858cf1e4c3530cee8fed54", + "inputs/complex/retained/stopped-product-complex.tex": "4738089103a4b263b3b0ef458f5ef35519c696f1ea871ae79e508d3720f5870a", + "inputs/complex/source-pins.json": "de0daf6847185d7a6911535e3012c1a91de1e32b5da8204beec26b37523ad569", + "inputs/complex/sources/Work__Bridge__Cert.lean": "5c24746a6330907b9b37d6064095035a58575d64ce793d6d7c9881121fdc3980", + "inputs/complex/sources/Work__Bridge__Net.lean": "cf7d7d330b1bffe2e66712c873e647b13dc32db1ccfc0e0f4cd62ee6caf584f0", + "inputs/complex/sources/Work__Carrier__Live.lean": "6d0649eb62589e66057f044e1e2103fc42f3f57a1498f82a26565bd8eb4026d0", + "inputs/complex/sources/Work__Carrier__Phases.lean": "71dc3dda23dfe510d5d53cbada3a6c540cd1dc2825503fda618a5bd6cfc3e812", + "inputs/complex/sources/Work__Fourier__Main.lean": "2e8e88efd4dcbdf0b1a6e39ce7eea8c5fd5ffee2faf360a8c0c9cba84c0e4ef3", + "inputs/complex/sources/Work__GCert__Chain__Geom.lean": "c302f5834287421f11f3b0da7112fcde876cbc702896f2af4145b2d72ee393a2", + "inputs/complex/sources/Work__GCert__Chain__InvThm.lean": "ade7e7873da75ca63a4b5ce2f562dde9c12bfbb69d87d7ae831039ff790e5adb", + "inputs/complex/sources/Work__GCert__Chain__NetCert.lean": "22ae34809466b4ac2a2c5cdde526f51ff246f5189f7c142b38aa4c0dcffb04a4", + "inputs/complex/sources/Work__GCert__Chain__NetDef.lean": "6e17a68b1e988969f6eb77000028f7ed877e687b8ad3976ec1707fcfe1d2f520", + "inputs/complex/sources/Work__GCert__Chain__NetStage.lean": "c122bc01392a6fdcc0bee918fed81804d3c9b1d3e071016dab65a4ed804ef0b6", + "inputs/complex/sources/Work__GCert__Chain__Phased.lean": "0de429c80231334f1ce92575c1e8ac382ca2d5e7d956767b547639a8941d9a8c", + "inputs/complex/sources/Work__GCert__Chain__WinB.lean": "c33ec3fce09c0971c32ddcbb86d9383ffbe4c6d05cf36f20460005e6547bb845", + "inputs/complex/sources/Work__GCert__Data__B2Gp193Main.lean": "cb61f304da51f1dd0a2ec25bca4b63eb095eeb2863289e1e2bdee7c82beff48b", + "inputs/complex/sources/Work__GCert__Data__Glue.lean": "d5314f2b93a7f0e1c949fb502331825bfc6d9d8762d35f865443e7c95b6c7ef7", + "inputs/complex/sources/Work__GCert__Data__InstB2Gp193.lean": "9587ddb9961f44938032b609307ab91c0b0e757e3991f1ad95480dd50fd4f72b", + "inputs/complex/sources/Work__GCert__Data__P193Cert.lean": "d92ee6889be4753fc99f467bd84039743325123a1165128378b9c906a04f2703", + "inputs/complex/sources/Work__GCert__Data__P193Price.lean": "0299bcd0fe255960eec682eef0f045f7e5cb1e4711af2aab4393526eae2caea3", + "inputs/complex/sources/Work__GCert__Data__P193ScalOK.lean": "479434815822e98f015e335361089c3788d00dc3dd39c2944f75410aa0c158fe", + "inputs/complex/sources/Work__GCert__Data__RateB2Gp193x.lean": "6b40cac1481c931d47b1a092e382d04716ede0e785c492a2f2983e886a257c3f", + "inputs/complex/sources/Work__GCert__Data__Raw.lean": "aba94a004c94dcae7cf3047c88a6da9561555f4ebe8ab92e299e6ce09ee7aa66", + "inputs/complex/sources/Work__GCert__Data__SolutionB2Gp193x.lean": "45c768c9d71a7cc18bd6db74cb036db880d89580ca60557bb4a492280296b169", + "inputs/complex/sources/Work__GFrame__Engine__Adapt.lean": "feec0a3828867968a5c7c2c30b86ed70449abc3c660a60ada67203a75bae2ef7", + "inputs/complex/sources/Work__GFrame__Engine__Letters.lean": "34906dbf5ae16b5174db00b4881a5cc1d2e583b8c8806db6523a5e2f86565f09", + "inputs/complex/sources/Work__GFrame__Engine__Level.lean": "80fb3daa9a45de0ed6da570eb4476b9104734be65d0116f58bcfcbcd67f771d0", + "inputs/complex/sources/tools__gx__ORIGIN.md": "6ba897a9495ddadcf8558b93133fdfaf66fc35ce7fa2c53e2d5667335c315e0b", + "inputs/complex/sources/tools__gx__gxbind.py": "9c9dcfac47f0535bf3aa8ebf7c662cdef0ebda50a9f0a9282b8f3cf34809f835", + "inputs/complex/sources/tools__gx__gxconv.py": "dab7fec9f44c2d368ed334055d7126e202017feb46e41a8d86e2d998720f67c2", + "inputs/complex/sources/tools__gx__gxcore.py": "eb972c06fe8c322db2d9a8d9a7d05596e8f40c4ca8e5f42eb6df3c7361b5d517", + "loader/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "loader/MANIFEST.json": "a1b6da7191f3bc0109dac63ae96122dd9f5174743909daf5e0bdcc8e9cfbbffc", + "loader/NOTICE.md": "ee632728cc4d89565292d288f8289f483ac794b5d02cc6e42c2b2c43c43ff1d8", + "loader/README.md": "4c36794b0f702ed521c0a7eaeacb1b7cc258760d59193cc8eb29be590e709dcd", + "loader/SOURCE_PINS.json": "5a4fa413ea0ecc74050359329e90521723151e421cc0c19f774b92bd608a3ac9", + "loader/expected_ledger.json": "4910004287e016f7f2db10f0a54eed24bf1912aa148b347b3cb4795fa3ac63f5", + "loader/expected_semantics.json": "b7de3178436c824b6be6d99842270a82e1821b8008dda66d8b18519ad347da2d", + "loader/raw_ledger.py": "89ba53114488a77a12b941db2787850c2c41612ad0332c47699a011c0c596b32", + "loader/source_inputs/base_bit/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "loader/source_inputs/base_bit/NOTICE": "c9850418622aea8d1382a230306c940947b5da818f4854b4b272ed60cf239f6c", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/bit/base_word.py": "9fe3a81b7561d2b09c086f63fac4626e88a32369ef8bc5579c94878de1218a89", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/bit/word.py": "85822e9cca5b1b2335c3704a3df2f3c6ef01e42d8328daacb33701d30cee80ab", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/references/pr168-v4/research/paired-cube-bit/check_paired_cube_bit.py": "4d7c86cd999a1519e0dfb6dcf33a8f26e442a353c3665a0f06881216a260fbf3", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/frames_p12.json.gz": "ad8e2705652b68476713d7647a8592505e222f2b3ccd1728dedce153aac6d462", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/graph_p12.json": "31a09a55920e64c8bfbac8b845dc01754c112aa6e207812e2fd1f4939d8f64cb", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/kchron_p12.json": "0fab548e84cf5ca7c04e8bd19b5810850463f36e0f92180efe73aeff17105e39", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/profile_p12.json": "c44ef8640cbcbcc9bac3a30e13373bd79efddde55d7cea514354ca2cdb60d66d", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/sinks.json": "c00ff70c564829d4b97740f92796fc6ce14fbcd5ca519663828650552b80249d", + "loader/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/word_p12.json.gz": "1cb7e8ed45cf542e304fddc4b12247dbb248a0dc84dedbd832f336b2d172793a", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/NOTICE": "9fc5561c0995892dbdde777c713899486920c32d3562392f5f72377a4953bf98", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/borrow/selection.json": "6932749407e14b199651f0a7deff02c6de74e2c1be0a1300263f1e164927fb8b", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/frames/opframe-bases.json": "687496f3c15818e7cad1beb5fdf3812b8e38825ea302bfd60aea7ac23f3516b4", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/gaugeb/selection.json": "b0f9f0e67f94a3c21069f393ea27f9483d315bff2f53f77270163065a6345d1c", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/joint/joint-selection.json": "13f6420d6c341c22235c9d136d5f7c32896974bb165a893fecd7e583b790d133", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/joint/joint_word.py": "de37cbed753fc6f13a7e5dc25c8346279cfee5f1868df8c12a5fcb6ca8f631c0", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/joint/pairs.json": "da54b863601b5cbc21d27fc5cd623bf805f974a3e47b81ed29a85aa5bad0fa05", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/newg/replay.py": "0cbec81a11e758156e9303f63dc8c617601da69523073fdf2a77394d76acf56a", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/newg/schedule.json": "ab39d61fff7a2cfcb13e2c10d65f2c603e76a91013d197260d6c7b645ccb27a1", + "loader/source_inputs/pr210/research/coordinated-crossover-pr200/newg/selection.json": "d94ef4e0b8ca98a7385b364cf245816a7cad08f850a60ce8b67aab4c3a89f3f4", + "loader/source_loader.py": "e5e19ee6d6899fce8273d0f06a49caf7cd8bfe940a2a9a103dbc9d3a62b6b291", + "loader/test_public.py": "2103c953b37cf447d1a2bbb86c26f96fa5569a3ab018567e93884c12ebde8a2d", + "math_check.py": "33dba4c0d203212cf5731a2094237774443725e832d419dc89c528187e52d671", + "moment.py": "9d465c716c6b910ff66e1453e3bf0057608a787b5f5361be93781f42cb3370f7", + "outer.py": "c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c", + "parity_transform.py": "ef6f5224b91c409c30fc0886143787a0839a13cc6b148e42ca5db858d502ec4d", + "portable_bit.py": "2bdf814013e46c3245fc67c5d152c3b13245d562a247410671575008f2007af1", + "portable_complex.py": "797e144c0040d78a4731a6eaa61c0edb9803a08462f885ed014cbca9d9991d82", + "prepare.py": "fc109fe81d7d9d3f53483ce7d648dc9fcf6d9fb71b8fde1c867ece5283fadbcc", + "prime_check.py": "22df1899dfb3b61e394bf1bca178b2a8846e1434ce12df3bf58fdee77f3283cf", + "prime_witnesses.py": "98cd03bc9582e7bd0ab194c191ea8eea940539e510051443ab9fd3e572a364ab", + "proof/FINITE_BIT_ACCOUNTING.md": "602923520af184670170bf159fde7b4c72e79a72570eddd7746b7c97bc51fc5b", + "proof/INTEGRATED_PROOF.md": "cff22391e71a50bad27a1e832d5c0a2c8b2446df55adb1297c8b1485b3761257", + "proof/PARITY-CONTRACT.md": "a9246be656e31f1a21d5ec714e002f51be0aa07c36e1528066a25b2c7a02db91", + "proof/copied-centers-lemma.tex": "d0ce6d3d504996aadb098227885224e48df46101daec8893523a0a8b7364d8fe", + "proof/primary/03-motifs.tex": "ed76761194988a01af77ead0ea6469cb5dcd29690ab985a0b5a4006b0f2b69bb", + "proof/primary/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "proof/primary/PROVENANCE.md": "dd9054c58aa92c44b0ef5f691ad4dc52b8ead2f20a9843d4399d6c300d616023", + "proof/primary/UPSTREAM-README.md": "8d1ceff898a4e0e681679f91c4def485820be9e99f04e4861f2ce601a364723e", + "proof/three-stage-cover-bit.tex": "47123a756f823c83a0d48cca2bf5add6472cd88410b13aed345e70c8834fb511", + "proof/three-stage-cover-rows.tex": "6ad97a5cd7d6aecf978a81226e1c2763d37840caca130c61f3bf5c4ac111c5c8", + "raw_ledger.py": "d5dae7b56d403adb778251e4b42903695632d522c1392505723e2125162cef78", + "regauge-selection.json": "135e314f37bd611a021776991c9d786377b3829f84ca576d5006696c2d8bfbed", + "regauge_transform.py": "baa1c7390f449722e7e700fa1ce9afc3d00cd4c0f7faa5f41693ff88ec02fd61", + "requirements.txt": "25f9f1fb1988b230147a1d3092d34e09c069eb7a6c6d6df46b3973b9f2d36efc", + "retiming-selection.json": "b173080a2884d5bfb28e35ed5b4256e233cafc6275cbfe5a76619b406f2ce989", + "retiming_transform.py": "483cb8da83a1444cbc8b1bbe60473e571a27e6e589fa64f9a26910ca0d678407", + "scalar_check.py": "d87c3cd39313d37cc1403a24e01ad383c146c295968fd41a68c345a4b5adba80", + "source527/echelon/selection.json": "8e6ce5e257aa7656898ab46bc3421df4a619497b1e9f5956d2c546b3014050a7", + "source527/extra/selection.json": "791f6ddeb19add7026ba37461256c13efe3d35bba0bccf1cb9787a01fc16f0f2", + "source527/extra/upstream_setup.py": "a7789d13eda75e78108cee84206692c913f63aafdb9e3e633fddd14640e4678a", + "source527/fresh/selection.json": "4df5f96064349415882ece4ac9abd19cc778f18c0306a27b3d65027dcb04b6c7", + "source527/fresh/upstream_setup.py": "dba4e53f235ca446095eb834313c59f80b5aa0e4fdfb24c5c2eebc26ac11d412", + "source527/paired-selection.json": "67a24896e5ff6a16735efdff57fbb875aa411aba00cbabb22c43a91cdf63e084", + "source527/pr230/NOTICE": "7dfbad087ee49b74fd5075d517eaa263c5dd3d4fbd4c69bfba34ee1cb55e837f", + "source527/pr230/PROVENANCE.json": "19957e28a8ad26281bfe8bfaf8ae16191be53e729a8870a6154671b3384959d4", + "source527/pr230/active-opframe-bases.json": "9a2bba5c72aebc9ee4f21e59b10ce810b2da98a1fa1748fbc44c50a080e584ff", + "source527/rank/selection.json": "5c97c6413f1eb56c7b8f9ba9e839329d212fae7ac3a08c29e9efdee42f5048a0", + "source527/targetagg/selection.json": "b7a4d5eb2a6d2f7df867f9be5af7da1d1aa99cfbd5214195967b0ff60642d77a", + "source527/targetagg/upstream_setup.py": "fd7adf0b12d0769e06438b2ee4322bfcb180d8f73a1104a3eb805ab88c5cc393", + "source527/word.py": "e675d4eb9d90ff0b44279fae0b46f1a8b39f65421cc38454b70a6b75d0e10b42", + "verify.py": "4fc103389c1c62bd0ea5b39f9d41128db30dde4475370394bab600a0acd52e9a" + } +} diff --git a/research/w3-restore/supplied/base/frames.json.gz b/research/w3-restore/supplied/base/frames.json.gz new file mode 100644 index 0000000000..68dcd9eb85 Binary files /dev/null and b/research/w3-restore/supplied/base/frames.json.gz differ diff --git a/research/w3-restore/supplied/builders/agentA_designT/addcats.py b/research/w3-restore/supplied/builders/agentA_designT/addcats.py new file mode 100644 index 0000000000..7d4debaa57 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/addcats.py @@ -0,0 +1,47 @@ +import json, collections, sys, math, pickle +import numpy as np +sys.path.insert(0,'/home/claude/work/eval'); sys.path.insert(0,'/home/claude/work/agentA') +from cost import load_snapshot +from decomp import lab, idx +s,fr,dim,rec=load_snapshot('/home/claude/work/snap') +v=s['v'];n=s['n'] +info=pickle.load(open('/home/claude/work/agentA/T/info.pkl','rb')) +role={} +for cube,C in info.items(): + for r in C['X']: role[r]=('X',cube) + for pl,(r,last,e) in C['BH'].items(): role[r]=('BH',cube) + for r in C['single']: role[r]=('S',cube) + for r in C['carrier']: role[r]=('C',cube) + for r in C['death']: role[r]=('D',cube) + for r in C['upper']: role[r]=('U',cube) + for r in C['other']: role[r]=('Y' if v<=r<2*v else 'M',cube) +F=fr['frames'] +P=lambda p:p//2 +cube_of=[tuple(sorted(P(p) for p in lab[i])) for i in range(v)] +chi=np.zeros((v,24),dtype=np.int64) +for i in range(v): + for p in lab[i]: chi[i,p]=1 +icache={} +def cubeframe(fid): + if fid in icache: return icache[fid] + if dim[fid]==0 or dim[fid]>3: icache[fid]=None; return None + A=np.array(F[str(fid)]['A'],dtype=np.int64) + I=frozenset(np.nonzero(np.all(chi@A.T==0,axis=1))[0].tolist()) + cs={cube_of[i] for i in I} + icache[fid]=next(iter(cs)) if len(cs)==1 else None + return icache[fid] +cat=collections.Counter(); catfull=collections.Counter() +for k in range(len(rec)): + o,a,b,c,f,z=map(int,rec[k]) + if o!=1: continue + if dim[f]==24: + ra=role.get(a,('?',))[0]; rb=role.get(b,('?',))[0] + if ra!='?' or rb!='?': catfull[(ra,rb)]+=1 + continue + cq=cubeframe(f) + if cq is None: continue + ra=role.get(a,('?',None)); rb=role.get(b,('?',None)) + cat[(ra[0],rb[0],dim[f], ra[1]==cq if ra[1] else None, rb[1]==cq if rb[1] else None)]+=1 +for k,c in sorted(cat.items(), key=lambda x:-x[1]): print(c,k) +print('FULL-frame ADDs by roles:') +for k,c in sorted(catfull.items(), key=lambda x:-x[1])[:30]: print(c,k) diff --git a/research/w3-restore/supplied/builders/agentA_designT/addcomp.py b/research/w3-restore/supplied/builders/agentA_designT/addcomp.py new file mode 100644 index 0000000000..6d5fea18b0 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/addcomp.py @@ -0,0 +1,12 @@ +import numpy as np, json, sys +d=sys.argv[1] +s=json.load(open(d+'/249-states.json')) +v=s['v']; ZERO=s['ZERO'] +rec=np.fromfile(d+'/249-records.bin',dtype='1 else '/home/claude/work/agentA/T/out' +LIMIT=int(sys.argv[2]) if len(sys.argv)>2 else 10**9 +os.makedirs(OUT,exist_ok=True) +s,fr,dim,rec=load_snapshot('/home/claude/work/snap') +v=s['v'];n=s['n']; ZERO=s['ZERO']; FULL=s['FULL'] +FR=fr['frames'] +info=pickle.load(open('/home/claude/work/agentA/T/info.pkl','rb')) +part=pickle.load(open('/home/claude/work/agentA/interface.pkl','rb')) +P=lambda p:p//2 +cube_of=[tuple(sorted(P(p) for p in lab[i])) for i in range(v)] +bits=lambda i: tuple(p%2 for p in lab[i]) +init={r:s['initial'][str(r)] for r in range(n)} +NR=len(rec) +chi=np.zeros((v,24),dtype=np.int64) +for i in range(v): + for p in lab[i]: chi[i,p]=1 +icache={} +def items_in(fid): + if fid in icache: return icache[fid] + if dim[fid]==0 or dim[fid]>3: icache[fid]=None; return None + A=np.array(FR[str(fid)]['A'],dtype=np.int64) + I=frozenset(np.nonzero(np.all(chi@A.T==0,axis=1))[0].tolist()); icache[fid]=I if I else None; return icache[fid] +byset={} +for k_ in FR: + f=int(k_) + if 1<=dim[f]<=2: + I=items_in(f) + if I and len(I)==dim[f]: byset.setdefault(I,f) +newframes={} +nextid=max(int(k) for k in FR)+1 +from fractions import Fraction +def kernel_int(B): + M=[[Fraction(x) for x in b] for b in B]; m=len(M); piv=[]; r=0 + for c in range(24): + pr=next((i for i in range(r,m) if M[i][c]!=0),None) + if pr is None: continue + M[r],M[pr]=M[pr],M[r]; pv=M[r][c]; M[r]=[x/pv for x in M[r]] + for i in range(m): + if i!=r and M[i][c]!=0: + f_=M[i][c]; M[i]=[a-f_*b for a,b in zip(M[i],M[r])] + piv.append(c); r+=1 + if r==m: break + out=[] + for fc in [c for c in range(24) if c not in piv]: + x=[Fraction(0)]*24; x[fc]=Fraction(1) + for i,pc in enumerate(piv): x[pc]=-M[i][fc] + den=1 + for q in x: den=den*q.denominator//math.gcd(den,q.denominator) + out.append([int(q*den) for q in x]) + return out +def frame_for(itemset): + global nextid + I=frozenset(itemset) + if I in byset: return byset[I] + B=[chi[i].tolist() for i in sorted(I)] + fid=nextid; nextid+=1 + newframes[fid]={'B':B,'A':kernel_int(B),'dim':len(B)} + dim[fid]=len(B); byset[I]=fid; icache[fid]=I + return fid +# ---------------- roles +role={} +for cube,C in info.items(): + for x in C['X']: role[x]=('X',cube) + for pl,(r,last,e) in C['BH'].items(): role[r]=('BH',cube) + for r in C['single']: role[r]=('S',cube) + for r in C['carrier']: role[r]=('C',cube) + for r in C['death']: role[r]=('D',cube) + for r in C['upper']: role[r]=('U',cube) + for r in C['other']: role[r]=('Y' if v<=r<2*v else 'M',cube) +moves=collections.defaultdict(list) +for k in np.nonzero(rec[:,0]==0)[0]: moves[int(rec[k,1])].append(int(k)) +# special cubes: Y or X reading BH at planes -> skip +skipc=set() +for k in np.nonzero(rec[:,0]==1)[0]: + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if 1<=dim[f]<=3: + ra=role.get(a,('?',None)); rb=role.get(b,('?',None)) + if rb[0]=='BH' and ra[0]=='X': skipc.add(rb[1]) +# single -> target (delivery ADD) +sdeliv={} +for k in np.nonzero(rec[:,0]==1)[0]: + a,b=int(rec[k,1]),int(rec[k,2]) + if v<=a<2*v and role.get(b,('?',))[0]=='S' and dim[int(rec[k,4])]==23: sdeliv[b]=a-v +# X-X forward mix ADDs +xx={} +for k in np.nonzero(rec[:,0]==1)[0]: + a,b=int(rec[k,1]),int(rec[k,2]) + if a new record (replace in place) +insert_before=collections.defaultdict(list) # k -> records to emit before k +newblock=[] +fwd=[] # new forward gates for inversion (a,b,f) +unused=set() +def MOVE(r,old,new): + assert dim[new]>=dim[old], (r,old,new) + return [0,r,old,new,dim[new]-dim[old],0] +def ADD(a,b,f,c=1,z=40): return [1,a,b,c,f,z] +def xor(a,b): return tuple(p^q for p,q in zip(a,b)) +allb=[(i,j,k) for i in (0,1) for j in (0,1) for k in (0,1)] +cubeframes_of={} +def is_cubeframe(fid,cube): + I=items_in(fid) + return bool(I) and all(cube_of[i]==cube for i in I) +stats=collections.Counter() +GPOOL=[] +for cube in todo: GPOOL.extend(sorted(info[cube]['death'])) +GPOOL_SET=set(GPOOL) +used_ids=set() +def take_id(own): + while own: + r=own.pop() + if r not in used_ids: used_ids.add(r); return r + while GPOOL: + r=GPOOL.pop() + if r not in used_ids: used_ids.add(r); return r + raise Exception('global pool empty') +for cube in todo: + C=info[cube]; byb=C['byb']; Xb=lambda b: byb[b] + cubeset=set(C['items']) + regs=set(C['X'])|{r for pl,(r,l,e) in C['BH'].items()}|set(C['single'])|set(C['carrier'])|set(C['death']) + # ---- mix pairs + mixpairs=[] + for b in allb: + if b[1]==0: + A_,B_=Xb(b),Xb(xor(b,(0,1,1))) + k=xx[frozenset((A_,B_))] + car=int(rec[k,1]); pas=int(rec[k,2]) + early=dim[int(rec[k,4])]==2 + Mf=int(rec[k,4]) if early else frame_for((A_,B_)) + mixpairs.append(dict(A=car,B=pas,k=k,early=early,M=Mf,bA=bits(car),bB=bits(pas))) + mixof={} + for mp in mixpairs: mixof[frozenset((mp['A'],mp['B']))]=mp + # ---- planes and BHs + planes=[] + for pl,(r,last,e) in C['BH'].items(): + fl=part[r]['frames']; pids=[f for f in fl if dim[f]==3] + bs=[bits(i) for i in pl] + if len({b[0] for b in bs})==1 or len({b[1]^b[2] for b in bs})==1: dirn=(0,1,1) + elif len({b[1] for b in bs})==1 or len({b[0]^b[2] for b in bs})==1: dirn=(1,0,1) + else: dirn=(1,1,0) + # split into 2 edges along dirn + its=sorted(pl); e1=None + edges=[] + rest=set(its) + while rest: + a=min(rest); bb=[i for i in rest if xor(bits(a),bits(i))==dirn][0] + edges.append(frozenset((a,bb))); rest-={a,bb} + planes.append(dict(items=pl,BH=r,pids=pids,first=pids[0],dirn=dirn,edges=edges)) + # ---- tetra edges (non-mix): each in 2 planes + tedges={} + for p in planes: + if p['dirn']!=(0,1,1): + for e in p['edges']: tedges.setdefault(e,[]).append(p) + assert len(tedges)==8 and all(len(x)==2 for x in tedges.values()), (cube,len(tedges)) + medges={} + for p in planes: + if p['dirn']==(0,1,1): + for e in p['edges']: medges.setdefault(e,[]).append(p) + assert len(medges)==4 and all(len(x)==2 for x in medges.values()) + # ---- singles matching: single for target t holds item s=t^011; edge {s, t^101} or {s, t^110} + singles=[] + for r,d in C['single'].items(): + t=sdeliv[r]; c=d['exit_content']; assert len(c)==1 + sitem=c[0]; tb=bits(t); assert xor(tb,(0,1,1))==bits(sitem), (r,t,sitem) + cands=[frozenset((sitem,byb[xor(tb,(1,0,1))])),frozenset((sitem,byb[xor(tb,(1,1,0))]))] + singles.append((r,t,sitem,cands)) + # bipartite matching singles <-> tedges + match={} + def try_assign(i,used): + r,t,si,cands=singles[i] + for e in cands: + if e in used: continue + used.add(e) + if e not in match or try_assign(match[e],used): match[e]=i; return True + return False + for i in range(len(singles)): assert try_assign(i,set()), 'no matching' + # ---- carriers + carriers=[] + for r in C['carrier']: + d=part[r]; c=d['exit_content'] + if len(c)==1: carriers.append((r,'line',c[0])) + elif len(c)==2: + e=frozenset(c); diff=xor(bits(c[0]),bits(c[1])) + if diff==(0,1,1): carriers.append((r,'M',e)) + else: + assert e in tedges, ('carrier pair not a T edge',cube,c) + carriers.append((r,'T',e)) + else: raise Exception(('carrier content',len(c))) + # ---- id pool for leftovers + pool=list(C['death']) + # ---- assign pair-holders + # tetra edges: L_a, L_b ; send L for item min->face plane? choose: arrival to plane p from edge e + arrivals=collections.defaultdict(list) # plane index -> list of (regid placeholder, source kind, edge, item) + T_regs={} + for e,pls in tedges.items(): + a,b=sorted(e) + # pls: two planes; L_a -> pls[0], L_b -> pls[1] + T_regs[e]=dict(La=a,Lb=b,pa=pls[0],pb=pls[1]) + plane_index={id(p):i for i,p in enumerate(planes)} + for e,tr in T_regs.items(): + arrivals[plane_index[id(tr['pa'])]].append(('L',e,tr['La'])) + arrivals[plane_index[id(tr['pb'])]].append(('L',e,tr['Lb'])) + for e,pls in medges.items(): + for p in pls: arrivals[plane_index[id(p)]].append(('M',e,None)) + # decide BH vs LO per plane, assign ids + regid={} # (kind,e,item/planeidx) -> role id + recyc={} # plane index -> carrier id + pair_carriers=[(r,kind,c) for (r,kind,c) in carriers if kind in ('M','T')] + for (r,kind,c) in pair_carriers: + last=part[r]['frames'][-1] + for pi,p in enumerate(planes): + if last in p['pids'] and c in p['edges'] and pi not in recyc: + recyc[pi]=(r,kind,c); break + recycled_carriers={x[0] for x in recyc.values()} + carriers=[x for x in carriers if x[0] not in recycled_carriers] + for pi,p in enumerate(planes): + arr=arrivals[pi]; assert len(arr)==2 + bh,lo=arr[0],arr[1] + if pi in recyc: + ce=recyc[pi][2] + if bh[1]==ce: bh,lo=lo,bh + assert lo[1]==ce + key_bh=(bh[0],bh[1],bh[2] if bh[0]=='L' else pi); key_lo=(lo[0],lo[1],lo[2] if lo[0]=='L' else pi) + regid[key_bh]=p['BH'] + if pi in recyc: regid[key_lo]=recyc[pi][0]; p['lo_carrier']=recyc[pi][0] + else: regid[key_lo]=take_id(pool) + p['bh_key']=key_bh; p['lo_key']=key_lo + # ---- remove old records of cube-layer regs within the cube layer + # deaths: all records removed (MOVEs, ADDs) -> handled via role-level removal below + # BH: MOVEs into cube frames up to and including first plane id + for p in planes: + r=p['BH'] + for k in moves[r]: + nf=int(rec[k,3]) + if is_cubeframe(nf,cube): + remove[k]=True + if nf==p['first']: break + # singles: remove MOVEs into cube frames; modify exit MOVE + for r,t,si,c in singles: + ex=part[r]['exit']; k=ex[2] + for kk in moves[r]: + if kkE (k_A), B: line->E (k_B), mix at E (mp['k']) + kA=part[A_]['exit'][2]; kB=part[B_]['exit'][2] + E=int(rec[kA,3]); assert int(rec[mp['k'],4])==E + # carrier: emit mix at M then MOVE M->E in place of kA + mixrec=rec[mp['k']].tolist(); mixrec[4]=mp['M'] + insert_before[kA].append(mixrec) + rr=rec[kA].tolist(); rr[2]=mp['M']; rr[4]=dim[rr[3]]-dim[rr[2]]; modify[kA]=rr + remove[mp['k']]=True + # passive: remove its MOVE to E; its next MOVE (from E) gets source M + remove[kB]=True + nxt=[kk for kk in moves[B_] if kk>kB] + assert nxt, 'passive no next move' + k2=nxt[0]; rr=rec[k2].tolist(); assert rr[2]==int(rec[kB,3]), ('passive next move',rr) + # any ADDs of passive at E between? check later in verification + rr[2]=mp['M']; rr[4]=dim[rr[3]]-dim[rr[2]]; modify[k2]=rr + # ---- deaths & cube-internal ADD removal + for r in C['death']: + for kk in moves[r]: remove[kk]=True + stats['cubes']+=1 +unused=GPOOL_SET-used_ids +print('new frames',len(newframes),'unused ids',len(unused), dict(stats)) +# ---------------- ADD removal (forward cube-layer gates) for transformed cubes +tset=set(todo) +cl_regs=set() +for cube in todo: + C=info[cube] + cl_regs|=set(C['X'])|{r for pl,(r,l,e) in C['BH'].items()}|set(C['single'])|set(C['carrier'])|set(C['death']) +deaths=set(); +for cube in todo: deaths|=set(info[cube]['death']) +fwd_removed=np.zeros(NR,bool) +for k in np.nonzero(rec[:,0]==1)[0]: + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if dim[f]==24: continue + if a in deaths or b in deaths: + if v<=a<2*v and dim[f]==0 and int(rec[k,5])==4: continue # comp read handled separately + fwd_removed[k]=True; continue + if 1<=dim[f]<=3: + ra=role.get(a,('?',None)); rb=role.get(b,('?',None)) + if ra[1] in tset or rb[1] in tset: + # keep interface ADDs + if ra[0] in ('U','Y','M'): continue + if ra[0]=='X' and rb[0]=='X': continue # mix handled separately + fwd_removed[k]=True +# LIFO matching of inverses +stack=collections.defaultdict(list); inv_of={} +for k in range(NR): + if rec[k,0]!=1: continue + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if v<=a<2*v: continue + if dim[f]!=24: stack[(a,b)].append(k) + else: + if stack[(a,b)]: inv_of[stack[(a,b)].pop()]=k +nomatch=sum(1 for k in np.nonzero(fwd_removed)[0] if k not in inv_of) +print('removed forward ADDs',int(fwd_removed.sum()),'without inverse',nomatch) +for k in np.nonzero(fwd_removed)[0]: + remove[k]=True + if k in inv_of: remove[inv_of[k]]=True +# deaths: also remove any FULL ADDs involving them that remain +for k in np.nonzero(rec[:,0]==1)[0]: + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if (a in deaths or b in deaths) and dim[f]==24: remove[k]=True +# comp reads: remove all frame-0 cat4 reads from sigma0 helpers (regenerated later) +comp=(rec[:,0]==1)&(rec[:,5]==4)&(rec[:,1]>=v)&(rec[:,1]<2*v) +for k in np.nonzero(comp)[0]: + if dim[int(rec[k,4])]==0 and dim[init[int(rec[k,2])]]==0: remove[k]=True +# ---------------- assemble +out=[] +out.extend(newblock) +for k in range(NR): + if k in insert_before: out.extend(insert_before[k]) + if remove[k] and k not in modify: continue + out.append(modify.get(k, rec[k].tolist())) +# inverses of new forward gates, appended at the end +for (o,a,b,c,f,z) in reversed(fwd): + out.append([1,a,b,-c,FULL,41]) +out=np.array(out,dtype=np.int32) +print('records',NR,'->',len(out)) +# states +newinit=dict(s['initial']); +for r in unused: newinit[str(r)]=FULL +st=dict(s); st['initial']=newinit; st['record_count']=len(out) +json.dump(st,open(OUT+'/249-states.json','w')) +out.tofile(OUT+'/249-records.bin') +# frames +fr2={'h':fr['h'],'frames':dict(FR)} +for fid,ff in newframes.items(): fr2['frames'][str(fid)]=ff +json.dump(fr2,open(OUT+'/frames.json','w')) +with open(OUT+'/frames.txt','w') as fo: + fo.write('%d\n'%len(fr2['frames'])) + for k_,ff in fr2['frames'].items(): + fo.write('%s %d\n'%(k_,len(ff['B']))) + for row in ff['B']: fo.write(' '.join(map(str,row))+'\n') +with open(OUT+'/states.txt','w') as fo: + fo.write('%d %d %d %d\n'%(n,v,ZERO,FULL)) + for r in range(n): fo.write('%d %d\n'%(int(newinit[str(r)]),int(s['final'][str(r)]))) + for t in range(v): fo.write(' '.join(map(str,s['source_covectors'][t]))+'\n') +pickle.dump(dict(todo=todo,unused=sorted(unused),newframes=list(newframes)),open(OUT+'/plan.pkl','wb')) +print('done') diff --git a/research/w3-restore/supplied/builders/agentA_designT/build_v5.py b/research/w3-restore/supplied/builders/agentA_designT/build_v5.py new file mode 100644 index 0000000000..c8ee81af98 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/build_v5.py @@ -0,0 +1,451 @@ +# Cube-layer redesign ("Design T") builder. +import json, collections, sys, math, pickle, os +import numpy as np +sys.path.insert(0,'/home/claude/work/eval'); sys.path.insert(0,'/home/claude/work/agentA') +from cost import load_snapshot +from decomp import lab, idx +OUT=sys.argv[1] if len(sys.argv)>1 else '/home/claude/work/agentA/T/out' +LIMIT=int(sys.argv[2]) if len(sys.argv)>2 else 10**9 +os.makedirs(OUT,exist_ok=True) +s,fr,dim,rec=load_snapshot('/home/claude/work/snap') +v=s['v'];n=s['n']; ZERO=s['ZERO']; FULL=s['FULL'] +FR=fr['frames'] +info=pickle.load(open('/home/claude/work/agentA/T/info.pkl','rb')) +part=pickle.load(open('/home/claude/work/agentA/interface.pkl','rb')) +P=lambda p:p//2 +cube_of=[tuple(sorted(P(p) for p in lab[i])) for i in range(v)] +bits=lambda i: tuple(p%2 for p in lab[i]) +init={r:s['initial'][str(r)] for r in range(n)} +NR=len(rec) +chi=np.zeros((v,24),dtype=np.int64) +for i in range(v): + for p in lab[i]: chi[i,p]=1 +icache={} +def items_in(fid): + if fid in icache: return icache[fid] + if dim[fid]==0 or dim[fid]>3: icache[fid]=None; return None + A=np.array(FR[str(fid)]['A'],dtype=np.int64) + I=frozenset(np.nonzero(np.all(chi@A.T==0,axis=1))[0].tolist()); icache[fid]=I if I else None; return icache[fid] +byset={} +for k_ in FR: + f=int(k_) + if 1<=dim[f]<=2: + I=items_in(f) + if I and len(I)==dim[f]: byset.setdefault(I,f) +newframes={} +nextid=max(int(k) for k in FR)+1 +from fractions import Fraction +def kernel_int(B): + M=[[Fraction(x) for x in b] for b in B]; m=len(M); piv=[]; r=0 + for c in range(24): + pr=next((i for i in range(r,m) if M[i][c]!=0),None) + if pr is None: continue + M[r],M[pr]=M[pr],M[r]; pv=M[r][c]; M[r]=[x/pv for x in M[r]] + for i in range(m): + if i!=r and M[i][c]!=0: + f_=M[i][c]; M[i]=[a-f_*b for a,b in zip(M[i],M[r])] + piv.append(c); r+=1 + if r==m: break + out=[] + for fc in [c for c in range(24) if c not in piv]: + x=[Fraction(0)]*24; x[fc]=Fraction(1) + for i,pc in enumerate(piv): x[pc]=-M[i][fc] + den=1 + for q in x: den=den*q.denominator//math.gcd(den,q.denominator) + out.append([int(q*den) for q in x]) + return out +def frame_for(itemset): + global nextid + I=frozenset(itemset) + if I in byset: return byset[I] + B=[chi[i].tolist() for i in sorted(I)] + fid=nextid; nextid+=1 + newframes[fid]={'B':B,'A':kernel_int(B),'dim':len(B)} + dim[fid]=len(B); byset[I]=fid; icache[fid]=I + return fid +# ---------------- roles +role={} +for cube,C in info.items(): + for x in C['X']: role[x]=('X',cube) + for pl,(r,last,e) in C['BH'].items(): role[r]=('BH',cube) + for r in C['single']: role[r]=('S',cube) + for r in C['carrier']: role[r]=('C',cube) + for r in C['death']: role[r]=('D',cube) + for r in C['upper']: role[r]=('U',cube) + for r in C['other']: role[r]=('Y' if v<=r<2*v else 'M',cube) +moves=collections.defaultdict(list) +for k in np.nonzero(rec[:,0]==0)[0]: moves[int(rec[k,1])].append(int(k)) +# special cubes: Y or X reading BH at planes -> skip +skipc=set(); xplane_keep=set() +for k in np.nonzero(rec[:,0]==1)[0]: + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if 1<=dim[f]<=3: + ra=role.get(a,('?',None)); rb=role.get(b,('?',None)) + if rb[0]=='BH' and ra[0]=='X': xplane_keep.add(a) # v5: keep this X's plane visit +# single -> target (delivery ADD) +sdeliv={} +for k in np.nonzero(rec[:,0]==1)[0]: + a,b=int(rec[k,1]),int(rec[k,2]) + if v<=a<2*v and role.get(b,('?',))[0]=='S' and dim[int(rec[k,4])]==23: sdeliv[b]=a-v +# X-X forward mix ADDs +xx={} +for k in np.nonzero(rec[:,0]==1)[0]: + a,b=int(rec[k,1]),int(rec[k,2]) + if a new record (replace in place) +insert_before=collections.defaultdict(list) # k -> records to emit before k +newblock=[] +fwd=[] # new forward gates for inversion (a,b,f) +unused=set() +def MOVE(r,old,new): + assert dim[new]>=dim[old], (r,old,new) + return [0,r,old,new,dim[new]-dim[old],0] +def ADD(a,b,f,c=1,z=40): return [1,a,b,c,f,z] +def xor(a,b): return tuple(p^q for p,q in zip(a,b)) +allb=[(i,j,k) for i in (0,1) for j in (0,1) for k in (0,1)] +cubeframes_of={} +def is_cubeframe(fid,cube): + I=items_in(fid) + return bool(I) and all(cube_of[i]==cube for i in I) +stats=collections.Counter() +GPOOL=[] +for cube in todo: GPOOL.extend(sorted(info[cube]['death'])) +GPOOL_SET=set(GPOOL) +used_ids=set() +def take_id(own): + while own: + r=own.pop() + if r not in used_ids: used_ids.add(r); return r + while GPOOL: + r=GPOOL.pop() + if r not in used_ids: used_ids.add(r); return r + raise Exception('global pool empty') +for cube in todo: + C=info[cube]; byb=C['byb']; Xb=lambda b: byb[b] + cubeset=set(C['items']) + regs=set(C['X'])|{r for pl,(r,l,e) in C['BH'].items()}|set(C['single'])|set(C['carrier'])|set(C['death']) + # ---- mix pairs + mixpairs=[] + for b in allb: + if b[1]==0: + A_,B_=Xb(b),Xb(xor(b,(0,1,1))) + k=xx[frozenset((A_,B_))] + car=int(rec[k,1]); pas=int(rec[k,2]) + early=dim[int(rec[k,4])]==2 + Mf=int(rec[k,4]) if early else frame_for((A_,B_)) + mixpairs.append(dict(A=car,B=pas,k=k,early=early,M=Mf,bA=bits(car),bB=bits(pas))) + mixof={} + for mp in mixpairs: mixof[frozenset((mp['A'],mp['B']))]=mp + # ---- planes and BHs + planes=[] + for pl,(r,last,e) in C['BH'].items(): + fl=part[r]['frames']; pids=[f for f in fl if dim[f]==3] + bs=[bits(i) for i in pl] + if len({b[0] for b in bs})==1 or len({b[1]^b[2] for b in bs})==1: dirn=(0,1,1) + elif len({b[1] for b in bs})==1 or len({b[0]^b[2] for b in bs})==1: dirn=(1,0,1) + else: dirn=(1,1,0) + # split into 2 edges along dirn + its=sorted(pl); e1=None + edges=[] + rest=set(its) + while rest: + a=min(rest); bb=[i for i in rest if xor(bits(a),bits(i))==dirn][0] + edges.append(frozenset((a,bb))); rest-={a,bb} + planes.append(dict(items=pl,BH=r,pids=pids,first=pids[0],dirn=dirn,edges=edges)) + # ---- tetra edges (non-mix): each in 2 planes + tedges={} + for p in planes: + if p['dirn']!=(0,1,1): + for e in p['edges']: tedges.setdefault(e,[]).append(p) + assert len(tedges)==8 and all(len(x)==2 for x in tedges.values()), (cube,len(tedges)) + medges={} + for p in planes: + if p['dirn']==(0,1,1): + for e in p['edges']: medges.setdefault(e,[]).append(p) + assert len(medges)==4 and all(len(x)==2 for x in medges.values()) + # ---- singles matching: single for target t holds item s=t^011; edge {s, t^101} or {s, t^110} + singles=[] + for r,d in C['single'].items(): + t=sdeliv[r]; c=d['exit_content']; assert len(c)==1 + sitem=c[0]; tb=bits(t); assert xor(tb,(0,1,1))==bits(sitem), (r,t,sitem) + cands=[frozenset((sitem,byb[xor(tb,(1,0,1))])),frozenset((sitem,byb[xor(tb,(1,1,0))]))] + singles.append((r,t,sitem,cands)) + # bipartite matching singles <-> tedges + match={} + def try_assign(i,used): + r,t,si,cands=singles[i] + for e in cands: + if e in used: continue + used.add(e) + if e not in match or try_assign(match[e],used): match[e]=i; return True + return False + for i in range(len(singles)): assert try_assign(i,set()), 'no matching' + # ---- carriers + carriers=[] + for r in C['carrier']: + d=part[r]; c=d['exit_content'] + if len(c)==1: carriers.append((r,'line',c[0])) + elif len(c)==2: + e=frozenset(c); diff=xor(bits(c[0]),bits(c[1])) + if diff==(0,1,1): carriers.append((r,'M',e)) + else: + assert e in tedges, ('carrier pair not a T edge',cube,c) + carriers.append((r,'T',e)) + else: raise Exception(('carrier content',len(c))) + # ---- id pool for leftovers + pool=list(C['death']) + # ---- assign pair-holders + # tetra edges: L_a, L_b ; send L for item min->face plane? choose: arrival to plane p from edge e + arrivals=collections.defaultdict(list) # plane index -> list of (regid placeholder, source kind, edge, item) + T_regs={} + for e,pls in tedges.items(): + a,b=sorted(e) + # pls: two planes; L_a -> pls[0], L_b -> pls[1] + T_regs[e]=dict(La=a,Lb=b,pa=pls[0],pb=pls[1]) + plane_index={id(p):i for i,p in enumerate(planes)} + for e,tr in T_regs.items(): + arrivals[plane_index[id(tr['pa'])]].append(('L',e,tr['La'])) + arrivals[plane_index[id(tr['pb'])]].append(('L',e,tr['Lb'])) + for e,pls in medges.items(): + for p in pls: arrivals[plane_index[id(p)]].append(('M',e,None)) + # decide BH vs LO per plane, assign ids + regid={} # (kind,e,item/planeidx) -> role id + recyc={} # plane index -> carrier id + pair_carriers=[(r,kind,c) for (r,kind,c) in carriers if kind in ('M','T')] + for (r,kind,c) in pair_carriers: + last=part[r]['frames'][-1] + for pi,p in enumerate(planes): + if last in p['pids'] and c in p['edges'] and pi not in recyc: + recyc[pi]=(r,kind,c); break + recycled_carriers={x[0] for x in recyc.values()} + carriers=[x for x in carriers if x[0] not in recycled_carriers] + for pi,p in enumerate(planes): + arr=arrivals[pi]; assert len(arr)==2 + bh,lo=arr[0],arr[1] + if pi in recyc: + ce=recyc[pi][2] + if bh[1]==ce: bh,lo=lo,bh + assert lo[1]==ce + key_bh=(bh[0],bh[1],bh[2] if bh[0]=='L' else pi); key_lo=(lo[0],lo[1],lo[2] if lo[0]=='L' else pi) + regid[key_bh]=p['BH'] + if pi in recyc: regid[key_lo]=recyc[pi][0]; p['lo_carrier']=recyc[pi][0] + else: regid[key_lo]=take_id(pool) + p['bh_key']=key_bh; p['lo_key']=key_lo + # ---- remove old records of cube-layer regs within the cube layer + # deaths: all records removed (MOVEs, ADDs) -> handled via role-level removal below + # BH: MOVEs into cube frames up to and including first plane id + for p in planes: + r=p['BH'] + for k in moves[r]: + nf=int(rec[k,3]) + if is_cubeframe(nf,cube): + remove[k]=True + if nf==p['first']: break + # singles: remove MOVEs into cube frames; modify exit MOVE + for r,t,si,c in singles: + ex=part[r]['exit']; k=ex[2] + for kk in moves[r]: + if kkE (k_A), B: line->E (k_B), mix at E (mp['k']) + kA=part[A_]['exit'][2]; kB=part[B_]['exit'][2] + E=int(rec[kA,3]); assert int(rec[mp['k'],4])==E + # carrier: emit mix at M then MOVE M->E in place of kA + mixrec=rec[mp['k']].tolist(); mixrec[4]=mp['M'] + insert_before[kA].append(mixrec) + rr=rec[kA].tolist(); rr[2]=mp['M']; rr[4]=dim[rr[3]]-dim[rr[2]]; modify[kA]=rr + remove[mp['k']]=True + # passive: remove its MOVE to E; its next MOVE (from E) gets source M + remove[kB]=True + nxt=[kk for kk in moves[B_] if kk>kB] + assert nxt, 'passive no next move' + k2=nxt[0]; rr=rec[k2].tolist(); assert rr[2]==int(rec[kB,3]), ('passive next move',rr) + # any ADDs of passive at E between? check later in verification + rr[2]=mp['M']; rr[4]=dim[rr[3]]-dim[rr[2]]; modify[k2]=rr + # ---- deaths & cube-internal ADD removal + for r in C['death']: + for kk in moves[r]: remove[kk]=True + stats['cubes']+=1 +unused=GPOOL_SET-used_ids +print('new frames',len(newframes),'unused ids',len(unused), dict(stats)) +# ---------------- ADD removal (forward cube-layer gates) for transformed cubes +tset=set(todo) +cl_regs=set() +for cube in todo: + C=info[cube] + cl_regs|=set(C['X'])|{r for pl,(r,l,e) in C['BH'].items()}|set(C['single'])|set(C['carrier'])|set(C['death']) +deaths=set(); +for cube in todo: deaths|=set(info[cube]['death']) +fwd_removed=np.zeros(NR,bool) +for k in np.nonzero(rec[:,0]==1)[0]: + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if dim[f]==24: continue + if a in deaths or b in deaths: + if v<=a<2*v and dim[f]==0 and int(rec[k,5])==4: continue # comp read handled separately + fwd_removed[k]=True; continue + if 1<=dim[f]<=3: + ra=role.get(a,('?',None)); rb=role.get(b,('?',None)) + if ra[1] in tset or rb[1] in tset: + # keep interface ADDs + if ra[0] in ('U','Y','M'): continue + if ra[0]=='X' and rb[0]=='X': continue # mix handled separately + if ra[0]=='X' and a in xplane_keep and rb[0]=='BH': continue # v5: special X reads its plane block + fwd_removed[k]=True +# LIFO matching of inverses +stack=collections.defaultdict(list); inv_of={} +for k in range(NR): + if rec[k,0]!=1: continue + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if v<=a<2*v: continue + if dim[f]!=24: stack[(a,b)].append(k) + else: + if stack[(a,b)]: inv_of[stack[(a,b)].pop()]=k +nomatch=sum(1 for k in np.nonzero(fwd_removed)[0] if k not in inv_of) +print('removed forward ADDs',int(fwd_removed.sum()),'without inverse',nomatch) +for k in np.nonzero(fwd_removed)[0]: + remove[k]=True + if k in inv_of: remove[inv_of[k]]=True +# deaths: also remove any FULL ADDs involving them that remain +for k in np.nonzero(rec[:,0]==1)[0]: + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if (a in deaths or b in deaths) and dim[f]==24: remove[k]=True +# comp reads: remove all frame-0 cat4 reads from sigma0 helpers (regenerated later) +comp=(rec[:,0]==1)&(rec[:,5]==4)&(rec[:,1]>=v)&(rec[:,1]<2*v) +for k in np.nonzero(comp)[0]: + if dim[int(rec[k,4])]==0 and dim[init[int(rec[k,2])]]==0: remove[k]=True +# ---------------- assemble +out=[] +out.extend(newblock) +for k in range(NR): + if k in insert_before: out.extend(insert_before[k]) + if remove[k] and k not in modify: continue + out.append(modify.get(k, rec[k].tolist())) +# inverses of new forward gates, appended at the end +for (o,a,b,c,f,z) in reversed(fwd): + out.append([1,a,b,-c,FULL,41]) +out=np.array(out,dtype=np.int32) +print('records',NR,'->',len(out)) +# states +newinit=dict(s['initial']); +for r in unused: newinit[str(r)]=FULL +st=dict(s); st['initial']=newinit; st['record_count']=len(out) +json.dump(st,open(OUT+'/249-states.json','w')) +out.tofile(OUT+'/249-records.bin') +# frames +fr2={'h':fr['h'],'frames':dict(FR)} +for fid,ff in newframes.items(): fr2['frames'][str(fid)]=ff +json.dump(fr2,open(OUT+'/frames.json','w')) +with open(OUT+'/frames.txt','w') as fo: + fo.write('%d\n'%len(fr2['frames'])) + for k_,ff in fr2['frames'].items(): + fo.write('%s %d\n'%(k_,len(ff['B']))) + for row in ff['B']: fo.write(' '.join(map(str,row))+'\n') +with open(OUT+'/states.txt','w') as fo: + fo.write('%d %d %d %d\n'%(n,v,ZERO,FULL)) + for r in range(n): fo.write('%d %d\n'%(int(newinit[str(r)]),int(s['final'][str(r)]))) + for t in range(v): fo.write(' '.join(map(str,s['source_covectors'][t]))+'\n') +pickle.dump(dict(todo=todo,unused=sorted(unused),newframes=list(newframes)),open(OUT+'/plan.pkl','wb')) +print('done') diff --git a/research/w3-restore/supplied/builders/agentA_designT/checks.py b/research/w3-restore/supplied/builders/agentA_designT/checks.py new file mode 100644 index 0000000000..e6fb746815 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/checks.py @@ -0,0 +1,39 @@ +import json, collections, sys, math, pickle +import numpy as np +sys.path.insert(0,'/home/claude/work/eval'); sys.path.insert(0,'/home/claude/work/agentA') +from cost import load_snapshot +from decomp import lab, idx +s,fr,dim,rec=load_snapshot('/home/claude/work/snap') +v=s['v'];n=s['n'] +info=pickle.load(open('/home/claude/work/agentA/T/info.pkl','rb')) +part=pickle.load(open('/home/claude/work/agentA/interface.pkl','rb')) +role={} +for cube,C in info.items(): + for r in C['X']: role[r]=('X',cube) + for pl,(r,last,e) in C['BH'].items(): role[r]=('BH',cube) + for r in C['single']: role[r]=('S',cube) + for r in C['carrier']: role[r]=('C',cube) + for r in C['death']: role[r]=('D',cube) + for r in C['upper']: role[r]=('U',cube) + for r in C['other']: role[r]=('Y' if v<=r<2*v else 'M',cube) +bhlast={} +for cube,C in info.items(): + for pl,(r,last,e) in C['BH'].items(): bhlast[r]=last +bad=collections.Counter(); badcubes=set() +for k in range(len(rec)): + o,a,b,c,f,z=map(int,rec[k]) + if o!=1 or dim[f]==24 or dim[f]>3 or dim[f]==0: continue + ra=role.get(a,('?',None)); rb=role.get(b,('?',None)) + if ra[0]=='U' and rb[0]=='BH': + if f!=bhlast[b]: bad['U-absorbs-at-other-plane-id']+=1; badcubes.add(rb[1]) + if (ra[0],rb[0]) in (('Y','BH'),('X','BH')): bad[(ra[0],rb[0])]+=1; badcubes.add(rb[1]) +# X chain shapes +xs=collections.Counter() +for cube,C in info.items(): + for x,d in C['X'].items(): + fr_=[dim[f] for f in d['frames']] + e=d['exit'] + xs[(tuple(fr_), e[1] if e else None)]+=1 +print(bad, len(badcubes)) +print(xs.most_common(20)) +pickle.dump(badcubes,open('/home/claude/work/agentA/T/badcubes.pkl','wb')) diff --git a/research/w3-restore/supplied/builders/agentA_designT/gather.py b/research/w3-restore/supplied/builders/agentA_designT/gather.py new file mode 100644 index 0000000000..fafa8ae6f0 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/gather.py @@ -0,0 +1,56 @@ +# Gather per-cube structural info for the cube-layer redesign. +import json, collections, sys, math, pickle +import numpy as np +sys.path.insert(0,'/home/claude/work/eval'); sys.path.insert(0,'/home/claude/work/agentA') +from cost import load_snapshot +from decomp import lab, idx +s,fr,dim,rec=load_snapshot('/home/claude/work/snap') +v=s['v'];n=s['n']; R=n+1 +F=fr['frames'] +P=lambda p:p//2 +cube_of=[tuple(sorted(P(p) for p in lab[i])) for i in range(v)] +bits=lambda i: tuple(p%2 for p in lab[i]) +part=pickle.load(open('/home/claude/work/agentA/interface.pkl','rb')) +init={r:s['initial'][str(r)] for r in range(n)} +ZERO=s['ZERO']; FULL=s['FULL'] +chi=np.zeros((v,24),dtype=np.int64) +for i in range(v): + for p in lab[i]: chi[i,p]=1 +icache={} +def items_in(fid): + if fid in icache: return icache[fid] + if dim[fid]==0 or dim[fid]>3: icache[fid]=None; return None + A=np.array(F[str(fid)]['A'],dtype=np.int64) + I=frozenset(np.nonzero(np.all(chi@A.T==0,axis=1))[0].tolist()); icache[fid]=I if I else None; return icache[fid] +cubes=collections.defaultdict(set) +for r,d in part.items(): cubes[d['cube']].add(r) +# classify participants +info={} +cnt=collections.Counter() +for cube,regs in cubes.items(): + items=sorted(i for i in range(v) if cube_of[i]==cube) + byb={bits(i):i for i in items} + C=dict(items=items,byb=byb,BH={},single={},carrier=[],death=[],upper=[],other=[],X={}) + for r in regs: + d=part[r]; e=d['exit'] + if r3: icache[fid]=None; return None + A=np.array(F[str(fid)]['A'],dtype=np.int64) + I=frozenset(np.nonzero(np.all(chi@A.T==0,axis=1))[0].tolist()) + icache[fid]=I if I else None + return icache[fid] +def cubeframe(fid): + I=items_in(fid) + if not I: return None + cs={cube_of[i] for i in I} + return next(iter(cs)) if len(cs)==1 else None +init={r:s['initial'][str(r)] for r in range(n)} +fin={r:s['final'][str(r)] for r in range(n)} +# simulate contents; track per register its frame and content at each move +Wd=(v+63)//64 +val=np.zeros((R,Wd),np.uint64) +for i in range(v): val[i,i//64]|=np.uint64(1)< dict(cube, entry_frame, entry_from_zero, frames list, exit (frame,dim,k), exit_content) +for r in range(n): + c=cubeframe(init[r]) + if c is not None: part[r]=dict(cube=c,entry=init[r],fromzero=False,frames=[init[r]],exit=None,firstk=0) +for k in range(len(rec)): + o,a,b,c,f,z=map(int,rec[k]) + if o==0: + r=a; newf=c + cq=cubeframe(newf) + if r in part and part[r]['exit'] is None: + if cq==part[r]['cube']: + part[r]['frames'].append(newf) + else: + part[r]['exit']=(newf,dim[newf],k); part[r]['exit_content']=its(r) + elif r not in part and cq is not None and dim[cur[r]]==0: + part[r]=dict(cube=cq,entry=newf,fromzero=True,frames=[newf],exit=None,firstk=k) + cur[r]=newf + elif o==1: + if c&1: val[a]^=val[b] + elif o==2: val[n]=val[a] + elif o==3: val[n]=0 +pickle.dump(part,open('/home/claude/work/agentA/interface.pkl','wb')) +stat=collections.Counter() +for r,d in part.items(): + kind='X' if r4')]+=1 +for k,c in sorted(stat.items(), key=lambda x:-x[1])[:40]: print(c,k) diff --git a/research/w3-restore/supplied/builders/agentA_designT/lpmod.py b/research/w3-restore/supplied/builders/agentA_designT/lpmod.py new file mode 100644 index 0000000000..c906572866 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/lpmod.py @@ -0,0 +1,45 @@ +# Show the registers of one LP module (anti-diagonal (a,b')/(a',b) on pairs Pa,Pb) in a word: chains and contents +import json, collections, sys, math +import numpy as np +sys.path.insert(0,'/home/claude/work/eval'); sys.path.insert(0,'/home/claude/work/agentA') +from cost import load_snapshot +from decomp import lab +d=sys.argv[1]; a0=int(sys.argv[2]); b0=int(sys.argv[3]) # points a and b' (anti-diagonal: items containing (a0,b0) or (a0^1,b0^1)) +s,fr,dim,rec=load_snapshot(d) +v=s['v'];n=s['n'];R=n+1 +g=lambda r: r*math.log(120/r) if r>0 else 0 +P=lambda p:p//2 +mod=set(i for i,l in enumerate(lab) if (a0 in l and b0 in l) or ((a0^1) in l and (b0^1) in l)) +print('module items',len(mod)) +Wd=(v+63)//64 +val=np.zeros((R,Wd),np.uint64) +for i in range(v): val[i,i//64]|=np.uint64(1)<=2*v and a=2*v and a=2*v and b0); tot+=D + rows.append((h,init[h],ch,D,[e for e in ev[h] if e[0]!='M' and e[1]>3][:8])) +for r in sorted(rows,key=lambda x:x[2]): + if r[3]>0: print(r[0],'sig',r[1],r[2],'%.1f'%r[3],r[4]) +print('registers',len(regs),'D %.0f'%tot) diff --git a/research/w3-restore/supplied/builders/agentA_designT/modules.py b/research/w3-restore/supplied/builders/agentA_designT/modules.py new file mode 100644 index 0000000000..adfe97df7f --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/modules.py @@ -0,0 +1,53 @@ +# Classify helpers into face modules (center point), LP modules (anti-diagonal line pair), or mixed; sum chain D. +import json, collections, sys, math +import numpy as np +sys.path.insert(0,'/home/claude/work/eval'); sys.path.insert(0,'/home/claude/work/agentA') +from cost import load_snapshot +from decomp import lab +d=sys.argv[1] +s,fr,dim,rec=load_snapshot(d) +v=s['v'];n=s['n'];R=n+1 +g=lambda r: r*math.log(120/r) if r>0 else 0 +init={r:dim[s['initial'][str(r)]] for r in range(n)} +P=lambda p:p//2 +Wd=(v+63)//64 +val=np.zeros((R,Wd),np.uint64) +for i in range(v): val[i,i//64]|=np.uint64(1)<=2: + return ('lp',) if len(its)>4 else ('cube-ish',) + return ('mixed',) +cat=collections.defaultdict(lambda:[0,0.0]) +for h in range(2*v,n): + if init[h]==24: continue + k=classify(h)+(('sig0' if init[h]==0 else 'gauged'),) + cat[k][0]+=1; cat[k][1]+=sum(g(x) for x in chain[h] if x>0) +tot=sum(x[1] for x in cat.values()) +for k,(c,dd) in sorted(cat.items(), key=lambda x:-x[1][1]): + print('%-28s n=%5d D=%8.0f (%4.1f%%) per=%.1f'%(str(k),c,dd,100*dd/tot,dd/c)) diff --git a/research/w3-restore/supplied/builders/agentA_designT/names.py b/research/w3-restore/supplied/builders/agentA_designT/names.py new file mode 100644 index 0000000000..45a2d7cb0d --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/names.py @@ -0,0 +1,7 @@ +# helper to name item sets relative to a target +import json, sys +sys.path.insert(0,'/home/claude/work/agentA') +from decomp import comps, name, lab, idx +if __name__=='__main__': + t=int(sys.argv[1]); xs=list(map(int,sys.argv[2:])) + print(lab[t], name(t,xs)) diff --git a/research/w3-restore/supplied/builders/agentA_designT/upper.py b/research/w3-restore/supplied/builders/agentA_designT/upper.py new file mode 100644 index 0000000000..161541d8cd --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/upper.py @@ -0,0 +1,41 @@ +# Upper-network register analysis on a given word dir: for each helper, content at each frame; classify death points. +import json, collections, sys, math +import numpy as np +sys.path.insert(0,'/home/claude/work/eval') +from cost import load_snapshot +d=sys.argv[1] +s,fr,dim,rec=load_snapshot(d) +v=s['v'];n=s['n'];R=n+1 +g=lambda r: r*math.log(120/r) if r>0 else 0 +init={r:dim[s['initial'][str(r)]] for r in range(n)} +Wd=(v+63)//64 +val=np.zeros((R,Wd),np.uint64) +for i in range(v): val[i,i//64]|=np.uint64(1)< (dim before final jump, content size at that time) +chain=collections.defaultdict(list) +for k in range(len(rec)): + o,a,b,c,f,z=map(int,rec[k]) + if o==0: + if a>=2*v and a=2*v and a180'))) + cat[key][0]+=1; cat[key][1]+=sum(g(x) for x in chain[h] if x>0) +tot=sum(x[1] for x in cat.values()) +for k,(c,dd) in sorted(cat.items(), key=lambda x:-x[1][1])[:40]: + print('%-25s n=%5d D=%8.0f (%4.1f%%) per=%.1f'%(str(k),c,dd,100*dd/tot,dd/c)) +print('total helper D',round(tot)) diff --git a/research/w3-restore/supplied/builders/agentA_designT/verify.cpp b/research/w3-restore/supplied/builders/agentA_designT/verify.cpp new file mode 100644 index 0000000000..7d26e6c2db --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_designT/verify.cpp @@ -0,0 +1,62 @@ +// Verifier: legality replay (exact-mod-p containment), nondegeneracy of used frames, formal F2 simulation. +// Usage: verify [residual_out] +#include "/home/claude/work/fr/sub.hpp" +int main(int argc,char**argv){ + string dir=argv[1]; + Store st; Snapshot sn; sn.load(st,dir,dir+"/249-records.bin"); + int n=sn.n, v=sn.v; size_t NR=sn.rec.size(); + fprintf(stderr,"[load] frames=%zu records=%zu\n",st.S.size(),NR); + auto C=[&](int c){ auto it=sn.cat2id.find(c); if(it==sn.cat2id.end()){fprintf(stderr,"unknown frame %d\n",c); exit(3);} return it->second; }; + int ZERO=C(sn.ZERO), FULLf=C(sn.FULL); + vector state(n+1); for(int r=0;r used; + for(size_t k=0;k val((size_t)(n+1)*WD,0); + auto row=[&](int r){return &val[(size_t)r*WD];}; + for(int r=0;r sig(n); for(int r=0;r2? fopen(argv[2],"w"):nullptr; + for(int r=0;r=2*v){ + bool ok=true; for(int w=0;w=2*v && qM->P) and LO goes P->FULL after BH += LO: +# LO (pivot) enters at the common line E = M_bh ∩ M_lo (sigma=1); BH visits E first and absorbs LO there; +# the absorption is inverted at FULL at the very end. LO's dirt then cancels (it enters BH twice). +import sys, json, collections, pickle, math, os +import numpy as np +from fractions import Fraction +sys.path.insert(0,'/home/claude/work/eval'); sys.path.insert(0,'/home/claude/work/agentA/V') +from cost import load_snapshot +from blocks import lab +IN=sys.argv[1]; OUT=sys.argv[2] +os.makedirs(OUT,exist_ok=True) +s,fr,dim,rec=load_snapshot(IN) +v=s['v']; n=s['n']; ZERO=s['ZERO']; FULL=s['FULL'] +FR=fr['frames'] +init={r:s['initial'][str(r)] for r in range(n)} +NR=len(rec) +moves=collections.defaultdict(list) +for k in np.nonzero(rec[:,0]==0)[0]: moves[int(rec[k,1])].append(int(k)) +adds_dst=collections.defaultdict(list); adds_src=collections.defaultdict(list) +for k in np.nonzero(rec[:,0]==1)[0]: + adds_dst[int(rec[k,1])].append(int(k)); adds_src[int(rec[k,2])].append(int(k)) +def chain(r): return [init[r]]+[int(rec[k,3]) for k in moves[r]] +chi=np.zeros((v,24),dtype=np.int64) +for i in range(v): + for p in lab[i]: chi[i,p]=1 +G=[[Fraction(int(i==j))-Fraction(1,9) for j in range(24)] for i in range(24)] +def gnorm(w): + s1=sum(x*x for x in w); s2=sum(w) + return Fraction(s1)-Fraction(s2*s2,9) +def kernel_int(Bm): + M=[[Fraction(x) for x in b] for b in Bm]; m=len(M); piv=[]; r=0 + for c in range(24): + pr=next((i for i in range(r,m) if M[i][c]!=0),None) + if pr is None: continue + M[r],M[pr]=M[pr],M[r]; pv=M[r][c]; M[r]=[x/pv for x in M[r]] + for i in range(m): + if i!=r and M[i][c]!=0: + f_=M[i][c]; M[i]=[a-f_*b for a,b in zip(M[i],M[r])] + piv.append(c); r+=1 + if r==m: break + out=[] + for fc in [c for c in range(24) if c not in piv]: + x=[Fraction(0)]*24; x[fc]=Fraction(1) + for i,pc in enumerate(piv): x[pc]=-M[i][fc] + den=1 + for q in x: den=den*q.denominator//math.gcd(den,q.denominator) + out.append([int(q*den) for q in x]) + return out +def intersect_line(a1,a2,b1,b2): + # solve al*chi[a1]+be*chi[a2]-ga*chi[b1]-de*chi[b2]=0 + Mx=np.stack([chi[a1],chi[a2],-chi[b1],-chi[b2]],axis=1).astype(object) # 24x4 + # nullspace over Q + M=[[Fraction(int(x)) for x in row] for row in Mx] + rows=len(M); cols=4; piv=[]; r=0 + for c in range(cols): + pr=next((i for i in range(r,rows) if M[i][c]!=0),None) + if pr is None: continue + M[r],M[pr]=M[pr],M[r]; pv=M[r][c]; M[r]=[x/pv for x in M[r]] + for i in range(rows): + if i!=r and M[i][c]!=0: + f_=M[i][c]; M[i]=[a-f_*b for a,b in zip(M[i],M[r])] + piv.append(c); r+=1 + free=[c for c in range(cols) if c not in piv] + if len(free)!=1: return None + fc=free[0]; x=[Fraction(0)]*cols; x[fc]=Fraction(1) + for i,pc in enumerate(piv): x[pc]=-M[i][fc] + w=[x[0]*int(chi[a1,j])+x[1]*int(chi[a2,j]) for j in range(24)] + den=1 + for q in w: den=den*q.denominator//math.gcd(den,q.denominator) + wi=[int(q*den) for q in w] + gg=0 + for q in wi: gg=math.gcd(gg,abs(q)) + wi=[q//gg for q in wi] + return wi +# detect eligible planes +elig=[] +for k in np.nonzero((rec[:,0]==1)&(rec[:,5]==40))[0]: + a,b,f=int(rec[k,1]),int(rec[k,2]),int(rec[k,4]) + if dim[f]!=3 or a<2*v or b<2*v or a>=n or b>=n: continue + ca,cb=chain(a),chain(b) + if len(ca)<3 or len(cb)!=4: continue + if not (ca[0]==ZERO and dim[ca[1]]==2 and ca[2]==f): continue + if not (cb[0]==ZERO and dim[cb[1]]==2 and cb[2]==f and cb[3]==FULL): continue + if ca[1]==cb[1]: continue + xa=[int(rec[kk,2]) for kk in adds_dst[a] if int(rec[kk,4])==ca[1]] + xb=[int(rec[kk,2]) for kk in adds_dst[b] if int(rec[kk,4])==cb[1]] + if len(xa)!=2 or len(xb)!=2 or max(xa+xb)>=v: continue + # LO consumers: only BH at P (forward); BH must not be read before this merge + lo_src=[kk for kk in adds_src[b] if 0',len(out)) diff --git a/research/w3-restore/supplied/builders/agentA_twin/twinscan.py b/research/w3-restore/supplied/builders/agentA_twin/twinscan.py new file mode 100644 index 0000000000..6b2c74bd3a --- /dev/null +++ b/research/w3-restore/supplied/builders/agentA_twin/twinscan.py @@ -0,0 +1,53 @@ +# Generalized twin scan: sigma0 helper h whose only forward consumer is k (single ADD k+=h), k gives nothing before it. +# Candidate pivot entrance E = f_h ∩ f_k (first frames). Estimate gains. +import sys, json, collections, pickle, math +import numpy as np +from fractions import Fraction +sys.path.insert(0,'/home/claude/work/eval') +from cost import load_snapshot +IN=sys.argv[1] +s,fr,dim,rec=load_snapshot(IN) +v=s['v']; n=s['n']; ZERO=s['ZERO']; FULL=s['FULL']; FR=fr['frames'] +init={r:s['initial'][str(r)] for r in range(n)} +g=lambda r: r*math.log(120/r) if r>0 else 0 +moves=collections.defaultdict(list) +for k in np.nonzero(rec[:,0]==0)[0]: moves[int(rec[k,1])].append(int(k)) +adds_dst=collections.defaultdict(list); adds_src=collections.defaultdict(list) +for k in np.nonzero(rec[:,0]==1)[0]: + f=int(rec[k,4]) + if 0=n or init[c]!=ZERO or not moves[c]: continue + if any(kk=dim[fh]: break # pivot must still move up (or could equal) + gain=(g(dim[fh])-g(dim[fh]-ee))-(g(ee)+g(dim[fc]-ee)-g(dim[fc]) if dim[fc]>ee else g(ee)-g(dim[fc])) + if gain>best: best=gain; be=ee + if best>0: + cands.append((h,c,int(k),fh,fc,be,best)); tot+=best; hist[(dim[fh],dim[fc],be)]+=1 +print('candidates',len(cands),'potential gain %.0f'%tot) +for kk,cnt in hist.most_common(15): print(kk,cnt) +pickle.dump(cands,open('twincands.pkl','wb')) diff --git a/research/w3-restore/supplied/builders/agentB_lp/addcomp.py b/research/w3-restore/supplied/builders/agentB_lp/addcomp.py new file mode 100644 index 0000000000..6d5fea18b0 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/addcomp.py @@ -0,0 +1,12 @@ +import numpy as np, json, sys +d=sys.argv[1] +s=json.load(open(d+'/249-states.json')) +v=s['v']; ZERO=s['ZERO'] +rec=np.fromfile(d+'/249-records.bin',dtype=' [--lift] +import sys, json, pickle, collections, math, os, argparse +import numpy as np +from fractions import Fraction +sys.path.insert(0,'/home/claude/work/agentB/tools'); sys.path.insert(0,'/home/claude/work/agentB/sat') +from base import * +from plan4 import make_plan +ap=argparse.ArgumentParser() +ap.add_argument('inw'); ap.add_argument('linesp'); ap.add_argument('design'); ap.add_argument('outd') +ap.add_argument('--limit',type=int,default=0) +ap.add_argument('--mode',type=str,default='exch') +a=ap.parse_args() +os.makedirs(a.outd,exist_ok=True) +s=json.load(open(a.inw+'/249-states.json')) +fr=json.load(open(a.inw+'/frames.json')); FR=fr['frames'] +rec=np.fromfile(a.inw+'/249-records.bin',dtype='len(sel): sel.append(r) + return sel +def gram_det_nonzero(B): + # exact det of B G B^T, G = I - J/9 + d=len(B) + s_=[sum(r) for r in B] + M=[[Fraction(sum(x*y for x,y in zip(B[i],B[k])))-Fraction(s_[i]*s_[k],9) for k in range(d)] for i in range(d)] + # det via elimination + det=Fraction(1) + for c in range(d): + p=next((i for i in range(c,d) if M[i][c]!=0),None) + if p is None: return False + if p!=c: M[c],M[p]=M[p],M[c]; det=-det + det*=M[c][c] + for i in range(c+1,d): + if M[i][c]!=0: + f_=M[i][c]/M[c][c]; M[i]=[x-f_*y for x,y in zip(M[i],M[c])] + return det!=0 +def chi(i): + w=[0]*24 + for p in lab[i]: w[p]=1 + return w +nextid=max(int(k) for k in FR)+1 +newframes={} +canon_index={} +def frame_id_for_rows(rows,hint_ids=()): + global nextid + B=indep_rows(rows) + key=canon(B) + if key in canon_index: return canon_index[key] + for h in hint_ids: + if h is None: continue + if dim[h]==len(B) and canon(FR[str(h)]['B'])==key: + canon_index[key]=h; return h + assert gram_det_nonzero(B), 'degenerate frame' + fid=nextid; nextid+=1 + newframes[fid]={'B':[list(map(int,r)) for r in B],'A':kernel_int(B),'dim':len(B)} + dim[fid]=len(B); canon_index[key]=fid + return fid +# ---------------- records by register +byreg=collections.defaultdict(list) +for k in range(NR): + o_,a_,b_,c_,f_,z_=rec[k] + byreg[int(a_)].append(k) + if o_==1 and b_!=a_: byreg[int(b_)].append(k) +remove=np.zeros(NR,bool) +modify={} # k -> new record list +insert_fwd=[] # new forward records (inserted at INS_FWD) +insert_inv=[] # new inverse records (inserted at INS_INV) +newinit={} +cat_first41=int(np.nonzero((rec[:,0]==1)&(rec[:,5]==41))[0].min()) +INS_FWD=879000 +print('first cat41 at',cat_first41,flush=True) +keys=sorted(lines) +if a.limit: keys=keys[:a.limit] +stats=collections.Counter() +for key in keys: + L=lines[key]; blocks=L['blocks'] + planes=L['planes']; outs=L['outs'] + planeR={p['r'] for p in planes.values()} + others=L['others'] + copies=set(L['copies']) + modregs=planeR|set(others) + # reusable fresh ids: sigma0 others + fresh_pool=[r for r in others if dim[init[r]]==0] + assert len(fresh_pool)>=10, (key,len(fresh_pool)) + # design register -> actual id + act={} + for i in range(10): act[i]=planes[blocks[i]]['r'] + for j,i in enumerate(range(10,20)): act[i]=fresh_pool[j] + used=set(act.values()) + freed=[r for r in others if r not in used] + # ---- classify old records of module registers + old_out={o['old']:Z for Z,o in outs.items()} + deliv=collections.defaultdict(list) # Z -> list of record indices (to be renamed) + for Z,o in outs.items(): + r=o['old']; kc=o['kcopy'] + ks=sorted(k for k in byreg[r] if k>=kc) + assert ks[0]==kc + deliv[Z].append(kc) + mv=[k for k in ks if rec[k][0]==0 and rec[k][1]==r] + k1=mv[0]; assert dim[int(rec[k1][2])]==21 and dim[int(rec[k1][3])]==22, (key,Z,rec[k1]) + assert int(rec[k1][2])==o['PZ'] + k2=mv[1]; assert dim[int(rec[k1][3])]==22 and int(rec[k2][3])==FULL + deliv[Z]+= [k1,k2] + E1=int(rec[k1][3]) + cons=[k for k in ks if k10: + stats['rm_sigma_comp']+=1 + elif other not in modregs and other not in copies and not (v<=other<2*v and f_==ZERO): + raise Exception(('unexpected partner',key,r,k,rec[k].tolist())) + remove[k]=True + for r in freed: + newinit[r]=FULL + for r in used: + if r not in planeR and r not in newinit: newinit[r]=ZERO + # ---- new forward block + cur={} # actual reg -> current catalog frame + for i in range(10): cur[act[i]]=planes[blocks[i]]['frame'] + def items_of(Kset): + rows=[] + for di in Kset: + X=blocks[di] + rows+=[chi(it) for it in items(DBM[(key,X)])] + return rows + for i in range(10,20): + inf=P['info'][i] + if inf['sig']: + K0=inf['K0'] + fid0=planes[blocks[K0[0]]]['frame'] if len(K0)==1 else frame_id_for_rows(items_of(K0)) + assert dim[fid0]==2*len(K0)+1 + cur[act[i]]=fid0; newinit[act[i]]=fid0; stats['sigF']+=1 + else: + cur[act[i]]=ZERO + curdim=lambda r: dim[cur[r]] + fwd=[] + def MOVE(r,new): + old=cur[r] + if old==new: return + assert dim[new]>dim[old] or (dim[new]==dim[old] and False), (key,r,old,new) + fwd.append([0,r,old,new,dim[new]-dim[old],0]); cur[r]=new + for t,groups in enumerate(P['rounds'],1): + for gr in groups: + Kd=gr['K'] + if len(Kd)==1: + fid=planes[blocks[Kd[0]]]['frame'] + else: + hints=[cur[act[m]] for m in gr['members']] + fid=frame_id_for_rows(items_of(Kd),hints) + assert dim[fid]==2*len(Kd)+1 + for m in gr['members']: MOVE(act[m],fid) + for (dst,src) in gr['adds']: + fwd.append([1,act[dst],act[src],1,fid,60]) + # final merges at P{Z} + for zd in range(10): + Z=blocks[zd]; o=outs[Z]; PZ=o['PZ'] + Od=[r for r in P['regs'] if P['info'][r]['role']=='O' and P['info'][r]['tgt']==zd][0] + Md=[r for r in P['regs'] if P['info'][r]['role']=='M' and P['info'][r]['tgt']==zd][0] + rO,rM=act[Od],act[Md] + MOVE(rO,PZ); MOVE(rM,PZ) + fwd.append([1,rO,rM,1,PZ,61]) + # partner retires + fwd.append([0,rM,PZ,FULL,24-dim[PZ],0]); cur[rM]=FULL + # rename deliveries: old output -> rO + oldr=o['old'] + for k in deliv[Z]: + rr=modify.get(k,rec[k].tolist()) + rr=list(map(int,rr)) + if rr[0]==0: + assert rr[1]==oldr; rr[1]=rO + else: + assert rr[2]==oldr; rr[2]=rO + modify[k]=rr + # sanity: every reg either at PZ (outputs, waiting for delivery) or FULL + insert_fwd.extend(fwd) + # inverses of new forward ADDs (reverse order), at FULL + for rr in reversed([x for x in fwd if x[0]==1]): + insert_inv.append([1,rr[1],rr[2],-1,FULL,62]) + stats['lines']+=1 +print(dict(stats),'new frames',len(newframes),flush=True) +# ---- global: remove all frame-0 cat4 compensation reads from sigma0 helpers (regenerated later) +newinit_full=dict(init); newinit_full.update(newinit) +comp=(rec[:,0]==1)&(rec[:,5]==4)&(rec[:,1]>=v)&(rec[:,1]<2*v) +nrm=0 +for k in np.nonzero(comp)[0]: + if dim[int(rec[k,4])]==0 and dim[init[int(rec[k,2])]]==0: + remove[k]=True; nrm+=1 +print('removed comp reads',nrm,flush=True) +# ---- assemble +out=[] +for k in range(NR): + if k==INS_FWD: out.extend(insert_fwd) + if k==cat_first41: out.extend(insert_inv) + if remove[k] and k not in modify: continue + out.append(modify.get(k,rec[k].tolist())) +out=np.array(out,dtype=np.int32) +print('records',NR,'->',len(out),flush=True) +st=dict(s); ni={str(r):int(newinit_full[r]) for r in range(n)} +st['initial']=ni; st['record_count']=len(out) +json.dump(st,open(a.outd+'/249-states.json','w')) +out.tofile(a.outd+'/249-records.bin') +fr2={'h':fr['h'],'frames':dict(FR)} +for fid,ff in newframes.items(): fr2['frames'][str(fid)]=ff +json.dump(fr2,open(a.outd+'/frames.json','w')) +with open(a.outd+'/frames.txt','w') as fo: + fo.write('%d\n'%len(fr2['frames'])) + for k_,ff in fr2['frames'].items(): + fo.write('%s %d\n'%(k_,len(ff['B']))) + for row in ff['B']: fo.write(' '.join(map(str,row))+'\n') +with open(a.outd+'/states.txt','w') as fo: + fo.write('%d %d %d %d\n'%(n,v,ZERO,FULL)) + for r in range(n): fo.write('%d %d\n'%(int(ni[str(r)]),int(s['final'][str(r)]))) + for t in range(v): fo.write(' '.join(map(str,s['source_covectors'][t]))+'\n') +print('done',flush=True) diff --git a/research/w3-restore/supplied/builders/agentB_lp/rebuild.sh b/research/w3-restore/supplied/builders/agentB_lp/rebuild.sh new file mode 100644 index 0000000000..18a9d577e2 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/rebuild.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# usage: rebuild.sh +set -e +D=$1; O=$2 +python3 /home/claude/work/agentB/build/build_lp.py /home/claude/work/agentA/W/out5b /home/claude/work/agentB/lines_out5b.pkl $D $O --mode ${3:-exch} +/home/claude/work/agentB/build/verify $O $O/resid.txt +python3 /home/claude/work/agentB/build/addcomp.py $O +/home/claude/work/verifyT/checkT $O $O/249-records.bin +python3 /home/claude/work/eval/cost.py $O +python3 /home/claude/work/agentB/tools/localD.py $O diff --git a/research/w3-restore/supplied/builders/agentB_lp/sat/checkdesign.py b/research/w3-restore/supplied/builders/agentB_lp/sat/checkdesign.py new file mode 100644 index 0000000000..b539dd9a57 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/sat/checkdesign.py @@ -0,0 +1,47 @@ +# Independent replay of an abstract design JSON (meet3 format). +import json, sys +D=json.load(open(sys.argv[1])); n=10 +N=len(D); T=max(h[0] for h in D[0]['hist']) +K={d['r']:(set([d['r']]) if d['R'] else set()) for d in D} +C={d['r']:(set([d['r']]) if d['R'] else set()) for d in D} +role={d['r']:d['role'] for d in D}; tgt={d['r']:d['tgt'] for d in D} +ok=True +for t in range(1,T+1): + groups={} + met={d['r']:set(d['hist'][t][3]) for d in D} + recv={d['r']:d['hist'][t][4] for d in D} + # check symmetric meets and transitivity -> groups + for r in met: + for s in met[r]: + if r not in met[s]: print('asym meet',t,r,s); ok=False + seen=set(); grps=[] + for r in met: + if r in seen: continue + g={r}|met[r] + for s in g: + if met[s]|{s}!=g: print('nontransitive',t,r,s); ok=False + seen|=g; grps.append(g) + newK={} + for g in grps: + U=set().union(*[K[r] for r in g]) + for r in g: newK[r]=set(U) if len(g)>1 else set(K[r]) + newC={} + for r in C: + c=set(C[r]) + for s in recv[r]: + if s not in met[r]: print('give without meet',t,r,s); ok=False + if recv[s]: print('giver also receives',t,s); ok=False + c^=C[s] + newC[r]=c + K,C=newK,newC + for r in K: + if role[r] in 'OM' and tgt[r] in K[r]: print('target contaminated',t,r); ok=False + if not C[r]<=K[r]: print('content outside K',t,r); ok=False + hK=''.join('%d'%x for x in sorted(K[r])); hC=''.join('%d'%x for x in sorted(C[r])) + dK=D[[d['r'] for d in D].index(r)]['hist'][t] + if dK[1]!=hK or dK[2]!=hC: print('mismatch with recorded',t,r,dK[1],hK,dK[2],hC); ok=False +for z in range(n): + Os=[r for r in K if role[r]=='O' and tgt[r]==z]; Ms=[r for r in K if role[r]=='M' and tgt[r]==z] + if len(Os)!=1 or len(Ms)!=1: print('bad roles',z); ok=False; continue + if C[Os[0]]^C[Ms[0]]!=set(range(n))-{z}: print('bad final',z); ok=False +print('CHECK','OK' if ok else 'FAIL') diff --git a/research/w3-restore/supplied/builders/agentB_lp/sat/checkdesign4.py b/research/w3-restore/supplied/builders/agentB_lp/sat/checkdesign4.py new file mode 100644 index 0000000000..5e0ab7cf08 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/sat/checkdesign4.py @@ -0,0 +1,45 @@ +# Independent replay of a meet4 design JSON (with sigma>0 fresh registers and dirt symbols). +import json, sys +D=json.load(open(sys.argv[1])); n=10 +T=max(h[0] for h in D[0]['hist']) +regs=[d['r'] for d in D]; byr={d['r']:d for d in D} +K={}; C={} +for d in D: + r=d['r'] + if d['R']: K[r]={r}; C[r]={r} + elif d.get('sig'): K[r]=set(int(c) for c in d['hist'][0][1]); C[r]={'d%d'%r} + else: K[r]=set(); C[r]=set() +ok=True +for r in regs: + if byr[r]['tgt'] in K[r]: print('target in K0',r); ok=False +for t in range(1,T+1): + met={r:set(byr[r]['hist'][t][3]) for r in regs} + recv={r:byr[r]['hist'][t][4] for r in regs} + seen=set(); grps=[] + for r in regs: + if r in seen: continue + g={r}|met[r] + for s in g: + if met[s]|{s}!=g: print('nontransitive',t,r,s); ok=False + seen|=g; grps.append(g) + newK={} + for g in grps: + U=set().union(*[K[r] for r in g]) + for r in g: newK[r]=set(U) if len(g)>1 else set(K[r]) + newC={} + for r in regs: + c=set(C[r]) + for s in recv[r]: + if s not in met[r]: print('give w/o meet',t,r,s); ok=False + if recv[s]: print('giver receives',t,s); ok=False + c^=C[s] + newC[r]=c + K,C=newK,newC + for r in regs: + if byr[r]['tgt'] in K[r]: print('target contaminated',t,r); ok=False + if not set(x for x in C[r] if isinstance(x,int))<=K[r]: print('content outside K',t,r); ok=False +for z in range(n): + O=[r for r in regs if byr[r]['role']=='O' and byr[r]['tgt']==z]; M=[r for r in regs if byr[r]['role']=='M' and byr[r]['tgt']==z] + if len(O)!=1 or len(M)!=1: print('roles',z); ok=False; continue + if C[O[0]]^C[M[0]]!=set(range(n))-{z}: print('bad final',z,C[O[0]]^C[M[0]]); ok=False +print('CHECK','OK' if ok else 'FAIL') diff --git a/research/w3-restore/supplied/builders/agentB_lp/sat/meet3.py b/research/w3-restore/supplied/builders/agentB_lp/sat/meet3.py new file mode 100644 index 0000000000..ae98829805 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/sat/meet3.py @@ -0,0 +1,255 @@ +# SAT search for all-but-one designs (abstract contamination model), with symmetry breaking, +# stop limits (distinct |K| levels per register) and exact cost evaluation of the found design. +import sys, itertools, math, time, argparse, json +from pysat.formula import IDPool, CNF +from pysat.card import CardEnc, EncType, ITotalizer +from pysat.solvers import Solver +g=lambda r: r*math.log(120/r) if r>0 else 0.0 +ap=argparse.ArgumentParser() +ap.add_argument('--n',type=int,default=10) +ap.add_argument('--nf',type=int,default=10) +ap.add_argument('--T',type=int,default=5) +ap.add_argument('--ni',type=int,default=0) +ap.add_argument('--maxlev',type=int,default=9) # max distinct levels (stops) per register (excluding R start level) +ap.add_argument('--forbid',type=str,default='') # comma list of forbidden |K| levels for stops +ap.add_argument('--costcap',type=float,default=0) # if >0: per-register cap on path cost (approx via forbidden level pairs) +ap.add_argument('--solver',type=str,default='cadical195') +ap.add_argument('--out',type=str,default='') +ap.add_argument('--timeout',type=int,default=0) +ap.add_argument('--sym',type=str,default='') +ap.add_argument('--cap',type=float,default=0) +ap.add_argument('--totalcap',type=float,default=0) +ap.add_argument('--reps',type=str,default='0,5,10,15') +ap.add_argument('--capR',type=float,default=0) +ap.add_argument('--capF',type=float,default=0) +ap.add_argument('--copyround',type=int,default=0) +a=ap.parse_args() +n=a.n; NF=a.nf; T=a.T; N=n+NF +pool=IDPool(); H=[] +V=lambda *x: pool.id(x) +regs=list(range(N)); isR=lambda r: r= k (k=1..n) via totalizer +LV={} +TRUE=V('TRUE'); H.append([TRUE]) +for r in regs: + for t in range(1,T+1): + xs=[V('K',r,t,x) for x in range(n)] + prev=[TRUE]+[-TRUE]*n # at least j of first 0 inputs + for i,xi in enumerate(xs,1): + cur=[TRUE] + for j in range(1,n+1): + c=V('cnt',r,t,i,j) + a1=prev[j]; a2=prev[j-1] + # c <-> a1 or (xi and a2) + H.append([-c,a1,xi]); H.append([-c,a1,a2]) + H.append([c,-a1]); H.append([c,-xi,-a2]) + cur.append(c) + prev=cur + LV[(r,t)]=prev[1:] # LV[k-1] <-> sum>=k (exact) +# visited level indicators: vis[r][k] = exists t: |K|==k +forb=set(int(x) for x in a.forbid.split(',') if x) +for r in regs: + vlits=[] + for k in range(1,n+1): + vk=V('vis',r,k); vlits.append(vk) + eqs=[] + for t in range(1,T+1): + rhs=LV[(r,t)] + e=V('eq',r,t,k) + ge=rhs[k-1]; gt=rhs[k] if k0: + levs=list(range(1,n)) + for mask in range(1<>i&1] + if isR(r) and 1 in Vs: continue # level 1 for R is the start; handled as same pattern without it + dims=[3] if isR(r) else [0] + for k in Vs: + d=2*k+1 + if d>dims[-1]: dims.append(d) + for role in ('O','M'): + tail=[21,22,24] if role=='O' else [21,24] + dd=dims+[x for x in tail if x>dims[-1]] + c=sum(g(dd[i]-dd[i-1]) for i in range(1,len(dd))) + if c>capr: + cl=[-V(role,r)] + for k in range(1,n+1): + if isR(r) and k==1: continue + cl.append(-V('vis',r,k) if k in Vs else V('vis',r,k)) + H.append(cl) +if a.sym: + if a.sym=='z5': bp=lambda X: (X%5+1)%5+5*(X//5) + elif a.sym=='z10': bp=lambda X: (X+1)%10 + elif a.sym=='z2': bp=lambda X: (X+5)%10 + rp=lambda r: bp(r) if rr: H.append([-meet(r,s_,1)]) + for x,y in itertools.combinations(range(n),2): H.append([-meet(x,y,1)]) +if a.totalcap>0: + reps=[int(x) for x in a.reps.split(',')] + allu=[] + for r in reps: + U=[V('u',r,j) for j in range(1,121)] + for j in range(1,120): H.append([-U[j],U[j-1]]) + allu+=U + levs=list(range(1,n)) + for mask in range(1<>i&1] + if isR(r) and 1 in Vs: continue + dims=[3] if isR(r) else [0] + for k in Vs: + d=2*k+1 + if d>dims[-1]: dims.append(d) + for role in ('O','M'): + tail=[21,22,24] if role=='O' else [21,24] + dd=dims+[x for x in tail if x>dims[-1]] + c=sum(g(dd[i]-dd[i-1]) for i in range(1,len(dd))) + ci=int(math.ceil(c-1e-9)) + cl=[-V(role,r)] + for k in range(1,n+1): + if isR(r) and k==1: continue + cl.append(-V('vis',r,k) if k in Vs else V('vis',r,k)) + H.append(cl+[V('u',r,min(ci,120))]) + B=int(math.floor(a.totalcap)) + H.extend(CardEnc.atmost(lits=allu,bound=B,vpool=pool,encoding=EncType.totalizer).clauses) +print('vars',pool.top,'clauses',len(H),file=sys.stderr,flush=True) +t0=time.time() +S=Solver(name=a.solver,bootstrap_with=H) +ok=S.solve() +print('SAT' if ok else 'UNSAT','time %.1f'%(time.time()-t0),flush=True) +if ok: + Mset=set(l for l in S.get_model() if l>0) + val=lambda *x: pool.id(x) in Mset + total=0; design=[] + for r in regs: + role=[x for x in 'OMI' if val(x,r)][0] + z=[z for z in range(n) if val('tgt',r,z)][0] + levels=sorted(set(k for k in (sum(1 for x in range(n) if val('K',r,t,x)) for t in range(1,T+1)) if k>0)) + dims=[0] if not isR(r) else [3] + for k in levels: + d=2*k+1 + if d>dims[-1]: dims.append(d) + tail=[21,22,24] if role=='O' else ([21,24] if role=='M' else [24]) + for d in tail: + if d>dims[-1]: dims.append(d) + cost=sum(g(dims[i]-dims[i-1]) for i in range(1,len(dims))) + cost_post = cost + total+=cost + hist=[] + for t in range(0,T+1): + K=''.join('%d'%x for x in range(n) if val('K',r,t,x)) + C=''.join('%d'%x for x in range(n) if val('C',r,t,x)) + met=[s for s in regs if s!=r and t>0 and val('meet',min(r,s),max(r,s),t)] + gv=[s for s in regs if s!=r and t>0 and val('give',r,s,t)] + hist.append((t,K,C,met,gv)) + design.append(dict(r=r,R=isR(r),role=role,tgt=z,dims=dims,cost=cost,hist=hist)) + print('reg %2d %s %s tgt %d dims %s cost %.1f'%(r,'R' if isR(r) else 'F',role,z,dims,cost)) + for h in hist[1:]: print(' t%d K=%s C=%s meet=%s recv_from=%s'%h) + print('TOTAL COST %.1f'%total) + if a.out: json.dump(design,open(a.out,'w')) diff --git a/research/w3-restore/supplied/builders/agentB_lp/sat/meet4.py b/research/w3-restore/supplied/builders/agentB_lp/sat/meet4.py new file mode 100644 index 0000000000..bcd2d5d57b --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/sat/meet4.py @@ -0,0 +1,233 @@ +# SAT search for all-but-one designs in the abstract contamination model, with optional +# sigma>0 fresh registers (dirty start at a nonzero frame; dirt must cancel in outputs). +import sys, itertools, math, time, argparse, json +from pysat.formula import IDPool +from pysat.card import CardEnc, EncType +from pysat.solvers import Solver +g=lambda r: r*math.log(120/r) if r>0 else 0.0 +ap=argparse.ArgumentParser() +ap.add_argument('--n',type=int,default=10) +ap.add_argument('--nf',type=int,default=10) +ap.add_argument('--T',type=int,default=5) +ap.add_argument('--maxlev',type=int,default=9) +ap.add_argument('--sym',type=str,default='') +ap.add_argument('--sigF',type=int,default=1) # allow sigma>0 fresh registers +ap.add_argument('--totalcap',type=float,default=0) +ap.add_argument('--forcesig',type=str,default='') +ap.add_argument('--forcerole',type=str,default='') # e.g. RO: all R are outputs (F partners) +ap.add_argument('--reps',type=str,default='0,5,10,15') +ap.add_argument('--solver',type=str,default='cadical195') +ap.add_argument('--out',type=str,default='') +a=ap.parse_args() +n=a.n; NF=a.nf; T=a.T; N=n+NF; NB=n+NF # content bits: blocks + dirt of each fresh reg +pool=IDPool(); H=[] +V=lambda *x: pool.id(x) +regs=list(range(N)); isR=lambda r: r K0 empty + if not isR(r): + H.append([-V('sig',r)]+[V('K',r,0,x) for x in range(n)]) # sig -> K0 nonempty + for x in range(NB): + if isR(r): H.append([V('C',r,0,x)] if x==r else [-V('C',r,0,x)]) + else: + if x==n+(r-n): H.extend([[-V('C',r,0,x),V('sig',r)],[V('C',r,0,x),-V('sig',r)]]) + else: H.append([-V('C',r,0,x)]) +for t in range(1,T+1): + for a_,b_,c_ in itertools.combinations(regs,3): + ab,ac,bc=meet(a_,b_,t),meet(a_,c_,t),meet(b_,c_,t) + H.extend([[-ab,-bc,ac],[-ab,-ac,bc],[-ac,-bc,ab]]) + for r in regs: + for x in range(n): + k_new=V('K',r,t,x); k_old=V('K',r,t-1,x); terms=[k_old] + for s in regs: + if s==r: continue + q=V('Ka',r,s,t,x) + H.extend([[-q,meet(r,s,t)],[-q,V('K',s,t-1,x)],[q,-meet(r,s,t),-V('K',s,t-1,x)]]) + terms.append(q) + H.append([-k_new]+terms) + for tm in terms: H.append([k_new,-tm]) + for s in regs: + if s==r: continue + H.append([-V('give',r,s,t),meet(r,s,t)]) + gl=[V('give',r,s,t) for s in regs if s!=r] + rc=V('recv',r,t); H.append([-rc]+gl) + for l in gl: H.append([rc,-l]) + for r in regs: + for s in regs: + if s!=r: H.append([-V('give',r,s,t),-V('recv',s,t)]) + for r in regs: + for x in range(NB): + prev=V('C',r,t-1,x) + for s in regs: + if s==r: continue + q=V('Ca',r,s,t,x) + H.extend([[-q,V('give',r,s,t)],[-q,V('C',s,t-1,x)],[q,-V('give',r,s,t),-V('C',s,t-1,x)]]) + nx=V('Cx',r,s,t,x) + H.extend([[-nx,prev,q],[-nx,-prev,-q],[nx,-prev,q],[nx,prev,-q]]); prev=nx + cur=V('C',r,t,x); H.extend([[-cur,prev],[cur,-prev]]) + if x=1). start level for R is 1; for sig F it's |K0|. +for r in regs: + for k in range(1,n+1): + vk=V('vis',r,k); eqs=[] + for t in range(0,T+1): + rhs=LV[(r,t)]; e=V('eq',r,t,k) + ge=rhs[k-1]; gt=rhs[k] if k1] + elif sigf: dims=[2*min(Vs)+1]; levs=[k for k in Vs if k>min(Vs)] + else: dims=[0]; levs=list(Vs) + for k in sorted(levs): + d=2*k+1 + if d>dims[-1]: dims.append(d) + tail=[21,22,24] if role=='O' else [21,24] + dd=dims+[x for x in tail if x>dims[-1]] + return sum(g(dd[i]-dd[i-1]) for i in range(1,len(dd))) +if a.maxlev<9: + for r in regs: + # number of stops beyond the start + cnt=[V('vis',r,k) for k in range(1,n+1)] + if isR(r): card_le([V('vis',r,k) for k in range(2,n+1)],a.maxlev) + else: + # stops = vis count (non-sig) or vis count - 1 (sig): enforce vis count <= maxlev + sig + ex=V('extra',r); H.extend([[-ex,V('sig',r)],[ex,-V('sig',r)]]) + card_le(cnt+[-ex],a.maxlev+1) +if a.totalcap>0: + reps=[int(x) for x in a.reps.split(',')] + allu=[] + for r in reps: + U=[V('u',r,j) for j in range(1,121)] + for j in range(1,120): H.append([-U[j],U[j-1]]) + allu+=U + for mask in range(1,1<<9): + Vs=[k+1 for k in range(9) if mask>>k&1] + if isR(r) and 1 not in Vs: continue + for sigf in ([False] if isR(r) else [False,True]): + for role in ('O','M'): + c=pattern_cost(isR(r),sigf,Vs,role) + ci=min(120,int(math.ceil(c-1e-9))) + cl=[-V(role,r)] + for k in range(1,10): cl.append(-V('vis',r,k) if k in Vs else V('vis',r,k)) + if not isR(r): cl.append(-V('sig',r) if sigf else V('sig',r)) + if sigf: + # start level must be min(Vs) + cl.append(-V('st',r,min(Vs))) + H.append(cl+[V('u',r,ci)]) + B=int(math.floor(a.totalcap)) + H.extend(CardEnc.atmost(lits=allu,bound=B,vpool=pool,encoding=EncType.totalizer).clauses) +if a.sym: + if a.sym=='z5': bp=lambda X: (X%5+1)%5+5*(X//5) + elif a.sym=='z10': bp=lambda X: (X+1)%10 + rp=lambda r: bp(r) if r0) + val=lambda *x: pool.id(x) in Mset + total=0; design=[] + for r in regs: + role='O' if val('O',r) else 'M' + z=[z for z in range(n) if val('tgt',r,z)][0] + sig=val('sig',r) + Ks=[frozenset(x for x in range(n) if val('K',r,t,x)) for t in range(T+1)] + Vs=sorted(set(len(K) for K in (Ks if (sig or isR(r)) else Ks[1:]) if len(K)>0)) + c=pattern_cost(isR(r),sig,Vs,role); total+=c + hist=[] + for t in range(0,T+1): + K=''.join('%d'%x for x in range(n) if val('K',r,t,x)) + C=''.join(('%d'%x if x0 and val('meet',min(r,s),max(r,s),t)] + gv=[s for s in regs if s!=r and t>0 and val('give',r,s,t)] + hist.append((t,K,C,met,gv)) + design.append(dict(r=r,R=isR(r),role=role,tgt=z,sig=sig,cost=c,hist=hist)) + print('reg %2d %s%s %s tgt %d levels %s cost %.1f'%(r,'R' if isR(r) else 'F','(sig)' if sig else '',role,z,Vs,c)) + for h in hist: print(' t%d K=%s C=%s meet=%s recv_from=%s'%h) + print('TOTAL COST %.1f'%total) + if a.out: json.dump(design,open(a.out,'w')) diff --git a/research/w3-restore/supplied/builders/agentB_lp/sat/plan4.py b/research/w3-restore/supplied/builders/agentB_lp/sat/plan4.py new file mode 100644 index 0000000000..21bbc19c27 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/sat/plan4.py @@ -0,0 +1,76 @@ +# Plan for designs with optional sigma>0 fresh registers (meet4 JSON). Exchange-based groups; dirt tracked. +import json, sys, math +g=lambda r: r*math.log(120/r) if r>0 else 0.0 +def make_plan(path,mode='exch'): + D=json.load(open(path)); n=10 + regs=[d['r'] for d in D]; byr={d['r']:d for d in D} + T=max(h[0] for h in D[0]['hist']) + sig={r:bool(byr[r].get('sig',False)) for r in regs} + K0={} + for r in regs: + if byr[r]['R']: K0[r]=frozenset([r]) + elif sig[r]: K0[r]=frozenset(int(c) for c in byr[r]['hist'][0][1]) + else: K0[r]=frozenset() + K=dict(K0) + C={r:(frozenset([r]) if byr[r]['R'] else (frozenset(['d%d'%r]) if sig[r] else frozenset())) for r in regs} + rounds=[] + for t in range(1,T+1): + edges=[(r,s) for r in regs for s in byr[r]['hist'][t][4]] + par={r:r for r in regs} + def f(x): + while par[x]!=x: par[x]=par[par[x]]; x=par[x] + return x + if mode=='sat': + for r in regs: + for s in byr[r]['hist'][t][3]: par[f(r)]=f(s) + else: + for r,s in edges: par[f(r)]=f(s) + comps={} + for r in regs: + if mode=='sat': + if byr[r]['hist'][t][3]: comps.setdefault(f(r),[]).append(r) + elif any(r in e for e in edges): comps.setdefault(f(r),[]).append(r) + groups=[]; newC=dict(C) + for root,mem in comps.items(): + KU=frozenset().union(*[K[r] for r in mem]) + adds=[(r,s) for (r,s) in edges if r in mem] + for r in mem: K[r]=KU + for r,s in adds: newC[r]=newC[r]^C[s] + groups.append(dict(K=sorted(KU),members=sorted(mem),adds=adds)) + C=newC; rounds.append(groups) + ok=True + for r in regs: + d=byr[r] + if d['tgt'] in K[r] or d['tgt'] in K0[r]: ok=False; print('target contaminated',r) + if not frozenset(x for x in C[r] if isinstance(x,int))<=K[r]: ok=False; print('content outside',r) + for z in range(n): + O=[r for r in regs if byr[r]['role']=='O' and byr[r]['tgt']==z][0] + M=[r for r in regs if byr[r]['role']=='M' and byr[r]['tgt']==z][0] + if C[O]^C[M]!=frozenset(range(n))-{z}: ok=False; print('bad final',z,sorted(map(str,C[O]^C[M]))) + total=0; per={} + for r in regs: + d=byr[r]; seq=[] + for t,groups in enumerate(rounds,1): + for gr in groups: + if r in gr['members']: + if not seq or seq[-1]!=tuple(gr['K']): seq.append(tuple(gr['K'])) + if d['R']: dims=[3] + elif sig[r]: dims=[2*len(K0[r])+1] + else: dims=[0] + for Kk in seq: + dm=2*len(Kk)+1 + if dm>dims[-1]: dims.append(dm) + tail=[21,22,24] if d['role']=='O' else [21,24] + for dm in tail: + if dm>dims[-1]: dims.append(dm) + c=sum(g(dims[i]-dims[i-1]) for i in range(1,len(dims))) + per[r]=(c,dims,seq); total+=c + info={r:dict(R=byr[r]['R'],role=byr[r]['role'],tgt=byr[r]['tgt'],sig=sig[r],K0=sorted(K0[r])) for r in regs} + return dict(n=n,regs=regs,info=info,rounds=rounds,per=per,total=total,ok=ok) +if __name__=='__main__': + P=make_plan(sys.argv[1],sys.argv[2] if len(sys.argv)>2 else 'exch') + print('ok',P['ok'],'total %.1f'%P['total']) + for r in P['regs']: print(r,P['info'][r],'%.1f'%P['per'][r][0],P['per'][r][1]) + for t,gr in enumerate(P['rounds'],1): + print('round',t) + for x in gr: print(' K=%s members=%s adds=%s'%(''.join(map(str,x['K'])),x['members'],x['adds'])) diff --git a/research/w3-restore/supplied/builders/agentB_lp/sat/sol_z5_m3t6.json b/research/w3-restore/supplied/builders/agentB_lp/sat/sol_z5_m3t6.json new file mode 100644 index 0000000000..8dea094e6c --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/sat/sol_z5_m3t6.json @@ -0,0 +1 @@ +[{"r": 0, "R": true, "role": "O", "tgt": 9, "dims": [3, 7, 13, 21, 22, 24], "cost": 66.21976564401649, "hist": [[0, "0", "0", [], []], [1, "0", "0", [12], []], [2, "067", "07", [6, 15], [15]], [3, "067", "07", [6], []], [4, "067", "07", [6, 15], []], [5, "024567", "07", [5, 14], []], [6, "024567", "024567", [5, 14, 15], [5, 14]]]}, {"r": 1, "R": true, "role": "O", "tgt": 5, "dims": [3, 7, 13, 21, 22, 24], "cost": 66.21976564401649, "hist": [[0, "1", "1", [], []], [1, "1", "1", [13], []], [2, "178", "18", [7, 16], [16]], [3, "178", "18", [7], []], [4, "178", "18", [7, 16], []], [5, "013678", "18", [6, 10], []], [6, "013678", "013678", [6, 10, 16], [6, 10]]]}, {"r": 2, "R": true, "role": "O", "tgt": 6, "dims": [3, 7, 13, 21, 22, 24], "cost": 66.21976564401649, "hist": [[0, "2", "2", [], []], [1, "2", "2", [14], []], [2, "289", "29", [8, 17], [17]], [3, "289", "29", [8], []], [4, "289", "29", [8, 17], []], [5, "124789", "29", [7, 11], []], [6, "124789", "124789", [7, 11, 17], [7, 11]]]}, {"r": 3, "R": true, "role": "O", "tgt": 7, "dims": [3, 7, 13, 21, 22, 24], "cost": 66.21976564401649, "hist": [[0, "3", "3", [], []], [1, "3", "3", [10], []], [2, "359", "35", [9, 18], [18]], [3, "359", "35", [9], []], [4, "359", "35", [9, 18], []], [5, "023589", "35", [8, 12], []], [6, "023589", "023589", [8, 12, 18], [8, 12]]]}, {"r": 4, "R": true, "role": "O", "tgt": 8, "dims": [3, 7, 13, 21, 22, 24], "cost": 66.21976564401649, "hist": [[0, "4", "4", [], []], [1, "4", "4", [11], []], [2, "456", "46", [5, 19], [19]], [3, "456", "46", [5], []], [4, "456", "46", [5, 19], []], [5, "134569", "46", [9, 13], []], [6, "134569", "134569", [9, 13, 19], [9, 13]]]}, {"r": 5, "R": true, "role": "M", "tgt": 1, "dims": [3, 7, 13, 21, 24], "cost": 64.31022313913206, "hist": [[0, "5", "5", [], []], [1, "5", "5", [18], []], [2, "456", "5", [4, 19], []], [3, "456", "456", [4], [4]], [4, "456", "456", [4, 19], []], [5, "024567", "04567", [0, 14], [0]], [6, "024567", "04567", [0, 14, 15], []]]}, {"r": 6, "R": true, "role": "M", "tgt": 2, "dims": [3, 7, 13, 21, 24], "cost": 64.31022313913206, "hist": [[0, "6", "6", [], []], [1, "6", "6", [19], []], [2, "067", "6", [0, 15], []], [3, "067", "067", [0], [0]], [4, "067", "067", [0, 15], []], [5, "013678", "01678", [1, 10], [1]], [6, "013678", "01678", [1, 10, 16], []]]}, {"r": 7, "R": true, "role": "M", "tgt": 3, "dims": [3, 7, 13, 21, 24], "cost": 64.31022313913206, "hist": [[0, "7", "7", [], []], [1, "7", "7", [15], []], [2, "178", "7", [1, 16], []], [3, "178", "178", [1], [1]], [4, "178", "178", [1, 16], []], [5, "124789", "12789", [2, 11], [2]], [6, "124789", "12789", [2, 11, 17], []]]}, {"r": 8, "R": true, "role": "M", "tgt": 4, "dims": [3, 7, 13, 21, 24], "cost": 64.31022313913206, "hist": [[0, "8", "8", [], []], [1, "8", "8", [16], []], [2, "289", "8", [2, 17], []], [3, "289", "289", [2], [2]], [4, "289", "289", [2, 17], []], [5, "023589", "23589", [3, 12], [3]], [6, "023589", "23589", [3, 12, 18], []]]}, {"r": 9, "R": true, "role": "M", "tgt": 0, "dims": [3, 7, 13, 21, 24], "cost": 64.31022313913206, "hist": [[0, "9", "9", [], []], [1, "9", "9", [17], []], [2, "359", "9", [3, 18], []], [3, "359", "359", [3], [3]], [4, "359", "359", [3, 18], []], [5, "134569", "34569", [4, 13], [4]], [6, "134569", "34569", [4, 13, 19], []]]}, {"r": 10, "R": false, "role": "M", "tgt": 9, "dims": [0, 3, 13, 21, 24], "cost": 68.6467448313813, "hist": [[0, "", "", [], []], [1, "3", "3", [3], [3]], [2, "3", "3", [], []], [3, "3", "3", [], []], [4, "3", "3", [], []], [5, "013678", "138", [1, 6], [1]], [6, "013678", "138", [1, 6, 16], []]]}, {"r": 11, "R": false, "role": "M", "tgt": 5, "dims": [0, 3, 13, 21, 24], "cost": 68.6467448313813, "hist": [[0, "", "", [], []], [1, "4", "4", [4], [4]], [2, "4", "4", [], []], [3, "4", "4", [], []], [4, "4", "4", [], []], [5, "124789", "249", [2, 7], [2]], [6, "124789", "249", [2, 7, 17], []]]}, {"r": 12, "R": false, "role": "M", "tgt": 6, "dims": [0, 3, 13, 21, 24], "cost": 68.6467448313813, "hist": [[0, "", "", [], []], [1, "0", "0", [0], [0]], [2, "0", "0", [], []], [3, "0", "0", [], []], [4, "0", "0", [], []], [5, "023589", "035", [3, 8], [3]], [6, "023589", "035", [3, 8, 18], []]]}, {"r": 13, "R": false, "role": "M", "tgt": 7, "dims": [0, 3, 13, 21, 24], "cost": 68.6467448313813, "hist": [[0, "", "", [], []], [1, "1", "1", [1], [1]], [2, "1", "1", [], []], [3, "1", "1", [], []], [4, "1", "1", [], []], [5, "134569", "146", [4, 9], [4]], [6, "134569", "146", [4, 9, 19], []]]}, {"r": 14, "R": false, "role": "M", "tgt": 8, "dims": [0, 3, 13, 21, 24], "cost": 68.6467448313813, "hist": [[0, "", "", [], []], [1, "2", "2", [2], [2]], [2, "2", "2", [], []], [3, "2", "2", [], []], [4, "2", "2", [], []], [5, "024567", "027", [0, 5], [0]], [6, "024567", "027", [0, 5, 15], []]]}, {"r": 15, "R": false, "role": "O", "tgt": 3, "dims": [0, 3, 7, 13, 21, 22, 24], "cost": 77.28640400635831, "hist": [[0, "", "", [], []], [1, "7", "7", [7], [7]], [2, "067", "7", [0, 6], []], [3, "067", "7", [], []], [4, "067", "7", [0, 6], []], [5, "067", "7", [], []], [6, "024567", "0456", [0, 5, 14], [5]]]}, {"r": 16, "R": false, "role": "O", "tgt": 4, "dims": [0, 3, 7, 13, 21, 22, 24], "cost": 77.28640400635831, "hist": [[0, "", "", [], []], [1, "8", "8", [8], [8]], [2, "178", "8", [1, 7], []], [3, "178", "8", [], []], [4, "178", "8", [1, 7], []], [5, "178", "8", [], []], [6, "013678", "0167", [1, 6, 10], [6]]]}, {"r": 17, "R": false, "role": "O", "tgt": 0, "dims": [0, 3, 7, 13, 21, 22, 24], "cost": 77.28640400635831, "hist": [[0, "", "", [], []], [1, "9", "9", [9], [9]], [2, "289", "9", [2, 8], []], [3, "289", "9", [], []], [4, "289", "9", [2, 8], []], [5, "289", "9", [], []], [6, "124789", "1278", [2, 7, 11], [7]]]}, {"r": 18, "R": false, "role": "O", "tgt": 1, "dims": [0, 3, 7, 13, 21, 22, 24], "cost": 77.28640400635831, "hist": [[0, "", "", [], []], [1, "5", "5", [5], [5]], [2, "359", "5", [3, 9], []], [3, "359", "5", [], []], [4, "359", "5", [3, 9], []], [5, "359", "5", [], []], [6, "023589", "2389", [3, 8, 12], [8]]]}, {"r": 19, "R": false, "role": "O", "tgt": 2, "dims": [0, 3, 7, 13, 21, 22, 24], "cost": 77.28640400635831, "hist": [[0, "", "", [], []], [1, "6", "6", [6], [6]], [2, "456", "6", [4, 5], []], [3, "456", "6", [], []], [4, "456", "6", [4, 5], []], [5, "456", "6", [], []], [6, "134569", "3459", [4, 9, 13], [9]]]}] \ No newline at end of file diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/base.py b/research/w3-restore/supplied/builders/agentB_lp/tools/base.py new file mode 100644 index 0000000000..0af77e3d32 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/base.py @@ -0,0 +1,84 @@ +# Common loader + combinatorics for agent B analyses (read-only on inputs). +import json, collections, math, itertools, sys +import numpy as np +G='/home/claude/scratch_rar/source_inputs/base_bit/research/paired-cube-diagonal-bit-168/selected/bit/graph_p12.json' +lab=[tuple(sorted(l)) for l in json.load(open(G))['labels']] +v=1760 +idx={l:i for i,l in enumerate(lab)} +P=lambda p:p//2 +cube_of=[tuple(sorted(P(p) for p in lab[i])) for i in range(v)] +g=lambda r: r*math.log(120/r) if r>0 else 0.0 +def mask(its): + m=0 + for i in its: m|=1<P(y): x,y=y,x + if x%2==1: x,y=x^1,y^1 + return (x,y) +LINEMASK={} +for i in range(v): + a,b,c=lab[i] + for (x,y) in ((a,b),(a,c),(b,c)): + LINEMASK.setdefault(linekey(x,y),0) +for key in list(LINEMASK): + x,y=key + LINEMASK[key]=mask(i for i in range(v) if (x in lab[i] and y in lab[i]) or ((x^1) in lab[i] and (y^1) in lab[i])) +LINEKEYS=sorted(LINEMASK) +def third(i,key): + x,y=key + return [P(q) for q in lab[i] if P(q) not in (P(x),P(y))][0] +DBM={} +for key,m in LINEMASK.items(): + for X in range(12): + if X in (P(key[0]),P(key[1])): continue + DBM[(key,X)]=mask(i for i in items(m) if third(i,key)==X) +def lp_mask(key,Z): + return LINEMASK[key]&~DBM[(key,Z)] +def target_parts(t): + c,d,e=lab[t] + F={p:face_mask(p,*[P(q) for q in lab[t] if q!=p]) for p in (c,d,e)} + L={} + for (a,b) in ((c,d),(c,e),(d,e)): + z=[P(q) for q in lab[t] if q not in (a,b)][0] + key=linekey(a,b^1) + L[(a,b)]=(key,z,lp_mask(key,z)) + K=[idx[tuple(sorted(s))] for s in ((c,d^1,e^1),(c^1,d,e^1),(c^1,d^1,e))] + return F,L,K +def N_of(t): + F,L,K=target_parts(t) + m=0 + for x in F.values(): m^=x + for x in L.values(): m^=x[2] + for k in K: m^=1<%d'%(dim[b],dim[c])) + elif op==1: + other=b if a==r else a + role='src' if b==r else 'dst' + kind='copy' if other in copies else ('mod' if other in modset else ('Y' if W.s['v']<=other<2*W.s['v'] else ('X' if other (dst,src,frame,dim,cat,src_content,dst_after) +evk={e[0]:e for e in ev} +lines={} +bad=0 +for key in LINEKEYS: + regs=mods[key] + blocks=sorted(X for (k2,X) in DBM if k2==key) + LM=LINEMASK[key] + planes={}; copies={}; others=[] + for r in regs: + c=chain[r] + if dim[init[r]]==20: copies[r]=None; continue + if len(c)>1 and c[1][2]==1 and dim[init[r]]==0: + # plane register: find dim-3 frame and block + pf=[x for x in c if x[2]==3][0][1] + # content at plane: events into r at dim<=3 + cont=0 + for k in byreg[r]: + if k in evk: + e=evk[k] + if e[1]==r and e[4]<=3: cont=e[7] + X=[X for X in blocks if DBM[(key,X)]==cont] + if len(X)!=1: print('plane content mismatch',key,r); bad+=1; continue + # last record index of cube phase: last ADD into r at dim<=3 + lastcube=max(k for k in byreg[r] if rec[k][0]==1 and rec[k][1]==r and 00 else 0.0 +d=sys.argv[1] +rec=np.fromfile(d+'/249-records.bin',dtype='0) + cp=rec[rec[:,0]==2]; Dc=sum(g(int(r[5])) for r in cp) + print(d,'local D per stage %.1f'%(D+Dc),'moves',len(mv),'records',len(rec)) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/lpcensus.py b/research/w3-restore/supplied/builders/agentB_lp/tools/lpcensus.py new file mode 100644 index 0000000000..bd38ac078d --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/lpcensus.py @@ -0,0 +1,46 @@ +import sys, pickle, collections +sys.path.insert(0,'/home/claude/work/agentB/tools') +from base import * +L=pickle.load(open(sys.argv[1],'rb')) +ev=L['ev']; n=L['n']; dim=L['dim']; init=L['init']; chain=L['chain'] +blockof={} +for (key,X),bm in DBM.items(): blockof[bm]=(key,X) +def pureline(m): + # returns key if m is nonempty union of full blocks of a single line + if m==0: return None + for key,lm in LINEMASK.items(): + if m&~lm==0: + for (k2,X),bm in DBM.items(): + if k2==key and (bm&m) and (bm&m)!=bm: return None + return key + return None +# find module registers per line: registers (helpers) that at some time hold pure-line content +memo={} +def pl(m): + if m in memo: return memo[m] + r=pureline(m); memo[m]=r; return r +modregs=collections.defaultdict(set); regline={} +for e in ev: + if e[1]>=2*v: + k=pl(e[7]) + if k is not None: + modregs[k].add(e[1]); regline.setdefault(e[1],set()).add(k) +multi=[r for r,s in regline.items() if len(s)>1] +print('module regs',len(regline),'multi-line regs',len(multi)) +def pathD(r): + c=chain[r]; return sum(g(c[i][2]-c[i-1][2]) for i in range(1,len(c)) if c[i][2]>c[i-1][2]) +# classify +cat=collections.Counter(); catD=collections.Counter(); chains=collections.Counter() +for r in regline: + c=[x[2] for x in chain[r]] + s=dim[init[r]] + if s>0: t='sig%d'%s + elif len(c)>1 and c[1]==1: t='plane(start1)' + elif len(c)>1 and c[1]==3: t='blockcopy(start3)' + else: t='other(start%d)'%(c[1] if len(c)>1 else -1) + cat[t]+=1; catD[t]+=pathD(r) + chains[(t,tuple(c))]+=1 +for t in cat: print(t,cat[t],'D %.0f'%catD[t],'avg %.1f'%(catD[t]/cat[t])) +print('total D %.0f'%sum(catD.values())) +for (t,c),k in chains.most_common(40): print(k,t,c,'%.1f'%sum(g(c[i]-c[i-1]) for i in range(1,len(c)) if c[i]>c[i-1])) +pickle.dump(dict(modregs=dict(modregs),regline=regline),open('lpmods.pkl','wb')) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/lpframes.py b/research/w3-restore/supplied/builders/agentB_lp/tools/lpframes.py new file mode 100644 index 0000000000..6f61afa647 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/lpframes.py @@ -0,0 +1,29 @@ +import sys, pickle, collections +sys.path.insert(0,'/home/claude/work/agentB/tools') +from frames import * +L=pickle.load(open(sys.argv[1],'rb')) +ev=L['ev']; n=L['n']; dim=L['dim']; init=L['init']; chain=L['chain'] +key=(int(sys.argv[2]),int(sys.argv[3])) +x,y=key +Zs=[X for (k2,X) in DBM if k2==key] +def targets_of(key,Z): + x,y=key + out=[] + for z in (2*Z,2*Z+1): + for (a,b) in ((x,y^1),(x^1,y)): + out.append(idx[tuple(sorted((a,b,z)))]) + return out +FZ={Z:kernel_rows([ann_vec_of_target(t) for t in targets_of(key,Z)]) for Z in Zs} +mods=pickle.load(open('lpmods.pkl','rb'))['modregs'][key] +fr_seen=set() +for r in mods: + for (k,f,d) in chain[r]: + if 0=2*v: regs.add(e[1]) +def nm(r): return 'X%d'%r if rc[i-1][2]) +evr=collections.defaultdict(list) +for e in ev: + if e[6]&LM or e[7]&LM: + evr[e[1]].append(e) + if e[2]!=e[1]: evr[e[2]].append(e) +tot=0 +for r in sorted(regs,key=lambda r:min(e[0] for e in evr[r])): + D=pathD(r); tot+=D + print('%s sig%d chain %s D=%.1f'%(nm(r),dim[init[r]],[(c[2]) for c in chain[r]],D)) + for e in evr[r]: + if e[1]==r: print(' k=%d @d%-2d f%d += %-7s %s -> %s'%(e[0],e[4],e[3],nm(e[2]),bl(e[6]),bl(e[7]))) + else: print(' k=%d @d%-2d f%d -> %-7s gives %s'%(e[0],e[4],e[3],nm(e[1]),bl(e[6]))) +print('regs',len(regs),'total D %.1f'%tot) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/lpout.py b/research/w3-restore/supplied/builders/agentB_lp/tools/lpout.py new file mode 100644 index 0000000000..55fd1e5650 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/lpout.py @@ -0,0 +1,22 @@ +import sys, pickle, collections +sys.path.insert(0,'/home/claude/work/agentB/tools') +from base import * +L=pickle.load(open(sys.argv[1],'rb')) +ev=L['ev']; n=L['n']; dim=L['dim']; init=L['init']; chain=L['chain'] +LPS={} +for key in LINEKEYS: + for X in range(12): + if (key,X) in DBM: LPS[lp_mask(key,X)]=(key,X) +def nm(r): return 'X' if r set of regs that hold exactly it at some time +gives=collections.defaultdict(list) +for e in ev: + if e[7] in LPS: holders[LPS[e[7]]].add(e[1]) + if e[6] in LPS: gives[LPS[e[6]]].append(e) +print('outputs held',len(holders),'given',len(gives)) +cnt=collections.Counter(len(x) for x in holders.values()); print('holders per output',sorted(cnt.items())) +pat=collections.Counter() +for o,es in gives.items(): + s=tuple(sorted('%s@%d'%(nm(e[1]),e[4]) for e in es)) + pat[s]+=1 +for s,c in pat.most_common(30): print(c,s) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/lptemplate.py b/research/w3-restore/supplied/builders/agentB_lp/tools/lptemplate.py new file mode 100644 index 0000000000..ab00cde94d --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/lptemplate.py @@ -0,0 +1,50 @@ +# Print LP module of a line in lattice terms: frames as s{S} (span) or P{A} (Phi), events. +import sys, pickle, collections +sys.path.insert(0,'/home/claude/work/agentB/tools') +from lattice import * +L=pickle.load(open(sys.argv[1],'rb')) +ev=L['ev']; n=L['n']; dim=L['dim']; init=L['init']; chain=L['chain'] +key=(int(sys.argv[2]),int(sys.argv[3])) +Xs=line_blocks(key) +FZ={Z:kernel_rows(phi_ann(key,[Z])) for Z in Xs} +blockrows={X:[chi(i) for i in items(DBM[(key,X)])] for X in Xs} +mods=pickle.load(open('lpmods.pkl','rb'))['modregs'][key] +lab_of={} +def flabel(f): + if f in lab_of: return lab_of[f] + d=dim[f] + if d==0: s='0' + elif d==24: s='FULL' + else: + B=FR()[str(f)]['B'] + A=[Z for Z in Xs if contains(FZ[Z],B)] + inb=[X for X in Xs if contains(B,blockrows[X])] + hx=lambda Ss: ''.join('%x'%x for x in Ss) + if d==2*len(inb)+1 and inb: s='s{%s}'%hx(inb) + elif d==23-2*len(A) and A: s='P{%s}'%hx(A) + else: s='d%d[A=%s,S=%s]'%(d,hx(A),hx(inb)) + lab_of[f]=s; return s +LM=LINEMASK[key] +blocks={X:DBM[(key,X)] for X in Xs} +def bl(m): + m2=m&LM + full=sorted(X for X,bm in blocks.items() if bm&m2==bm) + part=[X for X,bm in blocks.items() if bm&m2 and bm&m2!=bm] + s='{%s}'%''.join('%x'%X for X in full) + if part: s+='+p%d'%len(part) + ext=popc(m&~LM) + if ext: s+='+ext%d'%ext + return s +def nm(r): return 'X%d'%r if rc[i-1][2]) + print('%s sig%d D=%.1f %s'%(nm(r),dim[init[r]],D,' -> '.join('%s(%d)'%(flabel(x[1]),x[2]) for x in c))) + for e in evr[r]: + if e[1]==r: print(' %-14s += %-7s %s -> %s'%(flabel(e[3]),nm(e[2]),bl(e[6]),bl(e[7]))) + else: print(' %-14s -> %-7s gives %s'%(flabel(e[3]),nm(e[1]),bl(e[6]))) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/lptiming.py b/research/w3-restore/supplied/builders/agentB_lp/tools/lptiming.py new file mode 100644 index 0000000000..7574c26084 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/lptiming.py @@ -0,0 +1,24 @@ +import sys, pickle, collections +sys.path.insert(0,'/home/claude/work/agentB/tools') +from base import * +L=pickle.load(open(sys.argv[1],'rb')) +ev=L['ev']; n=L['n']; dim=L['dim']; init=L['init']; chain=L['chain'] +mods=pickle.load(open('lpmods.pkl','rb'))['modregs'] +rows=[] +for key in LINEKEYS[:132]: + regs=mods[key] + LM=LINEMASK[key] + # plane registers: chains starting with step to 1 + planes=[r for r in regs if len(chain[r])>1 and chain[r][1][2]==1] + # time plane complete: last event where plane reg receives into dim-3 frame with content = one full block + comp=[] + for r in planes: + ks=[e[0] for e in ev if e[1]==r and e[4]<=3] + comp.append(max(ks) if ks else -1) + firstmod=min(e[0] for e in ev if (e[1] in regs or e[2] in regs) and e[4]>=3 and ((e[1] not in planes) or e[4]>3) and (e[6]&LM) and e[6]&~LM==0 and popc(e[6])>=4) + lastfwd=max(e[0] for e in ev if (e[1] in regs or e[2] in regs) and e[4]<24) + rows.append((key,max(comp),firstmod,lastfwd)) +rows.sort(key=lambda x:x[2]) +for r in rows[:5]+rows[-5:]: print(r) +print('lines where planes complete after first module event:',sum(1 for r in rows if r[1]>r[2])) +print('min first',min(r[2] for r in rows),'max lastfwd',max(r[3] for r in rows), 'max planecomplete',max(r[1] for r in rows)) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/moduleD.py b/research/w3-restore/supplied/builders/agentB_lp/tools/moduleD.py new file mode 100644 index 0000000000..149528bd5a --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/moduleD.py @@ -0,0 +1,25 @@ +# D of LP-module registers (plane regs from their plane frame onward, plus fresh module regs) in a word. +import sys, pickle, json, numpy as np, math, collections +sys.path.insert(0,'/home/claude/work/agentB/tools') +from base import * +d=sys.argv[1]; lines=pickle.load(open(sys.argv[2],'rb')) +W=Word(d); rec=W.rec; dim=W.dim; init=W.init +mv=rec[rec[:,0]==0] +chains=collections.defaultdict(list) +for o,a,b,c,f,z in mv.tolist(): chains[a].append((b,c,f)) +tot_plane=0; tot_fresh=0; tot_copy=0; nf=0 +for key,L in lines.items(): + for X,p in L['planes'].items(): + r=p['r'] + # cost after reaching plane frame (dim 3) + for b,c,f in chains[r]: + if dim[b]>=3 and f>0: tot_plane+=g(f) + for r in L['others']: + if dim[init[r]]==24: continue + nf+=1 + for b,c,f in chains[r]: + if f>0: tot_fresh+=g(f) + for r in L['copies']: + for b,c,f in chains[r]: + if f>0: tot_copy+=g(f) +print(d,'plane post-3 %.1f fresh %.1f (n=%d) module total %.1f per line %.1f | sigma20 copies %.1f'%(tot_plane,tot_fresh,nf,tot_plane+tot_fresh,(tot_plane+tot_fresh)/132,tot_copy)) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/regrecs.py b/research/w3-restore/supplied/builders/agentB_lp/tools/regrecs.py new file mode 100644 index 0000000000..423c41ca63 --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/regrecs.py @@ -0,0 +1,20 @@ +import sys, numpy as np, json +d=sys.argv[1]; regs=[int(x) for x in sys.argv[2:]] +rec=np.fromfile(d+'/249-records.bin',dtype='%d(d%d) rank %d'%(k,nm(a),b,dim[b],c,dim[c],f)) + elif o==1: print(' %8d ADD %s += %s coeff %d @%d(d%d) cat %d'%(k,nm(a),nm(b),c,f,dim[f],z)) + else: print(' %8d op%d'%(k,o),rec[k].tolist()) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/regtrace.py b/research/w3-restore/supplied/builders/agentB_lp/tools/regtrace.py new file mode 100644 index 0000000000..e7fbbb17ff --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/regtrace.py @@ -0,0 +1,32 @@ +import sys, pickle, collections +sys.path.insert(0,'/home/claude/work/agentB/tools') +from base import * +L=pickle.load(open(sys.argv[1],'rb')) +ev=L['ev']; n=L['n']; dim=L['dim']; init=L['init']; chain=L['chain'] +# generic content descriptor: express as LP outputs, LP blocks, faces etc. relative to nothing (global) +LPS={} +for key in LINEKEYS: + for X in range(12): + if (key,X) in DBM: LPS[lp_mask(key,X)]=(key,X) +def gdesc(m): + if m==0: return '0' + if m in LPS: return 'LP%s/%d'%(LPS[m][0],LPS[m][1]) + # line restricted + for key,lm in LINEMASK.items(): + if m&~lm==0: + Xs=sorted(X for (k2,X),bm in DBM.items() if k2==key and bm&m==bm) + rest=m + for X in Xs: rest&=~DBM[(key,X)] + return 'line%s blocks{%s}%s'%(key,''.join('%x'%X for X in Xs),'+%d'%popc(rest) if rest else '') + return '%d items'%popc(m) +def nm(r): return 'X%d'%r if r %s'%(e[0],e[4],nm(e[2]),gdesc(e[6]),gdesc(e[7]))) + else: print(' k=%d @d%-2d -> %-7s gives %s'%(e[0],e[4],nm(e[1]),gdesc(e[6]))) diff --git a/research/w3-restore/supplied/builders/agentB_lp/tools/ystats.py b/research/w3-restore/supplied/builders/agentB_lp/tools/ystats.py new file mode 100644 index 0000000000..d4a360d29c --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/tools/ystats.py @@ -0,0 +1,28 @@ +import sys, pickle, collections +sys.path.insert(0,'/home/claude/work/agentB/tools') +from base import * +L=pickle.load(open(sys.argv[1],'rb')) +ev=L['ev']; n=L['n']; dim=L['dim']; init=L['init']; chain=L['chain'] +byy=collections.defaultdict(list) +for e in ev: + if v<=e[1]<2*v: byy[e[1]-v].append(e) +pat=collections.Counter(); chains=collections.Counter() +for t in range(v): + F,Lp,K=target_parts(t) + c,d,e_=lab[t] + nameF={c:'Fc',d:'Fd',e_:'Fe'} + atoms=[(nameF[p],m) for p,m in F.items()]+[({(c,d):'Lcd',(c,e_):'Lce',(d,e_):'Lde'}[ab],x[2]) for ab,x in Lp.items()]+[('K',1< %s'%(e[0],e[4],e[3],e[2],desc(e[6]),desc(e[7]))) diff --git a/research/w3-restore/supplied/builders/agentB_lp/verify.cpp b/research/w3-restore/supplied/builders/agentB_lp/verify.cpp new file mode 100644 index 0000000000..7d26e6c2db --- /dev/null +++ b/research/w3-restore/supplied/builders/agentB_lp/verify.cpp @@ -0,0 +1,62 @@ +// Verifier: legality replay (exact-mod-p containment), nondegeneracy of used frames, formal F2 simulation. +// Usage: verify [residual_out] +#include "/home/claude/work/fr/sub.hpp" +int main(int argc,char**argv){ + string dir=argv[1]; + Store st; Snapshot sn; sn.load(st,dir,dir+"/249-records.bin"); + int n=sn.n, v=sn.v; size_t NR=sn.rec.size(); + fprintf(stderr,"[load] frames=%zu records=%zu\n",st.S.size(),NR); + auto C=[&](int c){ auto it=sn.cat2id.find(c); if(it==sn.cat2id.end()){fprintf(stderr,"unknown frame %d\n",c); exit(3);} return it->second; }; + int ZERO=C(sn.ZERO), FULLf=C(sn.FULL); + vector state(n+1); for(int r=0;r used; + for(size_t k=0;k val((size_t)(n+1)*WD,0); + auto row=[&](int r){return &val[(size_t)r*WD];}; + for(int r=0;r sig(n); for(int r=0;r2? fopen(argv[2],"w"):nullptr; + for(int r=0;r=2*v){ + bool ok=true; for(int w=0;w=2*v && qsecond;}; + int ZERO=C(sn.ZERO); + vector state(n+1,ZERO); for(int r=0;r hist; long mass=0; bool copied=false; int center=-1; long copies=0; + set used; for(int r=0;r0){hist[e.f]++; mass+=e.f;} + state[e.a]=nw; used.insert(nw); + } else if(e.k==1){ int f=C(e.f); + if(state[e.a]!=f||state[e.b]!=f){ if(bad<5) fprintf(stderr,"ADD frame mismatch at %zu (a=%d b=%d)\n",k,e.a,e.b); bad++; } + if(e.a==e.b){bad++;} + if(copied && (e.a==center || e.a==n)){ if(bad<5) fprintf(stderr,"mutation in copy window %zu\n",k); bad++; } + if((e.a==n||e.b==n)&&!copied){bad++;} + used.insert(f); + } else if(e.k==2){ int c=C(e.c); + if(copied||e.b!=n||state[e.a]!=c||e.z!=st.dim(c)){ fprintf(stderr,"bad COPY %zu\n",k); bad++; } + copied=true; center=e.a; state[n]=C(e.f); hist[e.z]++; mass+=e.z; copies++; used.insert(c); + } else if(e.k==3){ + if(!copied||e.b!=n||e.a!=center||state[e.a]!=C(e.c)||state[n]!=C(e.f)){ fprintf(stderr,"bad ERASE %zu\n",k); bad++; } + copied=false; + } else {bad++;} + } + long badfin=0; for(int r=0;r val((size_t)(n+1)*WD,0); + auto row=[&](int r){return &val[(size_t)r*WD];}; + for(int r=0;r=v&&r<2*v && w==(r-v)/64) want^=1ULL<<((r-v)%64); + if(p[w]!=want){ if(r +using namespace std; +typedef uint64_t u64; typedef int64_t i64; +static const u64 P = 2147483647ULL; +static const int H = 24; +static inline u64 mulm(u64 a, u64 b) { return (a * b) % P; } +static inline u64 addm(u64 a, u64 b) { u64 c = a + b; return c >= P ? c - P : c; } +static inline u64 subm(u64 a, u64 b) { return a >= b ? a - b : a + P - b; } +static u64 powm(u64 a, u64 e) { u64 r = 1; a %= P; while (e) { if (e & 1) r = mulm(r, a); a = mulm(a, a); e >>= 1; } return r; } +static inline u64 invm(u64 a) { return powm(a, P - 2); } +typedef array Row; + +// in-place RREF; returns rank, rows resized to rank +static int rref(vector& M) { + int r = 0, n = M.size(); + for (int c = 0; c < H && r < n; c++) { + int k = -1; + for (int i = r; i < n; i++) if (M[i][c]) { k = i; break; } + if (k < 0) continue; + swap(M[r], M[k]); + u64 iv = invm(M[r][c]); + for (int j = 0; j < H; j++) M[r][j] = mulm(M[r][j], iv); + for (int i = 0; i < n; i++) if (i != r && M[i][c]) { + u64 f = M[i][c]; + for (int j = 0; j < H; j++) if (M[r][j]) M[i][j] = subm(M[i][j], mulm(f, M[r][j])); + } + r++; + } + M.resize(r); + return r; +} + +struct Store { + vector> S; // canonical RREF rows + unordered_map> byhash; + unordered_map joinm, meetm; + vector annm; // -1 unknown + vector ndm; // -1 unknown, 0 degenerate, 1 nondegenerate + u64 hashrows(const vector& R) { + u64 h = 1469598103934665603ULL ^ R.size(); + for (auto& r : R) for (int j = 0; j < H; j++) { h ^= r[j] + 0x9e3779b97f4a7c15ULL + (h << 6) + (h >> 2); } + return h; + } + int intern_rref(const vector& R) { // R must be canonical rref + u64 h = hashrows(R); + auto& L = byhash[h]; + for (int id : L) if (S[id] == R) return id; + S.push_back(R); annm.push_back(-1); ndm.push_back(-1); + L.push_back(S.size() - 1); + return S.size() - 1; + } + int intern(vector R) { rref(R); return intern_rref(R); } + int dim(int a) const { return S[a].size(); } + int join(int a, int b) { + if (a == b) return a; + if (a > b) swap(a, b); + u64 key = (u64)a << 32 | (u64)b; + auto it = joinm.find(key); if (it != joinm.end()) return it->second; + vector M = S[a]; M.insert(M.end(), S[b].begin(), S[b].end()); + int r = intern(M); + joinm[key] = r; return r; + } + int ann(int a) { + if (annm[a] >= 0) return annm[a]; + const vector& R = S[a]; + vector piv; vector isp(H, 0); + for (auto& r : R) { int c = 0; while (!r[c]) c++; piv.push_back(c); isp[c] = 1; } + vector N; + for (int f = 0; f < H; f++) if (!isp[f]) { + Row x{}; x[f] = 1; + for (size_t i = 0; i < R.size(); i++) x[piv[i]] = subm(0, R[i][f]); + N.push_back(x); + } + int r = intern(N); + annm[a] = r; annm[r] = a; + return r; + } + int meet(int a, int b) { + if (a == b) return a; + if (a > b) swap(a, b); + u64 key = (u64)a << 32 | (u64)b; + auto it = meetm.find(key); if (it != meetm.end()) return it->second; + int r = ann(join(ann(a), ann(b))); + meetm[key] = r; return r; + } + bool contains(int big, int small) { return join(big, small) == big; } + bool nondeg(int a) { // Gram under G = I - J/9 + if (ndm[a] >= 0) return ndm[a]; + const vector& R = S[a]; int d = R.size(); + if (d == 0) { ndm[a] = 1; return true; } + u64 i9 = invm(9); + vector s(d, 0); + for (int i = 0; i < d; i++) { u64 t = 0; for (int j = 0; j < H; j++) t = addm(t, R[i][j]); s[i] = t; } + vector M(d); + // use Row type with first d columns as matrix (d<=24) + for (int i = 0; i < d; i++) for (int k = 0; k < d; k++) { + u64 t = 0; for (int j = 0; j < H; j++) t = addm(t, mulm(R[i][j], R[k][j])); + t = subm(t, mulm(i9, mulm(s[i], s[k]))); + M[i][k] = t; + } + for (int i = 0; i < d; i++) for (int k = d; k < H; k++) M[i][k] = 0; + int rk = rref(M); + ndm[a] = (rk == d); + return ndm[a]; + } +}; + +static Row rowmod(const vector& v) { + Row r{}; + for (int j = 0; j < H; j++) { long long x = v[j] % (long long)P; if (x < 0) x += P; r[j] = x; } + return r; +} + +struct Rec { int k, a, b, c, f, z; }; + +struct Snapshot { + int n, v, ZERO, FULL; + vector init, fin; // catalog ids + vector> cov; // v covectors + unordered_map cat2id; // catalog frame id -> store id + vector rec; + void load(Store& st, const string& dir, const string& recfile) { + { + ifstream f(dir + "/frames.txt"); int nf; f >> nf; + for (int i = 0; i < nf; i++) { + int id, d; f >> id >> d; vector R; + for (int k = 0; k < d; k++) { vector v(H); for (int j = 0; j < H; j++) f >> v[j]; R.push_back(rowmod(v)); } + cat2id[id] = st.intern(R); + } + } + { + ifstream f(dir + "/states.txt"); f >> n >> v >> ZERO >> FULL; + init.resize(n); fin.resize(n); + for (int r = 0; r < n; r++) f >> init[r] >> fin[r]; + cov.assign(v, vector(H)); + for (int t = 0; t < v; t++) for (int j = 0; j < H; j++) f >> cov[t][j]; + } + { + ifstream f(recfile, ios::binary); Rec e; + while (f.read((char*)&e, sizeof e)) rec.push_back(e); + } + } +}; diff --git a/research/w3-restore/supplied/checkers/official/cohort-five-stage-columns.cpp b/research/w3-restore/supplied/checkers/official/cohort-five-stage-columns.cpp new file mode 100644 index 0000000000..8e02338398 --- /dev/null +++ b/research/w3-restore/supplied/checkers/official/cohort-five-stage-columns.cpp @@ -0,0 +1,42 @@ +#include "json.hpp" +#include +#include +using boost::multiprecision::cpp_int; +#include +#include +#include +#include +#include +#include +#include +using J=nlohmann::json; +struct E{int kind,dst,src,c;}; +void need(bool x,const char*s){if(!x)throw std::runtime_error(s);} +int main(int argc,char**argv){try{ +need(argc==3,"usage RAW6_RECORDS OUTPUT");std::string pre=argv[1];int v=1760,r=16587,loc=2*v+r,global=4*v+r,temp=global; +struct Raw{int op,a,b,c,f,z;};std::ifstream f(pre,std::ios::binary|std::ios::ate);size_t sz=f.tellg();need(sz%sizeof(Raw)==0,"stream alignment");std::vectorp(sz/sizeof(Raw));f.seekg(0);f.read((char*)p.data(),sz);std::vectore;std::mapH;for(auto q:p){if(q.op==0){if(q.f)H[q.f]++;}else if(q.op==1)e.push_back({0,q.a,q.b,q.c});else if(q.op==2){H[q.z]++;e.push_back({1,loc,q.a,0});}else if(q.op==3)e.push_back({2,loc,q.a,0});else need(false,"opcode");} +J prefix=J::array();cpp_int largestF=0,largestB=0;for(int rev=0;rev<2;rev++){std::vectornorms(loc+1,1);cpp_int maxrow=1;bool isopen=false;for(size_t z=0;zmaxrow)maxrow=norms[q.dst];}else if(k==1){need(!isopen,"boundcopy");norms[loc]=norms[q.src];isopen=true;}else {need(isopen,"bounderase");norms[loc]=0;isopen=false;}}need(!isopen,"prefix copy closure");if(rev)largestB=maxrow;else largestF=maxrow;prefix.push_back({{"reverse",bool(rev)},{"cancellation_free_signed_row_l1_upper",maxrow.convert_to()},{"bits",boost::multiprecision::msb(maxrow)+1}});} +cpp_int payload=64*largestF*largestF*largestF*largestB*largestB;need(payload<(cpp_int(1)<<104),"payloadfiniteprefix2^104"); +long long copies=0,adds=0,odd=0;bool open=false;int center=-1;long long reverseCopies=0; +for(auto q:e){need(q.kind>=0&&q.kind<=2,"kind");need(q.dst>=0&&q.dst<=loc,"local dst");if(q.kind==0){need(q.src>=0&&q.src<=loc&&q.dst!=q.src,"source distinct");need(q.dst!=loc,"copy immutable");need(q.src!=loc||open,"temp not open");if(open)need(q.dst!=center,"source changes inside copied-center block");adds++;odd+=q.c&1;} +else if(q.kind==1){need(!open&&q.dst==loc&&q.src>=0&&q.srca((size_t)(global+1)*words);auto row=[&](int i){return a.data()+(size_t)i*words;};for(int i=0;i=v&&i<2*v&&w==(size_t)(i-v)/64)want^=1ull<<((i-v)%64);need(x[w]==want,"local defining-decoder full formal column");}}} +if(stage==1||stage==2||stage==4){int b=stage==1?0:stage==2?1:2;for(auto q:bridges[b])for(int i=0;i(std::chrono::steady_clock::now()-t0).count()<<"s\n";} +for(int bank=0;bank<4;bank+=2)for(int i=0;i()},{"payload_prefix_bits",boost::multiprecision::msb(payload)+1},{"new_Q_categories",{28,29}},{"local_raw_H",H},{"negative_controls",controls},{"seconds",std::chrono::duration(std::chrono::steady_clock::now()-t0).count()}};std::ofstream(argv[2])< +#include +#include +using namespace std;using nlohmann::json;struct Ev{int k,a,b,c,f,z;};struct F{int d;vector>B,A;};json ld(string p){json j;ifstream(p)>>j;return j;}int main(int ac,char**av){if(ac!=4)return 2;string in=av[1],out=av[2];auto st=ld(in+"/249-states.json"),fj=ld(in+"/frames.json"),nf=ld(out+"/COHORT249-FRAMES.json"),ii=ld(out+"/COHORT249-INITIAL.json"),sel=ld(out+"/COHORT249-SELECTION.json"),own=ld(in+"/249-DONOR-OWNERSHIP.json");int n=st["n"],v=st["v"],zero=st["ZERO"];mapfs;long long maxabs=0;int oldmax=0;for(auto it=fj["frames"].begin();it!=fj["frames"].end();++it){int k=stoi(it.key());oldmax=max(oldmax,k);F f{it.value()["dim"],it.value()["B"],it.value()["A"]};for(auto M:{f.B,f.A})for(auto r:M)for(auto x:r)maxabs=max(maxabs,llabs(x));fs[k]=f;}for(auto it=nf.begin();it!=nf.end();++it){int k=stoi(it.key());if(fs.count(k))throw runtime_error("new frame collides");fs[k]={it.value()["dim"],it.value()["B"],it.value()["A"]};}map,bool>cache;long long contain=0;auto sub=[&](int a,int b){if(!fs.count(a)||!fs.count(b))throw runtime_error("unknown frame");auto k=make_pair(a,b);if(cache.count(k))return cache[k];contain++;bool ok=fs[a].d<=fs[b].d;for(auto r:fs[a].B)for(auto s:fs[b].A){boost::multiprecision::cpp_int d=0;for(int i=0;i<24;i++)d+=boost::multiprecision::cpp_int(r[i])*s[i];if(d)ok=false;}return cache[k]=ok;};setowners,donors,chosen;for(auto x:st["source_owned_roles"])owners.insert(x.get());for(auto x:own["donor_keys"])donors.insert(x.get());setpivots,partners;for(auto s:sel){int p=s["a"];if(!pivots.insert(p).second)throw runtime_error("repeated pivot");for(int r:s["partners"])partners.insert(r);}for(int p:pivots)if(partners.count(p))throw runtime_error("basis support is not square zero");for(auto s:sel){vectormembers=s["partners"].get>();members.push_back(s["a"]);for(int p:members){if(p<2*v||p>=n)throw runtime_error("invalid or overlapping helper");chosen.insert(p);int role=st["regs"][p-2*v];if(owners.count(role)||donors.count(role))throw runtime_error("source owner or donor selected");}int id=s["new_frame_id"];auto f=fs.at(id);if(f.d!=s["E_dimension"]||f.B.size()!=f.d||f.A.size()!=24-f.d)throw runtime_error("wrong new rank");for(auto r:f.A)for(auto b:f.B){boost::multiprecision::cpp_int d=0;for(int k=0;k<24;k++)d+=boost::multiprecision::cpp_int(r[k])*b[k];if(d)throw runtime_error("new ann mismatch");}} +vectorstate(n+1,zero);for(auto it=ii.begin();it!=ii.end();++it)state[stoi(it.key())]=it.value();bool copied=false;int copySource=-1;long long mov=0,adds=0,cop=0,era=0,mass=0;maphist;Ev e;ifstream f(out+"/COHORT249-RECORDS.bin",ios::binary);long long records=0;while(f.read((char*)&e,sizeof e)){records++;if(e.a<0||e.a>n||(e.k!=0&&(e.b<0||e.b>n)))throw runtime_error("bad role id");if(e.k==0){if(e.a==n&&!copied)throw runtime_error("move inactive temporary");if(state[e.a]!=e.b||!sub(e.b,e.c)||fs[e.c].d-fs[e.b].d!=e.f)throw runtime_error("illegal or mispriced MOVE");state[e.a]=e.c;if(e.f){hist[e.f]++;mass+=e.f;}mov++;}else if(e.k==1){if(state[e.a]!=e.f||state[e.b]!=e.f)throw runtime_error("ADD not in common frame");if((e.a==n||e.b==n)&&!copied)throw runtime_error("ADD inactive temporary");if(e.a==e.b)throw runtime_error("self ADD");if(copied&&(e.a==copySource||e.a==n))throw runtime_error("copied source or temporary mutated inside COPY window");adds++;}else if(e.k==2){if(copied||e.b!=n||state[e.a]!=e.c)throw runtime_error("invalid COPY lifecycle");if(e.z!=fs[e.c].d)throw runtime_error("COPY rank");copied=true;copySource=e.a;state[n]=e.f;hist[e.z]++;mass+=e.z;cop++;}else if(e.k==3){if(!copied||e.b!=n||e.a!=copySource||state[e.a]!=e.c||state[n]!=e.f)throw runtime_error("invalid ERASE lifecycle");copied=false;era++;}else throw runtime_error("unknown event");}if(copied||cop!=24||era!=24)throw runtime_error("unclosed COPY");for(int s=0;s +// SPDX-License-Identifier: MIT + +/****************************************************************************\ + * Note on documentation: The source files contain links to the online * + * documentation of the public API at https://json.nlohmann.me. This URL * + * contains the most recent documentation and should also be applicable to * + * previous versions; documentation for deprecated functions is not * + * removed, but marked deprecated. See "Generate documentation" section in * + * file docs/README.md. * +\****************************************************************************/ + +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ + +#include // all_of, find, for_each +#include // nullptr_t, ptrdiff_t, size_t +#include // hash, less +#include // initializer_list +#ifndef JSON_NO_IO + #include // istream, ostream +#endif // JSON_NO_IO +#include // random_access_iterator_tag +#include // unique_ptr +#include // string, stoi, to_string +#include // declval, forward, move, pair, swap +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// This file contains all macro definitions affecting or depending on the ABI + +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 12 || NLOHMANN_JSON_VERSION_PATCH != 0 + #warning "Already included a different version of the library!" + #endif + #endif +#endif + +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 12 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 0 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 +#endif + +#ifndef JSON_DIAGNOSTIC_POSITIONS + #define JSON_DIAGNOSTIC_POSITIONS 0 +#endif + +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 +#endif + +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS +#endif + +#if JSON_DIAGNOSTIC_POSITIONS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS _dp +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS +#endif + +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp +#else + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 +#endif + +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c) json_abi ## a ## b ## c +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b, c) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c) + +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON, \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS) + +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) + +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif + +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) + +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // transform +#include // array +#include // forward_list +#include // inserter, front_inserter, end +#include // map +#ifdef JSON_HAS_CPP_17 + #include // optional +#endif +#include // string +#include // tuple, make_tuple +#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible +#include // unordered_map +#include // pair, declval +#include // valarray + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // nullptr_t +#include // exception +#if JSON_DIAGNOSTICS + #include // accumulate +#endif +#include // runtime_error +#include // to_string +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // uint8_t +#include // string + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template struct make_void +{ + using type = void; +}; +template using void_t = typename make_void::type; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +// https://en.cppreference.com/w/cpp/experimental/is_detected +struct nonesuch +{ + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; +}; + +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> +{ + using value_t = std::true_type; + using type = Op; +}; + +template class Op, class... Args> +using is_detected = typename detector::value_t; + +template class Op, class... Args> +struct is_detected_lazy : is_detected { }; + +template class Op, class... Args> +using detected_t = typename detector::type; + +template class Op, class... Args> +using detected_or = detector; + +template class Op, class... Args> +using detected_or_t = typename detected_or::type; + +template class Op, class... Args> +using is_detected_exact = std::is_same>; + +template class Op, class... Args> +using is_detected_convertible = + std::is_convertible, To>; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + + +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-FileCopyrightText: 2016 - 2021 Evan Nemerson +// SPDX-License-Identifier: MIT + +/* Hedley - https://nemequ.github.io/hedley + * Created by Evan Nemerson + */ + +#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) +#if defined(JSON_HEDLEY_VERSION) + #undef JSON_HEDLEY_VERSION +#endif +#define JSON_HEDLEY_VERSION 15 + +#if defined(JSON_HEDLEY_STRINGIFY_EX) + #undef JSON_HEDLEY_STRINGIFY_EX +#endif +#define JSON_HEDLEY_STRINGIFY_EX(x) #x + +#if defined(JSON_HEDLEY_STRINGIFY) + #undef JSON_HEDLEY_STRINGIFY +#endif +#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) + +#if defined(JSON_HEDLEY_CONCAT_EX) + #undef JSON_HEDLEY_CONCAT_EX +#endif +#define JSON_HEDLEY_CONCAT_EX(a,b) a##b + +#if defined(JSON_HEDLEY_CONCAT) + #undef JSON_HEDLEY_CONCAT +#endif +#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) + +#if defined(JSON_HEDLEY_CONCAT3_EX) + #undef JSON_HEDLEY_CONCAT3_EX +#endif +#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c + +#if defined(JSON_HEDLEY_CONCAT3) + #undef JSON_HEDLEY_CONCAT3 +#endif +#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) + +#if defined(JSON_HEDLEY_VERSION_ENCODE) + #undef JSON_HEDLEY_VERSION_ENCODE +#endif +#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) + #undef JSON_HEDLEY_VERSION_DECODE_MAJOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) + #undef JSON_HEDLEY_VERSION_DECODE_MINOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) + #undef JSON_HEDLEY_VERSION_DECODE_REVISION +#endif +#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) + +#if defined(JSON_HEDLEY_GNUC_VERSION) + #undef JSON_HEDLEY_GNUC_VERSION +#endif +#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#elif defined(__GNUC__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) +#endif + +#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) + #undef JSON_HEDLEY_GNUC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GNUC_VERSION) + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION) + #undef JSON_HEDLEY_MSVC_VERSION +#endif +#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) +#elif defined(_MSC_FULL_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) +#elif defined(_MSC_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) + #undef JSON_HEDLEY_MSVC_VERSION_CHECK +#endif +#if !defined(JSON_HEDLEY_MSVC_VERSION) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) +#elif defined(_MSC_VER) && (_MSC_VER >= 1200) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) +#else + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION) + #undef JSON_HEDLEY_INTEL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) +#elif defined(__INTEL_COMPILER) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_VERSION) + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #undef JSON_HEDLEY_INTEL_CL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) + #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION) + #undef JSON_HEDLEY_PGI_VERSION +#endif +#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) + #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION_CHECK) + #undef JSON_HEDLEY_PGI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PGI_VERSION) + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #undef JSON_HEDLEY_SUNPRO_VERSION +#endif +#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) +#elif defined(__SUNPRO_C) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) +#elif defined(__SUNPRO_CC) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) + #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION +#endif +#if defined(__EMSCRIPTEN__) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION) + #undef JSON_HEDLEY_ARM_VERSION +#endif +#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) +#elif defined(__CC_ARM) && defined(__ARMCC_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION_CHECK) + #undef JSON_HEDLEY_ARM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_ARM_VERSION) + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION) + #undef JSON_HEDLEY_IBM_VERSION +#endif +#if defined(__ibmxl__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) +#elif defined(__xlC__) && defined(__xlC_ver__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) +#elif defined(__xlC__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION_CHECK) + #undef JSON_HEDLEY_IBM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IBM_VERSION) + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_VERSION) + #undef JSON_HEDLEY_TI_VERSION +#endif +#if \ + defined(__TI_COMPILER_VERSION__) && \ + ( \ + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ + ) +#if (__TI_COMPILER_VERSION__ >= 16000000) + #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif +#endif + +#if defined(JSON_HEDLEY_TI_VERSION_CHECK) + #undef JSON_HEDLEY_TI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_VERSION) + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #undef JSON_HEDLEY_TI_CL2000_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) + #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #undef JSON_HEDLEY_TI_CL430_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) + #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #undef JSON_HEDLEY_TI_ARMCL_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) + #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) + #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #undef JSON_HEDLEY_TI_CL6X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) + #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #undef JSON_HEDLEY_TI_CL7X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) + #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #undef JSON_HEDLEY_TI_CLPRU_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) + #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION) + #undef JSON_HEDLEY_CRAY_VERSION +#endif +#if defined(_CRAYC) + #if defined(_RELEASE_PATCHLEVEL) + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) + #else + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) + #undef JSON_HEDLEY_CRAY_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_CRAY_VERSION) + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION) + #undef JSON_HEDLEY_IAR_VERSION +#endif +#if defined(__IAR_SYSTEMS_ICC__) + #if __VER__ > 1000 + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) + #else + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION_CHECK) + #undef JSON_HEDLEY_IAR_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IAR_VERSION) + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION) + #undef JSON_HEDLEY_TINYC_VERSION +#endif +#if defined(__TINYC__) + #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) + #undef JSON_HEDLEY_TINYC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION) + #undef JSON_HEDLEY_DMC_VERSION +#endif +#if defined(__DMC__) + #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION_CHECK) + #undef JSON_HEDLEY_DMC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_DMC_VERSION) + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #undef JSON_HEDLEY_COMPCERT_VERSION +#endif +#if defined(__COMPCERT_VERSION__) + #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) + #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION) + #undef JSON_HEDLEY_PELLES_VERSION +#endif +#if defined(__POCC__) + #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) + #undef JSON_HEDLEY_PELLES_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PELLES_VERSION) + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #undef JSON_HEDLEY_MCST_LCC_VERSION +#endif +#if defined(__LCC__) && defined(__LCC_MINOR__) + #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) + #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION) + #undef JSON_HEDLEY_GCC_VERSION +#endif +#if \ + defined(JSON_HEDLEY_GNUC_VERSION) && \ + !defined(__clang__) && \ + !defined(JSON_HEDLEY_INTEL_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_ARM_VERSION) && \ + !defined(JSON_HEDLEY_CRAY_VERSION) && \ + !defined(JSON_HEDLEY_TI_VERSION) && \ + !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ + !defined(__COMPCERT__) && \ + !defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_ATTRIBUTE +#endif +#if \ + defined(__has_attribute) && \ + ( \ + (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ + ) +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) +#else +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE +#endif +#if \ + defined(__has_cpp_attribute) && \ + defined(__cplusplus) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS +#endif +#if !defined(__cplusplus) || !defined(__has_cpp_attribute) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#elif \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ + (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_BUILTIN) + #undef JSON_HEDLEY_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) +#else + #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) + #undef JSON_HEDLEY_GNUC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) + #undef JSON_HEDLEY_GCC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_FEATURE) + #undef JSON_HEDLEY_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) +#else + #define JSON_HEDLEY_HAS_FEATURE(feature) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) + #undef JSON_HEDLEY_GNUC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_FEATURE) + #undef JSON_HEDLEY_GCC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_EXTENSION) + #undef JSON_HEDLEY_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) +#else + #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) + #undef JSON_HEDLEY_GNUC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) + #undef JSON_HEDLEY_GCC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_WARNING) + #undef JSON_HEDLEY_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) +#else + #define JSON_HEDLEY_HAS_WARNING(warning) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_WARNING) + #undef JSON_HEDLEY_GNUC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_WARNING) + #undef JSON_HEDLEY_GCC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + defined(__clang__) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ + (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) + #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_PRAGMA(value) __pragma(value) +#else + #define JSON_HEDLEY_PRAGMA(value) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) + #undef JSON_HEDLEY_DIAGNOSTIC_PUSH +#endif +#if defined(JSON_HEDLEY_DIAGNOSTIC_POP) + #undef JSON_HEDLEY_DIAGNOSTIC_POP +#endif +#if defined(__clang__) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) + #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) +#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_PUSH + #define JSON_HEDLEY_DIAGNOSTIC_POP +#endif + +/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") +# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") +# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# endif +#endif +#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x +#endif + +#if defined(JSON_HEDLEY_CONST_CAST) + #undef JSON_HEDLEY_CONST_CAST +#endif +#if defined(__cplusplus) +# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) +#elif \ + JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_REINTERPRET_CAST) + #undef JSON_HEDLEY_REINTERPRET_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) +#else + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_STATIC_CAST) + #undef JSON_HEDLEY_STATIC_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) +#else + #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_CPP_CAST) + #undef JSON_HEDLEY_CPP_CAST +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ + ((T) (expr)) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("diag_suppress=Pe137") \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) +# endif +#else +# define JSON_HEDLEY_CPP_CAST(T, expr) (expr) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunused-function") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif + +#if defined(JSON_HEDLEY_DEPRECATED) + #undef JSON_HEDLEY_DEPRECATED +#endif +#if defined(JSON_HEDLEY_DEPRECATED_FOR) + #undef JSON_HEDLEY_DEPRECATED_FOR +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) +#elif \ + (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) +#elif defined(__cplusplus) && (__cplusplus >= 201402L) + #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") +#else + #define JSON_HEDLEY_DEPRECATED(since) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) +#endif + +#if defined(JSON_HEDLEY_UNAVAILABLE) + #undef JSON_HEDLEY_UNAVAILABLE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) +#else + #define JSON_HEDLEY_UNAVAILABLE(available_since) +#endif + +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT +#endif +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) +#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +#elif defined(_Check_return_) /* SAL */ + #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ +#else + #define JSON_HEDLEY_WARN_UNUSED_RESULT + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) +#endif + +#if defined(JSON_HEDLEY_SENTINEL) + #undef JSON_HEDLEY_SENTINEL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) +#else + #define JSON_HEDLEY_SENTINEL(position) +#endif + +#if defined(JSON_HEDLEY_NO_RETURN) + #undef JSON_HEDLEY_NO_RETURN +#endif +#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NO_RETURN __noreturn +#elif \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + #define JSON_HEDLEY_NO_RETURN _Noreturn +#elif defined(__cplusplus) && (__cplusplus >= 201103L) + #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#else + #define JSON_HEDLEY_NO_RETURN +#endif + +#if defined(JSON_HEDLEY_NO_ESCAPE) + #undef JSON_HEDLEY_NO_ESCAPE +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) + #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) +#else + #define JSON_HEDLEY_NO_ESCAPE +#endif + +#if defined(JSON_HEDLEY_UNREACHABLE) + #undef JSON_HEDLEY_UNREACHABLE +#endif +#if defined(JSON_HEDLEY_UNREACHABLE_RETURN) + #undef JSON_HEDLEY_UNREACHABLE_RETURN +#endif +#if defined(JSON_HEDLEY_ASSUME) + #undef JSON_HEDLEY_ASSUME +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_ASSUME(expr) __assume(expr) +#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) + #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) +#elif \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #if defined(__cplusplus) + #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) + #else + #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) + #endif +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() +#elif defined(JSON_HEDLEY_ASSUME) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif +#if !defined(JSON_HEDLEY_ASSUME) + #if defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) + #else + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) + #endif +#endif +#if defined(JSON_HEDLEY_UNREACHABLE) + #if \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) + #else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() + #endif +#else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) +#endif +#if !defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif + +JSON_HEDLEY_DIAGNOSTIC_PUSH +#if JSON_HEDLEY_HAS_WARNING("-Wpedantic") + #pragma clang diagnostic ignored "-Wpedantic" +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) + #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif +#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) + #if defined(__clang__) + #pragma clang diagnostic ignored "-Wvariadic-macros" + #elif defined(JSON_HEDLEY_GCC_VERSION) + #pragma GCC diagnostic ignored "-Wvariadic-macros" + #endif +#endif +#if defined(JSON_HEDLEY_NON_NULL) + #undef JSON_HEDLEY_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) +#else + #define JSON_HEDLEY_NON_NULL(...) +#endif +JSON_HEDLEY_DIAGNOSTIC_POP + +#if defined(JSON_HEDLEY_PRINTF_FORMAT) + #undef JSON_HEDLEY_PRINTF_FORMAT +#endif +#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) +#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) +#else + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) +#endif + +#if defined(JSON_HEDLEY_CONSTEXPR) + #undef JSON_HEDLEY_CONSTEXPR +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) + #endif +#endif +#if !defined(JSON_HEDLEY_CONSTEXPR) + #define JSON_HEDLEY_CONSTEXPR +#endif + +#if defined(JSON_HEDLEY_PREDICT) + #undef JSON_HEDLEY_PREDICT +#endif +#if defined(JSON_HEDLEY_LIKELY) + #undef JSON_HEDLEY_LIKELY +#endif +#if defined(JSON_HEDLEY_UNLIKELY) + #undef JSON_HEDLEY_UNLIKELY +#endif +#if defined(JSON_HEDLEY_UNPREDICTABLE) + #undef JSON_HEDLEY_UNPREDICTABLE +#endif +#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) + #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) +#elif \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, expected, probability) \ + (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ + })) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ + })) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) +#else +# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_LIKELY(expr) (!!(expr)) +# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) +#endif +#if !defined(JSON_HEDLEY_UNPREDICTABLE) + #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) +#endif + +#if defined(JSON_HEDLEY_MALLOC) + #undef JSON_HEDLEY_MALLOC +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_MALLOC __declspec(restrict) +#else + #define JSON_HEDLEY_MALLOC +#endif + +#if defined(JSON_HEDLEY_PURE) + #undef JSON_HEDLEY_PURE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PURE __attribute__((__pure__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + ) +# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") +#else +# define JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_CONST) + #undef JSON_HEDLEY_CONST +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_CONST __attribute__((__const__)) +#elif \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_CONST _Pragma("no_side_effect") +#else + #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_RESTRICT) + #undef JSON_HEDLEY_RESTRICT +#endif +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT restrict +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + defined(__clang__) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RESTRICT __restrict +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT _Restrict +#else + #define JSON_HEDLEY_RESTRICT +#endif + +#if defined(JSON_HEDLEY_INLINE) + #undef JSON_HEDLEY_INLINE +#endif +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + (defined(__cplusplus) && (__cplusplus >= 199711L)) + #define JSON_HEDLEY_INLINE inline +#elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) + #define JSON_HEDLEY_INLINE __inline__ +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_INLINE __inline +#else + #define JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_ALWAYS_INLINE) + #undef JSON_HEDLEY_ALWAYS_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_ALWAYS_INLINE __forceinline +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + ) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") +#else +# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_NEVER_INLINE) + #undef JSON_HEDLEY_NEVER_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#else + #define JSON_HEDLEY_NEVER_INLINE +#endif + +#if defined(JSON_HEDLEY_PRIVATE) + #undef JSON_HEDLEY_PRIVATE +#endif +#if defined(JSON_HEDLEY_PUBLIC) + #undef JSON_HEDLEY_PUBLIC +#endif +#if defined(JSON_HEDLEY_IMPORT) + #undef JSON_HEDLEY_IMPORT +#endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC __declspec(dllexport) +# define JSON_HEDLEY_IMPORT __declspec(dllimport) +#else +# if \ + JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + ( \ + defined(__TI_EABI__) && \ + ( \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ + ) \ + ) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) +# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) +# else +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC +# endif +# define JSON_HEDLEY_IMPORT extern +#endif + +#if defined(JSON_HEDLEY_NO_THROW) + #undef JSON_HEDLEY_NO_THROW +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NO_THROW __declspec(nothrow) +#else + #define JSON_HEDLEY_NO_THROW +#endif + +#if defined(JSON_HEDLEY_FALL_THROUGH) + #undef JSON_HEDLEY_FALL_THROUGH +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) +#elif defined(__fallthrough) /* SAL */ + #define JSON_HEDLEY_FALL_THROUGH __fallthrough +#else + #define JSON_HEDLEY_FALL_THROUGH +#endif + +#if defined(JSON_HEDLEY_RETURNS_NON_NULL) + #undef JSON_HEDLEY_RETURNS_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) +#elif defined(_Ret_notnull_) /* SAL */ + #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ +#else + #define JSON_HEDLEY_RETURNS_NON_NULL +#endif + +#if defined(JSON_HEDLEY_ARRAY_PARAM) + #undef JSON_HEDLEY_ARRAY_PARAM +#endif +#if \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__STDC_NO_VLA__) && \ + !defined(__cplusplus) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_ARRAY_PARAM(name) (name) +#else + #define JSON_HEDLEY_ARRAY_PARAM(name) +#endif + +#if defined(JSON_HEDLEY_IS_CONSTANT) + #undef JSON_HEDLEY_IS_CONSTANT +#endif +#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) + #undef JSON_HEDLEY_REQUIRE_CONSTEXPR +#endif +/* JSON_HEDLEY_IS_CONSTEXPR_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #undef JSON_HEDLEY_IS_CONSTEXPR_ +#endif +#if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) +#endif +#if !defined(__cplusplus) +# if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) +#endif +# elif \ + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION)) || \ + (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) +#endif +# elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + defined(JSON_HEDLEY_INTEL_VERSION) || \ + defined(JSON_HEDLEY_TINYC_VERSION) || \ + defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ + defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ + defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ + defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ + defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) +# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ + sizeof(void) != \ + sizeof(*( \ + 1 ? \ + ((void*) ((expr) * 0L) ) : \ +((struct { char v[sizeof(void) * 2]; } *) 1) \ + ) \ + ) \ + ) +# endif +#endif +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) +#else + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) (0) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) +#endif + +#if defined(JSON_HEDLEY_BEGIN_C_DECLS) + #undef JSON_HEDLEY_BEGIN_C_DECLS +#endif +#if defined(JSON_HEDLEY_END_C_DECLS) + #undef JSON_HEDLEY_END_C_DECLS +#endif +#if defined(JSON_HEDLEY_C_DECL) + #undef JSON_HEDLEY_C_DECL +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { + #define JSON_HEDLEY_END_C_DECLS } + #define JSON_HEDLEY_C_DECL extern "C" +#else + #define JSON_HEDLEY_BEGIN_C_DECLS + #define JSON_HEDLEY_END_C_DECLS + #define JSON_HEDLEY_C_DECL +#endif + +#if defined(JSON_HEDLEY_STATIC_ASSERT) + #undef JSON_HEDLEY_STATIC_ASSERT +#endif +#if \ + !defined(__cplusplus) && ( \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ + (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + defined(_Static_assert) \ + ) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) +#elif \ + (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) +#else +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) +#endif + +#if defined(JSON_HEDLEY_NULL) + #undef JSON_HEDLEY_NULL +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) + #elif defined(NULL) + #define JSON_HEDLEY_NULL NULL + #else + #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) + #endif +#elif defined(NULL) + #define JSON_HEDLEY_NULL NULL +#else + #define JSON_HEDLEY_NULL ((void*) 0) +#endif + +#if defined(JSON_HEDLEY_MESSAGE) + #undef JSON_HEDLEY_MESSAGE +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_MESSAGE(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(message msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) +#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_WARNING) + #undef JSON_HEDLEY_WARNING +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_WARNING(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(clang warning msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_REQUIRE) + #undef JSON_HEDLEY_REQUIRE +#endif +#if defined(JSON_HEDLEY_REQUIRE_MSG) + #undef JSON_HEDLEY_REQUIRE_MSG +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) +# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") +# define JSON_HEDLEY_REQUIRE(expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), #expr, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), msg, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) +# endif +#else +# define JSON_HEDLEY_REQUIRE(expr) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) +#endif + +#if defined(JSON_HEDLEY_FLAGS) + #undef JSON_HEDLEY_FLAGS +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) + #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) +#else + #define JSON_HEDLEY_FLAGS +#endif + +#if defined(JSON_HEDLEY_FLAGS_CAST) + #undef JSON_HEDLEY_FLAGS_CAST +#endif +#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) +# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("warning(disable:188)") \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) +#endif + +#if defined(JSON_HEDLEY_EMPTY_BASES) + #undef JSON_HEDLEY_EMPTY_BASES +#endif +#if \ + (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) +#else + #define JSON_HEDLEY_EMPTY_BASES +#endif + +/* Remaining macros are deprecated. */ + +#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK +#endif +#if defined(__clang__) + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) +#else + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) + #undef JSON_HEDLEY_CLANG_HAS_BUILTIN +#endif +#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) + +#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) + #undef JSON_HEDLEY_CLANG_HAS_FEATURE +#endif +#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) + +#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) + #undef JSON_HEDLEY_CLANG_HAS_EXTENSION +#endif +#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) + +#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_WARNING) + #undef JSON_HEDLEY_CLANG_HAS_WARNING +#endif +#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) + +#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ + + +// This file contains all internal macro definitions (except those affecting ABI) +// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them + +// #include + + +// exclude unsupported compilers +#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) + #if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #endif +#endif + +// C++ language standard detection +// if the user manually specified the used c++ version this is skipped +#if !defined(JSON_HAS_CPP_23) && !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) + #if (defined(__cplusplus) && __cplusplus > 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG > 202002L) + #define JSON_HAS_CPP_23 + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus > 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG > 201703L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus > 201402L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus > 201103L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 + #endif + // the cpp 11 flag is always specified because it is the minimal required version + #define JSON_HAS_CPP_11 +#endif + +#ifdef __has_include + #if __has_include() + #include + #endif +#endif + +#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) + #ifdef JSON_HAS_CPP_17 + #if defined(__cpp_lib_filesystem) + #define JSON_HAS_FILESYSTEM 1 + #elif defined(__cpp_lib_experimental_filesystem) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif !defined(__has_include) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #endif + + // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ + #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__clang_major__) && __clang_major__ < 7 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support + #if defined(_MSC_VER) && _MSC_VER < 1914 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before iOS 13 + #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before macOS Catalina + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + #endif +#endif + +#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_FILESYSTEM + #define JSON_HAS_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_THREE_WAY_COMPARISON + #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ + && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L + #define JSON_HAS_THREE_WAY_COMPARISON 1 + #else + #define JSON_HAS_THREE_WAY_COMPARISON 0 + #endif +#endif + +#ifndef JSON_HAS_RANGES + // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error + #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 + #define JSON_HAS_RANGES 0 + #elif defined(__cpp_lib_ranges) + #define JSON_HAS_RANGES 1 + #else + #define JSON_HAS_RANGES 0 + #endif +#endif + +#ifndef JSON_HAS_STATIC_RTTI + #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0 + #define JSON_HAS_STATIC_RTTI 1 + #else + #define JSON_HAS_STATIC_RTTI 0 + #endif +#endif + +#ifdef JSON_HAS_CPP_17 + #define JSON_INLINE_VARIABLE inline +#else + #define JSON_INLINE_VARIABLE +#endif + +#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) + #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define JSON_NO_UNIQUE_ADDRESS +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdocumentation" + #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +#endif + +// allow disabling exceptions +#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) + #define JSON_THROW(exception) throw exception + #define JSON_TRY try + #define JSON_CATCH(exception) catch(exception) + #define JSON_INTERNAL_CATCH(exception) catch(exception) +#else + #include + #define JSON_THROW(exception) std::abort() + #define JSON_TRY if(true) + #define JSON_CATCH(exception) if(false) + #define JSON_INTERNAL_CATCH(exception) if(false) +#endif + +// override exception macros +#if defined(JSON_THROW_USER) + #undef JSON_THROW + #define JSON_THROW JSON_THROW_USER +#endif +#if defined(JSON_TRY_USER) + #undef JSON_TRY + #define JSON_TRY JSON_TRY_USER +#endif +#if defined(JSON_CATCH_USER) + #undef JSON_CATCH + #define JSON_CATCH JSON_CATCH_USER + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_CATCH_USER +#endif +#if defined(JSON_INTERNAL_CATCH_USER) + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER +#endif + +// allow overriding assert +#if !defined(JSON_ASSERT) + #include // assert + #define JSON_ASSERT(x) assert(x) +#endif + +// allow to access some private functions (needed by the test suite) +#if defined(JSON_TESTS_PRIVATE) + #define JSON_PRIVATE_UNLESS_TESTED public +#else + #define JSON_PRIVATE_UNLESS_TESTED private +#endif + +/*! +@brief macro to briefly define a mapping between an enum and JSON +@def NLOHMANN_JSON_SERIALIZE_ENUM +@since version 3.4.0 +*/ +#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ + template \ + inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ + { \ + /* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + /* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on */ \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [e](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.first == e; \ + }); \ + j = ((it != std::end(m)) ? it : std::begin(m))->second; \ + } \ + template \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ + { \ + /* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + /* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on */ \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [&j](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.second == j; \ + }); \ + e = ((it != std::end(m)) ? it : std::begin(m))->first; \ + } + +// Ugly macros to avoid uglier copy-paste when specializing basic_json. They +// may be removed in the future once the class is split. + +#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer, \ + class BinaryType, \ + class CustomBaseClass> + +#define NLOHMANN_BASIC_JSON_TPL \ + basic_json + +// Macros to simplify conversion from/to types + +#define NLOHMANN_JSON_EXPAND( x ) x +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) +#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) +#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) +#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) +#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) + +#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; +#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); +#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = !nlohmann_json_j.is_null() ? nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1) : nlohmann_json_default_obj.v1; + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE +@since version 3.9.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT +@since version 3.11.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE +@since version 3.11.3 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE +@since version 3.9.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_non_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT +@since version 3.11.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_non_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE +@since version 3.11.3 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_type_non_intrusive/ +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Type, BaseType, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ + template::value, int> = 0> \ + friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(Type, BaseType, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + template::value, int> = 0> \ + void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE +@since version 3.12.0 +@sa https://json.nlohmann.me/api/macros/nlohmann_define_derived_type/ +*/ +#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ + template::value, int> = 0> \ + void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +// inspired from https://stackoverflow.com/a/26745591 +// allows calling any std function as if (e.g., with begin): +// using std::begin; begin(x); +// +// it allows using the detected idiom to retrieve the return type +// of such an expression +#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ + namespace detail { \ + using std::std_name; \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + } \ + \ + namespace detail2 { \ + struct std_name##_tag \ + { \ + }; \ + \ + template \ + std_name##_tag std_name(T&&...); \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + \ + template \ + struct would_call_std_##std_name \ + { \ + static constexpr auto const value = ::nlohmann::detail:: \ + is_detected_exact::value; \ + }; \ + } /* namespace detail2 */ \ + \ + template \ + struct would_call_std_##std_name : detail2::would_call_std_##std_name \ + { \ + } + +#ifndef JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_USE_IMPLICIT_CONVERSIONS 1 +#endif + +#if JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_EXPLICIT +#else + #define JSON_EXPLICIT explicit +#endif + +#ifndef JSON_DISABLE_ENUM_SERIALIZATION + #define JSON_DISABLE_ENUM_SERIALIZATION 0 +#endif + +#ifndef JSON_USE_GLOBAL_UDLS + #define JSON_USE_GLOBAL_UDLS 1 +#endif + +#if JSON_HAS_THREE_WAY_COMPARISON + #include // partial_ordering +#endif + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/////////////////////////// +// JSON type enumeration // +/////////////////////////// + +/*! +@brief the JSON type enumeration + +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. + +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : std::uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + binary, ///< binary array (ordered collection of bytes) + discarded ///< discarded by the parser callback function +}; + +/*! +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string < binary +- furthermore, each type is not smaller than itself +- discarded values are not comparable +- binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + +@since version 1.0.0 +*/ +#if JSON_HAS_THREE_WAY_COMPARISON + inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* +#else + inline bool operator<(const value_t lhs, const value_t rhs) noexcept +#endif +{ + static constexpr std::array order = {{ + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } + }; + + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); +#if JSON_HAS_THREE_WAY_COMPARISON + if (l_index < order.size() && r_index < order.size()) + { + return order[l_index] <=> order[r_index]; // *NOPAD* + } + return std::partial_ordering::unordered; +#else + return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; +#endif +} + +// GCC selects the built-in operator< over an operator rewritten from +// a user-defined spaceship operator +// Clang, MSVC, and ICC select the rewritten candidate +// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) +#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) +inline bool operator<(const value_t lhs, const value_t rhs) noexcept +{ + return std::is_lt(lhs <=> rhs); // *NOPAD* +} +#endif + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/*! +@brief replace all occurrences of a substring by another string + +@param[in,out] s the string to manipulate; changed so that all + occurrences of @a f are replaced with @a t +@param[in] f the substring to replace with @a t +@param[in] t the string to replace @a f + +@pre The search string @a f must not be empty. **This precondition is +enforced with an assertion.** + +@since version 2.0.0 +*/ +template +inline void replace_substring(StringType& s, const StringType& f, + const StringType& t) +{ + JSON_ASSERT(!f.empty()); + for (auto pos = s.find(f); // find first occurrence of f + pos != StringType::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find next occurrence of f + {} +} + +/*! + * @brief string escaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to escape + * @return escaped string + * + * Note the order of escaping "~" to "~0" and "/" to "~1" is important. + */ +template +inline StringType escape(StringType s) +{ + replace_substring(s, StringType{"~"}, StringType{"~0"}); + replace_substring(s, StringType{"/"}, StringType{"~1"}); + return s; +} + +/*! + * @brief string unescaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to unescape + * @return unescaped string + * + * Note the order of escaping "~1" to "/" and "~0" to "~" is important. + */ +template +static void unescape(StringType& s) +{ + replace_substring(s, StringType{"~1"}, StringType{"/"}); + replace_substring(s, StringType{"~0"}, StringType{"~"}); +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // size_t + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/// struct to capture the start position of the current token +struct position_t +{ + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; + + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const + { + return chars_read_total; + } +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-FileCopyrightText: 2018 The Abseil Authors +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +#include // index_sequence, make_index_sequence, index_sequence_for + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +using uncvref_t = typename std::remove_cv::type>::type; + +#ifdef JSON_HAS_CPP_14 + +// the following utilities are natively available in C++14 +using std::enable_if_t; +using std::index_sequence; +using std::make_index_sequence; +using std::index_sequence_for; + +#else + +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +// The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h +// which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. + +//// START OF CODE FROM GOOGLE ABSEIL + +// integer_sequence +// +// Class template representing a compile-time integer sequence. An instantiation +// of `integer_sequence` has a sequence of integers encoded in its +// type through its template arguments (which is a common need when +// working with C++11 variadic templates). `absl::integer_sequence` is designed +// to be a drop-in replacement for C++14's `std::integer_sequence`. +// +// Example: +// +// template< class T, T... Ints > +// void user_function(integer_sequence); +// +// int main() +// { +// // user_function's `T` will be deduced to `int` and `Ints...` +// // will be deduced to `0, 1, 2, 3, 4`. +// user_function(make_integer_sequence()); +// } +template +struct integer_sequence +{ + using value_type = T; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +// index_sequence +// +// A helper template for an `integer_sequence` of `size_t`, +// `absl::index_sequence` is designed to be a drop-in replacement for C++14's +// `std::index_sequence`. +template +using index_sequence = integer_sequence; + +namespace utility_internal +{ + +template +struct Extend; + +// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. +template +struct Extend, SeqSize, 0> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; +}; + +template +struct Extend, SeqSize, 1> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; +}; + +// Recursion helper for 'make_integer_sequence'. +// 'Gen::type' is an alias for 'integer_sequence'. +template +struct Gen +{ + using type = + typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; +}; + +template +struct Gen +{ + using type = integer_sequence; +}; + +} // namespace utility_internal + +// Compile-time sequences of integers + +// make_integer_sequence +// +// This template alias is equivalent to +// `integer_sequence`, and is designed to be a drop-in +// replacement for C++14's `std::make_integer_sequence`. +template +using make_integer_sequence = typename utility_internal::Gen::type; + +// make_index_sequence +// +// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, +// and is designed to be a drop-in replacement for C++14's +// `std::make_index_sequence`. +template +using make_index_sequence = make_integer_sequence; + +// index_sequence_for +// +// Converts a typename pack into an index sequence of the same length, and +// is designed to be a drop-in replacement for C++14's +// `std::index_sequence_for()` +template +using index_sequence_for = make_index_sequence; + +//// END OF CODE FROM GOOGLE ABSEIL + +#endif + +// dispatch utility (taken from ranges-v3) +template struct priority_tag : priority_tag < N - 1 > {}; +template<> struct priority_tag<0> {}; + +// taken from ranges-v3 +template +struct static_const +{ + static JSON_INLINE_VARIABLE constexpr T value{}; +}; + +#ifndef JSON_HAS_CPP_17 + template + constexpr T static_const::value; +#endif + +template +constexpr std::array make_array(Args&& ... args) +{ + return std::array {{static_cast(std::forward(args))...}}; +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // numeric_limits +#include // char_traits +#include // tuple +#include // false_type, is_constructible, is_integral, is_same, true_type +#include // declval + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // random_access_iterator_tag + +// #include + +// #include + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +struct iterator_types {}; + +template +struct iterator_types < + It, + void_t> +{ + using difference_type = typename It::difference_type; + using value_type = typename It::value_type; + using pointer = typename It::pointer; + using reference = typename It::reference; + using iterator_category = typename It::iterator_category; +}; + +// This is required as some compilers implement std::iterator_traits in a way that +// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. +template +struct iterator_traits +{ +}; + +template +struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> + : iterator_types +{ +}; + +template +struct iterator_traits::value>> +{ + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); + +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); + +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// SPDX-License-Identifier: MIT + +#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ + #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + #include // int64_t, uint64_t + #include // map + #include // allocator + #include // string + #include // vector + + // #include + + + /*! + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ + NLOHMANN_JSON_NAMESPACE_BEGIN + + /*! + @brief default JSONSerializer template argument + + This serializer ignores the template arguments and uses ADL + ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) + for serialization. + */ + template + struct adl_serializer; + + /// a class to store JSON values + /// @sa https://json.nlohmann.me/api/basic_json/ + template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer, + class BinaryType = std::vector, // cppcheck-suppress syntaxError + class CustomBaseClass = void> + class basic_json; + + /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document + /// @sa https://json.nlohmann.me/api/json_pointer/ + template + class json_pointer; + + /*! + @brief default specialization + @sa https://json.nlohmann.me/api/json/ + */ + using json = basic_json<>; + + /// @brief a minimal map-like container that preserves insertion order + /// @sa https://json.nlohmann.me/api/ordered_map/ + template + struct ordered_map; + + /// @brief specialization that maintains the insertion order of object keys + /// @sa https://json.nlohmann.me/api/ordered_json/ + using ordered_json = basic_json; + + NLOHMANN_JSON_NAMESPACE_END + +#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + +NLOHMANN_JSON_NAMESPACE_BEGIN +/*! +@brief detail namespace with internal helper functions + +This namespace collects functions that should not be exposed, +implementations of some @ref basic_json methods, and meta-programming helpers. + +@since version 2.1.0 +*/ +namespace detail +{ + +///////////// +// helpers // +///////////// + +// Note to maintainers: +// +// Every trait in this file expects a non CV-qualified type. +// The only exceptions are in the 'aliases for detected' section +// (i.e. those of the form: decltype(T::member_function(std::declval()))) +// +// In this case, T has to be properly CV-qualified to constraint the function arguments +// (e.g. to_json(BasicJsonType&, const T&)) + +template struct is_basic_json : std::false_type {}; + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +struct is_basic_json : std::true_type {}; + +// used by exceptions create() member functions +// true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t +// false_type otherwise +template +struct is_basic_json_context : + std::integral_constant < bool, + is_basic_json::type>::type>::value + || std::is_same::value > +{}; + +////////////////////// +// json_ref helpers // +////////////////////// + +template +class json_ref; + +template +struct is_json_ref : std::false_type {}; + +template +struct is_json_ref> : std::true_type {}; + +////////////////////////// +// aliases for detected // +////////////////////////// + +template +using mapped_type_t = typename T::mapped_type; + +template +using key_type_t = typename T::key_type; + +template +using value_type_t = typename T::value_type; + +template +using difference_type_t = typename T::difference_type; + +template +using pointer_t = typename T::pointer; + +template +using reference_t = typename T::reference; + +template +using iterator_category_t = typename T::iterator_category; + +template +using to_json_function = decltype(T::to_json(std::declval()...)); + +template +using from_json_function = decltype(T::from_json(std::declval()...)); + +template +using get_template_function = decltype(std::declval().template get()); + +// trait checking if JSONSerializer::from_json(json const&, udt&) exists +template +struct has_from_json : std::false_type {}; + +// trait checking if j.get is valid +// use this trait instead of std::is_constructible or std::is_convertible, +// both rely on, or make use of implicit conversions, and thus fail when T +// has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) +template +struct is_getable +{ + static constexpr bool value = is_detected::value; +}; + +template +struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if JSONSerializer::from_json(json const&) exists +// this overload is used for non-default-constructible user-defined-types +template +struct has_non_default_from_json : std::false_type {}; + +template +struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if BasicJsonType::json_serializer::to_json exists +// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. +template +struct has_to_json : std::false_type {}; + +template +struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +template +using detect_key_compare = typename T::key_compare; + +template +struct has_key_compare : std::integral_constant::value> {}; + +// obtains the actual object key comparator +template +struct actual_object_comparator +{ + using object_t = typename BasicJsonType::object_t; + using object_comparator_t = typename BasicJsonType::default_object_comparator_t; + using type = typename std::conditional < has_key_compare::value, + typename object_t::key_compare, object_comparator_t>::type; +}; + +template +using actual_object_comparator_t = typename actual_object_comparator::type; + +///////////////// +// char_traits // +///////////////// + +// Primary template of char_traits calls std char_traits +template +struct char_traits : std::char_traits +{}; + +// Explicitly define char traits for unsigned char since it is not standard +template<> +struct char_traits : std::char_traits +{ + using char_type = unsigned char; + using int_type = uint64_t; + + // Redefine to_int_type function + static int_type to_int_type(char_type c) noexcept + { + return static_cast(c); + } + + static char_type to_char_type(int_type i) noexcept + { + return static_cast(i); + } + + static constexpr int_type eof() noexcept + { + return static_cast(std::char_traits::eof()); + } +}; + +// Explicitly define char traits for signed char since it is not standard +template<> +struct char_traits : std::char_traits +{ + using char_type = signed char; + using int_type = uint64_t; + + // Redefine to_int_type function + static int_type to_int_type(char_type c) noexcept + { + return static_cast(c); + } + + static char_type to_char_type(int_type i) noexcept + { + return static_cast(i); + } + + static constexpr int_type eof() noexcept + { + return static_cast(std::char_traits::eof()); + } +}; + +/////////////////// +// is_ functions // +/////////////////// + +// https://en.cppreference.com/w/cpp/types/conjunction +template struct conjunction : std::true_type { }; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional(B::value), conjunction, B>::type {}; + +// https://en.cppreference.com/w/cpp/types/negation +template struct negation : std::integral_constant < bool, !B::value > { }; + +// Reimplementation of is_constructible and is_default_constructible, due to them being broken for +// std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). +// This causes compile errors in e.g. clang 3.5 or gcc 4.9. +template +struct is_default_constructible : std::is_default_constructible {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_constructible : std::is_constructible {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_iterator_traits : std::false_type {}; + +template +struct is_iterator_traits> +{ + private: + using traits = iterator_traits; + + public: + static constexpr auto value = + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value; +}; + +template +struct is_range +{ + private: + using t_ref = typename std::add_lvalue_reference::type; + + using iterator = detected_t; + using sentinel = detected_t; + + // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator + // and https://en.cppreference.com/w/cpp/iterator/sentinel_for + // but reimplementing these would be too much work, as a lot of other concepts are used underneath + static constexpr auto is_iterator_begin = + is_iterator_traits>::value; + + public: + static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; +}; + +template +using iterator_t = enable_if_t::value, result_of_begin())>>; + +template +using range_value_t = value_type_t>>; + +// The following implementation of is_complete_type is taken from +// https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ +// and is written by Xiang Fan who agreed to using it in this library. + +template +struct is_complete_type : std::false_type {}; + +template +struct is_complete_type : std::true_type {}; + +template +struct is_compatible_object_type_impl : std::false_type {}; + +template +struct is_compatible_object_type_impl < + BasicJsonType, CompatibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + // macOS's is_constructible does not play well with nonesuch... + static constexpr bool value = + is_constructible::value && + is_constructible::value; +}; + +template +struct is_compatible_object_type + : is_compatible_object_type_impl {}; + +template +struct is_constructible_object_type_impl : std::false_type {}; + +template +struct is_constructible_object_type_impl < + BasicJsonType, ConstructibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + static constexpr bool value = + (is_default_constructible::value && + (std::is_move_assignable::value || + std::is_copy_assignable::value) && + (is_constructible::value && + std::is_same < + typename object_t::mapped_type, + typename ConstructibleObjectType::mapped_type >::value)) || + (has_from_json::value || + has_non_default_from_json < + BasicJsonType, + typename ConstructibleObjectType::mapped_type >::value); +}; + +template +struct is_constructible_object_type + : is_constructible_object_type_impl {}; + +template +struct is_compatible_string_type +{ + static constexpr auto value = + is_constructible::value; +}; + +template +struct is_constructible_string_type +{ + // launder type through decltype() to fix compilation failure on ICPC +#ifdef __INTEL_COMPILER + using laundered_type = decltype(std::declval()); +#else + using laundered_type = ConstructibleStringType; +#endif + + static constexpr auto value = + conjunction < + is_constructible, + is_detected_exact>::value; +}; + +template +struct is_compatible_array_type_impl : std::false_type {}; + +template +struct is_compatible_array_type_impl < + BasicJsonType, CompatibleArrayType, + enable_if_t < + is_detected::value&& + is_iterator_traits>>::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 + !std::is_same>::value >> +{ + static constexpr bool value = + is_constructible>::value; +}; + +template +struct is_compatible_array_type + : is_compatible_array_type_impl {}; + +template +struct is_constructible_array_type_impl : std::false_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t::value >> + : std::true_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t < !std::is_same::value&& + !is_compatible_string_type::value&& + is_default_constructible::value&& +(std::is_move_assignable::value || + std::is_copy_assignable::value)&& +is_detected::value&& +is_iterator_traits>>::value&& +is_detected::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 +!std::is_same>::value&& +is_complete_type < +detected_t>::value >> +{ + using value_type = range_value_t; + + static constexpr bool value = + std::is_same::value || + has_from_json::value || + has_non_default_from_json < + BasicJsonType, + value_type >::value; +}; + +template +struct is_constructible_array_type + : is_constructible_array_type_impl {}; + +template +struct is_compatible_integer_type_impl : std::false_type {}; + +template +struct is_compatible_integer_type_impl < + RealIntegerType, CompatibleNumberIntegerType, + enable_if_t < std::is_integral::value&& + std::is_integral::value&& + !std::is_same::value >> +{ + // is there an assert somewhere on overflows? + using RealLimits = std::numeric_limits; + using CompatibleLimits = std::numeric_limits; + + static constexpr auto value = + is_constructible::value && + CompatibleLimits::is_integer && + RealLimits::is_signed == CompatibleLimits::is_signed; +}; + +template +struct is_compatible_integer_type + : is_compatible_integer_type_impl {}; + +template +struct is_compatible_type_impl: std::false_type {}; + +template +struct is_compatible_type_impl < + BasicJsonType, CompatibleType, + enable_if_t::value >> +{ + static constexpr bool value = + has_to_json::value; +}; + +template +struct is_compatible_type + : is_compatible_type_impl {}; + +template +struct is_constructible_tuple : std::false_type {}; + +template +struct is_constructible_tuple> : conjunction...> {}; + +template +struct is_json_iterator_of : std::false_type {}; + +template +struct is_json_iterator_of : std::true_type {}; + +template +struct is_json_iterator_of : std::true_type +{}; + +// checks if a given type T is a template specialization of Primary +template