diff --git a/research/current-triangle-rounded-contract/LICENSE b/research/current-triangle-rounded-contract/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/current-triangle-rounded-contract/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/current-triangle-rounded-contract/NOTICE b/research/current-triangle-rounded-contract/NOTICE new file mode 100644 index 0000000000..9ddec3d16a --- /dev/null +++ b/research/current-triangle-rounded-contract/NOTICE @@ -0,0 +1,11 @@ +Rounded scalar contract for the current three-field repair. +Prepared by Ali Romman with substantial OpenAI Codex assistance. +New work is Apache-2.0. + +SYLforge supplied the unchanged source composition, exact edit, recorded +rational identity and source word. The copied PROVENANCE.md retains the +work of DreamingOfClouds, Clear1nsight, ToikY, Rohan Arun, Ali Romman, +CubeJerry, Douglas Colkitt and earlier framework contributors. +The Mac and 5080 labels denote the same contributor's work environments. +The source composition also received substantial OpenAI Codex assistance. +VENDORED.json records the exact origin of each copied source file. diff --git a/research/current-triangle-rounded-contract/PROOF.md b/research/current-triangle-rounded-contract/PROOF.md new file mode 100644 index 0000000000..46e1b85fe1 --- /dev/null +++ b/research/current-triangle-rounded-contract/PROOF.md @@ -0,0 +1,175 @@ +# Floor-rounding contract for the three-field scalar repair + +## Exact scope + +This theorem concerns the common-coordinate scalar core extracted from +PR #7669 at `95d476623f1468822057554475dc8badb19bfa44`. The full candidate +has canonical SHA256 +`ee251f6005d2a92b887c5b804bd7aac05989d278b2c9ccb3c3091b50d533b08d`. +The verifier reconstructs it from the pinned K372-2 word and all twelve +edit blocks. It then reads the literal old and new local event windows. +No copied source byte is changed. + +Set x=role236, y=role544, z=role1000. In this theorem, x,y,z are arbitrary +integer ticks in one common coordinate system. Each ADD writes the +mathematical floor of its complete rational result. There is no overflow. +The native MOVE instructions are removed only for this stated scalar +model. The actual charts 265,751,927 have different bases. This theorem +does not assume that their physical transports commute with rounding. +It is not an error bound for the complete native or sixteen-call caller. + +The source's rational identity is an existing result. The new result is +the exact floor-rounding law, exactness domain and sharp local error. +It answers whether that rational identity alone proves equality after +rounding each scalar ADD. The answer is no, even in common coordinates. +The source's fine exact grid can still satisfy the stronger domain. + +## Literal programs and rational identity + +The old source window is `[97747,97753)`. The candidate window is +`[97842,97851)`. Each ends immediately before the external read +`ADD 544 972 1/2 927`. Their three and six scalar operations are: + +```text +Old: + y <- y - 2x + z <- z + 2y + x <- x + z/4 + +New: + x <- x + z/4 + z <- z - 2x + y <- y + z/2 + z <- z + 2y + y <- y - x + x <- x + y/2 +``` + +Without rounding, both tapes have the matrix + +```text +M = [ 0 1/2 1/4 ] + [-2 1 0 ] + [-4 2 1 ]. +``` + +The exact matrix check does not include the native chart transports. +The source's separate native proof and evidence remain necessary for +that composition. In particular, the old and new x fields leave this +local window in charts 751 and 927 respectively. + +## Complete all-integer law + +Let A and B be the old and new tapes with floor rounding. Set +`h = floor((z mod 4)/2)`, where `z mod 4` is in `{0,1,2,3}`, including +for negative z. Then, for every integer triple, + +```text +A(x,y,z) = (floor((2y+z)/4), y-2x, z+2y-4x). +B(x,y,z) = A(x,y,z) + (0,h,2h). +``` + +For the old tape, only its last operation can lose a fractional part. +The two earlier operations are integral, which gives A directly. + +For the new tape, write `z=4q+r`, with `0<=r<4`, and let `h=floor(r/2)`. +Its successive changed values are + +```text +x1 = x+q +z1 = 2q+r-2x + y1 = y+q-x+h +z2 = z+2y-4x+2h + y2 = y-2x+h +x2 = q+floor((y+h)/2). +``` + +For each r in `{0,1,2,3}`, +`floor((y+h)/2)=floor((2y+r)/4)`. This proves the formula for B. +The two rounded outputs are equal exactly when `z mod 4` is 0 or 1. +This equality domain is a union of two residue classes; it is not the +same as either tape's no-rounding domain. + +The verifier also checks a second completeness argument. The translations +`(1,0,0)`, `(0,2,0)` and `(0,0,4)` produce integral translations after +every exact prefix of both tapes. Floor commutes with each such integral +translation. Each integer triple therefore reduces to exactly one of +the eight cases `x=0, y in {0,1}, z in {0,1,2,3}`. The receipt records +all prefix translations and all eight outputs. + +## Exactness domains + +Every old division is exact if and only if + +```text +2y+z = 0 mod 4. +``` + +Every new division is exact if and only if + +```text +z = 0 mod 4 and y = 0 mod 2. +``` + +Necessity follows from the first quarter division and final half division +of the new tape. Under these conditions the middle half is also exact. +The old domain is a lattice of index 4 in the integer triples. The new +domain is a sublattice of index 8, hence has index 2 in the old domain. +For both tapes these domains also characterize exact final output Mv. + +For example, take `(x,y,z)=(0,1,2)`. Then `Mv=(1,1,4)` and the old tape +returns that exact value. The new tape returns `(1,2,6)`. All inputs, +intermediate stored integers and outputs fit in the signed four-bit +interval `[-8,7]`. Thus this witness does not depend on overflow. It is a +local scalar witness; reachability at the complete caller is not proved. + +## Sharp output errors + +Let `theta=((2y+z) mod 4)/4`. Relative to the common exact map M, + +```text +A(v)-Mv = (-theta,0,0). +B(v)-Mv = (-theta,h,2h). +B(v)-A(v) = (0,h,2h). +``` + +For Euclidean norm on one real triple, the sharp bounds are + +```text +||A(v)-Mv|| <= 3/4. +||B(v)-Mv|| <= sqrt(89)/4. +||B(v)-A(v)|| <= sqrt(5). +``` + +The first bound uses `theta<=3/4`. The second uses +`theta^2+5h^2<=9/16+5=89/16`. The input `(0,0,3)` attains both error +bounds and the difference bound. Its complete stored path also fits in +four signed bits. The receipt checks all eight residue cases, so there +is no independent-noise relaxation in these constants. + +For a grid spacing Delta, multiply the three bounds by Delta. For N +complex coordinates, apply the law independently to 2N real triples. +The sharp Euclidean bounds are respectively +`3sqrt(2N)Delta/4`, `sqrt(178N)Delta/4`, and `sqrt(10N)Delta`. +Repeat the real maximizing triple in both components of every coordinate +to attain them. These vector bounds still use common coordinates; they +do not include chart transport or caller propagation. + +## Evidence and remaining obligations + +The verifier uses independent rational and integer arithmetic on all +6859 triples in `[-9,9]^3`. It also checks the eight-case complete residue +quotient, exact rational matrices, all prefix translations, the two +exactness domains, attainment, complete source reconstruction and the +first later external read. Three coefficient/sign mutations and signed +truncation toward zero fail the claimed law. Checks use explicit +exceptions and remain active under optimized Python. + +This proof requires a chosen common grid and floor semantics. Other +rounding rules need their own law. Signed range for arbitrary inputs, +the actual native chart maps, reachable caller residues, inherited +approximation before the block, later error propagation, physical +conversion costs and the full sixteen-call precision theorem remain +open. In particular, no error was exhibited on the source's recorded +fine exact grid. The conditional kappa, all five framework assumptions +and the selected frontier are unchanged. diff --git a/research/current-triangle-rounded-contract/README.md b/research/current-triangle-rounded-contract/README.md new file mode 100644 index 0000000000..850d61b2ca --- /dev/null +++ b/research/current-triangle-rounded-contract/README.md @@ -0,0 +1,76 @@ +# Rounded scalar contract for the current three-field repair + +The exact rational identity in +[PR #7669](https://github.com/CrocSwap/integer-mult-bounds/pull/7669) +does not preserve its two scalar tapes under per-ADD floor rounding on +all integer inputs. For x=236,y=544,z=1000, the new rounded tape differs +from the old by `(0,h,2h)`, where `h=floor((z mod 4)/2)`. + +For `(0,1,2)`, the old tape returns the exact value `(1,1,4)`, while the +new tape returns `(1,2,6)`. Both paths fit in four signed bits. The exact +no-rounding domain changes from `2y+z=0 mod 4` to the stronger condition +`z=0 mod 4` and `y=0 mod 2`. The sharp local error against the common +rational map rises from `3/4` to `sqrt(89)/4` ticks per real triple. + +This is a **common-coordinate scalar theorem**. It removes the native +MOVE instructions only in that explicit model. It does not prove that +the actual chart transports commute with rounding, establish caller +reachability, or refute the source's fine exact-grid construction. +There is no new kappa or selected-frontier change. + +Read [PROOF.md](PROOF.md) for the all-integer law, its exact scope and the +sharp vector extension. [RESULT.json](RESULT.json) records all eight +residue cases, each integral prefix translation, the source binding and +fault witnesses. [verify.py](verify.py) reconstructs the complete pinned +candidate, then checks both literal local scalar tapes with separate +rational and integer interpreters. It also checks 6859 signed triples. +The full native, caller and source price replay are not run. + +## Source and decision + +The exact source is `95d476623f1468822057554475dc8badb19bfa44`. The +candidate is `ee251f6005d2a92b887c5b804bd7aac05989d278b2c9ccb3c3091b50d533b08d`. +[SOURCES.json](SOURCES.json) pins the current-main context. +[VENDORED.json](VENDORED.json) pins the six unchanged source files used +for this audit. The copied source directory is a partial dependency +snapshot; it is not the source's complete replay package. + +This takes the source's request to review the changed three-field +identity and rounded precision contract. The rational identity and +exact-grid replay are prior evidence. The new check tests one implication +that those results do not settle. It gives a concrete residue condition +and local error constant for a later transport-aware proof. It does not +supply a free correction, numerical child or physical service tariff. +The complete native/caller precision bill is still unknown here. + +## Reproduce + +Use Python 3.12 and the standard library, from the repository root: + +```sh +python3.12 -B scripts/research_package.py --package research/current-triangle-rounded-contract +``` + +Normal and optimized commands must each print +`PASS_CURRENT_TRIANGLE_ROUNDED_CONTRACT`, followed by the registered +package pass. All input and source files are local and hash-pinned. +No network, third-party library, Lean or Docker is required. + +## Open next questions + +What are the reachable residue classes after the literal native chart +transports at 265,751,927 in the actual sixteen-call service? Bind those +maps and the admitted input grid before using this scalar law as a +caller error bound. The next step is one transport-aware local block +with all three output frames and signed ranges. A coarser rounded grid +must not inherit the fine exact-grid conclusion without this check. + +## Credit + +Prepared by Ali Romman with substantial OpenAI Codex assistance. +SYLforge supplied the source composition, exact edit and three-field +rational identity. DreamingOfClouds, Clear1nsight, ToikY, Rohan Arun, +CubeJerry, Douglas Colkitt and the other native contributors retain the +credit stated in the unchanged [source provenance](source/PROVENANCE.md). +The Mac and 5080 labels name the same contributor's work environments, +not independent human authors. New work is Apache-2.0. diff --git a/research/current-triangle-rounded-contract/RESULT.json b/research/current-triangle-rounded-contract/RESULT.json new file mode 100644 index 0000000000..63293ddf31 --- /dev/null +++ b/research/current-triangle-rounded-contract/RESULT.json @@ -0,0 +1,831 @@ +{ + "binding": { + "source_sha256": "3dd1199d95291ee96e6c0aeb6f55f86244a569b1d4975840bf0207e2dcf9c025", + "candidate_sha256": "ee251f6005d2a92b887c5b804bd7aac05989d278b2c9ccb3c3091b50d533b08d", + "source_window": [ + 97747, + 97753 + ], + "candidate_window": [ + 97842, + 97851 + ], + "first_later_event": [ + "ADD", + 544, + 972, + "1/2", + 927 + ], + "frames": { + "265": [ + 21, + 38, + 448 + ], + "751": [ + 3, + 4, + 17, + 33, + 72, + 392 + ], + "927": [ + 3, + 4, + 17, + 33, + 72, + 128, + 264 + ] + }, + "old_events": [ + [ + "MOVE", + 236, + 265, + 751, + false + ], + [ + "ADD", + 544, + 236, + "-2", + 751 + ], + [ + "MOVE", + 1000, + 265, + 751, + false + ], + [ + "ADD", + 1000, + 544, + "2", + 751 + ], + [ + "ADD", + 236, + 1000, + "1/4", + 751 + ], + [ + "MOVE", + 544, + 751, + 927, + false + ] + ], + "new_events": [ + [ + "ADD", + 236, + 1000, + "1/4", + 265 + ], + [ + "ADD", + 1000, + 236, + "-2", + 265 + ], + [ + "MOVE", + 236, + 265, + 927, + false + ], + [ + "MOVE", + 1000, + 265, + 751, + false + ], + [ + "ADD", + 544, + 1000, + "1/2", + 751 + ], + [ + "ADD", + 1000, + 544, + "2", + 751 + ], + [ + "MOVE", + 544, + 751, + 927, + false + ], + [ + "ADD", + 544, + 236, + "-1", + 927 + ], + [ + "ADD", + 236, + 544, + "1/2", + 927 + ] + ] + }, + "scope": "common-coordinate scalar core; native MOVE transports are not rounded here", + "matrix": [ + [ + "0", + "1/2", + "1/4" + ], + [ + "-2", + "1", + "0" + ], + [ + "-4", + "2", + "1" + ] + ], + "period_generators": [ + [ + 1, + 0, + 0 + ], + [ + 0, + 2, + 0 + ], + [ + 0, + 0, + 4 + ] + ], + "integral_prefix_shifts": [ + { + "tape": "old", + "prefix_length": 0, + "shifts": [ + [ + 1, + 0, + 0 + ], + [ + 0, + 2, + 0 + ], + [ + 0, + 0, + 4 + ] + ] + }, + { + "tape": "old", + "prefix_length": 1, + "shifts": [ + [ + 1, + -2, + 0 + ], + [ + 0, + 2, + 0 + ], + [ + 0, + 0, + 4 + ] + ] + }, + { + "tape": "old", + "prefix_length": 2, + "shifts": [ + [ + 1, + -2, + -4 + ], + [ + 0, + 2, + 4 + ], + [ + 0, + 0, + 4 + ] + ] + }, + { + "tape": "old", + "prefix_length": 3, + "shifts": [ + [ + 0, + -2, + -4 + ], + [ + 1, + 2, + 4 + ], + [ + 1, + 0, + 4 + ] + ] + }, + { + "tape": "new", + "prefix_length": 0, + "shifts": [ + [ + 1, + 0, + 0 + ], + [ + 0, + 2, + 0 + ], + [ + 0, + 0, + 4 + ] + ] + }, + { + "tape": "new", + "prefix_length": 1, + "shifts": [ + [ + 1, + 0, + 0 + ], + [ + 0, + 2, + 0 + ], + [ + 1, + 0, + 4 + ] + ] + }, + { + "tape": "new", + "prefix_length": 2, + "shifts": [ + [ + 1, + 0, + -2 + ], + [ + 0, + 2, + 0 + ], + [ + 1, + 0, + 2 + ] + ] + }, + { + "tape": "new", + "prefix_length": 3, + "shifts": [ + [ + 1, + -1, + -2 + ], + [ + 0, + 2, + 0 + ], + [ + 1, + 1, + 2 + ] + ] + }, + { + "tape": "new", + "prefix_length": 4, + "shifts": [ + [ + 1, + -1, + -4 + ], + [ + 0, + 2, + 4 + ], + [ + 1, + 1, + 4 + ] + ] + }, + { + "tape": "new", + "prefix_length": 5, + "shifts": [ + [ + 1, + -2, + -4 + ], + [ + 0, + 2, + 4 + ], + [ + 1, + 0, + 4 + ] + ] + }, + { + "tape": "new", + "prefix_length": 6, + "shifts": [ + [ + 0, + -2, + -4 + ], + [ + 1, + 2, + 4 + ], + [ + 1, + 0, + 4 + ] + ] + } + ], + "residues": [ + { + "input": [ + 0, + 0, + 0 + ], + "old": [ + 0, + 0, + 0 + ], + "new": [ + 0, + 0, + 0 + ], + "old_exact": true, + "new_exact": true, + "squared_old_error": "0", + "squared_new_error": "0", + "squared_difference": "0" + }, + { + "input": [ + 0, + 0, + 1 + ], + "old": [ + 0, + 0, + 1 + ], + "new": [ + 0, + 0, + 1 + ], + "old_exact": false, + "new_exact": false, + "squared_old_error": "1/16", + "squared_new_error": "1/16", + "squared_difference": "0" + }, + { + "input": [ + 0, + 0, + 2 + ], + "old": [ + 0, + 0, + 2 + ], + "new": [ + 0, + 1, + 4 + ], + "old_exact": false, + "new_exact": false, + "squared_old_error": "1/4", + "squared_new_error": "21/4", + "squared_difference": "5" + }, + { + "input": [ + 0, + 0, + 3 + ], + "old": [ + 0, + 0, + 3 + ], + "new": [ + 0, + 1, + 5 + ], + "old_exact": false, + "new_exact": false, + "squared_old_error": "9/16", + "squared_new_error": "89/16", + "squared_difference": "5" + }, + { + "input": [ + 0, + 1, + 0 + ], + "old": [ + 0, + 1, + 2 + ], + "new": [ + 0, + 1, + 2 + ], + "old_exact": false, + "new_exact": false, + "squared_old_error": "1/4", + "squared_new_error": "1/4", + "squared_difference": "0" + }, + { + "input": [ + 0, + 1, + 1 + ], + "old": [ + 0, + 1, + 3 + ], + "new": [ + 0, + 1, + 3 + ], + "old_exact": false, + "new_exact": false, + "squared_old_error": "9/16", + "squared_new_error": "9/16", + "squared_difference": "0" + }, + { + "input": [ + 0, + 1, + 2 + ], + "old": [ + 1, + 1, + 4 + ], + "new": [ + 1, + 2, + 6 + ], + "old_exact": true, + "new_exact": false, + "squared_old_error": "0", + "squared_new_error": "5", + "squared_difference": "5" + }, + { + "input": [ + 0, + 1, + 3 + ], + "old": [ + 1, + 1, + 5 + ], + "new": [ + 1, + 2, + 7 + ], + "old_exact": false, + "new_exact": false, + "squared_old_error": "1/16", + "squared_new_error": "81/16", + "squared_difference": "5" + } + ], + "signed_box_cases": 6859, + "four_bit_paths": [ + { + "input": [ + 0, + 1, + 2 + ], + "tape": "old", + "states": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 4 + ], + [ + 1, + 1, + 4 + ] + ] + }, + { + "input": [ + 0, + 1, + 2 + ], + "tape": "new", + "states": [ + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 2 + ], + [ + 0, + 1, + 2 + ], + [ + 0, + 2, + 2 + ], + [ + 0, + 2, + 6 + ], + [ + 0, + 2, + 6 + ], + [ + 1, + 2, + 6 + ] + ] + }, + { + "input": [ + 0, + 0, + 3 + ], + "tape": "old", + "states": [ + [ + 0, + 0, + 3 + ], + [ + 0, + 0, + 3 + ], + [ + 0, + 0, + 3 + ], + [ + 0, + 0, + 3 + ] + ] + }, + { + "input": [ + 0, + 0, + 3 + ], + "tape": "new", + "states": [ + [ + 0, + 0, + 3 + ], + [ + 0, + 0, + 3 + ], + [ + 0, + 0, + 3 + ], + [ + 0, + 1, + 3 + ], + [ + 0, + 1, + 5 + ], + [ + 0, + 1, + 5 + ], + [ + 0, + 1, + 5 + ] + ] + } + ], + "old_exact_new_inexact": { + "input": [ + 0, + 1, + 2 + ], + "old": [ + 1, + 1, + 4 + ], + "new": [ + 1, + 2, + 6 + ], + "old_exact": true, + "new_exact": false, + "squared_old_error": "0", + "squared_new_error": "5", + "squared_difference": "5" + }, + "worst_new_error": { + "input": [ + 0, + 0, + 3 + ], + "old": [ + 0, + 0, + 3 + ], + "new": [ + 0, + 1, + 5 + ], + "old_exact": false, + "new_exact": false, + "squared_old_error": "9/16", + "squared_new_error": "89/16", + "squared_difference": "5" + }, + "controls": [ + { + "fault": "wrong first quarter", + "witness": [ + -2, + -2, + 2 + ] + }, + { + "fault": "wrong middle sign", + "witness": [ + -2, + -2, + 2 + ] + }, + { + "fault": "wrong final half", + "witness": [ + -2, + -2, + -2 + ] + }, + { + "fault": "truncate signed fractions toward zero", + "witness": [ + -2, + -2, + -2 + ] + } + ] +} diff --git a/research/current-triangle-rounded-contract/SOURCES.json b/research/current-triangle-rounded-contract/SOURCES.json new file mode 100644 index 0000000000..5335fa97d9 --- /dev/null +++ b/research/current-triangle-rounded-contract/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + } + ] +} diff --git a/research/current-triangle-rounded-contract/TASK.json b/research/current-triangle-rounded-contract/TASK.json new file mode 100644 index 0000000000..c6d0c8e64f --- /dev/null +++ b/research/current-triangle-rounded-contract/TASK.json @@ -0,0 +1,83 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Choose one assumption ID (native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery), one quantified implication and exact dependency closure. Check current handoffs, including #5625 row reentry and #5707 root-prefix lowering, without treating their partial scope as the whole theorem. Prove or falsify that implication with a caller-bound argument; stop at the chosen obligation. Finite tests or root digits do not discharge an all-size statement.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "actual_scope": "All-integer floor-rounding law, exactness domain and sharp local error for the literal PR7669 three-field scalar core.", + "scope_change_reason": "Audit the current source request about the changed three-field identity and scalar precision. Native transports and actual caller reachability remain outside this common-coordinate theorem.", + "bottleneck_link": "Separate exact rational equality from per-ADD rounded replacement; supply the exact residue condition and sharp local constant required by a later transport-aware precision proof.", + "budget_minutes": 60, + "stop_rule": "Stop at the exact source-bound scalar law, source reconstruction and finite corroboration. Do not claim a native/caller error or physical tariff.", + "outcome": "partial", + "evidence": "PROOF.md; RESULT.json; complete reconstruction; eight-case residue quotient; independent rational/integer arithmetic; 6859 signed cases and four arithmetic faults.", + "author": "Ali Romman", + "ai_assistance": "Substantial OpenAI Codex assistance for the proof, code, verification and publication.", + "open_questions": [ + { + "question": "Which residue classes occur after the literal native transports at charts 265,751,927?", + "why_it_matters": "The common-coordinate scalar law is not a caller error bound.", + "first_step": "Bind the actual local native maps, all three output frames, admitted grid and signed ranges.", + "blocked_by": "Transport-aware rounding and actual sixteen-call input reachability." + } + ] +} diff --git a/research/current-triangle-rounded-contract/VENDORED.json b/research/current-triangle-rounded-contract/VENDORED.json new file mode 100644 index 0000000000..11a9ff3a78 --- /dev/null +++ b/research/current-triangle-rounded-contract/VENDORED.json @@ -0,0 +1,52 @@ +{ + "files": [ + { + "path": "source/README.md", + "repository": "SYLforge/integer-mult-bounds", + "commit": "95d476623f1468822057554475dc8badb19bfa44", + "source_path": "research/ee251f60-composition/README.md", + "git_blob": "e3a5a57c053c41fa40150fc8b985ec2542323e78", + "sha256": "fe62fab887429a1daae72d9ef333a68b2d1e61fdaaf326ce5ffb39adc22382e4" + }, + { + "path": "source/PROVENANCE.md", + "repository": "SYLforge/integer-mult-bounds", + "commit": "95d476623f1468822057554475dc8badb19bfa44", + "source_path": "research/ee251f60-composition/PROVENANCE.md", + "git_blob": "f45da332072bd4044ceb7c9a752bc64caefdcc96", + "sha256": "f36ca952da2b24573f2e95ce2490b25b6d0dff9a35557305e4123d16a1ec2e56" + }, + { + "path": "source/EDIT.json", + "repository": "SYLforge/integer-mult-bounds", + "commit": "95d476623f1468822057554475dc8badb19bfa44", + "source_path": "research/ee251f60-composition/EDIT.json", + "git_blob": "23368c8750e6d981ee10664187c6a2c3859be542", + "sha256": "05b84f9578fddc7adc7805f20afdfe5ea679d298b2232d7f718193185f471656" + }, + { + "path": "source/evidence/BUILD.json", + "repository": "SYLforge/integer-mult-bounds", + "commit": "95d476623f1468822057554475dc8badb19bfa44", + "source_path": "research/ee251f60-composition/evidence/BUILD.json", + "git_blob": "17471691487841800604f97706ada2d3ca253b49", + "sha256": "4744201691120223ded62a3e0d55ea1029203f3ea996305163e7db8d9e3679a4" + }, + { + "path": "source/data/K372-2-WORD.json.gz", + "repository": "SYLforge/integer-mult-bounds", + "commit": "95d476623f1468822057554475dc8badb19bfa44", + "source_path": "research/ee251f60-composition/data/K372-2-WORD.json.gz", + "git_blob": "1273c83178693e1627a2324680907f9b0e95e995", + "sha256": "631babeca90e78c5caac713484fe618328b9beee8294baef6ac45ffc9a75dd3b" + }, + { + "path": "source/LICENSE", + "repository": "SYLforge/integer-mult-bounds", + "commit": "95d476623f1468822057554475dc8badb19bfa44", + "source_path": "research/ee251f60-composition/LICENSE", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + } + ] +} diff --git a/research/current-triangle-rounded-contract/VERIFY.json b/research/current-triangle-rounded-contract/VERIFY.json new file mode 100644 index 0000000000..8171e6a46d --- /dev/null +++ b/research/current-triangle-rounded-contract/VERIFY.json @@ -0,0 +1,28 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Complete source reconstruction; exact scalar matrices, integral prefix periods, all eight residues, two arithmetic interpreters, 6859 signed cases and four arithmetic faults." + }, + { + "argv": [ + "{python}", + "-B", + "-O", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Complete source reconstruction; exact scalar matrices, integral prefix periods, all eight residues, two arithmetic interpreters, 6859 signed cases and four arithmetic faults." + } + ] +} diff --git a/research/current-triangle-rounded-contract/source/EDIT.json b/research/current-triangle-rounded-contract/source/EDIT.json new file mode 100644 index 0000000000..23368c8750 --- /dev/null +++ b/research/current-triangle-rounded-contract/source/EDIT.json @@ -0,0 +1,979 @@ +{ + "schema": "source-bound-exact-event-edit/v1", + "source": "3dd1199d95291ee96e6c0aeb6f55f86244a569b1d4975840bf0207e2dcf9c025", + "candidate": "ee251f6005d2a92b887c5b804bd7aac05989d278b2c9ccb3c3091b50d533b08d", + "unchanged_headers": true, + "edits": [ + { + "start": 0, + "stop": 0, + "before": [], + "after": [ + [ + "ADD", + 112, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 113, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 114, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 116, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 117, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 118, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 119, + 607, + "1/2", + 3 + ], + [ + "ADD", + 120, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 122, + 607, + "1/2", + 3 + ], + [ + "ADD", + 123, + 607, + "1/2", + 3 + ], + [ + "ADD", + 137, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 138, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 139, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 140, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 141, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 142, + 607, + "-1", + 3 + ], + [ + "ADD", + 169, + 607, + "1/2", + 3 + ], + [ + "ADD", + 170, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 171, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 172, + 607, + "-1", + 3 + ], + [ + "ADD", + 173, + 607, + "1/4", + 3 + ], + [ + "ADD", + 174, + 607, + "1/2", + 3 + ], + [ + "ADD", + 175, + 607, + "1/2", + 3 + ], + [ + "ADD", + 176, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 177, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 178, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 179, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 180, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 181, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 182, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 183, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 184, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 185, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 186, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 187, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 191, + 607, + "1/2", + 3 + ], + [ + "ADD", + 192, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 193, + 607, + "1/2", + 3 + ], + [ + "ADD", + 194, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 195, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 196, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 198, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 199, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 200, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 201, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 202, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 203, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 204, + 607, + "1/2", + 3 + ], + [ + "ADD", + 206, + 607, + "1/2", + 3 + ], + [ + "ADD", + 207, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 208, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 209, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 228, + 607, + "1/4", + 3 + ], + [ + "ADD", + 236, + 607, + "1/4", + 3 + ], + [ + "ADD", + 255, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 272, + 607, + "1/4", + 3 + ], + [ + "ADD", + 279, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 306, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 311, + 607, + "-1", + 3 + ], + [ + "ADD", + 313, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 316, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 336, + 607, + "1/4", + 3 + ], + [ + "ADD", + 347, + 607, + "1/4", + 3 + ], + [ + "ADD", + 351, + 607, + "1/4", + 3 + ], + [ + "ADD", + 436, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 437, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 438, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 439, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 522, + 607, + "1", + 3 + ], + [ + "ADD", + 530, + 607, + "1", + 3 + ], + [ + "ADD", + 536, + 607, + "1/4", + 3 + ], + [ + "ADD", + 599, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 600, + 607, + "1/4", + 3 + ], + [ + "ADD", + 609, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 611, + 607, + "1/4", + 3 + ], + [ + "ADD", + 617, + 607, + "1/4", + 3 + ], + [ + "ADD", + 625, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 627, + 607, + "1/4", + 3 + ], + [ + "ADD", + 635, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 640, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 655, + 607, + "1/4", + 3 + ], + [ + "ADD", + 697, + 607, + "-1/4", + 3 + ], + [ + "ADD", + 752, + 607, + "17/8", + 3 + ], + [ + "ADD", + 812, + 607, + "1/2", + 3 + ], + [ + "ADD", + 1079, + 607, + "1/2", + 3 + ], + [ + "ADD", + 1122, + 607, + "-1", + 3 + ], + [ + "ADD", + 1176, + 607, + "-1/4", + 3 + ], + [ + "ADD", + 1228, + 607, + "1/8", + 3 + ], + [ + "ADD", + 1233, + 607, + "1/8", + 3 + ], + [ + "ADD", + 1234, + 607, + "1/4", + 3 + ], + [ + "ADD", + 1255, + 607, + "1/4", + 3 + ], + [ + "ADD", + 1265, + 607, + "-1/2", + 3 + ], + [ + "ADD", + 1279, + 607, + "1/8", + 3 + ], + [ + "ADD", + 1331, + 607, + "-1/2", + 3 + ] + ] + }, + { + "start": 87321, + "stop": 87321, + "before": [], + "after": [ + [ + "INIT", + 1551, + 115 + ], + [ + "ADD", + 1551, + 770, + "1", + 115 + ] + ] + }, + { + "start": 96905, + "stop": 96905, + "before": [], + "after": [ + [ + "ADD", + 1279, + 1551, + "-1", + 115 + ] + ] + }, + { + "start": 96959, + "stop": 96961, + "before": [ + [ + "MOVE", + 1517, + 549, + 115, + true + ], + [ + "ADD", + 1517, + 1518, + "1/4", + 115 + ] + ], + "after": [ + [ + "MOVE", + 1517, + 549, + 593, + true + ] + ] + }, + { + "start": 96963, + "stop": 96964, + "before": [ + [ + "MOVE", + 1517, + 115, + 593, + true + ] + ], + "after": [] + }, + { + "start": 97747, + "stop": 97749, + "before": [ + [ + "MOVE", + 236, + 265, + 751, + false + ], + [ + "ADD", + 544, + 236, + "-2", + 751 + ] + ], + "after": [ + [ + "ADD", + 236, + 1000, + "1/4", + 265 + ], + [ + "ADD", + 1000, + 236, + "-2", + 265 + ], + [ + "MOVE", + 236, + 265, + 927, + false + ] + ] + }, + { + "start": 97750, + "stop": 97750, + "before": [], + "after": [ + [ + "ADD", + 544, + 1000, + "1/2", + 751 + ] + ] + }, + { + "start": 97751, + "stop": 97752, + "before": [ + [ + "ADD", + 236, + 1000, + "1/4", + 751 + ] + ], + "after": [] + }, + { + "start": 97753, + "stop": 97753, + "before": [], + "after": [ + [ + "ADD", + 544, + 236, + "-1", + 927 + ], + [ + "ADD", + 236, + 544, + "1/2", + 927 + ] + ] + }, + { + "start": 99687, + "stop": 99687, + "before": [], + "after": [ + [ + "ADD", + 614, + 1551, + "1", + 115 + ] + ] + }, + { + "start": 100116, + "stop": 100117, + "before": [ + [ + "MOVE", + 236, + 751, + 127, + false + ] + ], + "after": [ + [ + "MOVE", + 236, + 927, + 127, + false + ] + ] + }, + { + "start": 150409, + "stop": 150409, + "before": [], + "after": [ + [ + "ADD", + 278, + 770, + "1/2", + 127 + ], + [ + "ADD", + 566, + 770, + "1", + 127 + ], + [ + "ADD", + 567, + 770, + "1/2", + 127 + ], + [ + "ADD", + 612, + 770, + "1", + 127 + ], + [ + "ADD", + 613, + 770, + "1", + 127 + ], + [ + "ADD", + 614, + 770, + "1", + 127 + ], + [ + "ADD", + 1078, + 770, + "1/2", + 127 + ], + [ + "ADD", + 1204, + 770, + "-1/4", + 127 + ], + [ + "ADD", + 1259, + 770, + "-1/4", + 127 + ], + [ + "ADD", + 1280, + 770, + "1", + 127 + ], + [ + "ADD", + 1368, + 770, + "1", + 127 + ], + [ + "ADD", + 1374, + 770, + "2", + 127 + ], + [ + "SCALE", + 770, + "-1", + 127 + ], + [ + "CLEAR", + 1551, + 115 + ] + ] + } + ] +} diff --git a/research/current-triangle-rounded-contract/source/LICENSE b/research/current-triangle-rounded-contract/source/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/research/current-triangle-rounded-contract/source/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/current-triangle-rounded-contract/source/PROVENANCE.md b/research/current-triangle-rounded-contract/source/PROVENANCE.md new file mode 100644 index 0000000000..f45da33207 --- /dev/null +++ b/research/current-triangle-rounded-contract/source/PROVENANCE.md @@ -0,0 +1,29 @@ +# Provenance, credit and scope + +This is a cumulative contribution. Thank you to everyone who has made their constructions, exact inputs, failure cases and careful reviews available. Those contributions made this composition possible; the small increment here should not obscure the much larger body of work it rests on. We aim to leave equally inspectable material for the next researcher. + +## Direct lineage and reused methods + +- **SYLforge, #7637:** the H5B frame-restored233-CLEAR construction is the published ancestor of this research. The present Mac K372-2 source retains its descendants rather than starting a new independent construction. [PR7637](https://github.com/CrocSwap/integer-mult-bounds/pull/7637). +- **DreamingOfClouds, #7641 and #7658:** #7641 combines20 edits over #7637. #7658 supplies the large-neighbourhood construction and its exact joint hub reconstruction: helper360/537 SWAP-NULL relabel, main176 bypass, helper236 contact re-chart, helper370 last-stay removal and helper461 first-stay removal. The source explicitly credits its #7630/#7636 relabel lineage and #7634 swap law. Our source descends from this word; those gains are not claimed as new work here. [PR7641](https://github.com/CrocSwap/integer-mult-bounds/pull/7641), [PR7658](https://github.com/CrocSwap/integer-mult-bounds/pull/7658). +- **Clear1nsight:** the contact re-chart type from #7612 and the24-bit coefficient-splitting report are part of the construction's lineage. #7626 contributed source isolation/portable materialization, and #7631/#7633 are credited by the parent lineage. #7660 separately published the role379 shortcut already present in our source; we do not count its rediscovery as another improvement. [PR7612](https://github.com/CrocSwap/integer-mult-bounds/pull/7612), [coefficient report](https://github.com/CrocSwap/integer-mult-bounds/discussions/7111#discussioncomment-19691406), [PR7660](https://github.com/CrocSwap/integer-mult-bounds/pull/7660). +- **ToikY, #7643:** the contact re-chart work is explicitly credited by #7658 alongside Clear1nsight's #7612. Its74-erasure contract and κ are not added to this candidate. No shared CI repair is copied by this PR. [PR7643](https://github.com/CrocSwap/integer-mult-bounds/pull/7643). +- **Rohan Arun, #7113:** the signed caller/accounting lineage underlies the actual16-call composition. Its original source commit is07a76c5e2738882c0cb322278e56f6cae3c9885d. We recount the literal16-call input here; we do not substitute historical17-call constants. [PR7113](https://github.com/CrocSwap/integer-mult-bounds/pull/7113). +- **Ali Romman and upstream contributors:** #7605 supplies an earlier exact protected/application checkpoint cited by the #7637 lineage. The two unmodified directed invoice comparison files are copied from canonical upstream base e54523517d0f03e58352e647c403a5af3e525a57, retaining their attribution and Apache-2.0 headers. Their arithmetic is not a full scientific acceptance gate. [PR7605](https://github.com/CrocSwap/integer-mult-bounds/pull/7605). +- **CubeJerry, Douglas Colkitt and the earlier source contributors:** the retained framework, primitive/service work and repository infrastructure form part of the inherited basis. This package does not claim that their open supplier obligations are resolved by a successful finite replay. + +## What this contribution adds + +The Mac branch supplied K372-2's five EARLY edits (1188,1013,940,1141,1195, with940/1141 sharing one ADD). The5080 branch recomputed the1517/770 bypass on that actual source and combined it with a three-field triangle repair. The new contribution is their compatible composition, exact12-block edit, final235 CLEAR witnesses and a small reproducible publication package. The two machines are work environments of the same user, not unnamed independent human contributors. Substantial OpenAI Codex assistance was used for research and packaging. New work is Apache-2.0. + +Exact source canonical:3dd1199d95291ee96e6c0aeb6f55f86244a569b1d4975840bf0207e2dcf9c025. Exact candidate canonical:ee251f6005d2a92b887c5b804bd7aac05989d278b2c9ccb3c3091b50d533b08d. Byte hashes are in MANIFEST.json. The12 edit blocks specify every changed event and leave all other fields unchanged. The parent research generators are not silently imported; this publication uses the transparent exact edit as its deterministic reconstruction recipe. + +## Related work, not automatically incorporated + +Ali Romman's #7662 studies one half-ADD rounding-error propagation with CubeJerry's service contract. Nick Petalas's #7654 provides a scoped minimal-rank interpolation result used as background when assessing structural repairs. Neither is a substitute for this candidate's entire rounded caller or physical supply proof. Their actual domains and assumptions must be checked before application. [PR7662](https://github.com/CrocSwap/integer-mult-bounds/pull/7662), [PR7654](https://github.com/CrocSwap/integer-mult-bounds/pull/7654). + +At the publication checkpoint, upstream main remained e54523517d0f03e58352e647c403a5af3e525a57. Ali Romman's #7663 uses a separate17-call full-private-bank model and changed helper endpoints; Clear1nsight's #7664 concerns180erasures/17calls; #7666 charges bank selection and return without claiming a new κ. K372-4 is later, separate research with changed helper-boundary conditions. None is silently folded into ee251f60 or used to assert identical physical assumptions. This is not a claim to the greatest bound across all models. + +## Fresh versus reused evidence + +Publication replay freshly reconstructs the whole word, runs exact rows/CLEAR, recounts native/caller histograms and checks the four directed price points. Normal, optimized Python and a Git-free committed-byte export were tested. The recorded ordinary/precision/native-phase/owner evidence retains its narrower scope and original source identifiers; it is not advertised as freshly rerun. No selected record, frozen predecessor package or common verifier is changed. diff --git a/research/current-triangle-rounded-contract/source/README.md b/research/current-triangle-rounded-contract/source/README.md new file mode 100644 index 0000000000..e3a5a57c05 --- /dev/null +++ b/research/current-triangle-rounded-contract/source/README.md @@ -0,0 +1,44 @@ +# K372-2 / 5080 composition: conditional κ ≥ 0.0037218793483 + +This is the exact **ee251f6005d2a92b887c5b804bd7aac05989d278b2c9ccb3c3091b50d533b08d** candidate, not the later K372-4 research. The declared 16-call invoice has a directed 256-bit crossing in **(0.0037218793483, 0.0037218793484)**. It is cheaper at κ=.00372, not at .00374. This is a conditional computational research contribution, not a complete multiplication theorem or a change to the selected frontier. + +## Change + +The supplied predecessor is Mac K372-2, canonical `3dd1199d95291ee96e6c0aeb6f55f86244a569b1d4975840bf0207e2dcf9c025`, retaining five EARLY edits. The 5080 combination adds: + +1. Owned role 1517 goes directly 549→593 instead of 549→115→593. The actual Mac source row is (input770−input607)/4. A new lifetime of role1551 at chart115 preserves input770; G/F boundary corrections and corrections at roles1279/614 restore the required operator. See `evidence/ROLE770-BUILD.json` and `ROLE770-PROBE.json` for measured rows, coefficients, chronology and the source-bound recipe. +2. The Mac 940/1141 edits share `236 += 1000/4`, which conflicts with simply inserting the earlier 5080 swap. With x=236,y=544,z=1000, the new sequence uses `x+=z/4; z-=2x` at265, `y+=z/2; z+=2y` at751, and `y-=x; x+=y/2` at927. The three values are restored at the local boundary. This costs three additional ADDs and changes two MOVE routes. `evidence/BUILD.json` gives both local tapes and their exact matrix. + +`EDIT.json` is the complete, readable source-bound edit: 12 blocks, seven removed events and120 inserted events, net113. All non-program fields are unchanged. It is a reconstruction recipe for this published candidate, not a new optimization search or a requirement for other researchers. `replay.py` applies the exact preimages and independently checks the resulting complete operator. The earlier exploratory search code is deliberately not bundled; the exact edit, input, certificates and scoped replay are self-contained. + +## Reproduce from a fresh directory + +Python3.12+ standard library; no installation or network needed. From this directory: + +```sh +python -I -B replay.py --out /path/to/a/new/output-directory +``` + +The output path must not already exist. Expected: `PASS_SCOPED_EE251F60_REPLAY`. The run reconstructs the candidate, freshly checks all public rows and every CLEAR, recounts the actual native/caller paid and target histograms, and executes the unchanged project price CLI at four points. It also rejects a changed predecessor, a wrong patch preimage, and an actual arithmetic sign mutation. All source/input bytes are checked before and after. Regenerated gzip container bytes are not the mathematical identity: the complete canonical JSON is compared. + +`src/integer_grid_audit.py` is our separately written exact integer interpreter. It does not import, change, or claim a pass from the original frozen checker. `src/ordinary_tape_audit.py` is reused only for its metadata inventory and literal invoice-count functions; its full ordinary/admission entry point is not run. The two project price files are unmodified copies of base e54523517d0f03e58352e647c403a5af3e525a57. Price success validates declared invoice arithmetic, not a circuit or physical supplier. + +## Evidence and scope + +The candidate has150,522 events:139,735 ADD,4,160 SCALE,6,157 MOVE and235 INIT/CLEAR each. It uses53 of68 reserved labels, peak51 concurrent owned lifetimes. The exact finite check covers1,501 public output rows and235 CLEARs (1,135 witness terms;42 are zero rows). It checks live sources, headers, frame containment, COPY-zero and exact divisions on supplied grid225·2^40; observed minimum denominators were225·2^14 and maximum reduced row numerator20bits. + +Recorded results in `evidence/` are explicitly distinguished from fresh replay. The prior ordinary substitution is raw730,213,664/signed733,928,608, and precision majorant context1324/height339/mass662. The prior16-call phase/owner/occurrence binding and three identical ordered-basis512-forward/512-adjoint/Pauli/phase measurements are reused under their recorded source bindings. No new512-column native run, complete signed application or physical tape execution is performed by this package. The empty unverified-pairs list is not a universal phase proof. + +## Conditions and open next questions + +The five inherited framework assumptions remain. Complete fixed-tape service domain, common-U whole-extent supply and reset tariff, helper325/1087 supply, uniform native/owned/compiler closure, actual rounded16-call error and analytic recovery remain open. The nominal scalar service32 and life count235 do not establish a physical implementation at that tariff. No selected result, shared verifier or acceptance gate is modified. + +1. Review the G/F reconstruction and three-field identity against the retained exact edit and finite witnesses. First step: fresh replay and inspect the12 edit blocks; physical supply is outside this check. +2. Bind the unchanged and changed native services to the complete admitted domain and tariff. First step: audit the recorded ordered-basis evidence and residual obligations; matching finite columns alone is insufficient. +3. Establish the full rounded caller error and analytic recovery. First step: trace changed scalar operations with their actual input domains and charged conversions. + +K372-4 and Ali Romman's later #7663 helper-boundary/private-bank work use changed conditions and are not silently folded into this candidate. A stronger headline from another model is not evidence that its assumptions transfer. Current related work is recorded in `PROVENANCE.md`. + +## Credit and license + +Preserve SYLforge #7637, DreamingOfClouds #7641/#7658, Clear1nsight's24-bit coefficient-splitting contribution, 5080 role379/325/1087 work and Mac EARLY composition. Rohan Arun #7113 supplies the caller and upstream signed-accounting lineage, with CubeJerry, Douglas Colkitt and other source contributors credited in the source records. This composition and package were prepared for SYLforge with substantial OpenAI Codex assistance. Apache-2.0; see LICENSE and PROVENANCE.md. Review or merge does not by itself scientifically validate the conditional claim. diff --git a/research/current-triangle-rounded-contract/source/data/K372-2-WORD.json.gz b/research/current-triangle-rounded-contract/source/data/K372-2-WORD.json.gz new file mode 100644 index 0000000000..1273c83178 Binary files /dev/null and b/research/current-triangle-rounded-contract/source/data/K372-2-WORD.json.gz differ diff --git a/research/current-triangle-rounded-contract/source/evidence/BUILD.json b/research/current-triangle-rounded-contract/source/evidence/BUILD.json new file mode 100644 index 0000000000..1747169148 --- /dev/null +++ b/research/current-triangle-rounded-contract/source/evidence/BUILD.json @@ -0,0 +1 @@ +{"CLEAR_coefficients_unchanged":true,"SCALE_delta":0,"candidate":"ee251f6005d2a92b887c5b804bd7aac05989d278b2c9ccb3c3091b50d533b08d","clear_count":235,"events":150522,"exact_local_identity_verified":true,"exact_local_matrix":[["0","1/2","1/4"],["-2","1","0"],["-4","2","1"]],"inputs_sha256":{"certificates":"49cc8b2737a4338db881416521f7e41e41be144aa8e993bdbb66ace9b5b4cb70","composer":"4df7e7bda29caae84dba183520c46657c25cd28680d6d2fb4a68e0bac5a6bf9b","hits":"a5d4c49a1fc14ca4af1383de33fb9347422607891207c0787dcc6de7736f4b60","word":"d96ddc490dd1c95736189e5fa973b62f6988f9a451f178a194d29ca4f129ab68"},"local_start":97842,"mac_hit_provenance":{"composer_rule":"Once per identical touched tuple, insert chosen ADD before original absolute slot[4]","preserved_hit_indices":[9,11,21,137,99],"selected_hits":{"11":{"chosen":[{"alpha_mod_p":2,"literal_ok":true,"q_est":"2","slot":[11149,249,938,683,98069]}],"item":{"c1":551,"c2":683,"c3":127,"gain":0.014209345760366213,"i1":94395,"i2":101951,"k":3,"kind":"STAY","touched":[94397],"x":1013},"mode":"EARLY"},"137":{"chosen":[{"alpha_mod_p":250000002,"literal_ok":true,"q_est":"1/4","slot":[10431,236,1000,751,97352]}],"item":{"c1":748,"c2":1065,"c3":1072,"gain":0.007123114717961903,"i1":97329,"i2":97333,"k":3,"kind":"STAY","touched":[97331],"x":1141},"mode":"EARLY"},"21":{"chosen":[{"alpha_mod_p":250000002,"literal_ok":true,"q_est":"1/4","slot":[10431,236,1000,751,97352]}],"item":{"c1":449,"c2":1065,"c3":928,"gain":0.01252692319001784,"i1":97330,"i2":97337,"k":1,"kind":"STAY","touched":[97331],"x":940},"mode":"EARLY"},"9":{"chosen":[{"alpha_mod_p":1000000006,"literal_ok":true,"q_est":"-1","slot":[9495,431,895,651,96415]},{"alpha_mod_p":1,"literal_ok":true,"q_est":"1","slot":[9495,431,928,651,96415]}],"item":{"c1":545,"c2":651,"c3":127,"gain":0.014209345760366213,"i1":96390,"i2":101958,"k":3,"kind":"STAY","touched":[96393],"x":1188},"mode":"EARLY"},"99":{"chosen":[{"alpha_mod_p":1000000005,"literal_ok":true,"q_est":"-2","slot":[12543,438,911,911,99464]},{"alpha_mod_p":2,"literal_ok":true,"q_est":"2","slot":[12543,438,925,911,99464]}],"item":{"c1":772,"c2":911,"c3":245,"gain":0.008384152313843303,"i1":99208,"i2":99211,"k":4,"kind":"STAY","touched":[99210],"x":1195},"mode":"EARLY"}},"shared_hit_indices":[21,137],"shared_q":"1/4","shared_slot":[10431,236,1000,751,97352],"shared_touched":[97331]},"new_edge_pairs":[[265,927],[927,127]],"old_local_events":[["MOVE",236,265,751,false],["ADD",544,236,"-2",751],["MOVE",1000,265,751,false],["ADD",1000,544,"2",751],["ADD",236,1000,"1/4",751],["MOVE",544,751,927,false]],"old_x_exit":100212,"original_ADD_indices":[97843,97845,97846],"owned_events_and_lifetimes_unchanged":true,"paid_delta_1e12_at_kappa00374":-1261037596,"paid_profile_delta":{"2":1,"3":-2,"4":1},"ports_byte_sha256":"8e55055da81bddced50a91a35d69504de1e942eac53a7d80080318fd686f13dd","public_headers_unchanged":true,"replacement_local_events":[["ADD",236,1000,"1/4",265],["ADD",1000,236,"-2",265],["MOVE",236,265,927,false],["MOVE",1000,265,751,false],["ADD",544,1000,"1/2",751],["ADD",1000,544,"2",751],["MOVE",544,751,927,false],["ADD",544,236,"-1",927],["ADD",236,544,"1/2",927]],"scalar_ADD_delta":3,"scope":"All three values restored at the local block boundary before the next scalar/CLEAR observation. Original Mac5 hit data and hub tapes preserved. Source certificates remapped with unchanged coefficients. Actual full finite/CLEAR, ordinary/precision, native phase, caller/invoice and supplier checks remain separate.","source":"be33ebb71f8c900315795b130efb457c1bb61cb3d575652b8ddd6dd354902772","source_events":150519,"status":"CONSTRUCTED_LOCAL_TRIANGLE_IDENTITY_FULL_REPLAY_PENDING","tool_byte_sha256":"e9927b125081682973d7ac1e368014a50765c2c7b2d475bfb03930958948b2ed"} \ No newline at end of file diff --git a/research/current-triangle-rounded-contract/verify.py b/research/current-triangle-rounded-contract/verify.py new file mode 100644 index 0000000000..c5a4d79651 --- /dev/null +++ b/research/current-triangle-rounded-contract/verify.py @@ -0,0 +1,193 @@ +#!/usr/bin/env python3 +"""Check the exact rounded scalar law of the pinned three-field repair.""" +from fractions import Fraction as F +from hashlib import sha1, sha256 +from itertools import product +import gzip +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +ROLES = (236, 544, 1000) +SOURCE = '3dd1199d95291ee96e6c0aeb6f55f86244a569b1d4975840bf0207e2dcf9c025' +CANDIDATE = 'ee251f6005d2a92b887c5b804bd7aac05989d278b2c9ccb3c3091b50d533b08d' +MATRIX = ((F(0), F(1, 2), F(1, 4)), (F(-2), F(1), F(0)), (F(-4), F(2), F(1))) +PERIODS = ((1, 0, 0), (0, 2, 0), (0, 0, 4)) + + +def need(ok, reason): + if not ok: + raise ValueError(reason) + + +def encoded(value): + return json.dumps(value, sort_keys=True, separators=(',', ':')).encode() + + +def sources(): + for row in json.loads((HERE / 'VENDORED.json').read_text())['files']: + raw = (HERE / row['path']).read_bytes() + need(sha256(raw).hexdigest() == row['sha256'], 'copied source hash') + need(sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() == row['git_blob'], 'copied source Git blob') + old = json.loads(gzip.decompress((HERE / 'source/data/K372-2-WORD.json.gz').read_bytes())) + edit = json.loads((HERE / 'source/EDIT.json').read_text()) + need(sha256(encoded(old)).hexdigest() == SOURCE == edit['source'], 'complete source identity') + cursor, program = 0, [] + for block in edit['edits']: + start, stop = block['start'], block['stop'] + need(cursor <= start <= stop <= len(old['program']), 'ordered source edit') + need(old['program'][start:stop] == block['before'], 'exact edit preimage') + program.extend(old['program'][cursor:start]) + program.extend(block['after']) + cursor = stop + program.extend(old['program'][cursor:]) + new = dict(old, program=program) + need(sha256(encoded(new)).hexdigest() == CANDIDATE == edit['candidate'], 'complete candidate identity') + before, after = old['program'][97747:97753], program[97842:97851] + build = json.loads((HERE / 'source/evidence/BUILD.json').read_text()) + need(before == build['old_local_events'] and after == build['replacement_local_events'], 'literal local source tapes') + next_event = ['ADD', 544, 972, '1/2', 927] + need(old['program'][97753] == program[97851] == next_event, 'first later external operand') + need([[str(x) for x in row] for row in MATRIX] == build['exact_local_matrix'], 'source rational matrix') + return before, after, {'source_sha256': SOURCE, 'candidate_sha256': CANDIDATE, + 'source_window': [97747, 97753], 'candidate_window': [97842, 97851], + 'first_later_event': next_event, + 'frames': {str(k): old['frames'][k] for k in (265, 751, 927)}, + 'old_events': before, 'new_events': after} + + +def core(events): + result = [] + for event in events: + need(event[0] in ('ADD', 'MOVE'), 'scalar core operation') + need(event[1] in ROLES, 'local output role') + if event[0] == 'ADD': + need(event[2] in ROLES, 'local input role') + result.append((ROLES.index(event[1]), ROLES.index(event[2]), F(event[3]))) + return result + + +def rational_run(tape, point, mode='exact'): + state = list(map(F, point)) + exact = True + for dest, source, coefficient in tape: + value = state[dest] + coefficient * state[source] + exact &= value.denominator == 1 + if mode == 'floor': + value = F(value.numerator // value.denominator) + elif mode == 'truncate': + value = F(int(value)) + state[dest] = value + return tuple(state), exact + + +def integer_run(tape, point): + state = list(point) + for dest, source, coefficient in tape: + state[dest] += coefficient.numerator * state[source] // coefficient.denominator + return tuple(state) + + +def expected(point): + x, y, z = point + old = ((2 * y + z) // 4, y - 2 * x, z + 2 * y - 4 * x) + h = (z % 4) // 2 + new = (old[0], old[1] + h, old[2] + 2 * h) + return old, new + + +def matrix(tape): + columns = [rational_run(tape, [int(i == j) for i in range(3)])[0] for j in range(3)] + return tuple(tuple(columns[j][i] for j in range(3)) for i in range(3)) + + +def squared(values): + return sum(x * x for x in values) + + +def verify_point(old, new, point): + a, exact_a = rational_run(old, point, 'floor') + b, exact_b = rational_run(new, point, 'floor') + need((a, b) == expected(point), 'complete rounded residue law') + need(a == integer_run(old, point) and b == integer_run(new, point), 'independent integer arithmetic') + x, y, z = point + need(exact_a == ((2 * y + z) % 4 == 0), 'old exactness lattice') + need(exact_b == (z % 4 == 0 and y % 2 == 0), 'new exactness lattice') + exact = tuple(sum(row[i] * point[i] for i in range(3)) for row in MATRIX) + old_error = squared([a[i] - exact[i] for i in range(3)]) + new_error = squared([b[i] - exact[i] for i in range(3)]) + difference = squared([a[i] - b[i] for i in range(3)]) + need(old_error <= F(9, 16) and new_error <= F(89, 16) and difference <= 5, 'sharp local error bounds') + return {'input': list(point), 'old': list(map(int, a)), 'new': list(map(int, b)), + 'old_exact': exact_a, 'new_exact': exact_b, + 'squared_old_error': str(old_error), 'squared_new_error': str(new_error), + 'squared_difference': str(difference)} + + +def controls(old, new): + results = [] + for label, index, coefficient in [('wrong first quarter', 0, F(1, 2)), + ('wrong middle sign', 3, F(-2)), + ('wrong final half', 5, F(-1, 2))]: + changed = list(new) + dest, source, _ = changed[index] + changed[index] = (dest, source, coefficient) + need(matrix(changed) != MATRIX, 'arithmetic mutation changes matrix') + witness = next((point for point in product(range(-2, 3), repeat=3) + if rational_run(changed, point, 'floor')[0] != expected(point)[1]), None) + need(witness is not None, 'actual arithmetic mutation detected') + results.append({'fault': label, 'witness': list(witness)}) + witness = next((point for point in product(range(-2, 3), repeat=3) + if rational_run(new, point, 'truncate')[0] != expected(point)[1]), None) + need(witness is not None, 'signed truncation differs from floor') + results.append({'fault': 'truncate signed fractions toward zero', 'witness': list(witness)}) + need(rational_run(old, (0, 1, 2), 'floor')[0] != rational_run(new, (0, 1, 2), 'floor')[0], 'exact matrix does not imply rounded equality') + return results + + +def main(): + before, after, binding = sources() + old, new = core(before), core(after) + need(len(old) == 3 and len(new) == 6 and matrix(old) == matrix(new) == MATRIX, 'exact rational identity') + prefixes = [] + for name, tape in [('old', old), ('new', new)]: + for length in range(len(tape) + 1): + shifts = [rational_run(tape[:length], period)[0] for period in PERIODS] + need(all(x.denominator == 1 for shift in shifts for x in shift), 'every prefix has integral period shifts') + prefixes.append({'tape': name, 'prefix_length': length, 'shifts': [list(map(int, shift)) for shift in shifts]}) + residues = [verify_point(old, new, (0, y, z)) for y in range(2) for z in range(4)] + for point in product(range(-9, 10), repeat=3): + verify_point(old, new, point) + need(max(F(row['squared_old_error']) for row in residues) == F(9, 16), 'old bound attained') + need(max(F(row['squared_new_error']) for row in residues) == F(89, 16), 'new bound attained') + need(max(F(row['squared_difference']) for row in residues) == 5, 'difference bound attained') + need(sum(row['old_exact'] for row in residues) == 2 and sum(row['new_exact'] for row in residues) == 1, 'exactness indices four and eight') + paths = [] + for point in ((0, 1, 2), (0, 0, 3)): + for name, tape in [('old', old), ('new', new)]: + states = [list(map(int, rational_run(tape[:i], point, 'floor')[0])) for i in range(len(tape) + 1)] + need(all(-8 <= value <= 7 for state in states for value in state), 'four-bit witness has no stored overflow') + paths.append({'input': list(point), 'tape': name, 'states': states}) + result = {'binding': binding, 'scope': 'common-coordinate scalar core; native MOVE transports are not rounded here', + 'matrix': [[str(x) for x in row] for row in MATRIX], + 'period_generators': PERIODS, 'integral_prefix_shifts': prefixes, + 'residues': residues, 'signed_box_cases': 19 ** 3, + 'four_bit_paths': paths, + 'old_exact_new_inexact': verify_point(old, new, (0, 1, 2)), + 'worst_new_error': verify_point(old, new, (0, 0, 3)), + 'controls': controls(old, new)} + file = HERE / 'RESULT.json' + if sys.argv[1:] == ['--write']: + need(not file.exists(), 'do not replace checked receipt') + file.write_text(json.dumps(result, indent=2) + '\n') + else: + need(not sys.argv[1:], 'unexpected arguments') + need(encoded(result) == encoded(json.loads(file.read_text())), 'complete result receipt') + print('PASS_CURRENT_TRIANGLE_ROUNDED_CONTRACT ' + json.dumps({'residues': 8, 'signed_cases': 19 ** 3, + 'old_exactness_index': 4, 'new_exactness_index': 8, 'new_squared_error': '89/16', + 'squared_difference': 5, 'controls': len(result['controls'])}, sort_keys=True)) + + +if __name__ == '__main__': + main()