diff --git a/.gitattributes b/.gitattributes index 6825630198..ee8d134eab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,3 +18,19 @@ research/coordinated-frames-and-entrance-banks/** -text -whitespace # Frozen PR210 package and round-nine evidence retain their audited bytes. research/five-stage-source527-banks/** -text -whitespace research/community-round9-audit/** -text -whitespace + +# Frozen replicated E8 sources and witnesses preserve their committed bytes. +research/e8-r740-replica32/** -text +# Byte-identical PR442 proof packages, including original whitespace. +research/e8-early-reset-kernel/** -text -whitespace +research/e8-early-reset-reuse/** -text -whitespace +research/idle-axis-hosting/** -text -whitespace +research/split-centres-global/** -text -whitespace +# Preserve source pins and the literal evidence diff, including removed whitespace. +research/e8-target-mixing-whole/** -text +research/e8-target-mixing-whole-validation/FINAL-COSMETIC.diff -text -whitespace +# R715 source-pinned words and upstream discovery artifacts retain exact bytes. +research/e8-r715-whole-hosted/** -text +research/e8-r715-whole-hosted/upstream*/** -whitespace +# The E8 bit carrier-skeleton package (vendored from #493) pins exact bytes in MANIFEST.sha256. +research/e8-bit-carrier-skeleton/** -text -whitespace diff --git a/.github/workflows/e8-complex-adapted-kernel.yml b/.github/workflows/e8-complex-adapted-kernel.yml new file mode 100644 index 0000000000..a3c418423c --- /dev/null +++ b/.github/workflows/e8-complex-adapted-kernel.yml @@ -0,0 +1,60 @@ +name: e8-complex-adapted-kernel +on: + pull_request: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/r740-hosted-rank149/**' + - 'research/e8-target-mixing-whole/**' + - 'research/e8-complex-adapted-kernel/**' + - 'research/whole-hosted-format-ceiling/**' + - 'research/cross-family-residual-obstruction/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/e8-complex-adapted-kernel.yml' + push: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/r740-hosted-rank149/**' + - 'research/e8-target-mixing-whole/**' + - 'research/e8-complex-adapted-kernel/**' + - 'research/whole-hosted-format-ceiling/**' + - 'research/cross-family-residual-obstruction/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/e8-complex-adapted-kernel.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.14'] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: ${{ matrix.python-version }} + - run: sudo apt-get update && sudo apt-get install -y libboost-dev + - run: python -m pip install -r research/e8-r740-replica32/parent436/requirements.txt + - name: Exact cross-family route obstruction + run: python -B research/cross-family-residual-obstruction/verify.py + - name: Exact scoped architecture ceiling + run: python -B research/whole-hosted-format-ceiling/verify.py + - name: Full parent, local phases and both eleven-stage suppliers + run: E8_REPLAY_PHASES=1 python -B research/e8-complex-adapted-kernel/verify.py "$RUNNER_TEMP/e8-complex-adapted-kernel-full" + - name: Require an unchanged tracked tree + run: git diff --exit-code diff --git a/.github/workflows/e8-r715-whole-hosted.yml b/.github/workflows/e8-r715-whole-hosted.yml new file mode 100644 index 0000000000..b1bcff0f09 --- /dev/null +++ b/.github/workflows/e8-r715-whole-hosted.yml @@ -0,0 +1,62 @@ +name: e8-r715-whole-hosted +on: + pull_request: + paths: + - 'research/e8-r715-whole-hosted/**' + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/r740-hosted-rank149/**' + - 'research/e8-target-mixing-whole/**' + - 'research/e8-complex-adapted-kernel/**' + - 'research/whole-hosted-format-ceiling/**' + - 'research/cross-family-residual-obstruction/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/e8-r715-whole-hosted.yml' + push: + paths: + - 'research/e8-r715-whole-hosted/**' + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/r740-hosted-rank149/**' + - 'research/e8-target-mixing-whole/**' + - 'research/e8-complex-adapted-kernel/**' + - 'research/whole-hosted-format-ceiling/**' + - 'research/cross-family-residual-obstruction/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/e8-r715-whole-hosted.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.14'] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: ${{ matrix.python-version }} + - run: sudo apt-get update && sudo apt-get install -y libboost-dev + - run: python -m pip install -r research/e8-r740-replica32/parent436/requirements.txt + - name: Exact cross-family route obstruction + run: python -B research/cross-family-residual-obstruction/verify.py + - name: Exact scoped architecture ceiling + run: python -B research/whole-hosted-format-ceiling/verify.py + - name: Full paid-complex parent and R715 whole-hosted composition + run: E8_REPLAY_PHASES=1 python -B research/e8-r715-whole-hosted/verify.py "$RUNNER_TEMP/e8-r715-whole-hosted-full" + - name: Require an unchanged tracked tree + run: git diff --exit-code diff --git a/.github/workflows/e8-r740-replica32.yml b/.github/workflows/e8-r740-replica32.yml new file mode 100644 index 0000000000..4975bb39f4 --- /dev/null +++ b/.github/workflows/e8-r740-replica32.yml @@ -0,0 +1,34 @@ +name: e8-r740-replica32 +on: + pull_request: + paths: + - 'research/e8-r740-replica32/**' + - '.github/workflows/e8-r740-replica32.yml' + push: + paths: + - 'research/e8-r740-replica32/**' + - '.github/workflows/e8-r740-replica32.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.14'] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: ${{ matrix.python-version }} + - run: sudo apt-get update && sudo apt-get install -y libboost-dev + - run: python -m pip install -r research/e8-r740-replica32/parent436/requirements.txt + - name: Full parent reconstruction and kernel verification + run: bash research/e8-r740-replica32/verify.sh "$RUNNER_TEMP/e8-r740-replica32-full" + - name: Require an unchanged tracked tree + run: git diff --exit-code diff --git a/.github/workflows/e8-target-mixing-whole.yml b/.github/workflows/e8-target-mixing-whole.yml new file mode 100644 index 0000000000..437cdc4ce8 --- /dev/null +++ b/.github/workflows/e8-target-mixing-whole.yml @@ -0,0 +1,54 @@ +name: e8-target-mixing-whole +on: + pull_request: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/r740-hosted-rank149/**' + - 'research/e8-target-mixing-whole/**' + - 'research/cross-family-residual-obstruction/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/e8-target-mixing-whole.yml' + push: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/r740-hosted-rank149/**' + - 'research/e8-target-mixing-whole/**' + - 'research/cross-family-residual-obstruction/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/e8-target-mixing-whole.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.14'] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: ${{ matrix.python-version }} + - run: sudo apt-get update && sudo apt-get install -y libboost-dev + - run: python -m pip install -r research/e8-r740-replica32/parent436/requirements.txt + - name: Exact cross-family route obstruction + run: python -B research/cross-family-residual-obstruction/verify.py + - name: Full parent, local phases and both eleven-stage suppliers + run: E8_REPLAY_PHASES=1 python -B research/e8-target-mixing-whole/verify.py "$RUNNER_TEMP/e8-target-mixing-whole-full" + - name: Require an unchanged tracked tree + run: git diff --exit-code diff --git a/.github/workflows/r740-hosted-eleven.yml b/.github/workflows/r740-hosted-eleven.yml new file mode 100644 index 0000000000..6936cc187d --- /dev/null +++ b/.github/workflows/r740-hosted-eleven.yml @@ -0,0 +1,46 @@ +name: r740-hosted-eleven +on: + pull_request: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/r740-hosted-eleven.yml' + push: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/r740-hosted-eleven.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.14'] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: ${{ matrix.python-version }} + - run: sudo apt-get update && sudo apt-get install -y libboost-dev + - run: python -m pip install -r research/e8-r740-replica32/parent436/requirements.txt + - name: Full parent reconstruction and hosted verification + run: python -B research/r740-hosted-eleven/verify.py "$RUNNER_TEMP/r740-hosted-eleven-full" + - name: Require an unchanged tracked tree + run: git diff --exit-code diff --git a/.github/workflows/r740-hosted-rank149.yml b/.github/workflows/r740-hosted-rank149.yml new file mode 100644 index 0000000000..9902b04897 --- /dev/null +++ b/.github/workflows/r740-hosted-rank149.yml @@ -0,0 +1,52 @@ +name: r740-hosted-rank149 +on: + pull_request: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/r740-hosted-rank149/**' + - 'research/cross-family-residual-obstruction/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/r740-hosted-rank149.yml' + push: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/r740-hosted-eleven/**' + - 'research/r740-hosted-rank149/**' + - 'research/cross-family-residual-obstruction/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/r740-hosted-rank149.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.14'] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: ${{ matrix.python-version }} + - run: sudo apt-get update && sudo apt-get install -y libboost-dev + - run: python -m pip install -r research/e8-r740-replica32/parent436/requirements.txt + - name: Exact cross-family route obstruction + run: python -B research/cross-family-residual-obstruction/verify.py + - name: Full parent, local phases and both eleven-stage suppliers + run: E8_REPLAY_PHASES=1 python -B research/r740-hosted-rank149/verify.py "$RUNNER_TEMP/r740-hosted-rank149-full" + - name: Require an unchanged tracked tree + run: git diff --exit-code diff --git a/.github/workflows/r740-idle-hosted-replicas.yml b/.github/workflows/r740-idle-hosted-replicas.yml new file mode 100644 index 0000000000..5c7e732117 --- /dev/null +++ b/.github/workflows/r740-idle-hosted-replicas.yml @@ -0,0 +1,44 @@ +name: r740-idle-hosted-replicas +on: + pull_request: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/r740-idle-hosted-replicas.yml' + push: + paths: + - 'research/r740-idle-hosted-replicas/**' + - 'research/split-centres-global/**' + - 'research/e8-early-reset-reuse/**' + - 'research/e8-early-reset-kernel/**' + - 'research/idle-axis-hosting/**' + - 'research/e8-r740-replica32/**' + - '.github/workflows/r740-idle-hosted-replicas.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + verify: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.14'] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: ${{ matrix.python-version }} + - run: sudo apt-get update && sudo apt-get install -y libboost-dev + - run: python -m pip install -r research/e8-r740-replica32/parent436/requirements.txt + - name: Full parent reconstruction and hosted verification + run: python -B research/r740-idle-hosted-replicas/verify.py "$RUNNER_TEMP/r740-idle-hosted-replicas-full" + - name: Require an unchanged tracked tree + run: git diff --exit-code 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/cross-copy-hosting-r715/EXPECTED.json b/research/cross-copy-hosting-r715/EXPECTED.json new file mode 100644 index 0000000000..a08a65e2aa --- /dev/null +++ b/research/cross-copy-hosting-r715/EXPECTED.json @@ -0,0 +1,10 @@ +{ + "status": "PASS_CONDITIONAL_CROSS_COPY_ELEVEN_STAGE_R715_ASSEMBLY", + "kappa": "68627507968399/50000000000000000", + "kappa_decimal": "0.001372550159367980", + "bit_lower": "687218321300411808399/500000000000000000000000", + "complex_lower": "718766148669433/500000000000000000", + "binding_component": "bit", + "emitted_program_sha256": "4c78424ddb3ef40f82f9e1d88d56ad009ce3664db483d15bf563f40b491bc704", + "complex_template_sha256": "848ad045872f55c43cc1623600d1ba81e32fe33b68683cb56c39324287bf9fa4" +} diff --git a/research/cross-copy-hosting-r715/LICENSE b/research/cross-copy-hosting-r715/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/cross-copy-hosting-r715/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/cross-copy-hosting-r715/MANIFEST.json b/research/cross-copy-hosting-r715/MANIFEST.json new file mode 100644 index 0000000000..9cb56d2124 --- /dev/null +++ b/research/cross-copy-hosting-r715/MANIFEST.json @@ -0,0 +1,17 @@ +{ + "files": { + "EXPECTED.json": "5755b762bfefd12b706ad48a97391661e8cf7adb63a2a259962f8496e947cc7d", + "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "PROOF.md": "3ed952270f76fef7d90c703c80ecdbab76651bff959e97545c13f537ddbef595", + "README.md": "462e641e2d915f34da0320cf751a4d5c4b7a3f64d254df13813b006feba23f11", + "SELECTION.json": "4413561eb3e773d549d195098b051ad9c672d8cc446daa44ec24d54872e9e1c1", + "assemble_split11.py": "3b97a6179516a42cba9207e539fd6e98e4788878ca68538ecef87ca8476fafac", + "audit_split.py": "549d41ce1d6587eae37e43d906297cc356c924d11b668c0bce89474acb5b690b", + "audit_split11.py": "2ce7b9d10da70cde7bf4d63b054eb955fdffbed99b0b3ab12cd74ac0f8f98c99", + "bit_split11.py": "6e717ca8495a1cec7eef7ff09508517c4df567807fffa2855be26c2a9912b869", + "complex_split.py": "eeee31964ea328c893d4fe10f5ec4c4f3a055769be39ef455186754459502c3a", + "tape_core.py": "bd1b68b56e382d014c1afeb4a735b26b469681192263f7b0da21c4288afaf3de", + "verify.py": "f5cea73f77a656d2253d4fa63d8c9ca95984b94b2afcb6d5cbaca4217064f537" + }, + "parent_manifest_sha256": "60d469ea1165f5861a4912c735d43b3eec67579645da2f3081b5393c4aa786f2" +} diff --git a/research/cross-copy-hosting-r715/PROOF.md b/research/cross-copy-hosting-r715/PROOF.md new file mode 100644 index 0000000000..8cf0e62a26 --- /dev/null +++ b/research/cross-copy-hosting-r715/PROOF.md @@ -0,0 +1,63 @@ +# Cross-copy idle-axis hosting on #472's R715 eleven-stage word + +The cross-copy slot of #448 (`research/cross-copy-hosting`, PROOF.md §2 and §7, `toy_two_family_check.py`) applied to +#472's suppliers. Nothing in #472's bit construction changes except where helper residuals live: its R715 local word, +109-pivot kernel (entrance rank 120), 56 target mixes, retimings, residual isometries, eleven-stage schedule (K = 5, +m = 78), eight replicas and bridges are byte-identical. The complex supplier is #448's cross-copy hosted #433 word. + +## 1. What changes + +#472 hosts every one of the 62,920 helper residual occurrences whole on one idle data family, pooling the eight +replicas (an owner may be in another replica). Residual widths are 8 − e (606 of width 8, 98 of width 7, 11 of width 6 +per replica), the children have ranks 7, 14, 28, 42 and 56, so copies are left partly empty and paid as remainder +children: #472's bit profile carries remainders of rank 6, 7, 28 and 56. + +Here the pending sets of a child's 2V·T = 1,920 pooled copies are concatenated into one tape and residuals are laid +along it widest first; a residual that straddles a copy boundary is owned by two copies of the same child. Both +copies share the child's window, so #442's lemma applies to each piece and #448 §2 gives the complete-program +identity family by family (the exact finite check of §7 covers the two-family case in the model of #451's note). +The remainder of every copy is exact, and concave costs make the contiguous fill optimal: filled copies pay nothing, +and the unfilled copies of the rank-56 final children pay the whole child. + +## 2. Accounting + +- Paid profile: the local word's climbs and copies, plus every nonzero copy remainder, once per copy (the template + pools replicas, as #472 does). Deficit (2KV − 72L)·T = 3,264 is unchanged. +- Physical prefix bound: #472's chronological norm bound is recomputed on the new owners; a split owner's two + families both receive the update (the bound is monotone in that choice). 1,161 bits, charged 1,216. This treatment of a + split owner in the chronological norm bound is new here and is a review point of its own. +- Finite invoice: #472's eleven-stage invoice (three-level halving, max child 56, complete row bound 19,431 < 20,161) + with one further route factor per helper selector for the split (three extra instead of #472's two). The complex + invoice is #448's (#442's formulas with the hosted stock). +- The integer programme (`tape_core.solve`, frozen in `SELECTION.json`) maximises Σ ln(m/r)·(hosted coordinates); + the generator completes any residual the solver leaves out on an in-window child with room. + +## 3. Checks + +`audit_split11.py` shares no code with the generators: windows re-derived from the schedule; every residual has +exactly one owner record; pieces on copies of the named child, inside the pending set, widths summing to the residual +width, disjoint per (child, copy), inside the window, off the active pair; owner families recomputed from the piece +copies; the unchanged parts of the template byte-identical to #472's; remainders, profile, live stock, deficit, the +emitted-program digest and the physical prefix bits recomputed; fifteen mutation controls rejected. +`assemble_split11.py` runs both rational moment engines per supplier, both finite invoices, six bootstrap levels and +the 47 strict outer inequalities; the next grid point and the zero-η, zero-β, unit-β controls are rejected. + +## 4. Result + +| | #472 | this package | +| --- | ---: | ---: | +| bit live / physical | 9,600 / 9,609 | 9,600 / 9,609 | +| hosted residuals (split) | 62,920 (0) | 62,920 (14,612) | +| bit saving c | 1.293771·10⁻³ | **1.374423·10⁻³** | +| complex saving b | 1.297204·10⁻³ (#458) | 1.437532·10⁻³ (#448) | +| κ | 1.292100·10⁻³ | **1.372550·10⁻³** | + +κ = 1372550159367980/10¹⁸ ≈ 1.37255·10⁻³, bit-bound, +6.23 % over #472 and +1.63 % over #469. + +## 5. Scope + +Conditional like its parents. The review point is the cross-copy slot of #448 (a residual's physical slot in two +data families of one idle child), on which #450, #453, #464 and #469 also rest; #451's trace note and the reply on +that thread describe the disagreement. #472's own review points (R715 word, kernel, mixing, pooled whole hosting, +eleven-stage row bound) and all inherited interfaces remain assumptions. No Lean proof and no unconditional +integer-multiplication theorem is claimed. diff --git a/research/cross-copy-hosting-r715/README.md b/research/cross-copy-hosting-r715/README.md new file mode 100644 index 0000000000..741885809d --- /dev/null +++ b/research/cross-copy-hosting-r715/README.md @@ -0,0 +1,36 @@ +# Cross-copy hosting on #472's R715 eleven-stage word: conditional κ ≈ 1.3725502·10⁻³ + +#448's cross-copy slot applied to #472's suppliers: chafreaky's R715 word with shared kernel, target mixing and +retimings in eleven compressed stages (bit), and #448's cross-copy hosted #433 word (complex). Neither local word nor +any schedule, isometry or bridge changes; only the owners of the helper residuals do. + +**Result:** κ = 1372550159367980/10¹⁸ ≈ 1.372550159367980·10⁻³, bit-bound, **+6.23 % over #472** (1.2920996·10⁻³) +and +1.63 % over #469 (1.3505809·10⁻³). + +| supplier | parent saving | this saving | hosted residuals (split) | max child | +| --- | --- | --- | --- | --- | +| bit, m = 78, R = 715, eleven stages, 8 replicas | 1.293771·10⁻³ | **1.374423·10⁻³** | 62,920 (14,612) | 56 | +| complex, m = 73, R = 560 (#448) | 1.437532·10⁻³ | 1.437532·10⁻³ | 40,320 (13,720) | 48 | + +[PROOF.md](PROOF.md) gives the construction, the accounting and the scope. + +## Verify + +```sh +python3 -B research/cross-copy-hosting-r715/verify.py /absolute/new/output # full +python3 -B research/cross-copy-hosting-r715/verify.py /absolute/new/output --quick # skips only #443's inherited exhaustive controls +``` + +- The output directory must not exist. #472's parents need numpy, mpmath, sympy, a C++17 compiler and Boost + headers (`BOOST_INCLUDE`); the new steps use the standard library (scipy only for `--discover`). +- It runs #472's complete `verify.py` (which rebuilds #458's complex supplier and the R715 composition), then both + generators, the independent audit (fifteen mutation controls) and the exact assembly, and compares every value, + the emitted-program digest and the complex template hash with `EXPECTED.json`. + +## Scope and credits + +Conditional, like its parents; the review point is #448's cross-copy slot. Builds on and runs unchanged: #472, #467, +#463 (R715 word: DreamingOfClouds), #458, #454, #451, #443–#445 (chafreaky), #442 (DaysSky), #450 (target mixing), +#441/#440/#436 (eumemic), #434 (Rohan Arun), #433 (icekylinx), #425/#386 (Zhihao Chen), #370 (Dylan Crow), Jacob +Sussman's E8 unit and interfaces. The cross-copy generators, audit and assembly were prepared by higherbeing with +Claude (Anthropic) assistance. diff --git a/research/cross-copy-hosting-r715/SELECTION.json b/research/cross-copy-hosting-r715/SELECTION.json new file mode 100644 index 0000000000..70d70216fc --- /dev/null +++ b/research/cross-copy-hosting-r715/SELECTION.json @@ -0,0 +1,617 @@ +{ + "bit": { + "counts": [ + [ + 0, + 0, + 8, + 417 + ], + [ + 0, + 1, + 4, + 6 + ], + [ + 1, + 2, + 7, + 104 + ], + [ + 1, + 2, + 8, + 119 + ], + [ + 2, + 0, + 4, + 4 + ], + [ + 2, + 1, + 7, + 104 + ], + [ + 2, + 1, + 8, + 637 + ], + [ + 2, + 2, + 4, + 6 + ], + [ + 2, + 3, + 4, + 6 + ], + [ + 2, + 3, + 8, + 104 + ], + [ + 3, + 4, + 4, + 6 + ], + [ + 3, + 4, + 7, + 96 + ], + [ + 3, + 4, + 8, + 123 + ], + [ + 4, + 0, + 8, + 16 + ], + [ + 4, + 2, + 8, + 118 + ], + [ + 4, + 4, + 8, + 499 + ], + [ + 4, + 5, + 8, + 624 + ], + [ + 5, + 6, + 4, + 6 + ], + [ + 5, + 6, + 7, + 104 + ], + [ + 5, + 6, + 8, + 116 + ], + [ + 6, + 3, + 8, + 520 + ], + [ + 6, + 4, + 8, + 14 + ], + [ + 6, + 5, + 4, + 6 + ], + [ + 6, + 7, + 8, + 402 + ], + [ + 6, + 8, + 8, + 321 + ], + [ + 7, + 6, + 8, + 521 + ], + [ + 7, + 8, + 4, + 6 + ], + [ + 7, + 8, + 8, + 316 + ], + [ + 8, + 7, + 4, + 6 + ], + [ + 8, + 7, + 7, + 104 + ], + [ + 8, + 7, + 8, + 235 + ], + [ + 8, + 8, + 7, + 104 + ] + ], + "proxy_saving": 40958.72701043286 + }, + "bit715": { + "counts": [ + [ + 0, + 1, + 8, + 3360 + ], + [ + 1, + 2, + 6, + 88 + ], + [ + 1, + 2, + 8, + 1614 + ], + [ + 2, + 0, + 8, + 4662 + ], + [ + 2, + 1, + 7, + 784 + ], + [ + 2, + 2, + 7, + 784 + ], + [ + 2, + 3, + 7, + 784 + ], + [ + 3, + 4, + 6, + 88 + ], + [ + 3, + 4, + 7, + 784 + ], + [ + 3, + 4, + 8, + 928 + ], + [ + 4, + 0, + 6, + 88 + ], + [ + 4, + 0, + 7, + 784 + ], + [ + 4, + 1, + 8, + 1114 + ], + [ + 4, + 2, + 8, + 3234 + ], + [ + 4, + 3, + 6, + 88 + ], + [ + 4, + 3, + 8, + 4848 + ], + [ + 4, + 5, + 6, + 88 + ], + [ + 5, + 6, + 6, + 88 + ], + [ + 5, + 6, + 8, + 1614 + ], + [ + 6, + 0, + 8, + 186 + ], + [ + 6, + 1, + 6, + 88 + ], + [ + 6, + 1, + 8, + 374 + ], + [ + 6, + 6, + 8, + 3234 + ], + [ + 7, + 8, + 8, + 1680 + ], + [ + 8, + 4, + 8, + 3920 + ], + [ + 8, + 6, + 7, + 777 + ], + [ + 8, + 9, + 8, + 4848 + ], + [ + 8, + 10, + 8, + 1252 + ], + [ + 9, + 5, + 7, + 784 + ], + [ + 9, + 5, + 8, + 4848 + ], + [ + 9, + 6, + 7, + 6 + ], + [ + 9, + 7, + 7, + 784 + ], + [ + 9, + 8, + 8, + 3168 + ], + [ + 9, + 9, + 7, + 784 + ], + [ + 10, + 7, + 6, + 88 + ], + [ + 10, + 7, + 8, + 4848 + ], + [ + 10, + 8, + 6, + 88 + ], + [ + 10, + 8, + 7, + 784 + ], + [ + 10, + 9, + 6, + 88 + ], + [ + 10, + 10, + 6, + 88 + ], + [ + 10, + 10, + 7, + 784 + ], + [ + 10, + 10, + 8, + 236 + ], + [ + 11, + 10, + 8, + 3360 + ] + ], + "proxy_saving": 470531.2626393047 + }, + "complex": { + "counts": [ + [ + 0, + 0, + 9, + 213 + ], + [ + 1, + 2, + 9, + 106 + ], + [ + 2, + 1, + 9, + 213 + ], + [ + 3, + 2, + 9, + 106 + ], + [ + 4, + 3, + 9, + 426 + ], + [ + 5, + 4, + 9, + 106 + ], + [ + 6, + 0, + 9, + 78 + ], + [ + 6, + 2, + 9, + 348 + ], + [ + 7, + 4, + 9, + 106 + ], + [ + 8, + 0, + 9, + 269 + ], + [ + 8, + 1, + 9, + 23 + ], + [ + 8, + 4, + 9, + 348 + ], + [ + 9, + 6, + 9, + 106 + ], + [ + 10, + 1, + 9, + 324 + ], + [ + 10, + 5, + 9, + 316 + ], + [ + 11, + 6, + 9, + 106 + ], + [ + 12, + 3, + 9, + 134 + ], + [ + 12, + 5, + 9, + 87 + ], + [ + 12, + 7, + 9, + 347 + ], + [ + 14, + 6, + 9, + 348 + ], + [ + 14, + 8, + 9, + 78 + ], + [ + 15, + 5, + 9, + 157 + ], + [ + 15, + 8, + 9, + 269 + ], + [ + 16, + 7, + 9, + 213 + ], + [ + 17, + 8, + 9, + 213 + ] + ], + "proxy_saving": 43915.96552502435 + } +} diff --git a/research/cross-copy-hosting-r715/assemble_split11.py b/research/cross-copy-hosting-r715/assemble_split11.py new file mode 100644 index 0000000000..06a12b208c --- /dev/null +++ b/research/cross-copy-hosting-r715/assemble_split11.py @@ -0,0 +1,90 @@ +"""Exact assembly: #472's eleven-stage bit invoice (three-level halving, complete row bound) with the cross-copy hosted +stock, plus #448's cross-copy complex supplier with its #442-style invoice; six bootstrap levels and the 47 strict +outer inequalities. usage: assemble_split11.py VERIFIED472_OUT BIT_DIR COMPLEX_DIR AUDIT.json OUT.json""" +import gzip, hashlib, importlib.util, json, math, sys +from fractions import Fraction as Q +from pathlib import Path +v472, bd, cd, ap, outp = map(Path, sys.argv[1:6]) +parent458 = v472 / 'parent458'; upstream = parent458 / 'parent454/parent451/parent445/parent444/upstream442'; par = upstream / 'parent/changed' +sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'r740-hosted-rank149/code')) # chafreaky's complete row bound, unchanged +def load(name): + sp = importlib.util.spec_from_file_location('hosted_' + name, par / 'work/pr361/code/engines' / (name + '.py')) + mod = importlib.util.module_from_spec(sp); sp.loader.exec_module(mod); return mod +M, Other, Outer = load('moment'), load('base_two_moment'), load('outer') +import row_bound as RB +audit = json.loads(ap.read_text()); bg = json.loads((bd / 'GLOBAL.json').read_text()); ch = json.loads((cd / 'HOSTED.json').read_text()) +assert audit['template_sha256'] == bg['template_sha256'] and audit['complex_template_sha256'] == ch['template_sha256'] +assert json.loads((upstream / 'RECEIPT.json').read_text())['status'] == 'PASS_FULL_IDLE_AXIS_HOSTING_COMPOSITION' +assert json.loads((v472 / 'RECEIPT.json').read_text())['status'].startswith('PASS_R715') +# ---------------- bit (eleven stages, m=78): #472's invoice with the hosted stock, +1 route factor for the split +P = {int(r): n for r, n in audit['profile'].items()}; m, W = 78, audit['live']; E = sum(P.values()) +geo = json.loads((bd / 'GEOMETRY.json').read_text()); pg = bg +T, L, R, V, K = 8, 11, 715, 120, 5 +assert pg['replicas'] == T and pg['R'] == R +mass = sum(r * z for r, z in P.items()); assert m * W - mass == (2 * K * V - L * 72) * T +physical = W + 9; d = m * m; N = 2 * m +unit = L * T * pg['local_additions'] + pg['bridge_additions'] +J = 8 * T * L * (2 * V + R) + 8 * (2 * K * V * T) + 2 * L * T * R + 2 * pg['copy_erase_episodes'] +high = 16 * (d + 1) ** 2; good = 8 * m * m + 8; compiler = 128 * N ** 3 +selectors = 2 * L * T * ((W - 1) + R * m * (geo['max_route_factors'] + 144 + 3 + (m - 1) + m)) # 144: residual isometry; +3: hosted slot permutation, U_q and the cross-copy split +prefix = int(pg['global_prefix_bound']); charged_prefix = 64 * ((prefix.bit_length() + 63) // 64) +assert prefix < 1 << charged_prefix and charged_prefix == pg['charged_prefix_bits'] and audit['physical_prefix_bits'] == prefix.bit_length() +coefficient = unit + J * high + J * physical + E * (good + compiler) + 16 * m ** 3 + pg['copy_erase_episodes'] + selectors + prefix + 1 +two = (coefficient + 1) ** 3 * (E + 1) ** 3; charged_two = 64 * ((two.bit_length() + 63) // 64) +assert two < 1 << charged_two and 2 * max(P) ** 3 < m ** 3 +assert coefficient < 1 << 100000 and 32 * m * (coefficient + 1) ** 2 < 1 << 210000 +rows = RB.bound(m, physical, max(P), 3); row = rows['complete_row_coefficient']; assert row < 20161 +row_rejected = RB.controls() +root = M.certify(P, m, W, True); c = Q(root['lower']); chi = Q(root['upper']) +fb = 32 * m * m * E +lo, hi = Other.moment(m, W, list(P.items()), c); bl, bh = Other.moment(m, W, [(1, fb)], c); assert hi + bh / 10 ** 16 < 1 +lo2, hi2 = Other.moment(m, W, list(P.items()), chi); bl2, bh2 = Other.moment(m, W, [(1, fb)], chi); assert lo2 + bl2 / 10 ** 16 > 1 +# ---------------- complex (#448's cross-copy hosted #433 word, nine stages, m=73): #442's invoice with the hosted stock +PC = {int(r): n for r, n in audit['complex_profile'].items()}; mc, WC = 73, audit['complex_live']; EC = sum(PC.values()) +massc = sum(r * z for r, z in PC.items()); assert mc * WC - massc == 2496 +rc = M.certify(PC, mc, WC, True); b = Q(int(Q(rc['lower']) * 10 ** 18), 10 ** 18) +fbc = 32 * mc * mc * EC +l3, h3 = Other.moment(mc, WC, list(PC.items()), b); b3, bh3 = Other.moment(mc, WC, [(1, fbc)], b); assert h3 + bh3 / 10 ** 16 < 1 +integ = json.loads((par / 'split-centres/INTEGRATION.json').read_text()); inv = integ['finite_invoice'] +physc = ch['physical']; compilerc = 64 * (mc + 1) ** 3 +pervertex = inv['pervertex'] - integ['physical'] * (64 + 1) + physc * (64 + 1) - integ['live'] + WC +r_ = mc // 2; group = 2 ** (r_ * r_) * math.prod(2 ** (2 * i) - 1 for i in range(1, r_ + 1)); stock = group * physc +smass = group * massc; logical = group * max(pervertex, inv['pervertex']) + 64; router = compilerc * (logical + 1) * (stock + 1) ** 2 +GG, EE, C0 = 1 << 30000, 1 << 100000, 1 << 210000; BB = smass + EE +literal = 2 * GG * stock ** 2 + 8 * smass + 4 * stock + 4 + 32 * mc +assert logical < 1 << 6050 and router < GG and literal < EE and BB < 1 << 100001 and 32 * mc * BB * BB < C0 and 2 * BB + 18 < C0 +depth = 2; assert mc ** depth > 2 * max(PC) ** depth +rowc = depth * stock.bit_length() + 9909 + 252; assert rowc < 20161 +# ---------------- outer assembly exactly as #434's combined.py +eta = beta = Q(1, 10 ** 18); grid = Q(1, 10 ** 18); s = min(c, (1 - beta) * b) - Q(1, 10 ** 24) +assert 0 < s < c and s < (1 - beta) * b +chain = [Q(384599, 10 ** 10)]; cutoffs = [] +def ceil(x): return -((-x.numerator) // x.denominator) +for j in range(6): + old = chain[-1]; a = (1 - s) * s + s * old + gap = min(s - a, 1 - a - s, 1 - a - s * (1 - old), 1 - s); assert old < a < s < 1 - a and gap > 0 + cutoff = max(ceil(36 / gap ** 2), ceil(2 * (4 + charged_two) / gap)); assert cutoff * gap ** 2 >= 36 and cutoff * gap >= 2 * (4 + charged_two) + cutoffs.append(dict(gap=str(gap), cutoff_log2=str(cutoff))); chain.append(a) +q = chain[-1] * (1 - 2 * eta); margin = (1 - eta) * q / (1 + q); ticks = margin / grid; k = grid * ((ticks.numerator - 1) // ticks.denominator) +bridge = {'semantic': {'C0': {'base': 2, 'exponent': 210000}, 'strict_literal_gap': 1}, 'rows': {'degree_gap': Q(10 ** 6) - Q(51 * 20161, 25)}} +a = Outer.assembly(chain[-1], b, bridge, k, eta=eta, beta=beta) +assert len(a['strict_constraints']) == 47 and all(x > 0 for x in a['strict_constraints'].values()) +controls = [] +for name, kk, ee, bb in [('next_grid', k + grid, eta, beta), ('zero_eta', k, Q(0), beta), ('zero_beta', k, eta, Q(0)), ('unit_beta', k, eta, Q(1))]: + try: Outer.assembly(chain[-1], b, bridge, kk, eta=ee, beta=bb) + except AssertionError: controls.append(name) + else: raise AssertionError(name) +parent_k = Q(json.loads((v472 / 'RESULT.json').read_text())['kappa']) +res = dict(status='PASS_CONDITIONAL_CROSS_COPY_ELEVEN_STAGE_R715_ASSEMBLY', kappa=str(k), kappa_decimal=format(float(k), '.18f'), + bit_lower=str(c), complex_lower=str(b), binding_component='bit' if c < (1 - beta) * b else 'complex', + gain_over_pr472_percent=float(100 * (k / parent_k - 1)), + bit=dict(live=W, physical=physical, maxchild=max(P), rank_mass=mass, hosted_residuals=audit['hosted_residuals'], split_residuals=audit['split_residuals'], + prefix_bits=prefix.bit_length(), charged_prefix_bits=charged_prefix, coefficient_bits=coefficient.bit_length(), + three_level_coefficient_bits=two.bit_length(), charged_three_level_coefficient_bits=charged_two, row_coefficient=row, row_controls_rejected=row_rejected), + complex=dict(live=WC, physical=physc, maxchild=max(PC), rank_mass=massc, hosted_residuals=audit['complex_hosted_residuals'], split_residuals=audit['complex_split_residuals'], + physical_stock_bits=stock.bit_length(), router_bits=router.bit_length(), literal_bits=literal.bit_length(), row_coefficient=rowc), + strict_outer_constraints={n: str(x) for n, x in a['strict_constraints'].items()}, outer_controls=controls, bootstrap=cutoffs, + bit_template_sha256=bg['template_sha256'], complex_template_sha256=ch['template_sha256'], emitted_program_sha256=bg['emitted_program_sha256'], + parent_kappa=str(parent_k), additional_interface='PR442 idle-data hosting during untouched windows, with PR448 cross-copy slots (one residual on two copies of one idle child)') +outp.write_text(json.dumps(res, indent=2) + '\n') +print(res['status'], res['kappa_decimal'], 'binding', res['binding_component'], 'gain over #472 %.4f%%' % res['gain_over_pr472_percent']) diff --git a/research/cross-copy-hosting-r715/audit_split.py b/research/cross-copy-hosting-r715/audit_split.py new file mode 100644 index 0000000000..ce80cf4e1d --- /dev/null +++ b/research/cross-copy-hosting-r715/audit_split.py @@ -0,0 +1,158 @@ +"""Independent audit of the two cross-copy hosted templates (no code shared with the generators). +Re-derives the windows from each template's schedule and checks, per replica and invocation: every helper residual has +exactly one owner record; a hosted residual's pieces (one or two) lie on data families of the idle child they name, +inside that child's pending coordinates, on copies of the same child, with piece widths summing to the residual width, +pairwise disjoint per (child, copy), with the invocation strictly inside the window and off the active pair; remainder +children exact; banks tiled exactly (bit) or padded (complex); profile, live stock and deficit 2496 recomputed. +usage: audit_split.py PARENT_CHANGED_DIR BIT_DIR COMPLEX_DIR OUT.json""" +import copy, gzip, hashlib, json, sys +from collections import Counter, defaultdict +from pathlib import Path +V, K, T, L = 120, 4, 8, 9 +DATA = 2 * K * V * T +def wins(events): + last = {}; seen = []; w = {} + for pos, e in enumerate(events): + if e[0] == 'local': seen.append((pos, e[1], e[2])); last[e[2]] = pos + elif e[0] == 'bridge': last[e[1]] = pos; last[e[2]] = pos + else: + lo = last.get(e[2], -1); w[e[1]] = {s for q, s, p in seen if lo < q < pos and p != e[2]} + return w +def check_pieces(hs, W, rank, widths, copies): + used = defaultdict(set); hosted = {} + for s, h, i, segs in hs['pieces']: + assert s in W[i], ('window', i, s); assert 1 <= len(segs) <= 2 + assert sum(w for _, _, w in segs) == widths[h] and all(w > 0 for _, _, w in segs) + for cp, off, w in segs: + assert 0 <= cp < copies and 0 <= off and off + w <= rank[i] + cells = set(range(off, off + w)); assert not cells & used[i, cp], ('overlap', i, cp); used[i, cp] |= cells + assert (s, h) not in hosted; hosted[s, h] = (i, segs) + return used, hosted +def audit_bit(t, parent_t, widths): + assert t['local_programs'] == parent_t['local_programs'] and len(t['calls']) == 72 + ev = []; rank = {}; pair = {} + for e in t['schedule']: + if e['kind'] == 'local_cover_sweep': ev.append(('local', e['stage'], e['pair'])) + elif e['kind'] == 'bridge': ev.append(('bridge', e['dst'], e['src'])) + elif e['kind'] == 'idle': ev.append(('idle', e['idx'], e['pair'])); rank[e['idx']] = e['rank']; pair[e['idx']] = e['pair'] + W = wins(ev); hs = t['hosting'] + used, hosted = check_pieces(hs, W, rank, widths, 2 * V) + rem = {} + for i in rank: + if rank[i] == 0: continue + for cp in range(2 * V): rem[i, cp] = rank[i] - len(used[i, cp]) + rr = Counter(rem[i, cp] for cp in range(2 * V)) + if str(i) in hs['remainders']: assert {int(k): v for k, v in hs['remainders'][str(i)].items()} == dict(rr) + else: assert rr == Counter({rank[i]: 2 * V}) + occ = defaultdict(set); LIVE = t['live'] + for c in t['calls']: + s, rep, p = c['stage'], c['replica'], c['pair']; own = c['owners']; assert len(own) == 2 * V + len(widths) + assert own[:2 * V] == next(q for q in parent_t['calls'] if (q['stage'], q['replica']) == (s, rep))['owners'][:2 * V] + for h, (f, r) in enumerate(own[2 * V:]): + if (s, h) in hosted: + i, segs = hosted[s, h]; fam = lambda cp: rep * 960 + (2 * pair[i] + cp // V) * V + cp % V + assert pair[i] != p + if len(segs) == 1: + cp, off, w = segs[0]; assert r == ['hosted', i, off, w] and f == fam(cp) + else: + (c1, o1, w1), (c2, o2, w2) = segs; assert c1 != c2 + assert r == ['hosted-split', i, o1, w1, fam(c2), o2, w2] and f == fam(c1) + else: + assert r[0] == 'bank' and r[2] == widths[h] and DATA <= f < LIVE + cells = set(range(r[1], r[1] + r[2])); assert cells <= set(range(64)) and not cells & occ[f]; occ[f] |= cells + banks = sorted(occ); assert banks == list(range(DATA, LIVE)) and all(occ[f] == set(range(64)) for f in banks) + paid = Counter() + for c in t['calls']: + for z in t['local_programs'][c['orientation']]: + if z[0] == 0 and z[4]: paid[z[4]] += 1 + if z[0] == 2: paid[z[5]] += 1 + for (i, cp), r_ in rem.items(): + if r_: paid[r_] += T + mass = sum(r * n for r, n in paid.items()); assert 64 * LIVE - mass == 2496 + assert 64 * 64 > 2 * max(paid) ** 2 + return paid, len(hosted) * T, sum(1 for _, segs in hosted.values() if len(segs) == 2) * T +def audit_complex(t, parent_t, local_checks): + R = 560; m = 73 + assert t['local_programs'] == parent_t['local_programs'] and len(t['calls']) == 72 + prank = {} + for it in parent_t['idle_children']: prank.setdefault(it['child'], it['rank']) + stage_pair = {e['stage']: e['pair'] for e in t['recipe'] if e['kind'] == 'local'} + ev = []; side = {}; pairs = {} + for e in t['execution_schedule']: + if e['kind'] == 'local_cover_sweep': ev.append(('local', e['stage'], stage_pair[e['stage']])) + elif e['kind'] == 'bridge': ev.append(('bridge', e['dst'], e['src'])) + elif e['kind'] == 'idle_cover_sweep': + for sd, ch in enumerate(e['child_indices']): + if ch in prank: ev.append(('idle', ch, e['pair'])); side[ch] = sd; pairs[ch] = e['pair'] + W = wins(ev); hs = t['hosting'] + used, hosted = check_pieces(hs, W, prank, [9] * R, V) + rem = {} + for it in parent_t['idle_children']: rem[it['child'], it['port']] = it['rank'] - len(used[it['child'], it['port']]) + got = {(it['child'], it['port']): it['rank'] for it in t['idle_children']} + assert got == {k: r for k, r in rem.items() if r} and all(it['replicas'] == T for it in t['idle_children']) + LIVE = t['live']; occ = defaultdict(set) + for c in t['calls']: + s, rep, p = c['stage'], c['replica'], c['pair']; own = c['owners']; assert len(own) == 2 * V + R + assert own[:2 * V] == next(q for q in parent_t['calls'] if (q['stage'], q['replica']) == (s, rep))['owners'][:2 * V] + for h, (f, r) in enumerate(own[2 * V:]): + if (s, h) in hosted: + i, segs = hosted[s, h]; fam = lambda port: rep * 960 + (2 * pairs[i] + side[i]) * V + port + assert pairs[i] != p + if len(segs) == 1: + port, off, w = segs[0]; assert r == [3, i, off] and f == fam(port) and w == 9 + else: + (p1, o1, w1), (p2, o2, w2) = segs; assert p1 != p2 + assert r == [5, i, o1, w1, fam(p2), o2, w2] and f == fam(p1) + else: + assert r[0] == 2 and 0 <= r[1] < 8 and DATA <= f < LIVE and r[1] not in occ[f]; occ[f].add(r[1]) + banks = sorted(occ); assert banks == list(range(DATA, LIVE)) + paid = Counter() + for c in t['calls']: + for r_, z in local_checks[c['orientation']]['paid_profile'].items(): paid[int(r_)] += z + for (ch, port), r_ in rem.items(): + if r_: paid[r_] += T + for f in banks: paid[m - 9 * len(occ[f])] += 1 + mass = sum(r * n for r, n in paid.items()); assert m * LIVE - mass == 2496 + assert m * m > 2 * max(paid) ** 2 + return paid, len(hosted) * T, sum(1 for _, segs in hosted.values() if len(segs) == 2) * T +def main(): + par, bd, cd, outp = map(Path, sys.argv[1:5]) + pbt = json.loads(gzip.decompress((par / 'bit426-source-centres/global/GLOBAL-TEMPLATE.json.gz').read_bytes())) + bt = json.loads(gzip.decompress((bd / 'GLOBAL-TEMPLATE.json.gz').read_bytes())); bg = json.loads((bd / 'GLOBAL.json').read_text()) + assert hashlib.sha256(gzip.decompress((bd / 'GLOBAL-TEMPLATE.json.gz').read_bytes())).hexdigest() == bg['template_sha256'] + st = json.loads((par / 'bit426-source-centres/records/249-states.json').read_text()) + fs = json.loads((par / 'bit426-source-centres/records/frames.json').read_text())['frames'] + widths = [8 - fs[str(st['initial'][str(i)])]['dim'] for i in range(240, 987)] + pct = json.loads(gzip.decompress((par / 'split-centres/GLOBAL-TEMPLATE.json.gz').read_bytes())) + ct = json.loads(gzip.decompress((cd / 'GLOBAL-TEMPLATE.json.gz').read_bytes())); ch = json.loads((cd / 'HOSTED.json').read_text()) + assert hashlib.sha256(gzip.decompress((cd / 'GLOBAL-TEMPLATE.json.gz').read_bytes())).hexdigest() == ch['template_sha256'] + lc = json.loads((par / 'split-centres/LOCAL-CHECKS.json').read_text()) + bp, bh, bs = audit_bit(bt, pbt, widths); assert bp == Counter({int(k): v for k, v in bg['profile'].items()}) + cp, chh, cs = audit_complex(ct, pct, lc); assert cp == Counter({int(k): v for k, v in ch['global_profile'].items()}) + controls = [] + def reject(name, fn, which): + q = copy.deepcopy(bt if which == 'bit' else ct); fn(q) + try: (audit_bit(q, pbt, widths) if which == 'bit' else audit_complex(q, pct, lc)) + except (AssertionError, KeyError, IndexError, StopIteration, ValueError): controls.append(name) + else: raise AssertionError('mutation accepted: ' + name) + def first_split(q): return next(pc for pc in q['hosting']['pieces'] if len(pc[3]) == 2) + def outside(q): + pc = q['hosting']['pieces'][0]; pc[0] = next(s for s in range(9) if s not in q['hosting']['windows'][str(pc[2])][2]) + reject('bit: hosted residual outside its window', outside, 'bit') + reject('bit: split piece widths do not sum to the residual width', lambda q: first_split(q)[3][1].__setitem__(2, first_split(q)[3][1][2] + 1), 'bit') + reject('bit: split pieces on two different children', lambda q: (lambda pc: q['hosting']['pieces'].__setitem__(q['hosting']['pieces'].index(pc), [pc[0], pc[1], (pc[2] + 1) % 9 if (pc[2] + 1) % 9 in [int(k) for k in q['hosting']['windows']] else 0, pc[3]]))(first_split(q)), 'bit') + reject('bit: overlapping hosted coordinates', lambda q: q['hosting']['pieces'][1][3][0].__setitem__(1, q['hosting']['pieces'][0][3][0][1]) if q['hosting']['pieces'][1][3][0][0] == q['hosting']['pieces'][0][3][0][0] and q['hosting']['pieces'][1][2] == q['hosting']['pieces'][0][2] else q['hosting']['pieces'][1][3][0].__setitem__(0, q['hosting']['pieces'][0][3][0][0]) or q['hosting']['pieces'][1][3][0].__setitem__(1, q['hosting']['pieces'][0][3][0][1]), 'bit') + reject('bit: understated live stock', lambda q: q.__setitem__('live', q['live'] - 1), 'bit') + reject('bit: hosted owner on the active pair', lambda q: q['calls'][0]['owners'].__setitem__(240 + next(h for h in range(747) if q['calls'][0]['owners'][240 + h][1][0] == 'hosted'), [0, ['hosted', 0, 0, 8]]), 'bit') + reject('bit: missing remainder child', lambda q: q['hosting']['pieces'].pop(), 'bit') + reject('complex: hosted residual outside its window', outside, 'complex') + reject('complex: split piece widths do not sum to nine', lambda q: first_split(q)[3][0].__setitem__(2, first_split(q)[3][0][2] + 1), 'complex') + reject('complex: remainder child understated', lambda q: q['idle_children'][0].__setitem__('rank', q['idle_children'][0]['rank'] - 1), 'complex') + reject('complex: dropped bank', lambda q: q.__setitem__('live', q['live'] - 1), 'complex') + reject('complex: duplicated hosted residual', lambda q: q['hosting']['pieces'].append(list(q['hosting']['pieces'][0])), 'complex') + res = dict(status='PASS_INDEPENDENT_CROSS_COPY_HOSTING_AUDIT', bit_template_sha256=bg['template_sha256'], complex_template_sha256=ch['template_sha256'], + bit_profile={str(k): v for k, v in sorted(bp.items())}, complex_profile={str(k): v for k, v in sorted(cp.items())}, + bit_live=bt['live'], complex_live=ct['live'], bit_hosted_residuals=bh, complex_hosted_residuals=chh, + bit_split_residuals=bs, complex_split_residuals=cs, bit_maxchild=max(bp), complex_maxchild=max(cp), mutations_rejected=controls) + outp.write_text(json.dumps(res, indent=2) + '\n'); print(json.dumps({k: v for k, v in res.items() if 'profile' not in k})) +if __name__ == '__main__': main() diff --git a/research/cross-copy-hosting-r715/audit_split11.py b/research/cross-copy-hosting-r715/audit_split11.py new file mode 100644 index 0000000000..02010b9109 --- /dev/null +++ b/research/cross-copy-hosting-r715/audit_split11.py @@ -0,0 +1,136 @@ +"""Independent audit of the cross-copy hosted eleven-stage R715 bit template (8 pooled replicas) and of the cross-copy +hosted complex template; no code shared with the generators. +usage: audit_split11.py PARENT_BIT_DIR LOCAL_DIR BIT_DIR UPSTREAM442_CHANGED COMPLEX_DIR OUT.json""" +import copy, gzip, hashlib, json, sys +from collections import Counter, defaultdict +from pathlib import Path +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from audit_split import audit_complex, check_pieces, wins +V, K, L, T, R, M = 120, 5, 11, 8, 715, 78 +LOCAL = 2 * V + R; DATA = 2 * K * V * T +def digest(t): + h = hashlib.sha256(); n = 0 + for call in t['calls']: + for z in t['local_programs'][call['orientation']]: + x = [z[0], call['owners'][z[1]]] + if z[0] == 0: x.extend(z[2:]) + else: x.append(call['owners'][z[2]] if z[2] < LOCAL else [t['live'], ['private', 0]]); x.extend(z[3:]) + h.update(json.dumps(x, separators=(',', ':')).encode()); h.update(b'\n'); n += 1 + return h.hexdigest(), n +def prefix_bits(t): + live = t['live']; norm = [1] * live + [0]; prefix = 1; callmap = {(c['stage'], c['replica']): c for c in t['calls']} + fams = lambda o: [o[0]] + ([o[1][4]] if o[1][0] == 'hosted-split' else []) + for e in t['schedule']: + if e['kind'] == 'local_cover_sweep': + for rep in range(T): + call = callmap[e['stage'], rep]; own = call['owners'] + for z in t['local_programs'][call['orientation']]: + if z[0] == 0: continue + xs = fams(own[z[1]]); ys = fams(own[z[2]]) if z[2] < LOCAL else [live] + if z[0] == 1: + inc = abs(z[3]) * max(norm[y] for y in ys) + for x in xs: norm[x] += inc; prefix = max(prefix, norm[x]) + elif z[0] == 2: norm[live] = max(norm[x] for x in xs); prefix = max(prefix, norm[live]) + else: norm[live] = 0 + elif e['kind'] == 'bridge': + d, ss = e['dst'], e['src'] + for rep in range(T): + for port in range(V): + for x, y in [(rep * 1200 + 2 * d * V + port, rep * 1200 + 2 * ss * V + port), (rep * 1200 + (2 * ss + 1) * V + port, rep * 1200 + (2 * d + 1) * V + port)]: + norm[x] += norm[y]; prefix = max(prefix, norm[x]) + assert norm[live] == 0 + return prefix.bit_length() +def audit_bit(t, parent_t, widths): + mutable = {'version', 'live', 'hosting', 'helper_route', 'calls', 'schedule'} + assert set(t) == set(parent_t) + assert {k: v for k, v in t.items() if k not in mutable} == {k: v for k, v in parent_t.items() if k not in mutable} + assert t['replicas'] == T and t['m'] == M and t['stages'] == L and t['live'] == DATA and len(t['calls']) == L * T + assert t['schedule'] == parent_t['schedule'] + ev = []; rank = {}; pair = {} + for e in t['schedule']: + if e['kind'] == 'local_cover_sweep': ev.append(('local', e['stage'], e['pair'])) + elif e['kind'] == 'bridge': ev.append(('bridge', e['dst'], e['src'])) + elif e['kind'] == 'idle': ev.append(('idle', e['idx'], e['pair'])); rank[e['idx']] = e['rank']; pair[e['idx']] = e['pair'] + W = wins(ev); hs = t['hosting']; copies = 2 * V * T + assert hs['windows'] == {str(i): [pair[i], rank[i], sorted(W[i])] for i in W if rank[i] > 0 and W[i]} + wid = [widths[h % R] for h in range(R * T)] + used, hosted = check_pieces(hs, W, rank, wid, copies) + assert set(hosted) == {(s, h) for s in range(L) for h in range(R * T)} + rem = {} + for i in rank: + if rank[i] == 0: continue + for cp in range(copies): rem[i, cp] = rank[i] - len(used[i, cp]) + rr = Counter(rem[i, cp] for cp in range(copies)) + if str(i) in hs['remainders']: assert {int(k): v for k, v in hs['remainders'][str(i)].items()} == dict(rr) + else: assert rr == Counter({rank[i]: copies}) + assert {(c['stage'], c['replica']) for c in t['calls']} == {(s, r) for s in range(L) for r in range(T)} + fam = lambda i, cp: (cp // (2 * V)) * (2 * K * V) + (2 * pair[i] + (cp % (2 * V)) // V) * V + cp % V + for c, pc in zip(t['calls'], parent_t['calls']): + assert {k: v for k, v in c.items() if k != 'owners'} == {k: v for k, v in pc.items() if k != 'owners'} + s, rep, p = c['stage'], c['replica'], c['pair']; own = c['owners']; assert len(own) == LOCAL and own[:2 * V] == pc['owners'][:2 * V] + for r, (f, rt) in enumerate(own[2 * V:]): + i, segs = hosted[s, rep * R + r]; assert pair[i] != p and 0 <= f < DATA + if len(segs) == 1: + cp, off, w = segs[0]; assert rt == ['hosted', i, off, w] and f == fam(i, cp) + else: + (c1, o1, w1), (c2, o2, w2) = segs; assert c1 != c2 + assert rt == ['hosted-split', i, o1, w1, fam(i, c2), o2, w2] and f == fam(i, c1) + assert len({(f, tuple(rt)) for f, rt in own}) == LOCAL + paid = Counter() + for c in t['calls']: + for z in t['local_programs'][c['orientation']]: + if z[0] == 0 and z[4]: paid[z[4]] += 1 + if z[0] == 2: paid[z[5]] += 1 + for (i, cp), r_ in rem.items(): + if r_: paid[r_] += 1 + mass = sum(r * n for r, n in paid.items()); assert M * DATA - mass == (2 * K * V - L * 72) * T + assert M ** 3 > 2 * max(paid) ** 3 + return paid, len(hosted), sum(1 for _, segs in hosted.values() if len(segs) == 2) +def main(): + par, local, bd, chg, cd, outp = map(Path, sys.argv[1:7]) + tpl = lambda p: json.loads(gzip.decompress(Path(p).read_bytes())) + pbt = tpl(par / 'GLOBAL-TEMPLATE.json.gz'); pg = json.loads((par / 'GLOBAL.json').read_text()) + bt = tpl(bd / 'GLOBAL-TEMPLATE.json.gz'); bg = json.loads((bd / 'GLOBAL.json').read_text()) + th = hashlib.sha256(gzip.decompress((bd / 'GLOBAL-TEMPLATE.json.gz').read_bytes())).hexdigest() + assert th == bg['template_sha256'] and bg['parent_template_sha256'] == pg['template_sha256'] + st = json.loads((local / 'records/249-states.json').read_text()); fs = json.loads((local / 'records/frames.json').read_text())['frames'] + widths = [8 - fs[str(st['initial'][str(h)])]['dim'] for h in range(2 * V, LOCAL)] + bp, bh, bs = audit_bit(bt, pbt, widths); assert bp == Counter({int(k): v for k, v in bg['profile'].items()}) + assert bg['hosted_residuals'] == bh and bg['live'] == bt['live'] and bg['split_residuals'] == bs + dg, n = digest(bt); assert dg == bg['emitted_program_sha256'] and n == bg['emitted_events'] == pg['emitted_events'] and dg != pg['emitted_program_sha256'] + pb = prefix_bits(bt); assert pb == bg['global_prefix_bits'] + pct = tpl(chg / 'split-centres/GLOBAL-TEMPLATE.json.gz'); ct = tpl(cd / 'GLOBAL-TEMPLATE.json.gz'); ch = json.loads((cd / 'HOSTED.json').read_text()) + assert hashlib.sha256(gzip.decompress((cd / 'GLOBAL-TEMPLATE.json.gz').read_bytes())).hexdigest() == ch['template_sha256'] + lc = json.loads((chg / 'split-centres/LOCAL-CHECKS.json').read_text()) + cp, chh, cs = audit_complex(ct, pct, lc); assert cp == Counter({int(k): v for k, v in ch['global_profile'].items()}) + controls = [] + def reject(name, fn, which): + q = copy.deepcopy(bt if which == 'bit' else ct); fn(q) + try: (audit_bit(q, pbt, widths) if which == 'bit' else audit_complex(q, pct, lc)) + except (AssertionError, KeyError, IndexError, StopIteration, ValueError, TypeError): controls.append(name) + else: raise AssertionError('mutation accepted: ' + name) + def first_split(q): return next(pc for pc in q['hosting']['pieces'] if len(pc[3]) == 2) + def outside(q): + pc = q['hosting']['pieces'][0]; pc[0] = next(s for s in range(L) if s not in q['hosting']['windows'][str(pc[2])][2]) + reject('bit: hosted residual outside its window', outside, 'bit') + reject('bit: split piece widths do not sum to the residual width', lambda q: first_split(q)[3][1].__setitem__(2, first_split(q)[3][1][2] + 1), 'bit') + reject('bit: split pieces on two different children', lambda q: first_split(q).__setitem__(2, (first_split(q)[2] + 1) % len(q['hosting']['windows'])), 'bit') + reject('bit: overlapping hosted coordinates', lambda q: q['hosting']['pieces'][1][3][0].__setitem__(0, q['hosting']['pieces'][0][3][0][0]) or q['hosting']['pieces'][1][3][0].__setitem__(1, q['hosting']['pieces'][0][3][0][1]), 'bit') + reject('bit: overstated live stock', lambda q: q.__setitem__('live', q['live'] + 1), 'bit') + reject('bit: hosted owner on the active pair', lambda q: q['calls'][0]['owners'].__setitem__(240, [q['calls'][0]['pair'] * V * 2, ['hosted', 0, 0, 8]]), 'bit') + reject('bit: missing hosted residual', lambda q: q['hosting']['pieces'].pop(), 'bit') + reject('bit: changed idle rank', lambda q: next(e for e in q['schedule'] if e['kind'] == 'idle').__setitem__('rank', 1), 'bit') + reject('bit: wrong owner family', lambda q: q['calls'][0]['owners'].__setitem__(241, [q['calls'][0]['owners'][241][0] + 1, q['calls'][0]['owners'][241][1]]), 'bit') + reject('bit: changed local program', lambda q: q['local_programs']['forward'].pop(), 'bit') + reject('complex: hosted residual outside its window', outside, 'complex') + reject('complex: split piece widths do not sum to nine', lambda q: first_split(q)[3][0].__setitem__(2, first_split(q)[3][0][2] + 1), 'complex') + reject('complex: remainder child understated', lambda q: q['idle_children'][0].__setitem__('rank', q['idle_children'][0]['rank'] - 1), 'complex') + reject('complex: dropped bank', lambda q: q.__setitem__('live', q['live'] - 1), 'complex') + reject('complex: duplicated hosted residual', lambda q: q['hosting']['pieces'].append(list(q['hosting']['pieces'][0])), 'complex') + res = dict(status='PASS_INDEPENDENT_CROSS_COPY_ELEVEN_STAGE_AUDIT', template_sha256=th, emitted_program_sha256=dg, emitted_events=n, + profile={str(k): v for k, v in sorted(bp.items())}, live=bt['live'], physical=bt['live'] + 9, hosted_residuals=bh, split_residuals=bs, + physical_prefix_bits=pb, rank_mass=sum(r * z for r, z in bp.items()), deficit=(2 * K * V - L * 72) * T, maxchild=max(bp), + complex_template_sha256=ch['template_sha256'], complex_profile={str(k): v for k, v in sorted(cp.items())}, complex_live=ct['live'], + complex_hosted_residuals=chh, complex_split_residuals=cs, complex_maxchild=max(cp), mutations_rejected=controls) + outp.write_text(json.dumps(res, indent=2) + '\n'); print(json.dumps({k: v for k, v in res.items() if 'profile' not in k})) +if __name__ == '__main__': main() diff --git a/research/cross-copy-hosting-r715/bit_split11.py b/research/cross-copy-hosting-r715/bit_split11.py new file mode 100644 index 0000000000..ad54bf2925 --- /dev/null +++ b/research/cross-copy-hosting-r715/bit_split11.py @@ -0,0 +1,131 @@ +"""Cross-copy idle-axis hosting for #472's eleven-stage R715 bit template (m=78, K=5, 8 pooled replicas). +Reads #472's emitted whole-hosted template (code/emit.py output), keeps every local program, data owner, isometry +and bridge, and re-hosts every helper residual on the tape of each child's 2V*T pooled copies; a residual may be +split across two copies of the same child. Recomputes paid profile, remainders, emitted digest and the physical +prefix bound. usage: bit_split11.py PARENT_BIT_DIR LOCAL_DIR OUT [--discover]""" +import gzip, hashlib, json, math, sys, time +from collections import Counter +from pathlib import Path +HERE = Path(__file__).resolve().parent; sys.path.insert(0, str(HERE)) +import tape_core as TC +H, V, R, L, K, T, M = 8, 120, 715, 11, 5, 8, 78 +LOCAL = 2 * V + R; DATA = 2 * K * V * T; LIVE = DATA +DISCOVER = False +def digest(t): + h = hashlib.sha256(); n = 0 + for call in t['calls']: + own = call['owners'] + for z in t['local_programs'][call['orientation']]: + if z[0] == 0: x = [z[0], own[z[1]], *z[2:]] + else: x = [z[0], own[z[1]], own[z[2]] if z[2] < LOCAL else [t['live'], ['private', 0]], *z[3:]] + h.update((json.dumps(x, separators=(',', ':')) + '\n').encode()); n += 1 + return h.hexdigest(), n +def prefix_bound(t): + """physical-family norm growth in chronological order; a split owner updates both of its families""" + live = t['live']; norm = [1] * live + [0]; prefix = 1 + callmap = {(c['stage'], c['replica']): c for c in t['calls']} + fams = lambda o: [o[0]] + ([o[1][4]] if o[1][0] == 'hosted-split' else []) + for e in t['schedule']: + if e['kind'] == 'local_cover_sweep': + for rep in range(T): + call = callmap[e['stage'], rep]; own = call['owners'] + for z in t['local_programs'][call['orientation']]: + op = z[0] + if op == 0: continue + xs = fams(own[z[1]]); ys = fams(own[z[2]]) if z[2] < LOCAL else [live] + if op == 1: + inc = abs(z[3]) * max(norm[y] for y in ys) + for x in xs: norm[x] += inc; prefix = max(prefix, norm[x]) + elif op == 2: norm[live] = max(norm[x] for x in xs); prefix = max(prefix, norm[live]) + else: norm[live] = 0 + elif e['kind'] == 'bridge': + d, ss = e['dst'], e['src'] + for rep in range(T): + for port in range(V): + for x, y in [(rep * 1200 + 2 * d * V + port, rep * 1200 + 2 * ss * V + port), (rep * 1200 + (2 * ss + 1) * V + port, rep * 1200 + (2 * d + 1) * V + port)]: + norm[x] += norm[y]; prefix = max(prefix, norm[x]) + assert norm[live] == 0 + return prefix +def main(parent, local, out): + t0 = time.monotonic(); out.mkdir(parents=True, exist_ok=False) + blob = gzip.decompress((parent / 'GLOBAL-TEMPLATE.json.gz').read_bytes()); t = json.loads(blob) + g = json.loads((parent / 'GLOBAL.json').read_text()); assert hashlib.sha256(blob).hexdigest() == g['template_sha256'] + assert g['replicas'] == T and g['R'] == R and t['m'] == M and t['stages'] == L + st = json.loads((local / 'records/249-states.json').read_text()) + fs = json.loads((local / 'records/frames.json').read_text())['frames']; dims = {int(f): z['dim'] for f, z in fs.items()} + width = [H - dims[st['initial'][str(i)]] for i in range(2 * V, LOCAL)] + sched = []; idx = 0 + for e in t['schedule']: + if e['kind'] == 'local_cover_sweep': sched.append(dict(kind='local', stage=e['stage'], pair=e['pair'])) + elif e['kind'] == 'bridge': sched.append(dict(kind='bridge', dst=e['dst'], src=e['src'])) + elif e['kind'] == 'idle': assert e['idx'] == idx; sched.append(dict(kind='idle', pair=e['pair'], rank=e['rank'], idx=idx)); idx += 1 + win = {k: x for k, x in TC.windows(sched).items() if x[1] > 0 and x[2]} + copies = 2 * V * T # pooled: every copy of every replica is a host + avail = Counter() + for s in range(L): + for rep in range(T): + for w in width: avail[s, w] += 1 + sel = HERE / 'SELECTION.json'; key = 'bit715' + if DISCOVER: + counts, val = TC.solve(win, copies, dict(avail), M, sorted({w for (_, w) in avail}, reverse=True), dict(vars=lambda st: [], rows=lambda *a: [])) + TC.save(sel, key, counts, val) + counts, val = TC.load(sel, key) + # complete the integer programme's choice: place any residual it left out on an in-window child with room (largest ln(m/r) first) + hostedc = Counter(); usedc = Counter() + for (i, s, w), n in counts.items(): hostedc[s, w] += n; usedc[i] += w * n + for (s, w), a in sorted(avail.items()): + for _ in range(a - hostedc[s, w]): + i = max((i for i in win if s in win[i][2] and usedc[i] + w <= win[i][1] * copies), key=lambda i: math.log(M / win[i][1])) + counts[i, s, w] = counts.get((i, s, w), 0) + 1; usedc[i] += w + helpers = {s: [(i, width[i % R]) for i in range(R * T)] for s in range(L)} # helper index i = rep*R + r + pieces, rem = TC.expand(win, counts, helpers, copies) + assert len(pieces) == L * R * T, ('every residual must be hosted', len(pieces), L * R * T) + split = 0 + fam = lambda i, cp: (lambda owner_rep, within: owner_rep * (2 * K * V) + (2 * win[i][0] + within // V) * V + within % V)(*divmod(cp, 2 * V)) + for c in t['calls']: + s, rep, p = c['stage'], c['replica'], c['pair']; own = c['owners'][:2 * V] + for r in range(R): + i, segs = pieces[s, rep * R + r]; assert win[i][0] != p + if len(segs) == 1: + cp, off, w = segs[0]; own.append([fam(i, cp), ['hosted', i, off, w]]) + else: + (c1, o1, w1), (c2, o2, w2) = segs; own.append([fam(i, c1), ['hosted-split', i, o1, w1, fam(i, c2), o2, w2]]); split += 1 + assert len({(f, tuple(rt)) for f, rt in own}) == LOCAL and all(0 <= f < LIVE for f, rt in own) + c['owners'] = own + paid = Counter() + for c in t['calls']: + for z in t['local_programs'][c['orientation']]: + if z[0] == 0 and z[4]: paid[z[4]] += 1 + if z[0] == 2: paid[z[5]] += 1 + remainder = {} + for e in t['schedule']: + if e['kind'] == 'idle' and e['rank']: + i = e['idx'] + if i in win: + rr = Counter(rem[i, cp] for cp in range(copies)); remainder[str(i)] = {str(k): v for k, v in sorted(rr.items())} + for r_, n in rr.items(): + if r_: paid[r_] += n + else: paid[e['rank']] += copies + mass = sum(r * n for r, n in paid.items()); deficit = (2 * K * V - L * 72) * T; assert M * LIVE - mass == deficit, (M * LIVE - mass, deficit) + t.update(version=t['version'] + '+cross-copy', live=LIVE, + hosting=dict(windows={str(i): [w[0], w[1], sorted(w[2])] for i, w in win.items()}, + pieces=[[s, h, i, [list(x) for x in segs]] for (s, h), (i, segs) in sorted(pieces.items())], remainders=remainder, + rule='helper (stage s, replica-helper index h = rep*R + r) owns, on the pending idle-child projector of child i, the coordinates ' + '[off, off+w) of pooled copy cp (owner replica cp // 240, side/port cp % 240) for each piece; one or two pieces on two copies of ' + 'the same child; s strictly inside the window; the child keeps the remaining coordinates.'), + helper_route='hosted owner (one or two data families of one idle child, in any replica, pending idle coordinates; exact residual isometry then the slot placement)') + prefix = prefix_bound(t); charged_prefix = 64 * ((prefix.bit_length() + 63) // 64) + tb = json.dumps(t, separators=(',', ':'), sort_keys=True).encode(); (out / 'GLOBAL-TEMPLATE.json.gz').write_bytes(gzip.compress(tb, mtime=0)) + dg, nev = digest(t) + res = dict(g); res.update(status='PASS_CROSS_COPY_HOSTED_ELEVEN_STAGE_BIT_TEMPLATE', live=LIVE, physical=LIVE + 9, template_sha256=hashlib.sha256(tb).hexdigest(), + parent_template_sha256=g['template_sha256'], profile=dict(sorted(paid.items())), paid_calls=sum(paid.values()), rank_mass=mass, deficit=deficit, + maxchild=max(paid), halving_integer_inequality=[M ** 3, 2 * max(paid) ** 3], hosted_residuals=len(pieces), split_residuals=split, + hosted_coordinates=sum(sum(w for _, _, w in segs) for _, segs in pieces.values()), saved_idle_cost_proxy=val, + emitted_program_sha256=dg, emitted_events=nev, global_prefix_bound=str(prefix), global_prefix_bits=prefix.bit_length(), charged_prefix_bits=charged_prefix, + seconds=time.monotonic() - t0) + res['scope'] = res.get('scope', '') + ' Cross-copy slots (PR448) are assumed in addition; every window and coordinate ownership is audited.' + (out / 'GLOBAL.json').write_text(json.dumps(res, indent=2) + '\n') + print(json.dumps({k: res[k] for k in ('live', 'maxchild', 'hosted_residuals', 'split_residuals', 'rank_mass', 'profile', 'global_prefix_bits')}), flush=True) +if __name__ == '__main__': + DISCOVER = '--discover' in sys.argv; args = [a for a in sys.argv[1:] if a != '--discover'] + main(Path(args[0]), Path(args[1]), Path(args[2])) diff --git a/research/cross-copy-hosting-r715/complex_split.py b/research/cross-copy-hosting-r715/complex_split.py new file mode 100644 index 0000000000..4de0d0123c --- /dev/null +++ b/research/cross-copy-hosting-r715/complex_split.py @@ -0,0 +1,87 @@ +"""Cross-copy idle-axis hosting for #433's compressed nine-stage complex template (m=73, R=560, rank-nine residuals), +on top of #442's windows. Residuals of a child are laid along the concatenated pending sets of its 120 port copies; +a residual may be split across two ports (two data families of the same child, same window). Unhosted residuals are +re-tiled eight per bank with one paid pad. usage: complex_split.py SPLIT_CENTRES_DIR OUT [--discover]""" +import gzip, hashlib, json, sys, time +from collections import Counter +from pathlib import Path +HERE = Path(__file__).resolve().parent; sys.path.insert(0, str(HERE)) +import tape_core as TC +V, K, T, L, M, R = 120, 4, 8, 9, 73, 560 +DATA = 2 * K * V * T +DISCOVER = False +def main(src, out): + t0 = time.monotonic(); out.mkdir(parents=True, exist_ok=False) + blob = gzip.decompress((src / 'GLOBAL-TEMPLATE.json.gz').read_bytes()); t = json.loads(blob) + integ = json.loads((src / 'INTEGRATION.json').read_text()); checks = json.loads((src / 'LOCAL-CHECKS.json').read_text()) + assert hashlib.sha256(blob).hexdigest() == integ['global_template_sha256'] and t['live'] == integ['live'] + rank = {} + for it in t['idle_children']: + assert it['replicas'] == T; rank.setdefault(it['child'], it['rank']); assert rank[it['child']] == it['rank'] + pair_of_stage = {e['stage']: e['pair'] for e in t['recipe'] if e['kind'] == 'local'} + sched = []; side_of = {}; pair_of = {} + for e in t['execution_schedule']: + if e['kind'] == 'local_cover_sweep': sched.append(dict(kind='local', stage=e['stage'], pair=pair_of_stage[e['stage']])) + elif e['kind'] == 'bridge': sched.append(dict(kind='bridge', dst=e['dst'], src=e['src'])) + elif e['kind'] == 'idle_cover_sweep': + for sd, ch in enumerate(e['child_indices']): + if ch in rank: + sched.append(dict(kind='idle', pair=e['pair'], rank=rank[ch], idx=ch)); side_of[ch] = sd; pair_of[ch] = e['pair'] + win = {k: x for k, x in TC.windows(sched).items() if x[1] > 0 and x[2]} + avail = {(s, 9): R for s in range(L)} + sel = HERE / 'SELECTION.json'; key = 'complex' + if DISCOVER: + counts, val = TC.solve(win, V, avail, M, [9], dict(vars=lambda st: [], rows=lambda *a: [])) + TC.save(sel, key, counts, val) + counts, val = TC.load(sel, key) + pieces, rem = TC.expand(win, counts, {s: [(h, 9) for h in range(R)] for s in range(L)}, V) + base = [DATA]; tile = {}; partial = Counter() + for s in range(L): + left = [(rep, h) for rep in range(T) for h in range(R) if (s, h) not in pieces] + for z, (rep, h) in enumerate(left): tile[s, rep, h] = divmod(z, 8) + nb = -(-len(left) // 8); base.append(base[-1] + nb) + if len(left) % 8: partial[M - 9 * (len(left) % 8)] += 1 + partial[M - 72] += len(left) // 8 + W = base[-1]; split = 0 + for c in t['calls']: + s, rep, p = c['stage'], c['replica'], c['pair']; own = c['owners'][:2 * V] + for h in range(R): + if (s, h) in pieces: + i, segs = pieces[s, h]; fam = lambda port: rep * 960 + (2 * pair_of[i] + side_of[i]) * V + port + if len(segs) == 1: + port, off, w = segs[0]; own.append([fam(port), [3, i, off]]) + else: + (p1, o1, w1), (p2, o2, w2) = segs; own.append([fam(p1), [5, i, o1, w1, fam(p2), o2, w2]]); split += 1 + else: + b, sl = tile[s, rep, h]; own.append([base[s] + b, [2, sl]]) + assert len({(f, tuple(r)) for f, r in own}) == 2 * V + R and all(f < W for f, r in own) + c['owners'] = own + paid = Counter() + for c in t['calls']: + for r_, z in checks[c['orientation']]['paid_profile'].items(): paid[int(r_)] += z + newidle = [] + for it in t['idle_children']: + ch, port = it['child'], it['port']; rr = rem.get((ch, port), it['rank']) if ch in win else it['rank'] + if rr: newidle.append(dict(child=ch, port=port, rank=rr, hosted=it['rank'] - rr, replicas=T)); paid[rr] += T + for r_, n in partial.items(): paid[r_] += n + mass = sum(r * n for r, n in paid.items()); D = M * W - mass; assert D == 2496, D + t.update(version='hamming-mutable-basis-nine-v1+idle-axis-hosting+cross-copy', live=W, idle_children=newidle, + physical=W + R + (integ['physical'] - integ['live'] - R), + hosting=dict(windows={str(i): [w[0], w[1], sorted(w[2])] for i, w in win.items()}, sides=side_of, pairs=pair_of, + pieces=[[s, h, i, [list(x) for x in segs]] for (s, h), (i, segs) in sorted(pieces.items())], + banks=[base[s + 1] - base[s] for s in range(L)])) + t['bank_padding']['families'] = list(range(DATA, W)); t['cover_final_correction']['families'] = [0, W] + t['cover_final_correction']['charged_calls_per_cover'] = W + for e in t['execution_schedule']: + if e['kind'] == 'bank_padding_cover_sweep': e['families'] = [DATA, W] + elif e['kind'] == 'translate_every_live_family': e.update(t['cover_final_correction']) + tb = json.dumps(t, sort_keys=True, separators=(',', ':')).encode(); (out / 'GLOBAL-TEMPLATE.json.gz').write_bytes(gzip.compress(tb, mtime=0)) + res = dict(status='PASS_CROSS_COPY_HOSTED_COMPLEX_TEMPLATE', parent_template_sha256=integ['global_template_sha256'], + template_sha256=hashlib.sha256(tb).hexdigest(), live=W, physical=t['physical'], global_profile=dict(sorted(paid.items())), + rank_mass=mass, deficit=D, maxchild=max(paid), hosted_residuals=len(pieces) * T, split_residuals=split, + banks_per_stage=t['hosting']['banks'], saved_cost_proxy=val, seconds=time.monotonic() - t0) + (out / 'HOSTED.json').write_text(json.dumps(res, indent=2) + '\n') + print(json.dumps({k: res[k] for k in ('live', 'maxchild', 'hosted_residuals', 'split_residuals', 'banks_per_stage', 'deficit', 'global_profile')})) +if __name__ == '__main__': + DISCOVER = '--discover' in sys.argv; args = [a for a in sys.argv[1:] if a != '--discover'] + main(Path(args[0]), Path(args[1])) diff --git a/research/cross-copy-hosting-r715/tape_core.py b/research/cross-copy-hosting-r715/tape_core.py new file mode 100644 index 0000000000..b7cea4707b --- /dev/null +++ b/research/cross-copy-hosting-r715/tape_core.py @@ -0,0 +1,95 @@ +"""Cross-copy idle-axis hosting. A child advancing pair j by rank r has, per replica, C copies (data families) with r +pending coordinates each; they share one window. Concatenate the C pending sets into a tape of C*r coordinates and +place whole residuals (stage in window, width w) contiguously; a residual may straddle a copy boundary, in which case +its two pieces are owned by two families of the same child. Integer programme: maximise saved idle cost (first-order +r ln(m/r) proxy) subject to residual availability and exact bank tiling of what is left. Standard library plus scipy +for the solve; a frozen selection replays without scipy.""" +import math, json +from collections import Counter, defaultdict +from pathlib import Path + +def windows(schedule): + last = {}; out = {}; locals_ = [] + for pos, e in enumerate(schedule): + k = e['kind'] + if k == 'local': locals_.append((pos, e['stage'], e['pair'])); last[e['pair']] = pos + elif k == 'bridge': last[e['dst']] = pos; last[e['src']] = pos + elif k == 'idle': + p = e['pair']; lo = last.get(p, -1) + out[e['idx']] = (p, e['rank'], frozenset(s for q, s, pp in locals_ if lo < q < pos and pp != p)) + return out + +def cost(r, m): return r * math.log(m / r) if r else 0.0 + +def solve(win, copies, avail, m, widths, tiling): + """win: {idx: (pair, rank, stages)}; copies per child per replica; avail: {(stage, width): count per replica}; + tiling: function(leftover counts per stage as dict width->var expressions) -> list of (row, lo, hi) built by caller. + Returns counts {(idx, stage, width): n} maximising sum_i ln(m/r_i) * used_i (used_i = coordinates hosted on child i).""" + import numpy as np + from scipy.optimize import milp, LinearConstraint, Bounds + var = []; index = {} + for idx, (p, r, st) in win.items(): + for s in sorted(st): + for w in widths: + if avail.get((s, w), 0): index[(idx, s, w)] = len(var); var.append(('n', idx, s, w)) + stages = sorted({s for (s, _) in avail}) + extra = tiling['vars'](stages) # list of names of integer slack vars + for name in extra: index[name] = len(var); var.append(name) + n = len(var); c = np.zeros(n); lb = np.zeros(n); ub = np.full(n, np.inf) + for key in list(index): + if isinstance(key, tuple) and len(key) == 3 and key[0] in win: + idx, s, w = key; r = win[idx][1]; c[index[key]] = -math.log(m / r) * w + rows, lo, hi = [], [], [] + for idx, (p, r, st) in win.items(): # capacity of the tape + row = np.zeros(n) + for key, j in index.items(): + if isinstance(key, tuple) and len(key) == 3 and key[0] == idx: row[j] = key[2] + rows.append(row); lo.append(0); hi.append(copies * r) + for (s, w), a in avail.items(): # availability and tiling of the leftover + row = np.zeros(n) + for key, j in index.items(): + if isinstance(key, tuple) and len(key) == 3 and key[0] in win and key[1] == s and key[2] == w: row[j] = 1 + rows.append(row); lo.append(0); hi.append(a) + for row, l, h in tiling['rows'](index, n, avail, win): + rows.append(row); lo.append(l); hi.append(h) + res = milp(c, constraints=LinearConstraint(np.array(rows), lo, hi), integrality=np.ones(n), bounds=Bounds(lb, ub), + options=dict(time_limit=600, disp=False)) + assert res.x is not None, res.message + x = [int(round(t)) for t in res.x] + counts = {key: x[j] for key, j in index.items() if isinstance(key, tuple) and len(key) == 3 and key[0] in win and x[j]} + return counts, -res.fun + +def expand(win, counts, helpers, copies): + """helpers: {stage: [(helper, width), ...]} for one replica (sorted). Lay the residuals of each child along the tape + in (stage, helper) order. Returns pieces {(stage, helper): (idx, [(copy, off, w), ...])} and the remainder rank of + every (idx, copy).""" + pool = defaultdict(list) + for s, hs in helpers.items(): + for h, w in hs: pool[s, w].append(h) + for k in pool: pool[k].sort() + pieces = {}; rem = {} + for idx in sorted(win): + p, r, st = win[idx]; pos = 0 + items = [] + for (i2, s, w), cnt in sorted(counts.items()): + if i2 != idx: continue + for _ in range(cnt): items.append((s, w, pool[s, w].pop(0))) + items.sort(key=lambda t: (-t[1], t[0], t[2])) # wide first: fewer straddles + for s, w, h in items: + a, b = pos, pos + w; segs = [] + while a < b: + cp = a // r; end = min(b, (cp + 1) * r); segs.append((cp, a - cp * r, end - a)); a = end + pieces[s, h] = (idx, segs); pos = b + assert pos <= copies * r + for cp in range(copies): + used = max(0, min(r, pos - cp * r)); rem[idx, cp] = r - used + return pieces, rem + +def save(path, key, counts, val): + p = Path(path); d = json.loads(p.read_text()) if p.exists() else {} + d[key] = dict(counts=sorted([[i, s, w, n] for (i, s, w), n in counts.items()]), proxy_saving=val) + p.write_text(json.dumps(d, indent=1, sort_keys=True) + '\n') + +def load(path, key): + d = json.loads(Path(path).read_text())[key] + return {(i, s, w): n for i, s, w, n in d['counts']}, d['proxy_saving'] diff --git a/research/cross-copy-hosting-r715/verify.py b/research/cross-copy-hosting-r715/verify.py new file mode 100644 index 0000000000..c8b1e4ff76 --- /dev/null +++ b/research/cross-copy-hosting-r715/verify.py @@ -0,0 +1,39 @@ +"""Fresh replay: #472 in full (its #458 complex parent and the R715 whole-hosted bit composition), then cross-copy +idle-axis hosting of the R715 eleven-stage bit template and of #442's complex template, independent audit and exact +assembly. usage: python -B research/cross-copy-hosting-r715/verify.py /absolute/new/output [--quick] +(--quick is passed through to #472 and skips only #443's inherited exhaustive negative controls; #472's parent needs +numpy, mpmath, sympy, a C++17 compiler and Boost headers, BOOST_INCLUDE if they are not on the include path.)""" +from pathlib import Path +import gzip, hashlib, json, os, subprocess, sys, time +assert __debug__ +ROOT = Path(__file__).resolve().parent; PARENT = ROOT.parent / 'e8-r715-whole-hosted' +out = Path(sys.argv[1]).resolve(); quick = '--quick' in sys.argv[2:]; assert not out.exists() and not out.is_relative_to(ROOT.parent) +read = lambda p: json.loads(Path(p).read_text()); sha = lambda p: hashlib.sha256(Path(p).read_bytes()).hexdigest() +def integrity(): + files = {p.relative_to(ROOT).as_posix(): sha(p) for p in ROOT.rglob('*') if p.is_file() and p.name != 'MANIFEST.json' and '__pycache__' not in p.parts} + assert files == read(ROOT / 'MANIFEST.json')['files'], 'manifest mismatch' + assert sha(PARENT / 'MANIFEST.json') == read(ROOT / 'MANIFEST.json')['parent_manifest_sha256'], 'parent package changed' +integrity(); out.mkdir(parents=True) +env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', PYTHONINTMAXSTRDIGITS='0'); env.pop('PYTHONOPTIMIZE', None); steps = [] +def run(name, file, *args, cwd=None): + t = time.monotonic(); log = out / (name + '.log'); print('RUN', name, flush=True) + with log.open('w') as f: q = subprocess.run([sys.executable, '-B', str(file), *map(str, args)], cwd=cwd, env=env, stdout=f, stderr=subprocess.STDOUT) + if q.returncode: raise RuntimeError((name, q.returncode, log.read_text()[-3000:])) + steps.append(dict(name=name, seconds=round(time.monotonic() - t, 1), log_sha256=sha(log))); print('PASS', name, flush=True) +try: + run('parent-472-full', PARENT / 'verify.py', out / 'parent', *(['--quick'] if quick else [])) + rep = out / 'parent'; changed = rep / 'parent458/parent454/parent451/parent445/parent444/upstream442/parent/changed' + run('bit-cross-copy-hosting-r715', ROOT / 'bit_split11.py', rep / 'bit', rep / 'local', out / 'bit') + (out / 'bit/GEOMETRY.json').write_bytes((rep / 'bit/GEOMETRY.json').read_bytes()) + run('complex-cross-copy-hosting', ROOT / 'complex_split.py', changed / 'split-centres', out / 'complex') + run('independent-audit', ROOT / 'audit_split11.py', rep / 'bit', rep / 'local', out / 'bit', changed, out / 'complex', out / 'AUDIT.json') + run('exact-assembly', ROOT / 'assemble_split11.py', rep, out / 'bit', out / 'complex', out / 'AUDIT.json', out / 'RESULT.json') + actual = read(out / 'RESULT.json'); expected = read(ROOT / 'EXPECTED.json') + for k, v in expected.items(): assert actual[k] == v, (k, actual[k], v) + h = hashlib.sha256(gzip.decompress((out / 'complex/GLOBAL-TEMPLATE.json.gz').read_bytes())).hexdigest(); assert h == expected['complex_template_sha256'] + integrity() + receipt = dict(status='PASS_FULL_CROSS_COPY_R715_COMPOSITION', mode='quick' if quick else 'full', kappa=actual['kappa'], kappa_decimal=actual['kappa_decimal'], + gain_over_pr472_percent=actual['gain_over_pr472_percent'], manifest_sha256=sha(ROOT / 'MANIFEST.json'), checks=steps, python=sys.version.split()[0]) + (out / 'RECEIPT.json').write_text(json.dumps(receipt, indent=2) + '\n'); print(json.dumps(receipt, indent=2)) +except BaseException as e: + (out / 'FAILURE.json').write_text(json.dumps(dict(error=repr(e), completed=steps), indent=2) + '\n'); raise diff --git a/research/cross-family-residual-obstruction/EXPECTED.json b/research/cross-family-residual-obstruction/EXPECTED.json new file mode 100644 index 0000000000..149851fe5c --- /dev/null +++ b/research/cross-family-residual-obstruction/EXPECTED.json @@ -0,0 +1,424 @@ +{ + "status": "PASS_CROSS_FAMILY_ROUTE_OBSTRUCTION", + "reviewed_pr": 448, + "reviewed_head": "9b966d8188e1cadd00aa834078ee6a8742a9d9b4", + "bit": [ + { + "q": 3, + "m": 2, + "ranks": [ + 1, + 1 + ], + "dimension": 162, + "whole_trace": 90, + "split_trace": 54, + "same_family_identity": true, + "not_similar_by_trace": true, + "distinct_column": { + "input": [ + 0, + [ + 0, + 0, + 0, + 1 + ] + ], + "whole": [ + 0, + [ + 0, + 1, + 0, + 0 + ] + ], + "split": [ + 0, + [ + 0, + 0, + 0, + 1 + ] + ] + }, + "whole_sha256": "5922ff9046806e99dccc93100cc1e70b6652dea3cae3fba29716c2f8b548af93", + "split_sha256": "94186aaf90f78695c762198e7efdb84eafe12bb782101c8f58f968e6f220c887" + }, + { + "q": 3, + "m": 3, + "ranks": [ + 1, + 1 + ], + "dimension": 1458, + "whole_trace": 810, + "split_trace": 486, + "same_family_identity": true, + "not_similar_by_trace": true, + "distinct_column": { + "input": [ + 0, + [ + 0, + 0, + 0, + 0, + 1, + 0 + ] + ], + "whole": [ + 0, + [ + 0, + 1, + 0, + 0, + 0, + 0 + ] + ], + "split": [ + 0, + [ + 0, + 0, + 0, + 0, + 1, + 0 + ] + ] + }, + "whole_sha256": "a2c7f305cfbbbf85a968b2a4a5ef0aec25e7611cefed9663fe55a07ac070648c", + "split_sha256": "0d323074b120550e07b47c8d09d0c36598d9dc2ad9b4515a64a2217e723bdfc4" + }, + { + "q": 3, + "m": 3, + "ranks": [ + 1, + 2 + ], + "dimension": 1458, + "whole_trace": 756, + "split_trace": 324, + "same_family_identity": true, + "not_similar_by_trace": true, + "distinct_column": { + "input": [ + 0, + [ + 0, + 0, + 0, + 0, + 0, + 1 + ] + ], + "whole": [ + 0, + [ + 0, + 0, + 1, + 0, + 0, + 0 + ] + ], + "split": [ + 0, + [ + 0, + 0, + 0, + 0, + 0, + 1 + ] + ] + }, + "whole_sha256": "1b8041d497b9cd4c7a8591dd9d044c97a7555cb81abc4ba523dfd47cf388a761", + "split_sha256": "6326e20aea48c078df46393f365b9cbe1be0cb8244b13f1dc68fec4f29426e16" + } + ], + "complex": [ + { + "m": 2, + "ranks": [ + 1, + 1 + ], + "dimension": 8, + "whole_trace_gaussian_integer": [ + 4, + 2 + ], + "split_trace_gaussian_integer": [ + 4, + 4 + ], + "same_family_identity": true, + "not_similar_by_trace": true + }, + { + "m": 3, + "ranks": [ + 1, + 2 + ], + "dimension": 16, + "whole_trace_gaussian_integer": [ + 6, + 2 + ], + "split_trace_gaussian_integer": [ + 4, + 8 + ], + "same_family_identity": true, + "not_similar_by_trace": true + } + ], + "actual_bit_rank8": [ + { + "m": 64, + "q": 3, + "ranks": [ + 1, + 7 + ], + "whole_trace": "11791981588038497602731286041242028270717943067903378960203362", + "split_trace": "3935452556812604350804863826626035037011931624307893923018190", + "difference": "7856529031225893251926422214615993233706011443595485037185172" + }, + { + "m": 64, + "q": 3, + "ranks": [ + 2, + 6 + ], + "whole_trace": "11791981588038497602731286041242028270717943067903378960203362", + "split_trace": "1326193601336850233284926714178088519321829013122934116523938", + "difference": "10465787986701647369446359327063939751396114054780444843679424" + }, + { + "m": 64, + "q": 3, + "ranks": [ + 3, + 5 + ], + "whole_trace": "11791981588038497602731286041242028270717943067903378960203362", + "split_trace": "485192780976896426811558553967593360727498419435219798728270", + "difference": "11306788807061601175919727487274434909990444648468159161475092" + }, + { + "m": 64, + "q": 3, + "ranks": [ + 4, + 4 + ], + "whole_trace": "11791981588038497602731286041242028270717943067903378960203362", + "split_trace": "291115668586137856086935132380556016436499051661131879236962", + "difference": "11500865919452359746644350908861472254281444016242247080966400" + }, + { + "m": 64, + "q": 3, + "ranks": [ + 5, + 3 + ], + "whole_trace": "11791981588038497602731286041242028270717943067903378960203362", + "split_trace": "485192780976896426811558553967593360727498419435219798728270", + "difference": "11306788807061601175919727487274434909990444648468159161475092" + }, + { + "m": 64, + "q": 3, + "ranks": [ + 6, + 2 + ], + "whole_trace": "11791981588038497602731286041242028270717943067903378960203362", + "split_trace": "1326193601336850233284926714178088519321829013122934116523938", + "difference": "10465787986701647369446359327063939751396114054780444843679424" + }, + { + "m": 64, + "q": 3, + "ranks": [ + 7, + 1 + ], + "whole_trace": "11791981588038497602731286041242028270717943067903378960203362", + "split_trace": "3935452556812604350804863826626035037011931624307893923018190", + "difference": "7856529031225893251926422214615993233706011443595485037185172" + } + ], + "actual_complex_rank9": [ + { + "m": 73, + "ranks": [ + 1, + 8 + ], + "whole_trace_gaussian_integer": [ + 9739880870918643253248, + 295147905179352825856 + ], + "split_trace_gaussian_integer": [ + 5312662293228350865408, + 4722366482869645213696 + ], + "difference": [ + 4427218577690292387840, + -4427218577690292387840 + ] + }, + { + "m": 73, + "ranks": [ + 2, + 7 + ], + "whole_trace_gaussian_integer": [ + 9739880870918643253248, + 295147905179352825856 + ], + "split_trace_gaussian_integer": [ + 590295810358705651712, + 4132070672510939561984 + ], + "difference": [ + 9149585060559937601536, + -3836922767331586736128 + ] + }, + { + "m": 73, + "ranks": [ + 3, + 6 + ], + "whole_trace_gaussian_integer": [ + 9739880870918643253248, + 295147905179352825856 + ], + "split_trace_gaussian_integer": [ + -2361183241434822606848, + 1180591620717411303424 + ], + "difference": [ + 12101064112353465860096, + -885443715538058477568 + ] + }, + { + "m": 73, + "ranks": [ + 4, + 5 + ], + "whole_trace_gaussian_integer": [ + 9739880870918643253248, + 295147905179352825856 + ], + "split_trace_gaussian_integer": [ + -3541774862152233910272, + -1180591620717411303424 + ], + "difference": [ + 13281655733070877163520, + 1475739525896764129280 + ] + }, + { + "m": 73, + "ranks": [ + 5, + 4 + ], + "whole_trace_gaussian_integer": [ + 9739880870918643253248, + 295147905179352825856 + ], + "split_trace_gaussian_integer": [ + -3541774862152233910272, + -1180591620717411303424 + ], + "difference": [ + 13281655733070877163520, + 1475739525896764129280 + ] + }, + { + "m": 73, + "ranks": [ + 6, + 3 + ], + "whole_trace_gaussian_integer": [ + 9739880870918643253248, + 295147905179352825856 + ], + "split_trace_gaussian_integer": [ + -2361183241434822606848, + 1180591620717411303424 + ], + "difference": [ + 12101064112353465860096, + -885443715538058477568 + ] + }, + { + "m": 73, + "ranks": [ + 7, + 2 + ], + "whole_trace_gaussian_integer": [ + 9739880870918643253248, + 295147905179352825856 + ], + "split_trace_gaussian_integer": [ + 590295810358705651712, + 4132070672510939561984 + ], + "difference": [ + 9149585060559937601536, + -3836922767331586736128 + ] + }, + { + "m": 73, + "ranks": [ + 8, + 1 + ], + "whole_trace_gaussian_integer": [ + 9739880870918643253248, + 295147905179352825856 + ], + "split_trace_gaussian_integer": [ + 5312662293228350865408, + 4722366482869645213696 + ], + "difference": [ + 4427218577690292387840, + -4427218577690292387840 + ] + } + ], + "conclusion": "D_(P1+P2) on one family plus identity on a second family is not similar to D_P1 on the first and D_P2 on the second. The analogous exact complex residual also fails the trace invariant.", + "scope": "Refutes the stated elementary-permutation derivation for splitting one residual across two families. Does not rule out a different compiler with additional operations, changed storage or charged work." +} diff --git a/research/cross-family-residual-obstruction/LICENSE b/research/cross-family-residual-obstruction/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/cross-family-residual-obstruction/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/cross-family-residual-obstruction/README.md b/research/cross-family-residual-obstruction/README.md new file mode 100644 index 0000000000..dd2f752df6 --- /dev/null +++ b/research/cross-family-residual-obstruction/README.md @@ -0,0 +1,85 @@ +# A trace obstruction to splitting one residual across two families + +PR448 at [`9b966d8`](https://github.com/CrocSwap/integer-mult-bounds/blob/9b966d8188e1cadd00aa834078ee6a8742a9d9b4/research/cross-copy-hosting/PROOF.md) +proposes routing one residual onto pending coordinate sets in two different +families by an elementary coordinate permutation. Its proof uses the valid +same-family factorization `D_(P1+P2) = D_P1 D_P2`, then assigns the two factors +to different families. That assignment needs a new operator theorem: it is +not a consequence of the factorization or a coordinate conjugation. + +The obstruction is invariant under **every invertible linear change of +storage**, not only coordinate permutations. Consider one residual on family +A and identity on an otherwise unused family B. Replacing it with one factor +on A and the other on B gives different traces. + +## Bit permutation + +Let each family have addresses `(x,y)` in `F_q^m × F_q^m`. A rank-r coordinate +operator `D_r` exchanges r selected coordinates between x and y. It fixes +`q^(2m-r)` addresses, so this is the trace of its permutation matrix. If the +residual has positive ranks a and b, with a+b≤m, then + +``` +trace(D_(a+b) ⊕ I) = q^(2m-a-b) + q^(2m) +trace(D_a ⊕ D_b) = q^(2m-a) + q^(2m-b) +``` + +Their difference is + +``` +q^(2m-a-b) (q^a−1) (q^b−1) > 0. +``` + +Thus the two operators are not similar. Disjoint coordinate factors on the +**same** family do multiply correctly; putting them on separate families +changes the operator. Independent routing conjugations inside each family +do not change this trace conclusion. + +The smallest enumerated odd-field control uses q=3, m=2 and a=b=1. On the +162 physical scalar coordinates of two families, the whole residual plus +identity has trace90; the split action has trace54. The script explicitly +constructs both permutations, checks bijectivity and involutivity, verifies +the valid same-family product, and emits a differing input column. Additional +controls cover m=3 and the exact rank-eight formulas at the proposed m=64. + +## Complex factor + +For the inherited complex factor, the exact Fourier multiplier on r selected +binary coordinates is `i^(sum y_j)`. Therefore + +``` +trace(C_r) = 2^(m-r) (1+i)^r. +``` + +The difference between `trace(C_(a+b) ⊕ I)` and `trace(C_a ⊕ C_b)` is + +``` +2^(m-a-b) [2^a−(1+i)^a] [2^b−(1+i)^b], +``` + +which is nonzero for positive a,b because each bracket is nonzero. +For m=2, a=b=1 the traces are exactly `4+2i` and `4+4i`. The script enumerates +the exact Fourier exponents and sums them as Gaussian integers, with no +floating-point arithmetic. It also verifies the same-family factorization +and the exact rank-nine formulas at the proposed m=73. + +## Scope and reproduction + +```sh +python -B research/cross-family-residual-obstruction/verify.py +``` + +This refutes the stated coordinate-permutation derivation for a **single +residual split between two families**. It does not rule out a different +compiler that changes the local program, introduces and charges additional +operations or storage, or proves a global regrouping theorem. Those changes +are not supplied by the two inherited hosting facts alone. A scalar count or +slot-packing audit cannot establish the missing operator identity. + +The adjacent `r740-hosted-rank149` certificate retains whole-residual hosting +and does not use the cross-family extension. + +Prepared by chafreaky with OpenAI Codex assistance, Apache-2.0. The reviewed +proposal is by Sreekanth Nair / higherbeing with substantial Anthropic Claude +assistance; its exact commit and proof are linked above. This review does not +claim their endorsement. diff --git a/research/cross-family-residual-obstruction/verify.py b/research/cross-family-residual-obstruction/verify.py new file mode 100644 index 0000000000..830f459968 --- /dev/null +++ b/research/cross-family-residual-obstruction/verify.py @@ -0,0 +1,80 @@ +"""Exact obstruction to replacing one residual by factors on different families. +Read-only review of PR448 head9b966d8188e1cadd00aa834078ee6a8742a9d9b4. +Chafreaky with OpenAI Codex assistance. Standard library only. +""" +from itertools import product +from pathlib import Path +import hashlib,json + +def bit(q,m,a,b): + states=list(product(range(2),product(range(q),repeat=2*m))) + index={x:i for i,x in enumerate(states)} + def perm(first,second): + out=[] + for family,word in states: + w=list(word) + for i in (first if family==0 else second):w[i],w[m+i]=w[m+i],w[i] + out.append(index[family,tuple(w)]) + assert sorted(out)==list(range(len(states))) and all(out[out[i]]==i for i in range(len(out))) + return out + A=list(range(a));B=list(range(a,a+b)) + whole=perm(A+B,[]);left=perm(A,[]);right=perm(B,[]);split=perm(A,B) + compose=[left[right[i]] for i in range(len(left))] + assert compose==whole,'same-family factorization must hold' + count=lambda p:sum(i==j for i,j in enumerate(p)) + w,s=count(whole),count(split) + assert w==q**(2*m)+q**(2*m-a-b) + assert s==q**(2*m-a)+q**(2*m-b) + assert w-s==q**(2*m-a-b)*(q**a-1)*(q**b-1)>0 + bad=next(i for i in range(len(states)) if whole[i]!=split[i]) + return dict(q=q,m=m,ranks=[a,b],dimension=len(states),whole_trace=w,split_trace=s, + same_family_identity=True,not_similar_by_trace=True, + distinct_column=dict(input=states[bad],whole=states[whole[bad]],split=states[split[bad]]), + whole_sha256=hashlib.sha256(json.dumps(whole).encode()).hexdigest(),split_sha256=hashlib.sha256(json.dumps(split).encode()).hexdigest()) + +def complex_case(m,a,b): + # In the exact Fourier basis C_u has multiplier i^parity(u.y). + # Store eigenvalues by their exponents modulo four; sum as Gaussian integers. + whole=[];split=[] + for family in range(2): + for y in range(1<>a)&((1<s;actual.append(dict(m=m,q=q,ranks=[a,b],whole_trace=str(w),split_trace=str(s),difference=str(w-s))) +def mul(z,w):return (z[0]*w[0]-z[1]*w[1],z[0]*w[1]+z[1]*w[0]) +def power(n): + z=(1,0) + for _ in range(n):z=mul(z,(1,1)) + return z +def scale(n,z):return (n*z[0],n*z[1]) +actual_complex=[] +for a in range(1,9): + b=9-a;m=73 + z=scale(2**(m-9),power(9));whole=(z[0]+2**m,z[1]) + x=scale(2**(m-a),power(a));y=scale(2**(m-b),power(b));split=(x[0]+y[0],x[1]+y[1]) + pa,pb=power(a),power(b) + difference=scale(2**(m-9),mul((2**a-pa[0],-pa[1]),(2**b-pb[0],-pb[1]))) + assert difference==(whole[0]-split[0],whole[1]-split[1]) and difference!=(0,0) + actual_complex.append(dict(m=m,ranks=[a,b],whole_trace_gaussian_integer=whole,split_trace_gaussian_integer=split,difference=difference)) +out=dict(status='PASS_CROSS_FAMILY_ROUTE_OBSTRUCTION',reviewed_pr=448,reviewed_head='9b966d8188e1cadd00aa834078ee6a8742a9d9b4', + bit=rows,complex=complex_rows,actual_bit_rank8=actual,actual_complex_rank9=actual_complex, + conclusion='D_(P1+P2) on one family plus identity on a second family is not similar to D_P1 on the first and D_P2 on the second. The analogous exact complex residual also fails the trace invariant.', + scope='Refutes the stated elementary-permutation derivation for splitting one residual across two families. Does not rule out a different compiler with additional operations, changed storage or charged work.') +expected=json.loads(Path(__file__).with_name('EXPECTED.json').read_text()) +assert json.loads(json.dumps(out))==expected, 'exact counterexample differs from frozen output' +print(json.dumps(out,indent=2)) diff --git a/research/e8-bit-carrier-skeleton/EXPECTED.json b/research/e8-bit-carrier-skeleton/EXPECTED.json new file mode 100644 index 0000000000..973aaf30f1 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/EXPECTED.json @@ -0,0 +1,91 @@ +{ + "note": "Exact values that verify.sh must reproduce. The bit c is on the 10^-24 grid of PR #472's assembly (largest grid point admitted by both PR #315 moment engines with the inherited 10^-16 bad-branch allowance; the next grid point is rejected); kappa values are on the 10^-18 grid of the six-level, 47-inequality outer assembly.", + "word": { + "R": 489, + "content_sha256": "88435b75b8d6e5c722eb2aa1449f3a5e8e9601a9ffe243839ce1ec932ab76547", + "local_histogram": { + "1": 1200, + "2": 1440, + "4": 180, + "6": 120, + "8": 18 + }, + "source_destination_gates_A": 577, + "sources_rewritten": 117, + "five_stage_payload_bits": 100 + }, + "eleven": { + "bit_lower": "391360506745414227149/250000000000000000000000", + "bit_lower_decimal": "0.001565442026981656908596", + "profile": { + "1": 105600, + "2": 130560, + "4": 19680, + "6": 14400, + "7": 7680, + "8": 1584, + "48": 2, + "56": 2628 + }, + "bit": { + "live": 9600, + "physical": 9609, + "maxchild": 56, + "rank_mass": 745536, + "hosted_residuals": 43032, + "prefix_bits": 2119, + "charged_prefix_bits": 2176, + "coefficient_bits": 2119, + "three_level_coefficient_bits": 6411, + "charged_three_level_coefficient_bits": 6464, + "row_coefficient": 19431, + "halving_depth": 3 + }, + "emitted_program_sha256": "e37b52e4861c39154b5891460fb45df8651c92cd68961078f8f06596f057c822", + "kappa": { + "pr484": { + "kappa": "662515748707749/500000000000000000", + "kappa_decimal": "0.001325031497415498", + "binding_component": "complex", + "complex_lower": "663394767670133/500000000000000000", + "role": "primary" + }, + "pr471": { + "kappa": "260706019542937/200000000000000000", + "kappa_decimal": "0.001303530097714685", + "binding_component": "complex", + "complex_lower": "1305231506267591/1000000000000000000", + "role": "control (complex supplier of the current whole-residual frontier)" + }, + "pr458": { + "kappa": "323880830669511/250000000000000000", + "kappa_decimal": "0.001295523322678044", + "binding_component": "complex", + "complex_lower": "1297203880559577927527/1000000000000000000000000", + "role": "control" + }, + "pr448": { + "kappa": "358867191156973/250000000000000000", + "kappa_decimal": "0.001435468764627892", + "binding_component": "complex", + "complex_lower": "718766148669433/500000000000000000", + "role": "information only" + } + } + }, + "controls": { + "pr472": { + "bit_lower": "323442810173099014031/250000000000000000000000", + "kappa": "646049779721139/500000000000000000", + "published": "research/e8-r715-whole-hosted/EXPECTED.json at 259c684: bit_lower 323442810173099014031/250000000000000000000000, kappa 646049779721139/500000000000000000" + }, + "pr445": { + "bit_lower": "316240894019344628547/250000000000000000000000", + "published": "research/r740-hosted-eleven README at 40ab91d: 1264963576077378514188/10^24" + }, + "pr451": { + "bit_lower": "158442042752174644233/125000000000000000000000", + "published": "PR #451 body at f3a3815: c = 0.001267536342017397153864" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/LICENSE b/research/e8-bit-carrier-skeleton/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/e8-bit-carrier-skeleton/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/e8-bit-carrier-skeleton/MANIFEST.sha256 b/research/e8-bit-carrier-skeleton/MANIFEST.sha256 new file mode 100644 index 0000000000..1213654fbd --- /dev/null +++ b/research/e8-bit-carrier-skeleton/MANIFEST.sha256 @@ -0,0 +1,93 @@ +3494ba83280cc86548fe0cc6695c50d23e6b6ffca85aeb1a33337c1196e280cb EXPECTED.json +c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSE +5f4b7fcbf99f572be28b6da612ce775363908cdfc7810f7aca167be01c86e49a NOTICE.md +e5212e8058c92a2b02cc12b4e174a65ce1cef7b4d7977ae770e64f5ff91b7204 README.md +03de1d341196cfa8cf1d39f3cc8648b25bb5f39c3c602a728cfbd089e8253ac0 SOURCE-pr370.json +16b1977240ca9acb58fa64572fb4231a423bc10bbf3e7bb30f1c8201fe369ba5 SOURCE-pr381.json +87c659ba932525631a40be14dca28a6a2efade8641f23bb08d6e1567fc991131 SOURCE-pr386.json +4a4f99f5bdb7530a0dcf9433f7f02afbf2abf908e718f7c63ffa5503d4f49693 SOURCE-pr436.json +e6f4a272442bb71ef68aaa3545b271236f9c99297e444fa01c62b0b5fb6a170f SOURCE-pr445.json +c771fa9be492408a78d6d970c839e68c4dfd1b66f4f4a4748e3d12726a43cf27 SOURCE-pr448.json +a639956eec858341987a815b7464ef472505300db754b5f9ac012dd01d18c8df SOURCE-pr451.json +cbdea984a46ab5de354b95e73fd76c1918fdc6676c658398a552772c4dc3dcaf SOURCE-pr458.json +499d861e090c9e646d978dd67890a8e58a9ff6bf08512684e66605179132076b SOURCE-pr471.json +6753bcf50c91806b75dd4dbe3963a79699a614d0dab8ce32b261cc3e76b288b1 SOURCE-pr472.json +2515c4f23dfa22a21913d92597669770f7f44c2a5b3ef069ef68a0c89779a656 SOURCE-pr473.json +9c7c4ea678865a955b0c89f0952927159976fdf55cadc6a488dec5757f03fe7d SOURCE-pr478.json +24e3eab4a985e115adb7f8665a401423e9636e9f16cc4373ec68cc86950445a8 SOURCE-pr483.json +b92f43fbcba3921a1aa37bcb9f05cf5fa612ff708785e05512438a6317bf0867 SOURCE-pr484.json +d1297f9052be4f2496e1ff2a77e4db2c0cdbd7d460d489b4c03e50bf317238ce code/bit/checkers/columns_h.cpp +1c344d18fcd494eeca93e259f10cafae7705780e6592f6dcb35b34752dab9bc2 code/bit/checkers/columns_k.cpp +223a5a07731fc315a90a3e48177796babc155c1d9985c7ae5017eff6af2a0608 code/bit/checkers/gram_frames.py +aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63 code/bit/checkers/json.hpp +6c1ef2b24e57781d6951c172a1024fc4300e6fd392c9d6672079a7806ab663b3 code/bit/checkers/legality_h.cpp +8a5999601f917dbb492bb9ae9a344611f18cc7cedc53dc3c76496a369e530eb3 code/bit/export_records.py +11bf9620ca9db16d52d9fe806b814fc9ec9a89c4d7645354d1861d96f6e805ad code/bit/independent/checkword.py +2c63a039f97e3a11ce5a6b83302d4f5beda160c1db14164a5a9b0855aeb19d3c code/bit/independent/interface.py +0ff65aace5da4b57d96235bf830f8f11969322e75134d498aeb70e9753ec6b0d code/bit/independent/mutate.py +3b002c19a5dcca76a5594f2a30fac7c01d2b45fc96b3e7cfbfd8b720f5ffb4e8 code/bit/independent/mutate_mut.py +d6e9f58de3fa41f538516b6227c249d61fb30f0f6843027cc8a07a1a372fa6b6 code/bit/independent/relax.py +b0e75d6550412a7be4017695e6b237392b611bb852ad8ff309d6682c9f166a4e code/bit/mutate_records.py +a9e085ec60d5657cd5d77832e3d95004e81b9f4f249d9e0fc95e345366cb2d2e code/bit/mutate_records_mut.py +6c288f6f234b528c1a7c0a4adfb724e91e0fe6b18c8dffad96af3f973de1829a code/bit/regression/stage_cohort.py +a4c2dd4755f2a45ceda327b36d9ee400c2804893000626ca8ff3f6ee296fd842 code/cited.py +d8a8c13b484d985f0133a5d06de4a78b8477314f922b9f693ba73640b7184d6b code/eleven/adapt.py +c47889a606701ae592374dd82a13cee8c5a4e8449b7facfdad2d90563a30a18c code/eleven/assemble.py +5ad832830c19ec6c904d1b64480f6b1e71c5673fdd38d487d17e179b1d197c09 code/eleven/audit.py +b0b25955875625ed63f82690f83aef976e3e9a978ae6620b23a23fc1207acd46 code/eleven/emit.py +95275473d7f9811011bda760dd0f04de5169c2a6922456dc9a5725a5d671f941 code/eleven/local_audit.py +abb60c35e448e0f94073f38a0352d11249aaf7bb8dbd7352414ae60a1d2b79c3 code/hub/e8-r715-whole-hosted/code/assemble.py +d28062127a9b0d3866a3b79aad98a307233b20ebdb94cfb9f197d726b82ffea5 code/hub/e8-r715-whole-hosted/code/audit.py +98d77cefbc3a76f9f10bd7df3a2590ab88b411f6afe77b5f8d73f1602eb2bef3 code/hub/e8-r715-whole-hosted/code/emit.py +23eda3fe3d774e7f2dbf4dbdd4ff90d69ae7d1762ff95c8629cdc7667aa3fe71 code/hub/e8-r715-whole-hosted/code/local_audit.py +765382d4fefd594e94c8c5826ec6300422ce9f79c816d7f7323ef85e99320f28 code/hub/e8-r715-whole-hosted/data/hosting.json +750221cc66badd0ed0a74e7aad2d59f91f89c107370af21c6d929fbdd4a08a9f code/hub/e8-r715-whole-hosted/data/residual-isometries.json +b2af02f593cd161bea64e6cd793508386914136be519f80726c071697379d5a9 code/hub/e8-r715-whole-hosted/data/word.json.gz +7c6997c455bd55acca3a1603797c34e7733d557c27a7694a1429ff15773a505d code/hub/e8-r740-replica32/code/bank_routes.py +1cb286196c1530d06f50f0997febc5993b388f33464e295611b920ba30a24eeb code/hub/e8-r740-replica32/code/e8core.py +aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098 code/hub/e8-r740-replica32/code/engines/base_two_moment.py +81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482 code/hub/e8-r740-replica32/code/engines/moment.py +c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c code/hub/e8-r740-replica32/code/engines/outer.py +d6ae4a556472d403773cd2117c992bfc10e1187112da1b3893f3fae628a131dd code/hub/e8-r740-replica32/code/tile_m.py +e12ed7ddd13cee101ba74a083b54665fd64d0b122b0bad5b83d817dcc8bae9d8 code/hub/e8-r740-replica32/data/residual-isometries.json +d8d6d3d3f336720302bc40b3c1504fe3c3583a7a8d707bb9bd7b21f85e5e69c6 code/hub/e8-r740-replica32/data/word.json.gz +d8b90cd5d152df3c7c351230863d9e61816ad5e1f21d69bea1a86a5daad559a3 code/hub/idle-axis-hosting/hosting_core.py +ac63ee481f3d75cb9f0658faaa2412db81d55bc44d9f1ff1c0329ce1e75aa0d4 code/hub/r740-hosted-eleven/code/emit.py +9554182d67e434ea84b4430f909a2c400abc755d8487b51454a8e6968e62859d code/hub/r740-hosted-eleven/code/geometry.py +de4a9b9cd797e1a05da56f62cfe725c8728cea3a4aa031b7d1b0a68f869760d6 code/hub/r740-hosted-eleven/code/row_bound.py +52dbbb68e8c147690d15eaa1d952df05d074b0c121885a4159d9f6732f391872 code/hub/r740-hosted-eleven/data/selection.json +ac63ee481f3d75cb9f0658faaa2412db81d55bc44d9f1ff1c0329ce1e75aa0d4 code/hub/r740-hosted-rank149/code/emit.py +b23fda74a7979179e8fd83ee9870c1e232442cc90c05077adaabfe31d050d1e4 code/hub/r740-hosted-rank149/data/residual-isometries.json +4d9c2cf6a3d31a6faa287731e0721cb16601b0bc5c1a186b9645bfb5760ce8db code/hub/r740-hosted-rank149/data/selection.json +41626789888ee070e1b435fa380b10ab9b88e3cf7d8d8e166ecef17269bbcf47 code/hub/r740-hosted-rank149/data/word.json.gz +36eeda3184bd009e89462b65c8725d10860c444f8da8f1f87e5f6e50120011ca code/nine/geometry.py +aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098 code/pricing/base_two_moment.py +81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482 code/pricing/moment.py +c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c code/pricing/outer.py +98cd03bc9582e7bd0ab194c191ea8eea940539e510051443ab9fd3e572a364ab code/pricing/prime_witnesses.py +e28fd87d0e34a6f6f6f1fddb6c4891deac220662c954de855d7aa5a7f9cceca4 code/provenance.py +721d859a6517d665ca84d03ef89668da3aae7433ffb0ee47faf37f2aeb85450e code/skeleton/e8.py +7cdcf48078ed4beacd2e240aa8145e4aa6984558748d07659cb1b252786e073a code/skeleton/gen.py +bb356568fa05e7bfd5fcd9012903611cf742729a99b4dc3a13685355b2678ae3 code/skeleton/geom.py +2b6c12d96f24a4e81f2c807827c2b74cf80037367fc8034e8c871dd5ce008351 code/skeleton/wordkit.py +1fb726ea3818fe0837cceb0dd22a71a0814f064e5e781628104610d6468e0e55 data/bit/bitE8-r865.json.gz +835eb96e147740fc7454f8cfb3dbd34ae89524b1dbd89a61e9288eae8ab6a5b9 data/bit/bitE8mut-r489.json.gz +dce3f4b76aa3f6c3ba826ce556ffa61398b33e81e4d1a226dd2a36ce684fb02e data/complex-b.json +18b42250c3faf6f0df76fcab6c3a483582192ad7bb09cb1985f4b0bb91d67024 data/complex/pr448/EXPECTED.json +a4312cb0c53c2066a28b683a971a41e7d76c5f6d828a96481c3ae7b3c01bb2f3 data/complex/pr458/EXPECTED.json +188f9d1a7450496dbfd8d64381febd20b0597141537eb1a003435297df2d1720 data/complex/pr471/EXPECTED.json +70e515f0a5a2f9508cd030d35a99f90981a6eccc027c9ad5a3c77f5860310910 data/complex/pr473/EXPECTED.json +07bd05d14c71df8925b0b03510b2b337334b73ac425a94e03b2ec34ed2680164 data/complex/pr478/EXPECTED.json +799fa4ab2f785c478c3cdcb6c1c0428a5ce6e3ddbe4a4b2fd88630d811a593f6 data/complex/pr483/EXPECTED.json +0c93018a23bc573c7d155d4786e0c3978e95be0fda974076697939a1a1d8e5be data/complex/pr484/EXPECTED.json +61f790657c465d16d3455f48f90f816797b9ea08bf02dbd0c90d2cf41836257e data/eleven/hosting.json +0fa5b353a0321af2ce4e2045db1d4c2d6418a11663894e2afcdb1eaa1984bddc data/eleven/residual-isometries.json +d69ffe3326140bc541b8f1639e02db43a5835ab8ca02cc742b5bee2bf2ef1ba9 data/skeleton/d4part-pairs.json +f6162bb4d8092bc233700fa7ebc6a0d79f2893135aee18e998369044abb3f44b data/skeleton/plan-skB.json +b09aa45d5651720e10326cde559c863ba3ea45fe2fb6b4aaa3bfaa66a8fcf69f discovery/README.md +a64927c340a4772ce0682b349e0c90c80d1a766000ccf397fb41b36a31929179 discovery/d4part.py +2aaaac18e083d289d4341e734c32571c89c51fefba04b388d407c7372b906dc7 discovery/host_select.py +40e8dea1b4b71c5afd5993625f57bcac089dd2f72dfbc4dbc23ce917e5a61010 discovery/plan.py +420094be2af295eed03a983dd66debbbe9cfb78d8252859f4498a615a0074b99 portable-include/bits/stdc++.h +6023d480f929cdfa4e2f35e361eea003451cd6695af806935a32038b0115abb5 requirements.txt +0f9248aa3611dfe2b5d59dbe992c6f7d21a0cc4f1de2b5ed05a6110191191224 verify.sh diff --git a/research/e8-bit-carrier-skeleton/NOTICE.md b/research/e8-bit-carrier-skeleton/NOTICE.md new file mode 100644 index 0000000000..5a0ecdcd2c --- /dev/null +++ b/research/e8-bit-carrier-skeleton/NOTICE.md @@ -0,0 +1,69 @@ +# Notice + +Apache-2.0 (`LICENSE`). Prepared by eumemic with substantial Anthropic Claude assistance. + +## New in this package + +- `code/skeleton/`: the D4 quad-skeleton geometry (`geom.py`), the word builder with source registers as gate + destinations (`wordkit.py`), the generator (`gen.py`) and an E8 root-line helper (`e8.py`, #370's Hamming + coordinates and line order). +- `data/skeleton/plan-skB.json` (CP-SAT plan nominated by `discovery/plan.py`), `data/skeleton/d4part-pairs.json` + (the 5-pair D4 partition, found by `discovery/d4part.py`), `data/bit/bitE8mut-r489.json.gz` (the word), + `data/eleven/hosting.json` (frozen hosting selection nominated by `discovery/host_select.py` with #442's integer + programme), `data/eleven/residual-isometries.json` (the frame-zero record of #443's isometry format: every helper of + this word enters at frame zero). +- `code/bit/independent/relax.py` (generates the relaxed #370 checker), `interface.py` (#425 lemma hypotheses), + `mutate_mut.py` (word-level mutants and hypothesis controls), `code/bit/mutate_records_mut.py` (record-level + mutable-source mutants). +- `code/eleven/adapt.py` and the adapted files it checks, `code/eleven/{emit,audit,local_audit}.py` (PR #472's files + plus 19 listed edits: R = 489, package paths, a `--hosting` argument, one frame-zero entrance instead of eleven). +- `code/eleven/assemble.py`: PR #472's bit invoice and pricing arithmetic with R as a parameter, and its outer + assembly run once per cited complex supplier. +- `code/cited.py`, `data/complex-b.json`, `verify.sh`, `EXPECTED.json`, `requirements.txt`, `discovery/`, + `.github/workflows/e8-bit-carrier-skeleton.yml`. + +## Vendored, byte-identical (git blob ids in `SOURCE-pr*.json`, checked by `code/provenance.py`) + +- **PR #370 (Dylan Crow / utcorvusvolat-dotcom, with Anthropic Claude assistance), commit b7fe9cd:** the independent + checker `checkword.py` and its controls `mutate.py`; `export_records.py`, `mutate_records.py`, `stage_cohort.py`; + PR #266's official cohort checkers as generalised there (`legality_h.cpp`, `columns_h.cpp`, NCOPY); nlohmann/json + (`json.hpp`, MIT licence in its header); `gram_frames.py`; PR #315's engines (`code/pricing/`, DreamingOfClouds); + the R865 word `data/bit/bitE8-r865.json.gz` (read only for the E8 label table by the geometry scripts); `LICENSE`. +- **PR #381 (DaysSky, assisted with Claude), commit 00765b2:** `columns_k.cpp`. +- **PR #386 (Zhihao Chen / jacklightChen, with OpenAI Codex assistance), commit dd11cf8:** the nine-stage bit geometry + `code/nine/geometry.py` (parent geometry checked by the eleven-stage audit) and `portable-include/bits/stdc++.h`. +- **PR #436 (eumemic, with Anthropic Claude assistance), commit 8f6b829:** `code/provenance.py`. +- **PR #445 (chafreaky, with OpenAI Codex assistance), commit 40ab91d:** `code/hub/r740-hosted-eleven/code/geometry.py` + (eleven-stage geometry), `row_bound.py` (orthogonal-cover row bound), `emit.py` and `data/selection.json` (used + unchanged for the PR #445 control). +- **PR #451 (chafreaky, with OpenAI Codex assistance), commit f3a3815:** `code/hub/r740-hosted-rank149/`: its + eleven-stage bit emitter (byte-identical to PR #445's), frozen selection, R740 rank149 word and isometries + (PR #451 control). +- **PR #472 (chafreaky, with OpenAI Codex assistance), commit 259c684,** and files its branch carries unchanged: + - `code/hub/e8-r715-whole-hosted/`: PR #472's eight-replica pooled emitter, independent audit, local projector + audit and assembly (the originals of the adapted files), its R715 word, isometries and frozen hosting (used + unchanged for the PR #472 control); + - `code/hub/e8-r740-replica32/`: PR #443 (chafreaky): `bank_routes.py`, `tile_m.py`, `e8core.py`, the R740 rank138 + word and its isometries (PR #445 control); PR #315's engines (DreamingOfClouds) in `code/engines/`; + - `code/hub/idle-axis-hosting/hosting_core.py`: PR #442 (DaysSky, with Anthropic Claude assistance). +- **Receipts (`data/complex/`):** `EXPECTED.json` of PR #484 (DreamingOfClouds, 035845c), PR #471 (Dugongue, + 56b3da6), PR #458 (chafreaky, 44e9eae), PR #448 (higherbeing, 359022b), and of the bit-bound frontier PRs #483 + (Dugongue, 3738c3c), #473 (rohanarun, c7590f1) and #478 (Dugongue, bea1d52). + +The repository-level files `certificates/joint-dual-kappa.json`, `certificates/joint-dual-validation.json` and +`research/joint-dual/SOURCE.json` in this branch are byte-identical to rohanarun's PR #318 (a45747d). They repair +stale root-file pins so the repository's joint check passes; #417, #436 and #439 carry the same repair. + +## Cited, not rebuilt + +Complex coarse savings in `data/complex-b.json`, each bound to its PR's `EXPECTED.json` by `code/cited.py`: +PR #484 (primary; draft, conditional on its Lemmas A and G), PR #471 (the complex supplier of #473, #478 and #483), +PR #458 (the complex supplier of #472) and PR #448 (information only; disputed cross-copy split). No complex +construction is rebuilt here. + +## Ideas used + +PR #425 (Zhihao Chen, with OpenAI Codex assistance): the scalar-interface lemma that permits source registers as +gate destinations when the full-frame cleanup restores them. PR #463 (DreamingOfClouds, with Claude Opus 5.5): the +carrier bound (three registers leave a source's line). PR #433 (icekylinx): source rows written on the bit side. +PR #442 (DaysSky): idle-axis hosting of whole residuals. Jacob Sussman introduced the E8 unit. diff --git a/research/e8-bit-carrier-skeleton/README.md b/research/e8-bit-carrier-skeleton/README.md new file mode 100644 index 0000000000..dd0d7c4361 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/README.md @@ -0,0 +1,164 @@ +# E8 bit word with source carriers: R = 489 on a D4 quad skeleton + +A new E8 bit supplier (h = 8, v = 120, 9 retained totals) with **489 helpers**; the hub's best bit word had 715 (#463). +Its source registers also carry partial sums, which is PR #425's mutable-basis interface applied on the bit side +(the review point below). Priced by the hub's eleven-stage whole-residual hosted bit pipeline (#445 geometry, +#472 emitter, audit and finite invoice, #442 hosting, #315 engines): + +| quantity | value | +|---|---| +| bit c, eleven stages, eight pooled replicas, every residual whole and hosted (10^-24 grid) | `391360506745414227149/250000000000000000000000` = 0.001565442026981656908596 | +| same pipeline on #472's R715 word (control, reproduced exactly) | 0.001293771240692396056124 | +| five-stage saving from #370's checker (no envelope) | 0.00127887365561970469 | + +The bit side no longer binds: c is 20.6% above the best whole-residual bit supplier (#483, 0.0012982901) and 18.0% +above the largest whole-residual complex b. Through the six-level, 47-inequality outer assembly (#434/#315, as in +#472), every composition is complex-bound: + +| complex supplier (cited from its receipt, not rebuilt) | complex b | κ | +|---|---|---| +| **#484** (DreamingOfClouds; draft, conditional on its Lemmas A and G) | `663394767670133/5·10^17` = 0.001326789535 | **`662515748707749/500000000000000000` = 0.001325031497415498** | +| #471 (Dugongue), the complex supplier of #473, #478 and #483 | `1305231506267591/10^18` | `260706019542937/200000000000000000` = 0.001303530097714685 | +| #458 (chafreaky), the complex supplier of #472 | `1297203880559577927527/10^24` | `323880830669511/250000000000000000` = 0.001295523322678044 | + +The best whole-residual κ on the hub when this was prepared is #483's 0.001296606691405309, bit-bound with +#471's complex b. With #484's supplier this word gives +2.19% over it; with #471's supplier, +0.53%. Each κ above +is the complex cap of its supplier: any bit word with c above b gives the same value. The #484 value inherits that +draft's two lemmas as review points. + +Information only, not a claim: #448's cross-copy complex supplier (b = `718766148669433/5·10^17` = 0.001437532) +would give κ = `358867191156973/250000000000000000` = 0.001435468764627892, complex-bound. That number rests on +#448's cross-family residual split, which #451 disputes (research/cross-family-residual-obstruction; the author's +rebuttal is on #451's thread). + +## The word + +`data/bit/bitE8mut-r489.json.gz` is rebuilt byte-for-byte by `code/skeleton/gen.py` from the frozen plan +`data/skeleton/plan-skB.json` and the D4 partition `data/skeleton/d4part-pairs.json`. Format: bitE8/1 (#370), with +gates allowed to write source registers. + +- **Partition.** The 120 root lines split into 10 D4 sub-root systems (12 lines each), in 5 orthogonally + complementary pairs. Each block has 3 orthogonal 4-frames: 30 four-frames and 180 cells (a cell is a pair of lines + in one 4-frame; it spans 2 dimensions and contains exactly those 2 lines). +- **Sources.** A fixed matching splits each 4-frame into two matching cells and four cross cells. A source stays in + its matching cell and two carriers copy it at its line into its two cross cells: three branches per source. Three + is the minimum: s⊥ (an E7) is a spherical 4-design, so two hyperplane sections do not cover it (the carrier bound of + #463). +- **Cells and quads.** Each cell delivers its sum to its two quads and keeps single lines: a cross cell uses its + two branches and one empty register, a matching cell its two sources and two empty registers. A quad is a + 4-dimensional D4 frame made of 6 cells from 6 blocks (3 complementary block pairs); there are 60. A butterfly on + the 6 delivered cell sums gives 6 outputs S + u_H, one per D6 the quad feeds (S is the quad's sum; u_H is the + owner D6's d-cell, its Q-cell or both). +- **Tops.** Target t is reached through the three D6 frames {t, e}⊥ (e the other lines of its 4-frame). At the D6 + shared with its matching partner it reads two quad outputs and a Q-delivery; at t⊥ it reads one register from each + of its two other D6 frames. +- **Q-nodes (the source writes).** For each block, its 12 sources (all sitting in matching cells) undergo one + invertible F2 transform at the block's D4 frame. It produces the 6 Q-deliveries read by the complementary block's + targets and 6 leftovers. These are the only gates that write sources: 577 gates, all at block D4 frames, each + reading one other source; 117 of the 120 source registers are written. +- **Totals and cleanup.** The 9 decoder totals of #370 are collected at the full frame on 9 fresh registers from + registers that are no longer needed. The cleanup C is the literal reverse of every source and helper gate of A and + B at the full frame, so every source and helper is restored; D is #370's frame-zero dirt compensation. +- **Count.** 120 sources, 240 carriers, 240 cell registers, 9 totals: R = 489. Local paid histogram + {1:1200, 2:1440, 4:180, 6:120, 8:18}, rank mass 5664 = 8R + 72 + 240·7. + +## Review point: source registers as gate destinations + +PR #370's independent checker contains one assertion this word does not meet: "x registers are never destinations". +PR #425's scalar-interface lemma (Zhihao Chen) shows the assertion is a sufficient condition, not a necessary one: +if no target feeds a source or helper register, the raw word is z' = U z, y' = V y + J x + K s; a frame-zero +preconditioner (here D) and U⁻¹ at the common full frame after the last climb (here C) give exactly +(x, s, y) → (x, s, y + x). #425 uses this with sources carrying packets below the full frame on the complex side; +#433 (icekylinx) already wrote source rows on the bit side, at the full frame only (559 XORs in its R758 word). +This word writes sources below the full frame (block D4 frames), as #425's packets do. + +What the package checks about it: + +- `code/bit/independent/relax.py` generates the relaxed checker from #370's pinned file by removing exactly that + assertion (it counts such gates instead). Every other check is unchanged, including the exact F2 replay on all + 729 columns, which requires every source to end holding exactly its own column. The stock file is run as well and + must refuse the word with "x register written". +- `interface.py` checks the lemma's hypotheses directly: no target feeds a source or helper; D writes only targets + from helpers at frame zero; C acts only at the full frame and is the literal reverse of the source and helper gates + of A and B; B writes only targets. +- Mutants aimed at the interface are rejected: dropping a source cleanup gate, corrupting a packet that targets + read while keeping every source restored, leaving a source unrestored, moving a source write below the source's + frame, dropping a source write (relaxed checker); the same three record-level mutants against both official + column checkers; two F2-neutral edits in which a target feeds a source or a helper (accepted by the F2 checker, + rejected by `interface.py`). +- The official cohort checkers (`legality_h`, `columns_h`, `columns_k`) treat every register alike and accept the + word unchanged. In the hub's bit address realization (#472's PROOF.md, "Shared physical labels") the pullback of + D_F on F2-valued streams does not depend on whether a register is called a source, helper or target, so the + common-frame argument covers source registers as it covers helpers. The mutable-basis realization stays a listed + conditional interface, as in #472, #473 and #478. + +## Checks (`verify.sh`) + +0. Manifest; 50 vendored files byte-identical to their PRs (git blob ids, `SOURCE-pr*.json`); the adapted hub + files equal #472's files plus the listed edits (`code/eleven/adapt.py --check`); cited complex b values equal + their PRs' own receipts (`code/cited.py`). +1. The word rebuilt from the frozen plan equals the shipped word. +2. #370's checker: the stock file refuses; the relaxed copy passes (legality, exact F2 on 729 columns, 671 frames + with positive Gram determinants, primes {2}, five-stage price); `interface.py`; 11 word-level mutants and 2 + hypothesis controls. +3. Official checkers: legality (NCOPY = 9; 33,990 ADDs, rank mass 5,664), five-stage formal columns (969 columns, + prefix payload 100 bits < 104), eleven-stage formal columns (#381's `columns_k`, KPAIRS = 5: 1,689 columns, + 2,880 bridge additions, 24/24 omitted-bridge controls), the KPAIRS = 2 regression, #370's 6 record-level + mutants and 3 mutable-source record mutants. +4. Exact Gram determinants and prime witnesses on all 672 frames. +5. Eleven-stage whole-residual hosting: #386 nine-stage geometry (parent of the audit), #445 eleven-stage geometry, + #472's emitter and independent audit with R = 489 (all 43,032 helper residuals hosted whole on idle data + families of the eight pooled replicas, 6,579 unbanked scalar columns restored, 24 omitted bridge shears + rejected, 22 template mutations rejected, 3,252,216 renamed instructions), then #472's bit invoice and both + moment engines, and the outer assembly per cited supplier (#484, #471, #458; #448 for information). +6. Controls through the unmodified hub files: #472's R715 word reproduces c = 0.001293771240692396056124 and, + with #458's b, κ = 0.001292099559442278 (#472's published values); #445's R740 word through #445's emitter + reproduces c = 0.001264963576077378514188, and #451's R740 rank149 word through #451's emitter (byte-identical to + #445's) reproduces c = 0.001267536342017397153864. +7. Every number above against `EXPECTED.json`. + +```sh +python -m pip install -r research/e8-bit-carrier-skeleton/requirements.txt +bash research/e8-bit-carrier-skeleton/verify.sh /absolute/new/output +``` + +Python 3.11+, numpy, sympy, a C++17 compiler (`CXX`) and Boost headers (`BOOST_INCLUDE`). About 2 minutes. + +## Finite invoice + +The physical prefix (#472's chronological cancellation-free bound over physical families) is 2,119 bits, charged +at 2,176; the three-level coefficient is 6,411 bits, charged at 6,464. Both are larger than #472's (804/2,496) +because the Q-node butterflies and the totals have long XOR chains; they stay below the hub's precedent (#473 +charges 3,456 and 10,304) and only enter the finite cutoffs. Maximum child 56, three-level halving, row +coefficient 19,431 < 20,161 (#445's orthogonal-cover bound). + +## Bounds for this family (analysis, not run by verify.sh) + +R ≥ 120 for any design (top arrivals; carriers). For tops through consistent D6 triples, at least 14 registers per +4-frame at dimension 6, so R ≥ 300. With three branches per source on this partition, at least 3 registers per cell +(540 at dimension 2), so R ≥ 420. With the totals in phase A, a brute force over all d-parity patterns needs 4 +single-line registers per 4-frame for the targets' parities, and each block's Q-node needs all 4 lines of each of +its 4-frames; no register can do both, and 3-register cells leave only 6 single-line registers per 4-frame. That +gives 20 registers per 4-frame, 600 in all, so R ≥ 480. R = 480 is reached with the totals on leftover registers, +but its prefix payload is 129 bits > 104; nine fresh total registers give R = 489 at 100 bits. + +## Scope + +Conditional on every interface #472's eleven-stage composition retains: the all-size bit/Gaussian compiler, +mutable-basis and target-label realization, whole-call correlated-helper hosting (#442), compressed windows, +restored work, common grid and tape, precision, row and analytic contracts. Complex savings are cited from their +PRs' receipts, not rebuilt; the primary κ also rests on #484's Lemmas A and G. The hosting selection is a frozen nomination of #442's integer programme +(`discovery/host_select.py`) and the plan a CP-SAT nomination (`discovery/plan.py`); neither is claimed optimal. +No unconditional multiplication theorem, Lean proof or κ = 1 result is claimed. + +## Credits + +Zhihao Chen (#425: the mutable-basis interface lemma; #386: nine-stage geometry); DreamingOfClouds (#463: the +carrier bound; #315: moment engines; #484: the primary complex supplier); DaysSky (#442: idle-axis hosting; #381: `columns_k`); chafreaky (#445, #451, +#472: eleven-stage geometry, row bound, pooled whole hosting, emitter, audit and invoice; #443's bank routes; +#458's complex supplier); Dylan Crow (#370: bitE8/1 format, independent checker, generalised official checkers); +icekylinx (#433: source rows written on the bit side); Dugongue (#471: complex supplier; #483: current +whole-residual frontier); higherbeing (#448, information only); eumemic (#436: R740 and the provenance tooling); Jacob Sussman (the E8 unit). Details in +`NOTICE.md`. + +Prepared by eumemic with substantial Anthropic Claude assistance. Apache-2.0 (`LICENSE`). diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr370.json b/research/e8-bit-carrier-skeleton/SOURCE-pr370.json new file mode 100644 index 0000000000..1b30f277af --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr370.json @@ -0,0 +1,69 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/370", + "head_repository": "utcorvusvolat-dotcom/e8-bit-kappa-8.7548e-4", + "commit": "b7fe9cdf2da009c947ff6b334c562bc190b30373", + "note": "PR #370 (Dylan Crow / utcorvusvolat-dotcom, with Anthropic Claude assistance): independent checker and its word-level controls, record exporter and record-level controls, PR #266's official cohort checkers as generalised there (NCOPY), Gram/prime-witness checker, PR #315's engines (DreamingOfClouds) as vendored there, the E8 label table (via its R865 word), LICENSE. Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "LICENSE": { + "source_path": "research/e8-bit/LICENSE", + "blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64" + }, + "code/bit/independent/checkword.py": { + "source_path": "research/e8-bit/code/bit/independent/checkword.py", + "blob": "da4e0fe05067184d4dab1e130ae1384c1fa983f5" + }, + "code/bit/independent/mutate.py": { + "source_path": "research/e8-bit/code/bit/independent/mutate.py", + "blob": "eba592fd468e0d7e7e5100fe99da6eb548c5906b" + }, + "code/bit/export_records.py": { + "source_path": "research/e8-bit/code/bit/export_records.py", + "blob": "3632d370486a02f5456f7643ced03f8c925b2350" + }, + "code/bit/mutate_records.py": { + "source_path": "research/e8-bit/code/bit/mutate_records.py", + "blob": "6794516f665d36eac189894e350a5ad01113cb4c" + }, + "code/bit/regression/stage_cohort.py": { + "source_path": "research/e8-bit/code/bit/regression/stage_cohort.py", + "blob": "f6d7afe3e623208c4207b6a683a1e3e49249e31c" + }, + "code/bit/checkers/legality_h.cpp": { + "source_path": "research/e8-bit/code/bit/checkers/legality_h.cpp", + "blob": "cb1233c7e96b1aa8bbf4d2e4165d75ab0dca64b9" + }, + "code/bit/checkers/columns_h.cpp": { + "source_path": "research/e8-bit/code/bit/checkers/columns_h.cpp", + "blob": "00c5a3a5d81d083582f60f33dd2e7bea5049c37f" + }, + "code/bit/checkers/json.hpp": { + "source_path": "research/e8-bit/code/bit/checkers/json.hpp", + "blob": "82d69f7c5d044c9887c96b90c97f5639083ecd14" + }, + "code/bit/checkers/gram_frames.py": { + "source_path": "research/e8-bit/code/bit/checkers/gram_frames.py", + "blob": "b740d47295c02692260d7cc01874a49fe48f78ab" + }, + "code/pricing/moment.py": { + "source_path": "research/e8-bit/code/pricing/moment.py", + "blob": "7d697cb45203fe72d97037403d6da41f71f3b7fd" + }, + "code/pricing/base_two_moment.py": { + "source_path": "research/e8-bit/code/pricing/base_two_moment.py", + "blob": "14a90fa0e788217856f070382c9e61bd7c603c61" + }, + "code/pricing/outer.py": { + "source_path": "research/e8-bit/code/pricing/outer.py", + "blob": "43007488ad2c43187c77cc6798beff8b1cd76ad2" + }, + "code/pricing/prime_witnesses.py": { + "source_path": "research/e8-bit/code/pricing/prime_witnesses.py", + "blob": "7f16d930302ae879c562dd58e085d9747fcac077" + }, + "data/bit/bitE8-r865.json.gz": { + "source_path": "research/e8-bit/data/bit/bitE8-r865.json.gz", + "blob": "8bec1751f7e33c3a1e4673ef5dbc34d6f205321e" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr381.json b/research/e8-bit-carrier-skeleton/SOURCE-pr381.json new file mode 100644 index 0000000000..fb0b0edd13 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr381.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/381", + "head_repository": "DaysSky/integer-mult-bounds", + "commit": "00765b291d0f924f337298eb1e2930cb0878b95e", + "note": "PR #381 (DaysSky, assisted with Claude): the B_K formal-columns checker columns_k.cpp (KPAIRS). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "code/bit/checkers/columns_k.cpp": { + "source_path": "research/e8-nine-stage-kappa/code/bit/checkers/columns_k.cpp", + "blob": "42bb232fbec4de703e70cc13dc2f39a3b43a3a01" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr386.json b/research/e8-bit-carrier-skeleton/SOURCE-pr386.json new file mode 100644 index 0000000000..3744861904 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr386.json @@ -0,0 +1,17 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/386", + "head_repository": "jacklightChen/integer-mult-bounds", + "commit": "dd11cf8069554f0333afde398f12a56c3a7c29dd", + "note": "PR #386 (Zhihao Chen / jacklightChen, with OpenAI Codex assistance): compressed nine-stage bit geometry (used here only as the parent geometry of the eleven-stage audit) and the portable bits/stdc++.h. Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "portable-include/bits/stdc++.h": { + "source_path": "research/e8-bit-complex-nine/portable-include/bits/stdc++.h", + "blob": "fc5664e929d9a81d9b4926bee049a93330be86ec" + }, + "code/nine/geometry.py": { + "source_path": "research/e8-bit-complex-nine/geometry.py", + "blob": "91594e0223e8fac49162b5aef834ffaa8e94a254" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr436.json b/research/e8-bit-carrier-skeleton/SOURCE-pr436.json new file mode 100644 index 0000000000..f190527ae1 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr436.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/436", + "head_repository": "eumemic/integer-mult-bounds", + "commit": "8f6b8297b08ad863940d5168a2db5402fad3690f", + "note": "PR #436 (eumemic, with Anthropic Claude assistance): the provenance checker. Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "code/provenance.py": { + "source_path": "research/e8-bit-elimination-reuse/code/provenance.py", + "blob": "9bfcb106230e454d9405ce5eb42dd2218d905ea6" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr445.json b/research/e8-bit-carrier-skeleton/SOURCE-pr445.json new file mode 100644 index 0000000000..ae29de391a --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr445.json @@ -0,0 +1,25 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/445", + "head_repository": "chafreaky/integer-mult-bounds", + "commit": "40ab91daf2b5e87fc4071dedae1699d5d7e7cecc", + "note": "PR #445 (chafreaky, with OpenAI Codex assistance): eleven-stage compressed bit geometry, elementary orthogonal-cover row bound, and its eleven-stage emitter and frozen hosting selection (used unchanged for the PR #445 R740 control). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "code/hub/r740-hosted-eleven/code/geometry.py": { + "source_path": "research/r740-hosted-eleven/code/geometry.py", + "blob": "b4ad5074014dc00a01143910eb1cd27fafe0e15c" + }, + "code/hub/r740-hosted-eleven/code/row_bound.py": { + "source_path": "research/r740-hosted-eleven/code/row_bound.py", + "blob": "11d3c0d48e4ea5a02ac3b6689f3c7d36f2972eb8" + }, + "code/hub/r740-hosted-eleven/code/emit.py": { + "source_path": "research/r740-hosted-eleven/code/emit.py", + "blob": "5ff0de0d6f088ac95e25a2a7aed8653e8cd0333e" + }, + "code/hub/r740-hosted-eleven/data/selection.json": { + "source_path": "research/r740-hosted-eleven/data/selection.json", + "blob": "8e548e5a9204a909d539ba36b866804b256d4c2b" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr448.json b/research/e8-bit-carrier-skeleton/SOURCE-pr448.json new file mode 100644 index 0000000000..3648ab3692 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr448.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/448", + "head_repository": "higherbeing/integer-mult-bounds", + "commit": "359022bcd71143e45d48def0dd005bf67f339aa7", + "note": "PR #448: its EXPECTED.json receipt (cited complex b). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "data/complex/pr448/EXPECTED.json": { + "source_path": "research/cross-copy-hosting/EXPECTED.json", + "blob": "1574e6488b6fc59191ae49fcc0c089e48b196fbd" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr451.json b/research/e8-bit-carrier-skeleton/SOURCE-pr451.json new file mode 100644 index 0000000000..fbd9881e09 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr451.json @@ -0,0 +1,25 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/451", + "head_repository": "chafreaky/integer-mult-bounds", + "commit": "f3a38153678b55063fc005901cc968266166507d", + "note": "PR #451 (chafreaky, with OpenAI Codex assistance): its eleven-stage bit emitter (byte-identical to PR #445's), frozen hosting selection, R740 rank149 word and residual isometries, used unchanged for the PR #451 control. Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "code/hub/r740-hosted-rank149/code/emit.py": { + "source_path": "research/r740-hosted-rank149/code/emit.py", + "blob": "5ff0de0d6f088ac95e25a2a7aed8653e8cd0333e" + }, + "code/hub/r740-hosted-rank149/data/selection.json": { + "source_path": "research/r740-hosted-rank149/data/selection.json", + "blob": "c57069f7385c3b6aff4fe3c73c0a21bae727c76f" + }, + "code/hub/r740-hosted-rank149/data/word.json.gz": { + "source_path": "research/r740-hosted-rank149/data/word.json.gz", + "blob": "3c8489a29f0de2cad7dafaddc340a1ff197d5172" + }, + "code/hub/r740-hosted-rank149/data/residual-isometries.json": { + "source_path": "research/r740-hosted-rank149/data/residual-isometries.json", + "blob": "ec8b4131d203d7a288ca078ca559f922d38fe9d2" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr458.json b/research/e8-bit-carrier-skeleton/SOURCE-pr458.json new file mode 100644 index 0000000000..c36c74cbea --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr458.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/458", + "head_repository": "chafreaky/integer-mult-bounds", + "commit": "44e9eae8287951c1e6dbbd3c553f5743fe2240b0", + "note": "PR #458: its EXPECTED.json receipt (cited complex b). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "data/complex/pr458/EXPECTED.json": { + "source_path": "research/e8-complex-adapted-kernel/EXPECTED.json", + "blob": "e06a17c177eee0e0962c96ea61554239ef38ef4d" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr471.json b/research/e8-bit-carrier-skeleton/SOURCE-pr471.json new file mode 100644 index 0000000000..0dc019cfb1 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr471.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/471", + "head_repository": "Dugongue/integer-mult-bounds", + "commit": "56b3da6aa1295d37ce43f1753479bfe4737b7ac3", + "note": "PR #471: its EXPECTED.json receipt (cited complex b). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "data/complex/pr471/EXPECTED.json": { + "source_path": "research/e8-tensor-normalization/EXPECTED.json", + "blob": "ed1e72239ebebdbfad847fb817e5546f980c1d8d" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr472.json b/research/e8-bit-carrier-skeleton/SOURCE-pr472.json new file mode 100644 index 0000000000..31acb027ec --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr472.json @@ -0,0 +1,73 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/472", + "head_repository": "chafreaky/integer-mult-bounds", + "commit": "259c68488b7aa8a14cf3fcae7fc499381c9bf729", + "note": "PR #472 (chafreaky, with OpenAI Codex assistance) and the files its branch carries unchanged: research/e8-r715-whole-hosted (PR #472: eight-replica pooled whole-residual emitter, independent audit, local projector audit, assembly, R715 word, isometries, frozen hosting); research/e8-r740-replica32 (PR #443, chafreaky: bank routes, tiling, engine wrapper, the R740 rank138 word and its isometries; PR #315 engines by DreamingOfClouds); research/idle-axis-hosting/hosting_core.py (PR #442, DaysSky). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "code/hub/e8-r740-replica32/code/bank_routes.py": { + "source_path": "research/e8-r740-replica32/code/bank_routes.py", + "blob": "9e43a876664a26899762f3b8e9a582e684a3650a" + }, + "code/hub/e8-r740-replica32/code/tile_m.py": { + "source_path": "research/e8-r740-replica32/code/tile_m.py", + "blob": "cd5fd9b5399f5e7afe5d2a95bd3504bd543c0d60" + }, + "code/hub/e8-r740-replica32/code/e8core.py": { + "source_path": "research/e8-r740-replica32/code/e8core.py", + "blob": "78983b368715e89fe8524a6dd2c13585d2b5394e" + }, + "code/hub/e8-r740-replica32/code/engines/moment.py": { + "source_path": "research/e8-r740-replica32/code/engines/moment.py", + "blob": "7d697cb45203fe72d97037403d6da41f71f3b7fd" + }, + "code/hub/e8-r740-replica32/code/engines/base_two_moment.py": { + "source_path": "research/e8-r740-replica32/code/engines/base_two_moment.py", + "blob": "14a90fa0e788217856f070382c9e61bd7c603c61" + }, + "code/hub/e8-r740-replica32/code/engines/outer.py": { + "source_path": "research/e8-r740-replica32/code/engines/outer.py", + "blob": "43007488ad2c43187c77cc6798beff8b1cd76ad2" + }, + "code/hub/e8-r740-replica32/data/word.json.gz": { + "source_path": "research/e8-r740-replica32/data/word.json.gz", + "blob": "85390b07e4747feddbf2e16f94b5e0a8a308c191" + }, + "code/hub/e8-r740-replica32/data/residual-isometries.json": { + "source_path": "research/e8-r740-replica32/data/residual-isometries.json", + "blob": "9b8b35cb1528a978e209e1098864cae48c57fd93" + }, + "code/hub/idle-axis-hosting/hosting_core.py": { + "source_path": "research/idle-axis-hosting/hosting_core.py", + "blob": "68b536daa9e6546c0aa046934bf840aaa3c3fde3" + }, + "code/hub/e8-r715-whole-hosted/code/emit.py": { + "source_path": "research/e8-r715-whole-hosted/code/emit.py", + "blob": "df74ad698a98419e828b37d4dfd7c036fc49a890" + }, + "code/hub/e8-r715-whole-hosted/code/audit.py": { + "source_path": "research/e8-r715-whole-hosted/code/audit.py", + "blob": "155b61f2944116423a5be6ae666276e1c1827fe5" + }, + "code/hub/e8-r715-whole-hosted/code/local_audit.py": { + "source_path": "research/e8-r715-whole-hosted/code/local_audit.py", + "blob": "931f884920125b334412f70cf30d9517b084dc7a" + }, + "code/hub/e8-r715-whole-hosted/code/assemble.py": { + "source_path": "research/e8-r715-whole-hosted/code/assemble.py", + "blob": "cd60b4bcfae515fccd7f21fd1ff5a7114a132eb9" + }, + "code/hub/e8-r715-whole-hosted/data/word.json.gz": { + "source_path": "research/e8-r715-whole-hosted/data/word.json.gz", + "blob": "f7d55b8bd45d385011ced25e632a3d922bb77bba" + }, + "code/hub/e8-r715-whole-hosted/data/residual-isometries.json": { + "source_path": "research/e8-r715-whole-hosted/data/residual-isometries.json", + "blob": "5864e4d680035401d53d32adab0369046d80b171" + }, + "code/hub/e8-r715-whole-hosted/data/hosting.json": { + "source_path": "research/e8-r715-whole-hosted/data/hosting.json", + "blob": "381fb06ccbe055f4fbdc7544dcf8c0bae8f96701" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr473.json b/research/e8-bit-carrier-skeleton/SOURCE-pr473.json new file mode 100644 index 0000000000..821caf8f07 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr473.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/473", + "head_repository": "rohanarun/integer-mult-bounds", + "commit": "c7590f1d861f0eaae725cc79901445385aab9125", + "note": "PR #473: its EXPECTED.json receipt (cited complex b; frontier kappa). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "data/complex/pr473/EXPECTED.json": { + "source_path": "research/r715-replica84-complex79/EXPECTED.json", + "blob": "45ee9fde7fdf6b19b6303372068977201b4ef61c" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr478.json b/research/e8-bit-carrier-skeleton/SOURCE-pr478.json new file mode 100644 index 0000000000..608323ccbe --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr478.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/478", + "head_repository": "Dugongue/integer-mult-bounds", + "commit": "bea1d52fd330c699903f81612ee58be81697d1eb", + "note": "PR #478: its EXPECTED.json receipt (cited complex b; frontier kappa). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "data/complex/pr478/EXPECTED.json": { + "source_path": "research/tensor-r715-next/EXPECTED.json", + "blob": "77f5805cd8125602e8c50f4eaba1691440c611c2" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr483.json b/research/e8-bit-carrier-skeleton/SOURCE-pr483.json new file mode 100644 index 0000000000..817396d9c8 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr483.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/483", + "head_repository": "Dugongue/integer-mult-bounds", + "commit": "3738c3ce2d04d6a6c6363408ff9402286f592bc7", + "note": "PR #483: its EXPECTED.json receipt (cited complex b; frontier kappa). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "data/complex/pr483/EXPECTED.json": { + "source_path": "research/tensor-response-r715/EXPECTED.json", + "blob": "f7ff643cd54a334bf46c82989ba155eb6e69adde" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/SOURCE-pr484.json b/research/e8-bit-carrier-skeleton/SOURCE-pr484.json new file mode 100644 index 0000000000..76292df851 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/SOURCE-pr484.json @@ -0,0 +1,13 @@ +{ + "schema": "source-pins/1", + "source": "https://github.com/CrocSwap/integer-mult-bounds/pull/484", + "head_repository": "DreamingOfClouds/integer-mult-bounds", + "commit": "035845ce95f31d0a2dcfb42b8c8e13411271fa5f", + "note": "PR #484: its EXPECTED.json receipt (cited complex b). Every file listed has, in this package, the git blob id it has at the commit above (git ls-tree -r -- ).", + "identical": { + "data/complex/pr484/EXPECTED.json": { + "source_path": "research/e8-complex-gauge-kernel/EXPECTED.json", + "blob": "7f93fcbb9f1c2799fd86dd308ec1e6f0ad2a3264" + } + } +} diff --git a/research/e8-bit-carrier-skeleton/code/bit/checkers/columns_h.cpp b/research/e8-bit-carrier-skeleton/code/bit/checkers/columns_h.cpp new file mode 100644 index 0000000000..00c5a3a5d8 --- /dev/null +++ b/research/e8-bit-carrier-skeleton/code/bit/checkers/columns_h.cpp @@ -0,0 +1,48 @@ +// Generalization (Dylan Crow, with Anthropic Claude assistance): the copied-centre count is the macro NCOPY, defaulting to +// HDIM, so the unmodified PR #346/#352 build (no -DNCOPY) is exactly the original checker. The E8 bit word has 9 +// retained totals at h = 8 (-DNCOPY=9). +#ifndef NCOPY +#define NCOPY HDIM +#endif +#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=VPORTS,r=RHELP,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 +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=VPORTS,r=RHELP,loc=2*v+r,global=2*KPAIRS*v+r,temp=global;const int S=2*KPAIRS+1; +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.src>active;std::vectorbackward;std::vector>>after(S); +auto X=[](int p){return 2*(p-1);};auto Y=[](int p){return 2*(p-1)+1;}; +for(int t=0;t=3&&t%2==1);backward.push_back(b);active.push_back(b?std::array{Y(p),X(p)}:std::array{X(p),Y(p)});} +for(int q=2;q<=KPAIRS;q++){after[2*q-3].push_back({X(q-1),X(q),1});after[2*q-3].push_back({Y(q),Y(q-1),-1}); + after[2*q-2].push_back({Y(q),Y(q-1),1});after[2*q-2].push_back({X(q-1),X(q),-1});} +for(int p=KPAIRS;p>=2;p--){after[S-1].push_back({Y(p-1),Y(p),-1});after[S-1].push_back({X(p),X(p-1),1});} +int nbridges=0;for(auto&a:after)nbridges+=a.size();need(nbridges==6*(KPAIRS-1),"twin bridge count"); +size_t words=(global+63)/64;std::vectora((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");}}} +for(auto q:after[stage])for(int i=0;i(std::chrono::steady_clock::now()-t0).count()<<"s\n";} +for(int bank=0;bank<2*KPAIRS;bank+=2)for(int i=0;ib(2*KPAIRS);for(int z=0;z<2*KPAIRS;z++)b[z]=1u<()},{"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])</2 in Construction-A (Hamming) coordinates, integer Gram 2 B G B^t = B B^t +Checks per frame: rank(B) = dim, A.B = 0 and |A| + dim = h (when A given), det(integer Gram) != 0 (exact Bareiss), and +the prime witness: |det| = residual * prod p^e over PR #315's allowed primes with 0 < residual < 2^80. With --new BASE +only frames absent from BASE are checked (prime_new.py's scope); otherwise every frame. +usage: python3 gram_frames.py WORDDIR --gram {triple9,e8ham} --h H [--new BASEDIR] [--positive]""" +import json, sys, argparse, importlib.util, os, collections +ap=argparse.ArgumentParser(); ap.add_argument('word'); ap.add_argument('--gram',required=True); ap.add_argument('--h',type=int,required=True) +ap.add_argument('--new'); ap.add_argument('--positive',action='store_true'); a=ap.parse_args() +HERE=os.path.dirname(os.path.abspath(__file__)) +s=importlib.util.spec_from_file_location('pw',os.path.join(HERE,'..','..','pricing','prime_witnesses.py')); pw=importlib.util.module_from_spec(s); s.loader.exec_module(pw) +def validate_record(row, dimension, determinant, allowed_primes): # PR #315 prime_check.validate_record, verbatim logic + assert type(row['dimension']) is int and type(row['determinant']) is int and type(row['residual']) is int, 'exact integer witness fields' + assert row['dimension'] == dimension and row['determinant'] == determinant != 0, 'exact determinant mismatch or singular basis' + assert 0 < row['residual'] < 2**80, 'retained prime lower bound' + product = row['residual'] + for prime, exponent in row['factors'].items(): + q = int(prime); assert q in allowed_primes and type(exponent) is int and exponent > 0, 'factor shape'; product *= q**exponent + assert product == abs(determinant), 'factor identity' +def gram(B): + if a.gram=='triple9': + s_=list(map(sum,B)); return [[9*sum(x*y for x,y in zip(B[i],B[j]))-s_[i]*s_[j] for j in range(len(B))] for i in range(len(B))] + if a.gram=='e8ham': + return [[sum(x*y for x,y in zip(B[i],B[j])) for j in range(len(B))] for i in range(len(B))] + raise SystemExit('unknown gram') +def rank_int(B): + M=[r[:] for r in B]; 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]!=0),None) + if p is None: continue + M[r],M[p]=M[p],M[r] + for i in range(len(M)): + if i!=r and M[i][c]!=0: x,y=M[r][c],M[i][c]; M[i]=[u*x-w*y for u,w in zip(M[i],M[r])] + r+=1 + return r +fr=json.load(open(a.word+'/frames.json'))['frames'] +old=json.load(open(a.new+'/frames.json'))['frames'] if a.new else {} +keys=[k for k in fr if k not in old] +stats=collections.Counter(); primes=set(); bits=0; nonpos=0 +for k in keys: + B=fr[k]['B']; A=fr[k].get('A',[]); d=len(B); assert fr[k]['dim']==d + assert d==0 or rank_int(B)==d,('basis rank',k) + if A: assert all(sum(x*y for x,y in zip(r,b))==0 for r in A for b in B) and len(A)+d==a.h,('annihilator',k) + M=gram(B) if d else []; det=pw.det(M); assert det!=0,('degenerate frame',k) + if a.positive: # positive-definite ambient form: every leading principal minor positive + for j in range(1,d+1): + if pw.det([r[:j] for r in M[:j]])<=0: nonpos+=1; break + powers,residual=pw.factor_witness(det); row=dict(dimension=d,determinant=det,residual=residual,factors={p:e for p,e in powers.items() if e}) + validate_record(row,d,det,pw.PRIMES); primes.update(map(int,row['factors'])); bits=max(bits,abs(det).bit_length()); stats[d]+=1 +assert nonpos==0 +print('PASS %s Gram: %d frames checked, all nondegenerate%s; prime witnesses valid; max determinant bits %d; primes %s; by dim %s'%( + a.gram,sum(stats.values()),' and positive definite' if a.positive else '',bits,sorted(primes),dict(sorted(stats.items())))) diff --git a/research/e8-bit-carrier-skeleton/code/bit/checkers/json.hpp b/research/e8-bit-carrier-skeleton/code/bit/checkers/json.hpp new file mode 100644 index 0000000000..82d69f7c5d --- /dev/null +++ b/research/e8-bit-carrier-skeleton/code/bit/checkers/json.hpp @@ -0,0 +1,25526 @@ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.12.0 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013 - 2025 Niels Lohmann +// 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